From: Daniel Caujolle-B. <f1...@us...> - 2001-12-17 22:30:04
|
Update of /cvsroot/xine/xine-ui/src/xitk/xine-toolkit In directory usw-pr-cvs1:/tmp/cvs-serv30191/src/xitk/xine-toolkit Modified Files: image.c image.h tips.c widget.c Log Message: Tips are yellow, discarted if a click occur in widget. Fix skin change (was executed 2 times). Index: image.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/image.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- image.c 2001/12/17 02:03:52 1.20 +++ image.c 2001/12/17 22:30:01 1.21 @@ -215,9 +215,11 @@ /* * */ -xitk_image_t *xitk_image_create_image_from_string(ImlibData *im, - char *fontname, - int width, int align, char *str) { +xitk_image_t *xitk_image_create_image_with_colors_from_string(ImlibData *im, + char *fontname, + int width, int align, char *str, + unsigned int foreground, + unsigned int background) { xitk_image_t *image; xitk_font_t *fs; GC gc; @@ -312,13 +314,13 @@ lines[numlines++] = strdup(buf); image = xitk_image_create_image(im, width, ((height * numlines) + (3 * numlines))); - draw_flat(im, image->image, image->width, image->height); + draw_flat_with_color(im, image->image, image->width, image->height, background); { /* Draw string in image */ int i, j, x = 0; XLOCK(im->x.disp); - XSetForeground(im->x.disp, gc, xitk_get_pixel_color_black(im)); + XSetForeground(im->x.disp, gc, foreground); j = height; for(i = 0; i < numlines; i++, j += (height + 3)) { length = xitk_font_get_string_length(fs, lines[i]); @@ -344,7 +346,14 @@ return image; } - +xitk_image_t *xitk_image_create_image_from_string(ImlibData *im, + char *fontname, + int width, int align, char *str) { + + return xitk_image_create_image_with_colors_from_string(im,fontname, width, align, str, + xitk_get_pixel_color_black(im), + xitk_get_pixel_color_gray(im)); +} /* * */ Index: image.h =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/image.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- image.h 2001/11/23 14:56:32 1.9 +++ image.h 2001/12/17 22:30:01 1.10 @@ -115,6 +115,11 @@ /* * Create and image object from a string, width is limited. */ +xitk_image_t *xitk_image_create_image_with_colors_from_string(ImlibData *im, + char *fontname, + int width, int align, char *str, + unsigned int foreground, + unsigned int background); xitk_image_t *xitk_image_create_image_from_string(ImlibData *im, char *fontname, int width, int align, char *str); Index: tips.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/tips.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tips.c 2001/12/17 09:59:01 1.3 +++ tips.c 2001/12/17 22:30:01 1.4 @@ -90,11 +90,12 @@ */ static void *xitk_tips_thread(void *data) { tips_private_t *tp = (tips_private_t *)data; - int x, y, string_length, string_ascent, string_descent; + int x, y, string_length; xitk_image_t *i; xitk_font_t *fs; XWindowAttributes wattr; Status status; + unsigned int cyellow, cblack; pthread_detach(pthread_self()); @@ -117,12 +118,14 @@ fs = xitk_font_load_font(tp->w->imlibdata->x.disp, DEFAULT_FONT_10); xitk_font_set_font(fs, tp->wl->gc); string_length = xitk_font_get_string_length(fs, tp->w->tips_string); - string_ascent = xitk_font_get_ascent(fs, tp->w->tips_string); - string_descent = xitk_font_get_descent(fs, tp->w->tips_string); xitk_font_unload_font(fs); - i = xitk_image_create_image_from_string(tp->w->imlibdata, DEFAULT_FONT_10, - string_length + 1, ALIGN_LEFT, tp->w->tips_string); + cblack = xitk_get_pixel_color_black(tp->w->imlibdata); + cyellow = xitk_get_pixel_color_from_rgb(tp->w->imlibdata, 255, 255, 0); + + i = xitk_image_create_image_with_colors_from_string(tp->w->imlibdata, DEFAULT_FONT_10, + string_length + 1, ALIGN_LEFT, + tp->w->tips_string, cblack, cyellow); tp->xwin = xitk_window_create_simple_window(tp->w->imlibdata, x, y, i->width + 10, i->height + 10); @@ -139,8 +142,10 @@ XLOCK(tp->w->imlibdata->x.disp); gc = XCreateGC(tp->w->imlibdata->x.disp, tp->w->imlibdata->x.base_window, None, None); XCopyArea(tp->w->imlibdata->x.disp, (xitk_window_get_background(tp->xwin)), bg, - gc, 0, 0, width, height, 0, 0); - XCopyArea(tp->w->imlibdata->x.disp, i->image, bg, + gc, 0, 0, width, height, 0, 0); + XSetForeground(tp->w->imlibdata->x.disp, gc, cyellow); + XFillRectangle(tp->w->imlibdata->x.disp, bg, gc, 1, 1, width - 2, height - 2); + XCopyArea(tp->w->imlibdata->x.disp, i->image, bg, gc, 0, 0, i->width, i->height, (width - i->width)>>1, ((height - i->height)>>1) + 1); XUNLOCK(tp->w->imlibdata->x.disp); Index: widget.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/widget.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- widget.c 2001/12/17 02:03:52 1.15 +++ widget.c 2001/12/17 22:30:01 1.16 @@ -875,12 +875,14 @@ if (mywidget) { - xitk_tips_create(mywidget, wl); + if(mywidget->enable == WIDGET_ENABLE) + xitk_tips_create(mywidget, wl); if (mywidget->notify_focus && mywidget->enable == WIDGET_ENABLE) { bRepaint |= (mywidget->notify_focus) (wl, mywidget, FOCUS_RECEIVED); mywidget->have_focus = FOCUS_RECEIVED; } + if(mywidget->paint) (mywidget->paint) (mywidget, wl->win, wl->gc); } @@ -909,6 +911,10 @@ wl->pressedWidget = mywidget; if (mywidget) { + + /* Kill (hide) tips */ + xitk_tips_tips_kill(mywidget); + if (mywidget->notify_click && mywidget->enable == WIDGET_ENABLE && mywidget->running) bRepaint |= (mywidget->notify_click) (wl, mywidget, LBUTTON_DOWN, x, y); |