Cosmetic changes.

This commit is contained in:
spx 2012-02-21 19:15:10 +00:00
parent bcb2326d33
commit bb865ec514
5 changed files with 55 additions and 56 deletions

View File

@ -284,12 +284,7 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
break;
case IDC_EDITSETTINGS_BUTTON:
{
std::wstring command = Rainmeter->GetConfigEditor() + L" \"";
command += Rainmeter->GetIniFile();
command += L'"';
RunCommand(Rainmeter->GetTrayWindow()->GetWindow(), command.c_str(), SW_SHOWNORMAL);
}
Rainmeter->EditSettings();
break;
case IDC_OPENLOG_BUTTON:
@ -918,19 +913,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
break;
case IDC_MANAGESKINS_EDIT_BUTTON:
{
std::wstring command = Rainmeter->GetSkinPath() + m_SkinName;
command += L'\\';
command += m_FileName;
bool writable = CSystem::IsFileWritable(command.c_str());
command.insert(0, L" \"");
command.insert(0, Rainmeter->GetConfigEditor());
command += L'"';
// Execute as admin if in protected location
RunCommand(NULL, command.c_str(), SW_SHOWNORMAL, !writable);
}
Rainmeter->EditSkinFile(m_SkinName, m_FileName);
break;
case IDC_MANAGESKINS_X_TEXT:
@ -1113,10 +1096,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
case IDM_MANAGESKINSMENU_OPENFOLDER:
{
HWND tree = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
std::wstring command = L'"' + Rainmeter->GetSkinPath();
command += GetTreeSelectionPath(tree);
command += L'"';
RunCommand(NULL, command.c_str(), SW_SHOWNORMAL);
Rainmeter->OpenSkinFolder(GetTreeSelectionPath(tree));
}
break;
@ -1743,10 +1723,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
break;
case IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON:
{
std::wstring command = Rainmeter->GetLogViewer() + Rainmeter->GetLogFile();
RunCommand(NULL, command.c_str(), SW_SHOWNORMAL);
}
Rainmeter->ShowLogFile();
break;
case IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON:

View File

@ -3408,17 +3408,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (wParam == IDM_SKIN_EDITSKIN)
{
std::wstring command = m_Rainmeter->GetSkinPath() + m_SkinName;
command += L'\\';
command += m_SkinIniFile;
bool writable = CSystem::IsFileWritable(command.c_str());
command.insert(0, L" \"");
command.insert(0, m_Rainmeter->GetConfigEditor());
command += L'"';
// Execute as admin if in protected location
RunCommand(NULL, command.c_str(), SW_SHOWNORMAL, !writable);
m_Rainmeter->EditSkinFile(m_SkinName, m_SkinIniFile);
}
else if (wParam == IDM_SKIN_REFRESH)
{
@ -3426,10 +3416,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
else if (wParam == IDM_SKIN_OPENSKINSFOLDER)
{
std::wstring command = L'"' + m_Rainmeter->GetSkinPath();
command += m_SkinName;
command += L'"';
RunCommand(NULL, command.c_str(), SW_SHOWNORMAL);
m_Rainmeter->OpenSkinFolder(m_SkinName);
}
else if (wParam == IDM_SKIN_MANAGESKIN)
{

View File

@ -1145,6 +1145,37 @@ void CRainmeter::ReloadSettings()
ReadGeneralSettings(m_IniFile);
}
void CRainmeter::EditSettings()
{
std::wstring command = m_ConfigEditor + L" \"";
command += m_IniFile;
command += L'"';
RunCommand(m_Window, command.c_str(), SW_SHOWNORMAL);
}
void CRainmeter::EditSkinFile(const std::wstring& name, const std::wstring& iniFile)
{
std::wstring command = m_SkinPath + name;
command += L'\\';
command += iniFile;
bool writable = CSystem::IsFileWritable(command.c_str());
command.insert(0, L" \"");
command.insert(0, m_ConfigEditor);
command += L'"';
// Execute as admin if in protected location
RunCommand(m_Window, command.c_str(), SW_SHOWNORMAL, !writable);
}
void CRainmeter::OpenSkinFolder(const std::wstring& name)
{
std::wstring command = L'"' + m_SkinPath;
if (!name.empty()) command += name;
command += L'"';
RunCommand(m_Window, command.c_str(), SW_SHOWNORMAL);
}
void CRainmeter::ActivateActiveConfigs()
{
std::multimap<int, int>::const_iterator iter = m_ConfigOrders.begin();
@ -3031,6 +3062,17 @@ void CRainmeter::StopLogging()
SetLogging(false);
}
void CRainmeter::ShowLogFile()
{
// Check if the file exists
if (_waccess(m_LogFile.c_str(), 0) != -1)
{
std::wstring command = m_LogViewer + L" ";
command += m_LogFile;
RunCommand(m_Window, command.c_str(), SW_SHOWNORMAL);
}
}
void CRainmeter::DeleteLogFile()
{
// Check if the file exists

View File

@ -173,6 +173,9 @@ public:
GlobalConfig& GetGlobalConfig() { return m_GlobalConfig; }
void ReloadSettings();
void EditSettings();
void EditSkinFile(const std::wstring& name, const std::wstring& iniFile);
void OpenSkinFolder(const std::wstring& name = std::wstring());
void UpdateStats();
void ReadStats();
@ -187,6 +190,7 @@ public:
bool GetLogging() { return m_Logging; }
void StartLogging();
void StopLogging();
void ShowLogFile();
void DeleteLogFile();
bool GetDisableRDP() { return m_DisableRDP; }

View File

@ -438,13 +438,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
else if (wParam == IDM_SHOWLOGFILE)
{
// Check if the file exists
const std::wstring& log = Rainmeter->GetLogFile();
if (_waccess(log.c_str(), 0) != -1)
{
std::wstring command = Rainmeter->GetLogViewer() + log;
RunCommand(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
}
Rainmeter->ShowLogFile();
}
else if (wParam == IDM_STARTLOG)
{
@ -468,10 +462,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
else if (wParam == IDM_EDITCONFIG)
{
std::wstring command = Rainmeter->GetConfigEditor() + L" \"";
command += Rainmeter->GetIniFile();
command += L'"';
RunCommand(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
Rainmeter->EditSettings();
}
else if (wParam == IDM_QUIT)
{
@ -479,9 +470,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
}
else if (wParam == IDM_OPENSKINSFOLDER)
{
std::wstring command = L'"' + Rainmeter->GetSkinPath();
command += L'"';
RunCommand(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
Rainmeter->OpenSkinFolder();
}
else if ((wParam & 0x0ffff) >= ID_THEME_FIRST && (wParam & 0x0ffff) <= ID_THEME_LAST)
{