mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 06:01:13 +02:00
ToolManager.cpp does not depend on Meter
This commit is contained in:
@@ -268,7 +268,7 @@ enum {
|
||||
OnPreferencesID
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MeterPanel, wxPanelWrapper)
|
||||
BEGIN_EVENT_TABLE(MeterPanel, MeterPanelBase)
|
||||
EVT_TIMER(OnMeterUpdateID, MeterPanel::OnMeterUpdate)
|
||||
EVT_MOUSE_EVENTS(MeterPanel::OnMouse)
|
||||
EVT_CONTEXT_MENU(MeterPanel::OnContext)
|
||||
@@ -2123,13 +2123,6 @@ wxString MeterPanel::Key(const wxString & key) const
|
||||
return wxT("/Meter/Output/") + key;
|
||||
}
|
||||
|
||||
bool MeterPanel::s_AcceptsFocus{ false };
|
||||
|
||||
auto MeterPanel::TemporarilyAllowFocus() -> TempAllowFocus {
|
||||
s_AcceptsFocus = true;
|
||||
return TempAllowFocus{ &s_AcceptsFocus };
|
||||
}
|
||||
|
||||
// This compensates for a but in wxWidgets 3.0.2 for mac:
|
||||
// Couldn't set focus from keyboard when AcceptsFocus returns false;
|
||||
// this bypasses that limitation
|
||||
|
@@ -117,9 +117,6 @@ class MeterPanel final : public MeterPanelBase, private PrefsListener
|
||||
Style style = HorizontalStereo,
|
||||
float fDecayRate = 60.0f);
|
||||
|
||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||
bool AcceptsFocusFromKeyboard() const override { return true; }
|
||||
|
||||
void SetFocusFromKbd() override;
|
||||
|
||||
void Clear() override;
|
||||
@@ -192,13 +189,6 @@ class MeterPanel final : public MeterPanelBase, private PrefsListener
|
||||
void UpdatePrefs() override;
|
||||
void UpdateSelectedPrefs( int ) override;
|
||||
|
||||
static bool s_AcceptsFocus;
|
||||
struct Resetter { void operator () (bool *p) const { if(p) *p = false; } };
|
||||
using TempAllowFocus = std::unique_ptr<bool, Resetter>;
|
||||
|
||||
public:
|
||||
static TempAllowFocus TemporarilyAllowFocus();
|
||||
|
||||
private:
|
||||
//
|
||||
// Event handlers
|
||||
|
@@ -13,3 +13,10 @@ Paul Licameli split from Meter.cpp
|
||||
MeterPanelBase::~MeterPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
bool MeterPanelBase::s_AcceptsFocus{ false };
|
||||
|
||||
auto MeterPanelBase::TemporarilyAllowFocus() -> TempAllowFocus {
|
||||
s_AcceptsFocus = true;
|
||||
return TempAllowFocus{ &s_AcceptsFocus };
|
||||
}
|
||||
|
@@ -26,7 +26,17 @@ public:
|
||||
int numFrames, float *sampleData) = 0;
|
||||
virtual bool IsMeterDisabled() const = 0;
|
||||
virtual float GetMaxPeak() const = 0;
|
||||
|
||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||
bool AcceptsFocusFromKeyboard() const override { return true; }
|
||||
|
||||
private:
|
||||
static bool s_AcceptsFocus;
|
||||
struct Resetter { void operator () (bool *p) const { if(p) *p = false; } };
|
||||
using TempAllowFocus = std::unique_ptr<bool, Resetter>;
|
||||
|
||||
public:
|
||||
static TempAllowFocus TemporarilyAllowFocus();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user