bin/live_edit: refactoring code.
Just keep the on/off info in live edit. enventor doesn't need to keep it in config since it's mode is volatile.
This commit is contained in:
parent
5c440f6554
commit
12b35145ae
|
@ -33,7 +33,6 @@ typedef struct config_s
|
|||
Eina_Bool tools;
|
||||
Eina_Bool console;
|
||||
Eina_Bool auto_complete;
|
||||
Eina_Bool live_edit;
|
||||
Eina_Bool view_size_configurable;
|
||||
} config_data;
|
||||
|
||||
|
@ -153,7 +152,6 @@ config_load(void)
|
|||
cd->tools = EINA_TRUE;
|
||||
cd->console = EINA_TRUE;
|
||||
cd->auto_complete = EINA_TRUE;
|
||||
cd->live_edit = EINA_FALSE;
|
||||
cd->view_size_configurable = EINA_FALSE;
|
||||
}
|
||||
|
||||
|
@ -675,20 +673,6 @@ config_font_scale_get(void)
|
|||
return cd->font_scale;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_live_edit_get(void)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->live_edit;
|
||||
}
|
||||
|
||||
void
|
||||
config_live_edit_set(Eina_Bool live_edit)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->live_edit = live_edit;
|
||||
}
|
||||
|
||||
void
|
||||
config_auto_complete_set(Eina_Bool auto_complete)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,8 @@ typedef struct live_editor_s
|
|||
cur_part_data *cur_part_data;
|
||||
|
||||
Ecore_Event_Handler *key_down_handler;
|
||||
|
||||
Eina_Bool on : 1;
|
||||
} live_data;
|
||||
|
||||
const int MENU_ITEMS_NUM = 6;
|
||||
|
@ -303,33 +305,39 @@ void
|
|||
live_edit_toggle(void)
|
||||
{
|
||||
live_data *ld = g_ld;
|
||||
Eina_Bool on = !config_live_edit_get();
|
||||
ld->on = !ld->on;
|
||||
Evas_Object *event_obj = enventor_object_live_view_get(ld->enventor);
|
||||
if (!event_obj) return;
|
||||
|
||||
if (on)
|
||||
if (ld->on)
|
||||
{
|
||||
evas_object_event_callback_add(event_obj, EVAS_CALLBACK_MOUSE_UP,
|
||||
layout_mouse_up_cb, ld);
|
||||
stats_info_msg_update("Live View Edit Mode Enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_event_callback_del(event_obj, EVAS_CALLBACK_MOUSE_UP,
|
||||
layout_mouse_up_cb);
|
||||
live_edit_reset(ld);
|
||||
stats_info_msg_update("Live View Edit Mode Disabled.");
|
||||
}
|
||||
enventor_object_disabled_set(ld->enventor, on);
|
||||
|
||||
if (on) stats_info_msg_update("Live View Edit Mode Enabled.");
|
||||
else stats_info_msg_update("Live View Edit Mode Disabled.");
|
||||
enventor_object_disabled_set(ld->enventor, ld->on);
|
||||
}
|
||||
|
||||
config_live_edit_set(on);
|
||||
Eina_Bool
|
||||
live_edit_get(void)
|
||||
{
|
||||
live_data *ld = g_ld;
|
||||
return ld->on;
|
||||
}
|
||||
|
||||
void
|
||||
live_edit_cancel(void)
|
||||
{
|
||||
if (!config_live_edit_get()) return;
|
||||
live_data *ld = g_ld;
|
||||
if (!ld->on) return;
|
||||
live_edit_toggle();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ template_insert_patch(app_data *ad, const char *key)
|
|||
{
|
||||
Edje_Part_Type part_type;
|
||||
|
||||
if (config_live_edit_get())
|
||||
if (live_edit_get())
|
||||
{
|
||||
stats_info_msg_update("Insertion of template code is disabled "
|
||||
"while in Live Edit mode");
|
||||
|
@ -621,7 +621,7 @@ dummy_swallow_toggle(app_data *ad)
|
|||
static void
|
||||
default_template_insert(app_data *ad)
|
||||
{
|
||||
if (config_live_edit_get())
|
||||
if (live_edit_get())
|
||||
{
|
||||
stats_info_msg_update("Insertion of template code is disabled "
|
||||
"while in Live Edit mode");
|
||||
|
|
|
@ -40,8 +40,6 @@ void config_auto_indent_set(Eina_Bool auto_indent);
|
|||
Eina_Bool config_auto_indent_get(void);
|
||||
void config_auto_complete_set(Eina_Bool auto_complete);
|
||||
Eina_Bool config_auto_complete_get(void);
|
||||
Eina_Bool config_live_edit_get(void);
|
||||
void config_live_edit_set(Eina_Bool live_edit);
|
||||
void config_font_scale_set(float font_scale);
|
||||
float config_font_scale_get(void);
|
||||
void config_view_scale_set(double view_scale);
|
||||
|
|
|
@ -2,3 +2,4 @@ void live_edit_init(Evas_Object *enventor);
|
|||
void live_edit_term(void);
|
||||
void live_edit_toggle(void);
|
||||
void live_edit_cancel(void);
|
||||
Eina_Bool live_edit_get(void);
|
||||
|
|
Loading…
Reference in New Issue