From bde17379eeb7957f4dbbcb5c21ebdd8d14902b99 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 29 Mar 2015 13:25:48 +0000 Subject: - adaptation of IRC dialogs to the kernel UI Utils; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@12539 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/irc_dlg.h | 6 ++-- protocols/IRCG/src/options.cpp | 50 +++++++++++++-------------- protocols/IRCG/src/version.h | 2 +- protocols/IRCG/src/windows.cpp | 78 ++++++++++++++++++++---------------------- 4 files changed, 65 insertions(+), 71 deletions(-) (limited to 'protocols/IRCG') diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h index 9f18a90862..9414365e3b 100644 --- a/protocols/IRCG/src/irc_dlg.h +++ b/protocols/IRCG/src/irc_dlg.h @@ -24,14 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CMessageBoxDlg : public CProtoDlgBase < CIrcProto > { - DCCINFO* pdci; + DCCINFO *pdci; CMessageBoxDlg(CIrcProto* _pro, DCCINFO* _dci); - CCtrlButton m_Ok; + CCtrlButton m_Ok; void OnOk(CCtrlButton*); - - virtual void OnInitDialog(); }; struct CCoolIrcDlg : public CProtoDlgBase < CIrcProto > diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 4cce32ad83..f98fcc1455 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -305,8 +305,8 @@ struct CServerDlg : public CProtoDlgBase CCtrlEdit m_server, m_address, m_port, m_port2; CCtrlCombo m_groupCombo; - CServerDlg(CIrcProto* _pro, CConnectPrefsDlg* _owner, int _action) : - CProtoDlgBase(_pro, IDD_ADDSERVER, _owner->GetHwnd()), + CServerDlg(CIrcProto* _pro, CConnectPrefsDlg* _owner, int _action) + : CProtoDlgBase(_pro, IDD_ADDSERVER, _owner->GetHwnd(), false), m_owner(_owner), m_action(_action), m_OK(this, IDOK), @@ -449,8 +449,8 @@ static TDbSetting ConnectSettings[] = { FIELD_OFFSET(CIrcProto, m_autoOnlineNotification), "AutoOnlineNotification", DBVT_BYTE }, }; -CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto* _pro) : - CProtoDlgBase(_pro, IDD_PREFS_CONNECT, NULL), +CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto* _pro) + : CProtoDlgBase(_pro, IDD_PREFS_CONNECT, NULL, false), m_serverCombo(this, IDC_SERVERCOMBO), m_server(this, IDC_SERVER), m_port(this, IDC_PORT), @@ -811,8 +811,8 @@ static TDbSetting CtcpSettings[] = { FIELD_OFFSET(CIrcProto, m_sendNotice), "SendNotice", DBVT_BYTE, 0, 1 } }; -CCtcpPrefsDlg::CCtcpPrefsDlg(CIrcProto* _pro) : - CProtoDlgBase(_pro, IDD_PREFS_CTCP, NULL), +CCtcpPrefsDlg::CCtcpPrefsDlg(CIrcProto* _pro) + : CProtoDlgBase(_pro, IDD_PREFS_CTCP, NULL, false), m_enableIP(this, IDC_ENABLEIP), m_fromServer(this, IDC_FROMSERVER), m_combo(this, IDC_COMBO), @@ -990,8 +990,8 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwndDlg, EditSubclassProc, msg, wParam, lParam); } -COtherPrefsDlg::COtherPrefsDlg(CIrcProto* _pro) : - CProtoDlgBase(_pro, IDD_PREFS_OTHER, NULL), +COtherPrefsDlg::COtherPrefsDlg(CIrcProto* _pro) + : CProtoDlgBase(_pro, IDD_PREFS_OTHER, NULL, false), m_url(this, IDC_CUSTOM), m_performCombo(this, IDC_PERFORMCOMBO), m_codepage(this, IDC_CODEPAGE), @@ -1207,10 +1207,10 @@ 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()), -m_Ok(this, IDOK), -m_owner(_owner) +CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner) + : CProtoDlgBase(_pro, IDD_ADDIGNORE, _owner->GetHwnd(), false), + m_Ok(this, IDOK), + m_owner(_owner) { if (mask == NULL) szOldMask[0] = 0; @@ -1406,17 +1406,17 @@ void CIrcProto::RewriteIgnoreSettings(void) } } -CIgnorePrefsDlg::CIgnorePrefsDlg(CIrcProto* _pro) : -CProtoDlgBase(_pro, IDD_PREFS_IGNORE, NULL), -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")), -m_del(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Delete this ignore")), -m_enable(this, IDC_ENABLEIGNORE), -m_ignoreChat(this, IDC_IGNORECHAT), -m_ignoreFile(this, IDC_IGNOREFILE), -m_ignoreChannel(this, IDC_IGNORECHANNEL), -m_ignoreUnknown(this, IDC_IGNOREUNKNOWN) +CIgnorePrefsDlg::CIgnorePrefsDlg(CIrcProto* _pro) + : CProtoDlgBase(_pro, IDD_PREFS_IGNORE, NULL, 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")), + m_del(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Delete this ignore")), + m_enable(this, IDC_ENABLEIGNORE), + m_ignoreChat(this, IDC_IGNORECHAT), + m_ignoreFile(this, IDC_IGNOREFILE), + m_ignoreChannel(this, IDC_IGNORECHANNEL), + m_ignoreUnknown(this, IDC_IGNOREUNKNOWN) { m_enable.OnChange = Callback(this, &CIgnorePrefsDlg::OnEnableIgnore); m_ignoreChat.OnChange = Callback(this, &CIgnorePrefsDlg::OnIgnoreChat); @@ -1764,8 +1764,8 @@ struct CDlgAccMgrUI : public CProtoDlgBase CCtrlCombo m_serverCombo; 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), + CDlgAccMgrUI(CIrcProto* _pro, HWND _owner) + : CProtoDlgBase(_pro, IDD_ACCMGRUI, _owner, false), m_serverCombo(this, IDC_SERVERCOMBO), m_server(this, IDC_SERVER), m_port(this, IDC_PORT), diff --git a/protocols/IRCG/src/version.h b/protocols/IRCG/src/version.h index 9f7aa15098..5374fd8af1 100644 --- a/protocols/IRCG/src/version.h +++ b/protocols/IRCG/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 4c4ffb2a13..a35a571855 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -24,18 +24,14 @@ 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), +CMessageBoxDlg::CMessageBoxDlg(CIrcProto *_pro, DCCINFO *_dci) + : CProtoDlgBase(_pro, IDD_MESSAGEBOX, NULL, false), pdci(_dci), m_Ok(this, IDOK) { m_Ok.OnClick = Callback(this, &CMessageBoxDlg::OnOk); } -void CMessageBoxDlg::OnInitDialog() -{ -} - void CMessageBoxDlg::OnOk(CCtrlButton*) { CDccSession *dcc = new CDccSession(m_proto, pdci); @@ -51,8 +47,8 @@ void CMessageBoxDlg::OnOk(CCtrlButton*) ///////////////////////////////////////////////////////////////////////////////////////// // Whois dialog -CWhoisDlg::CWhoisDlg(CIrcProto* _pro) : - CCoolIrcDlg(_pro, IDD_INFO), +CWhoisDlg::CWhoisDlg(CIrcProto *_pro) + : CCoolIrcDlg(_pro, IDD_INFO), m_InfoNick(this, IDC_INFO_NICK), m_Reply(this, IDC_REPLY), m_Caption(this, IDC_CAPTION), @@ -182,7 +178,7 @@ void CWhoisDlg::ShowMessage(const CIrcMessage* pmsg) InvalidateRect(m_hwnd, NULL, TRUE); } -void CWhoisDlg::ShowMessageNoUser(const CIrcMessage* pmsg) +void CWhoisDlg::ShowMessageNoUser(const CIrcMessage *pmsg) { m_InfoNick.SetText(pmsg->parameters[2].c_str()); m_InfoNick.SendMsg(CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); @@ -201,8 +197,8 @@ void CWhoisDlg::ShowMessageNoUser(const CIrcMessage* pmsg) ///////////////////////////////////////////////////////////////////////////////////////// // 'Change nickname' dialog -CNickDlg::CNickDlg(CIrcProto *_pro) : - CCoolIrcDlg(_pro, IDD_NICK), +CNickDlg::CNickDlg(CIrcProto *_pro) + : CCoolIrcDlg(_pro, IDD_NICK), m_Ok(this, IDOK), m_Enick(this, IDC_ENICK) { @@ -217,8 +213,8 @@ void CNickDlg::OnInitDialog() DBVARIANT dbv; if (!m_proto->getTString("RecentNicks", &dbv)) { for (int i = 0; i < 10; i++) - if (!GetWord(dbv.ptszVal, i).IsEmpty()) - SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str()); + if (!GetWord(dbv.ptszVal, i).IsEmpty()) + SendDlgItemMessage(m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str()); db_free(&dbv); } @@ -254,8 +250,8 @@ void CNickDlg::OnOk(CCtrlButton*) #define LIST_TIMER 10 -CListDlg::CListDlg(CIrcProto *_pro) : - CProtoDlgBase(_pro, IDD_LIST, NULL), +CListDlg::CListDlg(CIrcProto *_pro) + : CProtoDlgBase(_pro, IDD_LIST, NULL, false), m_Join(this, IDC_JOIN), m_list(this, IDC_INFO_LISTVIEW), m_list2(this, IDC_INFO_LISTVIEW2), @@ -331,7 +327,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) // Match the text? TCHAR* t = _tcsstr(lvm.pszText, strFilterText); - if (t == NULL) { // If no, then Check if in the topics + if (t == NULL) { // If no, then Check if in the topics m_list.GetItem(&lvm); // Match the text? @@ -394,7 +390,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return CProtoDlgBase::DlgProc(msg, wParam, lParam); } -void CListDlg::OnChange(CCtrlBase* ctrl) +void CListDlg::OnChange(CCtrlBase *ctrl) { if (ctrl->GetCtrlId() == IDC_FILTER_STRING) m_timer = ::SetTimer(m_hwnd, LIST_TIMER, 200, NULL); @@ -411,7 +407,7 @@ void CListDlg::OnDestroy() struct ListViewSortParam { CCtrlListView* pList; - int iSubItem; + int iSubItem; }; static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) @@ -458,7 +454,7 @@ int CListDlg::Resizer(UTILRESIZECONTROL *urc) return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM; } -void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo* ev) +void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo *ev) { ListViewSortParam param = { &m_list, ev->nmlv->iSubItem }; m_list.SortItems(ListViewSort, (LPARAM)¶m); @@ -495,8 +491,8 @@ void CListDlg::UpdateList() ///////////////////////////////////////////////////////////////////////////////////////// // 'Join' dialog -CJoinDlg::CJoinDlg(CIrcProto *_pro) : - CCoolIrcDlg(_pro, IDD_NICK, NULL), +CJoinDlg::CJoinDlg(CIrcProto *_pro) + : CCoolIrcDlg(_pro, IDD_NICK, NULL), m_Ok(this, IDOK) { m_Ok.OnClick = Callback(this, &CJoinDlg::OnOk); @@ -553,8 +549,8 @@ void CJoinDlg::OnOk(CCtrlButton*) ///////////////////////////////////////////////////////////////////////////////////////// // 'Quick' dialog -CQuickDlg::CQuickDlg(CIrcProto *_pro) : - CCoolIrcDlg(_pro, IDD_QUICKCONN), +CQuickDlg::CQuickDlg(CIrcProto *_pro) + : CCoolIrcDlg(_pro, IDD_QUICKCONN), m_Ok(this, IDOK), m_serverCombo(this, IDC_SERVERCOMBO) { @@ -704,8 +700,8 @@ void CQuickDlg::OnServerCombo(CCtrlData*) ///////////////////////////////////////////////////////////////////////////////////////// // 'Question' dialog -CQuestionDlg::CQuestionDlg(CIrcProto *_pro, CManagerDlg* owner) : - CCoolIrcDlg(_pro, IDD_QUESTION, (owner == NULL) ? NULL : owner->GetHwnd()), +CQuestionDlg::CQuestionDlg(CIrcProto *_pro, CManagerDlg *owner) + : CCoolIrcDlg(_pro, IDD_QUESTION, (owner == NULL) ? NULL : owner->GetHwnd()), m_Ok(this, IDOK), m_owner(owner) { @@ -733,12 +729,12 @@ void CQuestionDlg::OnOk(CCtrlButton*) GetDlgItemText(m_hwnd, IDC_EDIT, l, i + 1); int j = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_HIDDENEDIT)); - TCHAR* m = new TCHAR[j + 2]; + TCHAR *m = new TCHAR[j + 2]; GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, m, j + 1); - TCHAR* text = _tcsstr(m, _T("%question")); - TCHAR* p1 = text; - TCHAR* p2 = NULL; + TCHAR *text = _tcsstr(m, _T("%question")); + TCHAR *p1 = text; + TCHAR *p2 = NULL; if (p1) { p1 += 9; if (*p1 == '=' && p1[1] == '\"') { @@ -758,11 +754,10 @@ void CQuestionDlg::OnOk(CCtrlButton*) else *p1 = '\0'; } - TCHAR* n = (TCHAR*)alloca(sizeof(TCHAR)*(j + 2)); - GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, n, j + 1); - CMString S(n); + CMString S(_T('\0'), j + 2); + GetDlgItemText(m_hwnd, IDC_HIDDENEDIT, S.GetBuffer(), j + 1); S.Replace(text, l); - m_proto->PostIrcMessageWnd(NULL, NULL, (TCHAR*)S.c_str()); + m_proto->PostIrcMessageWnd(NULL, NULL, S); delete[]m; delete[]l; @@ -781,8 +776,8 @@ void CQuestionDlg::Activate() ///////////////////////////////////////////////////////////////////////////////////////// // 'Channel Manager' dialog -CManagerDlg::CManagerDlg(CIrcProto *_pro) : - CCoolIrcDlg(_pro, IDD_CHANMANAGER), +CManagerDlg::CManagerDlg(CIrcProto *_pro) + : CCoolIrcDlg(_pro, IDD_CHANMANAGER), m_list(this, IDC_LIST), m_check1(this, IDC_CHECK1), @@ -1290,7 +1285,7 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window) for (int i = 0; i < 5; i++) { CMString S = GetWord(dbv.ptszVal, i); if (!S.IsEmpty()) { -/* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */ + /* FIXME: What the hell does it mean!? GCC won't compile this on UNICODE */ #if !defined(__GNUC__) || !defined(UNICODE) S.Replace(_T("%¤"), _T(" ")); #endif @@ -1361,7 +1356,9 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window) CheckDlgButton(m_hwnd, IDC_NOTOP, BST_CHECKED); } ShowWindow(m_hwnd, SW_SHOW); - } } } + } + } + } if (strchr(m_proto->sChannelModes.c_str(), 'b')) { m_radio1.SetState(true); @@ -1372,10 +1369,9 @@ void CManagerDlg::InitManager(int mode, const TCHAR* window) ///////////////////////////////////////////////////////////////////////////////////////// // 'cool' dialog -CCoolIrcDlg::CCoolIrcDlg( CIrcProto* _pro, int dlgId, HWND parent ) : - CProtoDlgBase( _pro, dlgId, parent ) -{ -} +CCoolIrcDlg::CCoolIrcDlg(CIrcProto* _pro, int dlgId, HWND parent) + : CProtoDlgBase(_pro, dlgId, parent, false) +{} void CCoolIrcDlg::OnInitDialog() { -- cgit v1.2.3