diff options
Diffstat (limited to 'plugins/WebView')
-rw-r--r-- | plugins/WebView/src/main.cpp | 116 | ||||
-rw-r--r-- | plugins/WebView/src/webview.cpp | 19 | ||||
-rw-r--r-- | plugins/WebView/src/webview.h | 39 | ||||
-rw-r--r-- | plugins/WebView/src/webview_alerts.cpp | 10 | ||||
-rw-r--r-- | plugins/WebView/src/webview_datawnd.cpp | 28 | ||||
-rw-r--r-- | plugins/WebView/src/webview_opts.cpp | 6 | ||||
-rw-r--r-- | plugins/WebView/src/webview_services.cpp | 8 |
7 files changed, 118 insertions, 108 deletions
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 978e938e0a..4a99ab3cd4 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -43,7 +43,13 @@ PLUGININFOEX pluginInfoEx = { {0xcd5427fb, 0x5320, 0x4f65, {0xb4, 0xbf, 0x86, 0xb7, 0xcf, 0x7b, 0x50, 0x87}}
};
-/*****************************************************************************/
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfoEx;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void InitServices()
{
CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, GetCaps);
@@ -56,7 +62,8 @@ void InitServices() CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, GetInfo);
}
-/*****************************************************************************/
+/////////////////////////////////////////////////////////////////////////////////////////
+
void ChangeContactStatus(int con_stat)
{
WORD status_code = 0;
@@ -73,55 +80,25 @@ void ChangeContactStatus(int con_stat) db_set_w(hContact, MODULENAME, "Status", status_code);
}
-/*****************************************************************************/
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfoEx;
-}
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-/*****************************************************************************/
-extern "C" int __declspec(dllexport) Unload(void)
-{
- ChangeContactStatus(0);
+/////////////////////////////////////////////////////////////////////////////////////////
- KillTimer(nullptr, timerId);
- KillTimer(nullptr, Countdown);
+CMPlugin g_plugin;
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
- SavewinSettings();
- if (hRichEd)
- FreeLibrary(hRichEd);
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
- if (hNetlibUser) {
- Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = nullptr;
- }
-
- if (hHookDisplayDataAlert)
- DestroyHookableEvent(hHookDisplayDataAlert);
- if (hHookAlertPopup)
- DestroyHookableEvent(hHookAlertPopup);
- if (hHookAlertWPopup)
- DestroyHookableEvent(hHookAlertWPopup);
-
- if (h_font != nullptr)
- DeleteObject(h_font);
- if (hMenu)
- DestroyMenu(hMenu);
- WindowList_Destroy(hWindowList);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-/*****************************************************************************/
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfoEx);
HookEvent(ME_CLIST_DOUBLECLICKED, Doubleclick);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
hRichEd = LoadLibrary(L"Msftedit.dll");
/*TIMERS*/
@@ -164,7 +141,7 @@ extern "C" int __declspec(dllexport) Load() /*DISABLE WEBVIEW*/
SET_UID(mi, 0xdedeb697, 0xfc10, 0x4622, 0x8b, 0x97, 0x74, 0x39, 0x32, 0x68, 0xa7, 0x7b);
CreateServiceFunction("DisableWebview", AutoUpdateMCmd);
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
mi.name.w = LPGENW("Auto update disabled");
else
@@ -176,7 +153,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xf324ede, 0xfdf, 0x498a, 0x8f, 0x49, 0x6d, 0x2a, 0x9f, 0xda, 0x58, 0x6);
CreateServiceFunction("UpdateAll", UpdateAllMenuCommand);
mi.position = 500090002;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = LPGENW("Update all Webview sites");
mi.pszService = "UpdateAll";
Menu_AddMainMenuItem(&mi);
@@ -185,7 +162,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0x1fa5fa21, 0x2ee1, 0x4372, 0xae, 0x3e, 0x3b, 0x96, 0xac, 0xd, 0xe8, 0x49);
CreateServiceFunction("MarkAllSitesRead", MarkAllReadMenuCommand);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MARKALLREAD));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MARKALLREAD));
mi.name.w = LPGENW("Mark all Webview sites as read");
mi.pszService = "MarkAllSitesRead";
Menu_AddMainMenuItem(&mi);
@@ -194,7 +171,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xfed046a8, 0xaae5, 0x4cbe, 0xa8, 0xc, 0x3c, 0x50, 0x3e, 0x3e, 0x9b, 0x15);
CreateServiceFunction("OpenCacheFolder", OpenCacheDir);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FOLDER));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FOLDER));
mi.name.w = LPGENW("Open cache folder");
mi.pszService = "OpenCacheFolder";
Menu_AddMainMenuItem(&mi);
@@ -206,7 +183,7 @@ extern "C" int __declspec(dllexport) Load() wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
mi.pszService = "Countdown";
hMenuItemCountdown = Menu_AddMainMenuItem(&mi);
@@ -218,7 +195,7 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0xadc6a9a4, 0xdf7, 0x4f63, 0x89, 0x11, 0x8e, 0x42, 0x1d, 0xd6, 0x29, 0x31);
CreateServiceFunction("Open web page", WebsiteMenuCommand);
mi.position = 100;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_URL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_URL));
mi.pszService = "Open web page";
mi.name.w = LPGENW("Open web page");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -226,42 +203,42 @@ extern "C" int __declspec(dllexport) Load() SET_UID(mi, 0x9d803e61, 0xc929, 0x4c6e, 0x9e, 0x7, 0x93, 0x0, 0xab, 0x14, 0x13, 0x50);
CreateServiceFunction("OpenClose Window", DataWndMenuCommand);
mi.pszService = "OpenClose Window";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SHOW_HIDE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHOW_HIDE));
mi.name.w = LPGENW("Open/Close window");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x3840cc71, 0xcc85, 0x448d, 0xb5, 0xc8, 0x1a, 0x7d, 0xfe, 0xf0, 0x8, 0x85);
mi.position = 2222220;
mi.pszService = "UpdateData";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATE));
mi.name.w = LPGENW("Update data");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xd1ab586c, 0x2c71, 0x429c, 0xb1, 0x79, 0x7b, 0x3a, 0x1d, 0x4a, 0xc1, 0x7d);
CreateServiceFunction("ContactOptions", CntOptionsMenuCommand);
mi.pszService = "ContactOptions";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS));
mi.name.w = LPGENW("Contact options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xe4cda597, 0x9def, 0x4f54, 0x8a, 0xc6, 0x69, 0x3b, 0x5a, 0x7d, 0x77, 0xb6);
CreateServiceFunction("ContactAlertOpts", CntAlertMenuCommand);
mi.pszService = "ContactAlertOpts";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT));
mi.name.w = LPGENW("Contact alert options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x63fdeed8, 0xf880, 0x423f, 0x95, 0xae, 0x20, 0x8c, 0x86, 0x3c, 0x5, 0xd8);
CreateServiceFunction("PingWebsite", PingWebsiteMenuCommand);
mi.pszService = "PingWebsite";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_PING));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PING));
mi.name.w = LPGENW("Ping web site");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x28fd36de, 0x6ce1, 0x43d0, 0xa1, 0x6e, 0x98, 0x71, 0x53, 0xe8, 0xc9, 0xf4);
CreateServiceFunction("StopDataProcessing", StpPrcssMenuCommand);
mi.pszService = "StopDataProcessing";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_STOP));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STOP));
mi.name.w = LPGENW("Stop data processing");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -277,15 +254,34 @@ extern "C" int __declspec(dllexport) Load() /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public PLUGIN<CMPlugin>
+extern "C" int __declspec(dllexport) Unload(void)
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- SetUniqueId("PreserveName");
+ ChangeContactStatus(0);
+
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
+
+ db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
+ SavewinSettings();
+ if (hRichEd)
+ FreeLibrary(hRichEd);
+
+ if (hNetlibUser) {
+ Netlib_CloseHandle(hNetlibUser);
+ hNetlibUser = nullptr;
}
-}
- g_plugin;
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+ if (hHookDisplayDataAlert)
+ DestroyHookableEvent(hHookDisplayDataAlert);
+ if (hHookAlertPopup)
+ DestroyHookableEvent(hHookAlertPopup);
+ if (hHookAlertWPopup)
+ DestroyHookableEvent(hHookAlertWPopup);
+
+ if (h_font != nullptr)
+ DeleteObject(h_font);
+ if (hMenu)
+ DestroyMenu(hMenu);
+ WindowList_Destroy(hWindowList);
+ return 0;
+}
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index be2b8635bc..1206e4774f 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -38,7 +38,6 @@ UINT_PTR Countdown; LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
-HINSTANCE g_hInstance;
HMENU hMenu;
int bpStatus;
HGENMENU hMenuItem1;
@@ -54,14 +53,14 @@ void ChangeMenuItem1() else
ptszName = LPGENW("Auto update disabled");
- Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
+ Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)));
}
/*****************************************************************************/
void ChangeMenuItemCountdown()
{
// countdown
- HICON hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ HICON hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
@@ -185,9 +184,9 @@ int Doubleclick(WPARAM wParam, LPARAM) SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
@@ -293,7 +292,7 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD) static int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = MODULENAME;
@@ -368,8 +367,8 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) }
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
@@ -474,7 +473,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +488,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index c9bfd998a4..2f8304f051 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -101,7 +101,6 @@ #define RCLK_WINDOW_KEY "RightClkWindow"
#define RCLK_WEB_PGE_KEY "RightClkWebPage"
#define RCLK_DISMISS_KEY "RightClkDismiss"
-//#define INBUILTPOP_KEY "UseInbuiltPopupAlert"
#define TIME 60
#define Def_color_bg 0x00ffffff
@@ -117,7 +116,9 @@ #define Def_win_height 152
#define Def_win_width 250
-//lets get rid of some warnings
+/////////////////////////////////////////////////////////////////////////////////////////
+// lets get rid of some warnings
+
void CodetoSymbol(char *truncated);
void GetData(void *param);
void FillFontListThread(void *);
@@ -133,9 +134,8 @@ int OSDAlert(WPARAM wParam, LPARAM lParam); void ReadFromFile(void *hContact);
-/*
- * some globals for window settings
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// some globals for window settings
extern int Xposition, Yposition, WindowHeight, WindowWidth;
extern COLORREF BackgoundClr, TextClr;
@@ -150,7 +150,9 @@ extern MWindowList hWindowList; extern HGENMENU hMenuItem1, hMenuItemCountdown;
extern char optionsname[80];
-//lets get rid of some warnings
+/////////////////////////////////////////////////////////////////////////////////////////
+// lets get rid of some warnings
+
void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD);
void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD);
void SavewinSettings(void);
@@ -164,7 +166,9 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam); int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgbBack);
-//Services
+/////////////////////////////////////////////////////////////////////////////////////////
+// Services
+
INT_PTR GetCaps(WPARAM wParam, LPARAM lParam);
INT_PTR GetName(WPARAM wParam, LPARAM lParam);
INT_PTR BPLoadIcon(WPARAM wParam, LPARAM lParam); // BPLoadIcon
@@ -183,23 +187,21 @@ INT_PTR CountdownMenuCommand(WPARAM wParam, LPARAM lParam); INT_PTR MarkAllReadMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR AddContactMenuCommand(WPARAM wParam, LPARAM lParam);
-INT_PTR ContactOptionsMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM lParam);
-INT_PTR ShowHideContactCommand(WPARAM wParam, LPARAM lParam);
INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR StpPrcssMenuCommand(WPARAM wParam, LPARAM lParam);
int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, MCONTACT singlecontact);
int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, MCONTACT singlecontact);
-//
+/////////////////////////////////////////////////////////////////////////////////////////
void ChangeContactStatus(int con_stat);
void InitialiseGlobals(void);
void FontSettings(void);
-///
+/////////////////////////////////////////////////////////////////////////////////////////
void Removewhitespace(char *truncated);
void RemoveInvis(char *truncated, int AmountWspcRem);
@@ -227,7 +229,7 @@ int SiteDeleted(WPARAM wParam, LPARAM lParam); int WErrorPopup(MCONTACT hContact, wchar_t *textdisplay);
int WAlertPopup(MCONTACT hContact, wchar_t *displaytext);
-//////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// wrappers
extern HANDLE hHookDisplayDataAlert;
@@ -241,3 +243,16 @@ extern HANDLE hHookErrorPopup; extern HANDLE hHookAlertOSD;
#define ME_OSD_ALERT "Miranda/ALERT/OSD"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("PreserveName");
+ }
+};
+
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index a21b19f693..0610c9be34 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -122,7 +122,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) else mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
ppd.lchContact = wParam;
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
wchar_t *displaytext = (wchar_t*)lParam;
if ((mir_wstrlen(displaytext) == MAX_SECONDLINE) || (mir_wstrlen(displaytext) > MAX_SECONDLINE))
@@ -413,7 +413,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn else if (eventIndex == 1) { // webpage changed
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -625,7 +625,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -763,9 +763,9 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM) if ( WindowList_Find(hWindowList, hContact))
return 0;
- HWND hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 425b43e7ae..f4159e24f3 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SetWindowText(hwndDlg, TranslateT("Find"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FIND)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FIND)));
return TRUE;
case WM_COMMAND:
@@ -175,36 +175,36 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else preservename[0] = 0;
SetWindowTextA(hwndDlg, preservename);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)));
// //////
COLORREF colour = BackgoundClr;
COLORREF txtcolor;
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_SETBKGNDCOLOR, 0, colour);
- SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Update data"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Find"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Contact options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Alert options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STOP, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stop processing"), BATF_UNICODE);
SendDlgItemMessage(hwndDlg, IDC_OPEN_URL, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Click here to open this URL in a browser window."), BATF_UNICODE);
if (!db_get_b(hContact2, MODULENAME, ON_TOP_KEY, 0)) {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stick to the front"), BATF_UNICODE);
}
else {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Disable stick to the front"), BATF_UNICODE);
}
@@ -368,7 +368,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hTopmost = HWND_TOPMOST;
ptszToolTip = TranslateT("Disable stick to the front");
}
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM)ptszToolTip, BATF_UNICODE);
SetWindowPos(hwndDlg, hTopmost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}
@@ -376,7 +376,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_FIND_BUTTON:
{
- HWND hwndFind = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
+ HWND hwndFind = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
ShowWindow(hwndFind, SW_SHOW);
EnableWindow(GetDlgItem(hwndDlg, IDC_FIND_BUTTON), 0);
}
@@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_OPTIONS_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- ContactHwnd = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
+ ContactHwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
ShowWindow(ContactHwnd, SW_SHOW);
SetActiveWindow(ContactHwnd);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS_BUTTON), 0);
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_ALERT_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- HWND hwndAlertOpt = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
+ HWND hwndAlertOpt = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
ShowWindow(hwndAlertOpt, SW_SHOW);
SetActiveWindow(hwndAlertOpt);
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
InvalidateRect(hwndDlg, nullptr, TRUE);
// global
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 348185a01d..7cbcebb0c0 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) }
ppd.lchContact = NULL;
mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
@@ -279,7 +279,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetWindowText(hwndDlg, TranslateT("Alert options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT)));
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
@@ -819,7 +819,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowText(hwndDlg, TranslateT("Contact options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 277683ea74..0784da7750 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -80,7 +80,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); + GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -118,7 +118,7 @@ int SiteDeleted(WPARAM wParam, LPARAM) // TEST GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50]; - GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); + GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -143,7 +143,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) { //GET NAME FOR CACHE wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(g_hInstance, cachepath, _countof(cachepath)); + GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath)); wchar_t *cacheend = wcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; @@ -292,7 +292,7 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM) default: return 0; } - return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, + return (INT_PTR)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0); } |