forked from enlightenment/enventor
++ multi file support.
This commit is contained in:
parent
f4cf6703bb
commit
8c13d63a8e
|
@ -88,16 +88,16 @@ gl_clicked_double_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
if (!it_file_path) continue;
|
||||
if (selected_file_len != strlen(it_file_path)) continue;
|
||||
|
||||
//Ok, This selected file is already openend, let's activte the item.
|
||||
//Ok, This selected file is already openend, let's activate the item.
|
||||
if (!strcmp(file->path, it_file_path))
|
||||
{
|
||||
//TODO:
|
||||
facade_it_select(eit);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//This selected file hasn't been opened yet, so let's open this file newly.
|
||||
facade_sub_file_set(file->path);
|
||||
facade_sub_file_add(file->path);
|
||||
}
|
||||
|
||||
static Elm_Object_Item *
|
||||
|
|
|
@ -10,8 +10,6 @@ typedef struct file_tab_s
|
|||
typedef struct file_tab_it_s
|
||||
{
|
||||
Enventor_Item *enventor_it;
|
||||
file_data *fd;
|
||||
|
||||
} file_tab_it;
|
||||
|
||||
file_data *g_fd = NULL;
|
||||
|
@ -49,10 +47,21 @@ right_btn_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
list_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info)
|
||||
{
|
||||
file_data *fd = data;
|
||||
Elm_Object_Item *it = event_info;
|
||||
if (fd->selected_it == it) return;
|
||||
file_tab_it *fti = elm_object_item_data_get(it);
|
||||
facade_it_select(fti->enventor_it);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Externally accessible calls */
|
||||
/*****************************************************************************/
|
||||
Eina_Bool file_tab_it_selected_set(Enventor_Item *enventor_it)
|
||||
Eina_Bool file_tab_it_select(Enventor_Item *enventor_it)
|
||||
{
|
||||
file_data *fd = g_fd;
|
||||
if (!fd) return EINA_FALSE;
|
||||
|
@ -65,8 +74,8 @@ Eina_Bool file_tab_it_selected_set(Enventor_Item *enventor_it)
|
|||
{
|
||||
file_tab_it *fti = elm_object_item_data_get(it);
|
||||
if (fti->enventor_it != enventor_it) continue;
|
||||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
fd->selected_it = it;
|
||||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -127,7 +136,8 @@ Eina_Bool file_tab_it_add(Enventor_Item *enventor_it)
|
|||
|
||||
fti->enventor_it = enventor_it;
|
||||
|
||||
elm_list_item_append(fd->list, filename, NULL, NULL, NULL, fti);
|
||||
elm_list_item_append(fd->list, filename, NULL, NULL, list_item_selected_cb,
|
||||
fti);
|
||||
elm_list_go(fd->list);
|
||||
|
||||
free(filename);
|
||||
|
|
|
@ -7,22 +7,30 @@
|
|||
const char *DEFAULT_EDC_FORMAT = "enventor_XXXXXX.edc";
|
||||
char EDJE_PATH[PATH_MAX];
|
||||
const char *ENVENTOR_NAME = "enventor";
|
||||
Enventor_Item *active_item = NULL;
|
||||
|
||||
void mem_fail_msg(void)
|
||||
{
|
||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||
}
|
||||
|
||||
Enventor_Item *facade_sub_file_set(const char *path)
|
||||
void facade_it_select(Enventor_Item *it)
|
||||
{
|
||||
file_tab_it_select(it);
|
||||
enventor_item_focus_set(it);
|
||||
base_text_editor_set(it);
|
||||
base_title_set(enventor_item_file_get(it));
|
||||
}
|
||||
|
||||
Enventor_Item *facade_sub_file_add(const char *path)
|
||||
{
|
||||
Enventor_Item *it = enventor_object_sub_file_add(base_enventor_get(), path);
|
||||
if (!it) return NULL;
|
||||
|
||||
file_tab_it_add(it);
|
||||
file_tab_it_selected_set(it);
|
||||
file_tab_it_select(it);
|
||||
|
||||
base_text_editor_set(it);
|
||||
base_title_set(path);
|
||||
facade_it_select(it);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
@ -34,10 +42,9 @@ Enventor_Item *facade_main_file_set(const char *path)
|
|||
|
||||
file_tab_clear();
|
||||
file_tab_it_add(it);
|
||||
file_tab_it_selected_set(it);
|
||||
|
||||
base_text_editor_set(it);
|
||||
base_title_set(path);
|
||||
facade_it_select(it);
|
||||
|
||||
base_console_reset();
|
||||
|
||||
return it;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
typedef struct app_s
|
||||
{
|
||||
Evas_Object *keygrabber;
|
||||
Enventor_Item *main_it;
|
||||
Eina_Bool on_saving : 1;
|
||||
Eina_Bool lazy_save : 1;
|
||||
} app_data;
|
||||
|
@ -183,10 +182,14 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *ev)
|
|||
}
|
||||
|
||||
//Font Size
|
||||
//FIXME: probably here main_it could be changeable. we need to figure out
|
||||
//which item is currently set up.
|
||||
evas_object_geometry_get(enventor_item_editor_get(ad->main_it),
|
||||
&x, &y, &w, &h);
|
||||
Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get());
|
||||
if (!it)
|
||||
{
|
||||
EINA_LOG_ERR("No focused enventor item??");
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
evas_object_geometry_get(enventor_item_editor_get(it), &x, &y, &w, &h);
|
||||
|
||||
if ((event->x >= x) && (event->x <= (x + w)) &&
|
||||
(event->y >= y) && (event->y <= (y + h)))
|
||||
|
@ -593,7 +596,7 @@ enventor_setup(app_data *ad)
|
|||
enventor_common_setup(enventor);
|
||||
|
||||
base_enventor_set(enventor);
|
||||
ad->main_it = facade_main_file_set(config_input_path_get());
|
||||
facade_main_file_set(config_input_path_get());
|
||||
base_live_view_set(enventor_object_live_view_get(enventor));
|
||||
}
|
||||
|
||||
|
|
|
@ -285,6 +285,8 @@ void
|
|||
panes_text_editor_set(Evas_Object *text_editor)
|
||||
{
|
||||
panes_data *pd = g_pd;
|
||||
Evas_Object *prev = elm_object_content_unset(pd->text_tool_layout);
|
||||
evas_object_hide(prev);
|
||||
elm_object_content_set(pd->text_tool_layout, text_editor);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Evas_Object *file_tab_init(Evas_Object *parent);
|
||||
void file_tab_term(void);
|
||||
Eina_Bool file_tab_it_add(Enventor_Item *it);
|
||||
Eina_Bool file_tab_it_selected_set(Enventor_Item *enventor_it);
|
||||
Eina_Bool file_tab_it_select(Enventor_Item *enventor_it);
|
||||
void file_tab_disabled_set(Eina_Bool disabled);
|
||||
void file_tab_clear(void);
|
||||
|
|
|
@ -4,4 +4,5 @@ extern Eina_Prefix *PREFIX;
|
|||
extern const char *ENVENTOR_NAME;
|
||||
void mem_fail_msg(void);
|
||||
Enventor_Item *facade_main_file_set(const char *path);
|
||||
Enventor_Item *facade_sub_file_set(const char *path);
|
||||
Enventor_Item *facade_sub_file_add(const char *path);
|
||||
void facade_it_select(Enventor_Item *it);
|
||||
|
|
|
@ -8,4 +8,7 @@ EAPI Enventor_Item *enventor_object_sub_file_add(Evas_Object *obj, const char *f
|
|||
EAPI const Eina_List *enventor_object_sub_items_get(const Evas_Object *obj);
|
||||
EAPI Evas_Object *enventor_item_editor_get(const Enventor_Item *it);
|
||||
EAPI const char *enventor_item_file_get(const Enventor_Item *it);
|
||||
EAPI Enventor_Item *enventor_object_focused_item_get(const Evas_Object *obj);
|
||||
EAPI Eina_Bool enventor_item_focus_set(Enventor_Item *it);
|
||||
|
||||
#include "enventor_object.eo.legacy.h"
|
||||
|
|
|
@ -302,13 +302,13 @@ macro_list_free(Eina_List *macro_list)
|
|||
static void
|
||||
cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
#define PART_SYNTAX_CNT 13
|
||||
#define PART_SYNTAX_CNT 14
|
||||
|
||||
const char *GROUP = "group";
|
||||
const char *PARTS = "parts";
|
||||
const char *PART[PART_SYNTAX_CNT] = { "part", "image", "textblock",
|
||||
"swallow", "rect", "group", "spacer", "proxy", "text", "gradient",
|
||||
"box", "table", "external" };
|
||||
"box", "table", "external", "vector" };
|
||||
const char *DESC[2] = { "desc", "description" };
|
||||
const int DESC_LEN[2] = { 4, 11 };
|
||||
const char *STATE = "state";
|
||||
|
@ -528,8 +528,8 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
//Check Group in
|
||||
if (bracket == 1)
|
||||
//Check Group in. Probably inside of collections or the most outside.
|
||||
if (bracket < 2)
|
||||
{
|
||||
if (!strncmp(p, GROUP, strlen(GROUP)))
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ struct _Enventor_Object_Data
|
|||
Enventor_Object *obj;
|
||||
Enventor_Item_Data main_it;
|
||||
Eina_List *sub_its;
|
||||
Enventor_Item *focused_it;
|
||||
|
||||
Eina_Stringshare *group_name;
|
||||
|
||||
|
@ -998,6 +999,7 @@ enventor_object_main_file_set(Enventor_Object *obj, const char *file)
|
|||
pd->main_it.enventor = obj;
|
||||
pd->main_it.ed = edit_init(obj);
|
||||
edit_view_sync_cb_set(pd->main_it.ed, edit_view_sync_cb, pd);
|
||||
pd->focused_it = &pd->main_it;
|
||||
|
||||
Eina_Bool ret = efl_file_set(obj, file, NULL);
|
||||
if (!ret) return NULL;
|
||||
|
@ -1020,9 +1022,31 @@ enventor_object_sub_items_get(const Enventor_Object *obj)
|
|||
return pd->sub_its;
|
||||
}
|
||||
|
||||
EAPI Enventor_Item *
|
||||
enventor_object_focused_item_get(const Enventor_Object *obj)
|
||||
{
|
||||
Enventor_Object_Data *pd = eo_data_scope_get(obj, ENVENTOR_OBJECT_CLASS);
|
||||
return pd->focused_it;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/* Enventor_Item Functions. */
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Eina_Bool
|
||||
enventor_item_focus_set(Enventor_Item *it)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE);
|
||||
|
||||
Enventor_Object *obj = it->enventor;
|
||||
Enventor_Object_Data *pd = eo_data_scope_get(obj, ENVENTOR_OBJECT_CLASS);
|
||||
|
||||
edit_view_sync_cb_set(it->ed, edit_view_sync_cb, pd);
|
||||
|
||||
pd->focused_it = it;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
enventor_item_editor_get(const Enventor_Item *it)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue