mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Hidden buttons and sliders in narrow tracks are never clickable
This commit is contained in:
parent
5520abaa81
commit
895102bf9a
@ -5190,6 +5190,8 @@ enum : unsigned {
|
|||||||
kItemMidiControlsRect = 1 << 7,
|
kItemMidiControlsRect = 1 << 7,
|
||||||
kItemMinimize = 1 << 8,
|
kItemMinimize = 1 << 8,
|
||||||
kItemSyncLock = 1 << 9,
|
kItemSyncLock = 1 << 9,
|
||||||
|
|
||||||
|
kHighestBottomItem = kItemMinimize,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TCPLine {
|
struct TCPLine {
|
||||||
@ -5290,6 +5292,14 @@ std::pair< int, int > CalcBottomItemY
|
|||||||
return { y - (pLines->height + pLines->extraSpace ), pLines->height };
|
return { y - (pLines->height + pLines->extraSpace ), pLines->height };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HideTopItem( const wxRect &rect, const wxRect &subRect ) {
|
||||||
|
auto limit = CalcBottomItemY
|
||||||
|
( commonTrackTCPBottomLines, kHighestBottomItem, rect.height).first;
|
||||||
|
// Return true if the rectangle is even touching the limit
|
||||||
|
// without an overlap. That was the behavior as of 2.1.3.
|
||||||
|
return subRect.y + subRect.height >= rect.y + limit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This handles when the user clicks on the "Label" area
|
/// This handles when the user clicks on the "Label" area
|
||||||
@ -5363,7 +5373,8 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event)
|
|||||||
|
|
||||||
bool isright = event.Button(wxMOUSE_BTN_RIGHT);
|
bool isright = event.Button(wxMOUSE_BTN_RIGHT);
|
||||||
|
|
||||||
if ((isleft || isright) && midiRect.Contains(event.m_x, event.m_y) &&
|
if ( !HideTopItem( rect, midiRect ) &&
|
||||||
|
(isleft || isright) && midiRect.Contains(event.m_x, event.m_y) &&
|
||||||
static_cast<NoteTrack *>(t)->LabelClick(midiRect, event.m_x, event.m_y, isright)) {
|
static_cast<NoteTrack *>(t)->LabelClick(midiRect, event.m_x, event.m_y, isright)) {
|
||||||
MakeParentModifyState(false);
|
MakeParentModifyState(false);
|
||||||
Refresh(false);
|
Refresh(false);
|
||||||
@ -5500,6 +5511,8 @@ bool TrackPanel::GainFunc(Track * t, wxRect rect, wxMouseEvent &event,
|
|||||||
{
|
{
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
mTrackInfo.GetGainRect(rect.GetTopLeft(), sliderRect);
|
mTrackInfo.GetGainRect(rect.GetTopLeft(), sliderRect);
|
||||||
|
if ( HideTopItem( rect, sliderRect ) )
|
||||||
|
return false;
|
||||||
if (!sliderRect.Contains(x, y))
|
if (!sliderRect.Contains(x, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -5515,6 +5528,8 @@ bool TrackPanel::PanFunc(Track * t, wxRect rect, wxMouseEvent &event,
|
|||||||
{
|
{
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
mTrackInfo.GetPanRect(rect.GetTopLeft(), sliderRect);
|
mTrackInfo.GetPanRect(rect.GetTopLeft(), sliderRect);
|
||||||
|
if ( HideTopItem( rect, sliderRect ) )
|
||||||
|
return false;
|
||||||
if (!sliderRect.Contains(x, y))
|
if (!sliderRect.Contains(x, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -5531,6 +5546,8 @@ bool TrackPanel::VelocityFunc(Track * t, wxRect rect, wxMouseEvent &event,
|
|||||||
{
|
{
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
mTrackInfo.GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
mTrackInfo.GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
||||||
|
if ( HideTopItem( rect, sliderRect ) )
|
||||||
|
return false;
|
||||||
if (!sliderRect.Contains(x, y))
|
if (!sliderRect.Contains(x, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -5551,6 +5568,8 @@ bool TrackPanel::MuteSoloFunc(Track * t, wxRect rect, int x, int y,
|
|||||||
wxRect buttonRect;
|
wxRect buttonRect;
|
||||||
rect.width +=4;
|
rect.width +=4;
|
||||||
mTrackInfo.GetMuteSoloRect(rect, buttonRect, solo, HasSoloButton(), t);
|
mTrackInfo.GetMuteSoloRect(rect, buttonRect, solo, HasSoloButton(), t);
|
||||||
|
if ( HideTopItem( rect, buttonRect ) )
|
||||||
|
return false;
|
||||||
if (!buttonRect.Contains(x, y))
|
if (!buttonRect.Contains(x, y))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -7488,7 +7507,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec,
|
|||||||
wxRect midiRect;
|
wxRect midiRect;
|
||||||
mTrackInfo.GetMidiControlsRect(rect, midiRect);
|
mTrackInfo.GetMidiControlsRect(rect, midiRect);
|
||||||
|
|
||||||
if (midiRect.y + midiRect.height < rect.y + rect.height - 19)
|
if ( !HideTopItem( rect, midiRect ) )
|
||||||
static_cast<NoteTrack *>(t)->DrawLabelControls(*dc, midiRect);
|
static_cast<NoteTrack *>(t)->DrawLabelControls(*dc, midiRect);
|
||||||
// Draw some lines for MuteSolo buttons (normally handled by DrawBordersWithin but not done for note tracks)
|
// Draw some lines for MuteSolo buttons (normally handled by DrawBordersWithin but not done for note tracks)
|
||||||
if (rect.height > 48) {
|
if (rect.height > 48) {
|
||||||
@ -9589,7 +9608,7 @@ void TrackInfo::DrawMuteSolo(wxDC * dc, const wxRect & rect, Track * t,
|
|||||||
return;
|
return;
|
||||||
GetMuteSoloRect(rect, bev, solo, bHasSoloButton, t);
|
GetMuteSoloRect(rect, bev, solo, bHasSoloButton, t);
|
||||||
//bev.Inflate(-1, -1);
|
//bev.Inflate(-1, -1);
|
||||||
if (bev.y + bev.height >= rect.y + rect.height - 19)
|
if ( HideTopItem( rect, bev ) )
|
||||||
return; // don't draw mute and solo buttons, because they don't fit into track label
|
return; // don't draw mute and solo buttons, because they don't fit into track label
|
||||||
auto pt = dynamic_cast<const PlayableTrack *>(t);
|
auto pt = dynamic_cast<const PlayableTrack *>(t);
|
||||||
|
|
||||||
@ -9671,19 +9690,15 @@ void TrackInfo::DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool dow
|
|||||||
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect, bool captured) const
|
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect, bool captured) const
|
||||||
{
|
{
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
// Larger slidermargin means it disappears sooner on collapsing track.
|
|
||||||
const int sliderMargin = 14;
|
|
||||||
|
|
||||||
GetGainRect(rect.GetTopLeft(), sliderRect);
|
GetGainRect(rect.GetTopLeft(), sliderRect);
|
||||||
if (sliderRect.y + sliderRect.height < rect.y + rect.height - sliderMargin) {
|
if ( !HideTopItem( rect, sliderRect ) )
|
||||||
GainSlider(t, captured)->OnPaint(*dc);
|
GainSlider(t, captured)->OnPaint(*dc);
|
||||||
}
|
|
||||||
|
|
||||||
GetPanRect(rect.GetTopLeft(), sliderRect);
|
GetPanRect(rect.GetTopLeft(), sliderRect);
|
||||||
if (sliderRect.y + sliderRect.height < rect.y + rect.height - sliderMargin) {
|
if ( !HideTopItem( rect, sliderRect ) )
|
||||||
PanSlider(t, captured)->OnPaint(*dc);
|
PanSlider(t, captured)->OnPaint(*dc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect, bool captured) const
|
void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect, bool captured) const
|
||||||
@ -9691,7 +9706,7 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect, bool cap
|
|||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
|
|
||||||
GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
||||||
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
|
if ( !HideTopItem( rect, sliderRect ) ) {
|
||||||
VelocitySlider(t, captured)->OnPaint(*dc);
|
VelocitySlider(t, captured)->OnPaint(*dc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user