Author: matt
Date: 2011-05-27 14:32:16 -0700 (Fri, 27 May 2011)
New Revision: 8747
Log:
123: 'cube' demo compiles and runs using the original FLTK 1 source code in 
wrapper mode. This should proove that the code injection works quite well :-)

Added:
   branches/branch-3.0/test1/cube.cxx
Modified:
   branches/branch-3.0/FL/Fl.H
   branches/branch-3.0/FL/Fl_Gl_Window.H
   branches/branch-3.0/FL/Fl_Group.H
   branches/branch-3.0/FL/Fl_Image.H
   branches/branch-3.0/FL/Fl_Light_Button.H
   branches/branch-3.0/FL/Fl_Radio_Button.H
   branches/branch-3.0/FL/Fl_Radio_Light_Button.H
   branches/branch-3.0/FL/Fl_Slider.H
   branches/branch-3.0/FL/Fl_Valuator.H
   branches/branch-3.0/FL/gl.h
   branches/branch-3.0/fltk3/Valuator.h
   branches/branch-3.0/fltk3/Wrapper.h
   branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
   branches/branch-3.0/src/Fl_Gl_Window.cxx
   branches/branch-3.0/src/Fl_Widget.cxx

Modified: branches/branch-3.0/FL/Fl.H
===================================================================
--- branches/branch-3.0/FL/Fl.H 2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/FL/Fl.H 2011-05-27 21:32:16 UTC (rev 8747)
@@ -29,6 +29,7 @@
 #  define Fl_H
 
 #include <fltk3/run.h>
+#include <fltk3/Widget.h>
 
 #ifdef FLTK_HAVE_CAIRO
 # include <FL/Fl_Cairo.H>
@@ -115,18 +116,33 @@
   static int reload_scheme(); // platform dependent
   static int scrollbar_size();
   static void scrollbar_size(int W);
-  static int wait();
-  static double wait(double time);
-  static int check();
-  static int ready();
 #endif
   
+  static int wait() {
+    return fltk3::wait(); 
+  }
+  
+  static double wait(double time) {
+    return fltk3::wait(time); 
+  }
+  
+  static int check() {
+    return fltk3::check(); 
+  }
+  
+  static int ready() {
+    return fltk3::ready(); 
+  }
+  
   static int run() { 
     return fltk3::run(); 
   }
 
+  static Fl_Widget *readqueue() {
+    return (Fl_Widget*)(fltk3::readqueue()->wrapper());
+  }
+  
 #if 0 // FIXME: 123
-  static Fl_Widget* readqueue();
   static void add_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform 
dependent
   static void repeat_timeout(double t, Fl_Timeout_Handler, void* = 0); // 
platform dependent
   static int  has_timeout(Fl_Timeout_Handler, void* = 0);

Modified: branches/branch-3.0/FL/Fl_Gl_Window.H
===================================================================
--- branches/branch-3.0/FL/Fl_Gl_Window.H       2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/FL/Fl_Gl_Window.H       2011-05-27 21:32:16 UTC (rev 
8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -26,63 +25,31 @@
 //     http://www.fltk.org/str.php
 //
 
-/* \file
-   Fl_Gl_Window widget . */
-
 #ifndef Fl_Gl_Window_H
 #define Fl_Gl_Window_H
 
+#include <fltk3/GlWindow.h>
 #include "Fl_Window.H"
 
 #ifndef GLContext
-/**
-  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.
-  
-  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 Fl_Group, 
-  it is not useful to add other FLTK Widgets as children,
-  unless those widgets are modified to draw using OpenGL calls.
-*/
 class FL_EXPORT Fl_Gl_Window : public Fl_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();
+public:
+  
+  Fl_Gl_Window() { /* empty */ }
 
-  void *overlay;
-  void make_overlay();
-  friend class _Fl_Gl_Overlay;
+  Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0) {
+    _p = new fltk3::GlWindow(X, Y, W, H, l);
+    _p->wrapper(this);
+  }
 
-  static int can_do(int, const int *);
-  int mode(int, const int *);
+#if 0 // FIXME: 123
 
-public:
-
   void show();
   void show(int a, char **b) {Fl_Window::show(a,b);}
   void flush();
@@ -90,148 +57,51 @@
   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...
-     }
-     if (!context_valid()) {
-       ...load textures, etc. ...
-     }
-     ... draw your geometry here ...
-    }
-    \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 Fl_Gl_Window::valid() const 
-  */
+#endif
+  
+  char valid() const {
+    return ((fltk3::GlWindow*)_p)->valid();
+  }
+  
+  void show() const { // FIXME: 123 - this is a virtual function!
+    ((fltk3::GlWindow*)_p)->show();
+  }
+  
+#if 0 // FIXME: 123
+
   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 FL_RGB - RGB color (not indexed)
-    - \c FL_RGB8 - RGB color with at least 8 bits of each color
-    - \c FL_INDEX - Indexed mode
-    - \c FL_SINGLE - not double buffered
-    - \c FL_DOUBLE - double buffered
-    - \c FL_ACCUM - accumulation buffer
-    - \c FL_ALPHA - alpha channel in color
-    - \c FL_DEPTH - depth buffer
-    - \c FL_STENCIL - stencil buffer
-    - \c FL_MULTISAMPLE - multisample antialiasing
-
-    FL_RGB and FL_SINGLE have a value of zero, so they
-    are "on" unless you give FL_INDEX or FL_DOUBLE.
-
-    If the desired combination cannot be done, FLTK will try turning off 
-    FL_MULTISAMPLE.  If this also fails the show() will call 
-    Fl::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 Fl_Widget.H to avoid redundancy.
   virtual Fl_Gl_Window* as_gl_window() {return this;}
-  
   ~Fl_Gl_Window();
-  /**
-    Creates a new Fl_Gl_Window widget using the given size, and label string. 
-    The default boxtype is FL_NO_BOX. The default mode is 
FL_RGB|FL_DOUBLE|FL_DEPTH.
-  */
   Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
-  /**
-    Creates a new Fl_Gl_Window widget using the given position,
-    size, and label string. The default boxtype is FL_NO_BOX. The
-    default mode is FL_RGB|FL_DOUBLE|FL_DEPTH.
-  */
 
