diff options
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | CREDITS | 1 | ||||
| -rw-r--r-- | fluid/Fl_Type.h | 5 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 47 |
4 files changed, 49 insertions, 7 deletions
@@ -1,5 +1,8 @@ CHANGES IN FLTK 1.1.4 + - FLUID didn't write color/selection_color() calls using + the symbolic names when possible, nor did it cast + integer colors to Fl_Color (STR #146) - Fl_File_Chooser was very close for multiple file selection in large directories (STR #140) - Fl_Text_Display/Editor did not disable the current @@ -47,6 +47,7 @@ OTHER CONTRIBUTORS Albrecht Schlosser Andrea Suatoni Paul Sydney + Aaron Ucko Emanuele Vicentini Jim Wilson Ken Yarnall diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 2f714bcb5..c5346e72c 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5.2.11.2.9 2003/08/02 21:17:30 easysw Exp $" +// "$Id: Fl_Type.h,v 1.5.2.11.2.10 2003/09/03 19:50:54 easysw Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -260,6 +260,7 @@ protected: void write_extra_code(); void write_block_close(); void write_code2(); + void write_color(const char*, Fl_Color); public: @@ -593,5 +594,5 @@ int storestring(const char *n, const char * & p, int nostrip=0); extern int include_H_from_C; // -// End of "$Id: Fl_Type.h,v 1.5.2.11.2.9 2003/08/02 21:17:30 easysw Exp $". +// End of "$Id: Fl_Type.h,v 1.5.2.11.2.10 2003/09/03 19:50:54 easysw Exp $". // diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index a709f2641..28f205bbd 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.27 2003/08/02 21:17:30 easysw Exp $" +// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.28 2003/09/03 19:50:54 easysw Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -1538,6 +1538,43 @@ void Fl_Widget_Type::write_code1() { if (varused) write_widget_code(); } +void Fl_Widget_Type::write_color(const char* field, Fl_Color color) { + const char* color_name = 0; + switch (color) { + case FL_FOREGROUND_COLOR: color_name = "FL_FOREGROUND_COLOR"; break; + case FL_BACKGROUND2_COLOR: color_name = "FL_BACKGROUND2_COLOR"; break; + case FL_INACTIVE_COLOR: color_name = "FL_INACTIVE_COLOR"; break; + case FL_SELECTION_COLOR: color_name = "FL_SELECTION_COLOR"; break; + case FL_GRAY0: color_name = "FL_GRAY0"; break; + case FL_DARK3: color_name = "FL_DARK3"; break; + case FL_DARK2: color_name = "FL_DARK2"; break; + case FL_DARK1: color_name = "FL_DARK1"; break; + case FL_BACKGROUND_COLOR: color_name = "FL_BACKGROUND_COLOR"; break; + case FL_LIGHT1: color_name = "FL_LIGHT1"; break; + case FL_LIGHT2: color_name = "FL_LIGHT2"; break; + case FL_LIGHT3: color_name = "FL_LIGHT3"; break; + case FL_BLACK: color_name = "FL_BLACK"; break; + case FL_RED: color_name = "FL_RED"; break; + case FL_GREEN: color_name = "FL_GREEN"; break; + case FL_YELLOW: color_name = "FL_YELLOW"; break; + case FL_BLUE: color_name = "FL_BLUE"; break; + case FL_MAGENTA: color_name = "FL_MAGENTA"; break; + case FL_CYAN: color_name = "FL_CYAN"; break; + case FL_DARK_RED: color_name = "FL_DARK_RED"; break; + case FL_DARK_GREEN: color_name = "FL_DARK_GREEN"; break; + case FL_DARK_YELLOW: color_name = "FL_DARK_YELLOW"; break; + case FL_DARK_BLUE: color_name = "FL_DARK_BLUE"; break; + case FL_DARK_MAGENTA: color_name = "FL_DARK_MAGENTA"; break; + case FL_DARK_CYAN: color_name = "FL_DARK_CYAN"; break; + case FL_WHITE: color_name = "FL_WHITE"; break; + } + if (color_name) { + write_c("%so->%s(%s);\n", indent(), field, color_name); + } else { + write_c("%so->%s((Fl_Color)%d);\n", indent(), field, color); + } +} + // this is split from write_code1() for Fl_Window_Type: void Fl_Widget_Type::write_widget_code() { Fl_Widget* tplate = ((Fl_Widget_Type*)factory)->o; @@ -1580,9 +1617,9 @@ void Fl_Widget_Type::write_widget_code() { boxname(b->down_box())); } if (o->color() != tplate->color() || subclass()) - write_c("%so->color(%d);\n", indent(), o->color()); + write_color("color", o->color()); if (o->selection_color() != tplate->selection_color() || subclass()) - write_c("%so->selection_color(%d);\n", indent(), o->selection_color()); + write_color("selection_color", o->selection_color()); if (image) image->write_code(); if (inactive) inactive->write_code(1); if (o->labeltype() != tplate->labeltype() || subclass()) @@ -1593,7 +1630,7 @@ void Fl_Widget_Type::write_widget_code() { if (o->labelsize() != tplate->labelsize() || subclass()) write_c("%so->labelsize(%d);\n", indent(), o->labelsize()); if (o->labelcolor() != tplate->labelcolor() || subclass()) - write_c("%so->labelcolor(%d);\n", indent(), o->labelcolor()); + write_color("labelcolor", o->labelcolor()); if (is_valuator()) { Fl_Valuator* v = (Fl_Valuator*)o; Fl_Valuator* f = (Fl_Valuator*)(tplate); @@ -1982,5 +2019,5 @@ int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) { } // -// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.27 2003/08/02 21:17:30 easysw Exp $". +// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.28 2003/09/03 19:50:54 easysw Exp $". // |
