summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-01-05 23:57:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-01-05 23:57:32 +0300
commitb39f8c6ab6b8d83b190571ba2065615494b34c47 (patch)
treeab007999267b9c4a8c5c9efef6e40eb8eb43f0d0 /plugins
parent4350ca752a3a0fc9c5da36570c3eb1a995cccf94 (diff)
fixes #2658 (Вынести настройку цвета попапов редактора базы в отдельные настройки) + цвет текста + чистка кода
Diffstat (limited to 'plugins')
-rw-r--r--plugins/DbEditorPP/res/resource.rc70
-rw-r--r--plugins/DbEditorPP/src/deletemodule.cpp2
-rw-r--r--plugins/DbEditorPP/src/main.cpp11
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp12
-rw-r--r--plugins/DbEditorPP/src/moduletree.cpp2
-rw-r--r--plugins/DbEditorPP/src/options.cpp103
-rw-r--r--plugins/DbEditorPP/src/resource.h6
-rw-r--r--plugins/DbEditorPP/src/settinglist.cpp2
-rw-r--r--plugins/DbEditorPP/src/stdafx.h66
-rw-r--r--plugins/DbEditorPP/src/version.h2
-rw-r--r--plugins/DbEditorPP/src/watchedvars.cpp25
11 files changed, 175 insertions, 126 deletions
diff --git a/plugins/DbEditorPP/res/resource.rc b/plugins/DbEditorPP/res/resource.rc
index a3540a4644..2a5154b7f8 100644
--- a/plugins/DbEditorPP/res/resource.rc
+++ b/plugins/DbEditorPP/res/resource.rc
@@ -56,12 +56,21 @@ BEGIN
CONTROL "Automatically expand ""Settings"" when Database Editor++ starts",IDC_EXPANDSETTINGS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,26,283,10
CONTROL "Warn when deleting modules",IDC_WARNONDEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,39,280,10
+END
+
+IDD_POPUP_OPTS DIALOGEX 0, 0, 314, 71
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
CONTROL "Use popups when watched settings change values",IDC_POPUPS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,57,275,10
- EDITTEXT IDC_POPUPTIMEOUT,144,68,20,12,ES_NUMBER
- CONTROL "",IDC_COLOUR,"ColourPicker",WS_TABSTOP,257,68,26,12
- RTEXT "Popup timeout (0 for infinite)",IDC_STATIC,35,70,103,8
- RTEXT "Background color",IDC_STATIC,177,70,77,8
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,11,275,10
+ EDITTEXT IDC_POPUPTIMEOUT,144,24,26,12,ES_NUMBER
+ CONTROL "",IDC_COLOUR,"ColourPicker",WS_TABSTOP,144,38,26,12
+ LTEXT "Popup timeout (0 for infinite)",IDC_STATIC,35,26,103,8
+ LTEXT "Background color",IDC_STATIC,35,40,103,8
+ CONTROL "",IDC_TXT_COLOUR,"ColourPicker",WS_TABSTOP,144,53,26,12
+ LTEXT "Text color",IDC_STATIC,35,55,103,8
END
IDD_ADD_MODULE DIALOGEX 0, 0, 186, 67
@@ -181,6 +190,10 @@ BEGIN
HORZGUIDE, 68
END
+ IDD_POPUP_OPTS, DIALOG
+ BEGIN
+ END
+
IDD_ADD_MODULE, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -245,23 +258,40 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
ICO_REGEDIT ICON "regedit.ico"
+
ICO_CLOSED ICON "closed.ico"
+
ICO_OPENED ICON "opened.ico"
+
ICO_SETTINGS ICON "settings.ico"
+
ICO_ONLINE ICON "online.ico"
+
ICO_DBE_BUTT ICON "dbepp.ico"
+
ICO_REGUSER ICON "usermenu.ico"
+
ICO_STRING ICON "string.ico"
+
ICO_CONTACTS ICON "contacts.ico"
+
ICO_BINARY ICON "binary.ico"
+
ICO_DWORD ICON "dword.ico"
+
ICO_BYTE ICON "byte.ico"
+
ICO_WORD ICON "word.ico"
+
ICO_OFFLINE ICON "offline.ico"
+
ICO_UNICODE ICON "unicode.ico"
+
ICO_HANDLE ICON "handle.ico"
+
ICO_EMPTY ICON "empty.ico"
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@@ -306,7 +336,7 @@ BEGIN
BEGIN
MENUITEM "&Search and replace", MENU_FINDANDREPLACE
MENUITEM SEPARATOR
- MENUITEM "Delete &resident settings", MENU_FIX_RESIDENT
+ MENUITEM "Delete &resident settings", MENU_FIX_RESIDENT
MENUITEM SEPARATOR
MENUITEM "&Delete module", MENU_DELETE
END
@@ -350,7 +380,7 @@ BEGIN
POPUP "Item context"
BEGIN
MENUITEM "&Edit", MENU_EDIT_SET
- MENUITEM "&Copy", MENU_COPY_SET
+ MENUITEM "&Copy", MENU_COPY_SET
MENUITEM "&Delete", MENU_DELETE_SET
POPUP "Convert to"
BEGIN
@@ -372,8 +402,7 @@ BEGIN
END
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
- MENUITEM "&Refresh", MENU_REFRESH
-
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "Null Mod context"
BEGIN
@@ -384,7 +413,7 @@ BEGIN
MENUITEM "Export module", MENU_EXPORTMODULE
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "Contact menu"
BEGIN
@@ -399,7 +428,7 @@ BEGIN
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
END
MENUITEM SEPARATOR
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "NULL contact menu"
BEGIN
@@ -412,7 +441,7 @@ BEGIN
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
END
MENUITEM SEPARATOR
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "Contacts menu"
BEGIN
@@ -423,7 +452,7 @@ BEGIN
MENUITEM "From pasted text", MENU_IMPORTFROMTEXT
END
MENUITEM SEPARATOR
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "Contact Mod context"
BEGIN
@@ -435,7 +464,7 @@ BEGIN
MENUITEM "Export module from all contacts", MENU_EXPORTDB
MENUITEM SEPARATOR
MENUITEM "&Watch", MENU_WATCH_ITEM
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
POPUP "new item"
BEGIN
@@ -449,7 +478,7 @@ BEGIN
MENUITEM "BL&OB", MENU_ADD_BLOB
END
MENUITEM SEPARATOR
- MENUITEM "&Refresh", MENU_REFRESH
+ MENUITEM "&Refresh", MENU_REFRESH
END
END
@@ -464,6 +493,17 @@ BEGIN
END
END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_POPUP_OPTS AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp
index fadb491816..7c0eea7c2f 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 && g_plugin.getByte("WarnOnDelete", 1)) {
+ if (confirm && g_plugin.bWarnOnDelete) {
wchar_t text[MSG_SIZE];
mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module).get());
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp
index 564ed97d0f..d954cf1b89 100644
--- a/plugins/DbEditorPP/src/main.cpp
+++ b/plugins/DbEditorPP/src/main.cpp
@@ -33,8 +33,15 @@ PLUGININFOEX pluginInfoEx =
};
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ iPopupDelay(MODULENAME, "PopupDelay", 4),
+ iPopupBkColor(MODULENAME, "PopupColour", RGB(255, 0, 0)),
+ iPopupTxtColor(MODULENAME, "PopupTextColour", RGB(0, 0, 0)),
+ bWarnOnDelete(MODULENAME, "WarnOnDelete", true),
+ bRestoreOnOpen(MODULENAME, "RestoreOnOpen", true),
+ bExpandSettingsOnOpen(MODULENAME, "ExpandSettingsOnOpen", false)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
// we implement service mode interface
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 1f81ee24a8..680851e7ac 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -247,7 +247,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
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 | (g_plugin.getByte("RestoreOnOpen", 1) ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (g_plugin.bRestoreOnOpen ? MF_CHECKED : MF_UNCHECKED));
g_Order = g_plugin.getByte("SortMode", 1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SORT_ORDER, MF_BYCOMMAND | (g_Order ? MF_CHECKED : MF_UNCHECKED));
@@ -255,7 +255,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int restore;
if (hRestore)
restore = 3;
- else if (g_plugin.getByte("RestoreOnOpen", 1))
+ else if (g_plugin.bRestoreOnOpen)
restore = 2;
else
restore = 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 (g_plugin.getByte("RestoreOnOpen", 1)) {
+ if (g_plugin.bRestoreOnOpen) {
HTREEITEM item;
if (item = TreeView_GetSelection(hwnd2Tree)) {
@@ -491,9 +491,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case MENU_SAVE_POSITION:
{
- BOOL save = !g_plugin.getByte("RestoreOnOpen", 1);
- CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (save ? MF_CHECKED : MF_UNCHECKED));
- g_plugin.setByte("RestoreOnOpen", (byte)save);
+ bool bSave = !g_plugin.bRestoreOnOpen;
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (bSave ? MF_CHECKED : MF_UNCHECKED));
+ g_plugin.bRestoreOnOpen = bSave;
}
break;
case MENU_INLINE_EDIT:
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp
index f5048a6567..1bfc5ff05e 100644
--- a/plugins/DbEditorPP/src/moduletree.cpp
+++ b/plugins/DbEditorPP/src/moduletree.cpp
@@ -403,7 +403,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param)
insertItem(hContact, module->name, contact);
}
- if (g_plugin.getByte("ExpandSettingsOnOpen", 0))
+ if (g_plugin.bExpandSettingsOnOpen)
TreeView_Expand(hwnd2Tree, contact, TVE_EXPAND);
if (Select && hSelectedContact == NULL) {
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp
index 870f1d2ea0..ad2892ff9e 100644
--- a/plugins/DbEditorPP/src/options.cpp
+++ b/plugins/DbEditorPP/src/options.cpp
@@ -1,67 +1,66 @@
#include "stdafx.h"
-static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+class COptionsDlg : public CDlgBase
{
- static bool bInitDone = true;
- switch (msg) {
- case WM_INITDIALOG:
- bInitDone = false;
- 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, 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;
+ CCtrlCheck chkExpand, chkRestore, chkWarnDelete;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_RESTORESETTINGS:
- case IDC_EXPANDSETTINGS:
- case IDC_POPUPS:
- case IDC_WARNONDEL:
- case IDC_COLOUR:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
+public:
+ COptionsDlg() :
+ CDlgBase(g_plugin, IDD_OPTIONS),
+ chkExpand(this, IDC_EXPANDSETTINGS),
+ chkRestore(this, IDC_RESTORESETTINGS),
+ chkWarnDelete(this, IDC_WARNONDEL)
+ {
+ CreateLink(chkExpand, g_plugin.bExpandSettingsOnOpen);
+ CreateLink(chkRestore, g_plugin.bRestoreOnOpen);
+ CreateLink(chkWarnDelete, g_plugin.bWarnOnDelete);
+ }
+};
- case IDC_POPUPTIMEOUT:
- if (bInitDone && (HIWORD(wParam) == EN_CHANGE))
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- }
- break;
+class CPopupOptionsDlg : public CDlgBase
+{
+ CCtrlEdit edtTimeout;
+ CCtrlCheck chkUsePopups;
+ CCtrlColor clrBack, clrText;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- 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;
- 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;
- }
- break;
+public:
+ CPopupOptionsDlg() :
+ CDlgBase(g_plugin, IDD_POPUP_OPTS),
+ clrBack(this, IDC_COLOUR),
+ clrText(this, IDC_TXT_COLOUR),
+ edtTimeout(this, IDC_POPUPTIMEOUT),
+ chkUsePopups(this, IDC_POPUPS)
+ {
+ CreateLink(clrBack, g_plugin.iPopupBkColor);
+ CreateLink(clrText, g_plugin.iPopupTxtColor);
+ CreateLink(edtTimeout, g_plugin.iPopupDelay);
}
- return FALSE;
-}
+
+ bool OnInitDialog() override
+ {
+ chkUsePopups.SetState(g_bUsePopups);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ g_plugin.setByte("UsePopUps", g_bUsePopups = chkUsePopups.GetState());
+ return true;
+ }
+};
INT OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.szGroup.a = LPGEN("Database");
- odp.szTitle.a = modFullname;
- odp.pfnDlgProc = DlgProcOpts;
odp.flags = ODPF_BOLDGROUPS;
+ odp.szTitle.a = modFullname;
+
+ odp.szGroup.a = LPGEN("Database");
+ odp.pDialog = new COptionsDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szGroup.a = LPGEN("Popups");
+ odp.pDialog = new CPopupOptionsDlg();
g_plugin.addOptions(wParam, &odp);
return 0;
}
diff --git a/plugins/DbEditorPP/src/resource.h b/plugins/DbEditorPP/src/resource.h
index f8e379b8c5..cd785d9e54 100644
--- a/plugins/DbEditorPP/src/resource.h
+++ b/plugins/DbEditorPP/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by E:\Miranda\NG\plugins\DbeditorPP\res\resource.rc
+// Used by w:\miranda-ng\plugins\DbEditorPP\res\resource.rc
//
#define ICO_REGEDIT 1
#define ICO_UNICODE 2
@@ -28,6 +28,7 @@
#define IDD_CHANGE_ARRAYSIZE 120
#define IDD_FIND 121
#define IDD_OPTIONS 122
+#define IDD_POPUP_OPTS 123
#define ICO_CLOSED 124
#define ICO_OPENED 125
#define ICO_SETTINGS 128
@@ -76,6 +77,7 @@
#define IDC_POPUPTIMEOUT 1049
#define IDC_COLOUR 1050
#define IDC_RESTORESETTINGS 1051
+#define IDC_TXT_COLOUR 1051
#define IDC_BLOB 1052
#define IDC_FOUND 1056
#define IDC_SBAR 1057
@@ -145,7 +147,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 131
+#define _APS_NEXT_RESOURCE_VALUE 132
#define _APS_NEXT_COMMAND_VALUE 40065
#define _APS_NEXT_CONTROL_VALUE 1059
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp
index e60e15f2d5..96264fd906 100644
--- a/plugins/DbEditorPP/src/settinglist.cpp
+++ b/plugins/DbEditorPP/src/settinglist.cpp
@@ -124,7 +124,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s
if (!count)
return;
- if (g_plugin.getByte("WarnOnDelete", 1)) {
+ if (g_plugin.bWarnOnDelete) {
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/stdafx.h b/plugins/DbEditorPP/src/stdafx.h
index 56f5fc0c08..048e49168f 100644
--- a/plugins/DbEditorPP/src/stdafx.h
+++ b/plugins/DbEditorPP/src/stdafx.h
@@ -17,37 +17,41 @@
#include <malloc.h>
#include <newpluginapi.h>
-#include <m_utils.h>
#include <m_clist.h>
-#include <m_skin.h>
-#include <m_langpack.h>
#include <m_database.h>
#include <m_db_int.h>
-#include <m_system.h>
+#include <m_gui.h>
+#include <m_hotkeys.h>
+#include <m_icolib.h>
+#include <m_langpack.h>
+#include <m_metacontacts.h>
#include <m_netlib.h>
-#include <m_protocols.h>
-#include <m_userinfo.h>
#include <m_options.h>
-#include <m_protosvc.h>
#include <m_popup.h>
-#include <m_icolib.h>
-#include <m_hotkeys.h>
-#include <m_metacontacts.h>
+#include <m_protocols.h>
+#include <m_protosvc.h>
+#include <m_skin.h>
+#include <m_userinfo.h>
+#include <m_utils.h>
#include "m_toptoolbar.h"
#include "resource.h"
#include "version.h"
-
//=======================================================
// Definitions
//=======================================================
+
#define MODULENAME "DBEditorpp"
#define modFullname "Database Editor++"
struct CMPlugin : public PLUGIN<CMPlugin>
{
+ CMOption<bool> bExpandSettingsOnOpen, bRestoreOnOpen, bWarnOnDelete;
+ CMOption<WORD> iPopupDelay;
+ CMOption<DWORD> iPopupBkColor, iPopupTxtColor;
+
CMPlugin();
int Load() override;
@@ -63,7 +67,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
#define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0
-
/***********************
ModuleTreeInfoStruct
this gets dumped as the lparam for each module tree item
@@ -76,14 +79,14 @@ struct CMPlugin : public PLUGIN<CMPlugin>
#define STUB 4
#define EMPTY 8
-
-struct ModuleTreeInfoStruct {
+struct ModuleTreeInfoStruct
+{
int type; // from above types
MCONTACT hContact;
};
-
-struct SettingListInfo {
+struct SettingListInfo
+{
MCONTACT hContact;
int selectedItem; // item that is currently selected
char module[FLD_SIZE];
@@ -93,35 +96,37 @@ struct SettingListInfo {
int subitem;
};
-
-struct DBsetting {
+struct DBsetting
+{
MCONTACT hContact;
char *module;
char *setting;
DBVARIANT dbv;
};
-
-typedef struct {
+struct ModuleAndContact
+{
char module[FLD_SIZE];
MCONTACT hContact;
-} ModuleAndContact;
+};
// find window
#define FW_MODULE 0
#define FW_SETTINGNAME 1
#define FW_SETTINGVALUE 2
-typedef struct {
+struct ItemInfo
+{
int type; // above types
MCONTACT hContact;
char module[FLD_SIZE];
char setting[FLD_SIZE];
-} ItemInfo;
+};
// watchwindow
-struct WatchListArrayStruct {
- struct DBsetting *item; // gotta malloc this
+struct WatchListArrayStruct
+{
+ DBsetting *item; // gotta malloc this
int count;
int size;
};
@@ -139,21 +144,23 @@ struct ModuleSettingLL
ModSetLinkLinkItem *last;
};
-struct ColumnsSettings {
+struct ColumnsSettings
+{
wchar_t *name;
int index;
char *dbname;
int defsize;
};
-struct ColumnsSortParams {
+struct ColumnsSortParams
+{
HWND hList;
int column;
int last;
};
-
-enum ICONS {
+enum ICONS
+{
IMAGE_EMPTY,
IMAGE_BINARY,
IMAGE_BYTE,
@@ -170,7 +177,6 @@ enum ICONS {
IMAGE_OFFLINE
};
-
//=======================================================
// Variables
//=======================================================
diff --git a/plugins/DbEditorPP/src/version.h b/plugins/DbEditorPP/src/version.h
index 837746b063..94ec411e83 100644
--- a/plugins/DbEditorPP/src/version.h
+++ b/plugins/DbEditorPP/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 4
#define __MINOR_VERSION 0
#define __RELEASE_NUM 1
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp
index cc4e945452..47270f09c6 100644
--- a/plugins/DbEditorPP/src/watchedvars.cpp
+++ b/plugins/DbEditorPP/src/watchedvars.cpp
@@ -342,25 +342,20 @@ void openWatchedVarWindow()
void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
{
- 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));
-
- // 2nd line
+ int timeout = g_plugin.iPopupDelay;
+
+ wchar_t value[MAX_SECONDLINE];
int type = GetValue(hContact, module, setting, value, _countof(value));
- mir_snwprintf(text, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""),
- _A2T(module).get(), _A2T(setting).get(), DBVType(type), value);
POPUPDATAW ppd;
- ppd.lchContact = (MCONTACT)hContact;
+ GetContactName(hContact, nullptr, ppd.lpwzContactName, _countof(ppd.lpwzContactName));
+ mir_snwprintf(ppd.lpwzText, TranslateT("Database Setting Changed: \nModule: \"%s\", Setting: \"%s\"\nNew Value (%s): \"%s\""),
+ _A2T(module).get(), _A2T(setting).get(), DBVType(type), value);
+
+ ppd.lchContact = hContact;
ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(ICO_REGEDIT));
- mir_wstrncpy(ppd.lpwzContactName, name, _countof(ppd.lpwzContactName));
- mir_wstrncpy(ppd.lpwzText, text, _countof(ppd.lpwzText));
- ppd.colorBack = colorBack;
- ppd.colorText = colorText;
+ ppd.colorBack = g_plugin.iPopupBkColor;
+ ppd.colorText = g_plugin.iPopupTxtColor;
ppd.iSeconds = timeout ? timeout : -1;
PUAddPopupW(&ppd);
}