diff --git a/Library/CommandHandler.cpp b/Library/CommandHandler.cpp index b11fee24..1f4ec2d4 100644 --- a/Library/CommandHandler.cpp +++ b/Library/CommandHandler.cpp @@ -712,7 +712,21 @@ void CommandHandler::DoAboutBang(std::vector& args, MeterWindow* m void CommandHandler::DoManageBang(std::vector& args, MeterWindow* meterWindow) { - DialogManage::Open(args.empty() ? L"" : args[0].c_str()); + 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& args, MeterWindow* skin) diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 9c714f62..84c02272 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -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); } diff --git a/Library/DialogManage.h b/Library/DialogManage.h index 11fc1980..c23e1a73 100644 --- a/Library/DialogManage.h +++ b/Library/DialogManage.h @@ -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);