mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-16 16:20:50 +02:00
Define and use ShuttleGui::ConnectRoot...
... And corrected improper connections in HistoryWindow and ContrastDialog, improper because they got called with the wrong this pointer, to the control instead of the dialog. But that was harmless anyway because the handlers did not use this.
This commit is contained in:
parent
d98e41aad1
commit
64a96e6f01
@ -96,16 +96,14 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
|||||||
|
|
||||||
S.StartMultiColumn(3, wxCENTRE);
|
S.StartMultiColumn(3, wxCENTRE);
|
||||||
{
|
{
|
||||||
mTotal = S.Id(ID_TOTAL).AddTextBox(_("&Total space used"), wxT("0"), 10);
|
mTotal = S.Id(ID_TOTAL)
|
||||||
mTotal->Bind(wxEVT_KEY_DOWN,
|
.ConnectRoot(wxEVT_KEY_DOWN, &HistoryWindow::OnChar)
|
||||||
// ignore it
|
.AddTextBox(_("&Total space used"), wxT("0"), 10);
|
||||||
[](wxEvent&){});
|
|
||||||
S.AddVariableText( {} )->Hide();
|
S.AddVariableText( {} )->Hide();
|
||||||
|
|
||||||
mAvail = S.Id(ID_AVAIL).AddTextBox(_("&Undo levels available"), wxT("0"), 10);
|
mAvail = S.Id(ID_AVAIL)
|
||||||
mAvail->Bind(wxEVT_KEY_DOWN,
|
.ConnectRoot(wxEVT_KEY_DOWN, &HistoryWindow::OnChar)
|
||||||
// ignore it
|
.AddTextBox(_("&Undo levels available"), wxT("0"), 10);
|
||||||
[](wxEvent&){});
|
|
||||||
S.AddVariableText( {} )->Hide();
|
S.AddVariableText( {} )->Hide();
|
||||||
|
|
||||||
S.AddPrompt(_("&Levels to discard"));
|
S.AddPrompt(_("&Levels to discard"));
|
||||||
@ -122,10 +120,9 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
|||||||
/* i18n-hint: (verb)*/
|
/* i18n-hint: (verb)*/
|
||||||
mDiscard = S.Id(ID_DISCARD).AddButton(_("&Discard"));
|
mDiscard = S.Id(ID_DISCARD).AddButton(_("&Discard"));
|
||||||
|
|
||||||
mClipboard = S.AddTextBox(_("Clipboard space used"), wxT("0"), 10);
|
mClipboard = S
|
||||||
mClipboard->Bind(wxEVT_KEY_DOWN,
|
.ConnectRoot(wxEVT_KEY_DOWN, &HistoryWindow::OnChar)
|
||||||
// ignore it
|
.AddTextBox(_("Clipboard space used"), wxT("0"), 10);
|
||||||
[](wxEvent&){});
|
|
||||||
S.Id(ID_DISCARD_CLIPBOARD).AddButton(_("Discard"));
|
S.Id(ID_DISCARD_CLIPBOARD).AddButton(_("Discard"));
|
||||||
}
|
}
|
||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
@ -164,6 +161,11 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
|||||||
parent->Bind(EVT_UNDO_RESET, &HistoryWindow::UpdateDisplay, this);
|
parent->Bind(EVT_UNDO_RESET, &HistoryWindow::UpdateDisplay, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::OnChar( wxEvent& )
|
||||||
|
{
|
||||||
|
// ignore it
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
|
void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
|
||||||
{
|
{
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
@ -36,6 +36,7 @@ class HistoryWindow final : public wxDialogWrapper {
|
|||||||
void DoUpdate();
|
void DoUpdate();
|
||||||
void UpdateLevels();
|
void UpdateLevels();
|
||||||
|
|
||||||
|
void OnChar(wxEvent &event);
|
||||||
void OnSize(wxSizeEvent & event);
|
void OnSize(wxSizeEvent & event);
|
||||||
void OnCloseWindow(wxCloseEvent & WXUNUSED(event));
|
void OnCloseWindow(wxCloseEvent & WXUNUSED(event));
|
||||||
void OnItemSelected(wxListEvent & event);
|
void OnItemSelected(wxListEvent & event);
|
||||||
|
@ -578,10 +578,9 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S)
|
|||||||
|
|
||||||
mEffects = S.Id(ID_List)
|
mEffects = S.Id(ID_List)
|
||||||
.Style(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
|
.Style(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
|
||||||
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&PluginRegistrationDialog::OnListChar)
|
||||||
.AddListControlReportMode({ _("Name"), _("State"), _("Path") });
|
.AddListControlReportMode({ _("Name"), _("State"), _("Path") });
|
||||||
mEffects->Bind(wxEVT_KEY_DOWN,
|
|
||||||
&PluginRegistrationDialog::OnListChar,
|
|
||||||
this);
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
mEffects->SetAccessible(mAx = safenew CheckListAx(mEffects));
|
mEffects->SetAccessible(mAx = safenew CheckListAx(mEffects));
|
||||||
#endif
|
#endif
|
||||||
|
@ -2083,6 +2083,9 @@ void ShuttleGuiBase::UpdateSizersCore(bool bPrepend, int Flags, bool prompt)
|
|||||||
if (mItem.mDisabled)
|
if (mItem.mDisabled)
|
||||||
mpWind->Enable( false );
|
mpWind->Enable( false );
|
||||||
|
|
||||||
|
for (auto &pair : mItem.mRootConnections)
|
||||||
|
mpWind->Connect( pair.first, pair.second, nullptr, mpDlg );
|
||||||
|
|
||||||
// Reset to defaults
|
// Reset to defaults
|
||||||
mItem = {};
|
mItem = {};
|
||||||
}
|
}
|
||||||
|
@ -180,11 +180,36 @@ struct Item {
|
|||||||
return std::move( *this );
|
return std::move( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispatch events from the control to the dialog
|
||||||
|
// The template type deduction ensures consistency between the argument type
|
||||||
|
// and the event type. It does not (yet) ensure correctness of the type of
|
||||||
|
// the handler object.
|
||||||
|
template< typename Tag, typename Argument, typename Handler >
|
||||||
|
auto ConnectRoot(
|
||||||
|
wxEventTypeTag<Tag> eventType,
|
||||||
|
void (Handler::*func)(Argument&)
|
||||||
|
) &&
|
||||||
|
-> typename std::enable_if<
|
||||||
|
std::is_base_of<Argument, Tag>::value,
|
||||||
|
Item&&
|
||||||
|
>::type
|
||||||
|
{
|
||||||
|
mRootConnections.push_back({
|
||||||
|
eventType,
|
||||||
|
(void(wxEvtHandler::*)(wxEvent&)) (
|
||||||
|
static_cast<void(wxEvtHandler::*)(Argument&)>( func )
|
||||||
|
)
|
||||||
|
});
|
||||||
|
return std::move( *this );
|
||||||
|
}
|
||||||
|
|
||||||
std::function< void(wxWindow*) > mValidatorSetter;
|
std::function< void(wxWindow*) > mValidatorSetter;
|
||||||
TranslatableString mToolTip;
|
TranslatableString mToolTip;
|
||||||
TranslatableString mName;
|
TranslatableString mName;
|
||||||
TranslatableString mNameSuffix;
|
TranslatableString mNameSuffix;
|
||||||
|
|
||||||
|
std::vector<std::pair<wxEventType, wxObjectEventFunction>> mRootConnections;
|
||||||
|
|
||||||
long miStyle{};
|
long miStyle{};
|
||||||
|
|
||||||
bool mFocused { false };
|
bool mFocused { false };
|
||||||
@ -595,6 +620,24 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispatch events from the control to the dialog
|
||||||
|
// The template type deduction ensures consistency between the argument type
|
||||||
|
// and the event type. It does not (yet) ensure correctness of the type of
|
||||||
|
// the handler object.
|
||||||
|
template< typename Tag, typename Argument, typename Handler >
|
||||||
|
auto ConnectRoot(
|
||||||
|
wxEventTypeTag<Tag> eventType,
|
||||||
|
void (Handler::*func)(Argument&)
|
||||||
|
)
|
||||||
|
-> typename std::enable_if<
|
||||||
|
std::is_base_of<Argument, Tag>::value,
|
||||||
|
ShuttleGui&
|
||||||
|
>::type
|
||||||
|
{
|
||||||
|
std::move( mItem ).ConnectRoot( eventType, func );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Prop() sets the proportion value, defined as in wxSizer::Add().
|
// Prop() sets the proportion value, defined as in wxSizer::Add().
|
||||||
ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.
|
ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.
|
||||||
|
|
||||||
|
@ -87,6 +87,12 @@ SplashDialog::SplashDialog(wxWindow * parent)
|
|||||||
Move( x, 60 );
|
Move( x, 60 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplashDialog::OnChar(wxMouseEvent &event)
|
||||||
|
{
|
||||||
|
if ( event.ShiftDown() && event.ControlDown() )
|
||||||
|
wxLaunchDefaultBrowser("https://www.audacityteam.org");
|
||||||
|
}
|
||||||
|
|
||||||
void SplashDialog::Populate( ShuttleGui & S )
|
void SplashDialog::Populate( ShuttleGui & S )
|
||||||
{
|
{
|
||||||
bool bShow;
|
bool bShow;
|
||||||
@ -118,16 +124,11 @@ void SplashDialog::Populate( ShuttleGui & S )
|
|||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxSize((int)(LOGOWITHNAME_WIDTH*fScale), (int)(LOGOWITHNAME_HEIGHT*fScale)));
|
wxSize((int)(LOGOWITHNAME_WIDTH*fScale), (int)(LOGOWITHNAME_HEIGHT*fScale)));
|
||||||
|
|
||||||
S.Prop(0).AddWindow( icon );
|
S.Prop(0)
|
||||||
|
|
||||||
#if (0)
|
#if (0)
|
||||||
icon->Bind(wxEVT_LEFT_DOWN,
|
.ConnectRoot( wxEVT_LEFT_DOWN, &SplashDialog::OnChar)
|
||||||
[this]( wxMouseEvent const & event ) ->void {
|
|
||||||
if ( event.ShiftDown() && event.ControlDown())
|
|
||||||
wxLaunchDefaultBrowser("https://www.audacityteam.org");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
|
.AddWindow( icon );
|
||||||
|
|
||||||
mpHtml = safenew LinkingHtmlWindow(S.GetParent(), -1,
|
mpHtml = safenew LinkingHtmlWindow(S.GetParent(), -1,
|
||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void OnChar(wxMouseEvent &event);
|
||||||
void Populate( ShuttleGui & S );
|
void Populate( ShuttleGui & S );
|
||||||
void OnDontShow( wxCommandEvent & Evt );
|
void OnDontShow( wxCommandEvent & Evt );
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ BEGIN_EVENT_TABLE(ContrastDialog,wxDialogWrapper)
|
|||||||
EVT_BUTTON(wxID_CANCEL, ContrastDialog::OnClose)
|
EVT_BUTTON(wxID_CANCEL, ContrastDialog::OnClose)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
static void OnChar(wxKeyEvent & event)
|
void ContrastDialog::OnChar(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
// Is this still required?
|
// Is this still required?
|
||||||
if (event.GetKeyCode() == WXK_TAB) {
|
if (event.GetKeyCode() == WXK_TAB) {
|
||||||
@ -252,8 +252,10 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
|
|||||||
.AddWindow(mForegroundEndT);
|
.AddWindow(mForegroundEndT);
|
||||||
|
|
||||||
m_pButton_UseCurrentF = S.Id(ID_BUTTON_USECURRENTF).AddButton(_("&Measure selection"));
|
m_pButton_UseCurrentF = S.Id(ID_BUTTON_USECURRENTF).AddButton(_("&Measure selection"));
|
||||||
mForegroundRMSText=S.Id(ID_FOREGROUNDDB_TEXT).AddTextBox( {}, wxT(""), 17);
|
mForegroundRMSText = S.Id(ID_FOREGROUNDDB_TEXT)
|
||||||
mForegroundRMSText->Bind(wxEVT_KEY_DOWN, OnChar);
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&ContrastDialog::OnChar)
|
||||||
|
.AddTextBox( {}, wxT(""), 17);
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
S.AddFixedText(_("&Background:"));
|
S.AddFixedText(_("&Background:"));
|
||||||
@ -284,8 +286,10 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
|
|||||||
.AddWindow(mBackgroundEndT);
|
.AddWindow(mBackgroundEndT);
|
||||||
|
|
||||||
m_pButton_UseCurrentB = S.Id(ID_BUTTON_USECURRENTB).AddButton(_("Mea&sure selection"));
|
m_pButton_UseCurrentB = S.Id(ID_BUTTON_USECURRENTB).AddButton(_("Mea&sure selection"));
|
||||||
mBackgroundRMSText = S.Id(ID_BACKGROUNDDB_TEXT).AddTextBox( {}, wxT(""), 17);
|
mBackgroundRMSText = S.Id(ID_BACKGROUNDDB_TEXT)
|
||||||
mBackgroundRMSText->Bind(wxEVT_KEY_DOWN, OnChar);
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&ContrastDialog::OnChar)
|
||||||
|
.AddTextBox( {}, wxT(""), 17);
|
||||||
}
|
}
|
||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
}
|
}
|
||||||
@ -300,16 +304,18 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
|
|||||||
S.AddFixedText(label.Translation());
|
S.AddFixedText(label.Translation());
|
||||||
mPassFailText = S.Id(ID_RESULTS_TEXT)
|
mPassFailText = S.Id(ID_RESULTS_TEXT)
|
||||||
.Name(label)
|
.Name(label)
|
||||||
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&ContrastDialog::OnChar)
|
||||||
.AddTextBox( {}, wxT(""), 50);
|
.AddTextBox( {}, wxT(""), 50);
|
||||||
mPassFailText->Bind(wxEVT_KEY_DOWN, OnChar);
|
|
||||||
m_pButton_Reset = S.Id(ID_BUTTON_RESET).AddButton(_("R&eset"));
|
m_pButton_Reset = S.Id(ID_BUTTON_RESET).AddButton(_("R&eset"));
|
||||||
|
|
||||||
label = XO("&Difference:");
|
label = XO("&Difference:");
|
||||||
S.AddFixedText(label.Translation());
|
S.AddFixedText(label.Translation());
|
||||||
mDiffText = S.Id(ID_RESULTSDB_TEXT)
|
mDiffText = S.Id(ID_RESULTSDB_TEXT)
|
||||||
.Name(label)
|
.Name(label)
|
||||||
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&ContrastDialog::OnChar)
|
||||||
.AddTextBox( {}, wxT(""), 50);
|
.AddTextBox( {}, wxT(""), 50);
|
||||||
mDiffText->Bind(wxEVT_KEY_DOWN, OnChar);
|
|
||||||
m_pButton_Export = S.Id(ID_BUTTON_EXPORT).AddButton(_("E&xport..."));
|
m_pButton_Export = S.Id(ID_BUTTON_EXPORT).AddButton(_("E&xport..."));
|
||||||
}
|
}
|
||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// handlers
|
// handlers
|
||||||
|
void OnChar(wxKeyEvent &event);
|
||||||
void OnGetURL(wxCommandEvent &event);
|
void OnGetURL(wxCommandEvent &event);
|
||||||
void OnExport(wxCommandEvent &event);
|
void OnExport(wxCommandEvent &event);
|
||||||
void OnGetForeground(wxCommandEvent & event);
|
void OnGetForeground(wxCommandEvent & event);
|
||||||
|
@ -864,12 +864,10 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
|||||||
mSliders[i] = safenew wxSliderWrapper(pParent, ID_Slider + i, 0, -20, +20,
|
mSliders[i] = safenew wxSliderWrapper(pParent, ID_Slider + i, 0, -20, +20,
|
||||||
wxDefaultPosition, wxSize(-1,150), wxSL_VERTICAL | wxSL_INVERSE);
|
wxDefaultPosition, wxSize(-1,150), wxSL_VERTICAL | wxSL_INVERSE);
|
||||||
|
|
||||||
mSliders[i]->Bind(wxEVT_ERASE_BACKGROUND,
|
|
||||||
// ignore it
|
|
||||||
[](wxEvent&){});
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
mSliders[i]->SetAccessible(safenew SliderAx(mSliders[i], _("%d dB")));
|
mSliders[i]->SetAccessible(safenew SliderAx(mSliders[i], _("%d dB")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mSlidersOld[i] = 0;
|
mSlidersOld[i] = 0;
|
||||||
mEQVals[i] = 0.;
|
mEQVals[i] = 0.;
|
||||||
//S.SetSizerProportion(1);
|
//S.SetSizerProportion(1);
|
||||||
@ -879,6 +877,8 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
|||||||
? wxString::Format(_("%d Hz"), (int)kThirdOct[i])
|
? wxString::Format(_("%d Hz"), (int)kThirdOct[i])
|
||||||
: wxString::Format(_("%g kHz"), kThirdOct[i]/1000.)
|
: wxString::Format(_("%g kHz"), kThirdOct[i]/1000.)
|
||||||
} )
|
} )
|
||||||
|
.ConnectRoot(
|
||||||
|
wxEVT_ERASE_BACKGROUND, &EffectEqualization::OnErase)
|
||||||
.AddWindow( mSliders[i], wxEXPAND );
|
.AddWindow( mSliders[i], wxEXPAND );
|
||||||
}
|
}
|
||||||
S.AddSpace(15,0);
|
S.AddSpace(15,0);
|
||||||
@ -2757,6 +2757,10 @@ double EffectEqualization::splint(double x[], double y[], size_t n, double y2[],
|
|||||||
return( a*y[k]+b*y[k+1]+((a*a*a-a)*y2[k]+(b*b*b-b)*y2[k+1])*h*h/6.);
|
return( a*y[k]+b*y[k+1]+((a*a*a-a)*y2[k]+(b*b*b-b)*y2[k+1])*h*h/6.);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EffectEqualization::OnErase( wxEvent& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void EffectEqualization::OnSize(wxSizeEvent & event)
|
void EffectEqualization::OnSize(wxSizeEvent & event)
|
||||||
{
|
{
|
||||||
mUIParent->Layout();
|
mUIParent->Layout();
|
||||||
|
@ -190,6 +190,7 @@ private:
|
|||||||
void spline(double x[], double y[], size_t n, double y2[]);
|
void spline(double x[], double y[], size_t n, double y2[]);
|
||||||
double splint(double x[], double y[], size_t n, double y2[], double xr);
|
double splint(double x[], double y[], size_t n, double y2[], double xr);
|
||||||
|
|
||||||
|
void OnErase( wxEvent &event );
|
||||||
void OnSize( wxSizeEvent & event );
|
void OnSize( wxSizeEvent & event );
|
||||||
void OnSlider( wxCommandEvent & event );
|
void OnSlider( wxCommandEvent & event );
|
||||||
void OnInterp( wxCommandEvent & event );
|
void OnInterp( wxCommandEvent & event );
|
||||||
|
@ -226,14 +226,13 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
#endif
|
#endif
|
||||||
wxTE_PROCESS_ENTER);
|
wxTE_PROCESS_ENTER);
|
||||||
mFilter->SetName(wxStripMenuCodes(mFilterLabel->GetLabel()));
|
mFilter->SetName(wxStripMenuCodes(mFilterLabel->GetLabel()));
|
||||||
mFilter->Bind(wxEVT_KEY_DOWN,
|
|
||||||
&KeyConfigPrefs::OnFilterKeyDown,
|
|
||||||
this);
|
|
||||||
mFilter->Bind(wxEVT_CHAR,
|
|
||||||
&KeyConfigPrefs::OnFilterChar,
|
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
S.AddWindow(mFilter, wxALIGN_NOT | wxALIGN_LEFT);
|
S
|
||||||
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&KeyConfigPrefs::OnFilterKeyDown)
|
||||||
|
.ConnectRoot(wxEVT_CHAR,
|
||||||
|
&KeyConfigPrefs::OnFilterChar)
|
||||||
|
.AddWindow(mFilter, wxALIGN_NOT | wxALIGN_LEFT);
|
||||||
}
|
}
|
||||||
S.EndHorizontalLay();
|
S.EndHorizontalLay();
|
||||||
}
|
}
|
||||||
@ -269,17 +268,15 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
mKey->SetAccessible(safenew WindowAccessible(mKey));
|
mKey->SetAccessible(safenew WindowAccessible(mKey));
|
||||||
#endif
|
#endif
|
||||||
mKey->SetName(_("Short cut"));
|
mKey->SetName(_("Short cut"));
|
||||||
mKey->Bind(wxEVT_KEY_DOWN,
|
|
||||||
&KeyConfigPrefs::OnHotkeyKeyDown,
|
|
||||||
this);
|
|
||||||
mKey->Bind(wxEVT_CHAR,
|
|
||||||
&KeyConfigPrefs::OnHotkeyChar,
|
|
||||||
this);
|
|
||||||
mKey->Bind(wxEVT_KILL_FOCUS,
|
|
||||||
&KeyConfigPrefs::OnHotkeyKillFocus,
|
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
S.AddWindow(mKey);
|
S
|
||||||
|
.ConnectRoot(wxEVT_KEY_DOWN,
|
||||||
|
&KeyConfigPrefs::OnHotkeyKeyDown)
|
||||||
|
.ConnectRoot(wxEVT_CHAR,
|
||||||
|
&KeyConfigPrefs::OnHotkeyChar)
|
||||||
|
.ConnectRoot(wxEVT_KILL_FOCUS,
|
||||||
|
&KeyConfigPrefs::OnHotkeyKillFocus)
|
||||||
|
.AddWindow(mKey);
|
||||||
|
|
||||||
/* i18n-hint: (verb)*/
|
/* i18n-hint: (verb)*/
|
||||||
mSet = S.Id(SetButtonID).AddButton(_("&Set"));
|
mSet = S.Id(SetButtonID).AddButton(_("&Set"));
|
||||||
@ -455,12 +452,12 @@ void KeyConfigPrefs::OnHotkeyKeyDown(wxKeyEvent & e)
|
|||||||
t->SetValue(KeyEventToKeyString(e).Display());
|
t->SetValue(KeyEventToKeyString(e).Display());
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnHotkeyChar(wxKeyEvent & WXUNUSED(e))
|
void KeyConfigPrefs::OnHotkeyChar(wxEvent & WXUNUSED(e))
|
||||||
{
|
{
|
||||||
// event.Skip() not performed, so event will not be processed further.
|
// event.Skip() not performed, so event will not be processed further.
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnHotkeyKillFocus(wxFocusEvent & e)
|
void KeyConfigPrefs::OnHotkeyKillFocus(wxEvent & e)
|
||||||
{
|
{
|
||||||
if (mKey->GetValue().empty() && mCommandSelected != wxNOT_FOUND) {
|
if (mKey->GetValue().empty() && mCommandSelected != wxNOT_FOUND) {
|
||||||
mKey->AppendText(mView->GetKey(mCommandSelected).Display());
|
mKey->AppendText(mView->GetKey(mCommandSelected).Display());
|
||||||
@ -521,7 +518,7 @@ void KeyConfigPrefs::OnFilterKeyDown(wxKeyEvent & e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnFilterChar(wxKeyEvent & e)
|
void KeyConfigPrefs::OnFilterChar(wxEvent & e)
|
||||||
{
|
{
|
||||||
if (mViewType != ViewByKey)
|
if (mViewType != ViewByKey)
|
||||||
{
|
{
|
||||||
|
@ -58,12 +58,12 @@ private:
|
|||||||
void OnSelected(wxCommandEvent & e);
|
void OnSelected(wxCommandEvent & e);
|
||||||
|
|
||||||
void OnHotkeyKeyDown(wxKeyEvent & e);
|
void OnHotkeyKeyDown(wxKeyEvent & e);
|
||||||
void OnHotkeyChar(wxKeyEvent & e);
|
void OnHotkeyChar(wxEvent & e);
|
||||||
void OnHotkeyKillFocus(wxFocusEvent & e);
|
void OnHotkeyKillFocus(wxEvent & e);
|
||||||
|
|
||||||
void OnFilterTimer(wxTimerEvent & e);
|
void OnFilterTimer(wxTimerEvent & e);
|
||||||
void OnFilterKeyDown(wxKeyEvent & e);
|
void OnFilterKeyDown(wxKeyEvent & e);
|
||||||
void OnFilterChar(wxKeyEvent & e);
|
void OnFilterChar(wxEvent & e);
|
||||||
|
|
||||||
KeyView *mView;
|
KeyView *mView;
|
||||||
wxTextCtrl *mKey;
|
wxTextCtrl *mKey;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user