1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-17 17:17:40 +02:00

(sync-lock)

Change sync-lock tile and icons to be clock instead of chain link. (Yet to change sync-lock button image.)

Make click on sync-lock icon select track.

Remove bevels on regions holding controls, so that bevels are only on controls themselves. This removes confusing border line above sync-lock icon, and simplifies the TrackInfo.

Be more specific about class methods vs stand-alone functions in comments.
This commit is contained in:
v.audacity 2010-09-12 05:11:43 +00:00
parent ce73ad6ad5
commit 1663db9915
3 changed files with 4136 additions and 4094 deletions

File diff suppressed because it is too large Load Diff

View File

@ -85,7 +85,7 @@
\class TrackPanelListener \class TrackPanelListener
\brief A now badly named class which is used to give access to a \brief A now badly named class which is used to give access to a
subset of the TrackPanel functions from all over the place. subset of the TrackPanel methods from all over the place.
*//**************************************************************//** *//**************************************************************//**
@ -729,7 +729,7 @@ void TrackPanel::SetStop(bool bStopped)
} }
/// Remembers the track we clicked on and why we captured it. /// Remembers the track we clicked on and why we captured it.
/// We also use this function to clear the record /// We also use this method to clear the record
/// of the captured track, passing NULL as the track. /// of the captured track, passing NULL as the track.
void TrackPanel::SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture ) void TrackPanel::SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture )
{ {
@ -1005,7 +1005,7 @@ void TrackPanel::ScrollDuringDrag()
if (mAutoScrolling) { if (mAutoScrolling) {
// AS: To keep the selection working properly as we scroll, // AS: To keep the selection working properly as we scroll,
// we fake a mouse event (remember, this function is called // we fake a mouse event (remember, this method is called
// from a timer tick). // from a timer tick).
// AS: For some reason, GCC won't let us pass this directly. // AS: For some reason, GCC won't let us pass this directly.
@ -1141,7 +1141,7 @@ void TrackPanel::DoDrawIndicator(wxDC & dc)
} }
} }
/// This function draws the cursor things, both in the /// This method draws the cursor things, both in the
/// ruler as seen at the top of the screen, but also in each of the /// ruler as seen at the top of the screen, but also in each of the
/// selected tracks. /// selected tracks.
/// These are the 'vertical lines' through waves and ruler. /// These are the 'vertical lines' through waves and ruler.
@ -1437,7 +1437,7 @@ void TrackPanel::SetCursorAndTipWhenInVResizeArea( Track * label,
// is shorter when it is between stereo tracks). // is shorter when it is between stereo tracks).
// IF we are in the label THEN return. // IF we are in the label THEN return.
// Subsequently called functions can detect that a tip and // Subsequently called methods can detect that a tip and
// cursor are still needed. // cursor are still needed.
if (label) if (label)
return; return;
@ -1565,10 +1565,10 @@ void TrackPanel::SetCursorAndTipWhenSelectTool( Track * t,
} }
// It's possible we didn't set the tip and cursor. // It's possible we didn't set the tip and cursor.
// Subsequently called functions can detect this. // Subsequently called methods can detect this.
} }
/// In this function we know what tool we are using, /// In this method we know what tool we are using,
/// so set the cursor accordingly. /// so set the cursor accordingly.
void TrackPanel::SetCursorAndTipByTool( int tool, void TrackPanel::SetCursorAndTipByTool( int tool,
wxMouseEvent & event, const wxChar ** /*ppTip*/ ) wxMouseEvent & event, const wxChar ** /*ppTip*/ )
@ -1688,7 +1688,7 @@ void TrackPanel::HandleCursor(wxMouseEvent & event)
} }
/// This function handles various ways of starting and extending /// This method handles various ways of starting and extending
/// selections. These are the selections you make by clicking and /// selections. These are the selections you make by clicking and
/// dragging over a waveform. /// dragging over a waveform.
void TrackPanel::HandleSelect(wxMouseEvent & event) void TrackPanel::HandleSelect(wxMouseEvent & event)
@ -1774,7 +1774,7 @@ void TrackPanel::HandleSelect(wxMouseEvent & event)
} }
} }
/// This function gets called when we're handling selection /// This method gets called when we're handling selection
/// and the mouse was just clicked. /// and the mouse was just clicked.
void TrackPanel::SelectionHandleClick(wxMouseEvent & event, void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
Track * pTrack, wxRect r) Track * pTrack, wxRect r)
@ -2680,7 +2680,7 @@ void TrackPanel::DoSlide(wxMouseEvent & event)
} }
/// This function takes care of our different zoom /// This method takes care of our different zoom
/// possibilities. It is possible for a user to just /// possibilities. It is possible for a user to just
/// "zoom in" or "zoom out," but it is also possible /// "zoom in" or "zoom out," but it is also possible
/// for a user to drag and select an area that he /// for a user to drag and select an area that he
@ -2794,7 +2794,7 @@ void TrackPanel::DragZoom(wxMouseEvent & event, int trackLeftEdge)
/// This handles normal Zoom In/Out, if you just clicked; /// This handles normal Zoom In/Out, if you just clicked;
/// IOW, if you were NOT dragging to zoom an area. /// IOW, if you were NOT dragging to zoom an area.
/// \todo MAGIC NUMBER: We've got several in this function. /// \todo MAGIC NUMBER: We've got several in this method.
void TrackPanel::DoZoomInOut(wxMouseEvent & event, int trackLeftEdge) void TrackPanel::DoZoomInOut(wxMouseEvent & event, int trackLeftEdge)
{ {
double center_h = PositionToTime(event.m_x, trackLeftEdge); double center_h = PositionToTime(event.m_x, trackLeftEdge);
@ -3733,42 +3733,47 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event)
if (isleft && PopupFunc(t, r, event.m_x, event.m_y)) if (isleft && PopupFunc(t, r, event.m_x, event.m_y))
return; return;
// MM: Check minimize buttons on WaveTracks. Must be before // VJ: Check sync-lock icon. Only result of doing so is to selecxt the track.
// solo/mute buttons, sliders etc. bool bSyncLockIconClick = this->SyncLockFunc(t, r, event.m_x, event.m_y);
if (isleft && MinimizeFunc(t, r, event.m_x, event.m_y)) if (!bSyncLockIconClick)
return;
if (isleft && t->GetKind() == Track::Wave)
{ {
// DM: Check Mute and Solo buttons on WaveTracks: // MM: Check minimize buttons on WaveTracks. Must be before
if (MuteSoloFunc(t, r, event.m_x, event.m_y, false) || // solo/mute buttons, sliders etc.
MuteSoloFunc(t, r, event.m_x, event.m_y, true)) if (isleft && MinimizeFunc(t, r, event.m_x, event.m_y))
return; return;
if (GainFunc(t, r, event, event.m_x, event.m_y)) if (isleft && t->GetKind() == Track::Wave)
return; {
// DM: Check Mute and Solo buttons on WaveTracks:
if (MuteSoloFunc(t, r, event.m_x, event.m_y, false) ||
MuteSoloFunc(t, r, event.m_x, event.m_y, true))
return;
if (PanFunc(t, r, event, event.m_x, event.m_y)) if (GainFunc(t, r, event, event.m_x, event.m_y))
return; return;
}
#ifdef USE_MIDI if (PanFunc(t, r, event, event.m_x, event.m_y))
// DM: If it's a NoteTrack, it has special controls return;
else if (t->GetKind() == Track::Note) }
{ #ifdef USE_MIDI
wxRect midiRect; // DM: If it's a NoteTrack, it has special controls
mTrackInfo.GetTrackControlsRect(r, midiRect); else if (t->GetKind() == Track::Note)
if (midiRect.Contains(event.m_x, event.m_y)) { {
((NoteTrack *) t)->LabelClick(midiRect, event.m_x, event.m_y, wxRect midiRect;
event.Button(wxMOUSE_BTN_RIGHT)); mTrackInfo.GetTrackControlsRect(r, midiRect);
Refresh(false); if (midiRect.Contains(event.m_x, event.m_y)) {
((NoteTrack *) t)->LabelClick(midiRect, event.m_x, event.m_y,
event.Button(wxMOUSE_BTN_RIGHT));
Refresh(false);
return;
}
}
#endif // USE_MIDI
if (!isleft) {
return; return;
} }
} }
#endif // USE_MIDI
if (!isleft) {
return;
}
// DM: If they weren't clicking on a particular part of a track label, // DM: If they weren't clicking on a particular part of a track label,
// deselect other tracks and select this one. // deselect other tracks and select this one.
@ -3780,7 +3785,7 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event)
TrackPanel::CalculateRearrangingThresholds(event); TrackPanel::CalculateRearrangingThresholds(event);
} }
// AS: If the shift botton is being held down, then just invert // AS: If the shift button is being held down, invert
// the selection on this track. // the selection on this track.
if (event.ShiftDown()) { if (event.ShiftDown()) {
mTracks->Select(t, !t->GetSelected()); mTracks->Select(t, !t->GetSelected());
@ -3917,32 +3922,38 @@ bool TrackPanel::MuteSoloFunc(Track * t, wxRect r, int x, int y,
return true; return true;
} }
bool TrackPanel::MinimizeFunc(Track * t, wxRect r, int x, int y) bool TrackPanel::SyncLockFunc(Track * t, wxRect r, int x, int y)
{ {
wxRect buttonRect; wxRect buttonRect;
// Vaughan: Pass false for bIsSyncLockSelected instead of t->IsSyncLockSelected() because // Vaughan: First, call GetMinimizeRect with false for bIsSyncLockSelected instead
// we want to check the whole width, so we can return true, indicating we have handled // of t->IsSyncLockSelected() because we want to check the whole width.
// the mouse click, and so avoid this click being passed on to other controls in the TrackInfo,
// if we're showing the sync-lock icon (which doesn't handle mouse clicks).
mTrackInfo.GetMinimizeRect(r, buttonRect, false); mTrackInfo.GetMinimizeRect(r, buttonRect, false);
if (!buttonRect.Contains(x, y)) if (!buttonRect.Contains(x, y))
return false; return false;
// Now we know we're over the minimize button or the sync-lock icon. Get the correct rect. // Now we know we're on the minimize button or the sync-lock icon.
// Set the buttonRect to the actual minimize button rect.
mTrackInfo.GetMinimizeRect(r, buttonRect, t->IsSyncLockSelected()); mTrackInfo.GetMinimizeRect(r, buttonRect, t->IsSyncLockSelected());
// Set up for handling only if event is in actual button rect, not the sync-lock icon. // Not over minimize button means over sync-lock icon.
if (buttonRect.Contains(x, y)) bool bOnSyncLock = !buttonRect.Contains(x, y);
{ if (bOnSyncLock)
SetCapturedTrack(t, IsMinimizing);
mCapturedRect = r;
wxClientDC dc(this);
mTrackInfo.DrawMinimize(&dc, r, t, true);
}
else
// In the sync-lock icon rect. Tell HandleMinimizing to no-op.
SetCapturedTrack(NULL); SetCapturedTrack(NULL);
return bOnSyncLock;
}
bool TrackPanel::MinimizeFunc(Track * t, wxRect r, int x, int y)
{
wxRect buttonRect;
mTrackInfo.GetMinimizeRect(r, buttonRect, t->IsSyncLockSelected());
if (!buttonRect.Contains(x, y))
return false;
SetCapturedTrack(t, IsMinimizing);
mCapturedRect = r;
wxClientDC dc(this);
mTrackInfo.DrawMinimize(&dc, r, t, true);
return true; return true;
} }
@ -4500,7 +4511,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM
/// Event has happened on a track and it has been determined to be a label track. /// Event has happened on a track and it has been determined to be a label track.
bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMouseEvent & event) bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMouseEvent & event)
{ {
/// \todo This function is one of a large number of functions in /// \todo This method is one of a large number of methods in
/// TrackPanel which suitably modified belong in other classes. /// TrackPanel which suitably modified belong in other classes.
if(event.LeftDown()) if(event.LeftDown())
{ {
@ -4516,7 +4527,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo
} }
//If the button was pressed, check to see if we are over //If the button was pressed, check to see if we are over
//a glyph (this is the second of three calls to the function). //a glyph (this is the second of three calls to the method).
//std::cout << ((LabelTrack*)pTrack)->OverGlyph(event.m_x, event.m_y) << std::endl; //std::cout << ((LabelTrack*)pTrack)->OverGlyph(event.m_x, event.m_y) << std::endl;
if(lTrack->OverGlyph(event.m_x, event.m_y)) if(lTrack->OverGlyph(event.m_x, event.m_y))
{ {
@ -4775,7 +4786,7 @@ int TrackPanel::DetermineToolToUse( ToolsToolBar * pTtb, wxMouseEvent & event)
return currentTool; return currentTool;
} }
/// Function that tells us if the mouse event landed on a /// method that tells us if the mouse event landed on a
/// envelope boundary. /// envelope boundary.
bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event) bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event)
{ {
@ -4838,7 +4849,7 @@ bool TrackPanel::HitTestEnvelope(Track *track, wxRect &r, wxMouseEvent & event)
return( distance < yTolerance ); return( distance < yTolerance );
} }
/// Function that tells us if the mouse event landed on an /// method that tells us if the mouse event landed on an
/// editable sample /// editable sample
bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event) bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event)
{ {
@ -4886,7 +4897,7 @@ bool TrackPanel::HitTestSamples(Track *track, wxRect &r, wxMouseEvent & event)
return( abs( yValue - yMouse ) < yTolerance ); return( abs( yValue - yMouse ) < yTolerance );
} }
/// Function that tells us if the mouse event landed on a /// method that tells us if the mouse event landed on a
/// time-slider that allows us to time shift the sequence. /// time-slider that allows us to time shift the sequence.
bool TrackPanel::HitTestSlide(Track *track, wxRect &r, wxMouseEvent & event) bool TrackPanel::HitTestSlide(Track *track, wxRect &r, wxMouseEvent & event)
{ {
@ -4941,7 +4952,7 @@ void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
} }
/// This function overrides Refresh() of wxWindow so that the /// This method overrides Refresh() of wxWindow so that the
/// boolean play indicator can be set to false, so that an old play indicator that is /// boolean play indicator can be set to false, so that an old play indicator that is
/// no longer there won't get XORed (to erase it), thus redrawing it on the /// no longer there won't get XORed (to erase it), thus redrawing it on the
/// TrackPanel /// TrackPanel
@ -5309,11 +5320,11 @@ void TrackPanel::UpdateVRulerSize()
Refresh(false); Refresh(false);
} }
/// The following function moves to the previous track /// The following method moves to the previous track
/// selecting and unselecting depending if you are on the start of a /// selecting and unselecting depending if you are on the start of a
/// block or not. /// block or not.
/// \todo Merge related functions, TrackPanel::OnPrevTrack and /// \todo Merge related methods, TrackPanel::OnPrevTrack and
/// TrackPanel::OnNextTrack. /// TrackPanel::OnNextTrack.
void TrackPanel::OnPrevTrack( bool shift ) void TrackPanel::OnPrevTrack( bool shift )
{ {
@ -5414,7 +5425,7 @@ void TrackPanel::OnPrevTrack( bool shift )
} }
} }
/// The following function moves to the next track, /// The following method moves to the next track,
/// selecting and unselecting depending if you are on the start of a /// selecting and unselecting depending if you are on the start of a
/// block or not. /// block or not.
void TrackPanel::OnNextTrack( bool shift ) void TrackPanel::OnNextTrack( bool shift )
@ -5974,7 +5985,7 @@ void TrackPanel::OnCursorMove(bool forward, bool jump, bool longjump )
} }
} }
//The following functions operate controls on specified tracks, //The following methods operate controls on specified tracks,
//This will pop up the track panning dialog for specified track //This will pop up the track panning dialog for specified track
void TrackPanel::OnTrackPan() void TrackPanel::OnTrackPan()
{ {
@ -6601,7 +6612,7 @@ const int nRates=7;
/// IN THE SAME ORDER!! /// IN THE SAME ORDER!!
int gRates[nRates] = { 8000, 11025, 16000, 22050, 44100, 48000, 96000 }; int gRates[nRates] = { 8000, 11025, 16000, 22050, 44100, 48000, 96000 };
/// This function handles the selection from the Rate /// This method handles the selection from the Rate
/// submenu of the track menu, except for "Other" (/see OnRateOther). /// submenu of the track menu, except for "Other" (/see OnRateOther).
void TrackPanel::OnRateChange(wxCommandEvent & event) void TrackPanel::OnRateChange(wxCommandEvent & event)
{ {
@ -6987,7 +6998,7 @@ wxRect TrackPanel::FindTrackRect(Track * target, bool label)
// The check for a null linked track is necessary because there's // The check for a null linked track is necessary because there's
// a possible race condition between the time the 2 linked tracks // a possible race condition between the time the 2 linked tracks
// are added and when wxAccessible functions are called. This is // are added and when wxAccessible methods are called. This is
// most evident when using Jaws. // most evident when using Jaws.
if (target->GetLinked() && target->GetLink()) { if (target->GetLinked() && target->GetLink()) {
r.height += target->GetLink()->GetHeight(); r.height += target->GetLink()->GetHeight();
@ -7263,7 +7274,7 @@ void TrackInfo::DrawBordersWithin(wxDC * dc, const wxRect r, bool bHasMuteSolo )
AColor::Line(*dc, r.x, r.y + 66, GetTitleWidth(), r.y + 66); // bevel below mute/solo AColor::Line(*dc, r.x, r.y + 66, GetTitleWidth(), r.y + 66); // bevel below mute/solo
} }
//vvvvv AColor::Line(*dc, r.x, r.y + r.height - 19, GetTitleWidth(), r.y + r.height - 19); // minimize button AColor::Line(*dc, r.x, r.y + r.height - 19, GetTitleWidth(), r.y + r.height - 19); // minimize button
} }
void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected, void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected,
@ -7275,21 +7286,20 @@ void TrackInfo::DrawBackground(wxDC * dc, const wxRect r, bool bSelected,
AColor::MediumTrackInfo(dc, bSelected); AColor::MediumTrackInfo(dc, bSelected);
dc->DrawRectangle(fill); dc->DrawRectangle(fill);
if( bHasMuteSolo ) //vvvvv
{ //if( bHasMuteSolo )
fill=wxRect( r.x+1, r.y+17, vrul-6, 32); //{
AColor::BevelTrackInfo( *dc, true, fill ); // fill=wxRect( r.x+1, r.y+17, vrul-6, 32);
// AColor::BevelTrackInfo( *dc, true, fill );
//vvvvv // fill=wxRect( r.x+1, r.y+67, fill.width, r.height-87);
fill=wxRect( r.x+1, r.y+67, fill.width, r.height-87); // AColor::BevelTrackInfo( *dc, true, fill );
AColor::BevelTrackInfo( *dc, true, fill ); //}
} //else
else //{
{ // fill=wxRect( r.x+1, r.y+17, vrul-6, r.height-37);
//vvvvv // AColor::BevelTrackInfo( *dc, true, fill );
fill=wxRect( r.x+1, r.y+17, vrul-6, r.height-37); //}
AColor::BevelTrackInfo( *dc, true, fill );
}
} }
void TrackInfo::GetTrackControlsRect(const wxRect r, wxRect & dest) const void TrackInfo::GetTrackControlsRect(const wxRect r, wxRect & dest) const

View File

@ -338,14 +338,27 @@ class TrackPanel:public wxPanel {
void HandleMutingSoloing(wxMouseEvent & event, bool solo); void HandleMutingSoloing(wxMouseEvent & event, bool solo);
void HandleMinimizing(wxMouseEvent & event); void HandleMinimizing(wxMouseEvent & event);
void HandleSliders(wxMouseEvent &event, bool pan); void HandleSliders(wxMouseEvent &event, bool pan);
bool MuteSoloFunc(Track *t, wxRect r, int x, int f, bool solo);
bool MinimizeFunc(Track *t, wxRect r, int x, int f);
// These *Func methods are used in TrackPanel::HandleLabelClick to set up
// for actual handling in methods called by TrackPanel::OnMouseEvent, and
// to draw button-down states, etc.
bool CloseFunc(Track * t, wxRect r, int x, int y); bool CloseFunc(Track * t, wxRect r, int x, int y);
bool PopupFunc(Track * t, wxRect r, int x, int y); bool PopupFunc(Track * t, wxRect r, int x, int y);
// SyncLockFunc, unlike the other *Func methods, returns true if the click is not
// set up to be handled, but click is on the sync-lock icon and we want to pass
// it forward to be a track select.
bool SyncLockFunc(Track * t, wxRect r, int x, int y);
bool MuteSoloFunc(Track *t, wxRect r, int x, int f, bool solo);
bool MinimizeFunc(Track *t, wxRect r, int x, int f);
bool GainFunc(Track * t, wxRect r, wxMouseEvent &event, bool GainFunc(Track * t, wxRect r, wxMouseEvent &event,
int x, int y); int x, int y);
bool PanFunc(Track * t, wxRect r, wxMouseEvent &event, bool PanFunc(Track * t, wxRect r, wxMouseEvent &event,
int x, int y); int x, int y);
void MakeParentRedrawScrollbars(); void MakeParentRedrawScrollbars();
// AS: Pushing the state preserves state for Undo operations. // AS: Pushing the state preserves state for Undo operations.