From 87160b6eb9143e044926827b82a2df021cff9c83 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 3 Dec 2025 23:33:08 +0100 Subject: Remove boxtype linke trick. By defining boxtypes with underscores, box drawing cod ethat was not used was not linked, but with the introduction of themes, all boxes are available at all times. Reducing complexity. --- src/Fl_Dial.cxx | 2 +- src/Fl_Light_Button.cxx | 8 +- src/Fl_get_system_colors.cxx | 20 ++-- src/fl_boxtype.cxx | 223 ++++++++++++++++++++++++++----------------- src/fl_diamond_box.cxx | 12 +-- src/fl_gleam.cxx | 28 ++---- src/fl_gtk.cxx | 53 ++++------ src/fl_oval_box.cxx | 18 +--- src/fl_oxy.cxx | 117 ++++++++++------------- src/fl_plastic.cxx | 40 +++----- src/fl_round_box.cxx | 8 +- src/fl_rounded_box.cxx | 27 +----- src/fl_shadow_box.cxx | 13 +-- 13 files changed, 252 insertions(+), 317 deletions(-) (limited to 'src') diff --git a/src/Fl_Dial.cxx b/src/Fl_Dial.cxx index 2a9df4769..fb9f5e8de 100644 --- a/src/Fl_Dial.cxx +++ b/src/Fl_Dial.cxx @@ -37,7 +37,7 @@ void Fl_Dial::draw(int X, int Y, int W, int H) { double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1; if (type() == FL_FILL_DIAL) { // foo: draw this nicely in certain round box types - int foo = (box() > _FL_ROUND_UP_BOX && Fl::box_dx(box())); + int foo = (box() > FL_ROUND_UP_BOX && Fl::box_dx(box())); if (foo) {X--; Y--; W+=2; H+=2;} if (active_r()) fl_color(color()); else fl_color(fl_inactive(color())); diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx index 98ef910e6..db1616d5b 100644 --- a/src/Fl_Light_Button.cxx +++ b/src/Fl_Light_Button.cxx @@ -60,8 +60,8 @@ void Fl_Light_Button::draw() { switch (down_box()) { case FL_DOWN_BOX : case FL_UP_BOX : - case _FL_PLASTIC_DOWN_BOX : - case _FL_PLASTIC_UP_BOX : + case FL_PLASTIC_DOWN_BOX : + case FL_PLASTIC_UP_BOX : // Check box... draw_box(down_box(), cx, cy, W, W, FL_BACKGROUND2_COLOR); if (value()) { @@ -73,8 +73,8 @@ void Fl_Light_Button::draw() { fl_draw_check(Fl_Rect(cx, cy, cw, cw), check_color); } break; - case _FL_ROUND_DOWN_BOX : - case _FL_ROUND_UP_BOX : + case FL_ROUND_DOWN_BOX : + case FL_ROUND_UP_BOX : // Radio button... draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR); if (value()) { diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx index 24bf8e441..51eb06ac1 100644 --- a/src/Fl_get_system_colors.cxx +++ b/src/Fl_get_system_colors.cxx @@ -276,8 +276,8 @@ int Fl::reload_scheme() { set_boxtype(FL_DOWN_BOX, FL_PLASTIC_DOWN_BOX); set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_THIN_UP_BOX); set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_THIN_DOWN_BOX); - set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_ROUND_UP_BOX); - set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_ROUND_DOWN_BOX); + set_boxtype(FL_ROUND_UP_BOX, FL_PLASTIC_ROUND_UP_BOX); + set_boxtype(FL_ROUND_DOWN_BOX, FL_PLASTIC_ROUND_DOWN_BOX); // Use standard size scrollbars... Fl::scrollbar_size(16); @@ -297,8 +297,8 @@ int Fl::reload_scheme() { set_boxtype(FL_DOWN_BOX, FL_GTK_DOWN_BOX); set_boxtype(FL_THIN_UP_BOX, FL_GTK_THIN_UP_BOX); set_boxtype(FL_THIN_DOWN_BOX, FL_GTK_THIN_DOWN_BOX); - set_boxtype(_FL_ROUND_UP_BOX, FL_GTK_ROUND_UP_BOX); - set_boxtype(_FL_ROUND_DOWN_BOX, FL_GTK_ROUND_DOWN_BOX); + set_boxtype(FL_ROUND_UP_BOX, FL_GTK_ROUND_UP_BOX); + set_boxtype(FL_ROUND_DOWN_BOX, FL_GTK_ROUND_DOWN_BOX); // Use slightly thinner scrollbars... Fl::scrollbar_size(15); @@ -318,8 +318,8 @@ int Fl::reload_scheme() { set_boxtype(FL_DOWN_BOX, FL_GLEAM_DOWN_BOX); set_boxtype(FL_THIN_UP_BOX, FL_GLEAM_THIN_UP_BOX); set_boxtype(FL_THIN_DOWN_BOX, FL_GLEAM_THIN_DOWN_BOX); - set_boxtype(_FL_ROUND_UP_BOX, FL_GLEAM_ROUND_UP_BOX); - set_boxtype(_FL_ROUND_DOWN_BOX, FL_GLEAM_ROUND_DOWN_BOX); + set_boxtype(FL_ROUND_UP_BOX, FL_GLEAM_ROUND_UP_BOX); + set_boxtype(FL_ROUND_DOWN_BOX, FL_GLEAM_ROUND_DOWN_BOX); // Use slightly thinner scrollbars... Fl::scrollbar_size(15); @@ -339,8 +339,8 @@ int Fl::reload_scheme() { set_boxtype(FL_DOWN_BOX, FL_OXY_DOWN_BOX); set_boxtype(FL_THIN_UP_BOX, FL_OXY_THIN_UP_BOX); set_boxtype(FL_THIN_DOWN_BOX, FL_OXY_THIN_DOWN_BOX); - set_boxtype(_FL_ROUND_UP_BOX, FL_OXY_ROUND_UP_BOX); - set_boxtype(_FL_ROUND_DOWN_BOX, FL_OXY_ROUND_DOWN_BOX); + set_boxtype(FL_ROUND_UP_BOX, FL_OXY_ROUND_UP_BOX); + set_boxtype(FL_ROUND_DOWN_BOX, FL_OXY_ROUND_DOWN_BOX); // Use slightly thinner scrollbars... Fl::scrollbar_size(15); @@ -360,8 +360,8 @@ int Fl::reload_scheme() { set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2); set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2); set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2); - set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6, fl_round_focus); - set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6, fl_round_focus); + set_boxtype(FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6, fl_round_focus); + set_boxtype(FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6, fl_round_focus); // Use standard size scrollbars... Fl::scrollbar_size(16); diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index cdd396eaf..5d81fae10 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -324,6 +324,62 @@ void fl_border_frame(int x, int y, int w, int h, Fl_Color c) { fl_rect(x, y, w, h); } +void fl_rounded_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); +void fl_round_focus(Fl_Boxtype, int, int, int, int, Fl_Color, Fl_Color); +void fl_diamond_focus(Fl_Boxtype, int, int, int, int, Fl_Color, Fl_Color); + +void fl_shadow_frame(int x, int y, int w, int h, Fl_Color c); +void fl_shadow_box(int x, int y, int w, int h, Fl_Color c); +void fl_rounded_box(int x, int y, int w, int h, Fl_Color c); +void fl_rshadow_box(int x, int y, int w, int h, Fl_Color c); +void fl_rounded_frame(int x, int y, int w, int h, Fl_Color c); +void fl_rflat_box(int x, int y, int w, int h, Fl_Color c); +void fl_round_up_box(int x, int y, int w, int h, Fl_Color bgcolor); +void fl_round_down_box(int x, int y, int w, int h, Fl_Color bgcolor); +void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor); +void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor); +void fl_oval_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); +void fl_oval_shadow_box(int x, int y, int w, int h, Fl_Color c); +void fl_oval_box(int x, int y, int w, int h, Fl_Color c); +void fl_oval_frame(int x, int y, int w, int h, Fl_Color c); +void fl_oval_flat_box(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_up_round(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_down_frame(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_down_round(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_up_frame(int x, int y, int w, int h, Fl_Color c); +void fl_plastic_thin_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_up_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_down_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_thin_up_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_thin_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_thin_down_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_thin_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_round_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gtk_round_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_up_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_thin_up_box(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_down_frame(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_gleam_thin_down_box(int x, int y, int w, int h, Fl_Color c); +void fl_oxy_button_up_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_button_down_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_up_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_down_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_thin_up_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_thin_down_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_up_frame(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_down_frame(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_thin_up_frame(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_thin_down_frame(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_round_up_box(int x, int y, int w, int h, Fl_Color col); +void fl_oxy_round_down_box(int x, int y, int w, int h, Fl_Color col); + + // ///////////////////////////////////////////////////////////////////// // Up to FLTK 1.4 the 6th element of the following struct was named 'set' // and could only be 0 or 1: whether the boxtype was "set" or not. @@ -349,82 +405,82 @@ static struct { bool bg() { return !(flags & 2); } } fl_box_table[FL_MAX_BOXTYPE+1] = { // must match list in Enumerations.H !!! - {fl_no_box, 0,0,0,0,3}, // FL_NO_BOX - {fl_flat_box, 0,0,0,0,1}, // FL_FLAT_BOX - {fl_up_box, D1,D1,D2,D2,1}, // FL_UP_BOX - {fl_down_box, D1,D1,D2,D2,1}, // FL_DOWN_BOX - {fl_up_frame, D1,D1,D2,D2,3}, // FL_UP_FRAME - {fl_down_frame, D1,D1,D2,D2,3}, // FL_DOWN_FRAME - {fl_thin_up_box, 1,1,2,2,1}, // FL_THIN_UP_BOX - {fl_thin_down_box, 1,1,2,2,1}, // FL_THIN_DOWN_BOX, - {fl_thin_up_frame, 1,1,2,2,3}, // FL_THIN_UP_FRAME, - {fl_thin_down_frame, 1,1,2,2,3}, // FL_THIN_DOWN_FRAME, - {fl_engraved_box, 2,2,4,4,1}, // FL_ENGRAVED_BOX, - {fl_embossed_box, 2,2,4,4,1}, // FL_EMBOSSED_BOX, - {fl_engraved_frame, 2,2,4,4,3}, // FL_ENGRAVED_FRAME - {fl_embossed_frame, 2,2,4,4,3}, // FL_EMBOSSED_FRAME - {fl_border_box, 1,1,2,2,1}, // FL_BORDER_BOX - {fl_border_box, 1,1,5,5,0}, // _FL_SHADOW_BOX - {fl_border_frame, 1,1,2,2,3}, // FL_BORDER_FRAME, - {fl_border_frame, 1,1,5,5,2}, // _FL_SHADOW_FRAME - {fl_border_box, 1,1,2,2,0}, // _FL_ROUNDED_BOX - {fl_border_box, 1,1,2,2,0}, // _FL_RSHADOW_BOX - {fl_border_frame, 1,1,2,2,2}, // _FL_ROUNDED_FRAME - {fl_flat_box, 0,0,0,0,0}, // _FL_RFLAT_BOX - {fl_up_box, 3,3,6,6,0}, // _FL_ROUND_UP_BOX - {fl_down_box, 3,3,6,6,0}, // _FL_ROUND_DOWN_BOX - {fl_up_box, 0,0,0,0,0}, // _FL_DIAMOND_UP_BOX - {fl_down_box, 0,0,0,0,0}, // _FL_DIAMOND_DOWN_BOX - {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_BOX - {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX - {fl_border_frame, 1,1,2,2,2}, // _FL_OVAL_FRAME - {fl_flat_box, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_PLASTIC_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_DOWN_BOX - {fl_up_frame, 2,2,4,4,2}, // _FL_PLASTIC_UP_FRAME - {fl_down_frame, 2,2,4,4,2}, // _FL_PLASTIC_DOWN_FRAME - {fl_up_box, 2,2,4,4,0}, // _FL_PLASTIC_THIN_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_THIN_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_PLASTIC_ROUND_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_ROUND_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_GTK_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_GTK_DOWN_BOX - {fl_up_frame, 2,2,4,4,2}, // _FL_GTK_UP_FRAME - {fl_down_frame, 2,2,4,4,2}, // _FL_GTK_DOWN_FRAME - {fl_up_frame, 1,1,2,2,2}, // _FL_GTK_THIN_UP_FRAME - {fl_down_frame, 1,1,2,2,2}, // _FL_GTK_THIN_DOWN_FRAME - {fl_up_box, 1,1,2,2,0}, // _FL_GTK_THIN_ROUND_UP_BOX - {fl_down_box, 1,1,2,2,0}, // _FL_GTK_THIN_ROUND_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_GTK_ROUND_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_GTK_ROUND_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_GLEAM_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_GLEAM_DOWN_BOX - {fl_up_frame, 2,2,4,4,2}, // _FL_GLEAM_UP_FRAME - {fl_down_frame, 2,2,4,4,2}, // _FL_GLEAM_DOWN_FRAME - {fl_up_box, 2,2,4,4,0}, // _FL_GLEAM_THIN_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_GLEAM_THIN_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_GLEAM_ROUND_UP_BOX - {fl_down_box, 2,2,4,4,0}, // _FL_GLEAM_ROUND_DOWN_BOX - {fl_up_box, 2,2,4,4,0}, // _FL_OXY_UP_BOX, - {fl_down_box, 2,2,4,4,0}, // _FL_OXY_DOWN_BOX, - {fl_up_frame, 2,2,4,4,2}, // _FL_OXY_UP_FRAME, - {fl_down_frame, 2,2,4,4,2}, // _FL_OXY_DOWN_FRAME, - {fl_thin_up_box, 1,1,2,2,0}, // _FL_OXY_THIN_UP_BOX, - {fl_thin_down_box, 1,1,2,2,0}, // _FL_OXY_THIN_DOWN_BOX, - {fl_thin_up_frame, 1,1,2,2,2}, // _FL_OXY_THIN_UP_FRAME, - {fl_thin_down_frame, 1,1,2,2,2}, // _FL_OXY_THIN_DOWN_FRAME, - {fl_up_box, 2,2,4,4,0}, // _FL_OXY_ROUND_UP_BOX, - {fl_down_box, 2,2,4,4,0}, // _FL_OXY_ROUND_DOWN_BOX, - {fl_up_box, 2,2,4,4,0}, // _FL_OXY_BUTTON_UP_BOX, - {fl_down_box, 2,2,4,4,0}, // _FL_OXY_BUTTON_DOWN_BOX, - {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 - {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 - {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 - {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+3 - {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+4 - {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+5 - {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+6 - {fl_down_box, 3,3,6,6,0} // FL_FREE_BOX+7 + { fl_no_box, 0, 0, 0, 0, 3 }, // FL_NO_BOX + { fl_flat_box, 0, 0, 0, 0, 1 }, // FL_FLAT_BOX + { fl_up_box, D1, D1, D2, D2, 1 }, // FL_UP_BOX + { fl_down_box, D1, D1, D2, D2, 1 }, // FL_DOWN_BOX + { fl_up_frame, D1, D1, D2, D2, 3 }, // FL_UP_FRAME + { fl_down_frame, D1, D1, D2, D2, 3 }, // FL_DOWN_FRAME + { fl_thin_up_box, 1, 1, 2, 2, 1 }, // FL_THIN_UP_BOX + { fl_thin_down_box, 1, 1, 2, 2, 1 }, // FL_THIN_DOWN_BOX, + { fl_thin_up_frame, 1, 1, 2, 2, 3 }, // FL_THIN_UP_FRAME, + { fl_thin_down_frame, 1, 1, 2, 2, 3 }, // FL_THIN_DOWN_FRAME, + { fl_engraved_box, 2, 2, 4, 4, 1 }, // FL_ENGRAVED_BOX, + { fl_embossed_box, 2, 2, 4, 4, 1 }, // FL_EMBOSSED_BOX, + { fl_engraved_frame, 2, 2, 4, 4, 3 }, // FL_ENGRAVED_FRAME + { fl_embossed_frame, 2, 2, 4, 4, 3 }, // FL_EMBOSSED_FRAME + { fl_border_box, 1, 1, 2, 2, 1 }, // FL_BORDER_BOX + { fl_shadow_box, 1, 1, 5, 5, 1 }, // FL_SHADOW_BOX + { fl_border_frame, 1, 1, 2, 2, 3 }, // FL_BORDER_FRAME, + { fl_shadow_frame, 1, 1, 5, 5, 3 }, // FL_SHADOW_FRAME + { fl_rounded_box, 1, 1, 2, 2, 1, fl_rounded_focus }, // FL_ROUNDED_BOX + { fl_rshadow_box, 1, 1, 2, 2, 1, fl_rounded_focus }, // FL_RSHADOW_BOX + { fl_rounded_frame, 1, 1, 2, 2, 3, fl_rounded_focus }, // FL_ROUNDED_FRAME + { fl_rflat_box, 0, 0, 0, 0, 1, fl_rounded_focus }, // FL_RFLAT_BOX + { fl_round_up_box, 3, 3, 6, 6, 1, fl_round_focus }, // FL_ROUND_UP_BOX + { fl_round_down_box, 3, 3, 6, 6, 1, fl_round_focus }, // FL_ROUND_DOWN_BOX + { fl_diamond_up_box, 0, 0, 0, 0, 1, fl_diamond_focus }, // FL_DIAMOND_UP_BOX + { fl_diamond_down_box, 0, 0, 0, 0, 1, fl_diamond_focus }, // FL_DIAMOND_DOWN_BOX + { fl_oval_box, 1, 1, 2, 2, 1, fl_oval_focus }, // FL_OVAL_BOX + { fl_oval_shadow_box, 1, 1, 2, 2, 1, fl_oval_focus }, // FL_OSHADOW_BOX + { fl_oval_frame, 1, 1, 2, 2, 2, fl_oval_focus }, // FL_OVAL_FRAME + { fl_oval_flat_box, 0, 0, 0, 0, 1, fl_oval_focus }, // FL_OFLAT_BOX + { fl_plastic_up_box, 2, 2, 4, 4, 1 }, // _FL_PLASTIC_UP_BOX + { fl_plastic_down_box, 2, 2, 4, 4, 1 }, // _FL_PLASTIC_DOWN_BOX + { fl_plastic_up_frame, 2, 2, 4, 4, 3 }, // _FL_PLASTIC_UP_FRAME + { fl_plastic_down_frame, 2, 2, 4, 4, 3 }, // _FL_PLASTIC_DOWN_FRAME + { fl_plastic_thin_up_box, 2, 2, 4, 4, 1 }, // _FL_PLASTIC_THIN_UP_BOX + { fl_plastic_down_box, 2, 2, 4, 4, 1 }, // _FL_PLASTIC_THIN_DOWN_BOX + { fl_plastic_up_round, 2, 2, 4, 4, 1, fl_round_focus }, // _FL_PLASTIC_ROUND_UP_BOX + { fl_plastic_down_round, 2, 2, 4, 4, 1, fl_round_focus }, // _FL_PLASTIC_ROUND_DOWN_BOX + { fl_gtk_up_box, 2, 2, 4, 4, 1 }, // _FL_GTK_UP_BOX + { fl_gtk_down_box, 2, 2, 4, 4, 1 }, // _FL_GTK_DOWN_BOX + { fl_gtk_up_frame, 2, 2, 4, 4, 3 }, // _FL_GTK_UP_FRAME + { fl_gtk_down_frame, 2, 2, 4, 4, 3 }, // _FL_GTK_DOWN_FRAME + { fl_gtk_thin_up_box, 1, 1, 2, 2, 3 }, // FL_GTK_THIN_UP_BOX + { fl_gtk_thin_down_box, 1, 1, 2, 2, 3 }, // FL_GTK_THIN_DOWN_BOX + { fl_gtk_thin_up_frame, 1, 1, 2, 2, 1 }, // FL_GTK_THIN_UP_FRAME + { fl_gtk_thin_down_frame, 1, 1, 2, 2, 1 }, // FL_GTK_THIN_DOWN_FRAME + { fl_gtk_round_up_box, 2, 2, 4, 4, 1, fl_round_focus }, // FL_GTK_ROUND_UP_BOX + { fl_gtk_round_down_box, 2, 2, 4, 4, 1, fl_round_focus }, // FL_GTK_ROUND_DOWN_BOX + { fl_gleam_up_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_UP_BOX + { fl_gleam_down_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_DOWN_BOX + { fl_gleam_up_frame, 2, 2, 4, 4, 3 }, // _FL_GLEAM_UP_FRAME + { fl_gleam_down_frame, 2, 2, 4, 4, 3 }, // _FL_GLEAM_DOWN_FRAME + { fl_gleam_thin_up_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_THIN_UP_BOX + { fl_gleam_thin_down_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_THIN_DOWN_BOX + { fl_gleam_up_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_ROUND_UP_BOX + { fl_gleam_down_box, 2, 2, 4, 4, 1 }, // _FL_GLEAM_ROUND_DOWN_BOX + { fl_oxy_up_box, 2, 2, 4, 4, 1 }, // _FL_OXY_UP_BOX, + { fl_oxy_down_box, 2, 2, 4, 4, 1 }, // _FL_OXY_DOWN_BOX, + { fl_oxy_up_frame, 2, 2, 4, 4, 3 }, // _FL_OXY_UP_FRAME, + { fl_oxy_down_frame, 2, 2, 4, 4, 3 }, // _FL_OXY_DOWN_FRAME, + { fl_oxy_thin_up_box, 1, 1, 2, 2, 1 }, // _FL_OXY_THIN_UP_BOX, + { fl_oxy_thin_down_box, 1, 1, 2, 2, 1 }, // _FL_OXY_THIN_DOWN_BOX, + { fl_oxy_thin_up_frame, 1, 1, 2, 2, 3 }, // _FL_OXY_THIN_UP_FRAME, + { fl_oxy_thin_down_frame, 1, 1, 2, 2, 3 }, // _FL_OXY_THIN_DOWN_FRAME, + { fl_oxy_round_up_box, 2, 2, 4, 4, 1, fl_round_focus }, // _FL_OXY_ROUND_UP_BOX, + { fl_oxy_round_down_box, 2, 2, 4, 4, 1, fl_round_focus }, // _FL_OXY_ROUND_DOWN_BOX, + { fl_oxy_button_up_box, 2, 2, 4, 4, 1 }, // _FL_OXY_BUTTON_UP_BOX, + { fl_oxy_button_down_box, 2, 2, 4, 4, 1 }, // _FL_OXY_BUTTON_DOWN_BOX, + { fl_up_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+0 + { fl_down_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+1 + { fl_up_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+2 + { fl_down_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+3 + { fl_up_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+4 + { fl_down_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+5 + { fl_up_box, 3, 3, 6, 6, 1 }, // FL_FREE_BOX+6 + { fl_down_box, 3, 3, 6, 6, 1 } // FL_FREE_BOX+7 }; /** @@ -487,19 +543,10 @@ extern bool Fl::box_bg(Fl_Boxtype bt) { return fl_box_table[bt].bg(); } -/** - Sets the drawing function for a given box type. - \param[in] t box type - \param[in] f box drawing function - \param[in] ff optional box focus rectangle drawing function +/* + Starting with FLTK version 1.5, this is no longer needed. Use Fl::set_boxtype(). + void fl_internal_boxtype(Fl_Boxtype t, Fl_Box_Draw_F* f, Fl_Box_Draw_Focus_F* ff) */ -void fl_internal_boxtype(Fl_Boxtype t, Fl_Box_Draw_F* f, Fl_Box_Draw_Focus_F* ff) { - if (!fl_box_table[t].set()) { - fl_box_table[t].f = f; - fl_box_table[t].ff = ff; - fl_box_table[t].flags |= 1; - } -} /** Gets the current box drawing function for the specified box type. */ Fl_Box_Draw_F *Fl::get_boxtype(Fl_Boxtype t) { diff --git a/src/fl_diamond_box.cxx b/src/fl_diamond_box.cxx index 414e5dea3..8d4da1c7e 100644 --- a/src/fl_diamond_box.cxx +++ b/src/fl_diamond_box.cxx @@ -1,7 +1,7 @@ // // Diamond box code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2011 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -25,7 +25,7 @@ extern const uchar* fl_gray_ramp(); -static void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor) { +void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor) { w &= -2; h &= -2; int x1 = x+w/2; @@ -42,7 +42,7 @@ static void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor) { fl_color(g[(int)'A']); fl_loop(x, y1, x1, y, x+w, y1, x1, y+h); } -static void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor) { +void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor) { w &= -2; h &= -2; int x1 = x+w/2; @@ -75,9 +75,3 @@ void fl_diamond_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl fl_line_style(FL_SOLID); fl_color(savecolor); } -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); -Fl_Boxtype fl_define_FL_DIAMOND_BOX() { - fl_internal_boxtype(_FL_DIAMOND_DOWN_BOX, fl_diamond_down_box, fl_diamond_focus); - fl_internal_boxtype(_FL_DIAMOND_UP_BOX, fl_diamond_up_box, fl_diamond_focus); - return _FL_DIAMOND_UP_BOX; -} diff --git a/src/fl_gleam.cxx b/src/fl_gleam.cxx index d7f80adc6..f3278f9d9 100644 --- a/src/fl_gleam.cxx +++ b/src/fl_gleam.cxx @@ -1,7 +1,7 @@ // // "Gleam" scheme box drawing routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -136,44 +136,30 @@ static void frame_rect_down(int x, int y, int w, int h, Fl_Color bc, Fl_Color lc // Draw the different box types. These are the actual box drawing functions. -static void up_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_up_frame(int x, int y, int w, int h, Fl_Color c) { frame_rect_up(x, y, w, h, c, fl_color_average(c, FL_WHITE, .25f), .55f, .05f); } -static void up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_up_box(int x, int y, int w, int h, Fl_Color c) { shade_rect_top_bottom_up(x, y, w, h, c, .15f); frame_rect_up(x, y, w, h, c, fl_color_average(c, FL_WHITE, .05f), .15f, .05f); } -static void thin_up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_thin_up_box(int x, int y, int w, int h, Fl_Color c) { shade_rect_top_bottom_up(x, y, w, h, c, .25f); frame_rect_up(x, y, w, h, c, fl_color_average(c, FL_WHITE, .45f), .25f, .15f); } -static void down_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_down_frame(int x, int y, int w, int h, Fl_Color c) { frame_rect_down(x, y, w, h, fl_darker(c), fl_darker(c), .25f, .95f); } -static void down_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_down_box(int x, int y, int w, int h, Fl_Color c) { shade_rect_top_bottom_down(x, y, w, h, c, .65f); frame_rect_down(x, y, w, h, c, fl_color_average(c, FL_BLACK, .05f), .05f, .95f); } -static void thin_down_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gleam_thin_down_box(int x, int y, int w, int h, Fl_Color c) { shade_rect_top_bottom_down(x, y, w, h, c, .85f); frame_rect_down(x, y, w, h, c, fl_color_average(c, FL_BLACK, .45f), .35f, 0.85f); } - -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); - -Fl_Boxtype fl_define_FL_GLEAM_UP_BOX() { - fl_internal_boxtype(_FL_GLEAM_UP_BOX, up_box); - fl_internal_boxtype(_FL_GLEAM_DOWN_BOX, down_box); - fl_internal_boxtype(_FL_GLEAM_UP_FRAME, up_frame); - fl_internal_boxtype(_FL_GLEAM_DOWN_FRAME, down_frame); - fl_internal_boxtype(_FL_GLEAM_THIN_UP_BOX, thin_up_box); - fl_internal_boxtype(_FL_GLEAM_THIN_DOWN_BOX, thin_down_box); - fl_internal_boxtype(_FL_GLEAM_ROUND_UP_BOX, up_box); - fl_internal_boxtype(_FL_GLEAM_ROUND_DOWN_BOX, down_box); - return _FL_GLEAM_UP_BOX; -} diff --git a/src/fl_gtk.cxx b/src/fl_gtk.cxx index c09c24adb..519be370f 100644 --- a/src/fl_gtk.cxx +++ b/src/fl_gtk.cxx @@ -4,7 +4,7 @@ // These box types provide a GTK+ look, based on Red Hat's Bluecurve // theme... // -// Copyright 2006-2010 by Michael Sweet. +// Copyright 2006-2025 by Michael Sweet. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -24,14 +24,11 @@ #include #include -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); - - static void gtk_color(Fl_Color c) { Fl::set_box_color(c); } -static void gtk_up_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_up_frame(int x, int y, int w, int h, Fl_Color c) { gtk_color(fl_color_average(FL_WHITE, c, 0.5)); fl_xyline(x + 2, y + 1, x + w - 3); fl_yxline(x + 1, y + 2, y + h - 3); @@ -50,8 +47,8 @@ static void gtk_up_frame(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_up_box(int x, int y, int w, int h, Fl_Color c) { - gtk_up_frame(x, y, w, h, c); +void fl_gtk_up_box(int x, int y, int w, int h, Fl_Color c) { + fl_gtk_up_frame(x, y, w, h, c); gtk_color(fl_color_average(FL_WHITE, c, 0.4f)); fl_xyline(x + 2, y + 2, x + w - 3); @@ -71,7 +68,7 @@ static void gtk_up_box(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_down_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_down_frame(int x, int y, int w, int h, Fl_Color c) { gtk_color(fl_color_average(FL_BLACK, c, 0.5)); fl_begin_loop(); fl_vertex(x, y + 2); @@ -93,8 +90,8 @@ static void gtk_down_frame(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_down_box(int x, int y, int w, int h, Fl_Color c) { - gtk_down_frame(x, y, w, h, c); +void fl_gtk_down_box(int x, int y, int w, int h, Fl_Color c) { + fl_gtk_down_frame(x, y, w, h, c); gtk_color(c); fl_rectf(x + 3, y + 3, w - 5, h - 4); @@ -102,7 +99,7 @@ static void gtk_down_box(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_thin_up_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_thin_up_frame(int x, int y, int w, int h, Fl_Color c) { gtk_color(fl_color_average(FL_WHITE, c, 0.6f)); fl_xyline(x + 1, y, x + w - 2); fl_yxline(x, y + 1, y + h - 2); @@ -113,8 +110,8 @@ static void gtk_thin_up_frame(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_thin_up_box(int x, int y, int w, int h, Fl_Color c) { - gtk_thin_up_frame(x, y, w, h, c); +void fl_gtk_thin_up_box(int x, int y, int w, int h, Fl_Color c) { + fl_gtk_thin_up_frame(x, y, w, h, c); gtk_color(fl_color_average(FL_WHITE, c, 0.4f)); fl_xyline(x + 1, y + 1, x + w - 2); @@ -133,7 +130,7 @@ static void gtk_thin_up_box(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_thin_down_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_thin_down_frame(int x, int y, int w, int h, Fl_Color c) { gtk_color(fl_color_average(FL_BLACK, c, 0.4f)); fl_xyline(x + 1, y, x + w - 2); fl_yxline(x, y + 1, y + h - 2); @@ -144,8 +141,8 @@ static void gtk_thin_down_frame(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_thin_down_box(int x, int y, int w, int h, Fl_Color c) { - gtk_thin_down_frame(x, y, w, h, c); +void fl_gtk_thin_down_box(int x, int y, int w, int h, Fl_Color c) { + fl_gtk_thin_down_frame(x, y, w, h, c); gtk_color(c); fl_rectf(x + 1, y + 1, w - 2, h - 2); @@ -202,7 +199,7 @@ static void draw(int which, int x,int y,int w,int h, int inset) } } -static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { gtk_color(c); draw(FILL, x, y, w, h, 2); @@ -233,7 +230,8 @@ static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { draw(CLOSED, x, y, w, h, 0); } -static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { + +void fl_gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { gtk_color(c); draw(FILL, x, y, w, h, 2); @@ -260,7 +258,7 @@ static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { #else -static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { gtk_color(c); fl_pie(x, y, w, h, 0.0, 360.0); gtk_color(fl_color_average(FL_WHITE, c, 0.5f)); @@ -272,7 +270,7 @@ static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { } -static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { +void fl_gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { gtk_color(c); fl_pie(x, y, w, h, 0.0, 360.0); gtk_color(fl_color_average(FL_BLACK, c, 0.2)); @@ -284,18 +282,3 @@ static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { #endif extern void fl_round_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); - -Fl_Boxtype fl_define_FL_GTK_UP_BOX() { - fl_internal_boxtype(_FL_GTK_UP_BOX, gtk_up_box); - fl_internal_boxtype(_FL_GTK_DOWN_BOX, gtk_down_box); - fl_internal_boxtype(_FL_GTK_UP_FRAME, gtk_up_frame); - fl_internal_boxtype(_FL_GTK_DOWN_FRAME, gtk_down_frame); - fl_internal_boxtype(_FL_GTK_THIN_UP_BOX, gtk_thin_up_box); - fl_internal_boxtype(_FL_GTK_THIN_DOWN_BOX, gtk_thin_down_box); - fl_internal_boxtype(_FL_GTK_THIN_UP_FRAME, gtk_thin_up_frame); - fl_internal_boxtype(_FL_GTK_THIN_DOWN_FRAME, gtk_thin_down_frame); - fl_internal_boxtype(_FL_GTK_ROUND_UP_BOX, gtk_round_up_box, fl_round_focus); - fl_internal_boxtype(_FL_GTK_ROUND_DOWN_BOX, gtk_round_down_box, fl_round_focus); - - return _FL_GTK_UP_BOX; -} diff --git a/src/fl_oval_box.cxx b/src/fl_oval_box.cxx index 3d8d27fd3..a9db0b799 100644 --- a/src/fl_oval_box.cxx +++ b/src/fl_oval_box.cxx @@ -1,7 +1,7 @@ // // Oval box drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2020 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -25,22 +25,22 @@ // BW = box shadow width #define BW (Fl::box_shadow_width()) -static void fl_oval_flat_box(int x, int y, int w, int h, Fl_Color c) { +void fl_oval_flat_box(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); fl_pie(x, y, w, h, 0, 360); } -static void fl_oval_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_oval_frame(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); fl_arc(x, y, w, h, 0, 360); } -static void fl_oval_box(int x, int y, int w, int h, Fl_Color c) { +void fl_oval_box(int x, int y, int w, int h, Fl_Color c) { fl_oval_flat_box(x,y,w,h,c); fl_oval_frame(x,y,w,h,FL_BLACK); } -static void fl_oval_shadow_box(int x, int y, int w, int h, Fl_Color c) { +void fl_oval_shadow_box(int x, int y, int w, int h, Fl_Color c) { fl_oval_flat_box(x+BW,y+BW,w,h,FL_DARK3); fl_oval_box(x,y,w,h,c); } @@ -58,11 +58,3 @@ void fl_oval_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Co fl_color(savecolor); } -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); -Fl_Boxtype fl_define_FL_OVAL_BOX() { - fl_internal_boxtype(_FL_OSHADOW_BOX, fl_oval_shadow_box, fl_oval_focus); - fl_internal_boxtype(_FL_OVAL_FRAME, fl_oval_frame, fl_oval_focus); - fl_internal_boxtype(_FL_OFLAT_BOX, fl_oval_flat_box, fl_oval_focus); - fl_internal_boxtype(_FL_OVAL_BOX, fl_oval_box, fl_oval_focus); - return _FL_OVAL_BOX; -} diff --git a/src/fl_oxy.cxx b/src/fl_oxy.cxx index 0c6ae69e3..6332508d6 100644 --- a/src/fl_oxy.cxx +++ b/src/fl_oxy.cxx @@ -2,7 +2,7 @@ // "Oxy" Scheme drawing routines for the Fast Light Tool Kit (FLTK). // // Copyright 2011 by Dmitrij K. aka "kdiman" -// Copyright 2012-2024 by Bill Spitzak and others. +// Copyright 2012-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -256,7 +256,7 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool int X, Y, W, H, X1, Y1; // draw bg - if (typebox != _FL_OXY_UP_FRAME && typebox != _FL_OXY_DOWN_FRAME) { + if (typebox != FL_OXY_UP_FRAME && typebox != FL_OXY_DOWN_FRAME) { X = x + 1; Y = y + 1; @@ -264,24 +264,24 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool H = h - 2; switch (typebox) { - case _FL_OXY_UP_BOX: { + case FL_OXY_UP_BOX: { _oxy_up_box_(X, Y, W, H, oxy_color(col)); break; } - case _FL_OXY_DOWN_BOX: { + case FL_OXY_DOWN_BOX: { _oxy_down_box_(X, Y, W, H, oxy_color(col)); break; } - case _FL_OXY_BUTTON_UP_BOX: { + case FL_OXY_BUTTON_UP_BOX: { _oxy_button_up_box_(X, Y, W, H, oxy_color(col)); break; } - case _FL_OXY_BUTTON_DOWN_BOX: { + case FL_OXY_BUTTON_DOWN_BOX: { _oxy_button_down_box_(X, Y, W, H, oxy_color(col)); break; } - case _FL_OXY_ROUND_UP_BOX: - case _FL_OXY_ROUND_DOWN_BOX: + case FL_OXY_ROUND_UP_BOX: + case FL_OXY_ROUND_DOWN_BOX: _oxy_rounded_box_(x, y, w, h, oxy_color(fl_color_average(col, FL_WHITE, 0.82f))); break; default: { break; } @@ -290,31 +290,31 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool Fl_Color leftline = col, topline = col, rightline = col, bottomline = col; - if (typebox == _FL_OXY_ROUND_UP_BOX || typebox == _FL_OXY_ROUND_DOWN_BOX) { + if (typebox == FL_OXY_ROUND_UP_BOX || typebox == FL_OXY_ROUND_DOWN_BOX) { leftline = fl_color_average(col, FL_WHITE, 0.88f); leftline = topline = rightline = bottomline = fl_color_average(leftline, FL_BLACK, 0.97f); } - else if (typebox == _FL_OXY_UP_BOX || typebox == _FL_OXY_UP_FRAME) { + else if (typebox == FL_OXY_UP_BOX || typebox == FL_OXY_UP_FRAME) { topline = fl_color_average(col, FL_BLACK, 0.95f); leftline = fl_color_average(col, FL_BLACK, 0.85f); rightline = leftline; bottomline = fl_color_average(col, FL_BLACK, 0.88f); } - else if (typebox == _FL_OXY_DOWN_BOX || typebox == _FL_OXY_DOWN_FRAME) { + else if (typebox == FL_OXY_DOWN_BOX || typebox == FL_OXY_DOWN_FRAME) { topline = fl_color_average(col, FL_BLACK, 0.88f); leftline = fl_color_average(col, FL_BLACK, 0.85f); rightline = leftline; bottomline = fl_color_average(col, FL_BLACK, 0.95f); } - else if (typebox == _FL_OXY_BUTTON_UP_BOX || typebox == _FL_OXY_BUTTON_DOWN_BOX) { + else if (typebox == FL_OXY_BUTTON_UP_BOX || typebox == FL_OXY_BUTTON_DOWN_BOX) { topline = leftline = rightline = bottomline = fl_color_average(col, FL_BLACK, 0.85f); } // draw border - if (typebox != _FL_OXY_ROUND_UP_BOX && typebox != _FL_OXY_ROUND_DOWN_BOX) { + if (typebox != FL_OXY_ROUND_UP_BOX && typebox != FL_OXY_ROUND_DOWN_BOX) { // bottom side fl_color(oxy_color(bottomline)); fl_line(x + 1, y + h - 1, x + w - 2, y + h - 1); @@ -332,24 +332,24 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool // draw shadow if (is_shadow) { - if (typebox == _FL_OXY_ROUND_UP_BOX) { + if (typebox == FL_OXY_ROUND_UP_BOX) { topline = fl_color_average(col, FL_WHITE, 0.35f); bottomline = fl_color_average(col, FL_BLACK, 0.94f); } - else if (typebox == _FL_OXY_ROUND_DOWN_BOX) { + else if (typebox == FL_OXY_ROUND_DOWN_BOX) { topline = fl_color_average(col, FL_BLACK, 0.94f); bottomline = fl_color_average(col, FL_WHITE, 0.35f); } - else if (typebox == _FL_OXY_UP_BOX || typebox == _FL_OXY_UP_FRAME) { + else if (typebox == FL_OXY_UP_BOX || typebox == FL_OXY_UP_FRAME) { topline = fl_color_average(col, FL_WHITE, 0.35f); leftline = fl_color_average(col, FL_WHITE, 0.4f); rightline = leftline; bottomline = fl_color_average(col, FL_BLACK, 0.8f); } - else if (typebox == _FL_OXY_DOWN_BOX || typebox == _FL_OXY_DOWN_FRAME) { + else if (typebox == FL_OXY_DOWN_BOX || typebox == FL_OXY_DOWN_FRAME) { topline = fl_color_average(col, FL_BLACK, 0.8f); leftline = fl_color_average(col, FL_BLACK, 0.94f); rightline = leftline; @@ -362,7 +362,7 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool int yh2 = y + h - 2; int yh1 = y + h - 1; - if (typebox == _FL_OXY_UP_BOX || typebox == _FL_OXY_UP_FRAME) { + if (typebox == FL_OXY_UP_BOX || typebox == FL_OXY_UP_FRAME) { fl_color(oxy_color(topline)); X = x + 1; Y = y + 1; @@ -392,7 +392,7 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool fl_line(X, Y, X1, Y1); // bottom line } - else if (typebox == _FL_OXY_DOWN_BOX || typebox == _FL_OXY_DOWN_FRAME) { + else if (typebox == FL_OXY_DOWN_BOX || typebox == FL_OXY_DOWN_FRAME) { fl_color(oxy_color(topline)); X = x + 1; Y = y + 1; @@ -422,7 +422,7 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool fl_line(X, Y, X1, Y1); // bottom line } - else if (typebox == _FL_OXY_ROUND_UP_BOX || typebox == _FL_OXY_ROUND_DOWN_BOX) { + else if (typebox == FL_OXY_ROUND_UP_BOX || typebox == FL_OXY_ROUND_DOWN_BOX) { int Radius, smooth; int r_offset2; // quarter of smooth and half of smooth @@ -452,12 +452,12 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool fl_color(oxy_color(topline)); fl_line(x + 1, yh1 - smooth - r_offset2, x + 1, y + r_offset2 + smooth); // left side fl_arc(x + 1, y + 1, Radius, Radius, 90.0, 180.0); // left-top corner - if (typebox == _FL_OXY_ROUND_DOWN_BOX) { + if (typebox == FL_OXY_ROUND_DOWN_BOX) { fl_arc(x + 1, y + 1, Radius + 1, Radius + 1, 90.0, 180.0); } // left-top corner (DOWN_BOX) fl_line(x + smooth + r_offset2, y + 1, xw1 - smooth - r_offset2, y + 1); // top side fl_arc(xw1 - Radius, y + 1, Radius, Radius, 00.0, 90.0); // right-top corner - if (typebox == _FL_OXY_ROUND_DOWN_BOX) { + if (typebox == FL_OXY_ROUND_DOWN_BOX) { fl_arc(xw1 - Radius, y + 1, Radius + 1, Radius + 1, 00.0, 90.0); } // right-top corner (DOWN_BOX) fl_line(xw2, y + smooth + r_offset2, xw2, yh1 - smooth - r_offset2); // right side @@ -465,12 +465,12 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool fl_arc(xw1 - Radius, yh1 - Radius, Radius, Radius, 340.0, 360.0); // right-bottom fl_color(oxy_color(bottomline)); fl_arc(x + 1, yh1 - Radius, Radius, Radius, 200.0, 270.0); // left-bottom corner - if (typebox == _FL_OXY_ROUND_UP_BOX) { + if (typebox == FL_OXY_ROUND_UP_BOX) { fl_arc(x + 1, yh1 - Radius, Radius + 1, Radius + 1, 200.0, 270.0); } // left-bottom corner (UP_BOX) fl_line(xw1 - smooth - r_offset2, yh2, x + smooth + r_offset2, yh2); // bottom side fl_arc(xw1 - Radius, yh1 - Radius, Radius, Radius, 270.0, 340.0); // right-bottom corner - if (typebox == _FL_OXY_ROUND_UP_BOX) { + if (typebox == FL_OXY_ROUND_UP_BOX) { fl_arc(xw1 - Radius, yh1 - Radius, Radius + 1, Radius + 1, 270.0, 340.0); } // right-bottom corner } @@ -480,61 +480,40 @@ static void oxy_draw(int x, int y, int w, int h, Fl_Color col, int typebox, bool } // end `static void oxy_draw(...)' -void button_up_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_BUTTON_UP_BOX, true); +void fl_oxy_button_up_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_BUTTON_UP_BOX, true); } -void button_down_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_BUTTON_DOWN_BOX, true); +void fl_oxy_button_down_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_BUTTON_DOWN_BOX, true); } -void up_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_UP_BOX, true); +void fl_oxy_up_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_UP_BOX, true); } -void down_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_DOWN_BOX, true); +void fl_oxy_down_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_DOWN_BOX, true); } -void thin_up_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_UP_BOX, false); +void fl_oxy_thin_up_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_UP_BOX, false); } -void thin_down_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_DOWN_BOX, false); +void fl_oxy_thin_down_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_DOWN_BOX, false); } -void up_frame(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_UP_FRAME, true); +void fl_oxy_up_frame(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_UP_FRAME, true); } -void down_frame(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_DOWN_FRAME, true); +void fl_oxy_down_frame(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_DOWN_FRAME, true); } -void thin_up_frame(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_UP_FRAME, false); +void fl_oxy_thin_up_frame(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_UP_FRAME, false); } -void thin_down_frame(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_DOWN_FRAME, false); +void fl_oxy_thin_down_frame(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_DOWN_FRAME, false); } -void round_up_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_ROUND_UP_BOX, true); +void fl_oxy_round_up_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_ROUND_UP_BOX, true); } -void round_down_box(int x, int y, int w, int h, Fl_Color col) { - oxy_draw(x, y, w, h, col, _FL_OXY_ROUND_DOWN_BOX, true); +void fl_oxy_round_down_box(int x, int y, int w, int h, Fl_Color col) { + oxy_draw(x, y, w, h, col, FL_OXY_ROUND_DOWN_BOX, true); } - -extern void fl_round_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); - -Fl_Boxtype fl_define_FL_OXY_UP_BOX() { - - fl_internal_boxtype(_FL_OXY_UP_BOX, up_box); - fl_internal_boxtype(_FL_OXY_DOWN_BOX, down_box); - fl_internal_boxtype(_FL_OXY_UP_FRAME, up_frame); - fl_internal_boxtype(_FL_OXY_DOWN_FRAME, down_frame); - fl_internal_boxtype(_FL_OXY_THIN_UP_BOX, thin_up_box); - fl_internal_boxtype(_FL_OXY_THIN_DOWN_BOX, thin_down_box); - fl_internal_boxtype(_FL_OXY_THIN_UP_FRAME, thin_up_frame); - fl_internal_boxtype(_FL_OXY_THIN_DOWN_FRAME, thin_down_frame); - fl_internal_boxtype(_FL_OXY_ROUND_UP_BOX, round_up_box, fl_round_focus); - fl_internal_boxtype(_FL_OXY_ROUND_DOWN_BOX, round_down_box, fl_round_focus); - fl_internal_boxtype(_FL_OXY_BUTTON_UP_BOX, button_up_box); - fl_internal_boxtype(_FL_OXY_BUTTON_DOWN_BOX, button_down_box); - - return _FL_OXY_UP_BOX; -} diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx index 16c565c8b..e9ca0bd2a 100644 --- a/src/fl_plastic.cxx +++ b/src/fl_plastic.cxx @@ -4,7 +4,7 @@ // These box types provide a cross between Aqua and KDE buttons; kindof // like translucent plastic buttons... // -// Copyright 2001-2010 by Michael Sweet. +// Copyright 2001-2025 by Michael Sweet. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -268,7 +268,7 @@ static void shade_round(int x, int y, int w, int h, const char *c, Fl_Color bc) } -static void up_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_up_frame(int x, int y, int w, int h, Fl_Color c) { frame_rect(x, y, w, h - 1, "KLDIIJLM", c); } @@ -290,10 +290,10 @@ static void narrow_thin_box(int x, int y, int w, int h, Fl_Color c) { } -static void thin_up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_thin_up_box(int x, int y, int w, int h, Fl_Color c) { #ifdef USE_OLD_PLASTIC_BOX shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c); - up_frame(x, y, w, h, c); + fl_plastic_up_frame(x, y, w, h, c); #else if (w > 4 && h > 4) { shade_rect(x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c); @@ -305,36 +305,36 @@ static void thin_up_box(int x, int y, int w, int h, Fl_Color c) { } -static void up_box(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_up_box(int x, int y, int w, int h, Fl_Color c) { #ifdef USE_OLD_PLASTIC_BOX shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c); - up_frame(x, y, w, h, c); + fl_plastic_up_frame(x, y, w, h, c); #else if (w > 8 && h > 8) { shade_rect(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c); frame_rect(x, y, w, h - 1, "IJLM", c); } else { - thin_up_box(x, y, w, h, c); + fl_plastic_thin_up_box(x, y, w, h, c); } #endif // USE_OLD_PLASTIC_BOX } -static void up_round(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_up_round(int x, int y, int w, int h, Fl_Color c) { shade_round(x, y, w, h, "RVQNOPQRSTUVWVQ", c); frame_round(x, y, w, h, "IJLM", c); } -static void down_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_down_frame(int x, int y, int w, int h, Fl_Color c) { frame_rect(x, y, w, h - 1, "LLLLTTRR", c); } -static void down_box(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_down_box(int x, int y, int w, int h, Fl_Color c) { if (w > 6 && h > 6) { shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c); - down_frame(x, y, w, h, c); + fl_plastic_down_frame(x, y, w, h, c); } else { narrow_thin_box(x, y, w, h, c); @@ -342,24 +342,8 @@ static void down_box(int x, int y, int w, int h, Fl_Color c) { } -static void down_round(int x, int y, int w, int h, Fl_Color c) { +void fl_plastic_down_round(int x, int y, int w, int h, Fl_Color c) { shade_round(x, y, w, h, "STUVWWWVT", c); frame_round(x, y, w, h, "IJLM", c); } - -extern void fl_round_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); - -Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX() { - fl_internal_boxtype(_FL_PLASTIC_UP_BOX, up_box); - fl_internal_boxtype(_FL_PLASTIC_DOWN_BOX, down_box); - fl_internal_boxtype(_FL_PLASTIC_UP_FRAME, up_frame); - fl_internal_boxtype(_FL_PLASTIC_DOWN_FRAME, down_frame); - fl_internal_boxtype(_FL_PLASTIC_THIN_UP_BOX, thin_up_box); - fl_internal_boxtype(_FL_PLASTIC_THIN_DOWN_BOX, down_box); - fl_internal_boxtype(_FL_PLASTIC_ROUND_UP_BOX, up_round, fl_round_focus); - fl_internal_boxtype(_FL_PLASTIC_ROUND_DOWN_BOX, down_round, fl_round_focus); - - return _FL_PLASTIC_UP_BOX; -} diff --git a/src/fl_round_box.cxx b/src/fl_round_box.cxx index c46e6f9ae..aae5ef5b1 100644 --- a/src/fl_round_box.cxx +++ b/src/fl_round_box.cxx @@ -1,7 +1,7 @@ // // Round box drawing routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -120,9 +120,3 @@ void fl_round_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_C fl_color(savecolor); } -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); -Fl_Boxtype fl_define_FL_ROUND_UP_BOX() { - fl_internal_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, fl_round_focus); - fl_internal_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, fl_round_focus); - return _FL_ROUND_UP_BOX; -} diff --git a/src/fl_rounded_box.cxx b/src/fl_rounded_box.cxx index 9b64f5265..d442f41f8 100644 --- a/src/fl_rounded_box.cxx +++ b/src/fl_rounded_box.cxx @@ -1,7 +1,7 @@ // // Rounded box drawing routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2020 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -37,23 +37,23 @@ static void rbox(int fill, int x, int y, int w, int h) { fl_rounded_rect(x, y, w, h, rs); } -static void fl_rflat_box(int x, int y, int w, int h, Fl_Color c) { +void fl_rflat_box(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); rbox(1, x, y, w, h); rbox(0, x, y, w, h); } -static void fl_rounded_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_rounded_frame(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); rbox(0, x, y, w, h); } -static void fl_rounded_box(int x, int y, int w, int h, Fl_Color c) { +void fl_rounded_box(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); rbox(1, x, y, w, h); fl_color(FL_BLACK); rbox(0, x, y, w, h); } -static void fl_rshadow_box(int x, int y, int w, int h, Fl_Color c) { +void fl_rshadow_box(int x, int y, int w, int h, Fl_Color c) { // draw shadow: fl_color(FL_DARK3); rbox(1, x+BW, y+BW, w, h); @@ -75,20 +75,3 @@ void fl_rounded_focus(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl fl_color(savecolor); } -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); - -Fl_Boxtype fl_define_FL_ROUNDED_BOX() { - fl_internal_boxtype(_FL_ROUNDED_FRAME, fl_rounded_frame, fl_rounded_focus); - fl_internal_boxtype(_FL_ROUNDED_BOX, fl_rounded_box, fl_rounded_focus); - return _FL_ROUNDED_BOX; -} - -Fl_Boxtype fl_define_FL_RFLAT_BOX() { - fl_internal_boxtype(_FL_RFLAT_BOX, fl_rflat_box, fl_rounded_focus); - return _FL_RFLAT_BOX; -} - -Fl_Boxtype fl_define_FL_RSHADOW_BOX() { - fl_internal_boxtype(_FL_RSHADOW_BOX, fl_rshadow_box, fl_rounded_focus); - return _FL_RSHADOW_BOX; -} diff --git a/src/fl_shadow_box.cxx b/src/fl_shadow_box.cxx index 16d874afc..0b1873ff1 100644 --- a/src/fl_shadow_box.cxx +++ b/src/fl_shadow_box.cxx @@ -1,7 +1,7 @@ // // Shadow box drawing routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2011 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -22,7 +22,7 @@ // BW = box shadow width #define BW (Fl::box_shadow_width()) -static void fl_shadow_frame(int x, int y, int w, int h, Fl_Color c) { +void fl_shadow_frame(int x, int y, int w, int h, Fl_Color c) { fl_color(FL_DARK3); fl_rectf(x+BW, y+h-BW, w - BW, BW); fl_rectf(x+w-BW, y+BW, BW, h - BW); @@ -30,15 +30,8 @@ static void fl_shadow_frame(int x, int y, int w, int h, Fl_Color c) { fl_rect(x,y,w-BW,h-BW); } -static void fl_shadow_box(int x, int y, int w, int h, Fl_Color c) { +void fl_shadow_box(int x, int y, int w, int h, Fl_Color c) { Fl::set_box_color(c); fl_rectf(x,y,w-BW,h-BW); fl_shadow_frame(x,y,w,h,FL_GRAY0); } - -extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, Fl_Box_Draw_Focus_F* =NULL); -Fl_Boxtype fl_define_FL_SHADOW_BOX() { - fl_internal_boxtype(_FL_SHADOW_FRAME, fl_shadow_frame); - fl_internal_boxtype(_FL_SHADOW_BOX, fl_shadow_box); - return _FL_SHADOW_BOX; -} -- cgit v1.2.3