1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-12 06:01:13 +02:00

Arrange and Align done.

- 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.
This commit is contained in:
James Crook 2018-02-18 11:05:29 +00:00 committed by Paul Licameli
parent 41a0b64c04
commit 9bb41d6963
4 changed files with 86 additions and 30 deletions

View File

@ -11,8 +11,7 @@ exec( open("docimages_core.py" ).read() )
import time
def arrange_imagesA() :
def loadFourColours() :
loadMonoTracks( 4 )
do( 'SetTrack: Track=0 Name="Claire" Height=60 Color=Color0')
do( 'SetTrack: Track=1 Name="Ann" Height=60 Color=Color1')
@ -23,38 +22,79 @@ def arrange_imagesA() :
do( 'SetClip: Track=2 At=1 Start=20')
do( 'SetClip: Track=3 At=1 Start=10')
do( 'Select: First=0 Last=100 Mode=Remove' )
capture( 'TrackOrder001.png', 'All_Tracks' )
do( 'SetTrack: Track=2 Focused=1')
def loadFourColoursSelected() :
loadFourColours()
do( 'ZoomOut' )
do( 'Select: Start=90 End=135 First=0 Last=100' )
def blockMoves( name ):
# These are the align commands that move tracks 'en block'.
loadFourColoursSelected()
capture( name + '001.png', 'All_Tracks_Plus' )
do( 'Align_StarttoZero' )
capture( name + '002.png', 'All_Tracks_Plus' )
loadFourColoursSelected()
do( 'Align_StarttoCursorSelectionStart' )
capture( name + '003.png', 'All_Tracks_Plus' )
loadFourColoursSelected()
do( 'Align_StarttoSelectionEnd' )
capture( name + '004.png', 'All_Tracks_Plus' )
loadFourColoursSelected()
do( 'Align_EndtoCursorSelectionStart' )
capture( name + '005.png', 'All_Tracks_Plus' )
loadFourColoursSelected()
do( 'Align_EndtoSelectionEnd' )
capture( name + '006.png', 'All_Tracks_Plus' )
def track_moves( type ) :
loadFourColours()
# Sorting tracks into order
do( 'SetTrack: Track=1 Focused=1')
capture( 'TrackOrder002.png', 'All_Tracks' )
def arrange_imagesA() :
loadFourColours()
# Moving tracks up and down.
capture( 'TrackOrder001.png', 'All_Tracks' )
do( 'SetTrack: Track=1 Focused=1')
# ToTop=0 to show the focus...
capture( 'TrackOrder002.png', 'All_Tracks ToTop=0' )
do( 'TrackMoveUp' )
capture( 'TrackUp.png', 'All_Tracks ToTop=0' )
do( 'TrackMoveDown' ) # undo
do( 'TrackMoveDown' )
capture( 'TrackDown.png', 'All_Tracks ToTop=0' )
do( 'TrackMoveTop' )
capture( 'TrackTop.png', 'All_Tracks ToTop=0' )
do( 'TrackMoveBottom' )
capture( 'TrackBottom.png', 'All_Tracks ToTop=0' )
# Sorting tracks into order
do( 'SortByName')
capture( 'TrackOrder003.png', 'All_Tracks' )
do( 'SortByTime')
capture( 'TrackOrder004.png', 'All_Tracks' )
# Aligning tracks
do( 'Select: First=0 Last=100 From=0 To=0')
do( 'Align_AlignTogether' )
capture( 'TrackAlign001.png', 'All_Tracks' )
do( 'Align_AlignEndtoEnd' )
do( 'FitInWindow' )
capture( 'TrackAlign002.png', 'All_Tracks' )
def arrange_imagesB() :
loadMonoTracks( 3 )
do( 'SetClip: Track=0 At=1 Start=5')
time.sleep( 1 )
do( 'SetClip: Track=1 At=1 Start=3')
time.sleep( 1 )
do( 'SetClip: Track=2 At=1 Start=4')
time.sleep( 1 )
do( 'SetClip: Track=3 At=1 Start=2')
capture( 'TrackOrder001.png', 'All_Tracks' )
blockMoves( 'BlockMoves' )
do( 'MoveSelectionWithTracks')
blockMoves( 'BlockAndCursorMoves' )
do( 'MoveSelectionWithTracks')
def arrange_imagesC() :
do( 'SetTrack: Track=2 Focused=1')
capture( 'TrackOrder002.png', 'All_Tracks' )
do( 'SortByName')
capture( 'TrackOrder003.png', 'All_Tracks' )
do( 'SortByTime')
capture( 'TrackOrder004.png', 'All_Tracks' )
#quickTest()
arrange_imagesA()
#arrange_imagesB()
#arrange_imagesC()

View File

@ -122,6 +122,7 @@ def loadStereoTracks( num ) :
loadStereoTrack()
do( 'SetTrack: Track=0 Name="Foxy Lady"')
for i in range( 0, num-1 ):
do( 'Select: First=0 Last=0')
do( 'Duplicate' )
do( 'FitInWindow' )
do( 'Select: Start=55 End=70 First=0 Last=' + str(num*2-1) )

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

@ -214,7 +214,7 @@ bool SetTrackCommand::Apply(const CommandContext & context)
if( !bIsSecondChannel ){
if( bHasSelected )
t->SetSelected(bSelected);
if( bHasFocused )
if( bHasFocused && bFocused)
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
panel->SetFocusedTrack( t );