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
This commit is contained in:
parent
c483c4c5de
commit
e73f9d466d
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
33
src/print_button.h
Normal file
33
src/print_button.h
Normal file
@ -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_
|
Loading…
Reference in New Issue
Block a user