mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added SkinPath, ConfigEditor, and TrayIcon to Manage/Settings dialog
Also added Help button to Manage dialog
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "DialogManage.h"
|
||||
#include "DialogAbout.h"
|
||||
#include "../Version.h"
|
||||
#include <Commdlg.h>
|
||||
|
||||
#define WM_DELAYED_CLOSE WM_APP + 0
|
||||
|
||||
@@ -267,6 +268,28 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
PostMessage(m_Window, WM_DELAYED_CLOSE, 0, 0);
|
||||
break;
|
||||
|
||||
case IDC_MANAGE_HELP_BUTTON:
|
||||
{
|
||||
std::wstring url = L"http://docs.rainmeter.net/";
|
||||
|
||||
HWND hwnd = c_Dialog->GetActiveTabWindow();
|
||||
if (hwnd == m_TabSkins.GetWindow())
|
||||
{
|
||||
url.append(L"manual/user-interface/manage#SkinsTab");
|
||||
}
|
||||
else if (hwnd == m_TabLayouts.GetWindow())
|
||||
{
|
||||
url.append(L"/manual/user-interface/manage#LayoutsTab");
|
||||
}
|
||||
else if (hwnd == m_TabSettings.GetWindow())
|
||||
{
|
||||
url.append(L"/manual/user-interface/manage#SettingsTab");
|
||||
}
|
||||
|
||||
ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1649,6 +1672,12 @@ void CDialogManage::CTabSettings::Initialize()
|
||||
BOOL isLogFile = (_waccess(Rainmeter->GetLogFile().c_str(), 0) != -1);
|
||||
EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON), isLogFile);
|
||||
EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON), isLogFile);
|
||||
|
||||
Edit_SetText(GetDlgItem(m_Window, IDC_MANAGESETTINGS_SKINPATH_TEXT), Rainmeter->GetSkinPath().c_str());
|
||||
Edit_SetText(GetDlgItem(m_Window, IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT), Rainmeter->GetSkinEditor().c_str());
|
||||
|
||||
bool iconEnabled = Rainmeter->GetTrayWindow()->IsTrayIconEnabled();
|
||||
Button_SetCheck(GetDlgItem(m_Window, IDC_MANAGESETTINGS_TRAYICON_CHECKBOX), iconEnabled);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1762,9 +1791,78 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
Rainmeter->SetDebug(!Rainmeter->GetDebug());
|
||||
break;
|
||||
|
||||
case IDC_MANAGESETTINGS_SKINPATH_TEXT:
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
{
|
||||
WCHAR buffer[MAX_LINE_LENGTH];
|
||||
std::wstring skinPath = (GetWindowText((HWND)lParam, buffer, MAX_LINE_LENGTH) > 0) ? buffer : Rainmeter->GetSkinPath();
|
||||
Rainmeter->SetSkinPath(skinPath);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MANAGESETTINGS_SKINPATH_BUTTON:
|
||||
{
|
||||
WCHAR buffer[MAX_PATH];
|
||||
WCHAR* temp;
|
||||
BROWSEINFO bi = {0};
|
||||
bi.hwndOwner = c_Dialog->GetWindow();
|
||||
bi.lpszTitle = L"Select a new Skins folder:\r\n\r\nNote: Changes take place next time you load Rainmeter.";
|
||||
bi.ulFlags = BIF_USENEWUI | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
|
||||
|
||||
PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&bi);
|
||||
if (pidl && SHGetPathFromIDList(pidl, buffer))
|
||||
{
|
||||
temp = wcscat(buffer, L"\\");
|
||||
Edit_SetText(GetDlgItem(m_Window, IDC_MANAGESETTINGS_SKINPATH_TEXT), temp);
|
||||
CoTaskMemFree(pidl);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT:
|
||||
if (HIWORD(wParam) == EN_CHANGE)
|
||||
{
|
||||
WCHAR buffer[MAX_LINE_LENGTH];
|
||||
std::wstring editor = (GetWindowText((HWND)lParam, buffer, MAX_LINE_LENGTH) > 0) ? buffer : L"";
|
||||
Rainmeter->SetSkinEditor(editor);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MANAGESETTINGS_CONFIGEDITOR_BUTTON:
|
||||
{
|
||||
WCHAR buffer[MAX_PATH];
|
||||
buffer[0] = L'\0';
|
||||
|
||||
std::wstring editor = Rainmeter->GetSkinEditor();
|
||||
editor = editor.substr(0, editor.find_last_of(L"/\\")).c_str();
|
||||
|
||||
OPENFILENAME ofn = { sizeof(OPENFILENAME) };
|
||||
ofn.Flags = OFN_FILEMUSTEXIST;
|
||||
ofn.lpstrFilter = L"Executable File (.exe)\0*.exe";
|
||||
ofn.lpstrTitle = L"Select executable file";
|
||||
ofn.lpstrDefExt = L"exe";
|
||||
ofn.lpstrInitialDir = editor.c_str();
|
||||
ofn.nFilterIndex = 0;
|
||||
ofn.lpstrFile = buffer;
|
||||
ofn.nMaxFile = _countof(buffer);
|
||||
ofn.hwndOwner = c_Dialog->GetWindow();
|
||||
|
||||
if (!GetOpenFileName(&ofn))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Edit_SetText(GetDlgItem(m_Window, IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT), buffer);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MANAGESETTINGS_TRAYICON_CHECKBOX:
|
||||
Rainmeter->GetTrayWindow()->SetTrayIcon(!Rainmeter->GetTrayWindow()->IsTrayIconEnabled());
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,6 @@ private:
|
||||
virtual void Initialize();
|
||||
|
||||
static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
||||
@@ -1498,6 +1498,30 @@ void CRainmeter::ToggleSkin(int folderIndex, int fileIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void CRainmeter::SetSkinPath(std::wstring skinPath)
|
||||
{
|
||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", skinPath.c_str(), m_IniFile.c_str());
|
||||
}
|
||||
|
||||
void CRainmeter::SetSkinEditor(std::wstring editor)
|
||||
{
|
||||
LPCWSTR tmp = editor.empty() ? NULL : editor.c_str();
|
||||
if (!tmp)
|
||||
{
|
||||
// Get the program path associated with .ini files
|
||||
WCHAR buffer[MAX_PATH];
|
||||
DWORD cchOut = MAX_PATH;
|
||||
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".ini", L"open", buffer, &cchOut);
|
||||
m_SkinEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SkinEditor = editor;
|
||||
}
|
||||
|
||||
WritePrivateProfileString(L"Rainmeter", L"ConfigEditor", tmp, m_IniFile.c_str());
|
||||
}
|
||||
|
||||
void CRainmeter::WriteActive(const std::wstring& folderPath, int fileIndex)
|
||||
{
|
||||
WCHAR buffer[32];
|
||||
|
||||
@@ -138,6 +138,7 @@ public:
|
||||
const std::wstring& GetLogFile() { return m_LogFile; }
|
||||
const std::wstring& GetSettingsPath() { return m_SettingsPath; }
|
||||
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
||||
void SetSkinPath(std::wstring skinPath);
|
||||
std::wstring GetLayoutPath() { return m_SettingsPath + L"Layouts\\"; }
|
||||
std::wstring GetPluginPath() { return m_Path + L"Plugins\\"; }
|
||||
std::wstring GetUserPluginPath() { return m_SettingsPath + L"Plugins\\"; }
|
||||
@@ -153,6 +154,7 @@ public:
|
||||
const std::wstring& GetDrive() { return m_Drive; }
|
||||
|
||||
const std::wstring& GetSkinEditor() { return m_SkinEditor; }
|
||||
void SetSkinEditor(std::wstring editor);
|
||||
const std::wstring& GetStatsDate() { return m_StatsDate; }
|
||||
|
||||
HWND GetWindow() { return m_Window; }
|
||||
|
||||
@@ -333,6 +333,25 @@ void CTrayWindow::ShowUpdateNotification(const WCHAR* newVersion)
|
||||
ShowNotification(TRAY_NOTIFICATION_UPDATE, GetString(ID_STR_UPDATEAVAILABLE), text.c_str());
|
||||
}
|
||||
|
||||
void CTrayWindow::SetTrayIcon(bool state)
|
||||
{
|
||||
std::wstring iniFile = Rainmeter->GetIniFile();
|
||||
|
||||
if (state)
|
||||
{
|
||||
// Delete the key from Rainmeter.ini
|
||||
WritePrivateProfileString(L"Rainmeter", L"TrayIcon", NULL, iniFile.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
WritePrivateProfileString(L"Rainmeter", L"TrayIcon", L"0", iniFile.c_str());
|
||||
}
|
||||
|
||||
CConfigParser parser;
|
||||
parser.Initialize(iniFile, NULL, NULL);
|
||||
ReadOptions(parser);
|
||||
}
|
||||
|
||||
void CTrayWindow::ReadOptions(CConfigParser& parser)
|
||||
{
|
||||
// Clear old Settings
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void ReadOptions(CConfigParser& parser);
|
||||
HWND GetWindow() { return m_Window; }
|
||||
bool IsTrayIconEnabled() { return m_IconEnabled; }
|
||||
void SetTrayIcon(bool state);
|
||||
|
||||
void ShowWelcomeNotification();
|
||||
void ShowUpdateNotification(const WCHAR* newVersion);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define IDC_MANAGE_REFRESHALL_BUTTON 1001
|
||||
#define IDC_MANAGE_EDITSETTINGS_BUTTON 1002
|
||||
#define IDC_MANAGE_OPENLOG_BUTTON 1003
|
||||
#define IDC_MANAGE_HELP_BUTTON 1004
|
||||
|
||||
#define IDC_MANAGESKINS_ACTIVESKINS_BUTTON 1000
|
||||
#define IDC_MANAGESKINS_SKINS_TREEVIEW 1001
|
||||
@@ -90,6 +91,11 @@
|
||||
#define IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON 1005
|
||||
#define IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON 1006
|
||||
#define IDC_MANAGESETTINGS_LANGUAGE_COMBOBOX 1007
|
||||
#define IDC_MANAGESETTINGS_SKINPATH_TEXT 1008
|
||||
#define IDC_MANAGESETTINGS_SKINPATH_BUTTON 1009
|
||||
#define IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT 1010
|
||||
#define IDC_MANAGESETTINGS_CONFIGEDITOR_BUTTON 1011
|
||||
#define IDC_MANAGESETTINGS_TRAYICON_CHECKBOX 1012
|
||||
|
||||
#define ID_STR_ISRTL 2000
|
||||
#define ID_STR_UPDATEAVAILABLE 2001
|
||||
|
||||
Reference in New Issue
Block a user