bin/console: add auto hiding function.

this is for better intellegent console window.

console will be hidden if any error messages are gone.
This commit is contained in:
Hermet 2015-02-14 18:36:00 +09:00
parent d8f471fd02
commit 04c35e5d8a
9 changed files with 77 additions and 24 deletions

View File

@ -5,6 +5,7 @@ typedef struct base_s
Evas_Object *win;
Evas_Object *layout;
Evas_Object *console;
Eina_Bool console_msg : 1;
} base_data;
static base_data *g_bd = NULL;
@ -44,9 +45,10 @@ void
base_error_msg_set(const char *msg)
{
base_data *bd = g_bd;
if (panes_editors_full_view_get()) base_editors_full_view();
elm_object_signal_emit(bd->layout, "elm,state,alert,show", "");
console_text_set(bd->console, msg);
panes_editors_full_view(EINA_FALSE);
bd->console_msg = EINA_TRUE;
}
void
@ -131,7 +133,7 @@ base_enventor_full_view(void)
void
base_editors_full_view(void)
{
panes_editors_full_view();
base_console_toggle();
}
void
@ -147,9 +149,22 @@ base_live_view_set(Evas_Object *live_view)
}
void
base_console_toggle()
base_console_auto_hide(void)
{
panes_editors_full_view();
base_data *bd = g_bd;
if (!config_console_get()) return;
if (bd->console_msg) return;
panes_editors_full_view(EINA_TRUE);
}
void
base_console_toggle(void)
{
if (panes_editors_full_view_get())
panes_editors_full_view(EINA_FALSE);
else
panes_editors_full_view(EINA_TRUE);
}
void
@ -165,6 +180,8 @@ base_console_reset(void)
{
base_data *bd = g_bd;
console_text_set(bd->console, "");
bd->console_msg = EINA_FALSE;
if (config_console_get()) panes_editors_full_view(EINA_TRUE);
}
Eina_Bool
@ -216,6 +233,9 @@ base_gui_init(void)
Evas_Object *console = console_create(panes);
panes_console_set(console);
if (config_console_get())
panes_editors_full_view(EINA_TRUE);
bd->win = win;
bd->layout = layout;
bd->console = console;

View File

@ -31,6 +31,7 @@ typedef struct config_s
Eina_Bool dummy_swallow;
Eina_Bool auto_indent;
Eina_Bool tools;
Eina_Bool console;
Eina_Bool auto_complete;
Eina_Bool live_edit;
Eina_Bool view_size_configurable;
@ -150,6 +151,7 @@ config_load(void)
cd->dummy_swallow = EINA_TRUE;
cd->auto_indent = EINA_TRUE;
cd->tools = EINA_TRUE;
cd->console = EINA_TRUE;
cd->auto_complete = EINA_TRUE;
cd->live_edit = EINA_FALSE;
cd->view_size_configurable = EINA_FALSE;
@ -243,6 +245,8 @@ eddc_init(void)
auto_indent, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "tools",
tools, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "console",
console, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "auto_complete",
auto_complete, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data,
@ -782,6 +786,20 @@ config_win_size_get(Evas_Coord *w, Evas_Coord *h)
if (h) *h = cd->win_size_h;
}
Eina_Bool
config_console_get(void)
{
config_data *cd = g_cd;
return cd->console;
}
void
config_console_set(Eina_Bool enabled)
{
config_data *cd = g_cd;
cd->console = enabled;
}
Eina_Bool
config_tools_get(void)
{

View File

@ -197,6 +197,7 @@ config_update_cb(void *data)
base_tools_toggle(EINA_FALSE);
base_statusbar_toggle(EINA_FALSE);
base_console_auto_hide();
//previous build was failed, Need to rebuild then reload the edj.
#if 0

View File

@ -63,6 +63,7 @@ v_unpress_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
double origin = elm_panes_content_right_size_get(pd->vert.obj);
if (origin == 0.0) pd->vert.state = PANES_EDITORS_EXPAND;
else pd->vert.state = PANES_SPLIT_VIEW;
}
static void
@ -180,29 +181,30 @@ panes_editors_full_view_get(void)
}
void
panes_editors_full_view(void)
panes_editors_full_view(Eina_Bool full_view)
{
panes_data *pd = g_pd;
//Revert state if the current state is full view bottom already.
if (pd->vert.state == PANES_EDITORS_EXPAND)
if (full_view)
{
panes_v_full_view_cancel(pd);
return;
if (pd->vert.state == PANES_EDITORS_EXPAND) return;
pd->vert.origin = elm_panes_content_right_size_get(pd->vert.obj);
pd->vert.delta = 0.0 - pd->vert.origin;
Elm_Transit *transit = elm_transit_add();
elm_transit_effect_add(transit, transit_op_v, pd, NULL);
elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
elm_transit_duration_set(transit, TRANSIT_TIME);
elm_transit_go(transit);
pd->vert.state = PANES_EDITORS_EXPAND;
}
else
{
//Revert state if the current state is full view bottom already.
if (pd->vert.state == PANES_SPLIT_VIEW) return;
panes_v_full_view_cancel(pd);
}
double origin = elm_panes_content_right_size_get(pd->vert.obj);
if (origin == 0.0) return;
pd->vert.origin = origin;
pd->vert.delta = 0.0 - pd->vert.origin;
Elm_Transit *transit = elm_transit_add();
elm_transit_effect_add(transit, transit_op_v, pd, NULL);
elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
elm_transit_duration_set(transit, TRANSIT_TIME);
elm_transit_go(transit);
pd->vert.state = PANES_EDITORS_EXPAND;
}
void

