diff options
author | Mataes <mataes2007@gmail.com> | 2018-05-16 21:12:31 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-05-16 21:12:31 +0300 |
commit | 1fc8e65dd319abf0bac6ce753bb87ecbabd8b177 (patch) | |
tree | 94aaf74e14515883aea9da6752ccacca6007fa47 /plugins/DbEditorPP/src | |
parent | aba882ecf1f570400c301493725fcb31270e0fd5 (diff) |
Flags, CrashDumper, CryptoPP, CSList, Db_autobackups, DbEditorPP: cmplugin adaptation
Diffstat (limited to 'plugins/DbEditorPP/src')
-rw-r--r-- | plugins/DbEditorPP/src/copymodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/deletemodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/exportimport.cpp | 4 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/findwindow.cpp | 182 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/icons.cpp | 4 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 15 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 116 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/moduletree.cpp | 98 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/renamemodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/settinglist.cpp | 236 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/settingsdlg.cpp | 158 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/stdafx.h | 21 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/watchedvars.cpp | 52 |
14 files changed, 444 insertions, 450 deletions
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 052b6fd8d5..e0adfe2812 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -85,7 +85,7 @@ void copyModuleMenuItem(MCONTACT hContact, const char *module) mac->hContact = hContact;
mir_strncpy(mac->module, module, sizeof(mac->module));
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_COPY_MOD), hwnd2mainWindow, copyModDlgProc, (LPARAM)mac);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPY_MOD), hwnd2mainWindow, copyModDlgProc, (LPARAM)mac);
}
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 2c08c762e4..dd2758f3e5 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -121,7 +121,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) void deleteModuleDlg()
{
if (!hwnd2Delete)
- hwnd2Delete = CreateDialog(hInst, MAKEINTRESOURCE(IDD_COPY_MOD), hwnd2mainWindow, DeleteModuleDlgProc);
+ hwnd2Delete = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPY_MOD), hwnd2mainWindow, DeleteModuleDlgProc);
else
SetForegroundWindow(hwnd2Delete);
}
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 425abae95a..8241c13ed5 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -440,7 +440,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT));
if (length) {
- wchar_t *data = (wchar_t*)mir_alloc((length + 1)*sizeof(wchar_t));
+ wchar_t *data = (wchar_t*)mir_alloc((length + 1) * sizeof(wchar_t));
GetDlgItemText(hwnd, IDC_TEXT, data, length + 1);
importSettings(hContact, T2Utf(data));
mir_free(data);
@@ -454,7 +454,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara void ImportSettingsMenuItem(MCONTACT hContact)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IMPORT), hwnd2mainWindow, ImportDlgProc, hContact);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_IMPORT), hwnd2mainWindow, ImportDlgProc, hContact);
}
int Openfile2Import(wchar_t *outputFiles, int maxlen)
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index ca09d1750c..508a9fe727 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -3,16 +3,16 @@ #ifdef _UNICODE
- #define FindMatchT(a,b,c) FindMatchW(a,b,c)
+#define FindMatchT(a,b,c) FindMatchW(a,b,c)
#else
- #define FindMatchT(a,b,c) FindMatchA(a,b,c)
+#define FindMatchT(a,b,c) FindMatchA(a,b,c)
#endif
#ifdef _UNICODE
- #define multiReplaceT(a,b,c,d) multiReplaceW(a,b,c,d)
+#define multiReplaceT(a,b,c,d) multiReplaceW(a,b,c,d)
#else
- #define multiReplaceT(a,b,c,d) multiReplaceA(a,b,c,d)
+#define multiReplaceT(a,b,c,d) multiReplaceA(a,b,c,d)
#endif
@@ -78,7 +78,7 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP CheckDlgButton(hwnd, IDC_SETTINGNAME, BST_CHECKED);
CheckDlgButton(hwnd, IDC_SETTINGVALUE, BST_CHECKED);
CheckDlgButton(hwnd, IDC_FOUND, BST_CHECKED);
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)));
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT)));
SetWindowLongPtr(GetDlgItem(hwnd, IDC_REPLACE), GWLP_USERDATA, 0);
SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 0);
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); // taskbar icon
@@ -96,11 +96,11 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 0);
else {
wchar_t text[FLD_SIZE];
- wchar_t replace[FLD_SIZE] = {0};
+ wchar_t replace[FLD_SIZE] = { 0 };
if (!GetDlgItemText(hwnd, IDC_TEXT, text, _countof(text)) && !IsDlgButtonChecked(hwnd, IDC_EXACT)) break;
- // empty replace is done only for exact match or entire replace
+ // empty replace is done only for exact match or entire replace
if (LOWORD(wParam) == IDOK &&
!GetDlgItemText(hwnd, IDC_REPLACE, replace, _countof(replace)) &&
(!IsDlgButtonChecked(hwnd, IDC_ENTIRELY) && !IsDlgButtonChecked(hwnd, IDC_EXACT)))
@@ -154,61 +154,61 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP }
break;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = 610;
- mmi->ptMinTrackSize.y = 300;
- }
- return 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 610;
+ mmi->ptMinTrackSize.y = 300;
+ }
+ return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_FIND), FindDialogResize);
+ Utils_ResizeDialog(hwnd, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FIND), FindDialogResize);
break;
case WM_NOTIFY:
if (LOWORD(wParam) != IDC_LIST) break;
- switch (((NMHDR*)lParam)->code) {
- case NM_DBLCLK:
- {
- LVHITTESTINFO hti;
- LVITEM lvi;
- HWND hwndResults = GetDlgItem(hwnd, IDC_LIST);
- hti.pt = ((NMLISTVIEW*)lParam)->ptAction;
- if (ListView_SubItemHitTest(hwndResults, &hti) > -1) {
- if (hti.flags&LVHT_ONITEM)
+ switch (((NMHDR*)lParam)->code) {
+ case NM_DBLCLK:
+ {
+ LVHITTESTINFO hti;
+ LVITEM lvi;
+ HWND hwndResults = GetDlgItem(hwnd, IDC_LIST);
+ hti.pt = ((NMLISTVIEW*)lParam)->ptAction;
+ if (ListView_SubItemHitTest(hwndResults, &hti) > -1) {
+ if (hti.flags&LVHT_ONITEM)
+ {
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = hti.iItem;
+ lvi.iSubItem = 0;
+ if (ListView_GetItem(hwndResults, &lvi))
{
- lvi.mask = LVIF_PARAM;
- lvi.iItem = hti.iItem;
- lvi.iSubItem = 0;
- if (ListView_GetItem(hwndResults, &lvi))
- {
- ItemInfo ii = {0};
- ii.hContact = (MCONTACT)lvi.lParam;
- ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, _countof(ii.module));
- ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, _countof(ii.setting));
- if (ii.setting[0])
- ii.type = FW_SETTINGNAME;
- else if (ii.module[0])
- ii.type = FW_MODULE;
-
- SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
- }
+ ItemInfo ii = { 0 };
+ ii.hContact = (MCONTACT)lvi.lParam;
+ ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, _countof(ii.module));
+ ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, _countof(ii.setting));
+ if (ii.setting[0])
+ ii.type = FW_SETTINGNAME;
+ else if (ii.module[0])
+ ii.type = FW_MODULE;
+
+ SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
}
}
- break;
}
+ break;
+ }
case LVN_COLUMNCLICK:
- {
- LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
- ColumnsSortParams params;
- params.hList = GetDlgItem(hwnd, IDC_LIST);
- params.column = lv->iSubItem;
- params.last = lastColumn;
- ListView_SortItemsEx(params.hList, ColumnsCompare, (LPARAM)¶ms);
- lastColumn = (params.column == lastColumn) ? -1 : params.column;
- break;
- }
+ {
+ LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
+ ColumnsSortParams params;
+ params.hList = GetDlgItem(hwnd, IDC_LIST);
+ params.column = lv->iSubItem;
+ params.last = lastColumn;
+ ListView_SortItemsEx(params.hList, ColumnsCompare, (LPARAM)¶ms);
+ lastColumn = (params.column == lastColumn) ? -1 : params.column;
+ break;
+ }
} // switch
break;
case WM_DESTROY:
@@ -222,7 +222,7 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP void newFindWindow() {
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIND), hwnd2mainWindow, FindWindowDlgProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FIND), hwnd2mainWindow, FindWindowDlgProc);
}
void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *setting, wchar_t* value, int type)
@@ -236,10 +236,10 @@ void ItemFound(HWND hwnd, MCONTACT hContact, const char *module, const char *set mode = TranslateT("Deleted");
else
mode = TranslateT("Found");
-
+
GetContactName(hContact, nullptr, name, _countof(name));
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM;
lvi.lParam = (LPARAM)hContact;
@@ -266,20 +266,20 @@ char* multiReplaceA(const char *value, const char *search, const char *replace, int vlen = (int)mir_strlen(value);
int ci = slen ? cs : 1; // on empty string strstr() returns full string while StrStrI() returns NULL
// let's try to calculate maximum length for result string
- int newlen = (!slen) ? rlen + 1 : ( ( rlen <= slen ) ? vlen + 1 : vlen * rlen / slen + 1 );
-
+ int newlen = (!slen) ? rlen + 1 : ((rlen <= slen) ? vlen + 1 : vlen * rlen / slen + 1);
+
char *head;
char *in = (char*)value;
char *out = (char*)mir_alloc(newlen * sizeof(char));
out[0] = 0;
-
+
while (head = ci ? strstr(in, search) : StrStrIA(in, search)) {
if (head != in)
mir_strncat(out, in, head - in + 1);
in = head + slen;
mir_strcat(out, replace);
}
-
+
mir_strcat(out, in);
return out;
}
@@ -291,8 +291,8 @@ WCHAR* multiReplaceW(const WCHAR *value, const WCHAR *search, const WCHAR *repla int vlen = (int)mir_wstrlen(value);
int ci = slen ? cs : 1; // on empty string strstr() returns full string while StrStrI() returns NULL
// let's try to calculate maximum length for result string
- int newlen = (!slen) ? rlen + 1 : ( ( rlen <= slen ) ? vlen + 1 : vlen * rlen / slen + 1 );
-
+ int newlen = (!slen) ? rlen + 1 : ((rlen <= slen) ? vlen + 1 : vlen * rlen / slen + 1);
+
WCHAR *head;
WCHAR *in = (WCHAR*)value;
WCHAR *out = (WCHAR*)mir_alloc(newlen * sizeof(WCHAR));
@@ -304,7 +304,7 @@ WCHAR* multiReplaceW(const WCHAR *value, const WCHAR *search, const WCHAR *repla in = head + slen;
mir_wstrcat(out, replace);
}
-
+
mir_wstrcat(out, in);
return out;
}
@@ -317,7 +317,7 @@ int FindMatchA(const char *text, char *search, int options) if (options & F_EXACT)
return (options & F_CASE) ? !strcmp(text, search) : !stricmp(text, search);
-
+
// on empty string strstr() returns full string while StrStrI() returns NULL
return (options & F_CASE) ? (INT_PTR)strstr(text, search) : (INT_PTR)StrStrIA(text, search);
}
@@ -355,7 +355,7 @@ void __cdecl FindSettings(LPVOID param) MCONTACT hContact;
DBVARIANT dbv = { 0 };
- int foundCount = 0, replaceCount = 0, deleteCount = 0;
+ int foundCount = 0, replaceCount = 0, deleteCount = 0;
DWORD numsearch = 0, numreplace = 0;
int NULLContactDone = 0;
@@ -368,13 +368,13 @@ void __cdecl FindSettings(LPVOID param) _T2A search(fi->search);
_T2A replace(fi->replace);
- // skip modules and setting names on unicode search or replace
- if (IsRealUnicode(fi->search) || IsRealUnicode(fi->replace)) {
- fi->options &= ~(F_SETNAME | F_MODNAME);
- fi->options |= F_UNICODE;
- }
+ // skip modules and setting names on unicode search or replace
+ if (IsRealUnicode(fi->search) || IsRealUnicode(fi->replace)) {
+ fi->options &= ~(F_SETNAME | F_MODNAME);
+ fi->options |= F_UNICODE;
+ }
- if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
+ if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
char val[16];
numsearch = strtoul(search, nullptr, 10);
_ultoa(numsearch, val, 10);
@@ -397,7 +397,7 @@ void __cdecl FindSettings(LPVOID param) while (GetWindowLongPtr(GetDlgItem(hwndParent, IDC_SEARCH), GWLP_USERDATA)) {
if (!hContact) {
- if (NULLContactDone)
+ if (NULLContactDone)
break;
else {
NULLContactDone = 1;
@@ -430,27 +430,27 @@ void __cdecl FindSettings(LPVOID param) wchar_t *value = nullptr;
- switch(dbv.type) {
+ switch (dbv.type) {
- case DBVT_BYTE:
- case DBVT_WORD:
+ case DBVT_BYTE:
+ case DBVT_WORD:
case DBVT_DWORD:
if ((fi->options & F_NUMSRCH) && numsearch == getNumericValue(&dbv)) {
wchar_t *val = fi->search;
int flag = F_SETVAL;
if (fi->options & F_NUMREPL) {
- if (replace[0]) {
+ if (replace[0]) {
db_unset(hContact, module->name, setting->name);
flag |= F_DELETED;
deleteCount++;
- }
- else
- if (setNumericValue(hContact, module->name, setting->name, numreplace, dbv.type)) {
- val = fi->replace;
- flag |= F_REPLACED;
- replaceCount++;
}
+ else
+ if (setNumericValue(hContact, module->name, setting->name, numreplace, dbv.type)) {
+ val = fi->replace;
+ flag |= F_REPLACED;
+ replaceCount++;
+ }
}
ItemFound(fi->hwnd, hContact, module->name, setting->name, val, flag);
@@ -478,14 +478,15 @@ void __cdecl FindSettings(LPVOID param) flag |= F_DELETED;
newValue = value;
deleteCount++;
- } else {
+ }
+ else {
#ifdef _UNICODE
- // save as unicode if needed
+ // save as unicode if needed
if (dbv.type != DBVT_ASCIIZ || IsRealUnicode(newValue))
db_set_ws(hContact, module->name, setting->name, newValue);
- else
+ else
#endif
- db_set_s(hContact, module->name, setting->name, _T2A(newValue));
+ db_set_s(hContact, module->name, setting->name, _T2A(newValue));
flag |= F_REPLACED;
replaceCount++;
}
@@ -513,15 +514,16 @@ void __cdecl FindSettings(LPVOID param) flag |= F_DELETED;
newSetting = setting->name;
deleteCount++;
- } else {
+ }
+ else {
DBVARIANT dbv2;
// skip if exist
- if (!db_get_s(hContact, module->name, newSetting, &dbv2, 0))
+ if (!db_get_s(hContact, module->name, newSetting, &dbv2, 0))
db_free(&dbv2);
else if (!db_set(hContact, module->name, newSetting, &dbv)) {
db_unset(hContact, module->name, setting->name);
flag |= F_REPLACED;
- replaceCount++;
+ replaceCount++;
}
}
}
@@ -545,16 +547,16 @@ void __cdecl FindSettings(LPVOID param) if (replace) {
newModule = (fi->options & F_ENTIRE) ? replace : ptr = multiReplaceA(module->name, search, replace, fi->options & F_CASE);
-
+
if (!newModule[0]) {
deleteModule(hContact, module->name, 0);
replaceTreeItem(hContact, module->name, nullptr);
flag |= F_DELETED;
newModule = module->name;
deleteCount++;
- }
+ }
else if (renameModule(hContact, module->name, newModule)) {
- replaceTreeItem(hContact, module->name, nullptr);
+ replaceTreeItem(hContact, module->name, nullptr);
flag |= F_REPLACED;
replaceCount++;
}
@@ -566,7 +568,7 @@ void __cdecl FindSettings(LPVOID param) } // for(module)
}
- wchar_t msg[MSG_SIZE];
+ wchar_t msg[MSG_SIZE];
mir_snwprintf(msg, TranslateT("Finished. Items found: %d / replaced: %d / deleted: %d"), foundCount, replaceCount, deleteCount);
SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)msg);
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index a80958d752..7d5a0ec0bf 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -50,7 +50,7 @@ HANDLE GetIcoLibHandle(int icon) void IcoLibRegister(void)
{
- Icon_Register(hInst, modFullname, iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), modFullname, iconList, _countof(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
@@ -59,7 +59,7 @@ HICON LoadSkinnedDBEIcon(int icon) if (it.defIconID == icon)
return IcoLib_GetIconByHandle(it.hIcolib);
- return LoadIcon(hInst, MAKEINTRESOURCE(icon));
+ return LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(icon));
}
HIMAGELIST LoadIcons()
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index e54b484de5..70a77edb7b 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -1,13 +1,12 @@ #include "stdafx.h"
-HINSTANCE hInst = nullptr;
-
MIDatabase *g_db;
HANDLE hTTBButt = nullptr;
bool g_bServiceMode = false;
bool g_bUsePopups;
+CMPlugin g_plugin;
int hLangpack;
BYTE nameOrder[NAMEORDERCOUNT];
HGENMENU hUserMenu;
@@ -43,16 +42,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) // we implement service mode interface
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SERVICEMODE, MIID_LAST };
-//========================
-// WINAPI DllMain
-//========================
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-
int DBSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
@@ -169,7 +158,7 @@ INT_PTR ServiceMode(WPARAM, LPARAM) IcoLibRegister();
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
-
+
return SERVICE_ONLYDB; // load database and then call us
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 318a1fc8e1..cb5c21a393 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -60,12 +60,12 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return HTCLIENT;
case WM_SETCURSOR:
- {
- RECT rc;
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? LoadCursor(nullptr, IDC_SIZENS) : LoadCursor(nullptr, IDC_SIZEWE));
- }
- return TRUE;
+ {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ SetCursor(rc.right > rc.bottom ? LoadCursor(nullptr, IDC_SIZENS) : LoadCursor(nullptr, IDC_SIZEWE));
+ }
+ return TRUE;
case WM_LBUTTONDOWN:
SetCapture(hwnd);
@@ -91,18 +91,18 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR {
switch (msg) {
case WM_RBUTTONDOWN:
- {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(hwnd, &hti.pt);
-
- if (TreeView_HitTest(hwnd, &hti)) {
- if (hti.flags&TVHT_ONITEM)
- TreeView_SelectItem(hwnd, hti.hItem);
- }
+ {
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(hwnd, &hti.pt);
+
+ if (TreeView_HitTest(hwnd, &hti)) {
+ if (hti.flags&TVHT_ONITEM)
+ TreeView_SelectItem(hwnd, hti.hItem);
}
- break;
+ }
+ break;
case WM_CHAR:
if (GetKeyState(VK_CONTROL) & 0x8000 && wParam == 6)
@@ -209,7 +209,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) hImg = LoadIcons();
// do the icon
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)));
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT)));
SetWindowText(hwnd, TranslateT("Database Editor++"));
// setup the splitter
@@ -265,42 +265,42 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE;
case GC_SPLITTERMOVED:
- {
- int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
-
- RECT rc2;
- GetWindowRect(hwnd, &rc2);
-
- if ((HWND)lParam == GetDlgItem(hwnd, IDC_SPLITTER)) {
- RECT rc;
- GetClientRect(hwnd, &rc);
- POINT pt = { (LONG)wParam, 0 };
- ScreenToClient(hwnd, &pt);
-
- splitterPos = rc.left + pt.x + 1;
- if (splitterPos < 150)
- splitterPos = 150;
- if (splitterPos > rc2.right - rc2.left - 150)
- splitterPos = rc2.right - rc2.left - 150;
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
- db_set_w(NULL, modname, "Splitter", (WORD)splitterPos);
- }
- PostMessage(hwnd, WM_SIZE, 0, 0);
+ {
+ int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
+
+ RECT rc2;
+ GetWindowRect(hwnd, &rc2);
+
+ if ((HWND)lParam == GetDlgItem(hwnd, IDC_SPLITTER)) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ POINT pt = { (LONG)wParam, 0 };
+ ScreenToClient(hwnd, &pt);
+
+ splitterPos = rc.left + pt.x + 1;
+ if (splitterPos < 150)
+ splitterPos = 150;
+ if (splitterPos > rc2.right - rc2.left - 150)
+ splitterPos = rc2.right - rc2.left - 150;
+ SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
+ db_set_w(NULL, modname, "Splitter", (WORD)splitterPos);
}
- break;
+ PostMessage(hwnd, WM_SIZE, 0, 0);
+ }
+ break;
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO *)lParam;
- int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
- mmi->ptMinTrackSize.x = splitterPos + 150;
- mmi->ptMinTrackSize.y = 300;
- }
- return 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO *)lParam;
+ int splitterPos = GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA);
+ mmi->ptMinTrackSize.x = splitterPos + 150;
+ mmi->ptMinTrackSize.y = 300;
+ }
+ return 0;
case WM_MOVE:
case WM_SIZE:
- Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_MAIN), DialogResize, GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA));
+ Utils_ResizeDialog(hwnd, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_MAIN), DialogResize, GetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA));
break;
case WM_DESTROY: // free our shit!
@@ -359,7 +359,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ShowWindow(hwnd, SW_SHOWNOACTIVATE);
}
else db_set_b(NULL, modname, "Maximized", 0);
-
+
Utils_SaveWindowPosition(hwnd, NULL, modname, "Main_");
ShowWindow(hwnd, SW_HIDE);
}
@@ -408,7 +408,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) }
break;
- // watches
+ // watches
case MENU_VIEW_WATCHES:
openWatchedVarWindow();
break;
@@ -490,12 +490,12 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_DWORD_HEX, MF_BYCOMMAND | ((g_Hex & HEX_DWORD) ? MF_CHECKED : MF_UNCHECKED));
break;
case MENU_SAVE_POSITION:
- {
- BOOL save = !db_get_b(NULL, modname, "RestoreOnOpen", 1);
- CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (save ? MF_CHECKED : MF_UNCHECKED));
- db_set_b(NULL, modname, "RestoreOnOpen", (byte)save);
- }
- break;
+ {
+ BOOL save = !db_get_b(NULL, modname, "RestoreOnOpen", 1);
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (save ? MF_CHECKED : MF_UNCHECKED));
+ db_set_b(NULL, modname, "RestoreOnOpen", (byte)save);
+ }
+ break;
case MENU_INLINE_EDIT:
g_Inline = !g_Inline;
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_INLINE_EDIT, MF_BYCOMMAND | (g_Inline ? MF_CHECKED : MF_UNCHECKED));
@@ -523,7 +523,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; // case WM_NOTIFY
case WM_FINDITEM:
- ItemInfo *ii = (ItemInfo *)wParam;
+ ItemInfo * ii = (ItemInfo *)wParam;
HTREEITEM hItem = findItemInTree(ii->hContact, ii->module);
if (hItem) {
TreeView_SelectItem(hwnd2Tree, hItem);
@@ -539,5 +539,5 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openMainWindow()
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
}
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 5502e5c62e..b9dde4ac32 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -42,7 +42,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec tvi.hInsertAfter = TVI_SORT;
tvi.item.cChildren = 1;
-
+
char szProto[FLD_SIZE];
wchar_t name[NAME_SIZE];
@@ -80,7 +80,7 @@ int doContacts(HTREEITEM contactsRoot, ModuleSettingLL *modlist, MCONTACT hSelec for (ModSetLinkLinkItem *module = modlist->first; module && hwnd2mainWindow; module = module->next) {
if (!module->name[0] || IsModuleEmpty(hContact, module->name))
continue;
- insertItem(hContact, module->name, contact);
+ insertItem(hContact, module->name, contact);
}
hItem = findItemInTree(hSelectedContact, selectedModule);
@@ -400,7 +400,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) for (ModSetLinkLinkItem *module = modlist.first; module && hwnd2mainWindow; module = module->next) {
if (!module->name[0] || IsModuleEmpty(hContact, module->name))
continue;
- insertItem(hContact, module->name, contact);
+ insertItem(hContact, module->name, contact);
}
if (db_get_b(NULL, modname, "ExpandSettingsOnOpen", 0))
@@ -494,34 +494,34 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h break;
case TVN_SELCHANGED:
- {
- LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
- TVITEM tvi = { 0 };
- wchar_t text[FLD_SIZE];
- MCONTACT hContact;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
- tvi.hItem = pnmtv->itemNew.hItem;
- tvi.pszText = text;
- tvi.cchTextMax = _countof(text);
- TreeView_GetItem(pnmtv->hdr.hwndFrom, &tvi);
-
- ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
+ {
+ LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam;
+ TVITEM tvi = { 0 };
+ wchar_t text[FLD_SIZE];
+ MCONTACT hContact;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
+ tvi.hItem = pnmtv->itemNew.hItem;
+ tvi.pszText = text;
+ tvi.cchTextMax = _countof(text);
+ TreeView_GetItem(pnmtv->hdr.hwndFrom, &tvi);
- if (mtis) {
-
- hContact = mtis->hContact;
+ ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
- if (mtis->type == STUB)
- break;
+ if (mtis) {
- if (populating)
- Select = 0;
+ hContact = mtis->hContact;
- if (mtis->type == MODULE) {
- _T2A module(text);
- PopulateSettings(hContact, module);
- }
- else
+ if (mtis->type == STUB)
+ break;
+
+ if (populating)
+ Select = 0;
+
+ if (mtis->type == MODULE) {
+ _T2A module(text);
+ PopulateSettings(hContact, module);
+ }
+ else
if (((mtis->type & CONTACT) == CONTACT && hContact) || (mtis->type == CONTACT_ROOT_ITEM && !hContact)) {
int multi = 0;
@@ -550,11 +550,11 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h }
else
ClearListView();
- }
- else
- ClearListView();
}
- break; //TVN_SELCHANGED:
+ else
+ ClearListView();
+ }
+ break; //TVN_SELCHANGED:
case NM_RCLICK:
if (((NMHDR *)lParam)->code == NM_RCLICK)
@@ -562,18 +562,18 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT, WPARAM wParam, LPARAM lParam)// hwnd h break;
case TVN_BEGINLABELEDIT: // subclass it..
- {
- LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
- ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
- HWND hwnd2Edit = TreeView_GetEditControl(hwnd2Tree);
- if (!mtis->type || (mtis->type == CONTACT)) {
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
- break;
- }
- mir_subclassWindow(hwnd2Edit, ModuleTreeLabelEditSubClassProc);
- SetWindowLongPtr(hwnd, DWLP_MSGRESULT, FALSE);
+ {
+ LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
+ ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
+ HWND hwnd2Edit = TreeView_GetEditControl(hwnd2Tree);
+ if (!mtis->type || (mtis->type == CONTACT)) {
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
+ break;
}
- break;
+ mir_subclassWindow(hwnd2Edit, ModuleTreeLabelEditSubClassProc);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, FALSE);
+ }
+ break;
case TVN_ENDLABELEDIT:
LPNMTVDISPINFO ptvdi = (LPNMTVDISPINFO)lParam;
@@ -615,7 +615,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t hti.pt.y = (short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if (!TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || !(hti.flags & TVHT_ONITEM)) return;
+ if (!TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti) || !(hti.flags & TVHT_ONITEM)) return;
TVITEM tvi = { 0 };
HMENU hMenu, hSubMenu;
@@ -636,7 +636,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t MCONTACT hContact = mtis->hContact;
GetCursorPos(&hti.pt);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXTMENU));
TranslateMenu(hMenu);
if (mtis->type == CONTACT && hContact)
@@ -660,7 +660,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t {
// check if the setting is being watched and if it is then check the menu item
int watchIdx = WatchedArrayIndex(hContact, module, nullptr, 1);
- if (watchIdx >= 0)
+ if (watchIdx >= 0)
CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, nullptr)) {
@@ -689,7 +689,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case MENU_REFRESH:
- refreshTree(1);
+ refreshTree(1);
break;
case MENU_EXPORTMODULE:
@@ -739,7 +739,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case MENU_REFRESH:
- refreshTree(1);
+ refreshTree(1);
break;
}
@@ -760,7 +760,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
- refreshTree(1);
+ refreshTree(1);
break;
}
break;
@@ -777,7 +777,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t ImportSettingsFromFileMenuItem(NULL, nullptr);
break;
case MENU_REFRESH:
- refreshTree(1);
+ refreshTree(1);
break;
}
break;
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index 12a60c0693..29e45ad00f 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -57,7 +57,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l INT OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szGroup.a = LPGEN("Database");
odp.szTitle.a = modFullname;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 89122b9b39..488f881460 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -63,5 +63,5 @@ static INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA void addModuleDlg(MCONTACT hContact)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd2mainWindow, AddModDlgProc, hContact);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd2mainWindow, AddModDlgProc, hContact);
}
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index aaa8591c8b..6043abc02c 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
-SettingListInfo info = {0};
+SettingListInfo info = { 0 };
HWND hwnd2List = nullptr;
@@ -451,139 +451,139 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd, UINT msg, WPARAM case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- {
- DBVARIANT dbv = { 0 };
- int len = GetWindowTextLength(hwnd) + 1;
+ {
+ DBVARIANT dbv = { 0 };
+ int len = GetWindowTextLength(hwnd) + 1;
- if ((!info.subitem && len <= 1) || db_get_s(info.hContact, info.module, info.setting, &dbv, 0)) {
- SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0);
- return 0;
- }
+ if ((!info.subitem && len <= 1) || db_get_s(info.hContact, info.module, info.setting, &dbv, 0)) {
+ SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0);
+ return 0;
+ }
- wchar_t *value = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
+ wchar_t *value = (wchar_t*)mir_alloc(len * sizeof(wchar_t));
- GetWindowText(hwnd, value, len);
+ GetWindowText(hwnd, value, len);
- _T2A szValue(value);
+ _T2A szValue(value);
- int res = 0;
+ int res = 0;
- switch (info.subitem) {
- case 0: // setting name
- if (!mir_strcmp(info.setting, szValue) || mir_strlen(szValue) > 0xFE) {
- db_free(&dbv);
- mir_free(value);
- SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0);
- return 0;
- }
- if (db_set(info.hContact, info.module, szValue, &dbv))
- break;
- res = 1;
- db_unset(info.hContact, info.module, info.setting);
- deleteListItem(info.setting);
+ switch (info.subitem) {
+ case 0: // setting name
+ if (!mir_strcmp(info.setting, szValue) || mir_strlen(szValue) > 0xFE) {
+ db_free(&dbv);
+ mir_free(value);
+ SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDCANCEL, 0), 0);
+ return 0;
+ }
+ if (db_set(info.hContact, info.module, szValue, &dbv))
break;
+ res = 1;
+ db_unset(info.hContact, info.module, info.setting);
+ deleteListItem(info.setting);
+ break;
- case 1: // value
- DWORD val;
- int i = 0;
+ case 1: // value
+ DWORD val;
+ int i = 0;
- if (dbv.type == DBVT_BLOB) {
- res = WriteBlobFromString(info.hContact, info.module, info.setting, szValue, (int)mir_strlen(szValue));
- break;
- }
+ if (dbv.type == DBVT_BLOB) {
+ res = WriteBlobFromString(info.hContact, info.module, info.setting, szValue, (int)mir_strlen(szValue));
+ break;
+ }
- switch (value[0]) {
- case 'b':
- case 'B':
- val = wcstoul(&value[1], nullptr, 0);
- if (!val || value[1] == '0') {
- res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val);
- }
- else
- res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
- break;
- case 'w':
- case 'W':
- val = wcstoul(&value[1], nullptr, 0);
- if (!val || value[1] == '0')
- res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val);
- else
- res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
- break;
- case 'd':
- case 'D':
- val = wcstoul(&value[1], nullptr, 0);
- if (!val || value[1] == '0')
- res = !db_set_dw(info.hContact, info.module, info.setting, val);
- else
- res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
- break;
+ switch (value[0]) {
+ case 'b':
+ case 'B':
+ val = wcstoul(&value[1], nullptr, 0);
+ if (!val || value[1] == '0') {
+ res = !db_set_b(info.hContact, info.module, info.setting, (BYTE)val);
+ }
+ else
+ res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
+ break;
+ case 'w':
+ case 'W':
+ val = wcstoul(&value[1], nullptr, 0);
+ if (!val || value[1] == '0')
+ res = !db_set_w(info.hContact, info.module, info.setting, (WORD)val);
+ else
+ res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
+ break;
+ case 'd':
+ case 'D':
+ val = wcstoul(&value[1], nullptr, 0);
+ if (!val || value[1] == '0')
+ res = !db_set_dw(info.hContact, info.module, info.setting, val);
+ else
+ res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
+ break;
- case '0':
- i = 1;
- __fallthrough;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '-':
- case 'x':
- case 'X':
- if (value[i] == 'x' || value[i] == 'X')
- val = wcstoul(&value[i + 1], nullptr, 16);
- else
- val = wcstoul(value, nullptr, 10);
-
- switch (dbv.type) {
- case DBVT_BYTE:
- case DBVT_WORD:
- case DBVT_DWORD:
- res = setNumericValue(info.hContact, info.module, info.setting, val, dbv.type);
- break;
- case DBVT_ASCIIZ:
- case DBVT_WCHAR:
- case DBVT_UTF8:
- res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
- break;
- }
- break;
- case '\"':
- case '\'':
- {
- size_t nlen = mir_wstrlen(value);
- int sh = 0;
- if (nlen > 3) {
- if (value[nlen - 1] == value[0]) {
- value[nlen - 1] = 0;
- sh = 1;
- }
- }
- res = setTextValue(info.hContact, info.module, info.setting, &value[sh], dbv.type);
- }
+ case '0':
+ i = 1;
+ __fallthrough;
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '-':
+ case 'x':
+ case 'X':
+ if (value[i] == 'x' || value[i] == 'X')
+ val = wcstoul(&value[i + 1], nullptr, 16);
+ else
+ val = wcstoul(value, nullptr, 10);
+
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ case DBVT_WORD:
+ case DBVT_DWORD:
+ res = setNumericValue(info.hContact, info.module, info.setting, val, dbv.type);
break;
-
- default:
+ case DBVT_ASCIIZ:
+ case DBVT_WCHAR:
+ case DBVT_UTF8:
res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
break;
}
break;
+ case '\"':
+ case '\'':
+ {
+ size_t nlen = mir_wstrlen(value);
+ int sh = 0;
+ if (nlen > 3) {
+ if (value[nlen - 1] == value[0]) {
+ value[nlen - 1] = 0;
+ sh = 1;
+ }
+ }
+ res = setTextValue(info.hContact, info.module, info.setting, &value[sh], dbv.type);
}
+ break;
- mir_free(value);
- db_free(&dbv);
-
- if (!res) {
- msg(TranslateT("Unable to store value in this data type!"));
+ default:
+ res = setTextValue(info.hContact, info.module, info.setting, value, dbv.type);
break;
}
+ break;
+ }
+
+ mir_free(value);
+ db_free(&dbv);
+
+ if (!res) {
+ msg(TranslateT("Unable to store value in this data type!"));
+ break;
}
- __fallthrough;
+ }
+ __fallthrough;
case IDCANCEL:
DestroyWindow(hwnd);
@@ -622,7 +622,7 @@ void EditLabel(int item, int subitem) info.subitem = subitem;
if (!subitem)
- info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
+ info.hwnd2Edit = CreateWindow(L"EDIT", _A2T(setting), WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, g_plugin.getInst(), nullptr);
else {
wchar_t *str = nullptr, value[16] = { 0 };
@@ -656,11 +656,11 @@ void EditLabel(int item, int subitem) GetClientRect(hwnd2List, &rclist);
if (rc.top + height > rclist.bottom && rclist.bottom - rclist.top > height)
rc.top = rc.bottom - height;
- info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, nullptr, hInst, nullptr);
+ info.hwnd2Edit = CreateWindow(L"EDIT", str, WS_BORDER | WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOHSCROLL, rc.left, rc.top, rc.right - rc.left, height, hwnd2List, nullptr, g_plugin.getInst(), nullptr);
mir_free(str);
}
else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD)
- info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, hInst, nullptr);
+ info.hwnd2Edit = CreateWindow(L"EDIT", value, WS_BORDER | WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), hwnd2List, nullptr, g_plugin.getInst(), nullptr);
}
db_free(&dbv);
@@ -740,7 +740,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to if (ListView_SubItemHitTest(hwnd2List, &hti) == -1) {
// nowhere.. new item menu
GetCursorPos(&pt);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXTMENU));
hSubMenu = GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
@@ -783,7 +783,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to // on item
GetCursorPos(&pt);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXTMENU));
hSubMenu = GetSubMenu(hMenu, 0);
TranslateMenu(hSubMenu);
diff --git a/plugins/DbEditorPP/src/settingsdlg.cpp b/plugins/DbEditorPP/src/settingsdlg.cpp index 10201f6965..8c0f0d78a9 100644 --- a/plugins/DbEditorPP/src/settingsdlg.cpp +++ b/plugins/DbEditorPP/src/settingsdlg.cpp @@ -100,18 +100,18 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break;
case DBVT_UTF8:
- {
- ptrW tmp(mir_utf8decodeW(dbsetting->dbv.pszVal));
- SetDlgItemTextW(hwnd, IDC_STRING, tmp);
- break;
- }
+ {
+ ptrW tmp(mir_utf8decodeW(dbsetting->dbv.pszVal));
+ SetDlgItemTextW(hwnd, IDC_STRING, tmp);
+ break;
+ }
case DBVT_BLOB:
- {
- ptrA tmp(StringFromBlob(dbsetting->dbv.pbVal, dbsetting->dbv.cpbVal));
- SetDlgItemTextA(hwnd, IDC_BLOB, tmp);
- break;
- }
+ {
+ ptrA tmp(StringFromBlob(dbsetting->dbv.pbVal, dbsetting->dbv.cpbVal));
+ SetDlgItemTextA(hwnd, IDC_BLOB, tmp);
+ break;
+ }
}
}
@@ -176,79 +176,79 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break;
case IDOK:
- {
- struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- wchar_t settingname[FLD_SIZE];
- GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, _countof(settingname));
-
- if (settingname[0]) {
- int valueID = 0;
-
- switch (dbsetting->dbv.type) {
- case DBVT_BYTE:
- case DBVT_WORD:
- case DBVT_DWORD:
- case DBVT_DELETED:
- valueID = IDC_SETTINGVALUE;
- break;
-
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- case DBVT_WCHAR:
- valueID = IDC_STRING;
- break;
-
- case DBVT_BLOB:
- valueID = IDC_BLOB;
- break;
- default:
- break;
- }
+ {
+ struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (!valueID)
- break;
-
- int len = GetWindowTextLength(GetDlgItem(hwnd, valueID)) + 1;
- wchar_t *value = (wchar_t*)mir_alloc(len * sizeof(wchar_t));
-
- GetDlgItemText(hwnd, valueID, value, len);
- _T2A setting(settingname);
-
- int type = saveAsType(hwnd, dbsetting->dbv.type);
- int res = 0;
-
- // write the setting
- switch (type) {
- case DBVT_BYTE:
- case DBVT_WORD:
- case DBVT_DWORD:
- res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, nullptr, IsDlgButtonChecked(hwnd, CHK_HEX) ? 16 : 10), type);
- break;
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- case DBVT_WCHAR:
- res = setTextValue(dbsetting->hContact, dbsetting->module, setting, value, type);
- break;
- case DBVT_BLOB:
- res = WriteBlobFromString(dbsetting->hContact, dbsetting->module, setting, _T2A(value), len);
- break;
- }
+ wchar_t settingname[FLD_SIZE];
+ GetDlgItemText(hwnd, IDC_SETTINGNAME, settingname, _countof(settingname));
- mir_free(value);
+ if (settingname[0]) {
+ int valueID = 0;
- if (!res) {
- msg(TranslateT("Unable to store value in this data type!"));
- break;
- }
+ switch (dbsetting->dbv.type) {
+ case DBVT_BYTE:
+ case DBVT_WORD:
+ case DBVT_DWORD:
+ case DBVT_DELETED:
+ valueID = IDC_SETTINGVALUE;
+ break;
+
+ case DBVT_ASCIIZ:
+ case DBVT_UTF8:
+ case DBVT_WCHAR:
+ valueID = IDC_STRING;
+ break;
+
+ case DBVT_BLOB:
+ valueID = IDC_BLOB;
+ break;
+ default:
+ break;
+ }
+
+ if (!valueID)
+ break;
+
+ int len = GetWindowTextLength(GetDlgItem(hwnd, valueID)) + 1;
+ wchar_t *value = (wchar_t*)mir_alloc(len * sizeof(wchar_t));
+
+ GetDlgItemText(hwnd, valueID, value, len);
+ _T2A setting(settingname);
+
+ int type = saveAsType(hwnd, dbsetting->dbv.type);
+ int res = 0;
+
+ // write the setting
+ switch (type) {
+ case DBVT_BYTE:
+ case DBVT_WORD:
+ case DBVT_DWORD:
+ res = setNumericValue(dbsetting->hContact, dbsetting->module, setting, wcstoul(value, nullptr, IsDlgButtonChecked(hwnd, CHK_HEX) ? 16 : 10), type);
+ break;
+ case DBVT_ASCIIZ:
+ case DBVT_UTF8:
+ case DBVT_WCHAR:
+ res = setTextValue(dbsetting->hContact, dbsetting->module, setting, value, type);
+ break;
+ case DBVT_BLOB:
+ res = WriteBlobFromString(dbsetting->hContact, dbsetting->module, setting, _T2A(value), len);
+ break;
+ }
+
+ mir_free(value);
- // delete old setting
- if (dbsetting->setting && mir_strcmp(setting, dbsetting->setting))
- db_unset(dbsetting->hContact, dbsetting->module, dbsetting->setting);
+ if (!res) {
+ msg(TranslateT("Unable to store value in this data type!"));
+ break;
}
+ // delete old setting
+ if (dbsetting->setting && mir_strcmp(setting, dbsetting->setting))
+ db_unset(dbsetting->hContact, dbsetting->module, dbsetting->setting);
}
- __fallthrough;
+
+ }
+ __fallthrough;
case IDCANCEL:
struct DBsetting *dbsetting = (struct DBsetting*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -275,7 +275,7 @@ void editSetting(MCONTACT hContact, const char *module, const char *setting) dbsetting->module = mir_strdup(module);
dbsetting->setting = mir_strdup(setting);
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
}
}
@@ -298,7 +298,7 @@ void copySetting(MCONTACT hContact, const char *module, const char *setting) dbsetting->hContact = hContact;
dbsetting->module = mir_strdup(module);
dbsetting->setting = mir_strdup(tmp);
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
return;
}
}
@@ -313,5 +313,5 @@ void newSetting(MCONTACT hContact, const char *module, int type) dbsetting->hContact = hContact;
dbsetting->module = mir_strdup(module);
dbsetting->setting = nullptr;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EDIT_SETTING), hwnd2mainWindow, EditSettingDlgProc, (LPARAM)dbsetting);
}
diff --git a/plugins/DbEditorPP/src/stdafx.h b/plugins/DbEditorPP/src/stdafx.h index f661911b8c..3e3c0c9e6b 100644 --- a/plugins/DbEditorPP/src/stdafx.h +++ b/plugins/DbEditorPP/src/stdafx.h @@ -16,8 +16,6 @@ #include <win2k.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_utils.h>
#include <m_clist.h>
@@ -49,6 +47,13 @@ #define modname "DBEditorpp"
#define modFullname "Database Editor++"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(modname)
+ {}
+};
+
#define msg(a) MessageBox(hwnd2mainWindow,a,_A2T(modFullname),MB_OK)
#define dlg(a,b) MessageBox(hwnd2mainWindow,a,_A2T(modFullname),b)
@@ -64,7 +69,7 @@ this gets dumped as the lparam for each module tree item
************************/
-// types
+ // types
#define CONTACT_ROOT_ITEM 0
#define CONTACT 1
#define MODULE 2
@@ -149,7 +154,7 @@ struct ColumnsSortParams { enum ICONS {
- IMAGE_EMPTY,
+ IMAGE_EMPTY,
IMAGE_BINARY,
IMAGE_BYTE,
IMAGE_WORD,
@@ -169,8 +174,6 @@ enum ICONS { //=======================================================
// Variables
//=======================================================
-extern HINSTANCE hInst;
-
extern HWND hwnd2mainWindow;
extern int g_Mode;
@@ -196,9 +199,9 @@ extern bool g_bUsePopups; #define HEX_DWORD 4
#ifdef _UNICODE
- #define GetValue(a,b,c,d,e) GetValueW(a,b,c,d,e)
+#define GetValue(a,b,c,d,e) GetValueW(a,b,c,d,e)
#else
- #define GetValue(a,b,c,d,e) GetValueA(a,b,c,d,e)
+#define GetValue(a,b,c,d,e) GetValueA(a,b,c,d,e)
#endif
//main
@@ -250,7 +253,7 @@ void settingChanged(MCONTACT hContact, const char *module, const char *setting, void editSetting(MCONTACT hContact, const char *module, const char *setting);
void copySetting(MCONTACT hContact, const char *module, const char *setting);
void newSetting(MCONTACT hContact, const char *module, int type);
-
+
// exportimport
void exportDB(MCONTACT hContact, const char *module); // hContact == -1 export entire db. module == NULL export entire contact
void ImportSettingsMenuItem(MCONTACT hContact);
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index f438f3dba6..5d894c2c5a 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -22,7 +22,7 @@ int WatchedArrayIndex(MCONTACT hContact, const char *module, const char *setting if (hContact == WatchListArray.item[i].hContact)
if (!mir_strcmp(module, WatchListArray.item[i].module))
// empty setting = module watching
- if ((!strict && !WatchListArray.item[i].setting) || !mir_strcmp(setting, WatchListArray.item[i].setting))
+ if ((!strict && !WatchListArray.item[i].setting) || !mir_strcmp(setting, WatchListArray.item[i].setting))
return i;
}
return -1;
@@ -36,7 +36,7 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set WatchListArray.size += 32;
WatchListArray.item = (struct DBsetting*)mir_realloc(WatchListArray.item, sizeof(struct DBsetting)*WatchListArray.size);
}
- if (!WatchListArray.item)
+ if (!WatchListArray.item)
return 0;
db_get_s(hContact, module, setting, &(WatchListArray.item[WatchListArray.count].dbv), 0);
@@ -44,7 +44,7 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set WatchListArray.item[WatchListArray.count].hContact = hContact;
WatchListArray.item[WatchListArray.count].module = mir_strdup(module);
- if (setting)
+ if (setting)
WatchListArray.item[WatchListArray.count].setting = mir_strdup(setting);
else
WatchListArray.item[WatchListArray.count].setting = nullptr;
@@ -56,14 +56,14 @@ int addSettingToWatchList(MCONTACT hContact, const char *module, const char *set void freeWatchListItem(int item)
{
- if (item < 0 || item >= WatchListArray.count) return;
-
- if (WatchListArray.item[item].module)
+ if (item < 0 || item >= WatchListArray.count) return;
+
+ if (WatchListArray.item[item].module)
mir_free(WatchListArray.item[item].module);
WatchListArray.item[item].module = nullptr;
- if (WatchListArray.item[item].setting)
+ if (WatchListArray.item[item].setting)
mir_free(WatchListArray.item[item].setting);
WatchListArray.item[item].setting = nullptr;
@@ -77,7 +77,7 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) DBVARIANT *dbv = &(lParam->dbv);
if (!lParam->module) return;
-
+
LVITEM lvItem;
lvItem.lParam = (LPARAM)lParam->hContact;
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
@@ -90,20 +90,20 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) if (IsModuleEmpty(lParam->hContact, lParam->module) || !EnumSettings(lParam->hContact, lParam->module, &settinglist))
return;
- struct DBsetting dummy = {0};
+ struct DBsetting dummy = { 0 };
dummy.hContact = lParam->hContact;
dummy.module = lParam->module;
-
+
for (ModSetLinkLinkItem *setting = settinglist.first; setting; setting = setting->next)
{
dummy.setting = setting->name;
addwatchtolist(hwnd, &dummy);
-
+
}
FreeModuleSettingLL(&settinglist);
return;
}
-
+
db_free(&(lParam->dbv));
if (db_get_s(lParam->hContact, lParam->module, lParam->setting, &(lParam->dbv), 0))
@@ -172,8 +172,8 @@ void addwatchtolist(HWND hwnd, struct DBsetting *lParam) void PopulateWatchedWindow()
{
- if (!hwnd2watchedVarsWindow) return;
- HWND hwnd = GetDlgItem(hwnd2watchedVarsWindow, IDC_VARS);
+ if (!hwnd2watchedVarsWindow) return;
+ HWND hwnd = GetDlgItem(hwnd2watchedVarsWindow, IDC_VARS);
ListView_DeleteAllItems(hwnd);
for (int i = 0; i < WatchListArray.count; i++) {
addwatchtolist(hwnd, &(WatchListArray.item[i]));
@@ -237,7 +237,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG:
hwnd2watchedVarsWindow = hwnd;
// do the icon
- SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)));
+ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT)));
TranslateMenu(GetMenu(hwnd));
TranslateMenu(GetSubMenu(GetMenu(hwnd), 0));
TranslateDialogDefault(hwnd);
@@ -254,17 +254,17 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) PopulateWatchedWindow();
return TRUE;
- // for the resize
+ // for the resize
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = 500;
- mmi->ptMinTrackSize.y = 300;
- }
- return 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = 500;
+ mmi->ptMinTrackSize.y = 300;
+ }
+ return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwnd, hInst, MAKEINTRESOURCEA(IDD_WATCH_DIAG), WatchDialogResize);
+ Utils_ResizeDialog(hwnd, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_WATCH_DIAG), WatchDialogResize);
break;
case WM_COMMAND:
@@ -339,8 +339,8 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void openWatchedVarWindow()
{
- if (!hwnd2watchedVarsWindow)
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_WATCH_DIAG), nullptr, WatchDlgProc);
+ if (!hwnd2watchedVarsWindow)
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WATCH_DIAG), nullptr, WatchDlgProc);
else
SetForegroundWindow(hwnd2watchedVarsWindow);
}
@@ -361,7 +361,7 @@ void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting) POPUPDATAT ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
- ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT));
mir_wstrncpy(ppd.lptzContactName, name, _countof(ppd.lptzContactName));
mir_wstrncpy(ppd.lptzText, text, _countof(ppd.lptzText));
ppd.colorBack = colorBack;
|