diff --git a/.gitattributes b/.gitattributes index a6f45e35ba..cff2889e03 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4159,6 +4159,7 @@ lcl/themes.pas svneol=native#text/pascal lcl/tmschema.pas svneol=native#text/pascal lcl/toolwin.pp svneol=native#text/pascal lcl/translations.pas svneol=native#text/pascal +lcl/utf8process.pp svneol=native#text/pascal lcl/utrace.pp svneol=native#text/pascal lcl/widgetset/README.txt svneol=native#text/plain lcl/widgetset/wsactnlist.pp svneol=native#text/pascal diff --git a/components/chmhelp/packages/help/lhelpcontrol.pas b/components/chmhelp/packages/help/lhelpcontrol.pas index ca3758b540..93d771ecf2 100644 --- a/components/chmhelp/packages/help/lhelpcontrol.pas +++ b/components/chmhelp/packages/help/lhelpcontrol.pas @@ -5,7 +5,7 @@ unit LHelpControl; interface uses - Classes, SysUtils, FileUtil, SimpleIPC, Process, AsyncProcess; + Classes, SysUtils, FileUtil, SimpleIPC, Process, UTF8Process; type TRequestType = (rtFile, rtUrl, rtContext); diff --git a/components/datadict/reglazdatadict.pp b/components/datadict/reglazdatadict.pp index a35270a8da..b74c902b03 100644 --- a/components/datadict/reglazdatadict.pp +++ b/components/datadict/reglazdatadict.pp @@ -6,7 +6,7 @@ interface uses // General units - Classes, SysUtils, Process, AsyncProcess, DB, Typinfo, + Classes, SysUtils, Process, UTF8Process, DB, Typinfo, // IDE interface MenuIntf, propedits, lresources, // Data dict units diff --git a/doceditor/fpdocupdater/mainunit.pas b/doceditor/fpdocupdater/mainunit.pas index c14688cb8d..8378b279d7 100644 --- a/doceditor/fpdocupdater/mainunit.pas +++ b/doceditor/fpdocupdater/mainunit.pas @@ -29,7 +29,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, FPDocFiles, StdCtrls, ComCtrls, FileUtil, ExtCtrls, - LCLIntf, LCLType, LCLProc, Process, AsyncProcess, EditBtn, Laz_XMLCfg; + LCLIntf, LCLType, LCLProc, Process, UTF8Process, EditBtn, Laz_XMLCfg; type diff --git a/doceditor/frmbuild.pp b/doceditor/frmbuild.pp index 9555d55ccf..779fe49102 100644 --- a/doceditor/frmbuild.pp +++ b/doceditor/frmbuild.pp @@ -29,7 +29,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, FileUtil, Buttons, ComCtrls, EditBtn, ExtCtrls, ActnList, Grids, Process, - AsyncProcess; + UTF8Process; type { TBuildForm } diff --git a/doceditor/frmmain.pp b/doceditor/frmmain.pp index 6c0a5ff51b..e9243f7428 100644 --- a/doceditor/frmmain.pp +++ b/doceditor/frmmain.pp @@ -29,7 +29,7 @@ interface uses Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, FileUtil, Menus, ActnList, ExtCtrls, ComCtrls, StdCtrls, pgeditor, - process, AsyncProcess, fpdeutil; + process, UTF8Process, fpdeutil; type TNodeType = (ntFile,ntPackage,ntModule,ntElement,ntTopic); diff --git a/examples/openbrowser/mainunit.pas b/examples/openbrowser/mainunit.pas index 1aaffef2b2..38df74b4b9 100644 --- a/examples/openbrowser/mainunit.pas +++ b/examples/openbrowser/mainunit.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, - FileUtil, AsyncProcess, Buttons, Process, ExtCtrls; + FileUtil, UTF8Process, Buttons, Process, ExtCtrls; type { TForm1 } diff --git a/ide/checkcompileropts.pas b/ide/checkcompileropts.pas index 5b26226b23..a738d27ffb 100644 --- a/ide/checkcompileropts.pas +++ b/ide/checkcompileropts.pas @@ -27,14 +27,14 @@ interface uses Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, FileUtil, Clipbrd, StdCtrls, Buttons, Process, AsyncProcess, Menus, ExtCtrls, + UTF8Process, ButtonPanel, // codetools KeywordFuncLists, CodeToolManager, FileProcs, // IDEIntf ProjectIntf, MacroIntf, IDEExternToolIntf, // IDE Project, PackageSystem, ExtToolEditDlg, IDEProcs, EnvironmentOpts, - LazarusIDEStrConsts, PackageDefs, CompilerOptions, TransferMacros, LazConf, - ButtonPanel; + LazarusIDEStrConsts, PackageDefs, CompilerOptions, TransferMacros, LazConf; type TCompilerOptionsTest = ( diff --git a/ide/compiler.pp b/ide/compiler.pp index c15b78933a..2519499fa9 100644 --- a/ide/compiler.pp +++ b/ide/compiler.pp @@ -40,7 +40,7 @@ interface uses Classes, SysUtils, Process, AsyncProcess, LCLProc, Forms, Controls, FileUtil, - LazarusIDEStrConsts, CompilerOptions, Project, OutputFilter; + LazarusIDEStrConsts, CompilerOptions, Project, OutputFilter, UTF8Process; type TOnCmdLineCreate = procedure(var CmdLine: string; var Abort:boolean) diff --git a/ide/exttooldialog.pas b/ide/exttooldialog.pas index 47394226b0..e603f6383f 100644 --- a/ide/exttooldialog.pas +++ b/ide/exttooldialog.pas @@ -41,7 +41,7 @@ uses {$ENDIF} Classes, SysUtils, Process, AsyncProcess, LCLType, LCLProc, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs, LResources, ExtCtrls, - LazConfigStorage, FileUtil, + LazConfigStorage, FileUtil, UTF8Process, IDEExternToolIntf, IDEImagesIntf, ExtToolEditDlg, IDECommands, KeyMapping, TransferMacros, IDEProcs, InfoBuild, CompilerOptions, OutputFilter, LazarusIDEStrConsts, ButtonPanel; diff --git a/ide/lazarusmanager.pas b/ide/lazarusmanager.pas index f73e182f93..abe7cd3617 100644 --- a/ide/lazarusmanager.pas +++ b/ide/lazarusmanager.pas @@ -81,7 +81,7 @@ uses {$IFDEF unix} BaseUnix, {$ENDIF} - Classes, SysUtils, Process, AsyncProcess, + Classes, SysUtils, Process, AsyncProcess, UTF8Process, LCLProc, FileUtil, Forms, Controls, Dialogs, LazConf, Splash; diff --git a/ide/main.pp b/ide/main.pp index b0c46444f6..c476cc9541 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -75,7 +75,7 @@ uses // lcl LCLProc, LCLMemManager, LCLType, LCLIntf, LConvEncoding, LMessages, LResources, StdCtrls, Forms, Buttons, Menus, FileUtil, Controls, GraphType, - HelpIntfs, Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl, + HelpIntfs, Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl, UTF8Process, // codetools LinkScanner, BasicCodeTools, AVL_Tree, Laz_XMLCfg, CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates, diff --git a/ide/outputfilter.pas b/ide/outputfilter.pas index 4c2af12bcc..9898e513f2 100644 --- a/ide/outputfilter.pas +++ b/ide/outputfilter.pas @@ -9,7 +9,7 @@ ***************************************************************************** * * - * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * * for details about the copyright. * * * * This program is distributed in the hope that it will be useful, * @@ -29,7 +29,7 @@ interface uses Classes, Math, SysUtils, Forms, Controls, Dialogs, CompilerOptions, - Process, AsyncProcess, LCLProc, DynQueue, FileUtil, + Process, AsyncProcess, LCLProc, DynQueue, FileUtil, UTF8Process, IDEDialogs, IDEMsgIntf, IDEExternToolIntf, IDEProcs, LazConf; diff --git a/lcl/alllclunits.pp b/lcl/alllclunits.pp index da7640d7a2..d51b6651df 100644 --- a/lcl/alllclunits.pp +++ b/lcl/alllclunits.pp @@ -51,7 +51,7 @@ uses Printers, PostScriptPrinter, PostScriptCanvas, CheckLst, PairSplitter, ExtDlgs, DBCtrls, DBGrids, DBActns, EditBtn, ExtGraphics, ColorBox, PropertyStorage, IniPropStorage, XMLPropStorage, Chart, LDockTree, LDockCtrl, - CalendarPopup, Themes, PopupNotifier, ShellCtrls, + CalendarPopup, Themes, PopupNotifier, ShellCtrls, UTF8Process, LCLMessageGlue, RubberBand, // widgetset skeleton diff --git a/lcl/asyncprocess.pp b/lcl/asyncprocess.pp index 4d368385e0..783fcacd15 100644 --- a/lcl/asyncprocess.pp +++ b/lcl/asyncprocess.pp @@ -28,40 +28,10 @@ unit AsyncProcess; interface uses - Classes, SysUtils, Process, LCLProc, FileUtil, InterfaceBase, LCLIntf; + Classes, SysUtils, Process, LCLProc, FileUtil, InterfaceBase, LCLIntf, UTF8Process; type - { TProcessUTF8 } - - TProcessUTF8 = class(TProcess) - private - FApplicationNameUTF8: string; - FCommandLineUTF8: string; - FConsoleTitleUTF8: string; - FCurrentDirectoryUTF8: string; - FDesktopUTF8: string; - FEnvironmentUTF8: TStrings; - procedure SetApplicationNameUTF8(const AValue: string); - procedure SetCommandLineUTF8(const AValue: string); - procedure SetConsoleTitleUTF8(const AValue: string); - procedure SetCurrentDirectoryUTF8(const AValue: string); - procedure SetDesktopUTF8(const AValue: string); - procedure SetEnvironmentUTF8(const AValue: TStrings); - procedure UpdateEnvironment; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Execute; override; - property ApplicationName: string read FApplicationNameUTF8 write SetApplicationNameUTF8; - property CommandLine: string read FCommandLineUTF8 write SetCommandLineUTF8; - property ConsoleTitle: string read FConsoleTitleUTF8 write SetConsoleTitleUTF8; - property CurrentDirectory: string read FCurrentDirectoryUTF8 write SetCurrentDirectoryUTF8; - property Desktop: string read FDesktopUTF8 write SetDesktopUTF8; - property Environment: TStrings read FEnvironmentUTF8 write SetEnvironmentUTF8; - end; - - { TAsyncProcess } TAsyncProcess = class(TProcessUTF8) @@ -87,7 +57,6 @@ type procedure Register; - implementation function TAsyncProcess.GetNumBytesAvailable: dword; @@ -143,86 +112,9 @@ begin FProcessHandler := AddProcessEventHandler(ProcessHandle, @HandleProcessTermination, 0); end; -{ TProcessUTF8 } - -procedure TProcessUTF8.SetApplicationNameUTF8(const AValue: string); -begin - if FApplicationNameUTF8=AValue then exit; - FApplicationNameUTF8:=AValue; - inherited ApplicationName:=UTF8ToSys(FApplicationNameUTF8); -end; - -procedure TProcessUTF8.SetCommandLineUTF8(const AValue: string); -begin - if FCommandLineUTF8=AValue then exit; - FCommandLineUTF8:=AValue; - inherited CommandLine:=UTF8ToSys(FCommandLineUTF8); -end; - -procedure TProcessUTF8.SetConsoleTitleUTF8(const AValue: string); -begin - if FConsoleTitleUTF8=AValue then exit; - FConsoleTitleUTF8:=AValue; - inherited ConsoleTitle:=UTF8ToSys(FConsoleTitleUTF8); -end; - -procedure TProcessUTF8.SetCurrentDirectoryUTF8(const AValue: string); -begin - if FCurrentDirectoryUTF8=AValue then exit; - FCurrentDirectoryUTF8:=AValue; - inherited CurrentDirectory:=UTF8ToSys(FCurrentDirectoryUTF8); -end; - -procedure TProcessUTF8.SetDesktopUTF8(const AValue: string); -begin - if FDesktopUTF8=AValue then exit; - FDesktopUTF8:=AValue; - inherited Desktop:=UTF8ToSys(FDesktopUTF8); -end; - -procedure TProcessUTF8.SetEnvironmentUTF8(const AValue: TStrings); -begin - if (FEnvironmentUTF8=AValue) - or ((AValue<>nil) and FEnvironmentUTF8.Equals(AValue)) then exit; - FEnvironmentUTF8.Assign(AValue); -end; - -procedure TProcessUTF8.UpdateEnvironment; -var - sl: TStringList; - i: Integer; -begin - sl:=TStringList.Create; - try - for i:=0 to FEnvironmentUTF8.Count-1 do - sl.Add(UTF8ToSys(FEnvironmentUTF8[i])); - inherited Environment:=sl; - finally - sl.Free; - end; -end; - -constructor TProcessUTF8.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FEnvironmentUTF8:=TStringList.Create; -end; - -destructor TProcessUTF8.Destroy; -begin - FreeAndNil(FEnvironmentUTF8); - inherited Destroy; -end; - -procedure TProcessUTF8.Execute; -begin - UpdateEnvironment; - inherited Execute; -end; - procedure Register; begin - RegisterComponents('System',[TProcessUTF8,TAsyncProcess]); + RegisterComponents('System',[TAsyncProcess]); end; end. diff --git a/lcl/lazhelphtml.pas b/lcl/lazhelphtml.pas index be4b696a6b..063be5997e 100644 --- a/lcl/lazhelphtml.pas +++ b/lcl/lazhelphtml.pas @@ -22,7 +22,7 @@ unit LazHelpHTML; interface uses - Classes, SysUtils, LCLProc, Forms, Process, FileUtil, AsyncProcess, + Classes, SysUtils, LCLProc, Forms, Process, FileUtil, UTF8Process, LazConfigStorage, LCLStrConsts, HelpIntfs, LazHelpIntf; type diff --git a/lcl/utf8process.pp b/lcl/utf8process.pp new file mode 100644 index 0000000000..812ba05989 --- /dev/null +++ b/lcl/utf8process.pp @@ -0,0 +1,149 @@ +{ + /*************************************************************************** + UTF8Process.pp + --------------- + Initial Revision : Tue Dec 06 09:00:00 CET 2005 + + + ***************************************************************************/ + + ***************************************************************************** + * * + * This file is part of the Lazarus Component Library (LCL) * + * * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * for details about the copyright. * + * * + * This program 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. * + * * + ***************************************************************************** +} + +unit UTF8Process; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Process, LCLProc, FileUtil; + +type + { TProcessUTF8 } + + TProcessUTF8 = class(TProcess) + private + FApplicationNameUTF8: string; + FCommandLineUTF8: string; + FConsoleTitleUTF8: string; + FCurrentDirectoryUTF8: string; + FDesktopUTF8: string; + FEnvironmentUTF8: TStrings; + procedure SetApplicationNameUTF8(const AValue: string); + procedure SetCommandLineUTF8(const AValue: string); + procedure SetConsoleTitleUTF8(const AValue: string); + procedure SetCurrentDirectoryUTF8(const AValue: string); + procedure SetDesktopUTF8(const AValue: string); + procedure SetEnvironmentUTF8(const AValue: TStrings); + procedure UpdateEnvironment; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Execute; override; + property ApplicationName: string read FApplicationNameUTF8 write SetApplicationNameUTF8; + property CommandLine: string read FCommandLineUTF8 write SetCommandLineUTF8; + property ConsoleTitle: string read FConsoleTitleUTF8 write SetConsoleTitleUTF8; + property CurrentDirectory: string read FCurrentDirectoryUTF8 write SetCurrentDirectoryUTF8; + property Desktop: string read FDesktopUTF8 write SetDesktopUTF8; + property Environment: TStrings read FEnvironmentUTF8 write SetEnvironmentUTF8; + end; + +procedure Register; + +implementation + +{ TProcessUTF8 } + +procedure TProcessUTF8.SetApplicationNameUTF8(const AValue: string); +begin + if FApplicationNameUTF8=AValue then exit; + FApplicationNameUTF8:=AValue; + inherited ApplicationName:=UTF8ToSys(FApplicationNameUTF8); +end; + +procedure TProcessUTF8.SetCommandLineUTF8(const AValue: string); +begin + if FCommandLineUTF8=AValue then exit; + FCommandLineUTF8:=AValue; + inherited CommandLine:=UTF8ToSys(FCommandLineUTF8); +end; + +procedure TProcessUTF8.SetConsoleTitleUTF8(const AValue: string); +begin + if FConsoleTitleUTF8=AValue then exit; + FConsoleTitleUTF8:=AValue; + inherited ConsoleTitle:=UTF8ToSys(FConsoleTitleUTF8); +end; + +procedure TProcessUTF8.SetCurrentDirectoryUTF8(const AValue: string); +begin + if FCurrentDirectoryUTF8=AValue then exit; + FCurrentDirectoryUTF8:=AValue; + inherited CurrentDirectory:=UTF8ToSys(FCurrentDirectoryUTF8); +end; + +procedure TProcessUTF8.SetDesktopUTF8(const AValue: string); +begin + if FDesktopUTF8=AValue then exit; + FDesktopUTF8:=AValue; + inherited Desktop:=UTF8ToSys(FDesktopUTF8); +end; + +procedure TProcessUTF8.SetEnvironmentUTF8(const AValue: TStrings); +begin + if (FEnvironmentUTF8=AValue) + or ((AValue<>nil) and FEnvironmentUTF8.Equals(AValue)) then exit; + FEnvironmentUTF8.Assign(AValue); +end; + +procedure TProcessUTF8.UpdateEnvironment; +var + sl: TStringList; + i: Integer; +begin + sl:=TStringList.Create; + try + for i:=0 to FEnvironmentUTF8.Count-1 do + sl.Add(UTF8ToSys(FEnvironmentUTF8[i])); + inherited Environment:=sl; + finally + sl.Free; + end; +end; + +constructor TProcessUTF8.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FEnvironmentUTF8:=TStringList.Create; +end; + +destructor TProcessUTF8.Destroy; +begin + FreeAndNil(FEnvironmentUTF8); + inherited Destroy; +end; + +procedure TProcessUTF8.Execute; +begin + UpdateEnvironment; + inherited Execute; +end; + +procedure Register; +begin + RegisterComponents('System',[TProcessUTF8]); +end; + +end. diff --git a/packager/pkgfileslcl.inc b/packager/pkgfileslcl.inc index 4ee5e9062e..243a287af5 100644 --- a/packager/pkgfileslcl.inc +++ b/packager/pkgfileslcl.inc @@ -81,6 +81,7 @@ AddFile('textstrings.pas','TextStrings',pftUnit,[],cpBase); AddFile('toolwin.pp','Toolwin',pftUnit,[],cpBase); AddFile('translations.pas','Translations',pftUnit,[],cpBase); AddFile('utrace.pp','UTrace',pftUnit,[],cpBase); +AddFile('utf8process.pp','UTF8Process',pftUnit,[pffHasRegisterProc],cpBase); AddFile('widgetset/wsactnlist.pp','WSActnList',pftUnit,[],cpBase); AddFile('widgetset/wsarrow.pp','WSArrow',pftUnit,[],cpBase); AddFile('widgetset/wsbuttons.pp','WSButtons',pftUnit,[],cpBase); diff --git a/packager/registerlcl.pas b/packager/registerlcl.pas index fed784bf1b..2a42e3ca41 100644 --- a/packager/registerlcl.pas +++ b/packager/registerlcl.pas @@ -43,7 +43,7 @@ uses Dialogs, Spin, Arrow, Calendar, MaskEdit, CheckLst, PairSplitter, ExtDlgs, StdActns, DBCtrls, DBGrids, DBActns, EditBtn, ActnList, FileCtrl, ButtonPanel, LResources, XMLPropStorage, IniPropStorage, Graphics, Chart, ColorBox, - LazHelpHTML, PopupNotifier, AsyncProcess, ShellCtrls; + LazHelpHTML, PopupNotifier, AsyncProcess, UTF8Process, ShellCtrls; procedure Register; @@ -84,6 +84,7 @@ begin RegisterUnit('LazHelpHTML',@LazHelpHTML.Register); RegisterUnit('PopupNotifier', @PopupNotifier.Register); RegisterUnit('AsyncProcess', @AsyncProcess.Register); + RegisterUnit('UTF8Process', @UTF8Process.Register); RegisterUnit('ShellCtrls', @ShellCtrls.Register); end; diff --git a/test/bugtestcase.pas b/test/bugtestcase.pas index c5ec0f13b2..537a8a3fc7 100644 --- a/test/bugtestcase.pas +++ b/test/bugtestcase.pas @@ -24,7 +24,7 @@ interface uses Classes, SysUtils, Math, process, fpcunit, testregistry, - FileUtil, AsyncProcess, InterfaceBase, + FileUtil, UTF8Process, InterfaceBase, TestGlobals; type diff --git a/test/testlpi.pas b/test/testlpi.pas index d27deac5d1..08af042824 100644 --- a/test/testlpi.pas +++ b/test/testlpi.pas @@ -23,7 +23,7 @@ unit TestLpi; interface uses - Classes, SysUtils, strutils, fpcunit, testregistry, process, AsyncProcess, + Classes, SysUtils, strutils, fpcunit, testregistry, process, UTF8Process, InterfaceBase, FileUtil, TestGlobals; diff --git a/tools/svn2revisioninc.lpi b/tools/svn2revisioninc.lpi index 16a2211bc2..5f6e877f0b 100644 --- a/tools/svn2revisioninc.lpi +++ b/tools/svn2revisioninc.lpi @@ -1,12 +1,13 @@ - - + + + + - diff --git a/tools/svn2revisioninc.pas b/tools/svn2revisioninc.pas index 273181098b..5570b2161c 100644 --- a/tools/svn2revisioninc.pas +++ b/tools/svn2revisioninc.pas @@ -46,7 +46,7 @@ program Svn2RevisionInc; {$mode objfpc}{$H+} uses - Classes, CustApp, SysUtils, Process, AsyncProcess, LCLProc, FileUtil, + Classes, CustApp, SysUtils, Process, UTF8Process, LCLProc, FileUtil, Dom, XmlRead, GetOpts; type