diff --git a/data/themes/default_shelf.edc b/data/themes/default_shelf.edc index ed8284e2c..0e2edc53b 100644 --- a/data/themes/default_shelf.edc +++ b/data/themes/default_shelf.edc @@ -39,46 +39,81 @@ group { } part { name: "base"; - clip_to: "base_clip"; mouse_events: 0; description { state: "default" 0.0; - rel1 { - relative: 0.0 0.0; - offset: 0 -6; - } - rel2 { - relative: 1.0 1.0; - offset: -1 0; - } image { normal: "e17_shelf_bg_h.png"; border: 19 19 9 9; } + fill { + origin { + offset: 0 -6; + } + size { + offset: 0 6; + } + } + } + description { + state: "top_left" 0.0; + inherit: "default" 0.0; + fill { + origin { + offset: -16 -6; + } + size { + offset: 16 6; + } + } + } + description { + state: "top_right" 0.0; + inherit: "default" 0.0; + fill { + origin { + offset: 0 -6; + } + size { + offset: 16 6; + } + } } description { state: "bottom" 0.0; - rel1 { - relative: 0.0 0.0; - offset: 0 0; - } - rel2 { - relative: 1.0 1.0; - offset: -1 7; - } - image { - normal: "e17_shelf_bg_h.png"; - border: 19 19 9 9; + inherit: "default" 0.0; + fill { + origin { + offset: 0 0; + } + size { + offset: 0 6; + } } } - } - part { - name: "base_clip"; - type: RECT; - mouse_events: 0; description { - state: "default" 0.0; - color: 255 255 255 255; + state: "bottom_left" 0.0; + inherit: "default" 0.0; + fill { + origin { + offset: -16 0; + } + size { + offset: 16 6; + } + } + } + description { + state: "bottom_right" 0.0; + inherit: "default" 0.0; + fill { + origin { + offset: 0 0; + } + size { + offset: 16 6; + } + } } } part { @@ -96,6 +131,61 @@ group { offset: -19 -3; } } + description { + state: "top_left" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + relative: 1.0 1.0; + offset: -19 -3; + } + } + description { + state: "top_right" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 18 2; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + } + } + description { + state: "bottom" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 18 2; + } + rel2 { + relative: 1.0 1.0; + offset: -19 -3; + } + } + description { + state: "bottom_left" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 2 2; + } + rel2 { + relative: 1.0 1.0; + offset: -19 -3; + } + } + description { + state: "bottom_right" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 18 2; + } + rel2 { + relative: 1.0 1.0; + offset: -3 -3; + } + } } } programs { @@ -105,13 +195,47 @@ group { source: "top"; action: STATE_SET "default" 0.0; target: "base"; + target: "items"; } program { name: "orient2"; signal: "set_orientation"; + source: "top_left"; + action: STATE_SET "top_left" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient3"; + signal: "set_orientation"; + source: "top_right"; + action: STATE_SET "top_right" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient4"; + signal: "set_orientation"; source: "bottom"; action: STATE_SET "bottom" 0.0; target: "base"; + target: "items"; + } + program { + name: "orient5"; + signal: "set_orientation"; + source: "bottom_left"; + action: STATE_SET "bottom_left" 0.0; + target: "base"; + target: "items"; + } + program { + name: "orient6"; + signal: "set_orientation"; + source: "bottom_right"; + action: STATE_SET "bottom_right" 0.0; + target: "base"; + target: "items"; } } } diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index ca5339b4f..882122f35 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -151,7 +151,8 @@ e_stolen.h \ e_gadcon.h \ e_shelf.h \ e_widget_preview.h \ -e_int_config_paths.h +e_int_config_paths.h \ +e_int_shelf_config.h enlightenment_src = \ e_user.c \ @@ -284,6 +285,7 @@ e_gadcon.c \ e_shelf.c \ e_widget_preview.c \ e_int_config_paths.c \ +e_int_shelf_config.c \ $(ENLIGHTENMENTHEADERS) enlightenment_SOURCES = \ diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index bb6aa3cae..f0b3fa420 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -319,43 +319,46 @@ EAPI void e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient) { Evas_List *l; + int horiz = 0; E_OBJECT_CHECK(gc); E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); if (gc->orient == orient) return; gc->orient = orient; e_gadcon_layout_freeze(gc->o_container); + switch (gc->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: + horiz = 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: + horiz = 0; + break; + default: + break; + } + e_gadcon_layout_orientation_set(gc->o_container, horiz); for (l = gc->clients; l; l = l->next) { E_Gadcon_Client *gcc; gcc = l->data; + e_box_orientation_set(gcc->o_box, horiz); if (gcc->client_class->func.orient) gcc->client_class->func.orient(gcc); - 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; - } } e_gadcon_layout_thaw(gc->o_container); } @@ -720,6 +723,7 @@ 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) @@ -1873,7 +1877,8 @@ _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; @@ -2000,6 +2005,61 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) } else { + if (cur <= h) + { + /* all is fine - it should all fit */ + } + else + { + int sub, give, num, given, i; + + 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; + Evas_Object *obj; + + obj = l->data; + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + give = bi->ask.size - bi->min.h; // how much give does this have? + if (give < sub) give = sub; + bi->ask.size2 = bi->ask.size - give; + sub -= give; + 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 + given = 0; + for (l = sd->items; l; l = l->next) + { + E_Gadcon_Layout_Item *bi; + Evas_Object *obj; + + obj = l->data; + bi = evas_object_data_get(obj, "e_gadcon_layout_data"); + bi->ask.size2 = bi->min.h; + if (!l->next) + { + bi->ask.size2 -= (give - given); + } + else + { + i = (give + (num / 2)) / num; + given -= i; + bi->ask.size2 -= i; + } + } + } + } } for (l = sd->items; l; l = l->next) @@ -2094,7 +2154,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) bi->hookp = bi->ask.res / 2; } if (bi->y < 0) bi->y = 0; - else if ((bi->y + bi->h) > h) bi->y = h - bi->y; + else if ((bi->y + bi->h) > h) bi->y = h - bi->h; } } list_s = evas_list_sort(list_s, evas_list_count(list_s), _e_gadcon_sort_cb); @@ -2115,10 +2175,21 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) obj = l2->data; bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + if (sd->horizontal) { - bi->x = bi2->x + bi2->w; - goto again1; + if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + { + bi->x = bi2->x + bi2->w; + goto again1; + } + } + else + { + if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) + { + bi->y = bi2->y + bi2->h; + goto again1; + } } } } @@ -2136,13 +2207,27 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) obj = l2->data; bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + if (sd->horizontal) { - if ((bi2->x + (bi2->w / 2)) < (w / 2)) - bi->x = bi2->x - bi->w; - else - bi->x = bi2->x + bi2->w; - goto again2; + if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + { + if ((bi2->x + (bi2->w / 2)) < (w / 2)) + bi->x = bi2->x - bi->w; + else + bi->x = bi2->x + bi2->w; + goto again2; + } + } + else + { + if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) + { + if ((bi2->y + (bi2->h / 2)) < (h / 2)) + bi->y = bi2->y - bi->h; + else + bi->y = bi2->y + bi2->h; + goto again2; + } } } } @@ -2160,10 +2245,21 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) obj = l2->data; bi2 = evas_object_data_get(obj, "e_gadcon_layout_data"); - if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + if (sd->horizontal) { - bi->x = bi2->x - bi->w; - goto again3; + if (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + { + bi->x = bi2->x - bi->w; + goto again3; + } + } + else + { + if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) + { + bi->y = bi2->y - bi->h; + goto again3; + } } } } @@ -2175,20 +2271,42 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd) obj = l->data; bi = evas_object_data_get(obj, "e_gadcon_layout_data"); bi->can_move = 1; - if (!l->prev) + if (sd->horizontal) { - if (bi->x <= 0) + if (!l->prev) { - bi->x = 0; - bi->can_move = 0; + if (bi->x <= 0) + { + bi->x = 0; + bi->can_move = 0; + } + } + if (!l->next) + { + if ((bi->x + bi->w) >= w) + { + bi->x = w - bi->w; + bi->can_move = 0; + } } } - if (!l->next) + else { - if ((bi->x + bi->w) >= w) + if (!l->prev) { - bi->x = w - bi->w; - bi->can_move = 0; + if (bi->y <= 0) + { + bi->y = 0; + bi->can_move = 0; + } + } + if (!l->next) + { + if ((bi->y + bi->h) >= h) + { + bi->y = h - bi->h; + bi->can_move = 0; + } } } } @@ -2311,6 +2429,7 @@ _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; @@ -2330,9 +2449,13 @@ _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_includes.h b/src/bin/e_includes.h index 052792de2..436713057 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -132,3 +132,4 @@ #include "e_widget_tlist.h" #include "e_widget_preview.h" #include "e_int_config_paths.h" +#include "e_int_shelf_config.h" diff --git a/src/bin/e_int_border_border.c b/src/bin/e_int_border_border.c index 05187ef2c..ff43559e2 100644 --- a/src/bin/e_int_border_border.c +++ b/src/bin/e_int_border_border.c @@ -186,12 +186,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf if (!strcmp(cfdata->border->client.border.name, (char *)l->data)) sel = n; } - e_widget_ilist_selected_set(oi, sel); - e_widget_min_size_get(oi, &wmw, &wmh); e_widget_min_size_set(oi, wmw, 250); e_widget_ilist_go(oi); + e_widget_ilist_selected_set(oi, sel); e_widget_list_object_append(o, oi, 1, 1, 0.5); diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c new file mode 100644 index 000000000..1fe701165 --- /dev/null +++ b/src/bin/e_int_shelf_config.c @@ -0,0 +1,220 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" + +/* PROTOTYPES - same all the time */ +//typedef struct _CFBorder CFBorder; + +static void *_create_data(E_Config_Dialog *cfd); +static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); + +/* Actual config data we will be playing with whil the dialog is active */ +struct _E_Config_Dialog_Data +{ + E_Shelf *es; + E_Config_Shelf *escfg; + char *style; + int orient; + int fit_along; + int fit_size; + int size; + int layering; +}; + +//struct _CFBorder +//{ +// E_Config_Dialog_Data *cfdata; +// const char *bordername; +//}; + +/* a nice easy setup function that does the dirty work */ +EAPI void +e_int_shelf_config(E_Shelf *es) +{ + E_Config_Dialog *cfd; + E_Config_Dialog_View *v; + + v = E_NEW(E_Config_Dialog_View, 1); + if (v) + { + /* methods */ + v->create_cfdata = _create_data; + v->free_cfdata = _free_data; + v->basic.apply_cfdata = _basic_apply_data; + v->basic.create_widgets = _basic_create_widgets; + v->override_auto_apply = 1; + + /* create config diaolg for bd object/data */ + cfd = e_config_dialog_new(es->zone->container, + _("BLAH"), NULL, 0, v, es); + es->config_dialog = cfd; + } +} + +/**--CREATE--**/ +static void +_fill_data(E_Config_Dialog_Data *cfdata) +{ + if (cfdata->escfg->style) + cfdata->style = strdup(cfdata->escfg->style); + else + cfdata->style = strdup(""); + cfdata->orient = cfdata->escfg->orient; + cfdata->fit_along = cfdata->escfg->fit_along; + cfdata->fit_size = cfdata->escfg->fit_size; + cfdata->size = cfdata->escfg->size; + if ((!cfdata->escfg->popup) && + (cfdata->escfg->layer == 1)) + cfdata->layering = 0; + else if ((cfdata->escfg->popup) && + (cfdata->escfg->layer == 0)) + cfdata->layering = 1; + else if ((cfdata->escfg->popup) && + (cfdata->escfg->layer == 200)) + cfdata->layering = 2; + else + cfdata->layering = 2; +} + +static void * +_create_data(E_Config_Dialog *cfd) +{ + /* Create cfdata - cfdata is a temporary block of config data that this + * dialog will be dealing with while configuring. it will be applied to + * the running systems/config in the apply methods + */ + E_Config_Dialog_Data *cfdata; + + cfdata = E_NEW(E_Config_Dialog_Data, 1); + cfdata->es = cfd->data; + cfdata->escfg = cfdata->es->cfg; + _fill_data(cfdata); + return cfdata; +} + +static void +_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +{ + /* Free the cfdata */ + cfdata->es->config_dialog = NULL; + if (cfdata->style) free(cfdata->style); + free(cfdata); +} + +/**--APPLY--**/ +static int +_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +{ + E_Zone *zone; + int id; + + cfdata->escfg->orient = cfdata->orient; + cfdata->escfg->fit_along = cfdata->fit_along; + cfdata->escfg->fit_size = cfdata->fit_size; + cfdata->escfg->size = cfdata->size; + + printf("%i %i %i\n", cfdata->fit_along, cfdata->fit_size, cfdata->size); + + if (cfdata->escfg->style) evas_stringshare_del(cfdata->escfg->style); + cfdata->escfg->style = evas_stringshare_add(cfdata->style); + if (cfdata->layering == 0) + { + cfdata->escfg->popup = 0; + cfdata->escfg->layer = 1; + } + else if (cfdata->layering == 1) + { + cfdata->escfg->popup = 1; + cfdata->escfg->layer = 0; + } + else if (cfdata->layering == 2) + { + cfdata->escfg->popup = 1; + cfdata->escfg->layer = 200; + } + zone = cfdata->es->zone; + id = cfdata->es->id; + cfdata->es->config_dialog = NULL; + e_object_del(cfdata->es); + cfdata->es = e_shelf_zone_new(zone, cfdata->escfg->name, + cfdata->escfg->style, + cfdata->escfg->popup, + cfdata->escfg->layer, id); + cfdata->es->cfg = cfdata->escfg; + cfdata->es->fit_along = cfdata->escfg->fit_along; + cfdata->es->fit_size = cfdata->escfg->fit_size; + e_shelf_orient(cfdata->es, cfdata->escfg->orient); + e_shelf_position_calc(cfdata->es); + e_shelf_populate(cfdata->es); + e_shelf_show(cfdata->es); + e_config_save_queue(); + cfdata->es->config_dialog = cfd; + return 1; /* Apply was OK */ +} + +/**--GUI--**/ +static Evas_Object * +_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) +{ + /* generate the core widget layout for a basic dialog */ + Evas_Object *o, *of, *ob; + E_Radio_Group *rg; + int sel, n; + + /* FIXME: this is just raw config now - it needs UI improvments */ + o = e_widget_list_add(evas, 0, 0); + + of = e_widget_framelist_add(evas, _("Stacking"), 0); + rg = e_widget_radio_group_new(&(cfdata->layering)); + ob = e_widget_radio_add(evas, _("Below Everything"), 0, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Below Windows"), 1, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Above Everything"), 2, rg); + e_widget_framelist_object_append(of, ob); + e_widget_list_object_append(o, of, 1, 1, 0.5); + + of = e_widget_framelist_add(evas, _("Size"), 0); + ob = e_widget_check_add(evas, _("Shrink length fit contents"), &(cfdata->fit_along)); + e_widget_framelist_object_append(of, ob); + ob = e_widget_check_add(evas, _("Expand width to fit contents"), &(cfdata->fit_size)); + e_widget_framelist_object_append(of, ob); + ob = e_widget_label_add(evas, _("Shelf Size")); + e_widget_framelist_object_append(of, ob); + ob = e_widget_slider_add(evas, 1, 0, _("%3.0f pixels"), 4, 200, 4, 0, NULL, &(cfdata->size), 200); + e_widget_framelist_object_append(of, ob); + e_widget_list_object_append(o, of, 1, 1, 0.5); + + of = e_widget_framelist_add(evas, _("Layout"), 0); + rg = e_widget_radio_group_new(&(cfdata->orient)); + ob = e_widget_radio_add(evas, _("Left"), E_GADCON_ORIENT_LEFT, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Right"), E_GADCON_ORIENT_RIGHT, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Top"), E_GADCON_ORIENT_TOP, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Bottom"), E_GADCON_ORIENT_BOTTOM, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Top Left"), E_GADCON_ORIENT_CORNER_TL, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Top Right"), E_GADCON_ORIENT_CORNER_TR, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Bottom Left"), E_GADCON_ORIENT_CORNER_BL, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Bottom Right"), E_GADCON_ORIENT_CORNER_BR, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Left Top"), E_GADCON_ORIENT_CORNER_LT, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Right Top"), E_GADCON_ORIENT_CORNER_RT, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Left Bottom"), E_GADCON_ORIENT_CORNER_LB, rg); + e_widget_framelist_object_append(of, ob); + ob = e_widget_radio_add(evas, _("Right Bottom"), E_GADCON_ORIENT_CORNER_RB, rg); + e_widget_framelist_object_append(of, ob); + e_widget_list_object_append(o, of, 1, 1, 0.5); + + return o; +} diff --git a/src/bin/e_int_shelf_config.h b/src/bin/e_int_shelf_config.h new file mode 100644 index 000000000..393bcaafc --- /dev/null +++ b/src/bin/e_int_shelf_config.h @@ -0,0 +1,12 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifdef E_TYPEDEFS +#else +#ifndef E_INT_SHELF_CONFIG_H +#define E_INT_SHELF_CONFIG_H + +EAPI void e_int_shelf_config(E_Shelf *es); + +#endif +#endif diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 48a22f136..98ee62160 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -5,10 +5,13 @@ static void _e_shelf_free(E_Shelf *es); static const char *_e_shelf_orient_string_get(E_Shelf *es); -static void _e_shelf_position_calc(E_Shelf *es); static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style); +static void _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_shelf_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_shelf_cb_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); +static void _e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); static Evas_List *shelves = NULL; static int shelf_id = 0; @@ -35,7 +38,6 @@ e_shelf_config_init(void) { E_Config_Shelf *cf_es; E_Zone *zone; - int closeness; cf_es = l->data; zone = e_util_container_zone_number_get(cf_es->container, cf_es->zone); @@ -44,14 +46,14 @@ e_shelf_config_init(void) E_Shelf *es; es = e_shelf_zone_new(zone, cf_es->name, cf_es->style, - cf_es->popup, cf_es->layer); + cf_es->popup, cf_es->layer, -1); if (es) { es->cfg = cf_es; es->fit_along = cf_es->fit_along; es->fit_size = cf_es->fit_size; e_shelf_orient(es, cf_es->orient); - _e_shelf_position_calc(es); + e_shelf_position_calc(es); e_shelf_populate(es); e_shelf_show(es); } @@ -66,7 +68,7 @@ e_shelf_list(void) } EAPI E_Shelf * -e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer) +e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer, int id) { E_Shelf *es; char buf[1024]; @@ -99,6 +101,11 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i evas_object_color_set(es->o_event, 0, 0, 0, 0); evas_object_resize(es->o_event, es->w, es->h); + evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_shelf_cb_mouse_down, es); + evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_UP, _e_shelf_cb_mouse_up, es); + evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_IN, _e_shelf_cb_mouse_in, es); + evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_OUT, _e_shelf_cb_mouse_out, es); + es->o_base = edje_object_add(es->evas); es->name = evas_stringshare_add(name); snprintf(buf, sizeof(buf), "shelf/%s/base", es->style); @@ -119,9 +126,14 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i evas_object_layer_set(es->o_event, layer); evas_object_layer_set(es->o_base, layer); } - - snprintf(buf, sizeof(buf), "%i", shelf_id); - shelf_id++; + if (id < 0) + { + es->id = shelf_id; + shelf_id++; + } + else + es->id = id; + snprintf(buf, sizeof(buf), "%i", es->id); es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items"); e_gadcon_min_size_request_callback_set(es->gadcon, _e_shelf_gadcon_min_size_request, @@ -292,86 +304,15 @@ e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient) { E_OBJECT_CHECK(es); E_OBJECT_TYPE_CHECK(es, E_GADMAN_SHELF_TYPE); + e_gadcon_orient(es->gadcon, orient); edje_object_signal_emit(es->o_base, "set_orientation", _e_shelf_orient_string_get(es)); edje_object_message_signal_process(es->o_base); } -/* local subsystem functions */ -static void -_e_shelf_free(E_Shelf *es) -{ - shelves = evas_list_remove(shelves, es); - e_object_del(E_OBJECT(es->gadcon)); - evas_stringshare_del(es->name); - evas_stringshare_del(es->style); - evas_object_del(es->o_event); - evas_object_del(es->o_base); - if (es->popup) e_object_del(E_OBJECT(es->popup)); - free(es); -} - -static const char * -_e_shelf_orient_string_get(E_Shelf *es) -{ - const char *sig = ""; - - switch (es->gadcon->orient) - { - case E_GADCON_ORIENT_FLOAT: - sig = "float"; - break; - case E_GADCON_ORIENT_HORIZ: - sig = "horizontal"; - break; - case E_GADCON_ORIENT_VERT: - sig = "vertical"; - break; - case E_GADCON_ORIENT_LEFT: - sig = "left"; - break; - case E_GADCON_ORIENT_RIGHT: - sig = "right"; - break; - case E_GADCON_ORIENT_TOP: - sig = "top"; - break; - case E_GADCON_ORIENT_BOTTOM: - sig = "bottom"; - break; - case E_GADCON_ORIENT_CORNER_TL: - sig = "top_left"; - break; - case E_GADCON_ORIENT_CORNER_TR: - sig = "top_right"; - break; - case E_GADCON_ORIENT_CORNER_BL: - sig = "bottom_left"; - break; - case E_GADCON_ORIENT_CORNER_BR: - sig = "bottom_right"; - break; - case E_GADCON_ORIENT_CORNER_LT: - sig = "left_top"; - break; - case E_GADCON_ORIENT_CORNER_RT: - sig = "right_top"; - break; - case E_GADCON_ORIENT_CORNER_LB: - sig = "left_bottom"; - break; - case E_GADCON_ORIENT_CORNER_RB: - sig = "right_bottom"; - break; - default: - break; - } - return sig; -} - -static void -_e_shelf_position_calc(E_Shelf *es) +EAPI void +e_shelf_position_calc(E_Shelf *es) { E_Gadcon_Orient orient = E_GADCON_ORIENT_FLOAT; int size = 40; @@ -477,6 +418,79 @@ _e_shelf_position_calc(E_Shelf *es) e_shelf_move_resize(es, es->x, es->y, es->w, es->h); } +/* local subsystem functions */ +static void +_e_shelf_free(E_Shelf *es) +{ + 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)); + evas_stringshare_del(es->name); + evas_stringshare_del(es->style); + evas_object_del(es->o_event); + evas_object_del(es->o_base); + if (es->popup) e_object_del(E_OBJECT(es->popup)); + free(es); +} + +static const char * +_e_shelf_orient_string_get(E_Shelf *es) +{ + const char *sig = ""; + + switch (es->gadcon->orient) + { + case E_GADCON_ORIENT_FLOAT: + sig = "float"; + break; + case E_GADCON_ORIENT_HORIZ: + sig = "horizontal"; + break; + case E_GADCON_ORIENT_VERT: + sig = "vertical"; + break; + case E_GADCON_ORIENT_LEFT: + sig = "left"; + break; + case E_GADCON_ORIENT_RIGHT: + sig = "right"; + break; + case E_GADCON_ORIENT_TOP: + sig = "top"; + break; + case E_GADCON_ORIENT_BOTTOM: + sig = "bottom"; + break; + case E_GADCON_ORIENT_CORNER_TL: + sig = "top_left"; + break; + case E_GADCON_ORIENT_CORNER_TR: + sig = "top_right"; + break; + case E_GADCON_ORIENT_CORNER_BL: + sig = "bottom_left"; + break; + case E_GADCON_ORIENT_CORNER_BR: + sig = "bottom_right"; + break; + case E_GADCON_ORIENT_CORNER_LT: + sig = "left_top"; + break; + case E_GADCON_ORIENT_CORNER_RT: + sig = "right_top"; + break; + case E_GADCON_ORIENT_CORNER_LB: + sig = "left_bottom"; + break; + case E_GADCON_ORIENT_CORNER_RB: + sig = "right_bottom"; + break; + default: + break; + } + return sig; +} + static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h) { @@ -595,7 +609,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nh = es->h; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nw != es->w) nx = es->zone->w - es->w; + nx = es->zone->w - nw; ny = 0; break; case E_GADCON_ORIENT_CORNER_BL: @@ -611,7 +625,7 @@ _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord if (!es->fit_size) nh = es->h; if (nw > es->zone->w) nw = es->zone->w; if (nh > es->zone->h) nh = es->zone->h; - if (nw != es->w) nx = es->zone->w - es->w; + nx = es->zone->w - nw; ny = es->zone->h - nh; break; case E_GADCON_ORIENT_CORNER_LT: @@ -672,3 +686,49 @@ _e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *styl edje_object_message_signal_process(o); return o; } + +static void +_e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Down *ev; + E_Shelf *es; + + es = data; + ev = event_info; + if (ev->button == 3) + { + if (!es->config_dialog) e_int_shelf_config(es); + } +} + +static void +_e_shelf_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev; + E_Shelf *es; + + es = data; + ev = event_info; +} + +static void +_e_shelf_cb_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_In *ev; + E_Shelf *es; + + es = data; + ev = event_info; + edje_object_signal_emit(es->o_base, "active", ""); +} + +static void +_e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Out *ev; + E_Shelf *es; + + es = data; + ev = event_info; + edje_object_signal_emit(es->o_base, "inactive", ""); +} diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 17c7ff56e..349d89633 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -14,6 +14,7 @@ typedef struct _E_Shelf E_Shelf; struct _E_Shelf { E_Object e_obj_inherit; + int id; int x, y, w, h; int layer; E_Popup *popup; /* NULL if its within an existing canvas */ @@ -29,13 +30,14 @@ struct _E_Shelf unsigned char fit_along : 1; unsigned char fit_size : 1; int size; + E_Config_Dialog *config_dialog; }; EAPI int e_shelf_init(void); EAPI int e_shelf_shutdown(void); EAPI void e_shelf_config_init(void); EAPI Evas_List *e_shelf_list(void); -EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer); +EAPI E_Shelf *e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, int layer, int id); EAPI void e_shelf_populate(E_Shelf *es); EAPI void e_shelf_show(E_Shelf *es); EAPI void e_shelf_hide(E_Shelf *es); @@ -46,6 +48,7 @@ EAPI void e_shelf_layer_set(E_Shelf *es, int layer); EAPI void e_shelf_save(E_Shelf *es); EAPI void e_shelf_unsave(E_Shelf *es); EAPI void e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient); - +EAPI void e_shelf_position_calc(E_Shelf *es); + #endif #endif diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index b98031af2..d36e0fcf5 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -184,7 +184,8 @@ _gc_orient(E_Gadcon_Client *gcc) case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BR: - e_gadcon_client_aspect_set(gcc, evas_list_count(inst->ibar->icons), 1); + _ibar_orient_set(inst->ibar, 1); + e_gadcon_client_aspect_set(gcc, evas_list_count(inst->ibar->icons) * 16, 16); break; case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_LEFT: @@ -193,13 +194,14 @@ _gc_orient(E_Gadcon_Client *gcc) case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_RB: - e_gadcon_client_aspect_set(gcc, 1, evas_list_count(inst->ibar->icons)); + _ibar_orient_set(inst->ibar, 0); + e_gadcon_client_aspect_set(gcc, 16, evas_list_count(inst->ibar->icons) * 16); break; default: break; } if (evas_list_count(inst->ibar->icons) < 1) - e_gadcon_client_aspect_set(gcc, 1, 1); + e_gadcon_client_aspect_set(gcc, 16, 16); e_gadcon_client_min_size_set(gcc, 16, 16); } /**/ @@ -294,11 +296,13 @@ _ibar_resize_handle(IBar *b) Evas_Coord w, h; evas_object_geometry_get(b->o_box, NULL, NULL, &w, &h); + printf("BOX %ix%i\n", w, h); if (e_box_orientation_get(b->o_box)) w = h; else h = w; e_box_freeze(b->o_box); + printf("RESIZNE %i %i\n", w, h); for (l = b->icons; l; l = l->next) { ic = l->data; diff --git a/src/modules/start/e_mod_main.c b/src/modules/start/e_mod_main.c index 66bf36cd7..bc5529791 100644 --- a/src/modules/start/e_mod_main.c +++ b/src/modules/start/e_mod_main.c @@ -137,11 +137,33 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) case E_GADCON_ORIENT_RIGHT: dir = E_MENU_POP_DIRECTION_LEFT; break; - case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_CORNER_TL: + dir = E_MENU_POP_DIRECTION_DOWN; + break; case E_GADCON_ORIENT_CORNER_TR: + dir = E_MENU_POP_DIRECTION_DOWN; + break; case E_GADCON_ORIENT_CORNER_BL: + dir = E_MENU_POP_DIRECTION_UP; + break; case E_GADCON_ORIENT_CORNER_BR: + dir = E_MENU_POP_DIRECTION_UP; + break; + case E_GADCON_ORIENT_CORNER_LT: + dir = E_MENU_POP_DIRECTION_RIGHT; + break; + case E_GADCON_ORIENT_CORNER_RT: + dir = E_MENU_POP_DIRECTION_LEFT; + break; + case E_GADCON_ORIENT_CORNER_LB: + dir = E_MENU_POP_DIRECTION_RIGHT; + break; + case E_GADCON_ORIENT_CORNER_RB: + dir = E_MENU_POP_DIRECTION_LEFT; + break; + case E_GADCON_ORIENT_FLOAT: + case E_GADCON_ORIENT_HORIZ: + case E_GADCON_ORIENT_VERT: default: dir = E_MENU_POP_DIRECTION_AUTO; break;