summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-30 18:33:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-30 18:33:35 +0000
commit4540036e07fce39b653bbb2777df48f451368e67 (patch)
treeae95f059280255bc10cd7da2d57301847d87f4b9
parentf3db9f96a7ac4c566dbcde6c6438243012e92616 (diff)
fixes for popups
git-svn-id: http://svn.miranda-ng.org/main/trunk@241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Weather/weather_opt.cpp3
-rw-r--r--protocols/Weather/weather_popup.cpp47
-rw-r--r--protocols/Weather/weather_svcs.cpp6
3 files changed, 22 insertions, 34 deletions
diff --git a/protocols/Weather/weather_opt.cpp b/protocols/Weather/weather_opt.cpp
index 68512e09c8..2ec33bd371 100644
--- a/protocols/Weather/weather_opt.cpp
+++ b/protocols/Weather/weather_opt.cpp
@@ -300,8 +300,7 @@ int OptInit(WPARAM wParam,LPARAM lParam) {
CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
// if popup service exists, load the weather popup options
- if ((ServiceExists(MS_POPUP_ADDPOPUP)))
- {
+ if ((ServiceExists(MS_POPUP_ADDPOPUP))) {
odp.position = 100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
odp.pszGroup = LPGEN("PopUps");
diff --git a/protocols/Weather/weather_popup.cpp b/protocols/Weather/weather_popup.cpp
index 9945b5fe8d..6e55f7ad14 100644
--- a/protocols/Weather/weather_popup.cpp
+++ b/protocols/Weather/weather_popup.cpp
@@ -58,13 +58,7 @@ int WeatherPopup(WPARAM wParam, LPARAM lParam)
ppd.colorBack = (opt.UseWinColors)?GetSysColor(COLOR_BTNFACE):opt.BGColour;
ppd.colorText = (opt.UseWinColors)?GetSysColor(COLOR_WINDOWTEXT):opt.TextColour;
ppd.iSeconds = opt.pDelay;
- // display popups
- if (!ServiceExists(MS_POPUP_ADDPOPUPEX)) // old version
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
- else { // new version with delay
- ppd.iSeconds = opt.pDelay;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
- }
+ PUAddPopUpT( &ppd );
}
return 0;
}
@@ -75,46 +69,42 @@ int WeatherPopup(WPARAM wParam, LPARAM lParam)
// 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) return 0;
+ if (!opt.UsePopup)
+ return 0;
+
+ TCHAR* tszMsg = ( TCHAR* )wParam;
if ((DWORD)lParam == SM_WARNING)
- PUShowMessage((char*)wParam, SM_WARNING);
+ PUShowMessageT( tszMsg, SM_WARNING );
else if ((DWORD)lParam == SM_NOTIFY)
- PUShowMessage((char*)wParam, SM_NOTIFY);
+ PUShowMessageT( tszMsg, SM_NOTIFY);
else if ((DWORD)lParam == SM_WEATHERALERT)
{
- POPUPDATAEX ppd = {0};
- char *chop;
- char str1[512], str2[512];
+ POPUPDATAT ppd = {0};
+ TCHAR *chop, str1[512], str2[512];
// get the 2 strings
- strcpy(str1, (char*)wParam);
- strcpy(str2, (char*)wParam);
- chop = strchr(str1, 255);
+ _tcscpy(str1, tszMsg);
+ _tcscpy(str2, tszMsg);
+ chop = _tcschr(str1, 255);
if (chop != NULL) *chop = '\0';
else str1[0] = 0;
- chop = strchr(str2, 255);
- if (chop != NULL) strcpy(str2, chop+1);
+ chop = _tcschr(str2, 255);
+ if (chop != NULL) _tcscpy(str2, chop+1);
else str2[0] = 0;
// setup the popup
ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(OIC_BANG), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
- strcpy(ppd.lpzContactName, str1);
- strcpy(ppd.lpzText, str2);
+ _tcscpy(ppd.lptzContactName, str1);
+ _tcscpy(ppd.lptzText, str2);
ppd.colorBack = (opt.UseWinColors)?GetSysColor(COLOR_BTNFACE):opt.BGColour;
ppd.colorText = (opt.UseWinColors)?GetSysColor(COLOR_WINDOWTEXT):opt.TextColour;
ppd.iSeconds = opt.pDelay;
-
- // display popups
- if (!ServiceExists(MS_POPUP_ADDPOPUPEX)) // old version
- CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
- else { // new version with delay
- ppd.iSeconds = opt.pDelay;
- CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0);
- }
+ PUAddPopUpT( &ppd );
}
return 0;
}
@@ -123,6 +113,7 @@ 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);
diff --git a/protocols/Weather/weather_svcs.cpp b/protocols/Weather/weather_svcs.cpp
index 9e95f307f6..23cb105d3b 100644
--- a/protocols/Weather/weather_svcs.cpp
+++ b/protocols/Weather/weather_svcs.cpp
@@ -425,8 +425,7 @@ void AddMenuItems(void)
CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
// only run if popup service exists
- if (ServiceExists(MS_POPUP_ADDPOPUP))
- {
+ if (ServiceExists(MS_POPUP_ADDPOPUP)) {
hService[25] = CreateServiceFunction(WEATHERPROTONAME "/PopupMenu", MenuitemNotifyCmd);
mi.pszName = "Weather Notification";
mi.icolibItem = GetIconHandle("popup");
@@ -437,8 +436,7 @@ void AddMenuItems(void)
UpdatePopupMenu(opt.UsePopup);
}
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- {
+ if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
hService[26] = CreateServiceFunction("Weather/mwin_menu", Mwin_MenuClicked);
mi.position = -0x7FFFFFF0;
mi.hIcon = NULL;