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:
		| @@ -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,7 +2841,10 @@ 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 (m_HasButtons) | ||||||
|  | 		{ | ||||||
|  | 			button = dynamic_cast<CMeterButton*>(*j); | ||||||
| 			if (button) | 			if (button) | ||||||
| 			{ | 			{ | ||||||
| 				switch (proc) | 				switch (proc) | ||||||
| @@ -2860,6 +2863,7 @@ void CMeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, CMeterWindow* meter | |||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		if (changeCursor && !drawCursor) | 		if (changeCursor && !drawCursor) | ||||||
| 		{ | 		{ | ||||||
| @@ -4024,7 +4028,10 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				// Handle button | 				// Handle button | ||||||
| 				CMeterButton* button = dynamic_cast<CMeterButton*>(*j); | 				CMeterButton* button = NULL; | ||||||
|  | 				if (m_HasButtons) | ||||||
|  | 				{ | ||||||
|  | 					button = dynamic_cast<CMeterButton*>(*j); | ||||||
| 					if (button) | 					if (button) | ||||||
| 					{ | 					{ | ||||||
| 						if (!buttonFound) | 						if (!buttonFound) | ||||||
| @@ -4043,6 +4050,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 							} | 							} | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
|  | 				} | ||||||
|  |  | ||||||
| 				if (!(*j)->IsMouseOver()) | 				if (!(*j)->IsMouseOver()) | ||||||
| 				{ | 				{ | ||||||
| @@ -4066,6 +4074,8 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 			if ((*j)->IsMouseOver()) | 			if ((*j)->IsMouseOver()) | ||||||
| 			{ | 			{ | ||||||
| 				// Handle button | 				// Handle button | ||||||
|  | 				if (m_HasButtons) | ||||||
|  | 				{ | ||||||
| 					CMeterButton* button = dynamic_cast<CMeterButton*>(*j); | 					CMeterButton* button = dynamic_cast<CMeterButton*>(*j); | ||||||
| 					if (button) | 					if (button) | ||||||
| 					{ | 					{ | ||||||
| @@ -4074,6 +4084,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 							button->SetExecutable(false); | 							button->SetExecutable(false); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
|  | 				} | ||||||
|  |  | ||||||
| 				//DebugLog(L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); | 				//DebugLog(L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); | ||||||
| 				(*j)->SetMouseOver(false); | 				(*j)->SetMouseOver(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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 spx
					spx