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/IRCG/src/irc.h | 2 -- protocols/IRCG/src/irc_dlg.h | 10 +------ protocols/IRCG/src/options.cpp | 46 +++++++++++++------------------- protocols/IRCG/src/windows.cpp | 14 +++++----- 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 ++- protocols/Tox/src/tox_options.cpp | 45 ++++++++++++------------------- protocols/Tox/src/tox_options.h | 8 ++---- protocols/Tox/src/tox_profile.cpp | 2 +- protocols/Tox/src/tox_proto.h | 3 --- protocols/Tox/src/tox_search.cpp | 4 +-- 15 files changed, 78 insertions(+), 125 deletions(-) (limited to 'protocols') diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index a666514a85..c937c2f620 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -363,8 +363,6 @@ struct CIrcProto : public PROTO CMStringA sChannelModes, sUserModes; CMString sChannelPrefixes, sUserModePrefixes, WhoisAwayReply; - CDlgBase::CreateParam OptCreateAccount, OptCreateConn, OptCreateIgnore, OptCreateOther; - //clist.cpp MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline); bool CList_SetAllOffline(BYTE ChatsToo); diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h index 9414365e3b..327130838f 100644 --- a/protocols/IRCG/src/irc_dlg.h +++ b/protocols/IRCG/src/irc_dlg.h @@ -34,7 +34,7 @@ struct CMessageBoxDlg : public CProtoDlgBase < CIrcProto > struct CCoolIrcDlg : public CProtoDlgBase < CIrcProto > { - CCoolIrcDlg(CIrcProto* _pro, int dlgId, HWND parent = NULL); + CCoolIrcDlg(CIrcProto* _pro, int dlgId); virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam); @@ -208,8 +208,6 @@ struct CConnectPrefsDlg : public CProtoDlgBase < CIrcProto > CConnectPrefsDlg(CIrcProto* _pro); - static CDlgBase* Create(void* param) { return new CConnectPrefsDlg((CIrcProto*)param); } - virtual void OnInitDialog(); virtual void OnApply(); @@ -236,8 +234,6 @@ struct CCtcpPrefsDlg : public CProtoDlgBase < CIrcProto > CCtcpPrefsDlg(CIrcProto* _pro); - static CDlgBase* Create(void* param) { return new CCtcpPrefsDlg((CIrcProto*)param); } - virtual void OnInitDialog(); virtual void OnApply(); @@ -258,8 +254,6 @@ struct COtherPrefsDlg : public CProtoDlgBase < CIrcProto > COtherPrefsDlg(CIrcProto* _pro); - static CDlgBase* Create(void* param) { return new COtherPrefsDlg((CIrcProto*)param); } - virtual void OnInitDialog(); virtual void OnApply(); virtual void OnDestroy(); @@ -285,8 +279,6 @@ struct CIgnorePrefsDlg : public CProtoDlgBase < CIrcProto > CIgnorePrefsDlg(CIrcProto* _pro); - static CDlgBase* Create(void* param) { return new CIgnorePrefsDlg((CIrcProto*)param); } - virtual void OnInitDialog(); virtual void OnDestroy(); virtual void OnApply(); diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index f98fcc1455..21f13227e5 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -306,7 +306,7 @@ struct CServerDlg : public CProtoDlgBase CCtrlCombo m_groupCombo; CServerDlg(CIrcProto* _pro, CConnectPrefsDlg* _owner, int _action) - : CProtoDlgBase(_pro, IDD_ADDSERVER, _owner->GetHwnd(), false), + : CProtoDlgBase(_pro, IDD_ADDSERVER, false), m_owner(_owner), m_action(_action), m_OK(this, IDOK), @@ -316,6 +316,7 @@ struct CServerDlg : public CProtoDlgBase m_port(this, IDC_ADD_PORT), m_port2(this, IDC_ADD_PORT2) { + m_hwndParent = _owner->GetHwnd(); m_OK.OnClick = Callback(this, &CServerDlg::OnOk); m_autoClose = CLOSE_ON_CANCEL; } @@ -450,7 +451,7 @@ static TDbSetting ConnectSettings[] = }; CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto* _pro) - : CProtoDlgBase(_pro, IDD_PREFS_CONNECT, NULL, false), + : CProtoDlgBase(_pro, IDD_PREFS_CONNECT, false), m_serverCombo(this, IDC_SERVERCOMBO), m_server(this, IDC_SERVER), m_port(this, IDC_PORT), @@ -812,7 +813,7 @@ static TDbSetting CtcpSettings[] = }; CCtcpPrefsDlg::CCtcpPrefsDlg(CIrcProto* _pro) - : CProtoDlgBase(_pro, IDD_PREFS_CTCP, NULL, false), + : CProtoDlgBase(_pro, IDD_PREFS_CTCP, false), m_enableIP(this, IDC_ENABLEIP), m_fromServer(this, IDC_FROMSERVER), m_combo(this, IDC_COMBO), @@ -991,7 +992,7 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, } COtherPrefsDlg::COtherPrefsDlg(CIrcProto* _pro) - : CProtoDlgBase(_pro, IDD_PREFS_OTHER, NULL, false), + : CProtoDlgBase(_pro, IDD_PREFS_OTHER, false), m_url(this, IDC_CUSTOM), m_performCombo(this, IDC_PERFORMCOMBO), m_codepage(this, IDC_CODEPAGE), @@ -1208,10 +1209,12 @@ void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName) // 'add ignore' preferences dialog CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner) - : CProtoDlgBase(_pro, IDD_ADDIGNORE, _owner->GetHwnd(), false), + : CProtoDlgBase(_pro, IDD_ADDIGNORE, false), m_Ok(this, IDOK), m_owner(_owner) { + m_hwndParent = _owner->GetHwnd(); + if (mask == NULL) szOldMask[0] = 0; else @@ -1407,7 +1410,7 @@ void CIrcProto::RewriteIgnoreSettings(void) } CIgnorePrefsDlg::CIgnorePrefsDlg(CIrcProto* _pro) - : CProtoDlgBase(_pro, IDD_PREFS_IGNORE, NULL, false), + : CProtoDlgBase(_pro, IDD_PREFS_IGNORE, false), m_list(this, IDC_LIST), m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Add new ignore")), m_edit(this, IDC_EDIT, LoadIconEx(IDI_EDIT), LPGEN("Edit this ignore")), @@ -1654,38 +1657,26 @@ void CIgnorePrefsDlg::UpdateList() int CIrcProto::OnInitOptionsPages(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_CONNECT); + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); odp.ptszTitle = m_tszUserName; odp.ptszGroup = LPGENT("Network"); - odp.ptszTab = LPGENT("Account"); odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&OptCreateAccount; - OptCreateAccount.create = CConnectPrefsDlg::Create; - OptCreateAccount.param = this; + + odp.ptszTab = LPGENT("Account"); + odp.pDialog = new CConnectPrefsDlg(this); Options_AddPage(wParam, &odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_CTCP); odp.ptszTab = LPGENT("DCC and CTCP"); - odp.dwInitParam = (LPARAM)&OptCreateConn; - OptCreateConn.create = CCtcpPrefsDlg::Create; - OptCreateConn.param = this; + odp.pDialog = new CCtcpPrefsDlg(this); Options_AddPage(wParam, &odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_OTHER); odp.ptszTab = LPGENT("Advanced"); - odp.dwInitParam = (LPARAM)&OptCreateOther; - OptCreateOther.create = COtherPrefsDlg::Create; - OptCreateOther.param = this; + odp.pDialog = new COtherPrefsDlg(this); Options_AddPage(wParam, &odp); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_PREFS_IGNORE); odp.ptszTab = LPGENT("Ignore"); - odp.dwInitParam = (LPARAM)&OptCreateIgnore; - OptCreateIgnore.create = CIgnorePrefsDlg::Create; - OptCreateIgnore.param = this; + odp.pDialog = new CIgnorePrefsDlg(this); Options_AddPage(wParam, &odp); return 0; } @@ -1765,7 +1756,7 @@ struct CDlgAccMgrUI : public CProtoDlgBase CCtrlEdit m_server, m_port, m_port2, m_pass, m_nick, m_nick2, m_name, m_userID, m_ssl; CDlgAccMgrUI(CIrcProto* _pro, HWND _owner) - : CProtoDlgBase(_pro, IDD_ACCMGRUI, _owner, false), + : CProtoDlgBase(_pro, IDD_ACCMGRUI, false), m_serverCombo(this, IDC_SERVERCOMBO), m_server(this, IDC_SERVER), m_port(this, IDC_PORT), @@ -1777,6 +1768,7 @@ struct CDlgAccMgrUI : public CProtoDlgBase m_ssl(this, IDC_SSL), m_userID(this, IDC_USERID) { + m_hwndParent = _owner; m_serverCombo.OnChange = Callback(this, &CDlgAccMgrUI::OnChangeCombo); } diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index a35a571855..dc6e686b3e 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Message Box CMessageBoxDlg::CMessageBoxDlg(CIrcProto *_pro, DCCINFO *_dci) - : CProtoDlgBase(_pro, IDD_MESSAGEBOX, NULL, false), + : CProtoDlgBase(_pro, IDD_MESSAGEBOX, false), pdci(_dci), m_Ok(this, IDOK) { @@ -251,7 +251,7 @@ void CNickDlg::OnOk(CCtrlButton*) #define LIST_TIMER 10 CListDlg::CListDlg(CIrcProto *_pro) - : CProtoDlgBase(_pro, IDD_LIST, NULL, false), + : CProtoDlgBase(_pro, IDD_LIST, false), m_Join(this, IDC_JOIN), m_list(this, IDC_INFO_LISTVIEW), m_list2(this, IDC_INFO_LISTVIEW2), @@ -492,7 +492,7 @@ void CListDlg::UpdateList() // 'Join' dialog CJoinDlg::CJoinDlg(CIrcProto *_pro) - : CCoolIrcDlg(_pro, IDD_NICK, NULL), + : CCoolIrcDlg(_pro, IDD_NICK), m_Ok(this, IDOK) { m_Ok.OnClick = Callback(this, &CJoinDlg::OnOk); @@ -701,10 +701,12 @@ void CQuickDlg::OnServerCombo(CCtrlData*) // 'Question' dialog CQuestionDlg::CQuestionDlg(CIrcProto *_pro, CManagerDlg *owner) - : CCoolIrcDlg(_pro, IDD_QUESTION, (owner == NULL) ? NULL : owner->GetHwnd()), + : CCoolIrcDlg(_pro, IDD_QUESTION), m_Ok(this, IDOK), m_owner(owner) { + if (owner != NULL) + m_hwndParent = owner->GetHwnd(); m_Ok.OnClick = Callback(this, &CQuestionDlg::OnOk); } @@ -1369,8 +1371,8 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window) ///////////////////////////////////////////////////////////////////////////////////////// // 'cool' dialog -CCoolIrcDlg::CCoolIrcDlg(CIrcProto* _pro, int dlgId, HWND parent) - : CProtoDlgBase(_pro, dlgId, parent, false) +CCoolIrcDlg::CCoolIrcDlg(CIrcProto* _pro, int dlgId) + : CProtoDlgBase(_pro, dlgId, false) {} void CCoolIrcDlg::OnInitDialog() 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); } diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 4e7fb3103e..25443fb59e 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -1,13 +1,15 @@ #include "common.h" CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog, HWND hwndParent) - : CToxDlgBase(proto, idDialog, hwndParent, false), + : CToxDlgBase(proto, idDialog, false), m_toxAddress(this, IDC_TOXID), m_toxAddressCopy(this, IDC_CLIPBOARD), m_profileCreate(this, IDC_PROFILE_NEW), m_profileImport(this, IDC_PROFILE_IMPORT), m_profileExport(this, IDC_PROFILE_EXPORT), m_nickname(this, IDC_NAME), m_password(this, IDC_PASSWORD), m_group(this, IDC_GROUP), m_enableUdp(this, IDC_ENABLE_UDP), m_enableIPv6(this, IDC_ENABLE_IPV6) { + SetParent(hwndParent); + CreateLink(m_toxAddress, TOX_SETTINGS_ID, _T("")); CreateLink(m_nickname, "Nick", _T("")); CreateLink(m_password, "Password", _T("")); @@ -52,7 +54,7 @@ void CToxOptionsMain::OnInitDialog() void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*) { char *toxAddress = m_toxAddress.GetTextA(); - int toxAddressLength = mir_strlen(toxAddress) + 1; + size_t toxAddressLength = mir_strlen(toxAddress) + 1; if (OpenClipboard(m_toxAddress.GetHwnd())) { EmptyClipboard(); @@ -147,7 +149,7 @@ void CToxOptionsMain::OnApply() ///////////////////////////////////////////////////////////////////////////////// CToxNodeEditor::CToxNodeEditor(int iItem, CCtrlListView *m_nodes) - : CSuper(g_hInstance, IDD_NODE_EDITOR, NULL), + : CSuper(g_hInstance, IDD_NODE_EDITOR), m_ipv4(this, IDC_IPV4), m_ipv6(this, IDC_IPV6), m_port(this, IDC_PORT), m_pkey(this, IDC_PKEY), m_ok(this, IDOK), m_iItem(iItem) @@ -247,7 +249,7 @@ BOOL CCtrlNodeList::OnNotify(int idCtrl, NMHDR *pnmh) /****************************************/ CToxOptionsNodeList::CToxOptionsNodeList(CToxProto *proto) - : CSuper(proto, IDD_OPTIONS_NODES, NULL, false), + : CSuper(proto, IDD_OPTIONS_NODES, false), m_nodes(this, IDC_NODESLIST), m_addNode(this, IDC_ADDNODE) { m_addNode.OnClick = Callback(this, &CToxOptionsNodeList::OnAddNode); @@ -473,31 +475,18 @@ void CToxOptionsNodeList::OnApply() int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM) { - char *title = mir_t2a(m_tszUserName); - - OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = g_hInstance; - odp.pszTitle = title; - odp.flags = ODPF_BOLDGROUPS; - odp.pszGroup = LPGEN("Network"); - - odp.pszTab = LPGEN("Account"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&ToxMainOptions; - ToxMainOptions.create = CToxOptionsMain::CreateOptionsPage; - ToxMainOptions.param = this; + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.ptszTitle = m_tszUserName; + odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.ptszGroup = LPGENT("Network"); + + odp.ptszTab = LPGENT("Account"); + odp.pDialog = new CToxOptionsMain(this, IDD_OPTIONS_MAIN); Options_AddPage(wParam, &odp); - odp.pszTab = LPGEN("Nodes"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_NODES); - odp.pfnDlgProc = CDlgBase::DynamicDlgProc; - odp.dwInitParam = (LPARAM)&ToxNodeListOptions; - ToxNodeListOptions.create = CToxOptionsNodeList::CreateOptionsPage; - ToxNodeListOptions.param = this; + odp.ptszTab = LPGENT("Nodes"); + odp.pDialog = new CToxOptionsNodeList(this); Options_AddPage(wParam, &odp); - - mir_free(title); - return 0; -} \ No newline at end of file +} diff --git a/protocols/Tox/src/tox_options.h b/protocols/Tox/src/tox_options.h index 0b0e111513..afda3aee4e 100644 --- a/protocols/Tox/src/tox_options.h +++ b/protocols/Tox/src/tox_options.h @@ -38,8 +38,6 @@ public: page->Show(); return page; } - - static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsMain((CToxProto*)param, IDD_OPTIONS_MAIN); } }; ///////////////////////////////////////////////////////////////////////////////// @@ -94,9 +92,10 @@ private: CCtrlNodeList m_nodes; CCtrlButton m_addNode; -protected: +public: CToxOptionsNodeList(CToxProto *proto); +protected: void OnInitDialog(); void OnApply(); @@ -104,9 +103,6 @@ protected: void OnNodeListDoubleClick(CCtrlBase*); void OnNodeListClick(CCtrlListView::TEventInfo *evt); void OnNodeListKeyDown(CCtrlListView::TEventInfo *evt); - -public: - static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsNodeList((CToxProto*)param); } }; #endif //_TOX_OPTIONS_H_ \ No newline at end of file diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 8ca4bf84a4..2affb68422 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -142,7 +142,7 @@ INT_PTR CToxProto::OnCopyToxID(WPARAM, LPARAM) } CToxPasswordEditor::CToxPasswordEditor(CToxProto *proto) : - CToxDlgBase(proto, IDD_PASSWORD, NULL, false), ok(this, IDOK), + CToxDlgBase(proto, IDD_PASSWORD, false), ok(this, IDOK), password(this, IDC_PASSWORD), savePermanently(this, IDC_SAVEPERMANENTLY) { ok.OnClick = Callback(this, &CToxPasswordEditor::OnOk); diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index a329252fda..82bfe006f3 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -131,9 +131,6 @@ private: INT_PTR __cdecl CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam); // options - CToxDlgBase::CreateParam ToxMainOptions; - CToxDlgBase::CreateParam ToxNodeListOptions; - int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam); // events diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index f5d5b001b3..62671f7ac7 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -30,7 +30,7 @@ ToxHexAddress ResolveToxAddressFromDnsRecordV3(void *dns, uint32_t requestId, co { std::string id = match[1]; uint8_t data[TOX_ADDRESS_SIZE]; - if (tox_decrypt_dns3_TXT(dns, data, (uint8_t*)id.c_str(), id.length(), requestId) != TOX_ERROR) + if (tox_decrypt_dns3_TXT(dns, data, (uint8_t*)id.c_str(), (uint32_t)id.length(), requestId) != TOX_ERROR) { return ToxHexAddress(data, TOX_ADDRESS_SIZE); } @@ -69,7 +69,7 @@ void CToxProto::SearchByNameAsync(void *arg) uint32_t requestId = 0; uint8_t dnsString[MAX_PATH]; - int length = tox_generate_dns3_string(dns, dnsString, sizeof(dnsString), &requestId, (uint8_t*)name, mir_strlen(name)); + size_t length = tox_generate_dns3_string(dns, dnsString, sizeof(dnsString), &requestId, (uint8_t*)name, (uint8_t)mir_strlen(name)); if (length != TOX_ERROR) { dnsString[length] = 0; -- cgit v1.2.3