mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added "Group" option to Measure/Meter to operate Measures/Meters in bulk.
Usage: Group=group1 | group2 | group3 * Concatenate group with the "|" if you'd like to assign multiple groups. - Added !Bangs for Group. (!RainmeterShowMeterGroup, !RainmeterHideMeterGroup, !RainmeterToggleMeterGroup, !RainmeterEnableMeasureGroup, !RainmeterDisableMeasureGroup, !RainmeterToggleMeasureGroup) Usage: !RainmeterShowMeterGroup [group] (Config) !RainmeterHideMeterGroup [group] (Config) !RainmeterToggleMeterGroup [group] (Config) !RainmeterEnableMeasureGroup [group] (Config) !RainmeterDisableMeasureGroup [group] (Config) !RainmeterToggleMeasureGroup [group] (Config) - Modified logging feature. Added new "Logging" menu to the context menu. - Added the manifest to Rainmeter.exe to apply visual style to button etc.
This commit is contained in:
parent
36dfa2c6e5
commit
f61a35a64d
@ -24,6 +24,16 @@
|
||||
#include "resource.h"
|
||||
#include "..\Library\Rainmeter.h"
|
||||
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_IA64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Protos
|
||||
*/
|
||||
|
105
Library/Group.cpp
Normal file
105
Library/Group.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright (C) 2010 spx
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "Group.h"
|
||||
#include "ConfigParser.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
/*
|
||||
** CGroup
|
||||
**
|
||||
** The constructor
|
||||
**
|
||||
*/
|
||||
CGroup::CGroup()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** ~CGroup
|
||||
**
|
||||
** The destructor
|
||||
**
|
||||
*/
|
||||
CGroup::~CGroup()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** InitializeGroup
|
||||
**
|
||||
**
|
||||
*/
|
||||
void CGroup::InitializeGroup(const std::wstring& group)
|
||||
{
|
||||
if (group != m_OldGroup)
|
||||
{
|
||||
m_OldGroup = group;
|
||||
m_Group.clear();
|
||||
|
||||
std::vector<std::wstring> vGroup = CConfigParser::Tokenize(group, L"|");
|
||||
|
||||
std::vector<std::wstring>::const_iterator iter = vGroup.begin();
|
||||
for ( ; iter != vGroup.end(); ++iter)
|
||||
{
|
||||
std::wstring group = CreateGroup(*iter);
|
||||
if (!group.empty())
|
||||
{
|
||||
m_Group.insert(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** BelongsToGroup
|
||||
**
|
||||
**
|
||||
*/
|
||||
bool CGroup::BelongsToGroup(const std::wstring& group)
|
||||
{
|
||||
return (m_Group.find(CreateGroup(group)) != m_Group.end());
|
||||
}
|
||||
|
||||
std::wstring CGroup::CreateGroup(const std::wstring& str)
|
||||
{
|
||||
std::wstring strTmp = str;
|
||||
|
||||
// Trim whitespace
|
||||
std::wstring::size_type pos = strTmp.find_last_not_of(L' ');
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
strTmp.erase(pos + 1);
|
||||
pos = strTmp.find_first_not_of(' ');
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
strTmp.erase(0, pos);
|
||||
}
|
||||
|
||||
// Convert to lower
|
||||
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
||||
}
|
||||
else
|
||||
{
|
||||
strTmp.erase(strTmp.begin(), strTmp.end());
|
||||
}
|
||||
|
||||
return strTmp;
|
||||
}
|
48
Library/Group.h
Normal file
48
Library/Group.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2010 spx
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GROUP_H__
|
||||
#define __GROUP_H__
|
||||
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
class CGroup
|
||||
{
|
||||
public:
|
||||
bool BelongsToGroup(const std::wstring& group);
|
||||
const std::set<std::wstring>& GetGroup() { return m_Group; }
|
||||
|
||||
protected:
|
||||
CGroup();
|
||||
virtual ~CGroup();
|
||||
|
||||
void InitializeGroup(const std::wstring& group);
|
||||
|
||||
private:
|
||||
std::wstring CreateGroup(const std::wstring& str);
|
||||
|
||||
std::set<std::wstring> m_Group;
|
||||
std::wstring m_OldGroup;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -35,7 +35,17 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Edit Settings...", ID_CONTEXT_EDITCONFIG
|
||||
MENUITEM "Refresh All", ID_CONTEXT_REFRESH
|
||||
MENUITEM "Show Log File", ID_CONTEXT_SHOWLOGFILE
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "Logging"
|
||||
BEGIN
|
||||
MENUITEM "Show Log File...", ID_CONTEXT_SHOWLOGFILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Start Logging", ID_CONTEXT_STARTLOG
|
||||
MENUITEM "Stop Logging", ID_CONTEXT_STOPLOG
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Delete Log File...", ID_CONTEXT_DELETELOGFILE
|
||||
MENUITEM "Debug Mode", ID_CONTEXT_DEBUGLOG
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Exit", ID_CONTEXT_QUIT
|
||||
END
|
||||
|
@ -766,6 +766,69 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Group.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release64|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release64|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_UNICODE;UNICODE;_USRDLL;LIBRARY_EXPORTS"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Library.rc"
|
||||
>
|
||||
@ -2820,6 +2883,10 @@
|
||||
RelativePath="Export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Group.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Litestep.h"
|
||||
>
|
||||
|
@ -511,11 +511,11 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
|
||||
// Add timestamp
|
||||
static DWORD startTime = 0;
|
||||
|
||||
DWORD time = GetTickCount();
|
||||
if (startTime == 0)
|
||||
{
|
||||
startTime = GetTickCount();
|
||||
startTime = time;
|
||||
}
|
||||
DWORD time = GetTickCount();
|
||||
WCHAR buffer[MAX_PATH];
|
||||
swprintf(buffer, L"(%02i:%02i:%02i.%03i) ", (time - startTime) / (1000 * 60* 60), ((time - startTime) / (1000 * 60)) % 60, ((time - startTime) / 1000) % 60, (time - startTime) % 1000);
|
||||
|
||||
@ -536,7 +536,7 @@ BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
|
||||
}
|
||||
|
||||
// The stub implementation
|
||||
if (Rainmeter)
|
||||
if (Rainmeter && Rainmeter->GetLogging())
|
||||
{
|
||||
FILE* logFile;
|
||||
std::wstring logfile = Rainmeter->GetLogFile();
|
||||
@ -597,4 +597,4 @@ void DebugLog(const WCHAR* format, ... )
|
||||
_vsnwprintf( buffer, 4096, format, args );
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", buffer);
|
||||
va_end(args);
|
||||
};
|
||||
}
|
||||
|
@ -157,6 +157,9 @@ void CMeasure::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
{
|
||||
DebugLog(L"Incorrect substitute string: %s", subs.c_str());
|
||||
}
|
||||
|
||||
std::wstring group = parser.ReadString(section, L"Group", L"");
|
||||
InitializeGroup(group);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -21,10 +21,11 @@
|
||||
|
||||
#include "MeterWindow.h"
|
||||
#include "Litestep.h"
|
||||
#include "Group.h"
|
||||
|
||||
class CMeter;
|
||||
|
||||
class CMeasure
|
||||
class CMeasure : public CGroup
|
||||
{
|
||||
public:
|
||||
CMeasure(CMeterWindow* meterWindow);
|
||||
|
@ -357,6 +357,9 @@ void CMeter::ReadConfig(const WCHAR* section)
|
||||
DebugLog(L"The transformation matrix has incorrect number of values:", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
|
||||
}
|
||||
|
||||
std::wstring group = parser.ReadString(section, L"Group", L"");
|
||||
InitializeGroup(group);
|
||||
|
||||
/* Are these necessary?
|
||||
if (m_W == 0 || m_H == 0)
|
||||
{
|
||||
|
@ -24,10 +24,11 @@
|
||||
#include <gdiplus.h>
|
||||
#include "Litestep.h"
|
||||
#include "MeterWindow.h"
|
||||
#include "Group.h"
|
||||
|
||||
class CMeasure;
|
||||
|
||||
class CMeter
|
||||
class CMeter : public CGroup
|
||||
{
|
||||
public:
|
||||
CMeter(CMeterWindow* meterWindow);
|
||||
|
@ -612,6 +612,18 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
HideMeter(arg);
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMETERGROUP:
|
||||
ToggleMeter(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_SHOWMETERGROUP:
|
||||
ShowMeter(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_HIDEMETERGROUP:
|
||||
HideMeter(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMEASURE:
|
||||
ToggleMeasure(arg);
|
||||
break;
|
||||
@ -620,6 +632,18 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
EnableMeasure(arg);
|
||||
break;
|
||||
|
||||
case BANG_DISABLEMEASUREGROUP:
|
||||
DisableMeasure(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_TOGGLEMEASUREGROUP:
|
||||
ToggleMeasure(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_ENABLEMEASUREGROUP:
|
||||
EnableMeasure(arg, true);
|
||||
break;
|
||||
|
||||
case BANG_DISABLEMEASURE:
|
||||
DisableMeasure(arg);
|
||||
break;
|
||||
@ -831,22 +855,28 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
||||
** Shows the given meter
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::ShowMeter(const WCHAR* name)
|
||||
void CMeterWindow::ShowMeter(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
(*j)->Show();
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
return;
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*j)->Show();
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to show the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -855,22 +885,28 @@ void CMeterWindow::ShowMeter(const WCHAR* name)
|
||||
** Hides the given meter
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::HideMeter(const WCHAR* name)
|
||||
void CMeterWindow::HideMeter(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
(*j)->Hide();
|
||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
||||
return;
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*j)->Hide();
|
||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to hide the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -879,29 +915,35 @@ void CMeterWindow::HideMeter(const WCHAR* name)
|
||||
** Toggles the given meter
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::ToggleMeter(const WCHAR* name)
|
||||
void CMeterWindow::ToggleMeter(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||
for( ; j != m_Meters.end(); ++j)
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
if ((*j)->IsHidden())
|
||||
{
|
||||
(*j)->Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
(*j)->Hide();
|
||||
}
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
return;
|
||||
if (!(*j)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*j)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
if ((*j)->IsHidden())
|
||||
{
|
||||
(*j)->Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
(*j)->Hide();
|
||||
}
|
||||
m_ResetRegion = true; // Need to recalculate the window region
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to toggle the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -928,27 +970,34 @@ void CMeterWindow::MoveMeter(int x, int y, const WCHAR* name)
|
||||
|
||||
DebugLog(L"Unable to move the meter %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
** EnableMeasure
|
||||
**
|
||||
** Enables the given measure
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::EnableMeasure(const WCHAR* name)
|
||||
void CMeterWindow::EnableMeasure(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
(*i)->Enable();
|
||||
return;
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*i)->Enable();
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to enable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -958,21 +1007,27 @@ void CMeterWindow::EnableMeasure(const WCHAR* name)
|
||||
** Disables the given measure
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::DisableMeasure(const WCHAR* name)
|
||||
void CMeterWindow::DisableMeasure(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
(*i)->Disable();
|
||||
return;
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
(*i)->Disable();
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to disable the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -982,28 +1037,34 @@ void CMeterWindow::DisableMeasure(const WCHAR* name)
|
||||
** Toggless the given measure
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::ToggleMeasure(const WCHAR* name)
|
||||
void CMeterWindow::ToggleMeasure(const WCHAR* name, bool group)
|
||||
{
|
||||
if (name == NULL || wcslen(name) == 0) return;
|
||||
|
||||
std::list<CMeasure*>::const_iterator i = m_Measures.begin();
|
||||
for( ; i != m_Measures.end(); ++i)
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) == 0)
|
||||
if (group)
|
||||
{
|
||||
if ((*i)->IsDisabled())
|
||||
{
|
||||
(*i)->Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->Disable();
|
||||
}
|
||||
return;
|
||||
if (!(*i)->BelongsToGroup(name)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wcsicmp((*i)->GetName(), name) != 0) continue;
|
||||
}
|
||||
|
||||
if ((*i)->IsDisabled())
|
||||
{
|
||||
(*i)->Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->Disable();
|
||||
}
|
||||
if (!group) return;
|
||||
}
|
||||
|
||||
DebugLog(L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
if (!group) DebugLog(L"Unable to toggle the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||
}
|
||||
|
||||
/* WindowToScreen
|
||||
|
@ -95,6 +95,12 @@ enum BANGCOMMAND
|
||||
BANG_TOGGLEMEASURE,
|
||||
BANG_ENABLEMEASURE,
|
||||
BANG_DISABLEMEASURE,
|
||||
BANG_TOGGLEMETERGROUP,
|
||||
BANG_SHOWMETERGROUP,
|
||||
BANG_HIDEMETERGROUP,
|
||||
BANG_TOGGLEMEASUREGROUP,
|
||||
BANG_ENABLEMEASUREGROUP,
|
||||
BANG_DISABLEMEASUREGROUP,
|
||||
BANG_SHOW,
|
||||
BANG_HIDE,
|
||||
BANG_TOGGLE,
|
||||
@ -126,12 +132,12 @@ public:
|
||||
void RunBang(BANGCOMMAND bang, const WCHAR* arg);
|
||||
|
||||
void MoveMeter(int x, int y, const WCHAR* name);
|
||||
void HideMeter(const WCHAR* name);
|
||||
void ShowMeter(const WCHAR* name);
|
||||
void ToggleMeter(const WCHAR* name);
|
||||
void DisableMeasure(const WCHAR* name);
|
||||
void EnableMeasure(const WCHAR* name);
|
||||
void ToggleMeasure(const WCHAR* name);
|
||||
void HideMeter(const WCHAR* name, bool group = false);
|
||||
void ShowMeter(const WCHAR* name, bool group = false);
|
||||
void ToggleMeter(const WCHAR* name, bool group = false);
|
||||
void DisableMeasure(const WCHAR* name, bool group = false);
|
||||
void EnableMeasure(const WCHAR* name, bool group = false);
|
||||
void ToggleMeasure(const WCHAR* name, bool group = false);
|
||||
void Refresh(bool init, bool all = false);
|
||||
void Redraw();
|
||||
|
||||
|
@ -361,6 +361,39 @@ void RainmeterToggleMeter(HWND, const char* arg)
|
||||
BangWithArgs(BANG_TOGGLEMETER, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterHideMeterGroup
|
||||
**
|
||||
** Callback for the !RainmeterHideMeterGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterHideMeterGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_HIDEMETERGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterShowMeterGroup
|
||||
**
|
||||
** Callback for the !RainmeterShowMeterGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterShowMeterGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_SHOWMETERGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterToggleMeterGroup
|
||||
**
|
||||
** Callback for the !RainmeterToggleMeterGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterToggleMeterGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMETERGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterHideMeasure
|
||||
**
|
||||
@ -394,6 +427,39 @@ void RainmeterToggleMeasure(HWND, const char* arg)
|
||||
BangWithArgs(BANG_TOGGLEMEASURE, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterHideMeasureGroup
|
||||
**
|
||||
** Callback for the !RainmeterHideMeasureGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterDisableMeasureGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_DISABLEMEASUREGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterShowMeasureGroup
|
||||
**
|
||||
** Callback for the !RainmeterShowMeasureGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterEnableMeasureGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_ENABLEMEASUREGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterToggleMeasureGroup
|
||||
**
|
||||
** Callback for the !RainmeterToggleMeasureGroup bang
|
||||
**
|
||||
*/
|
||||
void RainmeterToggleMeasureGroup(HWND, const char* arg)
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMEASUREGROUP, ConvertToWide(arg).c_str(), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** RainmeterRefresh
|
||||
**
|
||||
@ -678,6 +744,8 @@ CRainmeter::CRainmeter()
|
||||
|
||||
c_Debug = false;
|
||||
|
||||
m_Logging = false;
|
||||
|
||||
m_DesktopWorkAreaChanged = false;
|
||||
m_DesktopWorkArea.left = m_DesktopWorkArea.top = m_DesktopWorkArea.right = m_DesktopWorkArea.bottom = 0;
|
||||
|
||||
@ -689,8 +757,6 @@ CRainmeter::CRainmeter()
|
||||
|
||||
m_TrayWindow = NULL;
|
||||
|
||||
m_ConfigEditor = L"Notepad";
|
||||
|
||||
INITCOMMONCONTROLSEX initCtrls;
|
||||
initCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
initCtrls.dwICC = ICC_TAB_CLASSES;
|
||||
@ -831,6 +897,22 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
bDefaultIniLocation = true;
|
||||
}
|
||||
|
||||
// Set the log file location
|
||||
m_LogFile = m_IniFile;
|
||||
size_t posExt = m_LogFile.find(L".ini");
|
||||
if (posExt != std::wstring::npos)
|
||||
{
|
||||
m_LogFile.replace(posExt, 4, L".log");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LogFile += L".log"; // Append the extension so that we don't accidentally overwrite the ini file
|
||||
}
|
||||
|
||||
// Read Logging settings beforehand
|
||||
m_Logging = 0!=GetPrivateProfileInt(L"Rainmeter", L"Logging", 0, m_IniFile.c_str());
|
||||
c_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, m_IniFile.c_str());
|
||||
|
||||
m_PluginPath = tmpName;
|
||||
m_PluginPath += L"Plugins\\";
|
||||
m_SkinPath = m_Path + L"Skins\\";
|
||||
@ -883,18 +965,6 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
}
|
||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), m_IniFile.c_str());
|
||||
|
||||
// Set the log file location
|
||||
m_LogFile = m_IniFile;
|
||||
size_t posExt = m_LogFile.find(L".ini");
|
||||
if (posExt != std::wstring::npos)
|
||||
{
|
||||
m_LogFile.replace(posExt, 4, L".log");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LogFile += L".log"; // Append the extension so that we don't accidentally overwrite the ini file
|
||||
}
|
||||
|
||||
if (!c_DummyLitestep)
|
||||
{
|
||||
char tmpSz[MAX_LINE_LENGTH];
|
||||
@ -935,9 +1005,6 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
CheckSkinVersions();
|
||||
}
|
||||
|
||||
// Read Debug first
|
||||
c_Debug = 0!=GetPrivateProfileInt(L"Rainmeter", L"Debug", 0, m_IniFile.c_str());
|
||||
|
||||
CSystem::Initialize(Instance);
|
||||
CMeasureNet::InitializeNewApi();
|
||||
|
||||
@ -1007,6 +1074,12 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
||||
AddBangCommand("!RainmeterDisableMeasure", RainmeterDisableMeasure);
|
||||
AddBangCommand("!RainmeterEnableMeasure", RainmeterEnableMeasure);
|
||||
AddBangCommand("!RainmeterToggleMeasure", RainmeterToggleMeasure);
|
||||
AddBangCommand("!RainmeterHideMeterGroup", RainmeterHideMeterGroup);
|
||||
AddBangCommand("!RainmeterShowMeterGroup", RainmeterShowMeterGroup);
|
||||
AddBangCommand("!RainmeterToggleMeterGroup", RainmeterToggleMeterGroup);
|
||||
AddBangCommand("!RainmeterDisableMeasureGroup", RainmeterDisableMeasureGroup);
|
||||
AddBangCommand("!RainmeterEnableMeasureGroup", RainmeterEnableMeasureGroup);
|
||||
AddBangCommand("!RainmeterToggleMeasureGroup", RainmeterToggleMeasureGroup);
|
||||
AddBangCommand("!RainmeterActivateConfig", RainmeterActivateConfig);
|
||||
AddBangCommand("!RainmeterToggleConfig", RainmeterToggleConfig);
|
||||
AddBangCommand("!RainmeterDeactivateConfig", RainmeterDeactivateConfig);
|
||||
@ -1531,6 +1604,12 @@ void CRainmeter::Quit(HINSTANCE dllInst)
|
||||
RemoveBangCommand("!RainmeterHideMeasure");
|
||||
RemoveBangCommand("!RainmeterShowMeasure");
|
||||
RemoveBangCommand("!RainmeterToggleMeasure");
|
||||
RemoveBangCommand("!RainmeterHideMeterGroup");
|
||||
RemoveBangCommand("!RainmeterShowMeterGroup");
|
||||
RemoveBangCommand("!RainmeterToggleMeterGroup");
|
||||
RemoveBangCommand("!RainmeterHideMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterShowMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterToggleMeasureGroup");
|
||||
RemoveBangCommand("!RainmeterActivateConfig");
|
||||
RemoveBangCommand("!RainmeterDeactivateConfig");
|
||||
RemoveBangCommand("!RainmeterToggleConfig");
|
||||
@ -1735,6 +1814,30 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMEASURE, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterHideMeterGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_HIDEMETERGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterShowMeterGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_SHOWMETERGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterToggleMeterGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMETERGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterDisableMeasureGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_DISABLEMEASUREGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterEnableMeasureGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_ENABLEMEASUREGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterToggleMeasureGroup") == 0)
|
||||
{
|
||||
BangWithArgs(BANG_TOGGLEMEASUREGROUP, arg.c_str(), 1);
|
||||
}
|
||||
else if (wcsicmp(bang.c_str(), L"!RainmeterActivateConfig") == 0)
|
||||
{
|
||||
RainmeterActivateConfig(NULL, ConvertToAscii(arg.c_str()).c_str());
|
||||
@ -1979,6 +2082,10 @@ void CRainmeter::ReadGeneralSettings(std::wstring& iniFile)
|
||||
CConfigParser parser;
|
||||
parser.Initialize(iniFile.c_str(), this);
|
||||
|
||||
// Read Logging settings
|
||||
m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0);
|
||||
c_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0);
|
||||
|
||||
if (m_TrayWindow)
|
||||
{
|
||||
m_TrayWindow->ReadConfig(parser);
|
||||
@ -2009,7 +2116,35 @@ void CRainmeter::ReadGeneralSettings(std::wstring& iniFile)
|
||||
m_ConfigEditor.insert(0, L"\"");
|
||||
m_ConfigEditor.append(L"\"");
|
||||
}
|
||||
if (c_Debug) DebugLog(L"ConfigEditor: %s", m_ConfigEditor.c_str());
|
||||
|
||||
m_LogViewer = parser.ReadString(L"Rainmeter", L"LogViewer", L"");
|
||||
if (m_LogViewer.empty())
|
||||
{
|
||||
// Get the program path associated with .log files
|
||||
WCHAR buffer[MAX_PATH+1] = {0};
|
||||
DWORD cchOut = MAX_PATH;
|
||||
|
||||
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".log", L"open", buffer, &cchOut);
|
||||
if (SUCCEEDED(hr) && cchOut > 0)
|
||||
{
|
||||
m_LogViewer = buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LogViewer = L"Notepad";
|
||||
}
|
||||
}
|
||||
if (!m_LogViewer.empty() && m_LogViewer[0] != L'\"')
|
||||
{
|
||||
m_LogViewer.insert(0, L"\"");
|
||||
m_LogViewer.append(L"\"");
|
||||
}
|
||||
|
||||
if (c_Debug)
|
||||
{
|
||||
DebugLog(L"ConfigEditor: %s", m_ConfigEditor.c_str());
|
||||
DebugLog(L"LogViewer: %s", m_LogViewer.c_str());
|
||||
}
|
||||
|
||||
m_TrayExecuteL = parser.ReadString(L"Rainmeter", L"TrayExecuteL", L"", false);
|
||||
m_TrayExecuteR = parser.ReadString(L"Rainmeter", L"TrayExecuteR", L"", false);
|
||||
@ -2265,6 +2400,26 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
||||
EnableMenuItem(subMenu, ID_CONTEXT_SHOWLOGFILE, MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
|
||||
if (_waccess(m_LogFile.c_str(), 0) == -1)
|
||||
{
|
||||
EnableMenuItem(subMenu, ID_CONTEXT_SHOWLOGFILE, MF_BYCOMMAND | MF_GRAYED);
|
||||
EnableMenuItem(subMenu, ID_CONTEXT_DELETELOGFILE, MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
|
||||
if (m_Logging)
|
||||
{
|
||||
EnableMenuItem(subMenu, ID_CONTEXT_STARTLOG, MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableMenuItem(subMenu, ID_CONTEXT_STOPLOG, MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
|
||||
if (c_Debug)
|
||||
{
|
||||
CheckMenuItem(subMenu, ID_CONTEXT_DEBUGLOG, MF_BYCOMMAND | MF_CHECKED);
|
||||
}
|
||||
|
||||
HMENU configMenu = CreateConfigMenu(m_ConfigMenu);
|
||||
if (configMenu)
|
||||
{
|
||||
@ -2291,7 +2446,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertMenu(subMenu, 10, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||
InsertMenu(subMenu, 11, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||
|
||||
// Create a menu for all active configs
|
||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
||||
@ -2301,7 +2456,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
||||
{
|
||||
CMeterWindow* mw = ((*iter).second);
|
||||
HMENU skinMenu = CreateSkinMenu(mw, index);
|
||||
InsertMenu(subMenu, 10, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str());
|
||||
InsertMenu(subMenu, 11, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str());
|
||||
++index;
|
||||
}
|
||||
|
||||
@ -2633,6 +2788,18 @@ void CRainmeter::ChangeSkinIndex(HMENU menu, int index)
|
||||
}
|
||||
}
|
||||
|
||||
void CRainmeter::SetLogging(bool logging)
|
||||
{
|
||||
m_Logging = logging;
|
||||
WritePrivateProfileString(L"Rainmeter", L"Logging", logging ? L"1" : L"0", m_IniFile.c_str());
|
||||
}
|
||||
|
||||
void CRainmeter::SetDebug(bool debug)
|
||||
{
|
||||
c_Debug = debug;
|
||||
WritePrivateProfileString(L"Rainmeter", L"Debug", debug ? L"1" : L"0", m_IniFile.c_str());
|
||||
}
|
||||
|
||||
void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
|
||||
{
|
||||
WritePrivateProfileString(L"Rainmeter", L"WriteTest", L"TRUE", m_IniFile.c_str());
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); };
|
||||
|
||||
const std::wstring& GetConfigEditor() { return m_ConfigEditor; };
|
||||
const std::wstring& GetLogViewer() { return m_LogViewer; };
|
||||
const std::wstring& GetStatsDate() { return m_StatsDate; };
|
||||
|
||||
HINSTANCE GetInstance() { return m_Instance; };
|
||||
@ -146,6 +147,7 @@ public:
|
||||
static void SetCommandLine(LPCTSTR CmdLine) { c_CmdLine = CmdLine;};
|
||||
static LPCTSTR GetCommandLine() { return c_CmdLine.c_str(); };
|
||||
static GlobalConfig& GetGlobalConfig() { return c_GlobalConfig; };
|
||||
|
||||
static bool GetDebug() { return c_Debug; }
|
||||
|
||||
void ReloadSettings();
|
||||
@ -160,7 +162,10 @@ public:
|
||||
BOOL GetNewVersion() { return m_NewVersion; };
|
||||
void SetDisableVersionCheck(BOOL check) { m_DisableVersionCheck = check; };
|
||||
void SetNewVersion(BOOL NewVer) { m_NewVersion = NewVer; };
|
||||
|
||||
|
||||
void SetLogging(bool logging);
|
||||
bool GetLogging() { return m_Logging; }
|
||||
void SetDebug(bool debug);
|
||||
|
||||
void ShowContextMenu(POINT pos, CMeterWindow* meterWindow);
|
||||
|
||||
@ -233,7 +238,10 @@ private:
|
||||
BOOL m_DesktopWorkAreaChanged;
|
||||
RECT m_DesktopWorkArea;
|
||||
|
||||
bool m_Logging;
|
||||
|
||||
std::wstring m_ConfigEditor;
|
||||
std::wstring m_LogViewer;
|
||||
|
||||
CConfigParser* m_CurrentParser;
|
||||
|
||||
|
@ -730,7 +730,7 @@ void CSystem::ChangeZPosInOrder()
|
||||
*/
|
||||
void CSystem::PrepareHelperWindow(HWND WorkerW)
|
||||
{
|
||||
bool logging = CRainmeter::GetDebug();
|
||||
bool logging = CRainmeter::GetDebug() && DEBUG_VERBOSE;
|
||||
|
||||
if (c_ShowDesktop && WorkerW)
|
||||
{
|
||||
|
@ -409,6 +409,10 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||
help = L"\"" + help + L"Rainmeter.chm\"";
|
||||
LSExecute(NULL, help.c_str(), SW_SHOWNORMAL);
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_NEW_VERSION)
|
||||
{
|
||||
LSExecute(NULL, L"http://rainmeter.net/RainCMS/", SW_SHOWNORMAL);
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_REFRESH)
|
||||
{
|
||||
PostMessage(tray->GetWindow(), WM_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL);
|
||||
@ -419,40 +423,65 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||
std::wstring log = Rainmeter->GetLogFile();
|
||||
if (_waccess(log.c_str(), 0) != -1)
|
||||
{
|
||||
std::wstring command = Rainmeter->GetConfigEditor();
|
||||
std::wstring command = Rainmeter->GetLogViewer();
|
||||
command += log;
|
||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||
}
|
||||
else
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_STARTLOG)
|
||||
{
|
||||
// Check if the file exists
|
||||
std::wstring log = Rainmeter->GetLogFile();
|
||||
if (_waccess(log.c_str(), 0) == -1)
|
||||
{
|
||||
int res = MessageBox(tray->GetWindow(), L"The log file doesn't exist.\nDo you want to create it?", L"Rainmeter", MB_YESNO | MB_ICONQUESTION);
|
||||
if (res == IDYES)
|
||||
// Create log file
|
||||
HANDLE file = CreateFile(log.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HANDLE file = CreateFile(log.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(file);
|
||||
ResetLoggingFlag(); // Re-enable logging
|
||||
CloseHandle(file);
|
||||
ResetLoggingFlag(); // Re-enable logging
|
||||
Rainmeter->SetLogging(true);
|
||||
|
||||
std::wstring message;
|
||||
message = L"Created file: ";
|
||||
message += log;
|
||||
message += L"\nDelete it to disable Rainmeter's logging";
|
||||
MessageBox(tray->GetWindow(), message.c_str(), L"Rainmeter", MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
std::wstring command = Rainmeter->GetConfigEditor();
|
||||
command += log;
|
||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring message;
|
||||
message = L"Unable to create the file: ";
|
||||
message += log;
|
||||
MessageBox(tray->GetWindow(), message.c_str(), L"Rainmeter", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
std::wstring message;
|
||||
message = L"Log file created at: ";
|
||||
message += log;
|
||||
MessageBox(tray->GetWindow(), message.c_str(), L"Rainmeter", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring message;
|
||||
message = L"Unable to create log file: ";
|
||||
message += log;
|
||||
MessageBox(tray->GetWindow(), message.c_str(), L"Rainmeter", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rainmeter->SetLogging(true);
|
||||
}
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_STOPLOG)
|
||||
{
|
||||
Rainmeter->SetLogging(false);
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_DELETELOGFILE)
|
||||
{
|
||||
// Check if the file exists
|
||||
std::wstring log = Rainmeter->GetLogFile();
|
||||
if (_waccess(log.c_str(), 0) != -1)
|
||||
{
|
||||
int res = MessageBox(tray->GetWindow(), L"Do you want to delete log file?", L"Rainmeter", MB_YESNO | MB_ICONQUESTION);
|
||||
if (res == IDYES)
|
||||
{
|
||||
Rainmeter->SetLogging(false);
|
||||
ResetLoggingFlag();
|
||||
DeleteFile(log.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_DEBUGLOG)
|
||||
{
|
||||
Rainmeter->SetDebug(!CRainmeter::GetDebug());
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_EDITCONFIG)
|
||||
{
|
||||
@ -468,10 +497,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||
command += L"\\Addons\\RainThemes\\RainThemes.exe\"";
|
||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_NEW_VERSION)
|
||||
{
|
||||
LSExecute(NULL, L"http://rainmeter.net/RainCMS/", SW_SHOWNORMAL);
|
||||
}
|
||||
else if(wParam == ID_CONTEXT_MANAGESKINS)
|
||||
{
|
||||
std::wstring command = L"\"" + Rainmeter->GetPath();
|
||||
|
@ -59,6 +59,10 @@
|
||||
#define ID_CONTEXT_SKINMENU_MONITOR_PRIMARY 4048
|
||||
#define ID_CONTEXT_SKINMENU_MONITOR_AUTOSELECT 4049
|
||||
#define ID_CONTEXT_NEW_VERSION 4050
|
||||
#define ID_CONTEXT_STARTLOG 4051
|
||||
#define ID_CONTEXT_STOPLOG 4052
|
||||
#define ID_CONTEXT_DEBUGLOG 4053
|
||||
#define ID_CONTEXT_DELETELOGFILE 4054
|
||||
|
||||
#define ID_CONFIG_EDIT 30000
|
||||
#define ID_CONFIG_FIRST 30001
|
||||
|
Loading…
Reference in New Issue
Block a user