Author: matt
Date: 2011-05-20 15:23:28 -0700 (Fri, 20 May 2011)
New Revision: 8702
Log:
123: starting OpenGL support.
Modified:
branches/branch-3.0/fltk3/GlWindow.h
branches/branch-3.0/fltk3/Printer.h
branches/branch-3.0/fltk3/RadioLightButton.h
branches/branch-3.0/fltk3/ToggleLightButton.h
branches/branch-3.0/fltk3/Widget.h
branches/branch-3.0/fltk3/Window.h
branches/branch-3.0/fltk3/enumerations.h
branches/branch-3.0/fltk3/glut.h
branches/branch-3.0/fltk3/run.h
branches/branch-3.0/fluid/fluid.cxx
branches/branch-3.0/src/Fl_Gl_Choice.H
branches/branch-3.0/src/Fl_Gl_Device_Plugin.cxx
branches/branch-3.0/src/Fl_Gl_Overlay.cxx
branches/branch-3.0/src/Fl_Gl_Window.cxx
branches/branch-3.0/src/gl_draw.cxx
branches/branch-3.0/src/glut_compatability.cxx
branches/branch-3.0/test/CubeView.cxx
branches/branch-3.0/test/CubeView.h
branches/branch-3.0/test/cube.cxx
branches/branch-3.0/test/fullscreen.cxx
branches/branch-3.0/test/gl_overlay.cxx
branches/branch-3.0/test/shape.cxx
Modified: branches/branch-3.0/fltk3/GlWindow.h
===================================================================
--- branches/branch-3.0/fltk3/GlWindow.h 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/fltk3/GlWindow.h 2011-05-20 22:23:28 UTC (rev
8702)
@@ -26,7 +26,7 @@
//
/* \file
- Fl_Gl_Window widget . */
+ fltk3::GlWindow widget . */
#ifndef Fltk3_Gl_Window_H
#define Fltk3_Gl_Window_H
@@ -35,204 +35,208 @@
#ifndef GLContext
/**
- Opaque pointer type to hide system specific implementation.
-*/
+ Opaque pointer type to hide system specific implementation.
+ */
typedef void* GLContext; // actually a GLXContext or HGLDC
#endif
class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
-/**
- The Fl_Gl_Window widget sets things up so OpenGL works.
+namespace fltk3 {
- It also keeps an OpenGL "context" for that window, so that changes to the
- lighting and projection may be reused between redraws. Fl_Gl_Window
- also flushes the OpenGL streams and swaps buffers after draw() returns.
-
- OpenGL hardware typically provides some overlay bit planes, which
- are very useful for drawing UI controls atop your 3D graphics. If the
- overlay hardware is not provided, FLTK tries to simulate the overlay.
- This works pretty well if your graphics are double buffered, but not
- very well for single-buffered.
-
- Please note that the FLTK drawing and clipping functions
- will not work inside an Fl_Gl_Window. All drawing
- should be done using OpenGL calls exclusively.
- Even though Fl_Gl_Window is derived from fltk3::Group,
- it is not useful to add other FLTK Widgets as children,
- unless those widgets are modified to draw using OpenGL calls.
-*/
-class FLTK3_EXPORT Fl_Gl_Window : public fltk3::Window {
-
- int mode_;
- const int *alist;
- Fl_Gl_Choice *g;
- GLContext context_;
- char valid_f_;
- char damage1_; // damage() of back buffer
- virtual void draw_overlay();
- void init();
-
- void *overlay;
- void make_overlay();
- friend class _Fl_Gl_Overlay;
-
- static int can_do(int, const int *);
- int mode(int, const int *);
-
-public:
-
- void show();
- void show(int a, char **b) {fltk3::Window::show(a,b);}
- void flush();
- void hide();
- void resize(int,int,int,int);
- int handle(int);
-
/**
- Is turned off when FLTK creates a new context for this window or
- when the window resizes, and is turned on \e after draw() is called.
- You can use this inside your draw() method to avoid unnecessarily
- initializing the OpenGL context. Just do this:
- \code
- void mywindow::draw() {
+ The fltk3::GlWindow widget sets things up so OpenGL works.
+
+ It also keeps an OpenGL "context" for that window, so that changes to the
+ lighting and projection may be reused between redraws. fltk3::GlWindow
+ also flushes the OpenGL streams and swaps buffers after draw() returns.
+
+ OpenGL hardware typically provides some overlay bit planes, which
+ are very useful for drawing UI controls atop your 3D graphics. If the
+ overlay hardware is not provided, FLTK tries to simulate the overlay.
+ This works pretty well if your graphics are double buffered, but not
+ very well for single-buffered.
+
+ Please note that the FLTK drawing and clipping functions
+ will not work inside an fltk3::GlWindow. All drawing
+ should be done using OpenGL calls exclusively.
+ Even though fltk3::GlWindow is derived from fltk3::Group,
+ it is not useful to add other FLTK Widgets as children,
+ unless those widgets are modified to draw using OpenGL calls.
+ */
+ class FLTK3_EXPORT GlWindow : public fltk3::Window {
+
+ int mode_;
+ const int *alist;
+ Fl_Gl_Choice *g;
+ GLContext context_;
+ char valid_f_;
+ char damage1_; // damage() of back buffer
+ virtual void draw_overlay();
+ void init();
+
+ void *overlay;
+ void make_overlay();
+ friend class _Fl_Gl_Overlay;
+
+ static int can_do(int, const int *);
+ int mode(int, const int *);
+
+ public:
+
+ void show();
+ void show(int a, char **b) {fltk3::Window::show(a,b);}
+ void flush();
+ void hide();
+ void resize(int,int,int,int);
+ int handle(int);
+
+ /**
+ Is turned off when FLTK creates a new context for this window or
+ when the window resizes, and is turned on \e after draw() is called.
+ You can use this inside your draw() method to avoid unnecessarily
+ initializing the OpenGL context. Just do this:
+ \code
+ void mywindow::draw() {
if (!valid()) {
- glViewport(0,0,w(),h());
- glFrustum(...);
- ...other initialization...
+ glViewport(0,0,w(),h());
+ glFrustum(...);
+ ...other initialization...
}
if (!context_valid()) {
- ...load textures, etc. ...
+ ...load textures, etc. ...
}
... draw your geometry here ...
- }
- \endcode
+ }
+ \endcode
+
+ You can turn valid() on by calling valid(1). You
+ should only do this after fixing the transformation inside a draw()
+ or after make_current(). This is done automatically after
+ draw() returns.
+ */
+ char valid() const {return valid_f_ & 1;}
+ /**
+ See char fltk3::GlWindow::valid() const
+ */
+ void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
+ void invalidate();
- You can turn valid() on by calling valid(1). You
- should only do this after fixing the transformation inside a draw()
- or after make_current(). This is done automatically after
- draw() returns.
- */
- char valid() const {return valid_f_ & 1;}
- /**
- See char Fl_Gl_Window::valid() const
- */
- void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;}
- void invalidate();
-
- /**
- Will only be set if the
- OpenGL context is created or recreated. It differs from
- Fl_Gl_Window::valid() which is also set whenever the context
- changes size.
- */
- char context_valid() const {return valid_f_ & 2;}
- /**
- See char Fl_Gl_Window::context_valid() const
- */
- void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
-
- /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
- static int can_do(int m) {return can_do(m,0);}
- /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
- static int can_do(const int *m) {return can_do(0, m);}
- /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
- int can_do() {return can_do(mode_,alist);}
- /**
- Set or change the OpenGL capabilites of the window. The value can be
- any of the following OR'd together:
-
- - \c fltk3::RGB - RGB color (not indexed)
- - \c fltk3::RGB8 - RGB color with at least 8 bits of each color
- - \c fltk3::INDEX - Indexed mode
- - \c fltk3::SINGLE - not double buffered
- - \c fltk3::DOUBLE - double buffered
- - \c fltk3::ACCUM - accumulation buffer
- - \c fltk3::ALPHA - alpha channel in color
- - \c fltk3::DEPTH - depth buffer
- - \c fltk3::STENCIL - stencil buffer
- - \c fltk3::MULTISAMPLE - multisample antialiasing
-
- fltk3::RGB and fltk3::SINGLE have a value of zero, so they
- are "on" unless you give fltk3::INDEX or fltk3::DOUBLE.
-
- If the desired combination cannot be done, FLTK will try turning off
- fltk3::MULTISAMPLE. If this also fails the show() will call
- fltk3::error() and not show the window.
-
- You can change the mode while the window is displayed. This is most
- useful for turning double-buffering on and off. Under X this will
- cause the old X window to be destroyed and a new one to be created. If
- this is a top-level window this will unfortunately also cause the
- window to blink, raise to the top, and be de-iconized, and the xid()
- will change, possibly breaking other code. It is best to make the GL
- window a child of another window if you wish to do this!
-
- mode() must not be called within draw() since it
- changes the current context.
- */
- Fl_Mode mode() const {return (Fl_Mode)mode_;}
- /** See Fl_Mode mode() const */
- int mode(int a) {return mode(a,0);}
- /** See Fl_Mode mode() const */
- int mode(const int *a) {return mode(0, a);}
- /** void See void context(void* v, int destroy_flag) */
- void* context() const {return context_;}
- void context(void*, int destroy_flag = 0);
- void make_current();
- void swap_buffers();
- void ortho();
-
- /**
- Returns true if the hardware overlay is possible. If this is false,
- FLTK will try to simulate the overlay, with significant loss of update
- speed. Calling this will cause FLTK to open the display.
- */
- int can_do_overlay();
- /**
- This method causes draw_overlay() to be called at a later time.
- Initially the overlay is clear. If you want the window to display
- something in the overlay when it first appears, you must call this
- immediately after you show() your window.
- */
- void redraw_overlay();
- void hide_overlay();
- /**
- The make_overlay_current() method selects the OpenGL context
- for the widget's overlay. It is called automatically prior to the
- draw_overlay() method being called and can also be used to
- implement feedback and/or selection within the handle()
- method.
- */
- void make_overlay_current();
-
- // Note: Doxygen docs in Widget.h to avoid redundancy.
- virtual Fl_Gl_Window* as_gl_window() {return this;}
+ /**
+ Will only be set if the
+ OpenGL context is created or recreated. It differs from
+ fltk3::GlWindow::valid() which is also set whenever the context
+ changes size.
+ */
+ char context_valid() const {return valid_f_ & 2;}
+ /**
+ See char fltk3::GlWindow::context_valid() const
+ */
+ void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
+
+ /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
+ static int can_do(int m) {return can_do(m,0);}
+ /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
+ static int can_do(const int *m) {return can_do(0, m);}
+ /** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
+ int can_do() {return can_do(mode_,alist);}
+ /**
+ Set or change the OpenGL capabilites of the window. The value can be
+ any of the following OR'd together:
+
+ - \c fltk3::RGB - RGB color (not indexed)
+ - \c fltk3::RGB8 - RGB color with at least 8 bits of each color
+ - \c fltk3::INDEX - Indexed mode
+ - \c fltk3::SINGLE - not double buffered
+ - \c fltk3::DOUBLE - double buffered
+ - \c fltk3::ACCUM - accumulation buffer
+ - \c fltk3::ALPHA - alpha channel in color
+ - \c fltk3::DEPTH - depth buffer
+ - \c fltk3::STENCIL - stencil buffer
+ - \c fltk3::MULTISAMPLE - multisample antialiasing
+
+ fltk3::RGB and fltk3::SINGLE have a value of zero, so they
+ are "on" unless you give fltk3::INDEX or fltk3::DOUBLE.
+
+ If the desired combination cannot be done, FLTK will try turning off
+ fltk3::MULTISAMPLE. If this also fails the show() will call
+ fltk3::error() and not show the window.
+
+ You can change the mode while the window is displayed. This is most
+ useful for turning double-buffering on and off. Under X this will
+ cause the old X window to be destroyed and a new one to be created. If
+ this is a top-level window this will unfortunately also cause the
+ window to blink, raise to the top, and be de-iconized, and the xid()
+ will change, possibly breaking other code. It is best to make the GL
+ window a child of another window if you wish to do this!
+
+ mode() must not be called within draw() since it
+ changes the current context.
+ */
+ fltk3::Mode mode() const {return (fltk3::Mode)mode_;}
+ /** See fltk3::Mode mode() const */
+ int mode(int a) {return mode(a,0);}
+ /** See fltk3::Mode mode() const */
+ int mode(const int *a) {return mode(0, a);}
+ /** void See void context(void* v, int destroy_flag) */
+ void* context() const {return context_;}
+ void context(void*, int destroy_flag = 0);
+ void make_current();
+ void swap_buffers();
+ void ortho();
+
+ /**
+ Returns true if the hardware overlay is possible. If this is false,
+ FLTK will try to simulate the overlay, with significant loss of update
+ speed. Calling this will cause FLTK to open the display.
+ */
+ int can_do_overlay();
+ /**
+ This method causes draw_overlay() to be called at a later time.
+ Initially the overlay is clear. If you want the window to display
+ something in the overlay when it first appears, you must call this
+ immediately after you show() your window.
+ */
+ void redraw_overlay();
+ void hide_overlay();
+ /**
+ The make_overlay_current() method selects the OpenGL context
+ for the widget's overlay. It is called automatically prior to the
+ draw_overlay() method being called and can also be used to
+ implement feedback and/or selection within the handle()
+ method.
+ */
+ void make_overlay_current();
+
+ // Note: Doxygen docs in Widget.h to avoid redundancy.
+ virtual fltk3::GlWindow* as_gl_window() {return this;}
+
+ ~GlWindow();
+ /**
+ Creates a new fltk3::GlWindow widget using the given size, and label
string.
+ The default boxtype is fltk3::NO_BOX. The default mode is
fltk3::RGB|fltk3::DOUBLE|fltk3::DEPTH.
+ */
+ GlWindow(int W, int H, const char *l=0) : fltk3::Window(W,H,l) {init();}
+ /**
+ Creates a new fltk3::GlWindow widget using the given position,
+ size, and label string. The default boxtype is fltk3::NO_BOX. The
+ default mode is fltk3::RGB|fltk3::DOUBLE|fltk3::DEPTH.
+ */
+
+ GlWindow(int X, int Y, int W, int H, const char *l=0)
+ : fltk3::Window(X,Y,W,H,l) {init();}
+
+ protected:
+ /**
+ Draws the fltk3::GlWindow.
+
+ You \e \b must override the draw() method.
+ */
+ virtual void draw();
+ };
- ~Fl_Gl_Window();
- /**
- Creates a new Fl_Gl_Window widget using the given size, and label string.
- The default boxtype is fltk3::NO_BOX. The default mode is
fltk3::RGB|fltk3::DOUBLE|fltk3::DEPTH.
- */
- Fl_Gl_Window(int W, int H, const char *l=0) : fltk3::Window(W,H,l) {init();}
- /**
- Creates a new Fl_Gl_Window widget using the given position,
- size, and label string. The default boxtype is fltk3::NO_BOX. The
- default mode is fltk3::RGB|fltk3::DOUBLE|fltk3::DEPTH.
- */
+}
- Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
- : fltk3::Window(X,Y,W,H,l) {init();}
-
-protected:
- /**
- Draws the Fl_Gl_Window.
-
- You \e \b must override the draw() method.
- */
- virtual void draw();
-};
-
#endif
//
Modified: branches/branch-3.0/fltk3/Printer.h
===================================================================
--- branches/branch-3.0/fltk3/Printer.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fltk3/Printer.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -124,7 +124,7 @@
*
Fl_Printer allows to use all FLTK drawing, color, text, and clip functions,
and to have them operate
on printed page(s). There are two main, non exclusive, ways to use it.
- <ul><li>Print any widget (standard, custom, fltk3::Window, Fl_Gl_Window) as
it appears
+ <ul><li>Print any widget (standard, custom, fltk3::Window, fltk3::GlWindow)
as it appears
on screen, with optional translation, scaling and rotation. This is done by
calling print_widget()
or print_window_part().
<li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors,
clip, image) to
Modified: branches/branch-3.0/fltk3/RadioLightButton.h
===================================================================
--- branches/branch-3.0/fltk3/RadioLightButton.h 2011-05-20 22:00:10 UTC
(rev 8701)
+++ branches/branch-3.0/fltk3/RadioLightButton.h 2011-05-20 22:23:28 UTC
(rev 8702)
@@ -26,18 +26,22 @@
//
/* \file
- Fl_Radio_Light_Button widget . */
+ fltk3::RadioLightButton widget . */
#ifndef Fltk3_Radio_Light_Button_H
#define Fltk3_Radio_Light_Button_H
#include "LightButton.h"
-class FLTK3_EXPORT Fl_Radio_Light_Button : public fltk3::LightButton {
-public:
- Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0)
- : fltk3::LightButton(X,Y,W,H,l) {type(fltk3::RADIO_BUTTON);}
-};
+namespace fltk3 {
+
+ class FLTK3_EXPORT RadioLightButton : public fltk3::LightButton {
+ public:
+ RadioLightButton(int X,int Y,int W,int H,const char *l=0)
+ : fltk3::LightButton(X,Y,W,H,l) {type(fltk3::RADIO_BUTTON);}
+ };
+
+}
#endif
Modified: branches/branch-3.0/fltk3/ToggleLightButton.h
===================================================================
--- branches/branch-3.0/fltk3/ToggleLightButton.h 2011-05-20 22:00:10 UTC
(rev 8701)
+++ branches/branch-3.0/fltk3/ToggleLightButton.h 2011-05-20 22:23:28 UTC
(rev 8702)
@@ -29,7 +29,19 @@
#ifndef Fl_Toggle_Light_Button
#include "LightButton.h"
-#define Fl_Toggle_Light_Button fltk3::LightButton
+
+namespace fltk3 {
+
+ class FLTK3_EXPORT ToggleLightButton : public LightButton {
+ protected:
+ virtual void draw();
+ public:
+ ToggleLightButton(int x,int y,int w,int h,const char *l = 0)
+ : LightButton(x, y, w, h, l) {}
+ };
+
+}
+
#endif
//
Modified: branches/branch-3.0/fltk3/Widget.h
===================================================================
--- branches/branch-3.0/fltk3/Widget.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fltk3/Widget.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -55,9 +55,8 @@
class Group;
class Window;
class Image;
-}
+ class GlWindow;
-namespace fltk3 {
/** Default callback type definition for all fltk widgets (by far the most
used) */
typedef void (Callback)(Widget*, void*);
/** Default callback type pointer definition for all fltk widgets */
@@ -944,17 +943,17 @@
*/
virtual fltk3::Window* as_window() {return 0;}
- /** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
+ /** Returns an fltk3::GlWindow pointer if this widget is an
fltk3::GlWindow.
Use this method if you have a widget (pointer) and need to
- know whether this widget is derived from Fl_Gl_Window. If it returns
- non-NULL, then the widget in question is derived from Fl_Gl_Window.
+ know whether this widget is derived from fltk3::GlWindow. If it returns
+ non-NULL, then the widget in question is derived from fltk3::GlWindow.
- \retval NULL if this widget is not derived from Fl_Gl_Window.
+ \retval NULL if this widget is not derived from fltk3::GlWindow.
\note This method is provided to avoid dynamic_cast.
\see fltk3::Widget::as_group(), fltk3::Widget::as_window()
*/
- virtual class Fl_Gl_Window* as_gl_window() {return 0;}
+ virtual class fltk3::GlWindow* as_gl_window() {return 0;}
/** For back compatibility only.
\deprecated Use selection_color() instead.
Modified: branches/branch-3.0/fltk3/Window.h
===================================================================
--- branches/branch-3.0/fltk3/Window.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fltk3/Window.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -425,7 +425,7 @@
if it draws a slow graphic. <B>Danger: incremental update is very hard to
debug and maintain!</B>
- This method only works for the fltk3::Window and Fl_Gl_Window derived
classes.
+ This method only works for the fltk3::Window and fltk3::GlWindow derived
classes.
*/
void make_current();
Modified: branches/branch-3.0/fltk3/enumerations.h
===================================================================
--- branches/branch-3.0/fltk3/enumerations.h 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/fltk3/enumerations.h 2011-05-20 22:23:28 UTC (rev
8702)
@@ -835,7 +835,7 @@
};
- /** visual types and Fl_Gl_Window::mode() (values match Glut) */
+ /** visual types and fltk3::GlWindow::mode() (values match Glut) */
enum Mode {
RGB = 0,
INDEX = 1,
Modified: branches/branch-3.0/fltk3/glut.h
===================================================================
--- branches/branch-3.0/fltk3/glut.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fltk3/glut.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -50,7 +50,7 @@
GLUT is emulated using this window class and these static variables
(plus several more static variables hidden in glut_compatability.cxx):
*/
-class FLTK3_EXPORT Fl_Glut_Window : public Fl_Gl_Window {
+class FLTK3_EXPORT Fl_Glut_Window : public fltk3::GlWindow {
void _init();
int mouse_down;
protected:
Modified: branches/branch-3.0/fltk3/run.h
===================================================================
--- branches/branch-3.0/fltk3/run.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fltk3/run.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -256,9 +256,9 @@
drawing to work. This <I>must</I> be done if you want to draw in
normal windows with OpenGL with gl_start() and gl_end().
It may be useful to call this so your X windows use the same visual
- as an Fl_Gl_Window, which on some servers will reduce colormap flashing.
+ as an fltk3::GlWindow, which on some servers will reduce colormap flashing.
- See Fl_Gl_Window for a list of additional values for the argument.
+ See fltk3::GlWindow for a list of additional values for the argument.
*/
int gl_visual(int, int *alist=0); // platform dependent
void own_colormap();
Modified: branches/branch-3.0/fluid/fluid.cxx
===================================================================
--- branches/branch-3.0/fluid/fluid.cxx 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/fluid/fluid.cxx 2011-05-20 22:23:28 UTC (rev 8702)
@@ -2391,7 +2391,7 @@
#ifdef __APPLE__
fl_open_callback(apple_open_cb);
#endif // __APPLE__
- fltk3::visual((Fl_Mode)(fltk3::DOUBLE|fltk3::INDEX));
+ fltk3::visual((fltk3::Mode)(fltk3::DOUBLE|fltk3::INDEX));
fltk3::FileIcon::load_system_icons();
main_window->callback(exit_cb);
position_window(main_window,"main_window_pos", 1, 10, 30, WINWIDTH,
WINHEIGHT );
Modified: branches/branch-3.0/src/Fl_Gl_Choice.H
===================================================================
--- branches/branch-3.0/src/Fl_Gl_Choice.H 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/src/Fl_Gl_Choice.H 2011-05-20 22:23:28 UTC (rev
8702)
@@ -49,7 +49,7 @@
//
// fl_delete_gl_context destroys the context.
//
-// This code is used by Fl_Gl_Window, gl_start(), and gl_visual()
+// This code is used by fltk3::GlWindow, gl_start(), and gl_visual()
#ifndef Fl_Gl_Choice_H
#define Fl_Gl_Choice_H
Modified: branches/branch-3.0/src/Fl_Gl_Device_Plugin.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Gl_Device_Plugin.cxx 2011-05-20 22:00:10 UTC
(rev 8701)
+++ branches/branch-3.0/src/Fl_Gl_Device_Plugin.cxx 2011-05-20 22:23:28 UTC
(rev 8702)
@@ -41,7 +41,7 @@
}
#endif
-static void print_gl_window(Fl_Gl_Window *glw, int x, int y, int height)
+static void print_gl_window(fltk3::GlWindow *glw, int x, int y, int height)
{
#ifdef WIN32
HDC save_gc = fl_gc;
@@ -138,7 +138,7 @@
Fl_Gl_Device_Plugin() : Fl_Device_Plugin(name()) { }
virtual const char *name() { return "opengl.device.fltk.org"; }
virtual int print(fltk3::Widget *w, int x, int y, int height) {
- Fl_Gl_Window *glw = w->as_gl_window();
+ fltk3::GlWindow *glw = w->as_gl_window();
if (!glw) return 0;
print_gl_window(glw, x, y, height);
return 1;
@@ -147,8 +147,8 @@
static Fl_Gl_Device_Plugin Gl_Device_Plugin;
-// The purpose of this variable, used in Fl_Gl_Window.cxx, is only to force
this file to be loaded
-// whenever Fl_Gl_Window.cxx is loaded, that is, whenever fltk_gl is.
+// The purpose of this variable, used in fltk3::GlWindow.cxx, is only to force
this file to be loaded
+// whenever fltk3::GlWindow.cxx is loaded, that is, whenever fltk_gl is.
FLTK3_EXPORT int fl_gl_load_plugin = 0;
//
Modified: branches/branch-3.0/src/Fl_Gl_Overlay.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Gl_Overlay.cxx 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/src/Fl_Gl_Overlay.cxx 2011-05-20 22:23:28 UTC (rev
8702)
@@ -36,19 +36,19 @@
#if !HAVE_GL_OVERLAY
-int Fl_Gl_Window::can_do_overlay() {return 0;}
+int fltk3::GlWindow::can_do_overlay() {return 0;}
-void Fl_Gl_Window::make_overlay() {overlay = this;}
+void fltk3::GlWindow::make_overlay() {overlay = this;}
#else
-// Methods on Fl_Gl_Window that create an overlay window. Because
+// Methods on fltk3::GlWindow that create an overlay window. Because
// many programs don't need the overlay, this is separated into this
// source file so it is not linked in if not used.
// Under X this is done by creating another window, of class _Fl_Gl_Overlay
-// which is a subclass of Fl_Gl_Window except it uses the overlay planes.
-// A pointer to this is stored in the "overlay" pointer of the Fl_Gl_Window.
+// which is a subclass of fltk3::GlWindow except it uses the overlay planes.
+// A pointer to this is stored in the "overlay" pointer of the fltk3::GlWindow.
// Under win32 another GLX context is created to draw into the overlay
// and it is stored in the "overlay" pointer.
@@ -67,13 +67,13 @@
extern unsigned long fl_transparent_pixel;
extern uchar fl_overlay;
-class _Fl_Gl_Overlay : public Fl_Gl_Window {
+class _Fl_Gl_Overlay : public fltk3::GlWindow {
void flush();
void draw();
public:
void show();
_Fl_Gl_Overlay(int x, int y, int w, int h) :
- Fl_Gl_Window(x,y,w,h) {
+ fltk3::GlWindow(x,y,w,h) {
set_flag(INACTIVE);
}
};
@@ -97,7 +97,7 @@
void _Fl_Gl_Overlay::draw() {
if (!valid()) glClearIndex((GLfloat)fl_transparent_pixel);
if (damage() != fltk3::DAMAGE_EXPOSE) glClear(GL_COLOR_BUFFER_BIT);
- Fl_Gl_Window *w = (Fl_Gl_Window *)parent();
+ fltk3::GlWindow *w = (fltk3::GlWindow *)parent();
uchar save_valid = w->valid();
w->valid(valid());
fl_overlay = 1;
@@ -119,14 +119,14 @@
context(fl_create_gl_context(fl_overlay_visual), 1);
valid(0);
}
- Fl_Gl_Window::show();
+ fltk3::GlWindow::show();
}
-int Fl_Gl_Window::can_do_overlay() {
+int fltk3::GlWindow::can_do_overlay() {
return fl_find_overlay_visual() != 0;
}
-void Fl_Gl_Window::make_overlay() {
+void fltk3::GlWindow::make_overlay() {
if (overlay) return;
if (can_do_overlay()) {
_Fl_Gl_Overlay* o = new _Fl_Gl_Overlay(0,0,w(),h());
@@ -145,7 +145,7 @@
//static COLORREF *palette;
extern int fl_overlay_depth;
-void Fl_Gl_Window::make_overlay() {
+void fltk3::GlWindow::make_overlay() {
if (overlay) return;
GLContext context = fl_create_gl_context(this, g, 1);
@@ -180,7 +180,7 @@
return;
}
-int Fl_Gl_Window::can_do_overlay() {
+int fltk3::GlWindow::can_do_overlay() {
if (!g) {
g = Fl_Gl_Choice::find(mode_,alist);
if (!g) return 0;
@@ -193,7 +193,7 @@
#endif
-void Fl_Gl_Window::redraw_overlay() {
+void fltk3::GlWindow::redraw_overlay() {
if (!shown()) return;
make_overlay();
#ifdef __APPLE__
@@ -201,14 +201,14 @@
#else
#ifndef WIN32
if (overlay != this)
- ((Fl_Gl_Window*)overlay)->redraw();
+ ((fltk3::GlWindow*)overlay)->redraw();
else
#endif
damage(fltk3::DAMAGE_OVERLAY);
#endif
}
-void Fl_Gl_Window::make_overlay_current() {
+void fltk3::GlWindow::make_overlay_current() {
make_overlay();
#ifdef __APPLE__
// this is not very useful, but unfortunately, Apple decided
@@ -223,7 +223,7 @@
// if (fl_overlay_depth)
// wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE);
#else
- ((Fl_Gl_Window*)overlay)->make_current();
+ ((fltk3::GlWindow*)overlay)->make_current();
#endif
} else
#endif
@@ -231,12 +231,12 @@
#endif
}
/** Hides the window if it is not this window, does nothing in WIN32. */
-void Fl_Gl_Window::hide_overlay() {
+void fltk3::GlWindow::hide_overlay() {
#if HAVE_GL_OVERLAY
#ifdef WIN32
// nothing needs to be done? Or should it be erased?
#else
- if (overlay && overlay!=this) ((Fl_Gl_Window*)overlay)->hide();
+ if (overlay && overlay!=this) ((fltk3::GlWindow*)overlay)->hide();
#endif
#endif
}
Modified: branches/branch-3.0/src/Fl_Gl_Window.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Gl_Window.cxx 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/src/Fl_Gl_Window.cxx 2011-05-20 22:23:28 UTC (rev
8702)
@@ -68,11 +68,11 @@
////////////////////////////////////////////////////////////////
/** Returns non-zero if the hardware supports the given or current OpenGL
mode. */
-int Fl_Gl_Window::can_do(int a, const int *b) {
+int fltk3::GlWindow::can_do(int a, const int *b) {
return Fl_Gl_Choice::find(a,b) != 0;
}
-void Fl_Gl_Window::show() {
+void fltk3::GlWindow::show() {
#if defined(__APPLE__)
int need_redraw = 0;
#endif
@@ -92,7 +92,7 @@
}
#if !defined(WIN32) && !defined(__APPLE__)
Fl_X::make_xid(this, g->vis, g->colormap);
- if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show();
+ if (overlay && overlay != this) ((fltk3::GlWindow*)overlay)->show();
#elif defined(__APPLE__)
if( ! parent() ) need_redraw=1;
#endif
@@ -109,21 +109,21 @@
The invalidate() method turns off valid() and is
equivalent to calling value(0).
*/
-void Fl_Gl_Window::invalidate() {
+void fltk3::GlWindow::invalidate() {
valid(0);
context_valid(0);
#ifndef WIN32
if (overlay) {
- ((Fl_Gl_Window*)overlay)->valid(0);
- ((Fl_Gl_Window*)overlay)->context_valid(0);
+ ((fltk3::GlWindow*)overlay)->valid(0);
+ ((fltk3::GlWindow*)overlay)->context_valid(0);
}
#endif
}
/**
- See const int Fl_Gl_Window::mode() const
+ See const int fltk3::GlWindow::mode() const
*/
-int Fl_Gl_Window::mode(int m, const int *a) {
+int fltk3::GlWindow::mode(int m, const int *a) {
if (m == mode_ && a == alist) return 0;
#ifndef __APPLE__
int oldmode = mode_;
@@ -168,8 +168,8 @@
selection within the handle() method.
*/
-void Fl_Gl_Window::make_current() {
-// puts("Fl_Gl_Window::make_current()");
+void fltk3::GlWindow::make_current() {
+// puts("fltk3::GlWindow::make_current()");
// printf("make_current: context_=%p\n", context_);
if (!context_) {
mode_ &= ~NON_LOCAL_CONTEXT;
@@ -219,7 +219,7 @@
pixel is 1 unit wide/tall. If you are drawing 2D images, your
draw() method may want to call this if valid() is false.
*/
-void Fl_Gl_Window::ortho() {
+void fltk3::GlWindow::ortho() {
// Alpha NT seems to have a broken OpenGL that does not like negative coords:
#ifdef _M_ALPHA
glLoadIdentity();
@@ -238,7 +238,7 @@
The swap_buffers() method swaps the back and front buffers.
It is called automatically after the draw() method is called.
*/
-void Fl_Gl_Window::swap_buffers() {
+void fltk3::GlWindow::swap_buffers() {
#if defined(USE_X11)
glXSwapBuffers(fl_display, fl_xid(this));
#elif defined(WIN32)
@@ -269,7 +269,7 @@
#endif
-void Fl_Gl_Window::flush() {
+void fltk3::GlWindow::flush() {
uchar save_valid = valid_f_ & 1;
#if HAVE_GL_OVERLAY && defined(WIN32)
uchar save_valid_f = valid_f_;
@@ -367,7 +367,7 @@
// we use a separate context for the copy because rasterpos must be 0
// and depth test needs to be off:
static GLContext ortho_context = 0;
- static Fl_Gl_Window* ortho_window = 0;
+ static fltk3::GlWindow* ortho_window = 0;
int orthoinit = !ortho_context;
if (orthoinit) ortho_context = fl_create_gl_context(this, g);
fl_set_gl_context(this, ortho_context);
@@ -415,8 +415,8 @@
context_valid(1);
}
-void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
-// printf("Fl_Gl_Window::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
+void fltk3::GlWindow::resize(int X,int Y,int W,int H) {
+// printf("fltk3::GlWindow::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
// printf("current: x()=%d, y()=%d, w()=%d, h()=%d\n", x(), y(), w(), h());
if (W != w() || H != h()) valid(0);
@@ -425,7 +425,7 @@
if (X != x() || Y != y() || W != w() || H != h()) aglUpdateContext(context_);
#elif !defined(WIN32)
if ((W != w() || H != h()) && !resizable() && overlay && overlay != this) {
- ((Fl_Gl_Window*)overlay)->resize(0,0,W,H);
+ ((fltk3::GlWindow*)overlay)->resize(0,0,W,H);
}
#endif
@@ -443,7 +443,7 @@
fltk when the window is destroyed, or when the mode() is changed,
or the next time context(x) is called.
*/
-void Fl_Gl_Window::context(void* v, int destroy_flag) {
+void fltk3::GlWindow::context(void* v, int destroy_flag) {
if (context_ && !(mode_&NON_LOCAL_CONTEXT)) fl_delete_gl_context(context_);
context_ = (GLContext)v;
if (destroy_flag) mode_ &= ~NON_LOCAL_CONTEXT;
@@ -453,7 +453,7 @@
/**
Hides the window and destroys the OpenGL context.
*/
-void Fl_Gl_Window::hide() {
+void fltk3::GlWindow::hide() {
context(0);
#if HAVE_GL_OVERLAY && defined(WIN32)
if (overlay && overlay != this) {
@@ -468,7 +468,7 @@
The destructor removes the widget and destroys the OpenGL context
associated with it.
*/
-Fl_Gl_Window::~Fl_Gl_Window() {
+fltk3::GlWindow::~GlWindow() {
hide();
// delete overlay; this is done by ~Fl_Group
#ifdef __APPLE__
@@ -478,7 +478,7 @@
#endif
}
-void Fl_Gl_Window::init() {
+void fltk3::GlWindow::init() {
end(); // we probably don't want any children
box(fltk3::NO_BOX);
@@ -506,18 +506,18 @@
OpenGL mode and drawing anything other than flat-shaded will probably
not work.
- Both this function and Fl_Gl_Window::draw() should check
- Fl_Gl_Window::valid() and set the same transformation. If you
+ Both this function and fltk3::GlWindow::draw() should check
+ fltk3::GlWindow::valid() and set the same transformation. If you
don't your code may not work on other systems. Depending on the OS,
and on whether overlays are real or simulated, the OpenGL context may
be the same or different between the overlay and main window.
*/
-void Fl_Gl_Window::draw_overlay() {}
+void fltk3::GlWindow::draw_overlay() {}
#endif
/**
- You \e \b must subclass Fl_Gl_Window and provide an implementation for
+ You \e \b must subclass fltk3::GlWindow and provide an implementation for
draw(). You may also provide an implementation of draw_overlay()
if you want to draw into the overlay planes. You can avoid
reinitializing the viewport and lights and other things by checking
@@ -531,15 +531,15 @@
If double-buffering is enabled in the window, the back and front
buffers are swapped after this function is completed.
*/
-void Fl_Gl_Window::draw() {
- fltk3::fatal("Fl_Gl_Window::draw() *must* be overriden. Please refer to
the documentation.");
+void fltk3::GlWindow::draw() {
+ fltk3::fatal("fltk3::GlWindow::draw() *must* be overriden. Please refer to
the documentation.");
}
/**
Handle some FLTK events as needed.
*/
-int Fl_Gl_Window::handle(int event)
+int fltk3::GlWindow::handle(int event)
{
#ifdef __APPLE_QUARTZ__
/*if (event==fltk3::HIDE) {
Modified: branches/branch-3.0/src/gl_draw.cxx
===================================================================
--- branches/branch-3.0/src/gl_draw.cxx 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/src/gl_draw.cxx 2011-05-20 22:23:28 UTC (rev 8702)
@@ -26,7 +26,7 @@
//
// Functions from <fltk3/gl.h>
-// See also Fl_Gl_Window and gl_start.cxx
+// See also fltk3::GlWindow and gl_start.cxx
#include "flstring.h"
#if HAVE_GL || defined(FL_DOXYGEN)
@@ -299,7 +299,7 @@
/**
Outlines the given rectangle with the current color.
- If Fl_Gl_Window::ortho() has been called, then the rectangle will
+ If fltk3::GlWindow::ortho() has been called, then the rectangle will
exactly fill the given pixel rectangle.
*/
void gl_rect(int x, int y, int w, int h) {
Modified: branches/branch-3.0/src/glut_compatability.cxx
===================================================================
--- branches/branch-3.0/src/glut_compatability.cxx 2011-05-20 22:00:10 UTC
(rev 8701)
+++ branches/branch-3.0/src/glut_compatability.cxx 2011-05-20 22:23:28 UTC
(rev 8702)
@@ -61,7 +61,7 @@
void Fl_Glut_Window::make_current() {
glut_window = this;
- if (shown()) Fl_Gl_Window::make_current();
+ if (shown()) fltk3::GlWindow::make_current();
}
static int indraw;
@@ -164,7 +164,7 @@
break;
}
- return Fl_Gl_Window::handle(event);
+ return fltk3::GlWindow::handle(event);
}
static int glut_mode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH;
@@ -189,11 +189,11 @@
/** Creates a glut window, registers to the glut windows list.*/
Fl_Glut_Window::Fl_Glut_Window(int W, int H, const char *t) :
- Fl_Gl_Window(W,H,t) {_init();}
+ fltk3::GlWindow(W,H,t) {_init();}
/** Creates a glut window, registers to the glut windows list.*/
Fl_Glut_Window::Fl_Glut_Window(int X,int Y,int W,int H, const char *t) :
- Fl_Gl_Window(X,Y,W,H,t) {_init();}
+ fltk3::GlWindow(X,Y,W,H,t) {_init();}
static int initargc;
static char **initargv;
@@ -351,7 +351,7 @@
i->text = label;
i->callback_ = 0;
i->user_data_ = (void *)(menus[submenu].m);
- i->flags = FL_PUP_SUBMENU;
+ i->flags = fltk3::SUBMENU;
}
void glutChangeToMenuEntry(int item, char *label, int value) {
@@ -369,7 +369,7 @@
i->text = label;
i->callback_ = 0;
i->user_data_ = (void *)(menus[submenu].m);
- i->flags = FL_PUP_SUBMENU;
+ i->flags = fltk3::SUBMENU;
}
void glutRemoveMenuItem(int item) {
@@ -400,7 +400,7 @@
//case GLUT_SCREEN_WIDTH_MM:
//case GLUT_SCREEN_HEIGHT_MM:
case GLUT_MENU_NUM_ITEMS: return menus[glut_menu].size;
- case GLUT_DISPLAY_MODE_POSSIBLE: return Fl_Gl_Window::can_do(glut_mode);
+ case GLUT_DISPLAY_MODE_POSSIBLE: return fltk3::GlWindow::can_do(glut_mode);
case GLUT_INIT_WINDOW_X: return initx;
case GLUT_INIT_WINDOW_Y: return inity;
case GLUT_INIT_WINDOW_WIDTH: return initw;
Modified: branches/branch-3.0/test/CubeView.cxx
===================================================================
--- branches/branch-3.0/test/CubeView.cxx 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/test/CubeView.cxx 2011-05-20 22:23:28 UTC (rev
8702)
@@ -31,7 +31,7 @@
#if HAVE_GL
CubeView::CubeView(int x,int y,int w,int h,const char *l)
- : Fl_Gl_Window(x,y,w,h,l)
+ : fltk3::GlWindow(x,y,w,h,l)
#else
CubeView::CubeView(int x,int y,int w,int h,const char *l)
: Fl_Box(x,y,w,h,l)
Modified: branches/branch-3.0/test/CubeView.h
===================================================================
--- branches/branch-3.0/test/CubeView.h 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/test/CubeView.h 2011-05-20 22:23:28 UTC (rev 8702)
@@ -39,7 +39,7 @@
#include <stdlib.h>
#if HAVE_GL
-class CubeView : public Fl_Gl_Window {
+class CubeView : public fltk3::GlWindow {
#else
class CubeView : public Fl_Box {
#endif /* HAVE_GL */
Modified: branches/branch-3.0/test/cube.cxx
===================================================================
--- branches/branch-3.0/test/cube.cxx 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/test/cube.cxx 2011-05-20 22:23:28 UTC (rev 8702)
@@ -32,27 +32,27 @@
#include <fltk3/Window.h>
#include <fltk3/Box.h>
#include <fltk3/Button.h>
-#include <fltk3/Radio_Light_Button.h>
-#include <FL/fltk3::Slider.h>
+#include <fltk3/RadioLightButton.h>
+#include <fltk3/Slider.h>
#include <stdlib.h>
#if !HAVE_GL
-class cube_box : public Fl_Box {
+class cube_box : public fltk3::Box {
public:
double lasttime;
int wire;
double size;
double speed;
cube_box(int x,int y,int w,int h,const char *l=0)
- :Fl_Box(FL_DOWN_BOX,x,y,w,h,l){
+ :fltk3::Box(fltk3::DOWN_BOX,x,y,w,h,l){
label("This demo does\nnot work without GL");
}
};
#else
-#include <fltk3/Gl_Window.h>
-#include <FL/gl.h>
+#include <fltk3/GlWindow.h>
+#include <fltk3/gl.h>
-class cube_box : public Fl_Gl_Window {
+class cube_box : public fltk3::GlWindow {
void draw();
int handle(int);
public:
@@ -61,7 +61,7 @@
double size;
double speed;
cube_box(int x,int y,int w,int h,const char *l=0)
- : Fl_Gl_Window(x,y,w,h,l) {lasttime = 0.0;}
+ : fltk3::GlWindow(x,y,w,h,l) {lasttime = 0.0;}
};
/* The cube definition */
@@ -107,7 +107,7 @@
glEnable(GL_DEPTH_TEST);
glFrustum(-1,1,-1,1,2,10000);
glTranslatef(0,0,-10);
- gl_font(FL_HELVETICA_BOLD, 16 );
+ gl_font(fltk3::HELVETICA_BOLD, 16 );
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
@@ -118,7 +118,7 @@
glScalef(float(size),float(size),float(size));
drawcube(wire);
glPopMatrix();
- gl_color(FL_GRAY);
+ gl_color(fltk3::GRAY);
glDisable(GL_DEPTH_TEST);
gl_draw(wire ? "Cube: wire" : "Cube: flat", -4.5f, -4.5f );
glEnable(GL_DEPTH_TEST);
@@ -126,31 +126,31 @@
int cube_box::handle(int e) {
switch (e) {
- case FL_ENTER: cursor(FL_CURSOR_CROSS); break;
- case FL_LEAVE: cursor(FL_CURSOR_DEFAULT); break;
+ case fltk3::ENTER: cursor(fltk3::CURSOR_CROSS); break;
+ case fltk3::LEAVE: cursor(fltk3::CURSOR_DEFAULT); break;
}
- return Fl_Gl_Window::handle(e);
+ return fltk3::GlWindow::handle(e);
}
#endif
-Fl_Window *form;
+fltk3::Window *form;
fltk3::Slider *speed, *size;
-Fl_Button *button, *wire, *flat;
+fltk3::Button *button, *wire, *flat;
cube_box *cube, *cube2;
void makeform(const char *name) {
- form = new Fl_Window(510+390,390,name);
- new Fl_Box(FL_DOWN_FRAME,20,20,350,350,"");
- new Fl_Box(FL_DOWN_FRAME,510,20,350,350,"");
- speed = new fltk3::Slider(FL_VERT_SLIDER,390,90,40,220,"Speed");
- size = new fltk3::Slider(FL_VERT_SLIDER,450,90,40,220,"Size");
- wire = new Fl_Radio_Light_Button(390,20,100,30,"Wire");
- flat = new Fl_Radio_Light_Button(390,50,100,30,"Flat");
- button = new Fl_Button(390,340,100,30,"Exit");
+ form = new fltk3::Window(510+390,390,name);
+ new fltk3::Box(fltk3::DOWN_FRAME,20,20,350,350,"");
+ new fltk3::Box(fltk3::DOWN_FRAME,510,20,350,350,"");
+ speed = new fltk3::Slider(fltk3::VERT_SLIDER,390,90,40,220,"Speed");
+ size = new fltk3::Slider(fltk3::VERT_SLIDER,450,90,40,220,"Size");
+ wire = new fltk3::RadioLightButton(390,20,100,30,"Wire");
+ flat = new fltk3::RadioLightButton(390,50,100,30,"Flat");
+ button = new fltk3::Button(390,340,100,30,"Exit");
cube = new cube_box(23,23,344,344, 0);
cube2 = new cube_box(513,23,344,344, 0);
- Fl_Box *b = new Fl_Box(FL_NO_BOX,cube->x(),size->y(),
+ fltk3::Box *b = new fltk3::Box(fltk3::NO_BOX,cube->x(),size->y(),
cube->w(),size->h(),0);
form->resizable(b);
b->hide();
@@ -158,13 +158,13 @@
}
// added to demo printing
-#include <fltk3/Sys_Menu_Bar.h>
+#include <fltk3/SysMenuBar.h>
#include <fltk3/Printer.h>
-void print_cb(Fl_Widget *w, void *data)
+void print_cb(fltk3::Widget *w, void *data)
{
- Fl_Printer printer;
- Fl_Window *win = Fl::first_window();
+ Fl_Printer printer; // FIXME: 123
+ fltk3::Window *win = fltk3::first_window();
if(!win) return;
if( printer.start_job(1) ) return;
if( printer.start_page() ) return;
@@ -187,7 +187,7 @@
};
fltk3::SysMenuBar *menubar_;
menubar_ = new fltk3::SysMenuBar(0, 0, 60, 20);
- menubar_->box(FL_FLAT_BOX);
+ menubar_->box(fltk3::FLAT_BOX);
menubar_->menu(items);
form->end();
// end of printing demo
@@ -212,16 +212,16 @@
#endif
for (;;) {
if (form->visible() && speed->value())
- {if (!Fl::check()) break;} // returns immediately
+ {if (!fltk3::check()) break;} // returns immediately
else
- {if (!Fl::wait()) break;} // waits until something happens
+ {if (!fltk3::wait()) break;} // waits until something happens
cube->wire = wire->value();
cube2->wire = !wire->value();
cube->size = cube2->size = size->value();
cube->speed = cube2->speed = speed->value();
cube->redraw();
cube2->redraw();
- if (Fl::readqueue() == button) break;
+ if (fltk3::readqueue() == button) break;
}
return 0;
}
Modified: branches/branch-3.0/test/fullscreen.cxx
===================================================================
--- branches/branch-3.0/test/fullscreen.cxx 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/test/fullscreen.cxx 2011-05-20 22:23:28 UTC (rev
8702)
@@ -31,7 +31,7 @@
//
// If it is a seperate window, turning double buffering on and off
// will cause the window to raise, deiconize, and possibly move. You
-// can avoid this by making the Fl_Gl_Window a child of a normal
+// can avoid this by making the fltk3::GlWindow a child of a normal
// window.
//
// Copyright 1998-2010 by Bill Spitzak and others.
@@ -58,17 +58,17 @@
#include <config.h>
#include <fltk3/run.h>
-#include <fltk3/Single_Window.h>
-#include <fltk3/Hor_Slider.h>
-#include <fltk3/Toggle_Light_Button.h>
+#include <fltk3/SingleWindow.h>
+#include <fltk3/HorSlider.h>
+#include <fltk3/LightButton.h>
#include <FL/math.h>
#include <stdio.h>
#if HAVE_GL
-#include <FL/gl.h>
-#include <fltk3/Gl_Window.h>
+#include <fltk3/gl.h>
+#include <fltk3/GlWindow.h>
-class shape_window : public Fl_Gl_Window {
+class shape_window : public fltk3::GlWindow {
void draw();
public:
int sides;
@@ -76,7 +76,7 @@
};
shape_window::shape_window(int x,int y,int w,int h,const char *l) :
-Fl_Gl_Window(x,y,w,h,l) {
+fltk3::GlWindow(x,y,w,h,l) {
sides = 3;
}
@@ -102,7 +102,7 @@
#include <fltk3/draw.h>
-class shape_window : public Fl_Window {
+class shape_window : public fltk3::Window {
void draw();
public:
int sides;
@@ -110,39 +110,39 @@
};
shape_window::shape_window(int x,int y,int w,int h,const char *l) :
-Fl_Window(x,y,w,h,l) {
+fltk3::Window(x,y,w,h,l) {
sides = 3;
}
void shape_window::draw() {
- fl_color(0);
- fl_rectf(0,0,w(),h());
- fl_font(0,20);
- fl_color(7);
- fl_draw("This requires GL",0,0,w(),h(),FL_ALIGN_CENTER);
+ fltk3::color(0);
+ fltk3::rectf(0,0,w(),h());
+ fltk3::font(0,20);
+ fltk3::color(7);
+ fltk3::draw("This requires GL",0,0,w(),h(),fltk3::ALIGN_CENTER);
}
#endif
-void sides_cb(Fl_Widget *o, void *p) {
+void sides_cb(fltk3::Widget *o, void *p) {
shape_window *sw = (shape_window *)p;
sw->sides = int(((fltk3::Slider *)o)->value());
sw->redraw();
}
#if HAVE_GL
-void double_cb(Fl_Widget *o, void *p) {
+void double_cb(fltk3::Widget *o, void *p) {
shape_window *sw = (shape_window *)p;
- int d = ((Fl_Button *)o)->value();
- sw->mode(d ? Fl_Mode(FL_DOUBLE|FL_RGB) : FL_RGB);
+ int d = ((fltk3::Button *)o)->value();
+ sw->mode(d ? fltk3::Mode(fltk3::DOUBLE|fltk3::RGB) : fltk3::RGB);
}
#else
-void double_cb(Fl_Widget *, void *) {}
+void double_cb(fltk3::Widget *, void *) {}
#endif
-void border_cb(Fl_Widget *o, void *p) {
- Fl_Window *w = (Fl_Window *)p;
- int d = ((Fl_Button *)o)->value();
+void border_cb(fltk3::Widget *o, void *p) {
+ fltk3::Window *w = (fltk3::Window *)p;
+ int d = ((fltk3::Button *)o)->value();
w->border(d);
#if defined(WIN32) || defined(__APPLE__)
int wx = w->x(), wy = w->y();
@@ -152,10 +152,10 @@
}
int px,py,pw,ph;
-Fl_Button *border_button;
-void fullscreen_cb(Fl_Widget *o, void *p) {
- Fl_Window *w = (Fl_Window *)p;
- int d = ((Fl_Button *)o)->value();
+fltk3::Button *border_button;
+void fullscreen_cb(fltk3::Widget *o, void *p) {
+ fltk3::Window *w = (fltk3::Window *)p;
+ int d = ((fltk3::Button *)o)->value();
if (d) {
px = w->x();
py = w->y();
@@ -173,7 +173,7 @@
#include <stdlib.h>
-void exit_cb(Fl_Widget *, void *) {
+void exit_cb(fltk3::Widget *, void *) {
exit(0);
}
@@ -190,17 +190,17 @@
int main(int argc, char **argv) {
int i=0;
- if (Fl::args(argc,argv,i,arg) < argc)
- Fl::fatal("Options are:\n -2 = 2 windows\n -f = startup
fullscreen\n%s",Fl::help);
+ if (fltk3::args(argc,argv,i,arg) < argc)
+ fltk3::fatal("Options are:\n -2 = 2 windows\n -f = startup
fullscreen\n%s",fltk3::help);
fltk3::SingleWindow window(300,300+30*NUMB); window.end();
shape_window sw(10,10,window.w()-20,window.h()-30*NUMB-20);
#if HAVE_GL
- sw.mode(FL_RGB);
+ sw.mode(fltk3::RGB);
#endif
- Fl_Window *w;
+ fltk3::Window *w;
if (twowindow) { // make it's own window
sw.resizable(&sw);
w = &sw;
@@ -217,28 +217,28 @@
int y = window.h()-30*NUMB-5;
fltk3::HorSlider slider(50,y,window.w()-60,30,"Sides:");
- slider.align(FL_ALIGN_LEFT);
+ slider.align(fltk3::ALIGN_LEFT);
slider.callback(sides_cb,&sw);
slider.value(sw.sides);
slider.step(1);
slider.bounds(3,40);
y+=30;
- Fl_Toggle_Light_Button b1(50,y,window.w()-60,30,"Double Buffered");
+ fltk3::LightButton b1(50,y,window.w()-60,30,"Double Buffered");
b1.callback(double_cb,&sw);
y+=30;
- Fl_Toggle_Light_Button b2(50,y,window.w()-60,30,"Border");
+ fltk3::LightButton b2(50,y,window.w()-60,30,"Border");
b2.callback(border_cb,w);
b2.set();
border_button = &b2;
y+=30;
- Fl_Toggle_Light_Button b3(50,y,window.w()-60,30,"FullScreen");
+ fltk3::LightButton b3(50,y,window.w()-60,30,"FullScreen");
b3.callback(fullscreen_cb,w);
y+=30;
- Fl_Button eb(50,y,window.w()-60,30,"Exit");
+ fltk3::Button eb(50,y,window.w()-60,30,"Exit");
eb.callback(exit_cb);
y+=30;
Modified: branches/branch-3.0/test/gl_overlay.cxx
===================================================================
--- branches/branch-3.0/test/gl_overlay.cxx 2011-05-20 22:00:10 UTC (rev
8701)
+++ branches/branch-3.0/test/gl_overlay.cxx 2011-05-20 22:23:28 UTC (rev
8702)
@@ -46,7 +46,7 @@
#include <FL/gl.h>
#include <fltk3/Gl_Window.h>
-class shape_window : public Fl_Gl_Window {
+class shape_window : public fltk3::GlWindow {
void draw();
void draw_overlay();
public:
@@ -56,7 +56,7 @@
};
shape_window::shape_window(int x,int y,int w,int h,const char *l) :
-Fl_Gl_Window(x,y,w,h,l) {
+fltk3::GlWindow(x,y,w,h,l) {
sides = overlay_sides = 3;
}
Modified: branches/branch-3.0/test/shape.cxx
===================================================================
--- branches/branch-3.0/test/shape.cxx 2011-05-20 22:00:10 UTC (rev 8701)
+++ branches/branch-3.0/test/shape.cxx 2011-05-20 22:23:28 UTC (rev 8702)
@@ -36,7 +36,7 @@
#include <FL/gl.h>
#include <fltk3/Gl_Window.h>
-class shape_window : public Fl_Gl_Window {
+class shape_window : public fltk3::GlWindow {
void draw();
public:
int sides;
@@ -44,7 +44,7 @@
};
shape_window::shape_window(int x,int y,int w,int h,const char *l) :
-Fl_Gl_Window(x,y,w,h,l) {
+fltk3::GlWindow(x,y,w,h,l) {
sides = 3;
}
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit