Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
dialog.c
Log Message:
Fix dialog button geometry.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/dialog.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -r1.99 -r1.100
--- dialog.c 16 Feb 2005 17:58:07 -0000 1.99
+++ dialog.c 20 Feb 2005 18:51:52 -0000 1.100
@@ -374,10 +374,10 @@
TextSize(db->tclass, 0, 0, STATE_NORMAL, text, &w, &h, 17);
db->h = h + db->iclass->padding.top + db->iclass->padding.bottom;
- if (!db->image)
- db->w = w + db->iclass->padding.left + db->iclass->padding.right;
- else
- db->w = w + db->iclass->padding.left + db->iclass->padding.right + db->h;
+ db->w = w + db->iclass->padding.left + db->iclass->padding.right;
+ if (Conf.dialogs.button_image && db->image)
+ db->w += h + 2;
+
ESelectInput(db->win,
EnterWindowMask | LeaveWindowMask | ButtonPressMask |
ButtonReleaseMask | ExposureMask);
@@ -387,7 +387,7 @@
DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
{
int state;
- Imlib_Image *im = NULL;
+ Imlib_Image *im;
state = STATE_NORMAL;
if ((db->hilited) && (db->clicked))
@@ -406,7 +406,8 @@
ImageclassApply(db->iclass, db->win, db->w, db->h, 0, 0, state, 0,
ST_WIDGET);
- if (Conf.dialogs.button_image == 1)
+ im = NULL;
+ if (Conf.dialogs.button_image)
{
switch (db->image)
{
@@ -423,33 +424,29 @@
im = ELoadImage("pix/close.png");
break;
default:
- im = NULL;
+ break;
}
+ }
- if (im)
- {
- int w, h;
-
- TextSize(db->tclass, 0, 0, STATE_NORMAL, db->text, &w, &h, 17);
+ if (im)
+ {
+ ImageClass *ic = db->iclass;
+ int h;
- TextDraw(db->tclass, db->win, 0, 0, state, db->text,
- db->w / 2.0 - w / 2.0 + db->h / 2.0, db->h / 4, db->w,
- db->h, 0, 0);
+ h = db->h - (ic->padding.top + ic->padding.bottom);
- imlib_context_set_image(im);
- imlib_context_set_drawable(db->win);
- imlib_context_set_blend(1);
- imlib_render_image_on_drawable_at_size(db->w / 2.0 - w / 2.0 -
- db->h / 2.0, 3, db->h - 6,
- db->h - 6);
- imlib_context_set_blend(0);
- imlib_free_image();
- }
- else
- {
- TextclassApply(db->iclass, db->win, db->w, db->h, 0, 0, state, 1,
- db->tclass, db->text);
- }
+ TextDraw(db->tclass, db->win, 0, 0, state, db->text,
+ h + 2 + ic->padding.left, ic->padding.top,
+ db->w - (h + 2 + ic->padding.left + ic->padding.right),
+ h, h, db->tclass->justification);
+
+ imlib_context_set_image(im);
+ imlib_context_set_drawable(db->win);
+ imlib_context_set_blend(1);
+ imlib_render_image_on_drawable_at_size(ic->padding.left,
+ ic->padding.top, h, h);
+ imlib_context_set_blend(0);
+ imlib_free_image();
}
else
{
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs