1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Scripts in Piped-Work

- New docimages script for the tracks.
- Added new option in screenshots to capture ruler as well as track.
- Typo fix (focussed)
This commit is contained in:
James Crook
2018-02-10 19:50:30 +00:00
committed by Paul Licameli
parent 1f605ccfc8
commit 24e8bbc623
7 changed files with 146 additions and 13 deletions

View File

@@ -73,6 +73,8 @@ enum kCaptureTypes
ktracks,
kfirsttrack,
ksecondtrack,
ktracksplus,
kfirsttrackplus,
nCaptureWhats
};
@@ -103,6 +105,8 @@ static const wxString kCaptureWhatStrings[nCaptureWhats] =
XO("Tracks"),
XO("First_Track"),
XO("Second_Track")
XO("Tracks_Plus"),
XO("First_Track_Plus"),
};
@@ -267,14 +271,15 @@ bool ScreenshotCommand::Capture(
//wxRect r(x, y, width, height);
// Ensure within bounds (x/y are negative on Windows when maximized)
r.Intersect(wxRect(0, 0, screenW, screenH));
// Convert to screen coordinates if needed
if (window && window->GetParent() && !window->IsTopLevel()) {
r.SetPosition(window->GetParent()->ClientToScreen(r.GetPosition()));
}
// Ensure within bounds (x/y are negative on Windows when maximized)
r.Intersect(wxRect(0, 0, screenW, screenH));
// Extract the actual image
wxBitmap part = full.GetSubBitmap(r);
@@ -799,6 +804,12 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
TrackPanel *panel = context.GetProject()->GetTrackPanel();
AdornedRulerPanel *ruler = panel->mRuler;
int x1,y1,x2,y2;
w->ClientToScreen(&x1, &y1);
panel->ClientToScreen(&x2, &y2);
wxPoint p( x2-x1, y2-y1);
if (mCaptureMode.IsSameAs(wxT("Window")))
return Capture(context, WindowFileName( context.GetProject(), w ) , w, GetWindowRect(w));
else if (mCaptureMode.IsSameAs(wxT("Fullwindow"))
@@ -848,6 +859,18 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 0 ) );
else if (mCaptureMode.IsSameAs(wxT("Second_Track")))
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
else if (mCaptureMode.IsSameAs(wxT("Tracks_Plus")))
{ wxRect r = GetTracksRect(panel);
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
return Capture(context, mFileName, panel, r);
}
else if (mCaptureMode.IsSameAs(wxT("First_Track_Plus")))
{ wxRect r = GetTrackRect(context.GetProject(), panel, 0 );
r.SetTop( r.GetTop() - ruler->GetRulerHeight() );
r.SetHeight( r.GetHeight() + ruler->GetRulerHeight() );
return Capture(context, mFileName, panel, r );
}
else
return false;

View File

@@ -27,16 +27,7 @@
#include "CommandContext.h"
SetTrackCommand::SetTrackCommand()
{/*
mTrackIndex = 0;
mTrackName = "unnamed";
mPan = 0.0f;
mGain = 1.0f;
bSelected = false;
bFocused = false;
bSolo = false;
bMute = false;
*/
{
}
enum kColours
@@ -65,7 +56,7 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){
S.Optional( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 );
S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
S.Optional( bHasSelected ).Define( bSelected, wxT("Selected"), false );
S.Optional( bHasFocused ).Define( bFocused, wxT("Focuseed"), false );
S.Optional( bHasFocused ).Define( bFocused, wxT("Focused"), false );
S.Optional( bHasSolo ).Define( bSolo, wxT("Solo"), false );
S.Optional( bHasMute ).Define( bMute, wxT("Mute"), false );
return true;