From 1ccafa83b2c783fdfe088af1ddf9a853e071cf5d Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 19 Mar 2025 14:44:16 +0100 Subject: Remove obsolete build option 'FLTK_OPTION_STD' This option is no longer needed since FLTK 1.5 always requires C++11. --- src/Fl_Table.cxx | 41 +----------------------- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 26 +++------------ src/fl_ask.cxx | 7 ---- 3 files changed, 5 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx index c145d9010..d970659a0 100644 --- a/src/Fl_Table.cxx +++ b/src/Fl_Table.cxx @@ -3,7 +3,7 @@ // // Copyright 2002 by Greg Ercolano. // Copyright (c) 2004 O'ksi'D -// Copyright 2023 by Bill Spitzak and others. +// Copyright 2023-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 @@ -20,16 +20,6 @@ #include #include -// EXPERIMENTAL -// We use either std::vector or the private class Fl_Int_Vector -// depending on the build option FLTK_OPTION_STD or equivalent. -// This option allows to use std::string and maybe std::vector -// already in FLTK 1.4.x - -#if (!FLTK_USE_STD) -#include "Fl_Int_Vector.H" // Note: MUST NOT be included in Fl_Table.H -#endif - #include #include // memcpy #include // fprintf @@ -155,13 +145,8 @@ Fl_Table::Fl_Table(int X, int Y, int W, int H, const char *l) : Fl_Group(X,Y,W,H _scrollbar_size = 0; flags_ = 0; // TABCELLNAV off -#if (FLTK_USE_STDXX) _colwidths = new std::vector; // column widths in pixels _rowheights = new std::vector; // row heights in pixels -#else - _colwidths = new Fl_Int_Vector(); // column widths in pixels - _rowheights = new Fl_Int_Vector(); // row heights in pixels -#endif box(FL_THIN_DOWN_FRAME); @@ -237,13 +222,7 @@ void Fl_Table::row_height(int row, int height) { // Add row heights, even if none yet int now_size = row_size(); if (row >= now_size) { -#if (FLTK_USE_STD) _rowheights->resize(row, height); -#else - _rowheights->size(row); - while (now_size < row) - (*_rowheights)[now_size++] = height; -#endif // FLTK_USE_STD } (*_rowheights)[row] = height; table_resized(); @@ -270,13 +249,7 @@ void Fl_Table::col_width(int col, int width) // Add column widths, even if none yet int now_size = col_size(); if ( col >= now_size ) { -#if (FLTK_USE_STD) _colwidths->resize(col+1, width); -#else - _colwidths->size(col+1); - while (now_size < col) - (*_colwidths)[now_size++] = width; -#endif } (*_colwidths)[col] = width; table_resized(); @@ -690,14 +663,8 @@ void Fl_Table::rows(int val) { int default_h = row_size() > 0 ? _rowheights->back() : 25; int now_size = row_size(); -#if (FLTK_USE_STD) if (now_size != val) _rowheights->resize(val, default_h); // enlarge or shrink as needed -#else - _rowheights->size(val); // enlarge or shrink as needed - while (now_size < val) - (*_rowheights)[now_size++] = default_h; // fill new -#endif table_resized(); @@ -718,14 +685,8 @@ void Fl_Table::cols(int val) { int default_w = col_size() > 0 ? (*_colwidths)[col_size()-1] : 80; int now_size = col_size(); -#if (FLTK_USE_STD) if (now_size != val) _colwidths->resize(val, default_w); // enlarge or shrink as needed -#else - _colwidths->size(val); // enlarge or shrink as needed - while (now_size < val) - (*_colwidths)[now_size++] = default_w; // fill new -#endif table_resized(); redraw(); diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index cdeeab9ac..8cb90d995 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -26,12 +26,7 @@ #include #include #include -#if FLTK_USE_STD -# include - typedef std::vector Fl_Int_Vector; -#else -# include "../../Fl_Int_Vector.H" -#endif +#include #include "../../print_button.h" #include #include @@ -90,7 +85,7 @@ struct pointer_output { */ -static Fl_Int_Vector key_vector; // used by Fl_Wayland_Screen_Driver::event_key() +static std::vector key_vector; // used by Fl_Wayland_Screen_Driver::event_key() static struct wl_surface *gtk_shell_surface = NULL; Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor = @@ -520,7 +515,7 @@ static void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, } -static int search_int_vector(Fl_Int_Vector& v, int val) { +static int search_int_vector(std::vector& v, int val) { for (unsigned pos = 0; pos < v.size(); pos++) { if (v[pos] == val) return pos; } @@ -528,15 +523,10 @@ static int search_int_vector(Fl_Int_Vector& v, int val) { } -static void remove_int_vector(Fl_Int_Vector& v, int val) { +static void remove_int_vector(std::vector& v, int val) { int pos = search_int_vector(v, val); if (pos < 0) return; -#if FLTK_USE_STD v.erase(v.begin()+pos); -#else - int last = v.pop_back(); - if (last != val) v[pos] = last; -#endif } @@ -567,11 +557,7 @@ static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; //fprintf(stderr, "keyboard enter fl_win=%p; keys pressed are: ", Fl_Wayland_Window_Driver::surface_to_window(surface)); -#if FLTK_USE_STD key_vector.clear(); -#else - key_vector.size(0); -#endif // Replace wl_array_for_each(p, keys) rejected by C++ for (uint32_t *p = (uint32_t *)(keys)->data; (const char *) p < ((const char *) (keys)->data + (keys)->size); @@ -864,11 +850,7 @@ static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, Fl_Window *win = Fl_Wayland_Window_Driver::surface_to_window(surface); if (!win && Fl::focus()) win = Fl::focus()->top_window(); if (win) Fl::handle(FL_UNFOCUS, win); -#if FLTK_USE_STD key_vector.clear(); -#else - key_vector.size(0); -#endif } diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 14913e269..49486716a 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -346,9 +346,6 @@ const char *fl_input(int maxchar, const char *fmt, const char *defstr, ...) { } - -#if (FLTK_USE_STD) - /** Shows an input dialog displaying the \p fmt message with variable arguments. Like fl_input(), but this method has the additional argument \p maxchar @@ -412,7 +409,6 @@ std::string fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) return (r == NULL) ? std::string("") : std::string(r); } -#endif // FLTK_USE_STD /** Shows an input dialog displaying the \p fmt message with variable arguments. @@ -460,7 +456,6 @@ const char *fl_password(int maxchar, const char *fmt, const char *defstr, ...) { return r; } -#if (FLTK_USE_STD) /** Shows an input dialog displaying the \p fmt message with variable arguments. @@ -510,8 +505,6 @@ std::string fl_password_str(int maxchar, const char *fmt, const char *defstr, .. return (r == NULL) ? std::string("") : std::string(r); } -#endif // FLTK_USE_STD - /** Sets the preferred position for the message box used in many common dialogs like fl_message(), fl_alert(), -- cgit v1.2.3