diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-21 15:13:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-21 15:13:56 +0000 |
commit | 34c11f2b4c3511476b2f09f3a438ce1f39d63bfd (patch) | |
tree | 88dbad1e6ca7dc7012bd4950fd9621fa0da29deb /src/modules | |
parent | 646d3950702c34475e9bcb05ebe380f6874a73d2 (diff) |
patch for eliminating expert mode in options (to replace the simple mode with ModernOpts)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2025 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/clist/genmenuopt.cpp | 2 | ||||
-rw-r--r-- | src/modules/icolib/skin2opts.cpp | 4 | ||||
-rw-r--r-- | src/modules/ignore/ignore.cpp | 19 | ||||
-rw-r--r-- | src/modules/netlib/netlibopts.cpp | 3 | ||||
-rw-r--r-- | src/modules/options/options.cpp | 183 | ||||
-rw-r--r-- | src/modules/skin/sounds.cpp | 2 |
6 files changed, 17 insertions, 196 deletions
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 004939591c..40dc80a597 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -864,7 +864,7 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTOCOLORDER);
odp.pszTitle = LPGEN("Accounts");
odp.pfnDlgProc = ProtocolOrderOpts;
- odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
+ odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 7075cd439d..f5bb3ffa06 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -1019,8 +1019,6 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
-static UINT iconsExpertOnlyControls[] = {IDC_IMPORT};
-
int SkinOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {0};
@@ -1032,8 +1030,6 @@ int SkinOptionsInit(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Icons");
odp.pszGroup = LPGEN("Customize");
odp.pfnDlgProc = DlgProcIcoLibOpts;
- odp.expertOnlyControls = iconsExpertOnlyControls;
- odp.nExpertOnlyControls = SIZEOF(iconsExpertOnlyControls);
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 715c7897da..2907833af5 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -221,11 +221,6 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM SendDlgItemMessage(hwndDlg, IDC_ADDED, STM_SETICON, (WPARAM)hIcons[7], 0);
SendDlgItemMessage(hwndDlg, IDC_TYPINGICON, STM_SETICON, (WPARAM)hIcons[8], 0);
- if ( !SendMessage(GetParent(hwndDlg), PSM_ISEXPERT, 0, 0)) {
- SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE, GetWindowLongPtr( GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE)&~(CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN));
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_AUTOREBUILD, 0, 0);
- }
-
ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, IGNOREEVENT_MAX+2, 0);
{
@@ -317,17 +312,6 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM }
return TRUE;
- case PSN_EXPERTCHANGED:
- {
- INT_PTR dwStyle = GetWindowLongPtr( GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE);
- if (((PSHNOTIFY*)lParam)->lParam)
- dwStyle |= CLS_CHECKBOXES | CLS_GROUPCHECKBOXES | CLS_SHOWHIDDEN;
- else
- dwStyle &= ~(CLS_CHECKBOXES|CLS_GROUPCHECKBOXES|CLS_SHOWHIDDEN);
- SetWindowLongPtr( GetDlgItem(hwndDlg, IDC_LIST), GWL_STYLE, dwStyle);
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_AUTOREBUILD, 0, 0);
- }
- break;
}
break;
}
@@ -345,7 +329,6 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM return FALSE;
}
-static UINT expertOnlyControls[] = {IDC_STCHECKMARKS};
static int IgnoreOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
@@ -357,8 +340,6 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Events");
odp.pfnDlgProc = DlgProcIgnoreOpts;
odp.flags = ODPF_BOLDGROUPS;
- odp.expertOnlyControls = expertOnlyControls;
- odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 582669eb0d..386de096f2 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -498,7 +498,6 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE;
}
-static UINT expertOnlyControls[] = {IDC_LOGOPTIONS};
int NetlibOptInitialise(WPARAM wParam, LPARAM)
{
int optionsCount = 0;
@@ -521,8 +520,6 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) odp.pszTitle = LPGEN("Network");
odp.pfnDlgProc = DlgProcNetlibOpts;
odp.flags = ODPF_BOLDGROUPS;
- odp.expertOnlyControls = expertOnlyControls;
- odp.nExpertOnlyControls = SIZEOF(expertOnlyControls);
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 8b4ee93f09..031691e5c2 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -68,11 +68,8 @@ struct OptionsPageData HTREEITEM hTreeItem;
HWND hwnd;
int changed;
- int simpleHeight, expertHeight;
- int simpleWidth, expertWidth;
- int simpleBottomControlId, simpleRightControlId;
- int nExpertOnlyControls;
- UINT *expertOnlyControls;
+ int height;
+ int width;
DWORD flags;
TCHAR *ptszTitle, *ptszGroup, *ptszTab;
int hLangpack;
@@ -359,8 +356,6 @@ static BOOL CheckPageShow(HWND hdlg, OptionsDlgData* dat, int i) OptionsPageData* opd = dat->arOpd[i];
if (dat->szFilterString && dat->szFilterString[0] && !MatchesFilter(opd, dat->szFilterString)) return FALSE;
- if ((opd->flags & ODPF_SIMPLEONLY) && IsDlgButtonChecked(hdlg, IDC_EXPERT)) return FALSE;
- if ((opd->flags & ODPF_EXPERTONLY) && !IsDlgButtonChecked(hdlg, IDC_EXPERT)) return FALSE;
return TRUE;
}
@@ -586,12 +581,8 @@ static bool LoadOptionsPage(OPTIONSDIALOGPAGE *src, OptionsPageData *dst) dst->hInst = src->hInstance;
dst->hwnd = NULL;
dst->changed = 0;
- dst->simpleHeight = dst->expertHeight = 0;
- dst->simpleBottomControlId = src->nIDBottomSimpleControl;
- dst->simpleWidth = dst->expertWidth = 0;
- dst->simpleRightControlId = src->nIDRightSimpleControl;
- dst->nExpertOnlyControls = src->nExpertOnlyControls;
- dst->expertOnlyControls = src->expertOnlyControls;
+ dst->height = 0;
+ dst->width = 0;
dst->flags = src->flags;
dst->hLangpack = src->hLangpack;
dst->dwInitParam = src->dwInitParam;
@@ -700,14 +691,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L Utils_RestoreWindowPositionNoSize(hdlg, NULL, "Options", "");
Window_SetIcon_IcoLib(hdlg, SKINICON_OTHER_OPTIONS);
- CheckDlgButton(hdlg, IDC_EXPERT, db_get_b(NULL, "Options", "Expert", SETTING_SHOWEXPERT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
EnableWindow( GetDlgItem(hdlg, IDC_APPLY), FALSE);
dat = new OptionsDlgData;
SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)dat);
SetWindowText(hdlg, psh->pszCaption);
LOGFONT lf;
- dat->hBoldFont = (HFONT)SendDlgItemMessage(hdlg, IDC_EXPERT, WM_GETFONT, 0, 0);
+ dat->hBoldFont = (HFONT)SendDlgItemMessage(hdlg, IDC_APPLY, WM_GETFONT, 0, 0);
GetObject(dat->hBoldFont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
dat->hBoldFont = CreateFontIndirect(&lf);
@@ -974,10 +964,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L return TRUE;
- case PSM_ISEXPERT:
- SetWindowLongPtr(hdlg, DWLP_MSGRESULT, IsDlgButtonChecked(hdlg, IDC_EXPERT));
- return TRUE;
-
case PSM_GETBOLDFONT:
SetWindowLongPtr(hdlg, DWLP_MSGRESULT, (LONG_PTR)dat->hBoldFont);
return TRUE;
@@ -1052,32 +1038,15 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if (p->flags & ODPF_BOLDGROUPS)
EnumChildWindows(p->hwnd, BoldGroupTitlesEnumChildren, (LPARAM)dat->hBoldFont);
GetClientRect(p->hwnd, &rcPage);
- p->expertWidth = rcPage.right;
- p->expertHeight = rcPage.bottom;
+ p->width = rcPage.right;
+ p->height = rcPage.bottom;
GetWindowRect(p->hwnd, &rc);
- if (p->simpleBottomControlId) {
- GetWindowRect( GetDlgItem(p->hwnd, p->simpleBottomControlId), &rcControl);
- p->simpleHeight = rcControl.bottom-rc.top;
- }
- else p->simpleHeight = p->expertHeight;
+ p->height = p->height;
+ p->width = p->width;
- if (p->simpleRightControlId) {
- GetWindowRect( GetDlgItem(p->hwnd, p->simpleRightControlId), &rcControl);
- p->simpleWidth = rcControl.right-rc.left;
- }
- else p->simpleWidth = p->expertWidth;
-
- if (IsDlgButtonChecked(hdlg, IDC_EXPERT)) {
- w = p->expertWidth;
- h = p->expertHeight;
- }
- else {
- for (int i=0; i < p->nExpertOnlyControls; i++)
- ShowWindow( GetDlgItem(p->hwnd, p->expertOnlyControls[i]), SW_HIDE);
- w = p->simpleWidth;
- h = p->simpleHeight;
- }
+ w = p->width;
+ h = p->height;
p->offsetX = 0;
p->offsetY = 0;
@@ -1128,47 +1097,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L ThemeDialogBackground(p->hwnd, FALSE);
}
- // Resizing
- if ( !p->simpleBottomControlId) {
- int pageWidth, pageHeight;
-
- if (IsDlgButtonChecked(hdlg, IDC_EXPERT)) {
- pageWidth = p->expertWidth;
- pageHeight = p->expertHeight;
- }
- else {
- pageWidth = p->simpleWidth;
- pageHeight = p->simpleHeight;
- }
-
- RECT* parentPageRect = &dat->rcDisplay;
- if (p->insideTab)
- parentPageRect = &dat->rcTab;
-
- pageHeight = min(pageHeight, parentPageRect->bottom - parentPageRect->top);
- pageWidth = min(pageWidth, parentPageRect->right - parentPageRect->left);
-
- int newOffsetX = (parentPageRect->right - parentPageRect->left - pageWidth) >> 1;
- int newOffsetY = p->insideTab ? 0 : (parentPageRect->bottom - parentPageRect->top - pageHeight) >> 1;
-
- struct MoveChildParam mcp;
- mcp.hDlg = p->hwnd;
- mcp.offset.x = newOffsetX - p->offsetX;
- mcp.offset.y = newOffsetY - p->offsetY;
-
- if (mcp.offset.x || mcp.offset.y) {
- EnumChildWindows(p->hwnd, MoveEnumChildren, (LPARAM)(&mcp));
-
- SetWindowPos(p->hwnd, NULL,
- parentPageRect->left, parentPageRect->top,
- parentPageRect->right - parentPageRect->left,
- parentPageRect->bottom - parentPageRect->top,
- SWP_NOZORDER | SWP_NOACTIVATE);
- p->offsetX = newOffsetX;
- p->offsetY = newOffsetY;
- }
- }
-
ShowWindow(p->hwnd, SW_SHOW);
if (((LPNMTREEVIEW)lParam)->action == TVC_BYMOUSE) PostMessage(hdlg, DM_FOCUSPAGE, 0, 0);
else SetFocus(hwndTree);
@@ -1201,91 +1129,12 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L break;
- case IDC_EXPERT:
+ case IDC_MODERN:
{
- int expert = IsDlgButtonChecked(hdlg, IDC_EXPERT);
- RECT rcPage;
- int neww, newh;
-
- DBWriteContactSettingByte(NULL, "Options", "Expert", (BYTE)expert);
-
- PSHNOTIFY pshn;
- pshn.hdr.idFrom = 0;
- pshn.lParam = expert;
- pshn.hdr.code = PSN_EXPERTCHANGED;
-
- for (int i=0; i <dat->arOpd.getCount(); i++) {
- opd = dat->arOpd[i];
- if (opd->hwnd == NULL)
- continue;
- if ( !CheckPageShow(hdlg, dat, i))
- continue;
-
- pshn.hdr.hwndFrom = opd->hwnd;
- SendMessage(opd->hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
-
- for (int j = 0; j < opd->nExpertOnlyControls; j++)
- ShowWindow( GetDlgItem(opd->hwnd, opd->expertOnlyControls[j]), expert ? SW_SHOW : SW_HIDE);
-
- opd->insideTab = IsInsideTab(hdlg, dat, i);
-
- GetWindowRect(opd->hwnd, &rcPage);
- if (opd->simpleBottomControlId)
- newh = expert ? opd->expertHeight : opd->simpleHeight;
- else
- newh = rcPage.bottom - rcPage.top;
- if (opd->simpleRightControlId)
- neww = expert ? opd->expertWidth : opd->simpleWidth;
- else
- neww = rcPage.right - rcPage.left;
-
- if (i == dat->currentPage) {
- POINT ptStart, ptEnd, ptNow;
- DWORD thisTick, startTick;
- RECT rc;
-
- ptNow.x = ptNow.y = 0;
- ClientToScreen(hdlg, &ptNow);
- GetWindowRect(opd->hwnd, &rc);
- ptStart.x = rc.left-ptNow.x;
- ptStart.y = rc.top-ptNow.y;
- if (opd->insideTab) {
- ptEnd.x = (dat->rcTab.left+dat->rcTab.right-neww)>>1;
- ptEnd.y = dat->rcTab.top;
- }
- else {
- ptEnd.x = (dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1;
- ptEnd.y = (dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1;
- }
- if (abs(ptEnd.x-ptStart.x)>5 || abs(ptEnd.y-ptStart.y)>5) {
- startTick = GetTickCount();
- SetWindowPos(opd->hwnd, HWND_TOP, 0, 0, min(neww, rcPage.right), min(newh, rcPage.bottom), SWP_NOMOVE);
- UpdateWindow(opd->hwnd);
- for (;;) {
- thisTick = GetTickCount();
- if (thisTick>startTick+100) break;
- ptNow.x = ptStart.x+(ptEnd.x-ptStart.x)*(int)(thisTick-startTick)/100;
- ptNow.y = ptStart.y+(ptEnd.y-ptStart.y)*(int)(thisTick-startTick)/100;
- SetWindowPos(opd->hwnd, 0, ptNow.x, ptNow.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
- }
- }
- if (opd->insideTab)
- ShowWindow( GetDlgItem(hdlg, IDC_TAB), SW_SHOW);
- else
- ShowWindow( GetDlgItem(hdlg, IDC_TAB), SW_HIDE);
- }
-
- if (opd->insideTab) {
- SetWindowPos(opd->hwnd, HWND_TOP, (dat->rcTab.left+dat->rcTab.right-neww)>>1, dat->rcTab.top, neww, newh, 0);
- ThemeDialogBackground(opd->hwnd, TRUE);
- }
- else {
- SetWindowPos(opd->hwnd, HWND_TOP, (dat->rcDisplay.left+dat->rcDisplay.right-neww)>>1, (dat->rcDisplay.top+dat->rcDisplay.bottom-newh)>>1, neww, newh, 0);
- ThemeDialogBackground(opd->hwnd, FALSE);
- }
- }
+ DBWriteContactSettingByte(NULL, "Options", "Expert", 0);
SaveOptionsTreeState(hdlg);
- SendMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
+ PostMessage(hdlg, WM_CLOSE, 0, 0);
+ CallService(MS_MODERNOPT_SHOW, 0, 0);
break;
}
case IDCANCEL:
@@ -1388,7 +1237,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L delete dat;
hwndOptions = NULL;
- CallService(MS_MODERNOPT_RESTORE, 0, 0);
+ CallService(MS_MODERNOPT_RESTORE, 0, 0);
break;
}
return FALSE;
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp index c79db357f1..104229ab7d 100644 --- a/src/modules/skin/sounds.cpp +++ b/src/modules/skin/sounds.cpp @@ -419,8 +419,6 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
-static UINT iconsExpertOnlyControls[] = {IDC_IMPORT};
-
static int SkinOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
|