-  Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
-    : Fl_Window(X,Y,W,H,l) {init();}
+#endif
 
 protected:
-  /**
-    Draws the Fl_Gl_Window.
 
-    You \e \b must override the draw() method.
-  */
+#if 0 // FIXME: 123
+
   virtual void draw();
+  
+#endif
+  
 };
 
 #endif

Modified: branches/branch-3.0/FL/Fl_Group.H
===================================================================
--- branches/branch-3.0/FL/Fl_Group.H   2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/FL/Fl_Group.H   2011-05-27 21:32:16 UTC (rev 8747)
@@ -52,13 +52,16 @@
 public:
   Fl_Group(int,int,int,int, const char * = 0);
 
+  void begin() {
+    ((fltk3::Group*)_p)->begin();
+  }
+    
   void end() {
     ((fltk3::Group*)_p)->end();
   }
   
 #if 0 // FIXME: 123
   int handle(int);
-  void begin();
   static Fl_Group *current();
   static void current(Fl_Group *g);
   int children() const {return children_;}

Modified: branches/branch-3.0/FL/Fl_Image.H
===================================================================
--- branches/branch-3.0/FL/Fl_Image.H   2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/FL/Fl_Image.H   2011-05-27 21:32:16 UTC (rev 8747)
@@ -39,7 +39,6 @@
 
 namespace fltk3 {
   inline Fl_Image *_3to1_image(Image *w) { return (Fl_Image*)w->wrapper(); }
-  //inline Widget *_1to3_widget(Fl_Widget *w) { return ((fltk3::Widget*)_p); }
 }
 
 class FL_EXPORT Fl_Image : public fltk3::Wrapper {

Modified: branches/branch-3.0/FL/Fl_Light_Button.H
===================================================================
--- branches/branch-3.0/FL/Fl_Light_Button.H    2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/FL/Fl_Light_Button.H    2011-05-27 21:32:16 UTC (rev 
8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -26,31 +25,34 @@
 //     http://www.fltk.org/str.php
 //
 
-/* \file
-   Fl_Light_Button widget . */
-
 #ifndef Fl_Light_Button_H
 #define Fl_Light_Button_H
 
+#include <fltk3/LightButton.h>
 #include "Fl_Button.H"
 
-/**
-  This subclass displays the "on" state by turning on a light, 
-  rather than drawing pushed in.  The shape of the  "light" 
-  is initially set to FL_DOWN_BOX.  The color of the light when
-  on is controlled with selection_color(), which defaults to FL_YELLOW.
 
-  Buttons generate callbacks when they are clicked by the user.  You
-  control exactly when and how by changing the values for type() and when().
-  <P ALIGN=CENTER>\image html Fl_Light_Button.png</P> 
-  \image latex Fl_Light_Button.png "Fl_Light_Button" width=4cm
-*/
 class FL_EXPORT Fl_Light_Button : public Fl_Button {
+  
 protected:
+  
+#if 0 // FIXME: 123
     virtual void draw();
+#endif
+  
 public:
-    virtual int handle(int);
-    Fl_Light_Button(int x,int y,int w,int h,const char *l = 0);
+
+#if 0 // FIXME: 123
+  virtual int handle(int);
+#endif
+  
+  Fl_Light_Button() { /* empty */ }
+  
+  Fl_Light_Button(int x,int y,int w,int h,const char *l = 0) {
+    _p = new fltk3::LightButton(x, y, w, h, l);
+    _p->wrapper(this);
+  }
+  
 };
 
 #endif

Modified: branches/branch-3.0/FL/Fl_Radio_Button.H
===================================================================
--- branches/branch-3.0/FL/Fl_Radio_Button.H    2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/FL/Fl_Radio_Button.H    2011-05-27 21:32:16 UTC (rev 
8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -32,12 +31,21 @@
 #ifndef Fl_Radio_Button_H
 #define Fl_Radio_Button_H
 
+#include <fltk3/RadioButton.h>
 #include "Fl_Button.H"
 
+
 class FL_EXPORT Fl_Radio_Button : public Fl_Button {
+  
 public:
-    Fl_Radio_Button(int x,int y,int w,int h,const char *l=0)
-       : Fl_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
+  
+  Fl_Radio_Button() { /* empty */ }
+  
+  Fl_Radio_Button(int x,int y,int w,int h,const char *l=0) {
+    _p = new fltk3::RadioLightButton(x, y, w, h, l);
+    _p->wrapper(this);
+  }
+
 };
 
 #endif

Modified: branches/branch-3.0/FL/Fl_Radio_Light_Button.H
===================================================================
--- branches/branch-3.0/FL/Fl_Radio_Light_Button.H      2011-05-27 19:37:55 UTC 
(rev 8746)
+++ branches/branch-3.0/FL/Fl_Radio_Light_Button.H      2011-05-27 21:32:16 UTC 
(rev 8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -26,18 +25,24 @@
 //     http://www.fltk.org/str.php
 //
 
-/* \file
-   Fl_Radio_Light_Button widget . */
-
 #ifndef Fl_Radio_Light_Button_H
 #define Fl_Radio_Light_Button_H
 
+#include <fltk3/RadioLightButton.h>
 #include "Fl_Light_Button.H"
 
+
 class FL_EXPORT Fl_Radio_Light_Button : public Fl_Light_Button {
+  
 public:
-    Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0)
-       : Fl_Light_Button(X,Y,W,H,l) {type(FL_RADIO_BUTTON);}
+  
+  Fl_Radio_Light_Button() { /* blank */ }
+  
+  Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0) {
+    _p = new fltk3::RadioLightButton(X, Y, W, H, l);
+    _p->wrapper(this);
+  }
+  
 };
 
 #endif

Modified: branches/branch-3.0/FL/Fl_Slider.H
===================================================================
--- branches/branch-3.0/FL/Fl_Slider.H  2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/FL/Fl_Slider.H  2011-05-27 21:32:16 UTC (rev 8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -26,17 +25,12 @@
 //     http://www.fltk.org/str.php
 //
 
-/* \file
-   Fl_Slider widget . */
-
 #ifndef Fl_Slider_H
 #define Fl_Slider_H
 
-#ifndef Fl_Valuator_H
+#include <fltk3/Slider.h>
 #include "Fl_Valuator.H"
-#endif
 
-// values for type(), lowest bit indicate horizontal:
 #define FL_VERT_SLIDER         0
 #define FL_HOR_SLIDER          1
 #define FL_VERT_FILL_SLIDER    2
@@ -44,74 +38,49 @@
 #define FL_VERT_NICE_SLIDER    4
 #define FL_HOR_NICE_SLIDER     5
 
-/**
-  The Fl_Slider widget contains a sliding knob inside a box. It if
-  often used as a scrollbar.  Moving the box all the way to the
-  top/left sets it to the minimum(), and to the bottom/right to the
-  maximum().  The minimum() may be greater than the maximum() to
-  reverse the slider direction.
 
-  Use void Fl_Widget::type(int) to set how the slider is drawn, 
-  which can be one of the following:
-  
-  \li FL_VERTICAL - Draws a vertical slider (this is the default).
-  \li FL_HORIZONTAL - Draws a horizontal slider.
-  \li FL_VERT_FILL_SLIDER - Draws a filled vertical slider,
-      useful as a progress or value meter.
-  \li FL_HOR_FILL_SLIDER - Draws a filled horizontal  slider,
-      useful as a progress or value meter.
-  \li FL_VERT_NICE_SLIDER - Draws a vertical slider with  a nice
-      looking control knob.
-  \li FL_HOR_NICE_SLIDER - Draws a horizontal slider with  a
-      nice looking control knob.
-
-  \image html  slider.png 
-  \image latex slider.png "Fl_Slider" width=4cm
-*/
 class FL_EXPORT Fl_Slider : public Fl_Valuator {
 
-  float slider_size_;
-  uchar slider_;
-  void _Fl_Slider();
-  void draw_bg(int, int, int, int);
-
+#if 0 // FIXME: 123
+  
 protected:
 
   // these allow subclasses to put the slider in a smaller area:
   void draw(int, int, int, int);
   int handle(int, int, int, int, int);
   void draw();
-
+  
+#endif
+  
 public:
 
-  int handle(int);
-  Fl_Slider(int X,int Y,int W,int H, const char *L = 0);
-  Fl_Slider(uchar t,int X,int Y,int W,int H, const char *L);
+  Fl_Slider() { /* empty */ }
+  
+  Fl_Slider(int X,int Y,int W,int H, const char *L = 0) {
+    _p = new fltk3::Slider(X, Y, W, H, L);
+    _p->wrapper(this);
+  }
+  
+  Fl_Slider(uchar t, int X,int Y,int W,int H, const char *L = 0) {
+    _p = new fltk3::Slider(t, X, Y, W, H, L);
+    _p->wrapper(this);
+  }
+  
+  void bounds(double a, double b) {
+    ((fltk3::Slider*)_p)->bounds(a, b);
+  }
+  
+#if 0 // FIXME: 123
 
+  ivirtual nt handle(int);
   int scrollvalue(int pos,int size,int first,int total);
-  void bounds(double a, double b);
-
-  /**
-    Get the dimensions of the moving piece of slider.
-  */
   float slider_size() const {return slider_size_;}
-
-  /**
-    Set the dimensions of the moving piece of slider. This is
-    the fraction of the size of the entire widget. If you set this
-    to 1 then the slider cannot move.  The default value is .08.
-
-    For the "fill" sliders this is the size of the area around the
-    end that causes a drag effect rather than causing the slider to
-    jump to the mouse.
-  */
   void slider_size(double v);
-
-  /** Gets the slider box type. */
   Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
-
-  /** Sets the slider box type. */
   void slider(Fl_Boxtype c) {slider_ = c;}
+
+#endif
+
 };
 
 #endif

Modified: branches/branch-3.0/FL/Fl_Valuator.H
===================================================================
--- branches/branch-3.0/FL/Fl_Valuator.H        2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/FL/Fl_Valuator.H        2011-05-27 21:32:16 UTC (rev 
8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -32,110 +31,73 @@
 #ifndef Fl_Valuator_H
 #define Fl_Valuator_H
 
-#ifndef Fl_Widget_H
+#include <fltk3/Valuator.h>
 #include "Fl_Widget.H"
-#endif
 
-// shared type() values for classes that work in both directions:
-#define FL_VERTICAL            0 ///< The valuator can work vertically
-#define FL_HORIZONTAL          1 ///< The valuator can work horizontally
+#define FL_VERTICAL            0
+#define FL_HORIZONTAL          1
 
-/**
-  The Fl_Valuator class controls a single floating-point value
-  and provides a consistent interface to set the value, range, and step,
-  and insures that callbacks are done the same for every object.
-  <P>There are probably more of these classes in FLTK than any others:
-  <P ALIGN=CENTER>\image html  valuators.png</P> 
-  \image latex   valuators.png "Valuators derived from Fl_Valuators" width=10cm
-  <P>In the above diagram each box surrounds an actual subclass.  These
-  are further differentiated by setting the type() of the widget t
-  o the symbolic value labeling the widget.  
-  The ones labelled "0" are the default versions with a type(0).  
-  For consistency the symbol FL_VERTICAL is defined as zero.
-*/
+
 class FL_EXPORT Fl_Valuator : public Fl_Widget {
 
-  double value_;
-  double previous_value_;
-  double min, max; // truncates to this range *after* rounding
-  double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
-
 protected:
-  /** Tells if the valuator is an FL_HORIZONTAL one */
+
+  Fl_Valuator() { /* empty */ }
+  
+  Fl_Valuator(int X, int Y, int W, int H, const char* L) {
+    _p = new fltk3::Valuator(X, Y, W, H, L);
+    _p->wrapper(this);
+  }
+
+#if 0 // FIXME: 123
+  
   int horizontal() const {return type()& FL_HORIZONTAL;}
   Fl_Valuator(int X, int Y, int W, int H, const char* L);
-
-  /** Gets the previous floating point value before an event changed it */
   double previous_value() const {return previous_value_;}
-  /** Stores the current value in the previous value */
   void handle_push() {previous_value_ = value_;}
   double softclamp(double);
   void handle_drag(double newvalue);
-  void handle_release(); // use drag() value
-  virtual void value_damage(); // cause damage() due to value() changing
-  /** Sets the current floating point value. */
+  void handle_release();
+  virtual void value_damage();
   void set_value(double v) {value_ = v;}
 
+#endif
+  
 public:
 
-    /**    Sets the minimum (a) and maximum (b) values for the valuator 
widget. */
-    void bounds(double a, double b) {min=a; max=b;}
-    /**    Gets the minimum value for the valuator.  */
-    double minimum() const {return min;}
-    /**    Sets the minimum value for the valuator.  */
-    void minimum(double a) {min = a;}
-    /**    Gets the maximum value for the valuator.  */
-    double maximum() const {return max;}
-    /**    Sets the maximum value for the valuator.  */
-    void maximum(double a) {max = a;}
-  /**
-    Sets the minimum and maximum values for the valuator. When
-    the user manipulates the widget, the value is limited to this
-    range. This clamping is done <I>after</I> rounding to the step
-    value (this makes a difference if the range is not a multiple of
-    the step).
-    
-    <P>The minimum may be greater than the maximum. This has the
-    effect of "reversing" the object so the larger values
-    are in the opposite direction. This also switches which end of
-    the filled sliders is filled.</P>
-    
-    <P>Some widgets consider this a "soft" range.  This
-    means they will stop at the range, but if the user releases and
-    grabs the control again and tries to move it further, it is
-    allowed.</P>
-    
-    <P>The range may affect the display. You must redraw()
-    the widget after changing the range.
-  */
+#if 0 // FIXME: 123
+
+  void bounds(double a, double b) {min=a; max=b;}
+  double minimum() const {return min;}
+  void minimum(double a) {min = a;}
+  double maximum() const {return max;}
+  void maximum(double a) {max = a;}
   void range(double a, double b) {min = a; max = b;}
-  /**    See double Fl_Valuator::step() const   */
   void step(int a) {A = a; B = 1;}
-  /**    See double Fl_Valuator::step() const   */
   void step(double a, int b) {A = a; B = b;}
   void step(double s);
-  /**
-    Gets or sets the step value. As the user moves the mouse the
-    value is rounded to the nearest multiple of the step value. This
-    is done <I>before</I> clamping it to the range. For most widgets
-    the default step is zero.
-    
-    <P>For precision the step is stored as the ratio of two
-    integers, A/B. You can set these integers directly. Currently
-    setting a floating point value sets the nearest A/1 or 1/B value
-    possible.
-  */
   double step() const {return A/B;}
   void precision(int);
 
-  /** Gets the floating point(double) value. See int value(double) */
-  double value() const {return value_;}
-  int value(double);
+#endif
 
+  double value() const {
+    return ((fltk3::Valuator*)_p)->value();
+  }
+  
+  int value(double v) {
+    return ((fltk3::Valuator*)_p)->value(v);
+  }
+
+#if 0 // FIXME: 123
+  
   virtual int format(char*);
-  double round(double); // round to nearest multiple of step
-  double clamp(double); // keep in range
-  double increment(double, int); // add n*step to value
+  double round(double);
+  double clamp(double);
+  double increment(double, int);
+
+#endif
+
 };
 
 #endif

Modified: branches/branch-3.0/FL/gl.h
===================================================================
--- branches/branch-3.0/FL/gl.h 2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/FL/gl.h 2011-05-27 21:32:16 UTC (rev 8747)
@@ -1,4 +1,3 @@
-#error header has not been ported to 3.0 yet
 //
 // "$Id$"
 //
@@ -70,6 +69,8 @@
 #    include <GL/gl.h>
 #  endif
 
+#if 0 // FIXME: 123
+
 FL_EXPORT void gl_start();
 FL_EXPORT void gl_finish();
 
@@ -106,6 +107,8 @@
 
 FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, 
int ld=0);
 
+#endif
+
 #endif // !FL_gl_H
 
 //

Modified: branches/branch-3.0/fltk3/Valuator.h
===================================================================
--- branches/branch-3.0/fltk3/Valuator.h        2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/fltk3/Valuator.h        2011-05-27 21:32:16 UTC (rev 
8747)
@@ -33,6 +33,8 @@
 
 #include "Widget.h"
 
+class Fl_Valuator;
+
 namespace fltk3 {
   
   // shared type() values for classes that work in both directions:
@@ -54,6 +56,8 @@
    */
   class FLTK3_EXPORT Valuator : public fltk3::Widget {
     
+    friend class ::Fl_Valuator;
+    
     double value_;
     double previous_value_;
     double min, max; // truncates to this range *after* rounding

Modified: branches/branch-3.0/fltk3/Wrapper.h
===================================================================
--- branches/branch-3.0/fltk3/Wrapper.h 2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/fltk3/Wrapper.h 2011-05-27 21:32:16 UTC (rev 8747)
@@ -108,9 +108,27 @@
   class WidgetWrapper : public Wrapper {
   public:
     virtual ~WidgetWrapper() {}
-    FLTK3_WRAPPER_VCALLS_OBJECT(draw(),
-                                draw(),
-                                Draw)
+    //FLTK3_WRAPPER_VCALLS_OBJECT(draw(),
+    //                            draw(),
+    //                            Draw)
+    
+    virtual void draw() {
+      if ( pVCalls & pVCallWidgetDraw ) {
+        // if my flag is set, we are called from the object that we wrap.
+        // Tell the caller that this function was not overridden by clearing 
+        // the flag
+        pVCalls &= ~pVCallWidgetDraw;
+      } else {
+        // if my flag is not set, we were called from the wrapper side, 
probably
+        // from the function overriding us. Set our flag and call the original
+        // function
+        pVCalls |= pVCallWidgetDraw;
+        ((fltk3::Widget*)_p)->draw();
+        pVCalls &= ~pVCallWidgetDraw;
+      }
+    }
+
+    
     FLTK3_WRAPPER_VCALLS_OBJECT_INT(handle(int event),
                                     handle(event),
                                     Handle)

Modified: branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
===================================================================
--- branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj       
2011-05-27 19:37:55 UTC (rev 8746)
+++ branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj       
2011-05-27 21:32:16 UTC (rev 8747)
@@ -473,6 +473,19 @@
                C910D4FD13901FC1003643F5 /* fltk.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
                C910D4FF13901FC1003643F5 /* fltk.framework in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
                C910D5091390206E003643F5 /* pixmap.cxx in Sources */ = {isa = 
PBXBuildFile; fileRef = C910D5081390206E003643F5 /* pixmap.cxx */; };
+               C910D51313903794003643F5 /* fltk.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
+               C910D51413903794003643F5 /* fltk_gl.framework in Frameworks */ 
= {isa = PBXBuildFile; fileRef = EA8E6EC230301E597B9D9AED /* fltk_gl.framework 
*/; };
+               C910D51513903794003643F5 /* OpenGL.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 05376DC900B2C885B847EA36 /* OpenGL.framework */; 
};
+               C910D51613903794003643F5 /* AGL.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = AACB2F49A22C3FB3E837EC61 /* AGL.framework */; };
+               C910D51813903794003643F5 /* fltk.framework in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
+               C910D51913903794003643F5 /* fltk_gl.framework in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = EA8E6EC230301E597B9D9AED /* fltk_gl.framework 
*/; };
+               C910D52313903856003643F5 /* cube.cxx in Sources */ = {isa = 
PBXBuildFile; fileRef = C910D5211390384D003643F5 /* cube.cxx */; };
+               C910D53113904487003643F5 /* Fl_Gl_Window.H in Headers */ = {isa 
= PBXBuildFile; fileRef = C910D5251390447B003643F5 /* Fl_Gl_Window.H */; };
+               C910D53213904487003643F5 /* gl_draw.H in Headers */ = {isa = 
PBXBuildFile; fileRef = C910D5261390447B003643F5 /* gl_draw.H */; };
+               C910D53313904487003643F5 /* gl.h in Headers */ = {isa = 
PBXBuildFile; fileRef = C910D5271390447B003643F5 /* gl.h */; };
+               C910D53413904487003643F5 /* gl2opengl.h in Headers */ = {isa = 
PBXBuildFile; fileRef = C910D5281390447B003643F5 /* gl2opengl.h */; };
+               C910D53513904487003643F5 /* glu.h in Headers */ = {isa = 
PBXBuildFile; fileRef = C910D5291390447B003643F5 /* glu.h */; };
+               C910D53613904487003643F5 /* glut.H in Headers */ = {isa = 
PBXBuildFile; fileRef = C910D52A1390447B003643F5 /* glut.H */; };
                C915E2CB1382D16E00C5FD27 /* fltk.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
                C915E2CD1382D16E00C5FD27 /* fltk.framework in CopyFiles */ = 
{isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; };
                C915E2DA1382D8ED00C5FD27 /* Enumerations.H in Headers */ = {isa 
= PBXBuildFile; fileRef = 84CE79448708855561FEE498 /* Enumerations.H */; };
@@ -1604,6 +1617,18 @@
                        );
                        script = "export 
DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ${INPUT_FILE_DIR} && 
${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}";
                };
+               C910D51A13903794003643F5 /* PBXBuildRule */ = {
+                       isa = PBXBuildRule;
+                       compilerSpec = com.apple.compilers.proxy.script;
+                       filePatterns = "*.fl";
+                       fileType = pattern.proxy;
+                       isEditable = 1;
+                       outputFiles = (
+                               "${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.cxx",
+                               "${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.h",
+                       );
+                       script = "export 
DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ${INPUT_FILE_DIR} && 
${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}";
+               };
                C915E2CE1382D16E00C5FD27 /* PBXBuildRule */ = {
                        isa = PBXBuildRule;
                        compilerSpec = com.apple.compilers.proxy.script;
@@ -2869,6 +2894,20 @@
                        remoteGlobalIDString = A57FDE871C99A52BEEDEE68C;
                        remoteInfo = fltk;
                };
+               C910D50C13903794003643F5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 4BF1A7FFEACF5F31B4127482 /* Project 
object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = A57FDE871C99A52BEEDEE68C;
+                       remoteInfo = fltk;
+               };
+               C910D50E13903794003643F5 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = 4BF1A7FFEACF5F31B4127482 /* Project 
object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C13484C4A9262C58D8FA7242;
+                       remoteInfo = fltk_gl;
+               };
                C915E2C61382D16E00C5FD27 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                        containerPortal = 4BF1A7FFEACF5F31B4127482 /* Project 
object */;
@@ -3746,6 +3785,17 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               C910D51713903794003643F5 /* CopyFiles */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 2147483647;
+                       dstPath = "";
+                       dstSubfolderSpec = 10;
+                       files = (
+                               C910D51813903794003643F5 /* fltk.framework in 
CopyFiles */,
+                               C910D51913903794003643F5 /* fltk_gl.framework 
in CopyFiles */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C915E2CC1382D16E00C5FD27 /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 2147483647;
@@ -4475,6 +4525,14 @@
                C8AE10A8DDF53B8B27E3215A /* Fl_Choice.H */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name 
= Fl_Choice.H; path = ../../FL/Fl_Choice.H; sourceTree = SOURCE_ROOT; };
                C910D50413901FC1003643F5 /* pixmap1.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = pixmap1.app; sourceTree = BUILT_PRODUCTS_DIR; };
                C910D5081390206E003643F5 /* pixmap.cxx */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = pixmap.cxx; path = ../../test1/pixmap.cxx; sourceTree = "<group>"; };
