Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_enums.h ewl_histogram.c ewl_histogram.h Log Message: - formatting and cleanup =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- ewl_enums.h 26 Sep 2006 18:04:44 -0000 1.55 +++ ewl_enums.h 26 Sep 2006 18:33:47 -0000 1.56 @@ -128,38 +128,37 @@ /* * Behavior modifying properties. */ - EWL_FLAG_PROPERTY_RECURSIVE = 0x1000, /**< Widget is recursive */ - EWL_FLAG_PROPERTY_TOPLEVEL = 0x2000, /**< Widget is a top level widget */ - EWL_FLAG_PROPERTY_INTERNAL = 0x4000, /**< Widget is internal */ + EWL_FLAG_PROPERTY_RECURSIVE = 0x1000, /**< Widget is recursive */ + EWL_FLAG_PROPERTY_TOPLEVEL = 0x2000, /**< Widget is a top level widget */ + EWL_FLAG_PROPERTY_INTERNAL = 0x4000, /**< Widget is internal */ EWL_FLAG_PROPERTY_BLOCK_TAB_FOCUS = 0x8000, /**< Widget will block tab focus changes */ - EWL_FLAG_PROPERTY_FOCUSABLE = 0x10000, /**< Widget is focusable */ - EWL_FLAG_PROPERTY_IN_TAB_LIST = 0x20000, /**< Widget is in the tab order */ + EWL_FLAG_PROPERTY_FOCUSABLE = 0x10000, /**< Widget is focusable */ + EWL_FLAG_PROPERTY_IN_TAB_LIST = 0x20000, /**< Widget is in the tab order */ + EWL_FLAG_PROPERTY_DND_TARGET = 0x40000, /**< Widget is DND aware */ + EWL_FLAG_PROPERTY_DND_SOURCE = 0x80000, /**< Widget is dragable */ /* * Flags to indicate queues this object is on. */ - EWL_FLAG_QUEUED_CSCHEDULED = 0x40000, /**< Configure scheduled */ - EWL_FLAG_QUEUED_RSCHEDULED = 0x80000, /**< Reveal scheduled */ - EWL_FLAG_QUEUED_DSCHEDULED = 0x100000, /**< Delete scheduled */ + EWL_FLAG_QUEUED_CSCHEDULED = 0x100000, /**< Configure scheduled */ + EWL_FLAG_QUEUED_RSCHEDULED = 0x200000, /**< Reveal scheduled */ + EWL_FLAG_QUEUED_DSCHEDULED = 0x400000, /**< Delete scheduled */ - EWL_FLAG_QUEUED_CPROCESS = 0x200000, /**< Configure in progress */ - EWL_FLAG_QUEUED_RPROCESS = 0x400000, /**< Reveal in progress */ - EWL_FLAG_QUEUED_DPROCESS = 0x800000, /**< Delete in progress */ + EWL_FLAG_QUEUED_CPROCESS = 0x800000, /**< Configure in progress */ + EWL_FLAG_QUEUED_RPROCESS = 0x1000000, /**< Reveal in progress */ + EWL_FLAG_QUEUED_DPROCESS = 0x2000000, /**< Delete in progress */ /* * The state enum specifies the current state of a widget, ie. has it * been clicked, does it have the keyboard focus, etc. */ - EWL_FLAG_STATE_NORMAL = 0, /**< Widget state normal */ - EWL_FLAG_STATE_MOUSE_IN = 0x1000000, /**< Mouse is in the widget */ - EWL_FLAG_STATE_PRESSED = 0x2000000, /**< Widget is pressed */ - EWL_FLAG_STATE_FOCUSED = 0x40000000, /**< Widget has focus */ - EWL_FLAG_STATE_DND = 0x8000000, /**< Widget is engaged in DND */ - EWL_FLAG_STATE_DISABLED = 0x10000000, /**< Widget is disabled */ - - EWL_FLAG_PROPERTY_DND_TARGET = 0x20000000, /**< Widget is DND aware */ - EWL_FLAG_PROPERTY_DND_SOURCE = 0x40000000, /**< Widget is dragable */ - EWL_FLAG_STATE_DND_WAIT = 0x80000000, /**< Widget is in DND wait state */ + EWL_FLAG_STATE_NORMAL = 0, /**< Widget state normal */ + EWL_FLAG_STATE_MOUSE_IN = 0x4000000, /**< Mouse is in the widget */ + EWL_FLAG_STATE_PRESSED = 0x8000000, /**< Widget is pressed */ + EWL_FLAG_STATE_FOCUSED = 0x10000000, /**< Widget has focus */ + EWL_FLAG_STATE_DISABLED = 0x20000000, /**< Widget is disabled */ + EWL_FLAG_STATE_DND = 0x40000000, /**< Widget is engaged in DND */ + EWL_FLAG_STATE_DND_WAIT = 0x80000000, /**< Widget is in DND wait state */ }; /** =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_histogram.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_histogram.c 14 Sep 2006 01:34:43 -0000 1.3 +++ ewl_histogram.c 26 Sep 2006 18:33:47 -0000 1.4 @@ -18,6 +18,9 @@ DENTER_FUNCTION(DLEVEL_STABLE); hist = calloc(1, sizeof(Ewl_Histogram)); + if (!hist) + DRETURN_PTR(NULL, DLEVEL_STABLE); + if (!ewl_histogram_init(hist)) { FREE(hist); } @@ -33,23 +36,22 @@ int ewl_histogram_init(Ewl_Histogram *hist) { - int result; Ewl_Widget *w = EWL_WIDGET(hist); DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("hist", hist, FALSE); - result = ewl_image_init(EWL_IMAGE(hist)); - if (result) { - ewl_widget_appearance_set(w, EWL_HISTOGRAM_TYPE); - ewl_widget_inherit(w, EWL_HISTOGRAM_TYPE); - ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, + if (!ewl_image_init(EWL_IMAGE(hist))) + DRETURN_INT(FALSE, DLEVEL_STABLE); + + ewl_widget_appearance_set(w, EWL_HISTOGRAM_TYPE); + ewl_widget_inherit(w, EWL_HISTOGRAM_TYPE); + ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_histogram_cb_configure, NULL); - ewl_object_preferred_inner_size_set(EWL_OBJECT(hist), 256, 256); - hist->channel = EWL_HISTOGRAM_CHANNEL_R; - } + ewl_object_preferred_inner_size_set(EWL_OBJECT(hist), 256, 256); + hist->channel = EWL_HISTOGRAM_CHANNEL_R; - DRETURN_INT(result, DLEVEL_STABLE); + DRETURN_INT(TRUE, DLEVEL_STABLE); } /** @@ -91,14 +93,10 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("hist", hist); - if (r) - *r = hist->color.r; - if (g) - *g = hist->color.g; - if (b) - *b = hist->color.b; - if (a) - *a = hist->color.a; + if (r) *r = hist->color.r; + if (g) *g = hist->color.g; + if (b) *b = hist->color.b; + if (a) *a = hist->color.a; DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -156,14 +154,13 @@ { DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("hist", hist); - DCHECK_TYPE("hist", hist, EWL_HISTOGRAM_TYPE); DCHECK_PARAM_PTR("image", image); + DCHECK_TYPE("hist", hist, EWL_HISTOGRAM_TYPE); DCHECK_TYPE("image", image, EWL_IMAGE_TYPE); hist->source = image; - if (REALIZED(image)) { + if (REALIZED(image)) ewl_histogram_cb_data_load(EWL_WIDGET(hist), NULL, hist); - } /* Append the callback to catch an obscure/reveal */ ewl_callback_append(EWL_WIDGET(image), EWL_CALLBACK_REVEAL, @@ -187,6 +184,19 @@ DRETURN_PTR(EWL_IMAGE(hist->source), DLEVEL_STABLE); } +void +ewl_histogram_cb_configure(Ewl_Widget *w, void *event __UNUSED__, + void *data __UNUSED__) +{ + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); + DCHECK_TYPE("w", w, EWL_WIDGET_TYPE); + + ewl_histogram_draw(EWL_HISTOGRAM(w)); + + DLEAVE_FUNCTION(DLEVEL_STABLE); +} + #define A_CALC(color) ((color) >> 24) #define R_CALC(color) ((color << 8) >> 24) #define G_CALC(color) ((color << 16) >> 24) @@ -194,7 +204,7 @@ #define Y_CALC(color) (((R_CALC(color) * 299) + (G_CALC(color) * 587) + (B_CALC(color) * 114)) / 1000) static void -ewl_histogram_cb_data_load(Ewl_Widget *w, void *ev __UNUSED__, void *h __UNUSED__) +ewl_histogram_cb_data_load(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *h) { int x, y; int maxv = 0; @@ -254,16 +264,6 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } -void -ewl_histogram_cb_configure(Ewl_Widget *w, void *event, void *data) -{ - DENTER_FUNCTION(DLEVEL_STABLE); - - ewl_histogram_draw(EWL_HISTOGRAM(w)); - - DLEAVE_FUNCTION(DLEVEL_STABLE); -} - static void ewl_histogram_draw(Ewl_Histogram *hist) { @@ -274,6 +274,8 @@ Evas_Object *img; DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("hist", hist); + DCHECK_TYPE("hist", hist, EWL_HISTOGRAM_TYPE); img = EWL_IMAGE(hist)->image; @@ -283,7 +285,7 @@ dst = data = evas_object_image_data_get(img, 1); if (!data) - return; + DRETURN(DLEVEL_STABLE); /* * If no color specified, choose a sane default for the channel @@ -306,7 +308,10 @@ } } else - color = (unsigned int)(hist->color.a << 24 | hist->color.r << 16 | hist->color.g << 8 | hist->color.b); + color = (unsigned int)(hist->color.a << 24 | + hist->color.r << 16 | + hist->color.g << 8 | + hist->color.b); for (y = 0; y < img_h; y++) { for (x = 0; x < img_w; x++) { @@ -331,7 +336,8 @@ cutoff = hist->graph[index]; /* Determine if this index should be weighted */ - if (x_scale != w1 && index < 255 && (cutoff || hist->graph[index + 1])) { + if ((x_scale != w1) && (index < 255) + && (cutoff || hist->graph[index + 1])) { cutoff = (cutoff * (w2 - x_scale)); cutoff += (hist->graph[index + 1] * (x_scale - w1)); cutoff = (cutoff / (w2 - w1)); @@ -349,3 +355,4 @@ DLEAVE_FUNCTION(DLEVEL_STABLE); } + =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_histogram.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_histogram.h 14 Sep 2006 01:34:43 -0000 1.3 +++ ewl_histogram.h 26 Sep 2006 18:33:47 -0000 1.4 @@ -49,16 +49,25 @@ Ewl_Histogram_Channel channel; /**< Channel of data for graphing */ }; -Ewl_Widget *ewl_histogram_new(void); -int ewl_histogram_init(Ewl_Histogram *histogram); -void ewl_histogram_color_set(Ewl_Histogram *histogram, int r, int g, int b, int a); -void ewl_histogram_color_get(Ewl_Histogram *histogram, int *r, int *g, int *b, int *a); -void ewl_histogram_image_set(Ewl_Histogram *histogram, Ewl_Image *image); -Ewl_Image *ewl_histogram_image_get(Ewl_Histogram *histogram); -void ewl_histogram_channel_set(Ewl_Histogram *histogram, Ewl_Histogram_Channel channel); +Ewl_Widget *ewl_histogram_new(void); +int ewl_histogram_init(Ewl_Histogram *histogram); + +void ewl_histogram_color_set(Ewl_Histogram *histogram, + int r, int g, + int b, int a); +void ewl_histogram_color_get(Ewl_Histogram *histogram, + int *r, int *g, + int *b, int *a); + +void ewl_histogram_image_set(Ewl_Histogram *histogram, + Ewl_Image *image); +Ewl_Image *ewl_histogram_image_get(Ewl_Histogram *histogram); + +void ewl_histogram_channel_set(Ewl_Histogram *histogram, + Ewl_Histogram_Channel channel); Ewl_Histogram_Channel ewl_histogram_channel_get(Ewl_Histogram *histogram); -/** +/* * Internally used callbacks, override at your own risk */ void ewl_histogram_cb_configure(Ewl_Widget *w, void *event, void *data); @@ -68,3 +77,4 @@ */ #endif + ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs