diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-14 14:57:22 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-12-14 14:57:22 +0000 |
commit | a6fa2268edcd1ec211ef101762232c97e9bb2833 (patch) | |
tree | 6676e4eeffda23a288552f1452deb510ed2c58fd /plugins/CSList | |
parent | ad9ea188764830dad666490867c07a9891b7e854 (diff) |
CSList: changed warning lavel to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11411 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CSList')
-rw-r--r-- | plugins/CSList/cslist_12.vcxproj | 8 | ||||
-rw-r--r-- | plugins/CSList/src/cslist.cpp | 466 | ||||
-rw-r--r-- | plugins/CSList/src/cslist.h | 126 |
3 files changed, 300 insertions, 300 deletions
diff --git a/plugins/CSList/cslist_12.vcxproj b/plugins/CSList/cslist_12.vcxproj index a72500689f..8847c600b0 100644 --- a/plugins/CSList/cslist_12.vcxproj +++ b/plugins/CSList/cslist_12.vcxproj @@ -82,7 +82,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>cslist.h</PrecompiledHeaderFile>
@@ -111,7 +111,7 @@ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>cslist.h</PrecompiledHeaderFile>
@@ -140,7 +140,7 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -169,7 +169,7 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>cslist.h</PrecompiledHeaderFile>
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index e65dcd6bfe..14a5ddc50d 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -1,28 +1,28 @@ /* ======================================================================== - Custom Status List - __________________ - - Custom Status List plugin for Miranda-IM (www.miranda-im.org) - Follower of Custom Status History List by HANAX - Copyright © 2006-2008 HANAX - Copyright © 2007-2009 jarvis - Occasionally rewritten in 2012 by George Hazan - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ======================================================================== */ + Custom Status List + __________________ + + Custom Status List plugin for Miranda-IM (www.miranda-im.org) + Follower of Custom Status History List by HANAX + Copyright © 2006-2008 HANAX + Copyright © 2007-2009 jarvis + Occasionally rewritten in 2012 by George Hazan + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ======================================================================== */ #include "cslist.h" #include "strpos.h" @@ -45,12 +45,12 @@ PLUGININFOEX pluginInfoEx = __AUTHORWEB, UNICODE_AWARE, // {C8CC7414-6507-4AF6-925A-83C1D2F7BE8C} - {0xc8cc7414, 0x6507, 0x4af6, {0x92, 0x5a, 0x83, 0xc1, 0xd2, 0xf7, 0xbe, 0x8c}} + { 0xc8cc7414, 0x6507, 0x4af6, { 0x92, 0x5a, 0x83, 0xc1, 0xd2, 0xf7, 0xbe, 0x8c } } }; // ====[ MAIN ]=============================================================== -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { g_hInst = hinstDLL; return TRUE; @@ -67,7 +67,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) static int OnDbChanged(WPARAM hContact, LPARAM lparam) { - DBCONTACTWRITESETTING *cws = ( DBCONTACTWRITESETTING* )lparam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lparam; // if user changes his UIN or JID on any account if (hContact == NULL) { @@ -78,7 +78,7 @@ static int OnDbChanged(WPARAM hContact, LPARAM lparam) return 0; } -static int OnInitOptions(WPARAM wparam, LPARAM lparam) +static int OnInitOptions(WPARAM wparam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 955000000; @@ -99,15 +99,15 @@ static int OnCreateMenuItems(WPARAM, LPARAM) ProtoEnumAccounts(&protoCount, &pdesc); for (int i = 0; i < protoCount; i++) - if ( ProtoServiceExists(pdesc[i]->szModuleName, PS_SETCUSTOMSTATUSEX)) + if (ProtoServiceExists(pdesc[i]->szModuleName, PS_SETCUSTOMSTATUSEX)) addProtoStatusMenuItem(pdesc[i]->szModuleName); return 0; } -static int OnPreshutdown(WPARAM wparam, LPARAM lparam) +static int OnPreshutdown(WPARAM, LPARAM) { - for (int i=0; i < arWindows.getCount(); i++) + for (int i = 0; i < arWindows.getCount(); i++) DestroyWindow(arWindows[i]->m_handle); return 0; } @@ -116,7 +116,7 @@ extern "C" __declspec(dllexport) int Load() { mir_getLP(&pluginInfoEx); mir_getCLI(); - + // support for ComboBoxEx INITCOMMONCONTROLSEX icc; icc.dwSize = sizeof(icc); @@ -125,7 +125,7 @@ extern "C" __declspec(dllexport) int Load() // init icons TCHAR tszFile[MAX_PATH]; - GetModuleFileName( g_hInst, tszFile, MAX_PATH ); + GetModuleFileName(g_hInst, tszFile, MAX_PATH); SKINICONDESC sid = { sizeof(sid) }; sid.ptszDefaultFile = tszFile; @@ -133,7 +133,7 @@ extern "C" __declspec(dllexport) int Load() sid.cx = sid.cy = 16; sid.ptszSection = _T(MODULENAME); - for (int i=0; i < SIZEOF(forms); i++) { + for (int i = 0; i < SIZEOF(forms); i++) { char szSettingName[64]; mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODNAME, forms[i].pszIconIcoLib); @@ -170,20 +170,20 @@ void RegisterHotkeys(char buf[200], TCHAR* accName, int Number) hotkey.ptszDescription = accName; hotkey.ptszSection = LPGENT("Custom Status List"); hotkey.pszService = buf; - hotkey.DefHotKey = HOTKEYCODE( HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0' + Number); + hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0' + Number); Hotkey_Register(&hotkey); } -void SetStatus(WORD code, StatusItem* item, char *szAccName) +void SetStatus(WORD code, StatusItem* item, char *szAccName) { - if ( code == IDCLOSE ) + if (code == IDCLOSE) return; PROTOACCOUNT* pdescr = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szAccName); if (pdescr == NULL) return; - if ( !ProtoServiceExists(szAccName, PS_SETCUSTOMSTATUSEX)) + if (!ProtoServiceExists(szAccName, PS_SETCUSTOMSTATUSEX)) return; int statusToSet; @@ -197,7 +197,7 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) ics.ptszMessage = _T(""); } else if (code == IDOK && item != NULL) { - statusToSet = item->m_iIcon+1; + statusToSet = item->m_iIcon + 1; ics.ptszName = variables_parsedup(item->m_tszTitle, NULL, NULL); ics.ptszMessage = variables_parsedup(item->m_tszMessage, NULL, NULL); } @@ -207,12 +207,12 @@ void SetStatus(WORD code, StatusItem* item, char *szAccName) ProtoCallService(szAccName, PS_SETCUSTOMSTATUSEX, 0, (LPARAM)&ics); } -INT_PTR showList(WPARAM wparam, LPARAM lparam, LPARAM param) +INT_PTR showList(WPARAM, LPARAM, LPARAM param) { char* szProto = (char*)param; - for (int i=0; i < arWindows.getCount(); i++) { + for (int i = 0; i < arWindows.getCount(); i++) { CSWindow *p = arWindows[i]; - if ( !strcmp(szProto, p->m_protoName)) { + if (!strcmp(szProto, p->m_protoName)) { ShowWindow(p->m_handle, SW_SHOW); SetForegroundWindow(p->m_handle); return 1; @@ -235,7 +235,7 @@ void addProtoStatusMenuItem(char *protoName) char buf[200]; mir_snprintf(buf, SIZEOF(buf), "CSList/ShowList/%s", protoName); - if ( !ServiceExists(buf)) + if (!ServiceExists(buf)) CreateServiceFunctionParam(buf, showList, (LPARAM)protoName); CLISTMENUITEM mi = { sizeof(mi) }; @@ -259,17 +259,17 @@ void importCustomStatuses(CSWindow* csw, int result) for (int i = 0; i < csw->m_statusCount; i++) { StatusItem* si = new StatusItem(); - si->m_iIcon = i-1; + si->m_iIcon = i - 1; mir_snprintf(bufTitle, SIZEOF(bufTitle), "XStatus%dName", i); - if ( !db_get_ts( NULL, protoName, bufTitle, &dbv )) { + if (!db_get_ts(NULL, protoName, bufTitle, &dbv)) { mir_tstrcpy(si->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else si->m_tszTitle[0] = 0; mir_snprintf(bufMessage, SIZEOF(bufMessage), "XStatus%dMsg", i); - if ( !db_get_ts( NULL, protoName, bufMessage, &dbv )) { + if (!db_get_ts(NULL, protoName, bufMessage, &dbv)) { mir_tstrcpy(si->m_tszMessage, dbv.ptszVal); db_free(&dbv); } @@ -296,7 +296,7 @@ CSWindow::CSWindow(char *protoName) { m_protoName = protoName; m_handle = NULL; - m_bExtraIcons = getByte( "AllowExtraIcons", DEFAULT_ALLOW_EXTRA_ICONS ); + m_bExtraIcons = getByte("AllowExtraIcons", DEFAULT_ALLOW_EXTRA_ICONS); m_itemslist = new CSItemsList(m_protoName); m_listview = NULL; m_addModifyDlg = NULL; @@ -316,7 +316,7 @@ void __fastcall SAFE_FREE(void** p) CSWindow::~CSWindow() { delete m_itemslist; - SAFE_FREE(( void** )&m_filterString ); + SAFE_FREE((void**)&m_filterString); } void CSWindow::initIcons() @@ -330,7 +330,7 @@ void CSWindow::initIcons() return; DBVARIANT dbv; - if ( db_get(NULL, pdescr->szModuleName, szUniqueID, &dbv)) + if (db_get(NULL, pdescr->szModuleName, szUniqueID, &dbv)) return; db_free(&dbv); @@ -338,14 +338,14 @@ void CSWindow::initIcons() CUSTOM_STATUS cs = { sizeof(cs) }; cs.flags = CSSF_STATUSES_COUNT; cs.wParam = &iNumStatuses; - if ( CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) + if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) return; m_statusCount = (int)iNumStatuses; if (NULL == (m_icons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, m_statusCount, 0))) return; - for (int i=1; i <= m_statusCount; i++) { + for (int i = 1; i <= m_statusCount; i++) { HICON hIcon = (HICON)CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSICON, i, 0); if (hIcon) { ImageList_AddIcon(m_icons, hIcon); @@ -356,18 +356,18 @@ void CSWindow::initIcons() void CSWindow::deinitIcons() { - ImageList_Destroy( m_icons ); + ImageList_Destroy(m_icons); } void CSWindow::initButtons() { for (int i = 0; i < SIZEOF(forms); i++) { - if ( forms[i].idc < 0 ) + if (forms[i].idc < 0) continue; - SendDlgItemMessage( m_handle, forms[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(forms[i].hIcoLibItem)); - SendDlgItemMessage( m_handle, forms[i].idc, BUTTONSETASFLATBTN, TRUE, 0 ); //maybe set as BUTTONSETDEFAULT? - SendDlgItemMessage( m_handle, forms[i].idc, BUTTONADDTOOLTIP, (WPARAM )TranslateTS(forms[i].ptszTitle), BATF_TCHAR ); + SendDlgItemMessage(m_handle, forms[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(forms[i].hIcoLibItem)); + SendDlgItemMessage(m_handle, forms[i].idc, BUTTONSETASFLATBTN, TRUE, 0); //maybe set as BUTTONSETDEFAULT? + SendDlgItemMessage(m_handle, forms[i].idc, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(forms[i].ptszTitle), BATF_TCHAR); } } @@ -379,25 +379,25 @@ void CSWindow::loadWindowPosition() void CSWindow::toggleEmptyListMessage() { - HWND hwnd = GetDlgItem( m_handle, IDC_NO_ITEMS ); - ShowWindow( hwnd, ( ListView_GetItemCount( m_listview->m_handle ) > 0 ) ? FALSE : TRUE ); - SetForegroundWindow( hwnd ); - hwnd = GetDlgItem( m_handle, IDC_ADD_SAMPLE ); - ShowWindow( hwnd, ( ListView_GetItemCount( m_listview->m_handle ) > 0 ) ? FALSE : TRUE ); - SetForegroundWindow( hwnd ); + HWND hwnd = GetDlgItem(m_handle, IDC_NO_ITEMS); + ShowWindow(hwnd, (ListView_GetItemCount(m_listview->m_handle) > 0) ? FALSE : TRUE); + SetForegroundWindow(hwnd); + hwnd = GetDlgItem(m_handle, IDC_ADD_SAMPLE); + ShowWindow(hwnd, (ListView_GetItemCount(m_listview->m_handle) > 0) ? FALSE : TRUE); + SetForegroundWindow(hwnd); } -BOOL CSWindow::itemPassedFilter( ListItem< StatusItem >* li ) +BOOL CSWindow::itemPassedFilter(ListItem< StatusItem >* li) { TCHAR filter[MAX_PATH]; - GetDlgItemText( m_handle, IDC_FILTER_FIELD, filter, SIZEOF(filter) ); + GetDlgItemText(m_handle, IDC_FILTER_FIELD, filter, SIZEOF(filter)); - if ( mir_tstrlen( filter )) + if (mir_tstrlen(filter)) { TCHAR title[EXTRASTATUS_TITLE_LIMIT], message[EXTRASTATUS_MESSAGE_LIMIT]; - mir_tstrcpy( title, li->m_item->m_tszTitle ); mir_tstrcpy( message, li->m_item->m_tszMessage ); - if ( strpos( _tcslwr( title ), _tcslwr( filter )) == -1 ) - if ( strpos( _tcslwr( message ), _tcslwr( filter )) == -1 ) + mir_tstrcpy(title, li->m_item->m_tszTitle); mir_tstrcpy(message, li->m_item->m_tszMessage); + if (strpos(_tcslwr(title), _tcslwr(filter)) == -1) + if (strpos(_tcslwr(message), _tcslwr(filter)) == -1) return FALSE; } @@ -406,37 +406,37 @@ BOOL CSWindow::itemPassedFilter( ListItem< StatusItem >* li ) void CSWindow::toggleFilter() { - HWND hFilter = GetDlgItem( m_handle, IDC_FILTER_FIELD ); - BOOL isEnabled = !IsWindowEnabled( hFilter ) ? TRUE : FALSE; // ! = + isEnabled = !isEnabled in one - EnableWindow( hFilter, isEnabled ); - ShowWindow( hFilter, isEnabled ); + HWND hFilter = GetDlgItem(m_handle, IDC_FILTER_FIELD); + BOOL isEnabled = !IsWindowEnabled(hFilter) ? TRUE : FALSE; // ! = + isEnabled = !isEnabled in one + EnableWindow(hFilter, isEnabled); + ShowWindow(hFilter, isEnabled); CheckDlgButton(m_handle, IDC_FILTER, isEnabled ? BST_CHECKED : BST_UNCHECKED); - SetForegroundWindow( hFilter ); - if ( isEnabled ) - SetFocus( hFilter ); + SetForegroundWindow(hFilter); + if (isEnabled) + SetFocus(hFilter); else { TCHAR filterText[255]; GetDlgItemText(m_handle, IDC_FILTER_FIELD, filterText, SIZEOF(filterText)); if (filterText[0] != 0) - SetDlgItemText( m_handle, IDC_FILTER_FIELD, TEXT( "")); + SetDlgItemText(m_handle, IDC_FILTER_FIELD, TEXT("")); } } BOOL CSWindow::toggleButtons() { - int selection = ListView_GetSelectedItemMacro( m_listview->m_handle ); - BOOL validSelection = ( selection >= 0 && ( unsigned int )selection < m_itemslist->m_list->getCount()) ? TRUE : FALSE; - BOOL filterEnabled = IsWindowVisible( GetDlgItem( m_handle, IDC_FILTER_FIELD )); + int selection = ListView_GetSelectedItemMacro(m_listview->m_handle); + BOOL validSelection = (selection >= 0 && (unsigned int)selection < m_itemslist->m_list->getCount()) ? TRUE : FALSE; + BOOL filterEnabled = IsWindowVisible(GetDlgItem(m_handle, IDC_FILTER_FIELD)); BOOL somethingChanged = m_bSomethingChanged; - EnableWindow( GetDlgItem( m_handle, IDC_ADD ), !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDC_MODIFY ), validSelection && !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDC_REMOVE ), validSelection && !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDC_FAVOURITE ), validSelection && !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDC_UNDO ), somethingChanged && !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDC_IMPORT ), !filterEnabled ); - EnableWindow( GetDlgItem( m_handle, IDOK ), validSelection ); + EnableWindow(GetDlgItem(m_handle, IDC_ADD), !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDC_MODIFY), validSelection && !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDC_REMOVE), validSelection && !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDC_FAVOURITE), validSelection && !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDC_UNDO), somethingChanged && !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDC_IMPORT), !filterEnabled); + EnableWindow(GetDlgItem(m_handle, IDOK), validSelection); return validSelection; } @@ -444,28 +444,28 @@ BOOL CSWindow::toggleButtons() /////////////////////////////////////////////////////////////////////////////// // CSAMWindow class - add form window -CSAMWindow::CSAMWindow( WORD action, CSWindow* parent ) +CSAMWindow::CSAMWindow(WORD action, CSWindow* parent) { m_action = action; m_parent = parent; m_bChanged = FALSE; m_hCombo = m_hMessage = NULL; - if ( m_action == IDC_ADD ) + if (m_action == IDC_ADD) m_item = new StatusItem(); else - m_item = new StatusItem( *m_parent->m_itemslist->m_list->get( m_parent->m_listview->getPositionInList()) ); + m_item = new StatusItem(*m_parent->m_itemslist->m_list->get(m_parent->m_listview->getPositionInList())); } CSAMWindow::~CSAMWindow() { - if ( !m_bChanged ) + if (!m_bChanged) delete m_item; } void CSAMWindow::exec() { - DialogBoxParam( g_hInst, MAKEINTRESOURCE( IDD_ADDMODIFY ), NULL, CSAMWindowProc, (LPARAM)this ); + DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ADDMODIFY), NULL, CSAMWindowProc, (LPARAM)this); } @@ -480,7 +480,7 @@ void CSAMWindow::setCombo() return; DBVARIANT dbv; - if ( db_get(NULL, pdescr->szModuleName, szUniqueID, &dbv)) + if (db_get(NULL, pdescr->szModuleName, szUniqueID, &dbv)) return; db_free(&dbv); @@ -491,20 +491,20 @@ void CSAMWindow::setCombo() cs.ptszName = tszName; cs.wParam = &iStatus; - SendMessage( m_hCombo, CBEM_SETIMAGELIST, 0, (LPARAM)m_parent->m_icons); - for (int i=1; i <= m_parent->m_statusCount; i++) { + SendMessage(m_hCombo, CBEM_SETIMAGELIST, 0, (LPARAM)m_parent->m_icons); + for (int i = 1; i <= m_parent->m_statusCount; i++) { iStatus = i; - if ( CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) + if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) != 0) continue; COMBOBOXEXITEM cbi = { 0 }; cbi.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE; cbi.iItem = -1; - cbi.iImage = cbi.iSelectedImage = i-1; + cbi.iImage = cbi.iSelectedImage = i - 1; cbi.pszText = TranslateTS(tszName); - SendMessage( m_hCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbi ); + SendMessage(m_hCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbi); } - SendMessage( m_hCombo, CB_SETCURSEL, 0, 0 ); // first 0 sets selection to top + SendMessage(m_hCombo, CB_SETCURSEL, 0, 0); // first 0 sets selection to top } void CSAMWindow::fillDialog() @@ -522,18 +522,18 @@ void CSAMWindow::fillDialog() SetDlgItemText(m_handle, IDC_MESSAGE, m_item->m_tszMessage); } -void CSAMWindow::checkFieldLimit( WORD action, WORD item ) +void CSAMWindow::checkFieldLimit(WORD action, WORD item) { - BOOL type = ( item == IDC_MESSAGE ) ? TRUE : FALSE; + BOOL type = (item == IDC_MESSAGE) ? TRUE : FALSE; unsigned int limit = type ? EXTRASTATUS_MESSAGE_LIMIT : EXTRASTATUS_TITLE_LIMIT; - if ( action == EN_CHANGE ) + if (action == EN_CHANGE) { TCHAR* ptszInputText = (TCHAR*)mir_alloc((limit + 8) * sizeof(TCHAR)); - GetDlgItemText( m_handle, item, ptszInputText, limit + 8 ); + GetDlgItemText(m_handle, item, ptszInputText, limit + 8); - if ( _tcslen( ptszInputText ) > limit ) + if (_tcslen(ptszInputText) > limit) { #if ( WINVER >= 0x501 ) TCHAR tszPopupTip[MAX_PATH]; @@ -546,11 +546,11 @@ void CSAMWindow::checkFieldLimit( WORD action, WORD item ) SendDlgItemMessage(m_handle, item, EM_SHOWBALLOONTIP, 0, (LPARAM)&ebt); #endif TCHAR* ptszOutputText = (TCHAR*)mir_alloc((limit + 1) * sizeof(TCHAR)); - GetDlgItemText( m_handle, item, ptszOutputText, limit + 1 ); - SetDlgItemText( m_handle, item, ptszOutputText ); - mir_free( ptszOutputText ); + GetDlgItemText(m_handle, item, ptszOutputText, limit + 1); + SetDlgItemText(m_handle, item, ptszOutputText); + mir_free(ptszOutputText); } - mir_free( ptszInputText ); + mir_free(ptszInputText); } } @@ -559,31 +559,31 @@ void CSAMWindow::checkItemValidity() COMBOBOXEXITEM cbi = { 0 }; cbi.mask = CBEIF_IMAGE; cbi.iItem = SendDlgItemMessage(m_handle, IDC_COMBO, CB_GETCURSEL, 0, 0); - SendDlgItemMessage( m_handle, IDC_COMBO, CBEM_GETITEM, 0, (LPARAM)&cbi ); + SendDlgItemMessage(m_handle, IDC_COMBO, CBEM_GETITEM, 0, (LPARAM)&cbi); if (m_item->m_iIcon != cbi.iImage) m_item->m_iIcon = cbi.iImage, m_bChanged = TRUE; TCHAR tszInputMessage[EXTRASTATUS_MESSAGE_LIMIT]; - GetDlgItemText( m_handle, IDC_MESSAGE, tszInputMessage, SIZEOF(tszInputMessage) ); + GetDlgItemText(m_handle, IDC_MESSAGE, tszInputMessage, SIZEOF(tszInputMessage)); PROTOACCOUNT* pdescr = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_parent->m_protoName); if (pdescr == NULL) return; - WPARAM i = SendMessage(m_hCombo, CB_GETCURSEL, 0, 0)+1; + WPARAM i = SendMessage(m_hCombo, CB_GETCURSEL, 0, 0) + 1; TCHAR tszTitle[100]; CUSTOM_STATUS cs = { sizeof(cs) }; cs.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR; cs.ptszName = tszTitle; cs.wParam = &i; - if ( CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) + if (CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) mir_tstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), SIZEOF(m_item->m_tszTitle)); - if ( mir_tstrcmp(m_item->m_tszMessage, tszInputMessage)) - mir_tstrcpy( m_item->m_tszMessage, tszInputMessage), m_bChanged = true; + if (mir_tstrcmp(m_item->m_tszMessage, tszInputMessage)) + mir_tstrcpy(m_item->m_tszMessage, tszInputMessage), m_bChanged = true; } CSListView::CSListView(HWND hwnd, CSWindow* parent) @@ -598,68 +598,68 @@ CSListView::CSListView(HWND hwnd, CSWindow* parent) lg.pszHeader = TranslateT("Favorites"); lg.iGroupId = 0; - ListView_InsertGroup( m_handle, -1, &lg ); + ListView_InsertGroup(m_handle, -1, &lg); lg.pszHeader = TranslateT("Regular statuses"); lg.iGroupId = 1; - ListView_InsertGroup( m_handle, -1, &lg ); - ListView_EnableGroupView( m_handle, TRUE ); + ListView_InsertGroup(m_handle, -1, &lg); + ListView_EnableGroupView(m_handle, TRUE); #endif LVCOLUMN lvc = { 0 }; lvc.mask = LVCF_TEXT | LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.cx = 0x00; - lvc.pszText = TEXT( ""); + lvc.pszText = TEXT(""); lvc.cx = 0x16; - SendMessage( m_handle, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc ); + SendMessage(m_handle, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc); lvc.pszText = TranslateT("Title"); lvc.cx = 0x64; - SendMessage( m_handle, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc ); + SendMessage(m_handle, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc); lvc.pszText = TranslateT("Message"); lvc.cx = 0xa8; - SendMessage( m_handle, LVM_INSERTCOLUMN, 2, (LPARAM)&lvc ); + SendMessage(m_handle, LVM_INSERTCOLUMN, 2, (LPARAM)&lvc); #if (_WIN32_IE >= 0x0400) - ListView_SetExtendedListViewStyleEx( m_handle, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_INFOTIP ); + ListView_SetExtendedListViewStyleEx(m_handle, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_INFOTIP); #endif ListView_SetImageList(m_handle, m_parent->m_icons, LVSIL_SMALL); } -void CSListView::addItem( StatusItem* item, int itemNumber ) +void CSListView::addItem(StatusItem* item, int itemNumber) { LVITEM lvi = { 0 }; lvi.mask = LVIF_IMAGE | LVIF_GROUPID | LVIF_PARAM; - lvi.iItem = ListView_GetItemCount( m_handle ); + lvi.iItem = ListView_GetItemCount(m_handle); lvi.lParam = itemNumber; lvi.iGroupId = item->m_bFavourite ? 0 : 1; // first column lvi.iSubItem = 0; lvi.iImage = item->m_iIcon; // use selected xicon - SendMessage( m_handle, LVM_INSERTITEM, 0, (LPARAM)&lvi ); + SendMessage(m_handle, LVM_INSERTITEM, 0, (LPARAM)&lvi); // second column lvi.mask = LVIF_TEXT; lvi.iSubItem = 1; lvi.pszText = item->m_tszTitle; - SendMessage( m_handle, LVM_SETITEM, 0, (LPARAM)&lvi ); + SendMessage(m_handle, LVM_SETITEM, 0, (LPARAM)&lvi); // third column lvi.iSubItem = 2; lvi.pszText = item->m_tszMessage; - SendMessage( m_handle, LVM_SETITEM, 0, (LPARAM)&lvi ); + SendMessage(m_handle, LVM_SETITEM, 0, (LPARAM)&lvi); } -void CSListView::initItems( ListItem< StatusItem >* items ) +void CSListView::initItems(ListItem< StatusItem >* items) { ListItem< StatusItem >* help = items; - for ( int i = 0; help != NULL; help = help->m_next, i++ ) - if (m_parent->itemPassedFilter( help )) - addItem( help->m_item, i ); + for (int i = 0; help != NULL; help = help->m_next, i++) + if (m_parent->itemPassedFilter(help)) + addItem(help->m_item, i); } -void CSListView::reinitItems( ListItem< StatusItem >* items ) +void CSListView::reinitItems(ListItem< StatusItem >* items) { EnableWindow(m_handle, FALSE); removeItems(); @@ -669,7 +669,7 @@ void CSListView::reinitItems( ListItem< StatusItem >* items ) void CSListView::removeItems() { - ListView_DeleteAllItems( m_handle ); + ListView_DeleteAllItems(m_handle); } int CSListView::getPositionInList() @@ -682,13 +682,13 @@ int CSListView::getPositionInList() return lvi.lParam; } -void CSListView::setFullFocusedSelection( int selection ) +void CSListView::setFullFocusedSelection(int selection) { - ListView_SetItemState( m_handle, -1, 0, LVIS_SELECTED ); - ListView_EnsureVisible( m_handle, selection, FALSE ); - ListView_SetItemState( m_handle, selection, LVIS_SELECTED, LVIS_SELECTED ); - ListView_SetItemState( m_handle, selection, LVIS_FOCUSED , LVIS_FOCUSED ); - SetFocus( m_handle ); + ListView_SetItemState(m_handle, -1, 0, LVIS_SELECTED); + ListView_EnsureVisible(m_handle, selection, FALSE); + ListView_SetItemState(m_handle, selection, LVIS_SELECTED, LVIS_SELECTED); + ListView_SetItemState(m_handle, selection, LVIS_FOCUSED, LVIS_FOCUSED); + SetFocus(m_handle); } // ====[ LIST MANAGEMENT ]==================================================== @@ -704,19 +704,19 @@ CSItemsList::~CSItemsList() delete m_list; } -int CSItemsList::compareItems( const StatusItem* p1, const StatusItem* p2 ) +int CSItemsList::compareItems(const StatusItem* p1, const StatusItem* p2) { int favRes = 0, icoRes = 0, ttlRes = 0, msgRes = 0; - if ( p1->m_bFavourite < p2->m_bFavourite ) - favRes = 1; - else if ( p1->m_bFavourite > p2->m_bFavourite ) - favRes = -1; + if (p1->m_bFavourite < p2->m_bFavourite) + favRes = 1; + else if (p1->m_bFavourite > p2->m_bFavourite) + favRes = -1; int result; - if ( p1->m_iIcon > p2->m_iIcon ) + if (p1->m_iIcon > p2->m_iIcon) icoRes = 1; - else if ( p1->m_iIcon < p2->m_iIcon ) + else if (p1->m_iIcon < p2->m_iIcon) icoRes = -1; result = mir_tstrcmp(p1->m_tszTitle, p2->m_tszTitle); @@ -725,7 +725,7 @@ int CSItemsList::compareItems( const StatusItem* p1, const StatusItem* p2 ) result = mir_tstrcmp(p1->m_tszMessage, p2->m_tszMessage); msgRes = result; - if ( !icoRes && !ttlRes && !msgRes) + if (!icoRes && !ttlRes && !msgRes) return 0; if (favRes != 0) @@ -753,14 +753,14 @@ void CSItemsList::loadItems(char *protoName) item->m_iIcon = getByte(dbSetting, DEFAULT_ITEM_ICON); mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i); - if ( !getTString(dbSetting, &dbv)) { + if (!getTString(dbSetting, &dbv)) { mir_tstrcpy(item->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else item->m_tszTitle[0] = 0; mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dMessage", protoName, i); - if ( !getTString(dbSetting, &dbv)) { + if (!getTString(dbSetting, &dbv)) { mir_tstrcpy(item->m_tszMessage, dbv.ptszVal); db_free(&dbv); } @@ -768,7 +768,7 @@ void CSItemsList::loadItems(char *protoName) mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dFavourite", protoName, i); item->m_bFavourite = (BOOL)getByte(dbSetting, DEFAULT_ITEM_IS_FAVOURITE); - + m_list->add(item); } } @@ -783,7 +783,7 @@ void CSItemsList::saveItems(char *protoName) for (i = 1; i <= m_list->getCount(); i++) { - StatusItem* item = m_list->get( i - 1 ); + StatusItem* item = m_list->get(i - 1); mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dIcon", protoName, i); setByte(dbSetting, item->m_iIcon); mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i); @@ -797,7 +797,7 @@ void CSItemsList::saveItems(char *protoName) mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_ItemsCount", protoName); setWord(dbSetting, m_list->getCount()); - for ( ; i <= oldItemsCount; i++) + for (; i <= oldItemsCount; i++) { mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dIcon", protoName, i); deleteSetting(dbSetting); @@ -813,11 +813,11 @@ void CSItemsList::saveItems(char *protoName) // ====[ PROCEDURES ]========================================================= -INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) +INT_PTR CALLBACK CSWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - CSWindow* csw = ( CSWindow* )GetWindowLongPtr( hwnd, GWLP_USERDATA ); + CSWindow* csw = (CSWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - switch ( message ) { + switch (message) { case WM_INITDIALOG: TranslateDialogDefault(hwnd); @@ -828,7 +828,7 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp csw->m_handle = hwnd; csw->initIcons(); csw->initButtons(); - csw->m_listview = new CSListView( GetDlgItem( hwnd, IDC_CSLIST ), csw); + csw->m_listview = new CSListView(GetDlgItem(hwnd, IDC_CSLIST), csw); csw->m_listview->initItems(csw->m_itemslist->m_list->getListHead()); csw->toggleButtons(); csw->toggleEmptyListMessage(); @@ -837,19 +837,19 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return TRUE; case WM_COMMAND: - switch ( LOWORD( wparam )) { + switch (LOWORD(wparam)) { case IDC_MODIFY: case IDC_ADD: - csw->m_addModifyDlg = new CSAMWindow( LOWORD( wparam ), csw ); + csw->m_addModifyDlg = new CSAMWindow(LOWORD(wparam), csw); csw->m_addModifyDlg->exec(); - if ( csw->m_addModifyDlg->m_bChanged ) { - if ( LOWORD( wparam ) == IDC_MODIFY ) - csw->m_itemslist->m_list->remove( csw->m_listview->getPositionInList()); + if (csw->m_addModifyDlg->m_bChanged) { + if (LOWORD(wparam) == IDC_MODIFY) + csw->m_itemslist->m_list->remove(csw->m_listview->getPositionInList()); - int selection = csw->m_itemslist->m_list->add( csw->m_addModifyDlg->m_item ); + int selection = csw->m_itemslist->m_list->add(csw->m_addModifyDlg->m_item); csw->m_bSomethingChanged = TRUE; - csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); - csw->m_listview->setFullFocusedSelection( selection ); + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); + csw->m_listview->setFullFocusedSelection(selection); csw->toggleButtons(); csw->toggleEmptyListMessage(); } @@ -857,59 +857,59 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case IDC_REMOVE: - if ( getByte( "ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION )) - if ( MessageBox( hwnd, TranslateT("Do you really want to delete selected item?"), TranslateT(MODULENAME), MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION ) == IDNO ) + if (getByte("ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION)) + if (MessageBox(hwnd, TranslateT("Do you really want to delete selected item?"), TranslateT(MODULENAME), MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION) == IDNO) break; - csw->m_itemslist->m_list->remove( csw->m_listview->getPositionInList()); + csw->m_itemslist->m_list->remove(csw->m_listview->getPositionInList()); csw->m_bSomethingChanged = TRUE; - csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); csw->toggleButtons(); csw->toggleEmptyListMessage(); break; case IDC_FAVOURITE: - { - int selection = csw->m_listview->getPositionInList(); - StatusItem* f = new StatusItem( *csw->m_itemslist->m_list->get( selection )); - f->m_bFavourite = ! f->m_bFavourite; - csw->m_itemslist->m_list->remove( selection ); - selection = csw->m_itemslist->m_list->add( f ); - csw->m_bSomethingChanged = TRUE; - csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); - csw->m_listview->setFullFocusedSelection( selection ); - csw->toggleButtons(); - } - break; + { + int selection = csw->m_listview->getPositionInList(); + StatusItem* f = new StatusItem(*csw->m_itemslist->m_list->get(selection)); + f->m_bFavourite = !f->m_bFavourite; + csw->m_itemslist->m_list->remove(selection); + selection = csw->m_itemslist->m_list->add(f); + csw->m_bSomethingChanged = TRUE; + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); + csw->m_listview->setFullFocusedSelection(selection); + csw->toggleButtons(); + } + break; case IDC_UNDO: csw->m_itemslist->m_list->destroy(); csw->m_itemslist->loadItems(csw->m_protoName); csw->m_bSomethingChanged = FALSE; - csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); csw->toggleButtons(); csw->toggleEmptyListMessage(); break; case IDC_IMPORT: - { - int result = getByte( "DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT ); - if (result == TRUE) - result = IDYES; - else { - result = MessageBox( hwnd, - TranslateT("Do you want old database entries to be deleted after Import?"), - TranslateT(MODULENAME), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONQUESTION ); - if ( result == IDCANCEL ) - break; - } - - importCustomStatuses(csw, result); - csw->m_bSomethingChanged = TRUE; - csw->toggleButtons(); - csw->toggleEmptyListMessage(); + { + int result = getByte("DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT); + if (result == TRUE) + result = IDYES; + else { + result = MessageBox(hwnd, + TranslateT("Do you want old database entries to be deleted after Import?"), + TranslateT(MODULENAME), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONQUESTION); + if (result == IDCANCEL) + break; } - break; + + importCustomStatuses(csw, result); + csw->m_bSomethingChanged = TRUE; + csw->toggleButtons(); + csw->toggleEmptyListMessage(); + } + break; case IDC_FILTER: csw->toggleFilter(); @@ -917,19 +917,19 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case IDC_FILTER_FIELD: - if ( HIWORD( wparam ) == EN_CHANGE ) - csw->m_listview->reinitItems( csw->m_itemslist->m_list->getListHead()); + if (HIWORD(wparam) == EN_CHANGE) + csw->m_listview->reinitItems(csw->m_itemslist->m_list->getListHead()); break; case IDCLOSE: // close and save, no custom status case IDCANCEL: // close and save, no custom status case IDC_CANCEL: // close and save, cancel custom status case IDOK: // close and save, set selected custom status - if ( LOWORD( wparam ) == IDOK && csw->toggleButtons()) + if (LOWORD(wparam) == IDOK && csw->toggleButtons()) SetStatus(IDOK, csw->m_itemslist->m_list->get(csw->m_listview->getPositionInList()), csw->m_protoName); - if ( LOWORD( wparam ) == IDC_CANCEL ) + if (LOWORD(wparam) == IDC_CANCEL) SetStatus(IDC_CANCEL, NULL, csw->m_protoName); - if ( csw->m_bSomethingChanged ) + if (csw->m_bSomethingChanged) csw->m_itemslist->saveItems(csw->m_protoName); csw->saveWindowPosition(csw->m_handle); EndDialog(hwnd, FALSE); @@ -938,11 +938,11 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return FALSE; case WM_NOTIFY: - if ( wparam == IDC_CSLIST ) { - NMHDR* pnmh = ( NMHDR* )lparam; - switch ( pnmh->code ) { + if (wparam == IDC_CSLIST) { + NMHDR* pnmh = (NMHDR*)lparam; + switch (pnmh->code) { case NM_DBLCLK: - PostMessage( hwnd, WM_COMMAND, IDOK, 0L ); + PostMessage(hwnd, WM_COMMAND, IDOK, 0L); break; case LVN_ITEMCHANGED: @@ -954,9 +954,9 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return FALSE; case WM_CTLCOLORSTATIC: - SetTextColor(( HDC )wparam, RGB( 174, 174, 174 )); + SetTextColor((HDC)wparam, RGB(174, 174, 174)); if (((HWND)lparam == GetDlgItem(hwnd, IDC_NO_ITEMS)) || ((HWND)lparam == GetDlgItem(hwnd, IDC_ADD_SAMPLE))) - return ( BOOL )GetStockObject( WHITE_BRUSH ); + return (BOOL)GetStockObject(WHITE_BRUSH); return FALSE; case WM_DESTROY: @@ -970,27 +970,27 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return FALSE; } -INT_PTR CALLBACK CSAMWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) +INT_PTR CALLBACK CSAMWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - CSAMWindow* csamw = ( CSAMWindow* )GetWindowLongPtr( hwnd, GWLP_USERDATA ); + CSAMWindow* csamw = (CSAMWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - switch ( message ) { + switch (message) { case WM_INITDIALOG: - csamw = ( CSAMWindow* )lparam; - SetWindowLongPtr( hwnd, GWLP_USERDATA, lparam ); + csamw = (CSAMWindow*)lparam; + SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); csamw->m_handle = hwnd; - EnableWindow( csamw->m_parent->m_handle, FALSE ); - csamw->m_hCombo = GetDlgItem( hwnd, IDC_COMBO ); - csamw->m_hMessage = GetDlgItem( hwnd, IDC_MESSAGE ); + EnableWindow(csamw->m_parent->m_handle, FALSE); + csamw->m_hCombo = GetDlgItem(hwnd, IDC_COMBO); + csamw->m_hMessage = GetDlgItem(hwnd, IDC_MESSAGE); csamw->setCombo(); csamw->fillDialog(); TranslateDialogDefault(hwnd); break; case WM_COMMAND: - switch ( LOWORD( wparam )) { + switch (LOWORD(wparam)) { case IDC_MESSAGE: - csamw->checkFieldLimit( HIWORD( wparam ), LOWORD( wparam )); + csamw->checkFieldLimit(HIWORD(wparam), LOWORD(wparam)); break; case IDOK: @@ -1007,30 +1007,30 @@ INT_PTR CALLBACK CSAMWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM } -INT_PTR CALLBACK CSOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) +INT_PTR CALLBACK CSOptionsProc(HWND hwnd, UINT message, WPARAM, LPARAM lparam) { - switch ( message ) { - case WM_INITDIALOG: + switch (message) { + case WM_INITDIALOG: TranslateDialogDefault(hwnd); - CheckDlgButton( hwnd, IDC_CONFIRM_DELETION, - getByte( "ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION ) ? - BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwnd, IDC_CONFIRM_DELETION, + getByte("ConfirmDeletion", DEFAULT_PLUGIN_CONFIRM_ITEMS_DELETION) ? + BST_CHECKED : BST_UNCHECKED); - CheckDlgButton( hwnd, IDC_DELETE_AFTER_IMPORT, - getByte( "DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT ) ? - BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwnd, IDC_DELETE_AFTER_IMPORT, + getByte("DeleteAfterImport", DEFAULT_PLUGIN_DELETE_AFTER_IMPORT) ? + BST_CHECKED : BST_UNCHECKED); - CheckDlgButton( hwnd, IDC_REMEMBER_POSITION, - getByte( "RememberWindowPosition", DEFAULT_REMEMBER_WINDOW_POSITION ) ? - BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwnd, IDC_REMEMBER_POSITION, + getByte("RememberWindowPosition", DEFAULT_REMEMBER_WINDOW_POSITION) ? + BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_NOTIFY: - switch ((( LPNMHDR )lparam )->code ) { + switch (((LPNMHDR)lparam)->code) { case PSN_APPLY: - setByte( "ConfirmDeletion", IsDlgButtonChecked( hwnd, IDC_CONFIRM_DELETION ) ? 1 : 0 ); - setByte( "DeleteAfterImport", IsDlgButtonChecked( hwnd, IDC_DELETE_AFTER_IMPORT ) ? 1 : 0 ); - setByte( "RememberWindowPosition", IsDlgButtonChecked( hwnd, IDC_REMEMBER_POSITION ) ? 1 : 0 ); + setByte("ConfirmDeletion", IsDlgButtonChecked(hwnd, IDC_CONFIRM_DELETION) ? 1 : 0); + setByte("DeleteAfterImport", IsDlgButtonChecked(hwnd, IDC_DELETE_AFTER_IMPORT) ? 1 : 0); + setByte("RememberWindowPosition", IsDlgButtonChecked(hwnd, IDC_REMEMBER_POSITION) ? 1 : 0); pcli->pfnReloadProtoMenus(); break; diff --git a/plugins/CSList/src/cslist.h b/plugins/CSList/src/cslist.h index e7ea295437..8e0ec67f86 100644 --- a/plugins/CSList/src/cslist.h +++ b/plugins/CSList/src/cslist.h @@ -1,34 +1,34 @@ /* ========================================================================
- Custom Status List
- __________________
+ Custom Status List
+ __________________
- Custom Status List plugin for Miranda-IM (www.miranda-im.org)
- Follower of Custom Status History List by HANAX
- Copyright © 2006-2008 HANAX
- Copyright © 2007-2009 jarvis
+ Custom Status List plugin for Miranda-IM (www.miranda-im.org)
+ Follower of Custom Status History List by HANAX
+ Copyright © 2006-2008 HANAX
+ Copyright © 2007-2009 jarvis
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- DESCRIPTION:
+ DESCRIPTION:
- Offers List of your Custom Statuses.
+ Offers List of your Custom Statuses.
- ============================================================================
+ ============================================================================
-// ====[ INCLUDES AND DEFINITIONS ]======================================== */
+ // ====[ INCLUDES AND DEFINITIONS ]======================================== */
#ifndef __CSLIST_H
#define __CSLIST_H 1
@@ -87,7 +87,7 @@ // set which row is selected (cannot be only focused, but fully selected - second param ;))
#define ListView_GetSelectedItemMacro( hwnd ) ListView_GetNextItem( hwnd, -1, LVNI_FOCUSED | LVNI_SELECTED );
#ifndef ListView_SetSelectionMark
- #define ListView_SetSelectionMark( x, y ) 0
+#define ListView_SetSelectionMark( x, y ) 0
#endif
#define getByte(setting, error) db_get_b(NULL, MODNAME, setting, error)
@@ -101,13 +101,13 @@ #define deleteSetting(setting) db_unset(NULL, MODNAME, setting)
// --
-typedef void (__cdecl *pForAllProtosFunc)( char*, void *);
+typedef void(__cdecl *pForAllProtosFunc)(char*, void *);
// ====[ STRUCTURES ]=========================================================
struct StatusItem // list item structure
-{
+{
int m_iIcon;
TCHAR m_tszTitle[EXTRASTATUS_TITLE_LIMIT];
TCHAR m_tszMessage[EXTRASTATUS_MESSAGE_LIMIT];
@@ -121,11 +121,11 @@ struct StatusItem // list item structure m_bFavourite = FALSE;
}
- StatusItem( const StatusItem& p )
+ StatusItem(const StatusItem& p)
{
m_iIcon = p.m_iIcon;
- mir_tstrcpy( m_tszTitle, p.m_tszTitle );
- mir_tstrcpy( m_tszMessage, p.m_tszMessage );
+ mir_tstrcpy(m_tszTitle, p.m_tszTitle);
+ mir_tstrcpy(m_tszMessage, p.m_tszMessage);
m_bFavourite = p.m_bFavourite;
}
@@ -176,13 +176,13 @@ template< class T > struct ListItem delete m_item;
}
- ListItem( StatusItem* si )
+ ListItem(StatusItem* si)
{
m_item = si;
m_next = NULL;
}
- ListItem( const ListItem& p )
+ ListItem(const ListItem& p)
{
m_item = p.item;
m_next = NULL;
@@ -197,10 +197,10 @@ private: unsigned int m_count;
public:
- typedef int ( *compareFunc )( const T* p1, const T* p2 );
+ typedef int(*compareFunc)(const T* p1, const T* p2);
compareFunc m_compare;
- List( compareFunc compFnc )
+ List(compareFunc compFnc)
{
m_items = NULL;
m_count = 0;
@@ -222,31 +222,31 @@ public: return m_count;
}
- int add( T* csi )
+ int add(T* csi)
{
int position = 0;
- ListItem< T >* item = new ListItem< T >( csi );
- if ( m_items == NULL )
+ ListItem< T >* item = new ListItem< T >(csi);
+ if (m_items == NULL)
m_items = item;
else
{
ListItem< T >* help = item;
item->m_next = m_items;
- while ( help->m_next != NULL )
+ while (help->m_next != NULL)
{
- int cmp = m_compare( item->m_item, help->m_next->m_item );
- if ( cmp == 1 )
+ int cmp = m_compare(item->m_item, help->m_next->m_item);
+ if (cmp == 1)
help = help->m_next;
- else if ( cmp == 0 )
+ else if (cmp == 0)
{
delete item;
return -1;
}
else
- break;
+ break;
position++;
}
- if ( help != item )
+ if (help != item)
{
item->m_next = help->m_next;
help->m_next = item;
@@ -265,14 +265,14 @@ public: ListItem< T >* help = m_items;
ListItem< T >* removed;
- if ( item == 0 )
+ if (item == 0)
{
m_items = m_items->m_next;
removed = help;
}
else
{
- for ( unsigned int i = 0; i < item - 1; i++ )
+ for (unsigned int i = 0; i < item - 1; i++)
{
help = help->m_next;
position++;
@@ -285,23 +285,23 @@ public: return position;
}
- T* get( const unsigned int item )
+ T* get(const unsigned int item)
{
ListItem< T >* help = m_items;
- for ( unsigned int i = 0; i < item; i++ )
+ for (unsigned int i = 0; i < item; i++)
help = help->m_next;
return help->m_item;
}
- T* operator[]( const unsigned int item )
+ T* operator[](const unsigned int item)
{
- return get( item );
+ return get(item);
}
void destroy()
{
- while ( m_count > 0 )
- remove( 0 );
+ while (m_count > 0)
+ remove(0);
}
};
@@ -316,14 +316,14 @@ struct CSListView HWND m_handle;
CSWindow* m_parent;
- CSListView( HWND, CSWindow* );
+ CSListView(HWND, CSWindow*);
- void addItem( StatusItem* item, int itemNumber );
- void initItems( ListItem< StatusItem >* items );
- void reinitItems( ListItem< StatusItem >* items );
+ void addItem(StatusItem* item, int itemNumber);
+ void initItems(ListItem< StatusItem >* items);
+ void reinitItems(ListItem< StatusItem >* items);
void removeItems();
int getPositionInList();
- void setFullFocusedSelection( int selection );
+ void setFullFocusedSelection(int selection);
};
@@ -331,7 +331,7 @@ struct CSItemsList {
List< StatusItem > *m_list;
- static int compareItems( const StatusItem* p1, const StatusItem* p2 );
+ static int compareItems(const StatusItem* p1, const StatusItem* p2);
void loadItems(char *protoName);
void saveItems(char *protoName);
@@ -351,7 +351,7 @@ struct CSWindow BOOL m_bSomethingChanged;
TCHAR* m_filterString;
char * m_protoName;
-
+
CSWindow(char *protoName);
~CSWindow();
@@ -362,9 +362,9 @@ struct CSWindow BOOL toggleButtons();
void toggleEmptyListMessage();
void toggleFilter();
- BOOL itemPassedFilter( ListItem< StatusItem >* li );
+ BOOL itemPassedFilter(ListItem< StatusItem >* li);
- void __inline saveWindowPosition( HWND hwnd )
+ void __inline saveWindowPosition(HWND hwnd)
{
if (getByte("RememberWindowPosition", DEFAULT_REMEMBER_WINDOW_POSITION) == TRUE)
Utils_SaveWindowPosition(hwnd, NULL, MODNAME, "Position");
@@ -382,13 +382,13 @@ struct CSAMWindow HWND m_hCombo;
HWND m_hMessage;
- CSAMWindow( WORD action, CSWindow* parent );
+ CSAMWindow(WORD action, CSWindow* parent);
~CSAMWindow();
void exec();
void setCombo();
void fillDialog();
- void checkFieldLimit( WORD action, WORD item );
+ void checkFieldLimit(WORD action, WORD item);
void checkItemValidity();
};
@@ -406,9 +406,9 @@ void SetStatus(WORD code, StatusItem* item, char *protoName); // ====[ PROCEDURES ]=========================================================
-INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
-INT_PTR CALLBACK CSAMWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
-INT_PTR CALLBACK CSRNWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
-INT_PTR CALLBACK CSOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam );
+INT_PTR CALLBACK CSWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+INT_PTR CALLBACK CSAMWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+INT_PTR CALLBACK CSRNWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+INT_PTR CALLBACK CSOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
#endif /* __CSLIST_H */
|