+               C910D51E13903794003643F5 /* cube1.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = cube1.app; sourceTree = BUILT_PRODUCTS_DIR; };
+               C910D5211390384D003643F5 /* cube.cxx */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = cube.cxx; path = ../../test1/cube.cxx; sourceTree = "<group>"; };
+               C910D5251390447B003643F5 /* Fl_Gl_Window.H */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name 
= Fl_Gl_Window.H; path = ../../FL/Fl_Gl_Window.H; sourceTree = "<group>"; };
+               C910D5261390447B003643F5 /* gl_draw.H */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name 
= gl_draw.H; path = ../../FL/gl_draw.H; sourceTree = "<group>"; };
+               C910D5271390447B003643F5 /* gl.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl.h; path = 
../../FL/gl.h; sourceTree = "<group>"; };
+               C910D5281390447B003643F5 /* gl2opengl.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
gl2opengl.h; path = ../../FL/gl2opengl.h; sourceTree = "<group>"; };
+               C910D5291390447B003643F5 /* glu.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glu.h; path = 
../../FL/glu.h; sourceTree = "<group>"; };
+               C910D52A1390447B003643F5 /* glut.H */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name 
= glut.H; path = ../../FL/glut.H; sourceTree = "<group>"; };
                C915E2D21382D16E00C5FD27 /* hello1.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = hello1.app; sourceTree = BUILT_PRODUCTS_DIR; };
                C915E2D71382D83A00C5FD27 /* hello.cxx */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = hello.cxx; path = ../../test1/hello.cxx; sourceTree = "<group>"; };
                C915E36A1383FA8800C5FD27 /* hello2.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = hello2.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -5448,6 +5506,17 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               C910D51213903794003643F5 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C910D51313903794003643F5 /* fltk.framework in 
Frameworks */,
+                               C910D51413903794003643F5 /* fltk_gl.framework 
in Frameworks */,
+                               C910D51513903794003643F5 /* OpenGL.framework in 
Frameworks */,
+                               C910D51613903794003643F5 /* AGL.framework in 
Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C915E2CA1382D16E00C5FD27 /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
@@ -6209,6 +6278,7 @@
                        isa = PBXGroup;
                        children = (
                                7E097C61B5952D56DFB93ECF /* Headers */,
