FLTK logo

[Library] r9041 - in branches/branch-3.0: include/fltk3 src/fltk3

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r9041 - in branches/branch-3.0: include/fltk3 src/fltk3 fltk-dev Sep 16, 2011  
 
Author: matt
Date: 2011-09-16 14:30:05 -0700 (Fri, 16 Sep 2011)
New Revision: 9041
Log:
FLTK3: move more attribute into Style class. Tied composite widgets together to make them look more like a unity (check valuators demo).

Modified:
   branches/branch-3.0/include/fltk3/MultiLabel.h
   branches/branch-3.0/include/fltk3/Spinner.h
   branches/branch-3.0/include/fltk3/Style.h
   branches/branch-3.0/include/fltk3/Widget.h
   branches/branch-3.0/src/fltk3/Adjuster.cxx
   branches/branch-3.0/src/fltk3/Choice.cxx
   branches/branch-3.0/src/fltk3/Counter.cxx
   branches/branch-3.0/src/fltk3/Menu.cxx
   branches/branch-3.0/src/fltk3/Style.cxx
   branches/branch-3.0/src/fltk3/ValueSlider.cxx
   branches/branch-3.0/src/fltk3/Widget.cxx
   branches/branch-3.0/src/fltk3/gtk.cxx

Modified: branches/branch-3.0/include/fltk3/MultiLabel.h
===================================================================
--- branches/branch-3.0/include/fltk3/MultiLabel.h	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/include/fltk3/MultiLabel.h	2011-09-16 21:30:05 UTC (rev 9041)
@@ -36,8 +36,8 @@
   struct FLTK3_EXPORT MultiLabel {
     const char* labela;
     const char* labelb;
-    uchar typea;
-    uchar typeb;
+    Labeltype typea;
+    Labeltype typeb;
     void label(fltk3::Widget*);
     void label(fltk3::MenuItem*);
   };

Modified: branches/branch-3.0/include/fltk3/Spinner.h
===================================================================
--- branches/branch-3.0/include/fltk3/Spinner.h	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/include/fltk3/Spinner.h	2011-09-16 21:30:05 UTC (rev 9041)
@@ -144,10 +144,13 @@
       input_.type(fltk3::INT_INPUT);
       input_.when(fltk3::WHEN_ENTER_KEY | fltk3::WHEN_RELEASE);
       input_.callback((fltk3::Callback *)sb_cb, this);
+      input_.box(Boxtype(input_.box()|TIE_RIGHT));
       
       up_button_.callback((fltk3::Callback *)sb_cb, this);
+      up_button_.box(Boxtype(up_button_.box()|TIE_LEFT|TIE_BOTTOM));
       
       down_button_.callback((fltk3::Callback *)sb_cb, this);
+      down_button_.box(Boxtype(down_button_.box()|TIE_LEFT|TIE_TOP));
     }
     
     /** Sets or returns the format string for the value. */

Modified: branches/branch-3.0/include/fltk3/Style.h
===================================================================
--- branches/branch-3.0/include/fltk3/Style.h	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/include/fltk3/Style.h	2011-09-16 21:30:05 UTC (rev 9041)
@@ -48,10 +48,22 @@
     
     Font labelfont_;
     Fontsize labelsize_;
+    Labeltype labeltype_;
+    Color labelcolor_;
+    Align align_;
+    Font textfont_;
+    Fontsize textsize_;
+    Color textcolor_;
 
     unsigned int private_:1;
     unsigned int labelfont_set_:1;
     unsigned int labelsize_set_:1;
+    unsigned int labeltype_set_:1;
+    unsigned int labelcolor_set_:1;
+    unsigned int align_set_:1;
+    unsigned int textfont_set_:1;
+    unsigned int textsize_set_:1;
+    unsigned int textcolor_set_:1;
     
     void update();
     void refresh() const { if (version_ != current_) ((Style*)this)->update(); }
@@ -70,7 +82,31 @@
     Fontsize labelsize() const { refresh(); return labelsize_;}
     void labelsize(fltk3::Fontsize s) { labelsize_=s; labelsize_set_ = 1; invalidate(); }
     void clear_labelsize() { labelsize_set_=0; invalidate(); }
