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

Script work

Add Envelope script
Add Clips and Boundaries Scripts.
Add docimages_oddments.py for the weirder cases.
Add make html script.
Add more spectral images
Add Dark versions of spectrograms (paul's comment)
Clean up oddments script.

- This commit also adds an option NOT to bring Audacity to the top when screenshotting.
-- That's because QuickPlay will disappear if you do -because you lose mouse capture.
- Also allow negative window IDs in the drag command.

- Registration names of align commands sorted.  They had &, : and / in them.
- Fixed bug in SetTrackInfo where bFocused was being ignored
- Fixed bug where command manager ignored multi-commands.
- Commit docimages_oddments.py again, to fix line endings.
This commit is contained in:
James Crook
2018-02-17 16:08:38 +00:00
committed by Paul Licameli
parent 4724c6a131
commit fa49d94530
22 changed files with 951 additions and 48 deletions

View File

@@ -947,7 +947,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
count, {});
}
CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
CommandListEntry *CommandManager::NewIdentifier(const wxString & nameIn,
const wxString & label,
const wxString & accel,
wxMenu *menu,
@@ -958,6 +958,8 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
int count,
const CommandParameter &parameter)
{
wxString name = nameIn;
// If we have the identifier already, reuse it.
CommandListEntry *prev = mCommandNameHash[name];
if (!prev);
@@ -975,6 +977,18 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
labelPrefix = mSubMenuList.back()->name;
}
// For key bindings for commands with a list, such as align,
// the name in prefs is the category name plus the effect name.
// This feature is not used for built-in effects.
if (multi) {
// The name needs to be clean for use by automation.
wxString cleanedName = wxString::Format(wxT("%s_%s"), name, label);
cleanedName.Replace( "/", "" );
cleanedName.Replace( "&", "" );
cleanedName.Replace( " ", "" );
name = cleanedName;
}
// wxMac 2.5 and higher will do special things with the
// Preferences, Exit (Quit), and About menu items,
// if we give them the right IDs.
@@ -1024,13 +1038,6 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
if( mMaxListOnly.Index( entry->key ) !=-1)
entry->key = wxT("");
// For key bindings for commands with a list, such as effects,
// the name in prefs is the category name plus the effect name.
if (multi) {
entry->name = wxString::Format(wxT("%s:%s"), name, label);
}
// Key from preferences overridse the default key given
gPrefs->SetPath(wxT("/NewKeys"));
if (gPrefs->HasEntry(entry->name)) {
@@ -1551,6 +1558,14 @@ bool CommandManager::HandleTextualCommand(const wxString & Str, const CommandCon
return HandleCommandEntry( entry.get(), flags, mask);
}
}
else
{
// Handle multis too...
if( Str.IsSameAs( entry->name, false ) )
{
return HandleCommandEntry( entry.get(), flags, mask);
}
}
}
// Not one of the singleton commands.
// We could/should try all the list-style commands.

View File

@@ -49,7 +49,7 @@ static const wxString kCoordTypeStrings[nCoordTypes] =
bool DragCommand::DefineParams( ShuttleParams & S ){
wxArrayString coords( nCoordTypes, kCoordTypeStrings );
S.OptionalN( bHasId ).Define( mId, wxT("Id"), 0.0, 11000.0, 1000000.0);
S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000.0, -100000.0, 1000000.0);
S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), "Timeline");
S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);

View File

