[Wine-devel] shell32: Changes for SHELL_ABOUT_DLG adds logo and product info

Константин Подрубный =?iso-8859-1?q?smoke_=CE=C1_etersoft=2Eru?=
Ср Июл 16 15:38:42 MSD 2008


----------- следующая часть -----------
From 9511729b702956481011f059bbcb38797231bf91 Mon Sep 17 00:00:00 2001
From: Konstantin Podrubny <smoke на etersoft.ru>
Date: Wed, 16 Jul 2008 15:01:06 +0400
Subject: [PATCH] Changes for WinVer

---
 dlls/shell32/shell32_Ru.rc  |   26 ++++---
 dlls/shell32/shell32_main.c |  176 ++++++++++++++++++++++++++++++++++++++++--
 dlls/shell32/shresdef.h     |    6 ++
 3 files changed, 189 insertions(+), 19 deletions(-)

diff --git a/dlls/shell32/shell32_Ru.rc b/dlls/shell32/shell32_Ru.rc
index d68f1d5..c17324c 100644
--- a/dlls/shell32/shell32_Ru.rc
+++ b/dlls/shell32/shell32_Ru.rc
@@ -137,19 +137,25 @@ FONT 8, "MS Shell Dlg"
     LTEXT "", IDD_MESSAGE, 40, 10, 238, 52, 0
 }
 
-SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 220, 152
+SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 335, 200
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "н %s"
 FONT 10, "MS Shell Dlg"
 {
- DEFPUSHBUTTON "OK", IDOK, 153, 133, 60, 12, WS_TABSTOP
- PUSHBUTTON "&кХЖЕМГХЪ Wine...", 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 %s", IDC_ABOUT_STATIC_TEXT3, 42, 34, 170, 10
- LTEXT "пЮГПЮАНРВХЙХ Wine:", IDC_ABOUT_WINE_TEXT, 8, 55, 137, 10
+/*ICON "", stc1, 10, 10, 30, 30*/
+CONTROL "", IDC_ABOUT_LOGO_ETERSOFT, "Static", SS_BITMAP, 0, 0, 60, 60
+DEFPUSHBUTTON "OK", IDOK, 256, 178, 70, 16, WS_TABSTOP
+PUSHBUTTON "&кХЖЕМГХЪ Wine...", IDC_ABOUT_LICENSE, 152, 178, 70, 16, WS_TABSTOP
+PUSHBUTTON "&кХЖЕМГХЪ Etersoft", IDC_ABOUT_LICENSE_ETERSOFT, 152, 158, 70, 16, WS_TABSTOP
+LISTBOX IDC_ABOUT_LISTBOX, 8, 107, 137, 90, LBS_NOTIFY | WS_VSCROLL | WS_BORDER
+LTEXT "", IDC_ABOUT_STATIC_TEXT1, 35, 65, 137, 8
+LTEXT "бЕПЯХЪ %s", IDC_ABOUT_STATIC_TEXT2, 35, 73, 290, 8
+LTEXT "%s", IDC_ABOUT_STATIC_OWNER, 153, 98, 174, 10
+LTEXT "%s", IDC_ABOUT_STATIC_COMPANY, 153, 110, 174, 10
+LTEXT "%s", IDC_ABOUT_STATIC_REGNUM, 153, 122, 174, 10
+LTEXT "", IDC_ABOUT_STATIC_TEXT3, 153, 134, 137, 8
+LTEXT "", IDC_ABOUT_STATIC_LINK, 153, 142, 120, 8, SS_NOTIFY
+LTEXT "пЮГПЮАНРВХЙХ Wine:", IDC_ABOUT_WINE_TEXT, 8, 98, 137, 8
 }
 
 SHELL_RUN_DLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 227, 95
@@ -248,7 +254,7 @@ STRINGTABLE
     IDS_COMMON_MUSIC            "нАЫХЕ ДНЙСЛЕМРШ\\лНЪ ЛСГШЙЮ"
     IDS_COMMON_PICTURES         "нАЫХЕ ДНЙСЛЕМРШ\\лНХ ПХЯСМЙХ"
     IDS_COMMON_VIDEO            "нАЫХЕ ДНЙСЛЕМРШ\\лНХ ТХКЭЛШ"
-    IDS_CDBURN_AREA             "Local Settings\\Application Data\\Microsoft\\CD Burning"
+    IDS_CDBURN_AREA             "Local Settings\\Application Data\\Microsoft\\CD Burning" 
 
     IDS_NEWFOLDER		"New Folder"
 }
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 07c1076..6e620fa 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <fcntl.h>
 
 #define COBJMACROS
 
@@ -38,6 +39,8 @@
 #include "wingdi.h"
 #include "shlobj.h"
 #include "shlwapi.h"
+#include "olectl.h"
+
 
 #include "undocshell.h"
 #include "pidl.h"
@@ -45,8 +48,11 @@
 #include "version.h"
 #include "shresdef.h"
 
+#define ETERSOFT_FUNC_LICENSE 
+
 #include "wine/debug.h"
 #include "wine/unicode.h"
+#include "wine/etersoft.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
@@ -965,10 +971,16 @@ HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
 /*************************************************************************
  * AboutDlgProc            (internal)
  */
+ 
 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
                               LPARAM lParam )
 {
     HWND hWndCtl;
+    HFONT hFont;
+    HCURSOR hCursor;
+
+    static IPicture *pPicture;
+
 
     TRACE("\n");
 
@@ -977,30 +989,124 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
     case WM_INITDIALOG:
         {
             ABOUT_INFO *info = (ABOUT_INFO *)lParam;
-            WCHAR template[512], buffer[512], version[64];
+            WCHAR template[512], buffer[512], version[512],more_text[512];
+            WCHAR url[512], regnum[64], owner[256], company[256];
+            WCHAR *more_buf;
+            int place;
+
+            IStream *pStream = 0;
+            HGLOBAL hMem = NULL;
+            HRESULT hRes;
+            int hFile;
+            LPVOID pMem;
+            DWORD dwBytesRead=0, dwFileSize=0;
+            char buf[1024];
+            char fn[1024];
+
+
             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);
+
+                /*load bitmap*/ 
+                if (wine_get_data_dir()!=NULL) lstrcpyA(fn,wine_get_data_dir());
+                        else lstrcpyA(fn,wine_get_build_dir());
+                lstrcatA(fn,"/etersoft/desktop/logo.bmp");
+
+                if((hFile = open(fn,O_RDONLY))!= -1) 
+                {
+                  while ((dwBytesRead = read(hFile,buf,1024))!=0) dwFileSize=dwFileSize+dwBytesRead;
+                  hMem = GlobalAlloc(GHND,dwFileSize);
+                  if (hMem!=NULL)
+                  {
+                    pMem = GlobalLock(hMem);
+                    dwFileSize = 0;
+                    lseek(hFile,0,0);
+                    while ((dwBytesRead = read(hFile,(char*)pMem+dwFileSize,1024))!=0) dwFileSize = dwFileSize + dwBytesRead;
+                    GlobalUnlock(hMem);
+                    hRes = CreateStreamOnHGlobal(hMem,FALSE, &pStream);
+                    if (SUCCEEDED(hRes))
+                      hRes = OleLoadPicture(pStream, dwFileSize, TRUE, &IID_IPicture, (void**)&pPicture);
+                  }
+                }
+                close(hFile);
+
+                /*geting text information*/
+                MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1,
+                                     version, sizeof(version)/sizeof(WCHAR) );
+
+                place=0; 
+                more_buf=version;
+                while ((version[place]!='\n')&(version[place]!='\0')) 
+                {
+                   place++;
+                   more_buf=CharNextW(more_buf);
+                }
+                more_buf=CharNextW(more_buf);
+                lstrcpyW(more_text,more_buf);
+                lstrcpynW(version, version, place);
+
+                LOADETER_FUNC(etersoft_license);
+
+                if(etersoft_license)
+                {
+                  MultiByteToWideChar( CP_UTF8, 0, etersoft_license(ETERSOFT_LICENSE_OWNER), -1,owner,sizeof(owner)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, etersoft_license(ETERSOFT_LICENSE_COMPANY), -1,company,  sizeof(company)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, etersoft_license(ETERSOFT_LICENSE_REGNUM), -1,regnum,  sizeof(regnum)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, etersoft_license(ETERSOFT_LICENSE_URL), -1,url, sizeof(url)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, "Legality check is available on the page", -1, more_text, sizeof(more_text)/sizeof(WCHAR) );
+                } 
+                else 
+                {
+                  MultiByteToWideChar( CP_UTF8, 0, "\0", -1,owner,sizeof(owner)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, "\0", -1,company,  sizeof(company)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, "\0", -1,regnum,  sizeof(regnum)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, "\0", -1,url, sizeof(url)/sizeof(WCHAR) );
+                  MultiByteToWideChar( CP_UTF8, 0, "\0", -1,more_text, sizeof(more_text)/sizeof(WCHAR) );
+                }
+
+
                 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),
+
+                GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2),
                                 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 );
+                sprintfW( buffer, template, version);
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), buffer );
+
+                GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_OWNER),
+                                template, sizeof(template)/sizeof(WCHAR) );
+                sprintfW( buffer, template, owner);
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_OWNER), buffer );
+
+                GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_COMPANY),
+                                template, sizeof(template)/sizeof(WCHAR) );
+                sprintfW( buffer, template, company);
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_COMPANY), buffer );
+
+                GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_REGNUM),
+                                template, sizeof(template)/sizeof(WCHAR) );
+                sprintfW( buffer, template, regnum);
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_REGNUM), buffer );  
+
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), more_text );
+                  hCursor=LoadCursorW(0,(LPCWSTR)IDC_HAND);
+                  SetClassLongW( GetDlgItem(hWnd,IDC_ABOUT_STATIC_LINK),-12,(WPARAM)hCursor);
+
+                  hFont=CreateFontW(16,6,0,0,0,0,1,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
+                SendMessageW( GetDlgItem(hWnd,IDC_ABOUT_STATIC_LINK), WM_SETFONT, (WPARAM)hFont,1);
+                SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_LINK), url );
+
                 hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);
                 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
                 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
                 while (*pstr)
                 {
-                    /* authors list is in utf-8 format */
                     MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, buffer, sizeof(buffer)/sizeof(WCHAR) );
                     SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)buffer );
                     pstr++;
@@ -1010,11 +1116,41 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
         }
         return 1;
 
+    case WM_CTLCOLORSTATIC:
+        {
+            int ID=(int)GetDlgCtrlID((HWND)lParam);
+            if (ID==IDC_ABOUT_STATIC_LINK)
+            {
+               SetTextColor((HDC)wParam,RGB(0,0,255));
+               SetBkColor((HDC)wParam,GetSysColor(COLOR_BTNFACE));
+               return (LRESULT)GetSysColorBrush(COLOR_BTNFACE);
+            } else if (pPicture!=0)
+            if ((ID==IDC_ABOUT_STATIC_TEXT1 )||(ID==IDC_ABOUT_STATIC_TEXT2 ))
+            {
+               SetBkColor((HDC)wParam,RGB(255,255,255));
+               return (LRESULT)(HBRUSH) GetStockObject (WHITE_BRUSH) ;
+            }
+
+        }
+    break; 
+
     case WM_PAINT:
         {
             PAINTSTRUCT ps;
+            RECT Rec;
+            int height=0,width=0;
             HDC hDC = BeginPaint( hWnd, &ps );
+
             paint_dropline( hDC, hWnd );
+
+            if (pPicture!=NULL)
+            {
+               IPicture_get_Width(pPicture,&width);
+               IPicture_get_Height(pPicture,&height);
+               GetClientRect(hWnd, &Rec);
+               IPicture_Render(pPicture,hDC,Rec.left,Rec.top,Rec.right-Rec.left,170,0,height,width,-height,NULL);
+            }
+
             EndPaint( hWnd, &ps );
         }
     break;
@@ -1041,6 +1177,28 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
             params.dwLanguageId = LANG_NEUTRAL;
             MessageBoxIndirectW( &params );
         }
+        if (wParam==IDC_ABOUT_LICENSE_ETERSOFT)
+        {
+            WCHAR license[1024];
+            WCHAR b2[1024];
+
+            LOADETER_FUNC(etersoft_license); 
+            if(etersoft_license) 
+            {
+                MultiByteToWideChar( CP_UTF8, 0, "iexplore.exe",-1,b2, sizeof(b2)/sizeof(WCHAR) );
+                MultiByteToWideChar(CP_UTF8,0,etersoft_license(ETERSOFT_LICENSE_FILE),-1,license,  sizeof(license)/sizeof(WCHAR) );
+                ShellExecuteW(0,0,b2,license,0,SW_SHOWNORMAL);
+            }
+            else MessageBoxA(0,"Are you shure you have got a license?!","doubt it...",MB_OK);
+        }
+        if (wParam == IDC_ABOUT_STATIC_LINK)
+        {
+           WCHAR link_buffer[1024];
+           WCHAR b2[1024];
+           MultiByteToWideChar( CP_UTF8, 0, "iexplore.exe",-1,b2, sizeof(b2)/sizeof(WCHAR) );
+           GetWindowTextW( GetDlgItem(hWnd,wParam), link_buffer, sizeof(link_buffer)/sizeof(WCHAR) );
+           ShellExecuteW(0,0,b2,link_buffer,0,SW_SHOWNORMAL);
+        }
         break;
     case WM_CLOSE:
       EndDialog(hWnd, TRUE);
diff --git a/dlls/shell32/shresdef.h b/dlls/shell32/shresdef.h
index 90b1c76..8954c52 100644
--- a/dlls/shell32/shresdef.h
+++ b/dlls/shell32/shresdef.h
@@ -176,6 +176,12 @@ FIXME: Need to add them, but for now just let them use the same: searching.avi
 #define IDC_ABOUT_STATIC_TEXT1   100
 #define IDC_ABOUT_STATIC_TEXT2   101
 #define IDC_ABOUT_STATIC_TEXT3   102
+#define IDC_ABOUT_LICENSE_ETERSOFT 103
+#define IDC_ABOUT_STATIC_OWNER 104
+#define IDC_ABOUT_STATIC_COMPANY 105
+#define IDC_ABOUT_STATIC_REGNUM 106
+#define IDC_ABOUT_STATIC_LINK 107
+#define IDC_ABOUT_LOGO_ETERSOFT 108
 
 /* run dialog */
 #define IDC_RUNDLG_DESCRIPTION  12289
-- 
1.5.4.5.GIT



Подробная информация о списке рассылки Wine-devel