diff --git a/src/Fl_Screen_Driver.H b/src/Fl_Screen_Driver.H index e7a64b542..60ad11dcd 100644 --- a/src/Fl_Screen_Driver.H +++ b/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 a/src/Fl_Window_Driver.H b/src/Fl_Window_Driver.H index dd99d23df..524c8be20 100644 --- a/src/Fl_Window_Driver.H +++ b/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 a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 1b86fd4f7..4518ba8bf 100644 --- a/src/Fl_cocoa.mm +++ b/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 #include #include @@ -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 a/src/Fl_win32.cxx b/src/Fl_win32.cxx index cb477d95f..6e9e8933f 100644 --- a/src/Fl_win32.cxx +++ b/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 // for fl_graphics_driver #include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" #include "drivers/WinAPI/Fl_WinAPI_System_Driver.H" diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index abbc27a5d..5fefa51c2 100644 --- a/src/Fl_x.cxx +++ b/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 # include # include @@ -51,6 +52,7 @@ # include # include # include "Xutf8.h" + #define USE_XRANDR (HAVE_DLSYM && HAVE_DLFCN_H) // means attempt to dynamically load libXrandr.so #if USE_XRANDR #include diff --git a/src/makedepend b/src/makedepend index c0895dfd7..02361c729 100644 --- a/src/makedepend +++ b/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 a/src/print_button.cxx b/src/print_button.cxx index 40836adc5..3db942dae 100644 --- a/src/print_button.cxx +++ b/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 -#include "Fl_Screen_Driver.H" +#include "print_button.h" + #include #include #include -//#define USE_PRINT_BUTTON 1 #ifdef USE_PRINT_BUTTON #include @@ -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 a/src/print_button.h b/src/print_button.h new file mode 100644 index 000000000..e218e7301 --- /dev/null +++ b/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 + +// 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_