mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
some minor tweaks & cleanups
This commit is contained in:
parent
b3e93c0765
commit
bf026cc248
@ -101,6 +101,10 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
CMeasure::ReadConfig(parser, section);
|
CMeasure::ReadConfig(parser, section);
|
||||||
|
|
||||||
|
// DynamicVariables is now disabled in MeasurePlugin due to a limitation of the re-initialization.
|
||||||
|
// Do not set m_DynamicVariables to "true".
|
||||||
|
m_DynamicVariables = false;
|
||||||
|
|
||||||
m_PluginName = parser.ReadString(section, L"Plugin", L"");
|
m_PluginName = parser.ReadString(section, L"Plugin", L"");
|
||||||
|
|
||||||
size_t pos = m_PluginName.rfind(L".");
|
size_t pos = m_PluginName.rfind(L".");
|
||||||
|
@ -93,6 +93,7 @@ CMeterWindow::CMeterWindow(std::wstring& path, std::wstring& config, std::wstrin
|
|||||||
m_TransitionUpdate = 100;
|
m_TransitionUpdate = 100;
|
||||||
m_ActiveTransition = false;
|
m_ActiveTransition = false;
|
||||||
m_HasNetMeasures = false;
|
m_HasNetMeasures = false;
|
||||||
|
m_HasButtons = false;
|
||||||
m_WindowHide = HIDEMODE_NONE;
|
m_WindowHide = HIDEMODE_NONE;
|
||||||
m_WindowStartHidden = false;
|
m_WindowStartHidden = false;
|
||||||
m_SnapEdges = true;
|
m_SnapEdges = true;
|
||||||
@ -1863,6 +1864,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
// Create the meters and measures
|
// Create the meters and measures
|
||||||
|
|
||||||
m_HasNetMeasures = false;
|
m_HasNetMeasures = false;
|
||||||
|
m_HasButtons = false;
|
||||||
|
|
||||||
// Get all the sections (i.e. different meters, measures and the other stuff)
|
// Get all the sections (i.e. different meters, measures and the other stuff)
|
||||||
std::vector<std::wstring> arraySections = m_Parser.GetSections();
|
std::vector<std::wstring> arraySections = m_Parser.GetSections();
|
||||||
@ -1907,7 +1909,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
|
|
||||||
m_Parser.AddMeasure(measure);
|
m_Parser.AddMeasure(measure);
|
||||||
|
|
||||||
if (!m_HasNetMeasures && dynamic_cast<CMeasureNet*>((measure)))
|
if (!m_HasNetMeasures && dynamic_cast<CMeasureNet*>(measure))
|
||||||
{
|
{
|
||||||
m_HasNetMeasures = true;
|
m_HasNetMeasures = true;
|
||||||
}
|
}
|
||||||
@ -1950,6 +1952,11 @@ bool CMeterWindow::ReadSkin()
|
|||||||
m_Meters.push_back(meter);
|
m_Meters.push_back(meter);
|
||||||
|
|
||||||
m_Parser.ResetStyleTemplate();
|
m_Parser.ResetStyleTemplate();
|
||||||
|
|
||||||
|
if (!m_HasButtons && dynamic_cast<CMeterButton*>(meter))
|
||||||
|
{
|
||||||
|
m_HasButtons = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If it's not a meter or measure it will be ignored
|
// If it's not a meter or measure it will be ignored
|
||||||
@ -2376,7 +2383,7 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ((*i)->HasDynamicVariables() && dynamic_cast<CMeasurePlugin*>((*i)) == NULL) // Plugins are not meant to be reinitialized
|
if ((*i)->HasDynamicVariables())
|
||||||
{
|
{
|
||||||
(*i)->ReadConfig(m_Parser, (*i)->GetName());
|
(*i)->ReadConfig(m_Parser, (*i)->GetName());
|
||||||
}
|
}
|
||||||
@ -2389,6 +2396,7 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the meters
|
// Update the meters
|
||||||
|
bool bActiveTransition = false;
|
||||||
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
std::list<CMeter*>::const_iterator j = m_Meters.begin();
|
||||||
for( ; j != m_Meters.end(); ++j)
|
for( ; j != m_Meters.end(); ++j)
|
||||||
{
|
{
|
||||||
@ -2405,6 +2413,22 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
{
|
{
|
||||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update tooltips
|
||||||
|
if (!((*j)->GetToolTipHandle() != NULL) && (!(*j)->GetToolTipText().empty()))
|
||||||
|
{
|
||||||
|
(*j)->CreateToolTip(this);
|
||||||
|
}
|
||||||
|
if ((*j)->GetToolTipHandle() != NULL)
|
||||||
|
{
|
||||||
|
(*j)->UpdateToolTip();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for transitions and start the timer if necessary
|
||||||
|
if (!bActiveTransition && (*j)->HasActiveTransition())
|
||||||
|
{
|
||||||
|
bActiveTransition = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nodraw)
|
if (!nodraw)
|
||||||
@ -2418,35 +2442,11 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
j = m_Meters.begin();
|
|
||||||
for ( ; j != m_Meters.end(); ++j)
|
|
||||||
{
|
|
||||||
if (!((*j)->GetToolTipHandle() != NULL) && (!(*j)->GetToolTipText().empty()))
|
|
||||||
{
|
|
||||||
(*j)->CreateToolTip(this);
|
|
||||||
}
|
|
||||||
if ((*j)->GetToolTipHandle() != NULL)
|
|
||||||
{
|
|
||||||
(*j)->UpdateToolTip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for transitions and start the timer if necessary
|
|
||||||
bool bActiveTransition = false;
|
|
||||||
j = m_Meters.begin();
|
|
||||||
for( ; j != m_Meters.end(); ++j)
|
|
||||||
{
|
|
||||||
if ((*j)->HasActiveTransition())
|
|
||||||
{
|
|
||||||
bActiveTransition = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start/stop the transition timer if necessary
|
// Start/stop the transition timer if necessary
|
||||||
if (!m_ActiveTransition && bActiveTransition)
|
if (!m_ActiveTransition && bActiveTransition)
|
||||||
{
|
{
|
||||||
SetTimer(m_Window, TRANSITIONTIMER, m_TransitionUpdate, NULL);
|
SetTimer(m_Window, TRANSITIONTIMER, m_TransitionUpdate, NULL);
|
||||||
|
m_ActiveTransition = true;
|
||||||
}
|
}
|
||||||
else if (m_ActiveTransition && !bActiveTransition)
|
else if (m_ActiveTransition && !bActiveTransition)
|
||||||
{
|
{
|
||||||
@ -2841,23 +2841,27 @@ void CMeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, CMeterWindow* meter
|
|||||||
// Hidden meters are ignored
|
// Hidden meters are ignored
|
||||||
if ((*j)->IsHidden()) continue;
|
if ((*j)->IsHidden()) continue;
|
||||||
|
|
||||||
CMeterButton* button = dynamic_cast<CMeterButton*>(*j);
|
CMeterButton* button = NULL;
|
||||||
if (button)
|
if (m_HasButtons)
|
||||||
{
|
{
|
||||||
switch (proc)
|
button = dynamic_cast<CMeterButton*>(*j);
|
||||||
|
if (button)
|
||||||
{
|
{
|
||||||
case BUTTONPROC_DOWN:
|
switch (proc)
|
||||||
redraw |= button->MouseDown(pos);
|
{
|
||||||
break;
|
case BUTTONPROC_DOWN:
|
||||||
|
redraw |= button->MouseDown(pos);
|
||||||
|
break;
|
||||||
|
|
||||||
case BUTTONPROC_UP:
|
case BUTTONPROC_UP:
|
||||||
redraw |= button->MouseUp(pos, meterWindow);
|
redraw |= button->MouseUp(pos, meterWindow);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTONPROC_MOVE:
|
case BUTTONPROC_MOVE:
|
||||||
default:
|
default:
|
||||||
redraw |= button->MouseMove(pos);
|
redraw |= button->MouseMove(pos);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4024,22 +4028,26 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle button
|
// Handle button
|
||||||
CMeterButton* button = dynamic_cast<CMeterButton*>(*j);
|
CMeterButton* button = NULL;
|
||||||
if (button)
|
if (m_HasButtons)
|
||||||
{
|
{
|
||||||
if (!buttonFound)
|
button = dynamic_cast<CMeterButton*>(*j);
|
||||||
|
if (button)
|
||||||
{
|
{
|
||||||
if (!button->IsExecutable())
|
if (!buttonFound)
|
||||||
{
|
{
|
||||||
button->SetExecutable(true);
|
if (!button->IsExecutable())
|
||||||
|
{
|
||||||
|
button->SetExecutable(true);
|
||||||
|
}
|
||||||
|
buttonFound = true;
|
||||||
}
|
}
|
||||||
buttonFound = true;
|
else
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (button->IsExecutable())
|
|
||||||
{
|
{
|
||||||
button->SetExecutable(false);
|
if (button->IsExecutable())
|
||||||
|
{
|
||||||
|
button->SetExecutable(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4066,12 +4074,15 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
|
|||||||
if ((*j)->IsMouseOver())
|
if ((*j)->IsMouseOver())
|
||||||
{
|
{
|
||||||
// Handle button
|
// Handle button
|
||||||
CMeterButton* button = dynamic_cast<CMeterButton*>(*j);
|
if (m_HasButtons)
|
||||||
if (button)
|
|
||||||
{
|
{
|
||||||
if (button->IsExecutable())
|
CMeterButton* button = dynamic_cast<CMeterButton*>(*j);
|
||||||
|
if (button)
|
||||||
{
|
{
|
||||||
button->SetExecutable(false);
|
if (button->IsExecutable())
|
||||||
|
{
|
||||||
|
button->SetExecutable(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +314,7 @@ private:
|
|||||||
int m_TransitionUpdate; // Transition redraw frequency
|
int m_TransitionUpdate; // Transition redraw frequency
|
||||||
bool m_ActiveTransition;
|
bool m_ActiveTransition;
|
||||||
bool m_HasNetMeasures;
|
bool m_HasNetMeasures;
|
||||||
|
bool m_HasButtons;
|
||||||
HIDEMODE m_WindowHide; // If true, the window is hidden when mouse is over it
|
HIDEMODE m_WindowHide; // If true, the window is hidden when mouse is over it
|
||||||
bool m_WindowStartHidden; // If true, the window is hidden at startup
|
bool m_WindowStartHidden; // If true, the window is hidden at startup
|
||||||
bool m_SavePosition; // If true, the window's position is saved
|
bool m_SavePosition; // If true, the window's position is saved
|
||||||
|
Loading…
Reference in New Issue
Block a user