From d38f03aea7cf43ab63e5c80b869b1249a76ff240 Mon Sep 17 00:00:00 2001 From: sndev Date: Thu, 31 Aug 2006 04:16:43 +0000 Subject: [PATCH] Ehhhh. So stuff in one go. * Mouse Binding Dialog - dialog refactoring - no need to select modifiers, etc. Just click add button and do an action with a mouse. - new icons. Many thanks to Luchezar 'ManowarrioR' Petkov for great work on this icons. - extra mouse buttons and wheels are supported. - etc, just try and see. * Shelf - No re-population when "plain/inset" mode set. - Changing the orientation of the shelf horiz->vert does not screws up it look. - something else * Gadcon - No overlaping items in initial shelf. - Moving of items in gadcon is not problematic any more. Will not get any mess and overlaps in gadcon on moving. - Item sizing. If u size an item to the left it will be sized only to the left. - If gadcon clients take much more space than gadcon can display, they are resized starting from the biggest item(s). - Shrinked mode actions, moving/sizing, is not problematic. Everything works exactly in the same fasion as in non-shrinked mode. - etc. SVN revision: 25235 --- data/themes/default_icons.edc | 50 +- data/themes/images/Makefile.am | 11 +- .../images/e17_icon_mouse_bindings_left.png | Bin 2829 -> 0 bytes .../images/e17_icon_mouse_bindings_middle.png | Bin 2750 -> 0 bytes .../images/e17_icon_mouse_bindings_right.png | Bin 2839 -> 0 bytes .../e17_icon_mouse_bindings_scroll_down.png | Bin 3100 -> 0 bytes .../e17_icon_mouse_bindings_scroll_up.png | Bin 3129 -> 0 bytes data/themes/images/e17_icon_mouse_clean.png | Bin 0 -> 2646 bytes data/themes/images/e17_icon_mouse_extra.png | Bin 0 -> 1575 bytes data/themes/images/e17_icon_mouse_left.png | Bin 0 -> 1227 bytes data/themes/images/e17_icon_mouse_middle.png | Bin 0 -> 1156 bytes data/themes/images/e17_icon_mouse_right.png | Bin 0 -> 1231 bytes data/themes/images/e17_icon_mouse_wheel.png | Bin 0 -> 1291 bytes src/bin/e_config.c | 4 + src/bin/e_config.h | 9 +- src/bin/e_configure.c | 2 +- src/bin/e_gadcon.c | 2771 +++++++++++++---- src/bin/e_gadcon.h | 12 +- src/bin/e_int_config_keybindings.c | 3 +- src/bin/e_int_config_mousebindings.c | 1878 ++++++----- src/bin/e_int_shelf_config.c | 1 + src/bin/e_shelf.c | 5 +- 22 files changed, 3279 insertions(+), 1467 deletions(-) delete mode 100644 data/themes/images/e17_icon_mouse_bindings_left.png delete mode 100644 data/themes/images/e17_icon_mouse_bindings_middle.png delete mode 100644 data/themes/images/e17_icon_mouse_bindings_right.png delete mode 100644 data/themes/images/e17_icon_mouse_bindings_scroll_down.png delete mode 100644 data/themes/images/e17_icon_mouse_bindings_scroll_up.png create mode 100644 data/themes/images/e17_icon_mouse_clean.png create mode 100644 data/themes/images/e17_icon_mouse_extra.png create mode 100644 data/themes/images/e17_icon_mouse_left.png create mode 100644 data/themes/images/e17_icon_mouse_middle.png create mode 100644 data/themes/images/e17_icon_mouse_right.png create mode 100644 data/themes/images/e17_icon_mouse_wheel.png diff --git a/data/themes/default_icons.edc b/data/themes/default_icons.edc index f2f666b00..fa468914c 100644 --- a/data/themes/default_icons.edc +++ b/data/themes/default_icons.edc @@ -41,11 +41,12 @@ images { image: "e17_icon_up_arrow.png" COMP; image: "e17_icon_down_arrow.png" COMP; - image: "e17_icon_mouse_bindings_left.png" COMP; - image: "e17_icon_mouse_bindings_middle.png" COMP; - image: "e17_icon_mouse_bindings_right.png" COMP; - image: "e17_icon_mouse_bindings_scroll_up.png" COMP; - image: "e17_icon_mouse_bindings_scroll_down.png" COMP; + image: "e17_icon_mouse_left.png" COMP; + image: "e17_icon_mouse_middle.png" COMP; + image: "e17_icon_mouse_right.png" COMP; + image: "e17_icon_mouse_extra.png" COMP; + image: "e17_icon_mouse_wheel.png" COMP; + image: "e17_icon_mouse_clean.png" COMP; image: "e17_shelf_bottom_left.png" COMP; image: "e17_shelf_bottom.png" COMP; @@ -605,7 +606,7 @@ group { } } group { - name: "e/icons/enlightenment/mouse_binding_left"; + name: "e/icons/enlightenment/mouse_left"; max: 64 64; parts { part { @@ -617,14 +618,14 @@ group { aspect_preference: BOTH; max: 64 64; image { - normal: "e17_icon_mouse_bindings_left.png"; + normal: "e17_icon_mouse_left.png"; } } } } } group { - name: "e/icons/enlightenment/mouse_binding_middle"; + name: "e/icons/enlightenment/mouse_middle"; max: 64 64; parts { part { @@ -636,14 +637,14 @@ group { aspect_preference: BOTH; max: 64 64; image { - normal: "e17_icon_mouse_bindings_middle.png"; + normal: "e17_icon_mouse_middle.png"; } } } } } group { - name: "e/icons/enlightenment/mouse_binding_right"; + name: "e/icons/enlightenment/mouse_right"; max: 64 64; parts { part { @@ -655,14 +656,14 @@ group { aspect_preference: BOTH; max: 64 64; image { - normal: "e17_icon_mouse_bindings_right.png"; + normal: "e17_icon_mouse_right.png"; } } } } } group { - name: "e/icons/enlightenment/mouse_binding_scroll_up"; + name: "e/icons/enlightenment/mouse_extra"; max: 64 64; parts { part { @@ -674,14 +675,14 @@ group { aspect_preference: BOTH; max: 64 64; image { - normal: "e17_icon_mouse_bindings_scroll_up.png"; + normal: "e17_icon_mouse_extra.png"; } } } } } group { - name: "e/icons/enlightenment/mouse_binding_scroll_down"; + name: "e/icons/enlightenment/mouse_wheel"; max: 64 64; parts { part { @@ -693,7 +694,26 @@ group { aspect_preference: BOTH; max: 64 64; image { - normal: "e17_icon_mouse_bindings_scroll_down.png"; + normal: "e17_icon_mouse_wheel.png"; + } + } + } + } +} +group { + name: "e/icons/enlightenment/mouse_clean"; + max: 64 64; + parts { + part { + name: "icon"; + mouse_events: 0; + description { + state: "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + max: 64 64; + image { + normal: "e17_icon_mouse_clean.png"; } } } diff --git a/data/themes/images/Makefile.am b/data/themes/images/Makefile.am index 76e5d808b..5cafdfa8e 100644 --- a/data/themes/images/Makefile.am +++ b/data/themes/images/Makefile.am @@ -332,11 +332,12 @@ e17_icon_windows.png \ e17_icon_window_focus.png \ e17_icon_lost_windows.png \ e17_icon_screen_resolution.png \ -e17_icon_mouse_bindings_left.png \ -e17_icon_mouse_bindings_middle.png \ -e17_icon_mouse_bindings_right.png \ -e17_icon_mouse_bindings_scroll_up.png \ -e17_icon_mouse_bindings_scroll_down.png \ +e17_icon_mouse_left.png \ +e17_icon_mouse_middle.png \ +e17_icon_mouse_right.png \ +e17_icon_mouse_extra.png \ +e17_icon_mouse_wheel.png \ +e17_icon_mouse_clean.png \ e17_pointer.png \ e17_pointer_mono.png \ e17_dialog_watermark.png \ diff --git a/data/themes/images/e17_icon_mouse_bindings_left.png b/data/themes/images/e17_icon_mouse_bindings_left.png deleted file mode 100644 index 85e74c1c50a5941e213567f15603274e4d2e9818..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2829 zcmV+o3-a`dP)@c{P1NNf-oECj2&zPif`3nW+|{s;nr zSg|q-kdQ2p2H8dk3c@@FW=6(#cTaaucXih*E3@(u4;Ir=ZzGh>Wlq;f4krB z9}EVA?M|mNa2%(I<9HN?;l%g-%rFdYSym;b6pusVaS2dOU^bh%X_^Mp>9jQ-kE3Do zhgUW~{Mk=B#MxY1TQl`{Y}-Bp@Vnt~_%kWxdpf*YmQ|f7Af=QzFNt$I6X%@Ob!~Fa zjmcyZ_WS*0Z*Om7D7QYoxB9E^-?M%neQx?agwtmbMG-jXpp;@T7@*hdK}uPsY5J;^ z@~7+T>-)a%XYF=-sMR=$R_Z^ZfDnS#b#3H%?iEGh92^|1Zf|dYWIKQB^Y=dfvu~AT zKmnjED+ED+pZxeo_{&>w;oIN&E}|$#p6Bp9&yJ$#e~yoj!>z5YA4E|!)@s2%uK+1YtwckuR$gHQe9n~D`QB?x+sbQp63Aoy4~)}2L}iB*4Ea~^+qS9q>M2kgiwqzxoiTgu4^;TbMN^0xH}vU z+wX4u^U3UmU;aNaIs3426)uaxRRs$^7-Q(Jc9CrKFd7Q=91qNyB*|B9-@bjv^Ss>m z{Y*+pZQCvxV*gxBV9DqD2#g z#yTSQ1Y+YuU@%eF6=t&;CZh?25@3u$2mwkTe5LEUPLd?g4+ewIcs!2sJoh-~h7Q#i zCZN*<&bd+7wW%}C@MF{GrQ$H)z@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fCe}q+w^&kury8oNO6BXJ1+_NwLc{MlC zY4-plaJ;v^vYUOoK;&7cD5v$V#l^hwpLCcTTacr$I+r@xDr+)jRx8Vw^>=>W&BcPb zSJka6%2`B03m9BrQ3JtZQGEU0qMRTh*`&ArpCU8c7~OCFw>(lijt)zk-Z|yqosy&J z{|iNq2P*-n4HUTwrMkOvCrE5sPcp14hD#i3Qbkf|lMhzgc1-dYcAIfP^ziU79ke-s zDo@`msy{vN7Gp|I&o=ZaW1KNY>2%!R`Y)vz5(!Te(ez6mVKQ~>ZEZ*Wnpl_GS09yL z((E0NKF1YJN~f?^@*HZKI<}B1F9kVVj5-XTB|N@cqpMKk&8+rqTc?TG&~vo| z8<@+!K^OD%!2Tk~b3jgcO&1_x<%yPzYGpw|K`L0VuF#Vz9QSHbhdMRACs znVDHr#1vmySa^F&OG^`#N)285LY9u0@^7@0ZyNHjI^(R5ic>SU7VSB2&UibuntFBb zXM?vBJTi2B=7VB(|NJlT7afbitvMj0rBzzX`#v~etgqgOHE^4mavaez>;)}GZh&Zu zkIWR)iLQ*g%uxL4e@dQwC`&4En3$kDHbp z?l-HR8C8}(aOc#7j@`T1r7c7gcI&f?JXE^*+1b3WKSzdqb^eOC9Y@!Auk=bl{6yfH nzt2T#cVv(CHfq)ENFMU(s!IPk?(573_OO77frWlGnh^Vce34$p diff --git a/data/themes/images/e17_icon_mouse_bindings_scroll_down.png b/data/themes/images/e17_icon_mouse_bindings_scroll_down.png deleted file mode 100644 index 2b79d8002d69e9bced2a33cfc46f821a71ccff17..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3100 zcmV+%4CC{OP)~mt0 zu|1VK($Yv=j21c3|SCC+(aFc{nc078hMlyXWb zCxi%1(`rBbO|EEfB&>jt{6Gt)E^Aq0OC5Kjt# zC;-FZFz5SzVK5lvd%d1VDgFHE)2F}gy6%ZerDA5Jww0#odwY9(e=mesRq|?@X0p$K z5JKQ_K|FRaF~(?`rUqk7@Avz~R;yLt-r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5{dX4G%X+uBWwUoBxS2c)X7900iUn+XU{+1xq0i> zNJAu|NhxU&!aRQKR_W&G=-lOt7bi{~KYo2`a&ipJW31Gdis+hc+h3MTrLnm}A$xOn z_BMdxQZ_^P{o7!*(1`;6NMmC}8pdiVzTP)G zJ6i@b3UhPixm>Prb!cd!TrTIBIY-R5S%@qtHLh%Xti(J~vaHD)6B9E43IMF7ZiOGT z0QYROO~9{Wv4()AMg5vq4n4VU5-rm?_U(c?(L)gA!bN(ha z{Wd?#FZcdjarEH9g9i^DJb3Wn!Gi}69z1yP;9;5gH_bS)lq*5FbN~PV07*qoM6N<$ Ef^h`k5&!@I literal 0 HcmV?d00001 diff --git a/data/themes/images/e17_icon_mouse_extra.png b/data/themes/images/e17_icon_mouse_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..f50fa81ec279f720b69c711a66e5ca14d6276956 GIT binary patch literal 1575 zcmV+?2H5$DP)lnT^Ci;yU&z3>NcZU2EDxS;lc z)T&Y|wTHehty)^ORZw1}1W24f$jeEZhhNwsar}P8UVC?Dd!V*Ll(cDqLnXe_Pdl?( z&G)mv`OVBO@J!G2KT#C`0|4@*2mZ$aEq1%jVzzuhh+5AW`twq*Z`tRY1&{*3pDKXM z<$9YjcG=_g8UC1`Cvyvn%;WW}DT?Z4T)9y!7P>>>@C0(XH~{uU0aR6`BO@a#0CoX@ zMx%i!ijWlr3yX_z&&+c7^t9yh`2$Shw@Y%ND-w&{EhG|Q0Lo(n3X_>2Rp2g^egDUegjv(?m{RO zLMoNQ{{8zQiekBL9x*Q#iy#EVXfSB@H8fZkeZH3@S^hPhNJRe@V03h}fph*YAq3SL z6K?!G1>NofS~{9=xP3SDrM)N#X$+6w!u4ynu&}TIywwP)gx&IPgmL3|v17;{K=~3QiMhEw!jSwF=ux9io8@ z<~#!!dG9vt^$xVOwBYpV)6nbnkYyQ)qCim;WV2aBqVb9Qi;KbaUYaeI-~j+2gn$r& zwzf71f`G9x1Ki*FaquX^o`zb~@1w{Z$|3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)CLA=Xq4w^e9>K*xZ%J z5);By>Sr*L3XK*gIF6%QT3VjtdH!X;-~UaqSX_Ugz^PNGnwpxLW^6WFC&Mt6P5+v! zR4O~aX0M>Dxd#lxpsub??{qp}E0s!@Bauk_9s#{xuZ_p!p{c2<<t>H*~~RGG`zaGx%q229A2sjn0Oe7LHTqqR0nM|gzokm2NOr~m{=UX)z%`5x%?d$95>8U+*=n$>b z=_>!fBuNMa0vH?|#FdFFP)tQ^EK4vL3>X?3LThU)BuT>f__*TrdM6hb7kg5v)LrT^ zx~HM7t?dP#=ilq??LBzp$PpFGvLJ+j5CU12ap%q*oIQIMmo8m`$K%1VW5*y#5(GiO zz`#H9>YikPw0|Q$( zZ{9o}2n0qR+6lLTl1imk=H}+Sp-||jWHNccZns-Fj=N{$ay~LLLS|-WKAxVQ{uF@n zBm^oVD=RCpiHV6XL{VI~SS&AEEEc9LAW0H#+_<5fKY#x6^tnR!wyfEKLO?gA+!&}xl{lE002ovPDHLkV1hAs BRhs|+ literal 0 HcmV?d00001 diff --git a/src/bin/e_config.c b/src/bin/e_config.c index ccf43cbdd..ad04a0f8b 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -90,6 +90,8 @@ e_config_init(void) E_CONFIG_VAL(D, T, geom.pos, INT); E_CONFIG_VAL(D, T, geom.size, INT); E_CONFIG_VAL(D, T, geom.res, INT); + E_CONFIG_VAL(D, T, state_info.seq, INT); + E_CONFIG_VAL(D, T, state_info.flags, INT); E_CONFIG_VAL(D, T, style, STR); E_CONFIG_VAL(D, T, autoscroll, UCHAR); E_CONFIG_VAL(D, T, resizable, UCHAR); @@ -1145,6 +1147,8 @@ e_config_init(void) cf_gcc->geom.res = _res; \ cf_gcc->geom.size = _size; \ cf_gcc->geom.pos = _pos; \ + cf_gcc->state_info.seq = 0; \ + cf_gcc->state_info.flags = 0; \ if (_style) cf_gcc->style = evas_stringshare_add(_style); \ else cf_gcc->style = NULL; \ cf_gcc->autoscroll = _autoscr; \ diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 759b43c16..fc96ca913 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -50,7 +50,7 @@ typedef Eet_Data_Descriptor E_Config_DD; /* increment this whenever a new set of config values are added but the users * config doesn't need top be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 0x0100 +#define E_CONFIG_FILE_GENERATION 0x0101 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_EVAS_ENGINE_DEFAULT 0 @@ -113,10 +113,10 @@ struct _E_Config Evas_List *font_fallbacks; // GUI Evas_List *font_defaults; // GUI Evas_List *themes; // GUI - Evas_List *mouse_bindings; + Evas_List *mouse_bindings; // GUI Evas_List *key_bindings; // GUI Evas_List *signal_bindings; - Evas_List *wheel_bindings; + Evas_List *wheel_bindings; // GUI Evas_List *path_append_data; // GUI Evas_List *path_append_images; // GUI Evas_List *path_append_fonts; // GUI @@ -333,6 +333,9 @@ struct _E_Config_Gadcon_Client struct { int pos, size, res; } geom; + struct { + int seq, flags; + } state_info; const char *style; unsigned char autoscroll; unsigned char resizable; diff --git a/src/bin/e_configure.c b/src/bin/e_configure.c index bd92dc4d4..756baa84b 100644 --- a/src/bin/e_configure.c +++ b/src/bin/e_configure.c @@ -80,7 +80,7 @@ e_configure_show(E_Container *con) e_configure_header_item_add(eco, "enlightenment/behavior", _("Behavior")); e_configure_standard_item_add(eco, "enlightenment/focus", _("Window Focus"), e_int_config_focus); e_configure_standard_item_add(eco, "enlightenment/keys", _("Key Bindings"), e_int_config_keybindings); - e_configure_standard_item_add(eco, "enlightenment/mouse_binding_left", _("Mouse Bindings"), e_int_config_mousebindings); + e_configure_standard_item_add(eco, "enlightenment/mouse_clean", _("Mouse Bindings"), e_int_config_mousebindings); e_configure_standard_item_add(eco, "enlightenment/menus", _("Menus"), e_int_config_menus); e_configure_header_item_add(eco, "enlightenment/misc", _("Miscellaneous")); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 9abc3bac6..83cea27e1 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -6,7 +6,7 @@ static void _e_gadcon_free(E_Gadcon *gc); static void _e_gadcon_client_free(E_Gadcon_Client *gcc); -static void _e_gadcon_movereisze_handle(E_Gadcon_Client *gcc); +static void _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc); static int _e_gadcon_cb_client_scroll_timer(void *data); static int _e_gadcon_cb_client_scroll_animator(void *data); static void _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -42,12 +42,117 @@ static void e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas static int e_gadcon_layout_pack(Evas_Object *obj, Evas_Object *child); static void e_gadcon_layout_pack_size_set(Evas_Object *obj, int size); static void e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size); -static void e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res); +static void e_gadcon_layout_pack_options_set(Evas_Object *obj, E_Gadcon_Client *gcc); static void e_gadcon_layout_pack_min_size_set(Evas_Object *obj, int w, int h); static void e_gadcon_layout_pack_aspect_set(Evas_Object *obj, int w, int h); static void e_gadcon_layout_pack_aspect_pad_set(Evas_Object *obj, int w, int h); static void e_gadcon_layout_unpack(Evas_Object *obj); +/********************/ +#define E_LAYOUT_ITEM_DRAG_RESIST_LEVEL 10 + +typedef struct _E_Smart_Data E_Smart_Data; +typedef struct _E_Layout_Item_Container E_Layout_Item_Container; + +static void _e_gadcon_client_current_position_sync(E_Gadcon_Client *gcc); +static void _e_gadcon_layout_smart_sync_clients(E_Gadcon *gc); +static void _e_gadcon_layout_smart_gadcon_position_shrinked_mode(E_Smart_Data *sd); +static void _e_gadcon_layout_smart_gadcon_clients_save(E_Smart_Data *sd); +static void _e_gadcon_layout_smart_gadcons_asked_position_set(E_Smart_Data *sd); +static Evas_List *_e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd); +static void _e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Evas_List **list); +static void _e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Evas_List **list); +static E_Layout_Item_Container * _e_gadcon_layout_smart_containers_position_adjust(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2); +static void _e_gadcon_layout_smart_position_items_inside_container(E_Smart_Data *sd, E_Layout_Item_Container *lc); +static void _e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2); +static void _e_gadcon_layout_smart_restore_gadcons_position_before_move(E_Smart_Data *sd, E_Layout_Item_Container **lc_moving, E_Layout_Item_Container *lc_back, Evas_List **con_list); + +typedef enum _E_Gadcon_Layout_Item_State +{ + E_LAYOUT_ITEM_STATE_NONE, + E_LAYOUT_ITEM_STATE_POS_INC, + E_LAYOUT_ITEM_STATE_POS_DEC, + E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC, + E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC, + E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC, + E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC, +} E_Gadcon_Layout_Item_State; + +typedef enum _E_Gadcon_Layout_Item_Flags +{ + E_GADCON_LAYOUT_ITEM_LOCK_NONE = 0x00000000, + E_GADCON_LAYOUT_ITEM_LOCK_POSITION = 0x00000001, + E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE = 0x00000002 +} E_Gadcon_Layout_Item_Flags; + +typedef enum _E_Layout_Item_Container_State +{ + E_LAYOUT_ITEM_CONTAINER_STATE_NONE, + E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC, + E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC, + E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC, + E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC, + E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC, + E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC, + E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED +} E_Layout_Item_Container_State; + +struct _E_Layout_Item_Container +{ + int pos, size, prev_pos, prev_size; + + struct { + int min_seq, max_seq; + } state_info; + + E_Smart_Data *sd; + Evas_List *items; + + E_Layout_Item_Container_State state; +}; + +#define LC_FREE(__lc) \ + if (__lc->items) \ + evas_list_free(__lc->items); \ + E_FREE(__lc) + +#define E_LAYOUT_ITEM_CONTAINER_STATE_SET(__con_state, __bi_state) \ + if (__bi_state == E_LAYOUT_ITEM_STATE_NONE) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_INC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_POS_DEC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC; \ + else if (__bi_state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC) \ + __con_state = E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC + +#define LC_OVERLAP(__lc, __lc2) \ + ( __lc2->pos >= __lc->pos && (__lc2->pos < (__lc->pos + __lc->size)) || \ + __lc->pos >= __lc2->pos && (__lc->pos < (__lc2->pos + __lc2->size))) + +#define E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(__lc, __bi, __increase) \ + if (__lc->sd->horizontal) \ + { \ + if (__increase) \ + __lc->size += __bi->w; \ + else \ + __lc->size -= __bi->w; \ + } \ + else \ + { \ + if (__increase) \ + __lc->size += __bi->h; \ + else \ + __lc->size -= __bi->h; \ + } +/********************/ + static Evas_Hash *providers = NULL; static Evas_List *providers_list = NULL; static Evas_List *gadcons = NULL; @@ -243,20 +348,19 @@ e_gadcon_populate(E_Gadcon *gc) gcc->config.pos = cf_gcc->geom.pos; gcc->config.size = cf_gcc->geom.size; gcc->config.res = cf_gcc->geom.res; + gcc->state_info.seq = cf_gcc->state_info.seq; + gcc->state_info.flags = cf_gcc->state_info.flags; if (gcc->o_frame) - e_gadcon_layout_pack_options_set(gcc->o_frame, - gcc->config.pos, - gcc->config.size, - gcc->config.res); + e_gadcon_layout_pack_options_set(gcc->o_frame, gcc); else - e_gadcon_layout_pack_options_set(gcc->o_base, - gcc->config.pos, - gcc->config.size, - gcc->config.res); + e_gadcon_layout_pack_options_set(gcc->o_base, gcc); + e_gadcon_client_autoscroll_set(gcc, cf_gcc->autoscroll); e_gadcon_client_resizable_set(gcc, cf_gcc->resizable); if (gcc->client_class->func.orient) gcc->client_class->func.orient(gcc); + + _e_gadcon_client_save(gcc); } } } @@ -337,18 +441,17 @@ e_gadcon_populate_class(E_Gadcon *gc, const E_Gadcon_Client_Class *cc) gcc->config.pos = cf_gcc->geom.pos; gcc->config.size = cf_gcc->geom.size; gcc->config.res = cf_gcc->geom.res; + gcc->state_info.seq = cf_gcc->state_info.seq; + gcc->state_info.flags = cf_gcc->state_info.flags; if (gcc->o_frame) - e_gadcon_layout_pack_options_set(gcc->o_frame, - gcc->config.pos, - gcc->config.size, - gcc->config.res); + e_gadcon_layout_pack_options_set(gcc->o_frame, gcc); else - e_gadcon_layout_pack_options_set(gcc->o_base, - gcc->config.pos, - gcc->config.size, - gcc->config.res); + e_gadcon_layout_pack_options_set(gcc->o_base, gcc); + if (gcc->client_class->func.orient) - gcc->client_class->func.orient(gcc); + gcc->client_class->func.orient(gcc); + + _e_gadcon_client_save(gcc); } } } @@ -767,7 +870,7 @@ e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h) else e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); } - _e_gadcon_movereisze_handle(gcc); + _e_gadcon_moveresize_handle(gcc); } EAPI void @@ -787,7 +890,7 @@ e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h) else e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); } - _e_gadcon_movereisze_handle(gcc); + _e_gadcon_moveresize_handle(gcc); } EAPI void @@ -807,8 +910,8 @@ e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll) } else { - e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); } } else @@ -901,27 +1004,26 @@ _e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi) E_Gadcon *gc; gcc = data; - gc = gcc->gadcon; + e_gadcon_layout_freeze(gcc->gadcon->o_container); if (gcc->autoscroll) gcc->autoscroll = 0; - else gcc->autoscroll = 1; + else gcc->autoscroll = 1; + e_gadcon_client_autoscroll_set(gcc, gcc->autoscroll); _e_gadcon_client_save(gcc); - e_gadcon_unpopulate(gc); - e_gadcon_populate(gc); + e_gadcon_layout_thaw(gcc->gadcon->o_container); } static void _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi) { E_Gadcon_Client *gcc; - E_Gadcon *gc; gcc = data; - gc = gcc->gadcon; + e_gadcon_layout_freeze(gcc->gadcon->o_container); if (gcc->resizable) gcc->resizable = 0; else gcc->resizable = 1; + e_gadcon_client_resizable_set(gcc, gcc->resizable); _e_gadcon_client_save(gcc); - e_gadcon_unpopulate(gc); - e_gadcon_populate(gc); + e_gadcon_layout_thaw(gcc->gadcon->o_container); } static void @@ -1156,7 +1258,7 @@ _e_gadcon_client_free(E_Gadcon_Client *gcc) } static void -_e_gadcon_movereisze_handle(E_Gadcon_Client *gcc) +_e_gadcon_moveresize_handle(E_Gadcon_Client *gcc) { Evas_Coord x, y, w, h; @@ -1267,7 +1369,7 @@ _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void E_Gadcon_Client *gcc; gcc = data; - _e_gadcon_movereisze_handle(gcc); + _e_gadcon_moveresize_handle(gcc); } static void @@ -1277,7 +1379,7 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) E_Config_Gadcon *cf_gc; E_Config_Gadcon_Client *cf_gcc; int ok; - + ok = 0; for (l = e_config->gadcons; l; l = l->next) { @@ -1300,6 +1402,8 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) cf_gcc->geom.pos = gcc->config.pos; cf_gcc->geom.size = gcc->config.size; cf_gcc->geom.res = gcc->config.res; + cf_gcc->state_info.seq = gcc->state_info.seq; + cf_gcc->state_info.flags = gcc->state_info.flags; cf_gcc->autoscroll = gcc->autoscroll; if (cf_gcc->style) evas_stringshare_del(cf_gcc->style); cf_gcc->style = NULL; @@ -1329,6 +1433,8 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) cf_gcc->geom.pos = gcc->config.pos; cf_gcc->geom.size = gcc->config.size; cf_gcc->geom.res = gcc->config.res; + cf_gcc->state_info.seq = gcc->state_info.seq; + cf_gcc->state_info.flags = gcc->state_info.flags; cf_gcc->autoscroll = gcc->autoscroll; if (cf_gcc->style) evas_stringshare_del(cf_gcc->style); cf_gcc->style = NULL; @@ -1336,7 +1442,6 @@ _e_gadcon_client_save(E_Gadcon_Client *gcc) cf_gcc->style = evas_stringshare_add(gcc->style); cf_gcc->resizable = gcc->resizable; cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc); - ok++; } e_config_save_queue(); } @@ -1473,20 +1578,13 @@ static void _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source) { E_Gadcon_Client *gcc; - Evas_Coord x, y; gcc = data; evas_object_raise(gcc->o_event); evas_object_stack_below(gcc->o_control, gcc->o_event); gcc->moving = 1; evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); - evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL); - if (gcc->o_frame) - evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, NULL, NULL); - else - evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, NULL, NULL); - gcc->sx -= x; - gcc->sy -= y; + gcc->state_info.resist = 0; } static void @@ -1495,8 +1593,11 @@ _e_gadcon_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission E_Gadcon_Client *gcc; gcc = data; - gcc->moving = 0; - _e_gadcon_client_save(gcc); + gcc->moving = 0; + + gcc->state_info.state = E_LAYOUT_ITEM_STATE_NONE; + gcc->state_info.resist = 0; + _e_gadcon_layout_smart_sync_clients(gcc->gadcon); } static void @@ -1509,18 +1610,61 @@ _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, if (!gcc->moving) return; evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y); x = x - gcc->dx; - y = y - gcc->dy; + y = y - gcc->dy; + + gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + _e_gadcon_client_current_position_sync(gcc); + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + { + if (x > 0) + { + if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_INC) + gcc->state_info.resist = 0; + gcc->state_info.state = E_LAYOUT_ITEM_STATE_POS_INC; + x = 1; + } + else if (x < 0) + { + if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC) + gcc->state_info.resist = 0; + gcc->state_info.state = E_LAYOUT_ITEM_STATE_POS_DEC; + x = -1; // would like to move by one pixel to be safe + } + } + else + { + if (y > 0) + { + if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_INC) + gcc->state_info.resist = 0; + gcc->state_info.state = E_LAYOUT_ITEM_STATE_POS_INC; + y = 1; + } + else if (y < 0) + { + if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC) + gcc->state_info.resist = 0; + gcc->state_info.state = E_LAYOUT_ITEM_STATE_POS_DEC; + y = -1; + } + } + + if (gcc->o_frame) evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); else evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) { if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, w); + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + x, w); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, w); - gcc->config.pos = gcc->sx + x; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w); + + //gcc->config.pos will be set in smart_recofigure + //gcc->config.size will be set in smart_reconfigure + //original: gcc->config.pos = gcc->sx + x; gcc->config.size = w; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); gcc->config.res = w; @@ -1528,38 +1672,37 @@ _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, else { if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, h); + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + y, h); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, h); - gcc->config.pos = gcc->sy + y; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h); + + //gcc->config.pos will be set in smart_recofigure + //gcc->config.size will be set in smart_reconfigure + //original: gcc->config.pos = gcc->sy + y; gcc->config.size = h; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); gcc->config.res = h; } + gcc->dx += x; + gcc->dy += y; } static void _e_gadcon_client_resize_start(E_Gadcon_Client *gcc) { - Evas_Coord x, y; - evas_object_raise(gcc->o_event); evas_object_stack_below(gcc->o_control, gcc->o_event); gcc->resizing = 1; evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); - evas_object_geometry_get(gcc->gadcon->o_container, &x, &y, NULL, NULL); - if (gcc->o_frame) - evas_object_geometry_get(gcc->o_frame, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh); - else - evas_object_geometry_get(gcc->o_base, &gcc->sx, &gcc->sy, &gcc->sw, &gcc->sh); - gcc->sx -= x; - gcc->sy -= y; } static void _e_gadconclient_resize_stop(E_Gadcon_Client *gcc) { gcc->resizing = 0; + + gcc->state_info.state = E_LAYOUT_ITEM_STATE_NONE; + _e_gadcon_layout_smart_sync_clients(gcc->gadcon); _e_gadcon_client_save(gcc); } @@ -1586,32 +1729,68 @@ _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emi evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y); x = x - gcc->dx; y = y - gcc->dy; + + gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + if (gcc->o_frame) evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); else evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); + + _e_gadcon_client_current_position_sync(gcc); + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) { - if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, gcc->sw - x); + if (x > 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC; + } + else if (x < 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC; + } + } + else + { + if (y > 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC; + } + else if (y < 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC; + } + } + + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + x, w - x); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, gcc->sw - x); - gcc->config.pos = gcc->sx + x; - gcc->config.size = gcc->sw - x; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w - x); + //gcc->config.pos will be set in smart_reconfigure + //gcc->config.size will be set in smart_reconfigure + //original: gcc->config.pos = gcc->sx + x; + //original: gcc->config.size = gcc->sw - x; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); gcc->config.res = w; } else { if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, gcc->sh - y); + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + y, h - y); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, gcc->sh - y); - gcc->config.pos = gcc->sy + y; - gcc->config.size = gcc->sh - y; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h - y); + //gcc->config.pos will be set in smart_reconfigure + //gcc->config.size will be set in smart_reconfigure + //original: gcc->config.pos = gcc->sy + y; + //original: gcc->config.size = gcc->sh - y; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = h; + gcc->config.res = h; + } + gcc->dx += x; + gcc->dy += y; } static void @@ -1637,41 +1816,73 @@ _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *em evas_pointer_canvas_xy_get(gcc->gadcon->evas, &x, &y); x = x - gcc->dx; y = y - gcc->dy; + + gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + if (gcc->o_frame) evas_object_geometry_get(gcc->o_frame, NULL, NULL, &w, &h); else evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); + + _e_gadcon_client_current_position_sync(gcc); + + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + { + if (x > 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC; + } + else if (x < 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC; + } + } + else + { + if (y > 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC; + } + else if (y < 0) + { + gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC; + } + } + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) { if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx, gcc->sw + x); + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, w + x); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx, gcc->sw + x); - gcc->config.pos = gcc->sx; - gcc->config.size = gcc->sw + x; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, w + x); + //gcc->config.pos is set inside smart_reconfigure + //gcc->config.size is set inside smart_reconfigure + //original: gcc->config.pos = gcc->sx; + //original: gcc->config.size = gcc->sw + x; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); gcc->config.res = w; } else { if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy, gcc->sh + y); + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, h + y); else - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy, gcc->sh + y); - gcc->config.pos = gcc->sy; - gcc->config.size = gcc->sh + y; + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, h + y); + //gcc->config.pos is set inside smart_reconfigure + //gcc->config.size is set inside smart_reconfigure + //original: gcc->config.pos = gcc->sy; + //original: gcc->config.size = gcc->sh + y; evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); gcc->config.res = h; } + gcc->dx += x; + gcc->dy += y; } - - /* a smart object JUST for gadcon */ -typedef struct _E_Smart_Data E_Smart_Data; typedef struct _E_Gadcon_Layout_Item E_Gadcon_Layout_Item; struct _E_Smart_Data @@ -1691,12 +1902,15 @@ struct _E_Gadcon_Layout_Item { E_Smart_Data *sd; struct { - int pos, size, size2, res; + int pos, size, size2, res, prev_pos, prev_size; } ask; int hookp; struct { int w, h; } min, aspect, aspect_pad; + + E_Gadcon_Client *gcc; + Evas_Coord x, y, w, h; Evas_Object *obj; unsigned char can_move : 1; @@ -1719,6 +1933,12 @@ static void _e_gadcon_layout_smart_color_set(Evas_Object *obj, int r, int g, int static void _e_gadcon_layout_smart_clip_set(Evas_Object *obj, Evas_Object *clip); static void _e_gadcon_layout_smart_clip_unset(Evas_Object *obj); +static void _e_gadcon_layout_smart_min_cur_size_calc(E_Smart_Data *sd, int *min, int *mino, int *cur); +void _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur); + +static int _e_gadcon_layout_smart_sort_by_sequence_number_cb(void *d1, void *d2); +static int _e_gadcon_layout_smart_sort_by_position_cb(void *d1, void *d2); + /* local subsystem globals */ static Evas_Smart *_e_smart = NULL; @@ -1797,6 +2017,7 @@ e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) if (w) *w = sd->minw; if (h) *h = sd->minh; + /* for (l = sd->items; l; l = l->next) { @@ -1827,10 +2048,12 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) E_Smart_Data *sd; Evas_Coord tw = 0, th = 0; + if (!obj) return; sd = evas_object_smart_data_get(obj); if (!sd) return; + if (sd->horizontal) tw = sd->req; else @@ -1875,6 +2098,9 @@ e_gadcon_layout_pack(Evas_Object *obj, Evas_Object *child) static void e_gadcon_layout_pack_size_set(Evas_Object *obj, int size) { + //FIXME: simplify this function until the + //is redone _e_gadcon_layout_smart_gadcons_asked_position_set(E_Smart_Data *sd) + // E_Gadcon_Layout_Item *bi; int xx; @@ -1947,18 +2173,45 @@ e_gadcon_layout_pack_request_set(Evas_Object *obj, int pos, int size) /* called when restoring config from saved config */ static void -e_gadcon_layout_pack_options_set(Evas_Object *obj, int pos, int size, int res) +e_gadcon_layout_pack_options_set(Evas_Object *obj, E_Gadcon_Client *gcc) { - E_Gadcon_Layout_Item *bi; + int ok, seq; + Evas_List *l; + E_Gadcon_Layout_Item *bi, *bi2; if (!obj) return; bi = evas_object_data_get(obj, "e_gadcon_layout_data"); if (!bi) return; - bi->ask.res = res; - bi->ask.size = size; - bi->ask.pos = pos; - _e_gadcon_layout_smart_reconfigure(bi->sd); + bi->ask.res = gcc->config.res; + bi->ask.size = gcc->config.size; + bi->ask.pos = gcc->config.pos; + bi->gcc = gcc; + + ok = 0; + if (!gcc->state_info.seq) + ok = 1; + + seq = 1; + for (l = bi->sd->items; l; l = l->next) + { + bi2 = evas_object_data_get(l->data, "e_gadcon_layout_data"); + if (bi == bi2) continue; + + if (bi->gcc->state_info.seq == bi2->gcc->state_info.seq) + ok = 1; + + if (bi2->gcc->state_info.seq > seq) + seq = bi2->gcc->state_info.seq; + } + + if (ok) + { + gcc->state_info.seq = seq + 1; + gcc->state_info.want_save = 1; + gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_NONE; + } + _e_gadcon_layout_smart_reconfigure(bi->sd); } static void @@ -2074,43 +2327,17 @@ _e_gadcon_layout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void e_gadcon_layout_unpack(obj); } -static int -_e_gadcon_sort_cb(void *d1, void *d2) -{ - E_Gadcon_Layout_Item *bi1, *bi2; - int v1, v2; - - bi1 = evas_object_data_get(d1, "e_gadcon_layout_data"); - bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); - v1 = (bi1->ask.pos + (bi1->ask.size / 2)) - bi1->hookp; - if (v1 < 0) v1 = -v1; - v2 = (bi2->ask.pos + (bi2->ask.size / 2)) - bi2->hookp; - if (v2 < 0) v2 = -v2; - return v1 - v2; -} - -static int -_e_gadcon_sort_all_cb(void *d1, void *d2) -{ - E_Gadcon_Layout_Item *bi1, *bi2; - int v1, v2; - - bi1 = evas_object_data_get(d1, "e_gadcon_layout_data"); - bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); - v1 = (bi1->ask.pos + (bi1->ask.size / 2)); - if (v1 < 0) v1 = -v1; - v2 = (bi2->ask.pos + (bi2->ask.size / 2)); - if (v2 < 0) v2 = -v2; - return v1 - v2; -} - static void _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) { Evas_Coord x, y, w, h, xx, yy; Evas_List *l, *l2; int min, mino, cur; - Evas_List *list_s = NULL, *list_m = NULL, *list_e = NULL, *list = NULL; + Evas_List *list = NULL; + E_Gadcon_Layout_Item *bi; + E_Layout_Item_Container *lc; + int i; + int set_prev_pos = 0; if (sd->frozen) return; if (sd->doing_config) @@ -2119,569 +2346,114 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) return; } - x = sd->x; y = sd->y; w = sd->w; h = sd->h; + //x = sd->x; y = sd->y; w = sd->w; h = sd->h; min = mino = cur = 0; - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - bi->ask.size2 = bi->ask.size; - if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) - { - if (sd->horizontal) - { - bi->ask.size2 = (((h - bi->aspect_pad.h) * bi->aspect.w) / - bi->aspect.h) + bi->aspect_pad.w; - if (bi->ask.size2 > bi->min.w) - { - min += bi->ask.size2; - cur += bi->ask.size2; - } - else - { - cur += bi->min.w; - min += bi->min.w; - } - } - else - { - bi->ask.size2 = (((w - bi->aspect_pad.w) * bi->aspect.h) / - bi->aspect.w) + bi->aspect_pad.h; - if (bi->ask.size2 > bi->min.h) - { - min += bi->ask.size2; - cur += bi->ask.size2; - } - else - { - cur += bi->min.h; - min += bi->min.h; - } - } - } - else - { - if (sd->horizontal) - { - min += bi->min.w; - if (bi->min.h > mino) mino = bi->min.h; - if (bi->ask.size < bi->min.w) - cur += bi->min.w; - else - cur += bi->ask.size; - } - else - { - min += bi->min.h; - if (bi->min.w > mino) mino = bi->min.w; - if (bi->ask.size < bi->min.h) - cur += bi->min.h; - else - cur += bi->ask.size; - } - } - } - + _e_gadcon_layout_smart_min_cur_size_calc(sd, &min, &mino, &cur); + + // update sd info about minw req etc + // here request for gadcon size !! if (sd->horizontal) { - if (cur <= w) + if ((sd->minw != min) || (sd->minh != mino)) { - /* all is fine - it should all fit */ - } - else - { - int sub, give, num, given, i; - - sub = cur - w; /* we need to find "sub" extra pixels */ - if (min <= w) - { - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - give = bi->ask.size - bi->min.w; // how much give does this have? - if (give < sub) give = sub; - bi->ask.size2 = bi->ask.size - give; - sub -= give; - if (sub <= 0) break; - } - } - else - { /* EEK - all items just cant fit at their minimum! what do we do? */ - num = 0; - num = evas_list_count(sd->items); - give = min - w; // how much give total below minw we need - given = 0; - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - bi->ask.size2 = bi->min.w; - if (!l->next) - { - bi->ask.size2 -= (give - given); - } - else - { - i = (give + (num / 2)) / num; - given -= i; - bi->ask.size2 -= i; - } - } - } + sd->minw = min; + sd->minh = mino; + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); } } else { - if (cur <= h) + if ((sd->minh != min) || (sd->minw != mino)) { - /* all is fine - it should all fit */ + sd->minh = min; + sd->minw = mino; + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); + } + } + + if (sd->req != cur) + { + if (((sd->horizontal) && (cur >= sd->minw)) || + ((!sd->horizontal) && (cur >= sd->minh))) + { + sd->req = cur; + evas_object_smart_callback_call(sd->obj, "size_request", NULL); } else { - int sub, give, num, given, i; - - sub = cur - h; /* we need to find "sub" extra pixels */ - if (min <= h) - { - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - give = bi->ask.size - bi->min.h; // how much give does this have? - if (give < sub) give = sub; - bi->ask.size2 = bi->ask.size - give; - sub -= give; - if (sub <= 0) break; - } - } - else - { /* EEK - all items just cant fit at their minimum! what do we do? */ - num = 0; - num = evas_list_count(sd->items); - give = min - h; // how much give total below minw we need - given = 0; - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - bi->ask.size2 = bi->min.h; - if (!l->next) - { - bi->ask.size2 -= (give - given); - } - else - { - i = (give + (num / 2)) / num; - given -= i; - bi->ask.size2 -= i; - } - } - } - } - } - - for (l = sd->items; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - list = evas_list_append(list, obj); - if (sd->horizontal) - { - xx = bi->ask.pos + (bi->ask.size / 2); - if (xx < (bi->ask.res / 3)) - { /* hooked to start */ - bi->x = bi->ask.pos; - bi->w = bi->ask.size2; - list_s = evas_list_append(list_s, obj); - bi->hookp = 0; - } - else if (xx > ((2 * bi->ask.res) / 3)) - { /* hooked to end */ - bi->x = (bi->ask.pos - bi->ask.res) + w; - bi->w = bi->ask.size2; - list_e = evas_list_append(list_e, obj); - bi->hookp = bi->ask.res; - } - else - { /* hooked to middle */ - if ((bi->ask.pos <= (bi->ask.res / 2)) && - ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2))) - { /* straddles middle */ - if (bi->ask.res > 2) - bi->x = (w / 2) + - (((bi->ask.pos + (bi->ask.size2 / 2) - - (bi->ask.res / 2)) * - (bi->ask.res / 2)) / - (bi->ask.res / 2)) - (bi->ask.size2 / 2); - else - bi->x = w / 2; - bi->w = bi->ask.size2; - } - else - { /* either side of middle */ - bi->x = (bi->ask.pos - (bi->ask.res / 2)) + (w / 2); - bi->w = bi->ask.size2; - } - list_m = evas_list_append(list_m, obj); - bi->hookp = bi->ask.res / 2; - } - if (bi->x < 0) bi->x = 0; - else if ((bi->x + bi->w) > w) bi->x = w - bi->w; - } - else - { - yy = bi->ask.pos + (bi->ask.size2 / 2); - if (yy < (bi->ask.res / 3)) - { /* hooked to start */ - bi->y = bi->ask.pos; - bi->h = bi->ask.size2; - list_s = evas_list_append(list_s, obj); - bi->hookp = 0; - } - else if (yy > ((2 * bi->ask.res) / 3)) - { /* hooked to end */ - bi->y = (bi->ask.pos - bi->ask.res) + h; - bi->h = bi->ask.size2; - list_e = evas_list_append(list_e, obj); - bi->hookp = bi->ask.res; - } - else - { /* hooked to middle */ - if ((bi->ask.pos <= (bi->ask.res / 2)) && - ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2))) - { /* straddles middle */ - if (bi->ask.res > 2) - bi->y = (h / 2) + - (((bi->ask.pos + (bi->ask.size2 / 2) - - (bi->ask.res / 2)) * - (bi->ask.res / 2)) / - (bi->ask.res / 2)) - (bi->ask.size2 / 2); - else - bi->y = h / 2; - bi->h = bi->ask.size2; - } - else - { /* either side of middle */ - bi->y = (bi->ask.pos - (bi->ask.res / 2)) + (h / 2); - bi->h = bi->ask.size2; - } - list_s = evas_list_append(list_s, obj); - bi->hookp = bi->ask.res / 2; - } - if (bi->y < 0) bi->y = 0; - else if ((bi->y + bi->h) > h) bi->y = h - bi->h; - } - } - list_s = evas_list_sort(list_s, evas_list_count(list_s), _e_gadcon_sort_cb); - list_m = evas_list_sort(list_m, evas_list_count(list_m), _e_gadcon_sort_cb); - list_e = evas_list_sort(list_e, evas_list_count(list_e), _e_gadcon_sort_cb); - list = evas_list_sort(list, evas_list_count(list), _e_gadcon_sort_all_cb); - for (l = list_s; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - again1: - for (l2 = l->prev; l2; l2 = l2->prev) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; if (sd->horizontal) - { - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) - { - bi->x = bi2->x + bi2->w; - goto again1; - } - } + sd->req = sd->minw; else - { - if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) - { - bi->y = bi2->y + bi2->h; - goto again1; - } - } + sd->req = sd->minh; } } - for (l = list_m; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - again2: - for (l2 = l->prev; l2; l2 = l2->prev) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (sd->horizontal) - { - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) - { - if ((bi2->x + (bi2->w / 2)) < (w / 2)) - bi->x = bi2->x - bi->w; - else - bi->x = bi2->x + bi2->w; - goto again2; - } - } - else - { - if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) - { - if ((bi2->y + (bi2->h / 2)) < (h / 2)) - bi->y = bi2->y - bi->h; - else - bi->y = bi2->y + bi2->h; - goto again2; - } - } - } - } - for (l = list_e; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - again3: - for (l2 = l->prev; l2; l2 = l2->prev) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (sd->horizontal) - { - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) - { - bi->x = bi2->x - bi->w; - goto again3; - } - } - else - { - if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) - { - bi->y = bi2->y - bi->h; - goto again3; - } - } - } - } - for (l = list; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - bi->can_move = 1; - if (sd->horizontal) - { - if (!l->prev) - { - if (bi->x <= 0) - { - bi->x = 0; - bi->can_move = 0; - } - } - if (!l->next) - { - if ((bi->x + bi->w) >= w) - { - bi->x = w - bi->w; - bi->can_move = 0; - } - } - } - else - { - if (!l->prev) - { - if (bi->y <= 0) - { - bi->y = 0; - bi->can_move = 0; - } - } - if (!l->next) - { - if ((bi->y + bi->h) >= h) - { - bi->y = h - bi->h; - bi->can_move = 0; - } - } - } - } - if (sd->horizontal) - { - int overlap; - int count; - - overlap = 1; - count = 0; - while (overlap) - { - overlap = 0; - for (l = list; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - if (bi->can_move) - { - for (l2 = l->next; l2; l2 = l2->next) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) - { - bi->x = bi2->x - bi->w; - if (!bi2->can_move) bi->can_move = 0; - if ((bi->x + bi->w) >= w) bi->x = w - bi->w; - if (bi->x <= 0) bi->x = 0; - overlap = 1; - } - } - for (l2 = l->prev; l2; l2 = l2->prev) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) - { - bi->x = bi2->x + bi2->w; - if (!bi2->can_move) bi->can_move = 0; - if ((bi->x + bi->w) >= w) bi->x = w - bi->w; - if (bi->x <= 0) bi->x = 0; - overlap = 1; - } - } - } - } - count++; - if (count > 200) break; // quick infinite loop fix - } + _e_gadcon_layout_smart_gadcons_width_adjust(sd, min, cur); + + if (((sd->horizontal) && (sd->w <= sd->req)) || ((!sd->horizontal) && (sd->h <= sd->req))) + { + _e_gadcon_layout_smart_gadcon_position_shrinked_mode(sd); + set_prev_pos = 0; } else - { - /* FIXME: for how this is just a copy of the above but in the vertical - * so when the above is "fixeD" the below needs to mirror it - */ - int overlap; - int count; - - overlap = 1; - count = 0; - while (overlap) + { + _e_gadcon_layout_smart_gadcons_asked_position_set(sd); + + list = _e_gadcon_layout_smart_gadcons_wrap(sd); + + _e_gadcon_layout_smart_gadcons_position(sd, &list); + + for (l = list; l; l = l->next) { - overlap = 0; - for (l = list; l; l = l->next) - { - E_Gadcon_Layout_Item *bi; - Evas_Object *obj; - - obj = l->data; - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; - if (bi->can_move) - { - for (l2 = l->next; l2; l2 = l2->next) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) - { - bi->y = bi2->y - bi->h; - if (!bi2->can_move) bi->can_move = 0; - if ((bi->y + bi->h) >= h) bi->y = h - bi->h; - if (bi->y <= 0) bi->y = 0; - overlap = 1; - } - } - for (l2 = l->prev; l2; l2 = l2->prev) - { - E_Gadcon_Layout_Item *bi2; - - obj = l2->data; - bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi2) continue; - if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) - { - bi->y = bi2->y + bi2->h; - if (!bi2->can_move) bi->can_move = 0; - if ((bi->y + bi->h) >= h) bi->y = h - bi->h; - if (bi->y <= 0) bi->y = 0; - overlap = 1; - } - } - } - } - count++; - if (count > 200) break; // quick infinite loop fix + lc = l->data; + LC_FREE(lc); } + list = evas_list_free(list); + set_prev_pos = 1; } - - evas_list_free(list_s); - evas_list_free(list_m); - evas_list_free(list_e); - evas_list_free(list); + + + sd->items = evas_list_sort(sd->items, evas_list_count(sd->items), + _e_gadcon_layout_smart_sort_by_position_cb); + for (l = sd->items, i = 1; l; l = l->next, i++) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + bi->gcc->state_info.seq = i; + + if (set_prev_pos) + { + if (sd->horizontal) + { + bi->ask.prev_pos = bi->x; + bi->ask.prev_size = bi->w; + } + else + { + bi->ask.prev_pos = bi->y; + bi->ask.prev_size = bi->h; + } + } + if (sd->horizontal) + { + if ((bi->x == bi->ask.pos) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION)) + bi->gcc->state_info.flags |= E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + else + { + if ((bi->y == bi->ask.pos) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION)) + bi->gcc->state_info.flags |= E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + + if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) + { + if (((sd->horizontal) && (bi->x != bi->ask.pos)) || + ((!sd->horizontal) && (bi->y != bi->ask.pos))) + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + } for (l = sd->items; l; l = l->next) { @@ -2693,15 +2465,15 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) if (!bi) continue; if (sd->horizontal) { - bi->h = h; - xx = x + bi->x; - yy = y + ((h - bi->h) / 2); + bi->h = sd->h; + xx = sd->x + bi->x; + yy = sd->y + ((sd->h - bi->h) / 2); } else { - bi->w = w; - xx = x + ((w - bi->w) / 2); - yy = y + bi->y; + bi->w = sd->w; + xx = sd->x + ((sd->w - bi->w) / 2); + yy = sd->y + bi->y; } evas_object_move(obj, xx, yy); evas_object_resize(obj, bi->w, bi->h); @@ -2904,3 +2676,1670 @@ _e_gadcon_layout_smart_clip_unset(Evas_Object *obj) if (!sd) return; evas_object_clip_unset(sd->clip); } + + +/* + * @min - the minimum width required by all the gadcons + * @cur - the current width required by all the gadcons + * @mino - the smalest width/height among all the objects + */ +static void +_e_gadcon_layout_smart_min_cur_size_calc(E_Smart_Data *sd, int *min, int *mino, int *cur) +{ + E_Gadcon_Layout_Item *bi; + Evas_List *l; + + // how much space all the gadgets takes in the shelf + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + bi->ask.size2 = bi->ask.size; + + if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) + { + if (sd->horizontal) + { + bi->ask.size2 = (((sd->h - bi->aspect_pad.h) * bi->aspect.w) / bi->aspect.h) + + bi->aspect_pad.w; + if (bi->ask.size2 > bi->min.w) + { + *min += bi->ask.size2; + *cur += bi->ask.size2; + } + else + { + *min += bi->min.w; + *cur += bi->min.w; + } + } + else + { + bi->ask.size2 = (((sd->w - bi->aspect_pad.w) * bi->aspect.h) / bi->aspect.w) + + bi->aspect_pad.h; + if (bi->ask.size2 > bi->min.h) + { + *min += bi->ask.size2; + *cur += bi->ask.size2; + } + else + { + *cur += bi->min.h; + *min += bi->min.h; + } + } + } + else + { + if (sd->horizontal) + { + *min += bi->min.w; + if (bi->min.h > *mino) *mino = bi->min.h; + //if (bi->min.w > *mino) *mino = bi->min.w; + if (bi->ask.size < bi->min.w) + *cur += bi->min.w; + else + *cur += bi->ask.size; + } + else + { + *min += bi->min.h; + //if (bi->min.h > *mino) *mino = bi->min.h; + if (bi->min.w > *mino) *mino = bi->min.w; + if (bi->ask.size < bi->min.h) + *cur += bi->min.h; + else + *cur += bi->ask.size; + } + } + } +} + +static int +_e_gadcon_layout_smart_width_smart_sort_reverse_cb(void *d1, void *d2) +{ + E_Gadcon_Layout_Item *bi, *bi2; + int v1, v2; + + bi = evas_object_data_get(d1, "e_gadcon_layout_data"); + bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); + + if (bi->sd->horizontal) + { + if (bi->ask.size2 > bi->min.w) + { + if (bi2->ask.size2 > bi2->min.w) + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + else + { + if (bi->ask.size2 == bi2->ask.size2) + return -1; + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + } + } + else + { + if (bi2->ask.size2 > bi2->min.w) + { + if (bi->ask.size2 == bi2->ask.size2) + return 1; + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + } + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else if (bi->ask.size2 > bi2->ask.size2) + return -1; + } + } + } + else + { + if (bi->ask.size2 > bi->min.h) + { + if (bi2->ask.size2 > bi2->min.h) + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + else + { + if (bi->ask.size2 == bi2->ask.size2) + return -1; + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + } + } + else + { + if (bi2->ask.size2 > bi2->min.h) + { + if (bi->ask.size2 == bi2->ask.size2) + return 1; + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else + return -1; + } + } + else + { + if (bi->ask.size2 < bi2->ask.size2) + return 1; + else if (bi->ask.size2 > bi2->ask.size2) + return -1; + } + } + } + return 0; +} + +void +_e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) +{ + int need, limit, reduce_total, reduce; + int max_size; + int c; + Evas_List *l, *l2; + E_Gadcon_Layout_Item *bi, *bi2; + + if (sd->horizontal) + { + if (sd->w < cur) + { + if (sd->w < min) + max_size = min; + else + max_size = cur; + + need = max_size - sd->w; + } + else + { + return; + } + } + else + { + if (sd->h < cur) + { + if (sd->h < min) + max_size = min; + else + max_size = cur; + need = max_size - sd->h; + } + else + { + return; + } + + } + + sd->items = evas_list_sort(sd->items, evas_list_count(sd->items), + _e_gadcon_layout_smart_width_smart_sort_reverse_cb); + + __adjust_size_again: + for (l = sd->items, c = 0; l; l = l->next) + { + if (l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + bi2 = evas_object_data_get(l->next->data, "e_gadcon_layout_data"); + + if (bi->ask.size2 > bi2->ask.size2) + { + limit = bi2->ask.size2; + c++; + break; + } + c++; + } + } + + if (evas_list_count(sd->items) == 1) + c = 1; + + if (l) + { + reduce = bi->ask.size2 - limit; + reduce_total = reduce * c; + + if (reduce_total <= need) + { + for (l2 = l; l2; l2 = l2->prev) + { + bi2 = evas_object_data_get(l2->data, "e_gadcon_layout_data"); + bi2->ask.size2 -= reduce; + } + need -= reduce * c; + if (need) + goto __adjust_size_again; + } + else + { + int reduce_by, c2; + + while (need) + { + reduce_by = 1; + while (1) + { + if (((reduce_by + 1) * c) < need) + reduce_by++; + else + break; + } + c2 = c; + for (l2 = sd->items; l2 && c2 && need; l2 = l2->next, c2--) + { + bi2 = evas_object_data_get(l2->data, "e_gadcon_layout_data"); + bi2->ask.size2 -= reduce_by; + need -= reduce_by; + } + } + } + } + else + { + int reduce_by, c2; + + while (need) + { + reduce_by = 1; + while (1) + { + if (((reduce_by + 1) * c) < need) + reduce_by++; + else + break; + } + c2 = c; + for (l2 = sd->items; l2 && c2 && need; l2 = l2->next, c2--) + { + bi2 = evas_object_data_get(l2->data, "e_gadcon_layout_data"); + bi2->ask.size2 -= reduce_by; + need -= reduce_by; + } + } + } +} + + +static int +_e_gadcon_layout_smart_sort_by_sequence_number_cb(void *d1, void *d2) +{ + E_Gadcon_Layout_Item *bi, *bi2; + + bi = evas_object_data_get(d1, "e_gadcon_layout_data"); + bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); + + if ((!bi->gcc->state_info.seq) && (!bi2->gcc->state_info.seq)) return 0; + else if (!bi->gcc->state_info.seq) return 1; + else if (!bi2->gcc->state_info.seq) return -1; + + return bi->gcc->state_info.seq - bi2->gcc->state_info.seq; +} + +static int +_e_gadcon_layout_smart_sort_by_position_cb(void *d1, void *d2) +{ + E_Gadcon_Layout_Item *bi, *bi2; + + bi = evas_object_data_get(d1, "e_gadcon_layout_data"); + bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); + + if (bi->sd->horizontal) + return (bi->x - bi2->x); + return (bi->y - bi2->y); +} + +static int +_e_gadcon_layout_smart_containers_sort_cb(void *d1, void *d2) +{ + E_Layout_Item_Container *lc, *lc2; + + lc = d1; + lc2 = d2; + + if (lc->pos < lc2->pos) return -1; + else if (lc->pos > lc2->pos) return 1; + + return 0; +} + +static int +_e_gadcon_layout_smart_seq_sort_cb(void *d1, void *d2) +{ + E_Gadcon_Layout_Item *bi, *bi2; + + bi = d1; + bi2 = d2; + + return (bi->gcc->state_info.seq - bi2->gcc->state_info.seq); +} + +static void +_e_gadcon_layout_smart_sync_clients(E_Gadcon *gc) +{ + E_Gadcon_Client *gcc; + Evas_List *l; + + for (l = gc->clients; l; l = l->next) + { + gcc = l->data; + _e_gadcon_client_save(gcc); + } +} +static void +_e_gadcon_client_current_position_sync(E_Gadcon_Client *gcc) +{ + E_Gadcon_Layout_Item *bi; + Evas_Object *o; + + o = gcc->o_frame ? gcc->o_frame : gcc->o_base; + bi = evas_object_data_get(o, "e_gadcon_layout_data"); + + gcc->state_info.prev_pos = gcc->config.pos; + gcc->state_info.prev_size = gcc->config.size; + if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) + gcc->config.pos = bi->x; + else + gcc->config.pos = bi->y; +} + +static void +_e_gadcon_layout_smart_gadcon_position_shrinked_mode(E_Smart_Data *sd) +{ + Evas_List *l; + E_Gadcon_Layout_Item *bi, *bi2; + void *tp; + int pos = 0; + + sd->items = evas_list_sort(sd->items, evas_list_count(sd->items), + _e_gadcon_layout_smart_sort_by_sequence_number_cb); + + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + if (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC) + { + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + bi->gcc->state_info.resist++; + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + } + else + { + bi->gcc->state_info.resist = 0; + if (l->next) + { + tp = l->next->data; + l->next->data = l->data; + l->data = tp; + + bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); + bi->gcc->config.pos = bi->ask.pos = bi2->ask.pos; + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + bi->gcc->state_info.want_save = 1; + bi2->gcc->state_info.want_save = 1; + break; + } + else + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + } + } + else if (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) + { + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + bi->gcc->state_info.resist++; + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + } + else + { + bi->gcc->state_info.resist = 0; + if (l->prev) + { + E_Gadcon_Layout_Item *bi2; + void *tp; + tp = l->prev->data; + l->prev->data = l->data; + l->data = tp; + + bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); + bi->gcc->config.pos = bi->ask.pos = bi2->ask.pos; + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + bi->gcc->state_info.want_save = 1; + bi2->gcc->state_info.want_save = 1; + break; + } + else + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + } + } + else if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC)) + { + if (sd->horizontal) + { + if (bi->w < bi->min.w) + bi->gcc->config.size = bi->w = bi->min.w; + else + bi->gcc->config.size = bi->w; + } + else + { + if (bi->h < bi->min.h) + bi->gcc->config.size = bi->h = bi->min.h; + else + bi->gcc->config.size = bi->h; + } + bi->gcc->config.pos = bi->gcc->state_info.prev_pos; + } + } + + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + if (sd->horizontal) + { + bi->x = pos; + bi->gcc->config.size = bi->w = bi->ask.size2; + pos = bi->x + bi->w; + } + else + { + bi->y = pos; + bi->gcc->config.size = bi->h = bi->ask.size2; + pos = bi->y + bi->h; + } + } +} + +/* + * The function returns a list of E_Gadcon_Layout_Item_Container + */ +static void +_e_gadcon_layout_smart_gadcons_asked_position_set(E_Smart_Data *sd) +{ + E_Gadcon_Layout_Item *bi; + Evas_List *l; + int xx, yy; + + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + if (!bi) continue; + + if (sd->horizontal) + { + bi->x = bi->ask.pos; + bi->w = bi->ask.size2; + } + else + { + bi->y = bi->ask.pos; + bi->h = bi->ask.size2; + } + } + +#if 0 + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + if (!bi) continue; + if (sd->horizontal) + { + xx = bi->ask.pos + (bi->ask.size / 2); + if (xx < (bi->ask.res / 3)) + { /* hooked to start */ + bi->x = bi->ask.pos; + bi->w = bi->ask.size2; + bi->hookp = 0; + } + else if (xx > ((2 * bi->ask.res) / 3)) + { /* hooked to end */ + bi->x = (bi->ask.pos - bi->ask.res) + sd->w; + bi->w = bi->ask.size2; + bi->hookp = bi->ask.res; + } + else + { /* hooked to middle */ + if ((bi->ask.pos <= (bi->ask.res / 2)) && + ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2))) + { /* straddles middle */ + if (bi->ask.res > 2) + bi->x = (sd->w / 2) + + (((bi->ask.pos + (bi->ask.size2 / 2) - + (bi->ask.res / 2)) * + (bi->ask.res / 2)) / + (bi->ask.res / 2)) - (bi->ask.size2 / 2); + else + bi->x = sd->w / 2; + bi->w = bi->ask.size2; + } + else + { /* either side of middle */ + bi->x = (bi->ask.pos - (bi->ask.res / 2)) + (sd->w / 2); + bi->w = bi->ask.size2; + } + bi->hookp = bi->ask.res / 2; + } + } + else + { + yy = bi->ask.pos + (bi->ask.size2 / 2); + if (yy < (bi->ask.res / 3)) + { /* hooked to start */ + bi->y = bi->ask.pos; + bi->h = bi->ask.size2; + bi->hookp = 0; + } + else if (yy > ((2 * bi->ask.res) / 3)) + { /* hooked to end */ + bi->y = (bi->ask.pos - bi->ask.res) + sd->h; + bi->h = bi->ask.size2; + bi->hookp = bi->ask.res; + } + else + { /* hooked to middle */ + if ((bi->ask.pos <= (bi->ask.res / 2)) && + ((bi->ask.pos + bi->ask.size2) > (bi->ask.res / 2))) + { /* straddles middle */ + if (bi->ask.res > 2) + bi->y = (sd->h / 2) + + (((bi->ask.pos + (bi->ask.size2 / 2) - + (bi->ask.res / 2)) * + (bi->ask.res / 2)) / + (bi->ask.res / 2)) - (bi->ask.size2 / 2); + else + bi->y = sd->h / 2; + bi->h = bi->ask.size2; + } + else + { /* either side of middle */ + bi->y = (bi->ask.pos - (bi->ask.res / 2)) + (sd->h / 2); + bi->h = bi->ask.size2; + } + bi->hookp = bi->ask.res / 2; + } + } + } +#endif +} + +static Evas_List * +_e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd) +{ + Evas_List *l, *list = NULL; + E_Layout_Item_Container *lc; + E_Gadcon_Layout_Item *bi; + + for (l = sd->items; l; l = l->next) + { + bi = evas_object_data_get(l->data, "e_gadcon_layout_data"); + lc = E_NEW(E_Layout_Item_Container, 1); + lc->state_info.min_seq = lc->state_info.max_seq = bi->gcc->state_info.seq; + lc->sd = sd; + if (sd->horizontal) + { + lc->pos = bi->x; + lc->size = bi->w; + } + else + { + lc->pos = bi->y; + lc->size = bi->h; + } + lc->prev_pos = bi->ask.prev_pos; + lc->prev_size = bi->ask.prev_size; + + E_LAYOUT_ITEM_CONTAINER_STATE_SET(lc->state, bi->gcc->state_info.state); + + if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && + (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) + lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + + lc->items = evas_list_append(lc->items, bi); + list = evas_list_append(list, lc); + } + return list; +} + +static void +_e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Evas_List **list) +{ + int ok; + Evas_List *l, *l2, *l3; + E_Layout_Item_Container *lc_moving = NULL, *lc_back, *lc, *lc3; + E_Gadcon_Layout_Item *bi, *bi_moving; + + if (!list || !*list) return; + + for (l = *list; l; l = l->next) + { + lc_moving = l->data; + + if ((lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) || + (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) || + (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC) || + (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC) || + (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC) || + (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC)) + { + lc_back = E_NEW(E_Layout_Item_Container, 1); + lc_back->pos = lc_moving->pos; + lc_back->prev_pos = lc_moving->prev_pos; + lc_back->size = lc_moving->size; + lc_back->prev_size = lc_moving->prev_size; + lc_back->state_info.min_seq = lc_moving->state_info.min_seq; + lc_back->state_info.max_seq = lc_moving->state_info.max_seq; + lc_back->sd = lc_moving->sd; + for (l2 = lc_moving->items; l2; l2 = l2->next) + lc_back->items = evas_list_append(lc_back->items, l2->data); + lc_back->state = lc_moving->state; + bi_moving = lc_back->items->data; + break; + } + lc_moving = NULL; + } + + if (!lc_moving) + { + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + return; + } + + if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) + { + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + ok = 0; + if ((l) && (l->prev)) + { + lc = l->prev->data; + if (LC_OVERLAP(lc, lc_moving)) + { + bi = lc_moving->items->data; + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + ok = 1; + bi->gcc->state_info.resist++; + lc_moving->pos = lc_moving->prev_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + else + { + bi->gcc->state_info.resist = 0; + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc_moving); + if (lc3) + { + ok = 1; + l->data = lc3; + *list = evas_list_remove_list(*list, l->prev); + LC_FREE(lc_moving); + LC_FREE(lc); + } + } + } + } + if (!ok) + { + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + if ((l) && (l->next)) + { + } + } + } + else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) + { + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + ok = 0; + if ((l) && (l->next)) + { + lc = l->next->data; + if (LC_OVERLAP(lc_moving, lc)) + { + bi = lc_moving->items->data; + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + ok = 1; + bi->gcc->state_info.resist++; + lc_moving->pos = lc_moving->prev_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + else + { + bi->gcc->state_info.resist = 0; + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc_moving, lc); + if (lc3) + { + ok = 1; + l->data = lc3; + *list = evas_list_remove_list(*list, l->next); + LC_FREE(lc_moving); + LC_FREE(lc); + } + } + } + } + + if (!ok) + { + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + if ((l) && (l->prev)) + { + //FIXME: need code that will shift l->prev's if needed. Basically + //it is need to unwrap all the l->prev, then restore the asked positions + //of each bi, wrap again and do static positioning. + } + } + } + else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC) + { + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + if ((l) && (l->prev)) + { + int new_pos = 0; + + ok = 0; + new_pos = lc_moving->pos; + for (l2 = l->prev; l2; l2 = l2->prev) + { + lc = l2->data; + if (new_pos >= (lc->pos + lc->size)) break; + + ok = 1; + new_pos -= lc->size; + } + + if (new_pos < 0) + { + lc_moving->size += new_pos; + lc_moving->pos -= new_pos; + + bi = lc_moving->items->data; + if (sd->horizontal) + bi->w = lc_moving->size; + else + bi->h = lc_moving->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + + new_pos = 0; + } + + if (ok) + { + if (!l2) l2 = *list; + else l2 = l2->next; + + for (l2; l2 != l; l2 = l2->next) + { + lc = l2->data; + lc->pos = new_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + for (l3 = lc->items; l3; l3 = l3->next) + { + bi = l3->data; + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + new_pos += lc->size; + } + } + } + else if ((l) && (!l->prev)) + { + if (lc_moving->pos <= 0) + { + lc_moving->size = lc_moving->prev_size; + lc_moving->pos = 0; + + bi = lc_moving->items->data; + if (sd->horizontal) + bi->w = lc_moving->size; + else + bi->h = lc_moving->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + } + } + else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC) + { + lc_moving->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + LC_FREE(lc_back); + } + else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC) + { + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + for (l = *list; (l) && (l->data != lc_moving); l = l->next); + + if ((l) && (l->next)) + { + Evas_List *stop; + int new_pos = 0; + + ok = 0; + new_pos = lc_moving->pos + lc_moving->size; + for (l2 = l->next; l2; l2 = l2->next) + { + lc = l2->data; + + if (new_pos <= lc->pos) + { + stop = l2; + break; + } + + ok = 1; + new_pos += lc->size; + } + + if (sd->horizontal) + { + if (new_pos > sd->w) + { + lc_moving->size -= (new_pos - sd->w); + bi = lc_moving->items->data; + bi->w = lc_moving->size; + + new_pos = lc_moving->pos + lc_moving->size; + } + } + else + { + if (new_pos > sd->h) + { + lc_moving->size -= (new_pos - sd->h); + bi = lc_moving->items->data; + bi->h = lc_moving->size; + + new_pos = lc_moving->pos + lc_moving->size; + } + } + + if (ok) + { + new_pos = lc_moving->pos + lc_moving->size; + for (l2 = l->next; l2 && l2 != stop; l2 = l2->next) + { + lc = l2->data; + lc->pos = new_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + for (l3 = lc->items; l3; l3 = l3->next) + { + bi = l3->data; + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + new_pos += lc->size; + } + } + } + else if ((l) && (!l->next)) + { + if (sd->horizontal) + { + if ((lc_moving->pos + lc_moving->size) >= sd->w) + { + lc_moving->size = lc_moving->prev_size; + bi = lc_moving->items->data; + bi->w = lc_moving->size; + } + } + else + { + if ((lc_moving->pos + lc_moving->size) > sd->h) + { + lc_moving->size = lc_moving->prev_size; + bi = lc_moving->items->data; + bi->h = lc_moving->size; + } + } + } + } + else if (lc_moving->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC) + { + lc_moving->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + LC_FREE(lc_back); + } + + //set lc_moving->items->data->gcc->config.pos; + if (sd->horizontal) + { + bi_moving->gcc->config.pos = bi_moving->ask.pos = bi_moving->x; + bi_moving->gcc->config.size = bi_moving->w; + } + else + { + bi_moving->gcc->config.pos = bi_moving->ask.pos = bi_moving->y; + bi_moving->gcc->config.size = bi_moving->w; + } +} + +static void +_e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Evas_List **list) +{ + int ok; + Evas_List *l; + E_Layout_Item_Container *lc, *lc2, *lc3; + + *list = evas_list_sort(*list, evas_list_count(*list), _e_gadcon_layout_smart_containers_sort_cb); + + __reposition_again: + for (l = *list; l; l = l->next) + { + if (!l->next) continue; + + lc = l->data; + lc2 = l->next->data; + + if (LC_OVERLAP(lc, lc2)) + { + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc2); + if (lc3) + { + l->data = lc3; + *list = evas_list_remove_list(*list, l->next); + LC_FREE(lc); + LC_FREE(lc2); + goto __reposition_again; + } + } + } + + ok = 1; + for (l = *list; l; l = l->next) + { + lc = l->data; + if (lc->pos < 0) + { + ok = 0; + lc->pos = 0; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + continue; + } + + if (sd->horizontal) + { + if (((lc->pos + lc->size) > sd->w) && (lc->size <= sd->w)) + { + ok = 0; + lc->pos = sd->w - lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + } + else + { + if (((lc->pos + lc->size) > sd->h) && (lc->size <= sd->h)) + { + ok = 0; + lc->pos = sd->h - lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + } + } + if (!ok) + _e_gadcon_layout_smart_gadcons_position_static(sd, list); +} + +static E_Layout_Item_Container * +_e_gadcon_layout_smart_containers_position_adjust(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2) +{ + int create_new; + Evas_List *l; + E_Layout_Item_Container *lc3 = NULL; + E_Layout_Item_Container_State new_state; + E_Gadcon_Layout_Item *bi, *bi2; + + if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && + (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) + { + if (lc->state_info.max_seq <= lc2->state_info.min_seq) + { + lc2->pos = lc->pos + lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc2); + } + else if (lc->state_info.min_seq > lc2->state_info.max_seq) + { + lc->pos = lc2->pos + lc2->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + else if (((lc->state_info.min_seq > lc2->state_info.min_seq) && + (lc->state_info.min_seq < lc2->state_info.max_seq)) || + ((lc2->state_info.min_seq > lc->state_info.min_seq) && + (lc2->state_info.min_seq < lc->state_info.max_seq))) + { + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); + } + create_new = 1; + new_state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + } + else if ((lc->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && + (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) + { + if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) + { + int t; + + bi = lc->items->data; + bi2 = lc2->items->data; + + if (sd->horizontal) + { + bi->gcc->config.pos = bi->ask.pos = bi->x = (bi2->x + bi2->w) - bi->w; + bi->gcc->config.size = bi->w; + bi2->x = bi->x - bi2->w; + } + else + { + bi->gcc->config.pos = bi->ask.pos = bi->y = (bi2->y + bi2->h) - bi->h; + bi->gcc->config.size = bi->h; + bi2->y = bi->y - bi2->h; + } + bi2->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + + t = bi->gcc->state_info.seq; + bi->gcc->state_info.seq = bi2->gcc->state_info.seq; + bi2->gcc->state_info.seq = t; + + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); + } + else if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED) + { + if (lc->state_info.max_seq < lc2->state_info.min_seq) + { + lc2->pos = lc->pos + lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc2); + } + else if (lc->state_info.min_seq > lc2->state_info.max_seq) + { + lc2->pos = lc->pos - lc2->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc2); + } + else if (((lc->state_info.min_seq > lc2->state_info.min_seq) && + (lc->state_info.min_seq < lc2->state_info.max_seq)) || + ((lc2->state_info.min_seq > lc->state_info.min_seq) && + (lc2->state_info.min_seq < lc->state_info.max_seq))) + { + int shift = 0; + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); + + for (l = lc->items; l; l = l->next) + { + bi = l->data; + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) + { + if (sd->horizontal) shift = bi->ask.pos - bi->x; + else shift = bi->ask.pos - bi->y; + } + + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + break; + } + + for (l = lc->items; l && shift; l = l->next) + { + bi = l->data; + + if (sd->horizontal) bi->x += shift; + else bi->y += shift; + + if (l == lc->items) + { + if (sd->horizontal) lc->pos = bi->x; + else lc->pos = bi->y; + } + } + } + } + create_new = 1; + new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + } + else if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && + (lc2->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) + { + if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED) + { + if (lc->state_info.max_seq < lc2->state_info.min_seq) + { + lc->pos = lc2->pos - lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + else if (lc->state_info.min_seq > lc2->state_info.max_seq) + { + lc->pos = lc2->pos + lc2->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + else if (((lc->state_info.min_seq > lc2->state_info.min_seq) && + (lc->state_info.min_seq < lc2->state_info.max_seq)) || + ((lc2->state_info.min_seq > lc->state_info.min_seq) && + (lc2->state_info.min_seq < lc->state_info.max_seq))) + { + int shift = 0; + + for (l = lc->items; l; l = l->next) + { + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) + { + if (sd->horizontal) shift = bi->ask.pos - bi->x; + else shift = bi->ask.pos - bi->y; + } + + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + break; + } + + for (l = lc->items; l && shift; l = l->next) + { + bi = l->data; + + if (sd->horizontal) bi->x += shift; + else bi->y += shift; + + if (l == lc->items) + { + if (sd->horizontal) lc->pos = bi->x; + else lc->pos = bi->y; + } + } + } + } + else if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) + { + int t; + + bi = (evas_list_last(lc->items))->data; + bi2 = lc2->items->data; + + if (sd->horizontal) + { + bi2->gcc->config.pos = bi2->ask.pos = bi2->x = bi->x; + bi2->gcc->config.size = bi2->w; + bi->x = bi2->x + bi2->w; + } + else + { + bi2->gcc->config.pos = bi2->ask.pos = bi2->y = bi->y; + bi2->gcc->config.size = bi2->h; + bi->y = bi2->y + bi2->h; + } + + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + + t = bi->gcc->state_info.seq; + bi->gcc->state_info.seq = bi2->gcc->state_info.seq; + bi2->gcc->state_info.seq = t; + + lc->items = evas_list_remove_list(lc->items, evas_list_last(lc->items)); + lc->items = evas_list_append(lc->items, bi2); + lc->items = evas_list_append(lc->items, bi); + lc2->items = evas_list_free(lc2->items); + E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc, bi2, 1); + lc2->pos = lc->pos + lc->size; + lc2->size = 0; + } + create_new = 1; + new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + } + else if ((lc->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && + (lc2->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) + { + if ((lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED) && + (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED)) + { + if (lc->state_info.max_seq < lc2->state_info.min_seq) + { + int move_lc1 = 1; + int move_lc2 = 1; + for (l = lc->items; l; l = l->next) + { + bi = l->data; + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc1 = 0; + break; + } + } + for (l = lc2->items; l; l = l->next) + { + bi = l->data; + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc2 = 0; + break; + } + } + + if ((move_lc1) && (!move_lc2)) + { + lc->pos = lc2->pos - lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + else + { + lc2->pos = lc->pos + lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc2); + } + } + else if (lc->state_info.min_seq > lc2->state_info.max_seq) + { + int move_lc1 = 1; + int move_lc2 = 1; + + for (l = lc->items; l; l = l->next) + { + bi = l->data; + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc1 = 0; + break; + } + } + for (l = lc2->items; l; l = l->next) + { + bi = l->data; + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc2 = 0; + break; + } + } + + if ((!move_lc1) && (move_lc2)) + { + lc2->pos = lc->pos - lc2->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc2); + } + else + { + lc->pos = lc2->pos + lc2->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + } + } + else if (((lc->state_info.min_seq > lc2->state_info.min_seq) && + (lc->state_info.min_seq < lc2->state_info.max_seq)) || + ((lc2->state_info.min_seq > lc->state_info.min_seq) && + (lc2->state_info.min_seq < lc->state_info.max_seq))) + { + int shift = 0; + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); + + for (l = lc->items; l; l = l->next) + { + bi = l->data; + if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) + { + if (sd->horizontal) + shift = bi->ask.pos - bi->x; + else + shift = bi->ask.pos - bi->y; + break; + } + } + + for (l = lc->items; l && shift; l = l->next) + { + bi = l->data; + + if (sd->horizontal) + bi->x += shift; + else + bi->y += shift; + + if (l == lc->items) + { + if (sd->horizontal) + lc->pos = bi->x; + else + lc->pos = bi->y; + } + } + } + create_new = 1; + new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + } + else + { + } + } + + if (create_new) + { + lc3 = E_NEW(E_Layout_Item_Container, 1); + lc3->sd = sd; + if (lc->pos < lc2->pos) + { + lc3->pos = lc->pos; + for (l = lc->items; l; l = l->next) + lc3->items = evas_list_append(lc3->items, l->data); + for (l = lc2->items; l; l = l->next) + lc3->items = evas_list_append(lc3->items, l->data); + + lc3->state_info.min_seq = lc->state_info.min_seq; + if (lc2->items) + lc3->state_info.max_seq = lc2->state_info.max_seq; + else + lc3->state_info.max_seq = lc->state_info.max_seq; + } + else + { + lc3->pos = lc2->pos; + for (l = lc2->items; l; l = l->next) + lc3->items = evas_list_append(lc3->items, l->data); + for (l = lc->items; l; l = l->next) + lc3->items = evas_list_append(lc3->items, l->data); + + lc3->state_info.min_seq = lc2->state_info.min_seq; + if (lc->items) + lc3->state_info.max_seq = lc->state_info.max_seq; + else + lc3->state_info.max_seq = lc2->state_info.max_seq; + } + lc3->size = lc->size + lc2->size; + lc3->state = new_state; + } + + return lc3; +} + +static void +_e_gadcon_layout_smart_position_items_inside_container(E_Smart_Data *sd, E_Layout_Item_Container *lc) +{ + int shift; + Evas_List *l; + E_Gadcon_Layout_Item *bi; + + if (!lc->items) return; + + bi = lc->items->data; + if (sd->horizontal) + shift = lc->pos - bi->x; + else + shift = lc->pos - bi->y; + if (!shift) return; + + for (l = lc->items; l; l = l->next) + { + bi = l->data; + if (sd->horizontal) + bi->x += shift; + else + bi->y += shift; + + if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC)) + { + if (sd->horizontal) + bi->gcc->config.pos = bi->ask.pos = bi->x; + else + bi->gcc->config.pos = bi->ask.pos = bi->y; + } + } +} + +static void +_e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2) +{ + int start = 0, size = 0, next = 0, min_seq = 0, max_seq = 0; + Evas_List *l, *nl = NULL; + E_Gadcon_Layout_Item *bi; + + for (l = lc->items; l; l = l->next) + nl = evas_list_append(nl, l->data); + for (l = lc2->items; l; l = l->next) + nl = evas_list_append(nl, l->data); + + nl = evas_list_sort(nl, evas_list_count(nl), _e_gadcon_layout_smart_seq_sort_cb); + + for (l = nl; l; l = l->next) + { + bi = l->data; + if (l == nl) + { + min_seq = max_seq = bi->gcc->state_info.seq; + if (sd->horizontal) + { + start = bi->x; + size = bi->w; + next = bi->x + bi->w; + } + else + { + start = bi->y; + size = bi->h; + next = bi->y + bi->h; + } + continue; + } + + max_seq = bi->gcc->state_info.seq; + if (sd->horizontal) + { + bi->x = next; + size += bi->w; + next = bi->x + bi->w; + } + else + { + bi->y = next; + size += bi->h; + next = bi->y + bi->h; + } + } + + lc->items = evas_list_free(lc->items); + lc2->items = evas_list_free(lc->items); + lc->items = nl; + lc->pos = start; + lc->size = size; + lc->state_info.min_seq = min_seq; + lc->state_info.max_seq = max_seq; + lc2->pos = lc->pos + lc->size; + lc2->size = 0; +} + +static void +_e_gadcon_layout_smart_restore_gadcons_position_before_move(E_Smart_Data *sd, E_Layout_Item_Container **lc_moving, E_Layout_Item_Container *lc_back, Evas_List **con_list) +{ + int ok; + Evas_List *l, *l2, *l3; + E_Gadcon_Layout_Item *bi, *bi2; + E_Layout_Item_Container *lc, *lc2, *lc3; + + + + (*lc_moving)->pos = (*lc_moving)->prev_pos; + if (((*lc_moving)->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_INC) || + ((*lc_moving)->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MIN_END_DEC) || + ((*lc_moving)->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_INC) || + ((*lc_moving)->state == E_LAYOUT_ITEM_CONTAINER_STATE_SIZE_MAX_END_DEC)) + { + (*lc_moving)->size = (*lc_moving)->prev_size; + bi = (*lc_moving)->items->data; + if (sd->horizontal) + bi->w = (*lc_moving)->prev_size; + else + bi->h = (*lc_moving)->prev_size; + + } + _e_gadcon_layout_smart_position_items_inside_container(sd, (*lc_moving)); + (*lc_moving)->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + _e_gadcon_layout_smart_gadcons_position_static(sd, con_list); + + + lc2 = NULL; + lc3 = NULL; + ok = 0; + for (l = *con_list; l; l = l->next) + { + lc = l->data; + if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) continue; + + if (evas_list_count(lc->items) == 1) + { + bi = lc->items->data; + if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC)) + { + LC_FREE(lc); + l->data = *lc_moving = lc_back; + _e_gadcon_layout_smart_position_items_inside_container(sd, (*lc_moving)); + + if (((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) && + ((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)) + { + bi = (*lc_moving)->items->data; + if (sd->horizontal) + bi->w = (*lc_moving)->size; + else + bi->h = (*lc_moving)->size; + } + } + } + else + { + for (l2 = lc->items; l2; l2 = l2->next) + { + bi = l2->data; + if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_INC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_SIZE_MAX_END_DEC)) + { + ok = 1; + if (l2 != lc->items) + { + lc2 = E_NEW(E_Layout_Item_Container, 1); + lc2->sd = sd; + lc2->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + for (l3 = lc->items; l3 != l2; l3 = l3->next) + { + bi2 = l3->data; + lc2->items = evas_list_append(lc2->items, bi2); + if (l3 == lc->items) + { + lc2->state_info.min_seq = bi2->gcc->state_info.seq; + if (sd->horizontal) + lc2->pos = lc2->prev_pos = bi2->x; + else + lc2->pos = lc2->prev_pos = bi2->y; + } + lc2->state_info.max_seq = bi2->gcc->state_info.seq; + E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc2, bi2, 1); + } + } + + if (l2->next) + { + lc3 = E_NEW(E_Layout_Item_Container, 1); + lc3->sd = sd; + lc3->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + for (l3 = l2->next; l3; l3 = l3->next) + { + bi2 = l3->data; + lc3->items = evas_list_append(lc3->items, bi2); + if (l3 == l2->next) + { + lc3->state_info.min_seq = bi2->gcc->state_info.seq; + if (sd->horizontal) + lc3->pos = lc3->prev_pos = bi2->x; + else + lc3->pos = lc3->prev_pos = bi2->y; + } + lc3->state_info.max_seq = bi2->gcc->state_info.seq; + E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc3, bi2, 1); + } + } + *lc_moving = lc_back; + _e_gadcon_layout_smart_position_items_inside_container(sd, *lc_moving); + + if (((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) && + ((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)) + { + bi = (*lc_moving)->items->data; + if (sd->horizontal) + bi->w = (*lc_moving)->size; + else + bi->h = (*lc_moving)->size; + } + break; + } + } + if (ok) + { + LC_FREE(lc); + if (lc2) + { + l->data = lc2; + *con_list = evas_list_append(*con_list, *lc_moving); + if (lc3) + *con_list = evas_list_append(*con_list, lc3); + *con_list = evas_list_sort(*con_list, evas_list_count(*con_list), + _e_gadcon_layout_smart_containers_sort_cb); + } + else + { + l->data = *lc_moving; + if (lc3) + { + *con_list = evas_list_append(*con_list, lc3); + *con_list = evas_list_sort(*con_list, evas_list_count(*con_list), + _e_gadcon_layout_smart_containers_sort_cb); + } + } + break; + } + } + } + + for (l = *con_list; l; l = l->next) + { + lc = l->data; + if (lc == *lc_moving) continue; + lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + } +} diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index 9854215e2..7c4d8e184 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -114,7 +114,15 @@ struct _E_Gadcon_Client void *data; struct { int pos, size, res; - } config; + } config; + + struct { + int seq, flags; // goes to save + int state, resist; + int prev_pos, prev_size; + int want_save : 1; + } state_info; + struct { Evas_Coord w, h; } pad, min, aspect; @@ -129,7 +137,7 @@ struct _E_Gadcon_Client unsigned char moving : 1; unsigned char resizing : 1; - Evas_Coord dx, dy, sx, sy, sw, sh; + Evas_Coord dx, dy; }; EAPI int e_gadcon_init(void); diff --git a/src/bin/e_int_config_keybindings.c b/src/bin/e_int_config_keybindings.c index dea1c65dc..b3dd76062 100644 --- a/src/bin/e_int_config_keybindings.c +++ b/src/bin/e_int_config_keybindings.c @@ -11,7 +11,7 @@ #define TEXT_ACTION _("Action") #define TEXT_NONE_ACTION_KEY _("") #define TEXT_PRESS_KEY_SEQUENCE _("Please press key sequence,
" \ - "or Escape to abort") + "or Escape to abort.") #define ILIST_ICON_WITH_KEYBIND "enlightenment/keys" #define ILIST_ICON_WITHOUT_KEYBIND "" @@ -1292,6 +1292,7 @@ _e_keybinding_keybind_cb_new_shortcut(void *data, void *data2) e_dialog_icon_set(cfdata->locals.dia, "enlightenment/e", 64); e_dialog_text_set(cfdata->locals.dia, TEXT_PRESS_KEY_SEQUENCE); e_win_centered_set(cfdata->locals.dia->win, 1); + e_win_borderless_set(cfdata->locals.dia->win, 1); cfdata->locals.keybind_win = ecore_x_window_input_new(e_manager_current_get()->root, 0, 0, 1, 1); diff --git a/src/bin/e_int_config_mousebindings.c b/src/bin/e_int_config_mousebindings.c index ffe97531f..f22442c95 100644 --- a/src/bin/e_int_config_mousebindings.c +++ b/src/bin/e_int_config_mousebindings.c @@ -1,7 +1,15 @@ #include "e.h" + +#define EXAMPLE_STRING "example : " #define E_BINDING_CONTEXT_NUMBER 10 + +#define TEXT_PRESS_MOUSE_BINIDING_SEQUENCE _("Please hold any modifier you want
" \ + "and press any button on your mouse,
or roll a" \ + " wheel, to assign mouse binding." \ + "
Press Escape to abort.") + static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); @@ -9,21 +17,36 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Co static void _fill_data(E_Config_Dialog_Data *cfdata); -static void _fill_action_ilist(E_Config_Dialog_Data *cfdata); -static void _update_binding_action_list(E_Config_Dialog_Data *cfdata); -static void _update_context_radios(E_Config_Dialog_Data *cfdata); -static void _update_mod_key_check_boxes(E_Config_Dialog_Data *cfdata); -static void _update_action_list(E_Config_Dialog_Data *cfdata); -static void _update_action_params(E_Config_Dialog_Data *cfdata); -static void _update_delete_button(E_Config_Dialog_Data *cfdata); +static void _fill_actions_list(E_Config_Dialog_Data *cfdata); +static void _auto_apply_changes(E_Config_Dialog_Data *cfdata); +/******** updates ************/ +static void _update_binding_list(E_Config_Dialog_Data *cfdata); +static void _update_binding_list_selection(E_Config_Dialog_Data *cfdata, const void *bind); +static void _update_buttons(E_Config_Dialog_Data *cfdata); +static void _update_binding_params(E_Config_Dialog_Data *cfdata); -static void _apply_binding_changes(E_Config_Dialog_Data *cfdata); +/******** callbacks ***********/ +static void _binding_change_cb(void *data); +static void _action_change_cb(void *data); +static void _add_mouse_binding_cb(void *data, void *data2); +static void _modify_mouse_binding_cb(void *data, void *data2); +static void _delete_mouse_binding_cb(void *data, void *data2); +static void _restore_default_cb(void *data, void *data2); + +static int _grab_key_down_cb(void *data, int type, void *event); +static int _grab_mouse_down_cb(void *data, int type, void *event); +static int _grab_mouse_wheel_cb(void *data, int type, void *event); +static void _grab_wnd_hide_cb(E_Config_Dialog_Data *cfdata); + +/******** helpers *************/ +static char *_helper_button_name_get(E_Config_Binding_Mouse *eb); +static char *_helper_wheel_name_get(E_Config_Binding_Wheel *bw); +static char *_helper_modifier_name_get(int mod); + +/********* sorts ***************/ +static int _mouse_binding_sort_cb(void *d1, void *d2); +static int _wheel_binding_sort_cb(void *d1, void *d2); -static void _binding_change_cb(void *data, Evas_Object *obj); -static void _binding_action_ilist_change_cb(void *data); -static void _action_ilist_change_cb(void *data); -static void _add_binding_cb(void *data, void *data2); -static void _delete_binding_cb(void *data, void *data2); #define E_ACTION_NUMBER 32 const char *action_to_name[E_ACTION_NUMBER][2] = { @@ -56,35 +79,40 @@ struct _E_Config_Dialog_Data Evas *evas; - int mouse_binding; + struct + { + Evas_List *mouse; + Evas_List *wheel; + } binding; - E_Config_Binding_Mouse *current_mouse_binding; - E_Config_Binding_Wheel *current_wheel_binding; + struct + { + char *binding; + char *action; + char *params; + int context; + char *cur; + int add; //just to distinguesh among two buttons add/modify - E_Binding_Context context; - char *binding_ilist_value; - char *action_ilist_value; - - int shift_mod, ctrl_mod, alt_mod, win_mod; - char *params; - - Evas_List *mouse_bindings[5]; + E_Dialog *dia; + Ecore_X_Window mousebind_win; + Evas_List *handlers; + } locals; struct { - Evas_Object *o_binding_action_list; - Evas_Object *o_action_list, *o_params; + Evas_Object *o_binding_list; + Evas_Object *o_action_list; + Evas_Object *o_add; + Evas_Object *o_mod; + Evas_Object *o_del; + Evas_Object *o_params; - Evas_Object *o_add, *o_del; - - struct { + struct { Evas_Object *o_any, *o_border, *o_menu, *o_winlist, *o_popup, *o_zone, *o_container, *o_manager, *o_none; } context; - struct { - Evas_Object *o_shift, *o_ctrl, *o_alt, *o_win; - } mod_key; } gui; }; @@ -105,7 +133,7 @@ e_int_config_mousebindings(E_Container *con) cfd = e_config_dialog_new(con, _("Mouse Binding Settings"), "E", "_config_mousebindings_dialog", - "enlightenment/mouse_binding_left", 0, v, NULL); + "enlightenment/mouse_clean", 0, v, NULL); return cfd; } @@ -116,24 +144,20 @@ _fill_data(E_Config_Dialog_Data *cfdata) E_Config_Binding_Mouse *eb, *eb2; E_Config_Binding_Wheel *bw, *bw2; - - cfdata->mouse_binding = 0; - cfdata->context = E_BINDING_CONTEXT_ANY; - cfdata->binding_ilist_value = strdup(""); - cfdata->shift_mod = 0; - cfdata->ctrl_mod = 0; - cfdata->alt_mod = 0; - cfdata->win_mod = 0; - cfdata->params = strdup(""); - cfdata->current_mouse_binding = NULL; - cfdata->current_wheel_binding = NULL; + cfdata->locals.binding = strdup(""); + cfdata->locals.action = strdup(""); + cfdata->locals.params = strdup(""); + cfdata->locals.context = E_BINDING_CONTEXT_ANY; + cfdata->binding.mouse = NULL; + cfdata->binding.wheel = NULL; + cfdata->locals.mousebind_win = 0; + cfdata->locals.handlers = NULL; + cfdata->locals.dia = NULL; for (l = e_config->mouse_bindings; l; l = l->next) { eb = l->data; - if (!eb->action) continue; - eb2 = E_NEW(E_Config_Binding_Mouse, 1); eb2->context = eb->context; eb2->button = eb->button; @@ -142,21 +166,12 @@ _fill_data(E_Config_Dialog_Data *cfdata) eb2->action = eb->action == NULL ? NULL : evas_stringshare_add(eb->action); eb2->params = eb->params == NULL ? NULL : evas_stringshare_add(eb->params); - if (eb2->button == 1) - cfdata->mouse_bindings[0] = evas_list_append(cfdata->mouse_bindings[0], eb2); - else if (eb2->button == 2) - cfdata->mouse_bindings[1] = evas_list_append(cfdata->mouse_bindings[1], eb2); - else if (eb2->button == 3) - cfdata->mouse_bindings[2] = evas_list_append(cfdata->mouse_bindings[2], eb2); + cfdata->binding.mouse = evas_list_append(cfdata->binding.mouse, eb2); } for (l = e_config->wheel_bindings; l; l = l->next) { bw = l->data; - - if (!bw) continue; - - if (bw->direction == 1) continue; bw2 = E_NEW(E_Config_Binding_Wheel, 1); bw2->context = bw->context; @@ -167,10 +182,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) bw2->action = bw->action == NULL ? NULL : evas_stringshare_add(bw->action); bw2->params = bw->params == NULL ? NULL : evas_stringshare_add(bw->params); - if (bw->z < 0) - cfdata->mouse_bindings[3] = evas_list_append(cfdata->mouse_bindings[3], bw2); - else - cfdata->mouse_bindings[4] = evas_list_append(cfdata->mouse_bindings[4], bw2); + cfdata->binding.wheel = evas_list_append(cfdata->binding.wheel, bw2); } } @@ -189,66 +201,74 @@ _create_data(E_Config_Dialog *cfd) static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - int i; - E_Config_Binding_Mouse *bm; + E_Config_Binding_Mouse *eb; E_Config_Binding_Wheel *bw; - for (i = 0; i < 5; i++) + while (cfdata->binding.mouse) { - while (cfdata->mouse_bindings[i]) - { - switch (i) - { - case 0: - case 1: - case 2: - bm = cfdata->mouse_bindings[i]->data; - if (bm->action) evas_stringshare_del(bm->action); - if (bm->params) evas_stringshare_del(bm->params); - E_FREE(bm); - break; - case 3: - case 4: - bw = cfdata->mouse_bindings[i]->data; - if (bw->action) evas_stringshare_del(bw->action); - if (bw->params) evas_stringshare_del(bw->params); - E_FREE(bw); - break; - } - cfdata->mouse_bindings[i] = - evas_list_remove_list(cfdata->mouse_bindings[i], cfdata->mouse_bindings[i]); - } + eb = cfdata->binding.mouse->data; + if (eb->action) evas_stringshare_del(eb->action); + if (eb->params) evas_stringshare_del(eb->params); + E_FREE(eb); + cfdata->binding.mouse = + evas_list_remove_list(cfdata->binding.mouse, cfdata->binding.mouse); } - if (cfdata->binding_ilist_value) free(cfdata->binding_ilist_value); - if (cfdata->action_ilist_value) free(cfdata->action_ilist_value); - if (cfdata->params) free(cfdata->params); + while (cfdata->binding.wheel) + { + bw = cfdata->binding.wheel->data; + if (bw->action) evas_stringshare_del(bw->action); + if (bw->params) evas_stringshare_del(bw->params); + E_FREE(bw); + cfdata->binding.wheel = + evas_list_remove_list(cfdata->binding.wheel, cfdata->binding.wheel); + } + + if (cfdata->locals.binding) free(cfdata->locals.binding); + if (cfdata->locals.action) free(cfdata->locals.action); + if (cfdata->locals.params) free(cfdata->locals.params); + if (cfdata->locals.cur) free(cfdata->locals.cur); free(cfdata); } static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - int i; Evas_List *l; - E_Config_Binding_Mouse *bm, *bm2; + E_Config_Binding_Mouse *eb, *eb2; E_Config_Binding_Wheel *bw, *bw2; - if (!cfdata) return 0; + _auto_apply_changes(cfdata); - _apply_binding_changes(cfdata); e_border_button_bindings_ungrab_all(); while (e_config->mouse_bindings) { - bm = e_config->mouse_bindings->data; - e_bindings_mouse_del(bm->context, bm->button, bm->modifiers, bm->any_mod, bm->action, - bm->params); - if (bm->action) evas_stringshare_del(bm->action); - if (bm->params) evas_stringshare_del(bm->params); - E_FREE(bm); + eb = e_config->mouse_bindings->data; + e_bindings_mouse_del(eb->context, eb->button, eb->modifiers, eb->any_mod, + eb->action, eb->params); + if (eb->action) evas_stringshare_del(eb->action); + if (eb->params) evas_stringshare_del(eb->params); + E_FREE(eb); + e_config->mouse_bindings = + evas_list_remove_list(e_config->mouse_bindings, e_config->mouse_bindings); + } - e_config->mouse_bindings = evas_list_remove_list(e_config->mouse_bindings, e_config->mouse_bindings); + for (l = cfdata->binding.mouse; l; l = l->next) + { + eb = l->data; + + eb2 = E_NEW(E_Config_Binding_Mouse, 1); + eb2->context = eb->context; + eb2->button = eb->button; + eb2->modifiers = eb->modifiers; + eb2->any_mod = eb->any_mod; + eb2->action = eb->action == NULL ? NULL : evas_stringshare_add(eb->action); + eb2->params = eb->params == NULL ? NULL : evas_stringshare_add(eb->params); + + e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, eb2); + e_bindings_mouse_add(eb2->context, eb2->button, eb2->modifiers, eb2->any_mod, + eb2->action, eb2->params); } while (e_config->wheel_bindings) @@ -259,67 +279,27 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) if (bw->action) evas_stringshare_del(bw->action); if (bw->params) evas_stringshare_del(bw->params); E_FREE(bw); - e_config->wheel_bindings = evas_list_remove_list(e_config->wheel_bindings, e_config->wheel_bindings); + + e_config->wheel_bindings = + evas_list_remove_list(e_config->wheel_bindings, e_config->wheel_bindings); } - for (i = 0; i < 5; i++) + for (l = cfdata->binding.wheel; l; l = l->next) { - switch (i) - { - case 0: - case 1: - case 2: - for (l = cfdata->mouse_bindings[i]; l; l = l->next) - { - bm = l->data; + bw = l->data; - bm2 = E_NEW(E_Config_Binding_Mouse, 1); - bm2->context = bm->context; - bm2->button = bm->button; - bm2->modifiers = bm->modifiers; - bm2->any_mod = bm->any_mod; - bm2->action = bm->action == NULL ? NULL : evas_stringshare_add(bm->action); - bm2->params = bm->params == NULL ? NULL : evas_stringshare_add(bm->params); + bw2 = E_NEW(E_Config_Binding_Wheel, 1); + bw2->context = bw->context; + bw2->direction = bw->direction; + bw2->z = bw->z; + bw2->modifiers = bw->modifiers; + bw2->any_mod = bw->any_mod; + bw2->action = bw->action == NULL ? NULL : evas_stringshare_add(bw->action); + bw2->params = bw->params == NULL ? NULL : evas_stringshare_add(bw->params); - e_config->mouse_bindings = evas_list_append(e_config->mouse_bindings, bm2); - e_bindings_mouse_add(bm2->context, bm2->button, bm2->modifiers, bm2->any_mod, - bm2->action, bm2->params); - } - break; - case 3: - case 4: - for (l = cfdata->mouse_bindings[i]; l; l = l->next) - { - bw = l->data; - - bw2 = E_NEW(E_Config_Binding_Wheel, 1); - bw2->context = bw->context; - bw2->direction = 0; - bw2->z = bw->z; - bw2->modifiers = bw->modifiers; - bw2->any_mod = 0;//bw->any_mod; - bw2->action = bw->action == NULL ? NULL : evas_stringshare_add(bw->action); - bw2->params = bw->params == NULL ? NULL : evas_stringshare_add(bw->params); - - e_config->wheel_bindings = evas_list_append(e_config->wheel_bindings, bw2); - e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers, - bw2->any_mod, bw2->action, bw2->params); - - bw2 = E_NEW(E_Config_Binding_Wheel, 1); - bw2->context = bw->context; - bw2->direction = 1; - bw2->z = bw->z; - bw2->modifiers = bw->modifiers; - bw2->any_mod = 0;//bw->any_mod; - bw2->action = bw->action == NULL ? NULL : evas_stringshare_add(bw->action); - bw2->params = bw->params == NULL ? NULL : evas_stringshare_add(bw->params); - - e_config->wheel_bindings = evas_list_append(e_config->wheel_bindings, bw2); - e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers, - bw2->any_mod, bw2->action, bw2->params); - } - break; - } + e_config->wheel_bindings = evas_list_append(e_config->wheel_bindings, bw2); + e_bindings_wheel_add(bw2->context, bw2->direction, bw2->z, bw2->modifiers, + bw2->any_mod, bw2->action, bw2->params); } e_border_button_bindings_grab_all(); @@ -330,255 +310,372 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { - Evas_Object *o, *ol, *ol2, *ol3, *of, *of2, *ot; + Evas_Object *o, *ol, *ol2, *ol3, *of; E_Radio_Group *rg; - cfdata->evas = evas; - ol = e_widget_list_add(evas, 0, 0); - - ol2 = e_widget_list_add(evas, 0, 1); - of = e_widget_framelist_add(evas, _("Mouse Binding"), 0); - - rg = e_widget_radio_group_new(&(cfdata->mouse_binding)); - ol3 = e_widget_list_add(evas, 0, 1); - o = e_widget_radio_icon_add(evas, _("Left Button"), "enlightenment/mouse_binding_left", - 48, 48, 0, rg); - e_widget_on_change_hook_set(o, _binding_change_cb, cfdata); - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - - o = e_widget_radio_icon_add(evas, _("Middle Button"), "enlightenment/mouse_binding_middle", - 48, 48, 1, rg); - e_widget_on_change_hook_set(o, _binding_change_cb, cfdata); - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - - o = e_widget_radio_icon_add(evas, _("Right Button"), "enlightenment/mouse_binding_right", - 48, 48, 2, rg); - e_widget_on_change_hook_set(o, _binding_change_cb, cfdata); - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - - e_widget_framelist_object_append(of, ol3); - - ol3 = e_widget_list_add(evas, 0, 1); - o = e_widget_radio_icon_add(evas, _("Mouse Wheel Up"), "enlightenment/mouse_binding_scroll_up", - 48, 48, 3, rg); - e_widget_on_change_hook_set(o, _binding_change_cb, cfdata); - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - - o = e_widget_radio_icon_add(evas, _("Mouse Wheel Down"), - "enlightenment/mouse_binding_scroll_down", 48, 48, 4, rg); - e_widget_on_change_hook_set(o, _binding_change_cb, cfdata); - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - e_widget_framelist_object_append(of, ol3); - - e_widget_list_object_append(ol2, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, _("Binding Action List"), 0); - o = e_widget_ilist_add(evas, 32, 32, &(cfdata->binding_ilist_value)); - cfdata->gui.o_binding_action_list = o; - e_widget_min_size_set(o, 250, 100); + ol = e_widget_list_add(evas, 0, 1); + of = e_widget_framelist_add(evas, _("Mouse Bindings"), 0); + + o = e_widget_ilist_add(evas, 32, 32, &(cfdata->locals.binding)); + cfdata->gui.o_binding_list = o; + e_widget_min_size_set(o, 250, 280); e_widget_ilist_go(o); - e_widget_framelist_object_append(of, o); - - ol3 = e_widget_list_add(evas, 0, 1); - o = e_widget_button_add(evas, _("Add"), NULL, _add_binding_cb, cfdata, NULL); + e_widget_framelist_object_append(of, o); + + ol2 = e_widget_list_add(evas, 1, 1); + o = e_widget_button_add(evas, _("Add"), NULL, _add_mouse_binding_cb, cfdata, NULL); cfdata->gui.o_add = o; - e_widget_list_object_append(ol3, o, 1, 1, 0.5); - - o = e_widget_button_add(evas, _("Delete"), NULL, _delete_binding_cb, cfdata, NULL); + e_widget_list_object_append(ol2, o, 1, 1, 0.5); + + o = e_widget_button_add(evas, _("Modify"), NULL, _modify_mouse_binding_cb, cfdata, NULL); + cfdata->gui.o_mod = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol2, o, 1, 1, 0.5); + + o = e_widget_button_add(evas, _("Delete"), NULL, _delete_mouse_binding_cb, cfdata, NULL); cfdata->gui.o_del = o; - e_widget_list_object_append(ol3, o, 1, 1, 0.5); e_widget_disabled_set(o, 1); - e_widget_framelist_object_append(of, ol3); - - e_widget_list_object_append(ol2, of, 1, 1, 0.5); - e_widget_list_object_append(ol, ol2, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Action Settings"), 1); - ol2 = e_widget_list_add(evas, 0, 0); - of2 = e_widget_framelist_add(evas, _("Modifier Key"), 1); - o = e_widget_check_add(evas, _("Shift"), &(cfdata->shift_mod)); - cfdata->gui.mod_key.o_shift = o; - e_widget_framelist_object_append(of2, o); - e_widget_disabled_set(o, 1); - - o = e_widget_check_add(evas, _("Ctrl"), &(cfdata->ctrl_mod)); - cfdata->gui.mod_key.o_ctrl = o; - e_widget_framelist_object_append(of2, o); - e_widget_disabled_set(o, 1); - - o = e_widget_check_add(evas, _("Alt"), &(cfdata->alt_mod)); - cfdata->gui.mod_key.o_alt = o; - e_widget_framelist_object_append(of2, o); - e_widget_disabled_set(o, 1); - - o = e_widget_check_add(evas, _("Win"), &(cfdata->win_mod)); - cfdata->gui.mod_key.o_win = o; - e_widget_framelist_object_append(of2, o); - e_widget_disabled_set(o, 1); - - e_widget_list_object_append(ol2, of2, 1, 1, 0.5); - of2 = e_widget_framelist_add(evas, _("Context"), 0); - ot = e_widget_table_add(evas, 0); - - rg = e_widget_radio_group_new((int*)(&(cfdata->context))); - o = e_widget_radio_add(evas, _("Any"), E_BINDING_CONTEXT_ANY, rg); - cfdata->gui.context.o_any = o; - e_widget_table_object_append(ot, o, 0, 0, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Border"), E_BINDING_CONTEXT_BORDER, rg); - cfdata->gui.context.o_border = o; - e_widget_table_object_append(ot, o, 0, 1, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Menu"), E_BINDING_CONTEXT_MENU, rg); - cfdata->gui.context.o_menu = o; - e_widget_table_object_append(ot, o, 0, 2, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Win List"), E_BINDING_CONTEXT_WINLIST, rg); - cfdata->gui.context.o_winlist = o; - e_widget_table_object_append(ot, o, 1, 0, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Popup"), E_BINDING_CONTEXT_POPUP, rg); - cfdata->gui.context.o_popup = o; - e_widget_table_object_append(ot, o, 1, 1, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Zone"), E_BINDING_CONTEXT_ZONE, rg); - cfdata->gui.context.o_zone = o; - e_widget_table_object_append(ot, o, 1, 2, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Container"), E_BINDING_CONTEXT_CONTAINER, rg); - cfdata->gui.context.o_container = o; - e_widget_table_object_append(ot, o, 2, 0, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("Manager"), E_BINDING_CONTEXT_MANAGER, rg); - cfdata->gui.context.o_manager = o; - e_widget_table_object_append(ot, o, 2, 1, 1, 1, 1, 1, 1, 1); - e_widget_disabled_set(o, 1); - - o = e_widget_radio_add(evas, _("None"), E_BINDING_CONTEXT_NONE, rg); - cfdata->gui.context.o_none = o; - e_widget_table_object_append(ot, o, 2, 2, 1, 1, 1, 1, 1, 1); e_widget_disabled_set(o, 1); - - e_widget_framelist_object_append(of2, ot); - e_widget_list_object_append(ol2, of2, 1, 1, 0.5); - - e_widget_framelist_object_append(of, ol2); - - ol2 = e_widget_list_add(evas, 0, 0); - of2 = e_widget_framelist_add(evas, _("Action"), 0); - - o = e_widget_ilist_add(evas, 32, 32, &(cfdata->action_ilist_value)); - cfdata->gui.o_action_list = o; - e_widget_min_size_set(o, 250, 100); - e_widget_ilist_go(o); - e_widget_disabled_set(o, 1); - e_widget_framelist_object_append(of2, o); - - e_widget_list_object_append(ol2, of2, 1, 1, 0.5); - - of2 = e_widget_framelist_add(evas, _("Params"), 0); - - o = e_widget_entry_add(evas, &(cfdata->params)); - cfdata->gui.o_params = o; - e_widget_framelist_object_append(of2, o); - e_widget_disabled_set(o, 1); - - e_widget_list_object_append(ol2, of2, 1, 1, 0.5); + e_widget_list_object_append(ol2, o, 1, 1, 0.5); e_widget_framelist_object_append(of, ol2); - + + o = e_widget_button_add(evas, _("Restore Mouse and Wheel Binding Defaults"), NULL, + _restore_default_cb, cfdata, NULL); + e_widget_framelist_object_append(of, o); e_widget_list_object_append(ol, of, 1, 1, 0.5); - _update_binding_action_list(cfdata); - _update_delete_button(cfdata); + + ol2 = e_widget_list_add(evas, 0, 0); + of = e_widget_framelist_add(evas, _("Action"), 0); + o = e_widget_ilist_add(evas, 24, 24, &(cfdata->locals.action)); + cfdata->gui.o_action_list = o; + e_widget_min_size_set(o, 250, 180); + e_widget_ilist_go(o); + e_widget_framelist_object_append(of, o); + e_widget_list_object_append(ol2, of, 1, 1, 0.5); + + of = e_widget_framelist_add(evas, _("Action Params"), 0); + o = e_widget_entry_add(evas, &(cfdata->locals.params)); + e_widget_disabled_set(o, 1); + cfdata->gui.o_params = o; + e_widget_framelist_object_append(of, o); + e_widget_list_object_append(ol2, of, 1, 1, 0.5); + + of = e_widget_framelist_add(evas, _("Action Context"), 1); + rg = e_widget_radio_group_new(&(cfdata->locals.context)); + ol3 = e_widget_list_add(evas, 0, 0); + + o = e_widget_radio_add(evas, _("Any"), E_BINDING_CONTEXT_ANY, rg); + cfdata->gui.context.o_any = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + + o = e_widget_radio_add(evas, _("Border"), E_BINDING_CONTEXT_BORDER, rg); + cfdata->gui.context.o_border = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + + o = e_widget_radio_add(evas, _("Menu"), E_BINDING_CONTEXT_MENU, rg); + cfdata->gui.context.o_menu = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + e_widget_framelist_object_append(of, ol3); + + ol3 = e_widget_list_add(evas, 0, 0); + o = e_widget_radio_add(evas, _("Win List"), E_BINDING_CONTEXT_WINLIST, rg); + cfdata->gui.context.o_winlist = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + + o = e_widget_radio_add(evas, _("Popup"), E_BINDING_CONTEXT_POPUP, rg); + cfdata->gui.context.o_popup = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + + o = e_widget_radio_add(evas, _("Zone"), E_BINDING_CONTEXT_ZONE, rg); + cfdata->gui.context.o_zone = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + e_widget_framelist_object_append(of, ol3); + + ol3 = e_widget_list_add(evas, 0, 0); + o = e_widget_radio_add(evas, _("Container"), E_BINDING_CONTEXT_CONTAINER, rg); + cfdata->gui.context.o_container = o; + e_widget_disabled_set(o, 1); + + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + o = e_widget_radio_add(evas, _("Manager"), E_BINDING_CONTEXT_MANAGER, rg); + cfdata->gui.context.o_manager = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + + o = e_widget_radio_add(evas, _("None"), E_BINDING_CONTEXT_NONE, rg); + cfdata->gui.context.o_none = o; + e_widget_disabled_set(o, 1); + e_widget_list_object_append(ol3, o, 1, 1, 0.5); + e_widget_framelist_object_append(of, ol3); + e_widget_list_object_append(ol2, of, 1, 1, 0.5); + + e_widget_list_object_append(ol, ol2, 1, 1, 0.5); + + _fill_actions_list(cfdata); + _update_binding_list(cfdata); + return ol; } static void -_update_binding_action_list(E_Config_Dialog_Data *cfdata) -{ - char buf[256] = ""; - const char *action; - char indx[256]; - Evas_List *l; - E_Config_Binding_Mouse *eb; - E_Config_Binding_Wheel *bw; - int i, j; +_fill_actions_list(E_Config_Dialog_Data *cfdata) +{ + char buf[1024]; + int i; - e_widget_ilist_clear(cfdata->gui.o_binding_action_list); - - if (cfdata->mouse_binding < 3) + for (i = 0; i < E_ACTION_NUMBER; i++) { - for (l = cfdata->mouse_bindings[cfdata->mouse_binding], i = 0; l; l = l->next, i++) - { - eb = l->data; - - for (j = 0; j < E_ACTION_NUMBER; j++) - { - if (!strcmp(action_to_name[j][0], eb->action)) - break; - } - - if (j < E_ACTION_NUMBER) - action = action_to_name[j][1]; - else - action = _("Unknown"); - - snprintf(buf, sizeof(buf), "%s %d: %s", _("Action"), i, action); - snprintf(indx, sizeof(indx), "%d", i); - e_widget_ilist_append(cfdata->gui.o_binding_action_list, NULL, buf, - _binding_action_ilist_change_cb, cfdata, indx); - } - } - else - { - for (l = cfdata->mouse_bindings[cfdata->mouse_binding], i = 0; l; l = l->next, i++) - { - bw = l->data; - - for (j = 0; j < E_ACTION_NUMBER; j++) - { - if (!strcmp(action_to_name[j][0], bw->action)) - break; - } - - if (j < E_ACTION_NUMBER) - action = action_to_name[j][1]; - else - action = _("Unknown"); - - snprintf(buf, sizeof(buf), "%s %d: %s", _("Action"), i, action); - snprintf(indx, sizeof(indx), "%d", i); - e_widget_ilist_append(cfdata->gui.o_binding_action_list, NULL, buf, - _binding_action_ilist_change_cb, cfdata, indx); - } + snprintf(buf, sizeof(buf), "%d", i); + e_widget_ilist_append(cfdata->gui.o_action_list, NULL, action_to_name[i][1], + _action_change_cb, cfdata, buf); } - e_widget_ilist_go(cfdata->gui.o_binding_action_list); - - if (!cfdata->mouse_bindings[cfdata->mouse_binding]) - { - _update_context_radios(cfdata); - _update_mod_key_check_boxes(cfdata); - _update_action_list(cfdata); - _update_action_params(cfdata); - } - else - e_widget_ilist_selected_set(cfdata->gui.o_binding_action_list, 0); + e_widget_ilist_go(cfdata->gui.o_action_list); } static void -_update_context_radios(E_Config_Dialog_Data *cfdata) +_auto_apply_changes(E_Config_Dialog_Data *cfdata) { + char *n; + const char *action; + int i; E_Config_Binding_Mouse *eb; E_Config_Binding_Wheel *bw; - - e_widget_disabled_set(cfdata->gui.context.o_any, 1); + + if (!cfdata->locals.cur) return; + + n = cfdata->locals.cur; + + if (cfdata->locals.cur[0] == 'm') + { + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + if (!eb) return; + + eb->context = cfdata->locals.context; + + if (eb->action) evas_stringshare_del(eb->action); + if (e_widget_ilist_selected_get(cfdata->gui.o_action_list) >= 0) + action = action_to_name[atoi(cfdata->locals.action)][0]; + else + action = NULL; + eb->action = action ? evas_stringshare_add(action) : NULL; + + if (eb->params) evas_stringshare_del(eb->params); + if ((!cfdata->locals.params) || (!cfdata->locals.params[0]) || + (!strncmp(cfdata->locals.params, EXAMPLE_STRING, strlen(EXAMPLE_STRING)))) + eb->params = NULL; + else + eb->params = evas_stringshare_add(cfdata->locals.params); + } + else + { + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + if (!bw) return; + + bw->context = cfdata->locals.context; + if (bw->action) evas_stringshare_del(bw->action); + if (e_widget_ilist_selected_get(cfdata->gui.o_action_list) >= 0) + action = action_to_name[atoi(cfdata->locals.action)][0]; + else + action = NULL; + bw->action = action ? evas_stringshare_add(action) : NULL; + + if (bw->params) evas_stringshare_del(bw->params); + if ((!cfdata->locals.params) || (!cfdata->locals.params[0])) + bw->params = NULL; + else + bw->params = evas_stringshare_add(cfdata->locals.params); + } +} +/********* updates *************/ +static void +_update_binding_actions(E_Config_Dialog_Data *cfdata) +{ + char *n; + int i; + E_Config_Binding_Mouse *eb; + E_Config_Binding_Wheel *bw; + const char *action; + + e_widget_ilist_clear(cfdata->gui.o_action_list); + _fill_actions_list(cfdata); + + if (!cfdata->locals.cur) return; + + n = cfdata->locals.cur; + if (cfdata->locals.cur[0] == 'm') + { + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + if (!eb) return; + action = eb->action; + } + else + { + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + if (!bw) return; + action = bw->action; + } + + if (action && action[0]) + { + for (i = 0; i < E_ACTION_NUMBER; i++) + { + if (!strcmp(action_to_name[i][0], action)) + { + e_widget_ilist_selected_set(cfdata->gui.o_action_list, i); + break; + } + } + } + else + cfdata->locals.action[0] = '\0'; +} +static void +_update_binding_list(E_Config_Dialog_Data *cfdata) +{ + char *icon = NULL, *button, *mods; + char label[1024], val[10]; + int i; + Evas_List *l; + E_Config_Binding_Mouse *eb; + E_Config_Binding_Wheel *bw; + + e_widget_ilist_clear(cfdata->gui.o_binding_list); + + if (cfdata->binding.mouse) + { + cfdata->binding.mouse = evas_list_sort(cfdata->binding.mouse, + evas_list_count(cfdata->binding.mouse), _mouse_binding_sort_cb); + + e_widget_ilist_header_append(cfdata->gui.o_binding_list, NULL, "Mouse Buttons"); + } + + for (l = cfdata->binding.mouse, i = 0; l; l = l->next, i++) + { + Evas_Object *ic; + eb = l->data; + + button = _helper_button_name_get(eb); + mods = _helper_modifier_name_get(eb->modifiers); + + snprintf(label, sizeof(label), "%s%s%s", button ? button : "", mods[0] ? " + ": "", + mods ? mods : ""); + if (button) free(button); + if (mods) free(mods); + + switch (eb->button) + { + case 1: + icon = "enlightenment/mouse_left"; + break; + case 2: + icon = "enlightenment/mouse_middle"; + break; + case 3: + icon = "enlightenment/mouse_right"; + break; + default: + icon = "enlightenment/mouse_extra"; + } + + snprintf(val, sizeof(val), "m%d", i); + + ic = edje_object_add(cfdata->evas); + e_util_edje_icon_set(ic, icon); + e_widget_ilist_append(cfdata->gui.o_binding_list, ic, label, _binding_change_cb, + cfdata, val); + } + + if (cfdata->binding.wheel) + { + cfdata->binding.wheel = evas_list_sort(cfdata->binding.wheel, + evas_list_count(cfdata->binding.wheel), _wheel_binding_sort_cb); + + e_widget_ilist_header_append(cfdata->gui.o_binding_list, NULL, "Mouse Wheels"); + } + + for (l = cfdata->binding.wheel, i = 0; l; l = l->next, i++) + { + Evas_Object *ic; + bw = l->data; + + button = _helper_wheel_name_get(bw); + mods = _helper_modifier_name_get(bw->modifiers); + + snprintf(label, sizeof(label), "%s%s%s", button ? button : "", mods[0] ? " + ": "", + mods ? mods : ""); + if (button) free(button); + if (mods) free(mods); + + snprintf(val, sizeof(val), "w%d", i); + + ic = edje_object_add(cfdata->evas); + e_util_edje_icon_set(ic, "enlightenment/mouse_wheel"); + e_widget_ilist_append(cfdata->gui.o_binding_list, ic, label, _binding_change_cb, + cfdata, val); + } + + e_widget_ilist_go(cfdata->gui.o_binding_list); +} +static void +_update_binding_list_selection(E_Config_Dialog_Data *cfdata, const void *bind) +{ + Evas_List *l; + int sel; + + for (l = cfdata->binding.mouse, sel = 0; l; l = l->next, sel++) + { + if (l->data == bind) + { + e_widget_ilist_selected_set(cfdata->gui.o_binding_list, sel + 1); + return; + } + } + + if (evas_list_count(cfdata->binding.mouse)) + sel = evas_list_count(cfdata->binding.mouse) + 1; + else + sel = 0; + + for (l = cfdata->binding.wheel; l; l = l->next, sel++) + { + if (l->data == bind) + { + e_widget_ilist_selected_set(cfdata->gui.o_binding_list, sel + 1); + return; + } + } +} +static void +_update_buttons(E_Config_Dialog_Data *cfdata) +{ + if (!cfdata->locals.cur) + { + e_widget_disabled_set(cfdata->gui.o_mod, 1); + e_widget_disabled_set(cfdata->gui.o_del, 1); + return; + } + + e_widget_disabled_set(cfdata->gui.o_mod, 0); + e_widget_disabled_set(cfdata->gui.o_del, 0); +} +static void +_update_binding_context(E_Config_Dialog_Data *cfdata) +{ + int found = 0; + char *n; + E_Config_Binding_Mouse *eb; + E_Config_Binding_Wheel *bw; + E_Binding_Context ctxt; + + e_widget_disabled_set(cfdata->gui.context.o_any, 1); e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1); e_widget_disabled_set(cfdata->gui.context.o_border, 1); e_widget_disabled_set(cfdata->gui.context.o_menu, 1); @@ -589,454 +686,693 @@ _update_context_radios(E_Config_Dialog_Data *cfdata) e_widget_disabled_set(cfdata->gui.context.o_manager, 1); e_widget_disabled_set(cfdata->gui.context.o_none, 1); - if ((!cfdata->current_mouse_binding) && (!cfdata->current_wheel_binding)) - return; - - e_widget_disabled_set(cfdata->gui.context.o_any, 0); - e_widget_disabled_set(cfdata->gui.context.o_border, 0); - e_widget_disabled_set(cfdata->gui.context.o_menu, 0); - e_widget_disabled_set(cfdata->gui.context.o_winlist, 0); - e_widget_disabled_set(cfdata->gui.context.o_popup, 0); - e_widget_disabled_set(cfdata->gui.context.o_zone, 0); - e_widget_disabled_set(cfdata->gui.context.o_container, 0); - e_widget_disabled_set(cfdata->gui.context.o_manager, 0); + if (!cfdata->locals.cur) return; + + n = cfdata->locals.cur; + if (cfdata->locals.cur[0] == 'm') + { + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + if (!eb) return; + ctxt = eb->context; + } + else + { + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + if (!bw) return; + ctxt = bw->context; + } + + e_widget_disabled_set(cfdata->gui.context.o_any, 0); + e_widget_disabled_set(cfdata->gui.context.o_border, 0); + e_widget_disabled_set(cfdata->gui.context.o_menu, 0); + e_widget_disabled_set(cfdata->gui.context.o_winlist, 0); + e_widget_disabled_set(cfdata->gui.context.o_popup, 0); + e_widget_disabled_set(cfdata->gui.context.o_zone, 0); + e_widget_disabled_set(cfdata->gui.context.o_container, 0); + e_widget_disabled_set(cfdata->gui.context.o_manager, 0); e_widget_disabled_set(cfdata->gui.context.o_none, 0); - if (cfdata->mouse_binding < 3) - { - eb = cfdata->current_mouse_binding; - - if (eb->context == E_BINDING_CONTEXT_ANY) - e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1); - else if (eb->context == E_BINDING_CONTEXT_BORDER) - e_widget_radio_toggle_set(cfdata->gui.context.o_border, 1); - else if (eb->context == E_BINDING_CONTEXT_MENU) - e_widget_radio_toggle_set(cfdata->gui.context.o_menu, 1); - else if (eb->context == E_BINDING_CONTEXT_WINLIST) - e_widget_radio_toggle_set(cfdata->gui.context.o_winlist, 1); - else if (eb->context == E_BINDING_CONTEXT_POPUP) - e_widget_radio_toggle_set(cfdata->gui.context.o_popup, 1); - else if (eb->context == E_BINDING_CONTEXT_ZONE) - e_widget_radio_toggle_set(cfdata->gui.context.o_zone, 1); - else if (eb->context == E_BINDING_CONTEXT_CONTAINER) - e_widget_radio_toggle_set(cfdata->gui.context.o_container, 1); - else if (eb->context == E_BINDING_CONTEXT_MANAGER) - e_widget_radio_toggle_set(cfdata->gui.context.o_manager, 1); - else if (eb->context == E_BINDING_CONTEXT_NONE) - e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1); - else - e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1); - } - else - { - bw = cfdata->current_wheel_binding; - - if (bw->context == E_BINDING_CONTEXT_ANY) - e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1); - else if (bw->context == E_BINDING_CONTEXT_BORDER) - e_widget_radio_toggle_set(cfdata->gui.context.o_border, 1); - else if (bw->context == E_BINDING_CONTEXT_MENU) - e_widget_radio_toggle_set(cfdata->gui.context.o_menu, 1); - else if (bw->context == E_BINDING_CONTEXT_WINLIST) - e_widget_radio_toggle_set(cfdata->gui.context.o_winlist, 1); - else if (bw->context == E_BINDING_CONTEXT_POPUP) - e_widget_radio_toggle_set(cfdata->gui.context.o_popup, 1); - else if (bw->context == E_BINDING_CONTEXT_ZONE) - e_widget_radio_toggle_set(cfdata->gui.context.o_zone, 1); - else if (bw->context == E_BINDING_CONTEXT_CONTAINER) - e_widget_radio_toggle_set(cfdata->gui.context.o_container, 1); - else if (bw->context == E_BINDING_CONTEXT_MANAGER) - e_widget_radio_toggle_set(cfdata->gui.context.o_manager, 1); - else if (bw->context == E_BINDING_CONTEXT_NONE) - e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1); - else - e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1); - } + if (ctxt == E_BINDING_CONTEXT_ANY) + e_widget_radio_toggle_set(cfdata->gui.context.o_any, 1); + else if (ctxt == E_BINDING_CONTEXT_BORDER) + e_widget_radio_toggle_set(cfdata->gui.context.o_border, 1); + else if (ctxt == E_BINDING_CONTEXT_MENU) + e_widget_radio_toggle_set(cfdata->gui.context.o_menu, 1); + else if (ctxt == E_BINDING_CONTEXT_WINLIST) + e_widget_radio_toggle_set(cfdata->gui.context.o_winlist, 1); + else if (ctxt == E_BINDING_CONTEXT_POPUP) + e_widget_radio_toggle_set(cfdata->gui.context.o_popup, 1); + else if (ctxt == E_BINDING_CONTEXT_ZONE) + e_widget_radio_toggle_set(cfdata->gui.context.o_zone, 1); + else if (ctxt == E_BINDING_CONTEXT_CONTAINER) + e_widget_radio_toggle_set(cfdata->gui.context.o_container, 1); + else if (ctxt == E_BINDING_CONTEXT_MANAGER) + e_widget_radio_toggle_set(cfdata->gui.context.o_manager, 1); + else if (ctxt == E_BINDING_CONTEXT_NONE) + e_widget_radio_toggle_set(cfdata->gui.context.o_none, 1); } -static void -_update_mod_key_check_boxes(E_Config_Dialog_Data *cfdata) -{ +static void +_update_binding_params(E_Config_Dialog_Data *cfdata) +{ + char *n; + const char *params; E_Config_Binding_Mouse *eb; E_Config_Binding_Wheel *bw; - e_widget_disabled_set(cfdata->gui.mod_key.o_shift, 1); - e_widget_disabled_set(cfdata->gui.mod_key.o_ctrl, 1); - e_widget_disabled_set(cfdata->gui.mod_key.o_alt, 1); - e_widget_disabled_set(cfdata->gui.mod_key.o_win, 1); - e_widget_check_checked_set(cfdata->gui.mod_key.o_shift, 0); - e_widget_check_checked_set(cfdata->gui.mod_key.o_ctrl, 0); - e_widget_check_checked_set(cfdata->gui.mod_key.o_alt, 0); - e_widget_check_checked_set(cfdata->gui.mod_key.o_win, 0); + e_widget_entry_clear(cfdata->gui.o_params); + e_widget_disabled_set(cfdata->gui.o_params, 1); - if ((!cfdata->current_mouse_binding) && (!cfdata->current_wheel_binding)) - return; + if (!cfdata->locals.cur) return; - e_widget_disabled_set(cfdata->gui.mod_key.o_shift, 0); - e_widget_disabled_set(cfdata->gui.mod_key.o_ctrl, 0); - e_widget_disabled_set(cfdata->gui.mod_key.o_alt, 0); - e_widget_disabled_set(cfdata->gui.mod_key.o_win, 0); - - if (cfdata->mouse_binding < 3) - { - eb = cfdata->current_mouse_binding; - - if (eb->modifiers & E_BINDING_MODIFIER_SHIFT) - e_widget_check_checked_set(cfdata->gui.mod_key.o_shift, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_shift, 0); - - if (eb->modifiers & E_BINDING_MODIFIER_CTRL) - e_widget_check_checked_set(cfdata->gui.mod_key.o_ctrl, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_ctrl, 0); - - if (eb->modifiers & E_BINDING_MODIFIER_ALT) - e_widget_check_checked_set(cfdata->gui.mod_key.o_alt, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_alt, 0); - - if (eb->modifiers & E_BINDING_MODIFIER_WIN) - e_widget_check_checked_set(cfdata->gui.mod_key.o_win, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_win, 0); - } - else - { - bw = cfdata->current_wheel_binding; - - if (bw->modifiers & E_BINDING_MODIFIER_SHIFT) - e_widget_check_checked_set(cfdata->gui.mod_key.o_shift, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_shift, 0); - - if (bw->modifiers & E_BINDING_MODIFIER_CTRL) - e_widget_check_checked_set(cfdata->gui.mod_key.o_ctrl, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_ctrl, 0); - - if (bw->modifiers & E_BINDING_MODIFIER_ALT) - e_widget_check_checked_set(cfdata->gui.mod_key.o_alt, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_alt, 0); - - if (bw->modifiers & E_BINDING_MODIFIER_WIN) - e_widget_check_checked_set(cfdata->gui.mod_key.o_win, 1); - else - e_widget_check_checked_set(cfdata->gui.mod_key.o_win, 0); - } -} - -static void -_update_action_list(E_Config_Dialog_Data *cfdata) -{ - int i; - E_Config_Binding_Mouse *eb; - E_Config_Binding_Wheel *bw; - - if ((cfdata->current_mouse_binding) || (cfdata->current_wheel_binding)) - _fill_action_ilist(cfdata); - else - { - _update_action_params(cfdata); - e_widget_ilist_clear(cfdata->gui.o_action_list); - return; - } - - if (cfdata->mouse_binding < 3) - { - eb = cfdata->current_mouse_binding; - - for (i = 0; i < E_ACTION_NUMBER; i++) - { - if (!strcmp(eb->action, action_to_name[i][0])) - break; - } - e_widget_ilist_selected_set(cfdata->gui.o_action_list, i); - } - else - { - bw = cfdata->current_wheel_binding; - - for (i = 0; i < E_ACTION_NUMBER; i++) - { - if (!strcmp(bw->action, action_to_name[i][0])) - break; - } - e_widget_ilist_selected_set(cfdata->gui.o_action_list, i); - } -} - -static void -_update_action_params(E_Config_Dialog_Data *cfdata) -{ - E_Config_Binding_Mouse *eb; - E_Config_Binding_Wheel *bw; - - if ((!cfdata->current_mouse_binding) && (!cfdata->current_wheel_binding)) - { - e_widget_entry_clear(cfdata->gui.o_params); - e_widget_disabled_set(cfdata->gui.o_params, 1); - return; - } e_widget_disabled_set(cfdata->gui.o_params, 0); - if (cfdata->mouse_binding < 3) + n = cfdata->locals.cur; + if (cfdata->locals.cur[0] == 'm') { - eb = cfdata->current_mouse_binding; - if (eb->params) - e_widget_entry_text_set(cfdata->gui.o_params, eb->params); - else - e_widget_entry_clear(cfdata->gui.o_params); + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + params = eb->params; } else { - bw = cfdata->current_wheel_binding; - if (bw->params) - e_widget_entry_text_set(cfdata->gui.o_params, bw->params); - else - e_widget_entry_clear(cfdata->gui.o_params); + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + params = bw->params; } + + if ((!params) || (!params[0])) + { + //FIXME: need to put example + //e_widget_entry_text_set(cfdata->gui.o_params, EXAMPLE_STRING); + e_widget_entry_clear(cfdata->gui.o_params); + } + else + e_widget_entry_text_set(cfdata->gui.o_params, params); } - +/******** callbacks ***********/ static void -_fill_action_ilist(E_Config_Dialog_Data *cfdata) -{ - char buf[256]; - int j; - - if (e_widget_ilist_count(cfdata->gui.o_action_list)) - return; - - for (j = 0; j < E_ACTION_NUMBER; j++) - { - snprintf(buf, sizeof(buf), "%d", j); - e_widget_ilist_append(cfdata->gui.o_action_list, NULL, action_to_name[j][1], - _action_ilist_change_cb, cfdata, buf); - } - e_widget_ilist_go(cfdata->gui.o_action_list); -} - - -static void -_apply_binding_changes(E_Config_Dialog_Data *cfdata) +_action_change_cb(void *data) { + const char *action; + char *n; E_Config_Binding_Mouse *eb; E_Config_Binding_Wheel *bw; - if (cfdata->current_mouse_binding) - { - eb = cfdata->current_mouse_binding; - - eb->context = cfdata->context; - eb->modifiers = E_BINDING_MODIFIER_NONE; - if (cfdata->shift_mod) - eb->modifiers |= E_BINDING_MODIFIER_SHIFT; - if (cfdata->ctrl_mod) - eb->modifiers |= E_BINDING_MODIFIER_CTRL; - if (cfdata->alt_mod) - eb->modifiers |= E_BINDING_MODIFIER_ALT; - if (cfdata->win_mod) - eb->modifiers |= E_BINDING_MODIFIER_WIN; - if (eb->action) evas_stringshare_del(eb->action); - eb->action = evas_stringshare_add(action_to_name[atoi(cfdata->action_ilist_value)][0]); - if (eb->params) evas_stringshare_del(eb->params); - eb->params = cfdata->params[0] ? evas_stringshare_add(cfdata->params) : NULL; - } - else if (cfdata->current_wheel_binding) - { - bw = cfdata->current_wheel_binding; - - bw->context = cfdata->context; - bw->direction = 0; - bw->modifiers = E_BINDING_MODIFIER_NONE; - if (cfdata->shift_mod) - bw->modifiers |= E_BINDING_MODIFIER_SHIFT; - if (cfdata->ctrl_mod) - bw->modifiers |= E_BINDING_MODIFIER_CTRL; - if (cfdata->alt_mod) - bw->modifiers |= E_BINDING_MODIFIER_ALT; - if (cfdata->win_mod) - bw->modifiers |= E_BINDING_MODIFIER_WIN; - if (bw->action) evas_stringshare_del(bw->action); - bw->action = evas_stringshare_add(action_to_name[atoi(cfdata->action_ilist_value)][0]); - if (bw->params) evas_stringshare_del(bw->params); - bw->params = cfdata->params[0] ? evas_stringshare_add(cfdata->params) : NULL; - } -} - -static void -_update_delete_button(E_Config_Dialog_Data *cfdata) -{ - if (evas_list_count(cfdata->mouse_bindings[cfdata->mouse_binding])) - e_widget_disabled_set(cfdata->gui.o_del, 0); - else - e_widget_disabled_set(cfdata->gui.o_del, 1); -} - -/* callbacks */ -static void -_binding_change_cb(void *data, Evas_Object *obj) -{ E_Config_Dialog_Data *cfdata; cfdata = data; - _apply_binding_changes(cfdata); - cfdata->current_mouse_binding = NULL; - cfdata->current_wheel_binding = NULL; + if (!cfdata->locals.cur) return; - _update_binding_action_list(cfdata); - _update_delete_button(cfdata); -} + action = action_to_name[atoi(cfdata->locals.action)][0]; -static void -_binding_action_ilist_change_cb(void *data) -{ - E_Config_Dialog_Data *cfdata; - - cfdata = data; - - _apply_binding_changes(cfdata); - - if (cfdata->mouse_binding < 3) - { - cfdata->current_mouse_binding = - evas_list_nth(cfdata->mouse_bindings[cfdata->mouse_binding], - atoi(cfdata->binding_ilist_value)); - cfdata->current_wheel_binding = NULL; - } - else + n = cfdata->locals.cur; + if (cfdata->locals.cur[0] == 'm') { - cfdata->current_mouse_binding = NULL; - cfdata->current_wheel_binding = - evas_list_nth(cfdata->mouse_bindings[cfdata->mouse_binding], - atoi(cfdata->binding_ilist_value)); - } - - _update_context_radios(cfdata); - _update_mod_key_check_boxes(cfdata); - _update_action_list(cfdata); - _update_action_params(cfdata); -} - -static void -_action_ilist_change_cb(void *data) -{ - E_Config_Dialog_Data *cfdata; - - cfdata = data; - _update_action_params(cfdata); -} - -static void -_add_binding_cb(void *data, void *data2) -{ - E_Config_Dialog_Data *cfdata; - E_Config_Binding_Mouse *bm; - E_Config_Binding_Wheel *bw; - - cfdata = data; - - if (cfdata->mouse_binding < 3) - { - bm = E_NEW(E_Config_Binding_Mouse, 1); - if (!bm) return; - bm->context = E_BINDING_CONTEXT_ANY; - switch (cfdata->mouse_binding) - { - case 0: - bm->button = 1; - break; - case 1: - bm->button = 2; - break; - case 2: - bm->button = 3; - break; + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + if (!eb || !eb->action) + { + //FIXME: need to put here an example how to make binding + e_widget_entry_clear(cfdata->gui.o_params); + return; } - bm->modifiers = E_BINDING_MODIFIER_NONE; - bm->any_mod = 0; - bm->action = evas_stringshare_add(action_to_name[0][0]); - bm->params = NULL; - cfdata->mouse_bindings[cfdata->mouse_binding] = - evas_list_append(cfdata->mouse_bindings[cfdata->mouse_binding], bm); + if (!strcmp(eb->action, action)) + { + if (!eb->params) + { + //FIXME: need to put here an example how to make binding + //e_widget_entry_text_set(cfdata->gui.o_params, EXAMPLE_STRING); + e_widget_entry_clear(cfdata->gui.o_params); + } + else + e_widget_entry_text_set(cfdata->gui.o_params, eb->params); + } + else + { + //FIXME: need to put here an example how to make binding + //e_widget_entry_text_set(cfdata->gui.o_params, EXAMPLE_STRING); + e_widget_entry_clear(cfdata->gui.o_params); + } } else { - bw = E_NEW(E_Config_Binding_Wheel, 1); - if (!bw) return; - bw->context = E_BINDING_CONTEXT_ANY; - bw->direction = 0; - if (cfdata->mouse_binding == 3) - bw->z = -1; - else if (cfdata->mouse_binding == 4) - bw->z = 1; - bw->modifiers = E_BINDING_MODIFIER_NONE; - bw->any_mod = 0; - bw->action = evas_stringshare_add(action_to_name[0][0]); - bw->params = NULL; + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + if (!bw || !bw->action) + { + //FIXME: need to put here an example how to make binding + e_widget_entry_clear(cfdata->gui.o_params); + return; + } - cfdata->mouse_bindings[cfdata->mouse_binding] = - evas_list_append(cfdata->mouse_bindings[cfdata->mouse_binding], bw); + if (!strcmp(bw->action, action)) + { + if (!bw->params) + { + //FIXME: need to put here an example how to make binding + e_widget_entry_clear(cfdata->gui.o_params); + } + else + e_widget_entry_text_set(cfdata->gui.o_params, bw->params); + } + else + { + //FIXME: need to put here an example how to make binding + //e_widget_entry_text_set(cfdata->gui.o_params, EXAMPLE_STRING); + e_widget_entry_clear(cfdata->gui.o_params); + } } - - _update_binding_action_list(cfdata); - _update_delete_button(cfdata); - e_widget_ilist_selected_set(cfdata->gui.o_binding_action_list, - e_widget_ilist_count(cfdata->gui.o_binding_action_list) - 1); } static void -_delete_binding_cb(void *data, void *data2) +_binding_change_cb(void *data) { - int current_selection = 0; + char *n; E_Config_Dialog_Data *cfdata; - E_Config_Binding_Mouse *bm; + + cfdata = data; + + _auto_apply_changes(cfdata); + + if (cfdata->locals.cur) free(cfdata->locals.cur); + cfdata->locals.cur == NULL; + + if (cfdata->locals.binding[0]) + cfdata->locals.cur = strdup(cfdata->locals.binding); + + _update_binding_context(cfdata); + _update_binding_actions(cfdata); + _update_binding_params(cfdata); + _update_buttons(cfdata); +} +static void +_add_mouse_binding_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + cfdata = data; + + if (cfdata->locals.mousebind_win != 0) return; + + cfdata->locals.add = 1; + cfdata->locals.dia = e_dialog_new(e_container_current_get(e_manager_current_get()), + "E", "_mousebind_getmouse_dialog"); + if (!cfdata->locals.dia) return; + e_dialog_title_set(cfdata->locals.dia, _("Mouse Binding Sequence")); + e_dialog_icon_set(cfdata->locals.dia, "enlightenment/mouse_clean", 64); + e_dialog_text_set(cfdata->locals.dia, TEXT_PRESS_MOUSE_BINIDING_SEQUENCE); + e_win_centered_set(cfdata->locals.dia->win, 1); + e_win_borderless_set(cfdata->locals.dia->win, 1); + + cfdata->locals.mousebind_win = ecore_x_window_input_new(e_manager_current_get()->root, + 0, 0, 1, 1); + ecore_x_window_show(cfdata->locals.mousebind_win); + e_grabinput_get(cfdata->locals.mousebind_win, 0, cfdata->locals.mousebind_win); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, + _grab_key_down_cb, cfdata)); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, + _grab_mouse_down_cb, cfdata)); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL, + _grab_mouse_wheel_cb, cfdata)); + + e_dialog_show(cfdata->locals.dia); +} +static void +_modify_mouse_binding_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + cfdata = data; + + if (cfdata->locals.mousebind_win != 0) return; + + cfdata->locals.add = 0; + cfdata->locals.dia = e_dialog_new(e_container_current_get(e_manager_current_get()), + "E", "_mousebind_getmouse_dialog"); + if (!cfdata->locals.dia) return; + e_dialog_title_set(cfdata->locals.dia, _("Mouse Binding Sequence")); + e_dialog_icon_set(cfdata->locals.dia, "enlightenment/mouse_clean", 64); + e_dialog_text_set(cfdata->locals.dia, TEXT_PRESS_MOUSE_BINIDING_SEQUENCE); + e_win_centered_set(cfdata->locals.dia->win, 1); + e_win_borderless_set(cfdata->locals.dia->win, 1); + + cfdata->locals.mousebind_win = ecore_x_window_input_new(e_manager_current_get()->root, + 0, 0, 1, 1); + ecore_x_window_show(cfdata->locals.mousebind_win); + e_grabinput_get(cfdata->locals.mousebind_win, 0, cfdata->locals.mousebind_win); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, + _grab_key_down_cb, cfdata)); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, + _grab_mouse_down_cb, cfdata)); + + cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers, + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL, + _grab_mouse_wheel_cb, cfdata)); + + e_dialog_show(cfdata->locals.dia); +} +static void +_delete_mouse_binding_cb(void *data, void *data2) +{ + Evas_List *l; + char *n; + int sel; + E_Config_Dialog_Data *cfdata; + E_Config_Binding_Mouse *eb; E_Config_Binding_Wheel *bw; cfdata = data; - current_selection = e_widget_ilist_selected_get(cfdata->gui.o_binding_action_list); - if (cfdata->mouse_binding < 3) + sel = e_widget_ilist_selected_get(cfdata->gui.o_binding_list); + if (cfdata->locals.binding[0] == 'm') { - bm = cfdata->current_mouse_binding; - cfdata->mouse_bindings[cfdata->mouse_binding] = - evas_list_remove(cfdata->mouse_bindings[cfdata->mouse_binding], bm); + n = cfdata->locals.binding; + l = evas_list_nth_list(cfdata->binding.mouse, atoi(++n)); - if (bm->action) evas_stringshare_del(bm->action); - if (bm->params) evas_stringshare_del(bm->params); - E_FREE(bm); - cfdata->current_mouse_binding = NULL; + if (l) + { + eb = l->data; + if (eb->action) evas_stringshare_del(eb->action); + if (eb->params) evas_stringshare_del(eb->params); + E_FREE(eb); + cfdata->binding.mouse = evas_list_remove_list(cfdata->binding.mouse, l); + } } else { - bw = cfdata->current_wheel_binding; - cfdata->mouse_bindings[cfdata->mouse_binding] = - evas_list_remove(cfdata->mouse_bindings[cfdata->mouse_binding], bw); + n = cfdata->locals.binding; + l = evas_list_nth_list(cfdata->binding.wheel, atoi(++n)); + if (l) + { + bw = l->data; + if (bw->action) evas_stringshare_del(bw->action); + if (bw->params) evas_stringshare_del(bw->params); + E_FREE(bw); + + cfdata->binding.wheel = evas_list_remove_list(cfdata->binding.wheel, l); + } + } + + _update_binding_list(cfdata); + if (sel >= e_widget_ilist_count(cfdata->gui.o_binding_list)) + sel = e_widget_ilist_count(cfdata->gui.o_binding_list) - 1; + + + if (cfdata->locals.cur) free(cfdata->locals.cur); + cfdata->locals.cur = NULL; + if (!e_widget_ilist_count(cfdata->gui.o_binding_list)) + { + _update_binding_context(cfdata); + _update_binding_params(cfdata); + _update_buttons(cfdata); + e_widget_ilist_selected_set(cfdata->gui.o_action_list, 0); + } + else + e_widget_ilist_selected_set(cfdata->gui.o_binding_list, sel); +} +static void +_restore_default_cb(void *data, void *data2) +{ + Evas_List *l; + E_Config_Binding_Mouse *eb; + E_Config_Binding_Wheel *bw; + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + while (cfdata->binding.mouse) + { + eb = cfdata->binding.mouse->data; + if (eb->action) evas_stringshare_del(eb->action); + if (eb->params) evas_stringshare_del(eb->params); + E_FREE(eb); + cfdata->binding.mouse = + evas_list_remove_list(cfdata->binding.mouse, cfdata->binding.mouse); + } + + while (cfdata->binding.wheel) + { + bw = cfdata->binding.wheel->data; if (bw->action) evas_stringshare_del(bw->action); if (bw->params) evas_stringshare_del(bw->params); E_FREE(bw); - cfdata->current_wheel_binding = NULL; + cfdata->binding.wheel = + evas_list_remove_list(cfdata->binding.wheel, cfdata->binding.wheel); } +#define CFG_MOUSEBIND(_context, _button, _modifiers, _anymod, _action, _params) \ + eb = E_NEW(E_Config_Binding_Mouse, 1); \ + eb->context = _context; \ + eb->button = _button; \ + eb->modifiers = _modifiers; \ + eb->any_mod = _anymod; \ + eb->action = _action == NULL ? NULL : evas_stringshare_add(_action); \ + eb->params = _params == NULL ? NULL : evas_stringshare_add(_params); \ + cfdata->binding.mouse = evas_list_append(cfdata->binding.mouse, eb) + + CFG_MOUSEBIND(E_BINDING_CONTEXT_BORDER, 1, E_BINDING_MODIFIER_ALT, 0, "window_move", NULL); + CFG_MOUSEBIND(E_BINDING_CONTEXT_BORDER, 2, E_BINDING_MODIFIER_ALT, 0, "window_resize", NULL); + CFG_MOUSEBIND(E_BINDING_CONTEXT_BORDER, 3, E_BINDING_MODIFIER_ALT, 0, "window_menu", NULL); + CFG_MOUSEBIND(E_BINDING_CONTEXT_ZONE, 1, 0, 0, "menu_show", "main"); + CFG_MOUSEBIND(E_BINDING_CONTEXT_ZONE, 2, 0, 0, "menu_show", "clients"); + CFG_MOUSEBIND(E_BINDING_CONTEXT_ZONE, 3, 0, 0, "menu_show", "favorites"); - _update_binding_action_list(cfdata); - if (!e_widget_ilist_count(cfdata->gui.o_binding_action_list)) - { - _update_context_radios(cfdata); - _update_mod_key_check_boxes(cfdata); - _update_action_list(cfdata); - _update_action_params(cfdata); - _update_delete_button(cfdata); +#define CFG_WHEELBIND(_context, _direction, _z, _modifiers, _anymod, _action, _params) \ + bw = E_NEW(E_Config_Binding_Wheel, 1); \ + bw->context = _context; \ + bw->direction = _direction; \ + bw->z = _z; \ + bw->modifiers = _modifiers; \ + bw->any_mod = _anymod; \ + bw->action = _action == NULL ? NULL : evas_stringshare_add(_action); \ + bw->params = _params == NULL ? NULL : evas_stringshare_add(_params); \ + cfdata->binding.wheel = evas_list_append(cfdata->binding.wheel, bw) + + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, -1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, -1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, 1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, 1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 0, -1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 1, -1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 0, 1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_POPUP, 1, 1, E_BINDING_MODIFIER_NONE, 1, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, -1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, -1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 0, 1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_CONTAINER, 1, 1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_BORDER, 0, -1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_BORDER, 1, -1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "-1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_BORDER, 0, 1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "1"); + CFG_WHEELBIND(E_BINDING_CONTEXT_BORDER, 1, 1, E_BINDING_MODIFIER_ALT, 0, + "desk_linear_flip_by", "1"); + + if (cfdata->locals.cur) free(cfdata->locals.cur); + cfdata->locals.cur = NULL; + + _update_binding_list(cfdata); + _update_buttons(cfdata); + _update_binding_params(cfdata); + _update_binding_context(cfdata); + e_widget_ilist_selected_set(cfdata->gui.o_action_list, 0); +} + +static int +_grab_mouse_down_cb(void *data, int type, void *event) +{ + Evas_List *l; + E_Config_Dialog_Data *cfdata; + E_Config_Binding_Mouse *eb; + int mod = E_BINDING_MODIFIER_NONE, found = 0; + Ecore_X_Event_Mouse_Button_Down *ev = event; + + cfdata = data; + if (ev->win != cfdata->locals.mousebind_win) return 1; + + if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) + mod |= E_BINDING_MODIFIER_SHIFT; + if (ev->modifiers & ECORE_X_MODIFIER_CTRL) + mod |= E_BINDING_MODIFIER_CTRL; + if (ev->modifiers & ECORE_X_MODIFIER_ALT) + mod |= E_BINDING_MODIFIER_ALT; + if (ev->modifiers & ECORE_X_MODIFIER_WIN) + mod |= E_BINDING_MODIFIER_WIN; + + + if (cfdata->locals.add) + { + eb = E_NEW(E_Config_Binding_Mouse, 1); + eb->context = E_BINDING_CONTEXT_ANY; + eb->button = ev->button; + eb->modifiers = mod; + eb->any_mod = 0; + eb->action = evas_stringshare_add(action_to_name[0][0]); + eb->params = NULL; + + cfdata->binding.mouse = evas_list_append(cfdata->binding.mouse, eb); } else { - if (current_selection >= e_widget_ilist_count(cfdata->gui.o_binding_action_list)) - e_widget_ilist_selected_set(cfdata->gui.o_binding_action_list, - e_widget_ilist_count(cfdata->gui.o_binding_action_list) - 1); - else - e_widget_ilist_selected_set(cfdata->gui.o_binding_action_list, current_selection); + char *n = cfdata->locals.cur; + + eb = evas_list_nth(cfdata->binding.mouse, atoi(++n)); + if (eb) + { + eb->button = ev->button; + eb->modifiers = mod; + } + } + _update_binding_list(cfdata); + _update_binding_list_selection(cfdata, eb); + + _grab_wnd_hide_cb(cfdata); + _update_buttons(cfdata); + return 1; +} +static int _grab_mouse_wheel_cb(void *data, int type, void *event) +{ + Evas_List *l; + E_Config_Binding_Wheel *bw; + E_Config_Dialog_Data *cfdata; + Ecore_X_Event_Mouse_Wheel *ev = event; + int mod = E_BINDING_MODIFIER_NONE, found = 0; + + cfdata = data; + + if (ev->win != cfdata->locals.mousebind_win) return 1; + + if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) + mod |= E_BINDING_MODIFIER_SHIFT; + if (ev->modifiers & ECORE_X_MODIFIER_CTRL) + mod |= E_BINDING_MODIFIER_CTRL; + if (ev->modifiers & ECORE_X_MODIFIER_ALT) + mod |= E_BINDING_MODIFIER_ALT; + if (ev->modifiers & ECORE_X_MODIFIER_WIN) + mod |= E_BINDING_MODIFIER_WIN; + + + if (cfdata->locals.add) + { + bw = E_NEW(E_Config_Binding_Wheel, 1); + bw->context = E_BINDING_CONTEXT_ANY; + bw->direction = ev->direction; + bw->z = ev->z; + bw->modifiers = mod; + bw->any_mod = 0; + bw->action = evas_stringshare_add(action_to_name[0][0]); + bw->params = NULL; + + cfdata->binding.wheel = evas_list_append(cfdata->binding.wheel, bw); + } + else + { + char *n = cfdata->locals.cur; + + bw = evas_list_nth(cfdata->binding.wheel, atoi(++n)); + if (bw) + { + bw->direction = ev->direction; + bw->z = ev->z; + bw->modifiers = mod; + } + } + _update_binding_list(cfdata); + _update_binding_list_selection(cfdata, bw); + + _grab_wnd_hide_cb(cfdata); + _update_buttons(cfdata); + + return 1; +} +static int +_grab_key_down_cb(void *data, int type, void *event) +{ + E_Config_Dialog_Data *cfdata; + Ecore_X_Event_Key_Down *ev = event; + + cfdata = data; + + if (ev->win != cfdata->locals.mousebind_win) return 1; + + if (!strcmp(ev->keyname, "Escape") && + !(ev->modifiers & ECORE_X_MODIFIER_SHIFT) && + !(ev->modifiers & ECORE_X_MODIFIER_CTRL) && + !(ev->modifiers & ECORE_X_MODIFIER_ALT) && + !(ev->modifiers & ECORE_X_MODIFIER_WIN)) + { + _grab_wnd_hide_cb(cfdata); } } +static void +_grab_wnd_hide_cb(E_Config_Dialog_Data *cfdata) +{ + while (cfdata->locals.handlers) + { + ecore_event_handler_del(cfdata->locals.handlers->data); + cfdata->locals.handlers = evas_list_remove_list(cfdata->locals.handlers, + cfdata->locals.handlers); + } + cfdata->locals.handlers = NULL; + e_grabinput_release(cfdata->locals.mousebind_win, cfdata->locals.mousebind_win); + ecore_x_window_del(cfdata->locals.mousebind_win); + cfdata->locals.mousebind_win = 0; + + e_object_del(E_OBJECT(cfdata->locals.dia)); + cfdata->locals.dia = NULL; +} +/******** helpers *************/ +static char * +_helper_modifier_name_get(int mod) +{ + char mods[1024]=""; + + if (mod & E_BINDING_MODIFIER_SHIFT) + snprintf(mods, sizeof(mods), "SHIFT"); + + if (mod & E_BINDING_MODIFIER_CTRL) + { + if (mods[0]) strcat(mods, " + "); + strcat(mods, "CTRL"); + } + + if (mod & E_BINDING_MODIFIER_ALT) + { + if (mods[0]) strcat(mods, " + "); + strcat(mods, "ALT"); + } + + if (mod & E_BINDING_MODIFIER_WIN) + { + if (mods[0]) strcat(mods, " + "); + strcat(mods, "WIN"); + } + + return strdup(mods); +} +static char * +_helper_button_name_get(E_Config_Binding_Mouse *eb) +{ + char *name = NULL; + char buf[1024]=""; + + switch (eb->button) + { + case 1: + name = strdup("Left Button"); + break; + case 2: + name = strdup("Middle Button"); + break; + case 3: + name = strdup("Right Button"); + break; + case 4: + case 5: + case 6: + case 7: + break; + default: + snprintf(buf, sizeof(buf), "Extra Button (%d)", eb->button); + name = strdup(buf); + } + return name; +} +static char * +_helper_wheel_name_get(E_Config_Binding_Wheel *bw) +{ + char *name = NULL; + char buf[1024] = ""; + + switch (bw->direction) + { + case 0: + if (bw->z >= 0) + name = strdup("Mouse Wheel Up"); + else + name = strdup("Mouse Wheel Down"); + break; + default: + if (bw->z >= 0) + snprintf(buf, sizeof(buf), "Extra Wheel (%d) Up", bw->direction); + else + snprintf(buf, sizeof(buf), "Extra Wheel (%d) Down", bw->direction); + name = strdup(buf); + } + return name; +} +/********* sorts ***************/ +static int +_mouse_binding_sort_cb(void *d1, void *d2) +{ + E_Config_Binding_Mouse *eb, *eb2; + + eb = d1; + eb2 = d2; + + if (eb->button < eb2->button) return -1; + else if (eb->button > eb2->button) return 1; + else + { + if (eb->modifiers < eb2->modifiers) return -1; + else if (eb->modifiers > eb2->modifiers) return 1; + } + return 0; +} +static int +_wheel_binding_sort_cb(void *d1, void *d2) +{ + E_Config_Binding_Wheel *bw, *bw2; + + bw = d1; + bw2 = d2; + + if (bw->direction < bw2->direction) + { + return -1; + } + else if (bw->direction > bw2->direction) + { + return 1; + } + else + { + if ((bw->z < 0) && (bw2->z > 0)) + { + return 1; + } + else if ((bw->z > 0) && (bw2->z < 0)) + { + return -1; + } + else if (((bw->z < 0) && (bw2->z < 0)) || + ((bw->z > 0) && (bw2->z > 0))) + { + if (bw->modifiers < bw2->modifiers) + return -1; + else if (bw->modifiers > bw2->modifiers) + return 1; + } + } + return 0; +} diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c index 2f751b7fd..22629756c 100644 --- a/src/bin/e_int_shelf_config.c +++ b/src/bin/e_int_shelf_config.c @@ -251,6 +251,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) cfdata->escfg->orient = cfdata->orient; e_shelf_orient(cfdata->es, cfdata->orient); e_shelf_position_calc(cfdata->es); + restart = 1; } /* Only Change fit along if we need to */ diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index d295b2ac3..8f7b27aa0 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -261,8 +261,8 @@ e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h) es->y = y; es->w = w; es->h = h; - if (es->popup) - e_popup_move_resize(es->popup, es->x, es->y, es->w, es->h); + if (es->popup) + e_popup_move_resize(es->popup, es->x, es->y, es->w, es->h); else { evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); @@ -475,7 +475,6 @@ e_shelf_style_set(E_Shelf *es, const char *style) if (!e_theme_edje_object_set(es->o_base, "base/theme/shelf", buf)) e_theme_edje_object_set(es->o_base, "base/theme/shelf", "e/shelf/default/base"); - e_gadcon_unpopulate(es->gadcon); e_gadcon_populate(es->gadcon); }