summaryrefslogtreecommitdiff
path: root/src/modules/clist/genmenu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-15 16:48:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-15 16:48:03 +0000
commit3744b5146df8530d3b43a972d58223cb3ffb533c (patch)
treea322ca4d0f8eda203cdb618071399c2d0a30e841 /src/modules/clist/genmenu.cpp
parentb92b010ae92db3f61a20ff2f579a5b717cfc8168 (diff)
- fixes for the plugins options' dialog;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@430 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist/genmenu.cpp')
-rw-r--r--src/modules/clist/genmenu.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index c6413ee556..2399286f72 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -772,6 +772,17 @@ static int WhereToPlace( HMENU hMenu, PMO_MenuItem mi )
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static DWORD GetMenuItemType(HMENU hMenu, int uItem)
+{
+ MENUITEMINFO mii = { 0 };
+ mii.cbSize = MENUITEMINFO_V4_SIZE;
+ mii.fMask = MIIM_TYPE;
+ GetMenuItemInfo(hMenu, uItem, TRUE, &mii);
+ return mii.fType;
+}
+
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii)
{
PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )lpmii->dwItemData );
@@ -782,20 +793,14 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l
mii.cbSize = MENUITEMINFO_V4_SIZE;
//check for separator before
if ( uItem ) {
- mii.fMask = MIIM_SUBMENU | MIIM_DATA | MIIM_TYPE;
+ mii.fMask = MIIM_DATA;
GetMenuItemInfo( hMenu, uItem-1, TRUE, &mii );
PMO_IntMenuItem p = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
if ( p != NULL && mii.fType != MFT_SEPARATOR) {
int needSeparator = (p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL);
if ( needSeparator) {
//but might be supposed to be after the next one instead
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = MENUITEMINFO_V4_SIZE;
- if ( uItem < GetMenuItemCount( hMenu )) {
- mii.fMask = MIIM_TYPE;
- GetMenuItemInfo( hMenu, uItem, TRUE, &mii );
- }
- if ( mii.fType != MFT_SEPARATOR) {
+ if ( uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR) {
mii.fMask = MIIM_TYPE;
mii.fType = MFT_SEPARATOR;
InsertMenuItem( hMenu, uItem, TRUE, &mii );
@@ -834,9 +839,11 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l
InsertMenuItem( hMenu, uItem, TRUE, &mii);
}
-//wparam started hMenu
-//lparam ListParam*
-//result hMenu
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam started hMenu
+// lparam ListParam*
+// result hMenu
+
INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam)
{
if ( !bIsGenMenuInited )