ToolManager.cpp does not depend on Meter
This commit is contained in:
parent
b84f5b66f0
commit
0b897c81b0
|
@ -60,7 +60,7 @@
|
||||||
#include "../ProjectWindow.h"
|
#include "../ProjectWindow.h"
|
||||||
#include "../widgets/AButton.h"
|
#include "../widgets/AButton.h"
|
||||||
#include "../widgets/ASlider.h"
|
#include "../widgets/ASlider.h"
|
||||||
#include "../widgets/Meter.h"
|
#include "../widgets/MeterPanelBase.h"
|
||||||
#include "../widgets/Grabber.h"
|
#include "../widgets/Grabber.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -1527,7 +1527,7 @@ bool ToolManager::RestoreFocus()
|
||||||
if (mLastFocus) {
|
if (mLastFocus) {
|
||||||
auto temp1 = AButton::TemporarilyAllowFocus();
|
auto temp1 = AButton::TemporarilyAllowFocus();
|
||||||
auto temp2 = ASlider::TemporarilyAllowFocus();
|
auto temp2 = ASlider::TemporarilyAllowFocus();
|
||||||
auto temp3 = MeterPanel::TemporarilyAllowFocus();
|
auto temp3 = MeterPanelBase::TemporarilyAllowFocus();
|
||||||
mLastFocus->SetFocus();
|
mLastFocus->SetFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ enum {
|
||||||
OnPreferencesID
|
OnPreferencesID
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MeterPanel, wxPanelWrapper)
|
BEGIN_EVENT_TABLE(MeterPanel, MeterPanelBase)
|
||||||
EVT_TIMER(OnMeterUpdateID, MeterPanel::OnMeterUpdate)
|
EVT_TIMER(OnMeterUpdateID, MeterPanel::OnMeterUpdate)
|
||||||
EVT_MOUSE_EVENTS(MeterPanel::OnMouse)
|
EVT_MOUSE_EVENTS(MeterPanel::OnMouse)
|
||||||
EVT_CONTEXT_MENU(MeterPanel::OnContext)
|
EVT_CONTEXT_MENU(MeterPanel::OnContext)
|
||||||
|
@ -2123,13 +2123,6 @@ wxString MeterPanel::Key(const wxString & key) const
|
||||||
return wxT("/Meter/Output/") + key;
|
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:
|
// This compensates for a but in wxWidgets 3.0.2 for mac:
|
||||||
// Couldn't set focus from keyboard when AcceptsFocus returns false;
|
// Couldn't set focus from keyboard when AcceptsFocus returns false;
|
||||||
// this bypasses that limitation
|
// this bypasses that limitation
|
||||||
|
|
|
@ -117,9 +117,6 @@ class MeterPanel final : public MeterPanelBase, private PrefsListener
|
||||||
Style style = HorizontalStereo,
|
Style style = HorizontalStereo,
|
||||||
float fDecayRate = 60.0f);
|
float fDecayRate = 60.0f);
|
||||||
|
|
||||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
|
||||||
bool AcceptsFocusFromKeyboard() const override { return true; }
|
|
||||||
|
|
||||||
void SetFocusFromKbd() override;
|
void SetFocusFromKbd() override;
|
||||||
|
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
|
@ -192,13 +189,6 @@ class MeterPanel final : public MeterPanelBase, private PrefsListener
|
||||||
void UpdatePrefs() override;
|
void UpdatePrefs() override;
|
||||||
void UpdateSelectedPrefs( int ) 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:
|
private:
|
||||||
//
|
//
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
|
|
@ -13,3 +13,10 @@ Paul Licameli split from Meter.cpp
|
||||||
MeterPanelBase::~MeterPanelBase()
|
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;
|
int numFrames, float *sampleData) = 0;
|
||||||
virtual bool IsMeterDisabled() const = 0;
|
virtual bool IsMeterDisabled() const = 0;
|
||||||
virtual float GetMaxPeak() const = 0;
|
virtual float GetMaxPeak() const = 0;
|
||||||
|
|
||||||
|
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||||
|
bool AcceptsFocusFromKeyboard() const override { return true; }
|
||||||
|
|
||||||
private:
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user