summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP/src/options.cpp
blob: ad2892ff9e6e7c31efaa948682f9d35a486e6482 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "stdafx.h"

class COptionsDlg : public CDlgBase
{
	CCtrlCheck chkExpand, chkRestore, chkWarnDelete;

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);
	}
};

class CPopupOptionsDlg : public CDlgBase
{
	CCtrlEdit  edtTimeout;
	CCtrlCheck chkUsePopups;
	CCtrlColor clrBack, clrText;

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);
	}

	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.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;
}