summaryrefslogtreecommitdiff
path: root/src/bin/controls.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-01-22 15:01:53 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-01-22 15:01:53 +0000
commita0ffffd42dfb5ffc3f77621a8343dc6e02e5ad0d (patch)
tree51965dde40434701c50082fab6ed2376772cf5f2 /src/bin/controls.c
parent1b69c6c544ab1089708a533821ed4b9d8cd4bf38 (diff)
split your terminology man... split it! :)
SVN revision: 83090
Diffstat (limited to 'src/bin/controls.c')
-rw-r--r--src/bin/controls.c154
1 files changed, 138 insertions, 16 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
index 0d80755..7df44fc 100644
--- a/src/bin/controls.c
+++ b/src/bin/controls.c
@@ -5,8 +5,10 @@
5#include "options.h" 5#include "options.h"
6#include "about.h" 6#include "about.h"
7#include "termio.h" 7#include "termio.h"
8#include "main.h"
8 9
9static Evas_Object *ct_frame = NULL, *ct_box = NULL, *ct_over = NULL; 10static Evas_Object *ct_frame = NULL, *ct_boxh = NULL, *ct_box = NULL;
11static Evas_Object *ct_box2 = NULL, *ct_over = NULL;
10static Eina_Bool ct_out = EINA_FALSE; 12static Eina_Bool ct_out = EINA_FALSE;
11static Ecore_Timer *ct_del_timer = NULL; 13static Ecore_Timer *ct_del_timer = NULL;
12static Evas_Object *saved_win = NULL; 14static Evas_Object *saved_win = NULL;
@@ -17,6 +19,11 @@ static Evas_Object *ct_win, *ct_bg, *ct_term;
17static Eina_Bool 19static Eina_Bool
18_cb_ct_del_delay(void *data __UNUSED__) 20_cb_ct_del_delay(void *data __UNUSED__)
19{ 21{
22 if (ct_over)
23 {
24 evas_object_del(ct_over);
25 ct_over = NULL;
26 }
20 evas_object_del(ct_frame); 27 evas_object_del(ct_frame);
21 ct_frame = NULL; 28 ct_frame = NULL;
22 ct_del_timer = NULL; 29 ct_del_timer = NULL;
@@ -39,6 +46,24 @@ _cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
39} 46}
40 47
41static void 48static void
49_cb_ct_split_v(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
50{
51 main_split_v(ct_win, ct_term);
52}
53
54static void
55_cb_ct_split_h(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
56{
57 main_split_h(ct_win, ct_term);
58}
59
60static void
61_cb_ct_close(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
62{
63 main_close(ct_win, ct_term);
64}
65
66static void
42_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 67_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
43{ 68{
44 controls_toggle(ct_win, ct_bg, ct_term); 69 controls_toggle(ct_win, ct_bg, ct_term);
@@ -58,13 +83,43 @@ _cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
58 controls_toggle(saved_win, saved_bg, data); 83 controls_toggle(saved_win, saved_bg, data);
59} 84}
60 85
86static void
87_cb_saved_del(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
88{
89 if ((obj == saved_win) || (obj == saved_bg) || (obj == ct_term))
90 {
91 if (ct_frame)
92 {
93 evas_object_del(ct_frame);
94 ct_frame = NULL;
95 }
96 if (ct_del_timer)
97 {
98 ecore_timer_del(ct_del_timer);
99 ct_del_timer = NULL;
100 }
101 if (ct_over)
102 {
103 evas_object_del(ct_over);
104 ct_over = NULL;
105 }
106 evas_object_event_callback_del(saved_win, EVAS_CALLBACK_DEL, _cb_saved_del);
107 evas_object_event_callback_del(saved_bg, EVAS_CALLBACK_DEL, _cb_saved_del);
108 evas_object_event_callback_del(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del);
109 saved_win = NULL;
110 saved_bg = NULL;
111 ct_win = NULL;
112 ct_bg = NULL;
113 ct_term = NULL;
114 ct_out = EINA_FALSE;
115 }
116}
117
61void 118void
62controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term) 119controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
63{ 120{
64 Evas_Object *o; 121 Evas_Object *o;
65 122
66 saved_win = win;
67 saved_bg = bg;
68 if (!ct_out) 123 if (!ct_out)
69 { 124 {
70 if (options_active_get()) 125 if (options_active_get())
@@ -80,12 +135,52 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
80 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 135 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
81 elm_object_text_set(o, "Controls"); 136 elm_object_text_set(o, "Controls");
82 137
83 ct_box = o = elm_box_add(win); 138 ct_boxh = o = elm_box_add(win);
139 elm_box_horizontal_set(o, EINA_TRUE);
84 elm_object_content_set(ct_frame, o); 140 elm_object_content_set(ct_frame, o);
85 evas_object_show(o); 141 evas_object_show(o);
142
143 ct_box2 = o = elm_box_add(win);
144 elm_box_pack_end(ct_boxh, o);
145 evas_object_show(o);
86 146
87 o = elm_button_add(win); 147 o = elm_button_add(win);
88 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 148 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
149 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
150 elm_object_text_set(o, "|");
151 elm_box_pack_end(ct_box2, o);
152 evas_object_show(o);
153 evas_object_smart_callback_add(o, "clicked", _cb_ct_split_v, NULL);
154
155 o = elm_button_add(win);
156 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
157 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
158 elm_object_text_set(o, "-");
159 elm_box_pack_end(ct_box2, o);
160 evas_object_show(o);
161 evas_object_smart_callback_add(o, "clicked", _cb_ct_split_h, NULL);
162
163 o = elm_button_add(win);
164 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
165 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
166 elm_object_text_set(o, "X");
167 elm_box_pack_end(ct_box2, o);
168 evas_object_show(o);
169 evas_object_smart_callback_add(o, "clicked", _cb_ct_close, NULL);
170
171 o = elm_separator_add(win);
172 evas_object_size_hint_weight_set(o, 0.0, EVAS_HINT_EXPAND);
173 evas_object_size_hint_align_set(o, 0.5, EVAS_HINT_FILL);
174 elm_separator_horizontal_set(o, EINA_FALSE);
175 elm_box_pack_end(ct_boxh, o);
176 evas_object_show(o);
177
178 ct_box = o = elm_box_add(win);
179 elm_box_pack_end(ct_boxh, o);
180 evas_object_show(o);
181
182 o = elm_button_add(win);
183 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
89 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 184 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
90 elm_object_text_set(o, "Copy"); 185 elm_object_text_set(o, "Copy");
91 elm_box_pack_end(ct_box, o); 186 elm_box_pack_end(ct_box, o);
@@ -93,7 +188,7 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
93 evas_object_smart_callback_add(o, "clicked", _cb_ct_copy, term); 188 evas_object_smart_callback_add(o, "clicked", _cb_ct_copy, term);
94 189
95 o = elm_button_add(win); 190 o = elm_button_add(win);
96 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 191 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
97 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 192 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
98 elm_object_text_set(o, "Paste"); 193 elm_object_text_set(o, "Paste");
99 elm_box_pack_end(ct_box, o); 194 elm_box_pack_end(ct_box, o);
@@ -106,9 +201,9 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
106 elm_separator_horizontal_set(o, EINA_TRUE); 201 elm_separator_horizontal_set(o, EINA_TRUE);
107 elm_box_pack_end(ct_box, o); 202 elm_box_pack_end(ct_box, o);
108 evas_object_show(o); 203 evas_object_show(o);
109 204
110 o = elm_button_add(win); 205 o = elm_button_add(win);
111 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 206 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
112 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 207 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
113 elm_object_text_set(o, "Options"); 208 elm_object_text_set(o, "Options");
114 elm_box_pack_end(ct_box, o); 209 elm_box_pack_end(ct_box, o);
@@ -123,18 +218,18 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
123 evas_object_show(o); 218 evas_object_show(o);
124 219
125 o = elm_button_add(win); 220 o = elm_button_add(win);
126 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 221 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
127 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); 222 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
128 elm_object_text_set(o, "About"); 223 elm_object_text_set(o, "About");
129 elm_box_pack_end(ct_box, o); 224 elm_box_pack_end(ct_box, o);
130 evas_object_show(o); 225 evas_object_show(o);
131 evas_object_smart_callback_add(o, "clicked", _cb_ct_about, NULL); 226 evas_object_smart_callback_add(o, "clicked", _cb_ct_about, NULL);
132 227
133 edje_object_part_swallow(bg, "terminology.controls", ct_frame);
134 evas_object_show(ct_frame);
135 } 228 }
136 if (!ct_out) 229 if (!ct_out)
137 { 230 {
231 edje_object_part_swallow(bg, "terminology.controls", ct_frame);
232 evas_object_show(ct_frame);
138 ct_over = o = evas_object_rectangle_add(evas_object_evas_get(win)); 233 ct_over = o = evas_object_rectangle_add(evas_object_evas_get(win));
139 evas_object_color_set(o, 0, 0, 0, 0); 234 evas_object_color_set(o, 0, 0, 0, 0);
140 edje_object_part_swallow(bg, "terminology.dismiss", o); 235 edje_object_part_swallow(bg, "terminology.dismiss", o);
@@ -156,14 +251,41 @@ controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
156 } 251 }
157 else 252 else
158 { 253 {
159 evas_object_del(ct_over); 254 if (ct_over)
160 ct_over = NULL; 255 {
161 256 evas_object_del(ct_over);
162 edje_object_signal_emit(bg, "controls,hide", "terminology"); 257 ct_over = NULL;
258 }
259 edje_object_signal_emit(saved_bg, "controls,hide", "terminology");
163 ct_out = EINA_FALSE; 260 ct_out = EINA_FALSE;
164 elm_object_focus_set(ct_frame, EINA_FALSE); 261 elm_object_focus_set(ct_frame, EINA_FALSE);
165 elm_object_focus_set(term, EINA_TRUE); 262 elm_object_focus_set(ct_term, EINA_TRUE);
166 if (ct_del_timer) ecore_timer_del(ct_del_timer); 263 if (ct_del_timer) ecore_timer_del(ct_del_timer);
167 ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL); 264 ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
265 ct_term = NULL;
266 ct_bg = NULL;
267 ct_win = NULL;
268 }
269 if (saved_win)
270 {
271 evas_object_event_callback_del(saved_win, EVAS_CALLBACK_DEL, _cb_saved_del);
272 evas_object_event_callback_del(saved_bg, EVAS_CALLBACK_DEL, _cb_saved_del);
273 evas_object_event_callback_del(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del);
274 }
275 if (ct_out)
276 {
277 saved_win = win;
278 saved_bg = bg;
279 evas_object_event_callback_add(saved_win, EVAS_CALLBACK_DEL, _cb_saved_del, NULL);
280 evas_object_event_callback_add(saved_bg, EVAS_CALLBACK_DEL, _cb_saved_del, NULL);
281 evas_object_event_callback_add(ct_term, EVAS_CALLBACK_DEL, _cb_saved_del, NULL);
282 }
283 else
284 {
285 saved_win = NULL;
286 saved_bg = NULL;
287 ct_term = NULL;
288 ct_bg = NULL;
289 ct_win = NULL;
168 } 290 }
169} 291}