From c26c7e3a5e2a5d4fa316b6b608f4751fc18799fc Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 1 Jun 2012 13:55:14 +0300 Subject: [PATCH] Changed checks to bullets in context menus where appropriate --- Library/Rainmeter.cpp | 52 ++++++++++++++++++------------------------- Library/resource.h | 15 ++++++------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 82af0249..4b417368 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -2839,8 +2839,13 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) int fileCount = (int)folder.files.size(); for ( ; fileIndex < fileCount; ++fileIndex) { - UINT flags = MF_STRING | MF_BYPOSITION | ((folder.active == fileIndex + 1) ? MF_CHECKED : MF_UNCHECKED); - InsertMenu(subMenu, fileIndex, flags, folder.commandBase, folder.files[fileIndex].c_str()); + InsertMenu(subMenu, fileIndex, MF_STRING | MF_BYPOSITION, folder.commandBase + fileIndex, folder.files[fileIndex].c_str()); + } + + if (folder.active) + { + UINT checkPos = folder.active - 1; + CheckMenuRadioItem(subMenu, checkPos, checkPos, checkPos, MF_BYPOSITION); } if (hasSubfolder && fileIndex != 0) @@ -2877,27 +2882,8 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con HMENU posMenu = GetSubMenu(settingsMenu, 0); if (posMenu) { - switch (meterWindow->GetWindowZPosition()) - { - case ZPOSITION_ONDESKTOP: - CheckMenuItem(posMenu, IDM_SKIN_ONDESKTOP, MF_BYCOMMAND | MF_CHECKED); - break; - - case ZPOSITION_ONBOTTOM: - CheckMenuItem(posMenu, IDM_SKIN_BOTTOM, MF_BYCOMMAND | MF_CHECKED); - break; - - case ZPOSITION_ONTOP: - CheckMenuItem(posMenu, IDM_SKIN_TOPMOST, MF_BYCOMMAND | MF_CHECKED); - break; - - case ZPOSITION_ONTOPMOST: - CheckMenuItem(posMenu, IDM_SKIN_VERYTOPMOST, MF_BYCOMMAND | MF_CHECKED); - break; - - default: - CheckMenuItem(posMenu, IDM_SKIN_NORMAL, MF_BYCOMMAND | MF_CHECKED); - } + UINT checkPos = IDM_SKIN_NORMAL - (UINT)meterWindow->GetWindowZPosition(); + CheckMenuRadioItem(posMenu, checkPos, checkPos, checkPos, MF_BYCOMMAND); if (meterWindow->GetXFromRight()) CheckMenuItem(posMenu, IDM_SKIN_FROMRIGHT, MF_BYCOMMAND | MF_CHECKED); if (meterWindow->GetYFromBottom()) CheckMenuItem(posMenu, IDM_SKIN_FROMBOTTOM, MF_BYCOMMAND | MF_CHECKED); @@ -2915,10 +2901,10 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con HMENU alphaMenu = GetSubMenu(settingsMenu, 1); if (alphaMenu) { - int value = (int)(10 - meterWindow->GetAlphaValue() / 25.5); - value = min(9, value); - value = max(0, value); - CheckMenuItem(alphaMenu, value, MF_BYPOSITION | MF_CHECKED); + UINT checkPos = (UINT)(10 - meterWindow->GetAlphaValue() / 25.5); + checkPos = min(9, checkPos); + checkPos = max(0, checkPos); + CheckMenuRadioItem(alphaMenu, checkPos, checkPos, checkPos, MF_BYPOSITION); switch (meterWindow->GetWindowHide()) { @@ -2939,7 +2925,7 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con } } - // Tick the configs + // Tick the settings switch (meterWindow->GetWindowHide()) { case HIDEMODE_HIDE: @@ -3001,9 +2987,15 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con if (variantsMenu) { const SkinFolder& folder = m_SkinFolders[FindSkinFolderIndex(skinName)]; - for (int i = 0, jsize = (int)folder.files.size(); i < jsize; ++i) + for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) { - InsertMenu(variantsMenu, i, MF_BYPOSITION | ((folder.active == i + 1) ? MF_CHECKED : MF_UNCHECKED), folder.commandBase + i, folder.files[i].c_str()); + InsertMenu(variantsMenu, i, MF_BYPOSITION, folder.commandBase + i, folder.files[i].c_str()); + } + + if (folder.active) + { + UINT checkPos = folder.active - 1; + CheckMenuRadioItem(variantsMenu, checkPos, checkPos, checkPos, MF_BYPOSITION); } } diff --git a/Library/resource.h b/Library/resource.h index 45672b20..fe0b07b9 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -139,12 +139,13 @@ #define IDM_DISABLEDRAG 4003 #define IDM_MANAGE 4004 #define IDM_ABOUT 4005 -#define IDM_CONFIGS_DEFAULT 4006 -#define IDM_EDITCONFIG 4008 -#define IDM_CLOSESKIN 4009 -#define IDM_SKIN_TOPMOST 4010 -#define IDM_SKIN_NORMAL 4011 -#define IDM_SKIN_BOTTOM 4012 +#define IDM_EDITCONFIG 4006 +#define IDM_CLOSESKIN 4007 +#define IDM_SKIN_VERYTOPMOST 4008 +#define IDM_SKIN_TOPMOST 4009 +#define IDM_SKIN_NORMAL 4010 +#define IDM_SKIN_BOTTOM 4011 +#define IDM_SKIN_ONDESKTOP 4012 #define IDM_SKIN_TRANSPARENCY_0 4014 #define IDM_SKIN_TRANSPARENCY_10 4015 #define IDM_SKIN_TRANSPARENCY_20 4016 @@ -162,8 +163,6 @@ #define IDM_SKIN_SNAPTOEDGES 4028 #define IDM_SKIN_CLICKTHROUGH 4029 #define IDM_SKIN_EDITSKIN 4030 -#define IDM_SKIN_VERYTOPMOST 4031 -#define IDM_SKIN_ONDESKTOP 4032 #define IDM_SHOW_HELP 4034 #define IDM_SHOWLOGFILE 4035 #define IDM_SKIN_TRANSPARENCY_FADEIN 4037