From 2fa4d8fd0f2c29517025dfc3bebc8a5e07c3d380 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Apr 2015 14:39:35 +0000 Subject: - nasty crutch removed from Options_AddPage; - HWND hwndParent removed from the CDlgBase constructor; - method CDlgBase::SetParent() added for the rare occasions where it's needed; git-svn-id: http://svn.miranda-ng.org/main/trunk@12785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber.h | 4 ++-- protocols/JabberG/src/jabber_agent.cpp | 5 ++-- protocols/JabberG/src/jabber_opt.cpp | 41 ++++++++++---------------------- protocols/JabberG/src/jabber_privacy.cpp | 8 +++++-- protocols/JabberG/src/jabber_proto.h | 7 +----- protocols/JabberG/src/jabber_svc.cpp | 4 +++- 6 files changed, 28 insertions(+), 41 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index dd707ac2be..09448a9446 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -124,8 +124,8 @@ class CJabberDlgBase : public CProtoDlgBase { typedef CProtoDlgBase CSuper; protected: - __inline CJabberDlgBase(CJabberProto *proto, int idDialog, HWND parent, bool show_label=true) : - CSuper(proto, idDialog, parent, show_label) + __inline CJabberDlgBase(CJabberProto *proto, int idDialog, bool show_label=true) : + CSuper(proto, idDialog, show_label) { } diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index 5b6176bf86..88487f68ba 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -35,9 +35,10 @@ class CAgentRegProgressDlg : public CJabberDlgBase public: CAgentRegProgressDlg(CJabberProto *_ppro, HWND _owner) : - CJabberDlgBase(_ppro, IDD_OPT_REGISTER, _owner, false), + CJabberDlgBase(_ppro, IDD_OPT_REGISTER, false), m_ok(this, IDOK) { + SetParent(_owner); m_ok.OnClick = Callback(this, &CAgentRegProgressDlg::OnOk); } @@ -87,7 +88,7 @@ class CAgentRegDlg : public CJabberDlgBase public: CAgentRegDlg(CJabberProto *_ppro, TCHAR *_jid) : - CJabberDlgBase(_ppro, IDD_FORM, NULL, false), + CJabberDlgBase(_ppro, IDD_FORM, false), m_submit(this, IDC_SUBMIT), m_jid(_jid), m_agentRegIqNode(NULL) diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 61190c27d7..f935c44fdf 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -229,11 +229,12 @@ class CJabberDlgRegister: public CJabberDlgBase typedef CJabberDlgBase CSuper; public: CJabberDlgRegister(CJabberProto *proto, HWND hwndParent, JABBER_CONN_DATA *regInfo): - CJabberDlgBase(proto, IDD_OPT_REGISTER, hwndParent, false), + CJabberDlgBase(proto, IDD_OPT_REGISTER, false), m_bProcessStarted(false), m_regInfo(regInfo), m_btnOk(this, IDOK) { + SetParent(hwndParent); m_autoClose = CLOSE_ON_CANCEL; m_btnOk.OnClick = Callback(this, &CJabberDlgRegister::btnOk_OnClick); } @@ -364,7 +365,7 @@ class CDlgOptAccount: public CJabberDlgBase public: CDlgOptAccount(CJabberProto *proto): - CJabberDlgBase(proto, IDD_OPT_JABBER, NULL, false), + CJabberDlgBase(proto, IDD_OPT_JABBER, false), m_txtUsername(this, IDC_EDIT_USERNAME), m_txtPassword(this, IDC_EDIT_PASSWORD), m_txtPriority(this, IDC_PRIORITY), @@ -419,8 +420,6 @@ public: m_btnChangePassword.OnClick = Callback(this, &CDlgOptAccount::btnChangePassword_OnClick); } - static CDlgBase *Create(void *param) { return new CDlgOptAccount((CJabberProto *)param); } - protected: void OnInitDialog() { @@ -774,7 +773,7 @@ class CDlgOptAdvanced: public CJabberDlgBase public: CDlgOptAdvanced(CJabberProto *proto): - CJabberDlgBase(proto, IDD_OPT_JABBER2, NULL, false), + CJabberDlgBase(proto, IDD_OPT_JABBER2, false), m_chkDirect(this, IDC_DIRECT), m_chkDirectManual(this, IDC_DIRECT_MANUAL), m_chkProxy(this, IDC_PROXY_MANUAL), @@ -875,8 +874,6 @@ public: else m_txtProxy.Disable(); } - - static CDlgBase *Create(void *param) { return new CDlgOptAdvanced((CJabberProto *)param); } }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -893,7 +890,7 @@ class CDlgOptGc: public CJabberDlgBase public: CDlgOptGc(CJabberProto *proto): - CJabberDlgBase(proto, IDD_OPT_JABBER4, NULL, false), + CJabberDlgBase(proto, IDD_OPT_JABBER4, false), m_txtAltNick(this, IDC_TXT_ALTNICK), m_txtSlap(this, IDC_TXT_SLAP), m_txtQuit(this, IDC_TXT_QUIT), @@ -915,8 +912,6 @@ public: m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Status changes"), m_proto->m_options.GcLogStatuses); m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory); } - - static CDlgBase *Create(void *param) { return new CDlgOptGc((CJabberProto *)param); } }; ////////////////////////////////////////////////////////////////////////// @@ -1511,34 +1506,22 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRosterControl(WPARAM, LPARAM) int CJabberProto::OnOptionsInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = hInst; + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); odp.ptszGroup = LPGENT("Network"); odp.ptszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; odp.ptszTab = LPGENT("Account"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&OptCreateAccount; - OptCreateAccount.create = CDlgOptAccount::Create; - OptCreateAccount.param = this; + odp.pDialog = new CDlgOptAccount(this); Options_AddPage(wParam, &odp); odp.ptszTab = LPGENT("Conferences"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER4); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&OptCreateGc; - OptCreateGc.create = CDlgOptGc::Create; - OptCreateGc.param = this; + odp.pDialog = new CDlgOptGc(this); Options_AddPage(wParam, &odp); odp.ptszTab = LPGENT("Advanced"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_JABBER2); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&OptCreateAdvanced; - OptCreateAdvanced.create = CDlgOptAdvanced::Create; - OptCreateAdvanced.param = this; + odp.pDialog = new CDlgOptAdvanced(this); Options_AddPage(wParam, &odp); return 0; } @@ -1564,7 +1547,7 @@ class CJabberDlgAccMgrUI: public CJabberDlgBase public: CJabberDlgAccMgrUI(CJabberProto *proto, HWND hwndParent): - CJabberDlgBase(proto, IDD_ACCMGRUI, hwndParent, false), + CJabberDlgBase(proto, IDD_ACCMGRUI, false), m_cbType(this, IDC_CB_TYPE), m_txtUsername(this, IDC_EDIT_USERNAME), m_txtPassword(this, IDC_EDIT_PASSWORD), @@ -1577,6 +1560,8 @@ public: m_txtManualHost(this, IDC_HOST), m_btnRegister(this, IDC_BUTTON_REGISTER) { + SetParent(hwndParent); + CreateLink(m_txtUsername, "LoginName", _T("")); CreateLink(m_chkSavePassword, proto->m_options.SavePassword); CreateLink(m_cbResource, "Resource", _T("Miranda")); diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 3a31b8de44..ffcf2945ef 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -301,11 +301,13 @@ public: TCHAR szLine[512]; CJabberDlgPrivacyAddList(CJabberProto *proto, HWND hwndParent): - CJabberDlgBase(proto, IDD_PRIVACY_ADD_LIST, hwndParent, false), + CJabberDlgBase(proto, IDD_PRIVACY_ADD_LIST, false), m_txtName(this, IDC_EDIT_NAME), m_btnOk(this, IDOK), m_btnCancel(this, IDCANCEL) { + SetParent(hwndParent); + m_btnOk.OnClick = Callback(this, &CJabberDlgPrivacyAddList::btnOk_OnClick); m_btnCancel.OnClick = Callback(this, &CJabberDlgPrivacyAddList::btnCancel_OnClick); } @@ -341,11 +343,13 @@ public: CPrivacyListRule *m_pRule; CJabberDlgPrivacyRule(CJabberProto *proto, HWND hwndParent, CPrivacyListRule *pRule): - CJabberDlgBase(proto, IDD_PRIVACY_RULE, hwndParent, false), + CJabberDlgBase(proto, IDD_PRIVACY_RULE, false), m_btnOk(this, IDOK), m_btnCancel(this, IDCANCEL), m_cbType(this, IDC_COMBO_TYPE) { + SetParent(hwndParent); + m_pRule = pRule; m_cbType.OnChange = Callback(this, &CJabberDlgPrivacyRule::cbType_OnChange); m_btnOk.OnClick = Callback(this, &CJabberDlgPrivacyRule::btnOk_OnClick); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index d078c91343..2f4764c94b 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -600,12 +600,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle); //---- jabber_opt.cpp ---------------------------------------------------------------- - - CJabberDlgBase::CreateParam OptCreateAccount; - CJabberDlgBase::CreateParam OptCreateGc; - CJabberDlgBase::CreateParam OptCreateAdvanced; - - INT_PTR __cdecl OnMenuHandleRosterControl(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnMenuHandleRosterControl(WPARAM wParam, LPARAM lParam); void _RosterExportToFile(HWND hwndDlg); void _RosterImportFromFile(HWND hwndDlg); diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index dc71adceab..19d6d8c154 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -587,12 +587,14 @@ class CJabberDlgHttpAuth: public CJabberDlgBase public: CJabberDlgHttpAuth(CJabberProto *proto, HWND hwndParent, CJabberHttpAuthParams *pParams): - CSuper(proto, IDD_HTTP_AUTH, hwndParent, true), + CSuper(proto, IDD_HTTP_AUTH, true), m_txtInfo(this, IDC_EDIT_HTTP_AUTH_INFO), m_btnAuth(this, IDOK), m_btnDeny(this, IDCANCEL), m_pParams(pParams) { + SetParent(hwndParent); + m_btnAuth.OnClick = Callback(this, &CJabberDlgHttpAuth::btnAuth_OnClick); m_btnDeny.OnClick = Callback(this, &CJabberDlgHttpAuth::btnDeny_OnClick); } -- cgit v1.2.3