+    
+    Labeltype labeltype() const { refresh(); return labeltype_;}
+    void labeltype(fltk3::Labeltype s) { labeltype_=s; labeltype_set_ = 1; invalidate(); }
+    void clear_labeltype() { labeltype_set_=0; invalidate(); }
+    
+    Color labelcolor() const { refresh(); return labelcolor_;}
+    void labelcolor(Color s) { labelcolor_=s; labelcolor_set_ = 1; invalidate(); }
+    void clear_labelcolor() { labelcolor_set_=0; invalidate(); }
+    
+    Align align() const { refresh(); return align_;}
+    void align(Align s) { align_=s; align_set_ = 1; invalidate(); }
+    void clear_align() { align_set_=0; invalidate(); }
 
+    Font textfont() const { refresh(); return textfont_;}
+    void textfont(fltk3::Font f) { textfont_=f; textfont_set_ = 1; invalidate(); }
+    void clear_textfont() { textfont_set_=0; invalidate(); }
+    
+    Fontsize textsize() const { refresh(); return textsize_;}
+    void textsize(fltk3::Fontsize s) { textsize_=s; textsize_set_ = 1; invalidate(); }
+    void clear_textsize() { textsize_set_=0; invalidate(); }
+    
+    Color textcolor() const { refresh(); return textcolor_;}
+    void textcolor(Color s) { textcolor_=s; textcolor_set_ = 1; invalidate(); }
+    void clear_textcolor() { textcolor_set_=0; invalidate(); }
+    
     Style *make_private();
   };
 

Modified: branches/branch-3.0/include/fltk3/Widget.h
===================================================================
--- branches/branch-3.0/include/fltk3/Widget.h	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/include/fltk3/Widget.h	2011-09-16 21:30:05 UTC (rev 9041)
@@ -82,20 +82,8 @@
     Style *style_;
     /** label text */
     const char* labeltext_;
-    /** type of label. \see fltk3::Labeltype */
-    uchar labeltype_;
-    /** text color */
-    fltk3::Color labelcolor_;
-    /** alignment of label */
-    fltk3::Align align_;
     /** various flags for the label and derived classes */
     unsigned int flags_;
-    /** \internal The font used for the entire text. */
-    fltk3::Font textfont_;
-    /** \internal Height of the font used for the entire text. */
-    fltk3::Fontsize textsize_;
-    /** \internal color of the entire text */
-    fltk3::Color textcolor_;
     /** optional image for an active label */
     fltk3::Image* image_;
     /** optional image for a deactivated label */
@@ -157,19 +145,19 @@
     /** Shortcut to set the label text and type in one call.
      \see label(const char *), labeltype(fltk3::Labeltype)
      */
-    void label(fltk3::Labeltype a, const char* b) { Label::labeltype_ = a; labeltext_ = b; }
+    void label(fltk3::Labeltype a, const char* b) { labeltype(a); labeltext_ = b; }
     
     /** Gets the label color. 
      The default color is fltk3::FOREGROUND_COLOR. 
      \return the current label color
      */
-    fltk3::Color labelcolor() const {return labelcolor_;}
+    fltk3::Color labelcolor() const {return style()->labelcolor();}
     
     /** Sets the label color. 
      The default color is fltk3::FOREGROUND_COLOR. 
      \param[in] c the new label color
      */
-    void labelcolor(fltk3::Color c) {labelcolor_=c;}
+    void labelcolor(fltk3::Color c) { private_style()->labelcolor(c);}
     
     /** Gets the font to use. 
      Fonts are identified by indexes into a table. The default value
@@ -205,7 +193,7 @@
      \return the current label type.
      \see fltk3::Labeltype
      */
-    fltk3::Labeltype labeltype() const {return (fltk3::Labeltype)labeltype_;}
+    fltk3::Labeltype labeltype() const {return style()->labeltype();}
     
     /** Sets the label type. 
      The label type identifies the function that draws the label of the widget. 
@@ -215,13 +203,13 @@
      \param[in] a new label type
      \see fltk3::Labeltype
      */
-    void labeltype(int a) {labeltype_ = (fltk3::Labeltype)a;}
+    void labeltype(Labeltype a) { private_style()->labeltype(a); }
     
     /** Gets the label alignment.     
      \return label alignment
      \see label(), align(fltk3::Align), fltk3::Align
      */
