summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-14 21:33:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-14 21:33:38 +0000
commit0f8566dd046d34ea0ff6b747f7383ffb17f6761e (patch)
tree7754cc5ea95a3599ad18410f3708cf70625baf63 /src
parent5bb6c8a74313a4b62de9cd4c2613d43945c3727b (diff)
WindowList_* functions are not services anymore; unneeded helpers removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdaway/src/awaymsg.cpp2
-rw-r--r--src/core/stdmsg/src/globals.h2
-rw-r--r--src/core/stduihist/src/history.cpp2
-rw-r--r--src/core/stdurl/commonheaders.h1
-rw-r--r--src/core/stdurl/url.cpp2
-rw-r--r--src/core/stdurl/urldialogs.cpp2
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp2
-rw-r--r--src/mir_app/src/clc.cpp2
-rw-r--r--src/mir_app/src/utils.cpp2
-rw-r--r--src/mir_app/src/windowlist.cpp111
-rw-r--r--src/mir_core/mir_core_10.vcxproj1
-rw-r--r--src/mir_core/mir_core_10.vcxproj.filters3
-rw-r--r--src/mir_core/mir_core_12.vcxproj1
-rw-r--r--src/mir_core/mir_core_12.vcxproj.filters3
-rw-r--r--src/mir_core/src/mir_core.def7
-rw-r--r--src/mir_core/src/mir_core64.def7
-rw-r--r--src/mir_core/src/windowlist.cpp104
17 files changed, 133 insertions, 121 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index 6d476adcff..80f775ff8f 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int LoadAwayMessageSending(void);
static HGENMENU hAwayMsgMenuItem;
-static HANDLE hWindowList;
+static MWindowList hWindowList;
struct AwayMsgDlgData {
MCONTACT hContact;
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h
index 8d5ba0683b..ff0557fc79 100644
--- a/src/core/stdmsg/src/globals.h
+++ b/src/core/stdmsg/src/globals.h
@@ -49,7 +49,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct GlobalMessageData
{
unsigned int flags;
- HANDLE hMessageWindowList;
+ MWindowList hMessageWindowList;
DWORD openFlags;
DWORD msgTimeout;
DWORD nFlashMax;
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index 176a761ac4..8f38b2d02f 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static HANDLE hWindowList = 0;
+static MWindowList hWindowList = 0;
static HGENMENU hContactMenu = 0;
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdurl/commonheaders.h b/src/core/stdurl/commonheaders.h
index 90c3c440d5..6651d1f240 100644
--- a/src/core/stdurl/commonheaders.h
+++ b/src/core/stdurl/commonheaders.h
@@ -71,3 +71,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
extern HINSTANCE hInst;
+extern MWindowList hUrlWindowList;
diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp
index f12c170831..5c1b3c50b3 100644
--- a/src/core/stdurl/url.cpp
+++ b/src/core/stdurl/url.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_url.h>
#include "url.h"
-HANDLE hUrlWindowList = NULL;
+MWindowList hUrlWindowList = NULL;
static HANDLE hEventContactSettingChange = NULL;
static HANDLE hContactDeleted = NULL;
static HGENMENU hSRUrlMenuItem = NULL;
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp
index d681aa2bde..f65bf202b9 100644
--- a/src/core/stdurl/urldialogs.cpp
+++ b/src/core/stdurl/urldialogs.cpp
@@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern HANDLE hUrlWindowList;
-
static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
{
TCHAR newtitle[256], oldtitle[256];
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 9fc5cbe86a..db234f29cb 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int DetailsInit(WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static HANDLE hWindowList = NULL;
+static MWindowList hWindowList = NULL;
static HANDLE hDetailsInitEvent;
struct DetailsPageInit
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 6863694d05..e677c7c6e3 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -34,7 +34,7 @@ void UninitCustomMenus(void);
void MTG_OnmodulesLoad(void);
static bool bModuleInitialized = false;
-static HANDLE hClcWindowList;
+static MWindowList hClcWindowList;
static HANDLE hShowInfoTipEvent;
HANDLE hHideInfoTipEvent;
static LIST<void> arEvents(10);
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp
index 9ac79dd185..cebebc6e5f 100644
--- a/src/mir_app/src/utils.cpp
+++ b/src/mir_app/src/utils.cpp
@@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam);
int InitOpenUrl(void);
-int InitWindowList(void);
int InitPathUtils(void);
int InitHyperlink(void);
int InitColourPicker(void);
@@ -477,7 +476,6 @@ int LoadUtilsModule(void)
CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda);
InitOpenUrl();
- InitWindowList();
InitHyperlink();
InitPathUtils();
InitColourPicker();
diff --git a/src/mir_app/src/windowlist.cpp b/src/mir_app/src/windowlist.cpp
deleted file mode 100644
index cea13f4e6e..0000000000
--- a/src/mir_app/src/windowlist.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (ñ) 2012-15 Miranda NG project (http://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"
-
-struct TWindowListItem
-{
- TWindowListItem(MCONTACT _contact, HWND _wnd) :
- hContact(_contact),
- hWnd(_wnd)
- {}
-
- MCONTACT hContact;
- HWND hWnd;
-};
-
-typedef OBJLIST<TWindowListItem> TWindowList;
-
-static INT_PTR AllocWindowList(WPARAM, LPARAM)
-{
- return (INT_PTR)new TWindowList(10, NumericKeySortT);
-}
-
-static INT_PTR DestroyWindowList(WPARAM wParam, LPARAM)
-{
- delete (TWindowList*)wParam;
- return 0;
-}
-
-static INT_PTR AddToWindowList(WPARAM, LPARAM lParam)
-{
- WINDOWLISTENTRY *pEntry = (WINDOWLISTENTRY*)lParam;
- TWindowList *pList = (TWindowList*)pEntry->hList;
- if (pList != NULL)
- pList->insert(new TWindowListItem(pEntry->hContact, pEntry->hwnd));
- return 0;
-}
-
-static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0) return 1;
- TWindowList &pList = *(TWindowList*)wParam;
- for (int i = 0; i < pList.getCount(); i++) {
- if (pList[i].hWnd == (HWND)lParam) {
- pList.remove(i);
- return 0;
- }
- }
- return 1;
-}
-
-static INT_PTR FindInWindowList(WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0) return NULL;
- TWindowList &pList = *(TWindowList*)wParam;
- TWindowListItem *p = pList.find((TWindowListItem*)&lParam);
- return (p == NULL) ? NULL : (INT_PTR)p->hWnd;
-}
-
-static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0 || lParam == 0) return NULL;
- TWindowList &pList = *(TWindowList*)wParam;
- MSG *msg = (MSG*)lParam;
- for (int i = pList.getCount()-1; i >= 0; i--)
- SendMessage(pList[i].hWnd, msg->message, msg->wParam, msg->lParam);
- return 0;
-}
-
-static INT_PTR BroadcastToWindowListAsync(WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0 || lParam == 0) return NULL;
- TWindowList &pList = *(TWindowList*)wParam;
- MSG *msg = (MSG*)lParam;
- for (int i = pList.getCount()-1; i >= 0; i--)
- PostMessage(pList[i].hWnd, msg->message, msg->wParam, msg->lParam);
- return 0;
-}
-
-int InitWindowList(void)
-{
- CreateServiceFunction(MS_UTILS_ALLOCWINDOWLIST, AllocWindowList);
- CreateServiceFunction(MS_UTILS_DESTROYWINDOWLIST, DestroyWindowList);
- CreateServiceFunction(MS_UTILS_ADDTOWINDOWLIST, AddToWindowList);
- CreateServiceFunction(MS_UTILS_REMOVEFROMWINDOWLIST, RemoveFromWindowList);
- CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST, BroadcastToWindowList);
- CreateServiceFunction(MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC, BroadcastToWindowListAsync);
- CreateServiceFunction(MS_UTILS_FINDWINDOWINLIST, FindInWindowList);
- return 0;
-}
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj
index ce4eb74f8c..68946ed6c2 100644
--- a/src/mir_core/mir_core_10.vcxproj
+++ b/src/mir_core/mir_core_10.vcxproj
@@ -92,6 +92,7 @@
<ClCompile Include="src\ui_utils.cpp" />
<ClCompile Include="src\utf.cpp" />
<ClCompile Include="src\utils.cpp" />
+ <ClCompile Include="src\windowlist.cpp" />
<ClCompile Include="src\winver.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters
index 7160a06293..f65ee2856e 100644
--- a/src/mir_core/mir_core_10.vcxproj.filters
+++ b/src/mir_core/mir_core_10.vcxproj.filters
@@ -115,6 +115,9 @@
<ClCompile Include="src\bitmaps.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\windowlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj
index a83072c7fd..ab2cb013e5 100644
--- a/src/mir_core/mir_core_12.vcxproj
+++ b/src/mir_core/mir_core_12.vcxproj
@@ -96,6 +96,7 @@
<ClCompile Include="src\ui_utils.cpp" />
<ClCompile Include="src\utf.cpp" />
<ClCompile Include="src\utils.cpp" />
+ <ClCompile Include="src\windowlist.cpp" />
<ClCompile Include="src\winver.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters
index ec0939a562..d320dd8ba4 100644
--- a/src/mir_core/mir_core_12.vcxproj.filters
+++ b/src/mir_core/mir_core_12.vcxproj.filters
@@ -115,6 +115,9 @@
<ClCompile Include="src\bitmaps.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\windowlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\m_core.h">
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index f2decbe158..6c1c107d7f 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1238,3 +1238,10 @@ Bitmap_GetFilter @1248
Bitmap_Load @1249
CreateProtoServiceFunction @1250
?SetSilent@CCtrlBase@@QAEXXZ @1251 NONAME
+WindowList_Add @1252
+WindowList_Broadcast @1253
+WindowList_BroadcastAsync @1254
+WindowList_Create @1255
+WindowList_Destroy @1256
+WindowList_Find @1257
+WindowList_Remove @1258
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 3a15379fcd..9fc7449fee 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1238,3 +1238,10 @@ Bitmap_GetFilter @1248
Bitmap_Load @1249
CreateProtoServiceFunction @1250
?SetSilent@CCtrlBase@@QEAAXXZ @1251 NONAME
+WindowList_Add @1252
+WindowList_Broadcast @1253
+WindowList_BroadcastAsync @1254
+WindowList_Create @1255
+WindowList_Destroy @1256
+WindowList_Find @1257
+WindowList_Remove @1258
diff --git a/src/mir_core/src/windowlist.cpp b/src/mir_core/src/windowlist.cpp
new file mode 100644
index 0000000000..425db3f2db
--- /dev/null
+++ b/src/mir_core/src/windowlist.cpp
@@ -0,0 +1,104 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://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 "commonheaders.h"
+
+struct TWindowListItem
+{
+ TWindowListItem(MCONTACT _contact, HWND _wnd) :
+ hContact(_contact),
+ hWnd(_wnd)
+ {}
+
+ MCONTACT hContact;
+ HWND hWnd;
+};
+
+struct TWindowList : public OBJLIST<TWindowListItem>
+{
+ TWindowList() :
+ OBJLIST<TWindowListItem>(10, NumericKeySortT)
+ {}
+};
+
+MIR_CORE_DLL(MWindowList) WindowList_Create(void)
+{
+ return new TWindowList();
+}
+
+MIR_CORE_DLL(void) WindowList_Destroy(MWindowList hList)
+{
+ delete hList;
+}
+
+MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact)
+{
+ if (hList == NULL)
+ return 1;
+
+ hList->insert(new TWindowListItem(hContact, hwnd));
+ return 0;
+}
+
+MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd)
+{
+ if (hList == NULL) return 1;
+
+ for (int i = 0; i < hList->getCount(); i++) {
+ if ((*hList)[i].hWnd == hwnd) {
+ hList->remove(i);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact)
+{
+ if (hList == NULL)
+ return NULL;
+
+ TWindowListItem *p = hList->find((TWindowListItem*)&hContact);
+ return (p == NULL) ? NULL : p->hWnd;
+}
+
+MIR_CORE_DLL(int) WindowList_Broadcast(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (hList == NULL)
+ return NULL;
+
+ for (int i = hList->getCount()-1; i >= 0; i--)
+ SendMessage((*hList)[i].hWnd, message, wParam, lParam);
+ return 0;
+}
+
+MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (hList == NULL)
+ return NULL;
+
+ for (int i = hList->getCount()-1; i >= 0; i--)
+ PostMessage((*hList)[i].hWnd, message, wParam, lParam);
+ return 0;
+}