mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-23 15:50:05 +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
85c36fe7fe
commit
1f605ccfc8
@ -66,10 +66,10 @@ CommandContext::CommandContext(
|
||||
{
|
||||
}
|
||||
|
||||
void CommandContext::Status( const wxString & message ) const
|
||||
void CommandContext::Status( const wxString & message, bool bFlush ) const
|
||||
{
|
||||
if( pOutput )
|
||||
pOutput->Status( message );
|
||||
pOutput->Status( message, bFlush );
|
||||
else
|
||||
{
|
||||
wxLogDebug("Status:%s", message );
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
AudacityProject &p,
|
||||
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 Progress( double WXUNUSED(d) ) const;
|
||||
|
||||
|
@ -304,10 +304,13 @@ public:
|
||||
if (mProgressTarget)
|
||||
mProgressTarget->Update(completed);
|
||||
}
|
||||
void Status(const wxString &status)
|
||||
void Status(const wxString &status, bool bFlush=false)
|
||||
{
|
||||
if (mStatusTarget)
|
||||
if (mStatusTarget){
|
||||
mStatusTarget->Update(status);
|
||||
if( bFlush )
|
||||
mStatusTarget->Flush();
|
||||
}
|
||||
}
|
||||
void Error(const wxString &message)
|
||||
{
|
||||
|
@ -299,7 +299,8 @@ bool ScreenshotCommand::Capture(
|
||||
::wxBell();
|
||||
|
||||
if (image.SaveFile(filename)) {
|
||||
context.Status( wxString::Format( _("Saved %s"), filename ) );
|
||||
// flush
|
||||
context.Status( wxString::Format( _("Saved %s"), filename ), true );
|
||||
}
|
||||
else {
|
||||
context.Error(
|
||||
@ -815,7 +816,7 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
||||
CapturePreferences(context, context.GetProject(), mFileName);
|
||||
else if (mCaptureMode.IsSameAs(wxT("Selectionbar")))
|
||||
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);
|
||||
else if (mCaptureMode.IsSameAs(wxT("Tools")))
|
||||
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) );
|
||||
else if (mCaptureMode.IsSameAs(wxT("Tracks")))
|
||||
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 ) );
|
||||
else if (mCaptureMode.IsSameAs(wxT("Secondtrack")))
|
||||
else if (mCaptureMode.IsSameAs(wxT("Second_Track")))
|
||||
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
|
||||
else
|
||||
return false;
|
||||
|
@ -71,7 +71,7 @@ int ExecCommand(wxString *pIn, wxString *pOut)
|
||||
if (builder.WasValid())
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
project->SafeDisplayStatusMessage(wxT("Received script command"));
|
||||
//project->SafeDisplayStatusMessage(wxT("Received script command"));
|
||||
OldStyleCommandPointer cmd = builder.GetCommand();
|
||||
ScriptCommandRelay::PostCommand(project, cmd);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user