summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-16 13:53:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-16 13:53:50 +0300
commit98f4bfb4b4d90f958685bbdc2b5c9baae522f17c (patch)
treeca0990f2945ca42f429b18dbd3cf075256fb7d95 /plugins/Clist_modern/src
parent14bdd09684eb98da73a0fe46882f883f109841d6 (diff)
Clist_modern => CMPlugin
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/cluiframes.cpp20
-rw-r--r--plugins/Clist_modern/src/init.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp10
-rw-r--r--plugins/Clist_modern/src/modern_clcopts.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistopts.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_skinbutton.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp10
-rw-r--r--plugins/Clist_modern/src/modern_skinopt.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_statusbar.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_toolbar.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_viewmodebar.cpp16
-rw-r--r--plugins/Clist_modern/src/stdafx.h7
17 files changed, 69 insertions, 60 deletions
diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp
index e5e61255a5..3006c0441e 100644
--- a/plugins/Clist_modern/src/cluiframes.cpp
+++ b/plugins/Clist_modern/src/cluiframes.cpp
@@ -960,7 +960,7 @@ static int UpdateTBToolTip(int framepos)
{
TOOLINFO ti = { sizeof(ti) };
ti.lpszText = g_pfwFrames[framepos].TitleBar.tooltip;
- ti.hinst = g_hInst;
+ ti.hinst = g_plugin.getInst();
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.uId = (UINT_PTR)g_pfwFrames[framepos].TitleBar.hwnd;
return SendMessage(g_pfwFrames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
@@ -1564,21 +1564,21 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM)
| WS_CHILD | WS_CLIPCHILDREN |
(F.TitleBar.ShowTitleBar ? WS_VISIBLE : 0) |
WS_CLIPCHILDREN,
- 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_hInst, nullptr);
+ 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(F.TitleBar.hwnd, GWLP_USERDATA, F.id);
F.TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- pcli->hwndContactList, nullptr, g_hInst,
+ pcli->hwndContactList, nullptr, g_plugin.getInst(),
nullptr);
SetWindowPos(F.TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
{
TOOLINFO ti = { sizeof(ti) };
ti.lpszText = L"";
- ti.hinst = g_hInst;
+ ti.hinst = g_plugin.getInst();
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.uId = (UINT_PTR)F.TitleBar.hwnd;
SendMessage(F.TitleBar.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
@@ -3002,7 +3002,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP
static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int height)
{
- HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, nullptr, g_hInst, nullptr);
+ HWND hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName, L"SubContainerWindow", WS_POPUP | (!g_CluiData.fLayered ? WS_BORDER : 0), x, y, width, height, parent, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_BORDER));
if (g_CluiData.fOnDesktop) {
HWND hProgMan = FindWindow(L"Progman", nullptr);
@@ -3155,7 +3155,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height)
{
- return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr);
+ return CreateWindow(L"FramesContainer", L"FramesContainer", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_plugin.getInst(), nullptr);
}
static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam)
@@ -3282,7 +3282,7 @@ int LoadCLUIFramesModule(void)
WNDCLASS wndclass = { 0 };
wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ;
wndclass.lpfnWndProc = CLUIFrameTitleBarProc;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wndclass.lpszClassName = CLUIFrameTitleBarClassName;
@@ -3291,7 +3291,7 @@ int LoadCLUIFramesModule(void)
WNDCLASS subconclass = { 0 };
subconclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ;
subconclass.lpfnWndProc = CLUIFrameSubContainerProc;
- subconclass.hInstance = g_hInst;
+ subconclass.hInstance = g_plugin.getInst();
subconclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
subconclass.lpszClassName = CLUIFrameSubContainerClassName;
RegisterClass(&subconclass);
@@ -3300,7 +3300,7 @@ int LoadCLUIFramesModule(void)
WNDCLASS cntclass = { 0 };
cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | CS_DROPSHADOW;
cntclass.lpfnWndProc = CLUIFrameContainerWndProc;
- cntclass.hInstance = g_hInst;
+ cntclass.hInstance = g_plugin.getInst();
cntclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
cntclass.lpszClassName = L"FramesContainer";
RegisterClass(&cntclass);
@@ -3402,7 +3402,7 @@ int UnLoadCLUIFramesModule(void)
free(g_pfwFrames);
g_pfwFrames = nullptr;
g_nFramesCount = 0;
- UnregisterClass(CLUIFrameTitleBarClassName, g_hInst);
+ UnregisterClass(CLUIFrameTitleBarClassName, g_plugin.getInst());
DeleteObject(_hTitleBarFont);
_cluiFramesModuleCSInitialized = FALSE;
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index 16a88ede50..cf025c5bf4 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -32,7 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CHECKRES(sub) if (sub != S_OK) return S_FALSE;
-HINSTANCE g_hInst = nullptr, g_hMirApp = nullptr;
+CMPlugin g_plugin;
+HINSTANCE g_hMirApp = nullptr;
CLIST_INTERFACE *pcli = nullptr;
CLIST_INTERFACE corecli = { 0 };
CLUIDATA g_CluiData = {};
@@ -42,6 +43,8 @@ static HRESULT SubclassClistInterface();
static HRESULT CreateHookableEvents();
int EventArea_UnloadModule();
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -55,20 +58,17 @@ PLUGININFOEX pluginInfo = {
{ 0x43909b6, 0xaad8, 0x4d82, { 0x8e, 0xb5, 0x9f, 0x64, 0xcf, 0xe8, 0x67, 0xcd } }
};
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CLIST, MIID_LAST };
-
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
-{
- g_hInst = hInstDLL;
- DisableThreadLibraryCalls(g_hInst);
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_CLIST, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int CListInitialise()
{
mir_getLP(&pluginInfo);
@@ -91,12 +91,16 @@ extern "C" __declspec(dllexport) int CListInitialise()
return S_OK;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// never called by a newer plugin loader.
+
extern "C" __declspec(dllexport) int Load(void)
{
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
TRACE("Unloading Clist Modern\r\n");
@@ -134,7 +138,7 @@ static HRESULT SubclassClistInterface()
pcli = Clist_GetInterface();
corecli = *pcli;
- pcli->hInst = g_hInst;
+ pcli->hInst = g_plugin.getInst();
pcli->pfnCreateCacheItem = cliCreateCacheItem;
pcli->pfnCheckCacheItem = cliCheckCacheItem;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 2d552b4ad4..32b5503318 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -956,7 +956,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta
else
- hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DROPMETA));
+ hNewCursor = LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(IDC_DROPMETA));
}
break;
@@ -969,9 +969,9 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta
else if (contSour->subcontacts == contDest)
- hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DEFAULTSUB)); ///MakeDefault
+ hNewCursor = LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(IDC_DEFAULTSUB)); ///MakeDefault
else
- hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_REGROUP));
+ hNewCursor = LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(IDC_REGROUP));
}
break;
@@ -986,7 +986,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
else if (contDest->subcontacts == contSour->subcontacts)
break;
else
- hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_REGROUP));
+ hNewCursor = LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(IDC_REGROUP));
}
break;
@@ -1559,7 +1559,7 @@ static int clcHookModulesLoaded(WPARAM, LPARAM)
// Get icons
wchar_t szMyPath[MAX_PATH];
- GetModuleFileName(g_hInst, szMyPath, _countof(szMyPath));
+ GetModuleFileName(g_plugin.getInst(), szMyPath, _countof(szMyPath));
// Menus
LoadFavoriteContactMenu();
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp
index 911ce3553f..4e3007ab9f 100644
--- a/plugins/Clist_modern/src/modern_clcopts.cpp
+++ b/plugins/Clist_modern/src/modern_clcopts.cpp
@@ -1199,8 +1199,6 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
#define DEFAULT_BKBMPUSE CLB_STRETCH
#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT)
-extern HINSTANCE g_hInst;
-
char **bkgrList = nullptr;
int bkgrCount = 0;
@@ -1513,7 +1511,7 @@ static clist_opt_items[] =
int ClcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC);
odp.szTitle.a = LPGEN("Contact list");
odp.pfnDlgProc = DlgProcClistListOpts;
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp
index 04498d6ab0..16b65bfae2 100644
--- a/plugins/Clist_modern/src/modern_clcutils.cpp
+++ b/plugins/Clist_modern/src/modern_clcutils.cpp
@@ -283,9 +283,9 @@ void cliBeginRenameSelection(HWND hwnd, ClcData *dat)
if (dat->text_rtl)
a |= EN_ALIGN_RTL_EC;
if (contact->type == CLCIT_GROUP)
- dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_hInst, nullptr);
+ dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_plugin.getInst(), nullptr);
else
- dat->hwndRenameEdit = CreateWindow(L"EDIT", Clist_GetContactDisplayName(contact->hContact), WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_hInst, nullptr);
+ dat->hwndRenameEdit = CreateWindow(L"EDIT", Clist_GetContactDisplayName(contact->hContact), WS_POPUP | WS_BORDER | ES_AUTOHSCROLL | a, x, y, w, h, hwnd, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(dat->hwndRenameEdit, GWL_STYLE, GetWindowLongPtr(dat->hwndRenameEdit, GWL_STYLE)&(~WS_CAPTION) | WS_BORDER);
SetWindowLongPtr(dat->hwndRenameEdit, GWLP_USERDATA, (LONG_PTR)dat);
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 290b7fbf04..0a1e379e9f 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -481,12 +481,12 @@ int EventArea_Create(HWND hCluiWnd)
WNDCLASS wndclass = { 0 };
wchar_t pluginname[] = L"EventArea";
int h = GetSystemMetrics(SM_CYSMICON) + 2;
- if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) {
+ if (GetClassInfo(g_plugin.getInst(), pluginname, &wndclass) == 0) {
wndclass.style = 0;
wndclass.lpfnWndProc = EventArea_WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
@@ -495,7 +495,7 @@ int EventArea_Create(HWND hCluiWnd)
RegisterClass(&wndclass);
}
g_CluiData.hwndEventFrame = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN,
- 0, 0, 0, h, hCluiWnd, nullptr, g_hInst, nullptr);
+ 0, 0, 0, h, hCluiWnd, nullptr, g_plugin.getInst(), nullptr);
// register frame
CLISTFrame Frame = { sizeof(Frame) };
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index 495d817f0a..8811d0b01c 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -145,7 +145,7 @@ int InitCustomMenus(void)
{
CreateServiceFunction("CloseAction", CloseAction);
- Icon_Register(g_hInst, LPGEN("Contact list"), iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Contact list"), iconList, _countof(iconList));
CreateServiceFunction(CLUI_FAVSETRATE, FAV_SetRate);
CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE, FAV_ToggleShowOffline);
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp
index da51bc085a..8887a3cbfd 100644
--- a/plugins/Clist_modern/src/modern_clistopts.cpp
+++ b/plugins/Clist_modern/src/modern_clistopts.cpp
@@ -931,7 +931,7 @@ int CListOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -200000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ITEMS);
odp.szGroup.a = LPGEN("Contact list");
odp.szTitle.a = LPGEN("Row items");
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index ac15e77b45..19c70de31d 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -322,7 +322,7 @@ static IconItemT iconItem[] = {
HRESULT CLUI::RegisterAvatarMenu()
{
- Icon_RegisterT(g_hInst, LPGENW("Contact list"), iconItem, _countof(iconItem));
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Contact list"), iconItem, _countof(iconItem));
CMenuItem mi;
@@ -354,7 +354,7 @@ HRESULT CLUI::CreateCLCWindow(const HWND hwndClui)
| (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
| (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0
| CLS_MULTICOLUMN),
- 0, 0, 0, 0, hwndClui, nullptr, g_hInst, nullptr);
+ 0, 0, 0, 0, hwndClui, nullptr, g_plugin.getInst(), nullptr);
return S_OK;
}
@@ -941,7 +941,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx)
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
- return LoadSmallIcon(g_hInst, -IDI_ICQC1 - idx);
+ return LoadSmallIcon(g_plugin.getInst(), -IDI_ICQC1 - idx);
}
static PROTOTICKS* CLUI_GetProtoTicksByProto(char *szProto)
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index 0a3245518b..94a13e282b 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -42,7 +42,7 @@ extern BYTE g_bCalledFromShowHide;
extern HICON g_hListeningToIcon;
extern HWND g_hCLUIOptionsWnd;
extern BOOL g_bTransparentFlag;
-extern HINSTANCE g_hInst, g_hMirApp;
+extern HINSTANCE g_hMirApp;
extern BOOL g_mutex_bChangingMode;
extern UINT g_dwMainThreadID;
extern HANDLE g_hAwayMsgThread, g_hGetTextAsyncThread, g_hSmoothAnimationThread;
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp
index b64d823059..8c446b526c 100644
--- a/plugins/Clist_modern/src/modern_skinbutton.cpp
+++ b/plugins/Clist_modern/src/modern_skinbutton.cpp
@@ -608,7 +608,7 @@ static HWND ModernSkinButtonCreateWindow(ModernSkinButtonCtrl * bct, HWND parent
if (bct == nullptr) return FALSE;
{
wchar_t *UnicodeID = mir_a2u(bct->ID);
- hwnd = CreateWindow(_A2W(MODERNSKINBUTTONCLASS), UnicodeID, WS_VISIBLE | WS_CHILD, bct->Left, bct->Top, bct->Right - bct->Left, bct->Bottom - bct->Top, parent, nullptr, g_hInst, nullptr);
+ hwnd = CreateWindow(_A2W(MODERNSKINBUTTONCLASS), UnicodeID, WS_VISIBLE | WS_CHILD, bct->Left, bct->Top, bct->Right - bct->Left, bct->Bottom - bct->Top, parent, nullptr, g_plugin.getInst(), nullptr);
mir_free(UnicodeID);
}
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index d51deeebf1..2eea47fe2c 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -122,7 +122,7 @@ IniParser::IniParser(wchar_t * tcsFileName, BYTE flags) : _Flags(flags)
if (tcsFileName[0] == '%') {
//TODO: Add parser of resource filename here
- _LoadResourceIni(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF");
+ _LoadResourceIni(g_plugin.getInst(), MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF");
return;
}
@@ -1585,11 +1585,11 @@ static HBITMAP ske_LoadGlyphImage_TGA(const wchar_t *szFilename)
}
else {
/* reading from resources IDR_TGA_DEFAULT_SKIN */
- HRSRC hRSrc = FindResourceA(g_hInst, MAKEINTRESOURCEA(IDR_TGA_DEFAULT_SKIN), "TGA");
+ HRSRC hRSrc = FindResourceA(g_plugin.getInst(), MAKEINTRESOURCEA(IDR_TGA_DEFAULT_SKIN), "TGA");
if (!hRSrc) return nullptr;
- HGLOBAL hRes = LoadResource(g_hInst, hRSrc);
+ HGLOBAL hRes = LoadResource(g_plugin.getInst(), hRSrc);
if (!hRes) return nullptr;
- DWORD size = SizeofResource(g_hInst, hRSrc);
+ DWORD size = SizeofResource(g_plugin.getInst(), hRSrc);
BYTE *mem = (BYTE*)LockResource(hRes);
if (size > sizeof(header)) {
tga_header_t *tgahdr = (tga_header_t*)mem;
@@ -1936,7 +1936,7 @@ void ske_LoadSkinFromDB(void)
static int ske_LoadSkinFromResource(BOOL bOnlyObjects)
{
- IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS);
+ IniParser parser(g_plugin.getInst(), MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS);
if (parser.CheckOK()) {
db_delete_module(0, "ModernSkin");
db_set_s(0, SKIN, "SkinFolder", "%Default%");
diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp
index 0c105e9ed0..b1dfa879bd 100644
--- a/plugins/Clist_modern/src/modern_skinopt.cpp
+++ b/plugins/Clist_modern/src/modern_skinopt.cpp
@@ -50,7 +50,7 @@ int SkinOptInit(WPARAM wParam, LPARAM)
//Tabbed settings
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -200000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = DlgSkinOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
odp.szGroup.w = LPGENW("Skins");
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp
index 5764ad7c05..1cf10dc67a 100644
--- a/plugins/Clist_modern/src/modern_statusbar.cpp
+++ b/plugins/Clist_modern/src/modern_statusbar.cpp
@@ -861,16 +861,16 @@ HWND StatusBar_Create(HWND parent)
{
WNDCLASS wndclass = { 0 };
int h = GetSystemMetrics(SM_CYSMICON) + 2;
- if (GetClassInfo(g_hInst, pluginname, &wndclass) == 0) {
+ if (GetClassInfo(g_plugin.getInst(), pluginname, &wndclass) == 0) {
wndclass.lpfnWndProc = ModernStatusProc;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wndclass.lpszClassName = pluginname;
RegisterClass(&wndclass);
}
- hModernStatusBar = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 0, h, parent, nullptr, g_hInst, nullptr);
+ hModernStatusBar = CreateWindow(pluginname, pluginname, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 0, h, parent, nullptr, g_plugin.getInst(), nullptr);
// register frame
CLISTFrame Frame = { sizeof(Frame) };
diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp
index fd561f27cb..fd130ab68b 100644
--- a/plugins/Clist_modern/src/modern_toolbar.cpp
+++ b/plugins/Clist_modern/src/modern_toolbar.cpp
@@ -69,13 +69,13 @@ void Modern_InitButtons()
char buf[255];
if (i != 0) {
mir_snprintf(buf, "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn");
- tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx, g_hInst, BTNS[i].defResource);
+ tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx, g_plugin.getInst(), BTNS[i].defResource);
}
else tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, nullptr, 0, nullptr, SKINICON_OTHER_MAINMENU);
if (BTNS[i].pszTooltipDn) {
mir_snprintf(buf, "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up");
- tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx + 1, g_hInst, BTNS[i].defResource2);
+ tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, L"icons\\toolbar_icons.dll", BTNS[i].icoDefIdx + 1, g_plugin.getInst(), BTNS[i].defResource2);
}
else tbb.hIconHandleDn = nullptr;
}
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp
index fdb8027a3b..96f3dce17f 100644
--- a/plugins/Clist_modern/src/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp
@@ -916,7 +916,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
RECT rcMargins = { 12, 0, 2, 0 };
hwndSelector = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_SELECTMODE, g_hInst, nullptr);
+ hwnd, (HMENU)IDC_SELECTMODE, g_plugin.getInst(), nullptr);
MakeButtonSkinned(hwndSelector);
SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE);
SendMessage(hwndSelector, BUTTONSETMARGINS, 0, (LPARAM)&rcMargins);
@@ -928,7 +928,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
//SendMessage(hwndSelector, BM_SETASMENUACTION, 1, 0);
HWND hwndButton = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_CONFIGUREMODES, g_hInst, nullptr);
+ hwnd, (HMENU)IDC_CONFIGUREMODES, g_plugin.getInst(), nullptr);
MakeButtonSkinned(hwndButton);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Setup view modes"), BATF_UNICODE);
SendMessage(hwndButton, BUTTONSETID, 0, (LPARAM) "ViewMode.Setup");
@@ -936,7 +936,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SendMessage(hwndButton, MBM_UPDATETRANSPARENTFLAG, 0, 2);
hwndButton = CreateWindow(MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
- hwnd, (HMENU)IDC_RESETMODES, g_hInst, nullptr);
+ hwnd, (HMENU)IDC_RESETMODES, g_plugin.getInst(), nullptr);
MakeButtonSkinned(hwndButton);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Clear view mode and return to default display"), BATF_UNICODE);
SendMessage(hwndButton, BUTTONSETID, 0, (LPARAM) "ViewMode.Clear");
@@ -966,10 +966,10 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_USER + 100:
SendDlgItemMessage(hwnd, IDC_RESETMODES, MBM_SETICOLIBHANDLE, 0,
- (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_reset", LPGEN("Contact list"), LPGEN("Reset view mode"), nullptr, 0, g_hInst, IDI_RESETVIEW));
+ (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_reset", LPGEN("Contact list"), LPGEN("Reset view mode"), nullptr, 0, g_plugin.getInst(), IDI_RESETVIEW));
SendDlgItemMessage(hwnd, IDC_CONFIGUREMODES, MBM_SETICOLIBHANDLE, 0,
- (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_set", LPGEN("Contact list"), LPGEN("Setup view modes"), nullptr, 0, g_hInst, IDI_SETVIEW));
+ (LPARAM)RegisterIcolibIconHandle("CLN_CLVM_set", LPGEN("Contact list"), LPGEN("Setup view modes"), nullptr, 0, g_plugin.getInst(), IDI_SETVIEW));
{
for (int i = 0; _buttons[i] != 0; i++) {
@@ -1099,7 +1099,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case IDC_CONFIGUREMODES:
clvm_config_command :
if (!g_ViewModeOptDlg)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_VIEWMODES), nullptr, DlgProcViewModesSetup, 0);
break;
}
@@ -1181,7 +1181,7 @@ void CreateViewModeFrame()
wndclass.lpfnWndProc = ViewModeFrameWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
wndclass.lpszMenuName = nullptr;
@@ -1196,7 +1196,7 @@ void CreateViewModeFrame()
frame.TBtname = TranslateT("View modes");
frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_NO_SUBCONTAINER | F_UNICODE;
frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr);
+ frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", _A2W(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_plugin.getInst(), nullptr);
g_hwndViewModeFrame = frame.hWnd;
hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h
index fffc321996..93bcb3ae35 100644
--- a/plugins/Clist_modern/src/stdafx.h
+++ b/plugins/Clist_modern/src/stdafx.h
@@ -104,6 +104,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_smileyadd.h>
#include <m_folders.h>
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("CList")
+ {}
+};
+
#include "modern_global_structure.h"
#include "modern_defsettings.h"
#include "modern_clist.h"