summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-16 13:57:46 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-16 13:57:46 +0300
commit976f7a55bea6ec6b3f6f3d8fa59fff46ca2e9c17 (patch)
tree460b0df3f421e68acd9813f5a8d8007e93fec3f2 /plugins/Clist_nicer/src
parent98f4bfb4b4d90f958685bbdc2b5c9baae522f17c (diff)
clist_nicer => CMPlugin
Diffstat (limited to 'plugins/Clist_nicer/src')
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp2
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp2
-rw-r--r--plugins/Clist_nicer/src/clcutils.cpp4
-rw-r--r--plugins/Clist_nicer/src/clistmenus.cpp6
-rw-r--r--plugins/Clist_nicer/src/clui.cpp18
-rw-r--r--plugins/Clist_nicer/src/cluiframes.cpp24
-rw-r--r--plugins/Clist_nicer/src/cluiopts.cpp2
-rw-r--r--plugins/Clist_nicer/src/config.cpp2
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp4
-rw-r--r--plugins/Clist_nicer/src/groupmenu.cpp2
-rw-r--r--plugins/Clist_nicer/src/init.cpp21
-rw-r--r--plugins/Clist_nicer/src/stdafx.h11
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp14
13 files changed, 59 insertions, 53 deletions
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp
index d2114efd77..78cba2f7cf 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -514,7 +514,7 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPar
int ClcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
////////////////////////////////////////////////////////////////////////////
// Main options tabs
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 012fb45f44..7b45f17c25 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -164,7 +164,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc)
DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE);
}
else {
- HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
+ HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
DrawText(hDC, TranslateT("No events..."), -1, rc, DT_VCENTER | DT_SINGLELINE);
DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, nullptr, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp
index c59a735535..0e4b9795cc 100644
--- a/plugins/Clist_nicer/src/clcutils.cpp
+++ b/plugins/Clist_nicer/src/clcutils.cpp
@@ -538,7 +538,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat)
if (h < dat->fontInfo[i].fontHeight + 2) h = dat->fontInfo[i].fontHeight + 2;
}
- dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, nullptr, g_hInst, nullptr);
+ dat->hwndRenameEdit = CreateWindowEx(0, L"RICHEDIT50W", contact->szText, WS_CHILD | WS_BORDER | ES_MULTILINE | ES_AUTOHSCROLL, x, y, clRect.right - x, h, hwnd, nullptr, g_plugin.getInst(), nullptr);
{
if ((contact->type == CLCIT_CONTACT && contact->pExtra->dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
PARAFORMAT2 pf2;
@@ -552,7 +552,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat)
}
}
- //dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
+ //dat->hwndRenameEdit = CreateWindow(L"EDIT", contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_plugin.getInst(), NULL);
mir_subclassWindow(dat->hwndRenameEdit, RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM)(contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp
index 104594bea5..402b74f25f 100644
--- a/plugins/Clist_nicer/src/clistmenus.cpp
+++ b/plugins/Clist_nicer/src/clistmenus.cpp
@@ -66,14 +66,14 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA
SendMessage(hWnd, WM_USER + 100, hContact, dwMask);
SendMessage(hWnd, WM_USER + 120, 0, 0);
TranslateDialogDefault(hWnd);
- hwndAdd = GetDlgItem(hWnd, IDC_IGN_ADDPERMANENTLY); // CreateWindowEx(0, L"CLCButtonClass", L"FOO", WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL);
+ hwndAdd = GetDlgItem(hWnd, IDC_IGN_ADDPERMANENTLY); // CreateWindowEx(0, L"CLCButtonClass", L"FOO", WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_plugin.getInst(), NULL);
CustomizeButton(hwndAdd, false, true, false);
SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT));
SetWindowText(hwndAdd, TranslateT("Add permanently"));
EnableWindow(hwndAdd, db_get_b(hContact, "CList", "NotOnList", 0));
- hwndAdd = GetDlgItem(hWnd, IDC_DSP_LOADDEFAULT); // CreateWindowEx(0, L"CLCButtonClass", L"FOO", WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_hInst, NULL);
+ hwndAdd = GetDlgItem(hWnd, IDC_DSP_LOADDEFAULT); // CreateWindowEx(0, L"CLCButtonClass", L"FOO", WS_VISIBLE | BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 200, 276, 106, 24, hWnd, (HMENU)IDC_IGN_ADDPERMANENTLY, g_plugin.getInst(), NULL);
CustomizeButton(hwndAdd, false, true, false);
SendMessage(hwndAdd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_DELETE));
@@ -346,7 +346,7 @@ static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM)
hWnd = WindowList_Find(hWindowListIGN, wParam);
if (wParam) {
if (hWnd == nullptr)
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), nullptr, IgnoreDialogProc, (LPARAM)wParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_QUICKIGNORE), nullptr, IgnoreDialogProc, (LPARAM)wParam);
else if (IsWindow(hWnd))
SetFocus(hWnd);
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index caa6b9b723..b2738f54d7 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -166,7 +166,7 @@ static HWND PreCreateCLC(HWND parent)
| (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0)
| (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0)
| CLS_MULTICOLUMN,
- 0, 0, 0, 0, parent, nullptr, g_hInst, (LPVOID)0xff00ff00);
+ 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), (LPVOID)0xff00ff00);
cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0);
return pcli->hwndContactTree;
@@ -187,7 +187,7 @@ static int CreateCLC()
frame.height = 20;
frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE;
frame.align = alBottom;
- frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_hInst, nullptr);
+ frame.hWnd = CreateWindowExA(0, "EventAreaClass", "evt", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)nullptr, g_plugin.getInst(), nullptr);
g_hwndEventArea = frame.hWnd;
hNotifyFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hNotifyFrame, FU_FMPOS);
@@ -250,13 +250,13 @@ static void CacheClientIcons()
static void InitIcoLib()
{
- Icon_Register(g_hInst, LPGEN("Contact list") "/" LPGEN("Default"), myIcons, _countof(myIcons));
+ Icon_Register(g_plugin.getInst(), LPGEN("Contact list") "/" LPGEN("Default"), myIcons, _countof(myIcons));
for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
char szBuffer[128];
mir_snprintf(szBuffer, "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
IconItemT icon = { Clist_GetStatusModeDescription(ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE), 0), szBuffer, i };
- Icon_RegisterT(g_hInst, LPGENW("Contact list") L"/" LPGENW("Overlay icons"), &icon, 1);
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Contact list") L"/" LPGENW("Overlay icons"), &icon, 1);
}
for (auto &pa : Accounts()) {
@@ -266,7 +266,7 @@ static void InitIcoLib()
wchar_t szDescr[128];
mir_snwprintf(szDescr, TranslateT("%s connecting"), pa->tszAccountName);
IconItemT icon = { szDescr, "conn", IDI_PROTOCONNECTING };
- Icon_RegisterT(g_hInst, LPGENW("Contact list") L"/" LPGENW("Connecting icons"), &icon, 1, pa->szModuleName);
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Contact list") L"/" LPGENW("Connecting icons"), &icon, 1, pa->szModuleName);
}
}
@@ -278,14 +278,14 @@ static int IcoLibChanged(WPARAM, LPARAM)
void CreateButtonBar(HWND hWnd)
{
- hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_hInst, nullptr);
+ hTbMenu = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBMENU, g_plugin.getInst(), nullptr);
CustomizeButton(hTbMenu, false, false, false);
SetWindowText(hTbMenu, TranslateT("Menu"));
SendMessage(hTbMenu, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_MAINMENU));
SendMessage(hTbMenu, BUTTONSETSENDONDOWN, TRUE, 0);
SendMessage(hTbMenu, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Open main menu"), 0);
- hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_hInst, nullptr);
+ hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU)IDC_TBGLOBALSTATUS, g_plugin.getInst(), nullptr);
CustomizeButton(hTbGlobalStatus, false, false, false);
SetWindowText(hTbGlobalStatus, TranslateT("Offline"));
SendMessage(hTbGlobalStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_LoadIcon(SKINICON_STATUS_OFFLINE));
@@ -779,7 +779,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
int flags = WS_CHILD | CCS_BOTTOM;
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_hInst, nullptr);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_plugin.getInst(), nullptr);
if (flags & WS_VISIBLE) {
ShowWindow(pcli->hwndStatus, SW_SHOW);
SendMessage(pcli->hwndStatus, WM_SIZE, 0, 0);
@@ -1811,7 +1811,7 @@ void LoadCLUIModule(void)
wndclass.lpfnWndProc = EventAreaWndProc;
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 = (HBRUSH)COLOR_3DFACE;
diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp
index 5e11de208f..f1be52c9dd 100644
--- a/plugins/Clist_nicer/src/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/cluiframes.cpp
@@ -38,15 +38,13 @@ HANDLE g_hEventThread = nullptr;
LOGFONT TitleBarLogFont = { 0 };
-extern HINSTANCE g_hInst;
-
-//we use dynamic frame list,
-//but who wants so huge number of frames ??
+// we use dynamic frame list,
+// but who wants so huge number of frames ??
#define MAX_FRAMES 40
#define UNCOLLAPSED_FRAME_SIZE 0
-//legacy menu support
+// legacy menu support
#define frame_menu_lock 1
#define frame_menu_visible 2
#define frame_menu_showtitlebar 3
@@ -1361,7 +1359,7 @@ static int UpdateTBToolTip(int framepos)
memset(&ti, 0, sizeof(ti));
ti.cbSize = sizeof(ti);
ti.lpszText = Frames[framepos].TitleBar.tooltip;
- ti.hinst = g_hInst;
+ ti.hinst = g_plugin.getInst();
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.uId = (UINT_PTR)Frames[framepos].TitleBar.hwnd;
@@ -1608,20 +1606,20 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM)
CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name,
(db_get_b(NULL, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER)
| WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) |
- WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_hInst, nullptr);
+ WS_CLIPCHILDREN, 0, 0, 0, 0, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id);
Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- pcli->hwndContactList, nullptr, g_hInst, nullptr);
+ pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
{
TOOLINFOA ti = { 0 };
ti.cbSize = sizeof(ti);
ti.lpszText = "";
- ti.hinst = g_hInst;
+ ti.hinst = g_plugin.getInst();
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.uId = (UINT_PTR)Frames[nFramescount].TitleBar.hwnd;
SendMessageA(Frames[nFramescount].TitleBar.hwndTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
@@ -2784,7 +2782,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height)
{
- return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_hInst, nullptr));
+ return(CreateWindowA("FramesContainer", "aaaa", WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, nullptr, g_plugin.getInst(), nullptr));
}
INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam)
@@ -2926,7 +2924,7 @@ int LoadCLUIFramesModule(void)
WNDCLASS wndclass = {};
wndclass.style = CS_DBLCLKS;
wndclass.lpfnWndProc = CLUIFrameTitleBarProc;
- wndclass.hInstance = g_hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.lpszClassName = CLUIFrameTitleBarClassName;
RegisterClass(&wndclass);
@@ -2934,7 +2932,7 @@ int LoadCLUIFramesModule(void)
WNDCLASS cntclass = {};
cntclass.style = CS_DBLCLKS | 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);
@@ -3047,6 +3045,6 @@ int UnLoadCLUIFramesModule(void)
free(Frames);
Frames = nullptr;
nFramescount = 0;
- UnregisterClass(CLUIFrameTitleBarClassName, g_hInst);
+ UnregisterClass(CLUIFrameTitleBarClassName, g_plugin.getInst());
return 0;
}
diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp
index ad87500749..e291388d67 100644
--- a/plugins/Clist_nicer/src/cluiopts.cpp
+++ b/plugins/Clist_nicer/src/cluiopts.cpp
@@ -387,7 +387,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
mir_subclassWindow(pcli->hwndStatus, NewStatusBarWndProc);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp
index 010a29cdfa..6ac1ab17cf 100644
--- a/plugins/Clist_nicer/src/config.cpp
+++ b/plugins/Clist_nicer/src/config.cpp
@@ -202,7 +202,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, wch
mir_snprintf(exSzFile, "%s%s", szName, szExt);
mir_snwprintf(exReason, L"An application error has occured: %s", szReason);
exLine = line;
- exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), nullptr, Ex_DlgProc, 0);
+ exLastResult = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXCEPTION), nullptr, Ex_DlgProc, 0);
exAllowContinue = fAllowContinue;
if (IDCANCEL == exLastResult)
ExitProcess(1);
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 83064a0ccc..d3e0ac5fda 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -1170,7 +1170,7 @@ static void BTN_ReadItem(char *itemName, char *file)
newItem->nextItem = nullptr;
curItem->nextItem = newItem;
}
- newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_hInst, nullptr);
+ newItem->hWnd = CreateWindowEx(0, MIRANDABUTTONCLASS, L"", BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 5, 5, pcli->hwndContactList, (HMENU)newItem->uId, g_plugin.getInst(), nullptr);
CustomizeButton(newItem->hWnd, false, false, true);
SendMessage(newItem->hWnd, BUTTONSETBTNITEM, 0, (LPARAM)newItem);
if (newItem->dwFlags & BUTTON_ISTOGGLE)
@@ -1636,7 +1636,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
TCITEM tci;
tci.mask = TCIF_PARAM | TCIF_TEXT;
- tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_OPT_SKIN), hwnd, DlgProcSkinOpts);
+ tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_SKIN), hwnd, DlgProcSkinOpts);
tci.pszText = TranslateT("Load and apply");
TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci);
MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1);
diff --git a/plugins/Clist_nicer/src/groupmenu.cpp b/plugins/Clist_nicer/src/groupmenu.cpp
index 7a89429983..fc2d244653 100644
--- a/plugins/Clist_nicer/src/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/groupmenu.cpp
@@ -85,7 +85,7 @@ IconItemT iconItem[] = {
void InitIconLibMenuIcons(void)
{
- Icon_RegisterT(g_hInst, LPGENW("Contact list"), iconItem, _countof(iconItem));
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Contact list"), iconItem, _countof(iconItem));
}
void InitGroupMenus(void)
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp
index 14aa73b678..1ac634c74b 100644
--- a/plugins/Clist_nicer/src/init.cpp
+++ b/plugins/Clist_nicer/src/init.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma comment(lib, "shlwapi.lib")
-HINSTANCE g_hInst = nullptr;
+CMPlugin g_plugin;
CLIST_INTERFACE *pcli, coreCli;
int hLangpack;
@@ -61,6 +61,8 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat);
LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -75,20 +77,17 @@ PLUGININFOEX pluginInfo =
{ 0x8f79b4ee, 0xeb48, 0x4a03, { 0x87, 0x3e, 0x27, 0xbe, 0x6b, 0x7e, 0x9a, 0x25 } }
};
-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 };
+/////////////////////////////////////////////////////////////////////////////////////////
+
int LoadContactListModule(void);
int LoadCLCModule(void);
void LoadCLUIModule(void);
@@ -178,7 +177,7 @@ extern "C" int __declspec(dllexport) CListInitialise()
wcslwr(cfg::dat.tszProfilePath);
// get the clist interface
- pcli->hInst = g_hInst;
+ pcli->hInst = g_plugin.getInst();
pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged;
pcli->pfnCompareContacts = CompareContacts;
pcli->pfnCreateClcContact = CreateClcContact;
@@ -224,12 +223,16 @@ extern "C" int __declspec(dllexport) CListInitialise()
return rc;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// a plugin loader aware of CList exports will never call this.
+
extern "C" int __declspec(dllexport) Load(void)
{
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
if (IsWindow(pcli->hwndContactList))
diff --git a/plugins/Clist_nicer/src/stdafx.h b/plugins/Clist_nicer/src/stdafx.h
index 356053cfbd..ded6de7f66 100644
--- a/plugins/Clist_nicer/src/stdafx.h
+++ b/plugins/Clist_nicer/src/stdafx.h
@@ -38,8 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <vssym32.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <win2k.h>
#include <m_clistint.h>
@@ -74,8 +72,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "alphablend.h"
#include "rowheight_funcs.h"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("CList")
+ {}
+};
+
// shared vars
-extern HINSTANCE g_hInst;
+
extern LONG g_cxsmIcon, g_cysmIcon;
extern PLUGININFOEX pluginInfo;
extern LIST<StatusItems_t> arStatusItems;
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 93e3756e0d..6770ce9cd3 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -549,7 +549,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP
for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
ImageList_AddIcon(himlViewModes, Skin_LoadProtoIcon(nullptr, i));
{
- HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0);
+ HICON hIcon = (HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0);
nullImage = ImageList_AddIcon(himlViewModes, hIcon);
DestroyIcon(hIcon);
}
@@ -817,18 +817,18 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
switch (msg) {
case WM_CREATE:
hwndSelector = CreateWindowEx(0, 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);
CustomizeButton(hwndSelector, false, false, false);
SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE);
SendMessage(hwndSelector, BUTTONSETSENDONDOWN, TRUE, 0);
{
HWND hwndButton = CreateWindowEx(0, 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);
CustomizeButton(hwndButton, false, false, false);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Setup view modes"), BATF_UNICODE);
hwndButton = CreateWindowEx(0, 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);
CustomizeButton(hwndButton, false, false, false);
SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Clear view mode and return to default display"), BATF_UNICODE);
}
@@ -973,7 +973,7 @@ clvm_reset_command:
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;
}
break;
@@ -996,7 +996,7 @@ void CreateViewModeFrame()
wndclass.lpfnWndProc = ViewModeFrameWndProc;
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 = (HBRUSH)(COLOR_3DFACE);
@@ -1012,7 +1012,7 @@ void CreateViewModeFrame()
frame.height = 22;
frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_UNICODE;
frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, L"CLVMFrameWindow", L"CLVM", 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", L"CLVM", 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);