Skip to content

Commit

Permalink
Fix radio button drawing for menubars and light buttons. Basically,
Browse files Browse the repository at this point in the history
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
  • Loading branch information
michaelrsweet committed Apr 30, 2002
1 parent 2779ff9 commit 19b4d2f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 22 deletions.
36 changes: 27 additions & 9 deletions src/Fl_Light_Button.cxx
@@ -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).
//
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 $".
//
36 changes: 27 additions & 9 deletions src/Fl_Menu.cxx
@@ -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).
//
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 $".
//
8 changes: 4 additions & 4 deletions src/Fl_Preferences.cxx
@@ -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).
//
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 $".
//

0 comments on commit 19b4d2f

Please sign in to comment.