Roxen.git
/
server
/
modules
/
graphics
/
gbutton.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/graphics/gbutton.pike:18:
// icon-data -- inline icon data // align -- left|center|right text alignment // align-icon -- left|center-before|center-after|right icon alignment // valign-icon -- above|middle|below icon vertical alignment // >Button text</gbutton> // // Alignment restriction: when text alignment is either left or right, icons // must also be aligned left or right.
-
constant cvs_version = "$Id: gbutton.pike,v 1.
70
2000/12/11
10
:
44
:
43
per Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
71
2000/12/11
13
:
25
:
51
per Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; roxen.ImageCache button_cache; constant module_type = MODULE_TAG; constant module_name = "GButton"; constant module_doc =
Roxen.git/server/modules/graphics/gbutton.pike:391:
{ int os, dir; Font button_font; int th = text_height; do { button_font = resolve_font( args->font+" "+th ); text_img = button_font->write(text); os = text_img->ysize(); if( !dir )
-
{
-
if( os < text_height )
{
dir = 1;
th++; }
-
if( os > text_height )
{
dir
=-1;
th--;
}
-
} else {
-
if( dir > 0 && os > text_height )
-
break;
-
if( dir < 0 && os < text_height )
-
break
;
-
if( os == text_height )
-
break;
+
if( os < text_height )
+
dir = 1;
+
else
if( os > text_height )
+
dir
=-1;
+
if( dir > 0 && os > text_height ) break;
+
else
if( dir < 0 && os < text_height )
dir
=
1
;
+
else
if( os == text_height ) break;
th += dir;
-
}
-
}
while( (text_img->ysize() - text_height)
>1
+
} while( (text_img->ysize() - text_height)
&& (th>0 && th<text_height*2)); // fonts that can not be scaled.
-
if( abs(text_img->ysize() - text_height)>
1
)
+
if( abs(text_img->ysize() - text_height)>
2
)
text_img = text_img->scale(0, text_height ); else { int o = text_img->ysize() - text_height; top -= o; middle -= o/2; } if (args->cnd) text_img = text_img->scale((int) round(text_img->xsize() * 0.8), text_img->ysize());