summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <Mataes2007@gmail.com>2018-12-27 10:41:21 +0300
committerKirill Volinsky <Mataes2007@gmail.com>2018-12-27 10:41:21 +0300
commit50b460e1381cfd3d8dbccc69892a70db2eeb2288 (patch)
tree971914d641a29e0fa3b74f42f91e94bc7593415d
parent228008cd0ceeeec457d83370854510cd8be1d8f8 (diff)
MenuEx: options class structure fix
-rw-r--r--plugins/MenuItemEx/res/resource.rc10
-rw-r--r--plugins/MenuItemEx/src/options.cpp178
-rw-r--r--plugins/MenuItemEx/src/stdafx.h25
3 files changed, 94 insertions, 119 deletions
diff --git a/plugins/MenuItemEx/res/resource.rc b/plugins/MenuItemEx/res/resource.rc
index 77b5784eed..c291df7a18 100644
--- a/plugins/MenuItemEx/res/resource.rc
+++ b/plugins/MenuItemEx/res/resource.rc
@@ -44,16 +44,6 @@ IDI_ICON13 ICON "CopyMirVer.ico"
// Dialog
//
-IDD_AUTHREQ DIALOGEX 0, 0, 186, 95
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "Enter an authorization request"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "&Send",IDOK,34,74,50,14
- PUSHBUTTON "&Cancel",IDCANCEL,98,74,50,14
- EDITTEXT IDC_REASON,7,7,172,59,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN
-END
-
IDD_OPTIONS DIALOGEX 0, 0, 280, 217
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp
index 7395585672..be129fe14f 100644
--- a/plugins/MenuItemEx/src/options.cpp
+++ b/plugins/MenuItemEx/src/options.cpp
@@ -26,105 +26,115 @@ static const checkboxes[] = {
{ IDC_TRIMID, VF_TRIMID }
};
-COptDialog::COptDialog() :
- CDlgBase(g_plugin, IDD_OPTIONS),
- m_chkVis(this, IDC_VIS),
- m_chkAlpha(this, IDC_SHOWALPHAICONS),
- m_chkHide(this, IDC_HIDE),
- m_chkIgnore(this, IDC_IGNORE),
- m_chkProtos(this, IDC_PROTOS),
- m_chkAdded(this, IDC_ADDED),
- m_chkAuthReq(this, IDC_AUTHREQ),
- m_chkRecvFiles(this, IDC_RECVFILES),
- m_chkCopyIP(this, IDC_COPYIP),
- m_chkCopyMirver(this, IDC_COPYMIRVER),
- m_chkStatusMsg(this, IDC_STATUSMSG),
- m_chkSMName(this, IDC_SMNAME),
- m_chkCopyID(this, IDC_COPYID),
- m_chkCopyIDName(this, IDC_COPYIDNAME),
- m_chkShowID(this, IDC_SHOWID),
- m_chkTrimID(this, IDC_TRIMID),
- m_lblHint(this, IDC_HINT1),
- m_chkIgnoreHide(this, IDC_IGNOREHIDE)
+class COptDialog : public CDlgBase
{
- m_flags = g_plugin.getDword("flags", vf_default);
-
- m_chkVis.OnChange = Callback(this, &COptDialog::OnVisChange);
- m_chkIgnore.OnChange = Callback(this, &COptDialog::OnIgnoreChange);
- m_chkCopyID.OnChange = Callback(this, &COptDialog::OnCopyIDChange);
- m_chkStatusMsg.OnChange = Callback(this, &COptDialog::OnStatusMsgChange);
- m_chkShowID.OnChange = Callback(this, &COptDialog::OnShowIDChange);
-}
-
-bool COptDialog::OnInitDialog()
-{
- for (auto &it : checkboxes) {
- CCtrlCheck &item = *(CCtrlCheck*)FindControl(it.idc);
- item.SetState(m_flags & it.flag);
+ DWORD m_flags;
+
+ CCtrlCheck m_chkVis, m_chkAlpha, m_chkHide, m_chkIgnore, m_chkProtos, m_chkAdded, m_chkAuthReq, m_chkRecvFiles, m_chkCopyIP, m_chkCopyMirver, m_chkStatusMsg,
+ m_chkSMName, m_chkCopyID, m_chkCopyIDName, m_chkShowID, m_chkTrimID, m_chkIgnoreHide;
+ CCtrlLabel m_lblHint;
+
+ void EnableWindowChecks()
+ {
+ m_chkAlpha.Enable(m_chkVis.GetState());
+ m_chkIgnoreHide.Enable(m_chkIgnore.GetState());
+ m_chkCopyIDName.Enable(m_chkCopyID.GetState());
+ m_chkShowID.Enable(m_chkCopyID.GetState());
+ m_chkTrimID.Enable(m_chkCopyID.GetState() && m_chkShowID.GetState());
+ m_chkSMName.Enable(m_chkStatusMsg.GetState());
}
- if (bPopupService) {
- for (int i = 0; i < 4; i++) {
- CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc);
- CMStringW buffer;
- buffer.Format(L"%s *", item.GetText());
- item.SetText(buffer);
- }
+public:
+ COptDialog() :
+ CDlgBase(g_plugin, IDD_OPTIONS),
+ m_chkVis(this, IDC_VIS),
+ m_chkAlpha(this, IDC_SHOWALPHAICONS),
+ m_chkHide(this, IDC_HIDE),
+ m_chkIgnore(this, IDC_IGNORE),
+ m_chkProtos(this, IDC_PROTOS),
+ m_chkAdded(this, IDC_ADDED),
+ m_chkAuthReq(this, IDC_AUTHREQ),
+ m_chkRecvFiles(this, IDC_RECVFILES),
+ m_chkCopyIP(this, IDC_COPYIP),
+ m_chkCopyMirver(this, IDC_COPYMIRVER),
+ m_chkStatusMsg(this, IDC_STATUSMSG),
+ m_chkSMName(this, IDC_SMNAME),
+ m_chkCopyID(this, IDC_COPYID),
+ m_chkCopyIDName(this, IDC_COPYIDNAME),
+ m_chkShowID(this, IDC_SHOWID),
+ m_chkTrimID(this, IDC_TRIMID),
+ m_lblHint(this, IDC_HINT1),
+ m_chkIgnoreHide(this, IDC_IGNOREHIDE)
+ {
+ m_flags = g_plugin.getDword("flags", vf_default);
+
+ m_chkVis.OnChange = Callback(this, &COptDialog::OnVisChange);
+ m_chkIgnore.OnChange = Callback(this, &COptDialog::OnIgnoreChange);
+ m_chkCopyID.OnChange = Callback(this, &COptDialog::OnCopyIDChange);
+ m_chkStatusMsg.OnChange = Callback(this, &COptDialog::OnStatusMsgChange);
+ m_chkShowID.OnChange = Callback(this, &COptDialog::OnShowIDChange);
}
- else
- m_lblHint.Hide();
- EnableWindowChecks();
- return true;
-}
+ bool OnInitDialog() override
+ {
+ for (auto &it : checkboxes) {
+ CCtrlCheck &item = *(CCtrlCheck*)FindControl(it.idc);
+ item.SetState(m_flags & it.flag);
+ }
-bool COptDialog::OnApply()
-{
- DWORD mod_flags = 0;
+ if (bPopupService) {
+ for (int i = 0; i < 4; i++) {
+ CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc);
+ CMStringW buffer;
+ buffer.Format(L"%s *", item.GetText());
+ item.SetText(buffer);
+ }
+ }
+ else
+ m_lblHint.Hide();
- for (auto &it : checkboxes) {
- CCtrlCheck &item = *(CCtrlCheck*)FindControl(it.idc);
- mod_flags |= item.GetState() ? it.flag : 0;
+ EnableWindowChecks();
+ return true;
}
- g_plugin.setDword("flags", mod_flags);
- return true;
-}
+ bool OnApply() override
+ {
+ DWORD mod_flags = 0;
-void COptDialog::EnableWindowChecks()
-{
- m_chkAlpha.Enable(m_chkVis.GetState());
- m_chkIgnoreHide.Enable(m_chkIgnore.GetState());
- m_chkCopyIDName.Enable(m_chkCopyID.GetState());
- m_chkShowID.Enable(m_chkCopyID.GetState());
- m_chkTrimID.Enable(m_chkCopyID.GetState() && m_chkShowID.GetState());
- m_chkSMName.Enable(m_chkStatusMsg.GetState());
-}
+ for (auto &it : checkboxes) {
+ CCtrlCheck &item = *(CCtrlCheck*)FindControl(it.idc);
+ mod_flags |= item.GetState() ? it.flag : 0;
+ }
-void COptDialog::OnVisChange(CCtrlBase*)
-{
- EnableWindowChecks();
-}
+ g_plugin.setDword("flags", mod_flags);
+ return true;
+ }
-void COptDialog::OnIgnoreChange(CCtrlBase*)
-{
- EnableWindowChecks();
-}
+ void OnVisChange(CCtrlBase*)
+ {
+ EnableWindowChecks();
+ }
-void COptDialog::OnCopyIDChange(CCtrlBase*)
-{
- EnableWindowChecks();
-}
+ void OnIgnoreChange(CCtrlBase*)
+ {
+ EnableWindowChecks();
+ }
-void COptDialog::OnStatusMsgChange(CCtrlBase*)
-{
- EnableWindowChecks();
-}
+ void OnCopyIDChange(CCtrlBase*)
+ {
+ EnableWindowChecks();
+ }
-void COptDialog::OnShowIDChange(CCtrlBase*)
-{
- EnableWindowChecks();
-}
+ void OnStatusMsgChange(CCtrlBase*)
+ {
+ EnableWindowChecks();
+ }
+
+ void OnShowIDChange(CCtrlBase*)
+ {
+ EnableWindowChecks();
+ }
+};
int OptionsInit(WPARAM wparam, LPARAM)
{
diff --git a/plugins/MenuItemEx/src/stdafx.h b/plugins/MenuItemEx/src/stdafx.h
index 7c2d4d0aa6..678d81f992 100644
--- a/plugins/MenuItemEx/src/stdafx.h
+++ b/plugins/MenuItemEx/src/stdafx.h
@@ -69,29 +69,4 @@ int OptionsInit(WPARAM, LPARAM);
extern const int vf_default;
-class COptDialog : public CDlgBase
-{
-private:
- DWORD m_flags;
-
- CCtrlCheck m_chkVis, m_chkAlpha, m_chkHide, m_chkIgnore, m_chkProtos, m_chkAdded, m_chkAuthReq, m_chkRecvFiles, m_chkCopyIP, m_chkCopyMirver, m_chkStatusMsg,
- m_chkSMName, m_chkCopyID, m_chkCopyIDName, m_chkShowID, m_chkTrimID, m_chkIgnoreHide;
- CCtrlLabel m_lblHint;
-
-protected:
- bool OnInitDialog() override;
- bool OnApply() override;
-
- void OnVisChange(CCtrlBase*);
- void OnIgnoreChange(CCtrlBase*);
- void OnCopyIDChange(CCtrlBase*);
- void OnStatusMsgChange(CCtrlBase*);
- void OnShowIDChange(CCtrlBase*);
-
- void EnableWindowChecks();
-
-public:
- COptDialog();
-};
-
#endif