Changed so that only LOG_ERROR from exceptions cause About Log to open.

This commit is contained in:
Birunthan Mohanathas 2011-09-08 17:05:48 +00:00
parent 2e9f063cef
commit 2e128c75be
7 changed files with 35 additions and 20 deletions

View File

@ -93,17 +93,23 @@ void CDialogAbout::Open(int tab)
c_Dialog->OnNotify(0, (LPARAM)&nm);
}
void CDialogAbout::AddLogItem(int level, LPCWSTR time, LPCWSTR message)
/*
** ShowAboutLog
**
** Shows log if dialog isn't already open.
**
*/
void CDialogAbout::ShowAboutLog()
{
if (!c_Dialog)
{
if (level == LOG_ERROR)
{
// Open About Log window for errors
CDialogAbout::Open();
}
Open();
}
else if (c_Dialog->m_TabLog && c_Dialog->m_TabLog->IsInitialized())
}
void CDialogAbout::AddLogItem(int level, LPCWSTR time, LPCWSTR message)
{
if (c_Dialog && c_Dialog->m_TabLog && c_Dialog->m_TabLog->IsInitialized())
{
c_Dialog->m_TabLog->AddItem(level, time, message);
}

View File

@ -35,6 +35,7 @@ public:
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
static void Open(int tab = 0);
static void ShowAboutLog();
static void AddLogItem(int level, LPCWSTR time, LPCWSTR message);
static void UpdateSkins();

View File

@ -18,8 +18,8 @@
#include "StdAfx.h"
#include "Litestep.h"
#include "Error.h"
#include "Rainmeter.h"
#include "DialogAbout.h"
#include "System.h"
extern CRainmeter* Rainmeter;
@ -719,6 +719,12 @@ void LogWithArgs(int nLevel, const WCHAR* format, ... )
delete [] buffer;
}
void LogError(CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
CDialogAbout::ShowAboutLog();
}
void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved)
{
// Do nothing.

View File

@ -22,6 +22,7 @@
#include <windows.h>
#include <comdef.h>
#include <string>
#include "Error.h"
#include "Export.h"
#define magicDWord 0x49474541
@ -52,6 +53,7 @@ void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t*
void Log(int nLevel, const WCHAR* message, const WCHAR* module = L"Rainmeter"); // Wrapper for LSLog().
void LogWithArgs(int nLevel, const WCHAR* format, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level.
void LogError(CError& error);
void ResetLoggingFlag();

View File

@ -2315,7 +2315,7 @@ bool CMeterWindow::ReadSkin()
{
delete measure;
measure = NULL;
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
else if (meterName.length() > 0)
@ -2345,7 +2345,7 @@ bool CMeterWindow::ReadSkin()
{
delete meter;
meter = NULL;
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
// If it's not a meter or measure it will be ignored
@ -2384,7 +2384,7 @@ bool CMeterWindow::ReadSkin()
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
}
@ -2410,7 +2410,7 @@ void CMeterWindow::InitializeMeasures()
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
}
@ -2433,7 +2433,7 @@ void CMeterWindow::InitializeMeters()
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
if (!(*j)->GetToolTipText().empty())
@ -2897,7 +2897,7 @@ bool CMeterWindow::UpdateMeasure(CMeasure* measure, bool force)
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
@ -2937,7 +2937,7 @@ bool CMeterWindow::UpdateMeter(CMeter* meter, bool& bActiveTransition, bool forc
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
@ -3828,7 +3828,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
return 0;
@ -5024,7 +5024,7 @@ LRESULT CMeterWindow::OnDelayedRefresh(UINT uMsg, WPARAM wParam, LPARAM lParam)
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
return 0;
}

View File

@ -2248,7 +2248,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
}
@ -3562,7 +3562,7 @@ void CRainmeter::RefreshAll()
}
catch (CError& error)
{
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
}
}

View File

@ -315,7 +315,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
{
delete m_Measure;
m_Measure = NULL;
Log(LOG_ERROR, error.GetString().c_str());
LogError(error);
}
Rainmeter->SetCurrentParser(oldParser);