nikawhite pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=28aced23c522d776c269524a49f2366d9c347356
commit 28aced23c522d776c269524a49f2366d9c347356 Author: Mykyta Biliavskyi <[email protected]> Date: Tue Jul 26 20:18:03 2016 +0300 History UI: disable history controls on no changes. --- data/themes/tizen/widgets/button.edc | 124 +++++++++++++++++++++++++++++++---- src/bin/ui/history_ui.c | 36 ++++++++++ 2 files changed, 148 insertions(+), 12 deletions(-) diff --git a/data/themes/tizen/widgets/button.edc b/data/themes/tizen/widgets/button.edc index a729615..ab84d4d 100644 --- a/data/themes/tizen/widgets/button.edc +++ b/data/themes/tizen/widgets/button.edc @@ -428,22 +428,39 @@ group { name: "elm/button/base/hoversel_vertical/history"; max: 9 9; images { image: "WYSIWG/tool_s_ic_arrow_nor.png" COMP; + image: "WYSIWG/tool_s_ic_arrow_mv.png" COMP; + image: "WYSIWG/tool_s_ic_arrow_dim.png" COMP; image: "WYSIWG/tool_s_ic_arrow_sel.png" COMP; } parts { + part { name: "dummy"; + type: SPACER; + description { state: "default" 0.0; + } + description { state: "expanded" 0.0; + } + } part { name: "arrow"; type: IMAGE; - clip_to: "disabler"; description { state: "default" 0.0; fixed: 1 1; min: 9 9; max: 9 9; image.normal: "WYSIWG/tool_s_ic_arrow_nor.png"; + fill.smooth: 0; } description { state: "expanded" 0.0; inherit: "default" 0.00; image.normal: "WYSIWG/tool_s_ic_arrow_sel.png"; } + description { state: "hovered" 0.0; + inherit: "default" 0.00; + image.normal: "WYSIWG/tool_s_ic_arrow_mv.png"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.00; + image.normal: "WYSIWG/tool_s_ic_arrow_dim.png"; + } } part { name: "expand.btn"; type: RECT; @@ -455,43 +472,81 @@ group { name: "elm/button/base/hoversel_vertical/history"; visible: 0; } } - part { name: "disabler"; + part { name: "event"; type: RECT; description { state: "default" 0.0; + color: 0 0 0 0; } - description { state: "active" 0.0; - color: 64 64 64 225; + description { state: "disabled" 0.0; + visible: 0; + color: 0 0 0 0; } } } programs { program { name: "button_click"; signal: "mouse,down,1"; - source: "expand.btn"; + source: "event"; action: SIGNAL_EMIT "elm,action,press" ""; } program { name: "button_unclick"; signal: "mouse,up,1"; - source: "expand.btn"; + source: "event"; action: SIGNAL_EMIT "elm,action,unpress" ""; } program { name: "button_click2"; signal: "mouse,down,1"; - source: "expand.btn"; + source: "event"; action: STATE_SET "expanded" 0.00; target: "arrow"; + target: "dummy"; } program { name: "button_unclick2"; signal: "mouse,up,1"; - source: "expand.btn"; + source: "event"; action: STATE_SET "default" 0.00; + target: "dummy"; target: "arrow"; } program { name: "button_unclick3"; signal: "mouse,clicked,1"; - source: "expand.btn"; + source: "event"; action: SIGNAL_EMIT "elm,action,click" ""; } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.00; + target: "event"; + target: "arrow"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.00; + target: "event"; + target: "arrow"; + } + program { name: "mouse_in"; + signal: "mouse,in"; + source: "event"; + action: STATE_SET "hovered" 0.00; + target: "arrow"; + } + program { name: "mouse_out_exp"; + signal: "mouse,out"; + source: "event"; + filter: "dummy" "default"; + action: STATE_SET "default" 0.00; + target: "arrow"; + } + program { name: "mouse_out"; + signal: "mouse,out"; + source: "event"; + filter: "dummy" "expanded"; + action: STATE_SET "expanded" 0.00; + target: "arrow"; + } } } @@ -1995,18 +2050,21 @@ group { name: "elm/button/base/undo"; min: 20 20; max: 20 20; image.normal: "WYSIWG/tool_s_undo_nor.png"; + fill.smooth: 0; } description { state: "clicked" 0.0; inherit: "default" 0.00; image.normal: "WYSIWG/tool_s_undo_sel.png"; } + description { state: "focused" 0.0; + inherit: "clicked" 0.00; + } description { state: "hilighted" 0.0; inherit: "default" 0.00; image.normal: "WYSIWG/tool_s_undo_mv.png"; } description { state: "disabled" 0.0; inherit: "clicked" 0.00; - color_class: "bg_scroller_disabled"; image.normal: "WYSIWG/tool_s_undo_dim.png"; } } @@ -2067,6 +2125,26 @@ group { name: "elm/button/base/undo"; action: STATE_SET "hilighted" 0.00; target: "icon"; } + program { name: "focused"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "focused" 0.00; + target: "icon"; + } + program { name: "unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + filter: "event" "default"; + action: STATE_SET "default" 0.00; + target: "icon"; + } + program { name: "unfocused_dis"; + signal: "elm,action,unfocus"; + source: "elm"; + filter: "event" "disabled"; + action: STATE_SET "disabled" 0.00; + target: "icon"; + } program { name: "mouse_out"; signal: "mouse,out"; source: "event"; @@ -2113,9 +2191,11 @@ group { name: "elm/button/base/redo"; inherit: "default" 0.00; image.normal: "WYSIWG/tool_s_redo_mv.png"; } + description { state: "focused" 0.0; + inherit: "clicked" 0.00; + } description { state: "disabled" 0.0; inherit: "clicked" 0.00; - color_class: "bg_scroller_disabled"; image.normal: "WYSIWG/tool_s_redo_dim.png"; } } @@ -2195,7 +2275,27 @@ group { name: "elm/button/base/redo"; action: STATE_SET "default" 0.00; target: "icon"; } - } + program { name: "focused"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "focused" 0.00; + target: "icon"; + } + program { name: "unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + filter: "event" "default"; + action: STATE_SET "default" 0.00; + target: "icon"; + } + program { name: "unfocused_dis"; + signal: "elm,action,unfocus"; + source: "elm"; + filter: "event" "disabled"; + action: STATE_SET "disabled" 0.00; + target: "icon"; + } + } } group { name: "elm/button/base/fit"; diff --git a/src/bin/ui/history_ui.c b/src/bin/ui/history_ui.c index 4fce434..8a35d88 100644 --- a/src/bin/ui/history_ui.c +++ b/src/bin/ui/history_ui.c @@ -29,6 +29,8 @@ typedef struct { Evas_Object *layout; Evas_Object *undo_cmbx; Evas_Object *redo_cmbx; + Evas_Object *btn_undo; + Evas_Object *btn_redo; History *history; Group *group; int to_undo; @@ -40,6 +42,32 @@ typedef struct { History_New_UI_data *hd = evas_object_data_get(OBJ, HISTORY_DATA); \ assert(hd != NULL); +static void +_update_ui_controls(History_New_UI_data *hd) +{ + if (hd->to_undo == 0) + { + elm_object_disabled_set(hd->btn_undo, true); + elm_object_disabled_set(hd->undo_cmbx , true); + } + else + { + elm_object_disabled_set(hd->btn_undo, false); + elm_object_disabled_set(hd->undo_cmbx, false); + } + + if (hd->to_redo == 0) + { + elm_object_disabled_set(hd->btn_redo, true); + elm_object_disabled_set(hd->redo_cmbx, true); + } + else + { + elm_object_disabled_set(hd->btn_redo, false); + elm_object_disabled_set(hd->redo_cmbx, false); + } +} + /* first invoke this function, then second */ static void _list_cleanup(History_New_UI_data *hd) @@ -131,6 +159,7 @@ _undo_item_selected(void *data, hd->to_undo--; hd->to_redo++; } + _update_ui_controls(hd); } static void @@ -159,6 +188,7 @@ _redo_item_selected(void *data, hd->to_redo--; hd->to_undo++; } + _update_ui_controls(hd); } void @@ -169,6 +199,7 @@ history_ui_undo(Evas_Object *obj) hd->to_undo--; hd->to_redo++; history_undo(hd->history); + _update_ui_controls(hd); } void @@ -179,6 +210,7 @@ history_ui_redo(Evas_Object *obj) hd->to_redo--; hd->to_undo++; history_redo(hd->history); + _update_ui_controls(hd); } void @@ -187,6 +219,7 @@ history_ui_update(Evas_Object *obj) HISTORY_DATA_GET(obj); hd->to_redo = 0; hd->to_undo++; + _update_ui_controls(hd); } static void @@ -224,6 +257,7 @@ history_ui_add(Evas_Object *parent, History *history) elm_object_style_set(btn, "undo"); evas_object_show(btn); evas_object_smart_callback_add(btn, "clicked", _btn_undo_cb, hd); + hd->btn_undo = btn; Evas_Object *undo_layout = elm_layout_add(hd->layout); elm_layout_theme_set(undo_layout, "layout", "history", "control"); @@ -248,6 +282,7 @@ history_ui_add(Evas_Object *parent, History *history) elm_object_style_set(btn, "redo"); evas_object_show(btn); evas_object_smart_callback_add(btn, "clicked", _btn_redo_cb, hd); + hd->btn_redo = btn; Evas_Object *redo_layout = elm_layout_add(hd->layout); elm_layout_theme_set(redo_layout, "layout", "history", "control"); @@ -267,5 +302,6 @@ history_ui_add(Evas_Object *parent, History *history) elm_object_part_content_set(redo_layout, "arrow", hd->redo_cmbx); elm_object_part_content_set(hd->layout, "redo", redo_layout); + _update_ui_controls(hd); return hd->layout; } --
