diff options
author | Kirill Volinsky <Mataes2007@gmail.com> | 2018-12-28 14:39:15 +0300 |
---|---|---|
committer | Kirill Volinsky <Mataes2007@gmail.com> | 2018-12-28 14:39:15 +0300 |
commit | 6e0d3b81517f36725d2edbffcadd3e5e1ad92438 (patch) | |
tree | 9053fb91794f6f429894060012339ea5ab8cbf51 /plugins/MyDetails/src/options.cpp | |
parent | a63e68f4047e60f85597ce052c23563228c1af78 (diff) |
CrashDumper: cleanup
MyDetails: moved to m_gui
Diffstat (limited to 'plugins/MyDetails/src/options.cpp')
-rw-r--r-- | plugins/MyDetails/src/options.cpp | 195 |
1 files changed, 124 insertions, 71 deletions
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index f4d123bbc9..0ddc30a187 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -70,101 +70,154 @@ void LoadOptions() RefreshFrameAndCalcRects();
}
-static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+class COptDialog : public CDlgBase
{
- BOOL ret = SaveOptsDlgProc(pageControls, _countof(pageControls), MODULENAME, hwndDlg, msg, wParam, lParam);
+ CCtrlCheck m_chkTextRTL, m_chkTextAlignRight, m_chkResizeFrame, m_chkUseCLSmilies, m_chkReplaceSmilies, m_chkResizeSmilies, m_chkGlobalAvatar, m_chkGlobalNickname, m_chkGlobalStatus,
+ m_chkGlobalStatusMessage, m_chkShowProtoName, m_chkShowCycleProtoBtn, m_chkCycleProtos, m_chkAvatarCustomSize, m_chkAvatarGrow, m_chkAvatarBorder, m_chkAvatarRound, m_chkAvatarCustomCorn,
+ m_chkAvatarFreeSpace;
+ CCtrlEdit m_edtCycleTime, m_edtAvatarCustomSize, m_edtAvatarCustomCorn, m_edtBorderTop, m_edtBorderBottom, m_edtBorderLeft, m_edtBorderRight;
+ CCtrlSpin m_spnCycleTime, m_spnAvatarCustomSize, m_spnAvatarCustomCorn, m_spnBorderTop, m_spnBorderBottom, m_spnBorderLeft, m_spnBorderRight;
+public:
+ COptDialog() :
+ CDlgBase(g_plugin, IDD_OPTS),
+ m_chkTextRTL(this, IDC_TEXT_RTL),
+ m_chkTextAlignRight(this, IDC_TEXT_ALIGN_RIGHT),
+ m_chkResizeFrame(this, IDC_RESIZE_FRAME),
+ m_chkUseCLSmilies(this, IDC_USE_CONTACT_LIST_SMILEYS),
+ m_chkReplaceSmilies(this, IDC_REPLACE_SMILEYS),
+ m_chkResizeSmilies(this, IDC_RESIZE_SMILEYS),
+ m_chkGlobalAvatar(this, IDC_GLOBAL_ON_AVATAR),
+ m_chkGlobalNickname(this, IDC_GLOBAL_ON_NICKNAME),
+ m_chkGlobalStatus(this, IDC_GLOBAL_ON_STATUS),
+ m_chkGlobalStatusMessage(this, IDC_GLOBAL_ON_STATUS_MESSAGE),
+ m_chkShowProtoName(this, IDC_SHOW_PROTO_NAME),
+ m_chkShowCycleProtoBtn(this, IDC_SHOW_CYCLE_PROTO_BUTTON),
+ m_chkCycleProtos(this, IDC_CYCLE_THROUGH_PROTOS),
+ m_edtCycleTime(this, IDC_CYCLE_TIME),
+ m_spnCycleTime(this, IDC_CYCLE_TIME_SPIN),
+ m_chkAvatarCustomSize(this, IDC_AVATAR_CUSTOM_SIZE_CHK),
+ m_edtAvatarCustomSize(this, IDC_AVATAR_CUSTOM_SIZE),
+ m_spnAvatarCustomSize(this, IDC_AVATAR_CUSTOM_SIZE_SPIN),
+ m_chkAvatarGrow(this, IDC_AVATAR_ALLOW_TO_GROW),
+ m_chkAvatarBorder(this, IDC_AVATAR_DRAW_BORDER),
+ m_chkAvatarRound(this, IDC_AVATAR_ROUND_CORNERS),
+ m_chkAvatarCustomCorn(this, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK),
+ m_edtAvatarCustomCorn(this, IDC_AVATAR_CUSTOM_CORNER_SIZE),
+ m_spnAvatarCustomCorn(this, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),
+ m_chkAvatarFreeSpace(this, IDC_AVATAR_USE_FREE_SPACE),
+ m_edtBorderTop(this, IDC_BORDER_TOP),
+ m_spnBorderTop(this, IDC_BORDER_TOP_SPIN),
+ m_edtBorderBottom(this, IDC_BORDER_BOTTOM),
+ m_spnBorderBottom(this, IDC_BORDER_BOTTOM_SPIN),
+ m_edtBorderLeft(this, IDC_BORDER_LEFT),
+ m_spnBorderLeft(this, IDC_BORDER_LEFT_SPIN),
+ m_edtBorderRight(this, IDC_BORDER_RIGHT),
+ m_spnBorderRight(this, IDC_BORDER_RIGHT_SPIN)
+ {
+ m_chkAvatarRound.OnChange = Callback(this, &COptDialog::OnAvatarRoundChange);
+ m_chkAvatarCustomCorn.OnChange = Callback(this, &COptDialog::OnAvatarCustomCornChange);
+ m_chkShowProtoName.OnChange = Callback(this, &COptDialog::OnShowProtoNameChange);
+ m_chkAvatarCustomSize.OnChange = Callback(this, &COptDialog::OnAvatarCustomSizeChange);
+ m_chkCycleProtos.OnChange = Callback(this, &COptDialog::OnCycleProtosChange);
+ m_chkReplaceSmilies.OnChange = Callback(this, &COptDialog::OnReplaceSmiliesChange);
+ }
- switch (msg) {
- case WM_INITDIALOG:
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK), FALSE);
- }
+ bool OnInitDialog() override
+ {
+ if (!m_chkAvatarRound.IsChecked())
+ m_chkAvatarCustomCorn.Disable();
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS) || BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN), FALSE);
+ if (!m_chkAvatarRound.IsChecked() || !m_chkAvatarCustomCorn.IsChecked()) {
+ m_edtAvatarCustomCorn.Disable();
+ m_spnAvatarCustomCorn.Disable();
}
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOW_PROTO_NAME))
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_CYCLE_PROTO_BUTTON), FALSE);
+ if (!m_chkShowProtoName.IsChecked())
+ m_chkShowCycleProtoBtn.Disable();
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_CHK)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_SPIN), FALSE);
+ if (!m_chkAvatarCustomSize.IsChecked()) {
+ m_edtAvatarCustomSize.Disable();
+ m_spnAvatarCustomSize.Disable();
}
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_CYCLE_THROUGH_PROTOS)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME_SPIN), FALSE);
+ if (!m_chkCycleProtos.IsChecked()) {
+ m_edtCycleTime.Disable();
+ m_spnCycleTime.Disable();
}
- if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), FALSE);
+ if (!m_chkReplaceSmilies.IsChecked()) {
+ m_chkUseCLSmilies.Disable();
+ m_chkResizeSmilies.Disable();
}
if (!ServiceExists(MS_SMILEYADD_BATCHPARSE)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_REPLACE_SMILEYS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), FALSE);
+ m_chkReplaceSmilies.Disable();
+ m_chkUseCLSmilies.Disable();
+ m_chkResizeSmilies.Disable();
}
if (!ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS))
- EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_FRAME), FALSE);
+ m_chkResizeFrame.Disable();
- break;
+ return true;
+ }
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_AVATAR_ROUND_CORNERS || LOWORD(wParam) == IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK), enabled);
- enabled = enabled && IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN), enabled);
- }
- else if (LOWORD(wParam) == IDC_SHOW_PROTO_NAME) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SHOW_PROTO_NAME);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_CYCLE_PROTO_BUTTON), enabled);
- }
- else if (LOWORD(wParam) == IDC_AVATAR_CUSTOM_SIZE_CHK) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_CHK);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_SPIN), enabled);
- }
- else if (LOWORD(wParam) == IDC_CYCLE_THROUGH_PROTOS) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_CYCLE_THROUGH_PROTOS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME_SPIN), enabled);
- }
- else if (LOWORD(wParam) == IDC_REPLACE_SMILEYS) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), enabled);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), enabled);
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- LoadOptions();
- return TRUE;
- }
- break;
- }
- break;
+ bool OnApply() override
+ {
+ LoadOptions();
+ return true;
}
- return ret;
-}
+ void OnAvatarRoundChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkAvatarRound.IsChecked();
+ m_chkAvatarCustomCorn.Enable(enabled);
+ enabled = enabled && m_chkAvatarCustomCorn.IsChecked();
+ m_edtAvatarCustomCorn.Enable(enabled);
+ m_spnAvatarCustomCorn.Enable(enabled);
+ }
+
+ void OnAvatarCustomCornChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkAvatarRound.IsChecked();
+ m_chkAvatarCustomCorn.Enable(enabled);
+ enabled = enabled && m_chkAvatarCustomCorn.IsChecked();
+ m_edtAvatarCustomCorn.Enable(enabled);
+ m_spnAvatarCustomCorn.Enable(enabled);
+ }
+
+ void OnShowProtoNameChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkShowProtoName.IsChecked();
+ m_chkShowCycleProtoBtn.Enable(enabled);
+ }
+
+ void OnAvatarCustomSizeChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkAvatarCustomSize.IsChecked();
+ m_edtAvatarCustomSize.Enable(enabled);
+ m_spnAvatarCustomSize.Enable(enabled);
+ }
+
+ void OnCycleProtosChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkCycleProtos.IsChecked();
+ m_edtCycleTime.Enable(enabled);
+ m_spnCycleTime.Enable(enabled);
+ }
+
+ void OnReplaceSmiliesChange(CCtrlBase*)
+ {
+ BOOL enabled = m_chkReplaceSmilies.IsChecked();
+ m_chkUseCLSmilies.Enable(enabled);
+ m_chkResizeSmilies.Enable(enabled);
+ }
+};
int InitOptionsCallback(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.position = -200000000;
- odp.pfnDlgProc = DlgProcOpts;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS);
+ odp.pDialog = new COptDialog;
odp.szGroup.w = LPGENW("Contact list");
odp.szTitle.w = LPGENW("My details");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
|