2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Screenshot.cpp
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
Dominic Mazzoni
|
|
|
|
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
*******************************************************************//**
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
\class ScreenshotBigDialog
|
|
|
|
\brief ScreenshotBigDialog provides an alternative Gui for ScreenshotCommand.
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
It adds a timer that allows a delay before taking a screenshot,
|
|
|
|
provides lots of one-click buttons, options to resize the screen.
|
|
|
|
It forwards the actual work of doing the commands to the ScreenshotCommand.
|
|
|
|
|
|
|
|
***********************************************************************/
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
#include "Screenshot.h"
|
|
|
|
#include "commands/ScreenshotCommand.h"
|
|
|
|
#include "commands/CommandTargets.h"
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
#include "commands/CommandContext.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/frame.h>
|
|
|
|
|
|
|
|
#include "ShuttleGui.h"
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/dirdlg.h>
|
|
|
|
#include <wx/image.h>
|
|
|
|
#include <wx/intl.h>
|
|
|
|
#include <wx/panel.h>
|
2019-03-28 07:29:15 +00:00
|
|
|
#include <wx/sizer.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/statusbr.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/timer.h>
|
|
|
|
#include <wx/tglbtn.h>
|
|
|
|
#include <wx/window.h>
|
|
|
|
|
|
|
|
#include "Project.h"
|
2019-07-02 15:38:15 +00:00
|
|
|
#include "ProjectStatus.h"
|
2019-05-29 16:05:22 +00:00
|
|
|
#include "ProjectWindow.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "Prefs.h"
|
2019-06-18 15:32:26 +00:00
|
|
|
#include "tracks/ui/TrackView.h"
|
2019-07-16 12:24:38 +00:00
|
|
|
#include "widgets/HelpSystem.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-04-28 10:49:47 +00:00
|
|
|
#include "ViewInfo.h"
|
2018-09-18 16:03:37 +00:00
|
|
|
#include "WaveTrack.h"
|
2015-07-03 04:20:21 +00:00
|
|
|
|
2018-02-07 21:50:55 +00:00
|
|
|
class OldStyleCommandType;
|
2020-03-03 01:38:34 +00:00
|
|
|
class ScreenFrameTimer;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2021-02-14 07:25:52 +00:00
|
|
|
#define ScreenCaptureFrameTitle XO("Screen Capture Frame")
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
// ANSWER-ME: Should this derive from wxDialogWrapper instead?
|
2021-02-14 07:25:52 +00:00
|
|
|
class ScreenshotBigDialog final : public wxFrame,
|
|
|
|
public PrefsListener
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-02-14 07:25:52 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
// constructors and destructors
|
2020-01-04 18:52:24 +00:00
|
|
|
ScreenshotBigDialog(
|
|
|
|
wxWindow *parent, wxWindowID id, AudacityProject &project);
|
2019-12-06 10:39:07 +00:00
|
|
|
virtual ~ScreenshotBigDialog();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
bool ProcessEvent(wxEvent & event) override;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Populate();
|
|
|
|
void PopulateOrExchange(ShuttleGui &S);
|
|
|
|
|
2013-08-25 21:51:26 +00:00
|
|
|
void OnCloseWindow(wxCloseEvent & event);
|
|
|
|
void OnUIUpdate(wxUpdateUIEvent & event);
|
|
|
|
void OnDirChoose(wxCommandEvent & event);
|
2019-07-16 12:24:38 +00:00
|
|
|
void OnGetURL(wxCommandEvent & event);
|
|
|
|
void OnClose(wxCommandEvent & event );
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
void SizeMainWindow(int w, int h);
|
2013-08-25 21:51:26 +00:00
|
|
|
void OnMainWindowSmall(wxCommandEvent & event);
|
|
|
|
void OnMainWindowLarge(wxCommandEvent & event);
|
|
|
|
void OnToggleBackgroundBlue(wxCommandEvent & event);
|
|
|
|
void OnToggleBackgroundWhite(wxCommandEvent & event);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2018-03-26 18:03:27 +00:00
|
|
|
void DoCapture(int captureMode);
|
2017-06-10 20:32:04 +00:00
|
|
|
void OnCaptureSomething(wxCommandEvent & event);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
void TimeZoom(double seconds);
|
2013-08-25 21:51:26 +00:00
|
|
|
void OnOneSec(wxCommandEvent & event);
|
|
|
|
void OnTenSec(wxCommandEvent & event);
|
|
|
|
void OnOneMin(wxCommandEvent & event);
|
|
|
|
void OnFiveMin(wxCommandEvent & event);
|
|
|
|
void OnOneHour(wxCommandEvent & event);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
void SizeTracks(int h);
|
2013-08-25 21:51:26 +00:00
|
|
|
void OnShortTracks(wxCommandEvent & event);
|
|
|
|
void OnMedTracks(wxCommandEvent & event);
|
|
|
|
void OnTallTracks(wxCommandEvent & event);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2021-02-14 07:25:52 +00:00
|
|
|
// PrefsListener implementation
|
|
|
|
void UpdatePrefs() override;
|
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
AudacityProject &mProject;
|
|
|
|
|
2016-03-31 11:40:05 +00:00
|
|
|
std::unique_ptr<ScreenshotCommand> CreateCommand();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
wxCheckBox *mDelayCheckBox;
|
|
|
|
wxTextCtrl *mDirectoryTextBox;
|
|
|
|
wxToggleButton *mBlue;
|
|
|
|
wxToggleButton *mWhite;
|
|
|
|
wxStatusBar *mStatus;
|
|
|
|
|
2020-03-03 01:38:34 +00:00
|
|
|
std::unique_ptr<ScreenFrameTimer> mTimer;
|
|
|
|
|
2016-03-31 11:40:05 +00:00
|
|
|
std::unique_ptr<ScreenshotCommand> mCommand;
|
2019-05-11 20:19:43 +00:00
|
|
|
const CommandContext mContext;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
// Static pointer to the unique ScreenshotBigDialog window.
|
|
|
|
// Formerly it was parentless, therefore this was a Destroy_ptr<ScreenshotBigDialog>
|
2017-08-07 20:11:20 +00:00
|
|
|
// But now the window is owned, so just use a bare pointer, and null it when
|
|
|
|
// the unique window is destroyed.
|
2019-12-06 10:39:07 +00:00
|
|
|
using ScreenshotBigDialogPtr = ScreenshotBigDialog*;
|
|
|
|
ScreenshotBigDialogPtr mFrame;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
void OpenScreenshotTools( AudacityProject &project )
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
if (!mFrame) {
|
2019-04-26 15:47:33 +00:00
|
|
|
auto parent = wxTheApp->GetTopWindow();
|
2017-08-07 20:11:20 +00:00
|
|
|
if (!parent) {
|
|
|
|
wxASSERT(false);
|
|
|
|
return;
|
|
|
|
}
|
2020-01-04 18:52:24 +00:00
|
|
|
mFrame = ScreenshotBigDialogPtr{
|
|
|
|
safenew ScreenshotBigDialog(parent, -1, project) };
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
mFrame->Show();
|
|
|
|
mFrame->Raise();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloseScreenshotTools()
|
|
|
|
{
|
2017-08-07 20:11:20 +00:00
|
|
|
mFrame = nullptr;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-02-24 06:06:39 +00:00
|
|
|
class ScreenFrameTimer final : public wxTimer
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-06 10:39:07 +00:00
|
|
|
ScreenFrameTimer(ScreenshotBigDialog *frame,
|
2013-08-25 21:51:26 +00:00
|
|
|
wxEvent & event)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
screenFrame = frame;
|
2016-03-31 05:13:29 +00:00
|
|
|
evt.reset(event.Clone());
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2020-03-08 17:46:09 +00:00
|
|
|
virtual ~ScreenFrameTimer()
|
|
|
|
{
|
|
|
|
if (IsRunning())
|
|
|
|
{
|
|
|
|
Stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-24 06:06:47 +00:00
|
|
|
void Notify() override
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2016-03-31 05:13:29 +00:00
|
|
|
// Process timer notification just once, then destroy self
|
2010-01-23 19:44:49 +00:00
|
|
|
evt->SetEventObject(NULL);
|
|
|
|
screenFrame->ProcessEvent(*evt);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2019-12-06 10:39:07 +00:00
|
|
|
ScreenshotBigDialog *screenFrame;
|
2016-03-31 05:13:29 +00:00
|
|
|
std::unique_ptr<wxEvent> evt;
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
IdMainWindowSmall = 19200,
|
|
|
|
IdMainWindowLarge,
|
|
|
|
|
|
|
|
IdDirectory,
|
|
|
|
IdDirChoose,
|
|
|
|
|
|
|
|
IdOneSec,
|
|
|
|
IdTenSec,
|
|
|
|
IdOneMin,
|
|
|
|
IdFiveMin,
|
|
|
|
IdOneHour,
|
|
|
|
|
|
|
|
IdShortTracks,
|
|
|
|
IdMedTracks,
|
|
|
|
IdTallTracks,
|
|
|
|
|
|
|
|
IdDelayCheckBox,
|
|
|
|
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCaptureFirst,
|
2017-08-14 17:53:44 +00:00
|
|
|
// No point delaying the capture of sets of things.
|
2018-02-27 21:50:53 +00:00
|
|
|
IdCaptureEffects= IdCaptureFirst,
|
|
|
|
IdCaptureScriptables,
|
2017-08-14 17:53:44 +00:00
|
|
|
IdCapturePreferences,
|
2018-02-27 21:50:53 +00:00
|
|
|
IdCaptureToolbars,
|
2017-08-14 17:53:44 +00:00
|
|
|
|
|
|
|
// Put all events that need delay between AllDelayed and LastDelayed.
|
|
|
|
IdAllDelayedEvents,
|
2018-02-27 21:50:53 +00:00
|
|
|
IdCaptureWindowContents=IdAllDelayedEvents,
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCaptureFullWindow,
|
|
|
|
IdCaptureWindowPlus,
|
|
|
|
IdCaptureFullScreen,
|
2019-10-14 17:00:26 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
IdCaptureSelectionBar,
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCaptureSpectralSelection,
|
2019-10-14 17:00:26 +00:00
|
|
|
IdCaptureTimer,
|
2010-01-23 19:44:49 +00:00
|
|
|
IdCaptureTools,
|
2010-11-16 01:18:39 +00:00
|
|
|
IdCaptureTransport,
|
2010-01-23 19:44:49 +00:00
|
|
|
IdCaptureMixer,
|
|
|
|
IdCaptureMeter,
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCapturePlayMeter,
|
|
|
|
IdCaptureRecordMeter,
|
2010-01-23 19:44:49 +00:00
|
|
|
IdCaptureEdit,
|
|
|
|
IdCaptureDevice,
|
|
|
|
IdCaptureTranscription,
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCaptureScrub,
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
IdCaptureTrackPanel,
|
|
|
|
IdCaptureRuler,
|
|
|
|
IdCaptureTracks,
|
|
|
|
IdCaptureFirstTrack,
|
|
|
|
IdCaptureSecondTrack,
|
2017-06-10 20:32:04 +00:00
|
|
|
IdCaptureLast = IdCaptureSecondTrack,
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2017-08-14 17:53:44 +00:00
|
|
|
IdLastDelayedEvent,
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
IdToggleBackgroundBlue,
|
|
|
|
IdToggleBackgroundWhite,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
BEGIN_EVENT_TABLE(ScreenshotBigDialog, wxFrame)
|
|
|
|
EVT_CLOSE(ScreenshotBigDialog::OnCloseWindow)
|
|
|
|
EVT_BUTTON(wxID_HELP, ScreenshotBigDialog::OnGetURL)
|
|
|
|
EVT_BUTTON(wxID_CANCEL, ScreenshotBigDialog::OnClose)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
EVT_UPDATE_UI(IdCaptureFullScreen, ScreenshotBigDialog::OnUIUpdate)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
EVT_BUTTON(IdMainWindowSmall, ScreenshotBigDialog::OnMainWindowSmall)
|
|
|
|
EVT_BUTTON(IdMainWindowLarge, ScreenshotBigDialog::OnMainWindowLarge)
|
|
|
|
EVT_TOGGLEBUTTON(IdToggleBackgroundBlue, ScreenshotBigDialog::OnToggleBackgroundBlue)
|
|
|
|
EVT_TOGGLEBUTTON(IdToggleBackgroundWhite, ScreenshotBigDialog::OnToggleBackgroundWhite)
|
|
|
|
EVT_COMMAND_RANGE(IdCaptureFirst, IdCaptureLast, wxEVT_COMMAND_BUTTON_CLICKED, ScreenshotBigDialog::OnCaptureSomething)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
EVT_BUTTON(IdOneSec, ScreenshotBigDialog::OnOneSec)
|
|
|
|
EVT_BUTTON(IdTenSec, ScreenshotBigDialog::OnTenSec)
|
|
|
|
EVT_BUTTON(IdOneMin, ScreenshotBigDialog::OnOneMin)
|
|
|
|
EVT_BUTTON(IdFiveMin, ScreenshotBigDialog::OnFiveMin)
|
|
|
|
EVT_BUTTON(IdOneHour, ScreenshotBigDialog::OnOneHour)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
EVT_BUTTON(IdShortTracks, ScreenshotBigDialog::OnShortTracks)
|
|
|
|
EVT_BUTTON(IdMedTracks, ScreenshotBigDialog::OnMedTracks)
|
|
|
|
EVT_BUTTON(IdTallTracks, ScreenshotBigDialog::OnTallTracks)
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
EVT_BUTTON(IdDirChoose, ScreenshotBigDialog::OnDirChoose)
|
2010-01-23 19:44:49 +00:00
|
|
|
END_EVENT_TABLE();
|
|
|
|
|
|
|
|
// Must not be called before CreateStatusBar!
|
2019-12-06 10:39:07 +00:00
|
|
|
std::unique_ptr<ScreenshotCommand> ScreenshotBigDialog::CreateCommand()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
wxASSERT(mStatus != NULL);
|
2016-03-31 11:40:05 +00:00
|
|
|
auto output =
|
2018-02-08 19:08:50 +00:00
|
|
|
std::make_unique<CommandOutputTargets>(std::make_unique<NullProgressTarget>(),
|
2016-03-31 17:12:04 +00:00
|
|
|
std::make_shared<StatusBarTarget>(*mStatus),
|
|
|
|
std::make_shared<MessageBoxTarget>());
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
return std::make_unique<ScreenshotCommand>();//*type, std::move(output), this);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
ScreenshotBigDialog::ScreenshotBigDialog(
|
|
|
|
wxWindow * parent, wxWindowID id, AudacityProject &project)
|
2021-02-14 07:25:52 +00:00
|
|
|
: wxFrame(parent, id, ScreenCaptureFrameTitle.Translation(),
|
2010-01-23 19:44:49 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
2016-04-11 10:40:13 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#if !defined(__WXMSW__)
|
2016-04-11 10:40:13 +00:00
|
|
|
|
|
|
|
#if !defined(__WXMAC__) // bug1358
|
|
|
|
wxFRAME_TOOL_WINDOW |
|
|
|
|
#endif
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#else
|
2016-04-11 10:40:13 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxSTAY_ON_TOP|
|
2016-04-11 10:40:13 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
2016-04-11 10:40:13 +00:00
|
|
|
|
2020-01-04 18:52:24 +00:00
|
|
|
wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX)
|
|
|
|
, mProject{ project }
|
|
|
|
, mContext( project )
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
mDelayCheckBox = NULL;
|
|
|
|
mDirectoryTextBox = NULL;
|
|
|
|
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
mStatus = CreateStatusBar(3);
|
2010-01-23 19:44:49 +00:00
|
|
|
mCommand = CreateCommand();
|
|
|
|
|
|
|
|
Populate();
|
|
|
|
|
2011-05-03 12:00:45 +00:00
|
|
|
// Reset the toolbars to a known state.
|
|
|
|
// Note that the audio could be playing.
|
|
|
|
// The monitoring will switch off temporarily
|
|
|
|
// because we've switched monitor mid play.
|
2017-06-22 15:38:50 +00:00
|
|
|
// Bug 383 - Resetting the toolbars is not wanted.
|
|
|
|
// Any that are invisible will be amde visible as/when needed.
|
2019-05-01 17:18:39 +00:00
|
|
|
//ToolManager::Get( mContext.project ).Reset();
|
2017-05-14 16:36:18 +00:00
|
|
|
Center();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
ScreenshotBigDialog::~ScreenshotBigDialog()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2017-08-07 20:11:20 +00:00
|
|
|
if (this == mFrame)
|
|
|
|
mFrame = nullptr;
|
|
|
|
else
|
|
|
|
// There should only be one!
|
|
|
|
wxASSERT(false);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::Populate()
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
ShuttleGui S(this, eIsCreating);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::PopulateOrExchange(ShuttleGui & S)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
wxPanel *p = S.StartPanel();
|
2018-08-10 14:35:06 +00:00
|
|
|
RTL_WORKAROUND(p);
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.SetBorder(3);
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Choose location to save files"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartMultiColumn(3, wxEXPAND);
|
|
|
|
{
|
|
|
|
S.SetStretchyCol(1);
|
|
|
|
|
|
|
|
mDirectoryTextBox =
|
2018-01-31 01:03:46 +00:00
|
|
|
S.Id(IdDirectory).AddTextBox(
|
2020-05-11 15:28:14 +00:00
|
|
|
XXO("Save images to:"),
|
2018-01-31 01:03:46 +00:00
|
|
|
gPrefs->Read(wxT("/ScreenshotPath"), wxFileName::GetHomeDir()),
|
|
|
|
30
|
|
|
|
);
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdDirChoose).AddButton(XXO("Choose..."));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndMultiColumn();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Capture entire window or screen"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdMainWindowSmall).AddButton(XXO("Resize Small"));
|
|
|
|
S.Id(IdMainWindowLarge).AddButton(XXO("Resize Large"));
|
2019-03-28 15:55:54 +00:00
|
|
|
mBlue = safenew wxToggleButton(S.GetParent(),
|
2010-01-23 19:44:49 +00:00
|
|
|
IdToggleBackgroundBlue,
|
2020-04-05 12:40:15 +00:00
|
|
|
/* i18n-hint: Bkgnd is short for background and appears on a small button
|
|
|
|
* It is OK to just translate this item as if it said 'Blue' */
|
2010-01-23 19:44:49 +00:00
|
|
|
_("Blue Bkgnd"));
|
|
|
|
S.AddWindow(mBlue);
|
2019-03-28 15:55:54 +00:00
|
|
|
mWhite = safenew wxToggleButton(S.GetParent(),
|
2010-01-23 19:44:49 +00:00
|
|
|
IdToggleBackgroundWhite,
|
2020-04-05 12:40:15 +00:00
|
|
|
/* i18n-hint: Bkgnd is short for background and appears on a small button
|
|
|
|
* It is OK to just translate this item as if it said 'White' */
|
2010-01-23 19:44:49 +00:00
|
|
|
_("White Bkgnd"));
|
|
|
|
S.AddWindow(mWhite);
|
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureWindowContents).AddButton(XXO("Capture Window Only"));
|
|
|
|
S.Id(IdCaptureFullWindow).AddButton(XXO("Capture Full Window"));
|
|
|
|
S.Id(IdCaptureWindowPlus).AddButton(XXO("Capture Window Plus"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureFullScreen).AddButton(XXO("Capture Full Screen"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2019-12-24 05:30:04 +00:00
|
|
|
mDelayCheckBox = S.Id(IdDelayCheckBox).AddCheckBox(
|
2020-05-11 15:28:14 +00:00
|
|
|
XXO("Wait 5 seconds and capture frontmost window/dialog"),
|
2018-02-02 02:37:34 +00:00
|
|
|
false);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Capture part of a project window"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureToolbars).AddButton(XXO("All Toolbars"));
|
|
|
|
S.Id(IdCaptureEffects).AddButton(XXO("All Effects"));
|
|
|
|
S.Id(IdCaptureScriptables).AddButton(XXO("All Scriptables"));
|
|
|
|
S.Id(IdCapturePreferences).AddButton(XXO("All Preferences"));
|
2017-06-02 22:52:53 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureSelectionBar).AddButton(XXO("SelectionBar"));
|
|
|
|
S.Id(IdCaptureSpectralSelection).AddButton(XXO("Spectral Selection"));
|
|
|
|
S.Id(IdCaptureTimer).AddButton(XXO("Timer"));
|
|
|
|
S.Id(IdCaptureTools).AddButton(XXO("Tools"));
|
|
|
|
S.Id(IdCaptureTransport).AddButton(XXO("Transport"));
|
2017-06-10 20:32:04 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureMixer).AddButton(XXO("Mixer"));
|
|
|
|
S.Id(IdCaptureMeter).AddButton(XXO("Meter"));
|
|
|
|
S.Id(IdCapturePlayMeter).AddButton(XXO("Play Meter"));
|
|
|
|
S.Id(IdCaptureRecordMeter).AddButton(XXO("Record Meter"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureEdit).AddButton(XXO("Edit"));
|
|
|
|
S.Id(IdCaptureDevice).AddButton(XXO("Device"));
|
|
|
|
S.Id(IdCaptureTranscription).AddButton(XXO("Play-at-Speed"));
|
|
|
|
S.Id(IdCaptureScrub).AddButton(XXO("Scrub"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdCaptureTrackPanel).AddButton(XXO("Track Panel"));
|
|
|
|
S.Id(IdCaptureRuler).AddButton(XXO("Ruler"));
|
|
|
|
S.Id(IdCaptureTracks).AddButton(XXO("Tracks"));
|
|
|
|
S.Id(IdCaptureFirstTrack).AddButton(XXO("First Track"));
|
|
|
|
S.Id(IdCaptureSecondTrack).AddButton(XXO("Second Track"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
|
|
|
|
2019-12-22 19:58:36 +00:00
|
|
|
S.StartStatic(XO("Scale"));
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdOneSec).AddButton(XXO("One Sec"));
|
|
|
|
S.Id(IdTenSec).AddButton(XXO("Ten Sec"));
|
|
|
|
S.Id(IdOneMin).AddButton(XXO("One Min"));
|
|
|
|
S.Id(IdFiveMin).AddButton(XXO("Five Min"));
|
|
|
|
S.Id(IdOneHour).AddButton(XXO("One Hour"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
|
|
|
|
S.StartHorizontalLay();
|
|
|
|
{
|
2020-05-11 15:28:14 +00:00
|
|
|
S.Id(IdShortTracks).AddButton(XXO("Short Tracks"));
|
|
|
|
S.Id(IdMedTracks).AddButton(XXO("Medium Tracks"));
|
|
|
|
S.Id(IdTallTracks).AddButton(XXO("Tall Tracks"));
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
}
|
|
|
|
S.EndStatic();
|
2019-07-16 12:24:38 +00:00
|
|
|
S.AddStandardButtons(eCloseButton |eHelpButton);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndPanel();
|
|
|
|
|
|
|
|
Layout();
|
2015-07-31 11:45:57 +00:00
|
|
|
GetSizer()->Fit(this);
|
2010-01-23 19:44:49 +00:00
|
|
|
SetMinSize(GetSize());
|
|
|
|
|
|
|
|
int top = 0;
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
// Allow for Mac menu bar
|
|
|
|
top += 20;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int width, height;
|
|
|
|
GetSize(&width, &height);
|
|
|
|
int displayWidth, displayHeight;
|
|
|
|
wxDisplaySize(&displayWidth, &displayHeight);
|
|
|
|
|
|
|
|
if (width > 100) {
|
|
|
|
Move(displayWidth - width - 16, top + 16);
|
|
|
|
}
|
|
|
|
else {
|
2014-06-03 20:30:19 +00:00
|
|
|
CentreOnParent();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 17:12:56 +00:00
|
|
|
SetIcon( GetProjectFrame( mContext.project ).GetIcon() );
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
bool ScreenshotBigDialog::ProcessEvent(wxEvent & e)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2021-02-14 07:25:52 +00:00
|
|
|
if (!IsFrozen())
|
2017-08-14 17:53:44 +00:00
|
|
|
{
|
2021-02-14 07:25:52 +00:00
|
|
|
int id = e.GetId();
|
|
|
|
|
|
|
|
// If split into two parts to make for easier breakpoint
|
|
|
|
// when testing timer.
|
|
|
|
if (mDelayCheckBox &&
|
|
|
|
mDelayCheckBox->GetValue() &&
|
|
|
|
e.IsCommandEvent() &&
|
|
|
|
e.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
|
|
|
|
{
|
|
|
|
if( id >= IdAllDelayedEvents && id <= IdLastDelayedEvent &&
|
|
|
|
e.GetEventObject() != NULL) {
|
|
|
|
mTimer = std::make_unique<ScreenFrameTimer>(this, e);
|
|
|
|
mTimer->Start(5000, true);
|
|
|
|
return true;
|
|
|
|
}
|
2017-08-14 17:53:44 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2021-02-14 07:25:52 +00:00
|
|
|
if (e.IsCommandEvent() && e.GetEventObject() == NULL) {
|
|
|
|
e.SetEventObject(this);
|
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2021-02-14 07:25:52 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
return wxFrame::ProcessEvent(e);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnCloseWindow(wxCloseEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2020-03-23 12:52:16 +00:00
|
|
|
if (mDirectoryTextBox->IsModified()) {
|
|
|
|
gPrefs->Write(wxT("/ScreenshotPath"), mDirectoryTextBox->GetValue());
|
|
|
|
gPrefs->Flush();
|
|
|
|
}
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
2019-07-16 12:24:38 +00:00
|
|
|
{
|
2020-03-23 12:52:16 +00:00
|
|
|
if (mDirectoryTextBox->IsModified()) {
|
|
|
|
gPrefs->Write(wxT("/ScreenshotPath"), mDirectoryTextBox->GetValue());
|
|
|
|
gPrefs->Flush();
|
|
|
|
}
|
|
|
|
|
2019-07-16 12:24:38 +00:00
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnGetURL(wxCommandEvent & WXUNUSED(event))
|
2019-07-16 12:24:38 +00:00
|
|
|
{
|
|
|
|
HelpSystem::ShowHelp(this, wxT("Screenshot"));
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnUIUpdate(wxUpdateUIEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
#ifdef __WXMAC__
|
2020-01-04 18:52:24 +00:00
|
|
|
wxTopLevelWindow *top = mCommand->GetFrontWindow(&mProject);
|
2010-01-23 19:44:49 +00:00
|
|
|
bool needupdate = false;
|
|
|
|
bool enable = false;
|
|
|
|
|
|
|
|
if ((!top || top->IsIconized()) && mDirectoryTextBox->IsEnabled()) {
|
|
|
|
needupdate = true;
|
|
|
|
enable = false;
|
|
|
|
}
|
|
|
|
else if ((top && !top->IsIconized()) && !mDirectoryTextBox->IsEnabled()) {
|
|
|
|
needupdate = true;
|
|
|
|
enable = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needupdate) {
|
|
|
|
for (int i = IdMainWindowSmall; i < IdLastDelayedEvent; i++) {
|
|
|
|
wxWindow *w = wxWindow::FindWindowById(i, this);
|
|
|
|
if (w) {
|
|
|
|
w->Enable(enable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnDirChoose(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
wxString current = mDirectoryTextBox->GetValue();
|
|
|
|
|
2017-10-12 19:23:52 +00:00
|
|
|
wxDirDialogWrapper dlog(this,
|
2019-12-20 17:13:39 +00:00
|
|
|
XO("Choose a location to save screenshot images"),
|
|
|
|
current);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
dlog.ShowModal();
|
2019-03-14 17:04:37 +00:00
|
|
|
if (!dlog.GetPath().empty()) {
|
2010-01-23 19:44:49 +00:00
|
|
|
wxFileName tmpDirPath;
|
|
|
|
tmpDirPath.AssignDir(dlog.GetPath());
|
|
|
|
wxString path = tmpDirPath.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR);
|
|
|
|
mDirectoryTextBox->SetValue(path);
|
|
|
|
gPrefs->Write(wxT("/ScreenshotPath"), path);
|
2012-08-02 06:03:19 +00:00
|
|
|
gPrefs->Flush();
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
mCommand->mPath = path;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnToggleBackgroundBlue(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
mWhite->SetValue(false);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnToggleBackgroundWhite(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
mBlue->SetValue(false);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::SizeMainWindow(int w, int h)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
int top = 20;
|
|
|
|
|
2019-05-28 17:12:56 +00:00
|
|
|
auto &window = GetProjectFrame( mContext.project );
|
|
|
|
window.Maximize(false);
|
|
|
|
window.SetSize(16, 16 + top, w, h);
|
2017-06-25 10:21:24 +00:00
|
|
|
//Bug383 - Toolbar Resets not wanted.
|
2019-05-01 17:18:39 +00:00
|
|
|
//ToolManager::Get( mContext.project ).Reset();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnMainWindowSmall(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
SizeMainWindow(680, 450);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnMainWindowLarge(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
SizeMainWindow(900, 600);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::DoCapture(int captureMode)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
Hide();
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
//mCommand->SetParameter(wxT("FilePath"), mDirectoryTextBox->GetValue());
|
|
|
|
//mCommand->SetParameter(wxT("CaptureMode"), captureMode);
|
2018-03-26 18:03:27 +00:00
|
|
|
mCommand->mBack = mWhite->GetValue()
|
|
|
|
? ScreenshotCommand::kWhite
|
|
|
|
: mBlue->GetValue()
|
|
|
|
? ScreenshotCommand::kBlue : ScreenshotCommand::kNone;
|
Automation: AudacityCommand
This is a squash of 50 commits.
This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class. AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.
- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
- Tested with Zoom Toggle.
- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.
We abuse EffectsManager. It handles both Effects and
AudacityCommands now. In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.
- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.
This way we can search for related types at the same time.
- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason. They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.
- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
which are now better handled by other commands.
- JSONify "GetInfo: Commands" output, i.e. commas in the right places.
- General work on better Doxygen.
- Lyrics -> LyricsPanel
- Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-01-14 18:51:41 +00:00
|
|
|
mCommand->mPath = mDirectoryTextBox->GetValue();
|
|
|
|
mCommand->mWhat = captureMode;
|
2010-01-23 19:44:49 +00:00
|
|
|
if (!mCommand->Apply(mContext))
|
2018-01-03 01:14:12 +00:00
|
|
|
mStatus->SetStatusText(_("Capture failed!"), mainStatusBarField);
|
2010-01-23 19:44:49 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnCaptureSomething(wxCommandEvent & event)
|
2017-06-10 20:32:04 +00:00
|
|
|
{
|
|
|
|
int i = event.GetId() - IdCaptureFirst;
|
|
|
|
|
2018-03-26 18:03:27 +00:00
|
|
|
/*
|
|
|
|
IdCaptureEffects= IdCaptureFirst,
|
|
|
|
IdCaptureScriptables,
|
|
|
|
IdCapturePreferences,
|
|
|
|
IdCaptureToolbars,
|
|
|
|
|
|
|
|
// Put all events that need delay between AllDelayed and LastDelayed.
|
|
|
|
IdAllDelayedEvents,
|
|
|
|
IdCaptureWindowContents=IdAllDelayedEvents,
|
|
|
|
IdCaptureFullWindow,
|
|
|
|
IdCaptureWindowPlus,
|
|
|
|
IdCaptureFullScreen,
|
2019-10-14 17:00:26 +00:00
|
|
|
|
2018-03-26 18:03:27 +00:00
|
|
|
IdCaptureSelectionBar,
|
|
|
|
IdCaptureSpectralSelection,
|
|
|
|
IdCaptureTools,
|
|
|
|
IdCaptureTransport,
|
|
|
|
IdCaptureMixer,
|
|
|
|
IdCaptureMeter,
|
|
|
|
IdCapturePlayMeter,
|
|
|
|
IdCaptureRecordMeter,
|
|
|
|
IdCaptureEdit,
|
|
|
|
IdCaptureDevice,
|
|
|
|
IdCaptureTranscription,
|
|
|
|
IdCaptureScrub,
|
|
|
|
|
|
|
|
IdCaptureTrackPanel,
|
|
|
|
IdCaptureRuler,
|
|
|
|
IdCaptureTracks,
|
|
|
|
IdCaptureFirstTrack,
|
|
|
|
IdCaptureSecondTrack,
|
|
|
|
IdCaptureLast = IdCaptureSecondTrack,
|
|
|
|
*/
|
|
|
|
|
2018-03-26 21:05:59 +00:00
|
|
|
static const int codes[] = {
|
2018-03-26 18:03:27 +00:00
|
|
|
ScreenshotCommand::keffects,
|
|
|
|
ScreenshotCommand::kscriptables,
|
|
|
|
ScreenshotCommand::kpreferences,
|
|
|
|
ScreenshotCommand::ktoolbars,
|
|
|
|
|
|
|
|
ScreenshotCommand::kwindow,
|
|
|
|
ScreenshotCommand::kfullwindow,
|
|
|
|
ScreenshotCommand::kwindowplus,
|
|
|
|
ScreenshotCommand::kfullscreen,
|
|
|
|
ScreenshotCommand::kselectionbar,
|
|
|
|
ScreenshotCommand::kspectralselection,
|
2020-02-17 22:50:56 +00:00
|
|
|
ScreenshotCommand::ktimer,
|
2018-03-26 18:03:27 +00:00
|
|
|
ScreenshotCommand::ktools,
|
|
|
|
ScreenshotCommand::ktransport,
|
|
|
|
ScreenshotCommand::kmixer,
|
|
|
|
ScreenshotCommand::kmeter,
|
|
|
|
ScreenshotCommand::kplaymeter,
|
|
|
|
ScreenshotCommand::krecordmeter,
|
|
|
|
ScreenshotCommand::kedit,
|
|
|
|
ScreenshotCommand::kdevice,
|
|
|
|
ScreenshotCommand::ktranscription,
|
|
|
|
ScreenshotCommand::kscrub,
|
|
|
|
ScreenshotCommand::ktrackpanel,
|
|
|
|
ScreenshotCommand::kruler,
|
|
|
|
ScreenshotCommand::ktracks,
|
|
|
|
ScreenshotCommand::kfirsttrack,
|
|
|
|
ScreenshotCommand::ksecondtrack,
|
|
|
|
};
|
|
|
|
|
|
|
|
DoCapture(codes[i]);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::TimeZoom(double seconds)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2019-04-28 10:49:47 +00:00
|
|
|
auto &viewInfo = ViewInfo::Get( mContext.project );
|
2019-05-28 17:12:56 +00:00
|
|
|
auto &window = ProjectWindow::Get( mContext.project );
|
2010-01-23 19:44:49 +00:00
|
|
|
int width, height;
|
2019-05-28 17:12:56 +00:00
|
|
|
window.GetClientSize(&width, &height);
|
2019-04-28 10:49:47 +00:00
|
|
|
viewInfo.SetZoom((0.75 * width) / seconds);
|
2019-05-28 17:12:56 +00:00
|
|
|
window.RedrawProject();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnOneSec(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
TimeZoom(1.0);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnTenSec(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
TimeZoom(10.0);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnOneMin(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
TimeZoom(60.0);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnFiveMin(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
TimeZoom(300.0);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnOneHour(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
TimeZoom(3600.0);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::SizeTracks(int h)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2017-04-16 20:36:46 +00:00
|
|
|
// h is the height for a channel
|
|
|
|
// Set the height of a mono track twice as high
|
|
|
|
|
|
|
|
// TODO: more-than-two-channels
|
|
|
|
// If there should be more-than-stereo tracks, this makes
|
|
|
|
// each channel as high as for a stereo channel
|
|
|
|
|
2019-05-06 23:00:10 +00:00
|
|
|
auto &tracks = TrackList::Get( mContext.project );
|
|
|
|
for (auto t : tracks.Leaders<WaveTrack>()) {
|
2017-04-16 20:36:46 +00:00
|
|
|
auto channels = TrackList::Channels(t);
|
|
|
|
auto nChannels = channels.size();
|
|
|
|
auto height = nChannels == 1 ? 2 * h : h;
|
|
|
|
for (auto channel : channels)
|
2019-06-18 15:32:26 +00:00
|
|
|
TrackView::Get( *channel ).SetHeight(height);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2019-05-28 17:12:56 +00:00
|
|
|
ProjectWindow::Get( mContext.project ).RedrawProject();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnShortTracks(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2019-06-18 15:32:26 +00:00
|
|
|
for (auto t : TrackList::Get( mContext.project ).Any<WaveTrack>()) {
|
|
|
|
auto &view = TrackView::Get( *t );
|
|
|
|
view.SetHeight( view.GetMinimizedHeight() );
|
|
|
|
}
|
2018-09-18 16:03:37 +00:00
|
|
|
|
2019-05-28 17:12:56 +00:00
|
|
|
ProjectWindow::Get( mContext.project ).RedrawProject();
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnMedTracks(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
SizeTracks(60);
|
|
|
|
}
|
|
|
|
|
2019-12-06 10:39:07 +00:00
|
|
|
void ScreenshotBigDialog::OnTallTracks(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
SizeTracks(85);
|
|
|
|
}
|
2021-02-14 07:25:52 +00:00
|
|
|
|
|
|
|
void ScreenshotBigDialog::UpdatePrefs()
|
|
|
|
{
|
|
|
|
Freeze();
|
|
|
|
|
|
|
|
SetSizer(nullptr);
|
|
|
|
DestroyChildren();
|
|
|
|
|
|
|
|
SetTitle(ScreenCaptureFrameTitle.Translation());
|
|
|
|
Populate();
|
|
|
|
|
|
|
|
Thaw();
|
|
|
|
}
|