mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Improved r1034 fix
- Minor tweaks
This commit is contained in:
parent
1ec1809c75
commit
b26dafc46f
@ -57,7 +57,7 @@ CDialog::~CDialog()
|
|||||||
** Enables RTL layout.
|
** Enables RTL layout.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialog::SetRTL()
|
void CDialog::SetDialogRTL()
|
||||||
{
|
{
|
||||||
SetWindowLong(m_Window, GWL_EXSTYLE, GetWindowLong(m_Window, GWL_EXSTYLE) | WS_EX_LAYOUTRTL);
|
SetWindowLong(m_Window, GWL_EXSTYLE, GetWindowLong(m_Window, GWL_EXSTYLE) | WS_EX_LAYOUTRTL);
|
||||||
}
|
}
|
||||||
@ -91,7 +91,8 @@ BOOL CALLBACK CDialog::SetFontProc(HWND hWnd, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CTab::CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc) : CDialog(CreateDialog(instance, MAKEINTRESOURCE(tabId), owner, tabProc)),
|
CDialog::CTab::CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc) :
|
||||||
|
m_Window(CreateDialog(instance, MAKEINTRESOURCE(tabId), owner, tabProc)),
|
||||||
m_Initialized(false)
|
m_Initialized(false)
|
||||||
{
|
{
|
||||||
EnableThemeDialogTexture(m_Window, ETDT_ENABLETAB);
|
EnableThemeDialogTexture(m_Window, ETDT_ENABLETAB);
|
||||||
@ -103,7 +104,23 @@ CTab::CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc) : CDialo
|
|||||||
** Destructor.
|
** Destructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CTab::~CTab()
|
CDialog::CTab::~CTab()
|
||||||
{
|
{
|
||||||
DestroyWindow(m_Window);
|
DestroyWindow(m_Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Activate
|
||||||
|
**
|
||||||
|
** Activates the tab.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void CDialog::CTab::Activate()
|
||||||
|
{
|
||||||
|
if (!m_Initialized)
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
BringWindowToTop(m_Window);
|
||||||
|
}
|
||||||
|
@ -25,11 +25,28 @@ public:
|
|||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
class CTab
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HWND GetWindow() { return m_Window; }
|
||||||
|
bool IsInitialized() { return m_Initialized; }
|
||||||
|
void Activate();
|
||||||
|
|
||||||
|
virtual void Initialize() {}
|
||||||
|
virtual void Resize(int w, int h) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc);
|
||||||
|
virtual ~CTab();
|
||||||
|
|
||||||
|
HWND m_Window;
|
||||||
|
bool m_Initialized;
|
||||||
|
};
|
||||||
|
|
||||||
CDialog(HWND wnd);
|
CDialog(HWND wnd);
|
||||||
virtual ~CDialog();
|
virtual ~CDialog();
|
||||||
|
|
||||||
void SetRTL();
|
void SetDialogRTL();
|
||||||
|
|
||||||
void SetDialogFont();
|
void SetDialogFont();
|
||||||
|
|
||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
@ -40,19 +57,4 @@ private:
|
|||||||
static BOOL CALLBACK SetFontProc(HWND hWnd, LPARAM lParam);
|
static BOOL CALLBACK SetFontProc(HWND hWnd, LPARAM lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTab : public CDialog
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool IsInitialized() { return m_Initialized; }
|
|
||||||
|
|
||||||
virtual void Initialize() {}
|
|
||||||
virtual void Resize(int w, int h) {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc);
|
|
||||||
virtual ~CTab();
|
|
||||||
|
|
||||||
bool m_Initialized;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -247,7 +247,7 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
|
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
|
||||||
{
|
{
|
||||||
// Use RTL layout if using a RTL language
|
// Use RTL layout if using a RTL language
|
||||||
SetRTL();
|
SetDialogRTL();
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND item = GetDlgItem(m_Window, IDC_ABOUT_TAB);
|
HWND item = GetDlgItem(m_Window, IDC_ABOUT_TAB);
|
||||||
@ -302,32 +302,22 @@ INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
case IDC_ABOUT_TAB:
|
case IDC_ABOUT_TAB:
|
||||||
if (nm->code == TCN_SELCHANGE)
|
if (nm->code == TCN_SELCHANGE)
|
||||||
{
|
{
|
||||||
CTab* tab;
|
|
||||||
int sel = TabCtrl_GetCurSel(nm->hwndFrom);
|
int sel = TabCtrl_GetCurSel(nm->hwndFrom);
|
||||||
if (sel == 0)
|
if (sel == 0)
|
||||||
{
|
{
|
||||||
tab = &m_TabLog;
|
m_TabLog.Activate();
|
||||||
}
|
}
|
||||||
else if (sel == 1)
|
else if (sel == 1)
|
||||||
{
|
{
|
||||||
tab = &m_TabMeasures;
|
m_TabMeasures.Activate();
|
||||||
}
|
}
|
||||||
else if (sel == 2)
|
else if (sel == 2)
|
||||||
{
|
{
|
||||||
tab = &m_TabPlugins;
|
m_TabPlugins.Activate();
|
||||||
}
|
}
|
||||||
else // if (sel == 3)
|
else // if (sel == 3)
|
||||||
{
|
{
|
||||||
tab = &m_TabVersion;
|
m_TabVersion.Activate();
|
||||||
}
|
|
||||||
|
|
||||||
if (tab)
|
|
||||||
{
|
|
||||||
if (!tab->IsInitialized())
|
|
||||||
{
|
|
||||||
tab->Initialize();
|
|
||||||
}
|
|
||||||
BringWindowToTop(tab->GetWindow());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -229,7 +229,7 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
|
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
|
||||||
{
|
{
|
||||||
// Use RTL layout if using a RTL language
|
// Use RTL layout if using a RTL language
|
||||||
SetRTL();
|
SetDialogRTL();
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND item = GetDlgItem(m_Window, IDC_MANAGE_TAB);
|
HWND item = GetDlgItem(m_Window, IDC_MANAGE_TAB);
|
||||||
@ -306,28 +306,18 @@ INT_PTR CDialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
case IDC_MANAGE_TAB:
|
case IDC_MANAGE_TAB:
|
||||||
if (nm->code == TCN_SELCHANGE)
|
if (nm->code == TCN_SELCHANGE)
|
||||||
{
|
{
|
||||||
CTab* tab;
|
|
||||||
int sel = TabCtrl_GetCurSel(nm->hwndFrom);
|
int sel = TabCtrl_GetCurSel(nm->hwndFrom);
|
||||||
if (sel == 0)
|
if (sel == 0)
|
||||||
{
|
{
|
||||||
tab = &m_TabSkins;
|
m_TabSkins.Activate();
|
||||||
}
|
}
|
||||||
else if (sel == 1)
|
else if (sel == 1)
|
||||||
{
|
{
|
||||||
tab = &m_TabThemes;
|
m_TabThemes.Activate();
|
||||||
}
|
}
|
||||||
else // if (sel == 2)
|
else // if (sel == 2)
|
||||||
{
|
{
|
||||||
tab = &m_TabSettings;
|
m_TabSettings.Activate();
|
||||||
}
|
|
||||||
|
|
||||||
if (tab)
|
|
||||||
{
|
|
||||||
if (!tab->IsInitialized())
|
|
||||||
{
|
|
||||||
tab->Initialize();
|
|
||||||
}
|
|
||||||
BringWindowToTop(tab->GetWindow());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -477,11 +467,10 @@ void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted)
|
|||||||
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
|
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
|
||||||
TreeView_DeleteAllItems(item);
|
TreeView_DeleteAllItems(item);
|
||||||
|
|
||||||
TV_INSERTSTRUCT tvi = {0};
|
TVINSERTSTRUCT tvi = {0};
|
||||||
tvi.hParent = NULL;
|
tvi.hInsertAfter = TVI_FIRST;
|
||||||
tvi.hInsertAfter = TVI_LAST;
|
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||||
tvi.item.mask= TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
tvi.item.iImage = tvi.item.iSelectedImage = 0;
|
||||||
tvi.item.iImage = tvi.item.iSelectedImage= 0;
|
|
||||||
PopulateTree(item, tvi, Rainmeter->m_ConfigMenu);
|
PopulateTree(item, tvi, Rainmeter->m_ConfigMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,25 +752,24 @@ void CDialogManage::CTabSkins::ReadSkin()
|
|||||||
** Populates the treeview with folders and skins.
|
** Populates the treeview with folders and skins.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::CTabSkins::PopulateTree(HWND tree, TV_INSERTSTRUCT& tvi, const std::vector<CRainmeter::CONFIGMENU>& configMenuData)
|
void CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, const std::vector<CRainmeter::CONFIGMENU>& configMenuData)
|
||||||
{
|
{
|
||||||
for (int i = 0, isize = (int)configMenuData.size(); i < isize; ++i)
|
for (int i = (int)configMenuData.size() - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
const CRainmeter::CONFIGMENU& configMenuS = configMenuData[i];
|
const CRainmeter::CONFIGMENU& configMenuS = configMenuData[i];
|
||||||
|
tvi.item.pszText =(WCHAR*)configMenuS.name.c_str();
|
||||||
if (configMenuS.index == -1)
|
if (configMenuS.index == -1)
|
||||||
{
|
{
|
||||||
tvi.item.iImage = tvi.item.iSelectedImage = 0;
|
tvi.item.iImage = tvi.item.iSelectedImage = 0;
|
||||||
tvi.item.pszText =(WCHAR*)configMenuS.name.c_str();
|
|
||||||
HTREEITEM hOldParent = tvi.hParent;
|
HTREEITEM hOldParent = tvi.hParent;
|
||||||
tvi.hParent = (HTREEITEM)SendMessage(tree, TVM_INSERTITEM, 0, (LPARAM)&tvi);
|
tvi.hParent = (HTREEITEM)TreeView_InsertItem(tree, &tvi);
|
||||||
PopulateTree(tree, tvi, configMenuS.children);
|
PopulateTree(tree, tvi, configMenuS.children);
|
||||||
tvi.hParent = hOldParent;
|
tvi.hParent = hOldParent;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tvi.item.iImage = tvi.item.iSelectedImage = 1;
|
tvi.item.iImage = tvi.item.iSelectedImage = 1;
|
||||||
tvi.item.pszText = (WCHAR*)configMenuS.name.c_str();
|
TreeView_InsertItem(tree, &tvi);
|
||||||
SendMessage(tree, TVM_INSERTITEM, 0, (LPARAM)&tvi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
void DisableControls(bool clear = false);
|
void DisableControls(bool clear = false);
|
||||||
void ReadSkin();
|
void ReadSkin();
|
||||||
|
|
||||||
static void PopulateTree(HWND tree, TV_INSERTSTRUCT& tvi, const std::vector<CRainmeter::CONFIGMENU>& configMenuData);
|
static void PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, const std::vector<CRainmeter::CONFIGMENU>& configMenuData);
|
||||||
|
|
||||||
std::wstring m_FileName;
|
std::wstring m_FileName;
|
||||||
std::wstring m_SkinName;
|
std::wstring m_SkinName;
|
||||||
|
@ -265,7 +265,24 @@ HICON CTrayWindow::CreateTrayIcon(double value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return the default icon if there is no valid measure
|
// Return the default icon if there is no valid measure
|
||||||
return (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
|
HINSTANCE hExe = GetModuleHandle(NULL);
|
||||||
|
HINSTANCE hComctl = GetModuleHandle(L"Comctl32");
|
||||||
|
if (hComctl)
|
||||||
|
{
|
||||||
|
// Try LoadIconMetric for better quality with high DPI
|
||||||
|
FPLOADICONMETRIC loadIconMetric = (FPLOADICONMETRIC)GetProcAddress(hComctl, "LoadIconMetric");
|
||||||
|
if (loadIconMetric)
|
||||||
|
{
|
||||||
|
HICON icon;
|
||||||
|
HRESULT hr = loadIconMetric(hExe, MAKEINTRESOURCE(IDI_RAINMETER), LIM_SMALL, &icon);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (HICON)LoadImage(hExe, MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
typedef HRESULT (WINAPI * FPLOADICONMETRIC)(HINSTANCE hinst, PCWSTR pszName, int lims, HICON* phico);
|
||||||
|
|
||||||
#define WM_TRAY_DELAYED_REFRESH_ALL WM_APP + 0
|
#define WM_TRAY_DELAYED_REFRESH_ALL WM_APP + 0
|
||||||
#define WM_TRAY_DELAYED_EXECUTE WM_APP + 1
|
#define WM_TRAY_DELAYED_EXECUTE WM_APP + 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user