diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index f62d623f7..75d5d3173 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -1272,6 +1272,7 @@ 5EF3E65B203FDACE006C6882 /* SetLabelCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E656203FDACE006C6882 /* SetLabelCommand.cpp */; }; 5EF3E65C203FDACE006C6882 /* SetProjectCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E658203FDACE006C6882 /* SetProjectCommand.cpp */; }; 5EF3E65F203FDFE9006C6882 /* SetEnvelopeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E65D203FDFE9006C6882 /* SetEnvelopeCommand.cpp */; }; + 5EF3E662203FE73C006C6882 /* DragCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E660203FE73C006C6882 /* DragCommand.cpp */; }; 5EF958851DEB121800191280 /* InconsistencyException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF958831DEB121800191280 /* InconsistencyException.cpp */; }; 8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; }; 8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; }; @@ -3179,6 +3180,8 @@ 5EF3E659203FDACE006C6882 /* SetProjectCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetProjectCommand.h; sourceTree = ""; }; 5EF3E65D203FDFE9006C6882 /* SetEnvelopeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetEnvelopeCommand.cpp; sourceTree = ""; }; 5EF3E65E203FDFE9006C6882 /* SetEnvelopeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetEnvelopeCommand.h; sourceTree = ""; }; + 5EF3E660203FE73C006C6882 /* DragCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DragCommand.cpp; sourceTree = ""; }; + 5EF3E661203FE73C006C6882 /* DragCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragCommand.h; sourceTree = ""; }; 5EF958831DEB121800191280 /* InconsistencyException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InconsistencyException.cpp; sourceTree = ""; }; 5EF958841DEB121800191280 /* InconsistencyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InconsistencyException.h; sourceTree = ""; }; 82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = ""; }; @@ -3782,6 +3785,7 @@ 28851F9F1027F16400152EE1 /* CommandType.cpp */, 28851FA11027F16400152EE1 /* CompareAudioCommand.cpp */, 5EF3E647203FBAFB006C6882 /* Demo.cpp */, + 5EF3E660203FE73C006C6882 /* DragCommand.cpp */, 5EF3E649203FBAFB006C6882 /* GetInfoCommand.cpp */, 28851FA31027F16400152EE1 /* GetTrackInfoCommand.cpp */, 28851FA51027F16400152EE1 /* HelpCommand.cpp */, @@ -3817,6 +3821,7 @@ 28851FA01027F16400152EE1 /* CommandType.h */, 28851FA21027F16400152EE1 /* CompareAudioCommand.h */, 5EF3E648203FBAFB006C6882 /* Demo.h */, + 5EF3E661203FE73C006C6882 /* DragCommand.h */, 5EF3E64A203FBAFB006C6882 /* GetInfoCommand.h */, 28851FA41027F16400152EE1 /* GetTrackInfoCommand.h */, 28851FA61027F16400152EE1 /* HelpCommand.h */, @@ -7866,6 +7871,7 @@ 5EF3E64E203FBAFB006C6882 /* CommandContext.cpp in Sources */, 2897F6F70AB3DB5A003C20C5 /* ToolManager.cpp in Sources */, 2897F6F80AB3DB5A003C20C5 /* ToolsToolBar.cpp in Sources */, + 5EF3E662203FE73C006C6882 /* DragCommand.cpp in Sources */, 2897F6F90AB3DB5A003C20C5 /* TranscriptionToolBar.cpp in Sources */, 2897F6FE0AB3DCD0003C20C5 /* Grabber.cpp in Sources */, 283DE1360AC0D4FD00E8C3AE /* XMLWriter.cpp in Sources */, diff --git a/src/Menus.cpp b/src/Menus.cpp index 89e2ecb71..d397a72fe 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -1611,6 +1611,12 @@ void AudacityProject::CreateMenusAndCommands() AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("Export2"), _("Export..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("OpenProject"), _("Open Project..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("SaveProject"), _("Save Project..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); + c->AddItem(wxT("Drag"), _("Mousing About..."), FN(OnAudacityCommand), + AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("CompareAudio"), _("Compare Audio..."), FN(OnAudacityCommand), AudioIONotBusyFlag, AudioIONotBusyFlag); c->AddItem(wxT("GetPreference"), _("Get Preference..."), FN(OnAudacityCommand), diff --git a/src/Shuttle.h b/src/Shuttle.h index 54db8c1c3..7e3f517e2 100644 --- a/src/Shuttle.h +++ b/src/Shuttle.h @@ -74,6 +74,8 @@ public: bool ExchangeWithMaster(const wxString & Name) override; bool ShouldSet(); virtual ShuttleParams & Optional( bool & var ){ pOptionalFlag = NULL;return *this;}; + virtual ShuttleParams & OptionalY( bool & var ){ return Optional( var );}; + virtual ShuttleParams & OptionalN( bool & var ){ return Optional( var );}; virtual void Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false ); virtual void Define( size_t & var, const wxChar * key, const int vdefault, const int vmin=0, const int vmax=100000, const int vscl=1 ); virtual void Define( int & var, const wxChar * key, const int vdefault, const int vmin=0, const int vmax=100000, const int vscl=1 ); @@ -156,6 +158,10 @@ class ShuttleDefaults : public ShuttleParams { public: wxString Result; + virtual ShuttleParams & Optional( bool & var )override{ var = true; pOptionalFlag = NULL;return *this;}; + virtual ShuttleParams & OptionalY( bool & var )override{ var = true; pOptionalFlag = NULL;return *this;}; + virtual ShuttleParams & OptionalN( bool & var )override{ var = false;pOptionalFlag = NULL;return *this;}; + void Define( bool & var, const wxChar * WXUNUSED(key), const bool vdefault, const bool WXUNUSED(vmin), const bool WXUNUSED(vmax), const bool WXUNUSED(vscl) ) override { var = vdefault;}; diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 3c0d95e1f..8c1d70c75 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -2197,6 +2197,8 @@ void TrackInfo::GainSliderDrawFunction auto target = dynamic_cast( context.target.get() ); auto dc = &context.dc; bool hit = target && target->GetTrack().get() == pTrack; + if( hit ) + hit=hit; bool captured = hit && target->IsClicked(); SliderDrawFunction ( &TrackInfo::GainSlider, dc, rect, pTrack, captured, hit); diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index e7637d9a9..936f036c3 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -295,6 +295,7 @@ bool CommandImplementation::Apply(const CommandContext & WXUNUSED(context)) #include "SetLabelCommand.cpp" #include "SetProjectCommand.cpp" #include "SetEnvelopeCommand.cpp" +#include "DragCommand.cpp" #endif #endif diff --git a/src/commands/CommandTargets.cpp b/src/commands/CommandTargets.cpp index 4b94cfe42..b335d4040 100644 --- a/src/commands/CommandTargets.cpp +++ b/src/commands/CommandTargets.cpp @@ -313,6 +313,7 @@ LongMessageDialog::LongMessageDialog(wxWindow * parent, { mType = type; mAdditionalButtons = additionalButtons; + SetName( "Long Message" ); } LongMessageDialog::~LongMessageDialog(){ diff --git a/src/commands/DragCommand.cpp b/src/commands/DragCommand.cpp new file mode 100644 index 000000000..cfa39c8fe --- /dev/null +++ b/src/commands/DragCommand.cpp @@ -0,0 +1,121 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2018 Audacity Team + License: wxwidgets + + James Crook + +******************************************************************//** + +\file DragCommand.cpp +\brief Definitions for DragCommand + +\class DragCommand +\brief Command that sets clip information + +*//*******************************************************************/ + +#include "../Audacity.h" +#include "DragCommand.h" +#include "../Project.h" +#include "../Track.h" +#include "../TrackPanel.h" +#include "../WaveTrack.h" +#include "../ShuttleGui.h" +#include "CommandContext.h" + +DragCommand::DragCommand() +{ +} + +enum kCoordTypes +{ + kPanel, + kApp, + kTrack0, + kTrack1, + nCoordTypes +}; + +static const wxString kCoordTypeStrings[nCoordTypes] = +{ + XO("Panel"), + XO("App"), + XO("Track0"), + XO("Track1"), +}; + + +bool DragCommand::DefineParams( ShuttleParams & S ){ + wxArrayString coords( nCoordTypes, kCoordTypeStrings ); + S.OptionalN( bHasId ).Define( mId, wxT("Id"), 0.0, 11000.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); + S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0); + S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0); + S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, coords ); + return true; +}; + +void DragCommand::PopulateOrExchange(ShuttleGui & S) +{ + wxArrayString coords( nCoordTypes, kCoordTypeStrings ); + + S.AddSpace(0, 5); + + S.StartMultiColumn(3, wxALIGN_CENTER); + { + S.Optional( bHasId ).TieNumericTextBox( _("Id:"), mId ); + S.Optional( bHasWinName ).TieTextBox( _("Window Name:"), mWinName ); + S.Optional( bHasFromX ).TieNumericTextBox( _("From X:"), mFromX ); + S.Optional( bHasFromY ).TieNumericTextBox( _("From Y:"), mFromY ); + S.Optional( bHasToX ).TieNumericTextBox( _("To X:"), mToX ); + S.Optional( bHasToY ).TieNumericTextBox( _("To Y:"), mToY ); + S.Optional( bHasRelativeTo ).TieChoice( _("Relative To:"), mRelativeTo, &coords ); + } + S.EndMultiColumn(); +} + +bool DragCommand::Apply(const CommandContext & context) +{ + wxWindow * pWin = context.GetProject(); + wxWindow * pWin1 = nullptr; + wxMouseEvent Evt( wxEVT_MOTION ); + Evt.m_x = mFromX; + Evt.m_y = mFromY; + if( bHasId ) + pWin1 = pWin->FindWindowById( mId ); + if( bHasWinName ) + pWin1 = pWin->FindWindowByName( mWinName ); + if( pWin1 ) + pWin = pWin1; + // Process twice - possible bug in Audacity being worked around + // where we need an event to enter AND an event to move. + // AdornedRuler Quick-Play bug. + pWin->GetEventHandler()->ProcessEvent( Evt ); + pWin->GetEventHandler()->ProcessEvent( Evt ); + if( bHasToX ){ + wxMouseEvent Evt2( wxEVT_LEFT_DOWN ); + Evt2.m_leftDown = true; + Evt2.m_x = mFromX; + Evt2.m_y = mFromY; + Evt2.m_aux2Down = true; + pWin->GetEventHandler()->ProcessEvent( Evt2 ); + wxMouseEvent Evt3( wxEVT_MOTION ); + Evt3.m_leftDown = true; + Evt2.m_aux2Down = true; + Evt3.m_x = mToX; + Evt3.m_y = mToY; + // AdornedRuler Quick-Play bug again. + pWin->GetEventHandler()->ProcessEvent( Evt3 ); + pWin->GetEventHandler()->ProcessEvent( Evt3 ); + wxMouseEvent Evt4( wxEVT_LEFT_UP ); + Evt2.m_aux2Down = true; + Evt4.m_x = mToX; + Evt4.m_y = mToY; + pWin->GetEventHandler()->ProcessEvent( Evt4 ); + } + return true; +} diff --git a/src/commands/DragCommand.h b/src/commands/DragCommand.h new file mode 100644 index 000000000..934bd4c29 --- /dev/null +++ b/src/commands/DragCommand.h @@ -0,0 +1,59 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + James Crook + +******************************************************************//** + +\file DragCommand.h +\brief Declarations of DragCommand and DragCommandType classes + +*//*******************************************************************/ + +#ifndef __DRAG_COMMAND__ +#define __DRAG_COMMAND__ + +#include "Command.h" +#include "CommandType.h" + +#define DRAG_PLUGIN_SYMBOL XO("Drag") + +class DragCommand : public AudacityCommand +{ +public: + DragCommand(); + // CommandDefinitionInterface overrides + wxString GetSymbol() override {return DRAG_PLUGIN_SYMBOL;}; + wxString GetDescription() override {return _("Drags mouse from one place to another.");}; + bool DefineParams( ShuttleParams & S ) override; + void PopulateOrExchange(ShuttleGui & S) override; + + // AudacityCommand overrides + wxString ManualPage() override {return wxT("Extra_Menu:_Automation#drag");}; + + bool Apply(const CommandContext & context) override; + +public: + double mFromX; + double mFromY; + double mToX; + double mToY; + int mRelativeTo; + int mId; + wxString mWinName; + + bool bHasFromX; + bool bHasFromY; + bool bHasToX; + bool bHasToY; + bool bHasRelativeTo; + bool bHasId; + bool bHasWinName; + +}; + + +#endif /* End of include guard: __DRAG_COMMAND__ */ diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index db4ebb1c4..efe6525bc 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -311,7 +311,7 @@ bool GetInfoCommand::SendEnvelopes(const CommandContext &context) context.StartField( "points" ); context.StartArray(); double offset = pEnv->mOffset; - for( int k=0;kmEnv.size(); k++) + for( size_t k=0;kmEnv.size(); k++) { context.StartStruct( ); context.AddItem( pEnv->mEnv[k].GetT()+offset, "t" ); @@ -586,7 +586,8 @@ void GetInfoCommand::ExploreWindows( const CommandContext &context, context.AddItem( R.GetTop() ); context.AddItem( R.GetRight() ); context.AddItem( R.GetBottom() ); - context.AddItem( Name ); + context.AddItem( Name ); + context.AddItem( item->GetId() ); context.EndArray(); ExploreWindows( context, P, item, item->GetId(), depth+1 ); diff --git a/src/commands/LoadCommands.cpp b/src/commands/LoadCommands.cpp index 5f32f7be9..059001071 100644 --- a/src/commands/LoadCommands.cpp +++ b/src/commands/LoadCommands.cpp @@ -37,7 +37,7 @@ modelled on BuiltinEffectsModule #include "../commands/SetEnvelopeCommand.h" #include "../commands/SetClipCommand.h" #include "../commands/SetProjectCommand.h" - +#include "../commands/DragCommand.h" // // Define the list of COMMANDs that will be autoregistered and how to instantiate each @@ -46,6 +46,7 @@ modelled on BuiltinEffectsModule COMMAND( DEMO, DemoCommand, () ) \ COMMAND( MESSAGE, MessageCommand, () ) \ COMMAND( SCREENSHOT, ScreenshotCommand, () ) \ + COMMAND( DRAG, DragCommand, () ) \ COMMAND( COMPARE_AUDIO, CompareAudioCommand, () ) \ COMMAND( SET_TRACK, SetTrackCommand, () ) \ COMMAND( SET_ENVELOPE, SetEnvelopeCommand, () ) \ diff --git a/src/commands/OpenSaveCommands.cpp b/src/commands/OpenSaveCommands.cpp index d5d261990..1ce167544 100644 --- a/src/commands/OpenSaveCommands.cpp +++ b/src/commands/OpenSaveCommands.cpp @@ -24,7 +24,7 @@ bool OpenProjectCommand::DefineParams( ShuttleParams & S ){ S.Define( mFileName, wxT("Filename"), "test.aup" ); - S.Define( mbAddToHistory, wxT("AddToHistory"), false ); + S.OptionalN(bHasAddToHistory).Define( mbAddToHistory, wxT("AddToHistory"), false ); return true; } @@ -62,8 +62,8 @@ bool OpenProjectCommand::Apply(const CommandContext & context){ bool SaveProjectCommand::DefineParams( ShuttleParams & S ){ S.Define( mFileName, wxT("Filename"), "name.aup" ); - S.Define( mbAddToHistory, wxT("AddToHistory"), false ); - S.Define( mbCompress, wxT("Compress"), false ); + S.OptionalN(bHasAddToHistory).Define( mbAddToHistory, wxT("AddToHistory"), false ); + S.OptionalN(bHasCompress).Define( mbCompress, wxT("Compress"), false ); return true; } diff --git a/src/commands/OpenSaveCommands.h b/src/commands/OpenSaveCommands.h index 41798d3e9..9770b3749 100644 --- a/src/commands/OpenSaveCommands.h +++ b/src/commands/OpenSaveCommands.h @@ -38,6 +38,7 @@ public: public: wxString mFileName; bool mbAddToHistory; + bool bHasAddToHistory; }; #define SAVE_PROJECT_PLUGIN_SYMBOL XO("Save Project") @@ -58,4 +59,6 @@ public: wxString mFileName; bool mbAddToHistory; bool mbCompress; + bool bHasAddToHistory; + bool bHasCompress; }; \ No newline at end of file diff --git a/src/commands/PreferenceCommands.cpp b/src/commands/PreferenceCommands.cpp index 11f97db4a..fa2671aaa 100644 --- a/src/commands/PreferenceCommands.cpp +++ b/src/commands/PreferenceCommands.cpp @@ -50,9 +50,9 @@ bool GetPreferenceCommand::Apply(const CommandContext & context) } bool SetPreferenceCommand::DefineParams( ShuttleParams & S ){ - S.Define( mName, wxT("Name"), wxT("") ); - S.Define( mValue, wxT("Value"), wxT("") ); - S.Define( mbReload, wxT("Reload"), false ); + S.Define( mName, wxT("Name"), wxT("") ); + S.Define( mValue, wxT("Value"), wxT("") ); + S.OptionalN(bHasReload).Define( mbReload, wxT("Reload"), false ); return true; } diff --git a/src/commands/PreferenceCommands.h b/src/commands/PreferenceCommands.h index fba717242..c53e520df 100644 --- a/src/commands/PreferenceCommands.h +++ b/src/commands/PreferenceCommands.h @@ -63,6 +63,7 @@ public: wxString mName; wxString mValue; bool mbReload; + bool bHasReload; }; #endif /* End of include guard: __PREFERENCE_COMMANDS__ */ diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index 4984e5edd..dcbd95263 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -139,9 +139,9 @@ static const wxString kBackgroundStrings[nBackgrounds] = bool ScreenshotCommand::DefineParams( ShuttleParams & S ){ wxArrayString whats(nCaptureWhats, kCaptureWhatStrings); wxArrayString backs(nBackgrounds, kBackgroundStrings); - S.Define( mPath, wxT("Path"), wxT(""), wxT(""), wxT(""), wxT("")); - S.DefineEnum( mWhat, wxT("CaptureWhat"), wxT("Window"), whats ); - S.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 ); return true; }; @@ -154,8 +154,8 @@ 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.TieChoice( _("Capture What:"), mWhat, &whats); + S.TieChoice( _("Background:"), mBack, &backs); } S.EndMultiColumn(); } @@ -483,7 +483,8 @@ void ScreenshotCommand::CaptureWindowOnIdle( void ScreenshotCommand::CapturePreferences( const CommandContext & context, AudacityProject * pProject, const wxString &mFileName ){ - mFileName;//compiler food. + (void)&mFileName;//compiler food. + (void)&context; CommandManager * pMan = pProject->GetCommandManager(); // Yucky static variables. Is there a better way? The problem is that we need the @@ -512,7 +513,8 @@ void ScreenshotCommand::CapturePreferences( void ScreenshotCommand::CaptureEffects( const CommandContext & context, AudacityProject * pProject, const wxString &mFileName ){ - mFileName;//compiler food. + (void)&mFileName;//compiler food. + (void)&context; CommandManager * pMan = pProject->GetCommandManager(); wxString Str; // Yucky static variables. Is there a better way? The problem is that we need the diff --git a/src/commands/ScreenshotCommand.h b/src/commands/ScreenshotCommand.h index cfdb47495..53ad6f41f 100644 --- a/src/commands/ScreenshotCommand.h +++ b/src/commands/ScreenshotCommand.h @@ -46,6 +46,7 @@ private: wxString mWhat; wxString mBack; wxString mPath; + bool bHasBackground; friend class ScreenshotCommand; friend class ScreenFrame; diff --git a/src/commands/SelectCommand.cpp b/src/commands/SelectCommand.cpp index 4f2f26662..d0ab58331 100644 --- a/src/commands/SelectCommand.cpp +++ b/src/commands/SelectCommand.cpp @@ -40,9 +40,9 @@ explicitly code all three. #include "CommandContext.h" bool SelectTimeCommand::DefineParams( ShuttleParams & S ){ - S.Optional( bHasT0 ).Define( mT0, wxT("Start"), 0.0, 0.0, (double)FLT_MAX); - S.Optional( bHasT1 ).Define( mT1, wxT("End"), 0.0, 0.0, (double)FLT_MAX); - S.Define( mFromEnd, wxT("FromEnd"), false ); + S.OptionalY( bHasT0 ).Define( mT0, wxT("Start"), 0.0, 0.0, (double)FLT_MAX); + S.OptionalY( bHasT1 ).Define( mT1, wxT("End"), 0.0, 0.0, (double)FLT_MAX); + S.OptionalY( bHasFromEnd).Define( mFromEnd, wxT("FromEnd"), false ); return true; } @@ -58,6 +58,7 @@ void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S) S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER); { + // Always used, so no optional checkbox. S.TieCheckBox(_("From End:"), mFromEnd ); } S.EndMultiColumn(); @@ -77,8 +78,8 @@ bool SelectTimeCommand::Apply(const CommandContext & context){ } bool SelectFrequenciesCommand::DefineParams( ShuttleParams & S ){ - S.Optional( bHasTop ).Define( mTop, wxT("High"), 0.0, 0.0, (double)FLT_MAX); - S.Optional( bHasBottom ).Define( mBottom, wxT("Low"), 0.0, 0.0, (double)FLT_MAX); + S.OptionalN( bHasTop ).Define( mTop, wxT("High"), 0.0, 0.0, (double)FLT_MAX); + S.OptionalN( bHasBottom ).Define( mBottom, wxT("Low"), 0.0, 0.0, (double)FLT_MAX); return true; } @@ -113,9 +114,9 @@ static const wxString kModes[nModes] = bool SelectTracksCommand::DefineParams( ShuttleParams & S ){ wxArrayString modes( nModes, kModes ); - S.Optional( bHasFirstTrack).Define( mFirstTrack, wxT("First"), 0, 0, 100); - S.Optional( bHasLastTrack ).Define( mLastTrack, wxT("Last"), 0, 0, 100); - S.DefineEnum( mMode, wxT("Mode"), 0, modes ); + S.OptionalN( bHasFirstTrack).Define( mFirstTrack, wxT("First"), 0, 0, 100); + S.OptionalN( bHasLastTrack ).Define( mLastTrack, wxT("Last"), 0, 0, 100); + S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, modes ); return true; } @@ -133,6 +134,7 @@ void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S) S.EndMultiColumn(); S.StartMultiColumn(2, wxALIGN_CENTER); { + // Always used, so no check box. S.TieChoice( _("Mode:"), mMode, &modes); } S.EndMultiColumn(); diff --git a/src/commands/SelectCommand.h b/src/commands/SelectCommand.h index 410e58f0d..457b67cfe 100644 --- a/src/commands/SelectCommand.h +++ b/src/commands/SelectCommand.h @@ -45,6 +45,7 @@ public: bool bHasT0; bool bHasT1; + bool bHasFromEnd; double mT0; double mT1; @@ -86,6 +87,7 @@ public: bool bHasFirstTrack; bool bHasLastTrack; + bool bHasMode; int mFirstTrack; int mLastTrack; diff --git a/src/commands/SetClipCommand.cpp b/src/commands/SetClipCommand.cpp index a6da5870d..731976edf 100644 --- a/src/commands/SetClipCommand.cpp +++ b/src/commands/SetClipCommand.cpp @@ -49,13 +49,13 @@ static const wxString kColourStrings[nColours] = bool SetClipCommand::DefineParams( ShuttleParams & S ){ wxArrayString colours( nColours, kColourStrings ); - S.Optional( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 ); - S.Optional( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 ); - S.Optional( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 ); - S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); + S.OptionalY( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 ); + S.OptionalN( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 ); + S.OptionalY( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 ); + S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); // Allowing a negative start time is not a mistake. // It will be used in demonstrating time before zero. - S.Optional( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0); + S.OptionalN( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0); return true; }; diff --git a/src/commands/SetEnvelopeCommand.cpp b/src/commands/SetEnvelopeCommand.cpp index da75cdcc4..0cdc20ca0 100644 --- a/src/commands/SetEnvelopeCommand.cpp +++ b/src/commands/SetEnvelopeCommand.cpp @@ -32,12 +32,11 @@ SetEnvelopeCommand::SetEnvelopeCommand() bool SetEnvelopeCommand::DefineParams( ShuttleParams & S ){ - S.Optional( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 ); - S.Optional( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 ); - S.Optional( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 ); - S.Optional( bHasT ).Define( mT, wxT("Time"), 0.0, 0.0, 100000.0); - S.Optional( bHasV ).Define( mV, wxT("Value"), 0.0, 0.0, 2.0); - S.Optional( bHasDelete ).Define( mbDelete, wxT("Delete"), false ); + 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.OptionalN( bHasDelete ).Define( mbDelete, wxT("Delete"), false ); return true; }; @@ -49,7 +48,6 @@ void SetEnvelopeCommand::PopulateOrExchange(ShuttleGui & S) { S.Optional( bHasTrackIndex ).TieNumericTextBox( _("Track Index:"), mTrackIndex ); S.Optional( bHasChannelIndex).TieNumericTextBox( _("Channel Index:"), mChannelIndex ); - S.Optional( bHasContainsTime).TieNumericTextBox( _("At:"), mContainsTime ); S.Optional( bHasT ).TieNumericTextBox( _("Time:"), mT ); S.Optional( bHasV ).TieNumericTextBox( _("Value:"), mV ); S.Optional( bHasDelete ).TieCheckBox( _("Delete:"), mbDelete ); @@ -85,9 +83,9 @@ bool SetEnvelopeCommand::Apply(const CommandContext & context) for(auto it = ptrs.begin(); (it != ptrs.end()); it++ ){ pClip = *it; bFound = - !bHasContainsTime || ( - ( pClip->GetStartTime() <= mContainsTime ) && - ( pClip->GetEndTime() >= mContainsTime ) + !bHasT || ( + ( pClip->GetStartTime() <= mT) && + ( pClip->GetEndTime() >= mT ) ); if( bFound ) { diff --git a/src/commands/SetEnvelopeCommand.h b/src/commands/SetEnvelopeCommand.h index 635f59367..fb195576d 100644 --- a/src/commands/SetEnvelopeCommand.h +++ b/src/commands/SetEnvelopeCommand.h @@ -39,14 +39,12 @@ public: public: int mTrackIndex; int mChannelIndex; - double mContainsTime; double mT; double mV; bool mbDelete; bool bHasTrackIndex; bool bHasChannelIndex; - bool bHasContainsTime; bool bHasT; bool bHasV; bool bHasDelete; diff --git a/src/commands/SetLabelCommand.cpp b/src/commands/SetLabelCommand.cpp index 31f0ab523..2c2d12772 100644 --- a/src/commands/SetLabelCommand.cpp +++ b/src/commands/SetLabelCommand.cpp @@ -32,11 +32,11 @@ SetLabelCommand::SetLabelCommand() bool SetLabelCommand::DefineParams( ShuttleParams & S ){ - S.Define( mLabelIndex, wxT("Label"), 0, 0, 100 ); - S.Optional( bHasText ).Define( mText, wxT("Text"), wxT("empty") ); - S.Optional( bHasT0 ).Define( mT0, wxT("Start"), 0.0, 0.0, 100000.0); - S.Optional( bHasT1 ).Define( mT1, wxT("End"), 0.0, 0.0, 100000.0); - S.Optional( bHasSelected ).Define( mbSelected, wxT("Selected"), false ); + S.Define( mLabelIndex, wxT("Label"), 0, 0, 100 ); + S.OptionalY( bHasText ).Define( mText, wxT("Text"), wxT("empty") ); + S.OptionalY( bHasT0 ).Define( mT0, wxT("Start"), 0.0, 0.0, 100000.0); + S.OptionalY( bHasT1 ).Define( mT1, wxT("End"), 0.0, 0.0, 100000.0); + S.OptionalN( bHasSelected ).Define( mbSelected, wxT("Selected"), false ); return true; }; diff --git a/src/commands/SetProjectCommand.cpp b/src/commands/SetProjectCommand.cpp index a9b0967b2..0a5181d7f 100644 --- a/src/commands/SetProjectCommand.cpp +++ b/src/commands/SetProjectCommand.cpp @@ -32,11 +32,11 @@ SetProjectCommand::SetProjectCommand() bool SetProjectCommand::DefineParams( ShuttleParams & S ){ - S.Optional( bHasName ).Define( mName, wxT("Name"), _("Project") ); - S.Optional( bHasSizing ).Define( mPosX, wxT("X"), 10.0, 0.0, 2000.0); - S.Optional( bHasSizing ).Define( mPosY, wxT("Y"), 10.0, 0.0, 2000.0); - S.Optional( bHasSizing ).Define( mWidth, wxT("Width"), 1000.0, 200.0, 4000.0); - S.Optional( bHasSizing ).Define( mHeight, wxT("Height"), 900.0, 200.0, 4000.0); + S.OptionalN( bHasName ).Define( mName, wxT("Name"), _("Project") ); + S.OptionalY( bHasSizing ).Define( mPosX, wxT("X"), 10.0, 0.0, 2000.0); + S.OptionalY( bHasSizing ).Define( mPosY, wxT("Y"), 10.0, 0.0, 2000.0); + S.OptionalY( bHasSizing ).Define( mWidth, wxT("Width"), 1000.0, 200.0, 4000.0); + S.OptionalY( bHasSizing ).Define( mHeight, wxT("Height"), 900.0, 200.0, 4000.0); return true; }; diff --git a/src/commands/SetTrackInfoCommand.cpp b/src/commands/SetTrackInfoCommand.cpp index ae020e66e..78806e02f 100644 --- a/src/commands/SetTrackInfoCommand.cpp +++ b/src/commands/SetTrackInfoCommand.cpp @@ -82,22 +82,22 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){ wxArrayString displays( nDisplayTypes, kDisplayTypeStrings ); wxArrayString scales( nScaleTypes, kScaleTypeStrings ); - S.Optional( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 ); - S.Optional( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 ); - S.Optional( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") ); - S.Optional( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -1.0, 1.0); - S.Optional( bHasGain ).Define( mGain, wxT("Gain"), 1.0, 0.0, 10.0); - S.Optional( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 ); - S.Optional( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, displays ); - S.Optional( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales ); - S.Optional( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); - S.Optional( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true ); - S.Optional( bHasGrayScale ).Define( bGrayScale, wxT("GrayScale"), false ); + S.OptionalY( bHasTrackIndex ).Define( mTrackIndex, wxT("Track"), 0, 0, 100 ); + S.OptionalN( bHasChannelIndex ).Define( mChannelIndex, wxT("Channel"), 0, 0, 100 ); + S.OptionalN( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") ); + S.OptionalN( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -1.0, 1.0); + S.OptionalN( bHasGain ).Define( mGain, wxT("Gain"), 1.0, 0.0, 10.0); + S.OptionalN( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 ); + S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, displays ); + S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales ); + S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours ); + S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true ); + S.OptionalN( bHasGrayScale ).Define( bGrayScale, wxT("GrayScale"), false ); // There is also a select command. This is an alternative. - S.Optional( bHasSelected ).Define( bSelected, wxT("Selected"), 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 ); + S.OptionalN( bHasSelected ).Define( bSelected, wxT("Selected"), false ); + S.OptionalN( bHasFocused ).Define( bFocused, wxT("Focused"), false ); + S.OptionalN( bHasSolo ).Define( bSolo, wxT("Solo"), false ); + S.OptionalN( bHasMute ).Define( bMute, wxT("Mute"), false ); return true; }; diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index a46ec8841..3895bfe36 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2636,7 +2636,7 @@ void AdornedRulerPanel::HandleQPDrag(wxMouseEvent &/*event*/, wxCoord mousePosX) case mesDraggingPlayRegionStart: HideQuickPlayIndicator(); - // Don't start dragging until beyond tollerance initial playback start + // Don't start dragging until beyond tolerance initial playback start if (!mIsDragging && isWithinStart) mQuickPlayPos = mOldPlayRegionStart; else diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index 1f4ad1a44..d3cb74135 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -141,6 +141,7 @@ + @@ -483,6 +484,7 @@ + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index c4cb5c97d..27eaf9c6d 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -1076,6 +1076,9 @@ src\commands + + src\commands + @@ -2146,6 +2149,9 @@ src\commands + + src\commands +