mirror of
https://github.com/fltk/fltk.git
synced 2026-06-06 00:22:42 +08:00
Fix radio button drawing for menubars and light buttons. Basically,
don't use system-supplied circle drawing functions, since they don't do a good job with small circles. Add !__CYGWIN__ for use of WIN32 mkdir() function in preferences... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+27
-9
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.15 2002/04/29 19:27:51 easysw Exp $"
|
||||
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.16 2002/04/30 15:34:57 easysw Exp $"
|
||||
//
|
||||
// Lighted button widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -70,16 +70,34 @@ void Fl_Light_Button::draw() {
|
||||
draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR);
|
||||
if (value()) {
|
||||
fl_color(col);
|
||||
int tW = W - Fl::box_dw(down_box()) - 3;
|
||||
int tW = W - Fl::box_dw(down_box()) - 2;
|
||||
int tdx = dx + Fl::box_dx(down_box()) + 1;
|
||||
int tdy = dy + Fl::box_dy(down_box()) + 1;
|
||||
|
||||
if (tW > 4) {
|
||||
fl_pie(x() + tdx, y() + tdy, tW, tW , 0.0, 360.0);
|
||||
} else {
|
||||
// Small circles don't draw well with some X servers...
|
||||
fl_rectf(x() + tdx + 1, y() + tdy, 2, 4);
|
||||
fl_rectf(x() + tdx, y() + tdy + 1, 4, 2);
|
||||
switch (tW) {
|
||||
// Larger circles draw fine...
|
||||
default :
|
||||
fl_pie(x() + tdx, y() + tdy, tW, tW, 0.0, 360.0);
|
||||
break;
|
||||
|
||||
// Small circles don't draw well on many systems...
|
||||
case 6 :
|
||||
fl_rectf(x() + tdx + 2, y() + tdy, tW - 4, tW);
|
||||
fl_rectf(x() + tdx + 1, y() + tdy + 1, tW - 2, tW - 2);
|
||||
fl_rectf(x() + tdx, y() + tdy + 2, tW, tW - 4);
|
||||
break;
|
||||
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
fl_rectf(x() + tdx + 1, y() + tdy, tW - 2, tW);
|
||||
fl_rectf(x() + tdx, y() + tdy + 1, tW, tW - 2);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
case 1 :
|
||||
fl_rectf(x() + tdx, y() + tdy, tW, tW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -123,5 +141,5 @@ Fl_Light_Button::Fl_Light_Button(int x, int y, int w, int h, const char* l)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.15 2002/04/29 19:27:51 easysw Exp $".
|
||||
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.16 2002/04/30 15:34:57 easysw Exp $".
|
||||
//
|
||||
|
||||
+27
-9
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.10 2002/04/29 19:27:51 easysw Exp $"
|
||||
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.11 2002/04/30 15:34:58 easysw Exp $"
|
||||
//
|
||||
// Menu code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -166,14 +166,32 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
|
||||
fl_draw_box(FL_ROUND_DOWN_BOX, x+2, y+d, W, W, FL_BACKGROUND2_COLOR);
|
||||
if (value()) {
|
||||
fl_color(labelcolor_);
|
||||
int tW = W - Fl::box_dw(FL_ROUND_DOWN_BOX) - 3;
|
||||
int tW = W - Fl::box_dw(FL_ROUND_DOWN_BOX) - 2;
|
||||
int td = Fl::box_dx(FL_ROUND_DOWN_BOX) + 1;
|
||||
if (tW > 4) {
|
||||
fl_pie(x+2 + td , y + d + td, tW, tW , 0.0, 360.0);
|
||||
} else {
|
||||
// Small circles don't draw well with some X servers...
|
||||
fl_rectf(x + td + 3, y + d + td, 2, 4);
|
||||
fl_rectf(x + td + 2, y + d + td + 1, 4, 2);
|
||||
switch (tW) {
|
||||
// Larger circles draw fine...
|
||||
default :
|
||||
fl_pie(x + td + 2, y + d + td, tW, tW, 0.0, 360.0);
|
||||
break;
|
||||
|
||||
// Small circles don't draw well on many systems...
|
||||
case 6 :
|
||||
fl_rectf(x + td + 4, y + d + td, tW - 4, tW);
|
||||
fl_rectf(x + td + 3, y + d + td + 1, tW - 2, tW - 2);
|
||||
fl_rectf(x + td + 2, y + d + td + 2, tW, tW - 4);
|
||||
break;
|
||||
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
fl_rectf(x + td + 3, y + d + td, tW - 2, tW);
|
||||
fl_rectf(x + td + 2, y + d + td + 1, tW, tW - 2);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
case 1 :
|
||||
fl_rectf(x + td + 2, y + d + td, tW, tW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -756,5 +774,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.10 2002/04/29 19:27:51 easysw Exp $".
|
||||
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.11 2002/04/30 15:34:58 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Preferences.cxx,v 1.1.2.5 2002/04/29 21:04:12 easysw Exp $"
|
||||
// "$Id: Fl_Preferences.cxx,v 1.1.2.6 2002/04/30 15:34:58 easysw Exp $"
|
||||
//
|
||||
// Preferences methods for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -447,11 +447,11 @@ static char makePath( const char *path )
|
||||
p[len] = 0;
|
||||
makePath( p );
|
||||
free( p );
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
return ( mkdir( path ) == 0 );
|
||||
#else
|
||||
return ( mkdir( path, 0777 ) == 0 );
|
||||
#endif
|
||||
#endif // WIN32 && !__CYGWIN__
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -935,5 +935,5 @@ char Fl_Preferences::Node::remove()
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.5 2002/04/29 21:04:12 easysw Exp $".
|
||||
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.6 2002/04/30 15:34:58 easysw Exp $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user