@@ -139,9 +139,10 @@ static const wxString kBackgroundStrings[nBackgrounds] =
bool ScreenshotCommand::DefineParams( ShuttleParams & S ){
wxArrayString whats(nCaptureWhats, kCaptureWhatStrings);
wxArrayString backs(nBackgrounds, kBackgroundStrings);
S.Define( mPath, wxT("Path"), wxT(""));
S.DefineEnum( mWhat, wxT("CaptureWhat"), wxT("Window"), whats );
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), wxT("None"), backs );
S.Define( mPath, wxT("Path"), wxT(""));
S.DefineEnum( mWhat, wxT("CaptureWhat"), wxT("Window"), whats );
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), wxT("None"), backs );
S.OptionalN(bHasBringToTop).Define( mbBringToTop, wxT("ToTop"), true );
return true;
};
@@ -153,9 +154,10 @@ void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox( _("Path:"), mPath);
S.TieChoice( _("Capture What:"), mWhat, &whats);
S.TieChoice( _("Background:"), mBack, &backs);
S.TieTextBox( _("Path:"), mPath);
S.TieChoice( _("Capture What:"), mWhat, &whats);
S.TieChoice( _("Background:"), mBack, &backs);
S.TieCheckBox( _("Bring To Top:"), mbBringToTop);
}
S.EndMultiColumn();
}
@@ -247,16 +249,18 @@ bool ScreenshotCommand::Capture(
int height = r.height;
if( r.width == 0 )
return false;
if (window) {
if (window->IsTopLevel()) {
window->Raise();
}
else {
wxGetTopLevelParent(window)->Raise();
if (window ) {
wxWindow * win = window;
wxTopLevelWindow * top_win= nullptr;
if( !window->IsTopLevel())
win = wxGetTopLevelParent(window);
top_win = dynamic_cast<wxTopLevelWindow*>( win );
if( (!bHasBringToTop || mbBringToTop) && (!top_win || !top_win->IsActive()) ){
win->Raise();
Yield();
}
}
Yield();
int screenW, screenH;
wxDisplaySize(&screenW, &screenH);

View File

@@ -33,6 +33,7 @@ class CommandContext;
class ScreenshotCommand : public AudacityCommand
{
public:
ScreenshotCommand(){ mbBringToTop=true;};
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SCREENSHOT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Takes screenshots.");};
@@ -46,7 +47,9 @@ private:
wxString mWhat;
wxString mBack;
wxString mPath;
bool mbBringToTop;
bool bHasBackground;
bool bHasBringToTop;
friend class ScreenshotCommand;
friend class ScreenFrame;

View File

@@ -35,7 +35,7 @@ bool SetEnvelopeCommand::DefineParams( ShuttleParams & S ){
S.OptionalY( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 );
S.OptionalN( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 );
S.OptionalY( bHasT ).Define( mT, wxT("Time"), 0.0, 0.0, 100000.0);
S.OptionalY( bHasV ).Define( mV, wxT("Value"), 0.0, 0.0, 2.0);
S.OptionalY( bHasV ).Define( mV, wxT("Value"), 1.0, 0.0, 2.0);
S.OptionalN( bHasDelete ).Define( mbDelete, wxT("Delete"), false );
return true;
};

View File

@@ -77,10 +77,27 @@ static const wxString kScaleTypeStrings[nScaleTypes] =
};
enum kZoomTypes
{
kReset,
kTimes2,
kHalfWave,
nZoomTypes
};
static const wxString kZoomTypeStrings[nZoomTypes] =
{
XO("Reset"),
XO("Times2"),
XO("HalfWave"),
};
bool SetTrackCommand::DefineParams( ShuttleParams & S ){
wxArrayString colours( nColours, kColourStrings );
wxArrayString displays( nDisplayTypes, kDisplayTypeStrings );
wxArrayString scales( nScaleTypes, kScaleTypeStrings );
wxArrayString vzooms( nZoomTypes, kZoomTypeStrings );
S.OptionalY( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 );
S.OptionalN( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 );
@@ -92,6 +109,7 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales );
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, vzooms );
S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
S.OptionalN( bHasGrayScale ).Define( bGrayScale, wxT("GrayScale"), false );
@@ -108,6 +126,7 @@ void SetTrackCommand::PopulateOrExchange(ShuttleGui & S)
wxArrayString colours( nColours, kColourStrings );
wxArrayString displays( nDisplayTypes, kDisplayTypeStrings );
wxArrayString scales( nScaleTypes, kScaleTypeStrings );
wxArrayString vzooms( nZoomTypes, kZoomTypeStrings );
S.AddSpace(0, 5);
@@ -122,6 +141,7 @@ void SetTrackCommand::PopulateOrExchange(ShuttleGui & S)
S.Optional( bHasColour ).TieChoice( _("Colour:"), mColour, &colours );
S.Optional( bHasDisplayType ).TieChoice( _("Display:"), mDisplayType, &displays );
S.Optional( bHasScaleType ).TieChoice( _("Scale:"), mScaleType, &scales );
S.Optional( bHasVZoom ).TieChoice( _("VZoom:"), mVZoom, &vzooms );
}
S.EndMultiColumn();
S.StartMultiColumn(2, wxALIGN_CENTER);
@@ -188,11 +208,19 @@ bool SetTrackCommand::Apply(const CommandContext & context)
wt->GetSpectrogramSettings().spectralSelection = bSpectralSelect;
if( wt && bHasGrayScale )
wt->GetSpectrogramSettings().isGrayscale = bGrayScale;
if( wt && bHasVZoom ){
switch( mVZoom ){
default:
case kReset: wt->SetDisplayBounds(-1,1); break;
case kTimes2: wt->SetDisplayBounds(-2,2); break;
case kHalfWave: wt->SetDisplayBounds(0,1); break;
}
}
// These ones don't make sense on the second channel of a stereo track.
if( !bIsSecondChannel ){
if( bHasSelected )
t->SetSelected(bSelected);
if( bHasFocused )
if( bHasFocused && bFocused)
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
panel->SetFocusedTrack( t );

View File

@@ -47,6 +47,7 @@ public:
int mHeight;
int mDisplayType;
int mScaleType;
int mVZoom;
bool bUseSpecPrefs;
bool bSpectralSelect;
bool bGrayScale;
@@ -65,6 +66,7 @@ public:
bool bHasHeight;
bool bHasDisplayType;
bool bHasScaleType;
bool bHasVZoom;
bool bHasUseSpecPrefs;
bool bHasSpectralSelect;
bool bHasGrayScale;