[utf8vcl-cvs] utf8vcl UTF8VCL.pas, 1.24, 1.25 UTF8VCLCommDlg.pas, 1.1, 1.2 UTF8VCLControls.pas, 1.4
Status: Alpha
Brought to you by:
bluelive
From: Robert M. <mar...@us...> - 2007-03-28 14:22:42
|
Update of /cvsroot/utf8vcl/utf8vcl In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1009 Modified Files: UTF8VCL.pas UTF8VCLCommDlg.pas UTF8VCLControls.pas Log Message: nitpicky cleanup Index: UTF8VCL.pas =================================================================== RCS file: /cvsroot/utf8vcl/utf8vcl/UTF8VCL.pas,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** UTF8VCL.pas 25 Mar 2007 15:55:18 -0000 1.24 --- UTF8VCL.pas 28 Mar 2007 14:22:32 -0000 1.25 *************** *** 308,313 **** end; ! function GetTextExtentPoint32AIntercept(DC: HDC; Str: PAnsiChar; Count: Integer; ! var Size: TSize): BOOL; stdcall; var C: PWideChar; --- 308,312 ---- end; ! function GetTextExtentPoint32AIntercept(DC: HDC; Str: PAnsiChar; Count: Integer; var Size: TSize): BOOL; stdcall; var C: PWideChar; *************** *** 396,402 **** begin if (Cardinal(lpClassName) and $FFFF0000) <> 0 then - begin C := ConvertFromUTF8(lpClassName) - end else // This isn't a string but a special id --- 395,399 ---- *************** *** 564,568 **** end; - function MultiByteToWideCharIntercept(CodePage: UINT; dwFlags: DWORD; const lpMultiByteStr: LPCSTR; cchMultiByte: Integer; --- 561,564 ---- *************** *** 603,608 **** --- 599,607 ---- end; + //============================================================================ var + ActiveState: Boolean = False; + LibUser32: HMODULE = 0; LibGdi32: HMODULE = 0; *************** *** 644,650 **** end; - var - ActiveState: Boolean = False; - procedure ActivateUtf8VCL(Active: Boolean); begin --- 643,646 ---- *************** *** 693,698 **** NonUTF8GetOpenFileName := HookCommdlg32Func('GetOpenFileNameA', @GetOpenFileNameAIntercept); // do not localize NonUTF8GetSaveFileName := HookCommdlg32Func('GetSaveFileNameA', @GetSaveFileNameAIntercept); // do not localize ! NonUTF8GetFileTitle := HookCommdlg32Func('GetFileTitleA', @GetFileTitleAIntercept); // do not localize ! NonUTF8ChooseColor := HookCommdlg32Func('ChooseColorA', @ChooseColorAIntercept); // do not localize end else --- 689,694 ---- NonUTF8GetOpenFileName := HookCommdlg32Func('GetOpenFileNameA', @GetOpenFileNameAIntercept); // do not localize NonUTF8GetSaveFileName := HookCommdlg32Func('GetSaveFileNameA', @GetSaveFileNameAIntercept); // do not localize ! NonUTF8GetFileTitle := HookCommdlg32Func('GetFileTitleA', @GetFileTitleAIntercept); // do not localize ! NonUTF8ChooseColor := HookCommdlg32Func('ChooseColorA', @ChooseColorAIntercept); // do not localize end else Index: UTF8VCLControls.pas =================================================================== RCS file: /cvsroot/utf8vcl/utf8vcl/UTF8VCLControls.pas,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UTF8VCLControls.pas 25 Mar 2007 11:46:17 -0000 1.4 --- UTF8VCLControls.pas 28 Mar 2007 14:22:33 -0000 1.5 *************** *** 31,41 **** Forms, Controls, Messages; - type - TWinControlPatch = class(TWinControl) - private - procedure HookTWinControlDoKeyPress; - function DoKeyPressPatch(var Mesg: TWMKey): Boolean; - end; - procedure HookTWinControlDoKeyPress; --- 31,34 ---- *************** *** 46,50 **** type ! TProc = function(var Message: TWMKey): Boolean of object; procedure HookTWinControlDoKeyPress; --- 39,47 ---- type ! TWinControlPatch = class(TWinControl) ! private ! procedure HookTWinControlDoKeyPress; ! function DoKeyPressPatch(var Mesg: TWMKey): Boolean; ! end; procedure HookTWinControlDoKeyPress; *************** *** 79,84 **** procedure TWinControlPatch.HookTWinControlDoKeyPress; var ! A, B: TProc; begin A := DoKeyPress; --- 76,83 ---- procedure TWinControlPatch.HookTWinControlDoKeyPress; + type + TWMKeyProc = function(var Message: TWMKey): Boolean of object; var ! A, B: TWMKeyProc; begin A := DoKeyPress; Index: UTF8VCLCommDlg.pas =================================================================== RCS file: /cvsroot/utf8vcl/utf8vcl/UTF8VCLCommDlg.pas,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UTF8VCLCommDlg.pas 25 Mar 2007 15:55:19 -0000 1.1 --- UTF8VCLCommDlg.pas 28 Mar 2007 14:22:33 -0000 1.2 *************** *** 94,98 **** with OpenFileW do begin - lpstrFilter := nil; lpstrInitialDir := nil; --- 94,97 ---- *************** *** 168,172 **** with OpenFileW do begin - lpstrFilter := nil; lpstrInitialDir := nil; --- 167,170 ---- *************** *** 233,259 **** function GetFileTitleAIntercept(FileName: PAnsiChar; Title: PAnsiChar; TitleSize: Word): Smallint; stdcall; var ! fnw, titlebuf: PWideChar; ! x: PChar; begin ! fnw := nil; ! titlebuf := nil; try ! titlebuf := GetMemory(TitleSize * SizeOf(WideChar)); //utf16 won't ever take more then 2* as much space for a string then utf8 ! fnw := ConvertFromUTF8(FileName); ! Result := GetFileTitleW(fnw, titlebuf, TitleSize); if Result > 0 then Result := Result * 4; // ensure enough size is available if Result = 0 then begin ! x := ConvertToUTF8(titlebuf); try ! CopyMemory(Title, x, TitleSize); finally ! FreeMem(x); end; end; finally ! FreeMem(titlebuf); ! FreeMem(fnw); end; end; --- 231,257 ---- function GetFileTitleAIntercept(FileName: PAnsiChar; Title: PAnsiChar; TitleSize: Word): Smallint; stdcall; var ! WideFileName, TitleBuf: PWideChar; ! X: PChar; begin ! WideFileName := nil; ! TitleBuf := nil; try ! TitleBuf := GetMemory(TitleSize * SizeOf(WideChar)); //utf16 won't ever take more then 2* as much space for a string then utf8 ! WideFileName := ConvertFromUTF8(FileName); ! Result := GetFileTitleW(WideFileName, TitleBuf, TitleSize); if Result > 0 then Result := Result * 4; // ensure enough size is available if Result = 0 then begin ! X := ConvertToUTF8(TitleBuf); try ! CopyMemory(Title, X, TitleSize); finally ! FreeMem(X); end; end; finally ! FreeMem(TitleBuf); ! FreeMem(WideFileName); end; end; *************** *** 271,275 **** try CCW.lpTemplateName := ConvertFromUTF8(CC.lpTemplateName); ! CCW.lpfnHook := WndProcConvertW2U(Pointer(@CC.lpfnHook), Pointer(@StdWndProcInterceptU2W), Pointer(@StdWndProcInterceptW2U)); Result := ChooseColorW(CCW); CC.rgbResult := CCW.rgbResult; --- 269,274 ---- try CCW.lpTemplateName := ConvertFromUTF8(CC.lpTemplateName); ! CCW.lpfnHook := WndProcConvertW2U(Pointer(@CC.lpfnHook), ! Pointer(@StdWndProcInterceptU2W), Pointer(@StdWndProcInterceptW2U)); Result := ChooseColorW(CCW); CC.rgbResult := CCW.rgbResult; |