|
|
|
Al Dimond
|
Bringing this thread back on-list in case people want to try this
patch. On Wednesday 21 October 2009 16:25:31 Bill Wharrie wrote: > Al, Gale: > One more thing ... > > There is a note in the manual about the labelled regions menu items > being enabled when the cursor is at a label point. This is easy to > confirm: > > 1) New project, linking off > 2) Create chirp > 3) Click anywhere in audio track > 4) Create label at selection > The cursor is now at a label point. To be sure this will happen > every time: > 5) Click in the track panel of the audio track > 6) Click on the label > 7) Click on Edit > Labeled Regions > All the labeled regions commands are enabled. The "standard" edit > menu items corresponding to the labeled region menu items are > disabled except for "Split" which makes sense. > 8) Click on Edit > Labeled Regions > Split - nothing happens > 9) Click on Edit > Split - the track is split at the cursor. > > -- Bill > Of the commands available in the "Labeled Regions" submenu, the only one whose normal counterpart is available when no time region is selected is Split. This updated patch disables the other items unless a time region is selected, and makes Split work with no time region selected. If someone applies this I'll try to remember to update the appropriate manual section. I also noticed that the normal counterparts of these commands all require AudioIONotBusyFlag to be set also, so I added it. If anyone thinks that's inappropriate let me know. - Al [awd_cutlabels_fix_3.patch] Index: src/Project.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/Project.h,v retrieving revision 1.167 diff -u -r1.167 Project.h --- src/Project.h 20 Sep 2009 19:06:06 -0000 1.167 +++ src/Project.h 22 Oct 2009 01:59:26 -0000 @@ -249,7 +249,7 @@ void Rewind(bool shift); void SkipEnd(bool shift); void SetStop(bool bStopped); - void EditByLabel( WaveTrack::EditFunction action ); + void EditByLabel( WaveTrack::EditFunction action, bool groupIteration ); void EditClipboardByLabel( WaveTrack::EditDestFunction action ); bool IsSticky(); bool GetStickyFlag() { return mStickyFlag; }; Index: src/Project.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v retrieving revision 1.464 diff -u -r1.464 Project.cpp --- src/Project.cpp 20 Oct 2009 23:08:26 -0000 1.464 +++ src/Project.cpp 22 Oct 2009 01:59:29 -0000 @@ -3801,7 +3862,7 @@ //determine labelled regions for( n = iter.First(); n; n = iter.Next() ) - if( n->GetKind() == Track::Label ) + if( n->GetKind() == Track::Label && n->GetSelected() ) { LabelTrack *lt = ( LabelTrack* )n; for( int i = 0; i < lt->GetNumLabels(); i++ ) @@ -3843,7 +3904,10 @@ //Executes the edit function on all selected wave tracks with //regions specified by selected labels //If No tracks selected, function is applied on all tracks -void AudacityProject::EditByLabel( WaveTrack::EditFunction action ) +//If the function deletes audio, groupIteration should probably be set to true, +// so it won't delete too many times. +void AudacityProject::EditByLabel( WaveTrack::EditFunction action, + bool groupIteration ) { Regions regions; @@ -3851,7 +3915,7 @@ if( regions.GetCount() == 0 ) return; - TrackListIterator iter( mTracks ); + TrackAndGroupIterator iter( mTracks ); Track *n; bool allTracks = true; @@ -3867,13 +3931,27 @@ //Apply action on wavetracks starting from //labeled regions in the end. This is to correctly perform //actions like 'Delete' which collapse the track area. - for( n = iter.First(); n; n = iter.Next() ) + n = iter.First(); + while (n) + { if( n->GetKind() == Track::Wave && ( allTracks || n->GetSelected() ) ) { WaveTrack *wt = ( WaveTrack* )n; for( int i = ( int )regions.GetCount() - 1; i >= 0; i-- ) ( wt->*action )( regions.Item( i )->start, regions.Item( i )->end ); + + // Tracks operated on may need group iteration + if (IsSticky() && groupIteration) + n = iter.NextGroup(); + else + n = iter.Next(); } + else + { + // Tracks not operated on need normal iteration + n = iter.Next(); + } + } //delete label regions for( unsigned int i = 0; i < regions.GetCount(); i++ ) @@ -3883,7 +3961,9 @@ //Executes the edit function on all selected wave tracks with //regions specified by selected labels //If No tracks selected, function is applied on all tracks -//functions copy the edited regions to clipboard, possibly in multiple tracks +//Functions copy the edited regions to clipboard, possibly in multiple tracks +//This probably should not be called if *action() changes the timeline, because +// the copy needs to happen by track, and the timeline change by group. void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action ) { Regions regions; Index: src/Menus.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v retrieving revision 1.531 diff -u -r1.531 Menus.cpp --- src/Menus.cpp 20 Oct 2009 23:32:09 -0000 1.531 +++ src/Menus.cpp 22 Oct 2009 01:59:32 -0000 @@ -414,7 +414,8 @@ ///////////////////////////////////////////////////////////////////////////// c->BeginSubMenu(_("La&beled Regions")); - c->SetDefaultFlags(LabelsSelectedFlag, LabelsSelectedFlag); + c->SetDefaultFlags(AudioIONotBusyFlag | LabelsSelectedFlag | TimeSelectedFlag, + AudioIONotBusyFlag | LabelsSelectedFlag | TimeSelectedFlag); c->AddItem(wxT("CutLabels"), _("&Cut"), FN(OnCutLabels), wxT("Alt+X")); c->AddItem(wxT("SplitCutLabels"), _("&Split Cut"), FN(OnSplitCutLabels), wxT("Shift+Alt+X")); @@ -428,7 +429,9 @@ c->AddSeparator(); - c->AddItem(wxT("SplitLabels"), _("Spli&t"), FN(OnSplitLabels), wxT("Alt+I")); + c->AddItem(wxT("SplitLabels"), _("Spli&t"), FN(OnSplitLabels), wxT("Alt+I"), + AudioIONotBusyFlag | LabelsSelectedFlag, + AudioIONotBusyFlag | LabelsSelectedFlag); c->AddItem(wxT("JoinLabels"), _("&Join"), FN(OnJoinLabels), wxT("Alt+J")); c->AddItem(wxT("DisjoinLabels"), _("Detac&h at Silences"), FN(OnDisjoinLabels), wxT("Shift+Alt+J")); @@ -3674,10 +3677,14 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; + // Because of grouping the copy may need to operate on different tracks than + // the clear, so we do these actions separately. + EditClipboardByLabel( &WaveTrack::Copy ); + if( gPrefs->Read( wxT( "/GUI/EnableCutLines" ), ( long )0 ) ) - EditClipboardByLabel( &WaveTrack::CutAndAddCutLine ); + EditByLabel( &WaveTrack::ClearAndAddCutLine, true ); else - EditClipboardByLabel( &WaveTrack::Cut ); + EditByLabel( &WaveTrack::Clear, true ); msClipProject = this; @@ -3722,7 +3729,9 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - EditByLabel( &WaveTrack::Clear ); + EditByLabel( &WaveTrack::Clear, true ); + + mViewInfo.sel1 = mViewInfo.sel0 = 0.0; PushState( _( "Deleted labeled regions" ), _( "Delete Labels" ) ); @@ -3734,7 +3743,7 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - EditByLabel( &WaveTrack::SplitDelete ); + EditByLabel( &WaveTrack::SplitDelete, false ); PushState( _( "Split Deleted labeled regions" ), _( "Split Delete Labels" ) ); @@ -3746,7 +3755,7 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - EditByLabel( &WaveTrack::Silence ); + EditByLabel( &WaveTrack::Silence, false ); PushState( _( "Silenced labeled regions" ), _( "Silence Labels" ) ); @@ -3755,10 +3764,7 @@ void AudacityProject::OnSplitLabels() { - if( mViewInfo.sel0 >= mViewInfo.sel1 ) - return; - - EditByLabel( &WaveTrack::Split ); + EditByLabel( &WaveTrack::Split, false ); PushState( _( "Split labeled regions" ), _( "Split Labels" ) ); @@ -3770,7 +3776,7 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - EditByLabel( &WaveTrack::Join ); + EditByLabel( &WaveTrack::Join, false ); PushState( _( "Joined labeled regions" ), _( "Join Labels" ) ); @@ -3782,7 +3788,7 @@ if( mViewInfo.sel0 >= mViewInfo.sel1 ) return; - EditByLabel( &WaveTrack::Disjoin ); + EditByLabel( &WaveTrack::Disjoin, false ); PushState( _( "Detached labeled regions" ), _( "Detach Labels" ) ); ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ audacity-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/audacity-devel |
||||||||||||||||
|
Gale (Audacity Team)
|
| From Al Dimond <[hidden email]> | Wed, 21 Oct 2009 20:03:39 -0600 | Subject: Labeled Regions behaviour > Bringing this thread back on-list in case people want to try this > patch. > > On Wednesday 21 October 2009 16:25:31 Bill Wharrie wrote: > > Al, Gale: > > One more thing ... > > > > There is a note in the manual about the labelled regions menu items > > being enabled when the cursor is at a label point. This is easy to > > confirm: > > > > 1) New project, linking off > > 2) Create chirp > > 3) Click anywhere in audio track > > 4) Create label at selection > > The cursor is now at a label point. To be sure this will happen > > every time: > > 5) Click in the track panel of the audio track > > 6) Click on the label > > 7) Click on Edit > Labeled Regions > > All the labeled regions commands are enabled. The "standard" edit > > menu items corresponding to the labeled region menu items are > > disabled except for "Split" which makes sense. > > 8) Click on Edit > Labeled Regions > Split - nothing happens > > 9) Click on Edit > Split - the track is split at the cursor. > > > > -- Bill > > > > Indeed, good catch. You're really giving this stuff a thorough run. > > Of the commands available in the "Labeled Regions" submenu, the only > one whose normal counterpart is available when no time region is > selected is Split. This updated patch disables the other items unless > a time region is selected, and makes Split work with no time region > selected. If someone applies this I'll try to remember to update the > appropriate manual section. Just to add that all those Labeled Regions commands are of course still enabled for a point label post patch when the default "Select All..." is enabled in the Tracks preferences. Most of them do nothing except a Select All of course, but at least they match with the comparable items enabled in the main Edit menu. The exception is "Silence" (which for consistency probably ought to be called "Silence Audio)" which unlike the main menu item only does a Select All, not a Silence Audio after it. Gale ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ audacity-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/audacity-devel |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |