From 12ae8ff814e47ee194191cae3879e7a29a578f59 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Mar 2008 20:51:12 +0100 Subject: [PATCH] shell32: Add a license message box and a build id to the About dialog. Clean things up a little. --- dlls/shell32/shell32_En.rc | 29 ++++++++++++++++---- dlls/shell32/shell32_main.c | 67 +++++++++++++++++++++++++++------------------ dlls/shell32/shresdef.h | 5 ++++ 3 files changed, 69 insertions(+), 32 deletions(-) diff --git a/dlls/shell32/shell32_En.rc b/dlls/shell32/shell32_En.rc index e4fdea97a0f..68263ce9c7f 100644 --- a/dlls/shell32/shell32_En.rc +++ b/dlls/shell32/shell32_En.rc @@ -136,17 +136,19 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDD_MESSAGE, 40, 10, 238, 52, 0 } -SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 210, 152 +SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 220, 152 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "About %s" FONT 10, "MS Shell Dlg" { - DEFPUSHBUTTON "OK", IDOK, 153, 133, 50, 12, WS_TABSTOP + DEFPUSHBUTTON "OK", IDOK, 153, 133, 60, 12, WS_TABSTOP + PUSHBUTTON "Wine &license...", IDC_ABOUT_LICENSE, 153, 113, 60, 12, WS_TABSTOP LISTBOX IDC_ABOUT_LISTBOX, 8, 65, 137, 82, LBS_NOTIFY | WS_VSCROLL | WS_BORDER ICON "", stc1, 10, 10, 30, 30 - LTEXT "", IDC_ABOUT_STATIC_TEXT1, 40, 10, 137, 10 - LTEXT "", IDC_ABOUT_STATIC_TEXT2, 40, 22, 137, 10 - LTEXT "Wine was brought to you by:", IDC_ABOUT_WINE_TEXT, 8, 55, 137, 10 + LTEXT "", IDC_ABOUT_STATIC_TEXT1, 42, 10, 170, 10 + LTEXT "", IDC_ABOUT_STATIC_TEXT2, 42, 22, 170, 10 + LTEXT "Running on %s", IDC_ABOUT_STATIC_TEXT3, 42, 34, 170, 10 + LTEXT "Wine was brought to you by:", IDC_ABOUT_WINE_TEXT, 8, 54, 204, 10 } SHELL_RUN_DLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 227, 95 @@ -248,3 +250,20 @@ STRINGTABLE IDS_NEWFOLDER "New Folder" } + +STRINGTABLE +{ +IDS_LICENSE_CAPTION, "Wine License" +IDS_LICENSE, +"Wine is free software; you can redistribute it and/or \ +modify it under the terms of the GNU Lesser General Public \ +License as published by the Free Software Foundation; either \ +version 2.1 of the License, or (at your option) any later version.\n\n\ +Wine is distributed in the hope that it will be useful, \ +but WITHOUT ANY WARRANTY; without even the implied warranty of \ +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \ +Lesser General Public License for more details.\n\n\ +You should have received a copy of the GNU Lesser General Public \ +License along with this library; if not, write to the Free Software \ +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA." +} diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 4163168ed56..30265824b7b 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -851,21 +851,19 @@ typedef struct HFONT hFont; } ABOUT_INFO; -#define DROP_FIELD_TOP (-15) -#define DROP_FIELD_HEIGHT 15 +#define DROP_FIELD_TOP (-12) -static BOOL __get_dropline( HWND hWnd, LPRECT lprect ) +static void paint_dropline( HDC hdc, HWND hWnd ) { HWND hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_WINE_TEXT); - - if( hWndCtl ) - { - GetWindowRect( hWndCtl, lprect ); - MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 ); - lprect->bottom = (lprect->top += DROP_FIELD_TOP); - return TRUE; - } - return FALSE; + RECT rect; + + if (!hWndCtl) return; + GetWindowRect( hWndCtl, &rect ); + MapWindowPoints( 0, hWnd, (LPPOINT)&rect, 2 ); + rect.top += DROP_FIELD_TOP; + rect.bottom = rect.top + 2; + DrawEdge( hdc, &rect, BDR_SUNKENOUTER, BF_RECT ); } /************************************************************************* @@ -979,26 +977,32 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, case WM_INITDIALOG: { ABOUT_INFO *info = (ABOUT_INFO *)lParam; - WCHAR Template[512], AppTitle[512]; + WCHAR template[512], buffer[512], version[64]; + extern const char *wine_get_build_id(void); if (info) { const char* const *pstr = SHELL_Authors; SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0); - GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) ); - sprintfW( AppTitle, Template, info->szApp ); - SetWindowTextW( hWnd, AppTitle ); + GetWindowTextW( hWnd, template, sizeof(template)/sizeof(WCHAR) ); + sprintfW( buffer, template, info->szApp ); + SetWindowTextW( hWnd, buffer ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff ); + GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), + template, sizeof(template)/sizeof(WCHAR) ); + MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1, + version, sizeof(version)/sizeof(WCHAR) ); + sprintfW( buffer, template, version ); + SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer ); hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX); SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 ); SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 ); while (*pstr) { - WCHAR name[64]; /* authors list is in utf-8 format */ - MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) ); - SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name ); + MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ); + SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)buffer ); pstr++; } SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 ); @@ -1008,16 +1012,9 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, case WM_PAINT: { - RECT rect; PAINTSTRUCT ps; HDC hDC = BeginPaint( hWnd, &ps ); - - if (__get_dropline( hWnd, &rect )) - { - SelectObject( hDC, GetStockObject( BLACK_PEN ) ); - MoveToEx( hDC, rect.left, rect.top, NULL ); - LineTo( hDC, rect.right, rect.bottom ); - } + paint_dropline( hDC, hWnd ); EndPaint( hWnd, &ps ); } break; @@ -1028,6 +1025,22 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, EndDialog(hWnd, TRUE); return TRUE; } + if (wParam == IDC_ABOUT_LICENSE) + { + MSGBOXPARAMSW params; + + params.cbSize = sizeof(params); + params.hwndOwner = hWnd; + params.hInstance = shell32_hInstance; + params.lpszText = MAKEINTRESOURCEW(IDS_LICENSE); + params.lpszCaption = MAKEINTRESOURCEW(IDS_LICENSE_CAPTION); + params.dwStyle = MB_ICONINFORMATION | MB_OK; + params.lpszIcon = 0; + params.dwContextHelpId = 0; + params.lpfnMsgBoxCallback = NULL; + params.dwLanguageId = LANG_NEUTRAL; + MessageBoxIndirectW( ¶ms ); + } break; case WM_CLOSE: EndDialog(hWnd, TRUE); diff --git a/dlls/shell32/shresdef.h b/dlls/shell32/shresdef.h index 211bcfe8c71..24373b719ba 100644 --- a/dlls/shell32/shresdef.h +++ b/dlls/shell32/shresdef.h @@ -96,6 +96,9 @@ #define IDS_NEWFOLDER 142 +#define IDS_LICENSE 256 +#define IDS_LICENSE_CAPTION 257 + #define MENU_SHV_FILE 144 /* Note: this string is referenced from the registry*/ @@ -161,9 +164,11 @@ FIXME: Need to add them, but for now just let them use the same: searching.avi #define IDR_AVI_FILEDELETE 164 /* about box */ +#define IDC_ABOUT_LICENSE 97 #define IDC_ABOUT_WINE_TEXT 98 #define IDC_ABOUT_LISTBOX 99 #define IDC_ABOUT_STATIC_TEXT1 100 #define IDC_ABOUT_STATIC_TEXT2 101 +#define IDC_ABOUT_STATIC_TEXT3 102 #endif -- 2.11.4.GIT