From d5a4dd567dcf34fe6f35f715cd40ba68629c61d4 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Tue, 27 Jan 2009 03:43:17 +0000 Subject: [PATCH] Get rid of the theming work I did before... This is better but still needs work on allowing the theme to define custom widgets. --- .../data/themes/default/groups/burn_data.edc | 106 +++- .../data/themes/default/groups/burn_image.edc | 86 ++- .../data/themes/default/groups/button.edc | 100 ++-- .../data/themes/default/groups/check.edc | 7 +- .../data/themes/default/groups/erase_disc.edc | 108 +++- .../data/themes/default/groups/label.edc | 1 + .../data/themes/default/macros/button.edc | 493 ------------------ .../data/themes/default/macros/check.edc | 264 ---------- experimental/ecdb/trunk/src/ecdb.h | 1 + experimental/ecdb/trunk/src/ecdb_gui.c | 111 ++-- 10 files changed, 379 insertions(+), 898 deletions(-) delete mode 100644 experimental/ecdb/trunk/data/themes/default/macros/button.edc delete mode 100644 experimental/ecdb/trunk/data/themes/default/macros/check.edc diff --git a/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc b/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc index f148811e..fbc6ea8f 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc @@ -6,6 +6,7 @@ group { part { name: "bg"; type: RECT; + scale: 1; description { state: "default" 0.0; @@ -53,9 +54,59 @@ group { } } - BUTTON("ecdb/burn_data/return", "ecdb/burn_data/return/text", 100, 26, 150, 26, "bg", "bg", 0, 0, "bg", "bg", 1, 1, 0, 5, -5, 1, 1, 0) + part { + name: "ecdb/burn_data/return"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; - BUTTON("ecdb/burn_data/begin", "ecdb/burn_data/begin/text", 100, 26, 150, 26, "bg", "ecdb/burn_data/return", 0, 1, "bg", "ecdb/burn_data/return", 1, 1, 0, 5, -5, -1, 1, 0) + rel1 { + to: "bg"; + relative: 0.0 0.0; + offset: 0 5; + } + + rel2 { + to: "bg"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } + + part { + name: "ecdb/burn_data/begin"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; + + rel1 { + to_x: "bg"; + to_y: "ecdb/burn_data/return"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to_x: "bg"; + to_y: "ecdb/burn_data/return"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } part { name: "ecdb/burn_data/drive"; @@ -65,19 +116,20 @@ group { description { state: "default" 0.0; - align: 1.0 0.0; - max: 150 26; min: 100 26; + max: 150 26; + align: 1.0 0.0; rel1 { - to_y: "ecdb/burn_data/begin"; to_x: "bg"; + to_y: "ecdb/burn_data/begin"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/burn_data/begin"; relative: 1.0 1.0; offset: -5 -1; } @@ -92,26 +144,53 @@ group { description { state: "default" 0.0; - align: 1.0 0.0; - max: 150 26; min: 100 26; + max: 150 26; + align: 1.0 0.0; rel1 { - to_y: "ecdb/burn_data/drive"; to_x: "bg"; + to_y: "ecdb/burn_data/drive"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/burn_data/drive"; relative: 1.0 1.0; offset: -5 -1; } } } - BUTTON("ecdb/burn_data/settings", "ecdb/burn_data/settings/text", 100, 26, 150, 26, "bg", "ecdb/burn_data/speed", 0, 1, "bg", "ecdb/burn_data/speed", 1, 1, 0, 5, -5, -1, 1, 0) + part { + name: "ecdb/burn_data/settings"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; + + rel1 { + to_x: "bg"; + to_y: "ecdb/burn_data/speed"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to_x: "bg"; + to_y: "ecdb/burn_data/speed"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } /* Missing a description later */ part { @@ -151,6 +230,7 @@ group { align: 0.0 1.0; rel1 { + to_y: "ecdb/burn_data/settings"; relative: 0.0 1.0; offset: 10 5; } @@ -267,7 +347,6 @@ group { name: "disabled_hack"; type: RECT; mouse_events: 1; - scale: 1; description { state: "default" 0.0; @@ -297,9 +376,6 @@ group { } programs { - BUTTON_PROGS("ecdb/burn_data/return") - BUTTON_PROGS("ecdb/burn_data/begin") - BUTTON_PROGS("ecdb/burn_data/settings") program { name: "burn_data_page,visible1"; signal: "ecdb,burn_data_page,visible"; diff --git a/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc b/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc index 7b2d289b..30ef83ed 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc @@ -1,6 +1,7 @@ /* vim: set sw=3 ts=3 sts=3 expandtab: */ group { name: "ecdb/burn_image_page"; + min: 640 170; script { public message(Msg_Type:type, id, ...) { @@ -27,6 +28,7 @@ group { part { name: "bg"; type: RECT; + scale: 1; description { state: "default" 0.0; @@ -74,9 +76,59 @@ group { } } - BUTTON("ecdb/burn_image/return", "ecdb/burn_image/return/text", 100, 26, 150, 26, "bg", "bg", 0, 0, "bg", "bg", 1, 1, 0, 5, -5, 1, 1, 0) + part { + name: "ecdb/burn_image/return"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; - BUTTON("ecdb/burn_image/begin", "ecdb/burn_image/begin/text", 100, 26, 150, 26, "bg", "ecdb/burn_image/return", 0, 1, "bg", "ecdb/burn_image/return", 1, 1, 0, 5, -5, -1, 1, 0) + rel1 { + to: "bg"; + relative: 0.0 0.0; + offset: 0 5; + } + + rel2 { + to: "bg"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } + + part { + name: "ecdb/burn_image/begin"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; + + rel1 { + to_x: "bg"; + to_y: "ecdb/burn_image/return"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to_x: "bg"; + to_y: "ecdb/burn_image/return"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } part { name: "ecdb/burn_image/file"; @@ -86,19 +138,20 @@ group { description { state: "default" 0.0; - align: 1.0 0.0; - max: 150 26; min: 100 26; + max: 150 26; + align: 1.0 0.0; rel1 { - to_y: "ecdb/burn_image/begin"; to_x: "bg"; + to_y: "ecdb/burn_image/begin"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/burn_image/begin"; relative: 1.0 1.0; offset: -5 -1; } @@ -113,19 +166,20 @@ group { description { state: "default" 0.0; - align: 1.0 0.0; - max: 150 26; min: 100 26; + max: 150 26; + align: 1.0 0.0; rel1 { - to_y: "ecdb/burn_image/file"; to_x: "bg"; + to_y: "ecdb/burn_image/file"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/burn_image/file"; relative: 1.0 1.0; offset: -5 -1; } @@ -140,19 +194,20 @@ group { description { state: "default" 0.0; - max: 150 26; min: 100 26; + max: 150 26; align: 1.0 0.0; rel1 { - to_y: "ecdb/burn_image/drive"; to_x: "bg"; + to_y: "ecdb/burn_image/drive"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/burn_image/drive"; relative: 1.0 1.0; offset: -5 -1; } @@ -175,8 +230,8 @@ group { } rel2 { - to_x: "ecdb/burn_image/speed"; to_y: "bg"; + to_x: "ecdb/burn_image/return"; relative: 0.0 1.0; offset: -5 -10; } @@ -266,7 +321,6 @@ group { name: "disabled_hack"; type: RECT; mouse_events: 1; - scale: 1; description { state: "default" 0.0; @@ -296,8 +350,6 @@ group { } programs { - BUTTON_PROGS("ecdb/burn_image/return") - BUTTON_PROGS("ecdb/burn_image/begin") program { name: "burn_image_page,visible1"; signal: "ecdb,burn_image_page,visible"; diff --git a/experimental/ecdb/trunk/data/themes/default/groups/button.edc b/experimental/ecdb/trunk/data/themes/default/groups/button.edc index e954eb00..68be783d 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/button.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/button.edc @@ -17,8 +17,7 @@ group { description { state: "default" 0.0; - min: 100 26; - max: 150 50; + min: 0 26; color: 255 255 255 178; image { @@ -32,7 +31,6 @@ group { name: "button_clip"; type: RECT; mouse_events: 1; - scale: 1; description { state: "default" 0.0; @@ -56,7 +54,6 @@ group { name: "focus_clip"; type: RECT; mouse_events: 1; - scale: 1; description { state: "default" 0.0; @@ -207,28 +204,6 @@ group { } } - part { - name: "minimum.size.hack"; - type: RECT; - mouse_events: 1; - clip_to: "button_clip"; - scale: 1; - - description { - state: "default" 0.0; - min: 88 24; - color: 0 0 0 0; - - rel1 { - to: "button_clip"; - } - - rel2 { - to: "button_clip"; - } - } - } - part { name: "ecdb.label"; type: TEXT; @@ -237,17 +212,15 @@ group { description { state: "default" 0.0; - align: 0.0 0.5; + align: 0.5 0.5; color: 60 60 60 255; - fixed: 1 1; - + rel1 { - to: "ecdb.swallow.icon"; - offset: 40 0; + to: "base"; } rel2 { - to: "ecdb.swallow.icon"; + to: "base"; } text { @@ -258,6 +231,25 @@ group { align: 0.5 0.5; } } + + description { + state: "iconized" 0.0; + inherit: "default" 0.0; + + rel1 { + to_x: "ecdb.swallow.icon"; + relative: 1.0 0.0; + offset: 5 0; + } + + rel2 { + relative: 1.0 1.0; + } + + text { + align: 0.0 0.5; + } + } } part { @@ -268,11 +260,12 @@ group { description { state: "default" 0.0; - max: 32 32; + max: 0 0; align: 0.0 0.5; rel1 { - to: "button_clip"; + to_x: "button_clip"; + relative: 0.0 0.0; offset: 15 0; } @@ -280,10 +273,49 @@ group { to: "button_clip"; } } + + description { + state: "filled" 0.0; + inherit: "default" 0.0; + max: 32 32; + min: 32 32; + } } } programs { + program { + name: "icon_swallow"; + signal: "ecdb,button,icon,swallow"; + source: "ecdb"; + action: STATE_SET "filled" 0.0; + target: "ecdb.swallow.icon"; + } + + program { + name: "swallow_text"; + signal: "ecdb,button,icon,swallow"; + source: "ecdb"; + action: STATE_SET "iconized" 0.0; + target: "ecdb.label"; + } + + program { + name: "icon_unswallow"; + signal: "ecdb,button,icon,unswallow"; + source: "ecdb"; + action: STATE_SET "default" 0.0; + target: "ecdb.swallow.icon"; + } + + program { + name: "unswallow_text"; + signal: "ecdb,button,icon,unswallow"; + source: "ecdb"; + action: STATE_SET "default" 0.0; + target: "ecdb.label"; + } + program { name: "clicked"; action: STATE_SET "clicked" 0.0; diff --git a/experimental/ecdb/trunk/data/themes/default/groups/check.edc b/experimental/ecdb/trunk/data/themes/default/groups/check.edc index b6134b26..9a2d156d 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/check.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/check.edc @@ -59,7 +59,6 @@ group { part { name: "check_shadow"; type: IMAGE; - scale: 1; description { state: "default" 0.0; @@ -164,8 +163,10 @@ group { fixed: 1 1; rel1 { - to: "check"; - offset: 25 0; + to_x: "check_base"; + to_y: "check"; + relative: 1.0 0.0; + offset: 5 0; } rel2 { diff --git a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc index cd1cf741..d2a12ef1 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc @@ -1,6 +1,7 @@ /* vim: set sw=3 ts=3 sts=3 expandtab: */ group { name: "ecdb/erase_page"; + min: 640 170; script { public message(Msg_Type:type, id, ...) { @@ -11,8 +12,9 @@ group { snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4)); set_text(PART:"progress_text", sectors); - // Also sent is the buffer available [getarg(5)] and - // the buffer capacity [getarg(6)] + /* Also sent is the buffer available [getarg(5)] and + * the buffer capacity [getarg(6)] + */ } } } @@ -68,11 +70,87 @@ group { } } - BUTTON("ecdb/erase/return", "ecdb/erase/return/text", 100, 26, 150, 26, "bg", "bg", 0, 0, "bg", "bg", 1, 1, 0, 5, -5, 1, 1, 0) + part { + name: "ecdb/erase/return"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; - BUTTON("ecdb/erase/begin", "ecdb/erase/begin/text", 100, 26, 150, 26, "bg", "ecdb/erase/return", 0, 1, "bg", "ecdb/erase/return", 1, 1, 0, 5, -5, -1, 1, 0) + rel1 { + to: "bg"; + relative: 0.0 0.0; + offset: 0 5; + } - CHECK("ecdb/erase/speed", "ecdb/erase/speed/text", 100, 26, 150, 26, "bg", "ecdb/erase/begin", 0, 1, "bg", "ecdb/erase/begin", 1, 1, 0, 5, -5, -1, 1, 0) + rel2 { + to: "bg"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } + + part { + name: "ecdb/erase/begin"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; + + rel1 { + to_y: "ecdb/erase/return"; + to_x: "bg"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to_y: "ecdb/erase/return"; + to_x: "bg"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } + + part { + name: "ecdb/erase/speed"; + type: SWALLOW; + repeat_events: 1; + scale: 1; + + description { + state: "default" 0.0; + min: 100 26; + max: 150 26; + align: 1.0 0.0; + + rel1 { + to_x: "bg"; + to_y: "ecdb/erase/begin"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to_x: "bg"; + to_y: "ecdb/erase/begin"; + relative: 1.0 1.0; + offset: -5 -1; + } + } + } part { name: "ecdb/erase/drive"; @@ -82,19 +160,20 @@ group { description { state: "default" 0.0; - align: 1.0 0.0; - max: 150 26; min: 100 26; + max: 150 26; + align: 1.0 0.0; rel1 { - to_y: "ecdb/erase/speed"; to_x: "bg"; + to_y: "ecdb/erase/speed"; relative: 0.0 1.0; offset: 0 5; } rel2 { - to: "bg"; + to_x: "bg"; + to_y: "ecdb/erase/speed"; relative: 1.0 1.0; offset: -5 -1; } @@ -117,7 +196,8 @@ group { } rel2 { - to_x: "ecdb/erase/return"; + to: "bg"; + to_x: "ecdb/erase/speed"; relative: 0.0 1.0; offset: -5 -10; } @@ -207,15 +287,14 @@ group { name: "disabled_hack"; type: RECT; mouse_events: 1; - scale: 1; description { state: "default" 0.0; visible: 0; rel1 { - to_x: "ecdb/erase/return"; - to_y: "bg"; + to_x: "bg"; + to_y: "ecdb/erase/return"; relative: 0.0 0.0; offset: 0 0; } @@ -237,9 +316,6 @@ group { } programs { - BUTTON_PROGS("ecdb/erase/return") - BUTTON_PROGS("ecdb/erase/begin") - CHECK_PROGS("ecdb/erase/speed") program { name: "erase_page,visible1"; signal: "ecdb,erase_page,visible"; diff --git a/experimental/ecdb/trunk/data/themes/default/groups/label.edc b/experimental/ecdb/trunk/data/themes/default/groups/label.edc index 294abf18..e27e12a5 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/label.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/label.edc @@ -6,6 +6,7 @@ group { part { name: "ecdb.label"; type: TEXT; + scale: 1; description { state: "default" 0.0; diff --git a/experimental/ecdb/trunk/data/themes/default/macros/button.edc b/experimental/ecdb/trunk/data/themes/default/macros/button.edc deleted file mode 100644 index 584f973b..00000000 --- a/experimental/ecdb/trunk/data/themes/default/macros/button.edc +++ /dev/null @@ -1,493 +0,0 @@ -/* vim: set sw=3 ts=3 sts=3 expandtab: */ -#define BUTTON_ICON(partname, partnametext, iconimage, minx, miny, maxx, maxy, rel1xto, rel1yto, rel1x, rel1y, rel2xto, rel2yto, rel2x, rel2y, offset1x, offset1y, offset2x, offset2y, alignx, aligny) \ - part { \ - name: partname; \ - type: IMAGE; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: minx miny; \ - max: maxx maxy; \ - color: 255 255 255 178; \ - align: alignx aligny; \ - rel1 { \ - to_x: rel1xto; \ - to_y: rel1yto; \ - relative: rel1x rel1y; \ - offset: offset1x offset1y; \ - } \ - rel2 { \ - to_x: rel2xto; \ - to_y: rel2yto; \ - relative: rel2x rel2y; \ - offset: offset2x offset2y; \ - } \ - image { \ - normal: "button_base.png"; \ - border: 7 7 7 7; \ - } \ - } \ - } \ - part { \ - name: partname"button_clip"; \ - type: RECT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 255; \ - rel1 { \ - to: partname; \ - relative: 0.0 0.0; \ - offset: 3 1; \ - } \ - rel2 { \ - to: partname; \ - relative: 1.0 1.0; \ - offset: -4 -2; \ - } \ - } \ - } \ - part { \ - name: partname"focus_clip"; \ - type: RECT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button"; \ - offset: -1 0; \ - } \ - rel2 { \ - to: partname"button"; \ - offset: 0 -1; \ - } \ - } \ - description { \ - state: "visible" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partname"focus"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"focus_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - rel1 { \ - to: partname"focus_clip"; \ - } \ - rel2 { \ - to: partname"focus_clip"; \ - } \ - image { \ - normal: "focus.png"; \ - border: 7 7 7 7; \ - } \ - } \ - } \ - part { \ - name: partname"button"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button.png"; \ - border: 7 7 7 7; \ - } \ - } \ - description { \ - state: "disabled" 0.0; \ - inherit: "default" 0.0; \ - image { \ - normal: "button_disabled.png"; \ - border: 11 11 10 10; \ - } \ - } \ - } \ - part { \ - name: partname"shadow"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button_shadow.png"; \ - border: 6 6 0 6; \ - } \ - } \ - description { \ - state: "clicked" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partname"shadow_overlay"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button_shadow_overlay.png"; \ - border: 6 6 6 13; \ - } \ - } \ - description { \ - state: "clicked" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partnametext; \ - type: TEXT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - align: 0.0 0.5; \ - color: 60 60 60 255; \ - rel1 { \ - to: partname"icon"; \ - relative: 1.0 0.0; \ - offset: 5 0; \ - } \ - rel2 { \ - to: partname"icon"; \ - relative: 1.0 1.0; \ - } \ - text { \ - text: ""; \ - font: "ecdb/default"; \ - min: 1 1; \ - size: 11; \ - align: 0.5 0.5; \ - } \ - } \ - } \ - part { \ - name: partname"icon"; \ - type: IMAGE; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - max: 32 32; \ - align: 0.0 0.5; \ - rel1 { \ - to: partname"button_clip"; \ - offset: 15 0; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: iconimage; \ - } \ - } \ - } - -#define BUTTON_PROGS(partname) \ - program { \ - name: partname"clicked"; \ - action: STATE_SET "clicked" 0.0; \ - signal: "mouse,down,1"; \ - source: partname"*"; \ - target: partname"shadow_overlay"; \ - target: partname"shadow"; \ - transition: DECELERATE 0.2; \ - } \ - program { \ - name: partname"focus_in,mouse"; \ - signal: "mouse,down,1"; \ - action: STATE_SET "visible" 0.0; \ - source: partname"*"; \ - target: partname"focus_clip"; \ - transition: DECELERATE 0.5; \ - } \ - program { \ - name: partname"focus_in,ecdb"; \ - signal: "ecdb,focus,in,"partname; \ - action: STATE_SET "visible" 0.0; \ - source: "ecdb"; \ - target: partname"focus_clip"; \ - transition: DECELERATE 0.5; \ - } \ - program { \ - name: partname"unclick"; \ - signal: "mouse,clicked,1"; \ - signal: "mouse,up,1"; \ - action: STATE_SET "default" 0.0; \ - source: partname"*"; \ - target: partname"shadow_overlay"; \ - target: partname"shadow"; \ - transition: DECELERATE 0.2; \ - } \ - program { \ - name: partname"click_emit"; \ - signal: "mouse,clicked,1"; \ - source: partname"*"; \ - action: SIGNAL_EMIT partname",clicked" partname; \ - } \ - program { \ - name: partname"focus_out"; \ - signal: "ecdb,focus,out,"partname; \ - action: STATE_SET "default" 0.0; \ - source: "ecdb"; \ - target: partname"focus_clip"; \ - transition: DECELERATE 0.5; \ - } \ - program { \ - name: partname"disable"; \ - signal: "ecdb,disable,"partname; \ - action: STATE_SET "disabled" 0.0; \ - source: "ecdb"; \ - target: partname"button"; \ - } \ - program { \ - name: partname"enable"; \ - signal: "ecdb,enable,"partname; \ - action: STATE_SET "default" 0.0; \ - source: "ecdb"; \ - target: partname"button"; \ - } - -#define BUTTON(partname, partnametext, minx, miny, maxx, maxy, rel1xto, rel1yto, rel1x, rel1y, rel2xto, rel2yto, rel2x, rel2y, offset1x, offset1y, offset2x, offset2y, alignx, aligny) \ - part { \ - name: partname; \ - type: IMAGE; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: minx miny; \ - max: maxx maxy; \ - color: 255 255 255 178; \ - align: alignx aligny; \ - rel1 { \ - to_x: rel1xto; \ - to_y: rel1yto; \ - relative: rel1x rel1y; \ - offset: offset1x offset1y; \ - } \ - rel2 { \ - to_x: rel2xto; \ - to_y: rel2yto; \ - relative: rel2x rel2y; \ - offset: offset2x offset2y; \ - } \ - image { \ - normal: "button_base.png"; \ - border: 7 7 7 7; \ - } \ - } \ - } \ - part { \ - name: partname"button_clip"; \ - type: RECT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 255; \ - rel1 { \ - to: partname; \ - relative: 0.0 0.0; \ - offset: 3 1; \ - } \ - rel2 { \ - to: partname; \ - relative: 1.0 1.0; \ - offset: -4 -2; \ - } \ - } \ - } \ - part { \ - name: partname"focus_clip"; \ - type: RECT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button"; \ - offset: -1 0; \ - } \ - rel2 { \ - to: partname"button"; \ - offset: 0 -1; \ - } \ - } \ - description { \ - state: "visible" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partname"focus"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"focus_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - rel1 { \ - to: partname"focus_clip"; \ - } \ - rel2 { \ - to: partname"focus_clip"; \ - } \ - image { \ - normal: "focus.png"; \ - border: 7 7 7 7; \ - } \ - } \ - } \ - part { \ - name: partname"button"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button.png"; \ - border: 7 7 7 7; \ - } \ - } \ - description { \ - state: "disabled" 0.0; \ - inherit: "default" 0.0; \ - image { \ - normal: "button_disabled.png"; \ - border: 11 11 10 10; \ - } \ - } \ - } \ - part { \ - name: partname"shadow"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button_shadow.png"; \ - border: 6 6 0 6; \ - } \ - } \ - description { \ - state: "clicked" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partname"shadow_overlay"; \ - type: IMAGE; \ - mouse_events: 1; \ - clip_to: partname"button_clip"; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 0 24; \ - color: 255 255 255 0; \ - rel1 { \ - to: partname"button_clip"; \ - } \ - rel2 { \ - to: partname"button_clip"; \ - } \ - image { \ - normal: "button_shadow_overlay.png"; \ - border: 6 6 6 13; \ - } \ - } \ - description { \ - state: "clicked" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - } \ - } \ - part { \ - name: partnametext; \ - type: TEXT; \ - mouse_events: 1; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - align: 0.0 0.5; \ - color: 60 60 60 255; \ - fixed: 1 1; \ - rel1 { \ - to: partname; \ - } \ - rel2 { \ - to: partname; \ - } \ - text { \ - text: ""; \ - font: "ecdb/default"; \ - min: 1 1; \ - size: 11; \ - align: 0.5 0.5; \ - } \ - } \ - } - diff --git a/experimental/ecdb/trunk/data/themes/default/macros/check.edc b/experimental/ecdb/trunk/data/themes/default/macros/check.edc deleted file mode 100644 index 12190f0e..00000000 --- a/experimental/ecdb/trunk/data/themes/default/macros/check.edc +++ /dev/null @@ -1,264 +0,0 @@ -/* vim: set sw=3 ts=3 sts=3 expandtab: */ -#define CHECK(partname, labeltext, minx, miny, maxx, maxy, rel1xto, rel1yto, rel1x, rel1y, rel2xto, rel2yto, rel2x, rel2y, offset1x, offset1y, offset2x, offset2y, alignx, aligny) \ - part { \ - name: partname"base"; \ - type: RECT; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: minx miny; \ - max: maxx maxy; \ - align: alignx aligny; \ - color: 0 0 0 0; \ - rel1 { \ - to_x: rel1xto; \ - to_y: rel1yto; \ - relative: rel1x rel1y; \ - offset: offset1x offset1y; \ - } \ - rel2 { \ - to_x: rel2xto; \ - to_y: rel2yto; \ - relative: rel2x rel2y; \ - offset: offset2x offset2y; \ - } \ - } \ - } \ - part { \ - name: partname"check_base"; \ - type: IMAGE; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 20 18; \ - max: 20 18; \ - fixed: 1 1; \ - align: 0.0 0.5; \ - rel1 { \ - to: partname"base"; \ - relative: 0.0 0.0; \ - offset: 2 2; \ - } \ - rel2 { \ - to: partname"base"; \ - relative: 0.0 1.0; \ - offset: -1 -3; \ - } \ - image { \ - normal: "check_base.png"; \ - } \ - } \ - description { \ - state: "disabled" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 128; \ - } \ - } \ - part { \ - name: partname"check_shadow"; \ - type: IMAGE; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 128; \ - image.normal: "check_shadow.png"; \ - rel1 { \ - to: partname; \ - relative: 0.0 0.0; \ - offset: 0 1; \ - } \ - rel2 { \ - to: partname; \ - relative: 1.0 1.0; \ - offset: -1 -1; \ - } \ - } \ - description { \ - state: "focused" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 255; \ - image.normal: "check_focus.png"; \ - rel1 { \ - to: partname; \ - relative: 0.0 0.0; \ - offset: 0 0; \ - } \ - rel2 { \ - to: partname; \ - relative: 1.0 1.0; \ - offset: -1 -1; \ - } \ - } \ - description { \ - state: "disabled" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 0; \ - } \ - } \ - part { \ - name: partname; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: 20 18; \ - max: 20 18; \ - fixed: 1 1; \ - align: 0.0 0.5; \ - rel1 { \ - to: partname"base"; \ - relative: 0.0 0.0; \ - offset: 2 2; \ - } \ - rel2 { \ - to: partname"base"; \ - relative: 0.0 1.0; \ - offset: 2 -3; \ - } \ - image { \ - normal: "check0.png"; \ - } \ - } \ - description { \ - state: "on" 0.0; \ - inherit: "default" 0.0; \ - image { \ - normal: "check2.png"; \ - } \ - } \ - description { \ - state: "disabled_unsel" 0.0; \ - inherit: "default" 0.0; \ - color: 255 255 255 128; \ - } \ - description { \ - state: "disabled_sel" 0.0; \ - inherit: "default" 0.0; \ - image { \ - normal: "check2.png"; \ - } \ - color: 255 255 255 128; \ - } \ - } \ - part { \ - name: labeltext; \ - type: TEXT; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - color: 60 60 60 255; \ - fixed: 1 1; \ - rel1 { \ - to_x: partname"check_base"; \ - to_y: partname; \ - relative: 1.0 0.0; \ - offset: 5 0; \ - } \ - rel2 { \ - relative: 1.0 1.0; \ - to_y: partname; \ - offset: -1 0; \ - } \ - text { \ - text: ""; \ - font: "ecdb/default"; \ - min: 1 1; \ - size: 11; \ - align: 0.0 0.5; \ - } \ - } \ - } - -#define CHECK_PROGS(partname) \ - program { \ - name: partname"focus_in"; \ - signal: "ecdb,focus,in,"partname; \ - signal: "mouse,down,1"; \ - action: STATE_SET "focused" 0.0; \ - source: "*"; \ - target: partname"check_shadow"; \ - } \ - program { \ - name: partname"focus_out"; \ - signal: "ecdb,focus,out,"partname; \ - action: STATE_SET "default" 0.0; \ - source: "ecdb"; \ - target: partname"check_shadow"; \ - } \ - program { \ - name: partname"clicked"; \ - signal: "mouse,clicked,1"; \ - source: partname"*"; \ - script { \ - new str[50]; \ - new Float:val; \ - get_state(PART:partname, str, 50, val); \ - if (!strcmp(str, "on")) \ - { \ - emit(partname",toggle,off", partname); \ - set_state(PART:partname, "default", 0.0); \ - } \ - else if (!strcmp(str, "default")) \ - { \ - emit(partname",toggle,on", partname); \ - set_state(PART:partname, "on", 0.0); \ - } \ - } \ - } \ - program { \ - name: partname"disabled"; \ - signal: "ecdb,disable,"partname; \ - source: "ecdb"; \ - action: STATE_SET "disabled" 0.0; \ - target: partname"check_base"; \ - target: partname"check_shadow"; \ - } \ - program { \ - name: partname"disabled_check"; \ - signal: "ecdb,disable,"partname; \ - source: "ecdb"; \ - script { \ - new str[50]; \ - new Float:val; \ - get_state(PART:partname, str, 50, val); \ - if (!strcmp(str, "on")) \ - set_state(PART:partname, "disabled_sel", 0.0); \ - else if (!strcmp(str, "default")) \ - set_state(PART:partname, "disabled_unsel", 0.0); \ - } \ - } \ - program { \ - name: partname"enabled"; \ - signal: "ecdb,enable,"partname; \ - source: "ecdb"; \ - action: STATE_SET "default" 0.0; \ - target: partname"check_base"; \ - target: partname"check_shadow"; \ - } \ - program { \ - name: partname"enabled_check"; \ - signal: "ecdb,enable,"partname; \ - source: "ecdb"; \ - script { \ - new str[50]; \ - new Float:val; \ - get_state(PART:partname, str, 50, val); \ - if (!strcmp(str, "disabled_sel")) \ - set_state(PART:partname, "on", 0.0); \ - else if (!strcmp(str, "disabled_unsel")) \ - set_state(PART:partname, "default", 0.0); \ - } \ - } \ - program { \ - name: partname"check_off"; \ - signal: "ecdb,check,off,"partname; \ - source: "ecdb"; \ - action: STATE_SET "default" 0.0; \ - target: partname; \ - } \ - program { \ - name: partname"check_on"; \ - signal: "ecdb,check,on,"partname; \ - source: "ecdb"; \ - action: STATE_SET "on" 0.0; \ - target: partname; \ - } diff --git a/experimental/ecdb/trunk/src/ecdb.h b/experimental/ecdb/trunk/src/ecdb.h index 42a30671..edc2ad22 100644 --- a/experimental/ecdb/trunk/src/ecdb.h +++ b/experimental/ecdb/trunk/src/ecdb.h @@ -40,6 +40,7 @@ struct _Ecdb_Main Eina_List *ewl_dnd_candidates; Evas_Object *evas_drop_object; Ewl_Widget *ewl_drop_object; + double scalef; }; extern Ecdb_Main *em; diff --git a/experimental/ecdb/trunk/src/ecdb_gui.c b/experimental/ecdb/trunk/src/ecdb_gui.c index d530ff14..ba437725 100644 --- a/experimental/ecdb/trunk/src/ecdb_gui.c +++ b/experimental/ecdb/trunk/src/ecdb_gui.c @@ -1,15 +1,8 @@ /* vim: set sw=3 ts=3 sts=3 expandtab: */ #include "ecdb.h" -#include static void ecdb_handle_typebuf(Evas_Object *gui); -static void _button_cb_burn_data(void *data, Evas_Object *o, - const char *emission, const char *source); -static void _button_cb_burn_audio(void *data, Evas_Object *o, - const char *emission, const char *source); -static void _button_cb_burn_image(void *data, Evas_Object *o, - const char *emission, const char *source); -static void _button_cb_erase(void *data, Evas_Object *o, +static void ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o, const char *emission, const char *source); static void ecdb_filelist_show(void); static void ecdb_page_hide(const char *pname); @@ -190,7 +183,6 @@ ecdb_create_main_gui(void) Evas_Object *gui; Evas_Coord mw, mh; const char *scale, *engine; - float scalef; engine = getenv("ECDB_ENGINE"); if (engine) @@ -203,7 +195,9 @@ ecdb_create_main_gui(void) em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255); } else + { em->main_win_ee = ecore_evas_software_x11_new(0, 0, 0, 0, 255, 255); + } if (!em->main_win_ee) { @@ -232,16 +226,16 @@ ecdb_create_main_gui(void) /* Make this configurable at some point */ ecdb_set_main_theme(NULL); scale = getenv("ECDB_SCALE"); - scalef = (scale) ? atof(scale) : 1.0; - edje_scale_set(scalef); + em->scalef = (scale) ? atof(scale) : 1.0; + edje_scale_set(em->scalef); gui = edje_object_add(ecore_evas_get(em->main_win_ee)); edje_object_file_set(gui, em->theme_path, "ecdb/window"); edje_object_size_min_get(gui, &mw, &mh); if (mw <= 0) mw = 400; if (mh <= 0) mh = 300; - mw = (int)((float)mw * scalef); - mh = (int)((float)mh * scalef); + mw = (int)((float)mw * em->scalef); + mh = (int)((float)mh * em->scalef); evas_object_resize(gui, mw, mh); ecore_evas_resize(em->main_win_ee, mw, mh); ecore_evas_size_min_set(em->main_win_ee, mw, mh); @@ -361,41 +355,45 @@ ecdb_handle_typebuf(Evas_Object *gui) edje_object_part_text_set(gui, "filelist_overlay_text", NULL); } -static void -_button_cb_burn_data(void *data __UNUSED__, Evas_Object *o, - const char *emission __UNUSED__, - const char *source __UNUSED__) -{ - edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb"); - ecdb_burn_data_page_show(); - ecdb_filelist_show(); -} static void -_button_cb_erase(void *data __UNUSED__, Evas_Object *o, - const char *emission __UNUSED__, - const char *source __UNUSED__) +ecdb_cb_welcome_page_buttons_clicked(void *data, Evas_Object *o, + const char *emission, const char *source) { - edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb"); - ecdb_erase_page_show(); -} + Evas_Object *swallow, *gui; -static void -_button_cb_burn_image(void *data __UNUSED__, Evas_Object *o, - const char *emission __UNUSED__, - const char *source __UNUSED__) -{ - edje_object_signal_emit(o, "ecdb,welcome_page,hide", "ecdb"); - ecdb_burn_image_page_show(); - ecdb_filelist_show(); -} + gui = evas_object_name_find(ecore_evas_get(em->main_win_ee), "gui"); + swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), + "main_filelist"); + if (!strcmp(source, "ecdb/burn_data")) + { + swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), + "welcome_page"); + edje_object_signal_emit(swallow, "ecdb,welcome_page,hide", "ecdb"); + ecdb_burn_data_page_show(); + ecdb_filelist_show(); + } + else if (!strcmp(source, "ecdb/erase")) + { + swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), + "welcome_page"); + edje_object_signal_emit(swallow, "ecdb,welcome_page,hide", "ecdb"); + ecdb_erase_page_show(); + } + else if (!strcmp(source, "ecdb/burn_image")) + { + ecdb_filelist_show(); + swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee), + "welcome_page"); + edje_object_signal_emit(swallow, "ecdb,welcome_page,hide", "ecdb"); + ecdb_burn_image_page_show(); + } + else if (swallow) + { + edje_object_signal_emit(gui, "ecdb,filelist,hide", "ecdb"); + } -static void -_button_cb_burn_audio(void *data __UNUSED__, Evas_Object *o, - const char *emission __UNUSED__, - const char *source) -{ printf("Action: %s\n", source); } @@ -411,6 +409,7 @@ ecdb_welcome_page_show(void) if (!swallow) { + Evas_Object *b; Evas_Coord x, y, w, h; swallow = edje_object_add(ecore_evas_get(em->main_win_ee)); @@ -420,24 +419,24 @@ ecdb_welcome_page_show(void) evas_object_move(swallow, x, y); evas_object_resize(swallow, w, h); edje_object_part_swallow(gui, "action_area", swallow); + edje_object_signal_callback_add(swallow, "mouse,clicked,1", "ecdb/*", + ecdb_cb_welcome_page_buttons_clicked, NULL); edje_object_signal_callback_add(swallow, "hide,finished", "welcome_page", ecdb_page_hide_finished, NULL); evas_object_show(swallow); - edje_object_part_text_set(swallow, "ecdb/burn_data/text", "Burn Data CD"); - edje_object_signal_callback_add(swallow, "ecdb/burn_data,clicked", "*", - _button_cb_burn_data, NULL); - edje_object_part_text_set(swallow, "ecdb/burn_audio/text", - "Burn Audio CD"); - edje_object_signal_callback_add(swallow, "ecdb/burn_audio,clicked", "*", - _button_cb_burn_audio, NULL); - edje_object_part_text_set(swallow, "ecdb/burn_image/text", "Burn Image"); - edje_object_signal_callback_add(swallow, "ecdb/burn_image,clicked", "*", - _button_cb_burn_image, NULL); - edje_object_part_text_set(swallow, "ecdb/erase/text", - "Erase Re-writable Disc"); - edje_object_signal_callback_add(swallow, "ecdb/erase,clicked", "*", - _button_cb_erase, NULL); + int i; + char *labels[] = {"Burn Data CD", "Burn Audio CD", "Burn Image", + "Erase Re-writable Disc"}; + char *ids[] = {"ecdb/burn_data", "ecdb/burn_audio", "ecdb/burn_image", + "ecdb/erase"}; + for (i = 0; i < 4; i++) + { + b = ecdb_button_add(swallow, ids[i]); + ecdb_button_label_set(b, labels[i]); + evas_object_show(b); + ecdb_button_icon_set(b, ids[i]); + } } else if (edje_object_part_swallow_get(gui, "action_area") != swallow)