+                               C910D5241390441F003643F5 /* Headers1 */,
                                27C65F509527076EB26E9C0F /* Fl_Gl_Choice.cxx */,
                                A7A692EB67C5CBE35D4A4B5C /* 
Fl_Gl_Device_Plugin.cxx */,
                                8E81EE378D475F9CFDE296C9 /* Fl_Gl_Overlay.cxx 
*/,
@@ -6640,6 +6710,27 @@
                        name = pixmap1;
                        sourceTree = "<group>";
                };
+               C910D520139037AD003643F5 /* cube */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C910D5211390384D003643F5 /* cube.cxx */,
+                       );
+                       name = cube;
+                       sourceTree = "<group>";
+               };
+               C910D5241390441F003643F5 /* Headers1 */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C910D5251390447B003643F5 /* Fl_Gl_Window.H */,
+                               C910D5261390447B003643F5 /* gl_draw.H */,
+                               C910D5271390447B003643F5 /* gl.h */,
+                               C910D5281390447B003643F5 /* gl2opengl.h */,
+                               C910D5291390447B003643F5 /* glu.h */,
+                               C910D52A1390447B003643F5 /* glut.H */,
+                       );
+                       name = Headers1;
+                       sourceTree = "<group>";
+               };
                C915E2D51382D1AC00C5FD27 /* hello1 */ = {
                        isa = PBXGroup;
                        children = (
@@ -6651,6 +6742,7 @@
                C915E2D61382D1C600C5FD27 /* Test1 */ = {
                        isa = PBXGroup;
                        children = (
+                               C910D520139037AD003643F5 /* cube */,
                                C915E2D51382D1AC00C5FD27 /* hello1 */,
                                C910D50713901FE4003643F5 /* pixmap1 */,
                        );
@@ -7198,6 +7290,7 @@
                                C915E2D21382D16E00C5FD27 /* hello1.app */,
                                C915E36A1383FA8800C5FD27 /* hello2.app */,
                                C910D50413901FC1003643F5 /* pixmap1.app */,
+                               C910D51E13903794003643F5 /* cube1.app */,
                        );
                        name = Products;
                        sourceTree = "<group>";
@@ -7591,6 +7684,12 @@
                                C915E3581382D8ED00C5FD27 /* x.H in Headers */,
                                C915E3591382D8ED00C5FD27 /* Fl_Paged_Device.H 
in Headers */,
                                C965812A1386B8EF00DF7523 /* show_colormap.h in 
Headers */,
+                               C910D53113904487003643F5 /* Fl_Gl_Window.H in 
Headers */,
+                               C910D53213904487003643F5 /* gl_draw.H in 
Headers */,
+                               C910D53313904487003643F5 /* gl.h in Headers */,
+                               C910D53413904487003643F5 /* gl2opengl.h in 
Headers */,
+                               C910D53513904487003643F5 /* glu.h in Headers */,
+                               C910D53613904487003643F5 /* glut.H in Headers 
*/,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -8948,6 +9047,27 @@
                        productReference = C910D50413901FC1003643F5 /* 
pixmap1.app */;
                        productType = "com.apple.product-type.application";
                };
+               C910D50A13903794003643F5 /* cube1 */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C910D51B13903794003643F5 /* 
Build configuration list for PBXNativeTarget "cube1" */;
+                       buildPhases = (
+                               C910D50F13903794003643F5 /* Resources */,
+                               C910D51013903794003643F5 /* Sources */,
+                               C910D51213903794003643F5 /* Frameworks */,
+                               C910D51713903794003643F5 /* CopyFiles */,
+                       );
+                       buildRules = (
+                               C910D51A13903794003643F5 /* PBXBuildRule */,
+                       );
+                       dependencies = (
+                               C910D50B13903794003643F5 /* PBXTargetDependency 
*/,
+                               C910D50D13903794003643F5 /* PBXTargetDependency 
*/,
+                       );
+                       name = cube1;
+                       productName = cube;
+                       productReference = C910D51E13903794003643F5 /* 
cube1.app */;
+                       productType = "com.apple.product-type.application";
+               };
                C915E2C41382D16E00C5FD27 /* hello1 */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = C915E2CF1382D16E00C5FD27 /* 
Build configuration list for PBXNativeTarget "hello1" */;
@@ -9393,6 +9513,7 @@
                                C915E2C41382D16E00C5FD27 /* hello1 */,
                                C915E35C1383FA8800C5FD27 /* hello2 */,
                                C910D4F613901FC1003643F5 /* pixmap1 */,
