summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-06 16:15:45 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-06 16:15:55 +0300
commitf580be3d9dcccb14831d6bed9e7dfca600f5b6f8 (patch)
tree468913d477b9d2a9fb430df9a886d24a8cf41887 /src/mir_app
parent827dbce0a554ccc313fd0b14b45bd57dffeead95 (diff)
popups:
- internal implementation details & all service declarations moved to m_popup_int.h; - all service calls removed and replaced with function calls; - direct access to popup serttings replaced with Popup_Enable / Popup_Enabled;
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/chat_tools.cpp2
-rw-r--r--src/mir_app/src/mir_app.def21
-rw-r--r--src/mir_app/src/mir_app64.def21
-rw-r--r--src/mir_app/src/popups.cpp147
-rw-r--r--src/mir_app/src/stdafx.h54
5 files changed, 216 insertions, 29 deletions
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 12e33f87eb..9762f03ee1 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -203,7 +203,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
pd.PluginWindowProc = PopupDlgProc;
pd.PluginData = si;
- return PUAddPopupW(&pd);
+ return (INT_PTR)PUAddPopupW(&pd);
}
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 314a530e15..26df34bbb4 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -652,3 +652,24 @@ db_mc_tryMeta @732
?setUString@PROTO_INTERFACE@@QAEXPBD0@Z @742 NONAME
?setUString@CMPluginBase@@QAEXIPBD0@Z @743 NONAME
?setUString@CMPluginBase@@QAEXPBD0@Z @744 NONAME
+?getKeyList@GCSessionInfoBase@@QAEAAU?$LIST@UUSERINFO@@@@XZ @745 NONAME
+PUAddPopup @746
+PUAddPopupW @747
+PUChangeTextW @748
+PUChangeW @749
+PUDeletePopup @750
+PUGetContact @751
+PUGetPluginData @752
+PURegisterActions @753
+PURegisterNotification @754
+PUShowMessage @755
+PUShowMessageW @756
+Popup_RegisterClass @757
+Popup_UnregisterClass @758
+ShowClassPopup @759
+ShowClassPopupW @760
+Popup_Enable @761
+Popup_Enabled @762
+Popup_AddClass @763
+Popup_Add @764
+Popup_Change @765
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b770ff95c3..44315b8df0 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -652,3 +652,24 @@ db_mc_tryMeta @732
?setUString@PROTO_INTERFACE@@QEAAXPEBD0@Z @742 NONAME
?setUString@CMPluginBase@@QEAAXIPEBD0@Z @743 NONAME
?setUString@CMPluginBase@@QEAAXPEBD0@Z @744 NONAME
+?getKeyList@GCSessionInfoBase@@QEAAAEAU?$LIST@UUSERINFO@@@@XZ @745 NONAME
+PUAddPopup @746
+PUAddPopupW @747
+PUChangeTextW @748
+PUChangeW @749
+PUDeletePopup @750
+PUGetContact @751
+PUGetPluginData @752
+PURegisterActions @753
+PURegisterNotification @754
+PUShowMessage @755
+PUShowMessageW @756
+Popup_RegisterClass @757
+Popup_UnregisterClass @758
+ShowClassPopup @759
+ShowClassPopupW @760
+Popup_Enable @761
+Popup_Enabled @762
+Popup_AddClass @763
+Popup_Add @764
+Popup_Change @765
diff --git a/src/mir_app/src/popups.cpp b/src/mir_app/src/popups.cpp
new file mode 100644
index 0000000000..67bee51a6e
--- /dev/null
+++ b/src/mir_app/src/popups.cpp
@@ -0,0 +1,147 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+MIR_APP_DLL(bool) Popup_Enabled()
+{
+ return db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
+}
+
+MIR_APP_DLL(void) Popup_Enable(bool bEnable)
+{
+ db_set_b(0, "Popup", "ModuleIsEnabled", bEnable);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup v2.0
+
+MIR_APP_DLL(HWND) Popup_Add(const POPUPDATA2 *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUP2, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(void) Popup_Change(HWND hwndPopup, const POPUPDATA2 *pData)
+{
+ CallService(MS_POPUP_CHANGEPOPUP2, (WPARAM)hwndPopup, (LPARAM)pData);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popups v1.0
+
+MIR_APP_DLL(HWND) PUAddPopup(POPUPDATA *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(HWND) PUAddPopupW(POPUPDATAW *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(int) PUChangeW(HWND hWndPopup, POPUPDATAW *newData)
+{
+ return (int)CallService(MS_POPUP_CHANGEW, (WPARAM)hWndPopup, (LPARAM)newData);
+}
+
+MIR_APP_DLL(int) PUChangeTextW(HWND hWndPopup, const wchar_t *lpwzNewText)
+{
+ return (int)CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hWndPopup, (LPARAM)lpwzNewText);
+}
+
+MIR_APP_DLL(int) PUDeletePopup(HWND hWndPopup)
+{
+ return (int)CallService(MS_POPUP_DESTROYPOPUP, 0, (LPARAM)hWndPopup);
+}
+
+MIR_APP_DLL(MCONTACT) PUGetContact(HWND hPopupWindow)
+{
+ return (MCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopupWindow, 0);
+}
+
+MIR_APP_DLL(void*) PUGetPluginData(HWND hPopupWindow)
+{
+ return (void*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hPopupWindow, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Messages
+
+MIR_APP_DLL(int) PUShowMessage(const char *lpzText, DWORD kind)
+{
+ return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText, (LPARAM)kind);
+}
+
+MIR_APP_DLL(int) PUShowMessageW(const wchar_t *lpwzText, DWORD kind)
+{
+ return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText, (LPARAM)kind);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Actions
+
+MIR_APP_DLL(int) PURegisterActions(POPUPACTION *actions, int count)
+{
+ return (int)CallService(MS_POPUP_REGISTERACTIONS, (WPARAM)actions, (LPARAM)count);
+}
+
+MIR_APP_DLL(HANDLE) PURegisterNotification(LPPOPUPNOTIFICATION notification)
+{
+ return (HANDLE)CallService(MS_POPUP_REGISTERNOTIFICATION, (WPARAM)notification, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup classes
+
+MIR_APP_DLL(HANDLE) Popup_RegisterClass(POPUPCLASS *pc)
+{
+ return (HANDLE)CallService(MS_POPUP_REGISTERCLASS, 0, LPARAM(pc));
+}
+
+MIR_APP_DLL(void) Popup_UnregisterClass(HANDLE ppc)
+{
+ if (ppc)
+ CallService(MS_POPUP_UNREGISTERCLASS, 0, LPARAM(ppc));
+}
+
+MIR_APP_DLL(HWND) Popup_AddClass(POPUPDATACLASS *pData)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)pData);
+}
+
+MIR_APP_DLL(HWND) ShowClassPopup(const char *name, const char *title, const char *text)
+{
+ POPUPDATACLASS d = { sizeof(d), name };
+ d.szTitle.a = title;
+ d.szText.a = text;
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+}
+
+MIR_APP_DLL(HWND) ShowClassPopupW(const char *name, const wchar_t *title, const wchar_t *text)
+{
+ POPUPDATACLASS d = { sizeof(d), name };
+ d.szTitle.w = title;
+ d.szText.w = text;
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+}
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index de011d93a3..9d369695a0 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -60,48 +60,46 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-#include <m_system.h>
#include <newpluginapi.h>
-#include <m_database.h>
-#include <m_db_int.h>
-#include <m_clc.h>
-#include <m_crypto.h>
-#include <m_langpack.h>
-#include <m_clistint.h>
#include <m_avatars.h>
+#include <m_awaymsg.h>
#include <m_button.h>
+#include <m_clc.h>
+#include <m_clistint.h>
+#include <m_cluiframes.h>
+#include <m_contacts.h>
+#include <m_crypto.h>
+#include <m_db_int.h>
+#include <m_extraicons.h>
+#include <m_file.h>
+#include <m_findadd.h>
+#include <m_gui.h>
+#include <m_icolib.h>
#include <m_idle.h>
-#include <m_protosvc.h>
-#include <m_protocols.h>
-#include <m_protoint.h>
+#include <m_ignore.h>
+#include <m_imgsrvc.h>
#include <m_hotkeys.h>
#include <m_fontservice.h>
+#include <m_langpack.h>
+#include <m_metacontacts.h>
+#include <m_netlib.h>
#include <m_options.h>
-#include <m_skin.h>
-#include <m_contacts.h>
#include <m_message.h>
-#include <m_userinfo.h>
-#include <m_findadd.h>
-#include <m_file.h>
-#include <m_awaymsg.h>
-#include <m_ignore.h>
-#include <m_icolib.h>
-#include <m_timezones.h>
-#include <m_extraicons.h>
-#include <m_xstatus.h>
-#include <m_cluiframes.h>
-#include <m_metacontacts.h>
-#include <m_gui.h>
+#include <m_popup_int.h>
+#include <m_protosvc.h>
+#include <m_protocols.h>
+#include <m_protoint.h>
+#include <m_skin.h>
#include <m_srmm_int.h>
-#include <m_imgsrvc.h>
+#include <m_ssl.h>
+#include <m_timezones.h>
#include <m_toptoolbar.h>
+#include <m_userinfo.h>
#include <m_version.h>
+#include <m_xstatus.h>
#include "miranda.h"
-#include <m_ssl.h>
-#include <m_netlib.h>
-
typedef struct GlobalLogSettingsBase GlobalLogSettings;
#include <m_chat_int.h>