1 #include "e.h"
2
3 static void *_create_data(E_Config_Dialog *cfd);
4 static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
5 static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
6 static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
7 static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
8
9 struct _E_Config_Dialog_Data
10 {
11 int move_info_visible;
12 int move_info_follows;
13 int resize_info_visible;
14 int resize_info_follows;
15 int window_maximize_animate;
16 int window_maximize_transition;
17 double window_maximize_time;
18 int border_shade_animate;
19 int border_shade_transition;
20 double border_shade_speed;
21 int use_app_icon;
22 int window_placement_policy;
23 int window_grouping;
24 int desk_auto_switch;
25 int screen_limits;
26
27 };
28
29 /* a nice easy setup function that does the dirty work */
30 E_Config_Dialog *
e_int_config_window_display(Evas_Object * parent EINA_UNUSED,const char * params EINA_UNUSED)31 e_int_config_window_display(Evas_Object *parent EINA_UNUSED, const char *params EINA_UNUSED)
32 {
33 E_Config_Dialog *cfd;
34 E_Config_Dialog_View *v;
35
36 if (e_config_dialog_find("E", "windows/window_display")) return NULL;
37 v = E_NEW(E_Config_Dialog_View, 1);
38
39 /* methods */
40 v->create_cfdata = _create_data;
41 v->free_cfdata = _free_data;
42 v->basic.apply_cfdata = _basic_apply;
43 v->basic.create_widgets = _basic_create;
44 v->basic.check_changed = _basic_check_changed;
45
46 /* create config diaolg for NULL object/data */
47 cfd = e_config_dialog_new(NULL, _("Window Display"),
48 "E", "windows/window_display",
49 "preferences-system-windows", 0, v, NULL);
50 return cfd;
51 }
52
53 static void *
_create_data(E_Config_Dialog * cfd EINA_UNUSED)54 _create_data(E_Config_Dialog *cfd EINA_UNUSED)
55 {
56 E_Config_Dialog_Data *cfdata;
57
58 cfdata = E_NEW(E_Config_Dialog_Data, 1);
59 if (!cfdata) return NULL;
60 cfdata->move_info_visible = e_config->move_info_visible;
61 cfdata->move_info_follows = e_config->move_info_follows;
62 cfdata->resize_info_visible = e_config->resize_info_visible;
63 cfdata->resize_info_follows = e_config->resize_info_follows;
64 cfdata->use_app_icon = e_config->use_app_icon;
65
66 cfdata->window_placement_policy =
67 e_config->window_placement_policy;
68 cfdata->window_grouping = e_config->window_grouping;
69 cfdata->desk_auto_switch = e_config->desk_auto_switch;
70
71 cfdata->screen_limits = e_config->screen_limits;
72
73 cfdata->window_maximize_animate = e_config->window_maximize_animate;
74 cfdata->window_maximize_transition = e_config->window_maximize_transition;
75 cfdata->window_maximize_time = e_config->window_maximize_time;
76
77 cfdata->border_shade_animate = e_config->border_shade_animate;
78 cfdata->border_shade_transition = e_config->border_shade_transition;
79 cfdata->border_shade_speed = e_config->border_shade_speed;
80
81 return cfdata;
82 }
83
84 static void
_free_data(E_Config_Dialog * cfd EINA_UNUSED,E_Config_Dialog_Data * cfdata)85 _free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
86 {
87 free(cfdata);
88 }
89
90 static int
_basic_apply(E_Config_Dialog * cfd EINA_UNUSED,E_Config_Dialog_Data * cfdata)91 _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
92 {
93 e_config->window_placement_policy = cfdata->window_placement_policy;
94 e_config->window_grouping = cfdata->window_grouping;
95 e_config->move_info_visible = cfdata->move_info_visible;
96 e_config->move_info_follows = cfdata->move_info_follows;
97 e_config->resize_info_visible = cfdata->resize_info_visible;
98 e_config->resize_info_follows = cfdata->resize_info_follows;
99 e_config->window_maximize_animate = cfdata->window_maximize_animate;
100 e_config->window_maximize_transition = cfdata->window_maximize_transition;
101 e_config->window_maximize_time = cfdata->window_maximize_time;
102 e_config->border_shade_animate = cfdata->border_shade_animate;
103 e_config->border_shade_transition = cfdata->border_shade_transition;
104 e_config->border_shade_speed = cfdata->border_shade_speed;
105 e_config->use_app_icon = cfdata->use_app_icon;
106
107 e_config->desk_auto_switch = cfdata->desk_auto_switch;
108 e_config->screen_limits = cfdata->screen_limits;
109 e_config_save_queue();
110 return 1;
111 }
112
113 static int
_basic_check_changed(E_Config_Dialog * cfd EINA_UNUSED,E_Config_Dialog_Data * cfdata)114 _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
115 {
116 return (e_config->window_placement_policy != cfdata->window_placement_policy) ||
117 (e_config->window_grouping != cfdata->window_grouping) ||
118 (e_config->move_info_visible != cfdata->move_info_visible) ||
119 (e_config->move_info_follows != cfdata->move_info_follows) ||
120 (e_config->resize_info_visible != cfdata->resize_info_visible) ||
121 (e_config->resize_info_follows != cfdata->resize_info_follows) ||
122 (e_config->border_shade_animate != cfdata->border_shade_animate) ||
123 (e_config->border_shade_transition != cfdata->border_shade_transition) ||
124 (!EINA_DBL_EQ(e_config->border_shade_speed, cfdata->border_shade_speed)) ||
125 (e_config->window_maximize_animate != cfdata->window_maximize_animate) ||
126 (e_config->window_maximize_transition != cfdata->window_maximize_transition) ||
127 (!dblequal(e_config->window_maximize_time, cfdata->window_maximize_time)) ||
128 (e_config->use_app_icon != cfdata->use_app_icon) ||
129 (e_config->desk_auto_switch != cfdata->desk_auto_switch) ||
130 (e_config->screen_limits != cfdata->screen_limits);
131 }
132
133 static Evas_Object *
_basic_create(E_Config_Dialog * cfd EINA_UNUSED,Evas * evas,E_Config_Dialog_Data * cfdata)134 _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
135 {
136 Evas_Object *otb, *ol, *of, *ow, *oc;
137 E_Radio_Group *rg;
138
139 e_dialog_resizable_set(cfd->dia, 1);
140 otb = e_widget_toolbook_add(evas, (24 * e_scale), (24 * e_scale));
141
142 /* Display */
143 ol = e_widget_list_add(evas, 0, 0);
144 of = e_widget_framelist_add(evas, _("Border Icon"), 0);
145 rg = e_widget_radio_group_new(&(cfdata->use_app_icon));
146 ow = e_widget_radio_add(evas, _("User defined"), 0, rg);
147 e_widget_framelist_object_append(of, ow);
148 ow = e_widget_radio_add(evas, _("Application provided"), 1, rg);
149 e_widget_framelist_object_append(of, ow);
150 e_widget_list_object_append(ol, of, 1, 1, 0.5);
151
152 of = e_widget_framelist_add(evas, _("Move Geometry"), 0);
153 oc = e_widget_check_add(evas, _("Display information"),
154 &(cfdata->move_info_visible));
155 e_widget_framelist_object_append(of, oc);
156 ow = e_widget_check_add(evas, _("Follows the window"),
157 &(cfdata->move_info_follows));
158 e_widget_disabled_set(ow, !cfdata->move_info_visible);
159 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
160 e_widget_framelist_object_append(of, ow);
161 e_widget_list_object_append(ol, of, 1, 1, 0.5);
162
163 of = e_widget_framelist_add(evas, _("Resize Geometry"), 0);
164 oc = e_widget_check_add(evas, _("Display information"),
165 &(cfdata->resize_info_visible));
166 e_widget_framelist_object_append(of, oc);
167 ow = e_widget_check_add(evas, _("Follows the window"),
168 &(cfdata->resize_info_follows));
169 e_widget_disabled_set(ow, !cfdata->resize_info_visible);
170 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
171 e_widget_framelist_object_append(of, ow);
172 e_widget_list_object_append(ol, of, 1, 1, 0.5);
173 e_widget_toolbook_page_append(otb, NULL, _("Display"), ol,
174 1, 1, 1, 0, 0.0, 0.0);
175
176 /* New Windows */
177 ol = e_widget_list_add(evas, 0, 0);
178 of = e_widget_framelist_add(evas, _("Placement"), 0);
179 rg = e_widget_radio_group_new(&(cfdata->window_placement_policy));
180 ow = e_widget_radio_add(evas, _("Smart Placement"),
181 E_WINDOW_PLACEMENT_SMART, rg);
182 e_widget_framelist_object_append(of, ow);
183 ow = e_widget_radio_add(evas, _("Don't hide Gadgets"),
184 E_WINDOW_PLACEMENT_ANTIGADGET, rg);
185 e_widget_framelist_object_append(of, ow);
186 ow = e_widget_radio_add(evas, _("Place at mouse pointer"),
187 E_WINDOW_PLACEMENT_CURSOR, rg);
188 e_widget_framelist_object_append(of, ow);
189 ow = e_widget_radio_add(evas, _("Place manually with the mouse"),
190 E_WINDOW_PLACEMENT_MANUAL, rg);
191 e_widget_framelist_object_append(of, ow);
192 ow = e_widget_check_add(evas, _("Group with windows of the same application"),
193 &(cfdata->window_grouping));
194 e_widget_framelist_object_append(of, ow);
195 e_widget_list_object_append(ol, of, 1, 1, 0.5);
196 ow = e_widget_check_add(evas, _("Switch to desktop of new window"),
197 &(cfdata->desk_auto_switch));
198 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
199 e_widget_toolbook_page_append(otb, NULL, _("New Windows"), ol,
200 1, 1, 1, 0, 0.0, 0.0);
201
202 /* Shading */
203 ol = e_widget_list_add(evas, 0, 0);
204 oc = e_widget_check_add(evas, _("Animate"),
205 &(cfdata->border_shade_animate));
206 e_widget_list_object_append(ol, oc, 1, 1, 0.5);
207 ow = e_widget_slider_add(evas, 1, 0, _("%4.0f pixels/s"),
208 100, 9900, 100, 0,
209 &(cfdata->border_shade_speed), NULL, 100);
210 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
211 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
212
213 rg = e_widget_radio_group_new(&(cfdata->border_shade_transition));
214
215 ow = e_widget_radio_add(evas, _("Linear"), E_TRANSITION_LINEAR, rg);
216 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
217 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
218
219 ow = e_widget_radio_add(evas, _("Accelerate, then decelerate"), E_TRANSITION_SINUSOIDAL, rg);
220 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
221 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
222
223 ow = e_widget_radio_add(evas, _("Accelerate"), E_TRANSITION_ACCELERATE, rg);
224 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
225 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
226
227 ow = e_widget_radio_add(evas, _("Decelerate"), E_TRANSITION_DECELERATE, rg);
228 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
229 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
230
231 ow = e_widget_radio_add(evas, _("Pronounced accelerate"), E_TRANSITION_ACCELERATE_LOTS, rg);
232 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
233 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
234
235 ow = e_widget_radio_add(evas, _("Pronounced decelerate"), E_TRANSITION_DECELERATE_LOTS, rg);
236 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
237 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
238
239 ow = e_widget_radio_add(evas, _("Pronounced accelerate, then decelerate"), E_TRANSITION_SINUSOIDAL_LOTS, rg);
240 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
241 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
242
243 ow = e_widget_radio_add(evas, _("Bounce"), E_TRANSITION_BOUNCE, rg);
244 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
245 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
246
247 ow = e_widget_radio_add(evas, _("Bounce more"), E_TRANSITION_BOUNCE_LOTS, rg);
248 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
249 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
250
251 e_widget_toolbook_page_append(otb, NULL, _("Shading"), ol,
252 1, 1, 1, 0, 0.0, 0.0);
253
254 /* Shading */
255 ol = e_widget_list_add(evas, 0, 0);
256 oc = e_widget_check_add(evas, _("Animate"),
257 &(cfdata->window_maximize_animate));
258 e_widget_list_object_append(ol, oc, 1, 1, 0.5);
259 ow = e_widget_slider_add(evas, 1, 0, _("%1.2f seconds"),
260 0.0, 1.0, 0.05, 0,
261 &(cfdata->window_maximize_time), NULL, 100);
262 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
263 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
264
265 rg = e_widget_radio_group_new(&(cfdata->border_shade_transition));
266
267 ow = e_widget_radio_add(evas, _("Linear"), E_EFX_EFFECT_SPEED_LINEAR, rg);
268 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
269 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
270
271 ow = e_widget_radio_add(evas, _("Accelerate"), E_EFX_EFFECT_SPEED_ACCELERATE, rg);
272 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
273 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
274
275 ow = e_widget_radio_add(evas, _("Decelerate"), E_EFX_EFFECT_SPEED_DECELERATE, rg);
276 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
277 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
278
279 ow = e_widget_radio_add(evas, _("Accelerate, then decelerate"), E_EFX_EFFECT_SPEED_SINUSOIDAL, rg);
280 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
281 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
282
283 e_widget_toolbook_page_append(otb, NULL, _("Maximizing"), ol,
284 1, 1, 1, 0, 0.0, 0.0);
285
286 /* Screen Limits */
287 ol = e_widget_list_add(evas, 0, 0);
288
289 rg = e_widget_radio_group_new(&(cfdata->screen_limits));
290
291 ow = e_widget_radio_add(evas, _("Keep windows within the visual screen limits"), E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE, rg);
292 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
293
294 ow = e_widget_radio_add(evas, _("Allow windows partly out of the visual screen limits"), E_CLIENT_OFFSCREEN_LIMIT_ALLOW_PARTIAL, rg);
295 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
296
297 ow = e_widget_radio_add(evas, _("Allow windows completely out of visual screen limits"), E_CLIENT_OFFSCREEN_LIMIT_ALLOW_FULL, rg);
298 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
299
300 e_widget_toolbook_page_append(otb, NULL, _("Screen Limits"), ol,
301 1, 1, 1, 0, 0.0, 0.0);
302
303 e_widget_toolbook_page_show(otb, 0);
304 return otb;
305 }
306