From d8b57512b6d000efd5f3f996f29c41886ff2b043 Mon Sep 17 00:00:00 2001 From: Brian Ferguson Date: Thu, 4 Oct 2012 23:30:45 -0600 Subject: [PATCH] Cosmetics --- Library/Rainmeter.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index c70ade2c..33a332e8 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -3163,10 +3163,8 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU men // Add custom actions to the context menu std::wstring contextTitle = meterWindow->GetParser().ReadString(L"Rainmeter", L"ContextTitle", L""); std::wstring contextAction = meterWindow->GetParser().ReadString(L"Rainmeter", L"ContextAction", L""); - if (!contextTitle.empty() && (!contextAction.empty() || _wcsicmp(contextTitle.c_str(), L"SEPARATOR") == 0)) { - // Read context menu titles (also read the actions) std::vector cTitles; WCHAR buffer[128]; int i = 1; @@ -3189,7 +3187,7 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU men contextAction = meterWindow->GetParser().ReadString(L"Rainmeter", buffer, L""); } - // Build a sub-menu if more than one item + // Build a sub-menu if more than three items size_t titleSize = cTitles.size(); if (titleSize <= 3) { @@ -3209,7 +3207,11 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU men ++position; } - InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, NULL, L"Custom skin actions"); + if (position != 0) + { + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, NULL, L"Custom skin actions"); + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + } } else { @@ -3227,9 +3229,9 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU men AppendMenu(customMenu, MF_BYPOSITION | MF_STRING, (index << 16) | (IDM_SKIN_CUSTOMCONTEXTMENU_FIRST + i), cTitles[i].c_str()); } } - } - InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + } } }