diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/DbEditorPP/src | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/DbEditorPP/src')
-rw-r--r-- | plugins/DbEditorPP/src/deletemodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main.cpp | 8 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 48 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/moduletree.cpp | 10 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/options.cpp | 22 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/renamemodule.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/settinglist.cpp | 2 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/watchedvars.cpp | 6 |
8 files changed, 50 insertions, 50 deletions
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index dcc3e6463b..343aa625da 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -8,7 +8,7 @@ int deleteModule(MCONTACT hContact, const char *module, int confirm) if (!module || IsModuleEmpty(hContact, module))
return 0;
- if (confirm && db_get_b(NULL, MODULENAME, "WarnOnDelete", 1)) {
+ if (confirm && g_plugin.getByte("WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module));
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 193ea74cc3..939a1b554d 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -127,14 +127,14 @@ static int ModulesLoaded(WPARAM, LPARAM) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D');
g_plugin.addHotkey(&hkd);
- g_bUsePopups = db_get_b(NULL, MODULENAME, "UsePopUps", 0) != 0;
+ g_bUsePopups = g_plugin.getByte("UsePopUps", 0) != 0;
// Load the name order
for (int i = 0; i < NAMEORDERCOUNT; i++)
nameOrder[i] = i;
DBVARIANT dbv = { 0 };
- if (!db_get_s(NULL, "Contact", "NameOrder", &dbv, DBVT_BLOB)) {
+ if (!db_get_s(0, "Contact", "NameOrder", &dbv, DBVT_BLOB)) {
memcpy(nameOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
@@ -517,7 +517,7 @@ void loadListSettings(HWND hwnd, ColumnsSettings *cs) int i = 0;
while (cs[i].name) {
sLC.pszText = TranslateW(cs[i].name);
- sLC.cx = db_get_w(NULL, MODULENAME, cs[i].dbname, cs[i].defsize);
+ sLC.cx = g_plugin.getWord(cs[i].dbname, cs[i].defsize);
ListView_InsertColumn(hwnd, cs[i].index, &sLC);
i++;
}
@@ -532,7 +532,7 @@ void saveListSettings(HWND hwnd, ColumnsSettings *cs) while (cs[i].name) {
if (ListView_GetColumn(hwnd, cs[i].index, &sLC)) {
mir_snprintf(tmp, cs[i].dbname, i);
- db_set_w(NULL, MODULENAME, tmp, (WORD)sLC.cx);
+ g_plugin.setWord(tmp, (WORD)sLC.cx);
}
i++;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 1698814b4d..fbef13920e 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -128,7 +128,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
}
else if ((mtis->type == CONTACT) && hContact) {
- if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
+ if (db_get_b(0, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
@@ -213,7 +213,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText(hwnd, TranslateT("Database Editor++"));
// setup the splitter
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, (LONG_PTR)db_get_w(NULL, MODULENAME, "Splitter", 200));
+ SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, (LONG_PTR)g_plugin.getWord("Splitter", 200));
SendMessage(hwnd, GC_SPLITTERMOVED, 0, 0);
mir_subclassWindow(GetDlgItem(hwnd, IDC_SPLITTER), SplitterSubclassProc);
@@ -233,29 +233,29 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateMenu(GetSubMenu(hMenu, i));
Utils_RestoreWindowPosition(hwnd, NULL, MODULENAME, "Main_");
- if (db_get_b(NULL, MODULENAME, "Maximized", 0))
+ if (g_plugin.getByte("Maximized", 0))
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
- g_Inline = !db_get_b(NULL, MODULENAME, "DontAllowInLineEdit", 1);
+ g_Inline = !g_plugin.getByte("DontAllowInLineEdit", 1);
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_INLINE_EDIT, MF_BYCOMMAND | (g_Inline ? MF_CHECKED : MF_UNCHECKED));
g_Mode = MODE_ALL;
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_FILTER_ALL, MF_BYCOMMAND | MF_CHECKED);
- g_Hex = db_get_b(NULL, MODULENAME, "HexMode", 0);
+ g_Hex = g_plugin.getByte("HexMode", 0);
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_BYTE_HEX, MF_BYCOMMAND | ((g_Hex & HEX_BYTE) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_WORD_HEX, MF_BYCOMMAND | ((g_Hex & HEX_WORD) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_DWORD_HEX, MF_BYCOMMAND | ((g_Hex & HEX_DWORD) ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1) ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (g_plugin.getByte("RestoreOnOpen", 1) ? MF_CHECKED : MF_UNCHECKED));
- g_Order = db_get_b(NULL, MODULENAME, "SortMode", 1);
+ g_Order = g_plugin.getByte("SortMode", 1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SORT_ORDER, MF_BYCOMMAND | (g_Order ? MF_CHECKED : MF_UNCHECKED));
int restore;
if (hRestore)
restore = 3;
- else if (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1))
+ else if (g_plugin.getByte("RestoreOnOpen", 1))
restore = 2;
else
restore = 0;
@@ -283,7 +283,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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, MODULENAME, "Splitter", (WORD)splitterPos);
+ g_plugin.setWord("Splitter", (WORD)splitterPos);
}
PostMessage(hwnd, WM_SIZE, 0, 0);
}
@@ -304,7 +304,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DESTROY: // free our shit!
- if (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1)) {
+ if (g_plugin.getByte("RestoreOnOpen", 1)) {
HTREEITEM item;
if (item = TreeView_GetSelection(hwnd2Tree)) {
@@ -322,16 +322,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) type = mtis->type;
}
- db_set_dw(NULL, MODULENAME, "LastContact", hContact);
+ g_plugin.setDword("LastContact", hContact);
if (type == CONTACT)
- db_set_s(NULL, MODULENAME, "LastModule", "");
+ g_plugin.setString("LastModule", "");
else
- db_set_s(NULL, MODULENAME, "LastModule", _T2A(text));
+ g_plugin.setString("LastModule", _T2A(text));
}
else {
- db_unset(NULL, MODULENAME, "LastContact");
- db_unset(NULL, MODULENAME, "LastModule");
+ g_plugin.delSetting("LastContact");
+ g_plugin.delSetting("LastModule");
}
int pos = ListView_GetSelectionMark(hwnd2List);
@@ -339,26 +339,26 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pos != -1) {
char data[FLD_SIZE];
ListView_GetItemTextA(hwnd2List, pos, 0, data, _countof(data));
- db_set_s(NULL, MODULENAME, "LastSetting", data);
+ g_plugin.setString("LastSetting", data);
}
else
- db_unset(NULL, MODULENAME, "LastSetting");
+ g_plugin.delSetting("LastSetting");
}
}
- db_set_b(NULL, MODULENAME, "HexMode", (byte)g_Hex);
- db_set_b(NULL, MODULENAME, "SortMode", (byte)g_Order);
- db_set_b(NULL, MODULENAME, "DontAllowInLineEdit", (byte)!g_Inline);
+ g_plugin.setByte("HexMode", (byte)g_Hex);
+ g_plugin.setByte("SortMode", (byte)g_Order);
+ g_plugin.setByte("DontAllowInLineEdit", (byte)!g_Inline);
{
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd, &wp);
if (wp.flags == WPF_RESTORETOMAXIMIZED) {
- db_set_b(NULL, MODULENAME, "Maximized", 1);
+ g_plugin.setByte("Maximized", 1);
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
}
- else db_set_b(NULL, MODULENAME, "Maximized", 0);
+ else g_plugin.setByte("Maximized", 0);
Utils_SaveWindowPosition(hwnd, NULL, MODULENAME, "Main_");
ShowWindow(hwnd, SW_HIDE);
@@ -491,9 +491,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case MENU_SAVE_POSITION:
{
- BOOL save = !db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1);
+ BOOL save = !g_plugin.getByte("RestoreOnOpen", 1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (save ? MF_CHECKED : MF_UNCHECKED));
- db_set_b(NULL, MODULENAME, "RestoreOnOpen", (byte)save);
+ g_plugin.setByte("RestoreOnOpen", (byte)save);
}
break;
case MENU_INLINE_EDIT:
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 3d3b15d5db..109dc77f0a 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -340,11 +340,11 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) break;
case 2: // restore saved
- if (GetValueA(NULL, MODULENAME, "LastModule", SelectedModule, _countof(SelectedModule))) {
- hSelectedContact = db_get_dw(NULL, MODULENAME, "LastContact", INVALID_CONTACT_ID);
+ if (GetValueA(0, MODULENAME, "LastModule", SelectedModule, _countof(SelectedModule))) {
+ hSelectedContact = g_plugin.getDword("LastContact", INVALID_CONTACT_ID);
if (hSelectedContact != INVALID_CONTACT_ID)
Select = 1;
- GetValueA(NULL, MODULENAME, "LastSetting", SelectedSetting, _countof(SelectedSetting));
+ GetValueA(0, MODULENAME, "LastSetting", SelectedSetting, _countof(SelectedSetting));
}
break;
@@ -403,7 +403,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) insertItem(hContact, module->name, contact);
}
- if (db_get_b(NULL, MODULENAME, "ExpandSettingsOnOpen", 0))
+ if (g_plugin.getByte("ExpandSettingsOnOpen", 0))
TreeView_Expand(hwnd2Tree, contact, TVE_EXPAND);
if (Select && hSelectedContact == NULL) {
@@ -711,7 +711,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case MENU_DELETE_CONTACT:
- if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
+ if (db_get_b(0, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index bcc4ea98fb..870f1d2ea0 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -6,12 +6,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_INITDIALOG:
bInitDone = false;
- CheckDlgButton(hwnd, IDC_EXPANDSETTINGS, db_get_b(NULL, MODULENAME, "ExpandSettingsOnOpen", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_RESTORESETTINGS, db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_WARNONDEL, db_get_b(NULL, MODULENAME, "WarnOnDelete", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_EXPANDSETTINGS, g_plugin.getByte("ExpandSettingsOnOpen", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_RESTORESETTINGS, g_plugin.getByte("RestoreOnOpen", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_WARNONDEL, g_plugin.getByte("WarnOnDelete", 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_POPUPS, g_bUsePopups ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, db_get_w(NULL, MODULENAME, "PopupDelay", 4), 0);
- SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(NULL, MODULENAME, "PopupColour", RGB(255, 0, 0)));
+ SetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, g_plugin.getWord("PopupDelay", 4), 0);
+ SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)g_plugin.getDword("PopupColour", RGB(255, 0, 0)));
TranslateDialogDefault(hwnd);
bInitDone = true;
return TRUE;
@@ -38,13 +38,13 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "ExpandSettingsOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_EXPANDSETTINGS));
- db_set_b(NULL, MODULENAME, "RestoreOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_RESTORESETTINGS));
- db_set_b(NULL, MODULENAME, "WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
+ g_plugin.setByte("ExpandSettingsOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_EXPANDSETTINGS));
+ g_plugin.setByte("RestoreOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_RESTORESETTINGS));
+ g_plugin.setByte("WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
g_bUsePopups = IsDlgButtonChecked(hwnd, IDC_POPUPS) != 0;
- db_set_b(NULL, MODULENAME, "UsePopUps", (BYTE)g_bUsePopups);
- db_set_w(NULL, MODULENAME, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
- db_set_dw(NULL, MODULENAME, "PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
+ g_plugin.setByte("UsePopUps", (BYTE)g_bUsePopups);
+ g_plugin.setWord("PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
+ g_plugin.setDword("PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
return TRUE;
}
break;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 488f881460..cb0359d930 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -43,7 +43,7 @@ static INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename));
if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
// null contact
- db_set_b(NULL, modulename, "(Default)", 0);
+ db_set_b(0, modulename, "(Default)", 0);
for (auto &hContact : Contacts())
db_set_b(hContact, modulename, "(Default)", 0);
}
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index ccb766e9ae..c1804603f6 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -127,7 +127,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s if (!count) return;
- if (db_get_b(NULL, MODULENAME, "WarnOnDelete", 1)) {
+ if (g_plugin.getByte("WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
mir_snwprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count);
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 787354cc95..d117298fc9 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -348,9 +348,9 @@ void openWatchedVarWindow() void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
{
- COLORREF colorBack = db_get_dw(NULL, MODULENAME, "PopupColour", RGB(255, 0, 0));
- COLORREF colorText = db_get_dw(NULL, MODULENAME, "PopupTextColour", RGB(0, 0, 0));
- int timeout = db_get_b(NULL, MODULENAME, "PopupDelay", 3);
+ COLORREF colorBack = g_plugin.getDword("PopupColour", RGB(255, 0, 0));
+ COLORREF colorText = g_plugin.getDword("PopupTextColour", RGB(0, 0, 0));
+ int timeout = g_plugin.getByte("PopupDelay", 3);
wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
GetContactName(hContact, nullptr, name, _countof(name));
|