diff options
author | David Walter Seikel | 2014-05-05 04:58:31 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-05 04:58:31 +1000 |
commit | 811750155227279ae09dc4258f411687f659f690 (patch) | |
tree | f977323dadf1e249e83c3da640d35cb88633113e /src | |
parent | winFang no longer depends on ourGlobals. (diff) | |
download | SledjHamr-811750155227279ae09dc4258f411687f659f690.zip SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.gz SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.bz2 SledjHamr-811750155227279ae09dc4258f411687f659f690.tar.xz |
Merge winFangComplete into winFangAdd.
Diffstat (limited to 'src')
-rw-r--r-- | src/extantz/chat.c | 3 | ||||
-rw-r--r-- | src/extantz/files.c | 3 | ||||
-rw-r--r-- | src/extantz/winFang.c | 67 | ||||
-rw-r--r-- | src/extantz/winFang.h | 3 | ||||
-rw-r--r-- | src/extantz/woMan.c | 3 |
5 files changed, 36 insertions, 43 deletions
diff --git a/src/extantz/chat.c b/src/extantz/chat.c index e0aa9da..5036c95 100644 --- a/src/extantz/chat.c +++ b/src/extantz/chat.c | |||
@@ -16,7 +16,7 @@ winFang *chat_add(globals *ourGlobals) | |||
16 | Widget *wid; | 16 | Widget *wid; |
17 | Evas_Object *bx, *en; | 17 | Evas_Object *bx, *en; |
18 | 18 | ||
19 | me = winFangAdd(ourGlobals->win); | 19 | me = winFangAdd(ourGlobals->win, 30, 500, ourGlobals->win_w / 3, ourGlobals->win_h / 3); |
20 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); | 20 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); |
21 | 21 | ||
22 | bx = eo_add(ELM_OBJ_BOX_CLASS, me->win, | 22 | bx = eo_add(ELM_OBJ_BOX_CLASS, me->win, |
@@ -47,6 +47,5 @@ winFang *chat_add(globals *ourGlobals) | |||
47 | evas_object_show(bx); | 47 | evas_object_show(bx); |
48 | eo_unref(bx); | 48 | eo_unref(bx); |
49 | 49 | ||
50 | winFangComplete(me, 30, 500, ourGlobals->win_w / 3, ourGlobals->win_h / 3); | ||
51 | return me; | 50 | return me; |
52 | } | 51 | } |
diff --git a/src/extantz/files.c b/src/extantz/files.c index 6743deb..254fc5f 100644 --- a/src/extantz/files.c +++ b/src/extantz/files.c | |||
@@ -146,7 +146,7 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
146 | Widget *wid; | 146 | Widget *wid; |
147 | Evas_Object *bx, *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; | 147 | Evas_Object *bx, *vbox, *fs, *bt, *rd = NULL, *rdg = NULL, *hoversel; |
148 | 148 | ||
149 | me = winFangAdd(ourGlobals->win); | 149 | me = winFangAdd(ourGlobals->win, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500); |
150 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); | 150 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); |
151 | 151 | ||
152 | bx = eo_add(ELM_OBJ_BOX_CLASS, me->win, | 152 | bx = eo_add(ELM_OBJ_BOX_CLASS, me->win, |
@@ -278,7 +278,6 @@ winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool sa | |||
278 | eo_unref(vbox); | 278 | eo_unref(vbox); |
279 | eo_unref(bx); | 279 | eo_unref(bx); |
280 | 280 | ||
281 | winFangComplete(me, ourGlobals->win_w - 380, ourGlobals->win_w - 530, 350, 500); | ||
282 | winFangHide(me); | 281 | winFangHide(me); |
283 | return me; | 282 | return me; |
284 | } | 283 | } |
diff --git a/src/extantz/winFang.c b/src/extantz/winFang.c index 830b84e..07fdaa7 100644 --- a/src/extantz/winFang.c +++ b/src/extantz/winFang.c | |||
@@ -67,14 +67,21 @@ void winFangShow(winFang *win) | |||
67 | evas_object_show(win->hand[i]); | 67 | evas_object_show(win->hand[i]); |
68 | } | 68 | } |
69 | 69 | ||
70 | winFang *winFangAdd(Evas_Object *parent) | 70 | winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h) |
71 | { | 71 | { |
72 | winFang *result; | 72 | winFang *result; |
73 | Evas_Object *bg; | 73 | Evas_Object *obj, *obj2, *bg; |
74 | char buf[PATH_MAX]; | ||
75 | int i; | ||
74 | 76 | ||
75 | result = calloc(1, sizeof(winFang)); | 77 | result = calloc(1, sizeof(winFang)); |
76 | eina_clist_init(&result->widgets); | 78 | eina_clist_init(&result->widgets); |
77 | 79 | ||
80 | result->x = x; | ||
81 | result->y = y; | ||
82 | result->w = w; | ||
83 | result->h = h; | ||
84 | |||
78 | // In theory this should create an EWS window, in practice, I'm not seeing any difference. | 85 | // In theory this should create an EWS window, in practice, I'm not seeing any difference. |
79 | // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. | 86 | // Guess I'll have to implement my own internal window manager. I don't think a basic one will be that hard. Famous last words. |
80 | // elm_config_engine_set("ews"); | 87 | // elm_config_engine_set("ews"); |
@@ -92,61 +99,51 @@ winFang *winFangAdd(Evas_Object *parent) | |||
92 | elm_win_resize_object_add(result->win, bg); | 99 | elm_win_resize_object_add(result->win, bg); |
93 | evas_object_show(bg); | 100 | evas_object_show(bg); |
94 | 101 | ||
95 | return result; | 102 | obj = elm_win_inlined_image_object_get(result->win); |
96 | } | 103 | obj2 = evas_object_evas_get(obj); |
97 | |||
98 | void winFangComplete(winFang *win, int x, int y, int w, int h) | ||
99 | { | ||
100 | Evas_Object *obj = elm_win_inlined_image_object_get(win->win); | ||
101 | Evas_Object *obj2 = evas_object_evas_get(obj); | ||
102 | char buf[PATH_MAX]; | ||
103 | int i; | ||
104 | |||
105 | win->x = x; | ||
106 | win->y = y; | ||
107 | win->w = w; | ||
108 | win->h = h; | ||
109 | // image object for win is unlinked to its pos/size - so manual control | 104 | // image object for win is unlinked to its pos/size - so manual control |
110 | // this allows also for using map and other things with it. | 105 | // this allows also for using map and other things with it. |
111 | evas_object_move(obj, x, y); | 106 | evas_object_move(obj, result->x, result->y); |
112 | // Odd, it needs to be resized twice. WTF? | 107 | // Odd, it needs to be resized twice. WTF? |
113 | evas_object_resize(win->win, w, h); | 108 | evas_object_resize(result->win, result->w, result->h); |
114 | evas_object_resize(obj, w, h); | 109 | evas_object_resize(obj, result->w, result->h); |
115 | evas_object_show(win->win); | 110 | evas_object_show(result->win); |
116 | 111 | ||
117 | // Create corner handles. | 112 | // Create corner handles. |
118 | snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); | 113 | snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); |
119 | for (i = 0; i < 4; i++) | 114 | for (i = 0; i < 4; i++) |
120 | { | 115 | { |
121 | char key[32]; | 116 | char key[32]; |
122 | int cx = x, cy = y; | 117 | int cx = result->x, cy = result->y; |
123 | 118 | ||
124 | if (i == 1) cx += w; | 119 | if (i == 1) cx += result->w; |
125 | else if (i == 2) {cx += w; cy += h;} | 120 | else if (i == 2) {cx += result->w; cy += result->h;} |
126 | else if (i == 3) cy += h; | 121 | else if (i == 3) cy += result->h; |
127 | snprintf(key, sizeof(key), "h-%i\n", i); | 122 | snprintf(key, sizeof(key), "h-%i\n", i); |
128 | #if 1 | 123 | #if 1 |
129 | win->hand[i] = evas_object_image_filled_add(obj2); | 124 | result->hand[i] = evas_object_image_filled_add(obj2); |
130 | evas_object_image_file_set(win->hand[i], buf, NULL); | 125 | evas_object_image_file_set(result->hand[i], buf, NULL); |
131 | evas_object_resize(win->hand[i], 31, 31); | 126 | evas_object_resize(result->hand[i], 31, 31); |
132 | evas_object_move(win->hand[i], cx - 15, cy - 15); | 127 | evas_object_move(result->hand[i], cx - 15, cy - 15); |
133 | evas_object_data_set(obj, key, win->hand[i]); | 128 | evas_object_data_set(obj, key, result->hand[i]); |
134 | evas_object_show(win->hand[i]); | 129 | evas_object_show(result->hand[i]); |
135 | evas_object_event_callback_add(win->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); | 130 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); |
136 | #else | 131 | #else |
137 | // TODO - No idea why, but using this version makes the window vanish when you click on a handle. | 132 | // TODO - No idea why, but using this version makes the window vanish when you click on a handle. |
138 | win->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, obj2, | 133 | result->hand[i] = eo_add(EVAS_OBJ_IMAGE_CLASS, obj2, |
139 | evas_obj_image_filled_set(EINA_TRUE), | 134 | evas_obj_image_filled_set(EINA_TRUE), |
140 | evas_obj_image_file_set(buf, NULL), | 135 | evas_obj_image_file_set(buf, NULL), |
141 | evas_obj_size_set(31, 31), | 136 | evas_obj_size_set(31, 31), |
142 | evas_obj_position_set(cx - 15, cy - 15), | 137 | evas_obj_position_set(cx - 15, cy - 15), |
143 | eo_key_data_set(key, win->hand[i], NULL), | 138 | eo_key_data_set(key, result->hand[i], NULL), |
144 | evas_obj_visibility_set(EINA_TRUE) | 139 | evas_obj_visibility_set(EINA_TRUE) |
145 | ); | 140 | ); |
146 | evas_object_event_callback_add(win->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); | 141 | evas_object_event_callback_add(result->hand[i], EVAS_CALLBACK_MOUSE_MOVE, cb_mouse_move, obj); |
147 | eo_unref(win->hand[i]); | 142 | eo_unref(result->hand[i]); |
148 | #endif | 143 | #endif |
149 | } | 144 | } |
145 | |||
146 | return result; | ||
150 | } | 147 | } |
151 | 148 | ||
152 | void winFangDel(winFang *win) | 149 | void winFangDel(winFang *win) |
diff --git a/src/extantz/winFang.h b/src/extantz/winFang.h index 49c7889..478fb4e 100644 --- a/src/extantz/winFang.h +++ b/src/extantz/winFang.h | |||
@@ -30,8 +30,7 @@ typedef struct _Widget | |||
30 | Evas_Smart_Cb on_del; | 30 | Evas_Smart_Cb on_del; |
31 | } Widget; | 31 | } Widget; |
32 | 32 | ||
33 | winFang *winFangAdd(Evas_Object *parent); | 33 | winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h); |
34 | void winFangComplete(winFang *win, int x, int y, int w, int h); | ||
35 | void winFangHide(winFang *win); | 34 | void winFangHide(winFang *win); |
36 | void winFangShow(winFang *win); | 35 | void winFangShow(winFang *win); |
37 | void winFangDel(winFang *win); | 36 | void winFangDel(winFang *win); |
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c index b5a4f50..dc9c8e0 100644 --- a/src/extantz/woMan.c +++ b/src/extantz/woMan.c | |||
@@ -159,7 +159,7 @@ winFang *woMan_add(globals *ourGlobals) | |||
159 | char buf[PATH_MAX]; | 159 | char buf[PATH_MAX]; |
160 | int i; | 160 | int i; |
161 | 161 | ||
162 | me = winFangAdd(ourGlobals->win); | 162 | me = winFangAdd(ourGlobals->win, 30, 30, ourGlobals->win_w / 3, ourGlobals->win_h / 3); |
163 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); | 163 | eina_clist_add_head(&ourGlobals->winFangs, &me->node); |
164 | 164 | ||
165 | bx = elm_box_add(me->win); | 165 | bx = elm_box_add(me->win); |
@@ -287,6 +287,5 @@ winFang *woMan_add(globals *ourGlobals) | |||
287 | eo_unref(bt); | 287 | eo_unref(bt); |
288 | evas_object_show(bx); | 288 | evas_object_show(bx); |
289 | 289 | ||
290 | winFangComplete(me, 30, 30, ourGlobals->win_w / 3, ourGlobals->win_h / 3); | ||
291 | return me; | 290 | return me; |
292 | } | 291 | } |