summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2014-07-30 13:00:22 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-08-19 17:48:42 -0400
commite66437ba07df9a04c7cb95b604e684517b538351 (patch)
treebe7d3f21e6eee3c4a46df82414d000e5f42f8a54
parentf87c66b44e6d5df17e5bfa2d018ceae7a71a6662 (diff)
finish out config menu
-rw-r--r--src/desksanity.c36
-rw-r--r--src/ds_config.c71
-rw-r--r--src/e_mod_main.c23
-rw-r--r--src/e_mod_main.h41
4 files changed, 150 insertions, 21 deletions
diff --git a/src/desksanity.c b/src/desksanity.c
index 0e03dbb..8e503ad 100644
--- a/src/desksanity.c
+++ b/src/desksanity.c
@@ -5,25 +5,6 @@ static Evas_Object *dm_show = NULL;
5static E_Desk *desk_hide = NULL; 5static E_Desk *desk_hide = NULL;
6static Evas_Object *dm_hide = NULL; 6static Evas_Object *dm_hide = NULL;
7 7
8typedef enum
9{
10 DS_PAN, //slide desk in direction of flip
11 DS_FADE_OUT, //current desk fades to transparent
12 DS_FADE_IN, //new desk fades in from transparent
13 DS_BATMAN, //adam west is calling
14 DS_ZOOM_IN, //zoom in to new desk
15 DS_ZOOM_OUT, //zoom out from old desk
16 DS_GROW, //grow the view of the new desk based on flip direction
17 DS_ROTATE_OUT, //spiral current desk out while shrinking
18 DS_ROTATE_IN, //spiral new desk in while growing
19 DS_SLIDE_SPLIT, //split screen in X parts and slide away based on flip direction
20 DS_QUAD_SPLIT, //split screen into quads and move towards corners
21 DS_QUAD_MERGE, //split screen into quads and move towards center
22 DS_BLINK, //like blinking your eye
23 DS_VIEWPORT, //current desk viewport shrinks towards 1x1 at center
24 DS_LAST,
25} DS_Type;
26
27static DS_Type cur_type = DS_PAN; 8static DS_Type cur_type = DS_PAN;
28 9
29static void 10static void
@@ -82,6 +63,7 @@ _ds_show(E_Desk *desk, int dx, int dy)
82{ 63{
83 E_Client *ec; 64 E_Client *ec;
84 DS_Type use_type; 65 DS_Type use_type;
66 DS_Type *disabled_types = (DS_Type*)&ds_config->types;
85 67
86 /* free existing mirror */ 68 /* free existing mirror */
87 E_FREE_FUNC(dm_show, evas_object_del); 69 E_FREE_FUNC(dm_show, evas_object_del);
@@ -107,6 +89,11 @@ _ds_show(E_Desk *desk, int dx, int dy)
107 ec->hidden = 0; 89 ec->hidden = 0;
108 evas_object_show(ec->frame); 90 evas_object_show(ec->frame);
109 } 91 }
92 if (ds_config->disabled_transition_count == DS_LAST)
93 {
94 e_desk_flip_end(desk);
95 return;
96 }
110 desk_show = desk; 97 desk_show = desk;
111 98
112 e_comp_shape_queue_block(e_comp_get(desk), 1); 99 e_comp_shape_queue_block(e_comp_get(desk), 1);
@@ -117,6 +104,16 @@ _ds_show(E_Desk *desk, int dx, int dy)
117 use_type = cur_type++; 104 use_type = cur_type++;
118 else 105 else
119 use_type = rand() % DS_LAST; 106 use_type = rand() % DS_LAST;
107 while (disabled_types[use_type])
108 {
109 use_type++;
110 if (use_type == DS_LAST)
111 {
112 cur_type = DS_LAST;
113 use_type = DS_PAN;
114 }
115 }
116
120 /* pick a random flip */ 117 /* pick a random flip */
121 switch (use_type) 118 switch (use_type)
122 { 119 {
@@ -408,6 +405,7 @@ _ds_hide(E_Desk *desk)
408 ec->hidden = 1; 405 ec->hidden = 1;
409 evas_object_hide(ec->frame); 406 evas_object_hide(ec->frame);
410 } 407 }
408 if (ds_config->disabled_transition_count == DS_LAST) return;
411 desk_hide = desk; 409 desk_hide = desk;
412 /* create mirror for previous desk */ 410 /* create mirror for previous desk */
413 dm_hide = dm_add(desk); 411 dm_hide = dm_add(desk);
diff --git a/src/ds_config.c b/src/ds_config.c
index 9f20345..b8134d7 100644
--- a/src/ds_config.c
+++ b/src/ds_config.c
@@ -3,6 +3,25 @@
3static E_Int_Menu_Augmentation *maug = NULL; 3static E_Int_Menu_Augmentation *maug = NULL;
4 4
5 5
6static const char *type_desc[] =
7{
8 [DS_PAN] = D_("Pan"),
9 [DS_FADE_OUT] = D_("Fade Out"),
10 [DS_FADE_IN] = D_("Fade In"),
11 [DS_BATMAN] = D_("Batman"),
12 [DS_ZOOM_IN] = D_("Zoom In"),
13 [DS_ZOOM_OUT] = D_("Zoom Out"),
14 [DS_GROW] = D_("Grow"),
15 [DS_ROTATE_OUT] = D_("Rotate Out"),
16 [DS_ROTATE_IN] = D_("Rotate In"),
17 [DS_SLIDE_SPLIT] = D_("Slide Split"),
18 [DS_QUAD_SPLIT] = D_("Quad Split"),
19 [DS_QUAD_MERGE] = D_("Quad Merge"),
20 [DS_BLINK] = D_("Blink"),
21 [DS_VIEWPORT] = D_("Viewport"),
22 [DS_LAST] = NULL
23};
24
6static void 25static void
7_ds_menu_ruler(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi) 26_ds_menu_ruler(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
8{ 27{
@@ -11,6 +30,7 @@ _ds_menu_ruler(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
11 mr_shutdown(); 30 mr_shutdown();
12 else 31 else
13 mr_init(); 32 mr_init();
33 e_config_save_queue();
14} 34}
15 35
16static void 36static void
@@ -21,6 +41,32 @@ _ds_menu_maximize(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi
21 maximize_shutdown(); 41 maximize_shutdown();
22 else 42 else
23 maximize_init(); 43 maximize_init();
44 e_config_save_queue();
45}
46
47static void
48_ds_menu_transitions(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
49{
50 ds_config->disable_transitions = mi->toggle;
51 if (ds_config->disable_transitions)
52 ds_shutdown();
53 else
54 ds_init();
55 e_config_save_queue();
56}
57
58static void
59_ds_menu_transition_type(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi)
60{
61 Eina_Bool *types = (Eina_Bool*)&ds_config->types;
62 unsigned int t = (uintptr_t)data;
63
64 types[t] = mi->toggle;
65 if (mi->toggle)
66 ds_config->disabled_transition_count++;
67 else
68 ds_config->disabled_transition_count--;
69 e_config_save_queue();
24} 70}
25 71
26static void 72static void
@@ -28,6 +74,7 @@ _ds_menu_add(void *data EINA_UNUSED, E_Menu *m)
28{ 74{
29 E_Menu_Item *mi; 75 E_Menu_Item *mi;
30 E_Menu *subm; 76 E_Menu *subm;
77 unsigned int t;
31 78
32 mi = e_menu_item_new(m); 79 mi = e_menu_item_new(m);
33 e_menu_item_label_set(mi, D_("Desksanity")); 80 e_menu_item_label_set(mi, D_("Desksanity"));
@@ -36,6 +83,7 @@ _ds_menu_add(void *data EINA_UNUSED, E_Menu *m)
36 subm = e_menu_new(); 83 subm = e_menu_new();
37 e_menu_title_set(subm, D_("Options")); 84 e_menu_title_set(subm, D_("Options"));
38 e_menu_item_submenu_set(mi, subm); 85 e_menu_item_submenu_set(mi, subm);
86 e_object_unref(E_OBJECT(subm));
39 87
40 mi = e_menu_item_new(subm); 88 mi = e_menu_item_new(subm);
41 e_menu_item_label_set(mi, D_("Disable Move/Resize Ruler")); 89 e_menu_item_label_set(mi, D_("Disable Move/Resize Ruler"));
@@ -48,6 +96,29 @@ _ds_menu_add(void *data EINA_UNUSED, E_Menu *m)
48 e_menu_item_check_set(mi, 1); 96 e_menu_item_check_set(mi, 1);
49 e_menu_item_toggle_set(mi, ds_config->disable_maximize); 97 e_menu_item_toggle_set(mi, ds_config->disable_maximize);
50 e_menu_item_callback_set(mi, _ds_menu_maximize, NULL); 98 e_menu_item_callback_set(mi, _ds_menu_maximize, NULL);
99
100 mi = e_menu_item_new(subm);
101 e_menu_item_label_set(mi, D_("Disable Transition Effects"));
102 e_menu_item_check_set(mi, 1);
103 e_menu_item_toggle_set(mi, ds_config->disable_transitions);
104 e_menu_item_callback_set(mi, _ds_menu_transitions, NULL);
105
106 if (ds_config->disable_transitions) return;
107
108 subm = e_menu_new();
109 e_menu_title_set(subm, D_("Transitions"));
110 e_menu_item_submenu_set(mi, subm);
111 e_object_unref(E_OBJECT(subm));
112
113 for (t = 0; t < DS_LAST; t++)
114 {
115 Eina_Bool *types = (Eina_Bool*)&ds_config->types;
116 mi = e_menu_item_new(subm);
117 e_menu_item_label_set(mi, type_desc[t]);
118 e_menu_item_check_set(mi, 1);
119 e_menu_item_toggle_set(mi, types[t]);
120 e_menu_item_callback_set(mi, _ds_menu_transition_type, (void*)(uintptr_t)t);
121 }
51} 122}
52 123
53EINTERN void 124EINTERN void
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index ed0041c..90e661e 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -17,6 +17,23 @@ _e_mod_ds_config_load(void)
17 E_CONFIG_VAL(D, T, config_version, UINT); 17 E_CONFIG_VAL(D, T, config_version, UINT);
18 E_CONFIG_VAL(D, T, disable_ruler, UCHAR); 18 E_CONFIG_VAL(D, T, disable_ruler, UCHAR);
19 E_CONFIG_VAL(D, T, disable_maximize, UCHAR); 19 E_CONFIG_VAL(D, T, disable_maximize, UCHAR);
20 E_CONFIG_VAL(D, T, disable_transitions, UCHAR);
21 E_CONFIG_VAL(D, T, disabled_transition_count, UINT);
22
23 E_CONFIG_VAL(D, T, types.disable_PAN, UCHAR);
24 E_CONFIG_VAL(D, T, types.disable_FADE_OUT, UCHAR);
25 E_CONFIG_VAL(D, T, types.disable_FADE_IN, UCHAR);
26 E_CONFIG_VAL(D, T, types.disable_BATMAN, UCHAR);
27 E_CONFIG_VAL(D, T, types.disable_ZOOM_IN, UCHAR);
28 E_CONFIG_VAL(D, T, types.disable_ZOOM_OUT, UCHAR);
29 E_CONFIG_VAL(D, T, types.disable_GROW, UCHAR);
30 E_CONFIG_VAL(D, T, types.disable_ROTATE_OUT, UCHAR);
31 E_CONFIG_VAL(D, T, types.disable_ROTATE_IN, UCHAR);
32 E_CONFIG_VAL(D, T, types.disable_SLIDE_SPLIT, UCHAR);
33 E_CONFIG_VAL(D, T, types.disable_QUAD_SPLIT, UCHAR);
34 E_CONFIG_VAL(D, T, types.disable_QUAD_MERGE, UCHAR);
35 E_CONFIG_VAL(D, T, types.disable_BLINK, UCHAR);
36 E_CONFIG_VAL(D, T, types.disable_VIEWPORT, UCHAR);
20 37
21 ds_config = e_config_domain_load("module.desksanity", conf_edd); 38 ds_config = e_config_domain_load("module.desksanity", conf_edd);
22 if (ds_config) 39 if (ds_config)
@@ -49,7 +66,8 @@ e_modapi_init(E_Module *m)
49 mod->edje_file = eina_stringshare_add(buf); 66 mod->edje_file = eina_stringshare_add(buf);
50 67
51 ds_config_init(); 68 ds_config_init();
52 ds_init(); 69 if (!ds_config->disable_transitions)
70 ds_init();
53 if (!ds_config->disable_ruler) 71 if (!ds_config->disable_ruler)
54 mr_init(); 72 mr_init();
55 if (!ds_config->disable_maximize) 73 if (!ds_config->disable_maximize)
@@ -65,7 +83,8 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
65 maximize_shutdown(); 83 maximize_shutdown();
66 if (!ds_config->disable_ruler) 84 if (!ds_config->disable_ruler)
67 mr_shutdown(); 85 mr_shutdown();
68 ds_shutdown(); 86 if (!ds_config->disable_transitions)
87 ds_shutdown();
69 ds_config_shutdown(); 88 ds_config_shutdown();
70 e_config_domain_save("module.desksanity", conf_edd, ds_config); 89 e_config_domain_save("module.desksanity", conf_edd, ds_config);
71 E_FREE(ds_config); 90 E_FREE(ds_config);
diff --git a/src/e_mod_main.h b/src/e_mod_main.h
index ab8f04b..dea970c 100644
--- a/src/e_mod_main.h
+++ b/src/e_mod_main.h
@@ -25,6 +25,25 @@
25#define MOD_CONFIG_FILE_GENERATION 1 25#define MOD_CONFIG_FILE_GENERATION 1
26#define MOD_CONFIG_FILE_VERSION ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION) 26#define MOD_CONFIG_FILE_VERSION ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION)
27 27
28typedef enum
29{
30 DS_PAN, //slide desk in direction of flip
31 DS_FADE_OUT, //current desk fades to transparent
32 DS_FADE_IN, //new desk fades in from transparent
33 DS_BATMAN, //adam west is calling
34 DS_ZOOM_IN, //zoom in to new desk
35 DS_ZOOM_OUT, //zoom out from old desk
36 DS_GROW, //grow the view of the new desk based on flip direction
37 DS_ROTATE_OUT, //spiral current desk out while shrinking
38 DS_ROTATE_IN, //spiral new desk in while growing
39 DS_SLIDE_SPLIT, //split screen in X parts and slide away based on flip direction
40 DS_QUAD_SPLIT, //split screen into quads and move towards corners
41 DS_QUAD_MERGE, //split screen into quads and move towards center
42 DS_BLINK, //like blinking your eye
43 DS_VIEWPORT, //current desk viewport shrinks towards 1x1 at center
44 DS_LAST,
45} DS_Type;
46
28typedef struct Mod 47typedef struct Mod
29{ 48{
30 E_Config_Dialog *cfd; 49 E_Config_Dialog *cfd;
@@ -32,13 +51,35 @@ typedef struct Mod
32 Eina_Stringshare *edje_file; 51 Eina_Stringshare *edje_file;
33} Mod; 52} Mod;
34 53
54typedef struct Config_Types
55{
56 Eina_Bool disable_PAN;
57 Eina_Bool disable_FADE_OUT;
58 Eina_Bool disable_FADE_IN;
59 Eina_Bool disable_BATMAN;
60 Eina_Bool disable_ZOOM_IN;
61 Eina_Bool disable_ZOOM_OUT;
62 Eina_Bool disable_GROW;
63 Eina_Bool disable_ROTATE_OUT;
64 Eina_Bool disable_ROTATE_IN;
65 Eina_Bool disable_SLIDE_SPLIT;
66 Eina_Bool disable_QUAD_SPLIT;
67 Eina_Bool disable_QUAD_MERGE;
68 Eina_Bool disable_BLINK;
69 Eina_Bool disable_VIEWPORT;
70} Config_Types;
71
35typedef struct Config 72typedef struct Config
36{ 73{
37 unsigned int config_version; 74 unsigned int config_version;
38 Eina_Bool disable_ruler; 75 Eina_Bool disable_ruler;
39 Eina_Bool disable_maximize; 76 Eina_Bool disable_maximize;
77 Eina_Bool disable_transitions;
78 unsigned int disabled_transition_count;
79 Config_Types types;
40} Config; 80} Config;
41 81
82
42extern Mod *mod; 83extern Mod *mod;
43extern Config *ds_config; 84extern Config *ds_config;
44 85