summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-11-24 14:12:27 +0200
committerYakov Goldberg <yakov.g@samsung.com>2014-11-25 16:41:46 +0200
commite637a4ac8cd2597b4e5f3649a5e3a2e3c84950ad (patch)
tree518ee08c33a48c78a85ae44a36c29f49ec37c635 /src/bin
parentef57aa9ea3f6f01e8fd8e69c28e3d2763674ee3d (diff)
Add start points to settings menu
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/egui_gui/egui_layout.json32
-rw-r--r--src/bin/egui_gui/egui_logic.c4
-rw-r--r--src/bin/egui_gui/prop_layout.c3
-rw-r--r--src/bin/egui_gui/settings_view.c84
-rw-r--r--src/bin/egui_gui/settings_view.h3
5 files changed, 119 insertions, 7 deletions
diff --git a/src/bin/egui_gui/egui_layout.json b/src/bin/egui_gui/egui_layout.json
index ab5a9de..9011622 100644
--- a/src/bin/egui_gui/egui_layout.json
+++ b/src/bin/egui_gui/egui_layout.json
@@ -686,7 +686,9 @@
686 "project_name_label":[0, 0, 1, 1], 686 "project_name_label":[0, 0, 1, 1],
687 "project_name_entry":[1, 0, 1, 1], 687 "project_name_entry":[1, 0, 1, 1],
688 "images_prefix_label":[0, 1, 1, 1], 688 "images_prefix_label":[0, 1, 1, 1],
689 "images_prefix_entry":[1, 1, 1, 1] 689 "images_prefix_entry":[1, 1, 1, 1],
690 "start_points_label":[0, 2, 1, 1],
691 "start_points_genlist":[0, 3, 2, 2]
690 } 692 }
691 }, 693 },
692 "settings_buttons_box": 694 "settings_buttons_box":
@@ -795,6 +797,34 @@
795 "changed,user": ["Invoke", "_settings_apply_button_enable", null] 797 "changed,user": ["Invoke", "_settings_apply_button_enable", null]
796 } 798 }
797 }, 799 },
800 "start_points_label":
801 {
802 "Desc":
803 {
804 "parent":"settings_table",
805 "class":"Elm_Label"
806 },
807 "Properties":
808 {
809 "Elm_Widget.part_text":[null, "Start Points:"],
810 "Evas.Object.visibility":[true]
811 }
812 },
813 "start_points_genlist":
814 {
815 "Desc":
816 {
817 "parent":"settings_table",
818 "class":"Elm_Genlist",
819 "public":true
820 },
821 "Properties":
822 {
823 "Evas.Object.size_hint_weight":[1, 1],
824 "Evas.Object.size_hint_align":[-1, -1],
825 "Evas.Object.visibility":[true]
826 }
827 },
798 "main_win": 828 "main_win":
799 { 829 {
800 "Desc": 830 "Desc":
diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c
index 77a3b65..344d4be 100644
--- a/src/bin/egui_gui/egui_logic.c
+++ b/src/bin/egui_gui/egui_logic.c
@@ -660,7 +660,6 @@ _graphviz_button_clicked_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const E
660 660
661 const Gui_Context *ctx = _active_context_get(); 661 const Gui_Context *ctx = _active_context_get();
662 const Eina_List* start_pts = gui_context_start_points_get(ctx), *itr; 662 const Eina_List* start_pts = gui_context_start_points_get(ctx), *itr;
663 const char *start_pt;
664 Agnode_t *start_node = NULL; 663 Agnode_t *start_node = NULL;
665 Dep_Id *wdg_id; 664 Dep_Id *wdg_id;
666 if (start_pts) 665 if (start_pts)
@@ -670,9 +669,8 @@ _graphviz_button_clicked_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const E
670 agsafeset(start_node, "style", "radial", ""); 669 agsafeset(start_node, "style", "radial", "");
671 agsafeset(start_node, "fillcolor", "white:blue", ""); 670 agsafeset(start_node, "fillcolor", "white:blue", "");
672 } 671 }
673 EINA_LIST_FOREACH(start_pts, itr, start_pt) 672 EINA_LIST_FOREACH(start_pts, itr, wdg_id)
674 { 673 {
675 wdg_id = gui_context_dep_id_by_name_get(ctx, start_pt);
676 const Gui_Widget *wdg = wdg_get(wdg_id); 674 const Gui_Widget *wdg = wdg_get(wdg_id);
677 if (wdg) 675 if (wdg)
678 { 676 {
diff --git a/src/bin/egui_gui/prop_layout.c b/src/bin/egui_gui/prop_layout.c
index 9efe2a8..317f0e9 100644
--- a/src/bin/egui_gui/prop_layout.c
+++ b/src/bin/egui_gui/prop_layout.c
@@ -11,6 +11,7 @@
11#include "cbview.h" 11#include "cbview.h"
12#include "prop_layout.h" 12#include "prop_layout.h"
13#include "itemview.h" 13#include "itemview.h"
14#include "settings_view.h"
14 15
15#include "elm_widget_container.h" 16#include "elm_widget_container.h"
16 17
@@ -301,6 +302,7 @@ proplayout_init()
301 contentview_init(); 302 contentview_init();
302 propview_init(); 303 propview_init();
303 itemview_init(); 304 itemview_init();
305 settingsview_init();
304 306
305 /* Put it here, because it Enums defined in propsview.h */ 307 /* Put it here, because it Enums defined in propsview.h */
306 elm_object_item_data_set(g->main_win->propsview_toolbar_desc_it, (void *) (intptr_t) DESCRIPTION_TYPE); 308 elm_object_item_data_set(g->main_win->propsview_toolbar_desc_it, (void *) (intptr_t) DESCRIPTION_TYPE);
@@ -324,6 +326,7 @@ proplayout_shutdown()
324 elm_genlist_item_class_free(_itc_notfound); 326 elm_genlist_item_class_free(_itc_notfound);
325 _itc_notfound = NULL; 327 _itc_notfound = NULL;
326 328
329 settingsview_shutdown();
327 cbview_shutdown(); 330 cbview_shutdown();
328 descview_shutdown(); 331 descview_shutdown();
329 contentview_shutdown(); 332 contentview_shutdown();
diff --git a/src/bin/egui_gui/settings_view.c b/src/bin/egui_gui/settings_view.c
index 01b44bf..36c7d8b 100644
--- a/src/bin/egui_gui/settings_view.c
+++ b/src/bin/egui_gui/settings_view.c
@@ -13,6 +13,9 @@ static SettingsView_Type _toolbar_selected_type = SETTINGSVIEW_NOT_SELECTED;
13 13
14static Egui_Layout_Settings_Win_Widgets *g_settings_win = NULL; 14static Egui_Layout_Settings_Win_Widgets *g_settings_win = NULL;
15 15
16static Elm_Genlist_Item_Class *_start_pt_itc = NULL;
17static Eina_List *_start_pts = NULL;
18
16void settings_win_set(Egui_Layout_Settings_Win_Widgets *settings_win) 19void settings_win_set(Egui_Layout_Settings_Win_Widgets *settings_win)
17{ 20{
18 if (g_settings_win) free(g_settings_win); 21 if (g_settings_win) free(g_settings_win);
@@ -39,13 +42,27 @@ _settingsview_toolbar_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *ev
39 const Gui_Context *ctx = _active_context_get(); 42 const Gui_Context *ctx = _active_context_get();
40 eo_do(g_settings_win->project_name_entry, elm_obj_widget_part_text_set(NULL, gui_context_project_name_get(ctx))); 43 eo_do(g_settings_win->project_name_entry, elm_obj_widget_part_text_set(NULL, gui_context_project_name_get(ctx)));
41 eo_do(g_settings_win->images_prefix_entry, elm_obj_widget_part_text_set(NULL, gui_context_images_prefix_get(ctx))); 44 eo_do(g_settings_win->images_prefix_entry, elm_obj_widget_part_text_set(NULL, gui_context_images_prefix_get(ctx)));
45
46 elm_genlist_clear(g_settings_win->start_points_genlist);
47 const Eina_List *itr;
48 Dep_Id *wdg_id;
49 EINA_LIST_FOREACH(gui_context_main_widgets_get(ctx), itr, wdg_id)
50 {
51 if (wdg_get(wdg_id))
52 {
53 Eina_Bool state = !!eina_list_data_find(gui_context_start_points_get(ctx), wdg_id);
54 elm_genlist_item_append(g_settings_win->start_points_genlist, _start_pt_itc, (void *) (uintptr_t) wdg_id, NULL,
55 ELM_GENLIST_ITEM_NONE, NULL, NULL);
56 if (state) _start_pts = eina_list_append(_start_pts, wdg_id);
57 }
58 }
42} 59}
43 60
44/* "Apply" button "clicked" callback." */ 61/* "Apply" button "clicked" callback." */
45Eina_Bool 62Eina_Bool
46_settings_apply_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 63_settings_apply_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
47{ 64{
48 const Gui_Context *ctx = _active_context_get(); 65 Gui_Context *ctx = _active_context_get();
49 const char *new_val = NULL, *old_val; 66 const char *new_val = NULL, *old_val;
50 eo_do(g_settings_win->project_name_entry, new_val = elm_obj_widget_part_text_get(NULL)); 67 eo_do(g_settings_win->project_name_entry, new_val = elm_obj_widget_part_text_get(NULL));
51 old_val = gui_context_project_name_get(ctx); 68 old_val = gui_context_project_name_get(ctx);
@@ -53,7 +70,7 @@ _settings_apply_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, cons
53 70
54 if (strlen(new_val) && (strcmp(new_val, old_val))) 71 if (strlen(new_val) && (strcmp(new_val, old_val)))
55 { 72 {
56 gui_context_project_name_set((Gui_Context *) ctx, new_val); 73 gui_context_project_name_set(ctx, new_val);
57 } 74 }
58 else if (!strlen(new_val)) 75 else if (!strlen(new_val))
59 { 76 {
@@ -67,13 +84,19 @@ _settings_apply_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, cons
67 /* FIXME add checks */ 84 /* FIXME add checks */
68 if (new_val) 85 if (new_val)
69 { 86 {
70 gui_context_images_prefix_set((Gui_Context *) ctx, new_val); 87 gui_context_images_prefix_set(ctx, new_val);
71 } 88 }
72 else if (!new_val || !strlen(new_val)) 89 else if (!new_val || !strlen(new_val))
73 { 90 {
74 eo_do(g_settings_win->images_prefix_entry, elm_obj_widget_part_text_set(NULL, old_val)); 91 eo_do(g_settings_win->images_prefix_entry, elm_obj_widget_part_text_set(NULL, old_val));
75 } 92 }
76 93
94 Dep_Id *start_pt_id = NULL;
95 gui_context_start_points_clear(ctx);
96 EINA_LIST_FREE(_start_pts, start_pt_id)
97 gui_context_start_point_append(ctx, start_pt_id);
98 _start_pts = NULL;
99
77 eo_do(g_settings_win->settings_button_apply, elm_obj_widget_disabled_set(EINA_TRUE)); 100 eo_do(g_settings_win->settings_button_apply, elm_obj_widget_disabled_set(EINA_TRUE));
78 return EO_CALLBACK_CONTINUE; 101 return EO_CALLBACK_CONTINUE;
79} 102}
@@ -83,6 +106,8 @@ Eina_Bool
83_settings_win_request_delete(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 106_settings_win_request_delete(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
84{ 107{
85 _toolbar_selected_type = SETTINGSVIEW_NOT_SELECTED; 108 _toolbar_selected_type = SETTINGSVIEW_NOT_SELECTED;
109 eina_list_free(_start_pts);
110 _start_pts = NULL;
86 return EO_CALLBACK_CONTINUE; 111 return EO_CALLBACK_CONTINUE;
87} 112}
88 113
@@ -93,3 +118,56 @@ settings_win_post_configure()
93 eo_do(g_settings_win->settings_toolbar, elm_obj_toolbar_item_append("preferences-system", "Project", 118 eo_do(g_settings_win->settings_toolbar, elm_obj_toolbar_item_append("preferences-system", "Project",
94 _settingsview_toolbar_clicked, (void *) (intptr_t) SETTINGSVIEW_MAIN)); 119 _settingsview_toolbar_clicked, (void *) (intptr_t) SETTINGSVIEW_MAIN));
95} 120}
121
122static Eina_Bool
123_start_pt_chk_chg(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
124{
125 Dep_Id *wdg_id = data;
126 Eina_Bool state = eo_do(obj, elm_obj_check_state_get());
127 if (state)
128 _start_pts = eina_list_append(_start_pts, wdg_id);
129 else
130 _start_pts = eina_list_remove(_start_pts, wdg_id);
131 eo_do(g_settings_win->settings_button_apply, elm_obj_widget_disabled_set(EINA_FALSE));
132 return EINA_TRUE;
133}
134
135static char *
136_start_pt_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
137{
138 Dep_Id *wdg_id = data;
139 const char *wdg_name = dep_name_get(wdg_id);
140 return wdg_name ? strdup(wdg_name) : NULL;
141}
142
143static Evas_Object *
144_start_pt_content_get(void *data, Evas_Object *obj, const char *part)
145{
146 Dep_Id *wdg_id = data;
147 const Gui_Context *ctx = gui_context_get_by_dep_id(wdg_id);
148 Eina_Bool state = !!eina_list_data_find(gui_context_start_points_get(ctx), wdg_id);
149 if (strcmp(part, "elm.swallow.icon")) return NULL;
150 Eo *ck = eo_add(ELM_CHECK_CLASS, obj,
151 eo_event_callback_add(ELM_CHECK_EVENT_CHANGED, _start_pt_chk_chg, wdg_id),
152 elm_obj_check_state_set(state));
153 return ck;
154}
155
156void
157settingsview_init()
158{
159 if (!_start_pt_itc)
160 {
161 _start_pt_itc = elm_genlist_item_class_new();
162 _start_pt_itc->item_style = "default";
163 _start_pt_itc->func.content_get = _start_pt_content_get;
164 _start_pt_itc->func.text_get = _start_pt_text_get;
165 }
166}
167
168void
169settingsview_shutdown()
170{
171 elm_genlist_item_class_free(_start_pt_itc);
172 _start_pt_itc = NULL;
173}
diff --git a/src/bin/egui_gui/settings_view.h b/src/bin/egui_gui/settings_view.h
index 3733168..638e084 100644
--- a/src/bin/egui_gui/settings_view.h
+++ b/src/bin/egui_gui/settings_view.h
@@ -10,6 +10,9 @@ typedef enum
10 SETTINGSVIEW_MAIN 10 SETTINGSVIEW_MAIN
11} SettingsView_Type; 11} SettingsView_Type;
12 12
13void settingsview_init();
14void settingsview_shutdown();
15
13void settings_win_set(Egui_Layout_Settings_Win_Widgets *settings_win); 16void settings_win_set(Egui_Layout_Settings_Win_Widgets *settings_win);
14 17
15void settings_win_post_configure(); 18void settings_win_post_configure();