+                               C910D50A13903794003643F5 /* cube1 */,
                        );
                };
 /* End PBXProject section */
@@ -9856,6 +9977,13 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               C910D50F13903794003643F5 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C915E2C71382D16E00C5FD27 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
@@ -10710,6 +10838,14 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
+               C910D51013903794003643F5 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C910D52313903856003643F5 /* cube.cxx in Sources 
*/,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C915E2C81382D16E00C5FD27 /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
@@ -11593,6 +11729,16 @@
                        target = A57FDE871C99A52BEEDEE68C /* fltk */;
                        targetProxy = C910D4F813901FC1003643F5 /* 
PBXContainerItemProxy */;
                };
+               C910D50B13903794003643F5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = A57FDE871C99A52BEEDEE68C /* fltk */;
+                       targetProxy = C910D50C13903794003643F5 /* 
PBXContainerItemProxy */;
+               };
+               C910D50D13903794003643F5 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C13484C4A9262C58D8FA7242 /* fltk_gl */;
+                       targetProxy = C910D50E13903794003643F5 /* 
PBXContainerItemProxy */;
+               };
                C915E2C51382D16E00C5FD27 /* PBXTargetDependency */ = {
                        isa = PBXTargetDependency;
                        target = A57FDE871C99A52BEEDEE68C /* fltk */;
@@ -15820,6 +15966,69 @@
                        };
                        name = Release;
                };
+               C910D51C13903794003643F5 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = fltk.pch;
+                               GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1";
+                               HEADER_SEARCH_PATHS = (
+                                       ../../ide/XCode3/,
+                                       ../../,
+                                       ../../png,
+                                       ../../jpeg,
+                               );
+                               INFOPLIST_FILE = "plists/cube-Info.plist";
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               OTHER_LDFLAGS = (
+                                       "-framework",
+                                       Cocoa,
+                               );
+                               PRODUCT_NAME = cube1;
+                               SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
+                               WARNING_CFLAGS = (
+                                       "-Wno-format-security",
+                                       "-Wall",
+                               );
+                       };
+                       name = Debug;
+               };
+               C910D51D13903794003643F5 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = fltk.pch;
+                               GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1";
+                               HEADER_SEARCH_PATHS = (
+                                       ../../ide/XCode3/,
+                                       ../../,
+                                       ../../png,
+                                       ../../jpeg,
+                               );
+                               INFOPLIST_FILE = "plists/cube-Info.plist";
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               OTHER_LDFLAGS = (
+                                       "-framework",
+                                       Cocoa,
+                               );
+                               PRODUCT_NAME = cube1;
+                               SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
+                               WARNING_CFLAGS = (
+                                       "-Wno-format-security",
+                                       "-Wall",
+                               );
+                       };
+                       name = Release;
+               };
                C915E2D01382D16E00C5FD27 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
@@ -17357,6 +17566,15 @@
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Debug;
                };
+               C910D51B13903794003643F5 /* Build configuration list for 
PBXNativeTarget "cube1" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C910D51C13903794003643F5 /* Debug */,
+                               C910D51D13903794003643F5 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Debug;
+               };
                C915E2CF1382D16E00C5FD27 /* Build configuration list for 
PBXNativeTarget "hello1" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (

Modified: branches/branch-3.0/src/Fl_Gl_Window.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Gl_Window.cxx    2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/src/Fl_Gl_Window.cxx    2011-05-27 21:32:16 UTC (rev 
8747)
@@ -32,6 +32,7 @@
 
 static int temp = fl_gl_load_plugin;
 
+#include <fltk3/Wrapper.h>
 #include <fltk3/run.h>
 #include <fltk3/x.h>
 #ifdef __APPLE__
@@ -532,7 +533,31 @@
   buffers are swapped after this function is completed.
 */
 void fltk3::GlWindow::draw() {
-    fltk3::fatal("fltk3::GlWindow::draw() *must* be overriden. Please refer to 
the documentation.");
+  //FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  
+  if (pWrapper) { 
+    // We only do this tests if there is a wrapper connected to me.
+    if ( pWrapper->pVCalls & Wrapper::pVCallWidgetDraw ) { 
+      // if my flag is set, we are being called from the wrapper, so we simply
+      // continue with the original code. The wrapper mus clear the flag.
+    } else { 
+      // if my flag is clear, we are called from the core. So lets set the 
+      // flag and call the wrapper.
+      pWrapper->pVCalls |= Wrapper::pVCallWidgetDraw; 
+      ((WidgetWrapper*)pWrapper)->draw(); 
+      if ( (pWrapper->pVCalls & Wrapper::pVCallWidgetDraw) ) {
+        // If the flag is still set, the function was overridden in the 
wrapper.
+        // Clear the flag for the next call and abort.
+        pWrapper->pVCalls &= ~Wrapper::pVCallWidgetDraw; 
+        return; 
+      } else {
+        // If the wrapper returns with the flag cleared, the default code was 
+        // called and we continue with the original code.
+      }
+    } 
+  }
+  
+  fltk3::fatal("fltk3::GlWindow::draw() *must* be overriden. Please refer to 
the documentation.");
 }
 
 

Modified: branches/branch-3.0/src/Fl_Widget.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Widget.cxx       2011-05-27 19:37:55 UTC (rev 
8746)
+++ branches/branch-3.0/src/Fl_Widget.cxx       2011-05-27 21:32:16 UTC (rev 
8747)
@@ -347,7 +347,19 @@
 /** Draw a box.
  */
 void fltk3::Widget::draw() {
-  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  //FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  
+  if (pWrapper) { 
+    if ( pWrapper->pVCalls & Wrapper::pVCallWidgetDraw ) { 
+    } else { 
+      pWrapper->pVCalls |= Wrapper::pVCallWidgetDraw; 
+      ((WidgetWrapper*)pWrapper)->draw(); 
+      if ( (pWrapper->pVCalls & Wrapper::pVCallWidgetDraw) ) 
+        return; 
+    } 
+    pWrapper->pVCalls &= ~Wrapper::pVCallWidgetDraw; 
+  }
+
   draw_box();
   draw_label();
 }

Added: branches/branch-3.0/test1/cube.cxx
===================================================================
--- branches/branch-3.0/test1/cube.cxx                          (rev 0)
+++ branches/branch-3.0/test1/cube.cxx  2011-05-27 21:32:16 UTC (rev 8747)
@@ -0,0 +1,235 @@
+//
+// "$Id: cube.cxx 8033 2010-12-15 12:11:16Z AlbrechtS $"
+//
+// Another forms test program for the Fast Light Tool Kit (FLTK).
+//
+// Modified to have 2 cubes to test multiple OpenGL contexts
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Radio_Light_Button.H>
+#include <FL/Fl_Slider.H>
+#include <stdlib.h>
+
+#if !HAVE_GL
+class cube_box : public Fl_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){
+      label("This demo does\nnot work without GL");
+  }
+};
+#else
+
+#include <FL/Fl_Gl_Window.H>
+#include <FL/gl.h>
+
+class cube_box : public Fl_Gl_Window {
+  void draw();
+#if 0 // FIXME: 123
+  int handle(int);
+#endif
+public:
+  double lasttime;
+  int wire;
+  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;}
+};
+
+
+/* The cube definition */
+float v0[3] = {0.0, 0.0, 0.0};
+float v1[3] = {1.0, 0.0, 0.0};
+float v2[3] = {1.0, 1.0, 0.0};
+float v3[3] = {0.0, 1.0, 0.0};
+float v4[3] = {0.0, 0.0, 1.0};
+float v5[3] = {1.0, 0.0, 1.0};
+float v6[3] = {1.0, 1.0, 1.0};
+float v7[3] = {0.0, 1.0, 1.0};
+
+#define v3f(x) glVertex3fv(x)
+
+void drawcube(int wire) {
+/* Draw a colored cube */
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(0,0,255);
+  v3f(v0); v3f(v1); v3f(v2); v3f(v3);
+  glEnd();
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(0,255,255); v3f(v4); v3f(v5); v3f(v6); v3f(v7);
+  glEnd();
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(255,0,255); v3f(v0); v3f(v1); v3f(v5); v3f(v4);
+  glEnd();
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(255,255,0); v3f(v2); v3f(v3); v3f(v7); v3f(v6);
+  glEnd();
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(0,255,0); v3f(v0); v3f(v4); v3f(v7); v3f(v3);
+  glEnd();
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glColor3ub(255,0,0); v3f(v1); v3f(v2); v3f(v6); v3f(v5);
+  glEnd();
+}
+
+void cube_box::draw() {
+  lasttime = lasttime+speed;
+  if (!valid()) {
+    glLoadIdentity();
+    glViewport(0,0,w(),h());
+    glEnable(GL_DEPTH_TEST);
+    glFrustum(-1,1,-1,1,2,10000);
+    glTranslatef(0,0,-10);
+    // FIXME: gl_font(FL_HELVETICA_BOLD, 16 );
+  }
+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+  glPushMatrix();
+  glRotatef(float(lasttime*1.6),0,0,1);
+  glRotatef(float(lasttime*4.2),1,0,0);
+  glRotatef(float(lasttime*2.3),0,1,0);
+  glTranslatef(-1.0, 1.2f, -1.5);
+  glScalef(float(size),float(size),float(size));
+  drawcube(wire);
+  glPopMatrix();
+  // FIXME: gl_color(FL_GRAY);
+  glDisable(GL_DEPTH_TEST);
+  // FIXME: gl_draw(wire ? "Cube: wire" : "Cube: flat", -4.5f, -4.5f );
+  glEnable(GL_DEPTH_TEST);
+}
+
+#if 0 // FIXME: 123
+
+int cube_box::handle(int e) {
+  switch (e) {
+  case FL_ENTER: cursor(FL_CURSOR_CROSS); break;
+  case FL_LEAVE: cursor(FL_CURSOR_DEFAULT); break;
+  }
+  return Fl_Gl_Window::handle(e);
+}
+
+#endif
+
+#endif
+
+Fl_Window *form;
+Fl_Slider *speed, *size;
+Fl_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 Fl_Slider(FL_VERT_SLIDER,390,90,40,220,"Speed");
+  size = new Fl_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");
+  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(),
+                        cube->w(),size->h(),0);
+  form->resizable(b);
+  b->hide();
+  form->end();
+}
+
+// added to demo printing
+#if 0 // FIXME: 123
+#include <FL/Fl_Sys_Menu_Bar.H>
+#include <FL/Fl_Printer.H>
+#endif
+
+void print_cb(Fl_Widget *w, void *data)
+{
+#if 0 // FIXME: 123
+  Fl_Printer printer;
+  Fl_Window *win = Fl::first_window();
+  if(!win) return;
+  if( printer.start_job(1) ) return;
+  if( printer.start_page() ) return;
+  printer.scale(0.5,0.5);
+  printer.print_widget( win );
+  printer.end_page();
+  printer.end_job();
+#endif
+}
+// end of printing demo
+
+int main(int argc, char **argv) {
+  makeform(argv[0]);
+  // added to demo printing
+  form->begin();
+#if 0 // FIXME: 123
+  static Fl_Menu_Item  items[] = {
+    { "Print", 0, 0, 0, FL_SUBMENU },
+    { "Print window", 0, print_cb, 0, 0 },
+    { 0 },
+    { 0 }
+  };
+  Fl_Sys_Menu_Bar *menubar_;
+  menubar_ = new Fl_Sys_Menu_Bar(0, 0, 60, 20);
+  menubar_->box(FL_FLAT_BOX);
+  menubar_->menu(items);
+  form->end();
+  // end of printing demo
+#endif
+  speed->bounds(4,0);
+  speed->value(cube->speed = cube2->speed = 1.0);
+  size->bounds(4,0.01);
+  size->value(cube->size = cube2->size = 1.0);
+  flat->value(1); cube->wire = 0; cube2->wire = 1;
+  form->label("cube");
+  form->show(argc,argv);
+  cube->show();
+  cube2->show();
+  for (;;) {
+    if (form->visible() && speed->value())
+      {if (!Fl::check()) break;}       // returns immediately
+    else
+      {if (!Fl::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;
+  }
+  return 0;
+}
+
+//
+// End of "$Id: cube.cxx 8033 2010-12-15 12:11:16Z AlbrechtS $".
+//

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to