From: <enl...@li...> - 2004-02-12 05:41:42
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/elicit Dir : e17/apps/elicit/src Modified Files: Elicit.h callbacks.c callbacks.h conf.c conf.h elicit.c Log Message: a few more signals (elicit,freeze; elicit,thaw; elicit,size,min,W,H) Spring theme: add labels and values to the color sliders add a zoom slider set a new min size while in the expanded state freeze before resizing the window and thaw after in a (failed) attempt to minimize jitter at the start of expand and end of collapse. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/Elicit.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Elicit.h 11 Feb 2004 02:49:30 -0000 1.7 +++ Elicit.h 12 Feb 2004 05:37:05 -0000 1.8 @@ -41,6 +41,7 @@ char *hex; } color; double zoom; + double zoom_max; /* flags */ struct { =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- callbacks.c 11 Feb 2004 02:49:30 -0000 1.9 +++ callbacks.c 12 Feb 2004 05:37:05 -0000 1.10 @@ -116,8 +116,6 @@ sscanf(sig, "elicit,switch,%s", group); - printf("switch group to: %s\n", group); - for (l = groups; l; l = l->next) { char *gp = l->data; @@ -171,6 +169,47 @@ } void +elicit_cb_size_min(void *data, Evas_Object *o, const char *sig, const char *src) +{ + Elicit *el = data; + int ow = 0, oh = 0; + int w = 0, h = 0; + char arg[PATH_MAX]; + char *wstr, *hstr, *sub; + int woff = 0, hoff = 0; + + printf("set min\n"); + ecore_evas_size_min_get(el->ee, &ow, &oh); + + /* if we have an arg */ + if (sscanf(sig, "elicit,size,min,%s", arg)) + { + wstr = arg; + sub = strstr(arg, ","); + //printf("arg: %s :: sub: %s\n", arg, sub); + sub[0] = '\0'; + hstr = sub + 1; + + if (wstr[0] == '+') woff = 1; + else if (wstr[0] == '-') woff = -1; + if (hstr[0] == '+') hoff = 1; + else if (hstr[0] == '-') hoff = -1; + + //printf("h: %s, w: %s off:(%d,%d)\n", hstr, wstr, hoff, woff); + if (woff != 0) wstr = wstr + 1; + if (hoff != 0) hstr = hstr + 1; + //printf("h: %s, w: %s off:(%d,%d)\n", hstr, wstr, hoff, woff); + w = atoi(wstr); + h = atoi(hstr); + + //printf("resize: (%d, %d) (%d, %d)\n", w, h, woff, hoff); + ecore_evas_size_min_set(el->ee, + woff ? ow + w * woff : w, + hoff ? oh + h * hoff : h); + } +} + +void elicit_cb_copy(void *data, Evas_Object *o, const char *sig, const char *src) { Elicit *el = data; @@ -217,12 +256,27 @@ el->color.v = vx; elicit_util_colors_set_from_hsv(el); } + else if (!strcmp(src, "zoom-slider")) + { + el->zoom = 1 + (el->zoom_max - 1) * vx; + } elicit_ui_update(el); } - +void +elicit_cb_freeze(void *data, Evas_Object *o, const char *sig, const char *src) +{ + Elicit *el = data; + edje_object_freeze(el->gui); +} +void +elicit_cb_thaw(void *data, Evas_Object *o, const char *sig, const char *src) +{ + Elicit *el = data; + edje_object_thaw(el->gui); +} static int elicit_timer_color(void *data) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- callbacks.h 11 Feb 2004 02:49:30 -0000 1.4 +++ callbacks.h 12 Feb 2004 05:37:05 -0000 1.5 @@ -12,5 +12,8 @@ void elicit_cb_copy(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_resize_sig(void *data, Evas_Object *o, const char *sig, const char *src); void elicit_cb_slider(void *data, Evas_Object *o, const char *sig, const char *src); +void elicit_cb_freeze(void *data, Evas_Object *o, const char *sig, const char *src); +void elicit_cb_thaw(void *data, Evas_Object *o, const char *sig, const char *src); +void elicit_cb_size_min(void *data, Evas_Object *o, const char *sig, const char *src); #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/conf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- conf.c 8 Feb 2004 09:25:59 -0000 1.4 +++ conf.c 12 Feb 2004 05:37:05 -0000 1.5 @@ -33,6 +33,7 @@ */ elicit_config_color_set(255, 255, 255); elicit_config_zoom_set(4.0); + elicit_config_zoom_max_set(20.0); elicit_config_theme_set("winter"); ecore_config_save(); } @@ -79,6 +80,24 @@ } void +elicit_config_zoom_max_set(double zoom_max) +{ + ecore_config_set_float("/settings/zoom_max", (float)zoom_max); +} + +double +elicit_config_zoom_max_get() +{ + double max = (double)ecore_config_get_float("/settings/zoom_max"); + if (max < 10.0) + { + max = 10.0; + ecore_config_set_float("/settings/zoom_max", (float)max); + } + return max; +} + +void elicit_config_color_get(int *r, int *g, int *b) { if (r) *r = ecore_config_get_int("/color/r"); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/conf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- conf.h 8 Feb 2004 04:02:09 -0000 1.2 +++ conf.h 12 Feb 2004 05:37:05 -0000 1.3 @@ -23,5 +23,8 @@ void elicit_config_zoom_set(double zoom); double elicit_config_zoom_get(); +void elicit_config_zoom_max_set(double zoom_max); +double elicit_config_zoom_max_get(); + #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/elicit.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- elicit.c 11 Feb 2004 02:49:30 -0000 1.10 +++ elicit.c 12 Feb 2004 05:37:05 -0000 1.11 @@ -71,6 +71,7 @@ /* shutdown the subsystems (when event loop exits, app is done) */ elicit_config_zoom_set(el->zoom); + elicit_config_zoom_max_set(el->zoom_max); elicit_config_color_set(el->color.r, el->color.g, el->color.b); elicit_config_shutdown(el); ecore_evas_shutdown(); @@ -100,6 +101,7 @@ elicit_config_color_get(&el->color.r, &el->color.g, &el->color.b); elicit_util_colors_set_from_rgb(el); el->zoom = elicit_config_zoom_get(); + el->zoom_max = elicit_config_zoom_max_get(); /* create the swatch and shot objects */ el->shot = evas_object_image_add(el->evas); @@ -167,6 +169,9 @@ edje_object_signal_callback_add(el->gui, "elicit,copy,*", "*", elicit_cb_copy, el); edje_object_signal_callback_add(el->gui, "elicit,resize,*", "*", elicit_cb_resize_sig, el); edje_object_signal_callback_add(el->gui, "drag", "*-slider", elicit_cb_slider, el); + edje_object_signal_callback_add(el->gui, "elicit,freeze", "*", elicit_cb_freeze, el); + edje_object_signal_callback_add(el->gui, "elicit,thaw", "*", elicit_cb_thaw, el); + edje_object_signal_callback_add(el->gui, "elicit,size,min,*", "*", elicit_cb_size_min, el); evas_object_hide(el->gui); evas_object_show(el->gui); @@ -179,27 +184,35 @@ snprintf(buf, sizeof(buf)-1, "%d", el->color.r); edje_object_part_text_set(el->gui, "red-val", buf); + edje_object_part_text_set(el->gui, "red-val2", buf); snprintf(buf, sizeof(buf)-1, "%d", el->color.g); edje_object_part_text_set(el->gui, "green-val", buf); + edje_object_part_text_set(el->gui, "green-val2", buf); snprintf(buf, sizeof(buf)-1, "%d", el->color.b); edje_object_part_text_set(el->gui, "blue-val", buf); + edje_object_part_text_set(el->gui, "blue-val2", buf); snprintf(buf, sizeof(buf)-1, "%.0f", el->color.h); edje_object_part_text_set(el->gui, "hue-val", buf); + edje_object_part_text_set(el->gui, "hue-val2", buf); snprintf(buf, sizeof(buf)-1, "%.2f", el->color.s); edje_object_part_text_set(el->gui, "sat-val", buf); + edje_object_part_text_set(el->gui, "sat-val2", buf); snprintf(buf, sizeof(buf)-1, "%.2f", el->color.v); edje_object_part_text_set(el->gui, "val-val", buf); + edje_object_part_text_set(el->gui, "val2-val", buf); snprintf(buf, sizeof(buf)-1, "%s", el->color.hex); edje_object_part_text_set(el->gui, "hex-val", buf); + edje_object_part_text_set(el->gui, "hex-val2", buf); snprintf(buf, sizeof(buf)-1, "%.2f", el->zoom); edje_object_part_text_set(el->gui, "zoom-val", buf); + edje_object_part_text_set(el->gui, "zoom-val2", buf); /* thaw here to force edje to recalc */ edje_object_thaw(el->gui); @@ -208,12 +221,23 @@ void elicit_ui_update_sliders(Elicit *el) { - edje_object_part_drag_value_set(el->gui, "red-slider", (double)el->color.r / 255, 1); - edje_object_part_drag_value_set(el->gui, "green-slider", (double)el->color.g / 255, 1); - edje_object_part_drag_value_set(el->gui, "blue-slider", (double)el->color.b / 255, 1); - edje_object_part_drag_value_set(el->gui, "hue-slider", (double)el->color.h / 360, 1); - edje_object_part_drag_value_set(el->gui, "sat-slider", (double)el->color.s, 1); - edje_object_part_drag_value_set(el->gui, "val-slider", (double)el->color.v, 1); + double v = 0; + + v = (double)el->color.r / 255; + edje_object_part_drag_value_set(el->gui, "red-slider", v, v); + v = (double)el->color.g / 255; + edje_object_part_drag_value_set(el->gui, "green-slider", v, v); + v = (double)el->color.b / 255; + edje_object_part_drag_value_set(el->gui, "blue-slider", v, v); + v = (double)el->color.h / 360; + edje_object_part_drag_value_set(el->gui, "hue-slider", v, v); + v = (double)el->color.s; + edje_object_part_drag_value_set(el->gui, "sat-slider", v, v); + v = (double)el->color.v; + edje_object_part_drag_value_set(el->gui, "val-slider", v, v); + v = (double)el->zoom / el->zoom_max; + edje_object_part_drag_value_set(el->gui, "zoom-slider", v, v); + } void |