mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
UIHandle objects now implement the context menus for the Ruler
This commit is contained in:
parent
0ae7f55fea
commit
c85d2cdfa0
@ -2076,9 +2076,11 @@ class AdornedRulerPanel::CommonRulerHandle : public UIHandle
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
CommonRulerHandle( AdornedRulerPanel *pParent, wxCoord xx )
|
CommonRulerHandle(
|
||||||
|
AdornedRulerPanel *pParent, wxCoord xx, MenuChoice menuChoice )
|
||||||
: mParent(pParent)
|
: mParent(pParent)
|
||||||
, mX( xx )
|
, mX( xx )
|
||||||
|
, mChoice( menuChoice )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool Clicked() const { return mClicked != Button::None; }
|
bool Clicked() const { return mClicked != Button::None; }
|
||||||
@ -2109,6 +2111,10 @@ protected:
|
|||||||
(const TrackPanelMouseEvent &event, AudacityProject *,
|
(const TrackPanelMouseEvent &event, AudacityProject *,
|
||||||
wxWindow *) override
|
wxWindow *) override
|
||||||
{
|
{
|
||||||
|
if ( mParent && mClicked == Button::Right ) {
|
||||||
|
const auto pos = event.event.GetPosition();
|
||||||
|
mParent->ShowContextMenu( mChoice, &pos );
|
||||||
|
}
|
||||||
return RefreshCode::DrawOverlays;
|
return RefreshCode::DrawOverlays;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2126,6 +2132,8 @@ protected:
|
|||||||
|
|
||||||
wxCoord mX;
|
wxCoord mX;
|
||||||
|
|
||||||
|
MenuChoice mChoice;
|
||||||
|
|
||||||
enum class Button { None, Left, Right };
|
enum class Button { None, Left, Right };
|
||||||
Button mClicked{ Button::None };
|
Button mClicked{ Button::None };
|
||||||
};
|
};
|
||||||
@ -2135,7 +2143,7 @@ class AdornedRulerPanel::QPHandle final : public CommonRulerHandle
|
|||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
QPHandle( AdornedRulerPanel *pParent, wxCoord xx )
|
QPHandle( AdornedRulerPanel *pParent, wxCoord xx )
|
||||||
: CommonRulerHandle( pParent, xx )
|
: CommonRulerHandle( pParent, xx, MenuChoice::QuickPlay )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2212,7 +2220,7 @@ class AdornedRulerPanel::ScrubbingHandle final : public CommonRulerHandle
|
|||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
ScrubbingHandle( AdornedRulerPanel *pParent, wxCoord xx )
|
ScrubbingHandle( AdornedRulerPanel *pParent, wxCoord xx )
|
||||||
: CommonRulerHandle( pParent, xx )
|
: CommonRulerHandle( pParent, xx, MenuChoice::Scrub )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2732,14 +2740,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
|
|
||||||
auto clicked = mQPCell->Clicked();
|
auto clicked = mQPCell->Clicked();
|
||||||
|
|
||||||
// Handle popup menus
|
if( !clicked && evt.LeftUp() && inScrubZone ) {
|
||||||
if (evt.RightUp() && !(evt.LeftIsDown())) {
|
|
||||||
ShowContextMenu
|
|
||||||
(inScrubZone ? MenuChoice::Scrub : MenuChoice::QuickPlay,
|
|
||||||
&position);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if( !clicked && evt.LeftUp() && inScrubZone ) {
|
|
||||||
if( scrubber.IsOneShotSeeking() ){
|
if( scrubber.IsOneShotSeeking() ){
|
||||||
scrubber.mInOneShotMode = false;
|
scrubber.mInOneShotMode = false;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user