View File

@ -22,6 +22,7 @@ struct setting_s
Evas_Object *toggle_swallow;
Evas_Object *toggle_stats;
Evas_Object *toggle_tools;
Evas_Object *toggle_console;
Evas_Object *apply_btn;
Evas_Object *reset_btn;
@ -117,6 +118,7 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
config_edc_dat_path_set(elm_object_text_get(sd->dat_path_entry));
config_view_scale_set(elm_slider_value_get(sd->slider_view));
config_tools_set(elm_check_state_get(sd->toggle_tools));
config_console_set(elm_check_state_get(sd->toggle_console));
config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
config_part_highlight_set(elm_check_state_get(sd->toggle_highlight));
config_dummy_swallow_set(elm_check_state_get(sd->toggle_swallow));
@ -158,6 +160,7 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get());
elm_check_state_set(sd->toggle_console, config_console_get());
elm_check_state_set(sd->toggle_tools, config_tools_get());
elm_check_state_set(sd->toggle_stats, config_stats_bar_get());
elm_check_state_set(sd->toggle_highlight, config_part_highlight_get());
@ -385,6 +388,11 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
config_tools_get());
elm_box_pack_end(box, toggle_tools);
//Toggle (Console)
Evas_Object *toggle_console = toggle_create(box, "Auto Hiding Console",
config_console_get());
elm_box_pack_end(box, toggle_console);
sd->general_layout = layout;
sd->img_path_entry = img_path_entry;
sd->snd_path_entry = snd_path_entry;
@ -398,6 +406,7 @@ general_layout_create(setting_data *sd, Evas_Object *parent)
sd->toggle_swallow = toggle_swallow;
sd->toggle_stats = toggle_stats;
sd->toggle_tools = toggle_tools;
sd->toggle_console = toggle_console;
return layout;
}

View File

@ -12,7 +12,7 @@ void base_tools_set(Evas_Object *tools);
void base_enventor_full_view(void);
void base_live_view_full_view(void);
void base_editors_full_view(void);
void base_console_full_view(void);
void base_console_auto_hide(void);
void base_console_toggle(void);
void base_live_view_set(Evas_Object *live_view);
void base_enventor_set(Evas_Object *enventor);

View File

@ -48,6 +48,8 @@ void config_view_scale_set(double view_scale);
double config_view_scale_get(void);
Eina_Bool config_tools_get(void);
void config_tools_set(Eina_Bool enabled);
Eina_Bool config_config_get(void);
void config_config_set(Eina_Bool enabled);
double config_console_size_get(void);
void config_console_size_set(double size);
void config_win_size_get(Evas_Coord *w, Evas_Coord *h);

View File

@ -2,7 +2,7 @@ Evas_Object *panes_init(Evas_Object *parent);
void panes_term(void);
void panes_text_editor_full_view(void);
void panes_live_view_full_view(void);
void panes_editors_full_view(void);
void panes_editors_full_view(Eina_Bool full_view);
void panes_console_full_view(void);
void panes_live_view_set(Evas_Object *live_view);
void panes_text_editor_set(Evas_Object *text_editor);

View File

@ -133,6 +133,7 @@ _enventor_object_evas_object_smart_add(Eo *obj, Enventor_Object_Data *pd)
evas_object_smart_member_add(edit_obj_get(pd->ed), obj);
elm_widget_can_focus_set(obj, EINA_FALSE);
//FIXME: Called twice ?? Why?
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, file_modified_cb, pd);
}