diff --git a/data/themes/default_shelf.edc b/data/themes/default_shelf.edc index 0e2edc53b..ec3b454ed 100644 --- a/data/themes/default_shelf.edc +++ b/data/themes/default_shelf.edc @@ -1,6 +1,6 @@ images { image: "e17_shelf_bg_h.png" COMP; - image: "e17_shelf_sh_h.png" COMP; + image: "e17_shelf_bg_v.png" COMP; image: "e17_ibar_bg_h.png" COMP; image: "e17_ibar_over_h.png" COMP; } @@ -12,31 +12,6 @@ group { item: "shaped" "1"; } parts { - part { - name: "shadow"; - mouse_events: 0; - description { - state: "default" 0.0; - visible: 0; - rel1 { - to: "base"; - relative: 0.0 0.0; - offset: -5 -5; - } - rel2 { - to: "base"; - relative: 1.0 1.0; - offset: 12 12; - } - image { - normal: "e17_shelf_sh_h.png"; - border: 19 19 19 19; - } - fill { - smooth: 0; - } - } - } part { name: "base"; mouse_events: 0; @@ -115,6 +90,96 @@ group { } } } + description { + state: "left" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: -6 0; + } + size { + offset: 6 0; + } + } + } + description { + state: "left_top" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: -6 -16; + } + size { + offset: 6 16; + } + } + } + description { + state: "left_bottom" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: -6 0; + } + size { + offset: 6 16; + } + } + } + description { + state: "right" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: 0 0; + } + size { + offset: 6 0; + } + } + } + description { + state: "right_top" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: 0 -16; + } + size { + offset: 6 16; + } + } + } + description { + state: "right_bottom" 0.0; + image { + normal: "e17_shelf_bg_v.png"; + border: 9 9 19 19; + } + fill { + origin { + offset: 0 0; + } + size { + offset: 6 16; + } + } + } } part { name: "items"; @@ -186,6 +251,72 @@ group { offset: -3 -3; } } + description { + state: "left" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 18; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -19; + } + } + description { + state: "left_top" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -19; + } + } + description { + state: "left_bottom" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 18; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + } + } + description { + state: "right" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 18; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -19; + } + } + description { + state: "right_top" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -19; + } + } + description { + state: "right_bottom" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 18; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + } + } } } programs { @@ -237,6 +368,54 @@ group { target: "base"; target: "items"; } + program { + name: "orient7"; + signal: "set_orientation"; + source: "left"; + action: STATE_SET "left" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient8"; + signal: "set_orientation"; + source: "left_top"; + action: STATE_SET "left_top" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient9"; + signal: "set_orientation"; + source: "left_bottom"; + action: STATE_SET "left_bottom" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient10"; + signal: "set_orientation"; + source: "right"; + action: STATE_SET "right" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient11"; + signal: "set_orientation"; + source: "right_top"; + action: STATE_SET "right_top" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient12"; + signal: "set_orientation"; + source: "right_bottom"; + action: STATE_SET "right_bottom" 0.0; + target: "base"; + target: "items"; + } } } group { diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index f0b3fa420..c2a36eb10 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -196,11 +196,9 @@ e_gadcon_populate(E_Gadcon *gc) E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); ok = 0; e_gadcon_layout_freeze(gc->o_container); - printf("e_config->gadcons = %p\n", e_config->gadcons); for (l = e_config->gadcons; l; l = l->next) { cf_gc = l->data; - printf("%s == %s, %s == %s\n", cf_gc->name, gc->name, cf_gc->id, gc->id); if ((!strcmp(cf_gc->name, gc->name)) && (!strcmp(cf_gc->id, gc->id))) { @@ -371,6 +369,7 @@ e_gadcon_edit_begin(E_Gadcon *gc) E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); e_gadcon_layout_freeze(gc->o_container); + gc->editing = 1; for (l = gc->clients; l; l = l->next) { E_Gadcon_Client *gcc; @@ -389,6 +388,7 @@ e_gadcon_edit_end(E_Gadcon *gc) E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); e_gadcon_layout_freeze(gc->o_container); + gc->editing = 0; for (l = gc->clients; l; l = l->next) { E_Gadcon_Client *gcc; @@ -723,7 +723,6 @@ e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h) E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE); gcc->aspect.w = w; gcc->aspect.h = h; - printf("ASPECt: %i %i\n", w, h); if ((!gcc->autoscroll) && (!gcc->resizable)) { if (gcc->o_frame) @@ -856,6 +855,18 @@ _e_gadcon_client_cb_menu_resizable(void *data, E_Menu *m, E_Menu_Item *mi) e_gadcon_populate(gc); } +static void +_e_gadcon_client_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Gadcon_Client *gcc; + + gcc = data; + if (gcc->o_control) + e_gadcon_client_edit_end(gcc); + else + e_gadcon_client_edit_begin(gcc); +} + EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags) { @@ -884,6 +895,14 @@ e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int f 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); + if (gcc->o_control) + e_menu_item_label_set(mi, _("Stop editing")); + else + e_menu_item_label_set(mi, _("Begin editing")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/edit"); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_edit, gcc); } static void @@ -1196,7 +1215,27 @@ _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_in ev = event_info; if (ev->button == 3) { - printf("THREE! %p\n", gcc); + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + 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 editing")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/edit"); + e_menu_item_callback_set(mi, _e_gadcon_client_cb_menu_edit, gcc); + + e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -1878,7 +1917,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) x = sd->x; y = sd->y; w = sd->w; h = sd->h; min = mino = cur = 0; - printf("HORIZ: %i\n", sd->horizontal); for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -1943,8 +1981,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) } } - printf("CUR = %i | %i %i\n", cur, min, mino); - if (sd->horizontal) { if (cur <= w) @@ -1958,7 +1994,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) sub = cur - w; /* we need to find "sub" extra pixels */ if (min <= w) { - printf("blum\n"); for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -1970,13 +2005,11 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) if (give < sub) give = sub; bi->ask.size2 = bi->ask.size - give; sub -= give; - printf("GIVE: %i\n", give); if (sub <= 0) break; } } else { /* EEK - all items just cant fit at their minimum! what do we do? */ - printf("EEK - nofit!\n"); num = 0; num = evas_list_count(sd->items); give = min - w; // how much give total below minw we need @@ -2016,7 +2049,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) sub = cur - h; /* we need to find "sub" extra pixels */ if (min <= h) { - printf("blum\n"); for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -2028,13 +2060,11 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) if (give < sub) give = sub; bi->ask.size2 = bi->ask.size - give; sub -= give; - printf("GIVE: %i\n", give); if (sub <= 0) break; } } else { /* EEK - all items just cant fit at their minimum! what do we do? */ - printf("EEK - nofit!\n"); num = 0; num = evas_list_count(sd->items); give = min - h; // how much give total below minw we need @@ -2429,7 +2459,6 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) evas_list_free(list_e); evas_list_free(list); - printf("-------------------v\n"); for (l = sd->items; l; l = l->next) { E_Gadcon_Layout_Item *bi; @@ -2449,13 +2478,9 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) xx = x + ((w - bi->w) / 2); yy = y + bi->y; } - printf("%p -> %i,%i [%i,%i], %ix%i\n", - obj, - xx, yy, bi->x, bi->y, bi->w, bi->h); evas_object_move(obj, xx, yy); evas_object_resize(obj, bi->w, bi->h); } - printf("-------------------^\n"); sd->doing_config = 0; if (sd->redo_config) { diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index ea6ffb11e..e6e8aaa2d 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -70,6 +70,8 @@ struct _E_Gadcon Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style); void *data; } frame_request; + + unsigned char editing : 1; }; #define GADCON_CLIENT_CLASS_VERSION 1 diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c index 817671411..2f7256dbc 100644 --- a/src/bin/e_int_menus.c +++ b/src/bin/e_int_menus.c @@ -822,12 +822,12 @@ _e_int_menus_gadgets_edit_mode_cb(void *data, E_Menu *m, E_Menu_Item *mi) gm = data; if (e_menu_item_toggle_get(mi)) { - e_gadcon_all_edit_begin(); +// e_gadcon_all_edit_begin(); e_gadman_mode_set(gm, E_GADMAN_MODE_EDIT); } else { - e_gadcon_all_edit_end(); +// e_gadcon_all_edit_end(); e_gadman_mode_set(gm, E_GADMAN_MODE_NORMAL); } } diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 98ee62160..a85cf4417 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -422,6 +422,12 @@ e_shelf_position_calc(E_Shelf *es) static void _e_shelf_free(E_Shelf *es) { + if (es->menu) + { + e_menu_post_deactivate_callback_set(es->menu, NULL, NULL); + e_object_del(E_OBJECT(es->menu)); + es->menu = NULL; + } if (es->config_dialog) e_object_del(E_OBJECT(es->config_dialog)); shelves = evas_list_remove(shelves, es); e_object_del(E_OBJECT(es->gadcon)); @@ -509,7 +515,6 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord nw = es->w; nh = es->h; ww = hh = 0; - printf("req = %i %i\n", w, h); evas_object_geometry_get(gc->o_container, NULL, NULL, &ww, &hh); switch (gc->orient) { @@ -537,10 +542,8 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord default: break; } - printf("adj min = %i %i\n", w, h); e_gadcon_swallowed_min_size_set(gc, w, h); edje_object_size_min_calc(es->o_base, &nw, &nh); - printf("new w, h = %i %i\n", nw, nh); switch (gc->orient) { case E_GADCON_ORIENT_FLOAT: @@ -687,6 +690,38 @@ _e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *styl return o; } +static void +_e_shelf_cb_menu_config(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Shelf *es; + + es = data; + if (!es->config_dialog) e_int_shelf_config(es); +} + +static void +_e_shelf_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Shelf *es; + + es = data; + if (es->gadcon->editing) + e_gadcon_edit_end(es->gadcon); + else + e_gadcon_edit_begin(es->gadcon); +} + +static void +_e_shelf_cb_menu_post(void *data, E_Menu *m) +{ + E_Shelf *es; + + es = data; + if (!es->menu) return; + e_object_del(E_OBJECT(es->menu)); + es->menu = NULL; +} + static void _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) { @@ -697,7 +732,34 @@ _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_inf ev = event_info; if (ev->button == 3) { - if (!es->config_dialog) e_int_shelf_config(es); + E_Menu *mn; + E_Menu_Item *mi; + int cx, cy, cw, ch; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _e_shelf_cb_menu_post, es); + es->menu = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, _("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/config"); + e_menu_item_callback_set(mi, _e_shelf_cb_menu_config, es); + + mi = e_menu_item_new(mn); + if (es->gadcon->editing) + e_menu_item_label_set(mi, _("Stop editing items")); + else + e_menu_item_label_set(mi, _("Begin editing items")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/edit"); + e_menu_item_callback_set(mi, _e_shelf_cb_menu_edit, es); + + e_gadcon_canvas_zone_geometry_get(es->gadcon, &cx, &cy, &cw, &ch); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(es->gadcon->evas, ev->button, + EVAS_BUTTON_NONE, ev->timestamp, NULL); } } diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 349d89633..5f20b4939 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -31,6 +31,7 @@ struct _E_Shelf unsigned char fit_size : 1; int size; E_Config_Dialog *config_dialog; + E_Menu *menu; }; EAPI int e_shelf_init(void);