FLTK logo

[master] e73f9d4 - Rearrange "Print Button Window" functions

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] e73f9d4 - Rearrange "Print Button Window" functions "Albrecht Schlosser" Feb 03, 2022  
 
commit e73f9d466da578f31af7b24d5f016eaa927a5c91
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Thu Feb 3 21:56:42 2022 +0100
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Thu Feb 3 21:57:47 2022 +0100

    Rearrange "Print Button Window" functions
    
    - Rename Fl_Screen_Driver::print_or_copy_window() to
        fl_print_or_copy_window()
    - Add header file src/print_button.h
    - Update dependencies

 src/Fl_Screen_Driver.H |  2 --
 src/Fl_Window_Driver.H |  3 ---
 src/Fl_cocoa.mm        |  3 ++-
 src/Fl_win32.cxx       |  1 +
 src/Fl_x.cxx           |  4 ++-
 src/makedepend         | 67 ++++++++++++++++++++++++++++++++++++++++----------
 src/print_button.cxx   | 27 ++++++++++----------
 src/print_button.h     | 33 +++++++++++++++++++++++++
 8 files changed, 107 insertions(+), 33 deletions(-)

diff --git src/Fl_Screen_Driver.H src/Fl_Screen_Driver.H
index e7a64b5..60ad11d 100644
--- src/Fl_Screen_Driver.H
+++ src/Fl_Screen_Driver.H
@@ -199,8 +199,6 @@ public:
   virtual APP_SCALING_CAPABILITY rescalable() { return NO_APP_SCALING; }
   // supports Fl_Window::default_icons()
   virtual void default_icons(const Fl_RGB_Image *icons[], int count);
-  // this one is implemented in print_button.cxx
-  static int print_or_copy_window(Fl_Window*, bool, int);
   // implement to support copy-to-clipboard
   virtual void copy(const char */*stuff*/, int /*len*/, int /*clipboard*/, const char */*type*/) {}
   // implement to support paste-from-clipboard
diff --git src/Fl_Window_Driver.H src/Fl_Window_Driver.H
index dd99d23..524c8be 100644
--- src/Fl_Window_Driver.H
+++ src/Fl_Window_Driver.H
@@ -38,9 +38,6 @@ class Fl_X;
 class Fl_Image;
 class Fl_RGB_Image;
 
-// not directly window driver related, but ...
-int fl_create_print_window(); // used internally on some platforms
-
 /**
  \brief A base class for platform specific window handling code.
 
diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index 1b86fd4..4518ba8 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -40,6 +40,7 @@ extern "C" {
 #include "drivers/Cocoa/Fl_Cocoa_Window_Driver.H"
 #include "drivers/Darwin/Fl_Darwin_System_Driver.H"
 #include "drivers/Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H"
+#include "print_button.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -3953,7 +3954,7 @@ static PrintWithTitlebarItem *print_with_titlebar_item = NULL;
 {
   bool grab_decoration = ([print_with_titlebar_item state] == NSOnState);
   fl_lock_function();
-  Fl_Screen_Driver::print_or_copy_window(Fl::first_window(), grab_decoration, 1);
+  fl_print_or_copy_window(Fl::first_window(), grab_decoration, 1);
   fl_unlock_function();
 }
 - (void)terminate:(id)sender
diff --git src/Fl_win32.cxx src/Fl_win32.cxx
index cb477d9..6e9e893 100644
--- src/Fl_win32.cxx
+++ src/Fl_win32.cxx
@@ -55,6 +55,7 @@ void fl_cleanup_dc_list(void);
 #include "Fl_Window_Driver.H"
 #include "Fl_Screen_Driver.H"
 #include "Fl_Timeout.h"
+#include "print_button.h"
 #include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver
 #include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H"
 #include "drivers/WinAPI/Fl_WinAPI_System_Driver.H"
diff --git src/Fl_x.cxx src/Fl_x.cxx
index abbc27a..5fefa51 100644
--- src/Fl_x.cxx
+++ src/Fl_x.cxx
@@ -1,7 +1,7 @@
 //
 // X specific code for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2021 by Bill Spitzak and others.
+// Copyright 1998-2022 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -42,6 +42,7 @@
 #  include "drivers/X11/Fl_X11_Window_Driver.H"
 #  include "drivers/X11/Fl_X11_System_Driver.H"
 #  include "drivers/Xlib/Fl_Xlib_Graphics_Driver.H"
+#  include "print_button.h"
 #  include <unistd.h>
 #  include <time.h>
 #  include <sys/time.h>
@@ -51,6 +52,7 @@
 #  include <X11/Xlib.h>
 #  include <X11/keysym.h>
 #  include "Xutf8.h"
+
 #define USE_XRANDR (HAVE_DLSYM && HAVE_DLFCN_H) // means attempt to dynamically load libXrandr.so
 #if USE_XRANDR
 #include <dlfcn.h>
diff --git src/makedepend src/makedepend
index c0895df..02361c7 100644
--- src/makedepend
+++ src/makedepend
@@ -437,6 +437,7 @@ drivers/X11/Fl_X11_Screen_Driver.o: drivers/Xlib/Fl_Font.H
 drivers/X11/Fl_X11_Screen_Driver.o: drivers/Xlib/Fl_Xlib_Graphics_Driver.H
 drivers/X11/Fl_X11_Screen_Driver.o: Fl_Screen_Driver.H
 drivers/X11/Fl_X11_Screen_Driver.o: Fl_System_Driver.H
+drivers/X11/Fl_X11_Screen_Driver.o: Fl_Timeout.h
 drivers/X11/Fl_X11_Screen_Driver.o: Fl_Window_Driver.H
 drivers/X11/Fl_X11_System_Driver.o: ../config.h
 drivers/X11/Fl_X11_System_Driver.o: ../FL/Enumerations.H
@@ -460,6 +461,7 @@ drivers/X11/Fl_X11_System_Driver.o: drivers/Posix/Fl_Posix_System_Driver.H
 drivers/X11/Fl_X11_System_Driver.o: drivers/X11/Fl_X11_System_Driver.H
 drivers/X11/Fl_X11_System_Driver.o: flstring.h
 drivers/X11/Fl_X11_System_Driver.o: Fl_System_Driver.H
+drivers/X11/Fl_X11_System_Driver.o: Fl_Timeout.h
 drivers/X11/Fl_X11_Window_Driver.o: ../config.h
 drivers/X11/Fl_X11_Window_Driver.o: ../FL/Enumerations.H
 drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl.H
@@ -893,6 +895,7 @@ Fl.o: ../FL/x11.H
 Fl.o: flstring.h
 Fl.o: Fl_Screen_Driver.H
 Fl.o: Fl_System_Driver.H
+Fl.o: Fl_Timeout.h
 Fl.o: Fl_Window_Driver.H
 flstring.o: ../config.h
 flstring.o: ../FL/fl_config.h
@@ -3190,20 +3193,20 @@ Fl_Spinner.o: ../FL/Fl_Input.H
 Fl_Spinner.o: ../FL/Fl_Input_.H
 Fl_Spinner.o: ../FL/Fl_Repeat_Button.H
 Fl_Spinner.o: ../FL/Fl_Spinner.H
-fl_string.o: ../FL/Enumerations.H
-fl_string.o: ../FL/filename.H
-fl_string.o: ../FL/Fl.H
-fl_string.o: ../FL/Fl_Cairo.H
-fl_string.o: ../FL/fl_casts.H
-fl_string.o: ../FL/fl_config.h
-fl_string.o: ../FL/Fl_Export.H
-fl_string.o: ../FL/Fl_Preferences.H
 Fl_String.o: ../FL/Fl_String.H
-fl_string.o: ../FL/fl_string_functions.h
-fl_string.o: ../FL/fl_types.h
-fl_string.o: ../FL/fl_utf8.h
-fl_string.o: ../FL/platform_types.h
-fl_string.o: Fl_System_Driver.H
+fl_string_functions.o: ../FL/Enumerations.H
+fl_string_functions.o: ../FL/filename.H
+fl_string_functions.o: ../FL/Fl.H
+fl_string_functions.o: ../FL/Fl_Cairo.H
+fl_string_functions.o: ../FL/fl_casts.H
+fl_string_functions.o: ../FL/fl_config.h
+fl_string_functions.o: ../FL/Fl_Export.H
+fl_string_functions.o: ../FL/Fl_Preferences.H
+fl_string_functions.o: ../FL/fl_string_functions.h
+fl_string_functions.o: ../FL/fl_types.h
+fl_string_functions.o: ../FL/fl_utf8.h
+fl_string_functions.o: ../FL/platform_types.h
+fl_string_functions.o: Fl_System_Driver.H
 Fl_SVG_Image.o: ../config.h
 Fl_SVG_Image.o: ../FL/Enumerations.H
 Fl_SVG_Image.o: ../FL/Fl.H
@@ -3452,6 +3455,19 @@ Fl_Tiled_Image.o: ../FL/fl_utf8.h
 Fl_Tiled_Image.o: ../FL/Fl_Widget.H
 Fl_Tiled_Image.o: ../FL/Fl_Window.H
 Fl_Tiled_Image.o: ../FL/platform_types.h
+Fl_Timeout.o: ../FL/Enumerations.H
+Fl_Timeout.o: ../FL/filename.H
+Fl_Timeout.o: ../FL/Fl.H
+Fl_Timeout.o: ../FL/Fl_Cairo.H
+Fl_Timeout.o: ../FL/fl_casts.H
+Fl_Timeout.o: ../FL/fl_config.h
+Fl_Timeout.o: ../FL/Fl_Export.H
+Fl_Timeout.o: ../FL/Fl_Preferences.H
+Fl_Timeout.o: ../FL/fl_types.h
+Fl_Timeout.o: ../FL/fl_utf8.h
+Fl_Timeout.o: ../FL/platform_types.h
+Fl_Timeout.o: Fl_System_Driver.H
+Fl_Timeout.o: Fl_Timeout.h
 Fl_Tooltip.o: ../FL/Enumerations.H
 Fl_Tooltip.o: ../FL/filename.H
 Fl_Tooltip.o: ../FL/Fl.H
@@ -3896,6 +3912,7 @@ Fl_x.o: flstring.h
 Fl_x.o: Fl_Screen_Driver.H
 Fl_x.o: Fl_System_Driver.H
 Fl_x.o: Fl_Window_Driver.H
+Fl_x.o: print_button.h
 Fl_x.o: Xutf8.h
 Fl_XBM_Image.o: ../config.h
 Fl_XBM_Image.o: ../FL/Enumerations.H
@@ -4377,6 +4394,30 @@ numericsort.o: ../FL/filename.H
 numericsort.o: ../FL/fl_config.h
 numericsort.o: ../FL/Fl_Export.H
 numericsort.o: ../FL/platform_types.h
+print_button.o: ../FL/Enumerations.H
+print_button.o: ../FL/Fl.H
+print_button.o: ../FL/Fl_Bitmap.H
+print_button.o: ../FL/Fl_Cairo.H
+print_button.o: ../FL/fl_casts.H
+print_button.o: ../FL/fl_config.h
+print_button.o: ../FL/Fl_Copy_Surface.H
+print_button.o: ../FL/Fl_Device.H
+print_button.o: ../FL/fl_draw.H
+print_button.o: ../FL/Fl_Export.H
+print_button.o: ../FL/Fl_Group.H
+print_button.o: ../FL/Fl_Image.H
+print_button.o: ../FL/Fl_Paged_Device.H
+print_button.o: ../FL/Fl_Plugin.H
+print_button.o: ../FL/Fl_PostScript.H
+print_button.o: ../FL/Fl_Preferences.H
+print_button.o: ../FL/Fl_Printer.H
+print_button.o: ../FL/fl_types.h
+print_button.o: ../FL/fl_utf8.h
+print_button.o: ../FL/Fl_Widget.H
+print_button.o: ../FL/Fl_Widget_Surface.H
+print_button.o: ../FL/Fl_Window.H
+print_button.o: ../FL/platform_types.h
+print_button.o: print_button.h
 scandir_posix.o: ../config.h
 scandir_posix.o: ../FL/fl_config.h
 screen_xywh.o: ../config.h
diff --git src/print_button.cxx src/print_button.cxx
index 40836ad..3db942d 100644
--- src/print_button.cxx
+++ src/print_button.cxx
@@ -1,7 +1,7 @@
 //
 // "Print Window" functions for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2021 by Bill Spitzak and others.
+// Copyright 1998-2022 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -38,13 +38,12 @@
 // Currently the shortcut can't be configured and is always ALT+SHIFT+'s'.
 // Todo: make the shortcut configurable.
 
-#include <FL/Fl_Window.H>
-#include "Fl_Screen_Driver.H"
+#include "print_button.h"
+
 #include <FL/Fl_Printer.H>
 #include <FL/Fl_PostScript.H>
 #include <FL/Fl_Copy_Surface.H>
 
-//#define USE_PRINT_BUTTON 1
 #ifdef USE_PRINT_BUTTON
 
 #include <FL/Fl_Button.H>
@@ -78,7 +77,7 @@ static void output_cb(Fl_Widget * /*unused*/, void *data) {
   // print window again (which ends the program)
 
   if (!win) return;
-  Fl_Screen_Driver::print_or_copy_window(win, deco_button->value(), fl_int(data));
+  fl_print_or_copy_window(win, deco_button->value(), fl_int(data));
   print_window->show();
 }
 
