mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 14:18:53 +02:00
Cleaner code to pop non toggle buttons up.
This commit is contained in:
parent
ffdba2eb2b
commit
6e440056f9
@ -246,15 +246,8 @@ void EditToolBar::OnButton(wxCommandEvent &event)
|
||||
// due to bugs elsewhere (see: AudacityProject::UpdateMenus() )
|
||||
|
||||
// Be sure the pop-up happens even if there are exceptions
|
||||
// Except, Sync Lock button is a toggle...
|
||||
auto cleanup = finally( [&] {
|
||||
bool bIsToggle = false;
|
||||
#ifdef OPTION_SYNC_LOCK_BUTTON
|
||||
bIsToggle = bIsToggle || ( id == ETBSyncLockID );
|
||||
#endif
|
||||
if( !bIsToggle )
|
||||
SetButton(false, mButtons[id]);
|
||||
}
|
||||
// except for buttons which toggle.
|
||||
auto cleanup = finally( [&] { mButtons[id]->InteractionOver();}
|
||||
);
|
||||
|
||||
switch (id) {
|
||||
|
@ -122,6 +122,9 @@ class AButton final : public wxWindow {
|
||||
void ClearDoubleClicked() { mIsDoubleClicked = false; }
|
||||
|
||||
void SetButtonToggles( bool toggler ){ mToggle = toggler;}
|
||||
// When click is over and mouse has moved away, a normal button
|
||||
// should pop up.
|
||||
void InteractionOver(){ if( !mToggle ) PopUp();}
|
||||
void Toggle(){ mButtonIsDown ? PopUp() : PushDown();}
|
||||
void Click();
|
||||
void SetShift(bool shift);
|
||||
|
Loading…
x
Reference in New Issue
Block a user