mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Add 'Select Track' Button.
This is a first take at this new feature. I'm expecting we'll want to refine it. https://wiki.audacityteam.org/wiki/Proposal_Select_Track_button_in_TCP has the feature proposal.
This commit is contained in:
@@ -1379,6 +1379,36 @@ void TrackInfo::MinimizeSyncLockDrawFunction
|
||||
minimized);
|
||||
}
|
||||
|
||||
{
|
||||
wxRect bev = rect;
|
||||
GetSelectButtonHorizontalBounds(rect, bev);
|
||||
auto target = dynamic_cast<SelectButtonHandle*>( context.target.get() );
|
||||
bool hit = target && target->GetTrack().get() == pTrack;
|
||||
bool captured = hit && target->IsClicked();
|
||||
bool down = captured && bev.Contains( context.lastState.GetPosition());
|
||||
|
||||
AColor::Bevel2(*dc, !down, bev, selected, hit);
|
||||
|
||||
#ifdef EXPERIMENTAL_THEMING
|
||||
wxColour c = theTheme.Colour(clrTrackPanelText);
|
||||
dc->SetBrush(c);
|
||||
dc->SetPen(c);
|
||||
#else
|
||||
AColor::Dark(dc, selected);
|
||||
#endif
|
||||
|
||||
wxString str = _("Select");
|
||||
wxCoord textWidth;
|
||||
wxCoord textHeight;
|
||||
SetTrackInfoFont(dc);
|
||||
dc->GetTextExtent(str, &textWidth, &textHeight);
|
||||
|
||||
dc->SetTextForeground( c );
|
||||
dc->SetTextBackground( wxTRANSPARENT );
|
||||
dc->DrawText(str, bev.x + 2 + (bev.width-textWidth)/2, bev.y + (bev.height - textHeight) / 2);
|
||||
}
|
||||
|
||||
|
||||
// Draw the sync-lock indicator if this track is in a sync-lock selected group.
|
||||
if (syncLockSelected)
|
||||
{
|
||||
@@ -2429,7 +2459,8 @@ void TrackInfo::GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest )
|
||||
|
||||
// Width is rect.width less space on left for track select
|
||||
// and on right for sync-lock icon.
|
||||
dest.width = rect.width - (space + syncLockRect.width);
|
||||
dest.width = kTrackInfoBtnSize;
|
||||
// rect.width - (space + syncLockRect.width);
|
||||
}
|
||||
|
||||
void TrackInfo::GetMinimizeRect(const wxRect & rect, wxRect &dest)
|
||||
@@ -2441,6 +2472,32 @@ void TrackInfo::GetMinimizeRect(const wxRect & rect, wxRect &dest)
|
||||
dest.height = results.second;
|
||||
}
|
||||
|
||||
void TrackInfo::GetSelectButtonHorizontalBounds( const wxRect &rect, wxRect &dest )
|
||||
{
|
||||
const int space = 0;// was 3.
|
||||
dest.x = rect.x + space;
|
||||
|
||||
wxRect syncLockRect;
|
||||
GetSyncLockHorizontalBounds( rect, syncLockRect );
|
||||
wxRect minimizeRect;
|
||||
GetMinimizeHorizontalBounds( rect, minimizeRect );
|
||||
|
||||
dest.x = dest.x + space + minimizeRect.width;
|
||||
// Width is rect.width less space on left for track select
|
||||
// and on right for sync-lock icon.
|
||||
dest.width = rect.width - (space + syncLockRect.width) - (space + minimizeRect.width);
|
||||
}
|
||||
|
||||
|
||||
void TrackInfo::GetSelectButtonRect(const wxRect & rect, wxRect &dest)
|
||||
{
|
||||
GetSelectButtonHorizontalBounds( rect, dest );
|
||||
auto results = CalcBottomItemY
|
||||
( commonTrackTCPBottomLines, kItemMinimize, rect.height);
|
||||
dest.y = rect.y + results.first;
|
||||
dest.height = results.second;
|
||||
}
|
||||
|
||||
void TrackInfo::GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest )
|
||||
{
|
||||
dest.width = kTrackInfoBtnSize;
|
||||
|
||||
Reference in New Issue
Block a user