@@ -143,14 +142,16 @@ int fl_create_print_window() {
 
 #endif // USE_PRINT_BUTTON
 
-/**
- To print or copy to clipboard a window.
- \param win The window to process
- \param grab_decoration true means the window titlebar is processed too
- \param mode 1 means print, other means copy
- */
-int Fl_Screen_Driver::print_or_copy_window(Fl_Window *win, bool grab_decoration, int mode)
-{
+/* undocumented function:
+
+  Print a window or copy its contents to the clipboard.
+
+    win              The window to process
+    grab_decoration  true means the window titlebar is processed too
+    mode             1 means print, other means copy
+*/
+int fl_print_or_copy_window(Fl_Window *win, bool grab_decoration, int mode) {
+
   if (!win) return 0;
 
   int ww = grab_decoration ? win->decorated_w() : win->w();
diff --git src/print_button.h src/print_button.h
new file mode 100644
index 0000000..e218e73
--- /dev/null
+++ src/print_button.h
@@ -0,0 +1,33 @@
+//
+// Header for "Print Window" functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2022 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     https://www.fltk.org/COPYING.php
+//
+// Please see the following page on how to report bugs and issues:
+//
+//     https://www.fltk.org/bugs.php
+//
+
+#ifndef _SRC_FL_PRINT_BUTTON_H_
+#define _SRC_FL_PRINT_BUTTON_H_
+
+#include <FL/Fl_Window.H>
+
+// These are all internal functions, do not FL_EXPORT these functions!
+// These functions are mplemented in src/print_button.cxx
+
+// Create and initialize the "Print/copy front window" dialog window
+
+int fl_create_print_window();
+
+// Print a window or copy its contents to the clipboard.
+
+int fl_print_or_copy_window(Fl_Window *win, bool grab_decoration, int mode);
+
+#endif // _SRC_FL_PRINT_BUTTON_H_
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.