diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index f10673eba..21cddbbf5 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -6,97 +6,97 @@ #define E_LAYOUT_ITEM_DRAG_RESIST_LEVEL 10 -static void _e_gadcon_free(E_Gadcon *gc); -static void _e_gadcon_client_free(E_Gadcon_Client *gcc); +static void _e_gadcon_free(E_Gadcon *gc); +static void _e_gadcon_client_free(E_Gadcon_Client *gcc); -static void _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc); -static Eina_Bool _e_gadcon_cb_client_scroll_timer(void *data); -static Eina_Bool _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); -static void _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_gadcon_client_save(E_Gadcon_Client *gcc); -static void _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y); -static void _e_gadcon_client_inject(E_Gadcon *gc, E_Gadcon_Client *gcc, int x, int y); +static void _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc); +static Eina_Bool _e_gadcon_cb_client_scroll_timer(void *data); +static Eina_Bool _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); +static void _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_client_save(E_Gadcon_Client *gcc); +static void _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y); +static void _e_gadcon_client_inject(E_Gadcon *gc, E_Gadcon_Client *gcc, int x, int y); -static void _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_moveresize(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_client_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_client_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_client_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_client_move(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_cb_client_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_moveresize(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_move(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_gadcon_cb_client_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _e_gadcon_client_move_start(E_Gadcon_Client *gcc); -static void _e_gadcon_client_move_stop(E_Gadcon_Client *gcc); -static void _e_gadcon_client_move_go(E_Gadcon_Client *gcc); +static void _e_gadcon_client_move_start(E_Gadcon_Client *gcc); +static void _e_gadcon_client_move_stop(E_Gadcon_Client *gcc); +static void _e_gadcon_client_move_go(E_Gadcon_Client *gcc); -static void _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _e_gadcon_cb_drag_finished(E_Drag *drag, int dropped); -static void _e_gadcon_cb_dnd_enter(void *data, const char *type, void *event); -static void _e_gadcon_cb_dnd_move(void *data, const char *type, void *event); -static void _e_gadcon_cb_dnd_leave(void *data, const char *type, void *event); -static void _e_gadcon_cb_drop(void *data, const char *type, void *event); +static void _e_gadcon_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_left_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_left_stop(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_right_start(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_right_stop(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _e_gadcon_cb_drag_finished(E_Drag *drag, int dropped); +static void _e_gadcon_cb_dnd_enter(void *data, const char *type, void *event); +static void _e_gadcon_cb_dnd_move(void *data, const char *type, void *event); +static void _e_gadcon_cb_dnd_leave(void *data, const char *type, void *event); +static void _e_gadcon_cb_drop(void *data, const char *type, void *event); -static int _e_gadcon_client_class_feature_check(const E_Gadcon_Client_Class *cc, const char *name, void *feature); -static void _e_gadcon_client_cb_menu_post(void *data, E_Menu *m); -static void _e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_gadcon_client_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_gadcon_client_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_gadcon_client_cb_menu_style_plain(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_gadcon_client_cb_menu_style_inset(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi); +static int _e_gadcon_client_class_feature_check(const E_Gadcon_Client_Class *cc, const char *name, void *feature); +static void _e_gadcon_client_cb_menu_post(void *data, E_Menu *m); +static void _e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_client_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_client_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_client_cb_menu_style_plain(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_gadcon_client_cb_menu_style_inset(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m, E_Menu_Item *mi); /*static void _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi);*/ -static void _e_gadcon_client_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_gadcon_client_cb_menu_remove(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_gadcon_client_cb_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_gadcon_client_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_gadcon_client_cb_menu_remove(void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_gadcon_client_cb_menu_pre(void *data, E_Menu *m, E_Menu_Item *mi); -static void _e_gadcon_client_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_client_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); -static Evas_Object *e_gadcon_layout_add(Evas *evas); -static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal); -static int e_gadcon_layout_orientation_get(Evas_Object *obj); -static void e_gadcon_layout_freeze(Evas_Object *obj); -static void e_gadcon_layout_thaw(Evas_Object *obj); -static void e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); -static void e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); -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, 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); -static void _e_gadcon_provider_populate_request(const E_Gadcon_Client_Class *cc); -static void _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc); -static Eina_Bool _e_gadcon_provider_populate_idler(void *data); -static Eina_Bool _e_gadcon_custom_populate_idler(void *data); +static Evas_Object *e_gadcon_layout_add(Evas *evas); +static void e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal); +static int e_gadcon_layout_orientation_get(Evas_Object *obj); +static void e_gadcon_layout_freeze(Evas_Object *obj); +static void e_gadcon_layout_thaw(Evas_Object *obj); +static void e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); +static void e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h); +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, 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); +static void _e_gadcon_provider_populate_request(const E_Gadcon_Client_Class *cc); +static void _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc); +static Eina_Bool _e_gadcon_provider_populate_idler(void *data); +static Eina_Bool _e_gadcon_custom_populate_idler(void *data); -static int _e_gadcon_location_change(E_Gadcon_Client * gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst); +static int _e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst); -typedef struct _E_Smart_Data E_Smart_Data; +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_gadcons_asked_position_set(E_Smart_Data *sd); -static Eina_List *_e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd); -static void _e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Eina_List **list); -static void _e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Eina_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, Eina_List **con_list); +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_gadcons_asked_position_set(E_Smart_Data *sd); +static Eina_List *_e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd); +static void _e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Eina_List **list); +static void _e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Eina_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, Eina_List **con_list); typedef enum _E_Gadcon_Layout_Item_State { @@ -111,70 +111,70 @@ typedef enum _E_Gadcon_Layout_Item_State typedef enum _E_Gadcon_Layout_Item_Flags { - E_GADCON_LAYOUT_ITEM_LOCK_NONE = 0x00000000, + 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_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; + int pos, size, prev_pos, prev_size; - struct - { - int min_seq, max_seq; - } state_info; + struct + { + int min_seq, max_seq; + } state_info; - E_Smart_Data *sd; - Eina_List *items; + E_Smart_Data *sd; + Eina_List *items; E_Layout_Item_Container_State state; }; -#define LC_FREE(__lc) \ - if (__lc->items) \ - eina_list_free(__lc->items); \ - E_FREE(__lc) +#define LC_FREE(__lc) \ + if (__lc->items) \ + eina_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 + 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 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 (__increase) \ - __lc->size += __bi->w; \ - else \ - __lc->size -= __bi->w; \ - } + { \ + if (__increase) \ + __lc->size += __bi->w; \ + else \ + __lc->size -= __bi->w; \ + } /********************/ @@ -205,14 +205,14 @@ e_gadcon_shutdown(void) populate_requests = eina_list_free(populate_requests); if (populate_idler) { - ecore_idler_del(populate_idler); - populate_idler = NULL; + ecore_idler_del(populate_idler); + populate_idler = NULL; } custom_populate_requests = eina_list_free(custom_populate_requests); if (custom_populate_idler) { - ecore_idler_del(custom_populate_idler); - custom_populate_idler = NULL; + ecore_idler_del(custom_populate_idler); + custom_populate_idler = NULL; } return 1; @@ -238,11 +238,11 @@ e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc) EINA_LIST_FOREACH(gadcons, l, gc) { - EINA_LIST_FOREACH(gc->clients, ll, gcc) - { - if (gcc->client_class == cc) - dlist = eina_list_append(dlist, gcc); - } + EINA_LIST_FOREACH(gc->clients, ll, gcc) + { + if (gcc->client_class == cc) + dlist = eina_list_append(dlist, gcc); + } } EINA_LIST_FREE(dlist, gcc) e_object_del(E_OBJECT(gcc)); @@ -265,9 +265,9 @@ e_gadcon_custom_new(E_Gadcon *gc) gadcons = eina_list_append(gadcons, gc); - if (!custom_populate_idler) + if (!custom_populate_idler) { - custom_populate_idler = + custom_populate_idler = ecore_idler_add(_e_gadcon_custom_populate_idler, NULL); } if (!eina_list_data_find(custom_populate_requests, gc)) @@ -306,40 +306,40 @@ e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *s gc->evas = evas_object_evas_get(obj); gc->o_container = e_gadcon_layout_add(gc->evas); evas_object_geometry_get(gc->o_container, &x, &y, &w, &h); - gc->drop_handler = + gc->drop_handler = e_drop_handler_add(E_OBJECT(gc), gc, _e_gadcon_cb_dnd_enter, _e_gadcon_cb_dnd_move, _e_gadcon_cb_dnd_leave, _e_gadcon_cb_drop, drop_types, 1, x, y, w, h); evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_MOVE, - _e_gadcon_cb_moveresize, gc); + _e_gadcon_cb_moveresize, gc); evas_object_event_callback_add(gc->o_container, EVAS_CALLBACK_RESIZE, - _e_gadcon_cb_moveresize, gc); + _e_gadcon_cb_moveresize, gc); evas_object_smart_callback_add(gc->o_container, "size_request", - _e_gadcon_cb_size_request, gc); + _e_gadcon_cb_size_request, gc); evas_object_smart_callback_add(gc->o_container, "min_size_request", - _e_gadcon_cb_min_size_request, gc); + _e_gadcon_cb_min_size_request, gc); evas_object_show(gc->o_container); edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, - gc->o_container); + gc->o_container); gadcons = eina_list_append(gadcons, gc); EINA_LIST_FOREACH(e_config->gadcons, l, cf_gc) { - if ((!strcmp(cf_gc->name, gc->name)) && (cf_gc->id == gc->id)) - { - gc->cf = cf_gc; - break; - } + if ((!strcmp(cf_gc->name, gc->name)) && (cf_gc->id == gc->id)) + { + gc->cf = cf_gc; + break; + } } if (!gc->cf) { - gc->cf = E_NEW(E_Config_Gadcon, 1); - gc->cf->name = eina_stringshare_add(gc->name); - gc->cf->id = gc->id; + gc->cf = E_NEW(E_Config_Gadcon, 1); + gc->cf->name = eina_stringshare_add(gc->name); + gc->cf->id = gc->id; if (gc->zone) gc->cf->zone = gc->zone->num; - e_config->gadcons = eina_list_append(e_config->gadcons, gc->cf); - e_config_save_queue(); + e_config->gadcons = eina_list_append(e_config->gadcons, gc->cf); + e_config_save_queue(); } return gc; } @@ -351,14 +351,14 @@ e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h) E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); if (gc->edje.o_parent) { - edje_extern_object_min_size_set(gc->o_container, w, h); - edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, - gc->o_container); + edje_extern_object_min_size_set(gc->o_container, w, h); + edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, + gc->o_container); } } EAPI void -e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data) +e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -367,7 +367,7 @@ e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E } EAPI void -e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data) +e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -376,7 +376,7 @@ e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gad } EAPI void -e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), void *data) +e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func)(void *data, E_Gadcon_Client * gcc, const char *style), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -385,7 +385,7 @@ e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void *da } EAPI void -e_gadcon_populate_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc), void *data) +e_gadcon_populate_callback_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon *gc, const E_Gadcon_Client_Class *cc), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -414,54 +414,54 @@ e_gadcon_populate(E_Gadcon *gc) e_gadcon_layout_freeze(gc->o_container); EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc) { - E_Gadcon_Client_Class *cc; + E_Gadcon_Client_Class *cc; - if (!cf_gcc->name) continue; - cc = eina_hash_find(providers, cf_gcc->name); - if (cc) - { - E_Gadcon_Client *gcc; + if (!cf_gcc->name) continue; + cc = eina_hash_find(providers, cf_gcc->name); + if (cc) + { + E_Gadcon_Client *gcc; - if (eina_list_data_find(populate_requests, cc)) - continue; + if (eina_list_data_find(populate_requests, cc)) + continue; - if ((!cf_gcc->id) && - (_e_gadcon_client_class_feature_check(cc, "id_new", cc->func.id_new))) - cf_gcc->id = eina_stringshare_add(cc->func.id_new(cc)); + if ((!cf_gcc->id) && + (_e_gadcon_client_class_feature_check(cc, "id_new", cc->func.id_new))) + cf_gcc->id = eina_stringshare_add(cc->func.id_new(cc)); - if (!cf_gcc->style) + if (!cf_gcc->style) gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, cc->default_style); - else - gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, + else + gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, cf_gcc->style); - if (gcc) - { - gcc->cf = cf_gcc; - gcc->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); - else if (gcc->o_base) - e_gadcon_layout_pack_options_set(gcc->o_base, gcc); + if (gcc) + { + gcc->cf = cf_gcc; + gcc->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); + else if (gcc->o_base) + e_gadcon_layout_pack_options_set(gcc->o_base, gcc); if (!gcc->autoscroll_set) 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, gc->orient); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc, gc->orient); - _e_gadcon_client_save(gcc); - if (gc->editing) e_gadcon_client_edit_begin(gcc); - if (gc->instant_edit) - e_gadcon_client_util_menu_attach(gcc); - } - } + _e_gadcon_client_save(gcc); + if (gc->editing) e_gadcon_client_edit_begin(gcc); + if (gc->instant_edit) + e_gadcon_client_util_menu_attach(gcc); + } + } } e_gadcon_layout_thaw(gc->o_container); } @@ -476,14 +476,14 @@ e_gadcon_unpopulate(E_Gadcon *gc) /* Be careful, e_object_del does remove gcc from gc->clients */ while (gc->clients) { - gcc = eina_list_data_get(gc->clients); - if (gcc->menu) - { - e_menu_post_deactivate_callback_set(gcc->menu, NULL, NULL); - e_object_del(E_OBJECT(gcc->menu)); - gcc->menu = NULL; - } - e_object_del(E_OBJECT(gcc)); + gcc = eina_list_data_get(gc->clients); + if (gcc->menu) + { + e_menu_post_deactivate_callback_set(gcc->menu, NULL, NULL); + e_object_del(E_OBJECT(gcc->menu)); + gcc->menu = NULL; + } + e_object_del(E_OBJECT(gcc)); } } @@ -498,44 +498,44 @@ e_gadcon_populate_class(E_Gadcon *gc, const E_Gadcon_Client_Class *cc) e_gadcon_layout_freeze(gc->o_container); EINA_LIST_FOREACH(gc->cf->clients, l, cf_gcc) { - if ((cf_gcc->name) && (cc->name) && - (!strcmp(cf_gcc->name, cc->name)) && - (cf_gcc->id) && (cf_gcc->style)) - { - E_Gadcon_Client *gcc; + if ((cf_gcc->name) && (cc->name) && + (!strcmp(cf_gcc->name, cc->name)) && + (cf_gcc->id) && (cf_gcc->style)) + { + E_Gadcon_Client *gcc; - if ((!cf_gcc->id) && - (_e_gadcon_client_class_feature_check((E_Gadcon_Client_Class *)cc, "id_new", cc->func.id_new))) - cf_gcc->id = eina_stringshare_add(cc->func.id_new((E_Gadcon_Client_Class *)cc)); + if ((!cf_gcc->id) && + (_e_gadcon_client_class_feature_check((E_Gadcon_Client_Class *)cc, "id_new", cc->func.id_new))) + cf_gcc->id = eina_stringshare_add(cc->func.id_new((E_Gadcon_Client_Class *)cc)); - gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, - cf_gcc->style); - if (gcc) - { - gcc->cf = cf_gcc; - gcc->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); - else if (gcc->o_base) - e_gadcon_layout_pack_options_set(gcc->o_base, gcc); + gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id, + cf_gcc->style); + if (gcc) + { + gcc->cf = cf_gcc; + gcc->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); + else if (gcc->o_base) + e_gadcon_layout_pack_options_set(gcc->o_base, gcc); if (!gcc->autoscroll_set) 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, gc->orient); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc, gc->orient); - _e_gadcon_client_save(gcc); - if (gc->editing) e_gadcon_client_edit_begin(gcc); - if (gc->instant_edit) - e_gadcon_client_util_menu_attach(gcc); - } - } + _e_gadcon_client_save(gcc); + if (gc->editing) e_gadcon_client_edit_begin(gcc); + if (gc->instant_edit) + e_gadcon_client_util_menu_attach(gcc); + } + } } e_gadcon_layout_thaw(gc->o_container); } @@ -562,8 +562,9 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient) case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BR: - horiz = 1; - break; + horiz = 1; + break; + case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_RIGHT: @@ -571,17 +572,18 @@ e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient) case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_RB: - horiz = 0; - break; + horiz = 0; + break; + default: - break; + break; } e_gadcon_layout_orientation_set(gc->o_container, horiz); EINA_LIST_FOREACH(gc->clients, l, gcc) { - e_box_orientation_set(gcc->o_box, horiz); - if (gcc->client_class->func.orient) - gcc->client_class->func.orient(gcc, gc->orient); + e_box_orientation_set(gcc->o_box, horiz); + if (gcc->client_class->func.orient) + gcc->client_class->func.orient(gcc, gc->orient); } e_gadcon_layout_thaw(gc->o_container); } @@ -680,7 +682,7 @@ e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, int *y, int *w, int *h) } EAPI void -e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon_Client *gcc, E_Menu *menu), void *data) +e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func)(void *data, E_Gadcon_Client *gcc, E_Menu *menu), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -689,7 +691,7 @@ e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Gad } EAPI void -e_gadcon_util_lock_func_set(E_Gadcon *gc, void (*func) (void *data, int lock), void *data) +e_gadcon_util_lock_func_set(E_Gadcon *gc, void (*func)(void *data, int lock), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -698,7 +700,7 @@ e_gadcon_util_lock_func_set(E_Gadcon *gc, void (*func) (void *data, int lock), v } EAPI void -e_gadcon_util_urgent_show_func_set(E_Gadcon *gc, void (*func) (void *data), void *data) +e_gadcon_util_urgent_show_func_set(E_Gadcon *gc, void (*func)(void *data), void *data) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -713,7 +715,7 @@ e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win) E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); gc->dnd_win = win; } - + EAPI Ecore_X_Window e_gadcon_dnd_window_get(E_Gadcon *gc) { @@ -729,7 +731,7 @@ e_gadcon_xdnd_window_set(E_Gadcon *gc, Ecore_X_Window win) E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); gc->xdnd_win = win; } - + EAPI Ecore_X_Window e_gadcon_xdnd_window_get(E_Gadcon *gc) { @@ -745,7 +747,7 @@ e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf) E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); gc->shelf = shelf; } - + EAPI E_Shelf * e_gadcon_shelf_get(E_Gadcon *gc) { @@ -754,8 +756,8 @@ e_gadcon_shelf_get(E_Gadcon *gc) return gc->shelf; } -EAPI void -e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar) +EAPI void +e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar) { E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); @@ -763,7 +765,7 @@ e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar) } EAPI E_Toolbar * -e_gadcon_toolbar_get(E_Gadcon *gc) +e_gadcon_toolbar_get(E_Gadcon *gc) { E_OBJECT_CHECK_RETURN(gc, NULL); E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL); @@ -781,7 +783,7 @@ e_gadcon_client_config_new(E_Gadcon *gc, const char *name) if (!name) return NULL; cc = eina_hash_find(providers, name); if (!cc) return NULL; - if (!_e_gadcon_client_class_feature_check(cc, "id_new", cc->func.id_new)) + if (!_e_gadcon_client_class_feature_check(cc, "id_new", cc->func.id_new)) return NULL; cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); @@ -825,7 +827,7 @@ e_gadcon_client_new(E_Gadcon *gc, const char *name, const char *id __UNUSED__, c E_OBJECT_CHECK_RETURN(gc, NULL); E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL); - gcc = E_OBJECT_ALLOC(E_Gadcon_Client, E_GADCON_CLIENT_TYPE, + gcc = E_OBJECT_ALLOC(E_Gadcon_Client, E_GADCON_CLIENT_TYPE, _e_gadcon_client_free); if (!gcc) return NULL; gcc->name = eina_stringshare_add(name); @@ -837,60 +839,62 @@ e_gadcon_client_new(E_Gadcon *gc, const char *name, const char *id __UNUSED__, c /* This must only be unique during runtime */ if (gcc->o_base) evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_DEL, - _e_gadcon_client_del_hook, gcc); + _e_gadcon_client_del_hook, gcc); if ((gc->frame_request.func) && (style)) { - gcc->o_frame = gc->frame_request.func(gc->frame_request.data, gcc, style); - gcc->style = eina_stringshare_add(style); - if (gcc->o_frame) - { - edje_object_size_min_calc(gcc->o_frame, &(gcc->pad.w), &(gcc->pad.h)); - gcc->o_box = e_box_add(gcc->gadcon->evas); - switch (gcc->gadcon->orient) - { - case E_GADCON_ORIENT_FLOAT: - case E_GADCON_ORIENT_HORIZ: - case E_GADCON_ORIENT_TOP: - case E_GADCON_ORIENT_BOTTOM: - case E_GADCON_ORIENT_CORNER_TL: - case E_GADCON_ORIENT_CORNER_TR: - case E_GADCON_ORIENT_CORNER_BL: - case E_GADCON_ORIENT_CORNER_BR: - e_box_orientation_set(gcc->o_box, 1); - break; - case E_GADCON_ORIENT_VERT: - case E_GADCON_ORIENT_LEFT: - case E_GADCON_ORIENT_RIGHT: - case E_GADCON_ORIENT_CORNER_LT: - case E_GADCON_ORIENT_CORNER_RT: - case E_GADCON_ORIENT_CORNER_LB: - case E_GADCON_ORIENT_CORNER_RB: - e_box_orientation_set(gcc->o_box, 0); - break; - default: - break; - } - evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_MOVE, - _e_gadcon_cb_client_frame_moveresize, gcc); - evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_RESIZE, - _e_gadcon_cb_client_frame_moveresize, gcc); - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE, - _e_gadcon_cb_client_frame_mouse_move, gcc); - if (gcc->o_base) - { - e_box_pack_end(gcc->o_box, gcc->o_base); - e_box_pack_options_set(gcc->o_base, - 1, 1, /* fill */ - 1, 1, /* expand */ - 0.5, 0.5, /* align */ - 0, 0, /* min */ - -1, -1 /* max */ - ); - } - edje_object_part_swallow(gcc->o_frame, gc->edje.swallow_name, gcc->o_box); - evas_object_show(gcc->o_box); - evas_object_show(gcc->o_frame); - } + gcc->o_frame = gc->frame_request.func(gc->frame_request.data, gcc, style); + gcc->style = eina_stringshare_add(style); + if (gcc->o_frame) + { + edje_object_size_min_calc(gcc->o_frame, &(gcc->pad.w), &(gcc->pad.h)); + gcc->o_box = e_box_add(gcc->gadcon->evas); + switch (gcc->gadcon->orient) + { + case E_GADCON_ORIENT_FLOAT: + case E_GADCON_ORIENT_HORIZ: + case E_GADCON_ORIENT_TOP: + case E_GADCON_ORIENT_BOTTOM: + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_TR: + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_BR: + e_box_orientation_set(gcc->o_box, 1); + break; + + case E_GADCON_ORIENT_VERT: + case E_GADCON_ORIENT_LEFT: + case E_GADCON_ORIENT_RIGHT: + case E_GADCON_ORIENT_CORNER_LT: + case E_GADCON_ORIENT_CORNER_RT: + case E_GADCON_ORIENT_CORNER_LB: + case E_GADCON_ORIENT_CORNER_RB: + e_box_orientation_set(gcc->o_box, 0); + break; + + default: + break; + } + evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_MOVE, + _e_gadcon_cb_client_frame_moveresize, gcc); + evas_object_event_callback_add(gcc->o_box, EVAS_CALLBACK_RESIZE, + _e_gadcon_cb_client_frame_moveresize, gcc); + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE, + _e_gadcon_cb_client_frame_mouse_move, gcc); + if (gcc->o_base) + { + e_box_pack_end(gcc->o_box, gcc->o_base); + e_box_pack_options_set(gcc->o_base, + 1, 1, /* fill */ + 1, 1, /* expand */ + 0.5, 0.5, /* align */ + 0, 0, /* min */ + -1, -1 /* max */ + ); + } + edje_object_part_swallow(gcc->o_frame, gc->edje.swallow_name, gcc->o_box); + evas_object_show(gcc->o_box); + evas_object_show(gcc->o_frame); + } } if (gcc->o_frame) e_gadcon_layout_pack(gc->o_container, gcc->o_frame); @@ -913,7 +917,7 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc) evas_object_geometry_get(gcc->o_frame, &x, &y, &w, &h); else if (gcc->o_base) evas_object_geometry_get(gcc->o_base, &x, &y, &w, &h); - else return; /* make clang happy */ + else return; /* make clang happy */ gcc->o_control = edje_object_add(gcc->gadcon->evas); evas_object_layer_set(gcc->o_control, 100); @@ -922,20 +926,20 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc) evas_object_move(gcc->o_control, x, y); evas_object_resize(gcc->o_control, w, h); - e_theme_edje_object_set(gcc->o_control, "base/theme/gadman", + e_theme_edje_object_set(gcc->o_control, "base/theme/gadman", "e/gadman/control"); - if ((gcc->autoscroll)/* || (gcc->resizable)*/) + if ((gcc->autoscroll) /* || (gcc->resizable)*/) { - if (e_box_orientation_get(gcc->o_box)) - edje_object_signal_emit(gcc->o_control, "e,state,hsize,on", "e"); - else - edje_object_signal_emit(gcc->o_control, "e,state,vsize,on", "e"); + if (e_box_orientation_get(gcc->o_box)) + edje_object_signal_emit(gcc->o_control, "e,state,hsize,on", "e"); + else + edje_object_signal_emit(gcc->o_control, "e,state,vsize,on", "e"); } else { - edje_object_signal_emit(gcc->o_control, "e,state,hsize,off", "e"); - edje_object_signal_emit(gcc->o_control, "e,state,vsize,off", "e"); + edje_object_signal_emit(gcc->o_control, "e,state,hsize,off", "e"); + edje_object_signal_emit(gcc->o_control, "e,state,vsize,off", "e"); } edje_object_signal_emit(gcc->o_control, "e,state,move,on", "e"); @@ -947,55 +951,55 @@ e_gadcon_client_edit_begin(E_Gadcon_Client *gcc) evas_object_resize(gcc->o_event, w, h); edje_object_signal_callback_add(gcc->o_control, "e,action,move,start", "", - _e_gadcon_cb_signal_move_start, gcc); + _e_gadcon_cb_signal_move_start, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,move,stop", "", - _e_gadcon_cb_signal_move_stop, gcc); + _e_gadcon_cb_signal_move_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,move,go", "", - _e_gadcon_cb_signal_move_go, gcc); + _e_gadcon_cb_signal_move_go, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,left,start", "", - _e_gadcon_cb_signal_resize_left_start, gcc); + _e_gadcon_cb_signal_resize_left_start, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,left,stop", "", - _e_gadcon_cb_signal_resize_left_stop, gcc); + _e_gadcon_cb_signal_resize_left_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,left,go", "", - _e_gadcon_cb_signal_resize_left_go, gcc); + _e_gadcon_cb_signal_resize_left_go, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,right,start", "", - _e_gadcon_cb_signal_resize_right_start, gcc); + _e_gadcon_cb_signal_resize_right_start, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,right,stop", "", - _e_gadcon_cb_signal_resize_right_stop, gcc); + _e_gadcon_cb_signal_resize_right_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,right,go", "", - _e_gadcon_cb_signal_resize_right_go, gcc); + _e_gadcon_cb_signal_resize_right_go, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,up,start", "", - _e_gadcon_cb_signal_resize_left_start, gcc); + _e_gadcon_cb_signal_resize_left_start, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,up,stop", "", - _e_gadcon_cb_signal_resize_left_stop, gcc); + _e_gadcon_cb_signal_resize_left_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,up,go", "", - _e_gadcon_cb_signal_resize_left_go, gcc); + _e_gadcon_cb_signal_resize_left_go, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,down,start", "", - _e_gadcon_cb_signal_resize_right_start, gcc); + _e_gadcon_cb_signal_resize_right_start, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,down,stop", "", - _e_gadcon_cb_signal_resize_right_stop, gcc); + _e_gadcon_cb_signal_resize_right_stop, gcc); edje_object_signal_callback_add(gcc->o_control, "e,action,resize,down,go", "", - _e_gadcon_cb_signal_resize_right_go, gcc); + _e_gadcon_cb_signal_resize_right_go, gcc); - evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_DOWN, + evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_cb_client_mouse_down, gcc); - evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_IN, + evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_IN, _e_gadcon_cb_client_mouse_in, gcc); - evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_OUT, + evas_object_event_callback_add(gcc->o_event, EVAS_CALLBACK_MOUSE_OUT, _e_gadcon_cb_client_mouse_out, gcc); if (gcc->o_frame) { - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOVE, + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOVE, _e_gadcon_cb_client_move, gcc); - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_RESIZE, + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_RESIZE, _e_gadcon_cb_client_resize, gcc); } else if (gcc->o_base) { - evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOVE, + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOVE, _e_gadcon_cb_client_move, gcc); - evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_RESIZE, + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_RESIZE, _e_gadcon_cb_client_resize, gcc); } @@ -1014,23 +1018,23 @@ e_gadcon_client_edit_end(E_Gadcon_Client *gcc) if (gcc->o_frame) { - evas_object_event_callback_del(gcc->o_frame, EVAS_CALLBACK_MOVE, + evas_object_event_callback_del(gcc->o_frame, EVAS_CALLBACK_MOVE, _e_gadcon_cb_client_move); - evas_object_event_callback_del(gcc->o_frame, EVAS_CALLBACK_RESIZE, + evas_object_event_callback_del(gcc->o_frame, EVAS_CALLBACK_RESIZE, _e_gadcon_cb_client_resize); } else if (gcc->o_base) { - evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_MOVE, + evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_MOVE, _e_gadcon_cb_client_move); - evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_RESIZE, + evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_RESIZE, _e_gadcon_cb_client_resize); } if (gcc->moving) { - gcc->moving = 0; - _e_gadcon_client_save(gcc); + gcc->moving = 0; + _e_gadcon_client_save(gcc); } if (gcc->o_event) evas_object_del(gcc->o_event); gcc->o_event = NULL; @@ -1039,8 +1043,8 @@ e_gadcon_client_edit_end(E_Gadcon_Client *gcc) EINA_LIST_FOREACH(gcc->gadcon->clients, l, client) { - if (!client) continue; - if (client->o_control) return; + if (!client) continue; + if (client->o_control) return; } gcc->gadcon->editing = 0; e_gadcon_locked_set(gcc->gadcon, 0); @@ -1060,13 +1064,13 @@ e_gadcon_client_show(E_Gadcon_Client *gcc) if (gcc->o_event) evas_object_show(gcc->o_event); if (gcc->o_frame) { - e_gadcon_layout_pack(gcc->gadcon->o_container, gcc->o_frame); - e_gadcon_layout_pack_options_set(gcc->o_frame, gcc); + e_gadcon_layout_pack(gcc->gadcon->o_container, gcc->o_frame); + e_gadcon_layout_pack_options_set(gcc->o_frame, gcc); } else if (gcc->o_base) { - e_gadcon_layout_pack(gcc->gadcon->o_container, gcc->o_base); - e_gadcon_layout_pack_options_set(gcc->o_base, gcc); + e_gadcon_layout_pack(gcc->gadcon->o_container, gcc->o_base); + e_gadcon_layout_pack_options_set(gcc->o_base, gcc); } gcc->hidden = 0; } @@ -1100,19 +1104,21 @@ e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h) case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_BOTTOM: - if (gcc->o_frame) - e_gadcon_layout_pack_size_set(gcc->o_frame, w + gcc->pad.w); - else if (gcc->o_base) - e_gadcon_layout_pack_size_set(gcc->o_base, w); - break; + if (gcc->o_frame) + e_gadcon_layout_pack_size_set(gcc->o_frame, w + gcc->pad.w); + else if (gcc->o_base) + e_gadcon_layout_pack_size_set(gcc->o_base, w); + break; + case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_RIGHT: - if (gcc->o_frame) - e_gadcon_layout_pack_size_set(gcc->o_frame, h + gcc->pad.h); - else if (gcc->o_base) - e_gadcon_layout_pack_size_set(gcc->o_base, h); - break; + if (gcc->o_frame) + e_gadcon_layout_pack_size_set(gcc->o_frame, h + gcc->pad.h); + else if (gcc->o_base) + e_gadcon_layout_pack_size_set(gcc->o_base, h); + break; + case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TR: @@ -1123,7 +1129,7 @@ e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h) case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_RB: default: - break; + break; } } @@ -1135,13 +1141,13 @@ e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h) gcc->min.w = w; gcc->min.h = h; /* if (!gcc->resizable)*/ - { - if (gcc->o_frame) - e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, - h + gcc->pad.h); - else if (gcc->o_base) - e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); - } + { + if (gcc->o_frame) + e_gadcon_layout_pack_min_size_set(gcc->o_frame, w + gcc->pad.w, + h + gcc->pad.h); + else if (gcc->o_base) + e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h); + } _e_gadcon_moveresize_handle(gcc); } @@ -1153,16 +1159,16 @@ e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h) gcc->aspect.w = w; gcc->aspect.h = h; // if ((!gcc->autoscroll)/* && (!gcc->resizable)*/) - { - if (gcc->o_frame) - { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, - gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h); - } - else if (gcc->o_base) - e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); - } + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, + gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h); + } + else if (gcc->o_base) + e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h); + } _e_gadcon_moveresize_handle(gcc); } @@ -1174,44 +1180,44 @@ e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll) gcc->autoscroll = autoscroll; gcc->autoscroll_set = 1; -/* +/* if (gcc->autoscroll) { - if (gcc->o_frame) - { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0); - e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); - } - else if (gcc->o_base) - { - e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); - e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); - } + e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); + } + else if (gcc->o_base) + { + e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); + } } else */ - { - if (gcc->o_frame) - { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, - gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, - gcc->aspect.h); - e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, - gcc->min.h); - } - else if (gcc->o_base) - { - e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, - gcc->min.h); - e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, - gcc->aspect.h); - } - } + { + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, + gcc->pad.h); + e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, + gcc->aspect.h); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, + gcc->min.h); + } + else if (gcc->o_base) + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, + gcc->min.h); + e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, + gcc->aspect.h); + } + } } - + EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable) { @@ -1221,37 +1227,37 @@ e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable) gcc->resizable = resizable; if (gcc->resizable) { - if (gcc->o_frame) - { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, 0, 0); - e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); - } - else if (gcc->o_base) - { - 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_aspect_set(gcc->o_frame, 0, 0); + e_gadcon_layout_pack_min_size_set(gcc->o_frame, 0, 0); + } + else if (gcc->o_base) + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, 0, 0); + e_gadcon_layout_pack_aspect_set(gcc->o_base, 0, 0); + } } else { - if (gcc->o_frame) - { - e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, + if (gcc->o_frame) + { + e_gadcon_layout_pack_aspect_pad_set(gcc->o_frame, gcc->pad.w, gcc->pad.h); - e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, + e_gadcon_layout_pack_aspect_set(gcc->o_frame, gcc->aspect.w, gcc->aspect.h); - e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, + e_gadcon_layout_pack_min_size_set(gcc->o_frame, gcc->min.w, gcc->min.h); - } - else if (gcc->o_base) - { - e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, + } + else if (gcc->o_base) + { + e_gadcon_layout_pack_min_size_set(gcc->o_base, gcc->min.w, gcc->min.h); - e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, + e_gadcon_layout_pack_aspect_set(gcc->o_base, gcc->aspect.w, gcc->aspect.h); - } + } } */ resizable = 0; @@ -1265,7 +1271,7 @@ e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int * E_OBJECT_CHECK(gcc); E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); - if (!e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gx, &gy, NULL, NULL)) + if (!e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gx, &gy, NULL, NULL)) return 0; if (gcc->o_base) evas_object_geometry_get(gcc->o_base, x, y, w, h); if (x) *x += gx; @@ -1280,7 +1286,8 @@ e_gadcon_client_viewport_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); if (gcc->o_box) evas_object_geometry_get(gcc->o_base, x, y, w, h); - else if (gcc->o_base) evas_object_geometry_get(gcc->o_base, x, y, w, h); + else if (gcc->o_base) + evas_object_geometry_get(gcc->o_base, x, y, w, h); else { if (x) *x = 0; @@ -1303,7 +1310,7 @@ static void _e_gadcon_client_change_gadcon(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) { E_Gadcon_Location *src, *dst; - E_Gadcon_Client * gcc; + E_Gadcon_Client *gcc; gcc = data; src = gcc->gadcon->location; @@ -1312,17 +1319,17 @@ _e_gadcon_client_change_gadcon(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi } static void -_e_gadcon_add_locations_menu_for_site(E_Menu *m, E_Gadcon_Client *gcc, E_Gadcon_Site site, int * count) +_e_gadcon_add_locations_menu_for_site(E_Menu *m, E_Gadcon_Client *gcc, E_Gadcon_Site site, int *count) { E_Menu_Item *mi; const Eina_List *l; - E_Gadcon_Location * loc; + E_Gadcon_Location *loc; int k = *count; EINA_LIST_FOREACH(gadcon_locations, l, loc) { - if (loc->site == site) - { + if (loc->site == site) + { if (k) { k = 0; @@ -1335,15 +1342,15 @@ _e_gadcon_add_locations_menu_for_site(E_Menu *m, E_Gadcon_Client *gcc, E_Gadcon_ e_object_data_set(E_OBJECT(mi), loc); e_menu_item_callback_set(mi, _e_gadcon_client_change_gadcon, gcc); if (loc == gcc->gadcon->location) e_menu_item_disabled_set(mi, 1); - if (loc->icon_name) + if (loc->icon_name) e_util_menu_item_theme_icon_set(mi, loc->icon_name); (*count)++; - } + } } } -static void -_e_gadcon_gadget_move_to_pre_cb(void *data, E_Menu *m) +static void +_e_gadcon_gadget_move_to_pre_cb(void *data, E_Menu *m) { E_Gadcon_Client *gcc; int n = 0; @@ -1373,12 +1380,12 @@ e_gadcon_client_add_location_menu(E_Gadcon_Client *gcc, E_Menu *menu) if (gcc->gadcon->location) { - mn = e_menu_new(); - mi = e_menu_item_new(menu); - e_menu_item_label_set(mi, _("Move to")); - e_util_menu_item_theme_icon_set(mi, "preferences-look"); - e_menu_item_submenu_set(mi, mn); - e_menu_pre_activate_callback_set(mn, _e_gadcon_gadget_move_to_pre_cb, gcc); + mn = e_menu_new(); + mi = e_menu_item_new(menu); + e_menu_item_label_set(mi, _("Move to")); + e_util_menu_item_theme_icon_set(mi, "preferences-look"); + e_menu_item_submenu_set(mi, mn); + e_menu_pre_activate_callback_set(mn, _e_gadcon_gadget_move_to_pre_cb, gcc); } } @@ -1396,7 +1403,7 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_gadget menu_main = menu_gadget; else menu_main = e_menu_new(); - + if ((gcc->gadcon->shelf) || (gcc->gadcon->toolbar)) { if (e_menu_item_nth(menu_gadget, 0)) @@ -1404,29 +1411,29 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_gadget mi = e_menu_item_new(menu_gadget); e_menu_item_separator_set(mi, 1); } - if (!gcc->o_control) - { + if (!gcc->o_control) + { mi = e_menu_item_new(menu_gadget); e_menu_item_label_set(mi, _("Move")); e_util_menu_item_theme_icon_set(mi, "transform-scale"); e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_edit, gcc); - } + } /* - mi = e_menu_item_new(menu_gadget); - e_menu_item_label_set(mi, _("Resizeable")); - e_util_menu_item_theme_icon_set(mi, "transform-scale"); - e_menu_item_check_set(mi, 1); - if (gcc->resizable) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_resizable, gcc); + mi = e_menu_item_new(menu_gadget); + e_menu_item_label_set(mi, _("Resizeable")); + e_util_menu_item_theme_icon_set(mi, "transform-scale"); + e_menu_item_check_set(mi, 1); + if (gcc->resizable) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_resizable, gcc); */ - mi = e_menu_item_new(menu_gadget); - e_menu_item_label_set(mi, _("Automatically scroll contents")); - e_util_menu_item_theme_icon_set(mi, "transform-move"); - e_menu_item_check_set(mi, 1); - if (gcc->autoscroll) e_menu_item_toggle_set(mi, 1); - e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_autoscroll, gcc); + mi = e_menu_item_new(menu_gadget); + e_menu_item_label_set(mi, _("Automatically scroll contents")); + e_util_menu_item_theme_icon_set(mi, "transform-move"); + e_menu_item_check_set(mi, 1); + if (gcc->autoscroll) e_menu_item_toggle_set(mi, 1); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_autoscroll, gcc); - if (gcc->gadcon->shelf) + if (gcc->gadcon->shelf) { mo = e_menu_new(); @@ -1454,49 +1461,49 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_gadget e_menu_item_submenu_set(mi, mo); } - mi = e_menu_item_new(menu_gadget); - e_menu_item_separator_set(mi, 1); + mi = e_menu_item_new(menu_gadget); + e_menu_item_separator_set(mi, 1); - e_gadcon_client_add_location_menu(gcc, menu_gadget); + e_gadcon_client_add_location_menu(gcc, menu_gadget); - mi = e_menu_item_new(menu_gadget); - e_menu_item_label_set(mi, _("Remove")); - e_util_menu_item_theme_icon_set(mi, "list-remove"); - e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_remove, gcc); + mi = e_menu_item_new(menu_gadget); + e_menu_item_label_set(mi, _("Remove")); + e_util_menu_item_theme_icon_set(mi, "list-remove"); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_remove, gcc); } if (!e_config->menu_gadcon_client_toplevel) { - mi = e_menu_item_new(menu_main); - if (gcc->client_class->func.label) - snprintf(buf, sizeof(buf), "%s", - gcc->client_class->func.label((E_Gadcon_Client_Class *)gcc->client_class)); - else - snprintf(buf, sizeof(buf), "%s", gcc->name); + mi = e_menu_item_new(menu_main); + if (gcc->client_class->func.label) + snprintf(buf, sizeof(buf), "%s", + gcc->client_class->func.label((E_Gadcon_Client_Class *)gcc->client_class)); + else + snprintf(buf, sizeof(buf), "%s", gcc->name); - e_menu_item_label_set(mi, _(buf)); - e_menu_item_realize_callback_set(mi, _e_gadcon_client_cb_menu_pre, gcc); - e_menu_item_submenu_set(mi, menu_gadget); + e_menu_item_label_set(mi, _(buf)); + e_menu_item_realize_callback_set(mi, _e_gadcon_client_cb_menu_pre, gcc); + e_menu_item_submenu_set(mi, menu_gadget); } - + if (gcc->gadcon->menu_attach.func) { if ((gcc->gadcon->shelf) || (gcc->gadcon->toolbar)) - { - if (e_config->menu_gadcon_client_toplevel) - { - mi = e_menu_item_new(menu_main); - e_menu_item_separator_set(mi, 1); - } - gcc->gadcon->menu_attach.func(gcc->gadcon->menu_attach.data, gcc, menu_main); - } + { + if (e_config->menu_gadcon_client_toplevel) + { + mi = e_menu_item_new(menu_main); + e_menu_item_separator_set(mi, 1); + } + gcc->gadcon->menu_attach.func(gcc->gadcon->menu_attach.data, gcc, menu_main); + } else gcc->gadcon->menu_attach.func(gcc->gadcon->menu_attach.data, gcc, menu_gadget); } - + return menu_main; } - + EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc) { @@ -1504,20 +1511,20 @@ e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc) E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); if (gcc->o_frame) { - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_DOWN, + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc); - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_UP, + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_UP, _e_gadcon_client_cb_mouse_up, gcc); - evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE, + evas_object_event_callback_add(gcc->o_frame, EVAS_CALLBACK_MOUSE_MOVE, _e_gadcon_client_cb_mouse_move, gcc); } else if (gcc->o_base) { - evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_DOWN, + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_DOWN, _e_gadcon_client_cb_mouse_down, gcc); - evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_UP, + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_UP, _e_gadcon_client_cb_mouse_up, gcc); - evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_MOVE, + evas_object_event_callback_add(gcc->o_base, EVAS_CALLBACK_MOUSE_MOVE, _e_gadcon_client_cb_mouse_move, gcc); } } @@ -1551,30 +1558,31 @@ e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, Evas_Coord x, Evas_Coord if (gcc->autoscroll) { - Evas_Coord w, h; - double d; + Evas_Coord w, h; + double d; /* TODO: When using gadman there is no o_box! */ - evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h); + evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h); if (e_box_orientation_get(gcc->o_box)) - { - if (w > 1) d = (double)x / (double)(w - 1); - else d = 0; - } - else - { - if (h > 1) d = (double)y / (double)(h - 1); - else d = 0; - } - if (d < 0.0) d = 0.0; - else if (d > 1.0) d = 1.0; - if (!gcc->scroll_timer) - gcc->scroll_timer = - ecore_timer_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc); - if (!gcc->scroll_animator) - gcc->scroll_animator = - ecore_animator_add(_e_gadcon_cb_client_scroll_animator, gcc); - gcc->scroll_wanted = d; + { + if (w > 1) d = (double)x / (double)(w - 1); + else d = 0; + } + else + { + if (h > 1) d = (double)y / (double)(h - 1); + else d = 0; + } + if (d < 0.0) d = 0.0; + else if (d > 1.0) + d = 1.0; + if (!gcc->scroll_timer) + gcc->scroll_timer = + ecore_timer_add(0.01, _e_gadcon_cb_client_scroll_timer, gcc); + if (!gcc->scroll_animator) + gcc->scroll_animator = + ecore_animator_add(_e_gadcon_cb_client_scroll_animator, gcc); + gcc->scroll_wanted = d; } } @@ -1590,19 +1598,19 @@ e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, void (*func)(void *data) EAPI Eina_Bool e_gadcon_site_is_shelf(E_Gadcon_Site site) { - return (site == E_GADCON_SITE_SHELF); + return site == E_GADCON_SITE_SHELF; } EAPI Eina_Bool e_gadcon_site_is_desktop(E_Gadcon_Site site) { - return (site == E_GADCON_SITE_DESKTOP); + return site == E_GADCON_SITE_DESKTOP; } EAPI Eina_Bool e_gadcon_site_is_efm_toolbar(E_Gadcon_Site site) { - return (site == E_GADCON_SITE_EFM_TOOLBAR); + return site == E_GADCON_SITE_EFM_TOOLBAR; } EAPI Eina_Bool @@ -1610,12 +1618,13 @@ e_gadcon_site_is_any_toolbar(E_Gadcon_Site site) { switch (site) { - // there should be all toolbar sities identifiers + // there should be all toolbar sities identifiers case E_GADCON_SITE_TOOLBAR: case E_GADCON_SITE_EFM_TOOLBAR: return EINA_TRUE; + default: - return EINA_FALSE; + return EINA_FALSE; } return EINA_FALSE; } @@ -1625,12 +1634,13 @@ e_gadcon_site_is_not_toolbar(E_Gadcon_Site site) { switch (site) { - // there should be all toolbar sities identifiers + // there should be all toolbar sities identifiers case E_GADCON_SITE_TOOLBAR: case E_GADCON_SITE_EFM_TOOLBAR: return EINA_FALSE; + default: - return EINA_TRUE; + return EINA_TRUE; } return EINA_TRUE; } @@ -1654,17 +1664,17 @@ _e_gadcon_client_free(E_Gadcon_Client *gcc) { if (gcc->instant_edit_timer) { - ecore_timer_del(gcc->instant_edit_timer); - gcc->instant_edit_timer = NULL; + ecore_timer_del(gcc->instant_edit_timer); + gcc->instant_edit_timer = NULL; } if (gcc->o_base) evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_DEL, - _e_gadcon_client_del_hook); + _e_gadcon_client_del_hook); if (gcc->menu) { e_menu_post_deactivate_callback_set(gcc->menu, NULL, NULL); - e_object_del(E_OBJECT(gcc->menu)); - gcc->menu = NULL; + e_object_del(E_OBJECT(gcc->menu)); + gcc->menu = NULL; } e_gadcon_client_edit_end(gcc); gcc->client_class->func.shutdown(gcc); @@ -1687,25 +1697,25 @@ _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc) Evas_Coord w, h; evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h); -/* +/* if (gcc->resizable) { - if (e_box_orientation_get(gcc->o_box)) - { - if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) - w = (h * gcc->aspect.w) / gcc->aspect.h; - } - else - { - if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) - h = (w * gcc->aspect.h) / gcc->aspect.w; - } + if (e_box_orientation_get(gcc->o_box)) + { + if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) + w = (h * gcc->aspect.w) / gcc->aspect.h; + } + else + { + if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) + h = (w * gcc->aspect.h) / gcc->aspect.w; + } } */ if (gcc->autoscroll) { - if (e_box_orientation_get(gcc->o_box)) - { + if (e_box_orientation_get(gcc->o_box)) + { if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) { w = (h * gcc->aspect.w) / gcc->aspect.h; // ZZZZ @@ -1715,9 +1725,9 @@ _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc) { w = gcc->min.w; } - } - else - { + } + else + { if ((gcc->aspect.w > 0) && (gcc->aspect.h > 0)) { h = (w * gcc->aspect.h) / gcc->aspect.w; // ZZZZ @@ -1727,7 +1737,7 @@ _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc) { h = gcc->min.h; } - } + } } if (gcc->o_base) e_box_pack_options_set(gcc->o_base, @@ -1736,7 +1746,7 @@ _e_gadcon_moveresize_handle(E_Gadcon_Client *gcc) 0.5, 0.5, /* align */ w, h, /* min */ w, h /* max */ - ); + ); } static Eina_Bool @@ -1750,9 +1760,9 @@ _e_gadcon_cb_client_scroll_timer(void *data) if (d < 0) d = -d; if (d < 0.001) { - gcc->scroll_pos = gcc->scroll_wanted; - gcc->scroll_timer = NULL; - return ECORE_CALLBACK_CANCEL; + gcc->scroll_pos = gcc->scroll_wanted; + gcc->scroll_timer = NULL; + return ECORE_CALLBACK_CANCEL; } v = 0.05; gcc->scroll_pos = (gcc->scroll_pos * (1.0 - v)) + (gcc->scroll_wanted * v); @@ -1771,8 +1781,8 @@ _e_gadcon_cb_client_scroll_animator(void *data) e_box_align_set(gcc->o_box, 0.5, 1.0 - gcc->scroll_pos); if (!gcc->scroll_timer) { - gcc->scroll_animator = NULL; - return ECORE_CALLBACK_CANCEL; + gcc->scroll_animator = NULL; + return ECORE_CALLBACK_CANCEL; } if (gcc->scroll_cb.func) @@ -1791,7 +1801,7 @@ _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object ev = event_info; gcc = data; evas_object_geometry_get(gcc->o_box, &x, &y, NULL, NULL); - e_gadcon_client_autoscroll_update(gcc, ev->cur.output.x - x, + e_gadcon_client_autoscroll_update(gcc, ev->cur.output.x - x, ev->cur.output.y - y); } @@ -1803,7 +1813,7 @@ _e_gadcon_cb_client_frame_moveresize(void *data, Evas *e __UNUSED__, Evas_Object gcc = data; _e_gadcon_moveresize_handle(gcc); } - + static void _e_gadcon_client_save(E_Gadcon_Client *gcc) { @@ -1841,7 +1851,7 @@ _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y) e_object_ref(E_OBJECT(gcc)); /* Remove this config from the current gadcon */ - gcc->gadcon->cf->clients = + gcc->gadcon->cf->clients = eina_list_remove(gcc->gadcon->cf->clients, gcc->cf); gcc->state_info.state = E_LAYOUT_ITEM_STATE_NONE; gcc->state_info.resist = 0; @@ -1850,26 +1860,26 @@ _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y) e_gadcon_client_hide(gcc); ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &x, &y); - + drag = e_drag_new(gcc->gadcon->zone->container, x, y, - drag_types, 1, gcc, -1, NULL, - _e_gadcon_cb_drag_finished); - if (drag) + drag_types, 1, gcc, -1, NULL, + _e_gadcon_cb_drag_finished); + if (drag) { - o = gcc->client_class->func.icon((E_Gadcon_Client_Class *)gcc->client_class, + o = gcc->client_class->func.icon((E_Gadcon_Client_Class *)gcc->client_class, e_drag_evas_get(drag)); - evas_object_geometry_get(o, NULL, NULL, &w, &h); - if (!o) - { - /* FIXME: fallback icon for drag */ - o = evas_object_rectangle_add(e_drag_evas_get(drag)); - evas_object_color_set(o, 255, 255, 255, 100); - } - if (w < 10) + evas_object_geometry_get(o, NULL, NULL, &w, &h); + if (!o) + { + /* FIXME: fallback icon for drag */ + o = evas_object_rectangle_add(e_drag_evas_get(drag)); + evas_object_color_set(o, 255, 255, 255, 100); + } + if (w < 10) w = h = 50; - e_drag_object_set(drag, o); - e_drag_resize(drag, w, h); - e_drag_start(drag, x + w/2, y + h/2); + e_drag_object_set(drag, o); + e_drag_resize(drag, w, h); + e_drag_start(drag, x + w / 2, y + h / 2); } } @@ -1884,13 +1894,13 @@ _e_gadcon_client_inject(E_Gadcon *gc, E_Gadcon_Client *gcc, int x, int y) /* Check if the gadcon client is in place */ if (!gcc->hidden) { - if (gcc->o_frame) - evas_object_geometry_get(gcc->o_frame, &cx, &cy, &cw, &ch); - else if (gcc->o_base) - evas_object_geometry_get(gcc->o_base, &cx, &cy, &cw, &ch); - else return; /* make clang happy */ + if (gcc->o_frame) + evas_object_geometry_get(gcc->o_frame, &cx, &cy, &cw, &ch); + else if (gcc->o_base) + evas_object_geometry_get(gcc->o_base, &cx, &cy, &cw, &ch); + else return; /* make clang happy */ - if (E_INSIDE(x, y, cx, cy, cw, ch)) return; + if (E_INSIDE(x, y, cx, cy, cw, ch)) return; } /* If x, y is not inside any gadcon client, seq will be 0 and it's position @@ -1898,43 +1908,43 @@ _e_gadcon_client_inject(E_Gadcon *gc, E_Gadcon_Client *gcc, int x, int y) gcc->state_info.seq = 0; EINA_LIST_FOREACH(gc->clients, l, gcc2) { - if (gcc == gcc2) continue; - if (gcc2->hidden) continue; - if (gcc2->o_frame) - evas_object_geometry_get(gcc2->o_frame, &cx, &cy, &cw, &ch); - else if (gcc2->o_base) - evas_object_geometry_get(gcc2->o_base, &cx, &cy, &cw, &ch); - else return; /* make clang happy */ - if (e_gadcon_layout_orientation_get(gc->o_container)) - { - if (E_INSIDE(x, y, cx, cy, cw / 2, ch)) - { - gcc->state_info.seq = seq++; - gcc2->state_info.seq = seq++; - } - else if (E_INSIDE(x, y, cx + cw / 2, cy, cw / 2, ch)) - { - gcc2->state_info.seq = seq++; - gcc->state_info.seq = seq++; - } - else + if (gcc == gcc2) continue; + if (gcc2->hidden) continue; + if (gcc2->o_frame) + evas_object_geometry_get(gcc2->o_frame, &cx, &cy, &cw, &ch); + else if (gcc2->o_base) + evas_object_geometry_get(gcc2->o_base, &cx, &cy, &cw, &ch); + else return; /* make clang happy */ + if (e_gadcon_layout_orientation_get(gc->o_container)) + { + if (E_INSIDE(x, y, cx, cy, cw / 2, ch)) + { + gcc->state_info.seq = seq++; + gcc2->state_info.seq = seq++; + } + else if (E_INSIDE(x, y, cx + cw / 2, cy, cw / 2, ch)) + { + gcc2->state_info.seq = seq++; + gcc->state_info.seq = seq++; + } + else gcc2->state_info.seq = seq++; - } - else - { - if (E_INSIDE(x, y, cx, cy, cw, ch / 2)) - { - gcc->state_info.seq = seq++; - gcc2->state_info.seq = seq++; - } - else if (E_INSIDE(x, y, cx, cy + ch / 2, cw, ch / 2)) - { - gcc2->state_info.seq = seq++; - gcc->state_info.seq = seq++; - } - else + } + else + { + if (E_INSIDE(x, y, cx, cy, cw, ch / 2)) + { + gcc->state_info.seq = seq++; + gcc2->state_info.seq = seq++; + } + else if (E_INSIDE(x, y, cx, cy + ch / 2, cw, ch / 2)) + { + gcc2->state_info.seq = seq++; + gcc->state_info.seq = seq++; + } + else gcc2->state_info.seq = seq++; - } + } } } @@ -1946,10 +1956,10 @@ _e_gadcon_cb_min_size_request(void *data, Evas_Object *obj __UNUSED__, void *eve gc = data; if (gc->min_size_request.func) { - Evas_Coord w = 0, h = 0; + Evas_Coord w = 0, h = 0; - e_gadcon_layout_min_size_get(gc->o_container, &w, &h); - gc->min_size_request.func(gc->min_size_request.data, gc, w, h); + e_gadcon_layout_min_size_get(gc->o_container, &w, &h); + gc->min_size_request.func(gc->min_size_request.data, gc, w, h); } } @@ -1961,10 +1971,10 @@ _e_gadcon_cb_size_request(void *data, Evas_Object *obj __UNUSED__, void *event_i gc = data; if (gc->resize_request.func) { - Evas_Coord w = 0, h = 0; + Evas_Coord w = 0, h = 0; - e_gadcon_layout_asked_size_get(gc->o_container, &w, &h); - gc->resize_request.func(gc->resize_request.data, gc, w, h); + e_gadcon_layout_asked_size_get(gc->o_container, &w, &h); + gc->resize_request.func(gc->resize_request.data, gc, w, h); } } @@ -1976,7 +1986,7 @@ _e_gadcon_cb_moveresize(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UN gc = data; evas_object_geometry_get(gc->o_container, &x, &y, &w, &h); - if (gc->drop_handler) + if (gc->drop_handler) e_drop_handler_geometry_set(gc->drop_handler, x, y, w, h); } @@ -1990,43 +2000,43 @@ _e_gadcon_cb_client_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *o ev = event_info; if (ev->button == 3) { - E_Zone *zone; - E_Menu *mn; - E_Menu_Item *mi; - int cx, cy; + E_Zone *zone; + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy; - zone = e_util_zone_current_get(e_manager_current_get()); + zone = e_util_zone_current_get(e_manager_current_get()); - e_gadcon_locked_set(gcc->gadcon, 1); - mn = e_menu_new(); - e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post, - gcc); - gcc->menu = mn; + e_gadcon_locked_set(gcc->gadcon, 1); + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _e_gadcon_client_cb_menu_post, + gcc); + gcc->menu = mn; - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Stop moving")); - e_util_menu_item_theme_icon_set(mi, "enlightenment/edit"); - e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_edit, gcc); + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Stop moving")); + e_util_menu_item_theme_icon_set(mi, "enlightenment/edit"); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_edit, gcc); - if (gcc->gadcon->menu_attach.func) - { - mi = e_menu_item_new(mn); - e_menu_item_separator_set(mi, 1); + if (gcc->gadcon->menu_attach.func) + { + mi = e_menu_item_new(mn); + e_menu_item_separator_set(mi, 1); - gcc->gadcon->menu_attach.func(gcc->gadcon->menu_attach.data, + gcc->gadcon->menu_attach.func(gcc->gadcon->menu_attach.data, gcc, mn); - } + } - if (gcc->gadcon->toolbar) - ecore_x_pointer_xy_get(zone->container->win, &cx, &cy); - else - { - e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, NULL, NULL); - cx = cx + ev->output.x; - cy = cy + ev->output.y; - } - e_menu_activate_mouse(mn, zone, cx, cy, 1, 1, - E_MENU_POP_DIRECTION_AUTO, ev->timestamp); + if (gcc->gadcon->toolbar) + ecore_x_pointer_xy_get(zone->container->win, &cx, &cy); + else + { + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, NULL, NULL); + cx = cx + ev->output.x; + cy = cy + ev->output.y; + } + e_menu_activate_mouse(mn, zone, cx, cy, 1, 1, + E_MENU_POP_DIRECTION_AUTO, ev->timestamp); } } @@ -2075,8 +2085,8 @@ _e_gadcon_cb_client_resize(void *data, Evas *evas __UNUSED__, Evas_Object *obj, static void _e_gadcon_client_move_start(E_Gadcon_Client *gcc) { - int x, y, gcx, gcy, gy ,gx; - + int x, y, gcx, gcy, gy, gx; + evas_object_raise(gcc->o_event); evas_object_stack_below(gcc->o_control, gcc->o_event); gcc->moving = 1; @@ -2084,13 +2094,13 @@ _e_gadcon_client_move_start(E_Gadcon_Client *gcc) evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy); else { - ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &gcc->dx, &gcc->dy); - e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gcx, &gcy, NULL, NULL); - evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, NULL, NULL); - gcc->dx -= (gcx + gx); - gcc->dy -= (gcy + gy); + ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &gcc->dx, &gcc->dy); + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gcx, &gcy, NULL, NULL); + evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, NULL, NULL); + gcc->dx -= (gcx + gx); + gcc->dy -= (gcy + gy); } - + if (gcc->o_frame) evas_object_geometry_get(gcc->o_frame, &x, &y, NULL, NULL); else if (gcc->o_base) @@ -2122,7 +2132,7 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc) int gx, gy, gw, gh; int gcx = 0, gcy = 0; int changes = 0; - + if (!gcc->moving) return; /* we need to get output not canvas because things like systray can reparent another window so we get no position here */ @@ -2132,18 +2142,18 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc) evas_pointer_canvas_xy_get(gcc->gadcon->evas, &cx, &cy); else { - ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &cx, &cy); - e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gcx, &gcy, NULL, NULL); + ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &cx, &cy); + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gcx, &gcy, NULL, NULL); } - + evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, &gw, &gh); cx -= (gx + gcx); cy -= (gy + gcy); - + x = cx - gcc->dx; - y = cy - gcc->dy; - + y = cy - 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); @@ -2152,80 +2162,79 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc) else if (gcc->o_base) evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); else - return; /* make clang happy */ + return; /* make clang happy */ if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container)) - { - if (cy + e_config->drag_resist < 0 || cy - e_config->drag_resist > gh) - { - _e_gadcon_client_drag_begin(gcc, cx, cy); - return; - } + { + if (cy + e_config->drag_resist < 0 || cy - e_config->drag_resist > gh) + { + _e_gadcon_client_drag_begin(gcc, cx, cy); + return; + } - if (x > 0 && (cx + gcc->drag.x > gcc->config.pos)) - { - 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; - changes = 1; - } - else if (x < 0 && (cx + gcc->drag.x < gcc->config.pos)) - { - 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; - changes = 1; - } + if (x > 0 && (cx + gcc->drag.x > gcc->config.pos)) + { + 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; + changes = 1; + } + else if (x < 0 && (cx + gcc->drag.x < gcc->config.pos)) + { + 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; + changes = 1; + } - if (changes) - { - if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, cx + gcc->drag.x, w); - else if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, cx + gcc->drag.x, w); + if (changes) + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, cx + gcc->drag.x, w); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, cx + gcc->drag.x, w); - gcc->config.size = w; - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = w; - } + gcc->config.size = w; + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = w; + } } else { - if (cx + e_config->drag_resist < 0 || cx - e_config->drag_resist > gw) - { - _e_gadcon_client_drag_begin(gcc, cx, cy); - return; - } + if (cx + e_config->drag_resist < 0 || cx - e_config->drag_resist > gw) + { + _e_gadcon_client_drag_begin(gcc, cx, cy); + return; + } - if (y > 0 && (cy + gcc->drag.y > gcc->config.pos)) - { - 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; - changes = 1; - } - else if (y < 0 && (cy + gcc->drag.y < gcc->config.pos)) - { - 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; - changes = 1; - } + if (y > 0 && (cy + gcc->drag.y > gcc->config.pos)) + { + 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; + changes = 1; + } + else if (y < 0 && (cy + gcc->drag.y < gcc->config.pos)) + { + 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; + changes = 1; + } - if (changes) - { - if (gcc->o_frame) - e_gadcon_layout_pack_request_set(gcc->o_frame, cy + gcc->drag.y, h); - else if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, cy + gcc->drag.y, h); - - gcc->config.size = h; - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = h; - } + if (changes) + { + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, cy + gcc->drag.y, h); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, cy + gcc->drag.y, h); + 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; } @@ -2290,49 +2299,49 @@ _e_gadcon_cb_signal_resize_left_go(void *data, Evas_Object *obj __UNUSED__, cons x = x - gcc->dx; y = y - gcc->dy; - gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | + 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 if (gcc->o_base) evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); - else return; /* make clang happy */ + else return; /* make clang happy */ _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_MIN_END_INC; - else if (x < 0) - gcc->state_info.state = E_LAYOUT_ITEM_STATE_SIZE_MIN_END_DEC; + 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 (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 if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w - x); - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = w; + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + x, w - x); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + x, w - 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->config.pos + y, h - y); - else if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h - y); - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = h; + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos + y, h - y); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos + y, h - y); + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = h; } gcc->dx += x; gcc->dy += y; @@ -2362,49 +2371,49 @@ _e_gadcon_cb_signal_resize_right_go(void *data, Evas_Object *obj __UNUSED__, con x = x - gcc->dx; y = y - gcc->dy; - gcc->state_info.flags = E_GADCON_LAYOUT_ITEM_LOCK_POSITION | + 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 if (gcc->o_base) evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h); - else return; /* make clang happy */ + else return; /* make clang happy */ _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; + 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 (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->config.pos, w + x); - else if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, w + x); - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = w; + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, w + x); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, w + 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->config.pos, h + y); - else if (gcc->o_base) - e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, h + y); - evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); - gcc->config.res = h; + if (gcc->o_frame) + e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->config.pos, h + y); + else if (gcc->o_base) + e_gadcon_layout_pack_request_set(gcc->o_base, gcc->config.pos, h + y); + evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h); + gcc->config.res = h; } gcc->dx += x; gcc->dy += y; @@ -2418,16 +2427,16 @@ _e_gadcon_cb_drag_finished(E_Drag *drag, int dropped) gcc = drag->data; if (!dropped) { - /* free client config */ - e_gadcon_client_config_del(NULL, gcc->cf); - /* delete the gadcon client */ - /* TODO: Clean up module config too? */ - e_object_del(E_OBJECT(gcc)); + /* free client config */ + e_gadcon_client_config_del(NULL, gcc->cf); + /* delete the gadcon client */ + /* TODO: Clean up module config too? */ + e_object_del(E_OBJECT(gcc)); } else if (new_gcc) { - /* dropped on new gadcon, delete this one as it is no longer in use */ - e_object_del(E_OBJECT(gcc)); + /* dropped on new gadcon, delete this one as it is no longer in use */ + e_object_del(E_OBJECT(gcc)); } e_object_unref(E_OBJECT(gcc)); new_gcc = NULL; @@ -2448,75 +2457,75 @@ _e_gadcon_cb_dnd_enter(void *data, const char *type __UNUSED__, void *event) if (gcc->gadcon == gc) { - /* We have re-entered the gadcon we left, revive gadcon client */ - Evas_Coord dx, dy; - Evas_Object *o; + /* We have re-entered the gadcon we left, revive gadcon client */ + Evas_Coord dx, dy; + Evas_Object *o; - if (e_gadcon_layout_orientation_get(gc->o_container)) - gcc->config.pos = ev->x - gcc->config.size / 2; - else - gcc->config.pos = ev->y - gcc->config.size / 2; - gcc->state_info.prev_pos = gcc->config.pos; + if (e_gadcon_layout_orientation_get(gc->o_container)) + gcc->config.pos = ev->x - gcc->config.size / 2; + else + gcc->config.pos = ev->y - gcc->config.size / 2; + gcc->state_info.prev_pos = gcc->config.pos; - evas_object_geometry_get(gc->o_container, &dx, &dy, NULL, NULL); - _e_gadcon_client_inject(gc, gcc, ev->x + dx, ev->y + dy); - e_gadcon_client_show(gcc); + evas_object_geometry_get(gc->o_container, &dx, &dy, NULL, NULL); + _e_gadcon_client_inject(gc, gcc, ev->x + dx, ev->y + dy); + e_gadcon_client_show(gcc); - o = gcc->o_frame ? gcc->o_frame : gcc->o_base; - if (o) - { - if (e_gadcon_layout_orientation_get(gc->o_container)) - e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); - else - e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); - } - gcc->state_info.resist = 1; + o = gcc->o_frame ? gcc->o_frame : gcc->o_base; + if (o) + { + if (e_gadcon_layout_orientation_get(gc->o_container)) + e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); + else + e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); + } + gcc->state_info.resist = 1; } else if (ev->data) { - /* Create a new gadcon to show where the gadcon will end up */ - E_Gadcon_Client_Class *cc; + /* Create a new gadcon to show where the gadcon will end up */ + E_Gadcon_Client_Class *cc; - gcc = ev->data; - cc = eina_hash_find(providers, gcc->name); - if (cc) - { - if (!gcc->style) - { - new_gcc = cc->func.init(gc, gcc->name, gcc->cf->id, + gcc = ev->data; + cc = eina_hash_find(providers, gcc->name); + if (cc) + { + if (!gcc->style) + { + new_gcc = cc->func.init(gc, gcc->name, gcc->cf->id, cc->default_style); - } - else - new_gcc = cc->func.init(gc, gcc->name, gcc->cf->id, + } + else + new_gcc = cc->func.init(gc, gcc->name, gcc->cf->id, gcc->style); - if (new_gcc) - { - new_gcc->cf = gcc->cf; - new_gcc->client_class = cc; - new_gcc->config.pos = gcc->config.pos; - new_gcc->config.size = gcc->config.size; - new_gcc->config.res = gcc->config.res; - new_gcc->state_info.seq = gcc->state_info.seq; - new_gcc->state_info.flags = gcc->state_info.flags; - if (new_gcc->o_frame) - e_gadcon_layout_pack_options_set(new_gcc->o_frame, new_gcc); - else if (new_gcc->o_base) - e_gadcon_layout_pack_options_set(new_gcc->o_base, new_gcc); + if (new_gcc) + { + new_gcc->cf = gcc->cf; + new_gcc->client_class = cc; + new_gcc->config.pos = gcc->config.pos; + new_gcc->config.size = gcc->config.size; + new_gcc->config.res = gcc->config.res; + new_gcc->state_info.seq = gcc->state_info.seq; + new_gcc->state_info.flags = gcc->state_info.flags; + if (new_gcc->o_frame) + e_gadcon_layout_pack_options_set(new_gcc->o_frame, new_gcc); + else if (new_gcc->o_base) + e_gadcon_layout_pack_options_set(new_gcc->o_base, new_gcc); - e_gadcon_client_autoscroll_set(new_gcc, gcc->autoscroll); + e_gadcon_client_autoscroll_set(new_gcc, gcc->autoscroll); /* e_gadcon_client_resizable_set(new_gcc, gcc->resizable);*/ - if (new_gcc->client_class->func.orient) - new_gcc->client_class->func.orient(new_gcc, gc->orient); - new_gcc->state_info.resist = 1; - if (gc->instant_edit) - e_gadcon_client_util_menu_attach(new_gcc); - } - } + if (new_gcc->client_class->func.orient) + new_gcc->client_class->func.orient(new_gcc, gc->orient); + new_gcc->state_info.resist = 1; + if (gc->instant_edit) + e_gadcon_client_util_menu_attach(new_gcc); + } + } } else { - /* TODO: Create a placeholder to show where the gadcon will end up */ + /* TODO: Create a placeholder to show where the gadcon will end up */ } e_gadcon_layout_thaw(gc->o_container); } @@ -2534,39 +2543,40 @@ _e_gadcon_cb_dnd_move(void *data, const char *type __UNUSED__, void *event) /* If we move in the same gadcon as the client originates */ if (drag_gcc->gadcon == gc) gcc = drag_gcc; /* If we move in the newly entered gadcon */ - else if (new_gcc->gadcon == gc) gcc = new_gcc; + else if (new_gcc->gadcon == gc) + gcc = new_gcc; if (gcc) { - Evas_Coord dx, dy; - Evas_Object *o; + Evas_Coord dx, dy; + Evas_Object *o; - if (gcc->state_info.resist > 0) - { - gcc->state_info.resist--; - return; - } - e_gadcon_layout_freeze(gc->o_container); + if (gcc->state_info.resist > 0) + { + gcc->state_info.resist--; + return; + } + e_gadcon_layout_freeze(gc->o_container); - if (e_gadcon_layout_orientation_get(gc->o_container)) - gcc->config.pos = ev->x - gcc->config.size / 2; - else - gcc->config.pos = ev->y - gcc->config.size / 2; - gcc->state_info.prev_pos = gcc->config.pos; + if (e_gadcon_layout_orientation_get(gc->o_container)) + gcc->config.pos = ev->x - gcc->config.size / 2; + else + gcc->config.pos = ev->y - gcc->config.size / 2; + gcc->state_info.prev_pos = gcc->config.pos; - evas_object_geometry_get(gc->o_container, &dx, &dy, NULL, NULL); - _e_gadcon_client_inject(gc, gcc, ev->x + dx, ev->y + dy); + evas_object_geometry_get(gc->o_container, &dx, &dy, NULL, NULL); + _e_gadcon_client_inject(gc, gcc, ev->x + dx, ev->y + dy); - o = gcc->o_frame ? gcc->o_frame : gcc->o_base; - if (o) - { - if (e_gadcon_layout_orientation_get(gc->o_container)) - e_gadcon_layout_pack_request_set(o, gcc->config.pos, + o = gcc->o_frame ? gcc->o_frame : gcc->o_base; + if (o) + { + if (e_gadcon_layout_orientation_get(gc->o_container)) + e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); - else - e_gadcon_layout_pack_request_set(o, gcc->config.pos, + else + e_gadcon_layout_pack_request_set(o, gcc->config.pos, gcc->config.size); - } - e_gadcon_layout_thaw(gc->o_container); + } + e_gadcon_layout_thaw(gc->o_container); } } @@ -2582,8 +2592,8 @@ _e_gadcon_cb_dnd_leave(void *data, const char *type __UNUSED__, void *event __UN /* Delete temporary object */ if (new_gcc) { - e_object_del(E_OBJECT(new_gcc)); - new_gcc = NULL; + e_object_del(E_OBJECT(new_gcc)); + new_gcc = NULL; } } @@ -2595,7 +2605,8 @@ _e_gadcon_cb_drop(void *data, const char *type __UNUSED__, void *event __UNUSED_ gc = data; if (drag_gcc->gadcon == gc) gcc = drag_gcc; - else if ((new_gcc) && (new_gcc->gadcon == gc)) gcc = new_gcc; + else if ((new_gcc) && (new_gcc->gadcon == gc)) + gcc = new_gcc; else return; /* make clang happy */ gc->cf->clients = eina_list_append(gc->cf->clients, gcc->cf); @@ -2609,15 +2620,15 @@ _e_gadcon_client_class_feature_check(const E_Gadcon_Client_Class *cc, const char { if (!feature) { - e_util_dialog_show("Insufficent gadcon support", - "Module %s needs to support %s", - cc->name, name); - return 0; + e_util_dialog_show("Insufficent gadcon support", + "Module %s needs to support %s", + cc->name, name); + return 0; } return 1; } -static void +static void _e_gadcon_client_cb_menu_post(void *data, E_Menu *m __UNUSED__) { E_Gadcon_Client *gcc; @@ -2652,36 +2663,36 @@ _e_gadcon_client_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj if (gcc->menu) return; if (ev->button == 3) { - E_Menu *m; + E_Menu *m; E_Zone *zone; - int cx, cy, cw, ch; + int cx, cy, cw, ch; - e_gadcon_locked_set(gcc->gadcon, 1); - m = e_menu_new(); + e_gadcon_locked_set(gcc->gadcon, 1); + m = e_menu_new(); - m = e_gadcon_client_util_menu_items_append(gcc, m, 0); - e_menu_post_deactivate_callback_set(m, _e_gadcon_client_cb_menu_post, - gcc); - gcc->menu = m; + m = e_gadcon_client_util_menu_items_append(gcc, m, 0); + e_menu_post_deactivate_callback_set(m, _e_gadcon_client_cb_menu_post, + gcc); + gcc->menu = m; - e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch); + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch); zone = gcc->gadcon->zone; if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); - e_menu_activate_mouse(m, zone, - cx + ev->output.x, + e_menu_activate_mouse(m, zone, + cx + ev->output.x, cy + ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_AUTO, ev->timestamp); + E_MENU_POP_DIRECTION_AUTO, ev->timestamp); } else if (ev->button == 1) { - if ((!gcc->o_control) && (gcc->gadcon->instant_edit)) - { - if (gcc->instant_edit_timer) + if ((!gcc->o_control) && (gcc->gadcon->instant_edit)) + { + if (gcc->instant_edit_timer) ecore_timer_del(gcc->instant_edit_timer); - gcc->instant_edit_timer = - ecore_timer_add(1.0, _e_gadcon_client_cb_instant_edit_timer, - gcc); - } + gcc->instant_edit_timer = + ecore_timer_add(1.0, _e_gadcon_client_cb_instant_edit_timer, + gcc); + } } } @@ -2695,16 +2706,16 @@ _e_gadcon_client_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __ gcc = data; if ((ev->button == 1) && (gcc->gadcon->instant_edit)) { - if (gcc->instant_edit_timer) - { - ecore_timer_del(gcc->instant_edit_timer); - gcc->instant_edit_timer = NULL; - } - if (gcc->o_control) - { - _e_gadcon_client_move_stop(gcc); - e_gadcon_client_edit_end(gcc); - } + if (gcc->instant_edit_timer) + { + ecore_timer_del(gcc->instant_edit_timer); + gcc->instant_edit_timer = NULL; + } + if (gcc->o_control) + { + _e_gadcon_client_move_stop(gcc); + e_gadcon_client_edit_end(gcc); + } } } @@ -2716,7 +2727,7 @@ _e_gadcon_client_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj gcc = data; if ((gcc->gadcon->instant_edit)) { - if (gcc->o_control) _e_gadcon_client_move_go(gcc); + if (gcc->o_control) _e_gadcon_client_move_go(gcc); } } @@ -2758,15 +2769,16 @@ _e_gadcon_client_cb_menu_autoscroll(void *data, E_Menu *m __UNUSED__, E_Menu_Ite gcc = data; 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_layout_thaw(gcc->gadcon->o_container); } + /* -static void -_e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) -{ + static void + _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) + { E_Gadcon_Client *gcc; gcc = data; @@ -2776,8 +2788,8 @@ _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m __UNUSED__, E_Menu_Item e_gadcon_client_resizable_set(gcc, gcc->resizable); _e_gadcon_client_save(gcc); e_gadcon_layout_thaw(gcc->gadcon->o_container); -} -*/ + } + */ static void _e_gadcon_client_cb_menu_edit(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) { @@ -2805,25 +2817,25 @@ _e_gadcon_client_cb_menu_remove(void *data, E_Menu *m __UNUSED__, E_Menu_Item *m e_config_save_queue(); } -static void -_e_gadcon_client_cb_menu_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) +static void +_e_gadcon_client_cb_menu_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) { E_Gadcon_Client *gcc; if (!(gcc = data)) return; - if (gcc->client_class->func.icon) + if (gcc->client_class->func.icon) { Evas_Object *ic; - + // e menu ASSUMES... EXPECTS the icon to be an.... e_icon! make it so. ic = gcc->client_class->func.icon - ((E_Gadcon_Client_Class *)gcc->client_class, - mi->menu->evas); + ((E_Gadcon_Client_Class *)gcc->client_class, + mi->menu->evas); mi->icon_object = e_icon_add(mi->menu->evas); e_icon_object_set(mi->icon_object, ic); } else - e_util_menu_item_theme_icon_set(mi, "preferences-gadget"); // FIXME: Needs icon in theme + e_util_menu_item_theme_icon_set(mi, "preferences-gadget"); // FIXME: Needs icon in theme } static void @@ -2835,67 +2847,67 @@ _e_gadcon_client_del_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU gcc->o_base = NULL; if (gcc->o_frame) { - evas_object_del(gcc->o_frame); - gcc->o_frame = NULL; + evas_object_del(gcc->o_frame); + gcc->o_frame = NULL; } e_object_del(E_OBJECT(gcc)); } /* a smart object JUST for gadcon */ -typedef struct _E_Gadcon_Layout_Item E_Gadcon_Layout_Item; +typedef struct _E_Gadcon_Layout_Item E_Gadcon_Layout_Item; struct _E_Smart_Data -{ - Evas_Coord x, y, w, h; - Evas_Object *obj, *clip; +{ + Evas_Coord x, y, w, h; + Evas_Object *obj, *clip; unsigned char horizontal : 1; unsigned char doing_config : 1; unsigned char redo_config : 1; - Eina_List *items; - int frozen; - Evas_Coord minw, minh, req; -}; + Eina_List *items; + int frozen; + Evas_Coord minw, minh, req; +}; struct _E_Gadcon_Layout_Item { - E_Smart_Data *sd; - struct - { - int pos, size, size2, res, prev_pos, prev_size; - } ask; - int hookp; - struct - { - int w, h; - } min, aspect, aspect_pad; + E_Smart_Data *sd; + struct + { + 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; + Evas_Coord x, y, w, h; + Evas_Object *obj; + unsigned char can_move : 1; }; /* local subsystem functions */ static E_Gadcon_Layout_Item *_e_gadcon_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj); -static void _e_gadcon_layout_smart_disown(Evas_Object *obj); -static void _e_gadcon_layout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd); -static void _e_gadcon_layout_smart_init(void); -static void _e_gadcon_layout_smart_add(Evas_Object *obj); -static void _e_gadcon_layout_smart_del(Evas_Object *obj); -static void _e_gadcon_layout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); -static void _e_gadcon_layout_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); -static void _e_gadcon_layout_smart_show(Evas_Object *obj); -static void _e_gadcon_layout_smart_hide(Evas_Object *obj); -static void _e_gadcon_layout_smart_color_set(Evas_Object *obj, int r, int g, int b, int a); -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); -static 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(const void *d1, const void *d2); -static int _e_gadcon_layout_smart_sort_by_position_cb(const void *d1, const void *d2); +static void _e_gadcon_layout_smart_disown(Evas_Object *obj); +static void _e_gadcon_layout_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd); +static void _e_gadcon_layout_smart_init(void); +static void _e_gadcon_layout_smart_add(Evas_Object *obj); +static void _e_gadcon_layout_smart_del(Evas_Object *obj); +static void _e_gadcon_layout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _e_gadcon_layout_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _e_gadcon_layout_smart_show(Evas_Object *obj); +static void _e_gadcon_layout_smart_hide(Evas_Object *obj); +static void _e_gadcon_layout_smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +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); +static 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(const void *d1, const void *d2); +static int _e_gadcon_layout_smart_sort_by_position_cb(const void *d1, const void *d2); /* local subsystem globals */ static Evas_Smart *_e_smart = NULL; @@ -2903,7 +2915,7 @@ static Evas_Smart *_e_smart = NULL; /* externally accessible functions */ static Evas_Object * e_gadcon_layout_add(Evas *evas) -{ +{ _e_gadcon_layout_smart_init(); return evas_object_smart_add(evas, _e_smart); } @@ -2916,7 +2928,7 @@ e_gadcon_layout_orientation_set(Evas_Object *obj, int horizontal) if (!obj) return; sd = evas_object_smart_data_get(obj); if (!sd) return; - if (((sd->horizontal) && (horizontal)) || + if (((sd->horizontal) && (horizontal)) || ((!sd->horizontal) && (!horizontal))) return; sd->horizontal = horizontal; _e_gadcon_layout_smart_reconfigure(sd); @@ -2960,7 +2972,7 @@ static void e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) { E_Smart_Data *sd; -/* +/* Eina_List *l; Evas_Object *obj; Evas_Coord tw = 0, th = 0; @@ -2970,31 +2982,31 @@ e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) if (!sd) return; if (sd->horizontal) { - if (w) *w = sd->minw; - if (h) *h = sd->minh; + if (w) *w = sd->minw; + if (h) *h = sd->minh; } else { - if (w) *w = sd->minh; - if (h) *h = sd->minw; + if (w) *w = sd->minh; + if (h) *h = sd->minw; } - -/* + +/* EINA_LIST_FOREACH(sd->items, l, obj) { - E_Gadcon_Layout_Item *bi; - - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (sd->horizontal) - { - tw += bi->min.w; - if (bi->min.h > th) th = bi->min.h; - } - else - { - th += bi->min.h; - if (bi->min.w > tw) tw = bi->min.w; - } + E_Gadcon_Layout_Item *bi; + + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + if (sd->horizontal) + { + tw += bi->min.w; + if (bi->min.h > th) th = bi->min.h; + } + else + { + th += bi->min.h; + if (bi->min.w > tw) tw = bi->min.w; + } } if (w) *w = tw; if (h) *h = th; @@ -3014,21 +3026,21 @@ e_gadcon_layout_asked_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) tw = sd->req; else th = sd->req; -/* +/* Evas_Object *obj; EINA_LIST_FOREACH(sd->items, l, obj) { - E_Gadcon_Layout_Item *bi; - - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (sd->horizontal) - { - tw += bi->ask.size; - } - else - { - th += bi->ask.size; - } + E_Gadcon_Layout_Item *bi; + + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + if (sd->horizontal) + { + tw += bi->ask.size; + } + else + { + th += bi->ask.size; + } } */ if (w) *w = tw; @@ -3065,43 +3077,43 @@ e_gadcon_layout_pack_size_set(Evas_Object *obj, int size) if (!bi) return; pos = bi->ask.pos + (bi->ask.size / 2); if (pos < (bi->ask.res / 3)) - { + { /* hooked to start */ - bi->ask.size = size; + bi->ask.size = size; } else if (pos > ((2 * bi->ask.res) / 3)) - { + { /* hooked to end */ - bi->ask.pos = (bi->ask.pos + bi->ask.size) - size; - bi->ask.size = size; + bi->ask.pos = (bi->ask.pos + bi->ask.size) - size; + bi->ask.size = size; } else - { + { /* hooked to middle */ - if ((bi->ask.pos <= (bi->ask.res / 2)) && - ((bi->ask.pos + bi->ask.size) > (bi->ask.res / 2))) - { + if ((bi->ask.pos <= (bi->ask.res / 2)) && + ((bi->ask.pos + bi->ask.size) > (bi->ask.res / 2))) + { /* straddles middle */ - if (bi->ask.res > 2) - bi->ask.pos = (bi->ask.res / 2) + - (((bi->ask.pos + (bi->ask.size / 2) - - (bi->ask.res / 2)) * - (bi->ask.res / 2)) / - (bi->ask.res / 2)) - (bi->ask.size / 2); - else - bi->x = bi->ask.res / 2; - bi->ask.size = size; - } - else - { - if (pos < (bi->ask.res / 2)) - { - bi->ask.pos = (bi->ask.pos + bi->ask.size) - size; - bi->ask.size = size; - } - else - bi->ask.size = size; - } + if (bi->ask.res > 2) + bi->ask.pos = (bi->ask.res / 2) + + (((bi->ask.pos + (bi->ask.size / 2) - + (bi->ask.res / 2)) * + (bi->ask.res / 2)) / + (bi->ask.res / 2)) - (bi->ask.size / 2); + else + bi->x = bi->ask.res / 2; + bi->ask.size = size; + } + else + { + if (pos < (bi->ask.res / 2)) + { + bi->ask.pos = (bi->ask.pos + bi->ask.size) - size; + bi->ask.size = size; + } + else + bi->ask.size = size; + } bi->ask.size = size; } _e_gadcon_layout_smart_reconfigure(bi->sd); @@ -3148,22 +3160,22 @@ e_gadcon_layout_pack_options_set(Evas_Object *obj, E_Gadcon_Client *gcc) seq = 1; EINA_LIST_FOREACH(bi->sd->items, l, item) { - bi2 = evas_object_data_get(item, "e_gadcon_layout_data"); - if (bi == bi2) continue; - if (bi->gcc->state_info.seq == bi2->gcc->state_info.seq) - ok = 1; + bi2 = evas_object_data_get(item, "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 (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; + { + 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); + _e_gadcon_layout_smart_reconfigure(bi->sd); } static void @@ -3176,15 +3188,15 @@ e_gadcon_layout_pack_min_size_set(Evas_Object *obj, int w, int h) if (!bi) return; if (bi->sd->horizontal) { - bi->min.w = w; - bi->min.h = h; + bi->min.w = w; + bi->min.h = h; } else { - bi->min.w = h; - bi->min.h = w; + bi->min.w = h; + bi->min.h = w; } - + _e_gadcon_layout_smart_reconfigure(bi->sd); } @@ -3198,15 +3210,15 @@ e_gadcon_layout_pack_aspect_set(Evas_Object *obj, int w, int h) if (!bi) return; if (bi->sd->horizontal) { - bi->aspect.w = w; - bi->aspect.h = h; + bi->aspect.w = w; + bi->aspect.h = h; } else { - bi->aspect.w = h; - bi->aspect.h = w; + bi->aspect.w = h; + bi->aspect.h = w; } - + _e_gadcon_layout_smart_reconfigure(bi->sd); } @@ -3220,14 +3232,14 @@ e_gadcon_layout_pack_aspect_pad_set(Evas_Object *obj, int w, int h) if (!bi) return; if (bi->sd->horizontal) { - bi->aspect_pad.w = w; - bi->aspect_pad.h = h; + bi->aspect_pad.w = w; + bi->aspect_pad.h = h; } else { - bi->aspect_pad.w = h; - bi->aspect_pad.h = w; - } + bi->aspect_pad.w = h; + bi->aspect_pad.h = w; + } } static void @@ -3262,7 +3274,7 @@ _e_gadcon_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj) evas_object_smart_member_add(obj, bi->sd->obj); evas_object_data_set(obj, "e_gadcon_layout_data", bi); evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _e_gadcon_layout_smart_item_del_hook, NULL); + _e_gadcon_layout_smart_item_del_hook, NULL); if ((!evas_object_visible_get(sd->clip)) && (evas_object_visible_get(sd->obj))) evas_object_show(sd->clip); @@ -3279,11 +3291,11 @@ _e_gadcon_layout_smart_disown(Evas_Object *obj) if (!bi) return; if (!bi->sd->items) { - if (evas_object_visible_get(bi->sd->clip)) - evas_object_hide(bi->sd->clip); + if (evas_object_visible_get(bi->sd->clip)) + evas_object_hide(bi->sd->clip); } evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL, - _e_gadcon_layout_smart_item_del_hook); + _e_gadcon_layout_smart_item_del_hook); evas_object_smart_member_del(obj); evas_object_clip_unset(obj); evas_object_data_del(obj, "e_gadcon_layout_data"); @@ -3313,123 +3325,123 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) if (sd->frozen) return; if (sd->doing_config) { - sd->redo_config = 1; - return; + sd->redo_config = 1; + return; } recurse++; min = mino = cur = 0; - _e_gadcon_layout_smart_min_cur_size_calc(sd, &min, &mino, &cur); + _e_gadcon_layout_smart_min_cur_size_calc(sd, &min, &mino, &cur); if ((sd->minw != min) || (sd->minh != mino)) { - sd->minw = min; - sd->minh = mino; - evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); + sd->minw = min; + sd->minh = mino; + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); } if (sd->req != cur) { - if (cur >= sd->minw) - { - sd->req = cur; - evas_object_smart_callback_call(sd->obj, "size_request", NULL); - } - else - { - sd->req = sd->minw; - } + if (cur >= sd->minw) + { + sd->req = cur; + evas_object_smart_callback_call(sd->obj, "size_request", NULL); + } + else + { + sd->req = sd->minw; + } } if (recurse == 1) _e_gadcon_layout_smart_gadcons_width_adjust(sd, min, cur); if (sd->w <= sd->req) - { - _e_gadcon_layout_smart_gadcon_position_shrinked_mode(sd); - set_prev_pos = 0; + { + _e_gadcon_layout_smart_gadcon_position_shrinked_mode(sd); + set_prev_pos = 0; } else - { - _e_gadcon_layout_smart_gadcons_asked_position_set(sd); + { + _e_gadcon_layout_smart_gadcons_asked_position_set(sd); - list = _e_gadcon_layout_smart_gadcons_wrap(sd); + list = _e_gadcon_layout_smart_gadcons_wrap(sd); - _e_gadcon_layout_smart_gadcons_position(sd, &list); + _e_gadcon_layout_smart_gadcons_position(sd, &list); - EINA_LIST_FREE(list, lc) - LC_FREE(lc); + EINA_LIST_FREE(list, lc) + LC_FREE(lc); - set_prev_pos = 1; + set_prev_pos = 1; } sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), - _e_gadcon_layout_smart_sort_by_position_cb); + _e_gadcon_layout_smart_sort_by_position_cb); i = 1; EINA_LIST_FOREACH(sd->items, l, obj) { - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (bi->gcc->gadcon->editing) bi->gcc->state_info.seq = i; + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + if (bi->gcc->gadcon->editing) bi->gcc->state_info.seq = i; - if (set_prev_pos) - { - bi->ask.prev_pos = bi->x; - bi->ask.prev_size = bi->w; - } + if (set_prev_pos) + { + bi->ask.prev_pos = bi->x; + bi->ask.prev_size = bi->w; + } - 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; + 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; - if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && - (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) - { - if (bi->x != bi->ask.pos) - bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; - } - i++; - } + if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) + { + if (bi->x != bi->ask.pos) + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + i++; + } EINA_LIST_FOREACH(sd->items, l, obj) { - bi = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (!bi) continue; + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + if (!bi) continue; - bi->h = sd->h; - xx = sd->x + bi->x; - yy = sd->y; // + ((sd->h - bi->h) / 2); - - if (sd->horizontal) - { - evas_object_move(obj, xx, yy); - evas_object_resize(obj, bi->w, bi->h); - } - else - { - evas_object_move(obj, yy, xx); - evas_object_resize(obj, bi->h, bi->w); - } + bi->h = sd->h; + xx = sd->x + bi->x; + yy = sd->y; // + ((sd->h - bi->h) / 2); + + if (sd->horizontal) + { + evas_object_move(obj, xx, yy); + evas_object_resize(obj, bi->w, bi->h); + } + else + { + evas_object_move(obj, yy, xx); + evas_object_resize(obj, bi->h, bi->w); + } } sd->doing_config = 0; if (sd->redo_config) { - _e_gadcon_layout_smart_reconfigure(sd); - sd->redo_config = 0; + _e_gadcon_layout_smart_reconfigure(sd); + sd->redo_config = 0; } if ((sd->minw != min) || (sd->minh != mino)) { - sd->minw = min; - sd->minh = mino; - evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); + sd->minw = min; + sd->minh = mino; + evas_object_smart_callback_call(sd->obj, "min_size_request", NULL); } if (sd->req != cur) { - if (cur >= sd->minw) - { - sd->req = cur; - evas_object_smart_callback_call(sd->obj, "size_request", NULL); - } + if (cur >= sd->minw) + { + sd->req = cur; + evas_object_smart_callback_call(sd->obj, "size_request", NULL); + } } recurse--; } @@ -3438,24 +3450,24 @@ static void _e_gadcon_layout_smart_init(void) { if (_e_smart) return; - { - static const Evas_Smart_Class sc = - { - "e_gadcon_layout", - EVAS_SMART_CLASS_VERSION, - _e_gadcon_layout_smart_add, - _e_gadcon_layout_smart_del, - _e_gadcon_layout_smart_move, - _e_gadcon_layout_smart_resize, - _e_gadcon_layout_smart_show, - _e_gadcon_layout_smart_hide, - _e_gadcon_layout_smart_color_set, - _e_gadcon_layout_smart_clip_set, - _e_gadcon_layout_smart_clip_unset, - NULL, NULL, NULL, NULL, NULL, NULL, NULL - }; - _e_smart = evas_smart_class_new(&sc); - } + { + static const Evas_Smart_Class sc = + { + "e_gadcon_layout", + EVAS_SMART_CLASS_VERSION, + _e_gadcon_layout_smart_add, + _e_gadcon_layout_smart_del, + _e_gadcon_layout_smart_move, + _e_gadcon_layout_smart_resize, + _e_gadcon_layout_smart_show, + _e_gadcon_layout_smart_hide, + _e_gadcon_layout_smart_color_set, + _e_gadcon_layout_smart_clip_set, + _e_gadcon_layout_smart_clip_unset, + NULL, NULL, NULL, NULL, NULL, NULL, NULL + }; + _e_smart = evas_smart_class_new(&sc); + } } static void @@ -3479,7 +3491,7 @@ _e_gadcon_layout_smart_add(Evas_Object *obj) evas_object_color_set(sd->clip, 255, 255, 255, 255); evas_object_smart_data_set(obj, sd); } - + static void _e_gadcon_layout_smart_del(Evas_Object *obj) { @@ -3490,10 +3502,10 @@ _e_gadcon_layout_smart_del(Evas_Object *obj) if (!sd) return; while (sd->items) { - Evas_Object *child; + Evas_Object *child; - child = eina_list_data_get(sd->items); - e_gadcon_layout_unpack(child); + child = eina_list_data_get(sd->items); + e_gadcon_layout_unpack(child); } evas_object_del(sd->clip); free(sd); @@ -3508,41 +3520,41 @@ _e_gadcon_layout_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) sd = evas_object_smart_data_get(obj); if (!sd) return; if ((x == sd->x) && (y == sd->y)) return; + { + Eina_List *l; + Evas_Object *item; + Evas_Coord dx, dy; + + if (sd->horizontal) + { + dx = x - sd->x; + dy = y - sd->y; + } + else + { + dx = x - sd->y; + dy = y - sd->x; + } + + EINA_LIST_FOREACH(sd->items, l, item) + { + Evas_Coord ox, oy; + + evas_object_geometry_get(item, &ox, &oy, NULL, NULL); + evas_object_move(item, ox + dx, oy + dy); + } + } + + if (sd->horizontal) { - Eina_List *l; - Evas_Object *item; - Evas_Coord dx, dy; - - if (sd->horizontal) - { - dx = x - sd->x; - dy = y - sd->y; - } - else - { - dx = x - sd->y; - dy = y - sd->x; - } - - EINA_LIST_FOREACH(sd->items, l, item) - { - Evas_Coord ox, oy; - - evas_object_geometry_get(item, &ox, &oy, NULL, NULL); - evas_object_move(item, ox + dx, oy + dy); - } + sd->x = x; + sd->y = y; + } + else + { + sd->x = y; + sd->y = x; } - - if (sd->horizontal) - { - sd->x = x; - sd->y = y; - } - else - { - sd->x = y; - sd->y = x; - } } static void @@ -3555,17 +3567,16 @@ _e_gadcon_layout_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) if (!sd) return; if ((w == sd->w) && (h == sd->h)) return; if (sd->horizontal) - { - sd->w = w; - sd->h = h; + { + sd->w = w; + sd->h = h; } else { - sd->w = h; - sd->h = w; - + sd->w = h; + sd->h = w; } - + _e_gadcon_layout_smart_reconfigure(sd); } @@ -3598,7 +3609,7 @@ _e_gadcon_layout_smart_color_set(Evas_Object *obj, int r, int g, int b, int a) if (!obj) return; sd = evas_object_smart_data_get(obj); - if (!sd) return; + if (!sd) return; evas_object_color_set(sd->clip, r, g, b, a); } @@ -3622,7 +3633,7 @@ _e_gadcon_layout_smart_clip_unset(Evas_Object *obj) sd = evas_object_smart_data_get(obj); if (!sd) return; evas_object_clip_unset(sd->clip); -} +} /* * @min - the minimum width required by all the gadcons @@ -3632,103 +3643,103 @@ _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) { - E_Gadcon_Layout_Item *bi; + E_Gadcon_Layout_Item *bi; Eina_List *l; Evas_Object *item; EINA_LIST_FOREACH(sd->items, l, item) { - bi = evas_object_data_get(item, "e_gadcon_layout_data"); - bi->ask.size2 = bi->ask.size; + bi = evas_object_data_get(item, "e_gadcon_layout_data"); + bi->ask.size2 = bi->ask.size; - if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) - { - 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 - { + if ((bi->aspect.w > 0) && (bi->aspect.h > 0)) + { + 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 = bi->ask.size = bi->min.w; - *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; - } + *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; + } } } -static int +static int _e_gadcon_layout_smart_width_smart_sort_reverse_cb(const void *d1, const void *d2) { const 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"); + bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); 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; - } - } + 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; - } + 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; + } } return 0; } -static void +static void _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) -{ +{ E_Gadcon_Layout_Item *bi = NULL; Eina_List *l, *l2; Evas_Object *item; @@ -3738,54 +3749,54 @@ _e_gadcon_layout_smart_gadcons_width_adjust(E_Smart_Data *sd, int min, int cur) if (sd->w < cur) { - if (sd->w < min) max_size = min; - else max_size = cur; - need = max_size - sd->w; + if (sd->w < min) max_size = min; + else max_size = cur; + need = max_size - sd->w; } else return; - - sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), - _e_gadcon_layout_smart_width_smart_sort_reverse_cb); + + sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), + _e_gadcon_layout_smart_width_smart_sort_reverse_cb); EINA_LIST_FOREACH(sd->items, l, item) - { + { bi = evas_object_data_get(item, "e_gadcon_layout_data"); if (bi->gcc->autoscroll) autosize += bi->ask.size2; - } + } if (autosize < 1) autosize = 1; while (need > 0) - { + { needed = need; EINA_LIST_REVERSE_FOREACH(sd->items, l2, item) - { + { if (need <= 0) break; bi = evas_object_data_get(item, "e_gadcon_layout_data"); if (bi->gcc->autoscroll) { - int reduce_by; - + int reduce_by; + reduce_by = (need * bi->ask.size2) / autosize; if (reduce_by < 1) reduce_by = 1; if (bi->ask.size2 - reduce_by > 8) { bi->ask.size2 -= reduce_by; - need -= reduce_by ; + need -= reduce_by; } else { need -= bi->ask.size2 - 8; bi->ask.size2 = 8; } - } - } + } + } /* If the 'needed' size change didn't get modified (no gadget has autoscroll) then we must break or we end up in an infinite loop */ if (need == needed) break; } } -static int +static int _e_gadcon_layout_smart_sort_by_sequence_number_cb(const void *d1, const void *d2) { const E_Gadcon_Layout_Item *bi, *bi2; @@ -3794,10 +3805,12 @@ _e_gadcon_layout_smart_sort_by_sequence_number_cb(const void *d1, const void *d2 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; + 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(const void *d1, const void *d2) @@ -3807,7 +3820,7 @@ _e_gadcon_layout_smart_sort_by_position_cb(const void *d1, const void *d2) bi = evas_object_data_get(d1, "e_gadcon_layout_data"); bi2 = evas_object_data_get(d2, "e_gadcon_layout_data"); - return (bi->x - bi2->x); + return bi->x - bi2->x; } static int @@ -3818,7 +3831,8 @@ _e_gadcon_layout_smart_containers_sort_cb(const void *d1, const void *d2) lc = d1; lc2 = d2; if (lc->pos < lc2->pos) return -1; - else if (lc->pos > lc2->pos) return 1; + else if (lc->pos > lc2->pos) + return 1; return 0; } @@ -3829,7 +3843,7 @@ _e_gadcon_layout_smart_seq_sort_cb(const void *d1, const void *d2) bi = d1; bi2 = d2; - return (bi->gcc->state_info.seq - bi2->gcc->state_info.seq); + return bi->gcc->state_info.seq - bi2->gcc->state_info.seq; } static void @@ -3840,7 +3854,7 @@ _e_gadcon_layout_smart_sync_clients(E_Gadcon *gc) EINA_LIST_FOREACH(gc->clients, l, gcc) { - _e_gadcon_client_save(gcc); + _e_gadcon_client_save(gcc); } } @@ -3853,10 +3867,10 @@ _e_gadcon_client_current_position_sync(E_Gadcon_Client *gcc) o = gcc->o_frame ? gcc->o_frame : gcc->o_base; if (o) { - bi = evas_object_data_get(o, "e_gadcon_layout_data"); - if (!bi) return; + bi = evas_object_data_get(o, "e_gadcon_layout_data"); + if (!bi) return; } - else return; /* make clang happy */ + else return; /* make clang happy */ gcc->state_info.prev_pos = gcc->config.pos; gcc->state_info.prev_size = gcc->config.size; @@ -3865,108 +3879,108 @@ _e_gadcon_client_current_position_sync(E_Gadcon_Client *gcc) static void _e_gadcon_layout_smart_gadcon_position_shrinked_mode(E_Smart_Data *sd) -{ +{ Eina_List *l; Evas_Object *item; - E_Gadcon_Layout_Item *bi, *bi2; - void *tp; - int pos = 0; + E_Gadcon_Layout_Item *bi, *bi2; + void *tp; + int pos = 0; sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), - _e_gadcon_layout_smart_sort_by_sequence_number_cb); + _e_gadcon_layout_smart_sort_by_sequence_number_cb); EINA_LIST_FOREACH(sd->items, l, item) - { - bi = evas_object_data_get(item, "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 (eina_list_next(l)) - { - tp = eina_list_data_get(eina_list_next(l)); - l->next->data = eina_list_data_get(l); - l->data = tp; + { + bi = evas_object_data_get(item, "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 (eina_list_next(l)) + { + tp = eina_list_data_get(eina_list_next(l)); + l->next->data = eina_list_data_get(l); + l->data = tp; - bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); - - if (bi2->x + bi2->w/2 > bi->ask.pos + bi->w) - { - bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; - return; - } - - 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 (eina_list_prev(l)) - { - tp = eina_list_data_get(eina_list_prev(l)); - l->prev->data = eina_list_data_get(l); + bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); - l->data = tp; - bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); + if (bi2->x + bi2->w / 2 > bi->ask.pos + bi->w) + { + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + return; + } - if (bi->ask.pos > bi2->x + bi2->w/2) - { - bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; - return; - } + 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 (eina_list_prev(l)) + { + tp = eina_list_data_get(eina_list_prev(l)); + l->prev->data = eina_list_data_get(l); - 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 (bi->w < bi->min.w) - bi->gcc->config.size = bi->w = bi->min.w; - else - bi->gcc->config.size = bi->w; + l->data = tp; + bi2 = evas_object_data_get(tp, "e_gadcon_layout_data"); - bi->gcc->config.pos = bi->gcc->state_info.prev_pos; - } - } + if (bi->ask.pos > bi2->x + bi2->w / 2) + { + bi->gcc->config.pos = bi->ask.pos = bi->gcc->state_info.prev_pos; + return; + } + + 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 (bi->w < bi->min.w) + bi->gcc->config.size = bi->w = bi->min.w; + else + bi->gcc->config.size = bi->w; + + bi->gcc->config.pos = bi->gcc->state_info.prev_pos; + } + } EINA_LIST_FOREACH(sd->items, l, item) - { - bi = evas_object_data_get(item, "e_gadcon_layout_data"); + { + bi = evas_object_data_get(item, "e_gadcon_layout_data"); - bi->x = pos; - bi->w = bi->ask.size2; - bi->gcc->config.size = bi->w; - pos = bi->x + bi->w; + bi->x = pos; + bi->w = bi->ask.size2; + bi->gcc->config.size = bi->w; + pos = bi->x + bi->w; } } @@ -3980,64 +3994,64 @@ _e_gadcon_layout_smart_gadcons_asked_position_set(E_Smart_Data *sd) #if 0 EINA_LIST_FOREACH(sd->items, l, item) { - bi = evas_object_data_get(item, "e_gadcon_layout_data"); - if (!bi) continue; - - bi->x = bi->ask.pos; - bi->w = bi->ask.size2; + bi = evas_object_data_get(item, "e_gadcon_layout_data"); + if (!bi) continue; + + bi->x = bi->ask.pos; + bi->w = bi->ask.size2; } #else int pos; EINA_LIST_FOREACH(sd->items, l, item) { - bi = evas_object_data_get(item, "e_gadcon_layout_data"); - if (!bi) continue; + bi = evas_object_data_get(item, "e_gadcon_layout_data"); + if (!bi) continue; - pos = bi->ask.pos + (bi->ask.size / 2); - if (pos < (bi->ask.res / 3)) - { - /* hooked to start */ - bi->x = bi->ask.pos; - bi->w = bi->ask.size2; - bi->hookp = 0; - } - else if (pos > ((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; - } + pos = bi->ask.pos + (bi->ask.size / 2); + if (pos < (bi->ask.res / 3)) + { + /* hooked to start */ + bi->x = bi->ask.pos; + bi->w = bi->ask.size2; + bi->hookp = 0; + } + else if (pos > ((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; + } } #endif } -/* +/* * The function returns a list of E_Gadcon_Layout_Item_Container */ static Eina_List * @@ -4048,28 +4062,27 @@ _e_gadcon_layout_smart_gadcons_wrap(E_Smart_Data *sd) E_Layout_Item_Container *lc; E_Gadcon_Layout_Item *bi; - EINA_LIST_FOREACH(sd->items, l, item) { - bi = evas_object_data_get(item, "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; + bi = evas_object_data_get(item, "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; - lc->pos = bi->x; - lc->size = bi->w; + lc->pos = bi->x; + lc->size = bi->w; - lc->prev_pos = bi->ask.prev_pos; - lc->prev_size = bi->ask.prev_size; + 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); + 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; + 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 = eina_list_append(lc->items, bi); - list = eina_list_append(list, lc); + lc->items = eina_list_append(lc->items, bi); + list = eina_list_append(list, lc); } return list; } @@ -4086,351 +4099,351 @@ _e_gadcon_layout_smart_gadcons_position(E_Smart_Data *sd, Eina_List **list) EINA_LIST_FOREACH(*list, l, lc_moving) { - if ((lc_moving->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && - (lc_moving->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED)) - { - 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; - EINA_LIST_FOREACH(lc_moving->items, l2, lc) - lc_back->items = eina_list_append(lc_back->items, lc); - lc_back->state = lc_moving->state; - bi_moving = eina_list_data_get(lc_back->items); - - break; - } - lc_moving = NULL; + if ((lc_moving->state != E_LAYOUT_ITEM_CONTAINER_STATE_NONE) && + (lc_moving->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED)) + { + 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; + EINA_LIST_FOREACH(lc_moving->items, l2, lc) + lc_back->items = eina_list_append(lc_back->items, lc); + lc_back->state = lc_moving->state; + bi_moving = eina_list_data_get(lc_back->items); + + break; + } + lc_moving = NULL; } if (!lc_moving) { - _e_gadcon_layout_smart_gadcons_position_static(sd, list); - return; - } + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + return; + } lc_moving_prev_pos = lc_moving->prev_pos; - 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); - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + 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); + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - ok = 0; - if ((l) && eina_list_prev(l)) - { - lc = eina_list_data_get(eina_list_prev(l)); + ok = 0; + if ((l) && eina_list_prev(l)) + { + lc = eina_list_data_get(eina_list_prev(l)); - if (lc_moving->pos < (lc->pos + lc->size)) - { - bi = eina_list_data_get(lc_moving->items); - if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) - { - if (lc_moving->prev_pos == (lc->pos + lc->size)) - ok = 1; - bi->gcc->state_info.resist++; - lc_moving->pos = lc->pos + lc->size; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - } - else - { - bi->gcc->state_info.resist = 0; - if (lc_moving->pos < lc->pos) - { - lc_moving->pos = (lc->pos + lc->size) - 1; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - } - lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc_moving); - if (lc3) - { - if (lc_moving->prev_pos == (lc->pos + lc->size)) - ok = 1; + if (lc_moving->pos < (lc->pos + lc->size)) + { + bi = eina_list_data_get(lc_moving->items); + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + if (lc_moving->prev_pos == (lc->pos + lc->size)) + ok = 1; + bi->gcc->state_info.resist++; + lc_moving->pos = lc->pos + lc->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + else + { + bi->gcc->state_info.resist = 0; + if (lc_moving->pos < lc->pos) + { + lc_moving->pos = (lc->pos + lc->size) - 1; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc_moving); + if (lc3) + { + if (lc_moving->prev_pos == (lc->pos + lc->size)) + ok = 1; - l->data = lc3; - *list = eina_list_remove_list(*list, eina_list_prev(l)); - LC_FREE(lc_moving); - LC_FREE(lc); - lc_moving = lc3; - } - } - } - } - if (!ok) - { - int pos, prev_pos, stop; + l->data = lc3; + *list = eina_list_remove_list(*list, eina_list_prev(l)); + LC_FREE(lc_moving); + LC_FREE(lc); + lc_moving = lc3; + } + } + } + } + if (!ok) + { + int pos, prev_pos, stop; - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - pos = lc_moving->pos + lc_moving->size; - prev_pos = lc_moving_prev_pos; - if ((l) && (eina_list_next(l))) - { - stop = 0; - EINA_LIST_FOREACH(eina_list_next(l), l2, lc) - { - if (stop) break; - if (lc->pos != prev_pos) break; - prev_pos = lc->pos + lc->size; + pos = lc_moving->pos + lc_moving->size; + prev_pos = lc_moving_prev_pos; + if ((l) && (eina_list_next(l))) + { + stop = 0; + EINA_LIST_FOREACH(eina_list_next(l), l2, lc) + { + if (stop) break; + if (lc->pos != prev_pos) break; + prev_pos = lc->pos + lc->size; - EINA_LIST_FOREACH(lc->items, l3, bi) - { - if (bi->ask.pos <= pos) - { - bi->x = pos; - pos = (bi->x) + (bi->w); - } - else if (bi->ask.pos < bi->x) - { - bi->x = bi->ask.pos; - pos = (bi->x) + (bi->w); - } - else if (bi->ask.pos == bi->x) - { - stop = 1; - break; - } - } - } - } - } + EINA_LIST_FOREACH(lc->items, l3, bi) + { + if (bi->ask.pos <= pos) + { + bi->x = pos; + pos = (bi->x) + (bi->w); + } + else if (bi->ask.pos < bi->x) + { + bi->x = bi->ask.pos; + pos = (bi->x) + (bi->w); + } + else if (bi->ask.pos == bi->x) + { + stop = 1; + break; + } + } + } + } + } } 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); - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - ok = 0; - if ((l) && eina_list_next(l)) - { - lc = eina_list_data_get(eina_list_next(l)); + ok = 0; + if ((l) && eina_list_next(l)) + { + lc = eina_list_data_get(eina_list_next(l)); - if ((lc_moving->pos + lc_moving->size) > lc->pos) - { - bi = eina_list_data_get(lc_moving->items); - if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) - { - if ((lc_moving->prev_pos + lc_moving->size) == lc->pos) - ok = 1; - bi->gcc->state_info.resist++; - lc_moving->pos = lc->pos - lc_moving->size; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - } - else - { - bi->gcc->state_info.resist = 0; - if ((lc_moving->pos + lc_moving->size) > lc->pos) - { - lc_moving->pos = (lc->pos - lc_moving->size) + 1; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - } - lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc_moving, lc); - if (lc3) - { - if ((lc_moving->prev_pos + lc_moving->size) == lc->pos) - ok = 1; + if ((lc_moving->pos + lc_moving->size) > lc->pos) + { + bi = eina_list_data_get(lc_moving->items); + if (bi->gcc->state_info.resist <= E_LAYOUT_ITEM_DRAG_RESIST_LEVEL) + { + if ((lc_moving->prev_pos + lc_moving->size) == lc->pos) + ok = 1; + bi->gcc->state_info.resist++; + lc_moving->pos = lc->pos - lc_moving->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + else + { + bi->gcc->state_info.resist = 0; + if ((lc_moving->pos + lc_moving->size) > lc->pos) + { + lc_moving->pos = (lc->pos - lc_moving->size) + 1; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + } + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc_moving, lc); + if (lc3) + { + if ((lc_moving->prev_pos + lc_moving->size) == lc->pos) + ok = 1; - l->data = lc3; - *list = eina_list_remove_list(*list, eina_list_next(l)); - LC_FREE(lc_moving); - LC_FREE(lc); - lc_moving = lc3; - } - } - } - } + l->data = lc3; + *list = eina_list_remove_list(*list, eina_list_next(l)); + LC_FREE(lc_moving); + LC_FREE(lc); + lc_moving = lc3; + } + } + } + } - if (!ok) - { - int pos, prev_pos, stop; - - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + if (!ok) + { + int pos, prev_pos, stop; - pos = lc_moving->pos; - prev_pos = lc_moving_prev_pos; + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - if ((l) && eina_list_prev(l)) - { - stop = 0; - /* EINA_FUCK_REVERSE_FOREACH(eina_list_prev(l), l2, lc) */ - for (l2 = l->prev; l2; l2 = l2->prev) - { - lc = l2->data; - - if (stop) break; - if ((lc->pos + lc->size) == prev_pos) break; - prev_pos = lc->pos; + pos = lc_moving->pos; + prev_pos = lc_moving_prev_pos; - EINA_LIST_REVERSE_FOREACH(lc->items, l3, bi) - { - if ((bi->ask.pos + bi->w) >= pos) - { - bi->x = pos - bi->w; - pos = bi->x; - } - else if (bi->ask.pos > bi->x) - { - bi->x = bi->ask.pos; - pos = bi->x; - } - else if (bi->ask.pos == bi->x) - { - stop = 1; - break; - } - } - } - } - } - } + if ((l) && eina_list_prev(l)) + { + stop = 0; + /* EINA_FUCK_REVERSE_FOREACH(eina_list_prev(l), l2, lc) */ + for (l2 = l->prev; l2; l2 = l2->prev) + { + lc = l2->data; + + if (stop) break; + if ((lc->pos + lc->size) == prev_pos) break; + prev_pos = lc->pos; + + EINA_LIST_REVERSE_FOREACH(lc->items, l3, bi) + { + if ((bi->ask.pos + bi->w) >= pos) + { + bi->x = pos - bi->w; + pos = bi->x; + } + else if (bi->ask.pos > bi->x) + { + bi->x = bi->ask.pos; + pos = bi->x; + } + else if (bi->ask.pos == bi->x) + { + stop = 1; + break; + } + } + } + } + } + } 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); - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + { + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - if ((l) && eina_list_prev(l)) - { - int new_pos = 0; + if ((l) && eina_list_prev(l)) + { + int new_pos = 0; - ok = 0; - new_pos = lc_moving->pos; - /* EINA_FUCK_REVERSE_FOREACH(eina_list_prev(l), l2, lc) */ - for (l2 = l->prev; l2; l2 = l2->prev) - { - lc = l2->data; - if (new_pos >= (lc->pos + lc->size)) break; + ok = 0; + new_pos = lc_moving->pos; + /* EINA_FUCK_REVERSE_FOREACH(eina_list_prev(l), l2, lc) */ + 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; - } + ok = 1; + new_pos -= lc->size; + } - if (new_pos < 0) - { - lc_moving->size += new_pos; - lc_moving->pos -= new_pos; + if (new_pos < 0) + { + lc_moving->size += new_pos; + lc_moving->pos -= new_pos; - bi = eina_list_data_get(lc_moving->items); - bi->w = lc_moving->size; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); + bi = eina_list_data_get(lc_moving->items); + bi->w = lc_moving->size; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - new_pos = 0; - } + new_pos = 0; + } - if (ok) - { - if (!l2) l2 = *list; - else l2 = eina_list_next(l2); + if (ok) + { + if (!l2) l2 = *list; + else l2 = eina_list_next(l2); - EINA_LIST_FOREACH(l2, l2, lc) - { - if (l2 == l) break; - lc->pos = new_pos; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc); - EINA_LIST_FOREACH(lc->items, l3, bi) - { - bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; - } - new_pos += lc->size; - } - } - } - else if ((l) && (!eina_list_prev(l))) - { - if (lc_moving->pos <= 0) - { - lc_moving->size = lc_moving->prev_size; - lc_moving->pos = 0; + EINA_LIST_FOREACH(l2, l2, lc) + { + if (l2 == l) break; + lc->pos = new_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + EINA_LIST_FOREACH(lc->items, l3, bi) + { + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + new_pos += lc->size; + } + } + } + else if ((l) && (!eina_list_prev(l))) + { + if (lc_moving->pos <= 0) + { + lc_moving->size = lc_moving->prev_size; + lc_moving->pos = 0; - bi = eina_list_data_get(lc_moving->items); - bi->w = lc_moving->size; + bi = eina_list_data_get(lc_moving->items); + bi->w = lc_moving->size; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc_moving); - } - } + _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); - if (lc_back) LC_FREE(lc_back); + lc_moving->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + if (lc_back) 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); - EINA_LIST_FOREACH(*list, l, lc) - if (lc == lc_moving) break; + _e_gadcon_layout_smart_restore_gadcons_position_before_move(sd, &lc_moving, lc_back, list); + EINA_LIST_FOREACH(*list, l, lc) + if (lc == lc_moving) break; - if ((l) && eina_list_next(l)) - { - Eina_List *stop = NULL; - int new_pos = 0; + if ((l) && eina_list_next(l)) + { + Eina_List *stop = NULL; + int new_pos = 0; - ok = 0; - new_pos = lc_moving->pos + lc_moving->size; - EINA_LIST_FOREACH(eina_list_next(l), l2, lc) - { - if (new_pos <= lc->pos) - { - stop = l2; - break; - } + ok = 0; + new_pos = lc_moving->pos + lc_moving->size; + EINA_LIST_FOREACH(eina_list_next(l), l2, lc) + { + if (new_pos <= lc->pos) + { + stop = l2; + break; + } - ok = 1; - /* new_pos += lc->size; */ - } + ok = 1; + /* new_pos += lc->size; */ + } - if (new_pos > sd->w) - { - lc_moving->size -= (new_pos - sd->w); - bi = eina_list_data_get(lc_moving->items); - bi->w = lc_moving->size; + if (new_pos > sd->w) + { + lc_moving->size -= (new_pos - sd->w); + bi = eina_list_data_get(lc_moving->items); + bi->w = lc_moving->size; - new_pos = lc_moving->pos + lc_moving->size; - } + new_pos = lc_moving->pos + lc_moving->size; + } - if (ok) - { - EINA_LIST_FOREACH(eina_list_next(l), l2, lc) - { - if (l2 == stop) break; - lc->pos = new_pos; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc); - EINA_LIST_FOREACH(lc->items, l3, bi) - { - bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; - } - new_pos += lc->size; - } - } - } - else if ((l) && (!eina_list_next(l))) - { - if ((lc_moving->pos + lc_moving->size) >= sd->w) - { - lc_moving->size = lc_moving->prev_size; - bi = eina_list_data_get(lc_moving->items); - bi->w = lc_moving->size; - } - } + if (ok) + { + EINA_LIST_FOREACH(eina_list_next(l), l2, lc) + { + if (l2 == stop) break; + lc->pos = new_pos; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + EINA_LIST_FOREACH(lc->items, l3, bi) + { + bi->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + } + new_pos += lc->size; + } + } + } + else if ((l) && (!eina_list_next(l))) + { + if ((lc_moving->pos + lc_moving->size) >= sd->w) + { + lc_moving->size = lc_moving->prev_size; + bi = eina_list_data_get(lc_moving->items); + bi->w = 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); - if (lc_back) LC_FREE(lc_back); + lc_moving->state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + _e_gadcon_layout_smart_gadcons_position_static(sd, list); + if (lc_back) LC_FREE(lc_back); } if (bi_moving) { - bi_moving->gcc->config.pos = bi_moving->ask.pos = bi_moving->x; - bi_moving->gcc->config.size = bi_moving->w; + bi_moving->gcc->config.pos = bi_moving->ask.pos = bi_moving->x; + bi_moving->gcc->config.size = bi_moving->w; } } @@ -4443,44 +4456,44 @@ _e_gadcon_layout_smart_gadcons_position_static(E_Smart_Data *sd, Eina_List **lis *list = eina_list_sort(*list, eina_list_count(*list), _e_gadcon_layout_smart_containers_sort_cb); - __reposition_again: +__reposition_again: EINA_LIST_FOREACH(*list, l, lc) { - if (!eina_list_next(l)) continue; + if (!eina_list_next(l)) continue; - lc2 = eina_list_data_get(eina_list_next(l)); + lc2 = eina_list_data_get(eina_list_next(l)); - if (LC_OVERLAP(lc, lc2)) - { - lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc2); - if (lc3) - { - l->data = lc3; - *list = eina_list_remove_list(*list, eina_list_next(l)); - LC_FREE(lc); - LC_FREE(lc2); - goto __reposition_again; - } - } + if (LC_OVERLAP(lc, lc2)) + { + lc3 = _e_gadcon_layout_smart_containers_position_adjust(sd, lc, lc2); + if (lc3) + { + l->data = lc3; + *list = eina_list_remove_list(*list, eina_list_next(l)); + LC_FREE(lc); + LC_FREE(lc2); + goto __reposition_again; + } + } } ok = 1; EINA_LIST_FOREACH(*list, l, lc) { - if (lc->pos < 0) - { - ok = 0; - lc->pos = 0; - _e_gadcon_layout_smart_position_items_inside_container(sd, lc); - continue; - } + if (lc->pos < 0) + { + ok = 0; + lc->pos = 0; + _e_gadcon_layout_smart_position_items_inside_container(sd, lc); + continue; + } - 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); - } + 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); + } } if (!ok) _e_gadcon_layout_smart_gadcons_position_static(sd, list); @@ -4498,312 +4511,312 @@ _e_gadcon_layout_smart_containers_position_adjust(E_Smart_Data *sd, E_Layout_Ite 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; + 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)) + (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE)) { - if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) - { - int t; + if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) + { + int t; - bi = eina_list_data_get(lc->items); - bi2 = eina_list_data_get(lc2->items); + bi = eina_list_data_get(lc->items); + bi2 = eina_list_data_get(lc2->items); - bi->x = ((bi2->x) + (bi2->w)) - (bi->w); - bi->gcc->config.pos = bi->ask.pos = bi->x; - bi->gcc->config.size = bi->w; - bi2->x = (bi->x) - (bi2->w); + bi->x = ((bi2->x) + (bi2->w)) - (bi->w); + bi->gcc->config.pos = bi->ask.pos = bi->x; + bi->gcc->config.size = bi->w; + bi2->x = (bi->x) - (bi2->w); - bi2->gcc->state_info.flags &= ~E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE; + 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; + 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); + } + 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); + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); - EINA_LIST_FOREACH(lc->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) - { - shift = bi->ask.pos - bi->x; - } + EINA_LIST_FOREACH(lc->items, l, bi) + { + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) + { + shift = bi->ask.pos - bi->x; + } - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - break; - } + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + break; + } - if (shift) - { - EINA_LIST_FOREACH(lc->items, l, bi) - { - bi->x += shift; - - if (l == lc->items) - lc->pos = bi->x; - } - } - } - } - create_new = 1; - new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + if (shift) + { + EINA_LIST_FOREACH(lc->items, l, bi) + { + bi->x += shift; + + if (l == lc->items) + lc->pos = bi->x; + } + } + } + } + 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)) + (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; + 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; - EINA_LIST_FOREACH(lc->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) - { - shift = bi->ask.pos - bi->x; - } + EINA_LIST_FOREACH(lc->items, l, bi) + { + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) + { + shift = bi->ask.pos - bi->x; + } - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - break; - } + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + break; + } - if (shift) - { - EINA_LIST_FOREACH(lc->items, l, bi) - { - bi->x += shift; + if (shift) + { + EINA_LIST_FOREACH(lc->items, l, bi) + { + bi->x += shift; - if (l == lc->items) - lc->pos = bi->x; - } - } - } - } - else if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) - { - int t; + if (l == lc->items) + lc->pos = bi->x; + } + } + } + } + else if (lc2->state == E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC) + { + int t; - bi = eina_list_data_get(eina_list_last(lc->items)); - bi2 = eina_list_data_get(lc2->items); + bi = eina_list_data_get(eina_list_last(lc->items)); + bi2 = eina_list_data_get(lc2->items); - bi2->gcc->config.pos = bi2->ask.pos = (bi2->x) = (bi->x); - bi2->gcc->config.size = bi2->w; - bi->x = bi2->x + bi2->w; + bi2->gcc->config.pos = bi2->ask.pos = (bi2->x) = (bi->x); + bi2->gcc->config.size = bi2->w; + bi->x = bi2->x + bi2->w; - t = bi->gcc->state_info.seq; - bi->gcc->state_info.seq = bi2->gcc->state_info.seq; - bi2->gcc->state_info.seq = t; + t = bi->gcc->state_info.seq; + bi->gcc->state_info.seq = bi2->gcc->state_info.seq; + bi2->gcc->state_info.seq = t; - lc->items = eina_list_remove_list(lc->items, eina_list_last(lc->items)); - lc->items = eina_list_append(lc->items, bi2); - lc->items = eina_list_append(lc->items, bi); - lc2->items = eina_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; + lc->items = eina_list_remove_list(lc->items, eina_list_last(lc->items)); + lc->items = eina_list_append(lc->items, bi2); + lc->items = eina_list_append(lc->items, bi); + lc2->items = eina_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)) + (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; + 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; - EINA_LIST_FOREACH(lc->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - { - move_lc1 = 0; - break; - } - } - EINA_LIST_FOREACH(lc2->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - { - move_lc2 = 0; - break; - } - } + EINA_LIST_FOREACH(lc->items, l, bi) + { + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc1 = 0; + break; + } + } + EINA_LIST_FOREACH(lc2->items, l, bi) + { + 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; + 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; - EINA_LIST_FOREACH(lc->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - { - move_lc1 = 0; - break; - } - } - EINA_LIST_FOREACH(lc2->items, l, bi) - { - if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) - { - move_lc2 = 0; - break; - } - } + EINA_LIST_FOREACH(lc->items, l, bi) + { + if (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE) + { + move_lc1 = 0; + break; + } + } + EINA_LIST_FOREACH(lc2->items, l, bi) + { + 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; + 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); + _e_gadcon_layout_smart_containers_merge(sd, lc, lc2); - EINA_LIST_FOREACH(lc->items, l, bi) - { - if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && - (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) - { - shift = bi->ask.pos - bi->x; - break; - } - } + EINA_LIST_FOREACH(lc->items, l, bi) + { + if ((bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_POSITION) && + (bi->gcc->state_info.flags & E_GADCON_LAYOUT_ITEM_LOCK_ABSOLUTE)) + { + shift = bi->ask.pos - bi->x; + break; + } + } - if (shift) - { - EINA_LIST_FOREACH(lc->items, l, bi) - { - bi->x += shift; - - if (l == lc->items) - lc->pos = bi->x; - } - } - } - create_new = 1; - new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; - } + if (shift) + { + EINA_LIST_FOREACH(lc->items, l, bi) + { + bi->x += shift; + + if (l == lc->items) + lc->pos = bi->x; + } + } + } + create_new = 1; + new_state = E_LAYOUT_ITEM_CONTAINER_STATE_POS_LOCKED; + } } if (create_new) { - lc3 = E_NEW(E_Layout_Item_Container, 1); - lc3->sd = sd; - if (lc->pos < lc2->pos) - { - lc3->pos = lc->pos; - EINA_LIST_FOREACH(lc->items, l, bi) - lc3->items = eina_list_append(lc3->items, bi); - EINA_LIST_FOREACH(lc2->items, l, bi) - lc3->items = eina_list_append(lc3->items, bi); + lc3 = E_NEW(E_Layout_Item_Container, 1); + lc3->sd = sd; + if (lc->pos < lc2->pos) + { + lc3->pos = lc->pos; + EINA_LIST_FOREACH(lc->items, l, bi) + lc3->items = eina_list_append(lc3->items, bi); + EINA_LIST_FOREACH(lc2->items, l, bi) + lc3->items = eina_list_append(lc3->items, bi); - 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; - EINA_LIST_FOREACH(lc2->items, l, bi) - lc3->items = eina_list_append(lc3->items, bi); - EINA_LIST_FOREACH(lc->items, l, bi) - lc3->items = eina_list_append(lc3->items, bi); + 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; + EINA_LIST_FOREACH(lc2->items, l, bi) + lc3->items = eina_list_append(lc3->items, bi); + EINA_LIST_FOREACH(lc->items, l, bi) + lc3->items = eina_list_append(lc3->items, bi); - 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; + 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 __UNUSED__, E_Layout_Item_Container *lc) @@ -4816,20 +4829,20 @@ _e_gadcon_layout_smart_position_items_inside_container(E_Smart_Data *sd __UNUSED bi = eina_list_data_get(lc->items); shift = lc->pos - bi->x; - + if (!shift) return; EINA_LIST_FOREACH(lc->items, l, bi) { - bi->x += shift; - - if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) || - (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC)) - { - bi->gcc->config.pos = bi->ask.pos = bi->x; - } + bi->x += shift; + + if ((bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_DEC) || + (bi->gcc->state_info.state == E_LAYOUT_ITEM_STATE_POS_INC)) + { + bi->gcc->config.pos = bi->ask.pos = bi->x; + } } -} +} static void _e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd __UNUSED__, E_Layout_Item_Container *lc, E_Layout_Item_Container *lc2) @@ -4847,21 +4860,21 @@ _e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd __UNUSED__, E_Layout_It EINA_LIST_FOREACH(nl, l, bi) { - if (l == nl) - { - min_seq = max_seq = bi->gcc->state_info.seq; - start = bi->x; - size = bi->w; - next = bi->x + bi->w; + if (l == nl) + { + min_seq = max_seq = bi->gcc->state_info.seq; + start = bi->x; + size = bi->w; + next = bi->x + bi->w; - continue; - } + continue; + } - max_seq = bi->gcc->state_info.seq; + max_seq = bi->gcc->state_info.seq; - bi->x = next; - size += bi->w; - next = bi->x + bi->w; + bi->x = next; + size += bi->w; + next = bi->x + bi->w; } lc->items = eina_list_free(lc->items); @@ -4873,7 +4886,7 @@ _e_gadcon_layout_smart_containers_merge(E_Smart_Data *sd __UNUSED__, E_Layout_It 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, Eina_List **con_list) @@ -4884,15 +4897,15 @@ _e_gadcon_layout_smart_restore_gadcons_position_before_move(E_Smart_Data *sd, E_ 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) || + 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 = eina_list_data_get((*lc_moving)->items); + (*lc_moving)->size = (*lc_moving)->prev_size; + bi = eina_list_data_get((*lc_moving)->items); - bi->w = (*lc_moving)->prev_size; + bi->w = (*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; @@ -4903,111 +4916,111 @@ _e_gadcon_layout_smart_restore_gadcons_position_before_move(E_Smart_Data *sd, E_ ok = 0; EINA_LIST_FOREACH(*con_list, l, lc) { - if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) continue; + if (lc->state == E_LAYOUT_ITEM_CONTAINER_STATE_NONE) continue; - if (eina_list_count(lc->items) == 1) - { - bi = eina_list_data_get(lc->items); - if (bi->gcc->state_info.state != E_LAYOUT_ITEM_STATE_NONE) - { - LC_FREE(lc); - l->data = *lc_moving = lc_back; - _e_gadcon_layout_smart_position_items_inside_container(sd, (*lc_moving)); + if (eina_list_count(lc->items) == 1) + { + bi = eina_list_data_get(lc->items); + if (bi->gcc->state_info.state != E_LAYOUT_ITEM_STATE_NONE) + { + 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 = eina_list_data_get((*lc_moving)->items); - bi->w = (*lc_moving)->size; - } - } - } - else - { - EINA_LIST_FOREACH(lc->items, l2, bi) - { - if (bi->gcc->state_info.state != E_LAYOUT_ITEM_STATE_NONE) - { - 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; - EINA_LIST_FOREACH(lc->items, l3, bi2) - { - if(l2 == l3) break; - lc2->items = eina_list_append(lc2->items, bi2); - if (l3 == lc->items) - { - lc2->state_info.min_seq = bi2->gcc->state_info.seq; - lc2->pos = lc2->prev_pos = bi2->x; - } - lc2->state_info.max_seq = bi2->gcc->state_info.seq; - E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc2, bi2, 1); - } - } + if (((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) && + ((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)) + { + bi = eina_list_data_get((*lc_moving)->items); + bi->w = (*lc_moving)->size; + } + } + } + else + { + EINA_LIST_FOREACH(lc->items, l2, bi) + { + if (bi->gcc->state_info.state != E_LAYOUT_ITEM_STATE_NONE) + { + 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; + EINA_LIST_FOREACH(lc->items, l3, bi2) + { + if (l2 == l3) break; + lc2->items = eina_list_append(lc2->items, bi2); + if (l3 == lc->items) + { + lc2->state_info.min_seq = bi2->gcc->state_info.seq; + lc2->pos = lc2->prev_pos = bi2->x; + } + lc2->state_info.max_seq = bi2->gcc->state_info.seq; + E_LAYOUT_ITEM_CONTAINER_SIZE_CHANGE_BY(lc2, bi2, 1); + } + } - if (eina_list_next(l2)) - { - lc3 = E_NEW(E_Layout_Item_Container, 1); - lc3->sd = sd; - lc3->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; - EINA_LIST_FOREACH(eina_list_next(l2), l3, bi2) - { - lc3->items = eina_list_append(lc3->items, bi2); - if (l3 == eina_list_next(l2)) - { - lc3->state_info.min_seq = bi2->gcc->state_info.seq; - lc3->pos = lc3->prev_pos = bi2->x; - } - 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 (eina_list_next(l2)) + { + lc3 = E_NEW(E_Layout_Item_Container, 1); + lc3->sd = sd; + lc3->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + EINA_LIST_FOREACH(eina_list_next(l2), l3, bi2) + { + lc3->items = eina_list_append(lc3->items, bi2); + if (l3 == eina_list_next(l2)) + { + lc3->state_info.min_seq = bi2->gcc->state_info.seq; + lc3->pos = lc3->prev_pos = bi2->x; + } + 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 = eina_list_data_get((*lc_moving)->items); - bi->w = (*lc_moving)->size; - } - break; - } - } - if (ok) - { - LC_FREE(lc); - if (lc2) - { - l->data = lc2; - *con_list = eina_list_append(*con_list, *lc_moving); - if (lc3) - *con_list = eina_list_append(*con_list, lc3); - *con_list = eina_list_sort(*con_list, eina_list_count(*con_list), - _e_gadcon_layout_smart_containers_sort_cb); - } - else - { - l->data = *lc_moving; - if (lc3) - { - *con_list = eina_list_append(*con_list, lc3); - *con_list = eina_list_sort(*con_list, eina_list_count(*con_list), - _e_gadcon_layout_smart_containers_sort_cb); - } - } - break; - } - } + if (((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_INC) && + ((*lc_moving)->state != E_LAYOUT_ITEM_CONTAINER_STATE_POS_DEC)) + { + bi = eina_list_data_get((*lc_moving)->items); + bi->w = (*lc_moving)->size; + } + break; + } + } + if (ok) + { + LC_FREE(lc); + if (lc2) + { + l->data = lc2; + *con_list = eina_list_append(*con_list, *lc_moving); + if (lc3) + *con_list = eina_list_append(*con_list, lc3); + *con_list = eina_list_sort(*con_list, eina_list_count(*con_list), + _e_gadcon_layout_smart_containers_sort_cb); + } + else + { + l->data = *lc_moving; + if (lc3) + { + *con_list = eina_list_append(*con_list, lc3); + *con_list = eina_list_sort(*con_list, eina_list_count(*con_list), + _e_gadcon_layout_smart_containers_sort_cb); + } + } + break; + } + } } EINA_LIST_FOREACH(*con_list, l, lc) { - if (lc == *lc_moving) continue; - lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; + if (lc == *lc_moving) continue; + lc->state = E_LAYOUT_ITEM_CONTAINER_STATE_NONE; } } @@ -5020,15 +5033,15 @@ _e_gadcon_custom_populate_idler(void *data __UNUSED__) EINA_LIST_FREE(custom_populate_requests, gc) { - e_gadcon_layout_freeze(gc->o_container); - EINA_LIST_FOREACH(providers_list, l, cc) - { - if (gc->populate_class.func) - gc->populate_class.func(gc->populate_class.data, gc, cc); - else - e_gadcon_populate_class(gc, cc); - } - e_gadcon_layout_thaw(gc->o_container); + e_gadcon_layout_freeze(gc->o_container); + EINA_LIST_FOREACH(providers_list, l, cc) + { + if (gc->populate_class.func) + gc->populate_class.func(gc->populate_class.data, gc, cc); + else + e_gadcon_populate_class(gc, cc); + } + e_gadcon_layout_thaw(gc->o_container); } custom_populate_idler = NULL; @@ -5047,13 +5060,13 @@ _e_gadcon_provider_populate_idler(void *data __UNUSED__) EINA_LIST_FREE(populate_requests, cc) { - EINA_LIST_FOREACH(gadcons, l, gc) - { - if (gc->populate_class.func) - gc->populate_class.func(gc->populate_class.data, gc, cc); - else - e_gadcon_populate_class(gc, cc); - } + EINA_LIST_FOREACH(gadcons, l, gc) + { + if (gc->populate_class.func) + gc->populate_class.func(gc->populate_class.data, gc, cc); + else + e_gadcon_populate_class(gc, cc); + } } EINA_LIST_FOREACH(gadcons, l, gc) @@ -5078,30 +5091,30 @@ _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc) populate_requests = eina_list_remove(populate_requests, cc); if ((!populate_requests) && (populate_idler)) { - ecore_idler_del(populate_idler); - populate_idler = NULL; + ecore_idler_del(populate_idler); + populate_idler = NULL; } } /* gadgets movement between different gadcons */ EAPI E_Gadcon_Location * -e_gadcon_location_new(const char * name, - E_Gadcon_Site site, - int (*add_func) (void *data, const E_Gadcon_Client_Class *cc), - void * add_data, - void (*remove_func) (void *data, E_Gadcon_Client *cc), - void * remove_data) +e_gadcon_location_new(const char *name, + E_Gadcon_Site site, + int (*add_func)(void *data, const E_Gadcon_Client_Class *cc), + void *add_data, + void (*remove_func)(void *data, E_Gadcon_Client *cc), + void *remove_data) { E_Gadcon_Location *loc; - loc = E_NEW(E_Gadcon_Location, 1); + loc = E_NEW(E_Gadcon_Location, 1); loc->name = eina_stringshare_add(name); loc->site = site; - loc->gadget_add.func = add_func; - loc->gadget_add.data = add_data; - loc->gadget_remove.func = remove_func; - loc->gadget_remove.data = remove_data; + loc->gadget_add.func = add_func; + loc->gadget_add.data = add_data; + loc->gadget_remove.func = remove_func; + loc->gadget_remove.data = remove_data; loc->icon_name = NULL; return loc; } @@ -5125,19 +5138,19 @@ e_gadcon_location_free(E_Gadcon_Location *loc) } EAPI void -e_gadcon_location_register(E_Gadcon_Location * loc) +e_gadcon_location_register(E_Gadcon_Location *loc) { gadcon_locations = eina_list_append(gadcon_locations, loc); } EAPI void -e_gadcon_location_unregister(E_Gadcon_Location * loc) +e_gadcon_location_unregister(E_Gadcon_Location *loc) { gadcon_locations = eina_list_remove(gadcon_locations, loc); } static int -_e_gadcon_location_change(E_Gadcon_Client * gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst) +_e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon_Location *dst) { E_Gadcon_Client_Class *cc;