mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Relocated some context menu items to the resource file.
This commit is contained in:
parent
bf7fdad840
commit
c0579e3b24
@ -73,8 +73,20 @@ BEGIN
|
|||||||
POPUP "Context"
|
POPUP "Context"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "About...", ID_CONTEXT_ABOUT
|
MENUITEM "About...", ID_CONTEXT_ABOUT
|
||||||
|
MENUITEM "Downloads", ID_CONTEXT_DOWNLOADS
|
||||||
MENUITEM "Help", ID_CONTEXT_SHOW_HELP
|
MENUITEM "Help", ID_CONTEXT_SHOW_HELP
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
POPUP "Configs"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Open Skins' Folder", ID_CONTEXT_OPENSKINSFOLDER
|
||||||
|
MENUITEM "Disable Dragging", ID_CONTEXT_DISABLEDRAG
|
||||||
|
MENUITEM "Manage Skins...", ID_CONTEXT_MANAGESKINS
|
||||||
|
END
|
||||||
|
POPUP "Themes"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Manage Themes...", ID_CONTEXT_MANAGETHEMES
|
||||||
|
END
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Edit Settings...", ID_CONTEXT_EDITCONFIG
|
MENUITEM "Edit Settings...", ID_CONTEXT_EDITCONFIG
|
||||||
MENUITEM "Refresh All", ID_CONTEXT_REFRESH
|
MENUITEM "Refresh All", ID_CONTEXT_REFRESH
|
||||||
@ -98,6 +110,13 @@ IDR_SKIN_MENU MENU DISCARDABLE
|
|||||||
BEGIN
|
BEGIN
|
||||||
POPUP "Skin Menu"
|
POPUP "Skin Menu"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
MENUITEM " ", ID_CONTEXT_SKINMENU_OPENSKINSFOLDER
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
POPUP "Variants"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM " ", 0, GRAYED // DUMMY
|
||||||
|
END
|
||||||
|
MENUITEM SEPARATOR
|
||||||
POPUP "Settings"
|
POPUP "Settings"
|
||||||
BEGIN
|
BEGIN
|
||||||
POPUP "Position"
|
POPUP "Position"
|
||||||
|
@ -3869,7 +3869,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
|||||||
{
|
{
|
||||||
// Disable Quit/Logging if ran as a Litestep plugin
|
// Disable Quit/Logging if ran as a Litestep plugin
|
||||||
EnableMenuItem(subMenu, ID_CONTEXT_QUIT, MF_BYCOMMAND | MF_GRAYED);
|
EnableMenuItem(subMenu, ID_CONTEXT_QUIT, MF_BYCOMMAND | MF_GRAYED);
|
||||||
EnableMenuItem(subMenu, 7, MF_BYPOSITION | MF_GRAYED); // "Logging" menu
|
EnableMenuItem(subMenu, 10, MF_BYPOSITION | MF_GRAYED); // "Logging" menu
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3890,26 +3890,24 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU configMenu = CreateConfigMenu(m_ConfigMenu);
|
HMENU configMenu = GetSubMenu(subMenu, 4);
|
||||||
if (!configMenu)
|
|
||||||
{
|
|
||||||
configMenu = CreatePopupMenu();
|
|
||||||
AppendMenu(configMenu, MF_GRAYED, 0, L"No configs available");
|
|
||||||
}
|
|
||||||
if (configMenu)
|
if (configMenu)
|
||||||
{
|
{
|
||||||
AppendMenu(configMenu, MF_SEPARATOR, 0, NULL);
|
if (!CreateConfigMenu(configMenu, m_ConfigMenu))
|
||||||
AppendMenu(configMenu, 0, ID_CONTEXT_OPENSKINSFOLDER, L"Open Skins\' Folder");
|
{
|
||||||
AppendMenu(configMenu, (m_DisableDragging) ? MF_CHECKED : MF_UNCHECKED, ID_CONTEXT_DISABLEDRAG, L"Disable Dragging");
|
InsertMenu(configMenu, 0, MF_BYPOSITION | MF_GRAYED, 0, L"No configs available");
|
||||||
AppendMenu(configMenu, 0, ID_CONTEXT_MANAGESKINS, L"Manage Skins...");
|
|
||||||
|
|
||||||
InsertMenu(subMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)configMenu, L"Configs");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU themeMenu = CreateThemeMenu();
|
if (m_DisableDragging)
|
||||||
|
{
|
||||||
|
CheckMenuItem(configMenu, ID_CONTEXT_DISABLEDRAG, MF_BYCOMMAND | MF_CHECKED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HMENU themeMenu = GetSubMenu(subMenu, 5);
|
||||||
if (themeMenu)
|
if (themeMenu)
|
||||||
{
|
{
|
||||||
InsertMenu(subMenu, 4, MF_BYPOSITION | MF_POPUP, (UINT_PTR)themeMenu, L"Themes");
|
CreateThemeMenu(themeMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
@ -3918,10 +3916,12 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
|||||||
subMenu = CreateSkinMenu(meterWindow, 0, configMenu);
|
subMenu = CreateSkinMenu(meterWindow, 0, configMenu);
|
||||||
InsertMenu(subMenu, 9, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
InsertMenu(subMenu, 9, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||||
InsertMenu(subMenu, 10, MF_BYPOSITION | MF_POPUP, (UINT_PTR)rainmeterMenu, L"Rainmeter Menu");
|
InsertMenu(subMenu, 10, MF_BYPOSITION | MF_POPUP, (UINT_PTR)rainmeterMenu, L"Rainmeter Menu");
|
||||||
|
|
||||||
|
RemoveMenu(rainmeterMenu, ID_CONTEXT_DOWNLOADS, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InsertMenu(subMenu, 11, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
InsertMenu(subMenu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||||
|
|
||||||
// Create a menu for all active configs
|
// Create a menu for all active configs
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
||||||
@ -3931,12 +3931,10 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
|||||||
{
|
{
|
||||||
CMeterWindow* mw = ((*iter).second);
|
CMeterWindow* mw = ((*iter).second);
|
||||||
HMENU skinMenu = CreateSkinMenu(mw, index, configMenu);
|
HMENU skinMenu = CreateSkinMenu(mw, index, configMenu);
|
||||||
InsertMenu(subMenu, 11, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str());
|
InsertMenu(subMenu, 12, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str());
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertMenu(subMenu, 1, MF_BYPOSITION, ID_CONTEXT_DOWNLOADS, L"Downloads");
|
|
||||||
|
|
||||||
// Put Update notifications in the Tray menu
|
// Put Update notifications in the Tray menu
|
||||||
if (m_NewVersion)
|
if (m_NewVersion)
|
||||||
{
|
{
|
||||||
@ -3994,15 +3992,16 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HMENU CRainmeter::CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData)
|
HMENU CRainmeter::CreateConfigMenu(HMENU configMenu, std::vector<CONFIGMENU>& configMenuData)
|
||||||
{
|
{
|
||||||
HMENU configMenu = NULL;
|
|
||||||
|
|
||||||
if (!configMenuData.empty())
|
if (!configMenuData.empty())
|
||||||
|
{
|
||||||
|
if (!configMenu)
|
||||||
{
|
{
|
||||||
configMenu = CreatePopupMenu();
|
configMenu = CreatePopupMenu();
|
||||||
bool item = false;
|
}
|
||||||
|
|
||||||
|
bool item = false;
|
||||||
for (int i = 0, j = 0, isize = (int)configMenuData.size(); i < isize; ++i)
|
for (int i = 0, j = 0, isize = (int)configMenuData.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
if (configMenuData[i].index == -1)
|
if (configMenuData[i].index == -1)
|
||||||
@ -4015,7 +4014,7 @@ HMENU CRainmeter::CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData)
|
|||||||
item = false;
|
item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU submenu = CreateConfigMenu(configMenuData[i].children);
|
HMENU submenu = CreateConfigMenu(NULL, configMenuData[i].children);
|
||||||
if (submenu)
|
if (submenu)
|
||||||
{
|
{
|
||||||
InsertMenu(configMenu, i + j, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, configMenuData[i].name.c_str());
|
InsertMenu(configMenu, i + j, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, configMenuData[i].name.c_str());
|
||||||
@ -4028,27 +4027,24 @@ HMENU CRainmeter::CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData)
|
|||||||
item = true;
|
item = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return configMenu;
|
return configMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU CRainmeter::CreateThemeMenu()
|
void CRainmeter::CreateThemeMenu(HMENU themeMenu)
|
||||||
{
|
{
|
||||||
HMENU themeMenu = CreatePopupMenu();
|
if (!m_Themes.empty())
|
||||||
|
{
|
||||||
|
InsertMenu(themeMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||||
|
|
||||||
for (size_t i = 0, isize = m_Themes.size(); i < isize; ++i)
|
for (size_t i = 0, isize = m_Themes.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
AppendMenu(themeMenu, 0, ID_THEME_FIRST + i, m_Themes[i].c_str());
|
InsertMenu(themeMenu, i, MF_BYPOSITION, ID_THEME_FIRST + i, m_Themes[i].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Themes.empty())
|
|
||||||
{
|
|
||||||
AppendMenu(themeMenu, MF_SEPARATOR, 0, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendMenu(themeMenu, 0, ID_CONTEXT_MANAGETHEMES, L"Manage Themes...");
|
|
||||||
|
|
||||||
return themeMenu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu)
|
HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu)
|
||||||
@ -4066,7 +4062,7 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
|||||||
if (skinMenu)
|
if (skinMenu)
|
||||||
{
|
{
|
||||||
// Tick the position
|
// Tick the position
|
||||||
HMENU settingsMenu = GetSubMenu(skinMenu, 0);
|
HMENU settingsMenu = GetSubMenu(skinMenu, 4);
|
||||||
if (settingsMenu)
|
if (settingsMenu)
|
||||||
{
|
{
|
||||||
HMENU posMenu = GetSubMenu(settingsMenu, 0);
|
HMENU posMenu = GetSubMenu(settingsMenu, 0);
|
||||||
@ -4110,7 +4106,6 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
|||||||
CreateMonitorMenu(monitorMenu, meterWindow);
|
CreateMonitorMenu(monitorMenu, meterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Tick the transparency
|
// Tick the transparency
|
||||||
if (!meterWindow->GetNativeTransparency())
|
if (!meterWindow->GetNativeTransparency())
|
||||||
@ -4184,30 +4179,39 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
|||||||
{
|
{
|
||||||
CheckMenuItem(settingsMenu, ID_CONTEXT_SKINMENU_KEEPONSCREEN, MF_BYCOMMAND | MF_CHECKED);
|
CheckMenuItem(settingsMenu, ID_CONTEXT_SKINMENU_KEEPONSCREEN, MF_BYCOMMAND | MF_CHECKED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the name of the Skin to the menu and disable the item
|
// Add the name of the Skin to the menu
|
||||||
const std::wstring& skinName = meterWindow->GetSkinName();
|
const std::wstring& skinName = meterWindow->GetSkinName();
|
||||||
InsertMenu(skinMenu, 0, MF_BYPOSITION, ID_CONTEXT_SKINMENU_OPENSKINSFOLDER, skinName.c_str());
|
ModifyMenu(skinMenu, ID_CONTEXT_SKINMENU_OPENSKINSFOLDER, MF_BYCOMMAND, ID_CONTEXT_SKINMENU_OPENSKINSFOLDER, skinName.c_str());
|
||||||
InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
SetMenuDefaultItem(skinMenu, ID_CONTEXT_SKINMENU_OPENSKINSFOLDER, FALSE);
|
||||||
SetMenuDefaultItem(skinMenu, 0, MF_BYPOSITION);
|
|
||||||
|
|
||||||
|
// Remove dummy menuitem from the variants menu
|
||||||
|
HMENU variantsMenu = GetSubMenu(skinMenu, 2);
|
||||||
|
if (variantsMenu)
|
||||||
|
{
|
||||||
|
RemoveMenu(variantsMenu, 0, MF_BYPOSITION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give the menuitem the unique id that depends on the skin
|
||||||
ChangeSkinIndex(skinMenu, index);
|
ChangeSkinIndex(skinMenu, index);
|
||||||
|
|
||||||
// Add the variants menu
|
// Add the variants menu
|
||||||
|
if (variantsMenu)
|
||||||
|
{
|
||||||
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
const CONFIG& config = m_ConfigStrings[i];
|
const CONFIG& config = m_ConfigStrings[i];
|
||||||
if (_wcsicmp(config.config.c_str(), skinName.c_str()) == 0)
|
if (_wcsicmp(config.config.c_str(), skinName.c_str()) == 0)
|
||||||
{
|
{
|
||||||
HMENU variantsMenu = CreatePopupMenu();
|
|
||||||
for (int j = 0, jsize = (int)config.iniFiles.size(); j < jsize; ++j)
|
for (int j = 0, jsize = (int)config.iniFiles.size(); j < jsize; ++j)
|
||||||
{
|
{
|
||||||
InsertMenu(variantsMenu, j, MF_BYPOSITION | ((config.active == j + 1) ? MF_CHECKED : MF_UNCHECKED), config.commands[j], config.iniFiles[j].c_str());
|
InsertMenu(variantsMenu, j, MF_BYPOSITION | ((config.active == j + 1) ? MF_CHECKED : MF_UNCHECKED), config.commands[j], config.iniFiles[j].c_str());
|
||||||
}
|
}
|
||||||
InsertMenu(skinMenu, 2, MF_BYPOSITION | MF_POPUP, (UINT_PTR)variantsMenu, L"Variants");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add config's root menu
|
// Add config's root menu
|
||||||
int itemCount = GetMenuItemCount(configMenu);
|
int itemCount = GetMenuItemCount(configMenu);
|
||||||
@ -4234,7 +4238,6 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
|||||||
if (configRootMenu)
|
if (configRootMenu)
|
||||||
{
|
{
|
||||||
InsertMenu(skinMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)configRootMenu, root.c_str());
|
InsertMenu(skinMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)configRootMenu, root.c_str());
|
||||||
InsertMenu(skinMenu, 4, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -272,8 +272,8 @@ private:
|
|||||||
HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu);
|
HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu);
|
||||||
void ChangeSkinIndex(HMENU subMenu, int index);
|
void ChangeSkinIndex(HMENU subMenu, int index);
|
||||||
int ScanForConfigsRecursive(const std::wstring& path, std::wstring base, int index, std::vector<CONFIGMENU>& menu, bool DontRecurse);
|
int ScanForConfigsRecursive(const std::wstring& path, std::wstring base, int index, std::vector<CONFIGMENU>& menu, bool DontRecurse);
|
||||||
HMENU CreateConfigMenu(std::vector<CONFIGMENU>& configMenuData);
|
HMENU CreateConfigMenu(HMENU configMenu, std::vector<CONFIGMENU>& configMenuData);
|
||||||
HMENU CreateThemeMenu();
|
void CreateThemeMenu(HMENU themeMenu);
|
||||||
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
|
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
|
||||||
void CreateDefaultConfigFile(const std::wstring& strFile);
|
void CreateDefaultConfigFile(const std::wstring& strFile);
|
||||||
void SetLogging(bool logging);
|
void SetLogging(bool logging);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user