Author: manolo
Date: 2010-03-04 03:52:18 -0800 (Thu, 04 Mar 2010)
New Revision: 7210
Log:
Replaced current_display() by better static Fl_Device::display_device(void)

Modified:
   branches/branch-1.3-Fl_Printer/FL/Fl_Device.H
   branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
   branches/branch-1.3-Fl_Printer/src/Fl_Device.cxx
   branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
   branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx
   branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx
   branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
   branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm
   branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx
   branches/branch-1.3-Fl_Printer/src/Fl_x.cxx

Modified: branches/branch-1.3-Fl_Printer/FL/Fl_Device.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/Fl_Device.H       2010-03-04 09:41:22 UTC 
(rev 7209)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Device.H       2010-03-04 11:52:18 UTC 
(rev 7210)
@@ -18,6 +18,8 @@
 class Fl_RGB_Image;
 class Fl_Pixmap;
 class Fl_Bitmap;
+class Fl_Display;
+extern Fl_Display *fl_display_device;
 typedef void (*Fl_Draw_Image_Cb)(void* ,int,int,int,uchar*);
 
 /**
@@ -154,6 +156,12 @@
    @brief    Returns the current target device of graphics calls.
    */
   static Fl_Device *current();
+  
+  /**
+   @brief    Returns the platform's display device.
+   */
+  static Fl_Display *display_device() { return fl_display_device; };
+  
 };
 extern Fl_Device *fl_device;
 

Modified: branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H      2010-03-04 09:41:22 UTC 
(rev 7209)
+++ branches/branch-1.3-Fl_Printer/FL/Fl_Printer.H      2010-03-04 11:52:18 UTC 
(rev 7210)
@@ -39,7 +39,6 @@
     const uchar *data;
     struct chain_elt *next;
   };
-  Fl_Display *current_display_;
   void add_image(Fl_Image *image, const uchar *data); // adds an image to the 
page image list
   void traverse(Fl_Widget *widget); // finds subwindows of widget and prints 
them
   /**
@@ -61,7 +60,7 @@
   void *gc; // the printer's graphics context, if there's one, NULL otherwise
   void delete_image_list(); // deletes the page image list
 #ifndef FL_DOXYGEN
-     Fl_Virtual_Printer(void) { current_display_ = (Fl_Display*)fl_device; gc 
= NULL; };
+     Fl_Virtual_Printer(void) { gc = NULL; };
 #endif
 public:
 #ifdef FL_DOXYGEN
@@ -206,12 +205,7 @@
       @brief To be called at the end of a print job.
       */
      virtual void end_job (void);
-     
-     /**
-      @brief Returns the display device of the platform.
-      */
-     Fl_Display *current_display() {return current_display_; };
-     
+          
      Fl_Device *Fl_Virtual_Printer::set_current(void);
 };
 

Modified: branches/branch-1.3-Fl_Printer/src/Fl_Device.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Device.cxx    2010-03-04 09:41:22 UTC 
(rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Device.cxx    2010-03-04 11:52:18 UTC 
(rev 7210)
@@ -91,7 +91,7 @@
 
 void Fl_Virtual_Printer::print_window_part(Fl_Window *win, int x, int y, int 
w, int h, int delta_x, int delta_y)
 {
-  this->current_display()->set_current();
+  Fl_Device::display_device()->set_current();
   Fl_Window *save_front = Fl::first_window();
   win->show();
   Fl::check();

Modified: branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx       2010-03-04 
09:41:22 UTC (rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx       2010-03-04 
11:52:18 UTC (rev 7210)
@@ -88,7 +88,7 @@
 
 void Fl_GDI_Printer::end_job (void)
 {
-  current_display()->set_current();
+  Fl_Device::display_device()->set_current();
   if (hPr != NULL) {
     if (! abortPrint) {
       prerr = EndDoc (hPr);

Modified: branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx        2010-03-04 
09:41:22 UTC (rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx        2010-03-04 
11:52:18 UTC (rev 7210)
@@ -75,8 +75,8 @@
   Fl_X::q_end_image();
   CGContextRestoreGState(fl_gc);
   CFRelease(image);
-  free(baseAddress);
 #else // FIXME Linux/Unix
   fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(), 
glw->h(), bytesperpixel, - mByteWidth);
 #endif // WIN32
+  free(baseAddress);
 }

Modified: branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx        2010-03-04 
09:41:22 UTC (rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_PS_Printer.cxx        2010-03-04 
11:52:18 UTC (rev 7210)
@@ -699,7 +699,6 @@
 "ZapfDingbats"
 };
 // TODO RK: CRITICAL: this is hacky/temporary implementation of fonts. All 
below should be replaced.
-extern Fl_Display fl_display_device;
 
 void Fl_PSfile_Device::font(int f, int s) {
   
@@ -708,22 +707,22 @@
     f = FL_COURIER;
   fprintf(output, "/%s SF\n" , _fontNames[f]);
   fprintf(output,"%i FS\n", s);
-  fl_display_device.font(f,s); //Dirty hack for font measurement ;-(
+  Fl_Device::display_device()->font(f,s); //Dirty hack for font measurement ;-(
   font_=f; size_=s;
 };
 
 /*double Fl_PSfile_Device::width(unsigned c){
-  return fl_display_device.width(c); //Dirty...
+  return Fl_Device::display_device()->width(c); //Dirty...
 }
 
 double Fl_PSfile_Device::width(const char* s, int n){;
-  return fl_display_device.width(s,n); //Very Dirty...
+  return Fl_Device::display_device()->width(s,n); //Very Dirty...
 }
 int Fl_PSfile_Device::descent(){
-  return fl_display_device.descent(); //A bit Dirty...
+  return Fl_Device::display_device()->descent(); //A bit Dirty...
 }
 int Fl_PSfile_Device::height(){
-  return fl_display_device.height(); //Still Dirty...
+  return Fl_Device::display_device()->height(); //Still Dirty...
 }*/
 
 void Fl_PSfile_Device::color(Fl_Color c) {
@@ -1149,7 +1148,7 @@
     delete c;
   }
   if (close_cmd_) (*close_cmd_)(output);
-  current_display()->set_current();
+  Fl_Device::display_device()->set_current();
 }
 
 #if ! (defined(__APPLE__) || defined(WIN32) )

Modified: branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm     2010-03-04 
09:41:22 UTC (rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm     2010-03-04 
11:52:18 UTC (rev 7210)
@@ -264,7 +264,7 @@
     fl_alert ("PM Session error %d", (int)status);
   }
   PMSessionEndDocumentNoDialog(printSession);
-  current_display()->set_current();
+  Fl_Device::display_device()->set_current();
   fl_gc = 0;
   Fl::first_window()->show();
 }

Modified: branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm      2010-03-04 09:41:22 UTC 
(rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm      2010-03-04 11:52:18 UTC 
(rev 7210)
@@ -152,8 +152,9 @@
 static Fl_Region MacRegionMinusRect(Fl_Region r, int x,int y,int w,int h);
 static void cocoaMouseHandler(NSEvent *theEvent);
 
-FL_EXPORT Fl_Quartz_Display fl_display_device;
-Fl_Device *fl_device = (Fl_Device*)&fl_display_device;
+static Fl_Quartz_Display fl_quartz_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_quartz_device; // 
does not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_quartz_device; // the current 
target device of graphics operations
 
 // public variables
 int fl_screen;

Modified: branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx     2010-03-04 09:41:22 UTC 
(rev 7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx     2010-03-04 11:52:18 UTC 
(rev 7210)
@@ -95,8 +95,9 @@
   for async mode proper operation, not mentioning the side effects...
 */
 
-FL_EXPORT Fl_Display fl_display_device;
-Fl_Device *fl_device = (Fl_Device*)&fl_display_device;
+static Fl_GDI_Display fl_gdi_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_gdi_device; // does 
not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_gdi_device; // the current 
target device of graphics operations
 
 // dynamic wsock dll handling api:
 #if defined(__CYGWIN__) && !defined(SOCKET)

Modified: branches/branch-1.3-Fl_Printer/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_x.cxx 2010-03-04 09:41:22 UTC (rev 
7209)
+++ branches/branch-1.3-Fl_Printer/src/Fl_x.cxx 2010-03-04 11:52:18 UTC (rev 
7210)
@@ -51,8 +51,9 @@
 #  include <X11/Xlocale.h>
 #  include <X11/Xlib.h>
 
-FL_EXPORT Fl_Xlib_Display fl_display_device;
-Fl_Device *fl_device = (Fl_Device*)&fl_display_device;
+static Fl_Xlib_Display fl_xlib_device;
+FL_EXPORT Fl_Display *fl_display_device = (Fl_Display*)&fl_xlib_device; // 
does not change
+FL_EXPORT Fl_Device *fl_device = (Fl_Device*)&fl_xlib_device; // the current 
target device of graphics operations
 
 ////////////////////////////////////////////////////////////////
 // interface to poll/select call:

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

Reply via email to