[ui] re-add the undo button, it's back
Now that most keyboard actions can be undone it seemed sensible to get the ui elements back again.
This commit is contained in:
parent
5b1a45cf45
commit
1867697292
|
@ -580,6 +580,13 @@ _tb_close_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNU
|
|||
edi_mainview_close();
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_undo_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_toolbar_item_selected_set(elm_toolbar_selected_item_get(obj), EINA_FALSE);
|
||||
edi_mainview_undo();
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_cut_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -725,6 +732,13 @@ _edi_menu_quit_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
elm_exit();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_undo_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
edi_mainview_undo();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_cut_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -829,6 +843,8 @@ _edi_menu_setup(Evas_Object *win)
|
|||
elm_menu_item_add(menu, menu_it, "application-exit", "Quit", _edi_menu_quit_cb, NULL);
|
||||
|
||||
menu_it = elm_menu_item_add(menu, NULL, NULL, "Edit", NULL, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-undo", "Undo", _edi_menu_undo_cb, NULL);
|
||||
elm_menu_item_separator_add(menu, menu_it);
|
||||
elm_menu_item_add(menu, menu_it, "edit-cut", "Cut", _edi_menu_cut_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-copy", "Copy", _edi_menu_copy_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-paste", "Paste", _edi_menu_paste_cb, NULL);
|
||||
|
@ -879,6 +895,8 @@ edi_toolbar_setup(Evas_Object *win)
|
|||
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
|
||||
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-undo", "Undo", _tb_undo_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-cut", "Cut", _tb_cut_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-copy", "Copy", _tb_copy_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-paste", "Paste", _tb_paste_cb, NULL);
|
||||
|
|
|
@ -523,6 +523,21 @@ edi_mainview_closeall()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
edi_mainview_undo()
|
||||
{
|
||||
Evas_Object *content;
|
||||
Elm_Object_Item *it;
|
||||
Edi_Editor *editor;
|
||||
|
||||
it = elm_naviframe_top_item_get(nf);
|
||||
content = elm_object_item_content_get(it);
|
||||
editor = (Edi_Editor *)evas_object_data_get(content, "editor");
|
||||
|
||||
if (editor)
|
||||
elm_code_widget_undo(editor->entry);
|
||||
}
|
||||
|
||||
void
|
||||
edi_mainview_cut()
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ void edi_mainview_add(Evas_Object *parent, Evas_Object *win);
|
|||
/**
|
||||
* @}
|
||||
*
|
||||
*
|
||||
*
|
||||
* @brief Content management functions.
|
||||
* @defgroup Content
|
||||
*
|
||||
|
@ -117,6 +117,13 @@ void edi_mainview_close();
|
|||
*/
|
||||
void edi_mainview_closeall();
|
||||
|
||||
/**
|
||||
* Undo the most recent change in the current view.
|
||||
*
|
||||
* @ingroup Content
|
||||
*/
|
||||
void edi_mainview_undo();
|
||||
|
||||
/**
|
||||
* Cut the current selection into the clipboard.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue