summaryrefslogtreecommitdiff
path: root/src/bin/controls.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-06-24 06:39:54 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-06-24 06:39:54 +0000
commit256059af6ea44907c0efeed5b9415bfe5fcb4956 (patch)
tree836622af894dc5c844b299d1f1676cb275fff339 /src/bin/controls.c
parentb3003cadc0386e1fa0dc5406e2b011669ad1aa7b (diff)
move current options pane 1 level down and now its a controls pane
with copy, paste and options. copy & paste use clipboard, not primary. SVN revision: 72755
Diffstat (limited to 'src/bin/controls.c')
-rw-r--r--src/bin/controls.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/src/bin/controls.c b/src/bin/controls.c
new file mode 100644
index 0000000..3393c8d
--- /dev/null
+++ b/src/bin/controls.c
@@ -0,0 +1,126 @@
1#include "private.h"
2
3#include <Elementary.h>
4#include "controls.h"
5#include "options.h"
6#include "termio.h"
7
8static Evas_Object *ct_frame, *ct_box = NULL;
9static Eina_Bool ct_out = EINA_FALSE;
10static Ecore_Timer *ct_del_timer = NULL;
11
12static Evas_Object *ct_win, *ct_bg, *ct_term;
13
14static Eina_Bool
15_cb_ct_del_delay(void *data __UNUSED__)
16{
17 evas_object_del(ct_frame);
18 ct_frame = NULL;
19 ct_del_timer = NULL;
20 elm_cache_all_flush();
21 return EINA_FALSE;
22}
23
24static void
25_cb_ct_copy(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
26{
27 controls_toggle(ct_win, ct_bg, ct_term);
28 termio_copy_clipboard(data);
29}
30
31static void
32_cb_ct_paste(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
33{
34 controls_toggle(ct_win, ct_bg, ct_term);
35 termio_paste_clipboard(data);
36}
37
38static void
39_cb_ct_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
40{
41 controls_toggle(ct_win, ct_bg, ct_term);
42 options_toggle(ct_win, ct_bg, ct_term);
43}
44
45void
46controls_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term)
47{
48 Evas_Object *o;
49
50 if (!ct_out)
51 {
52 if (options_active_get())
53 {
54 options_toggle(win, bg, term);
55 return;
56 }
57 }
58 if (!ct_frame)
59 {
60 ct_frame = o = elm_frame_add(win);
61 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
63 elm_object_text_set(o, "Controls");
64
65 ct_box = o = elm_box_add(win);
66 elm_object_content_set(ct_frame, o);
67 evas_object_show(o);
68
69 o = elm_button_add(win);
70 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
72 elm_object_text_set(o, "Copy");
73 elm_box_pack_end(ct_box, o);
74 evas_object_show(o);
75 evas_object_smart_callback_add(o, "clicked", _cb_ct_copy, term);
76
77 o = elm_button_add(win);
78 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
79 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
80 elm_object_text_set(o, "Paste");
81 elm_box_pack_end(ct_box, o);
82 evas_object_show(o);
83 evas_object_smart_callback_add(o, "clicked", _cb_ct_paste, term);
84
85 o = elm_separator_add(win);
86 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
87 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
88 elm_separator_horizontal_set(o, EINA_TRUE);
89 elm_box_pack_end(ct_box, o);
90 evas_object_show(o);
91
92 o = elm_button_add(win);
93 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
94 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
95 elm_object_text_set(o, "Options");
96 elm_box_pack_end(ct_box, o);
97 evas_object_show(o);
98 evas_object_smart_callback_add(o, "clicked", _cb_ct_options, NULL);
99
100 edje_object_part_swallow(bg, "terminology.controls", ct_frame);
101 evas_object_show(ct_frame);
102 }
103 if (!ct_out)
104 {
105 ct_win = win;
106 ct_bg = bg;
107 ct_term = term;
108 edje_object_signal_emit(bg, "controls,show", "terminology");
109 ct_out = EINA_TRUE;
110 elm_object_focus_set(ct_frame, EINA_TRUE);
111 if (ct_del_timer)
112 {
113 ecore_timer_del(ct_del_timer);
114 ct_del_timer = NULL;
115 }
116 }
117 else
118 {
119 edje_object_signal_emit(bg, "controls,hide", "terminology");
120 ct_out = EINA_FALSE;
121 elm_object_focus_set(ct_frame, EINA_FALSE);
122 elm_object_focus_set(term, EINA_TRUE);
123 if (ct_del_timer) ecore_timer_del(ct_del_timer);
124 ct_del_timer = ecore_timer_add(10.0, _cb_ct_del_delay, NULL);
125 }
126}