mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-05 15:09:08 +02:00
Right click on a ruler pushbutton pops up the appropriate menu, regardless...
... of the button's enabled state.
This commit is contained in:
parent
31eda6641b
commit
cac54a3b57
@ -2262,13 +2262,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
|
|
||||||
if (HasCapture() && mCaptureState != StatusChoice::NoButton)
|
if (HasCapture() && mCaptureState != StatusChoice::NoButton)
|
||||||
HandlePushbuttonEvent(evt);
|
HandlePushbuttonEvent(evt);
|
||||||
else if (!HasCapture() && overButtons) {
|
else if (!HasCapture() && overButtons)
|
||||||
if (evt.ButtonDown() && button != StatusChoice::NoButton) {
|
HandlePushbuttonClick(evt);
|
||||||
CaptureMouse();
|
|
||||||
mCaptureState = button;
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle popup menus
|
// Handle popup menus
|
||||||
else if (!HasCapture() && evt.RightDown() && !(evt.LeftIsDown())) {
|
else if (!HasCapture() && evt.RightDown() && !(evt.LeftIsDown())) {
|
||||||
if(inScrubZone)
|
if(inScrubZone)
|
||||||
@ -2909,6 +2904,18 @@ void AdornedRulerPanel::ToggleButtonState( StatusChoice button )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdornedRulerPanel::ShowButtonMenu( StatusChoice button, wxPoint position)
|
||||||
|
{
|
||||||
|
switch (button) {
|
||||||
|
case StatusChoice::QuickPlayButton:
|
||||||
|
return ShowMenu(position);
|
||||||
|
case StatusChoice::ScrubBarButton:
|
||||||
|
return ShowScrubMenu(position);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const AdornedRulerPanel::ButtonStrings AdornedRulerPanel::PushbuttonLabels
|
const AdornedRulerPanel::ButtonStrings AdornedRulerPanel::PushbuttonLabels
|
||||||
[static_cast<size_t>(StatusChoice::NumButtons)]
|
[static_cast<size_t>(StatusChoice::NumButtons)]
|
||||||
{
|
{
|
||||||
@ -2946,6 +2953,22 @@ void AdornedRulerPanel::DoDrawPushbutton(wxDC *dc, StatusChoice button, bool dow
|
|||||||
AColor::BevelTrackInfo(*dc, !down, bev);
|
AColor::BevelTrackInfo(*dc, !down, bev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdornedRulerPanel::HandlePushbuttonClick(wxMouseEvent &evt)
|
||||||
|
{
|
||||||
|
auto button = FindButton(evt.GetPosition());
|
||||||
|
if (IsButton(button)) {
|
||||||
|
if (evt.LeftDown()) {
|
||||||
|
CaptureMouse();
|
||||||
|
mCaptureState = button;
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
else if (evt.RightDown()) {
|
||||||
|
auto rect = GetButtonRect(button);
|
||||||
|
ShowButtonMenu( button, wxPoint{ rect.GetX() + 1, rect.GetBottom() + 1 } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AdornedRulerPanel::HandlePushbuttonEvent(wxMouseEvent &evt)
|
void AdornedRulerPanel::HandlePushbuttonEvent(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
if(evt.ButtonUp()) {
|
if(evt.ButtonUp()) {
|
||||||
|
@ -385,8 +385,10 @@ private:
|
|||||||
StatusChoice FindButton( wxPoint position ) const;
|
StatusChoice FindButton( wxPoint position ) const;
|
||||||
bool GetButtonState( StatusChoice button ) const;
|
bool GetButtonState( StatusChoice button ) const;
|
||||||
void ToggleButtonState( StatusChoice button );
|
void ToggleButtonState( StatusChoice button );
|
||||||
|
void ShowButtonMenu( StatusChoice button, wxPoint position);
|
||||||
void DoDrawPushbutton(wxDC *dc, StatusChoice button, bool down) const;
|
void DoDrawPushbutton(wxDC *dc, StatusChoice button, bool down) const;
|
||||||
void DoDrawPushbuttons(wxDC *dc) const;
|
void DoDrawPushbuttons(wxDC *dc) const;
|
||||||
|
void HandlePushbuttonClick(wxMouseEvent &evt);
|
||||||
void HandlePushbuttonEvent(wxMouseEvent &evt);
|
void HandlePushbuttonEvent(wxMouseEvent &evt);
|
||||||
|
|
||||||
wxFont &GetButtonFont() const;
|
wxFont &GetButtonFont() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user