diff options
-rw-r--r-- | MySpace/common.h | 2 | ||||
-rw-r--r-- | MySpace/notifications.cpp | 90 | ||||
-rw-r--r-- | MySpace/version.h | 2 | ||||
-rw-r--r-- | message_notify/MessageNotify.mdsp | 10 | ||||
-rw-r--r-- | message_notify/messagenotify.cpp | 2 | ||||
-rw-r--r-- | message_notify/popups.cpp | 22 | ||||
-rw-r--r-- | message_notify/popups.h | 2 | ||||
-rw-r--r-- | otr/common.h | 3 | ||||
-rw-r--r-- | otr/otr.mdsp | 12 | ||||
-rw-r--r-- | otr/otr_private.h | 2 | ||||
-rw-r--r-- | otr/utils.cpp | 11 | ||||
-rw-r--r-- | updater/popups.cpp | 34 | ||||
-rw-r--r-- | updater/popups.h | 2 | ||||
-rw-r--r-- | updater/version.h | 2 | ||||
-rw-r--r-- | yapp/YAPP.mdsp | 12 | ||||
-rw-r--r-- | yapp/common.h | 2 | ||||
-rw-r--r-- | yapp/docs/m_popup.h | 90 | ||||
-rw-r--r-- | yapp/docs/m_yapp.h | 466 | ||||
-rw-r--r-- | yapp/message_pump.cpp | 12 | ||||
-rw-r--r-- | yapp/message_pump.h | 2 | ||||
-rw-r--r-- | yapp/notify_imp.cpp | 4 | ||||
-rw-r--r-- | yapp/options.cpp | 73 | ||||
-rw-r--r-- | yapp/popups2.cpp | 4 | ||||
-rw-r--r-- | yapp/popwin.cpp | 113 | ||||
-rw-r--r-- | yapp/popwin.h | 4 | ||||
-rw-r--r-- | yapp/services.cpp | 294 | ||||
-rw-r--r-- | yapp/services.h | 4 | ||||
-rw-r--r-- | yapp/version.h | 4 |
28 files changed, 867 insertions, 413 deletions
diff --git a/MySpace/common.h b/MySpace/common.h index 1fc68e5..aaed8b4 100644 --- a/MySpace/common.h +++ b/MySpace/common.h @@ -52,7 +52,7 @@ #include <m_message.h>
#include <m_clui.h>
-#include <m_popup.h>
+#include <m_yapp.h>
#include <m_updater.h>
#include <m_metacontacts.h>
diff --git a/MySpace/notifications.cpp b/MySpace/notifications.cpp index 702c965..df387ad 100644 --- a/MySpace/notifications.cpp +++ b/MySpace/notifications.cpp @@ -24,7 +24,7 @@ bool bWndMailPopup = false, bWndBlogPopup = false, bWndProfilePopup = false, bWn typedef struct {
char *url;
bool *bWnd;
-} PopupData;
+} PopupProcData;
char popup_class_name[128];
@@ -33,14 +33,14 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, switch( message ) {
case UM_INITPOPUP:
{
- PopupData *pd = (PopupData *)PUGetPluginData(hWnd);
+ PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd);
if(pd) *pd->bWnd = true;
}
break;
case WM_COMMAND:
{
- PopupData *pd = (PopupData *)PUGetPluginData(hWnd);
+ PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd);
if(pd) {
CallService(MS_UTILS_OPENURL, (WPARAM)TRUE, (LPARAM)pd->url); //"http://messaging.myspace.com/index.cfm?fuseaction=mail.inbox"
*pd->bWnd = false;
@@ -52,7 +52,7 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, case WM_CONTEXTMENU:
{
- PopupData *pd = (PopupData *)PUGetPluginData(hWnd);
+ PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd);
if(pd) *pd->bWnd = false;
}
PUDeletePopUp( hWnd );
@@ -61,7 +61,7 @@ LRESULT CALLBACK NotifyPopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, case UM_FREEPLUGINDATA:
{
- PopupData *pd = (PopupData *)PUGetPluginData(hWnd);
+ PopupProcData *pd = (PopupProcData *)PUGetPluginData(hWnd);
if(pd) {
free(pd->url);
delete pd;
@@ -86,16 +86,16 @@ void NotifyMail() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
pd->url = strdup(URL_MAIL);
pd->bWnd = &bWndMailPopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have unread mail");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have unread mail"));
@@ -126,16 +126,16 @@ void NotifyBlogComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
pd->url = strdup(URL_BLOG);
pd->bWnd = &bWndBlogPopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have unread blog comments");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have unread blog comments"));
@@ -165,18 +165,18 @@ void NotifyProfileComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
char url[1024];
mir_snprintf(url, 1024, URL_PROFILE, DBGetContactSettingDword(0, MODULE, "UID", 0));
pd->url = strdup(url);
pd->bWnd = &bWndProfilePopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have unread profile comments");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have unread profile comments"));
@@ -205,16 +205,16 @@ void NotifyFriendRequest() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
pd->url = strdup(URL_FRIEND);
pd->bWnd = &bWndFriendPopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have new friend requests");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have new friend requests"));
@@ -243,18 +243,18 @@ void NotifyPictureComment() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
char url[1024];
mir_snprintf(url, 1024, URL_PICTURE, DBGetContactSettingDword(0, MODULE, "UID", 0));
pd->url = strdup(url);
pd->bWnd = &bWndPicPopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have unread picture comments");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have unread picture comments"));
@@ -283,16 +283,16 @@ void NotifyBlogSubscriptPost() { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
pd->url = strdup(URL_BLOGSUB);
pd->bWnd = &bWndBlogSubPopup;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = TranslateT("You have unread blog subscription posts");
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, TranslateT("You have unread log subscription posts"));
@@ -321,7 +321,7 @@ void NotifyUnknown(char *name) { MultiByteToWideChar(code_page, 0, MODULE, -1, wproto, 256);
#endif
- PopupData *pd = new PopupData;
+ PopupProcData *pd = new PopupProcData;
pd->url = strdup(URL_HOME);
pd->bWnd = &bWndUnknownPopup;
@@ -335,12 +335,12 @@ void NotifyUnknown(char *name) { TCHAR text[512];
mir_sntprintf(text, 512, TranslateT("Unknown event: %s\n\nClick here to go to your homepage"), tname);
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), popup_class_name};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), popup_class_name};
d.ptszTitle = wproto;
d.ptszText = text;
- d.PluginData = (void *)pd;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)pd;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
_tcsncpy(ppd.lptzContactName, wproto, 256);
_tcscpy(ppd.lptzText, text);
@@ -455,7 +455,7 @@ void InitNotifications() { }
hProtoIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MYSPACE), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, 0);
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ if(ServiceExists(MS_YAPP_REGISTERCLASS)) {
TCHAR tmod[128];
#ifdef _UNICODE
MultiByteToWideChar(code_page, 0, MODULE, -1, tmod, 128);
@@ -465,15 +465,15 @@ void InitNotifications() { mir_snprintf(popup_class_name, 128, "%s/Notify", MODULE);
- POPUPCLASS test = {0};
+ PopupClass test = {0};
test.cbSize = sizeof(test);
test.flags = PCF_TCHAR;
test.hIcon = hProtoIcon;
- test.iSeconds = -1;
+ test.timeout = -1;
test.ptszDescription = tmod;
test.pszName = popup_class_name;
- test.PluginWindowProc = NotifyPopupWindowProc;
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
+ test.windowProc = NotifyPopupWindowProc;
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
}
}
diff --git a/MySpace/version.h b/MySpace/version.h index f88249e..1ebf4be 100644 --- a/MySpace/version.h +++ b/MySpace/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 0
#define __RELEASE_NUM 5
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
diff --git a/message_notify/MessageNotify.mdsp b/message_notify/MessageNotify.mdsp index 678bb6d..fd8763c 100644 --- a/message_notify/MessageNotify.mdsp +++ b/message_notify/MessageNotify.mdsp @@ -96,9 +96,9 @@ extraResourceOptions= [Other]
1=..\..\include\m_database.h
[History]
-popups.cpp,6357
-mywindowlist.cpp,0
-options.cpp,5097
-common.h,643
..\..\include\m_database.h,16842
-messagenotify.cpp,1542
+common.h,643
+options.cpp,5097
+mywindowlist.cpp,0
+popups.cpp,6337
+messagenotify.cpp,726
diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp index 4e1480d..f21c3f3 100644 --- a/message_notify/messagenotify.cpp +++ b/message_notify/messagenotify.cpp @@ -27,7 +27,7 @@ DWORD focusTimerId = 0; PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
"Message Notify",
- PLUGIN_MAKE_VERSION(0,3,0,1),
+ PLUGIN_MAKE_VERSION(0,3,0,2),
"Show a popup when a message is received",
"Scott Ellis",
"mail@scottellis.com.au",
diff --git a/message_notify/popups.cpp b/message_notify/popups.cpp index a82cd0d..9066613 100644 --- a/message_notify/popups.cpp +++ b/message_notify/popups.cpp @@ -136,12 +136,12 @@ void ShowPopup( HANDLE hContact, const char* line1, const char* line2, int flags }
if(classes_enabled) {
- POPUPDATACLASS d = {sizeof(d), "messagenotify"};
+ PopupClassInstance d = {sizeof(d), "messagenotify"};
d.pszTitle = line1;
d.pszText = line2;
d.hContact = hContact;
- d.PluginData = (void *)hContact;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)hContact;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
POPUPDATAEX* ppd = ( POPUPDATAEX* )malloc( sizeof( POPUPDATAEX ));
memset((void *)ppd, 0, sizeof(POPUPDATAEX));
@@ -189,12 +189,12 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in }
if(classes_enabled) {
- POPUPDATACLASS d = {sizeof(d), "messagenotify"};
+ PopupClassInstance d = {sizeof(d), "messagenotify"};
d.pwszTitle = line1;
d.pwszText = line2;
d.hContact = hContact;
- d.PluginData = (void *)hContact;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = (void *)hContact;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
POPUPDATAW* ppd = ( POPUPDATAW* )malloc( sizeof( POPUPDATAW ));
memset((void *)ppd, 0, sizeof(POPUPDATAW));
@@ -251,17 +251,17 @@ bool IsUnicodePopupsEnabled() { void InitUtils() {
hPopupIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
unicode_enabled = ServiceExists(MS_POPUP_ADDPOPUPW) ? true : false;
- classes_enabled = ServiceExists(MS_POPUP_ADDPOPUPCLASS) ? true : false;
+ classes_enabled = ServiceExists(MS_YAPP_REGISTERCLASS) ? true : false;
if(classes_enabled) {
- POPUPCLASS test = {0};
+ PopupClass test = {0};
test.cbSize = sizeof(test);
test.flags = PCF_TCHAR;
test.hIcon = hPopupIcon;
- test.iSeconds = -1;
+ test.timeout = -1;
test.ptszDescription = TranslateT("Message Notify");
test.pszName = "messagenotify";
- test.PluginWindowProc = NullWindowProc;
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
+ test.windowProc = NullWindowProc;
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
}
}
diff --git a/message_notify/popups.h b/message_notify/popups.h index eb71d85..b9ce8ac 100644 --- a/message_notify/popups.h +++ b/message_notify/popups.h @@ -1,7 +1,7 @@ #ifndef _POPUPS_INC
#define _POPUPS_INC
-#include "../../include/m_popup.h"
+#include <m_yapp.h>
#include "options.h"
#include "mywindowlist.h"
diff --git a/otr/common.h b/otr/common.h index 028e7ca..5d7edb0 100644 --- a/otr/common.h +++ b/otr/common.h @@ -19,7 +19,6 @@ #include <statusmodes.h>
#include <m_options.h>
#include <m_langpack.h>
-#include <m_popup.h>
#include <m_system.h>
#include <m_skin.h>
#include <m_netlib.h>
@@ -36,7 +35,7 @@ #include <m_updater.h>
#include <m_metacontacts.h>
-#include <m_popup.h>
+#include <m_yapp.h>
#include <m_icolib.h>
#include <m_folders.h>
diff --git a/otr/otr.mdsp b/otr/otr.mdsp index c9ae5a2..53a08f9 100644 --- a/otr/otr.mdsp +++ b/otr/otr.mdsp @@ -129,9 +129,13 @@ extraResourceOptions= 30=..\..\include\m_updater.h
31=..\..\include\m_database.h
[History]
-..\..\include\m_protosvc.h,21646
-..\..\include\m_protocols.h,0
-..\..\include\m_protomod.h,0
+dllmain.cpp,0
..\..\include\m_database.h,16842
-dllmain.cpp,30072
+..\..\include\m_protomod.h,0
+..\..\include\m_protocols.h,0
+..\..\include\m_protosvc.h,21646
+utils.cpp,41
+common.h,414
+..\..\include\m_yapp.h,1938
+utils.h,0
otr_private.h,171
diff --git a/otr/otr_private.h b/otr/otr_private.h index 5c7ed4f..1b53236 100644 --- a/otr/otr_private.h +++ b/otr/otr_private.h @@ -5,7 +5,7 @@ #define VER_MAJOR 0
#define VER_MINOR 5
#define VER_RELEASE 5
-#define VER_BUILD 1
+#define VER_BUILD 2
#define __STRINGIZE(x) #x
#define VER_STRING __STRINGIZE( VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD )
diff --git a/otr/utils.cpp b/otr/utils.cpp index 79e4a2d..9f77b2c 100644 --- a/otr/utils.cpp +++ b/otr/utils.cpp @@ -1,6 +1,5 @@ #include "common.h"
#include "utils.h"
-#include "../../include/m_popup.h"
#include "options.h"
#include "menu.h"
@@ -60,7 +59,7 @@ void ShowPopup( const char* line1, const char* line2, int timeout ) return;
}
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
ShowClassPopup(popup_class_name, (char *)line1, (char *)line2);
} else {
POPUPDATAEX* ppd = ( POPUPDATAEX* )calloc( sizeof( POPUPDATAEX ), 1 );
@@ -276,16 +275,16 @@ void InitUtils() { hUnlockIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, 16, 16, 0);
}
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ if(ServiceExists(MS_YAPP_REGISTERCLASS)) {
mir_snprintf(popup_class_name, 128, "%s/Notify", MODULE);
- POPUPCLASS test = {0};
+ PopupClass test = {0};
test.cbSize = sizeof(test);
test.hIcon = hProtoIcon;
test.pszDescription = Translate("OTR");
test.pszName = popup_class_name;
- test.PluginWindowProc = NullWindowProc;
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
+ test.windowProc = NullWindowProc;
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
}
}
diff --git a/updater/popups.cpp b/updater/popups.cpp index 813d58c..4dbc7c0 100644 --- a/updater/popups.cpp +++ b/updater/popups.cpp @@ -109,14 +109,14 @@ void ShowPopupA( HANDLE hContact, const char* line1, const char* line2, int flag SetEvent(hEventPop);
ResetEvent(hEventPop);
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), "updaterpopups"};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), "updaterpopups"};
d.pszTitle = (char *)line1;
d.pszText = (char *)line2;
- d.PluginData = malloc(sizeof(PopupDataType));
- ((PopupDataType*)d.PluginData)->flags = flags;
- ((PopupDataType*)d.PluginData)->hIcon = 0;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = malloc(sizeof(PopupDataType));
+ ((PopupDataType*)d.opaque)->flags = flags;
+ ((PopupDataType*)d.opaque)->hIcon = 0;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
POPUPDATAEX* ppd = ( POPUPDATAEX* )malloc( sizeof( POPUPDATAEX ));
@@ -182,14 +182,14 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in SetEvent(hEventPop);
ResetEvent(hEventPop);
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- POPUPDATACLASS d = {sizeof(d), "updaterpopups"};
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), "updaterpopups"};
d.pwszTitle = (wchar_t *)line1;
d.pwszText = (wchar_t *)line2;
- d.PluginData = malloc(sizeof(PopupDataType));
- ((PopupDataType*)d.PluginData)->flags = flags;
- ((PopupDataType*)d.PluginData)->hIcon = 0;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+ d.opaque = malloc(sizeof(PopupDataType));
+ ((PopupDataType*)d.opaque)->flags = flags;
+ ((PopupDataType*)d.opaque)->hIcon = 0;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
} else {
POPUPDATAW* ppd = ( POPUPDATAW* )malloc( sizeof( POPUPDATAW ));
memset((void *)ppd, 0, sizeof(POPUPDATAW));
@@ -311,17 +311,17 @@ void InitPopups() { hEventPop = CreateEvent( NULL, TRUE, FALSE, NULL );
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ if(ServiceExists(MS_YAPP_REGISTERCLASS)) {
hPopupIcon = LoadIconEx(I_CHKUPD);
- POPUPCLASS test = {0};
+ PopupClass test = {0};
test.cbSize = sizeof(test);
test.flags = PCF_TCHAR;
test.hIcon = hPopupIcon;
- test.iSeconds = -1;
+ test.timeout = -1;
test.ptszDescription = TranslateT("Updater");
test.pszName = "updaterpopups";
- test.PluginWindowProc = NullWindowProc;
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
+ test.windowProc = NullWindowProc;
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
}
}
diff --git a/updater/popups.h b/updater/popups.h index c389897..49449fe 100644 --- a/updater/popups.h +++ b/updater/popups.h @@ -1,7 +1,7 @@ #ifndef _POPUPS_INC
#define _POPUPS_INC
-#include <m_popup.h>
+#include <m_yapp.h>
//#include <m_popupw.h>
#include "options.h"
diff --git a/updater/version.h b/updater/version.h index 27630cb..2f6fd54 100644 --- a/updater/version.h +++ b/updater/version.h @@ -5,7 +5,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 5
#define __RELEASE_NUM 2
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
diff --git a/yapp/YAPP.mdsp b/yapp/YAPP.mdsp index 7ac3ef6..045993e 100644 --- a/yapp/YAPP.mdsp +++ b/yapp/YAPP.mdsp @@ -110,15 +110,3 @@ extraResourceOptions= 1=popups2.rc
2=version.rc
[History]
-version.h,150
-..\..\include\newpluginapi.h,1181
-..\..\include\m_plugins.h,0
-popups2.cpp,1500
-popups2.rc,830
-resource.h,2161
-version.rc,24
-resource.rc,23
-popup_history.cpp,2330
-common.h,2366
-message_pump.cpp,1129
-popwin.cpp,2018
diff --git a/yapp/common.h b/yapp/common.h index 88cff9d..c1c6cf6 100644 --- a/yapp/common.h +++ b/yapp/common.h @@ -52,7 +52,7 @@ #include <stdio.h>
#include <m_utils.h>
-#include <m_popup.h>
+#include <m_yapp.h>
#include <m_updater.h>
#include <m_fontservice.h>
diff --git a/yapp/docs/m_popup.h b/yapp/docs/m_popup.h index 6471799..7efad50 100644 --- a/yapp/docs/m_popup.h +++ b/yapp/docs/m_popup.h @@ -85,8 +85,8 @@ typedef struct };
union
{
- WCHAR lptzText[MAX_SECONDLINE];
- WCHAR lpwzText[MAX_SECONDLINE];
+ WCHAR lptzText[MAX_CONTACTNAME];
+ WCHAR lpwzText[MAX_CONTACTNAME];
};
COLORREF colorBack;
COLORREF colorText;
@@ -330,95 +330,9 @@ Returns: 0 if the popup was shown, -1 in case of failure. #define SM_WARNING 0x01 //Triangle icon.
#define SM_NOTIFY 0x02 //Exclamation mark icon.
#define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage"
-#define MS_POPUP_SHOWMESSAGEW "PopUp/ShowMessageW"
static int __inline PUShowMessage(char *lpzText, BYTE kind) {
return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind);
}
-static int __inline PUShowMessageW(wchar_t *lpwzText, BYTE kind) {
- return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText,(LPARAM)kind);
-}
-
-#ifdef _UNICODE
-#define PUShowMessageT PUShowMessageW
-#else
-#define PUShowMessageT PUShowMessage
-#endif
-
-//------------- Class API ----------------//
-
-typedef struct {
- int cbSize;
- int flags;
- char *pszName;
- union {
- char *pszDescription;
- wchar_t *pwszDescription;
- TCHAR *ptszDescription;
- };
-
- HICON hIcon;
-
- COLORREF colorBack;
- COLORREF colorText;
-
- WNDPROC PluginWindowProc;
-
- int iSeconds;
-} POPUPCLASS;
-
-#define PCF_UNICODE 0x0001
-
-#ifdef _UNICODE
-#define PCF_TCHAR PCF_UNICODE
-#else
-#define PCF_TCHAR 0
-#endif
-
-// wParam = 0
-// lParam = (POPUPCLASS *)&pc
-#define MS_POPUP_REGISTERCLASS "PopUp/RegisterClass"
-
-typedef struct {
- int cbSize;
- char *pszClassName;
- union {
- const char *pszTitle;
- const wchar_t *pwszTitle;
- const TCHAR *ptszTitle;
- };
- union {
- const char *pszText;
- const wchar_t *pwszText;
- const TCHAR *ptszText;
- };
- void *PluginData;
- HANDLE hContact;
-} POPUPDATACLASS;
-
-// wParam = 0
-// lParam = (POPUPDATACLASS *)&pdc
-#define MS_POPUP_ADDPOPUPCLASS "PopUp/AddPopupClass"
-
-static int __inline ShowClassPopup(char *name, char *title, char *text) {
- POPUPDATACLASS d = {sizeof(d), name};
- d.pszTitle = title;
- d.pszText = text;
- return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
-}
-
-static int __inline ShowClassPopupW(char *name, wchar_t *title, wchar_t *text) {
- POPUPDATACLASS d = {sizeof(d), name};
- d.pwszTitle = title;
- d.pwszText = text;
- return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
-}
-
-#ifdef _UNICODE
-#define ShowClassPopupT ShowClassPopupW
-#else
-#define ShowClassPopupT ShowClassPopup
-#endif
-
#endif // __m_popup_h__
diff --git a/yapp/docs/m_yapp.h b/yapp/docs/m_yapp.h new file mode 100644 index 0000000..940750c --- /dev/null +++ b/yapp/docs/m_yapp.h @@ -0,0 +1,466 @@ +#ifndef _YAPP_INC
+#define _YAPP_INC
+
+////////////////////////////////////////////////
+// YAPP API
+///////////////////////////////////////////////
+
+typedef struct {
+ int cbSize;
+ int flags; // OR of PDF_* flags below
+ HANDLE hContact;
+ HICON hIcon;
+ union {
+ char *pszTitle;
+ TCHAR *ptzTitle;
+ wchar_t *pwzTitle;
+ };
+ union {
+ char *pszText;
+ TCHAR *ptzText;
+ wchar_t *pwzText;
+ };
+ COLORREF colorBack; // if colorBack and colorText are equal, defaults will be used
+ COLORREF colorText;
+ WNDPROC windowProc; // optional custom window procedure
+ int timeout; // -1 == infinite, 0 == default, otherwise timeout in seconds
+ void *opaque;
+} PopupData;
+
+#define PDF_UNICODE 0x0001
+#ifdef _UNICODE
+#define PDF_TCHAR PDF_UNICODE
+#else
+#define PDF_TCHAR 0
+#endif
+
+// windowProc messages
+#define PM_INIT (WM_USER + 0x0202) // message sent to your windowProc after the window has been initialized
+#define PM_DIENOTIFY (WM_USER + 0x0200) // message sent to your windowProc just before the window is destroyed (can be used e.g. to free your opaque data)
+
+#define PM_DESTROY (WM_USER + 0x0201) // send to the popup hWnd (use PostMessage generally, or SendMessage inside your windowProc) to kill it
+
+// Show a popup
+//wParam = &PopupData
+//lParam = 0
+// returns -1 if popups disabled
+#define MS_YAPP_SHOWPOPUP "YAPP/ShowPopup"
+
+static int __inline ShowPopup(PopupData* pd) {
+ return CallService(MS_YAPP_SHOWPOPUP, (WPARAM)pd,0);
+}
+
+// get hContact from PopupData
+// wParam = hWnd
+// lParam = 0
+// return hContact
+#define MS_YAPP_GETCONTACT "YAPP/GetContact"
+
+static HANDLE __inline PGetContact(HWND hWndPopup) {
+ return (HANDLE)CallService(MS_YAPP_GETCONTACT, (WPARAM)hWndPopup, 0);
+}
+
+// get opaque from PopupData
+// wParam = hWnd
+// lParam = 0
+// returns opaque
+#define MS_YAPP_GETOPAQUE "YAPP/GetOpaque"
+static void __inline * PGetOpaque(HWND hWndPopup) {
+ return (void*)CallService(MS_YAPP_GETOPAQUE,(WPARAM)hWndPopup, 0);
+}
+
+
+//------------- Class API ----------------//
+
+typedef struct {
+ int cbSize;
+ int flags;
+ char *pszName;
+ union {
+ char *pszDescription;
+ wchar_t *pwszDescription;
+ TCHAR *ptszDescription;
+ };
+
+ HICON hIcon;
+
+ COLORREF colorBack;
+ COLORREF colorText;
+
+ WNDPROC windowProc;
+
+ int timeout;
+} PopupClass;
+
+#define PCF_UNICODE 0x0001
+
+#ifdef _UNICODE
+#define PCF_TCHAR PCF_UNICODE
+#else
+#define PCF_TCHAR 0
+#endif
+
+// wParam = 0
+// lParam = (POPUPCLASS *)&pc
+#define MS_YAPP_REGISTERCLASS "YAPP/RegisterClass"
+
+typedef struct {
+ int cbSize;
+ const char *pszClassName;
+ union {
+ const char *pszTitle;
+ const wchar_t *pwszTitle;
+ const TCHAR *ptszTitle;
+ };
+ union {
+ const char *pszText;
+ const wchar_t *pwszText;
+ const TCHAR *ptszText;
+ };
+ void *opaque;
+ HANDLE hContact;
+} PopupClassInstance;
+
+// wParam = 0
+// lParam = (POPUPDATACLASS *)&pdc
+#define MS_YAPP_CLASSINSTANCE "YAPP/ClassInstance"
+
+static int __inline ShowClassPopupA(const char *name, const char *title, const char *text) {
+ PopupClassInstance d = {sizeof(d), name};
+ d.pszTitle = title;
+ d.pszText = text;
+ return CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
+}
+
+static int __inline ShowClassPopupW(const char *name, const wchar_t *title, const wchar_t *text) {
+ PopupClassInstance d = {sizeof(d), name};
+ d.pwszTitle = title;
+ d.pwszText = text;
+ return CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
+}
+
+#ifdef _UNICODE
+#define ShowClassPopup ShowClassPopupW
+#else
+#define ShowClassPopup ShowClassPopupA
+#endif
+
+////////////////////////////////////////////////
+//// legacy support for old popup structures
+///////////////////////////////////////////////
+
+/*
+NOTE! Since Popup 1.0.1.2 there is a main meun group called "PopUps" where I
+have put a "Enable/Disable" item. You can add your own "enable/disable" items
+by adding these lines before you call MS_CLIST_ADDMAINMENUITEM:
+mi.pszPopUpName = Translate("PopUps");
+mi.position = 0; //You don't need it and it's better if you put it to zero.
+*/
+
+#define MAX_CONTACTNAME 2048
+#define MAX_SECONDLINE 2048
+
+// This is the basic data you'll need to fill and pass to the service function.
+typedef struct
+{
+ HANDLE lchContact; // Handle to the contact, can be NULL (main contact).
+ HICON lchIcon; // Handle to a icon to be shown. Cannot be NULL.
+ union
+ {
+ char lptzContactName[MAX_CONTACTNAME]; // This is the contact name or the first line in the plugin. Cannot be NULL.
+ char lpzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ char lptzText[MAX_SECONDLINE]; // This is the second line text. Users can choose to hide it. Cannot be NULL.
+ char lpzText[MAX_SECONDLINE];
+ };
+ COLORREF colorBack; // COLORREF to be used for the background. Can be NULL, default will be used.
+ COLORREF colorText; // COLORREF to be used for the text. Can be NULL, default will be used.
+ WNDPROC PluginWindowProc; // Read below. Can be NULL; default will be used.
+ void * PluginData; // Read below. Can be NULL.
+} POPUPDATA, * LPPOPUPDATA;
+
+// Extended popup data
+typedef struct
+{
+ HANDLE lchContact;
+ HICON lchIcon;
+ union
+ {
+ char lptzContactName[MAX_CONTACTNAME];
+ char lpzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ char lptzText[MAX_SECONDLINE];
+ char lpzText[MAX_SECONDLINE];
+ };
+ COLORREF colorBack;
+ COLORREF colorText;
+ WNDPROC PluginWindowProc;
+ void * PluginData;
+ int iSeconds; // Custom delay time in seconds. -1 means "forever", 0 means "default time".
+ char cZero[16]; // Some unused bytes which may come useful in the future.
+} POPUPDATAEX, *LPPOPUPDATAEX;
+
+// Unicode version of POPUPDATAEX
+typedef struct
+{
+ HANDLE lchContact;
+ HICON lchIcon;
+ union
+ {
+ WCHAR lptzContactName[MAX_CONTACTNAME];
+ WCHAR lpwzContactName[MAX_CONTACTNAME];
+ };
+ union
+ {
+ WCHAR lptzText[MAX_CONTACTNAME];
+ WCHAR lpwzText[MAX_CONTACTNAME];
+ };
+ COLORREF colorBack;
+ COLORREF colorText;
+ WNDPROC PluginWindowProc;
+ void * PluginData;
+ int iSeconds;
+ char cZero[16];
+} POPUPDATAW, *LPPOPUPDATAW;
+
+#if defined(_UNICODE) || defined(UNICODE)
+ typedef POPUPDATAW POPUPDATAT;
+ typedef LPPOPUPDATAW LPPOPUPDATAT;
+#else
+ typedef POPUPDATAEX POPUPDATAT;
+ typedef LPPOPUPDATAEX LPPOPUPDATAT;
+#endif
+
+/* PopUp/AddPopup
+Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
+
+wParam = (WPARAM)(*POPUPDATA)PopUpDataAddress
+lParam = 0
+
+Returns: > 0 on success, 0 if creation went bad, -1 if the PopUpData contained unacceptable values.
+NOTE: it returns -1 if the PopUpData was not valid, if there were already too many popups, if the module was disabled.
+Otherwise, it can return anything else...
+
+*/
+
+#define MS_POPUP_ADDPOPUP "PopUp/AddPopUp"
+static int __inline PUAddPopUp(POPUPDATA* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp,0);
+}
+
+#define MS_POPUP_ADDPOPUPEX "PopUp/AddPopUpEx"
+static int __inline PUAddPopUpEx(POPUPDATAEX* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)ppdp,0);
+}
+
+#define MS_POPUP_ADDPOPUPW "PopUp/AddPopUpW"
+static int __inline PUAddPopUpW(POPUPDATAW* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp,0);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPW
+ #define PUAddPopUpT PUAddPopUpW
+#else
+ #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPEX
+ #define PUAddPopUpT PUAddPopUpEx
+#endif
+
+
+/* PopUp/GetContact
+Returns the handle to the contact associated to the specified PopUpWindow.
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = 0;
+
+Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure.
+*/
+#define MS_POPUP_GETCONTACT "PopUp/GetContact"
+static HANDLE __inline PUGetContact(HWND hPopUpWindow) {
+ return (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopUpWindow,0);
+}
+
+/* PopUp/GetPluginData
+Returns custom plugin date associated with popup
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(PLUGINDATA*)PluginDataAddress;
+
+Returns: the address of the PLUGINDATA structure. Can return NULL, meaning nothing was given. -1 means failure.
+
+IMPORTANT NOTE: it doesn't seem to work if you do:
+CallService(..., (LPARAM)aPointerToAStruct);
+and then use that struct.
+Do this, instead:
+aPointerToStruct = CallService(..., (LPARAM)aPointerToAStruct);
+and it will work. Just look at the example I've written above (PopUpDlgProc).
+
+*/
+#define MS_POPUP_GETPLUGINDATA "PopUp/GetPluginData"
+static void __inline * PUGetPluginData(HWND hPopUpWindow) {
+ long * uselessPointer = NULL;
+ return (void*)CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hPopUpWindow,(LPARAM)uselessPointer);
+}
+
+/* PopUp/IsSecondLineShown
+Checks if second line is enable
+
+wParam = 0
+lParam = 0
+
+Returns: 0 if the user has chosen not to have the second line, 1 if he choose to have the second line.
+*/
+#define MS_POPUP_ISSECONDLINESHOWN "PopUp/IsSecondLineShown"
+static BOOL __inline PUIsSecondLineShown() {
+ return (BOOL)CallService(MS_POPUP_ISSECONDLINESHOWN,0,0);
+}
+
+/* PopUp/Query
+
+Requests an action or an answer from PopUp module.
+
+wParam = (WPARAM)wpQuery
+
+returns 0 on success, -1 on error, 1 on stupid calls ;-)
+*/
+
+#define PUQS_ENABLEPOPUPS 1 // returns 0 if state was changed, 1 if state wasn't changed
+#define PUQS_DISABLEPOPUPS 2 // " "
+#define PUQS_GETSTATUS 3 //Returns 1 (TRUE) if popups are enabled, 0 (FALSE) if popups are disabled.
+
+#define MS_POPUP_QUERY "PopUp/Query"
+
+/* UM_FREEPLUGINDATA
+Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
+
+wParam = 0
+lParam = 0
+*/
+#define UM_FREEPLUGINDATA (WM_USER + 0x0200)
+
+/* UM_DESTROYPOPUP
+Send this message when you want to destroy the popup, or use the function below.
+
+wParam = 0
+lParam = 0
+*/
+#define UM_DESTROYPOPUP (WM_USER + 0x0201)
+static int __inline PUDeletePopUp(HWND hWndPopUp) {
+ return (int)SendMessage(hWndPopUp, UM_DESTROYPOPUP,0,0);
+}
+
+/* UM_INITPOPUP
+This message is sent to the PopUp when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
+Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
+Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
+
+wParam = (WPARAM)(HWND)hPopUpWindow (this is useless, you get message inside your popup window)
+lParam = 0
+*/
+#define UM_INITPOPUP (WM_USER + 0x0202)
+
+/* PopUp/Changetext
+Changes the text displayed in the second line of the popup.
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(char*)lpzNewText
+
+returns: > 0 for success, -1 for failure, 0 if the failure is due to second line not being shown. (but you could call
+PUIsSecondLineShown() before changing the text...)
+*/
+#define MS_POPUP_CHANGETEXT "PopUp/Changetext"
+static int __inline PUChangeText(HWND hWndPopUp, LPCTSTR lpzNewText) {
+ return (int)CallService(MS_POPUP_CHANGETEXT, (WPARAM)hWndPopUp, (LPARAM)lpzNewText);
+}
+
+#define MS_POPUP_CHANGETEXTW "PopUp/ChangetextW"
+static int __inline PUChangeTextW(HWND hWndPopUp, LPCWSTR lpwzNewText) {
+ return (int)CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hWndPopUp, (LPARAM)lpwzNewText);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_CHANGETEXTT MS_POPUP_CHANGETEXTW
+ #define PUChangeTextT PUChangeTextW
+#else
+ #define MS_POPUP_CHANGETEXTT MS_POPUP_CHANGETEXT
+ #define PUChangeTextT PUChangeText
+#endif
+
+/* PopUp/Change
+Changes the entire popup
+
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(POPUPDATAEX*)newData
+*/
+#define MS_POPUP_CHANGE "PopUp/Change"
+static int __inline PUChange(HWND hWndPopUp, POPUPDATAEX *newData) {
+ return (int)CallService(MS_POPUP_CHANGE, (WPARAM)hWndPopUp, (LPARAM)newData);
+}
+
+#define MS_POPUP_CHANGEW "PopUp/ChangeW"
+static int __inline PUChangeW(HWND hWndPopUp, POPUPDATAW *newData) {
+ return (int)CallService(MS_POPUP_CHANGE, (WPARAM)hWndPopUp, (LPARAM)newData);
+}
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define MS_POPUP_CHANGET MS_POPUP_CHANGEW
+ #define PUChangeT PUChangeW
+#else
+ #define MS_POPUP_CHANGET MS_POPUP_CHANGE
+ #define PUChangeT PUChange
+#endif
+
+/* UM_CHANGEPOPUP
+This message is triggered by Change/ChangeText services. You also may post it directly :)
+
+wParam = Modification type
+lParam = value of type defined by wParam
+*/
+
+#define CPT_TEXT 1 // lParam = (char *)text
+#define CPT_TEXTW 2 // lParam = (WCHAR *)text
+#define CPT_TITLE 3 // lParam = (char *)title
+#define CPT_TITLEW 4 // lParam = (WCHAR *)title
+#define CPT_DATA 5 // lParam = (POPUPDATA *)data
+#define CPT_DATAEX 6 // lParam = (POPUPDATAEX *)data
+#define CPT_DATAW 7 // lParam = (POPUPDATAW *)data
+
+#define UM_CHANGEPOPUP (WM_USER + 0x0203)
+
+#if defined(_UNICODE) || defined(UNICODE)
+ #define CPT_TEXTT CPT_TEXTW
+ #define CPT_TITLET CPT_TITLEW
+ #define CPT_DATAT CPT_DATAW
+#else
+ #define CPT_TEXTT CPT_TEXT
+ #define CPT_TITLET CPT_TITLE
+ #define CPT_DATAT CPT_DATA
+#endif
+
+/* PopUp/ShowMessage
+This is mainly for developers.
+Shows a warning message in a PopUp. It's useful if you need a "MessageBox" like function, but you don't want a modal
+window (which will interfere with a DialogProcedure. MessageBox steals focus and control, this one not.
+
+wParam = (char *)lpzMessage
+lParam = 0;
+
+Returns: 0 if the popup was shown, -1 in case of failure.
+*/
+#define SM_WARNING 0x01 //Triangle icon.
+#define SM_NOTIFY 0x02 //Exclamation mark icon.
+#define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage"
+#define MS_POPUP_SHOWMESSAGEW "PopUp/ShowMessageW"
+
+static int __inline PUShowMessage(char *lpzText, BYTE kind) {
+ return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind);
+}
+
+static int __inline PUShowMessageW(wchar_t *lpwzText, BYTE kind) {
+ return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText,(LPARAM)kind);
+}
+#endif // _YAPP_INC
diff --git a/yapp/message_pump.cpp b/yapp/message_pump.cpp index 535f8fc..db84f64 100644 --- a/yapp/message_pump.cpp +++ b/yapp/message_pump.cpp @@ -16,8 +16,8 @@ HANDLE hMPEvent; // from popups, popup2 implementation, slightly modified
// return true if there is a full-screen application (e.g. game) running
bool is_full_screen() {
- int w = GetSystemMetrics(SM_CXFULLSCREEN);
- int h = GetSystemMetrics(SM_CYFULLSCREEN);
+ int w = GetSystemMetrics(SM_CXSCREEN);
+ int h = GetSystemMetrics(SM_CYSCREEN);
// use ClientRect instead of WindowRect so that it works normally for maximized applications - thx Nikto
RECT ClientRect;
HWND hWnd = 0;
@@ -106,6 +106,7 @@ DWORD CALLBACK MessagePumpThread(LPVOID param) { if((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
enabled = false;
+ PopupData *pd = (PopupData *)hwndMsg.lParam;
if(enabled && num_popups < MAX_POPUPS) {
//HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
@@ -113,7 +114,9 @@ DWORD CALLBACK MessagePumpThread(LPVOID param) { if(hwndMsg.wParam) // set notifyer handle
SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
} else {
- free((void *)hwndMsg.lParam);
+ if(pd && pd->pwzTitle) free(pd->pwzTitle);
+ if(pd && pd->pwzText) free(pd->pwzText);
+ if(pd) free(pd);
}
}
break;
@@ -172,7 +175,7 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { // will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(POPUPDATAW *pd, HANDLE hEvent, HWND *hwnd);
+void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump() {
WNDCLASS popup_win_class = {0};
@@ -192,6 +195,5 @@ void InitMessagePump() { }
void DeinitMessagePump() {
-
PostMPMessage(WM_QUIT, 0, 0);
}
diff --git a/yapp/message_pump.h b/yapp/message_pump.h index e57ed55..487c17e 100644 --- a/yapp/message_pump.h +++ b/yapp/message_pump.h @@ -14,7 +14,7 @@ void PostMPMessage(UINT msg, WPARAM, LPARAM); // will post a message to the message queue which will set the hwnd value
// and then set the event...so create an event, call this function and then wait on the event
// when the event is signalled, the hwnd will be valid
-void FindWindow(POPUPDATAW *pd, HANDLE hEvent, HWND *hwnd);
+void FindWindow(PopupData *pd, HANDLE hEvent, HWND *hwnd);
void InitMessagePump();
void DeinitMessagePump();
diff --git a/yapp/notify_imp.cpp b/yapp/notify_imp.cpp index acb9d36..5b20a19 100644 --- a/yapp/notify_imp.cpp +++ b/yapp/notify_imp.cpp @@ -12,8 +12,8 @@ int Popup2Show(WPARAM wParam, LPARAM lParam) { HANDLE hNotify = (HANDLE)lParam;
- POPUPDATAW *pd_out = (POPUPDATAW *)malloc(sizeof(POPUPDATAW));
- memset(pd_out, 0, sizeof(POPUPDATAW));
+ PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData));
+ memset(pd_out, 0, sizeof(PopupData));
PostMPMessage(MUM_CREATEPOPUP, (WPARAM)hNotify, (LPARAM)pd_out);
PostMPMessage(MUM_NMUPDATE, (WPARAM)hNotify, (LPARAM)0);
diff --git a/yapp/options.cpp b/yapp/options.cpp index fa8426d..94a12c4 100644 --- a/yapp/options.cpp +++ b/yapp/options.cpp @@ -86,27 +86,28 @@ void SaveOptions() { }
void ShowExamplePopups() {
- POPUPDATAT pd = {0};
- pd.lchIcon = hPopupIcon;
-
- _tcscpy(pd.lptzContactName, TranslateT("Example"));
- _tcscpy(pd.lptzText, TranslateT("The quick brown fox jumped over the lazy dog."));
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
- _tcscpy(pd.lptzContactName, TranslateT("Example With a Long Title"));
- _tcscpy(pd.lptzText, TranslateT("The quick brown fox jumped over the lazy dog."));
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
- _tcscpy(pd.lptzContactName, TranslateT("Example"));
- _tcscpy(pd.lptzText, TranslateT("Thequickbrownfoxjumpedoverthelazydog."));
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
+ PopupData pd = {sizeof(PopupData)};
+ pd.hIcon = hPopupIcon;
+ pd.flags = PDF_TCHAR;
+
+ pd.ptzTitle = TranslateT("Example");
+ pd.ptzText = TranslateT("The quick brown fox jumped over the lazy dog.");
+ CallService(MS_YAPP_SHOWPOPUP, (WPARAM)&pd, 0);
+ pd.ptzTitle = TranslateT("Example With a Long Title");
+ pd.ptzText = TranslateT("The quick brown fox jumped over the lazy dog.");
+ CallService(MS_YAPP_SHOWPOPUP, (WPARAM)&pd, 0);
+ pd.ptzTitle = TranslateT("Example");
+ pd.ptzText = TranslateT("Thequickbrownfoxjumpedoverthelazydog.");
+ CallService(MS_YAPP_SHOWPOPUP, (WPARAM)&pd, 0);
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while(hContact) {
if(options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
- if(ace && ace->dwFlags & AVS_BITMAP_VALID) {
- pd.lchContact = hContact;
- _tcscpy(pd.lptzText, TranslateT("An avatar."));
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0);
+ if(ace && (ace->dwFlags & AVS_BITMAP_VALID)) {
+ pd.hContact = hContact;
+ pd.ptzText = TranslateT("An avatar.");
+ CallService(MS_YAPP_SHOWPOPUP, (WPARAM)&pd, 0);
break;
}
}
@@ -353,17 +354,17 @@ static BOOL CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return 0;
}
-POPUPCLASS *newclasses = 0;
+PopupClass *newclasses = 0;
static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
{
if(num_classes) {
- newclasses = (POPUPCLASS *)malloc(num_classes * sizeof(POPUPCLASS));
- memcpy(newclasses, classes, num_classes * sizeof(POPUPCLASS));
+ newclasses = (PopupClass *)malloc(num_classes * sizeof(PopupClass));
+ memcpy(newclasses, classes, num_classes * sizeof(PopupClass));
- POPUPCLASS *pc;
+ PopupClass *pc;
int index;
for(int i = 0; i < num_classes; i++) {
pc = &newclasses[i];
@@ -388,8 +389,8 @@ static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, L int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_SETCOLOUR, 0, (LPARAM)newclasses[i].colorText);
SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_SETCOLOUR, 0, (LPARAM)newclasses[i].colorBack);
- CheckDlgButton(hwndDlg, IDC_CHK_TIMEOUT, newclasses[i].iSeconds != -1);
- SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, newclasses[i].iSeconds, TRUE);
+ CheckDlgButton(hwndDlg, IDC_CHK_TIMEOUT, newclasses[i].timeout != -1);
+ SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, newclasses[i].timeout, TRUE);
}
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), index != -1 && IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT));
return TRUE;
@@ -399,7 +400,7 @@ static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, L int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
BOOL tr;
int t = GetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, &tr, FALSE);
- newclasses[i].iSeconds = t;
+ newclasses[i].timeout = t;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -412,9 +413,9 @@ static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, L {
BOOL isChecked = IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT);
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), isChecked);
- if(isChecked) newclasses[i].iSeconds = 0;
- else newclasses[i].iSeconds = -1;
- SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, newclasses[i].iSeconds, TRUE);
+ if(isChecked) newclasses[i].timeout = 0;
+ else newclasses[i].timeout = -1;
+ SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, newclasses[i].timeout, TRUE);
}
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
break;
@@ -428,19 +429,19 @@ static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case IDC_BTN_PREVIEW:
if(newclasses[i].flags & PCF_UNICODE) {
- POPUPCLASS pc = newclasses[i];
- pc.PluginWindowProc = 0;
- POPUPDATACLASS d = {sizeof(d), pc.pszName};
+ PopupClass pc = newclasses[i];
+ pc.windowProc = 0;
+ PopupClassInstance d = {sizeof(d), pc.pszName};
d.pwszTitle = L"Preview";
d.pwszText = L"The quick brown fox jumps over the lazy dog.";
- CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
+ CallService(MS_YAPP_CLASSINSTANCE, (WPARAM)&pc, (LPARAM)&d);
} else {
- POPUPCLASS pc = newclasses[i];
- pc.PluginWindowProc = 0;
- POPUPDATACLASS d = {sizeof(d), pc.pszName};
+ PopupClass pc = newclasses[i];
+ pc.windowProc = 0;
+ PopupClassInstance d = {sizeof(d), pc.pszName};
d.pszTitle = "Preview";
d.pszText = "The quick brown fox jumps over the lazy dog.";
- CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
+ CallService(MS_YAPP_CLASSINSTANCE, (WPARAM)&pc, (LPARAM)&d);
}
break;
}
@@ -449,11 +450,11 @@ static BOOL CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
- memcpy(classes, newclasses, num_classes * sizeof(POPUPCLASS));
+ memcpy(classes, newclasses, num_classes * sizeof(PopupClass));
char setting[256];
for(int i = 0; i < num_classes; i++) {
mir_snprintf(setting, 256, "%s/Timeout", classes[i].pszName);
- DBWriteContactSettingWord(0, MODULE, setting, classes[i].iSeconds);
+ DBWriteContactSettingWord(0, MODULE, setting, classes[i].timeout);
mir_snprintf(setting, 256, "%s/TextCol", classes[i].pszName);
DBWriteContactSettingDword(0, MODULE, setting, (DWORD)classes[i].colorText);
mir_snprintf(setting, 256, "%s/BgCol", classes[i].pszName);
diff --git a/yapp/popups2.cpp b/yapp/popups2.cpp index 56c1c59..cf40d5b 100644 --- a/yapp/popups2.cpp +++ b/yapp/popups2.cpp @@ -350,7 +350,7 @@ extern "C" int POPUPS2_API Load(PLUGINLINK *link) { /*
// test popup classes
- POPUPCLASS test = {0};
+ PopupClass test = {0};
test.cbSize = sizeof(test);
test.flags = PCF_TCHAR;
test.hIcon = LoadIcon(0, IDI_WARNING);
@@ -359,7 +359,7 @@ extern "C" int POPUPS2_API Load(PLUGINLINK *link) { test.iSeconds = 10;
test.ptszDescription = TranslateT("Test popup class");
test.pszName = "popup/testclass";
- CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
*/
return 0;
diff --git a/yapp/popwin.cpp b/yapp/popwin.cpp index 2647d0b..8ff4619 100644 --- a/yapp/popwin.cpp +++ b/yapp/popwin.cpp @@ -139,7 +139,7 @@ void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) { }
struct PopupWindowData {
- POPUPDATAW *pd;
+ PopupData pd;
int new_x, new_y;
bool is_round, av_is_round, mouse_in, close_on_leave;
bool custom_col;
@@ -154,20 +154,22 @@ struct PopupWindowData { LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
PopupWindowData *pwd = (PopupWindowData *)GetWindowLong(hwnd, GWL_USERDATA);
- POPUPDATAW *pd = 0;
- if(pwd) pd = pwd->pd;
+ PopupData *pd = 0;
+ if(pwd) pd = &pwd->pd;
switch(uMsg) {
case WM_CREATE:
{
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
pwd = (PopupWindowData *)malloc(sizeof(PopupWindowData));
- pd = (POPUPDATAW *)cs->lpCreateParams;
- pwd->pd = pd;
+ pd = (PopupData *)cs->lpCreateParams;
+ pwd->pd = *pd;
+ if(pd->pwzTitle) pwd->pd.pwzTitle = wcsdup(pd->pwzTitle);
+ if(pd->pwzText) pwd->pd.pwzText = wcsdup(pd->pwzText);
pwd->hNotify = 0;
- trimW(pwd->pd->lpwzContactName);
- trimW(pwd->pd->lpwzText);
+ trimW(pwd->pd.pwzTitle);
+ trimW(pwd->pd.pwzText);
pwd->is_round = options.round;
pwd->av_is_round = options.av_round;
@@ -202,14 +204,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowLong(hwnd, GWL_USERDATA, (LONG)pwd);
- if(pd->iSeconds == -1 || (pd->iSeconds == 0 && options.default_timeout == -1)) {
+ if(pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) {
// make a really long timeout - say 7 days? ;)
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
} else {
- if(pd->iSeconds == 0) {
+ if(pd->timeout == 0) {
SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
} else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->iSeconds * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
}
}
@@ -240,7 +242,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
#endif
- PostMessage(hwnd, UM_INITPOPUP, (WPARAM)hwnd, 0);
+ PostMessage(hwnd, PM_INIT, (WPARAM)hwnd, 0);
return 0;
case WM_MOUSEMOVE:
if(pwd && !pwd->mouse_in) {
@@ -268,7 +270,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(pwd->mouse_in || (options.global_hover && global_mouse_in))
SetTimer(hwnd, ID_CLOSETIMER, 800, 0); // reset timer if mouse in window - allow another 800 ms
else {
- PostMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
+ PostMessage(hwnd, PM_DESTROY, 0, 0);
}
return TRUE;
} else if(wParam == ID_MOVETIMER) {
@@ -423,7 +425,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa AVATARDRAWREQUEST adr = {0};
adr.cbSize = sizeof(adr);
- adr.hContact = pd->lchContact;
+ adr.hContact = pd->hContact;
adr.hTargetDC = ps.hdc;
adr.rcDraw = avr;
adr.dwFlags = (pwd->av_is_round ? AVDRQ_ROUNDEDCORNER : 0);
@@ -435,7 +437,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // title icon
int iconx, textxmin = r.left + options.padding, textxmax = r.right - options.padding;
- if(pd->lchIcon) {
+ if(pd->hIcon) {
if(options.right_icon) {
iconx = r.right - (16 + options.padding);
textxmax -= 16 + options.padding;
@@ -443,7 +445,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa iconx = r.left + options.padding;
textxmin += 16 + options.padding;
}
- DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->lchIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->hIcon, 16, 16, 0, NULL, DI_NORMAL);
}
// title time
@@ -478,7 +480,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colFirstLine);
- DrawTextW(ps.hdc, pd->lptzContactName, wcslen(pd->lpwzContactName), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
+ DrawTextW(ps.hdc, pd->pwzTitle, wcslen(pd->pwzTitle), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
// title underline
RECT tur;
@@ -489,7 +491,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa FillRect(ps.hdc, &tur, pwd->underlineBrush);
// second line(s)
- int len_second = wcslen(pd->lpwzText);
+ int len_second = wcslen(pd->pwzText);
if(len_second) {
if(hFontSecondLine) SelectObject(ps.hdc, (HGDIOBJ)hFontSecondLine);
if(!pwd->custom_col)
@@ -500,7 +502,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa GetClientRect(hwnd, &r);
tr.left = r.left + options.padding + options.text_indent; tr.right = r.right - options.padding; tr.top = tr.bottom + options.padding; tr.bottom = r.bottom - options.padding;
- DrawTextW(ps.hdc, pd->lpwzText, len_second, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
+ DrawTextW(ps.hdc, pd->pwzText, len_second, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
}
EndPaint(hwnd, &ps);
@@ -521,10 +523,11 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa RemoveWindowFromStack(hwnd);
- SendMessage(hwnd, UM_FREEPLUGINDATA, 0, 0);
+ SendMessage(hwnd, PM_DIENOTIFY, 0, 0);
- free(pd); pd = 0;
- free(pwd); pwd = 0;
+ if(pd->pwzTitle) free(pd->pwzTitle);
+ if(pd->pwzText) free(pd->pwzText);
+ free(pwd); pwd = 0; pd = 0;
SetWindowLong(hwnd, GWL_USERDATA, 0);
break;
@@ -563,7 +566,11 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return TRUE;
case PUM_SETTEXT:
{
- wcscpy(pd->lpwzText, (wchar_t *)lParam);
+ if(pd->pszText) free(pd->pszText);
+ if(lParam)
+ pd->pwzText = wcsdup((wchar_t *)lParam);
+ else
+ pd->pwzText = 0;
// free((void *)lParam); // freed in message pump in case the window has gone
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
@@ -573,7 +580,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_GETCONTACT:
{
HANDLE *phContact = (HANDLE *)wParam;
- *phContact = pd->lchContact;
+ *phContact = pd->hContact;
if(lParam) SetEvent((HANDLE)lParam);
}
return TRUE;
@@ -594,7 +601,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // titlebar height
if(hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine);
- GetTextExtentPoint32W(hdc, pd->lpwzContactName, wcslen(pd->lptzContactName), &size);
+ GetTextExtentPoint32W(hdc, pd->pwzTitle, wcslen(pd->pwzTitle), &size);
pwd->tb_height = size.cy;
if(options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
if(pwd->tb_height < pwd->time_height) pwd->tb_height = pwd->time_height;
@@ -603,7 +610,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // avatar height
if(options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
- AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pd->lchContact, 0);
+ AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pd->hContact, 0);
if(ace && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) {
if(ace->bmHeight >= ace->bmWidth) {
pwd->real_av_height = options.av_size;
@@ -618,7 +625,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
// text height
- int len_second = wcslen(pd->lptzText);
+ int len_second = wcslen(pd->pwzText);
if(len_second) {
RECT r;
r.left = r.top = 0;
@@ -631,7 +638,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa r.right -= pwd->time_width + options.padding;
if(hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
- DrawTextW(hdc, pd->lpwzText, len_second, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
+ DrawTextW(hdc, pd->pwzText, len_second, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
pwd->text_height = r.bottom;
}
@@ -653,25 +660,35 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
return TRUE;
- case PUM_GETPLUGINDATA:
+ case PUM_GETOPAQUE:
{
void **pData = (void **)wParam;
- if(pd) *pData = pd->PluginData;
+ if(pd) *pData = pd->opaque;
if(lParam) SetEvent((HANDLE)lParam);
}
return TRUE;
case PUM_CHANGE:
{
KillTimer(hwnd, ID_CLOSETIMER);
- free(pd);
- pwd->pd = pd = (POPUPDATAW *)malloc(sizeof(POPUPDATAW));
- memcpy(pd, (void *)lParam, sizeof(POPUPDATAW)); // the passed in value is freed in the message pump, in case the window has gone
+ PopupData *pdn = (PopupData *)lParam;
+ if(pd->pwzTitle) { free(pd->pwzTitle); pd->pwzTitle = 0; }
+ if(pd->pwzText) { free(pd->pwzText); pd->pwzText = 0; }
+
+ pwd->pd = *pdn;
+ if(pdn->flags & PDF_UNICODE) {
+ if(pdn->pwzTitle) pwd->pd.pwzTitle = wcsdup(pdn->pwzTitle);
+ if(pdn->pwzText) pwd->pd.pwzText = wcsdup(pdn->pwzText);
+ } else {
+ pwd->pd.flags |= PDF_UNICODE;
+ if(pd->pszTitle) pwd->pd.pwzTitle = a2w(pd->pszTitle);
+ if(pd->pszText) pwd->pd.pwzText = a2w(pd->pszText);
+ }
- if(pd->iSeconds != -1) {
- if(pd->iSeconds == 0) {
+ if(pd->timeout != -1) {
+ if(pd->timeout == 0) {
SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
} else {
- SetTimer(hwnd, ID_CLOSETIMER, pd->iSeconds * 1000, 0);
+ SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
}
} else {
// make a really long timeout - say 7 days? ;)
@@ -691,16 +708,20 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(pwd->hNotify == (HANDLE)wParam) {
pd->colorBack = MNotifyGetDWord(pwd->hNotify, NFOPT_BACKCOLOR, colBg);
pd->colorText = MNotifyGetDWord(pwd->hNotify, NFOPT_TEXTCOLOR, colSecondLine);
- pd->iSeconds = MNotifyGetDWord(pwd->hNotify, NFOPT_TIMEOUT, options.default_timeout);
- pd->lchContact = (HANDLE)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0);
- pd->lchIcon = (HICON)MNotifyGetDWord(pwd->hNotify, NFOPT_ICON, 0);
+ pd->timeout = MNotifyGetDWord(pwd->hNotify, NFOPT_TIMEOUT, options.default_timeout);
+ pd->hContact = (HANDLE)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0);
+ pd->hIcon = (HICON)MNotifyGetDWord(pwd->hNotify, NFOPT_ICON, 0);
+
const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, 0);
- wcsncpy(pd->lpwzContactName, swzName, MAX_CONTACTNAME);
- pd->lpwzContactName[MAX_CONTACTNAME - 1] = 0;
+ if(pd->pwzTitle) free(pd->pwzTitle);
+ if(swzName) pd->pwzTitle = wcsdup(swzName);
+ else pd->pwzTitle = 0;
const wchar_t *swzText = MNotifyGetWString(pwd->hNotify, NFOPT_TEXTW, 0);
- wcsncpy(pd->lpwzText, swzText, MAX_SECONDLINE);
- pd->lpwzText[MAX_SECONDLINE - 1] = 0;
+ if(pd->pwzText) free(pd->pwzText);
+ if(swzText) pd->pwzText = wcsdup(swzText);
+ else pd->pwzText= 0;
+
InvalidateRect(hwnd, 0, TRUE);
RepositionWindows();
}
@@ -711,18 +732,18 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return TRUE;
// drop through
- case UM_DESTROYPOPUP:
+ case PM_DESTROY:
PostMPMessage(MUM_DELETEPOPUP, 0, (LPARAM)hwnd);
return TRUE;
}
- if(pd && pd->PluginWindowProc)
- return CallWindowProc(pd->PluginWindowProc, hwnd, uMsg, wParam, lParam);
+ if(pd && pd->windowProc)
+ return CallWindowProc(pd->windowProc, hwnd, uMsg, wParam, lParam);
else {
// provide a way to close popups, if no PluginWindowProc is provided
if(uMsg == WM_CONTEXTMENU) {
- SendMessage(hwnd, UM_DESTROYPOPUP, 0, 0);
+ SendMessage(hwnd, PM_DESTROY, 0, 0);
return TRUE;
} else
return DefWindowProc(hwnd, uMsg, wParam, lParam);
diff --git a/yapp/popwin.h b/yapp/popwin.h index 951a6ba..d532108 100644 --- a/yapp/popwin.h +++ b/yapp/popwin.h @@ -1,11 +1,11 @@ #ifndef _POPWIN_INC
#define _POPWIN_INC
-#define POP_WIN_CLASS _T(MODULE) _T("WinClass")
+#define POP_WIN_CLASS _T(MODULE) _T("YAPPWindowClass")
#define PUM_SETTEXT (WM_USER + 0x020)
#define PUM_GETCONTACT (WM_USER + 0x021)
-#define PUM_GETPLUGINDATA (WM_USER + 0x022)
+#define PUM_GETOPAQUE (WM_USER + 0x022)
#define PUM_CHANGE (WM_USER + 0x023)
#define PUM_MOVE (WM_USER + 0x024)
#define PUM_GETHEIGHT (WM_USER + 0x025)
diff --git a/yapp/services.cpp b/yapp/services.cpp index 573ae58..ad920cd 100644 --- a/yapp/services.cpp +++ b/yapp/services.cpp @@ -7,12 +7,12 @@ #include <time.h> #include "str_utils.h" -#define NUM_SERVICES 16 +#define NUM_SERVICES 20 HANDLE hService[NUM_SERVICES]; HANDLE hMenuShowHistory, hMenuToggleOnOff; void StripBBCodesInPlace(wchar_t *text) { - if(!DBGetContactSettingByte(0, MODULE, "StripBBCodes", 1)) + if(text == 0 || DBGetContactSettingByte(0, MODULE, "StripBBCodes", 1) == 0) return; int read = 0, write = 0; @@ -41,36 +41,37 @@ void StripBBCodesInPlace(wchar_t *text) { } } -int CreatePopupA(WPARAM wParam, LPARAM lParam) { - if(!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) return 0; - +int OldCreatePopupA(WPARAM wParam, LPARAM lParam) { POPUPDATA *pd_in = (POPUPDATA *)wParam; - POPUPDATAW *pd_out = (POPUPDATAW *)malloc(sizeof(POPUPDATAW)); - - MultiByteToWideChar(code_page, 0, pd_in->lpzContactName, -1, pd_out->lpwzContactName, MAX_CONTACTNAME); - MultiByteToWideChar(code_page, 0, pd_in->lpzText, -1, pd_out->lpwzText, MAX_SECONDLINE); - pd_out->lpwzContactName[MAX_CONTACTNAME - 1] = 0; - pd_out->lpwzText[MAX_SECONDLINE - 1] = 0; - StripBBCodesInPlace(pd_out->lpwzContactName); - StripBBCodesInPlace(pd_out->lpwzText); - - pd_out->lchContact = pd_in->lchContact; - pd_out->lchIcon = pd_in->lchIcon; + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + ZeroMemory(pd_out, sizeof(PopupData)); + + pd_out->cbSize = sizeof(PopupData); + pd_out->flags = PDF_UNICODE; + pd_out->pwzTitle = a2w(pd_in->lpzContactName); + pd_out->pwzText = a2w(pd_in->lpzText); + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); + + pd_out->hContact = pd_in->lchContact; + pd_out->hIcon = pd_in->lchIcon; if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg' pd_out->colorBack = pd_out->colorText = 0; else { pd_out->colorBack = pd_in->colorBack & 0xFFFFFF; pd_out->colorText = pd_in->colorText & 0xFFFFFF; } - pd_out->PluginWindowProc = pd_in->PluginWindowProc; - pd_out->PluginData = pd_in->PluginData; - pd_out->iSeconds = 0; + pd_out->windowProc = pd_in->PluginWindowProc; + pd_out->opaque = pd_in->PluginData; + pd_out->timeout = 0; - lstPopupHistory.Add(pd_out->lpwzContactName, pd_out->lpwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); if(!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) { + free(pd_out->pwzTitle); + free(pd_out->pwzText); free(pd_out); - return 0; + return -1; } //MessageBox(0, pd_out->lpwzContactName, _T("CreatePopupA"), MB_OK); @@ -78,34 +79,36 @@ int CreatePopupA(WPARAM wParam, LPARAM lParam) { return 0; } -int CreatePopupExA(WPARAM wParam, LPARAM lParam) { +int OldCreatePopupExA(WPARAM wParam, LPARAM lParam) { POPUPDATAEX *pd_in = (POPUPDATAEX *)wParam; - POPUPDATAW *pd_out = (POPUPDATAW *)malloc(sizeof(POPUPDATAW)); - - MultiByteToWideChar(code_page, 0, pd_in->lpzContactName, -1, pd_out->lpwzContactName, MAX_CONTACTNAME); - MultiByteToWideChar(code_page, 0, pd_in->lpzText, -1, pd_out->lpwzText, MAX_SECONDLINE); - pd_out->lpwzContactName[MAX_CONTACTNAME - 1] = 0; - pd_out->lpwzText[MAX_SECONDLINE - 1] = 0; - StripBBCodesInPlace(pd_out->lpwzContactName); - StripBBCodesInPlace(pd_out->lpwzText); - - pd_out->lchContact = pd_in->lchContact; - pd_out->lchIcon = pd_in->lchIcon; + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + ZeroMemory(pd_out, sizeof(PopupData)); + pd_out->cbSize = sizeof(PopupData); + pd_out->flags = PDF_UNICODE; + pd_out->pwzTitle = a2w(pd_in->lpzContactName); + pd_out->pwzText = a2w(pd_in->lpzText); + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); + + pd_out->hContact = pd_in->lchContact; + pd_out->hIcon = pd_in->lchIcon; if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg' pd_out->colorBack = pd_out->colorText = 0; else { pd_out->colorBack = pd_in->colorBack & 0xFFFFFF; pd_out->colorText = pd_in->colorText & 0xFFFFFF; } - pd_out->PluginWindowProc = pd_in->PluginWindowProc; - pd_out->PluginData = pd_in->PluginData; - pd_out->iSeconds = pd_in->iSeconds; + pd_out->windowProc = pd_in->PluginWindowProc; + pd_out->opaque= pd_in->PluginData; + pd_out->timeout = pd_in->iSeconds; - lstPopupHistory.Add(pd_out->lpwzContactName, pd_out->lpwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); if(!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) { + free(pd_out->pwzTitle); + free(pd_out->pwzText); free(pd_out); - return 0; + return -1; } //MessageBox(0, pd_out->lpwzContactName, _T("CreatePopupExA"), MB_OK); @@ -113,16 +116,20 @@ int CreatePopupExA(WPARAM wParam, LPARAM lParam) { return 0; } -int CreatePopupW(WPARAM wParam, LPARAM lParam) { +int OldCreatePopupW(WPARAM wParam, LPARAM lParam) { POPUPDATAW *pd_in = (POPUPDATAW *)wParam; - POPUPDATAW *pd_out = (POPUPDATAW *)malloc(sizeof(POPUPDATAW)); - memcpy(pd_out, pd_in, sizeof(POPUPDATAW)); - pd_out->lpwzContactName[MAX_CONTACTNAME - 1] = 0; - pd_out->lpwzText[MAX_SECONDLINE - 1] = 0; - StripBBCodesInPlace(pd_out->lpwzContactName); - StripBBCodesInPlace(pd_out->lpwzText); - + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + ZeroMemory(pd_out, sizeof(PopupData)); + pd_out->cbSize = sizeof(PopupData); + pd_out->flags = PDF_UNICODE; + pd_out->pwzTitle = wcsdup(pd_in->lpwzContactName); + pd_out->pwzText = wcsdup(pd_in->lpwzText); + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); + + pd_out->hContact = pd_in->lchContact; + pd_out->hIcon = pd_in->lchIcon; if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg' pd_out->colorBack = pd_out->colorText = 0; else { @@ -130,10 +137,12 @@ int CreatePopupW(WPARAM wParam, LPARAM lParam) { pd_out->colorText &= 0xFFFFFF; } - lstPopupHistory.Add(pd_out->lpwzContactName, pd_out->lpwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); if(!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) { + free(pd_out->pwzTitle); + free(pd_out->pwzText); free(pd_out); - return 0; + return -1; } //MessageBox(0, pd_out->lpwzContactName, _T("CreatePopupW"), MB_OK); @@ -155,8 +164,7 @@ int ChangeTextA(WPARAM wParam, LPARAM lParam) { HWND hwndPop = (HWND)wParam; char *newText = (char *)lParam; wchar_t buff[MAX_SECONDLINE]; - MultiByteToWideChar(code_page, 0, newText, -1, buff, MAX_SECONDLINE); - buff[MAX_SECONDLINE - 1] = 0; + a2w(newText, buff, MAX_SECONDLINE); StripBBCodesInPlace(buff); if(IsWindow(hwndPop)) @@ -164,6 +172,34 @@ int ChangeTextA(WPARAM wParam, LPARAM lParam) { return 0; } +int ShowPopup(WPARAM wParam, LPARAM lParam) { + PopupData *pd_in = (PopupData *)wParam; + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + *pd_out = *pd_in; + if(pd_in->flags & PDF_UNICODE) {
+ if(pd_in->pwzTitle) pd_out->pwzTitle = wcsdup(pd_in->pwzTitle);
+ if(pd_in->pwzText) pd_out->pwzText = wcsdup(pd_in->pwzText);
+ } else {
+ pd_out->flags |= PDF_UNICODE;
+ if(pd_in->pszTitle) pd_out->pwzTitle = a2w(pd_in->pszTitle);
+ if(pd_in->pszText) pd_out->pwzText = a2w(pd_in->pszText);
+ } + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); + + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); + if(!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) { + if(pd_out->pwzTitle) free(pd_out->pwzTitle); + if(pd_out->pwzText) free(pd_out->pwzText); + free(pd_out); + return -1; + } + + //MessageBox(0, pd_out->lpwzContactName, _T("CreatePopupW"), MB_OK); + PostMPMessage(MUM_CREATEPOPUP, 0, (LPARAM)pd_out); + return 0; +} + int GetContact(WPARAM wParam, LPARAM lParam) { HWND hwndPop = (HWND)wParam; HANDLE hContact; @@ -172,7 +208,6 @@ int GetContact(WPARAM wParam, LPARAM lParam) { } else { HANDLE hEvent = CreateEvent(0, 0, 0, 0); PostMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, (LPARAM)hEvent); - //WaitForSingleObject(hEvent, INFINITE); MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0); CloseHandle(hEvent); } @@ -180,24 +215,18 @@ int GetContact(WPARAM wParam, LPARAM lParam) { return (int)hContact; } -int GetPluginData(WPARAM wParam, LPARAM lParam) { +int GetOpaque(WPARAM wParam, LPARAM lParam) { HWND hwndPop = (HWND)wParam; void *data = 0; if(GetCurrentThreadId() == message_pump_thread_id) { - SendMessage(hwndPop, PUM_GETPLUGINDATA, (WPARAM)&data, 0); + SendMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, 0); } else { HANDLE hEvent = CreateEvent(0, 0, 0, 0); - PostMessage(hwndPop, PUM_GETPLUGINDATA, (WPARAM)&data, (LPARAM)hEvent); - //WaitForSingleObject(hEvent, INFINITE); + PostMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, (LPARAM)hEvent); MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0); CloseHandle(hEvent); } - if(lParam && !ignore_gpd_passed_addy) { - void **pData = (void **)lParam; - *pData = data; - } - return (int)data; } @@ -249,18 +278,22 @@ int TogglePopups(WPARAM wParam, LPARAM lParam) { return 0; } -int PopupChange(WPARAM wParam, LPARAM lParam) { +int PopupChangeA(WPARAM wParam, LPARAM lParam) { HWND hwndPop = (HWND)wParam; POPUPDATAEX *pd_in = (POPUPDATAEX *)lParam; if(IsWindow(hwndPop)) { - POPUPDATAW *pd_out = (POPUPDATAW *)malloc(sizeof(POPUPDATAW)); + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + pd_out->cbSize = sizeof(PopupData); + pd_out->flags = PDF_UNICODE; - MultiByteToWideChar(code_page, 0, pd_in->lpzContactName, -1, pd_out->lpwzContactName, MAX_CONTACTNAME); - MultiByteToWideChar(code_page, 0, pd_in->lpzText, -1, pd_out->lpwzText, MAX_SECONDLINE); + pd_out->pwzTitle = a2w(pd_in->lpzContactName); + pd_out->pwzText = a2w(pd_in->lpzText); + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); - pd_out->lchContact = pd_in->lchContact; - pd_out->lchIcon = pd_in->lchIcon; + pd_out->hContact = pd_in->lchContact; + pd_out->hIcon = pd_in->lchIcon; if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg' pd_out->colorBack = pd_out->colorText = 0; else { @@ -269,11 +302,46 @@ int PopupChange(WPARAM wParam, LPARAM lParam) { } pd_out->colorBack = pd_in->colorBack; pd_out->colorText = pd_in->colorText; - pd_out->PluginWindowProc = pd_in->PluginWindowProc; - pd_out->PluginData = pd_in->PluginData; - pd_out->iSeconds = pd_in->iSeconds; + pd_out->windowProc = pd_in->PluginWindowProc; + pd_out->opaque = pd_in->PluginData; + pd_out->timeout = pd_in->iSeconds; - lstPopupHistory.Add(pd_out->lpwzContactName, pd_out->lpwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); + + PostMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)pd_out); + } + return 0; +} + +int PopupChangeW(WPARAM wParam, LPARAM lParam) { + HWND hwndPop = (HWND)wParam; + POPUPDATAW *pd_in = (POPUPDATAW *)lParam; + + if(IsWindow(hwndPop)) { + PopupData *pd_out = (PopupData *)malloc(sizeof(PopupData)); + pd_out->cbSize = sizeof(PopupData); + pd_out->flags = PDF_UNICODE; + + pd_out->pwzTitle = wcsdup(pd_in->lpwzContactName); + pd_out->pwzText = wcsdup(pd_in->lpwzText); + StripBBCodesInPlace(pd_out->pwzTitle); + StripBBCodesInPlace(pd_out->pwzText); + + pd_out->hContact = pd_in->lchContact; + pd_out->hIcon = pd_in->lchIcon; + if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg' + pd_out->colorBack = pd_out->colorText = 0; + else { + pd_out->colorBack = pd_in->colorBack & 0xFFFFFF; + pd_out->colorText = pd_in->colorText & 0xFFFFFF; + } + pd_out->colorBack = pd_in->colorBack; + pd_out->colorText = pd_in->colorText; + pd_out->windowProc = pd_in->PluginWindowProc; + pd_out->opaque = pd_in->PluginData; + pd_out->timeout = pd_in->iSeconds; + + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); PostMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)pd_out); } @@ -320,10 +388,10 @@ int PopUp_ShowHistory(WPARAM wParam, LPARAM lParam) } int num_classes = 0; -POPUPCLASS *classes = 0; +PopupClass *classes = 0; int RegisterPopupClass(WPARAM wParam, LPARAM lParam) {
- POPUPCLASS *pc = (POPUPCLASS *)lParam;
+ PopupClass *pc = (PopupClass *)lParam;
pc->pszName = strdup(pc->pszName);
if(pc->flags & PCF_UNICODE)
pc->pwszDescription = wcsdup(pc->pwszDescription);
@@ -332,25 +400,25 @@ int RegisterPopupClass(WPARAM wParam, LPARAM lParam) { char setting[256];
mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
- pc->iSeconds = DBGetContactSettingWord(0, MODULE, setting, pc->iSeconds);
- if(pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
+ pc->timeout = DBGetContactSettingWord(0, MODULE, setting, pc->timeout);
+ if(pc->timeout == (WORD)-1) pc->timeout = -1;
mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
pc->colorText = (COLORREF)DBGetContactSettingDword(0, MODULE, setting, (DWORD)pc->colorText);
mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
pc->colorBack = (COLORREF)DBGetContactSettingDword(0, MODULE, setting, (DWORD)pc->colorBack);
- classes = (POPUPCLASS *)realloc(classes, sizeof(POPUPCLASS) * (num_classes + 1));
- memcpy(classes + num_classes, pc, sizeof(POPUPCLASS));
+ classes = (PopupClass *)realloc(classes, sizeof(PopupClass) * (num_classes + 1));
+ memcpy(classes + num_classes, pc, sizeof(PopupClass));
num_classes++;
return 0;
}
int CreateClassPopup(WPARAM wParam, LPARAM lParam) {
- POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
- if(pdc->cbSize != sizeof(POPUPDATACLASS)) return 1;
+ PopupClassInstance *pdc = (PopupClassInstance *)lParam;
+ if(pdc->cbSize != sizeof(PopupClassInstance)) return 1;
- POPUPCLASS *pc = 0;
- if(wParam) pc = (POPUPCLASS *)wParam;
+ PopupClass *pc = 0;
+ if(wParam) pc = (PopupClass *)wParam;
else {
for(int i = 0; i < num_classes; i++) {
if(strcmp(classes[i].pszName, pdc->pszClassName) == 0) {
@@ -360,35 +428,20 @@ int CreateClassPopup(WPARAM wParam, LPARAM lParam) { }
}
if(pc) {
- if(pc->flags & PCF_UNICODE) {
- POPUPDATAW pdw = {0};
- pdw.colorBack = pc->colorBack;
- pdw.colorText = pc->colorText;
- pdw.lchIcon = pc->hIcon;
- pdw.iSeconds = pc->iSeconds;
- pdw.PluginWindowProc = pc->PluginWindowProc;
-
- pdw.lchContact = pdc->hContact;
- pdw.PluginData = pdc->PluginData;
- wcsncpy(pdw.lpwzContactName, pdc->pwszTitle, MAX_CONTACTNAME);
- wcsncpy(pdw.lpwzText, pdc->pwszText, MAX_SECONDLINE);
- - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pdw, 0); - } else {
- POPUPDATAEX pd = {0};
- pd.colorBack = pc->colorBack;
- pd.colorText = pc->colorText;
- pd.lchIcon = pc->hIcon;
- pd.iSeconds = pc->iSeconds;
- pd.PluginWindowProc = pc->PluginWindowProc;
+ PopupData pd = {sizeof(PopupData)};
+ if(pc->flags & PCF_UNICODE) pd.flags |= PDF_UNICODE;
+ pd.colorBack = pc->colorBack;
+ pd.colorText = pc->colorText;
+ pd.hIcon = pc->hIcon;
+ pd.timeout = pc->timeout;
+ pd.windowProc = pc->windowProc;
- pd.lchContact = pdc->hContact;
- pd.PluginData = pdc->PluginData;
- strncpy(pd.lpzContactName, pdc->pszTitle, MAX_CONTACTNAME);
- strncpy(pd.lpzText, pdc->pszText, MAX_SECONDLINE);
- - CallService(MS_POPUP_ADDPOPUP, (WPARAM)&pd, 0); - }
+ pd.hContact = pdc->hContact;
+ pd.opaque = pdc->opaque;
+ pd.pszTitle = (char *)pdc->pszTitle;
+ pd.pszText = (char *)pdc->pszText;
+ + CallService(MS_YAPP_SHOWPOPUP, (WPARAM)&pd, 0); }
return 0;
} @@ -401,14 +454,22 @@ HANDLE hEventBuildMenu; void InitServices() { int i = 0; - hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUP, CreatePopupA); - hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUPEX, CreatePopupExA); - hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUPW, CreatePopupW); + hService[i++] = CreateServiceFunction(MS_YAPP_SHOWPOPUP, ShowPopup); + hService[i++] = CreateServiceFunction(MS_YAPP_REGISTERCLASS, RegisterPopupClass); + hService[i++] = CreateServiceFunction(MS_YAPP_CLASSINSTANCE, CreateClassPopup); + hService[i++] = CreateServiceFunction(MS_YAPP_GETCONTACT, GetContact); + hService[i++] = CreateServiceFunction(MS_YAPP_GETOPAQUE, GetOpaque); + + // legacy support + hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUP, OldCreatePopupA); + hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUPEX, OldCreatePopupExA); + hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUPW, OldCreatePopupW); hService[i++] = CreateServiceFunction(MS_POPUP_CHANGETEXTW, ChangeTextW); hService[i++] = CreateServiceFunction(MS_POPUP_CHANGETEXT, ChangeTextA); - hService[i++] = CreateServiceFunction(MS_POPUP_CHANGE, PopupChange); + hService[i++] = CreateServiceFunction(MS_POPUP_CHANGE, PopupChangeA); + hService[i++] = CreateServiceFunction(MS_POPUP_CHANGEW, PopupChangeW); hService[i++] = CreateServiceFunction(MS_POPUP_GETCONTACT, GetContact); - hService[i++] = CreateServiceFunction(MS_POPUP_GETPLUGINDATA, GetPluginData); + hService[i++] = CreateServiceFunction(MS_POPUP_GETPLUGINDATA, GetOpaque); hService[i++] = CreateServiceFunction(MS_POPUP_ISSECONDLINESHOWN, IsSecondLineShown); hService[i++] = CreateServiceFunction(MS_POPUP_QUERY, PopupQuery); @@ -418,8 +479,6 @@ void InitServices() { hService[i++] = CreateServiceFunction(MS_POPUP_SHOWHISTORY, PopUp_ShowHistory); hService[i++] = CreateServiceFunction("PopUp/ToggleEnabled", TogglePopups); - hService[i++] = CreateServiceFunction(MS_POPUP_REGISTERCLASS, RegisterPopupClass); - hService[i++] = CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, CreateClassPopup); CLISTMENUITEM menu = {0}; @@ -448,7 +507,8 @@ void InitServices() { } void DeinitServices() { - for(int i = 0; i < num_classes; i++) { + int i; + for(i = 0; i < num_classes; i++) { free(classes[i].pszName); free(classes[i].pszDescription); } @@ -456,6 +516,6 @@ void DeinitServices() { UnhookEvent(hEventBuildMenu); - for(int i = 0; i < NUM_SERVICES; i++) + for(i = 0; i < NUM_SERVICES; i++) if(hService[i]) DestroyServiceFunction(hService[i]); } diff --git a/yapp/services.h b/yapp/services.h index 91761f9..b47a793 100644 --- a/yapp/services.h +++ b/yapp/services.h @@ -1,7 +1,7 @@ #ifndef _SERVICES_INC
#define _SERVICES_INC
-#include <m_popup.h>
+#include <m_yapp.h>
void InitServices();
void DeinitServices();
@@ -28,7 +28,7 @@ int CreateClassPopup(WPARAM wParam, LPARAM lParam); */
extern int num_classes; -extern POPUPCLASS *classes; +extern PopupClass *classes; #endif
diff --git a/yapp/version.h b/yapp/version.h index 6fd31b0..75d8637 100644 --- a/yapp/version.h +++ b/yapp/version.h @@ -2,9 +2,9 @@ #define __VERSION_H_INCLUDED
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 4
+#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 3
+#define __BUILD_NUM 0
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
|