From 4b112fab6652b54edb385c0f037987b34da26fa1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Sch=C3=BCmann?= <white06tiger@gmail.com>
Date: Thu, 25 Dec 2014 00:42:11 +0000
Subject: SendSS: fixed "info bar" used on our message boxes (actually we don't
 use those messages boxes atm.) * message box width increased if info bar text
 requires more space to display ! info bar text can be multi-line text ! fixed
 info bar (default) icon. Code got disabled previously because default icon
 didn't exist. Now using SendSS main icon

git-svn-id: http://svn.miranda-ng.org/main/trunk@11614 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/SendScreenshotPlus/res/resource.rc    |  2 +-
 plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 37 ++++++++++++++++++---------
 2 files changed, 26 insertions(+), 13 deletions(-)

(limited to 'plugins')

diff --git a/plugins/SendScreenshotPlus/res/resource.rc b/plugins/SendScreenshotPlus/res/resource.rc
index 8041020cc1..941b74b161 100644
--- a/plugins/SendScreenshotPlus/res/resource.rc
+++ b/plugins/SendScreenshotPlus/res/resource.rc
@@ -32,7 +32,7 @@ CAPTION "Dialog"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
     LTEXT           "",STATIC_WHITERECT,0,0,219,72
-    LTEXT           "",TXT_NAME,11,3,173,20,SS_ENDELLIPSIS | NOT WS_VISIBLE,WS_EX_TRANSPARENT
+    LTEXT           "",TXT_NAME,11,3,173,16,NOT WS_VISIBLE,WS_EX_TRANSPARENT
     ICON            "",ICO_DLGLOGO,191,3,21,20,NOT WS_VISIBLE
     ICON            "",ICO_MSGDLG,7,29,21,20
     LTEXT           "",TXT_MESSAGE,34,37,180,35
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
index 702550ad66..a8ba2b3227 100644
--- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
+++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
@@ -198,11 +198,9 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
 					SendDlgItemMessage(hDlg, TXT_NAME, WM_SETFONT, (WPARAM)hNormalFont, 0);
 
 					// set infobar's logo icon
-// @fixme (White-Tiger#1#): fix details icon
-//					SendDlgItemMessage(hDlg, ICO_DLGLOGO, STM_SETIMAGE, IMAGE_ICON, 
-//						(LPARAM)((pMsgBox->hiLogo) ? pMsgBox->hiLogo : Skin_GetIcon(ICO_DLG_DETAILS,1)));
+					SendDlgItemMessage(hDlg,ICO_DLGLOGO,STM_SETIMAGE,IMAGE_ICON, (pMsgBox->hiLogo?(LPARAM)pMsgBox->hiLogo:(LPARAM)GetIcon(ICO_MAIN)));
 
-					// anable headerbar
+					// enable headerbar
 					ShowWindow(GetDlgItem(hDlg, TXT_NAME), SW_SHOW);
 					ShowWindow(GetDlgItem(hDlg, ICO_DLGLOGO), SW_SHOW);
 				}
@@ -230,26 +228,41 @@ static INT_PTR CALLBACK MsgBoxProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
 				if (HDC hDC = GetDC(hDlg)) {
 					POINT mpt = {0,0};
 					RECT	ws = {0,0,0,0};
-					int   txtWidth, txtHeight, needX, needY;
+					int   txtWidth=0, txtHeight=0, needX, needY;
 					RECT	rcDlg;
 					SIZE	ts;
 					LPTSTR h, rs;
 
 					SelectObject(hDC, hNormalFont);
-
-					for (rs = h = pMsgBox->ptszMsg, txtHeight = 0, txtWidth = 0; h; ++h) {
-						if (*h == '\n' || *h == '\0') {
-							GetTextExtentPoint32(hDC, rs, int(h - rs), &ts);
+					// get message text width and height
+					for (rs=h=pMsgBox->ptszMsg; ; ++h) {
+						if (*h=='\n' || !*h) {
+							GetTextExtentPoint32(hDC, rs, h-rs, &ts);
 							if (ts.cx > txtWidth)
 								txtWidth = ts.cx;
-
 							txtHeight += ts.cy;
-							if (*h == '\0')
+							if (!*h)
 								break;
-
 							rs = h + 1;
 						}
 					}
+					// increase width if info text requires more
+					if((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText){
+						RECT rcico;
+						GetClientRect(GetDlgItem(hDlg,ICO_DLGLOGO), &rcico);
+						rcico.right=rcico.right*100/66; // padding
+						for(rs=h=pMsgBox->ptszInfoText; ; ++h) {
+							if (*h=='\n' || !*h) {
+								GetTextExtentPoint32(hDC, rs, h-rs, &ts);
+								ts.cx += rcico.right;
+								if (ts.cx > txtWidth)
+									txtWidth = ts.cx;
+								if (!*h)
+									break;
+								rs = h + 1;
+							}
+						}
+					}
 					ReleaseDC(hDlg, hDC);
 				
 					// calc new dialog size
-- 
cgit v1.2.3