From: Daniel Caujolle-B. <f1...@us...> - 2004-04-09 15:56:39
|
Update of /cvsroot/xine/xine-ui/src/xitk/xine-toolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16272/xine-toolkit Modified Files: README _config.h _xitk.h checkbox.c combo.c config.c image.c image.h test.c xitk.c xitk.h Log Message: add two new check style (used in menus and checkboxes), round and check (check is now the default one). Can be changed in the xitk rc file. Index: README =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/README,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- README 26 Mar 2004 22:16:26 -0000 1.6 +++ README 9 Apr 2004 15:43:07 -0000 1.7 @@ -64,8 +64,11 @@ # Use old title bar style (blueish): 0/1 (default = 0) feature.old_title_style = 1 +# Check{box/menu} style (can be: round, check or old) (default = check) +feature.check_style = round + # Enable/disable menus shortcuts displaying (default = 1) -menus.shortcuts = 1; +menus.shortcuts = 1 -- Index: _config.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/_config.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- _config.h 26 Mar 2004 22:16:26 -0000 1.11 +++ _config.h 9 Apr 2004 15:43:13 -0000 1.12 @@ -57,6 +57,7 @@ struct { int shm; int oldbarstyle; + int checkstyle; } features; struct { @@ -69,6 +70,7 @@ xitk_config_t *xitk_config_init(void); void xitk_config_deinit(xitk_config_t *xtcf); int xitk_config_get_barstyle_feature(xitk_config_t *xtcf); +int xitk_config_get_checkstyle_feature(xitk_config_t *xtcf); int xitk_config_get_shm_feature(xitk_config_t *xtcf); char *xitk_config_get_system_font(xitk_config_t *xtcf); char *xitk_config_get_default_font(xitk_config_t *xtcf); Index: _xitk.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/_xitk.h,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- _xitk.h 26 Mar 2004 22:16:26 -0000 1.74 +++ _xitk.h 9 Apr 2004 15:43:13 -0000 1.75 @@ -268,6 +268,10 @@ #define DIRECTION_LEFT 3 #define DIRECTION_RIGHT 4 +#define CHECK_STYLE_OLD 1 +#define CHECK_STYLE_CHECK 2 +#define CHECK_STYLE_ROUND 3 + int xitk_x_error; #ifndef _XITK_C_ @@ -312,6 +316,7 @@ unsigned long xitk_get_timer_label_animation(void); long int xitk_get_timer_dbl_click(void); int xitk_get_barstyle_feature(void); +int xitk_get_checkstyle_feature(void); unsigned long xitk_get_warning_foreground(void); unsigned long xitk_get_warning_background(void); void xitk_modal_window(Window w); @@ -349,6 +354,7 @@ int xitk_get_bool_value(const char *val); + struct xitk_font_s { Display *display; #ifdef WITH_XFT Index: checkbox.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/checkbox.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- checkbox.c 29 Jan 2004 22:19:52 -0000 1.35 +++ checkbox.c 9 Apr 2004 15:43:13 -0000 1.36 @@ -385,7 +385,7 @@ XITK_CHECK_CONSTITENCY(cb); i = xitk_image_create_image(cb->imlibdata, width * 3, height); - draw_bevel_three_state(cb->imlibdata, i); + draw_checkbox_check(cb->imlibdata, i); return _xitk_checkbox_create(wl, NULL, cb, x, y, NULL, i, 0, 0); } Index: combo.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/combo.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- combo.c 30 Mar 2004 22:41:39 -0000 1.37 +++ combo.c 9 Apr 2004 15:43:13 -0000 1.38 @@ -689,8 +689,6 @@ *lw = private_data->label_widget; if(bw) *bw = private_data->button_widget; - - { int x, y; @@ -777,13 +775,13 @@ { xitk_image_t *wimage = xitk_get_widget_foreground_skin(private_data->label_widget); - if(wimage) { + if(wimage) draw_rectangular_inner_box(c->imlibdata, wimage->image, 0, 0, wimage->width - 1, wimage->height - 1); - } - + wimage = xitk_get_widget_foreground_skin(private_data->button_widget); if(wimage) { + draw_bevel_three_state(c->imlibdata, wimage); draw_arrow_down(c->imlibdata, wimage); } Index: config.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/config.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- config.c 26 Mar 2004 22:16:26 -0000 1.18 +++ config.c 9 Apr 2004 15:43:13 -0000 1.19 @@ -173,6 +173,14 @@ if(!strncasecmp(p, "old_title_style", 15)) xtcf->features.oldbarstyle = strtol(c, &c, 10); + if(!strncasecmp(p, "check_style", 11)) { + if(!strcasecmp(c, "old")) + xtcf->features.checkstyle = CHECK_STYLE_OLD; + else if(!strcasecmp(c, "round")) + xtcf->features.checkstyle = CHECK_STYLE_ROUND; + else if(!strcasecmp(c, "check")) + xtcf->features.checkstyle = CHECK_STYLE_CHECK; + } else if(!strncasecmp(p, "shm", 3)) xtcf->features.shm = strtol(c, &c, 10); } @@ -326,6 +334,7 @@ xtcf->features.shm = 0; #endif xtcf->features.oldbarstyle = 0; + xtcf->features.checkstyle = CHECK_STYLE_CHECK; xtcf->menus.shortcuts = 1; } @@ -339,6 +348,13 @@ return (xtcf->features.oldbarstyle > 0) ? 1 : 0; } +int xitk_config_get_checkstyle_feature(xitk_config_t *xtcf) { + + if(!xtcf) + return -1; + + return xtcf->features.checkstyle; +} int xitk_config_get_shm_feature(xitk_config_t *xtcf) { if(!xtcf) Index: image.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/image.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- image.c 29 Jan 2004 22:19:52 -0000 1.55 +++ image.c 9 Apr 2004 15:43:13 -0000 1.56 @@ -825,20 +825,125 @@ _draw_rectangular_box_light(im, p, x, y, 0, 0, width, height, DRAW_OUTTER); } -void menu_draw_check(ImlibData *im, xitk_image_t *p, int checked) { - int h, w; - int relief = (checked) ? DRAW_INNER : DRAW_OUTTER; - int nrelief = (checked) ? DRAW_OUTTER : DRAW_INNER; +static void _draw_check_round(ImlibData *im, xitk_image_t *p, int x, int y, int d, int checked) { + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_black(im)); + XFillArc(im->x.disp, p->image->pixmap, p->image->gc, x, y, d, d, (30 * 64), (180 * 64)); + XUNLOCK(im->x.disp); + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_darkgray(im)); + XFillArc(im->x.disp, p->image->pixmap, p->image->gc, x, y, d, d, (210 * 64), (180 * 64)); + XUNLOCK(im->x.disp); + + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_white(im)); + XFillArc(im->x.disp, p->image->pixmap, p->image->gc, x + 2, y + 2, d - 4, d - 4, (0 * 64), (360 * 64)); + XUNLOCK(im->x.disp); + + if(checked) { + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_black(im)); + XFillArc(im->x.disp, p->image->pixmap, p->image->gc, x + 4, y + 4, d - 8, d - 8, (0 * 64), (360 * 64)); + XUNLOCK(im->x.disp); + } +} +static void _draw_check_check(ImlibData *im, xitk_image_t *p, int x, int y, int d, int checked) { + /* background */ + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_lightgray(im)); + XFillRectangle(im->x.disp, p->image->pixmap, p->image->gc, x, y, d, d); + XUNLOCK(im->x.disp); + /* */ + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_black(im)); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x, y, x + d, y); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x, y, x, y + d); + XUNLOCK(im->x.disp); + + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_darkgray(im)); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x, y + d, x + d, y + d); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x + d, y, x + d, y + d); + XUNLOCK(im->x.disp); + + if(checked) { + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_black(im)); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x + (d / 5), (y + ((d / 3) * 2)) - 2, x + (d / 2), y + d - 2); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x + (d / 5)+1, (y + ((d / 3) * 2)) - 2, x + (d / 2) + 1, y + d - 2); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x + (d / 2), y + d - 2, x + d - 2, y+1); + XDrawLine(im->x.disp, p->image->pixmap, p->image->gc, x + (d / 2) + 1, y + d - 2, x + d - 1, y+1); + XUNLOCK(im->x.disp); + } + +} + +void draw_check_three_state_round_style(ImlibData *im, xitk_image_t *p, int x, int y, int d, int w, int checked) { + int i; + + ABORT_IF_NULL(im); + ABORT_IF_NULL(p); + + for(i = 0; i < 3; i++) { + if(i == 2) { + x++; + y++; + } + + _draw_check_round(im, p, x, y, d, checked); + x += w; + } +} + +void draw_check_three_state_check_style(ImlibData *im, xitk_image_t *p, int x, int y, int d, int w, int checked) { + int i; + ABORT_IF_NULL(im); ABORT_IF_NULL(p); - w = p->width / 3; - h = p->height - 12; + for(i = 0; i < 3; i++) { + if(i == 2) { + x++; + y++; + } + + _draw_check_check(im, p, x, y, d, checked); + x += w; + } +} + +void menu_draw_check(ImlibData *im, xitk_image_t *p, int checked) { + int style = xitk_get_checkstyle_feature(); - _draw_rectangular_box(im, p->image, 4, 6, 0, 0, 12, h, relief); - _draw_rectangular_box(im, p->image, w + 4, 6, 0, 0, 12, h, relief); - _draw_rectangular_box(im, p->image, (w * 2) + 4 + 1, 6 + 1, 0, 0, 12, h, nrelief); + ABORT_IF_NULL(im); + ABORT_IF_NULL(p); + + switch(style) { + + case CHECK_STYLE_CHECK: + draw_check_three_state_check_style(im, p, 4, 4, p->height - 8, p->width / 3, checked); + break; + + case CHECK_STYLE_ROUND: + draw_check_three_state_round_style(im, p, 4, 4, p->height - 8, p->width / 3, checked); + break; + + case CHECK_STYLE_OLD: + default: + { + int relief = (checked) ? DRAW_INNER : DRAW_OUTTER; + int nrelief = (checked) ? DRAW_OUTTER : DRAW_INNER; + int w, h; + + w = p->width / 3; + h = p->height - 12; + _draw_rectangular_box(im, p->image, 4, 6, 0, 0, 12, h, relief); + _draw_rectangular_box(im, p->image, w + 4, 6, 0, 0, 12, h, relief); + _draw_rectangular_box(im, p->image, (w * 2) + 4 + 1, 6 + 1, 0, 0, 12, h, nrelief); + } + break; + } } /* @@ -975,6 +1080,45 @@ } +void draw_checkbox_check(ImlibData *im, xitk_image_t *p) { + int style = xitk_get_checkstyle_feature(); + + XLOCK(im->x.disp); + XSetForeground(im->x.disp, p->image->gc, xitk_get_pixel_color_gray(im)); + XFillRectangle(im->x.disp, p->image->pixmap, p->image->gc, 0, 0, p->width, p->height); + XUNLOCK(im->x.disp); + + switch(style) { + + case CHECK_STYLE_CHECK: + { + int w; + + w = p->width / 3; + _draw_check_check(im, p, 0, 0, p->height, 0); + _draw_check_check(im, p, w, 0, p->height, 0); + _draw_check_check(im, p, w * 2, 0, p->height, 1); + } + break; + + case CHECK_STYLE_ROUND: + { + int w; + + w = p->width / 3; + _draw_check_round(im, p, 0, 0, p->height, 0); + _draw_check_round(im, p, w, 0, p->height, 0); + _draw_check_round(im, p, w * 2, 0, p->height, 1); + } + break; + + case CHECK_STYLE_OLD: + default: + _draw_three_state(im, p, STYLE_BEVEL); + break; + } +} + /* * */ Index: image.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/image.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- image.h 14 Jul 2003 22:44:10 -0000 1.23 +++ image.h 9 Apr 2004 15:43:13 -0000 1.24 @@ -47,3 +47,5 @@ } image_private_data_t; #endif + +void draw_checkbox_check(ImlibData *im, xitk_image_t *p); Index: test.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/test.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- test.c 30 Mar 2004 22:41:39 -0000 1.50 +++ test.c 9 Apr 2004 15:43:13 -0000 1.51 @@ -91,6 +91,7 @@ /* menu */ xitk_widget_t *menu; + int checked; xitk_widget_list_t *widget_list; xitk_register_key_t kreg; @@ -849,6 +850,9 @@ } +static void menu_checked(xitk_widget_t *w, xitk_menu_entry_t *me, void *data) { + test->checked = !test->checked; +} static void menu_test_end(xitk_widget_t *w, xitk_menu_entry_t *me, void *data) { test_end(NULL, NULL); } @@ -859,7 +863,8 @@ { "Popup menu:", NULL, "<title>", NULL, NULL }, { "Load a file", NULL, NULL, NULL, NULL }, { "Reload", NULL, NULL, NULL, NULL }, - { "Auto save", NULL, "<check>", NULL, NULL }, + { "Auto save", NULL, + test->checked ? "<checked>" : "<check>", menu_checked, NULL }, { "SEP", NULL, "<separator>", NULL, NULL }, { "Empty", NULL, "<branch>", NULL, NULL }, { "Playlist", NULL, "<branch>", NULL, NULL }, Index: xitk.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/xitk.c,v retrieving revision 1.117 retrieving revision 1.118 diff -u -r1.117 -r1.118 --- xitk.c 2 Apr 2004 21:33:11 -0000 1.117 +++ xitk.c 9 Apr 2004 15:43:14 -0000 1.118 @@ -1893,6 +1893,9 @@ int xitk_get_barstyle_feature(void) { return xitk_config_get_barstyle_feature(gXitk->config); } +int xitk_get_checkstyle_feature(void) { + return xitk_config_get_checkstyle_feature(gXitk->config); +} int xitk_get_menu_shortcuts_enability(void) { return xitk_config_get_menu_shortcuts_enability(gXitk->config); } Index: xitk.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/xitk.h,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- xitk.h 30 Mar 2004 22:41:39 -0000 1.118 +++ xitk.h 9 Apr 2004 15:43:14 -0000 1.119 @@ -2020,6 +2020,10 @@ */ void draw_bevel_two_state(ImlibData *im, xitk_image_t *p); +void draw_three_state_round_style(ImlibData *im, xitk_image_t *p, int x, int y, int d, int w, int checked); +void draw_three_state_check_style(ImlibData *im, xitk_image_t *p, int x, int y, int d, int w, int checked); + + void draw_paddle_three_state_vertical(ImlibData *im, xitk_image_t *p); void draw_paddle_three_state_horizontal(ImlibData *im, xitk_image_t *p); |