From 5958b2064712c58ac650f15a91812edc9259d7e2 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sun, 9 Mar 2014 23:40:05 +0000 Subject: Tipper Add: "Show title" option to control the title regardless of icons git-svn-id: http://svn.miranda-ng.org/main/trunk@8535 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/src/options.cpp | 15 +++++++++------ plugins/TipperYM/src/options.h | 5 +++-- plugins/TipperYM/src/popwin.cpp | 26 ++++++++++++++------------ plugins/TipperYM/src/resource.h | 1 + 4 files changed, 27 insertions(+), 20 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 41aef2fc2b..f9aae7e2fd 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -239,7 +239,8 @@ void SaveOptions() db_set_dw(0, MODULE, "MaxHeight", opt.iWinMaxHeight); db_set_b(0, MODULE, "AvatarOpacity", (BYTE)opt.iAvatarOpacity); db_set_b(0, MODULE, "AvatarRoundCorners", (opt.bAvatarRound ? 1 : 0)); - db_set_b(0, MODULE, "TitleLayout", (BYTE)opt.titleLayout); + db_set_b(0, MODULE, "TitleIconLayout", (BYTE)opt.titleIconLayout); + db_set_b(0, MODULE, "TitleShow", (opt.bShowTitle ? 1 : 0)); if (ServiceExists(MS_AV_DRAWAVATAR)) db_set_b(0, MODULE, "AVLayout", (BYTE)opt.avatarLayout); opt.bWaitForAvatar = (opt.avatarLayout == PAV_NONE) ? false : true; @@ -347,7 +348,8 @@ void LoadOptions() opt.iAvatarOpacity = db_get_b(0, MODULE, "AvatarOpacity", 100); if (opt.iAvatarOpacity > 100) opt.iAvatarOpacity = 100; opt.bAvatarRound = (db_get_b(0, MODULE, "AvatarRoundCorners", opt.bRound ? 1 : 0) == 1); - opt.titleLayout = (PopupTitleLayout)db_get_b(0, MODULE, "TitleLayout", (BYTE)PTL_LEFTICON); + opt.titleIconLayout = (PopupIconTitleLayout)db_get_b(0, MODULE, "TitleIconLayout", (BYTE)PTL_LEFTICON); + opt.bShowTitle = (db_get_b(0, MODULE, "TitleShow", 1) == 1); if (ServiceExists(MS_AV_DRAWAVATAR)) opt.avatarLayout = (PopupAvLayout)db_get_b(0, MODULE, "AVLayout", PAV_RIGHT); else @@ -1362,14 +1364,14 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TranslateDialogDefault( hwndDlg ); + CheckDlgButton(hwndDlg, IDC_CHK_SHOWTITLE, opt.bShowTitle ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_CHK_NOFOCUS, opt.bShowNoFocus ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_CHK_SBAR, opt.bStatusBarTips ? TRUE : FALSE); + SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("No icon")); SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on left")); SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on right")); - SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("No icon")); - SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("No title")); - SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_SETCURSEL, (int)opt.titleLayout, 0); + SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_SETCURSEL, (int)opt.titleIconLayout, 0); SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom right")); SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom left")); @@ -1523,7 +1525,7 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP new_val = GetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, &trans, FALSE); if (trans) opt.iSidebarWidth = new_val; - opt.titleLayout = (PopupTitleLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0); + opt.titleIconLayout = (PopupIconTitleLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0); opt.avatarLayout = (PopupAvLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_GETCURSEL, 0, 0); opt.pos = (PopupPosition)SendDlgItemMessage(hwndDlg, IDC_CMB_POS, CB_GETCURSEL, 0, 0); @@ -1531,6 +1533,7 @@ INT_PTR CALLBACK DlgProcOptsAppearance(HWND hwndDlg, UINT msg, WPARAM wParam, LP opt.bAvatarRound = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false; opt.bOriginalAvatarSize = IsDlgButtonChecked(hwndDlg, IDC_CHK_ORIGINALAVSIZE) ? true : false; + opt.bShowTitle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWTITLE) ? true : false; opt.bShowNoFocus = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOFOCUS) ? true : false; opt.bStatusBarTips = IsDlgButtonChecked(hwndDlg, IDC_CHK_SBAR) ? true : false; diff --git a/plugins/TipperYM/src/options.h b/plugins/TipperYM/src/options.h index 98caec2063..ac61325b85 100644 --- a/plugins/TipperYM/src/options.h +++ b/plugins/TipperYM/src/options.h @@ -125,13 +125,14 @@ typedef struct { } ICONSTATE; typedef enum {PAV_NONE=0, PAV_LEFT=1, PAV_RIGHT=2} PopupAvLayout; -typedef enum {PTL_LEFTICON=0, PTL_RIGHTICON=1, PTL_NOICON=2, PTL_NOTITLE=3} PopupTitleLayout; +typedef enum {PTL_NOICON=0, PTL_LEFTICON=1, PTL_RIGHTICON=2} PopupIconTitleLayout; typedef enum {PP_BOTTOMRIGHT=0, PP_BOTTOMLEFT=1, PP_TOPRIGHT=2, PP_TOPLEFT=3} PopupPosition; typedef enum {PSE_NONE=0, PSE_ANIMATE=1, PSE_FADE=2} PopupShowEffect; typedef struct { int iWinWidth, iWinMaxHeight, iAvatarSize; //tweety - PopupTitleLayout titleLayout; + PopupIconTitleLayout titleIconLayout; + bool bShowTitle; PopupAvLayout avatarLayout; int iTextIndent, iTitleIndent, iValueIndent; bool bShowNoFocus; diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 95f558cb08..2568132110 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -558,13 +558,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa tr.top = 0; tr.bottom = opt.iPadding; - if (!pwd->bIsTextTip && opt.titleLayout != PTL_NOTITLE) { - if (opt.titleLayout != PTL_NOICON) { + if (!pwd->bIsTextTip) { + if (opt.titleIconLayout != PTL_NOICON) { // draw icons int iIconX, iIconY; iIconY = opt.iPadding + opt.iTextPadding; - if (opt.titleLayout == PTL_RIGHTICON) + if (opt.titleIconLayout == PTL_RIGHTICON) iIconX = r2.right - 16 - opt.iPadding; else iIconX = r2.left + opt.iPadding; @@ -578,12 +578,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // title text - if (hFontTitle) SelectObject(hdc, (HGDIOBJ)hFontTitle); - SetTextColor(hdc, opt.colTitle); - tr.top = opt.iPadding; - tr.bottom = tr.top + pwd->iTitleHeight - opt.iPadding; - UINT uTextFormat = DT_TOP | DT_LEFT | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX; - DrawTextExt(hdc, pwd->swzTitle, -1, &tr, uTextFormat, NULL, pwd->spiTitle); + if (opt.bShowTitle) { + if (hFontTitle) SelectObject(hdc, (HGDIOBJ)hFontTitle); + SetTextColor(hdc, opt.colTitle); + tr.top = opt.iPadding; + tr.bottom = tr.top + pwd->iTitleHeight - opt.iPadding; + UINT uTextFormat = DT_TOP | DT_LEFT | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX; + DrawTextExt(hdc, pwd->swzTitle, -1, &tr, uTextFormat, NULL, pwd->spiTitle); + } } // values @@ -650,7 +652,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // status icon in tray tooltip - if (opt.titleLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon) { + if (opt.titleIconLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon) { DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iLabelHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, NULL, DI_NORMAL, false); bIconPainted = true; } @@ -689,7 +691,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa else tr.bottom = tr.top + iRowHeight; - if (opt.titleLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon && !bIconPainted) + if (opt.titleIconLayout != PTL_NOICON && pwd->bIsTrayTip && pwd->rows[i].hIcon && !bIconPainted) DrawIconExAlpha(hdc, opt.iPadding, tr.top + (pwd->rows[i].iValueHeight - 16) / 2, pwd->rows[i].hIcon, 16, 16, 0, NULL, DI_NORMAL, false); UINT uFormat = opt.iValueValign | opt.iValueHalign | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | DT_NOPREFIX; @@ -1142,7 +1144,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } // titlebar height - if (!pwd->bIsTextTip && pwd->swzTitle && opt.titleLayout != PTL_NOTITLE) { + if (!pwd->bIsTextTip && pwd->swzTitle && opt.bShowTitle) { smr.top = smr.bottom = 0; smr.left = rc.left + opt.iPadding + pwd->iIndent; smr.right = rc.right; diff --git a/plugins/TipperYM/src/resource.h b/plugins/TipperYM/src/resource.h index 5f14e5a4b2..2e2ae30fd7 100644 --- a/plugins/TipperYM/src/resource.h +++ b/plugins/TipperYM/src/resource.h @@ -125,6 +125,7 @@ #define IDC_BTN_APPLYSKIN 1124 #define IDC_BTN_VARIABLE 1125 #define IDC_BTN_GETSKINS 1125 +#define IDC_CHK_SHOWTITLE 1126 // Next default values for new objects // -- cgit v1.2.3