editor: split view. allow deletion of views.
If we have split panels let the delete button delete each view in sequence until there are none remaining. Basically the tab close button will do the work. Seems a logical approach.
This commit is contained in:
parent
8bda6d887b
commit
0089d5e100
|
@ -50,6 +50,7 @@ struct _Edi_Editor
|
|||
Edi_Editor_Search *search;
|
||||
Eina_Bool modified;
|
||||
Ecore_Timer *save_timer;
|
||||
Eina_List *split_views;
|
||||
|
||||
#if HAVE_LIBCLANG
|
||||
/* Clang */
|
||||
|
|
|
@ -280,21 +280,6 @@ edi_mainview_open_path(const char *path)
|
|||
edi_mainview_panel_open_path(_current_panel, path);
|
||||
}
|
||||
|
||||
static void
|
||||
_focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Elm_Code *code;
|
||||
const char *path;
|
||||
Edi_Mainview_Panel *panel;
|
||||
Edi_Editor *editor = data;
|
||||
|
||||
code = elm_code_widget_code_get(editor->entry);
|
||||
path = elm_code_file_path_get(code->file);
|
||||
panel = edi_mainview_panel_for_path_get(path);
|
||||
|
||||
edi_mainview_panel_focus(panel);
|
||||
}
|
||||
|
||||
static void
|
||||
_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -329,13 +314,14 @@ void edi_mainview_split_current(void)
|
|||
elm_code_widget_editable_set(widget, EINA_TRUE);
|
||||
elm_code_widget_line_numbers_set(widget, EINA_TRUE);
|
||||
evas_object_smart_callback_add(widget, "changed,user", _changed_cb, editor);
|
||||
evas_object_smart_callback_add(widget, "focused", _focused_cb, editor);
|
||||
edi_editor_widget_config_get(widget);
|
||||
|
||||
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(widget);
|
||||
elm_box_pack_start(panel->current->container, widget);
|
||||
|
||||
editor->split_views = eina_list_append(editor->split_views, widget);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -401,11 +401,23 @@ _closetab(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
Edi_Mainview_Panel *panel;
|
||||
Edi_Mainview_Item *item;
|
||||
Edi_Mainview_State *last;
|
||||
Edi_Editor *editor;
|
||||
int index;
|
||||
|
||||
item = (Edi_Mainview_Item *) data;
|
||||
|
||||
panel = edi_mainview_panel_for_item_get(item);
|
||||
|
||||
editor = (Edi_Editor *) evas_object_data_get(panel->current->view, "editor");
|
||||
if (editor && eina_list_count(editor->split_views))
|
||||
{
|
||||
Elm_Code_Widget *widget = eina_list_nth(editor->split_views, 0);
|
||||
elm_box_unpack(panel->current->container, widget);
|
||||
editor->split_views = eina_list_remove(editor->split_views, widget);
|
||||
evas_object_del(widget);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
edi_mainview_panel_item_close(panel, item);
|
||||
if (eina_list_count(panel->items)== 0 && edi_mainview_panel_count() > 1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue