From 45ad964b158499ce39c2485c8be4e20884b4234b Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Wed, 24 Dec 2008 22:59:59 +0000 Subject: [PATCH] Add in a capacity widget and set up the callbacks to update it. --- .../trunk/data/themes/default/default.edc | 1 + .../data/themes/default/groups/Makefile.am | 1 + .../data/themes/default/groups/burn_data.edc | 47 ++++- .../data/themes/default/groups/capacity.edc | 195 ++++++++++++++++++ .../data/themes/default/groups/window.edc | 6 +- .../data/themes/default/images/images.edc | 4 + .../default/images/progress_bar_fill_0.png | Bin 0 -> 746 bytes .../default/images/progress_bar_left.png | Bin 0 -> 181 bytes .../default/images/progress_bar_right.png | Bin 0 -> 187 bytes .../themes/default/images/progress_trough.png | Bin 0 -> 333 bytes experimental/ecdb/trunk/src/ecdb.c | 2 + experimental/ecdb/trunk/src/ecdb.h | 1 + .../ecdb/trunk/src/ecdb_burn_data_gui.c | 24 +++ experimental/ecdb/trunk/src/ecdb_common.h | 1 + .../ecdb/trunk/src/ecdb_filelist_custom.c | 5 + experimental/ecdb/trunk/src/ecdb_image.c | 4 + experimental/ecdb/trunk/src/ecdb_widgets.h | 1 + 17 files changed, 288 insertions(+), 4 deletions(-) create mode 100644 experimental/ecdb/trunk/data/themes/default/groups/capacity.edc create mode 100644 experimental/ecdb/trunk/data/themes/default/images/progress_bar_fill_0.png create mode 100644 experimental/ecdb/trunk/data/themes/default/images/progress_bar_left.png create mode 100644 experimental/ecdb/trunk/data/themes/default/images/progress_bar_right.png create mode 100644 experimental/ecdb/trunk/data/themes/default/images/progress_trough.png diff --git a/experimental/ecdb/trunk/data/themes/default/default.edc b/experimental/ecdb/trunk/data/themes/default/default.edc index 8a47d4ee..26e4f432 100644 --- a/experimental/ecdb/trunk/data/themes/default/default.edc +++ b/experimental/ecdb/trunk/data/themes/default/default.edc @@ -17,4 +17,5 @@ collections { #include "groups/combo.edc" #include "groups/label.edc" #include "groups/burn_data.edc" + #include "groups/capacity.edc" } diff --git a/experimental/ecdb/trunk/data/themes/default/groups/Makefile.am b/experimental/ecdb/trunk/data/themes/default/groups/Makefile.am index 9120d5dd..ba64f616 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/Makefile.am +++ b/experimental/ecdb/trunk/data/themes/default/groups/Makefile.am @@ -9,4 +9,5 @@ EXTRA_DIST= burn_data.edc \ icons.edc \ label.edc \ welcome_page.edc \ + capacity.edc \ window.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 6223d24a..29637965 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/burn_data.edc @@ -142,6 +142,28 @@ group { } } + part { + name: "ecdb/burn_data/vol_name"; + type: SWALLOW; + repeat_events: 1; + + description { + state: "default" 0.0; + + rel1 { + to: "ecdb/burn_data/speed"; + relative: 0.0 1.0; + offset: 0 5; + } + + rel2 { + to: "ecdb/burn_data/speed"; + relative: 1.0 1.0; + offset: 0 30; + } + } + } + /* Missing a description later */ part { name: "ecdb/burn_data/filelist"; @@ -160,7 +182,30 @@ group { rel2 { to: "bg"; relative: 0.5 1.0; - offset: -1 -10; + offset: -1 -26; + } + } + } + + part { + name: "ecdb/burn_data/capacity"; + type: SWALLOW; + repeat_events: 0; + + description { + state: "default" 0.0; + max: 99999 20; + + rel1 { + to: "bg"; + relative: 0.0 1.0; + offset: 10 -23; + } + + rel2 { + to: "bg"; + relative: 1.0 1.0; + offset: -11 -1; } } } diff --git a/experimental/ecdb/trunk/data/themes/default/groups/capacity.edc b/experimental/ecdb/trunk/data/themes/default/groups/capacity.edc new file mode 100644 index 00000000..a940e2c1 --- /dev/null +++ b/experimental/ecdb/trunk/data/themes/default/groups/capacity.edc @@ -0,0 +1,195 @@ +/* vim: set sw=3 ts=3 sts=3 expandtab: */ +group { + name: "ecdb/capacity"; + max: 999999 20; + + script { + public message(Msg_Type:type, id, ...) { + if ((type == MSG_FLOAT) && (id == 1)) { + new Float:freq; + freq = getfarg(2); + set_drag(PART:"draggie", freq, 0.0); + } + } + } + + parts { + part { + name: "confine"; + mouse_events: 0; + type: RECT; + + description { + state: "default" 0.0; + min: 0 17; + fixed: 1 1; + + rel1 { + relative: 0.0 0.0; + offset: 2 1; + } + + rel2 { + relative: 1.0 1.0; + offset: -2 -3; + } + } + } + + part { + name: "bg"; + type: IMAGE; + + description { + state: "default" 0.0; + fixed: 1 1; + + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + + rel2 { + relative: 1.0 1.0; + offset: -1 -1; + } + + image { + normal: "progress_trough.png"; + border: 3 3 3 4; + } + + fill { + smooth: 0; + } + } + } + + part { + name: "progress_left"; + type: IMAGE; + clip_to: "confine"; + + description { + state: "default" 0.0; + fixed: 1 1; + min: 2 17; + max: 2 17; + + rel1 { + to: "confine"; + relative: 0.0 0.0; + offset: 0 0; + } + + rel2 { + to: "confine"; + relative: 0.0 1.0; + offset: -1 -1; + } + + image { + normal: "progress_bar_left.png"; + } + + fill { + smooth: 0; + } + } + } + + part { + name: "draggie"; + type: RECT; + clip_to: "confine"; + + dragable { + confine: "confine"; + x: 1 1 0; + y: 0 0 0; + } + + description { + state: "default" 0.0; + min: 1 21; + fixed: 1 1; + color: 0 0 0 0; + + rel1 { + relative: 0.0 0.0; + } + + rel2 { + relative: 0.0 1.0; + } + } + } + + part { + name: "fill"; + type: IMAGE; + mouse_events: 0; + clip_to: "confine"; + + description { + state: "default" 0.0; + fixed: 1 1; + + rel1 { + relative: 1.0 0.0; + offset: 0 0; + to: "progress_left"; + } + + rel2 { + relative: 0.0 1.0; + offset: -1 -1; + to: "draggie"; + } + + image { + normal: "progress_bar_fill_0.png"; + } + + fill { + smooth: 1; + size { + relative: 0.0 0.0; + offset: 28 17; + } + } + } + } + + part { + name: "progress_right"; + type: IMAGE; + + description { + state: "default" 0.0; + fixed: 1 1; + min: 2 17; + max: 2 17; + + rel1 { + to: "fill"; + relative: 1.0 0.0; + } + + rel2 { + to: "fill"; + relative: 1.0 1.0; + } + + image { + normal: "progress_bar_right.png"; + } + + fill { + smooth: 0; + } + } + } + } +} + diff --git a/experimental/ecdb/trunk/data/themes/default/groups/window.edc b/experimental/ecdb/trunk/data/themes/default/groups/window.edc index edec1dfe..9609ca88 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/window.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/window.edc @@ -1,7 +1,7 @@ /* vim: set sw=3 ts=3 sts=3 expandtab: */ group { name: "ecdb/window"; - min: 640 360; + min: 640 390; parts { part { @@ -10,7 +10,7 @@ group { description { state: "default" 0.0; - min: 640 360; + min: 640 390; max: 999999 999999; rel1 { @@ -62,7 +62,7 @@ group { rel2 { relative: 1.0 1.0; - offset: 0 -175; + offset: 0 -230; } } } diff --git a/experimental/ecdb/trunk/data/themes/default/images/images.edc b/experimental/ecdb/trunk/data/themes/default/images/images.edc index 11f23283..6d7d6587 100644 --- a/experimental/ecdb/trunk/data/themes/default/images/images.edc +++ b/experimental/ecdb/trunk/data/themes/default/images/images.edc @@ -25,4 +25,8 @@ images { image: "combobox_button_clicked.png" COMP; image: "combobox_button_disabled.png" COMP; image: "combo_arrow.png" COMP; + image: "progress_bar_fill_0.png" COMP; + image: "progress_bar_left.png" COMP; + image: "progress_bar_right.png" COMP; + image: "progress_trough.png" COMP; } diff --git a/experimental/ecdb/trunk/data/themes/default/images/progress_bar_fill_0.png b/experimental/ecdb/trunk/data/themes/default/images/progress_bar_fill_0.png new file mode 100644 index 0000000000000000000000000000000000000000..28e3a5b0bb65b1b18c1213be7eb9dd999daf5618 GIT binary patch literal 746 zcmVWFU8GbZ8()Nlj27VtF8FbaZe!FE3+na%E&LZ*pg!6A0}9 z00KTqL_t(I%e|F7YZXBhhM$=o5kw2Y%Fb30zw$RkPzzHi1hi2hHdaCq3+)seOGQMq zvk)W^@)y$CnL@C!FtPHIJ9Ex!F|#-KBYF`b1G~lU&hx(SoH?@rILbbbu(GnEeH9!G z26F`k1PKCs-rNF&q}`VYBs4o~hLr}t26HU+Q^mWrFBL4WNO=|a-he>9Yi4R(yLg6F zy!<^{8*f%OtAK+VxKAptA|VJjpPdXWT{=rCMzW#pspW_eK!Vq+U%{;k;mBJ$IWKjT7ck2s zUMkaq3J?SiFV?=d6uSxBg&I)JNdFD8F;Q`6@ie9631-SUPc3D=z5KM*guFo;tX;@( z30c2^Y|Naqym*RncF#@QKei_y0uSE)L}o}JWiUs0tBoU5T~;|#u5~oS5xDVm`8?y? zadz4%!`3Yk{axFr)wg literal 0 HcmV?d00001 diff --git a/experimental/ecdb/trunk/data/themes/default/images/progress_bar_right.png b/experimental/ecdb/trunk/data/themes/default/images/progress_bar_right.png new file mode 100644 index 0000000000000000000000000000000000000000..b97c5f59179d131872669cbab7e78bca0a150358 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^Oh7Ei!3HG1f2kD&Qfx`y?k)^n467L)GME-C14TFs zJR*x37=*6_aR*~u&}NW+_7YEDSN7}7atvw=-^1hcfkKict`Q~9`MJ5Nc_j?aMX8A; zsVNHOnI#zt?w-B@;f;LaKt;-)E{-7_*OOBc5(I!aAz{Vp)xXalIG}Li2m>qgp@f#5 a>q`WTzQfx`y?k)^h7z`K;+FQ2Y0*Y`J zctjR6FbH1<;ts~Rpv@rt>?NMQuI$&DWf&Dz^zZc_1qw-)xJHyX=jZ08=9Mrw7o{ea zq^2m8XO?6rxO@5rgg5eu0~Kxcba4#vIR18uBVV%t4@wq#DlmhAR@?_)(>ls%`f6P|cjxkZI($CBp;ECS41b9YD15UO7A*rHDK zpuo0$kM{i+=v0}%kCCM%C)TCTH-Rll(eaGVy=GEnt$zcVY? zVcN9>$!Xu8C*IxEcIjG(vGSh(lQtdu5$MX5^Zv^95YIo3t5`EtUKZ}3%h$9!K0DwE ZtAv8&theme_path, "ecdb/capacity"); + evas_object_data_set(b, "source", src); + ecore_event_handler_add(ECDB_FILELIST_SIZE_CHANGED, _update_capacity, b); + evas_object_show(b); } else if (edje_object_part_swallow_get(gui, "action_area") != swallow) diff --git a/experimental/ecdb/trunk/src/ecdb_common.h b/experimental/ecdb/trunk/src/ecdb_common.h index 1b316e70..612695f3 100644 --- a/experimental/ecdb/trunk/src/ecdb_common.h +++ b/experimental/ecdb/trunk/src/ecdb_common.h @@ -92,6 +92,7 @@ struct _Ecdb_Source const char *dst; unsigned char dir:1; unsigned int num_children; + long long size; //Sizeof itself and children Ecdb_Source **children; Ecdb_Source *parent; IsoNode *node; diff --git a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c index 86321d74..5904dab7 100644 --- a/experimental/ecdb/trunk/src/ecdb_filelist_custom.c +++ b/experimental/ecdb/trunk/src/ecdb_filelist_custom.c @@ -77,6 +77,10 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev, (EWL_MVC(EWL_FILELIST(w)->controller)), 0, EWL_SORT_DIRECTION_ASCENDING); ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(w)->controller), TRUE); + + // Send out this event so that we can get notified on size changes + // and update the capacity measure + ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL); } void @@ -308,6 +312,7 @@ ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, void *data) ecdb_source_child_remove(parent, child); ecdb_source_destroy(child); ecdb_custom_filelist_directory_set(fl, parent); + ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL); break; } } diff --git a/experimental/ecdb/trunk/src/ecdb_image.c b/experimental/ecdb/trunk/src/ecdb_image.c index cef37357..d53c12ea 100644 --- a/experimental/ecdb/trunk/src/ecdb_image.c +++ b/experimental/ecdb/trunk/src/ecdb_image.c @@ -28,6 +28,7 @@ ecdb_source_init(Ecdb_Source *src) { src->dir = FALSE; src->num_children = 0; + src->size = 0; src->children = calloc(1, sizeof(Ecdb_Source)); if (!src->children) { @@ -65,6 +66,7 @@ ecdb_source_data_set(Ecdb_Source *src, const char *dst) } src->dst = eina_stringshare_add(dst); + src->size = ecore_file_size(dst); /* Add the files recursively here */ if (ecore_file_is_dir(src->dst)) @@ -109,6 +111,7 @@ ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child) (src->num_children + 1)); src->children[src->num_children - 1] = child; src->children[src->num_children] = NULL; + src->size += child->size; child->parent = src; } @@ -146,6 +149,7 @@ ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child) FREE(src->children); src->children = temp; src->num_children--; + src->size -= child->size; child->parent = NULL; } diff --git a/experimental/ecdb/trunk/src/ecdb_widgets.h b/experimental/ecdb/trunk/src/ecdb_widgets.h index 88a425c0..b28daf01 100644 --- a/experimental/ecdb/trunk/src/ecdb_widgets.h +++ b/experimental/ecdb/trunk/src/ecdb_widgets.h @@ -3,6 +3,7 @@ #define ECDB_WIDGETS_H void ecdb_widget_focus_callback_add(Evas_Object *o, const char *name); +Evas_Object *ecdb_widget_add(Evas_Object *parent, const char *name); Evas_Object *ecdb_button_add(Evas_Object *parent, const char *name); void ecdb_button_label_set(Evas_Object *b, const char *label);