diff options
author | George Hazan <ghazan@miranda.im> | 2021-01-06 12:43:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-01-06 12:44:00 +0300 |
commit | c8283bbae2f7a24c21c862f1769e8566b0b5144f (patch) | |
tree | c98d64626c740820c7416eb7a4a95301af0bb6e6 | |
parent | bdf7f9fabb34c6248a46cb08a3673fbf954026a7 (diff) |
CCtrlColor applied in dialogs when possible
-rw-r--r-- | plugins/Clist_nicer/src/clcopts.cpp | 29 | ||||
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 80 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 26 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_options.cpp | 27 |
4 files changed, 83 insertions, 79 deletions
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index f7ada77509..ded6e52933 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -224,18 +224,20 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
-static UINT avatar_controls[] = { IDC_ALIGNMENT, IDC_AVATARSBORDER, IDC_AVATARSROUNDED, IDC_AVATARBORDERCLR, IDC_ALWAYSALIGNNICK, IDC_AVATARHEIGHT, IDC_AVATARSIZESPIN, 0 };
+static UINT avatar_controls[] = { IDC_ALIGNMENT, IDC_AVATARSBORDER, IDC_AVATARSROUNDED, IDC_AVATARBORDERCLR, IDC_ALWAYSALIGNNICK, IDC_AVATARHEIGHT, IDC_AVATARSIZESPIN };
class CDspAdvancedDlg : public CRowItemsBaseDlg
{
CCtrlCheck chkLocalTime, chkAvaRound, chkAvaBorder;
+ CCtrlColor clrAvaBorder;
public:
CDspAdvancedDlg() :
CRowItemsBaseDlg(IDD_OPT_DSPADVANCED),
chkAvaRound(this, IDC_AVATARSROUNDED),
chkAvaBorder(this, IDC_AVATARSBORDER),
- chkLocalTime(this, IDC_SHOWLOCALTIME)
+ chkLocalTime(this, IDC_SHOWLOCALTIME),
+ clrAvaBorder(this, IDC_AVATARBORDERCLR)
{
chkAvaRound.OnChange = Callback(this, &CDspAdvancedDlg::onChange_AvatarsRounded);
chkAvaBorder.OnChange = Callback(this, &CDspAdvancedDlg::onChange_AvatarsBorder);
@@ -253,19 +255,10 @@ public: SendDlgItemMessage(m_hwnd, IDC_ALIGNMENT, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Far left"));
SendDlgItemMessage(m_hwnd, IDC_ALIGNMENT, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Far right"));
SendDlgItemMessage(m_hwnd, IDC_ALIGNMENT, CB_INSERTSTRING, -1, (LPARAM)TranslateT("With nickname - right"));
- {
- int i = 0;
- if (cfg::dat.bAvatarServiceAvail) {
- Utils::enableDlgControl(m_hwnd, IDC_CLISTAVATARS, TRUE);
- while (avatar_controls[i] != 0)
- Utils::enableDlgControl(m_hwnd, avatar_controls[i++], TRUE);
- }
- else {
- Utils::enableDlgControl(m_hwnd, IDC_CLISTAVATARS, FALSE);
- while (avatar_controls[i] != 0)
- Utils::enableDlgControl(m_hwnd, avatar_controls[i++], FALSE);
- }
- }
+
+ Utils::enableDlgControl(m_hwnd, IDC_CLISTAVATARS, cfg::dat.bAvatarServiceAvail);
+ for (auto &ctrlId : avatar_controls)
+ Utils::enableDlgControl(m_hwnd, ctrlId, cfg::dat.bAvatarServiceAvail);
CheckDlgButton(m_hwnd, IDC_NOAVATARSOFFLINE, cfg::dat.bNoOfflineAvatars ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(m_hwnd, IDC_DUALROWMODE, CB_SETCURSEL, cfg::dat.dualRowMode, 0);
@@ -276,7 +269,7 @@ public: CheckDlgButton(m_hwnd, IDC_ALWAYSALIGNNICK, (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_SHOWSTATUSMSG, (cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG) ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_AVATARBORDERCLR, CPM_SETCOLOUR, 0, cfg::dat.avatarBorder);
+ clrAvaBorder.SetColor(cfg::dat.avatarBorder);
SendDlgItemMessage(m_hwnd, IDC_RADIUSSPIN, UDM_SETRANGE, 0, MAKELONG(10, 2));
SendDlgItemMessage(m_hwnd, IDC_RADIUSSPIN, UDM_SETPOS, 0, cfg::dat.avatarRadius);
@@ -320,7 +313,7 @@ public: cfgSetFlag(m_hwnd, IDC_ALWAYSALIGNNICK, CLUI_FRAME_ALWAYSALIGNNICK);
cfgSetFlag(m_hwnd, IDC_SHOWSTATUSMSG, CLUI_FRAME_SHOWSTATUSMSG);
- cfg::dat.avatarBorder = SendDlgItemMessage(m_hwnd, IDC_AVATARBORDERCLR, CPM_GETCOLOUR, 0, 0);
+ cfg::dat.avatarBorder = clrAvaBorder.GetColor();
db_set_dw(0, "CLC", "avatarborder", cfg::dat.avatarBorder);
BOOL translated;
@@ -364,7 +357,7 @@ public: void onChange_AvatarsBorder(CCtrlCheck *)
{
- Utils::enableDlgControl(m_hwnd, IDC_AVATARBORDERCLR, chkAvaBorder.GetState());
+ clrAvaBorder.Enable(chkAvaBorder.GetState());
}
};
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 7b28288a9e..e97c92355a 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -490,10 +490,19 @@ class CPopupOptionsDlg : public CDlgBase {
CCtrlTreeView eventOptions;
CCtrlButton btnPreview, btnModes;
+ CCtrlColor mucBack, mucText, msgBack, msgText, otherBack, otherText, errBack, errText;
public:
CPopupOptionsDlg() :
CDlgBase(g_plugin, IDD_POPUP_OPT),
+ errBack(this, IDC_COLBACK_ERR),
+ errText(this, IDC_COLTEXT_ERR),
+ msgBack(this, IDC_COLBACK_MESSAGE),
+ msgText(this, IDC_COLTEXT_MESSAGE),
+ mucBack(this, IDC_COLBACK_MUC),
+ mucText(this, IDC_COLTEXT_MUC),
+ otherBack(this, IDC_COLBACK_OTHERS),
+ otherText(this, IDC_COLTEXT_OTHERS),
btnModes(this, IDC_POPUPSTATUSMODES),
btnPreview(this, IDC_PREVIEW),
eventOptions(this, IDC_EVENTOPTIONS)
@@ -506,18 +515,18 @@ public: {
TreeViewInit(eventOptions, lvGroupsNEN, lvItemsNEN, 0, 0, TRUE);
- SendDlgItemMessage(m_hwnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colBackMsg);
- SendDlgItemMessage(m_hwnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colTextMsg);
- SendDlgItemMessage(m_hwnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, nen_options.colBackOthers);
- SendDlgItemMessage(m_hwnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, nen_options.colTextOthers);
- SendDlgItemMessage(m_hwnd, IDC_COLBACK_ERR, CPM_SETCOLOUR, 0, nen_options.colBackErr);
- SendDlgItemMessage(m_hwnd, IDC_COLTEXT_ERR, CPM_SETCOLOUR, 0, nen_options.colTextErr);
+ msgBack.SetColor(nen_options.colBackMsg);
+ msgText.SetColor(nen_options.colTextMsg);
+ otherBack.SetColor(nen_options.colBackOthers);
+ otherText.SetColor(nen_options.colTextOthers);
+ errBack.SetColor(nen_options.colBackErr);
+ errText.SetColor(nen_options.colTextErr);
CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_MESSAGE, nen_options.bDefaultColorMsg ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_OTHERS, nen_options.bDefaultColorOthers ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_ERR, nen_options.bDefaultColorErr ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(m_hwnd, IDC_COLTEXT_MUC, CPM_SETCOLOUR, 0, g_Settings.crPUTextColour);
- SendDlgItemMessage(m_hwnd, IDC_COLBACK_MUC, CPM_SETCOLOUR, 0, g_Settings.crPUBkgColour);
+ mucText.SetColor(g_Settings.crPUTextColour);
+ mucBack.SetColor(g_Settings.crPUBkgColour);
CheckDlgButton(m_hwnd, IDC_CHKDEFAULTCOL_MUC, g_Settings.iPopupStyle == 2 ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_SPIN, UDM_SETRANGE, 0, MAKELONG(3600, -1));
@@ -530,14 +539,14 @@ public: SendDlgItemMessage(m_hwnd, IDC_DELAY_ERR_SPIN, UDM_SETPOS, 0, (LPARAM)nen_options.iDelayErr);
SendDlgItemMessage(m_hwnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_SETPOS, 0, (LPARAM)g_Settings.iPopupTimeout);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_MESSAGE, !nen_options.bDefaultColorMsg);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_MESSAGE, !nen_options.bDefaultColorMsg);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_OTHERS, !nen_options.bDefaultColorOthers);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_OTHERS, !nen_options.bDefaultColorOthers);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_ERR, !nen_options.bDefaultColorErr);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_ERR, !nen_options.bDefaultColorErr);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_MUC, g_Settings.iPopupStyle == 3);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_MUC, g_Settings.iPopupStyle == 3);
+ msgBack.Enable(!nen_options.bDefaultColorMsg);
+ msgText.Enable(!nen_options.bDefaultColorMsg);
+ otherBack.Enable(!nen_options.bDefaultColorOthers);
+ otherText.Enable(!nen_options.bDefaultColorOthers);
+ errBack.Enable(!nen_options.bDefaultColorErr);
+ errText.Enable(!nen_options.bDefaultColorErr);
+ mucText.Enable(g_Settings.iPopupStyle == 3);
+ mucBack.Enable(g_Settings.iPopupStyle == 3);
CheckDlgButton(m_hwnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle < 2 ? BST_CHECKED : BST_UNCHECKED);
Utils::enableDlgControl(m_hwnd, IDC_MUC_LOGCOLORS, g_Settings.iPopupStyle != 2);
@@ -558,11 +567,8 @@ public: db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)g_Settings.iPopupStyle);
db_set_w(0, CHAT_MODULE, "PopupTimeout", g_Settings.iPopupTimeout);
-
- g_Settings.crPUBkgColour = SendDlgItemMessage(m_hwnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
- db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)g_Settings.crPUBkgColour);
- g_Settings.crPUTextColour = SendDlgItemMessage(m_hwnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
- db_set_dw(0, CHAT_MODULE, "PopupColorText", (DWORD)g_Settings.crPUTextColour);
+ db_set_dw(0, CHAT_MODULE, "PopupColorBG", g_Settings.crPUBkgColour = mucBack.GetColor());
+ db_set_dw(0, CHAT_MODULE, "PopupColorText", g_Settings.crPUTextColour = mucText.GetColor());
NEN_WriteOptions(&nen_options);
CheckForRemoveMask();
@@ -614,14 +620,14 @@ public: nen_options.iLimitPreview = GetDlgItemInt(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, nullptr, FALSE);
else
nen_options.iLimitPreview = 0;
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_MESSAGE, !nen_options.bDefaultColorMsg);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_MESSAGE, !nen_options.bDefaultColorMsg);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_OTHERS, !nen_options.bDefaultColorOthers);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_OTHERS, !nen_options.bDefaultColorOthers);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_ERR, !nen_options.bDefaultColorErr);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_ERR, !nen_options.bDefaultColorErr);
- Utils::enableDlgControl(m_hwnd, IDC_COLTEXT_MUC, g_Settings.iPopupStyle == 3);
- Utils::enableDlgControl(m_hwnd, IDC_COLBACK_MUC, g_Settings.iPopupStyle == 3);
+ msgBack.Enable(!nen_options.bDefaultColorMsg);
+ msgText.Enable(!nen_options.bDefaultColorMsg);
+ otherBack.Enable(!nen_options.bDefaultColorOthers);
+ otherText.Enable(!nen_options.bDefaultColorOthers);
+ errBack.Enable(!nen_options.bDefaultColorErr);
+ errText.Enable(!nen_options.bDefaultColorErr);
+ mucText.Enable(g_Settings.iPopupStyle == 3);
+ mucBack.Enable(g_Settings.iPopupStyle == 3);
Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW) != 0);
Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMITSPIN, IsDlgButtonChecked(m_hwnd, IDC_LIMITPREVIEW) != 0);
@@ -632,14 +638,14 @@ public: Utils::enableDlgControl(m_hwnd, IDC_DELAY_ERR, nen_options.iDelayErr != -1);
Utils::enableDlgControl(m_hwnd, IDC_DELAY_MUC, g_Settings.iPopupTimeout != -1);
- nen_options.colBackMsg = SendDlgItemMessage(m_hwnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
- nen_options.colTextMsg = SendDlgItemMessage(m_hwnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
- nen_options.colBackOthers = SendDlgItemMessage(m_hwnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
- nen_options.colTextOthers = SendDlgItemMessage(m_hwnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
- nen_options.colBackErr = SendDlgItemMessage(m_hwnd, IDC_COLBACK_ERR, CPM_GETCOLOUR, 0, 0);
- nen_options.colTextErr = SendDlgItemMessage(m_hwnd, IDC_COLTEXT_ERR, CPM_GETCOLOUR, 0, 0);
- g_Settings.crPUBkgColour = SendDlgItemMessage(m_hwnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0);
- g_Settings.crPUTextColour = SendDlgItemMessage(m_hwnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0);
+ nen_options.colBackMsg = msgBack.GetColor();
+ nen_options.colTextMsg = msgText.GetColor();
+ nen_options.colBackOthers = otherBack.GetColor();
+ nen_options.colTextOthers = otherText.GetColor();
+ nen_options.colBackErr = errBack.GetColor();
+ nen_options.colTextErr = errText.GetColor();
+ g_Settings.crPUBkgColour = mucBack.GetColor();
+ g_Settings.crPUTextColour = mucText.GetColor();
}
};
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index c53759d8dc..7b09df4edc 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -556,6 +556,7 @@ class CTemplateEditDlg : public CMsgDialog TTemplateSet *tSet;
CCtrlEdit edtText;
+ CCtrlColor clr1, clr2, clr3, clr4, clr5;
CCtrlButton btnResetAll, btnSave, btnForget, btnRevert, btnPreview;
CCtrlListBox listTemplates;
CCtrlHyperlink urlHelp;
@@ -564,6 +565,11 @@ public: CTemplateEditDlg(BOOL _rtl, HWND hwndParent) :
CSuper(IDD_TEMPLATEEDIT, 0),
rtl(_rtl),
+ clr1(this, IDC_COLOR1),
+ clr2(this, IDC_COLOR2),
+ clr3(this, IDC_COLOR3),
+ clr4(this, IDC_COLOR4),
+ clr5(this, IDC_COLOR5),
edtText(this, IDC_EDITTEMPLATE),
urlHelp(this, IDC_VARIABLESHELP, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Templates"),
btnSave(this, IDC_SAVETEMPLATE),
@@ -621,11 +627,11 @@ public: Utils::enableDlgControl(m_hwndParent, IDC_MODIFY, FALSE);
Utils::enableDlgControl(m_hwndParent, IDC_RTLMODIFY, FALSE);
- SendDlgItemMessage(m_hwnd, IDC_COLOR1, CPM_SETCOLOUR, 0, M.GetDword("cc1", SRMSGDEFSET_BKGCOLOUR));
- SendDlgItemMessage(m_hwnd, IDC_COLOR2, CPM_SETCOLOUR, 0, M.GetDword("cc2", SRMSGDEFSET_BKGCOLOUR));
- SendDlgItemMessage(m_hwnd, IDC_COLOR3, CPM_SETCOLOUR, 0, M.GetDword("cc3", SRMSGDEFSET_BKGCOLOUR));
- SendDlgItemMessage(m_hwnd, IDC_COLOR4, CPM_SETCOLOUR, 0, M.GetDword("cc4", SRMSGDEFSET_BKGCOLOUR));
- SendDlgItemMessage(m_hwnd, IDC_COLOR5, CPM_SETCOLOUR, 0, M.GetDword("cc5", SRMSGDEFSET_BKGCOLOUR));
+ clr1.SetColor(M.GetDword("cc1", SRMSGDEFSET_BKGCOLOUR));
+ clr1.SetColor(M.GetDword("cc2", SRMSGDEFSET_BKGCOLOUR));
+ clr1.SetColor(M.GetDword("cc3", SRMSGDEFSET_BKGCOLOUR));
+ clr1.SetColor(M.GetDword("cc4", SRMSGDEFSET_BKGCOLOUR));
+ clr1.SetColor(M.GetDword("cc5", SRMSGDEFSET_BKGCOLOUR));
edtText.SendMsg(EM_SETREADONLY, TRUE, 0);
return true;
}
@@ -640,11 +646,11 @@ public: delete m_pContainer;
delete m_cache;
- db_set_dw(0, SRMSGMOD_T, "cc1", SendDlgItemMessage(m_hwnd, IDC_COLOR1, CPM_GETCOLOUR, 0, 0));
- db_set_dw(0, SRMSGMOD_T, "cc2", SendDlgItemMessage(m_hwnd, IDC_COLOR2, CPM_GETCOLOUR, 0, 0));
- db_set_dw(0, SRMSGMOD_T, "cc3", SendDlgItemMessage(m_hwnd, IDC_COLOR3, CPM_GETCOLOUR, 0, 0));
- db_set_dw(0, SRMSGMOD_T, "cc4", SendDlgItemMessage(m_hwnd, IDC_COLOR4, CPM_GETCOLOUR, 0, 0));
- db_set_dw(0, SRMSGMOD_T, "cc5", SendDlgItemMessage(m_hwnd, IDC_COLOR5, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(0, SRMSGMOD_T, "cc1", clr1.GetColor());
+ db_set_dw(0, SRMSGMOD_T, "cc2", clr2.GetColor());
+ db_set_dw(0, SRMSGMOD_T, "cc3", clr3.GetColor());
+ db_set_dw(0, SRMSGMOD_T, "cc4", clr4.GetColor());
+ db_set_dw(0, SRMSGMOD_T, "cc5", clr5.GetColor());
}
INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index cd3f03b3b3..a089c3d70f 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -491,10 +491,13 @@ public: class COptPopupDlg : public CDlgBase { CCtrlCheck chkRadio1, chkRadio2, chkRadio3; + CCtrlColor clrBack, clrText; public: - COptPopupDlg() - : CDlgBase(g_plugin, IDD_OPTIONSPOPUP), + COptPopupDlg() : + CDlgBase(g_plugin, IDD_OPTIONSPOPUP), + clrBack(this, IDC_BKG), + clrText(this, IDC_TEXT), chkRadio1(this, IDC_RADIO1), chkRadio2(this, IDC_RADIO2), chkRadio3(this, IDC_RADIO3) @@ -504,8 +507,8 @@ public: bool OnInitDialog() override { - SendDlgItemMessage(m_hwnd, IDC_BKG, CPM_SETCOLOUR, 0, g_Settings.crPUBkgColour); - SendDlgItemMessage(m_hwnd, IDC_TEXT, CPM_SETCOLOUR, 0, g_Settings.crPUTextColour); + clrBack.SetColor(g_Settings.crPUBkgColour); + clrText.SetColor(g_Settings.crPUTextColour); if (g_Settings.iPopupStyle == 2) CheckDlgButton(m_hwnd, IDC_RADIO2, BST_CHECKED); @@ -513,9 +516,7 @@ public: CheckDlgButton(m_hwnd, IDC_RADIO3, BST_CHECKED); else CheckDlgButton(m_hwnd, IDC_RADIO1, BST_CHECKED); - - EnableWindow(GetDlgItem(m_hwnd, IDC_BKG), IsDlgButtonChecked(m_hwnd, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE); - EnableWindow(GetDlgItem(m_hwnd, IDC_TEXT), IsDlgButtonChecked(m_hwnd, IDC_RADIO3) == BST_CHECKED ? TRUE : FALSE); + onChange_Radio(0); SendDlgItemMessage(m_hwnd, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(100, -1)); SendDlgItemMessage(m_hwnd, IDC_SPIN1, UDM_SETPOS, 0, MAKELONG(g_Settings.iPopupTimeout, 0)); @@ -538,18 +539,16 @@ public: g_Settings.iPopupTimeout = iLen; db_set_w(0, CHAT_MODULE, "PopupTimeout", (WORD)iLen); - g_Settings.crPUBkgColour = SendDlgItemMessage(m_hwnd, IDC_BKG, CPM_GETCOLOUR, 0, 0); - db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(m_hwnd, IDC_BKG, CPM_GETCOLOUR, 0, 0)); - g_Settings.crPUTextColour = SendDlgItemMessage(m_hwnd, IDC_TEXT, CPM_GETCOLOUR, 0, 0); - db_set_dw(0, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(m_hwnd, IDC_TEXT, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, CHAT_MODULE, "PopupColorBG", g_Settings.crPUBkgColour = clrBack.GetColor()); + db_set_dw(0, CHAT_MODULE, "PopupColorText", g_Settings.crPUTextColour = clrText.GetColor()); return true; } void onChange_Radio(CCtrlCheck*) { - BOOL bStatus = chkRadio3.GetState() != 0; - EnableWindow(GetDlgItem(m_hwnd, IDC_BKG), bStatus); - EnableWindow(GetDlgItem(m_hwnd, IDC_TEXT), bStatus); + bool bStatus = chkRadio3.GetState(); + clrBack.Enable(bStatus); + clrText.Enable(bStatus); } }; |