Finally remove FLTK_ABI_VERSION preprocessor macro from code.

FLTK_ABI_VERSION has been renamed to FL_ABI_VERSION in FLTK 1.4.0.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12121 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2016-11-19 01:20:53 +00:00
parent 18d478055e
commit 6d4b93e9c7
7 changed files with 75 additions and 166 deletions

View File

@ -25,15 +25,8 @@
/*
******************************************************************************
* Notes on FL_ABI_VERSION and deprecated (obsolete) FLTK_ABI_VERSION:
*
* (1) FLTK_ABI_VERSION is deprecated, but still defined below.
* Do NOT define FLTK_ABI_VERSION here - it would be overwritten later.
*
* (2) FL_ABI_VERSION is now (as of FLTK 1.3.4) defined by configure
* or CMake. Do NOT define it here. Its definition will be included
* below by "#include <FL/abi-version.h>".
*
* FL_ABI_VERSION is defined by configure or CMake since FLTK 1.3.4.
* It is written to FL/abi-version.h and #included here.
******************************************************************************
* For more informations on FL_ABI_VERSION see README.abi-version.txt.
******************************************************************************
@ -181,19 +174,6 @@
#endif
/*
FLTK_ABI_VERSION is deprecated (replaced by FL_ABI_VERSION).
This deprecated constant will be removed in FLTK 1.4.0 and later.
Please use FL_ABI_VERSION when FLTK 1.4.0 has been released.
*/
#ifdef FLTK_ABI_VERSION
#undef FLTK_ABI_VERSION
#endif
#define FLTK_ABI_VERSION FL_ABI_VERSION
/*@}*/ // group: Version Numbers
/**
@ -214,7 +194,7 @@
\sa Fl::event_text(), Fl::event_key(), class Fl::
*/
// DEV NOTE: Keep this list in sync with FL/names.H
// DEV NOTE: Keep this list in sync with FL/names.h
enum Fl_Event { // events
/** No event. */
FL_NO_EVENT = 0,
@ -424,6 +404,8 @@ enum Fl_Event { // events
Fl::event_x() and Fl::event_y() are set as well.
*/
FL_ZOOM_GESTURE = 26
// DEV NOTE: Keep this list in sync with FL/names.h
};
/** \name When Conditions */

View File

@ -3,7 +3,7 @@
//
// Event names header file 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
@ -69,10 +69,10 @@ const char * const fl_eventnames[] =
"FL_SCREEN_CONFIGURATION_CHANGED",
"FL_FULLSCREEN",
"FL_ZOOM_GESTURE",
"FL_EVENT_27", // not yet defined, just in case they /will/ be defined ...
"FL_EVENT_28",
"FL_EVENT_29",
"FL_EVENT_30"
"FL_EVENT_27", // not yet defined, just in case it /will/ be defined ...
"FL_EVENT_28", // not yet defined, just in case it /will/ be defined ...
"FL_EVENT_29", // not yet defined, just in case it /will/ be defined ...
"FL_EVENT_30" // not yet defined, just in case it /will/ be defined ...
};
/**

View File

@ -6,21 +6,24 @@ patch versions, for instance all 1.3.x versions (x = patch version).
This basically means that a program compiled and linked with FLTK 1.3.0
can run with a FLTK shared library (fltk.dll, fltk.so.1.3.x) of a later
FLTK version.
FLTK version 1.3.x, but not with a shared library of FLTK 1.4.0 or later.
Since FLTK 1.3.1 the FLTK team began to introduce ABI-breaking features
wrapped in so-called ABI guards in the library code, e.g.
#if FLTK_ABI_VERSION >= 10304
... new, ABI breaking code ...
#else
... old, ABI preserving code ...
#endif
#if FL_ABI_VERSION >= 10401
... new, ABI breaking code ...
#else
... old, ABI preserving code ...
#endif
Note: This documentation is written for FLTK 1.4.x, but it applies to all
later versions as well. Replace the version numbers given here by the
version numbers of the version you are using. FLTK version 1.4.4 is
chosen as an example only. As of this writing, FLTK 1.4.4 does not exist yet.
Note: In FLTK 1.3.x this preprocessor macro was named FLTK_ABI_VERSION.
In FLTK 1.4.0 FLTK_ABI_VERSION was renamed to FL_ABI_VERSION.
This documentation is written for FLTK 1.4.x, but it applies to all later
versions as well. Replace the version numbers given here with the version
numbers of the version you are using. FLTK version 1.4.1 was chosen as an
example only. As of this writing, FLTK 1.4.1 does not yet exist.
How to define the FLTK ABI version
@ -29,83 +32,85 @@ How to define the FLTK ABI version
To define the ABI version the preprocessor macro FL_ABI_VERSION must be
defined as a number representing the ABI version in the form
#define FL_ABI_VERSION 1xxyy
#define FL_ABI_VERSION 1xxyy
where xx and yy are the minor and patch versions, resp. with leading zeroes,
and '1' is the major version number.
The default ABI version for all FLTK 1.4.x versions is 10400 (the binary
version of FLTK 1.4.0), but you can configure another version, e.g.
10404 for FLTK 1.4.4 to enable the ABI features of FLTK 1.4.4 and all
10401 for FLTK 1.4.1 to enable the ABI features of FLTK 1.4.1 and all
previous versions. See CHANGES file.
Depending on how you build FLTK, there are two different ways to configure
the ABI version. The default is always the lowest version (e.g. 10400). All
following examples are written for FLTK 1.4.4, hence we use "10404" for
following examples are written for FLTK 1.4.1, hence we use "10401" for
the version number.
(1) Traditional configure + make (Unix, Linux, MinGW etc.)
----------------------------------------------------------
Run
Run
./configure --with-abiversion=10404
make
./configure --with-abiversion=10401
make
This will generate FL/abi-version.h and build FLTK as usual.
This will generate FL/abi-version.h and build FLTK as usual.
(2) CMake + make
----------------
FLTK 1.4.0 and later contains full CMake support.
FLTK versions 1.4.0 and later contain full CMake support.
Use CMake to build the Makefile's and run 'make'. To configure the
ABI version, use ccmake, cmake-gui, or run make with the following
command:
Use CMake to build the Makefile's and run 'make'. To configure the
ABI version, use ccmake, cmake-gui, or run make with the following
command:
cmake -D OPTION_ABI_VERSION:STRING=10404 /path/to/fltk
make
cmake -D OPTION_ABI_VERSION:STRING=10401 /path/to/fltk
make
You can define OPTION_ABI_VERSION to the required version number using
one of the graphical CMake tools.
You can define OPTION_ABI_VERSION to the required version number using
one of the graphical CMake tools.
For more information on how to use CMake with FLTK see README.CMake.txt.
For more information on how to use CMake with FLTK see README.CMake.txt.
(3) CMake + IDE Projects: Visual C++, Xcode, other IDE's
--------------------------------------------------------
FLTK 1.4.0 and later contains full CMake support.
FLTK versions 1.4.0 and later contain full CMake support.
IDE project files are no longer included in the FLTK source distribution.
You need to install CMake to generate the IDE files.
IDE project files are no longer included in the FLTK source distribution.
You need to install CMake to generate the IDE files.
Use CMake to generate the IDE project files of your choice. Currently
the FLTK team uses some Visual C++ (Visual Studio) versions and Xcode.
Other IDE's may work as well (not yet tested).
Use CMake to generate the IDE project files of your choice. Currently
the FLTK team uses some Visual C++ (Visual Studio) versions and Xcode.
Other IDE's may work as well (not yet tested).
For more informations on how to install and use CMake see ...
... *FIXME* [Add documentation how to use CMake with FLTK].
For more informations on how to install and use CMake see ...
... *FIXME* [Add documentation how to use CMake with FLTK].
Use CMake option OPTION_ABI_VERSION:STRING=10404 with the command line
or any of the CMake GUI programs.
Use CMake option OPTION_ABI_VERSION:STRING=10401 with the command line
or any of the CMake GUI programs.
Then start the build process in the IDE solution of your choice. This
will run the build with the defined ABI version.
Then start the build process in the IDE solution of your choice. This
will run the build with the defined ABI version.
General note on CMake:
----------------------
CMake generates FL/abi-version.h in the build tree. You may run
'make install' to install the FLTK library including all headers in
the chosen installation directory, although this is not necessary.
CMake generates FL/abi-version.h in the build tree. You may run
'make install' to install the FLTK library including all headers in
the chosen installation directory, although this is not necessary.
The FLTK team recommends to use the FLTK library directly from the
build folder. See README.CMake.txt for more information.
The FLTK team recommends to use the FLTK library directly from the
build folder. See README.CMake.txt for more information.
... to be continued ...
Possible exception: Visual Studio IDE builds (Windows).
... to be continued ...

View File

@ -4,7 +4,7 @@
// Demonstrate Fl_Tree custom item draw callback. - erco 11/09/2013
//
// Copyright 2013 Greg Ercolano.
// Copyright 1998-2013 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
@ -26,7 +26,6 @@
#define MAX(a,b) ((a)>(b))?(a):(b)
#endif
#if FLTK_ABI_VERSION >= 10303
// DERIVE CUSTOM CLASS FROM Fl_Tree_Item TO IMPLEMENT SHOWING THE TIME OF DAY
// This demonstrates that item content can be dynamic and highly customized.
//
@ -176,15 +175,6 @@ int main(int argc, char *argv[]) {
win->show(argc, argv);
return(Fl::run());
}
#else
#include <FL/Fl.H>
#include <FL/fl_message.H>
int main(int, char**) {
fl_alert("This demo is dependent on an ABI feature.\n"
"FLTK_ABI_VERSION must be set to 10303 (or higher) in Enumerations.H");
return 1;
}
#endif
//
// End of "$Id$".

View File

@ -7,7 +7,7 @@
// contains a complex widget.
//
// Copyright 2010,2012 Greg Ercolano.
// 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
@ -29,7 +29,6 @@
#define PI 3.14159
#endif
#if FLTK_ABI_VERSION >= 10301
class MyTable : public Fl_Table {
const char *mode;
public:
@ -142,13 +141,6 @@ int main(int argc, char *argv[]) {
win->show(argc, argv);
return(Fl::run());
}
#else /*FLTK_ABI_VERSION*/
#include <FL/fl_ask.H>
int main(int argc, char *argv[]) {
fl_alert("This example must have FLTK_ABI_VERSION enabled to work properly.");
return 1;
}
#endif
//
// End of "$Id$".

