Manage Layouts: Fix missing entries in the displayed list of layouts

This fixes http://rainmeter.net/forum/viewtopic.php?p=101697
This commit is contained in:
Birunthan Mohanathas 2014-07-12 15:50:26 -07:00
parent 6eafb835ad
commit 1cf0212e87
3 changed files with 20 additions and 5 deletions

View File

@ -149,10 +149,6 @@ void DialogManage::Open(const WCHAR* tabName, const WCHAR* param1, const WCHAR*
} }
} }
/*
** Updates Skins tab.
**
*/
void DialogManage::UpdateSkins(MeterWindow* meterWindow, bool deleted) void DialogManage::UpdateSkins(MeterWindow* meterWindow, bool deleted)
{ {
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized()) if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
@ -161,6 +157,14 @@ void DialogManage::UpdateSkins(MeterWindow* meterWindow, bool deleted)
} }
} }
void DialogManage::UpdateLayouts()
{
if (c_Dialog && c_Dialog->m_TabLayouts.IsInitialized())
{
c_Dialog->m_TabLayouts.Update();
}
}
Dialog::Tab& DialogManage::GetActiveTab() Dialog::Tab& DialogManage::GetActiveTab()
{ {
int sel = TabCtrl_GetCurSel(GetControl(Id_Tab)); int sel = TabCtrl_GetCurSel(GetControl(Id_Tab));
@ -1580,7 +1584,8 @@ void DialogManage::TabLayouts::Create(HWND owner)
void DialogManage::TabLayouts::Initialize() void DialogManage::TabLayouts::Initialize()
{ {
HWND item = GetControl(Id_List); HWND item = GetControl(Id_List);
ListBox_ResetContent(item);
const std::vector<std::wstring>& layouts = GetRainmeter().GetAllLayouts(); const std::vector<std::wstring>& layouts = GetRainmeter().GetAllLayouts();
for (size_t i = 0, isize = layouts.size(); i < isize; ++i) for (size_t i = 0, isize = layouts.size(); i < isize; ++i)
{ {
@ -1590,6 +1595,11 @@ void DialogManage::TabLayouts::Initialize()
m_Initialized = true; m_Initialized = true;
} }
void DialogManage::TabLayouts::Update()
{
Initialize();
}
INT_PTR DialogManage::TabLayouts::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR DialogManage::TabLayouts::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) switch (uMsg)

View File

@ -39,6 +39,7 @@ public:
static void OpenSkin(MeterWindow* meterWindow); static void OpenSkin(MeterWindow* meterWindow);
static void UpdateSkins(MeterWindow* meterWindow, bool deleted = false); static void UpdateSkins(MeterWindow* meterWindow, bool deleted = false);
static void UpdateLayouts();
protected: protected:
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
@ -132,6 +133,8 @@ private:
void Create(HWND owner); void Create(HWND owner);
virtual void Initialize(); virtual void Initialize();
void Update();
protected: protected:
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam); INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);

View File

@ -1215,6 +1215,8 @@ void Rainmeter::ScanForLayouts()
FindClose(hSearch); FindClose(hSearch);
} }
DialogManage::UpdateLayouts();
} }
void Rainmeter::ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args, MeterWindow* meterWindow) void Rainmeter::ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args, MeterWindow* meterWindow)