summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-01 10:56:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-01 10:56:58 +0000
commit95dccf315ba175eaf848fd6d85af6eb306a7482f (patch)
tree0e5d65712a914566cf76370c78ae256bd744218e
parent1fba79d0cd33719c33a431b0c6ecd4b169acd4d5 (diff)
duplicate code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@17235 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_clist.h20
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_contact.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_keyboard.cpp6
-rw-r--r--plugins/Clist_nicer/src/clui.cpp17
-rw-r--r--plugins/ExternalAPI/m_skin_eng.h4
-rw-r--r--plugins/TopToolBar/src/InternalButtons.cpp20
-rw-r--r--src/mir_app/src/clui.cpp14
-rw-r--r--src/mir_app/src/menu_groups.cpp25
11 files changed, 43 insertions, 76 deletions
diff --git a/include/m_clist.h b/include/m_clist.h
index 3cde4222f9..8b54c0c4b0 100644
--- a/include/m_clist.h
+++ b/include/m_clist.h
@@ -319,7 +319,25 @@ typedef struct {
// toggles the show/hide status of the contact list
// wParam = lParam = 0
// returns 0 on success, nonzero on failure
-#define MS_CLIST_SHOWHIDE "CList/ShowHide"
+#define MS_CLIST_SHOWHIDE "CList/ShowHide"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// toggles the use groups mode of the contact list
+// wParam = lParam = 0
+// returns new groups mode
+#define MS_CLIST_TOGGLEGROUPS "CList/ToggleGroups"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// toggles the empty groups display mode
+// wParam = lParam = 0
+// returns new empty groups mode
+#define MS_CLIST_TOGGLEEMPTYGROUPS "CList/ToggleEmptyGroups"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// toggles the hidden users display mode
+// wParam = lParam = 0
+// returns new hidden users mode
+#define MS_CLIST_TOGGLEHIDEOFFLINEROOT "CList/ToggleHideOfflineRoot"
/////////////////////////////////////////////////////////////////////////////////////////
// sent when the group get modified (created, renamed or deleted)
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index 72b297c2bc..4e76e461f3 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -112,7 +112,6 @@ extern "C" __declspec(dllexport) int Unload(void)
XPThemesUnloadModule();
UnloadAvatarOverlayIcon();
- UninitSkinHotKeys();
FreeRowCell();
EventArea_UnloadModule();
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index bc23afacfe..d1786bb6a3 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -171,8 +171,6 @@ HRESULT CluiLoadModule()
HookEvent(ME_DB_CONTACT_ADDED, ContactAdded);
CreateServiceFunction(MS_CLIST_TOGGLEHIDEOFFLINE, ToggleHideOffline);
-
- CreateServiceFunction(MS_CLIST_TOGGLEGROUPS, ToggleGroups);
CreateServiceFunction(MS_CLIST_TOGGLESOUNDS, ToggleSounds);
CreateServiceFunction(MS_CLIST_SETUSEGROUPS, SetUseGroups);
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index b267c906b5..610778758a 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -200,7 +200,6 @@ int RestoreAllContactData(ClcData *dat); //c
int SkinSelector_DeleteMask(MODERNMASK *mm); //mod_skin_selector.c
int StoreAllContactData(ClcData *dat); //cache_func.c
INT_PTR ToggleHideOffline(WPARAM wParam, LPARAM lParam); //contact.c
-INT_PTR ToggleGroups(WPARAM wParam, LPARAM lParam); //contact.c
INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam); //contact.c
INT_PTR ToggleSounds(WPARAM wParam, LPARAM lParam); //contact.c
void ClcOptionsChanged(); //clc.c
@@ -220,7 +219,6 @@ void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *sz
int ExtraImage_ExtraIDToColumnNum(int extra);
int LoadSkinButtonModule();
-void UninitSkinHotKeys();
void GetDefaultFontSetting(int i, LOGFONTA *lf, COLORREF *colour);
int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam);
HRESULT CluiLoadModule();
diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp
index 6d6d5698e0..47ffcfc574 100644
--- a/plugins/Clist_modern/src/modern_contact.cpp
+++ b/plugins/Clist_modern/src/modern_contact.cpp
@@ -158,14 +158,6 @@ INT_PTR ToggleHideOffline(WPARAM, LPARAM)
return pcli->pfnSetHideOffline(-1);
}
-INT_PTR ToggleGroups(WPARAM, LPARAM)
-{
- db_set_b(NULL, "CList", "UseGroups",
- (BYTE)!db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
- pcli->pfnLoadContactTree();
- return 0;
-}
-
INT_PTR SetUseGroups(WPARAM wParam, LPARAM)
{
int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE)&CLS_USEGROUPS);
diff --git a/plugins/Clist_modern/src/modern_keyboard.cpp b/plugins/Clist_modern/src/modern_keyboard.cpp
index 174efbed7f..77707dc3ec 100644
--- a/plugins/Clist_modern/src/modern_keyboard.cpp
+++ b/plugins/Clist_modern/src/modern_keyboard.cpp
@@ -66,11 +66,5 @@ int InitSkinHotKeys(void)
shk.pwszSection = LPGENW("Main");
shk.pszService = MS_CLIST_TOGGLEHIDEOFFLINE;
Hotkey_Register(&shk);
-
-
return 0;
}
-
-void UninitSkinHotKeys(void)
-{
-}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 5cde52aab1..a73e090873 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -1501,25 +1501,16 @@ buttons_done:
CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)(-1), 0);
break;
case POPUP_HIDEOFFLINEROOT:
- SendMessage(pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0);
+ CallService(MS_CLIST_TOGGLEHIDEOFFLINEROOT, 0, 0);
break;
case POPUP_HIDEEMPTYGROUPS:
- {
- int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
- SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- }
+ CallService(MS_CLIST_TOGGLEEMPTYGROUPS, 0, 0);
break;
case IDC_TBHIDEGROUPS:
case IDC_STBHIDEGROUPS:
case POPUP_DISABLEGROUPS:
- {
- int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
- SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal, 0);
- ClcSetButtonState(IDC_TBHIDEGROUPS, newVal);
- SetButtonStates();
- }
+ ClcSetButtonState(IDC_TBHIDEGROUPS, CallService(MS_CLIST_TOGGLEGROUPS, 0, 0));
+ SetButtonStates();
break;
case POPUP_HIDEMIRANDA:
pcli->pfnShowHide(0, 0);
diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h
index a1b8b6cf55..e7241a9447 100644
--- a/plugins/ExternalAPI/m_skin_eng.h
+++ b/plugins/ExternalAPI/m_skin_eng.h
@@ -67,12 +67,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/*SERVICES*/
//toggle the 'hide offline contacts' flag and call CLUI
-//wParam=0
-//lParam=0
#define MS_CLIST_TOGGLEHIDEOFFLINE "CList/ToggleHideOffline"
-#define MS_CLIST_TOGGLEGROUPS "CList/ToggleGroups"
-
#define MS_CLIST_TOGGLESOUNDS "CList/ToggleSounds"
// Add new object to skin object list.
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp
index 8bf37c6d23..dbc1b811dd 100644
--- a/plugins/TopToolBar/src/InternalButtons.cpp
+++ b/plugins/TopToolBar/src/InternalButtons.cpp
@@ -1,11 +1,10 @@
#include "stdafx.h"
-#define TTBI_GROUPSHOWHIDE "TTBInternal/GroupShowHide"
-#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
-#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
-#define TTBI_STATUSMENUBUTT "TTBInternal/StatusMenuButt"
-#define TTBI_SHOWHIDEOFFLINE "TTBInternal/ShowHideOffline"
+#define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
+#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
+#define TTBI_STATUSMENUBUTT "TTBInternal/StatusMenuButt"
+#define TTBI_SHOWHIDEOFFLINE "TTBInternal/ShowHideOffline"
#define INDEX_OFFLINE 5
#define INDEX_META 6
@@ -29,7 +28,7 @@ static stdButtons[] = {
{ LPGEN("Show status menu"), TTBI_STATUSMENUBUTT, SKINICON_OTHER_STATUS, 0, LPGEN("Show status menu"), NULL, 0, 0 },
{ LPGEN("Show/hide offline contacts"), TTBI_SHOWHIDEOFFLINE, IDI_HIDEOFFLINE, IDI_SHOWOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 1, 1 },
{ LPGEN("Enable/disable metacontacts"), "MetaContacts/OnOff", IDI_METAOFF, IDI_METAON, LPGEN("Disable metacontacts"), LPGEN("Enable metacontacts"), 1, 1 },
- { LPGEN("Enable/disable groups"), TTBI_GROUPSHOWHIDE, IDI_GROUPSOFF, IDI_GROUPSON, LPGEN("Enable groups"), LPGEN("Disable groups"), 1, 1 },
+ { LPGEN("Enable/disable groups"), MS_CLIST_TOGGLEGROUPS, IDI_GROUPSOFF, IDI_GROUPSON, LPGEN("Enable groups"), LPGEN("Disable groups"), 1, 1 },
{ LPGEN("Enable/disable sounds"), TTBI_SOUNDSONOFF, IDI_SOUNDSOFF, IDI_SOUNDSON, LPGEN("Disable sounds"), LPGEN("Enable sounds"), 1, 1 },
{ LPGEN("Minimize contact list"), MS_CLIST_SHOWHIDE, SKINICON_OTHER_SHOWHIDE, 0, LPGEN("Minimize contact list"), NULL, 0, 1 },
{ LPGEN("Exit"), "CloseAction", SKINICON_OTHER_EXIT, 0, LPGEN("Exit"), NULL, 0, 0 }
@@ -77,14 +76,6 @@ INT_PTR TTBInternalStatusMenuButt(WPARAM, LPARAM)
return 0;
}
-INT_PTR TTBInternalGroupShowHide(WPARAM, LPARAM)
-{
- int newVal = !(GetWindowLongPtr(hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
- SendMessage(hwndContactTree, CLM_SETUSEGROUPS, newVal, 0);
- return 0;
-}
-
INT_PTR TTBInternalSoundsOnOff(WPARAM, LPARAM)
{
int newVal = !(db_get_b(NULL, "Skin", "UseSound", 1));
@@ -104,7 +95,6 @@ void InitInternalButtons()
{
hwndContactTree = pcli->hwndContactTree;
- CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide);
CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff);
CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt);
CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt);
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 250287f634..2090775fd5 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -708,23 +708,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case POPUP_HIDEOFFLINEROOT:
- SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT, !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0);
+ CallService(MS_CLIST_TOGGLEHIDEOFFLINEROOT, 0, 0);
break;
case POPUP_HIDEEMPTYGROUPS:
- {
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- }
+ CallService(MS_CLIST_TOGGLEEMPTYGROUPS);
break;
case POPUP_DISABLEGROUPS:
- {
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal, 0);
- }
+ CallService(MS_CLIST_TOGGLEGROUPS);
break;
case POPUP_HIDEMIRANDA:
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp
index 1eda0aa080..e4a0a1d0af 100644
--- a/src/mir_app/src/menu_groups.cpp
+++ b/src/mir_app/src/menu_groups.cpp
@@ -103,31 +103,30 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR HideGroupsHelper(WPARAM, LPARAM)
+static INT_PTR HideGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- return 0;
+ return newVal;
}
-INT_PTR UseGroupsHelper(WPARAM, LPARAM)
+static INT_PTR UseGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
- return 0;
+ return newVal;
}
-INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
+static INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
{
- SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT,
- !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0),
- 0);
- return 0;
+ int newVal = !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0);
+ SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT, newVal, 0);
+ return newVal;
}
-INT_PTR CreateGroupHelper(WPARAM, LPARAM)
+static INT_PTR CreateGroupHelper(WPARAM, LPARAM)
{
SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
@@ -301,21 +300,21 @@ void InitGroupMenus(void)
SET_UID(mi, 0xeded7371, 0xf6e6, 0x48c3, 0x8c, 0x9e, 0x62, 0xc1, 0xd5, 0xcb, 0x51, 0xbc);
mi.position = 500002;
- mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
+ mi.pszService = MS_CLIST_TOGGLEHIDEOFFLINEROOT;
mi.name.a = LPGEN("Hide &offline users out here");
hHideOfflineUsersOutHereMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, HideOfflineRootHelper);
SET_UID(mi, 0x4c17b9cf, 0x513a, 0x41d8, 0x8d, 0x2b, 0x89, 0x44, 0x81, 0x14, 0x0, 0x91);
mi.position = 500003;
- mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
+ mi.pszService = MS_CLIST_TOGGLEEMPTYGROUPS;
mi.name.a = LPGEN("Hide &empty groups");
hHideEmptyGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, HideGroupsHelper);
SET_UID(mi, 0xfcbdbbb1, 0xa553, 0x49ac, 0xa5, 0xdf, 0xb4, 0x81, 0x38, 0xf, 0xa0, 0xc7);
mi.position = 500004;
- mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
+ mi.pszService = MS_CLIST_TOGGLEGROUPS;
mi.name.a = LPGEN("Disable &groups");
hDisableGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, UseGroupsHelper);