mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Fix ScreenshotCommand
- Show Status immediately (Flush), don't wait for window to be closed. - Correct strings with _ in them. - Remove unhelpful 'Received Script Command' message.
This commit is contained in:
parent
e0ee34e877
commit
590b471eb7
@ -65,10 +65,10 @@ CommandContext::CommandContext(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandContext::Status( const wxString & message ) const
|
void CommandContext::Status( const wxString & message, bool bFlush ) const
|
||||||
{
|
{
|
||||||
if( pOutput )
|
if( pOutput )
|
||||||
pOutput->Status( message );
|
pOutput->Status( message, bFlush );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogDebug("Status:%s", message );
|
wxLogDebug("Status:%s", message );
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
AudacityProject &p,
|
AudacityProject &p,
|
||||||
std::unique_ptr<CommandOutputTargets> target);
|
std::unique_ptr<CommandOutputTargets> target);
|
||||||
|
|
||||||
virtual void Status( const wxString & WXUNUSED(message) ) const;
|
virtual void Status( const wxString & WXUNUSED(message), bool bFlush = false ) const;
|
||||||
virtual void Error( const wxString & WXUNUSED(message) ) const;
|
virtual void Error( const wxString & WXUNUSED(message) ) const;
|
||||||
virtual void Progress( double WXUNUSED(d) ) const;
|
virtual void Progress( double WXUNUSED(d) ) const;
|
||||||
|
|
||||||
|
@ -304,10 +304,13 @@ public:
|
|||||||
if (mProgressTarget)
|
if (mProgressTarget)
|
||||||
mProgressTarget->Update(completed);
|
mProgressTarget->Update(completed);
|
||||||
}
|
}
|
||||||
void Status(const wxString &status)
|
void Status(const wxString &status, bool bFlush=false)
|
||||||
{
|
{
|
||||||
if (mStatusTarget)
|
if (mStatusTarget){
|
||||||
mStatusTarget->Update(status);
|
mStatusTarget->Update(status);
|
||||||
|
if( bFlush )
|
||||||
|
mStatusTarget->Flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Error(const wxString &message)
|
void Error(const wxString &message)
|
||||||
{
|
{
|
||||||
|
@ -299,7 +299,8 @@ bool ScreenshotCommand::Capture(
|
|||||||
::wxBell();
|
::wxBell();
|
||||||
|
|
||||||
if (image.SaveFile(filename)) {
|
if (image.SaveFile(filename)) {
|
||||||
context.Status( wxString::Format( _("Saved %s"), filename ) );
|
// flush
|
||||||
|
context.Status( wxString::Format( _("Saved %s"), filename ), true );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
context.Error(
|
context.Error(
|
||||||
@ -815,7 +816,7 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
CapturePreferences(context, context.GetProject(), mFileName);
|
CapturePreferences(context, context.GetProject(), mFileName);
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Selectionbar")))
|
else if (mCaptureMode.IsSameAs(wxT("Selectionbar")))
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SelectionBarID, mFileName);
|
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SelectionBarID, mFileName);
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Spectral__Selection")))
|
else if (mCaptureMode.IsSameAs(wxT("Spectral_Selection")))
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SpectralSelectionBarID, mFileName);
|
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SpectralSelectionBarID, mFileName);
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Tools")))
|
else if (mCaptureMode.IsSameAs(wxT("Tools")))
|
||||||
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ToolsBarID, mFileName);
|
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ToolsBarID, mFileName);
|
||||||
@ -843,9 +844,9 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
return Capture(context, mFileName, ruler, GetRulerRect(ruler) );
|
return Capture(context, mFileName, ruler, GetRulerRect(ruler) );
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Tracks")))
|
else if (mCaptureMode.IsSameAs(wxT("Tracks")))
|
||||||
return Capture(context, mFileName, panel, GetTracksRect(panel));
|
return Capture(context, mFileName, panel, GetTracksRect(panel));
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Firsttrack")))
|
else if (mCaptureMode.IsSameAs(wxT("First_Track")))
|
||||||
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 0 ) );
|
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 0 ) );
|
||||||
else if (mCaptureMode.IsSameAs(wxT("Secondtrack")))
|
else if (mCaptureMode.IsSameAs(wxT("Second_Track")))
|
||||||
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
|
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,7 +71,7 @@ int ExecCommand(wxString *pIn, wxString *pOut)
|
|||||||
if (builder.WasValid())
|
if (builder.WasValid())
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = GetActiveProject();
|
||||||
project->SafeDisplayStatusMessage(wxT("Received script command"));
|
//project->SafeDisplayStatusMessage(wxT("Received script command"));
|
||||||
OldStyleCommandPointer cmd = builder.GetCommand();
|
OldStyleCommandPointer cmd = builder.GetCommand();
|
||||||
ScriptCommandRelay::PostCommand(project, cmd);
|
ScriptCommandRelay::PostCommand(project, cmd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user