Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: Makefile.am e_gadcon.c e_includes.h e_int_border_border.c e_shelf.c e_shelf.h Added Files: e_int_shelf_config.c e_int_shelf_config.h Log Message: start of some shelf config - START only... deal with it. debugging printfs galore. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/Makefile.am,v retrieving revision 1.117 retrieving revision 1.118 diff -u -3 -r1.117 -r1.118 --- Makefile.am 9 Apr 2006 11:55:18 -0000 1.117 +++ Makefile.am 23 Apr 2006 06:56:22 -0000 1.118 @@ -151,7 +151,8 @@ 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_shelf.c \ e_widget_preview.c \ e_int_config_paths.c \ +e_int_shelf_config.c \ $(ENLIGHTENMENTHEADERS) enlightenment_SOURCES = \ =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- e_gadcon.c 20 Apr 2006 14:59:53 -0000 1.19 +++ e_gadcon.c 23 Apr 2006 06:56:22 -0000 1.20 @@ -319,43 +319,46 @@ 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_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 @@ 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 @@ } 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 @@ 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 @@ 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 (E_SPANS_COMMON(bi->x, bi->w, bi2->x, bi2->w)) + { + bi->x = bi2->x + bi2->w; + goto again1; + } + } + else { - bi->x = bi2->x + bi2->w; - goto again1; + if (E_SPANS_COMMON(bi->y, bi->h, bi2->y, bi2->h)) + { + bi->y = bi2->y + bi2->h; + goto again1; + } } } } @@ -2136,13 +2207,27 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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) { =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_includes.h,v retrieving revision 1.99 retrieving revision 1.100 diff -u -3 -r1.99 -r1.100 --- e_includes.h 20 Apr 2006 11:30:24 -0000 1.99 +++ e_includes.h 23 Apr 2006 06:56:22 -0000 1.100 @@ -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" =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_border_border.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_int_border_border.c 15 Feb 2006 20:40:55 -0000 1.10 +++ e_int_border_border.c 23 Apr 2006 06:56:22 -0000 1.11 @@ -186,12 +186,11 @@ 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); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- e_shelf.c 20 Apr 2006 11:30:24 -0000 1.15 +++ e_shelf.c 23 Apr 2006 06:56:22 -0000 1.16 @@ -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_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 *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 @@ } 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 @@ 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 @@ 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_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_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 @@ 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 @@ 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: @@ -671,4 +685,50 @@ _e_shelf_orient_string_get(es)); 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", ""); } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_shelf.h 20 Apr 2006 11:30:24 -0000 1.11 +++ e_shelf.h 23 Apr 2006 06:56:22 -0000 1.12 @@ -14,6 +14,7 @@ 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 @@ 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_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 ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs