Screen capture preference panels too.
This commit is contained in:
parent
7bf7815c75
commit
8f66c3603d
|
@ -4231,6 +4231,9 @@ void AudacityProject::OnPreferences()
|
|||
{
|
||||
GlobalPrefsDialog dialog(this /* parent */ );
|
||||
|
||||
if( ScreenshotCommand::MayCapture( &dialog ) )
|
||||
return;
|
||||
|
||||
if (!dialog.ShowModal()) {
|
||||
// Canceled
|
||||
return;
|
||||
|
|
|
@ -72,6 +72,7 @@ class ScreenFrame final : public wxFrame
|
|||
void OnCaptureToolbars(wxCommandEvent & event);
|
||||
void OnCaptureMenus(wxCommandEvent & event);
|
||||
void OnCaptureEffects(wxCommandEvent & event);
|
||||
void OnCapturePreferences(wxCommandEvent & event);
|
||||
void OnCaptureSelectionBar(wxCommandEvent & event);
|
||||
void OnCaptureTools(wxCommandEvent & event);
|
||||
void OnCaptureTransport(wxCommandEvent & event);
|
||||
|
@ -182,6 +183,7 @@ enum
|
|||
IdCaptureToolbars,
|
||||
IdCaptureMenus,
|
||||
IdCaptureEffects,
|
||||
IdCapturePreferences,
|
||||
IdCaptureSelectionBar,
|
||||
IdCaptureTools,
|
||||
IdCaptureTransport,
|
||||
|
@ -228,6 +230,7 @@ BEGIN_EVENT_TABLE(ScreenFrame, wxFrame)
|
|||
EVT_BUTTON(IdCaptureToolbars, ScreenFrame::OnCaptureToolbars)
|
||||
EVT_BUTTON(IdCaptureMenus, ScreenFrame::OnCaptureMenus)
|
||||
EVT_BUTTON(IdCaptureEffects, ScreenFrame::OnCaptureEffects)
|
||||
EVT_BUTTON(IdCapturePreferences, ScreenFrame::OnCapturePreferences)
|
||||
EVT_BUTTON(IdCaptureSelectionBar, ScreenFrame::OnCaptureSelectionBar)
|
||||
EVT_BUTTON(IdCaptureTools, ScreenFrame::OnCaptureTools)
|
||||
EVT_BUTTON(IdCaptureTransport, ScreenFrame::OnCaptureTransport)
|
||||
|
@ -392,6 +395,7 @@ void ScreenFrame::PopulateOrExchange(ShuttleGui & S)
|
|||
#ifdef EXPERIMENTAL_DOCS_AUTOMATION
|
||||
S.Id(IdCaptureMenus).AddButton(_("All Menus"));
|
||||
S.Id(IdCaptureEffects).AddButton(_("All Effects"));
|
||||
S.Id(IdCapturePreferences).AddButton(_("All Preferences"));
|
||||
#endif
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
@ -629,6 +633,11 @@ void ScreenFrame::OnCaptureEffects(wxCommandEvent & WXUNUSED(event))
|
|||
DoCapture(wxT("effects"));
|
||||
}
|
||||
|
||||
void ScreenFrame::OnCapturePreferences(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
DoCapture(wxT("preferences"));
|
||||
}
|
||||
|
||||
void ScreenFrame::OnCaptureSelectionBar(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
DoCapture(wxT("selectionbar"));
|
||||
|
|
|
@ -42,6 +42,7 @@ project window.
|
|||
#include "../toolbars/ToolsToolBar.h"
|
||||
#include "../toolbars/TranscriptionToolBar.h"
|
||||
#include "../widgets/Ruler.h"
|
||||
#include "../Prefs.h"
|
||||
|
||||
#if defined(__WXMAC__) && !wxCHECK_VERSION(3, 0, 0)
|
||||
//
|
||||
|
@ -376,16 +377,13 @@ void ScreenshotCommand::CaptureWindowOnIdle( wxWindow * pWin )
|
|||
|
||||
wxPoint Pos = pDlg->GetScreenPosition();
|
||||
wxSize Siz = pDlg->GetSize();
|
||||
wxString Name = mDirToWriteTo;
|
||||
wxString Title = pDlg->GetTitle();
|
||||
|
||||
// Remove '/' from "Sliding Time Scale/Pitch Shift..."
|
||||
// and any other effects that have illegal filename chanracters.
|
||||
Title.Replace( "/", "" );
|
||||
Name.Replace( "effects000", Title );
|
||||
|
||||
int x = 0, y = 0;
|
||||
int width, height;
|
||||
Title.Replace( ":", "" );
|
||||
wxString Name = mDirToWriteTo + Title + ".png";
|
||||
|
||||
wxLogDebug("Taking screenshot of window %s (%i,%i,%i,%i)", Name,
|
||||
Pos.x, Pos.y, Siz.x, Siz.y );
|
||||
|
@ -400,13 +398,39 @@ void ScreenshotCommand::CaptureWindowOnIdle( wxWindow * pWin )
|
|||
pDlg->GetEventHandler()->AddPendingEvent( Evt );
|
||||
}
|
||||
|
||||
void ScreenshotCommand::CapturePreferences( AudacityProject * pProject, const wxString &fileName ){
|
||||
fileName;//compiler food.
|
||||
CommandManager * pMan = pProject->GetCommandManager();
|
||||
|
||||
// Yucky static variables. Is there a better way? The problem is that we need the
|
||||
// idle callback to know more about what to do.
|
||||
mDirToWriteTo = fileName.BeforeLast('\\') + "\\";
|
||||
mpShooter = this;
|
||||
const int nPrefsPages = 19;
|
||||
|
||||
for( int i=0;i<nPrefsPages;i++){
|
||||
// The handler is cleared each time it is used.
|
||||
SetIdleHandler( IdleHandler );
|
||||
gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)i);
|
||||
gPrefs->Flush();
|
||||
wxString Command = "Preferences";
|
||||
if( !pMan->HandleTextualCommand( Command, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
{
|
||||
wxLogDebug("Command %s not found", Command );
|
||||
}
|
||||
// This sleep is not needed, but gives user a chance to see the
|
||||
// dialogs as they whizz by.
|
||||
wxMilliSleep( 200 );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenshotCommand::CaptureEffects( AudacityProject * pProject, const wxString &fileName ){
|
||||
fileName;//compiler food.
|
||||
CommandManager * pMan = pProject->GetCommandManager();
|
||||
wxString Str;
|
||||
// Yucky static variables. Is there a better way? The problem is that we need the
|
||||
// idle callback to know more about what to do.
|
||||
mDirToWriteTo = fileName;
|
||||
mDirToWriteTo = fileName.BeforeLast('/') + "/";
|
||||
mpShooter = this;
|
||||
|
||||
#define TRICKY_CAPTURE
|
||||
|
@ -523,6 +547,7 @@ void ScreenshotCommandType::BuildSignature(CommandSignature &signature)
|
|||
captureModeValidator->AddOption(wxT("toolbars"));
|
||||
captureModeValidator->AddOption(wxT("menus"));
|
||||
captureModeValidator->AddOption(wxT("effects"));
|
||||
captureModeValidator->AddOption(wxT("preferences"));
|
||||
captureModeValidator->AddOption(wxT("selectionbar"));
|
||||
captureModeValidator->AddOption(wxT("tools"));
|
||||
captureModeValidator->AddOption(wxT("transport"));
|
||||
|
@ -708,6 +733,10 @@ bool ScreenshotCommand::Apply(CommandExecutionContext context)
|
|||
{
|
||||
CaptureEffects(context.GetProject(), fileName);
|
||||
}
|
||||
else if (captureMode.IsSameAs(wxT("preferences")))
|
||||
{
|
||||
CapturePreferences(context.GetProject(), fileName);
|
||||
}
|
||||
else if (captureMode.IsSameAs(wxT("selectionbar")))
|
||||
{
|
||||
CaptureDock(context.GetProject()->GetToolManager()->GetBotDock(), fileName);
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
void CaptureDock(wxWindow *win, const wxString &fileName);
|
||||
void CaptureMenus(wxMenuBar*pBar, const wxString &fileName);
|
||||
void CaptureEffects( AudacityProject * pProject, const wxString &fileName );
|
||||
void CapturePreferences( AudacityProject * pProject, const wxString &fileName );
|
||||
void Capture(const wxString &basename,
|
||||
wxWindow *window,
|
||||
int x, int y, int width, int height,
|
||||
|
|
Loading…
Reference in New Issue