editor: fix initial max line 0 issue.

Update max line correctly of the statusbar.
This fix brought Enventor_Max_Line passed away
because Enventor_Cursor_Line can be used instead.

@fix
This commit is contained in:
Hermet Park 2016-03-05 00:26:41 +09:00
parent da5134a165
commit 7795dbe101
3 changed files with 19 additions and 18 deletions

View File

@ -392,7 +392,7 @@ enventor_cursor_line_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event_info)
{
Enventor_Cursor_Line *cur_line = (Enventor_Cursor_Line *)event_info;
stats_line_num_update(cur_line->line, enventor_object_max_line_get(obj));
stats_line_num_update(cur_line->cur_line, cur_line->max_line);
}
static void
@ -520,6 +520,8 @@ static void
enventor_setup(app_data *ad)
{
Evas_Object *enventor = enventor_object_add(base_layout_get());
evas_object_smart_callback_add(enventor, "max_line,changed",
enventor_cursor_line_changed_cb, ad);
evas_object_smart_callback_add(enventor, "cursor,line,changed",
enventor_cursor_line_changed_cb, ad);
evas_object_smart_callback_add(enventor, "cursor,group,changed",

View File

@ -50,14 +50,10 @@ typedef struct
typedef struct
{
int line;
int cur_line;
int max_line;
} Enventor_Cursor_Line;
typedef struct
{
int line;
} Enventor_Max_Line;
typedef struct
{
Eina_Bool self_changed : 1;

View File

@ -800,7 +800,8 @@ cur_line_pos_set(edit_data *ed, Eina_Bool force)
ed->cur_line = line;
Enventor_Cursor_Line cur_line;
cur_line.line = line;
cur_line.cur_line = line;
cur_line.max_line = ed->line_max;
evas_object_smart_callback_call(ed->enventor, SIG_CURSOR_LINE_CHANGED,
&cur_line);
}
@ -1008,7 +1009,6 @@ static Eina_Bool
edit_edc_load(edit_data *ed, const char *file_path)
{
char buf[MAX_LINE_DIGIT_CNT];
Eina_File *file = NULL;
Eina_Strbuf *strbuf_line = NULL;
Eina_Stringshare *group_name = NULL;
@ -1093,10 +1093,11 @@ err:
if (utf8_edit) eina_file_map_free(file, utf8_edit);
if (file) eina_file_close(file);
Enventor_Max_Line max_line;
max_line.line = ed->line_max;
Enventor_Cursor_Line cursor_line;
cursor_line.cur_line = ed->cur_line;
cursor_line.max_line = ed->line_max;
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
&max_line);
&cursor_line);
if (ed->view_sync_cb)
ed->view_sync_cb(ed->view_sync_cb_data, NULL, 0.0, NULL, group_name);
@ -1737,10 +1738,11 @@ edit_line_increase(edit_data *ed, int cnt)
}
elm_entry_calc_force(ed->en_line);
Enventor_Max_Line max_line;
max_line.line = ed->line_max;
Enventor_Cursor_Line cur_line;
cur_line.cur_line = ed->cur_line;
cur_line.max_line = ed->line_max;
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
&max_line);
&cur_line);
}
void
@ -1771,10 +1773,11 @@ edit_line_decrease(edit_data *ed, int cnt)
if (ed->line_max < 1) line_init(ed);
Enventor_Max_Line max_line;
max_line.line = ed->line_max;
Enventor_Cursor_Line cur_line;
cur_line.cur_line = ed->cur_line;
cur_line.max_line = ed->line_max;
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
&max_line);
&cur_line);
}
void