mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added optional parameters to the "!Manage" bang for the "Skins" tab.
Usage: !Manage Skins Config File (both "Config" and "File" are optional). Example: !Manage Skins "illustro\Clock" "Clock.ini" To use the "File" parameter, you must specify a "Config" parameter as well.
This commit is contained in:
parent
dfc804d50e
commit
eca5dd0010
@ -712,7 +712,21 @@ void CommandHandler::DoAboutBang(std::vector<std::wstring>& args, MeterWindow* m
|
||||
|
||||
void CommandHandler::DoManageBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||
{
|
||||
const size_t argsSize = args.size();
|
||||
if (argsSize >= 2 && argsSize <= 3)
|
||||
{
|
||||
DialogManage::OpenSkin(args[0].c_str(),
|
||||
args[1].c_str(),
|
||||
(argsSize == 3) ? args[2].c_str() : L"");
|
||||
}
|
||||
else if (argsSize == 1)
|
||||
{
|
||||
DialogManage::Open(args.empty() ? L"" : args[0].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
LogErrorF(meterWindow, L"!Manage: Invalid parameters");
|
||||
}
|
||||
}
|
||||
|
||||
void CommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||
|
@ -117,6 +117,40 @@ void DialogManage::OpenSkin(MeterWindow* meterWindow)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Opens the Manage dialog Skins tab with config and/or skin selected.
|
||||
**
|
||||
*/
|
||||
void DialogManage::OpenSkin(const WCHAR* tabName, const WCHAR* param1, const WCHAR* param2)
|
||||
{
|
||||
Open(tabName);
|
||||
|
||||
if (c_Dialog)
|
||||
{
|
||||
// Make sure "Skins" was defined in the bang
|
||||
if (_wcsicmp(tabName, L"Skins") == 0)
|
||||
{
|
||||
// For "Skins":
|
||||
// |param1| represents the config (ie. "illustro\Clock")
|
||||
// |param2| represents the file (ie. "Clock.ini")
|
||||
|
||||
std::wstring name = param1;
|
||||
|
||||
// Allow just a config to be selected
|
||||
if (param2)
|
||||
{
|
||||
name += L'\\';
|
||||
name += param2;
|
||||
}
|
||||
|
||||
HWND item = c_Dialog->m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView);
|
||||
c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
|
||||
}
|
||||
// Future use: Allow optional params for different tabs
|
||||
//else if (_wcsicmp(tabName, L"Layouts") == 0)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Updates Skins tab.
|
||||
**
|
||||
@ -949,6 +983,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n
|
||||
if ((item = TreeView_GetChild(tree, tvi.hItem)) != nullptr)
|
||||
{
|
||||
TreeView_Expand(tree, tvi.hItem, TVE_EXPAND);
|
||||
TreeView_Select(tree, tvi.hItem, TVGN_CARET);
|
||||
++pos; // Skip the slash
|
||||
SelectTreeItem(tree, item, pos);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
static void Open(const WCHAR* name);
|
||||
static void Open(int tab = 0);
|
||||
static void OpenSkin(MeterWindow* meterWindow);
|
||||
static void OpenSkin(const WCHAR* tabName, const WCHAR* param1, const WCHAR* param2);
|
||||
|
||||
static void UpdateSkins(MeterWindow* meterWindow, bool deleted = false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user