-    Align align() const {return align_;}
+    Align align() const {return style()->align();}
     
     /** Sets the label alignment.
      This controls how the label is displayed next to or inside the widget. 
@@ -230,7 +218,7 @@
      \param[in] alignment new label alignment
      \see align(), fltk3::Align
      */
-    void align(Align alignment) {align_ = alignment;}
+    void align(Align alignment) { private_style()->align(alignment); }
     
     /** Gets the widget flags mask */
     unsigned int flags() const {return flags_;}
@@ -256,32 +244,32 @@
 
     /** Gets the font of the text in the input field.
      \return the current fltk3::Font index */
-    fltk3::Font textfont() const {return textfont_;}
+    fltk3::Font textfont() const { return style()->textfont(); }
     
     /** Sets the font of the text in the input field.
      The text font defaults to \c fltk3::HELVETICA.
      \param [in] s the new text font */
-    void textfont(fltk3::Font s) {textfont_ = s;}
+    void textfont(fltk3::Font s) { private_style()->textfont(s); }
     
     /** Gets the size of the text in the input field.
      \return the text height in pixels */
-    fltk3::Fontsize textsize() const {return textsize_;}
+    fltk3::Fontsize textsize() const { return style()->textsize(); }
     
     /** Sets the size of the text in the input field.
      The text height defaults to \c fltk3::NORMAL_SIZE.
      \param [in] s the new font height in pixel units */
-    void textsize(fltk3::Fontsize s) {textsize_ = s;}
+    void textsize(fltk3::Fontsize s) { private_style()->textsize(s); }
     
     /** Gets the color of the text in the input field.
      \return the text color
      \see textcolor(fltk3::Color) */
-    fltk3::Color textcolor() const {return textcolor_;}
+    fltk3::Color textcolor() const { return style()->textcolor(); }
     
     /** Sets the color of the text in the input field.
      The text color defaults to \c fltk3::FOREGROUND_COLOR.
      \param [in] n new text color
      \see textcolor() */
-    void textcolor(fltk3::Color n) {textcolor_ = n;}
+    void textcolor(fltk3::Color n) { private_style()->textcolor(n); }
 
     /** Gets the image that is used as part of the widget label.
      This image is used when drawing the widget in the active state.
@@ -344,9 +332,9 @@
     void* user_data_;
     Color color_;
     Color color2_;
+    Boxtype box_;
     uchar type_;
     uchar damage_;
-    Boxtype box_;
     uchar when_;
     
     const char *tooltip_;

Modified: branches/branch-3.0/src/fltk3/Adjuster.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Adjuster.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Adjuster.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -42,17 +42,17 @@
 void fltk3::Adjuster::value_damage() {}
 
 void fltk3::Adjuster::draw() {
-  int dx, dy, W, H;
-  if (w()>=h()) {
+  int dx, dy, W, H, hor = (w()>=h());
+  if (hor) {
     dx = W = w()/3;
     dy = 0; H = h();
   } else {
     dx = 0; W = w();
     dy = H = h()/3;
   }
-  draw_box(drag==1?fltk3::DOWN_BOX:box(), x(),  y()+2*dy, W, H, color());
-  draw_box(drag==2?fltk3::DOWN_BOX:box(), x()+dx, y()+dy, W, H, color());
-  draw_box(drag==3?fltk3::DOWN_BOX:box(), x()+2*dx,  y(), W, H, color());
+  draw_box(Boxtype((drag==1?DOWN_BOX:box())|(hor?TIE_RIGHT:TIE_TOP)), x(),  y()+2*dy, W, H, color());
+  draw_box(Boxtype((drag==2?fltk3::DOWN_BOX:box())|(hor?TIE_LEFT|TIE_RIGHT:TIE_TOP|TIE_BOTTOM)), x()+dx, y()+dy, W, H, color());
+  draw_box(Boxtype((drag==3?fltk3::DOWN_BOX:box())|(hor?TIE_LEFT:TIE_BOTTOM)), x()+2*dx,  y(), W, H, color());
   if (active_r())
     fltk3::color(selection_color());
   else

Modified: branches/branch-3.0/src/fltk3/Choice.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Choice.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Choice.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -96,10 +96,10 @@
       l.label(m.text);
       l.image(0);
       l.deimage(0);
-      l.labeltype( m.labeltype_ );
-      l.labelfont( m.labelsize_ || m.labelfont_ ? m.labelfont_ : textfont() );
-      l.labelsize( m.labelsize_ ? m.labelsize_ : textsize() );
-      l.labelcolor( m.labelcolor_ ? m.labelcolor_ : textcolor() );
+      l.labeltype( m.labeltype() );
+      l.labelfont( m.labelsize() || m.labelfont() ? m.labelfont() : textfont() );
+      l.labelsize( m.labelsize() ? m.labelsize() : textsize() );
+      l.labelcolor( m.labelcolor() ? m.labelcolor() : textcolor() );
       if (!m.active()) l.labelcolor( fltk3::inactive((fltk3::Color)l.labelcolor()) );
       fltk3::draw_shortcut = 2; // hack value to make '&' disappear
       l.draw(xx+3, yy, ww>6 ? ww-6 : 0, hh, fltk3::ALIGN_LEFT);

Modified: branches/branch-3.0/src/fltk3/Counter.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Counter.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Counter.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -60,7 +60,7 @@
     xx[4] = 0;	         ww[4] = 0;
   }
 
-  draw_box(boxtype[0], xx[0], y(), ww[0], h(), fltk3::BACKGROUND2_COLOR);
+  draw_box(Boxtype(boxtype[0]|TIE_LEFT|TIE_RIGHT), xx[0], y(), ww[0], h(), fltk3::BACKGROUND2_COLOR);
   fltk3::font(textfont(), textsize());
   fltk3::color(active_r() ? textcolor() : fltk3::inactive(textcolor()));
   char str[128]; format(str);
@@ -74,16 +74,22 @@
     selcolor = fltk3::inactive(labelcolor());
 
   if (type() == fltk3::NORMAL_COUNTER) {
-    draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
+    draw_box(Boxtype(boxtype[1]|TIE_RIGHT), xx[1], y(), ww[1], h(), color());
     fltk3::draw_symbol("@-4<<", xx[1], y(), ww[1], h(), selcolor);
+    draw_box(Boxtype(boxtype[2]|TIE_LEFT|TIE_RIGHT), xx[2], y(), ww[2], h(), color());
+    fltk3::draw_symbol("@-4<",  xx[2], y(), ww[2], h(), selcolor);
+  } else {
+    draw_box(Boxtype(boxtype[2]|TIE_RIGHT), xx[2], y(), ww[2], h(), color());
+    fltk3::draw_symbol("@-4<",  xx[2], y(), ww[2], h(), selcolor);
   }
-  draw_box(boxtype[2], xx[2], y(), ww[2], h(), color());
-  fltk3::draw_symbol("@-4<",  xx[2], y(), ww[2], h(), selcolor);
-  draw_box(boxtype[3], xx[3], y(), ww[3], h(), color());
-  fltk3::draw_symbol("@-4>",  xx[3], y(), ww[3], h(), selcolor);
   if (type() == fltk3::NORMAL_COUNTER) {
-    draw_box(boxtype[4], xx[4], y(), ww[4], h(), color());
+    draw_box(Boxtype(boxtype[3]|TIE_LEFT|TIE_RIGHT), xx[3], y(), ww[3], h(), color());
+    fltk3::draw_symbol("@-4>",  xx[3], y(), ww[3], h(), selcolor);
+    draw_box(Boxtype(boxtype[4]|TIE_LEFT), xx[4], y(), ww[4], h(), color());
     fltk3::draw_symbol("@-4>>", xx[4], y(), ww[4], h(), selcolor);
+  } else {
+    draw_box(Boxtype(boxtype[3]|TIE_LEFT), xx[3], y(), ww[3], h(), color());
+    fltk3::draw_symbol("@-4>",  xx[3], y(), ww[3], h(), selcolor);
   }
 }
 

Modified: branches/branch-3.0/src/fltk3/Menu.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Menu.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Menu.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -140,9 +140,9 @@
   l.label(text);
   l.image(0);
   l.deimage(0);
-  l.labeltype( labeltype_ );
-  l.labelfont( labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : fltk3::HELVETICA) );
-  l.labelsize( labelsize_ ? labelsize_ : m ? m->textsize() : fltk3::NORMAL_SIZE );
+  l.labeltype( labeltype() );
+  l.labelfont( labelsize() || labelfont() ? labelfont() : (m ? m->textfont() : fltk3::HELVETICA) );
+  l.labelsize( labelsize() ? labelsize() : m ? m->textsize() : fltk3::NORMAL_SIZE );
   l.labelcolor( fltk3::FOREGROUND_COLOR ); // this makes no difference?
   fltk3::draw_shortcut = 1;
   int w = 0; int h = 0;
@@ -159,10 +159,10 @@
   l.label(text);
   l.image(0);
   l.deimage(0);
-  l.labeltype( labeltype_ );
-  l.labelfont( labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : fltk3::HELVETICA) );
-  l.labelsize( labelsize_ ? labelsize_ : m ? m->textsize() : fltk3::NORMAL_SIZE );
-  l.labelcolor( labelcolor_ ? labelcolor_ : m ? m->textcolor() : int(fltk3::FOREGROUND_COLOR) );
+  l.labeltype( labeltype() );
+  l.labelfont( labelsize() || labelfont() ? labelfont() : (m ? m->textfont() : fltk3::HELVETICA) );
+  l.labelsize( labelsize() ? labelsize() : m ? m->textsize() : fltk3::NORMAL_SIZE );
+  l.labelcolor( labelcolor() ? labelcolor() : m ? m->textcolor() : int(fltk3::FOREGROUND_COLOR) );
   if (!active()) l.labelcolor( fltk3::inactive((fltk3::Color)l.labelcolor()) );
   fltk3::Color color = m ? m->color() : fltk3::GRAY;
   if (selected) {

Modified: branches/branch-3.0/src/fltk3/Style.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Style.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Style.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -37,9 +37,21 @@
   parent_(0),
   labelfont_(fltk3::HELVETICA),
   labelsize_(fltk3::NORMAL_SIZE),
+  labeltype_(fltk3::NORMAL_LABEL),
+  labelcolor_(fltk3::FOREGROUND_COLOR),
+  align_(fltk3::ALIGN_CENTER),
+  textfont_(fltk3::HELVETICA),
+  textsize_(fltk3::NORMAL_SIZE),
+  textcolor_(fltk3::FOREGROUND_COLOR),
   private_(0),
   labelfont_set_(1),
-  labelsize_set_(1)
+  labelsize_set_(1),
+  labeltype_set_(1),
+  labelcolor_set_(1),
+  align_set_(1),
+  textfont_set_(1),
+  textsize_set_(1),
+  textcolor_set_(1)
 {
 }
 
@@ -49,9 +61,21 @@
   parent_(parent),
   labelfont_(parent->labelfont_),
   labelsize_(parent->labelsize_),
+  labeltype_(parent->labeltype_),
+  labelcolor_(parent->labelcolor_),
+  align_(parent->align_),
+  textfont_(parent->textfont_),
+  textsize_(parent->textsize_),
+  textcolor_(parent->textcolor_),
   private_(0),
   labelfont_set_(0),
-  labelsize_set_(0)
+  labelsize_set_(0),
+  labeltype_set_(0),
+  labelcolor_set_(0),
+  align_set_(0),
+  textfont_set_(0),
+  textsize_set_(0),
+  textcolor_set_(0)
 {
 }
 
@@ -83,6 +107,18 @@
     labelfont_ = parent_->labelfont_;
   if (!labelsize_set_)
     labelsize_ = parent_->labelsize_;
+  if (!labeltype_set_)
+    labeltype_ = parent_->labeltype_;
+  if (!labelcolor_set_)
+    labelcolor_ = parent_->labelcolor_;
+  if (!align_set_)
+    align_ = parent_->align_;
+  if (!textfont_set_)
+    textfont_ = parent_->textfont_;
+  if (!textsize_set_)
+    textsize_ = parent_->textsize_;
+  if (!textcolor_set_)
+    textcolor_ = parent_->textcolor_;
   
   version_ = current_;
 }

Modified: branches/branch-3.0/src/fltk3/ValueSlider.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/ValueSlider.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/ValueSlider.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -51,12 +51,13 @@
   } else {
     syy += 25; bhh = 25; shh -= 25;
   }
-  if (damage()&fltk3::DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color());
+  if (damage()&fltk3::DAMAGE_ALL) 
+    draw_box(Boxtype(box()|(horizontal()?TIE_LEFT:TIE_TOP)),sxx,syy,sww,shh,color());
   Slider::draw(sxx+fltk3::box_dx(box()),
 		  syy+fltk3::box_dy(box()),
 		  sww-fltk3::box_dw(box()),
 		  shh-fltk3::box_dh(box()));
-  draw_box(box(),bxx,byy,bww,bhh,color());
+  draw_box(Boxtype(box()|(horizontal()?TIE_RIGHT:TIE_BOTTOM)),bxx,byy,bww,bhh,color());
   char buf[128];
   format(buf);
   fltk3::font(textfont(), textsize());

Modified: branches/branch-3.0/src/fltk3/Widget.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Widget.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/Widget.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -108,13 +108,7 @@
 : fltk3::Rectangle(X, Y, W, H),
   style_(&fltk3::default_style),
   labeltext_(L),
-  labeltype_(fltk3::NORMAL_LABEL),
-  labelcolor_(fltk3::FOREGROUND_COLOR),
-  align_(fltk3::ALIGN_CENTER),
   flags_(0),
-  textfont_(0),
-  textsize_(0),
-  textcolor_(0),
   image_(0),
   deimage_(0)
 {
@@ -124,13 +118,7 @@
 : fltk3::Rectangle(s),
   style_(s.style_), // FIXME: do not just link to private styles
   labeltext_(0L),
-  labeltype_(s.labeltype_),
-  labelcolor_(s.labelcolor_),
-  align_(s.align_),
   flags_(s.flags_),
-  textfont_(s.textfont_),
-  textsize_(s.textsize_),
-  textcolor_(s.textcolor_),
   image_(s.image_),
   deimage_(s.deimage_)
 {
@@ -146,13 +134,7 @@
 fltk3::Label::Label() 
 : fltk3::Rectangle(),
   style_(&fltk3::default_style),
-  labeltype_(fltk3::NORMAL_LABEL),
-  labelcolor_(fltk3::FOREGROUND_COLOR),
-  align_(fltk3::ALIGN_CENTER),
   flags_(0),
-  textfont_(fltk3::HELVETICA),
-  textsize_(fltk3::NORMAL_SIZE),
-  textcolor_(fltk3::FOREGROUND_COLOR),
   image_(0),
   deimage_(0)
 {

Modified: branches/branch-3.0/src/fltk3/gtk.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/gtk.cxx	2011-09-16 08:41:27 UTC (rev 9040)
+++ branches/branch-3.0/src/fltk3/gtk.cxx	2011-09-16 21:30:05 UTC (rev 9041)
@@ -41,6 +41,12 @@
 static const float tie_dk = 0.3f;
 static const float tie_lt = 0.45f;
 static const int use_tie_lt = 1;
+// a high number creates a very intense shadow and steep ramp,
+// a low number brightens the shadow and flattens the ramp
+static const float tie_dk_ramp = 0.25;
+// a high number creates a very intense highlight and steep ramp,
+// a low number lowers the highlight and flattens the ramp
+static const float tie_lt_ramp = 0.9;
 
 
 static fltk3::Color gtk_get_color(fltk3::Color c) {
@@ -61,9 +67,9 @@
 
 
 static void draw_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Color lt, fltk3::Color dk, fltk3::Boxtype t) {
-  float f = (dk==fltk3::WHITE) ? 0.2 : 0.5;
-  fltk3::Color ol = gtk_get_color(fltk3::color_average(fltk3::BLACK, c, f));
-  fltk3::Color hi = gtk_get_color(fltk3::color_average(lt, c, 0.5));
+  float f = (dk==fltk3::WHITE) ? tie_dk_ramp : tie_lt_ramp;
+  fltk3::Color ol = gtk_get_color(fltk3::color_average(fltk3::BLACK, c, 0.7f));
+  fltk3::Color hi = gtk_get_color(fltk3::color_average(lt, c, f));
   if (t & 0xff000000) {
     int r = x+w-1, b = y+h-1, xr = x+w/2, yb = y+h/2;
     fltk3::color(ol);
@@ -169,7 +175,13 @@
 }
 
 static void draw_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Color lt, fltk3::Color dk, fltk3::Boxtype t) {
-  float f = (dk==fltk3::WHITE) ? 0.5 : 1.0;
+  float f = (dk==fltk3::WHITE) ? tie_dk_ramp : tie_lt_ramp;
+  fltk3::Color tc1 = gtk_get_color(fltk3::color_average(lt, c, f*0.8f));
+  fltk3::Color tc2 = gtk_get_color(fltk3::color_average(lt, c, f*0.4f));
+  fltk3::Color tc3 = gtk_get_color(fltk3::color_average(lt, c, f*0.2f));
+  fltk3::Color bc1 = gtk_get_color(fltk3::color_average(dk, c, f*0.6f));
+  fltk3::Color bc2 = gtk_get_color(fltk3::color_average(dk, c, f*0.3f));
+  fltk3::Color bc3 = gtk_get_color(fltk3::color_average(dk, c, f*0.1f));
   draw_frame(x, y, w, h, c, lt, dk, t);
   if (t & 0xff000000) {
     int r = x+w-1, b = y+h-1;
@@ -191,11 +203,11 @@
         fltk3::rectf(x2, y, r2-x2+2, 5);
       }
     } else {
-      gtk_color(fltk3::color_average(lt, c, 0.4f*f));
+      gtk_color(tc1);
       fltk3::xyline(x2, y+2, r2);
-      gtk_color(fltk3::color_average(lt, c, 0.2f*f));
+      gtk_color(tc2);
       fltk3::xyline(x2, y+3, r2);
-      gtk_color(fltk3::color_average(lt, c, 0.1f*f));
+      gtk_color(tc3);
       fltk3::xyline(x2, y+4, r2);
     }
     gtk_color(c);
@@ -209,11 +221,11 @@
       fltk3::xyline(r-tie_gap+1, b, r2);
       fltk3::rectf(x2, y+h-4, r2-x2+1, 3);
     } else {
-      gtk_color(fltk3::color_average(dk, c, 0.025f/f));
+      gtk_color(bc3);
       fltk3::xyline(x2, b-3, r2);
-      gtk_color(fltk3::color_average(dk, c, 0.05f/f));
+      gtk_color(bc2);
       fltk3::xyline(x2, b-2, r2);
-      gtk_color(fltk3::color_average(dk, c, 0.1f/f));
+      gtk_color(bc1);
       fltk3::xyline(x2, b-1, r2);
     }
     if (t & fltk3::TIE_LEFT) {
@@ -233,19 +245,19 @@
       fltk3::yxline(r-1, y2, b2);
     }
   } else {
-    gtk_color(fltk3::color_average(lt, c, 0.4f));
+    gtk_color(tc1);
     fltk3::xyline(x + 2, y + 2, x + w - 3);
-    gtk_color(fltk3::color_average(lt, c, 0.2f));
+    gtk_color(tc2);
     fltk3::xyline(x + 2, y + 3, x + w - 3);
-    gtk_color(fltk3::color_average(lt, c, 0.1f));
+    gtk_color(tc3);
     fltk3::xyline(x + 2, y + 4, x + w - 3);
     gtk_color(c);
     fltk3::rectf(x + 2, y + 5, w - 4, h - 7);
-    gtk_color(fltk3::color_average(dk, c, 0.025f));
+    gtk_color(bc3);
     fltk3::xyline(x + 2, y + h - 4, x + w - 3);
-    gtk_color(fltk3::color_average(dk, c, 0.05f));
+    gtk_color(bc2);
     fltk3::xyline(x + 2, y + h - 3, x + w - 3);
-    gtk_color(fltk3::color_average(dk, c, 0.1f));
+    gtk_color(bc1);
     fltk3::xyline(x + 2, y + h - 2, x + w - 3);
     fltk3::yxline(x + w - 2, y + 2, y + h - 3);
   }

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.