mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Adding JamesAC's new ToolTips functionality.
Minor fix to the Rainmeter installer Minor changes to RainBrowser and RainThemes
This commit is contained in:
		| @@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT | ||||
| // | ||||
|  | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,3,0,466 | ||||
|  PRODUCTVERSION 1,3,0,466 | ||||
|  FILEVERSION 1,3,0,467 | ||||
|  PRODUCTVERSION 1,3,0,467 | ||||
|  FILEFLAGSMASK 0x17L | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
| @@ -45,12 +45,12 @@ BEGIN | ||||
|         BLOCK "040b04b0" | ||||
|         BEGIN | ||||
|             VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" | ||||
|             VALUE "FileVersion", "1, 3, 0, 466" | ||||
|             VALUE "FileVersion", "1, 3, 0, 467" | ||||
|             VALUE "InternalName", "Rainmeter" | ||||
|             VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" | ||||
|             VALUE "OriginalFilename", "Rainmeter.exe" | ||||
|             VALUE "ProductName", "Rainmeter" | ||||
|             VALUE "ProductVersion", "1, 3, 0, 466" | ||||
|             VALUE "ProductVersion", "1, 3, 0, 467" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|   | ||||
| @@ -184,6 +184,24 @@ int CMeter::GetY(bool abs) | ||||
| 	return m_Y;  | ||||
| } | ||||
|  | ||||
| /* | ||||
| ** GetMeterRect | ||||
| ** | ||||
| ** Returns a RECT containing the dimensions of the meter within the MeterWindow | ||||
| ** | ||||
| */ | ||||
| RECT CMeter::GetMeterRect() | ||||
| { | ||||
| 	RECT meterRect; | ||||
|  | ||||
| 	meterRect.left = GetX(); | ||||
| 	meterRect.top = GetY(); | ||||
| 	meterRect.right = GetX() + m_W; | ||||
| 	meterRect.bottom = GetY() + m_H; | ||||
|  | ||||
| 	return meterRect; | ||||
| } | ||||
|  | ||||
| /* | ||||
| ** HitTest | ||||
| ** | ||||
| @@ -340,6 +358,11 @@ void CMeter::ReadConfig(const WCHAR* section) | ||||
| 		|| !m_MiddleMouseUpAction.empty() || !m_MiddleMouseDownAction.empty() || !m_MiddleMouseDoubleClickAction.empty() | ||||
| 		|| !m_RightMouseUpAction.empty() || !m_RightMouseDownAction.empty() || !m_RightMouseDoubleClickAction.empty() ); | ||||
|  | ||||
| 	m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"", true); | ||||
| 	m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"", true); | ||||
| 	m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L"", true); | ||||
| 	m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0); | ||||
|  | ||||
| 	m_MeasureName = parser.ReadString(section, L"MeasureName", L""); | ||||
|  | ||||
| 	m_UpdateDivider = parser.ReadInt(section, L"UpdateDivider", 1); | ||||
| @@ -466,6 +489,149 @@ bool CMeter::Update() | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| /* | ||||
| ** CreateToolTip | ||||
| ** | ||||
| ** Does the initial construction of the ToolTip for the meter | ||||
| */ | ||||
| void CMeter::CreateToolTip(CMeterWindow* meterWindow) | ||||
| { | ||||
| 	HWND hwndTT; | ||||
| 	if(!m_ToolTipType) | ||||
| 	{ | ||||
| 		hwndTT = CreateWindowEx(WS_EX_TOPMOST, | ||||
| 			TOOLTIPS_CLASS,  | ||||
| 			NULL, | ||||
| 			WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,		 | ||||
| 			CW_USEDEFAULT,  | ||||
| 			CW_USEDEFAULT, | ||||
| 			CW_USEDEFAULT,  | ||||
| 			CW_USEDEFAULT, | ||||
| 			m_MeterWindow->GetWindow(),  | ||||
| 			NULL,  | ||||
| 			m_MeterWindow->GetMainObject()->GetInstance(), | ||||
| 			NULL); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		hwndTT = CreateWindowEx(WS_EX_TOPMOST, | ||||
| 			TOOLTIPS_CLASS,  | ||||
| 			NULL, | ||||
| 			WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | TTS_BALLOON,		 | ||||
| 			CW_USEDEFAULT,  | ||||
| 			CW_USEDEFAULT, | ||||
| 			CW_USEDEFAULT,  | ||||
| 			CW_USEDEFAULT, | ||||
| 			m_MeterWindow->GetWindow(),  | ||||
| 			NULL,  | ||||
| 			m_MeterWindow->GetMainObject()->GetInstance(), | ||||
| 			NULL); | ||||
| 	} | ||||
| 	SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | ||||
|  | ||||
| 	TOOLINFO ti = { 0 }; | ||||
| 	ti.cbSize = sizeof(TOOLINFO); | ||||
| 	ti.uFlags = TTF_SUBCLASS; | ||||
| 	ti.hwnd = m_MeterWindow->GetWindow(); | ||||
| 	ti.hinst = m_MeterWindow->GetMainObject()->GetInstance(); | ||||
| 	ti.lpszText = (PTSTR) m_ToolTipText.c_str(); | ||||
| 	ti.rect = GetMeterRect(); | ||||
|  | ||||
| 	SendMessage(hwndTT, TTM_ADDTOOL, NULL, (LPARAM) (LPTOOLINFO) &ti); | ||||
|  | ||||
| 	if (!m_ToolTipTitle.empty()) | ||||
| 	{ | ||||
| 		HICON hIcon = NULL; | ||||
| 		if (!m_ToolTipIcon.empty()) | ||||
| 		{ | ||||
| 			if (!_wcsicmp(m_ToolTipIcon.c_str(), L"INFO")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_INFO; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"WARNING")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_WARNING; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"ERROR")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_ERROR; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"QUESTION")) | ||||
| 			{ | ||||
| 				hIcon = LoadIcon(NULL, IDI_QUESTION); | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"SHIELD")) | ||||
| 			{ | ||||
| 				hIcon = LoadIcon(NULL, IDI_SHIELD); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				hIcon = (HICON) LoadImage(NULL, m_ToolTipIcon.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		SendMessage(hwndTT, TTM_SETTITLE, (WPARAM) hIcon, (LPARAM) m_ToolTipTitle.c_str()); | ||||
| 		DestroyIcon(hIcon); | ||||
| 	} | ||||
| 	m_ToolTipHandle = hwndTT; | ||||
| } | ||||
|  | ||||
| /* | ||||
| ** UpdateToolTip | ||||
| ** | ||||
| ** Updates the ToolTip to match new values | ||||
| */ | ||||
| void CMeter::UpdateToolTip() | ||||
| { | ||||
| 	HWND hwndTT = m_ToolTipHandle; | ||||
|  | ||||
| 	TOOLINFO ti = { 0 }; | ||||
| 	ti.cbSize = sizeof(TOOLINFO); | ||||
| 	ti.hwnd = m_MeterWindow->GetWindow(); | ||||
|  | ||||
| 	SendMessage(hwndTT, TTM_GETTOOLINFO, NULL, (LPARAM) (LPTOOLINFO) &ti); | ||||
|  | ||||
| 	ti.lpszText = (PTSTR) m_ToolTipText.c_str(); | ||||
| 	ti.rect = GetMeterRect(); | ||||
|  | ||||
| 	SendMessage(hwndTT, TTM_SETTOOLINFO, NULL, (LPARAM) (LPTOOLINFO) &ti);  | ||||
|  | ||||
| 	if (!m_ToolTipTitle.empty()) | ||||
| 	{ | ||||
| 		HICON hIcon = NULL; | ||||
| 		if (!m_ToolTipIcon.empty()) | ||||
| 		{ | ||||
| 			if (!_wcsicmp(m_ToolTipIcon.c_str(), L"INFO")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_INFO; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"WARNING")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_WARNING; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"ERROR")) | ||||
| 			{ | ||||
| 				hIcon = (HICON) TTI_ERROR; | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"QUESTION")) | ||||
| 			{ | ||||
| 				hIcon = LoadIcon(NULL, IDI_QUESTION); | ||||
| 			} | ||||
| 			else if (!_wcsicmp(m_ToolTipIcon.c_str(), L"SHIELD")) | ||||
| 			{ | ||||
| 				hIcon = LoadIcon(NULL, IDI_SHIELD); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				hIcon = (HICON) LoadImage(NULL, m_ToolTipIcon.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		SendMessage(hwndTT, TTM_SETTITLE, (WPARAM) hIcon, (LPARAM) m_ToolTipTitle.c_str()); | ||||
| 		DestroyIcon(hIcon); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /* | ||||
| ** Draw | ||||
| ** | ||||
|   | ||||
| @@ -47,6 +47,7 @@ public: | ||||
| 	virtual int GetW() { return m_Hidden ? 0 : m_W; }; | ||||
| 	virtual int GetX(bool abs = false); | ||||
| 	virtual int GetY(bool abs = false); | ||||
| 	RECT GetMeterRect(); | ||||
|  | ||||
| 	void SetX(int x) { m_X = x; m_RelativeX = POSITION_ABSOLUTE; }; | ||||
| 	void SetY(int y) { m_Y = y; m_RelativeY = POSITION_ABSOLUTE; }; | ||||
| @@ -63,6 +64,13 @@ public: | ||||
| 	std::wstring& GetMouseOverAction() { return m_MouseOverAction; }; | ||||
| 	std::wstring& GetMouseLeaveAction() { return m_MouseLeaveAction; }; | ||||
|  | ||||
| 	std::wstring& GetToolTipText() { return m_ToolTipText; }; | ||||
| 	HWND GetToolTipHandle() { return m_ToolTipHandle; }; | ||||
| 	void SetToolTipHandle(HWND handle) { m_ToolTipHandle = handle; }; | ||||
|  | ||||
| 	void CreateToolTip(CMeterWindow* meterWindow); | ||||
| 	void UpdateToolTip(); | ||||
|  | ||||
| 	bool HasMouseAction() { return m_HasMouseAction; }; | ||||
| 	bool HasMouseActionCursor() { return m_MouseActionCursor; }; | ||||
| 	void SetMouseActionCursor(bool b) { m_MouseActionCursor = b; }; | ||||
| @@ -113,6 +121,13 @@ protected: | ||||
| 	CMeter*	m_RelativeMeter; | ||||
| 	bool m_DynamicVariables;		// If true, the measure contains dynamic variables | ||||
|  | ||||
| 	std::wstring m_ToolTipText; | ||||
| 	std::wstring m_ToolTipTitle; | ||||
| 	std::wstring m_ToolTipIcon; | ||||
| 	bool m_ToolTipType; | ||||
|  | ||||
| 	HWND m_ToolTipHandle; | ||||
|  | ||||
| 	std::wstring m_RightMouseDownAction;	// Actions for left and right and middle mouse buttons | ||||
| 	std::wstring m_RightMouseUpAction; | ||||
| 	std::wstring m_RightMouseDoubleClickAction; | ||||
|   | ||||
| @@ -333,6 +333,11 @@ void CMeterWindow::Refresh(bool init, bool all) | ||||
| 		std::list<CMeter*>::iterator j = m_Meters.begin(); | ||||
| 		for( ; j != m_Meters.end(); ++j) | ||||
| 		{ | ||||
| 			if ((*j)->GetToolTipHandle() != NULL) | ||||
| 			{ | ||||
| 				DestroyWindow((*j)->GetToolTipHandle()); | ||||
| 				(*j)->SetToolTipHandle(NULL); | ||||
| 			} | ||||
| 			delete (*j); | ||||
| 		} | ||||
| 		m_Meters.clear(); | ||||
| @@ -1840,6 +1845,11 @@ void CMeterWindow::ReadSkin() | ||||
| 						} | ||||
|  | ||||
| 						meter->ReadConfig(strSection.c_str()); | ||||
|  | ||||
| 						if (!meter->GetToolTipText().empty()) | ||||
| 						{ | ||||
| 							meter->CreateToolTip(this); | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 				catch (CError& error) | ||||
| @@ -2320,6 +2330,15 @@ void CMeterWindow::Update(bool nodraw) | ||||
| 		Redraw(); | ||||
| 	} | ||||
|  | ||||
| 	j = m_Meters.begin(); | ||||
| 	for ( ; j != m_Meters.end(); ++j) | ||||
| 	{ | ||||
| 		if ((*j)->GetToolTipHandle() != NULL) | ||||
| 		{ | ||||
| 			(*j)->UpdateToolTip(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Check for transitions and start the timer if necessary | ||||
| 	bool bActiveTransition = false; | ||||
| 	j = m_Meters.begin(); | ||||
|   | ||||
| @@ -129,6 +129,8 @@ public: | ||||
|  | ||||
| 	int Initialize(CRainmeter& Rainmeter); | ||||
|  | ||||
| 	CRainmeter* GetMainObject() { return m_Rainmeter; }; | ||||
|  | ||||
| 	void RunBang(BANGCOMMAND bang, const WCHAR* arg); | ||||
|  | ||||
| 	void MoveMeter(int x, int y, const WCHAR* name); | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| #pragma once | ||||
| const int revision_number = 466; | ||||
| const int revision_number = 467; | ||||
		Reference in New Issue
	
	Block a user
	 jsmorley
					jsmorley