Audacity  2.3.1
ScreenshotCommand.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2018 Audacity Team
5  License: GPL v2 - see LICENSE.txt
6 
7  Dominic Mazzoni
8  Dan Horgan
9  James Crook
10 
11 **********************************************************************/
12 
13 #ifndef __SCREENSHOT_COMMAND__
14 #define __SCREENSHOT_COMMAND__
15 
16 #include "Command.h"
17 #include "../commands/AudacityCommand.h"
18 
19 #include <wx/colour.h>
20 class wxWindow;
21 class wxTopLevelWindow;
22 class wxCommandEvent;
23 class wxRect;
24 class ToolManager;
26 class TrackPanel;
27 class AdornedRulerPanel;
28 class AudacityProject;
29 class CommandContext;
30 
31 #define SCREENSHOT_PLUGIN_SYMBOL ComponentInterfaceSymbol{ XO("Screenshot") }
32 
34 {
35 public:
37  {
42  };
43 
45  {
79  };
80 
82  // ComponentInterface overrides
84  wxString GetDescription() override {return _("Takes screenshots.");};
85  bool DefineParams( ShuttleParams & S ) override;
86  void PopulateOrExchange(ShuttleGui & S) override;
87 
88  // AudacityCommand overrides
89  wxString ManualPage() override {return wxT("Extra_Menu:_Scriptables_II#screenshot_short_format");};
90 
91 private:
92  int mWhat;
93  int mBack;
94  wxString mPath;
98  friend class ScreenFrame;
99 
100 public:
101  bool Apply(const CommandContext & context) override;
102  void GetDerivedParams();
103 
104 private:
105  // May need to ignore the screenshot dialog
106  // Appears not to be used anymore.
107  wxWindow *mIgnore;
108 
110  wxColour mBackColor;
111  wxString mDirToWriteTo;
112 
113  wxString mFilePath;
114  wxString mFileName;
116 
117  wxString MakeFileName(const wxString &path, const wxString &basename);
118 
119  wxRect GetBackgroundRect();
120 
121  bool CaptureToolbar(const CommandContext & Context, ToolManager *man, int type, const wxString &name);
122  bool CaptureDock(const CommandContext & Context, wxWindow *win, const wxString &fileName);
123  void CaptureCommands(const CommandContext & Context, wxArrayString &Commands );
124  void CaptureEffects(const CommandContext & Context, AudacityProject * pProject, const wxString &fileName );
125  void CaptureScriptables(const CommandContext & Context, AudacityProject * pProject, const wxString &fileName );
126  void CapturePreferences(const CommandContext & Context, AudacityProject * pProject, const wxString &fileName );
127  bool Capture(
128  const CommandContext & Context,
129  const wxString &basename,
130  wxWindow *window, wxRect rect,
131  bool bg = false);
132  wxRect GetWindowRect(wxTopLevelWindow *w);
133  wxRect GetFullWindowRect(wxTopLevelWindow *w);
134  wxRect GetScreenRect();
135  wxRect GetPanelRect(TrackPanel * panel);
136  wxRect GetRulerRect(AdornedRulerPanel *ruler);
137  wxRect GetTracksRect(TrackPanel * panel);
138  wxRect GetTrackRect( AudacityProject * pProj, TrackPanel * panel,int n);
139  wxString WindowFileName(AudacityProject * proj, wxTopLevelWindow *w);
140 
141 public:
143  static void (*mIdleHandler)(wxIdleEvent& event);
144  static void SetIdleHandler( void (*pHandler)(wxIdleEvent& event) ){mIdleHandler=pHandler;};
145  static bool MayCapture( wxDialog * pDlg );
146 
147  void CaptureWindowOnIdle( const CommandContext & context, wxWindow * pWin );
148  wxTopLevelWindow *GetFrontWindow(AudacityProject *project);
149 };
150 
151 #endif /* End of include guard: __SCREENSHOT_COMMAND__ */
bool DefineParams(ShuttleParams &S) override
CommandOutputTargets a mix of three output classes to output progress indication, status messages and...
bool CaptureDock(const CommandContext &Context, wxWindow *win, const wxString &fileName)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
bool CaptureToolbar(const CommandContext &Context, ToolManager *man, int type, const wxString &name)
Contains declaration of Command base class.
void CaptureWindowOnIdle(const CommandContext &context, wxWindow *pWin)
void CaptureScriptables(const CommandContext &Context, AudacityProject *pProject, const wxString &fileName)
wxRect GetWindowRect(wxTopLevelWindow *w)
CommandContext provides addiitonal information to an 'Apply()' command. It provides the project...
wxRect GetTrackRect(AudacityProject *pProj, TrackPanel *panel, int n)
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:60
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional...
void PopulateOrExchange(ShuttleGui &S) override
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:174
static ScreenshotCommand * mpShooter
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:248
ComponentInterfaceSymbol GetSymbol() override
void CaptureEffects(const CommandContext &Context, AudacityProject *pProject, const wxString &fileName)
wxString WindowFileName(AudacityProject *proj, wxTopLevelWindow *w)
wxString ManualPage() override
ScreenFrame provides an alternative Gui for ScreenshotCommand. It adds a timer that allows a delay be...
Definition: Screenshot.cpp:52
wxRect GetTracksRect(TrackPanel *panel)
bool Capture(const CommandContext &Context, const wxString &basename, wxWindow *window, wxRect rect, bool bg=false)
Base class for command in Audacity.
void CapturePreferences(const CommandContext &Context, AudacityProject *pProject, const wxString &fileName)
Implements a command for capturing various areas of the screen or project window. It's one big if-els...
wxString GetDescription() override
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
#define SCREENSHOT_PLUGIN_SYMBOL
const wxChar * name
Definition: Distortion.cpp:94
This is an Audacity Specific ruler panel which additionally has border, selection markers...
static bool MayCapture(wxDialog *pDlg)
wxRect GetRulerRect(AdornedRulerPanel *ruler)
class ToolManager
Definition: ToolManager.h:45
static void(* mIdleHandler)(wxIdleEvent &event)
static void SetIdleHandler(void(*pHandler)(wxIdleEvent &event))
wxRect GetFullWindowRect(wxTopLevelWindow *w)
wxTopLevelWindow * GetFrontWindow(AudacityProject *project)
wxRect GetPanelRect(TrackPanel *panel)
virtual bool Apply()
wxString MakeFileName(const wxString &path, const wxString &basename)
void CaptureCommands(const CommandContext &Context, wxArrayString &Commands)