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 +++++++------ 4 files changed, 28 insertions(+), 44 deletions(-) (limited to 'protocols/IRCG/src') 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() -- cgit v1.2.3