summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-25 18:35:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-25 18:35:16 +0000
commitf8025eba881e80e6dc301c4005ef0d2077bf086a (patch)
tree44b7e885f95c3eddbd3378f0744aec21ebd64461
parent60eb7158c64c215db62ba3df6f248778792cbe5a (diff)
- obsolete menu processing code removed;
- common menu commands processing code moved to the core; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14698 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_clistint.h2
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp47
-rw-r--r--protocols/AimOscar/src/file.cpp2
-rw-r--r--src/mir_app/src/clc.cpp47
-rw-r--r--src/mir_app/src/clc.h1
-rw-r--r--src/mir_app/src/clistcore.cpp1
-rw-r--r--src/mir_app/src/menu_clist.cpp8
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp24
8 files changed, 55 insertions, 77 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index 31203835e6..636d7b6bc3 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -267,7 +267,7 @@ struct CLIST_INTERFACE
/* clc.h */
void (*pfnClcOptionsChanged)(void);
void (*pfnClcBroadcast)(int, WPARAM, LPARAM);
- HMENU (*pfnBuildGroupPopupMenu)(struct ClcGroup*);
+ HMENU (*pfnBuildGroupPopupMenu)(struct ClcGroup*); // unused
LRESULT (CALLBACK *pfnContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 34c9c76e16..deadd91373 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -339,45 +339,30 @@ static LRESULT clcOnHitTest(ClcData *, HWND hwnd, UINT, WPARAM wParam, LPARAM lP
return DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam);
}
-static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM)
+static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)
{
ClcContact *contact;
int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
- if (hit == -1) return 0;
- if (contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), contact->hContact)) return 0;
+ if (hit != -1) {
+ switch (LOWORD(wParam)) {
+ case POPUP_NEWSUBGROUP:
+ if (contact->type == CLCIT_GROUP) {
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
+ CallService(MS_CLIST_GROUPCREATE, contact->groupId, 0);
+ }
+ return 0;
- switch (LOWORD(wParam)) {
- case POPUP_NEWSUBGROUP:
- if (contact->type != CLCIT_GROUP)
+ case POPUP_GROUPSHOWOFFLINE:
+ if (contact->type == CLCIT_GROUP) {
+ CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ }
return 0;
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
- CallService(MS_CLIST_GROUPCREATE, contact->groupId, 0);
- return 0;
- case POPUP_RENAMEGROUP:
- pcli->pfnBeginRenameSelection(hwnd, dat);
- return 0;
- case POPUP_DELETEGROUP:
- if (contact->type == CLCIT_GROUP)
- CallService(MS_CLIST_GROUPDELETE, contact->groupId, 0);
- return 0;
- case POPUP_GROUPSHOWOFFLINE:
- if (contact->type == CLCIT_GROUP) {
- CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
- return 0;
- case POPUP_GROUPHIDEOFFLINE:
- if (contact->type == CLCIT_GROUP)
- CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
- return 0;
}
- if (contact->type == CLCIT_GROUP)
- if (Menu_ProcessCommandById(wParam, (LPARAM)hwnd))
- return 0;
-
- return 0;
+ return corecli.pfnContactListControlWndProc(hwnd, WM_COMMAND, wParam, lParam);
}
static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index 9e075e3f79..19efeee646 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -248,7 +248,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
}
else if (type == 0x0205)
{
- oft2* recv_ft = (oft2*)packetRecv.buffer;
+ recv_ft = (oft2*)packetRecv.buffer;
recv_ft->type = _htons(0x0106);
ft->pfts.currentFileProgress = _htonl(recv_ft->recv_bytes);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index d6baa3ff91..3410754d1c 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -59,12 +59,6 @@ void fnClcOptionsChanged(void)
cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
}
-// stub. does nothing
-HMENU fnBuildGroupPopupMenu(ClcGroup *group)
-{
- return Menu_BuildSubGroupMenu(group);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// standard CLC services
@@ -1246,7 +1240,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (dat->selection != -1 && hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMCHECK | CLCHT_ONITEMLABEL)) {
HMENU hMenu;
if (contact->type == CLCIT_GROUP)
- hMenu = cli.pfnBuildGroupPopupMenu(contact->group);
+ hMenu = Menu_BuildSubGroupMenu(contact->group);
else if (contact->type == CLCIT_CONTACT)
hMenu = Menu_BuildContactMenu(contact->hContact);
else
@@ -1272,28 +1266,31 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (hit == -1)
break;
if (contact->type == CLCIT_CONTACT)
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)contact->hContact))
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), contact->hContact))
break;
- switch (LOWORD(wParam)) {
- case POPUP_NEWSUBGROUP:
- if (contact->type != CLCIT_GROUP)
+
+ if (contact->type == CLCIT_GROUP) {
+ switch (LOWORD(wParam)) {
+ case POPUP_NEWSUBGROUP:
+ if (contact->type != CLCIT_GROUP)
+ break;
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
+ CallService(MS_CLIST_GROUPCREATE, contact->groupId, 0);
break;
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
- CallService(MS_CLIST_GROUPCREATE, contact->groupId, 0);
- break;
- case POPUP_RENAMEGROUP:
- cli.pfnBeginRenameSelection(hwnd, dat);
- break;
- case POPUP_DELETEGROUP:
- if (contact->type != CLCIT_GROUP)
+ case POPUP_RENAMEGROUP:
+ cli.pfnBeginRenameSelection(hwnd, dat);
break;
- CallService(MS_CLIST_GROUPDELETE, contact->groupId, 0);
- break;
- case POPUP_GROUPHIDEOFFLINE:
- if (contact->type != CLCIT_GROUP)
+ case POPUP_DELETEGROUP:
+ if (contact->type == CLCIT_GROUP)
+ CallService(MS_CLIST_GROUPDELETE, contact->groupId, 0);
break;
- CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
- break;
+ case POPUP_GROUPHIDEOFFLINE:
+ if (contact->type == CLCIT_GROUP)
+ CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
+ break;
+ }
+
+ Menu_ProcessCommandById(wParam, (LPARAM)hwnd);
}
break;
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h
index 5df01c3eff..dfb5a93dba 100644
--- a/src/mir_app/src/clc.h
+++ b/src/mir_app/src/clc.h
@@ -39,7 +39,6 @@ extern int g_IconWidth, g_IconHeight;
void fnClcOptionsChanged(void);
void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam);
-HMENU fnBuildGroupPopupMenu(ClcGroup* group);
void fnInitAutoRebuild(HWND hWnd);
LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp
index 9c53d8f1ec..7df2f0d0ed 100644
--- a/src/mir_app/src/clistcore.cpp
+++ b/src/mir_app/src/clistcore.cpp
@@ -74,7 +74,6 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM)
cli.pfnClcOptionsChanged = fnClcOptionsChanged;
cli.pfnClcBroadcast = fnClcBroadcast;
cli.pfnContactListControlWndProc = fnContactListControlWndProc;
- cli.pfnBuildGroupPopupMenu = fnBuildGroupPopupMenu;
cli.pfnRegisterFileDropping = fnRegisterFileDropping;
cli.pfnUnregisterFileDropping = fnUnregisterFileDropping;
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index 273cf5e7b4..5bfeeee21b 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -661,12 +661,12 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
if (!(cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX))
return 0; // DO NOT process ids outside from clist menu id range v0.7.0.27+
- //process old menu sys
+ // process old menu sys
if (HIWORD(wParam) & MPCF_CONTACTMENU)
- return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam);
+ return MO_ProcessCommandBySubMenuIdent(hContactMenuObject, cmd, lParam);
- //unknown old menu
- return Menu_ProcessCommandById(LOWORD(wParam), lParam);
+ // unknown old menu
+ return Menu_ProcessCommandById(cmd, lParam);
}
BOOL FindMenuHanleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itdat)
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index 87916cebb0..e12c1e107c 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -23,6 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+void SafeDestroyIcon(HICON hIcon)
+{
+ if (hIcon != NULL)
+ if (!IcoLib_IsManaged(hIcon))
+ ::DestroyIcon(hIcon);
+}
+
struct StatusIconChild : public MZeroedObject
{
~StatusIconChild()
@@ -36,15 +43,6 @@ struct StatusIconChild : public MZeroedObject
HICON hIcon, hIconDisabled;
int flags;
TCHAR *tszTooltip;
-
- void SafeDestroyIcon(HICON hIcon)
- {
- if (hIcon == NULL)
- return;
-
- if (!IcoLib_IsManaged(hIcon))
- ::DestroyIcon(hIcon);
- }
};
struct StatusIconMain : public MZeroedObject
@@ -105,7 +103,7 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam)
pc->hContact = hContact;
p->arChildren.insert(pc);
}
- else pc->SafeDestroyIcon(pc->hIcon);
+ else SafeDestroyIcon(pc->hIcon);
pc->flags = sid->flags;
pc->hIcon = sid->hIcon;
@@ -193,11 +191,11 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-void KillModuleSrmmIcons(int hLangpack)
+void KillModuleSrmmIcons(int _hLang)
{
- for (int i=arIcons.getCount()-1; i >= 0; i--) {
+ for (int i = arIcons.getCount()-1; i >= 0; i--) {
StatusIconMain &p = arIcons[i];
- if (p.hLangpack == hLangpack)
+ if (p.hLangpack == _hLang)
arIcons.remove(i);
}
}