summaryrefslogtreecommitdiff
path: root/plugins/Weather/src/weather_popup.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2016-03-24 23:32:20 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2016-03-24 23:32:20 +0000
commit79412831126e49d990a44506af1ae69f78797d6c (patch)
tree9b08aab70ee1be9fc36adb51cf4d3f4337991383 /plugins/Weather/src/weather_popup.cpp
parent2e7f9dcf085ba41ab37bd3234c5fd27781896114 (diff)
Weather: - minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@16539 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Weather/src/weather_popup.cpp')
-rw-r--r--plugins/Weather/src/weather_popup.cpp55
1 files changed, 27 insertions, 28 deletions
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index 4835761da6..5351d74abf 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -29,38 +29,12 @@ static HANDLE hPopupContact;
//============ SHOW WEATHER POPUPS ============
-// display weather popups
-// wParam = the contact to display popup
-// lParam = whether the weather data is changed or not
-int WeatherPopup(WPARAM hContact, LPARAM lParam)
-{
- // determine if the popup should display or not
- if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) &&
- !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0)) {
- WEATHERINFO winfo = LoadWeatherInfo(hContact);
-
- // setup the popup
- POPUPDATAT ppd = { 0 };
- ppd.lchContact = hContact;
- ppd.PluginData = ppd.lchIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, winfo.status);
- GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
- GetDisplay(&winfo, opt.pText, ppd.lptzText);
- ppd.PluginWindowProc = PopupDlgProc;
- ppd.colorBack = (opt.UseWinColors) ? GetSysColor(COLOR_BTNFACE) : opt.BGColour;
- ppd.colorText = (opt.UseWinColors) ? GetSysColor(COLOR_WINDOWTEXT) : opt.TextColour;
- ppd.iSeconds = opt.pDelay;
- PUAddPopupT(&ppd);
- }
- return 0;
-}
-
//============ WEATHER ERROR POPUPS ============
// display weather error or notices (not threaded)
// wParam = error text
// lParam = display type
// Type can either be SM_WARNING, SM_NOTIFY, or SM_WEATHERALERT
-
int WeatherError(WPARAM wParam, LPARAM lParam)
{
if (!opt.UsePopup)
@@ -107,7 +81,6 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
// (threaded)
// lpzText = error text
// kind = display type (see m_popup.h)
-
int WPShowMessage(TCHAR* lpzText, WORD kind)
{
NotifyEventHooks(hHookWeatherError, (WPARAM)lpzText, (LPARAM)kind);
@@ -119,7 +92,7 @@ int WPShowMessage(TCHAR* lpzText, WORD kind)
// popup dialog pocess
// for selecting actions when click on the popup window
// use for displaying contact menu
-LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
DWORD ID = 0;
MCONTACT hContact;
@@ -146,6 +119,32 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
return DefWindowProc(hWnd, message, wParam, lParam);
}
+// display weather popups
+// wParam = the contact to display popup
+// lParam = whether the weather data is changed or not
+int WeatherPopup(WPARAM hContact, LPARAM lParam)
+{
+ // determine if the popup should display or not
+ if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) &&
+ !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0)) {
+ WEATHERINFO winfo = LoadWeatherInfo(hContact);
+
+ // setup the popup
+ POPUPDATAT ppd = { 0 };
+ ppd.lchContact = hContact;
+ ppd.PluginData = ppd.lchIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, winfo.status);
+ GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
+ GetDisplay(&winfo, opt.pText, ppd.lptzText);
+ ppd.PluginWindowProc = PopupDlgProc;
+ ppd.colorBack = (opt.UseWinColors) ? GetSysColor(COLOR_BTNFACE) : opt.BGColour;
+ ppd.colorText = (opt.UseWinColors) ? GetSysColor(COLOR_WINDOWTEXT) : opt.TextColour;
+ ppd.iSeconds = opt.pDelay;
+ PUAddPopupT(&ppd);
+ }
+ return 0;
+}
+
+
// process for the popup window
// containing the code for popup actions
LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)