forked from enlightenment/enventor
multi-file: support the function, go to line.
removed enventor_object_max_line_get() removed enventor_object_goto_line() added enventor_item_max_line_get() added enventor_item_goto_line()
This commit is contained in:
parent
b71d9d2f26
commit
68548afdde
|
@ -41,7 +41,11 @@ error_word_select(Evas_Object *console)
|
||||||
const char *entry_text = enventor_object_text_get(base_enventor_get());
|
const char *entry_text = enventor_object_text_get(base_enventor_get());
|
||||||
char *utf8 = elm_entry_markup_to_utf8(entry_text);
|
char *utf8 = elm_entry_markup_to_utf8(entry_text);
|
||||||
|
|
||||||
enventor_object_line_goto(base_enventor_get(), atoi(error_line));
|
//FIXME: Need to get the file that contains errors.
|
||||||
|
Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get());
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(it);
|
||||||
|
|
||||||
|
enventor_item_line_goto(it, atoi(error_line));
|
||||||
int pos = enventor_object_cursor_pos_get(base_enventor_get());
|
int pos = enventor_object_cursor_pos_get(base_enventor_get());
|
||||||
|
|
||||||
const char *search_line = utf8 + pos * sizeof(char);
|
const char *search_line = utf8 + pos * sizeof(char);
|
||||||
|
|
|
@ -78,7 +78,7 @@ gl_clicked_double_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
//skip non edc file.
|
//skip non edc file.
|
||||||
if (!eina_str_has_extension(file->path, "edc")) return;
|
if (!eina_str_has_extension(file->path, "edc")) return;
|
||||||
|
|
||||||
int selected_file_len = strlen(file->path);
|
unsigned int selected_file_len = strlen(file->path);
|
||||||
|
|
||||||
Enventor_Item *eit;
|
Enventor_Item *eit;
|
||||||
const char *it_file_path;
|
const char *it_file_path;
|
||||||
|
@ -104,7 +104,7 @@ gl_clicked_double_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
if (strlen(file->name) == strlen(it_file_path) &&
|
if (strlen(file->name) == strlen(it_file_path) &&
|
||||||
!strcmp(file->name, it_file_path))
|
!strcmp(file->name, it_file_path))
|
||||||
{
|
{
|
||||||
facade_it_select(eit);
|
file_mgr_file_focus(eit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,13 +123,13 @@ gl_clicked_double_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
//Ok, This selected file is already openend, let's activate the item.
|
//Ok, This selected file is already openend, let's activate the item.
|
||||||
if (!strcmp(file->path, it_file_path))
|
if (!strcmp(file->path, it_file_path))
|
||||||
{
|
{
|
||||||
facade_it_select(eit);
|
file_mgr_file_focus(eit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//This selected file hasn't been opened yet, so let's open this file newly.
|
//This selected file hasn't been opened yet, so let's open this file newly.
|
||||||
facade_sub_file_add(file->path);
|
file_mgr_sub_file_add(file->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Elm_Object_Item *
|
static Elm_Object_Item *
|
||||||
|
|
|
@ -57,7 +57,7 @@ warning_replace_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
file_mgr_data *fmd = data;
|
file_mgr_data *fmd = data;
|
||||||
facade_main_file_set(config_input_path_get());
|
file_mgr_main_file_set(config_input_path_get());
|
||||||
warning_close(fmd);
|
warning_close(fmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,6 @@ file_mgr_edc_save(void)
|
||||||
|
|
||||||
Eina_Bool save_success = enventor_object_save(base_enventor_get(),
|
Eina_Bool save_success = enventor_object_save(base_enventor_get(),
|
||||||
config_input_path_get());
|
config_input_path_get());
|
||||||
|
|
||||||
if (!config_stats_bar_get()) return;
|
if (!config_stats_bar_get()) return;
|
||||||
|
|
||||||
if (save_success)
|
if (save_success)
|
||||||
|
@ -222,3 +221,44 @@ file_mgr_term(void)
|
||||||
|
|
||||||
free(fmd);
|
free(fmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Enventor_Item *
|
||||||
|
file_mgr_sub_file_add(const char *path)
|
||||||
|
{
|
||||||
|
Enventor_Item *it = enventor_object_sub_item_add(base_enventor_get(), path);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
||||||
|
|
||||||
|
file_tab_it_add(it);
|
||||||
|
file_tab_it_select(it);
|
||||||
|
|
||||||
|
file_mgr_file_focus(it);
|
||||||
|
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enventor_Item *
|
||||||
|
file_mgr_main_file_set(const char *path)
|
||||||
|
{
|
||||||
|
Enventor_Item *it = enventor_object_main_item_set(base_enventor_get(), path);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
||||||
|
|
||||||
|
file_tab_clear();
|
||||||
|
file_tab_it_add(it);
|
||||||
|
|
||||||
|
file_mgr_file_focus(it);
|
||||||
|
|
||||||
|
base_console_reset();
|
||||||
|
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
file_mgr_file_focus(Enventor_Item *it)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(it);
|
||||||
|
|
||||||
|
file_tab_it_select(it);
|
||||||
|
enventor_item_focus_set(it);
|
||||||
|
base_text_editor_set(it);
|
||||||
|
base_title_set(enventor_item_file_get(it));
|
||||||
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ list_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
Elm_Object_Item *it = event_info;
|
Elm_Object_Item *it = event_info;
|
||||||
if (fd->selected_it == it) return;
|
if (fd->selected_it == it) return;
|
||||||
file_tab_it *fti = elm_object_item_data_get(it);
|
file_tab_it *fti = elm_object_item_data_get(it);
|
||||||
facade_it_select(fti->enventor_it);
|
file_mgr_file_focus(fti->enventor_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -13,41 +13,3 @@ void mem_fail_msg(void)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void facade_it_select(Enventor_Item *it)
|
|
||||||
{
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN(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_item_add(base_enventor_get(), path);
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
|
||||||
|
|
||||||
file_tab_it_add(it);
|
|
||||||
file_tab_it_select(it);
|
|
||||||
|
|
||||||
facade_it_select(it);
|
|
||||||
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
|
|
||||||
Enventor_Item *facade_main_file_set(const char *path)
|
|
||||||
{
|
|
||||||
Enventor_Item *it = enventor_object_main_item_set(base_enventor_get(), path);
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
|
||||||
|
|
||||||
file_tab_clear();
|
|
||||||
file_tab_it_add(it);
|
|
||||||
|
|
||||||
facade_it_select(it);
|
|
||||||
|
|
||||||
base_console_reset();
|
|
||||||
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ typedef struct goto_s
|
||||||
Evas_Object *entry;
|
Evas_Object *entry;
|
||||||
Evas_Object *btn;
|
Evas_Object *btn;
|
||||||
Ecore_Timer *timer;
|
Ecore_Timer *timer;
|
||||||
|
Enventor_Item *it;
|
||||||
} goto_data;
|
} goto_data;
|
||||||
|
|
||||||
static goto_data *g_gd = NULL;
|
static goto_data *g_gd = NULL;
|
||||||
|
@ -65,7 +66,7 @@ goto_line(goto_data *gd)
|
||||||
const char *txt = elm_entry_entry_get(gd->entry);
|
const char *txt = elm_entry_entry_get(gd->entry);
|
||||||
int line = 0;
|
int line = 0;
|
||||||
if (txt) line = atoi(txt);
|
if (txt) line = atoi(txt);
|
||||||
enventor_object_line_goto(base_enventor_get(), line);
|
enventor_item_line_goto(gd->it, line);
|
||||||
goto_close();
|
goto_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ entry_changed_cb(void *data, Evas_Object *obj, void* event_info EINA_UNUSED)
|
||||||
int line = atoi(txt);
|
int line = atoi(txt);
|
||||||
|
|
||||||
if ((line < 1) ||
|
if ((line < 1) ||
|
||||||
(line > enventor_object_max_line_get(base_enventor_get())))
|
(line > enventor_item_max_line_get(gd->it)))
|
||||||
{
|
{
|
||||||
elm_object_part_text_set(gd->layout, "elm.text.msg",
|
elm_object_part_text_set(gd->layout, "elm.text.msg",
|
||||||
_("Invalid line number"));
|
_("Invalid line number"));
|
||||||
|
@ -146,6 +147,9 @@ goto_open(void)
|
||||||
}
|
}
|
||||||
g_gd = gd;
|
g_gd = gd;
|
||||||
|
|
||||||
|
Enventor_Item *it = enventor_object_focused_item_get(base_enventor_get());
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(it);
|
||||||
|
|
||||||
//Win
|
//Win
|
||||||
Evas_Object *win = elm_win_add(base_win_get(), _("Enventor Goto Line"),
|
Evas_Object *win = elm_win_add(base_win_get(), _("Enventor Goto Line"),
|
||||||
ELM_WIN_DIALOG_BASIC);
|
ELM_WIN_DIALOG_BASIC);
|
||||||
|
@ -174,7 +178,7 @@ goto_open(void)
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf), _("Enter line number [1..%d]:"),
|
snprintf(buf, sizeof(buf), _("Enter line number [1..%d]:"),
|
||||||
enventor_object_max_line_get(base_enventor_get()));
|
enventor_item_max_line_get(it));
|
||||||
elm_object_part_text_set(layout, "elm.text.goto", buf);
|
elm_object_part_text_set(layout, "elm.text.goto", buf);
|
||||||
|
|
||||||
//Entry (line)
|
//Entry (line)
|
||||||
|
@ -217,6 +221,7 @@ goto_open(void)
|
||||||
gd->layout = layout;
|
gd->layout = layout;
|
||||||
gd->entry = entry;
|
gd->entry = entry;
|
||||||
gd->btn = btn;
|
gd->btn = btn;
|
||||||
|
gd->it = it;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
|
|
|
@ -573,7 +573,7 @@ enventor_setup(app_data *ad)
|
||||||
enventor_common_setup(enventor);
|
enventor_common_setup(enventor);
|
||||||
|
|
||||||
base_enventor_set(enventor);
|
base_enventor_set(enventor);
|
||||||
facade_main_file_set(config_input_path_get());
|
file_mgr_main_file_set(config_input_path_get());
|
||||||
base_live_view_set(enventor_object_live_view_get(enventor));
|
base_live_view_set(enventor_object_live_view_get(enventor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
eina_stringshare_del(selected);
|
eina_stringshare_del(selected);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
facade_main_file_set(selected);
|
file_mgr_main_file_set(selected);
|
||||||
}
|
}
|
||||||
else if (is_edj)
|
else if (is_edj)
|
||||||
{
|
{
|
||||||
|
@ -434,7 +434,7 @@ fileselector_load_done_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
config_input_path_set(selected);
|
config_input_path_set(selected);
|
||||||
facade_main_file_set(selected);
|
file_mgr_main_file_set(selected);
|
||||||
fileselector_close(md);
|
fileselector_close(md);
|
||||||
menu_close(md);
|
menu_close(md);
|
||||||
file_mgr_reset();
|
file_mgr_reset();
|
||||||
|
|
|
@ -113,7 +113,7 @@ newfile_set(Eina_Bool template_new)
|
||||||
EINA_LOG_ERR(_("Cannot find file! \"%s\""), buf);
|
EINA_LOG_ERR(_("Cannot find file! \"%s\""), buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
facade_main_file_set(path);
|
file_mgr_main_file_set(path);
|
||||||
file_mgr_reset();
|
file_mgr_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,3 +6,6 @@ void file_mgr_term(void);
|
||||||
int file_mgr_edc_modified_get(void);
|
int file_mgr_edc_modified_get(void);
|
||||||
void file_mgr_reset(void);
|
void file_mgr_reset(void);
|
||||||
void file_mgr_edc_save(void);
|
void file_mgr_edc_save(void);
|
||||||
|
Enventor_Item *file_mgr_main_file_set(const char *path);
|
||||||
|
Enventor_Item *file_mgr_sub_file_add(const char *path);
|
||||||
|
void file_mgr_file_focus(Enventor_Item *it);
|
||||||
|
|
|
@ -3,6 +3,4 @@ extern char EDJE_PATH[PATH_MAX];
|
||||||
extern Eina_Prefix *PREFIX;
|
extern Eina_Prefix *PREFIX;
|
||||||
extern const char *ENVENTOR_NAME;
|
extern const char *ENVENTOR_NAME;
|
||||||
void mem_fail_msg(void);
|
void mem_fail_msg(void);
|
||||||
Enventor_Item *facade_main_file_set(const char *path);
|
|
||||||
Enventor_Item *facade_sub_file_add(const char *path);
|
|
||||||
void facade_it_select(Enventor_Item *it);
|
|
||||||
|
|
|
@ -11,5 +11,7 @@ EAPI Evas_Object *enventor_item_editor_get(const Enventor_Item *it);
|
||||||
EAPI const char *enventor_item_file_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 Enventor_Item *enventor_object_focused_item_get(const Evas_Object *obj);
|
||||||
EAPI Eina_Bool enventor_item_focus_set(Enventor_Item *it);
|
EAPI Eina_Bool enventor_item_focus_set(Enventor_Item *it);
|
||||||
|
EAPI int enventor_item_max_line_get(const Enventor_Item *it);
|
||||||
|
EAPI void enventor_item_line_goto(Enventor_Item *it, int line);
|
||||||
|
|
||||||
#include "enventor_object.eo.legacy.h"
|
#include "enventor_object.eo.legacy.h"
|
||||||
|
|
|
@ -149,9 +149,6 @@ class Enventor.Object (Elm.Widget, Efl.File) {
|
||||||
parts_list_get {
|
parts_list_get {
|
||||||
return: list<char *>;
|
return: list<char *>;
|
||||||
}
|
}
|
||||||
max_line_get {
|
|
||||||
return: int;
|
|
||||||
}
|
|
||||||
text_get {
|
text_get {
|
||||||
return: const(char) *;
|
return: const(char) *;
|
||||||
}
|
}
|
||||||
|
@ -190,11 +187,6 @@ class Enventor.Object (Elm.Widget, Efl.File) {
|
||||||
live_view_get {
|
live_view_get {
|
||||||
return: Efl.Canvas.Object;
|
return: Efl.Canvas.Object;
|
||||||
}
|
}
|
||||||
line_goto {
|
|
||||||
params {
|
|
||||||
@in line: int;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
programs_stop {
|
programs_stop {
|
||||||
}
|
}
|
||||||
program_run {
|
program_run {
|
||||||
|
|
|
@ -769,21 +769,6 @@ _enventor_object_font_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
if (font_style) *font_style = pd->font_style;
|
if (font_style) *font_style = pd->font_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Itemize
|
|
||||||
EOLIAN static int
|
|
||||||
_enventor_object_max_line_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
|
||||||
{
|
|
||||||
return edit_max_line_get(pd->main_it.ed);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Itemize
|
|
||||||
EOLIAN static void
|
|
||||||
_enventor_object_line_goto(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
|
||||||
int line)
|
|
||||||
{
|
|
||||||
edit_goto(pd->main_it.ed, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_enventor_object_syntax_color_set(Eo *obj EINA_UNUSED,
|
_enventor_object_syntax_color_set(Eo *obj EINA_UNUSED,
|
||||||
Enventor_Object_Data *pd,
|
Enventor_Object_Data *pd,
|
||||||
|
@ -1027,7 +1012,7 @@ enventor_object_focused_item_get(const Enventor_Object *obj)
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/* Enventor_Item Functions. */
|
/* Enventor_Item Functions. */
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
Eina_Bool
|
EAPI Eina_Bool
|
||||||
enventor_item_focus_set(Enventor_Item *it)
|
enventor_item_focus_set(Enventor_Item *it)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE);
|
||||||
|
@ -1047,7 +1032,7 @@ enventor_item_focus_set(Enventor_Item *it)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Evas_Object *
|
EAPI Evas_Object *
|
||||||
enventor_item_editor_get(const Enventor_Item *it)
|
enventor_item_editor_get(const Enventor_Item *it)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
||||||
|
@ -1057,7 +1042,7 @@ enventor_item_editor_get(const Enventor_Item *it)
|
||||||
return edit_obj_get(it->ed);
|
return edit_obj_get(it->ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
EAPI const char *
|
||||||
enventor_item_file_get(const Enventor_Item *it)
|
enventor_item_file_get(const Enventor_Item *it)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL);
|
||||||
|
@ -1067,5 +1052,21 @@ enventor_item_file_get(const Enventor_Item *it)
|
||||||
return edit_file_get(it->ed);
|
return edit_file_get(it->ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
enventor_item_max_line_get(const Enventor_Item *it)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(it, 0);
|
||||||
|
|
||||||
|
return edit_max_line_get(it->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
enventor_item_line_goto(Enventor_Item *it, int line)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN(it);
|
||||||
|
|
||||||
|
edit_goto(it->ed, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "enventor_object.eo.c"
|
#include "enventor_object.eo.c"
|
||||||
|
|
Loading…
Reference in New Issue