View File

@ -4,7 +4,7 @@
// Simple Fl_Tree widget example. - erco 06/05/2010
//
// Copyright 2010 Greg Ercolano.
// 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
@ -44,12 +44,10 @@ void TreeCallback(Fl_Widget *w, void *data) {
case FL_TREE_REASON_CLOSED:
// fprintf(stderr, "TreeCallback: Item '%s' closed\n", item->label());
break;
#if FLTK_ABI_VERSION >= 10301
// To enable this callback, use tree->item_reselect_mode(FL_TREE_SELECTABLE_ALWAYS);
case FL_TREE_REASON_RESELECTED:
// fprintf(stderr, "TreeCallback: Item '%s' reselected\n", item->label());
break;
#endif
default:
break;
}

View File

@ -52,9 +52,7 @@ Function {reason_as_name(Fl_Tree_Reason reason)} {
case FL_TREE_REASON_OPENED: return("opened");
case FL_TREE_REASON_CLOSED: return("closed");
case FL_TREE_REASON_DRAGGED: return("dragged");
\#if FLTK_ABI_VERSION >= 10301
case FL_TREE_REASON_RESELECTED: return("reselected");
\#endif
case FL_TREE_REASON_RESELECTED: return("reselected");
default: return("???");
}} {}
}
@ -322,22 +320,14 @@ Function {GetTreeMarginBottom()} {
comment {Get the current 'margin bottom' size
Handles this as an ABI feature..} open return_type int
} {
code {\#if FLTK_ABI_VERSION >= 10301
return tree->marginbottom();
\#else
return 0;
\#endif} {}
code {return tree->marginbottom();} {}
}
Function {GetTreeWidgetMarginLeft()} {
comment {Get the current 'margin bottom' size
Handles this as an ABI feature..} open return_type int
} {
code {\#if FLTK_ABI_VERSION >= 10301
return tree->widgetmarginleft();
\#else
return 0;
\#endif} {}
code {return tree->widgetmarginleft();} {}
}
Function {GetSelectedItemFGColor()} {
@ -433,18 +423,9 @@ tree->redraw();}
Fl_Value_Slider marginbottom_slider {
label {marginbottom()}
user_data tree
callback {\#if FLTK_ABI_VERSION >= 10301
// NEW
int val = (int)marginbottom_slider->value();
callback {int val = (int)marginbottom_slider->value();
tree->marginbottom(val);
tree->redraw();
\#else
// OLD
marginbottom_slider->deactivate(); // deactivate if this ABI feature is disabled
marginbottom_slider->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10301 (or higher)\\n"
"to enable this feature");
\#endif}
tree->redraw();}
tooltip {Changes the bottom margin for the tree
Sets how far beyond bottom of tree you can scroll} xywh {505 80 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
code0 {o->value(GetTreeMarginBottom()); // handle ABI feature}
@ -488,16 +469,9 @@ tree->redraw();}
Fl_Value_Slider widgetmarginleft_slider {
label {widgetmarginleft()}
user_data tree
callback {\#if FLTK_ABI_VERSION >= 10301
int val = (int)widgetmarginleft_slider->value();
callback {int val = (int)widgetmarginleft_slider->value();
tree->widgetmarginleft(val);
tree->redraw();
\#else
widgetmarginleft_slider->deactivate();
widgetmarginleft_slider->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10301 (or higher)\\n"
"to enable this feature");
\#endif}
tree->redraw();}
tooltip {Changes the margin to the left of child FLTK widget()
"Show label + widget" must be 'on' for this to take effect, i.e.
item_draw_mode(FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET)} xywh {505 160 155 16} type Horizontal color 46 selection_color 1 labelsize 10 align 4 textsize 9
@ -692,21 +666,11 @@ Sets how Fl_Tree handles mouse selection of tree items.
}
Fl_Choice reselectmode_chooser {
label {Item Reselect Mode}
callback {\#if FLTK_ABI_VERSION >= 10301
// NEW
// Set reselection mode
callback {// Set reselection mode
switch ( reselectmode_chooser->value() ) {
case 0: tree->item_reselect_mode(FL_TREE_SELECTABLE_ONCE); break;
case 1: tree->item_reselect_mode(FL_TREE_SELECTABLE_ALWAYS); break;
}
\#else
// OLD
reselectmode_chooser->deactivate(); // deactivate if this ABI feature is disabled
reselectmode_chooser->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10301 (or higher)\\n"
"to enable this feature");
window->redraw(); // deactivated
\#endif}
}}
tooltip {Tests Fl_Tree::item_reselect_mode().
Enables 'reselect' events.
These happen when someone selects an item already selected
@ -774,23 +738,13 @@ tree->visible_focus(onoff);}
}
Fl_Check_Button labelandwidget_radio {
label {Show label + widget}
callback {\#if FLTK_ABI_VERSION >= 10303
// NEW
int flags = tree->item_draw_mode();
callback {int flags = tree->item_draw_mode();
if ( labelandwidget_radio->value() )
{ flags |= FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET; }
else
{ flags &= ~FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET; }
tree->item_draw_mode(flags);
tree->redraw();
\#else
// OLD
labelandwidget_radio->deactivate(); // deactivate if this ABI feature is disabled
labelandwidget_radio->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10303 (or higher)\\n"
"to enable this feature");
window->redraw(); // deactivated
\#endif}
tree->redraw();}
tooltip {Tests Fl_Tree::item_draw_mode(FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET)
Enables both label and widget() for display.
When enabled, widget should appear to the right of the item's label.
@ -800,23 +754,13 @@ By default, the widget() is shown in place of the item's label.} xywh {645 356 2
}
Fl_Check_Button itemheightfromwidget_radio {
label {Item h() from widget}
callback {\#if FLTK_ABI_VERSION >= 10303
// NEW
int flags = tree->item_draw_mode();
callback {int flags = tree->item_draw_mode();
if ( itemheightfromwidget_radio->value() )
{ flags |= FL_TREE_ITEM_HEIGHT_FROM_WIDGET; }
else
{ flags &= ~FL_TREE_ITEM_HEIGHT_FROM_WIDGET; }
tree->item_draw_mode(flags);
tree->redraw();
\#else
// OLD
itemheightfromwidget_radio->deactivate(); // deactivate if this ABI feature is disabled
itemheightfromwidget_radio->tooltip("DISABLED.\\n"
"Set FLTK_ABI_VERSION to 10303 (or higher)\\n"
"to enable this feature");
window->redraw(); // deactivated
\#endif}
tree->redraw();}
tooltip {Tests Fl_Tree::item_draw_mode(FL_TREE_ITEM_HEIGHT_FROM_WIDGET)
If enabled, item's height will track the widget()'s height.
When enabled, click 'ccc' or 'D1/D2' buttons to test.} xywh {645 371 20 16} down_box DOWN_BOX labelsize 11 align 7
@ -1789,9 +1733,7 @@ tree->redraw();}
}
code {// Initialize Tree
tree->root_label("ROOT");
\#if FLTK_ABI_VERSION >= 10301
tree->item_reselect_mode(FL_TREE_SELECTABLE_ALWAYS);
\#endif
RebuildTree();
/*tree->show_self();*/} {}
code {// FLTK stuff