From ceba4f0e143850780842cc6e78a6ad2644ed7a2b Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 23 Feb 2009 11:40:24 +0000 Subject: [PATCH] todo stuff scroller segv fix (list showed it). check theme item placeholder. doing gfx. SVN revision: 39161 --- data/themes/default.edc | 313 ++++++++++++++++++++++++++++++++++++++++++++++++ src/bin/test.c | 66 +++++++++- src/lib/Elementary.h.in | 7 +- src/lib/elm_scroller.c | 9 +- 4 files changed, 392 insertions(+), 3 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index 4524874..a6d984b 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -7535,4 +7535,317 @@ collections { } } } + +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/check/base/default"; + images { + image: "shelf_inset.png" COMP; + image: "bt_basew.png" COMP; + image: "bt_bases.png" COMP; + image: "bt_hilightw.png" COMP; + image: "tog_base.png" COMP; + } + parts { + part { name: "bg"; + type: RECT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + rel1.relative: 1.0 0.0; + rel1.offset: -4 3; + rel2.offset: -4 -4; + align: 1.0 0.5; + min: 96 16; + max: 96 16; + aspect: 4.0 4.0; + aspect_preference: VERTICAL; + color: 255 255 255 255; + } + } + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "bg"; + rel2.to: "bg"; + color: 255 255 255 255; + } + } + part { name: "button"; + type: RECT; + scale: 1; + clip_to: "clipper"; + mouse_events: 1; + dragable { + x: 1 1 0; + y: 0 0 0; + confine: "bg"; + } + description { state: "default" 0.0; + fixed: 1 1; + rel1.to: "bg"; + rel2.to: "bg"; + min: 16 16; + max: 16 16; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + color: 0 0 0 0; + } + } + part { name: "button_events"; + type: RECT; + dragable { + events: "button"; + } + description { state: "default" 0.0; + rel1.to_x: "bg"; + rel1.offset: 0 0; + rel1.relative: 0.0 0.0; + rel2.to_x: "bg"; + rel2.offset: -1 -1; + rel2.relative: 1.0 1.0; + color: 0 0 0 0; + } + } + part { name: "onrect"; + type: RECT; + scale: 1; + clip_to: "clipper"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "button"; + rel1.relative: -5.0 0.0; + rel2.to: "button"; + rel2.relative: 0.0 1.0; + color: 0 0 0 0; + } + } + part { name: "offrect"; + type: RECT; + scale: 1; + clip_to: "clipper"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.to: "button"; + rel1.relative: 1.0 0.0; + rel2.to: "button"; + rel2.relative: 6.0 1.0; + color: 0 0 0 0; + } + } + part { name: "togbase"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1.to: "onrect"; + rel2.to: "offrect"; + image.normal: "tog_base.png"; + } + } + part { name: "elm.offtext"; + type: TEXT; + mouse_events: 0; + scale: 1; + clip_to: "clipper"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to_x: "offrect"; + rel2.to_x: "offrect"; + color: 0 0 0 255; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 1; + align: 0.5 0.5; + text: "OFF"; + } + } + } + part { name: "elm.ontext"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + clip_to: "clipper"; + description { state: "default" 0.0; + fixed: 1 1; + rel1.to_x: "onrect"; + rel1.offset: 1 1; + rel2.to_x: "onrect"; + rel2.offset: 0 0; + color: 224 224 224 255; + color3: 0 0 0 64; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 1; + align: 0.5 0.5; + text: "ON"; + } + } + } + part { name: "conf_over"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: -1 -1; + rel1.to: "bg"; + rel2.offset: 0 0; + rel2.to: "bg"; + image { + normal: "shelf_inset.png"; + border: 7 7 7 7; + middle: 0; + } + fill.smooth : 0; + } + } + part { name: "button0"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1.to: "button2"; + rel1.offset: -4 -4; + rel2.to: "button2"; + rel2.offset: 3 3; + image { + normal: "bt_bases.png"; + border: 11 11 11 11; + } + image.middle: SOLID; + color: 255 255 255 128; + } + } + part { name: "button2"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1.to: "button"; + rel1.offset: -2 -2; + rel2.to: "button"; + rel2.offset: 1 1; + image { + normal: "bt_basew.png"; + border: 7 7 7 7; + } + image.middle: SOLID; + } + } + part { name: "button3"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + rel1.to: "button2"; + rel2.to: "button2"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_hilightw.png"; + border: 4 4 4 0; + } + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + description { state: "default" 0.0; +// fixed: 1 1; + visible: 0; + align: 0.0 0.5; + rel1.offset: 4 4; + rel2.relative: 0.0 1.0; + rel2.offset: 3 -5; + } + description { state: "visible" 0.0; + inherit: "default" 0.0; +// fixed: 0 0; + visible: 1; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel2.offset: 4 -5; + } + } + part { name: "elm.text"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 0; + rel1.to_x: "elm.swallow.content"; + rel1.relative: 1.0 0.0; + rel1.offset: 0 4; + rel2.to_x: "bg"; + rel2.relative: 0.0 1.0; + rel2.offset: -5 -5; + color: 0 0 0 255; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 0; + align: 0.0 0.5; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + text.min: 1 1; + } + } + } + programs { + program { name: "drag_end"; + signal: "mouse,up,1"; + source: "button"; + script { + new Float:dx, Float:dy; + get_drag(PART:"button", dx, dy); + if (dx > 0.5) + { + set_drag(PART:"button", 1.0, 0.0); + emit("elm,action,check,on", ""); + } + else + { + set_drag(PART:"button", 0.0, 0.0); + emit("elm,action,check,off", ""); + } + } + } + program { name: "check_on"; + signal: "elm,state,check,on"; + source: "elm"; + script { + set_drag(PART:"button", 100.0, 0.0); + } + } + program { name: "check_off"; + signal: "elm,state,check,off"; + source: "elm"; + script { + set_drag(PART:"button", 0.0, 0.0); + } + } + program { name: "text_show"; + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text"; + } + program { name: "text_hide"; + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "icon_show"; + signal: "elm,state,icon,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.content"; + } + program { name: "icon_hide"; + signal: "elm,state,icon,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.content"; + } + } + } } diff --git a/src/bin/test.c b/src/bin/test.c index 9e9bbf3..5685d4e 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -2102,7 +2102,7 @@ my_bt_29(void *data, Evas_Object *obj, void *event_info) itc1.func.state_get = gl_state_get; itc1.func.del = gl_del; - for (i = 0; i < 10000; i++) + for (i = 0; i < 2000; i++) { gli = elm_genlist_item_append(gl, &itc1, (void *)i/* item data */, @@ -2458,6 +2458,69 @@ my_bt_31(void *data, Evas_Object *obj, void *event_info) } static void +my_bt_32(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *bx, *ic, *tg; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "check", ELM_WIN_BASIC); + elm_win_title_set(win, "Checks"); + elm_win_autodel_set(win, 1); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + tg = elm_check_add(win); + evas_object_size_hint_weight_set(tg, 1.0, 1.0); + evas_object_size_hint_align_set(tg, -1.0, 0.5); + elm_check_label_set(tg, "Icon sized to check"); + elm_check_icon_set(tg, ic); + elm_check_state_set(tg, 1); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + tg = elm_check_add(win); + elm_check_label_set(tg, "Icon no scale"); + elm_check_icon_set(tg, ic); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + tg = elm_check_add(win); + elm_check_label_set(tg, "Label Only"); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + elm_icon_scale_set(ic, 0, 0); + tg = elm_check_add(win); + elm_check_icon_set(tg, ic); + elm_box_pack_end(bx, tg); + evas_object_show(tg); + evas_object_show(ic); + + evas_object_show(win); +} + +static void my_win_main(void) { Evas_Object *win, *bg, *bx0, *lb, *li, *fr; @@ -2563,6 +2626,7 @@ my_win_main(void) elm_list_item_append(li, "Genlist", NULL, NULL, my_bt_29, NULL); elm_list_item_append(li, "Genlist 2", NULL, NULL, my_bt_30, NULL); elm_list_item_append(li, "Genlist 3", NULL, NULL, my_bt_31, NULL); + elm_list_item_append(li, "Checks", NULL, NULL, my_bt_32, NULL); elm_list_go(li); diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index faedd0f..dcafedc 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -586,6 +586,7 @@ extern "C" { // * // * // +// * multiple genlist item styles (multi-label, 1 icon + 2 line label, header etc.) // * carousel selector widget // * auto-size label/text that adapts text size to its allocated region // * [ scrollable dropdown combo box ] @@ -610,13 +611,17 @@ extern "C" { // * full window in window widget (so move/resize of window object does as you'd expect a child window to do within the canvas) // //// (improvements - low priority) +// * test for all bubble styles +// * test for all frame styles +// * test for all genlist item styles +// * need a way to attach a "dnd detector" to any object +// * need a dnd handler (able to hook to dnd detector) // * need another sample theme // * need a way to set a preferred size of a widget (but not min or max). // * merge with gurana // * use evas's new box instead of a box smart // * use evas's table instead of a table smart // * use stack for win widget -// * prepend or append theme files from code for an app to allow an app to augment the theme eithe rby forcibly overriding things with its own theme file (so it can ship some custom elements that always override user theme) and so it can also provide a final (even after default) fallback for "extended" styles of its own (but thus allowing themes to overried its extensions if they want) // * determine prefix of app dynamically and export calls to get prefix info // * load config from file // * load config from x property diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index e467633..145cd3f 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -21,6 +21,7 @@ static void _del_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; free(wd); } @@ -28,6 +29,7 @@ static void _theme_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default"); edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale); _sizing_eval(obj); @@ -38,6 +40,7 @@ _show_region_hook(void *data, Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(data); Evas_Coord x, y, w, h; + if (!wd) return; elm_widget_show_region_get(obj, &x, &y, &w, &h); elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); } @@ -48,7 +51,7 @@ _sizing_eval(Evas_Object *obj) Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh; double xw, xy; - + if (!wd) return; evas_object_size_hint_min_get(wd->content, &minw, &minh); evas_object_size_hint_max_get(wd->content, &maxw, &maxh); evas_object_size_hint_weight_get(wd->content, &xw, &xy); @@ -85,6 +88,7 @@ _sub_del(void *data, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Object *sub = event_info; + if (!wd) return; if (sub == wd->content) { elm_widget_on_show_region_hook_set(wd->content, NULL, NULL); @@ -133,6 +137,7 @@ EAPI void elm_scroller_content_set(Evas_Object *obj, Evas_Object *content) { Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; if ((wd->content != content) && (wd->content)) elm_widget_sub_object_del(obj, wd->content); wd->content = content; @@ -151,6 +156,7 @@ EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Evas_Bool w, Evas_Bool h) { Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; wd->min_w = w; wd->min_h = h; _sizing_eval(obj); @@ -160,5 +166,6 @@ EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); } -- 2.7.4