From 29a9e89b39c2fdc1f9498717f5ae53798528ffb1 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 26 Mar 2016 02:55:14 +0000 Subject: [PATCH] Remove FLTK_ABI_VERSION from all but *tree*.* and documentation. Everything related to Fl_Tree and its test and demo programs has been cleaned. Documentation needs updates. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11428 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Spinner.H | 5 +-- FL/Fl_Table.H | 13 ++---- FL/Fl_Tabs.H | 6 --- FL/Fl_Text_Display.H | 8 +--- FL/porting.H | 12 ------ examples/fltk-versions.cxx | 6 --- examples/table-spreadsheet.cxx | 2 - src/Fl_Native_File_Chooser_WIN32.cxx | 9 ---- src/Fl_Table.cxx | 28 ------------ src/Fl_Tabs.cxx | 6 --- src/Fl_Text_Display.cxx | 64 +++------------------------- test/unittest_scrollbarsize.cxx | 7 --- 12 files changed, 11 insertions(+), 155 deletions(-) diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H index 22da7886f..10df08613 100644 --- a/FL/Fl_Spinner.H +++ b/FL/Fl_Spinner.H @@ -3,7 +3,7 @@ // // Spinner widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2016 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 @@ -50,10 +50,7 @@ class FL_EXPORT Fl_Spinner : public Fl_Group { double step_; // Amount to add/subtract for up/down const char *format_; // Format string -#if FLTK_ABI_VERSION >= 10301 -// NEW protected: -#endif Fl_Input input_; // Input field for the value Fl_Repeat_Button up_button_, // Up button diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 341f878b8..bce52bb3e 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -209,15 +209,11 @@ private: int _auto_drag; int _selecting; -#if FLTK_ABI_VERSION >= 10301 int _scrollbar_size; -#endif -#if FLTK_ABI_VERSION >= 10303 enum { TABCELLNAV = 1<<0, ///> tab cell navigation flag }; unsigned int flags_; -#endif // An STL-ish vector without templates class FL_EXPORT IntVector { @@ -1079,8 +1075,6 @@ public: void callback(Fl_Widget*, void*); #endif -#if FLTK_ABI_VERSION >= 10301 - // NEW /** Gets the current size of the scrollbars' troughs, in pixels. @@ -1093,6 +1087,7 @@ public: int scrollbar_size() const { return(_scrollbar_size); } + /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. @@ -1114,9 +1109,8 @@ public: void scrollbar_size(int newSize) { if ( newSize != _scrollbar_size ) redraw(); _scrollbar_size = newSize; - } -#endif -#if FLTK_ABI_VERSION >= 10303 + } + /** Flag to control if Tab navigates table cells or not. @@ -1145,7 +1139,6 @@ public: int tab_cell_nav() const { return(flags_ & TABCELLNAV ? 1 : 0); } -#endif }; #endif /*_FL_TABLE_H*/ diff --git a/FL/Fl_Tabs.H b/FL/Fl_Tabs.H index 756b550cf..3d75db81d 100644 --- a/FL/Fl_Tabs.H +++ b/FL/Fl_Tabs.H @@ -199,12 +199,6 @@ such as using the arrow keys while at the left or right end of the tabs. */ class FL_EXPORT Fl_Tabs : public Fl_Group { -#if FLTK_ABI_VERSION >= 10304 - // NEW (nothing) -#else - // OLD (maintained for ABI compat) - Fl_Widget *value_; // NOTE: this member no longer used -- STR #3169 -#endif Fl_Widget *push_; int *tab_pos; // array of x-offsets of tabs per child + 1 int *tab_width; // array of widths of tabs per child + 1 diff --git a/FL/Fl_Text_Display.H b/FL/Fl_Text_Display.H index 7237bc86f..1f0615d0e 100644 --- a/FL/Fl_Text_Display.H +++ b/FL/Fl_Text_Display.H @@ -73,11 +73,7 @@ Note that other features may be available via Fl_Text_Editor and Fl_Text_Buffer classes. - \note Line numbers were added in 1.3.3. To avoid breaking ABI, - many of its options are read only. To adjust these features - in 1.3.x, you must build FLTK with FLTK_ABI_VERSION set to 10303 - or higher. - + \note Line numbers were added in FLTK 1.3.3. */ class FL_EXPORT Fl_Text_Display: public Fl_Group { @@ -526,14 +522,12 @@ protected: int mLineNumLeft, mLineNumWidth; // Line number font/colors -#if FLTK_ABI_VERSION >= 10303 Fl_Font linenumber_font_; Fl_Fontsize linenumber_size_; Fl_Color linenumber_fgcolor_; Fl_Color linenumber_bgcolor_; Fl_Align linenumber_align_; const char* linenumber_format_; -#endif }; #endif diff --git a/FL/porting.H b/FL/porting.H index 744e34486..c9c68b2e7 100644 --- a/FL/porting.H +++ b/FL/porting.H @@ -67,14 +67,7 @@ public: Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) Fl_Window *w; // FLTK window for Fl_Region region; -//#if FLTK_ABI_VERSION < 10304 -// Fl_Region subRegion; // for ABI compatibility, recycled to replace subRect_ -//#endif Fl_X *next; // chain of mapped windows -//#if FLTK_ABI_VERSION < 10304 -// Fl_X *xidChildren; // useless with true subwindows, recycled to replace mapped_to_retina_ -// Fl_X *xidNext; // useless with true subwindows -//#endif int wait_for_expose; // NSCursor *cursor; static Fl_X* first; @@ -82,13 +75,8 @@ public: static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&); static Fl_X* make(Fl_Window*); void flush(); -//#if FLTK_ABI_VERSION >= 10304 // CGRect* subRect() { return subRect_; } // getter // void subRect(CGRect *r) { subRect_ = r; } // setter -//#else -// CGRect* subRect() { return (CGRect*)subRegion; } // getter -// void subRect(CGRect *r) { subRegion = (Fl_Region)r; } // setter -//#endif // bool mapped_to_retina(); // is window mapped to retina display? // void mapped_to_retina(bool); // sets whether window is mapped to retina display // bool changed_resolution(); // did window just moved to display with another resolution? diff --git a/examples/fltk-versions.cxx b/examples/fltk-versions.cxx index e1ab59075..bf27228f1 100644 --- a/examples/fltk-versions.cxx +++ b/examples/fltk-versions.cxx @@ -43,12 +43,6 @@ int main(int argc, char **argv) { (FL_ABI_VERSION == Fl::abi_version()) ? "" : "***"); #endif -#ifdef FLTK_ABI_VERSION - sprintf(version[versions++],"FLTK_ABI_VERSION = %6d",FLTK_ABI_VERSION); - sprintf(version[versions++],"NOTE: FLTK_ABI_VERSION is deprecated.\n" - "Please use FL_ABI_VERSION instead !"); -#endif - for (int i=0; iw()-20, win->h()-20); -#if FLTK_ABI_VERSION >= 10303 table->tab_cell_nav(1); // enable tab navigation of table cells (instead of fltk widgets) -#endif table->tooltip("Use keyboard to navigate cells:\n" "Arrow keys or Tab/Shift-Tab"); // Table rows diff --git a/src/Fl_Native_File_Chooser_WIN32.cxx b/src/Fl_Native_File_Chooser_WIN32.cxx index da425339a..7cd50e7dd 100644 --- a/src/Fl_Native_File_Chooser_WIN32.cxx +++ b/src/Fl_Native_File_Chooser_WIN32.cxx @@ -24,11 +24,6 @@ #ifndef FL_DOXYGEN // PREVENT DOXYGEN'S USE OF THIS FILE #include -#if FLTK_ABI_VERSION < 10304 -#define _ofn_ptr (&_ofn) -#define _binf_ptr (&_binf) -#endif - #include // malloc #include // sprintf #include @@ -133,10 +128,8 @@ static void dnullcat(char*&wp, const char *string, int n = -1 ) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { _btype = val; _options = NO_OPTIONS; -#if FLTK_ABI_VERSION >= 10304 _ofn_ptr = new OPENFILENAMEW; _binf_ptr = new BROWSEINFOW; -#endif memset((void*)_ofn_ptr, 0, sizeof(OPENFILENAMEW)); _ofn_ptr->lStructSize = sizeof(OPENFILENAMEW); _ofn_ptr->hwndOwner = 0L; @@ -167,10 +160,8 @@ Fl_Native_File_Chooser::~Fl_Native_File_Chooser() { clear_pathnames(); ClearOFN(); ClearBINF(); -#if FLTK_ABI_VERSION >= 10304 delete _binf_ptr; delete _ofn_ptr; -#endif } // SET TYPE OF BROWSER diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx index b5fecc0d1..48541fada 100644 --- a/src/Fl_Table.cxx +++ b/src/Fl_Table.cxx @@ -128,12 +128,8 @@ Fl_Table::Fl_Table(int X, int Y, int W, int H, const char *l) : Fl_Group(X,Y,W,H current_row = -1; select_row = -1; select_col = -1; -#if FLTK_ABI_VERSION >= 10301 _scrollbar_size = 0; -#endif -#if FLTK_ABI_VERSION >= 10303 flags_ = 0; // TABCELLNAV off -#endif box(FL_THIN_DOWN_FRAME); vscrollbar = new Fl_Scrollbar(x()+w()-Fl::scrollbar_size(), y(), @@ -483,13 +479,7 @@ void Fl_Table::recalc_dimensions() { // First pass: can hide via window size? int hidev = (table_h <= tih); int hideh = (table_w <= tiw); -#if FLTK_ABI_VERSION >= 10301 - // NEW int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size(); -#else - // OLD - int scrollsize = Fl::scrollbar_size(); -#endif // Second pass: Check for interference if ( !hideh & hidev ) { hidev = (( table_h - tih + scrollsize ) <= 0 ); } if ( !hidev & hideh ) { hideh = (( table_w - tiw + scrollsize ) <= 0 ); } @@ -564,13 +554,7 @@ void Fl_Table::table_resized() { // Vertical scrollbar float vscrolltab = ( table_h == 0 || tih > table_h ) ? 1 : (float)tih / table_h; float hscrolltab = ( table_w == 0 || tiw > table_w ) ? 1 : (float)tiw / table_w; -#if FLTK_ABI_VERSION >= 10301 - // NEW int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size(); -#else - // OLD - int scrollsize = Fl::scrollbar_size(); -#endif vscrollbar->bounds(0, table_h-tih); vscrollbar->precision(10); vscrollbar->slider_size(vscrolltab); @@ -736,9 +720,7 @@ int Fl_Table::handle(int event) { int _event_x = Fl::event_x(); int _event_y = Fl::event_y(); int _event_key = Fl::event_key(); -#if FLTK_ABI_VERSION >= 10303 int _event_state = Fl::event_state(); -#endif Fl_Widget *_focus = Fl::focus(); switch ( event ) { case FL_PUSH: @@ -1036,7 +1018,6 @@ int Fl_Table::handle(int event) { ret = move_cursor(1, 0); break; case FL_Tab: -#if FLTK_ABI_VERSION >= 10303 if ( !tab_cell_nav() ) break; // not navigating cells? let fltk handle it (STR#2862) if ( _event_state & FL_SHIFT ) { ret = move_cursor(0, -1, 0); // shift-tab -> left @@ -1044,9 +1025,6 @@ int Fl_Table::handle(int event) { ret = move_cursor(0, 1, 0); // tab -> right } break; -#else - break; // without tab_cell_nav(), Fl_Table should default to navigating widgets, not cells -#endif } if (ret && Fl::focus() != this) { do_callback(CONTEXT_TABLE, -1, -1); @@ -1168,13 +1146,7 @@ void Fl_Table::set_selection(int row_top, int col_left, int row_bot, int col_rig // Then tell the group to draw over us. // void Fl_Table::draw() { -#if FLTK_ABI_VERSION >= 10301 - // NEW int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size(); -#else - // OLD - int scrollsize = Fl::scrollbar_size(); -#endif // Check if scrollbar size changed if ( ( vscrollbar && (scrollsize != vscrollbar->w()) ) || ( hscrollbar && (scrollsize != hscrollbar->h()) ) ) { diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx index 16b6426f5..f0117b431 100644 --- a/src/Fl_Tabs.cxx +++ b/src/Fl_Tabs.cxx @@ -461,12 +461,6 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) : Fl_Group(X,Y,W,H,l) { box(FL_THIN_UP_BOX); -#if FLTK_ABI_VERSION >= 10304 - // NEW (nothing) -#else - // OLD (init to prevent 'unused' warnings) -- STR #3169 - value_ = 0; // NOTE: this member unused -- STR #3169 -#endif push_ = 0; tab_pos = 0; tab_width = 0; diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index cfeb9d970..b696b0d3d 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -171,14 +171,12 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l) mContinuousWrap = 0; mWrapMarginPix = 0; mSuppressResync = mNLinesDeleted = mModifyingTabDistance = 0; -#if FLTK_ABI_VERSION >= 10303 linenumber_font_ = FL_HELVETICA; linenumber_size_ = FL_NORMAL_SIZE; linenumber_fgcolor_ = FL_INACTIVE_COLOR; linenumber_bgcolor_ = 53; // ~90% gray linenumber_align_ = FL_ALIGN_RIGHT; linenumber_format_ = strdup("%d"); -#endif } @@ -199,12 +197,10 @@ Fl_Text_Display::~Fl_Text_Display() { mBuffer->remove_predelete_callback(buffer_predelete_cb, this); } if (mLineStarts) delete[] mLineStarts; -#if FLTK_ABI_VERSION >= 10303 if (linenumber_format_) { free((void*)linenumber_format_); linenumber_format_ = 0; } -#endif } @@ -230,118 +226,78 @@ int Fl_Text_Display::linenumber_width() const { /** Set the font used for line numbers (if enabled). - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_font(Fl_Font val) { -#if FLTK_ABI_VERSION >= 10303 linenumber_font_ = val; -#else - // do nothing -#endif } /** Return the font used for line numbers (if enabled). */ Fl_Font Fl_Text_Display::linenumber_font() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_font_; -#else - return FL_HELVETICA; -#endif } /** Set the font size used for line numbers (if enabled). - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_size(Fl_Fontsize val) { -#if FLTK_ABI_VERSION >= 10303 linenumber_size_ = val; -#else - // do nothing -#endif } /** Return the font size used for line numbers (if enabled). */ Fl_Fontsize Fl_Text_Display::linenumber_size() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_size_; -#else - return FL_NORMAL_SIZE; -#endif } /** Set the foreground color used for line numbers (if enabled). - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_fgcolor(Fl_Color val) { -#if FLTK_ABI_VERSION >= 10303 linenumber_fgcolor_ = val; -#else - // do nothing -#endif } /** Return the foreground color used for line numbers (if enabled). */ Fl_Color Fl_Text_Display::linenumber_fgcolor() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_fgcolor_; -#else - return FL_INACTIVE_COLOR; -#endif } /** Set the background color used for line numbers (if enabled). - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_bgcolor(Fl_Color val) { -#if FLTK_ABI_VERSION >= 10303 linenumber_bgcolor_ = val; -#else - // do nothing -#endif } /** Returns the background color used for line numbers (if enabled). */ Fl_Color Fl_Text_Display::linenumber_bgcolor() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_bgcolor_; -#else - return 53; // hard coded ~90% gray -#endif } /** Set alignment for line numbers (if enabled). Valid values are FL_ALIGN_LEFT, FL_ALIGN_CENTER or FL_ALIGN_RIGHT. - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_align(Fl_Align val) { -#if FLTK_ABI_VERSION >= 10303 linenumber_align_ = val; -#else - // do nothing -#endif } /** Returns the alignment used for line numbers (if enabled). */ Fl_Align Fl_Text_Display::linenumber_align() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_align_; -#else - return FL_ALIGN_RIGHT; -#endif } /** @@ -361,26 +317,18 @@ Fl_Align Fl_Text_Display::linenumber_align() const { - "%x" -- For hexadecimal line numbers - "%o" -- For octal line numbers - \version 1.3.3 ABI feature (ignored in 1.3.x unless FLTK_ABI_VERSION is 10303 or higher) + \version 1.3.3 ABI feature (ignored in 1.3.x unless FL_ABI_VERSION is 10303 or higher) */ void Fl_Text_Display::linenumber_format(const char* val) { -#if FLTK_ABI_VERSION >= 10303 if ( linenumber_format_ ) free((void*)linenumber_format_); linenumber_format_ = val ? strdup(val) : 0; -#else - // do nothing -#endif } /** Returns the line number printf() format string. */ const char* Fl_Text_Display::linenumber_format() const { -#if FLTK_ABI_VERSION >= 10303 return linenumber_format_; -#else - return "%d"; -#endif } /** diff --git a/test/unittest_scrollbarsize.cxx b/test/unittest_scrollbarsize.cxx index d150c963b..f8e97d6c6 100644 --- a/test/unittest_scrollbarsize.cxx +++ b/test/unittest_scrollbarsize.cxx @@ -126,10 +126,7 @@ class ScrollBarSizeTest : public Fl_Group { if ( strcmp(label,"A: Scroll Size") == 0 ) { brow_a->scrollbar_size(val); tree_a->scrollbar_size(val); -#if FLTK_ABI_VERSION >= 10301 - // NEW table_a->scrollbar_size(val); -#endif } else { Fl::scrollbar_size(val); } @@ -206,11 +203,7 @@ public: "Scrollbar's size should change interactively as size sliders are changed.\n" "Changing 'Global Scroll Size' should affect all three browser's scrollbars UNLESS\n" "the 'A: Scroll Size' slider is changed, in which case its value will take precedence\n" -#if FLTK_ABI_VERSION >= 10301 "for the 'A' group of widgets."); -#else - "for the 'A' group of widgets. (NOTE: 'table_a' does not currently support this)"); -#endif labelsize(10); align(FL_ALIGN_INSIDE|FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_WRAP); }