diff --git a/components/ideintf/toolbarintf.pas b/components/ideintf/toolbarintf.pas index 1595cd64ee..266a82d54b 100644 --- a/components/ideintf/toolbarintf.pas +++ b/components/ideintf/toolbarintf.pas @@ -19,6 +19,8 @@ uses Classes, // LCL Controls, ComCtrls, Menus, + // LazUtils + LazUTF8, // IdeIntf IDECommands, MenuIntf, IDEImagesIntf, SrcEditorIntf; @@ -120,8 +122,8 @@ type TIDEToolButtonCategories = class private - FButtonNames: TStringList; - FCategories: TStringList; + FButtonNames: TStringListUTF8Fast; + FCategories: TStringListUTF8Fast; function GetItems(Index: Integer): TIDEToolButtonCategory; public constructor Create; @@ -530,10 +532,10 @@ end; constructor TIDEToolButtonCategories.Create; begin - FButtonNames := TStringList.Create; + FButtonNames := TStringListUTF8Fast.Create; FButtonNames.Sorted := True; FButtonNames.Duplicates := dupIgnore; - FCategories := TStringList.Create; + FCategories := TStringListUTF8Fast.Create; FCategories.Sorted := True; FCategories.Duplicates := dupIgnore; FCategories.OwnsObjects := True; diff --git a/components/synedit/syncompletion.pas b/components/synedit/syncompletion.pas index 8048f2a53f..b71768ed68 100644 --- a/components/synedit/syncompletion.pas +++ b/components/synedit/syncompletion.pas @@ -44,10 +44,14 @@ unit SynCompletion; interface uses - LCLProc, LCLIntf, LCLType, LazUTF8, LMessages, Classes, Graphics, Forms, - Controls, StdCtrls, ExtCtrls, Menus, SysUtils, types, Themes, - SynEditMiscProcs, SynEditKeyCmds, SynEdit, SynEditTypes, SynEditPlugins - {$IF FPC_FULLVERSION >= 20701}, character{$ENDIF}; + Classes, SysUtils, Types, Character, + // LCL + LCLProc, LCLIntf, LCLType, LMessages, Graphics, Forms, + Controls, StdCtrls, ExtCtrls, Menus, Themes, + // LazUtils + LazUTF8, + // SynEdit + SynEditMiscProcs, SynEditKeyCmds, SynEdit, SynEditTypes, SynEditPlugins; type TSynBaseCompletionPaintItem = @@ -1152,8 +1156,8 @@ begin end; end else begin for i := 0 to Pred(ItemList.Count) do - if 0 = WideCompareText(UTF8Decode(fCurrentString), - UTF8Decode(Copy(ItemList[i], 1, Length(fCurrentString)))) + if 0 = UTF8CompareLatinTextFast(fCurrentString, + Copy(ItemList[i], 1, Length(fCurrentString))) then begin Position := i; break; diff --git a/converter/chgencodingdlg.pas b/converter/chgencodingdlg.pas index 276b9a0a52..692882e49a 100644 --- a/converter/chgencodingdlg.pas +++ b/converter/chgencodingdlg.pas @@ -37,7 +37,7 @@ uses // CodeTools CodeCache, CodeToolManager, FileProcs, // LazUtils - LConvEncoding, LazFileUtils, LazFileCache, LazStringUtils, AvgLvlTree, + LConvEncoding, LazFileUtils, LazFileCache, LazStringUtils, LazUTF8, AvgLvlTree, // IDEIntf IDEWindowIntf, SrcEditorIntf, IDEHelpIntf, IDEImagesIntf, // IDE @@ -97,7 +97,7 @@ end; procedure TChgEncodingDialog.FormCreate(Sender: TObject); var - List: TStringList; + List: TStringListUTF8Fast; Encoding: string; i: Integer; begin @@ -126,7 +126,7 @@ begin PreviewListView.Column[1].Caption:=uemEncoding; // get possible encodings - List:=TStringList.Create; + List:=TStringListUTF8Fast.Create; GetSupportedEncodings(List); for i:=List.Count-1 downto 0 do begin Encoding:=List[i]; @@ -139,7 +139,7 @@ begin NewEncodingComboBox.Text:='UTF-8'; // get possible filters - List:=TStringList.Create; + List:=TStringListUTF8Fast.Create; List.Add('*.pas;*.pp;*.p;*.inc;*.lpr;*.lfm;*.lrs;*.txt'); List.Sort; FileFilterCombobox.Items.Assign(List); @@ -147,7 +147,7 @@ begin FileFilterCombobox.Text:=FileFilterCombobox.Items[0]; // get possible projects and packages - List:=TStringList.Create; + List:=TStringListUTF8Fast.Create; for i:=0 to PackageGraph.Count-1 do if (List.IndexOf(PackageGraph[i].Name)<0) and (not PackageGraph[i].ReadOnly) diff --git a/converter/convcodetool.pas b/converter/convcodetool.pas index 4fb8d9dec5..1729babc70 100644 --- a/converter/convcodetool.pas +++ b/converter/convcodetool.pas @@ -84,7 +84,7 @@ type fResAction: TResAction; fAddUnitEvent: TAddUnitEvent; // Delphi Function names to replace with FCL/LCL functions. - fDefinedProcNames: TStringList; + fDefinedProcNames: TStringMap; // List of TFuncReplacement. fFuncsToReplace: TObjectList; @@ -667,7 +667,7 @@ var var FuncDefInfo, FuncCallInfo: TFuncReplacement; IdentName: string; - i, x, IdentEndPos, IdentLen: Integer; + i, IdentEndPos, IdentLen: Integer; begin IdentEndPos:=xStart; with fCTLink.CodeTool, fCTLink.Settings do @@ -679,7 +679,7 @@ var StrMove(PChar(IdentName), @Src[xStart], IdentLen); // Don't try to uselessly find short identifiers if (IdentLen'Ptr') then Exit; - if fDefinedProcNames.Find(IdentName, x) then Exit; + if fDefinedProcNames.Contains(IdentName) then Exit; if not ReplaceFuncs.Funcs.Find(IdentName, i) then Exit; // Now function name is found in replacement list, get function info. FuncDefInfo:=ReplaceFuncs.FuncAtInd(i); @@ -801,9 +801,7 @@ begin Result:=false; with fCTLink.CodeTool do begin fFuncsToReplace:=TObjectList.Create; - fDefinedProcNames:=TStringList.Create; - fDefinedProcNames.Sorted:=True; - fDefinedProcNames.Duplicates:=dupIgnore; + fDefinedProcNames:=TStringMap.Create(False); ActivateGlobalWriteLock; try BuildTree(lsrEnd); diff --git a/converter/convertdelphi.pas b/converter/convertdelphi.pas index 72be2aa201..2e6002e71d 100644 --- a/converter/convertdelphi.pas +++ b/converter/convertdelphi.pas @@ -135,7 +135,7 @@ type // The user selected path when searching missing units. fPrevSelectedPath: string; // Missing units that are commented automatically in all units. - fAllCommentedUnits: TStringList; + fAllCommentedUnits: TStringListUTF8Fast; function DoMissingUnits({%H-}AUsedUnitsTool: TUsedUnitsTool): integer; virtual; function GetCachedUnitPath(const AUnitName: string): string; protected @@ -177,10 +177,10 @@ type // Main unit with resource code fMainUnitConverter: TDelphiUnit; // Unit search path for project settings. - fUnitSearchPaths: TStringList; + fUnitSearchPaths: TStringListUTF8Fast; // Units that are found and will be added to project or package and converted. - fUnitsToAddToProject: TStringList; - fFilesToDelete: TStringList; + fUnitsToAddToProject: TStringListUTF8Fast; + fFilesToDelete: TStringListUTF8Fast; fUseThreads: boolean; // The project/package uses TThread. function ConvertSub: TModalResult; procedure CleanUpCompilerOptionsSearchPaths(Options: TBaseCompilerOptions); @@ -957,16 +957,16 @@ constructor TConvertDelphiProjPack.Create(const AFilename, ADescription: string) begin inherited Create(AFilename, ADescription); fUseThreads:=False; - fUnitSearchPaths:=TStringList.Create; + fUnitSearchPaths:=TStringListUTF8Fast.Create; fUnitSearchPaths.Delimiter:=';'; fUnitSearchPaths.StrictDelimiter:=True; fCachedUnitNames:=TStringToStringTree.Create(False); fCachedRealFileNames:=TStringToStringTree.Create(True); - fAllCommentedUnits:=TStringList.Create; + fAllCommentedUnits:=TStringListUTF8Fast.Create; fAllCommentedUnits.Sorted:=True; - fUnitsToAddToProject:=TStringList.Create; + fUnitsToAddToProject:=TStringListUTF8Fast.Create; fUnitsToAddToProject.Sorted:=True; - fFilesToDelete:=TStringList.Create; + fFilesToDelete:=TStringListUTF8Fast.Create; fFilesToDelete.Sorted:=True; fMainUnitConverter:=nil; end; @@ -1384,7 +1384,6 @@ begin // Delete from file system because compiler would find it otherwise. if not DeleteFileUTF8(s) then exit(mrCancel); - //fFilesToDelete.Delete(i); fSettings.AddLogLine(mluNote, Format(lisConvDeletedFile,[s])); end; end; diff --git a/converter/replacenamesunit.pas b/converter/replacenamesunit.pas index 4702b54577..3aaedd3eb5 100644 --- a/converter/replacenamesunit.pas +++ b/converter/replacenamesunit.pas @@ -20,7 +20,7 @@ type TStringMapUpdater = class private fStringToStringMap: TStringToStringTree; - fSeenNames: TStringList; + fSeenNames: TStringMap; public constructor Create(AStringToStringMap: TStringToStringTree); destructor Destroy; override; @@ -204,7 +204,7 @@ end; constructor TStringMapUpdater.Create(AStringToStringMap: TStringToStringTree); begin fStringToStringMap:=AStringToStringMap; - fSeenNames:=TStringList.Create; + fSeenNames:=TStringMap.Create(False); end; destructor TStringMapUpdater.Destroy; @@ -272,7 +272,7 @@ function TGridUpdater.AddUnique(AOldIdent: string): string; // Add a new Delphi -> Lazarus mapping to the grid. // Returns the replacement string. begin - if fSeenNames.IndexOf(AOldIdent)<0 then begin + if not fSeenNames.Contains(AOldIdent) then begin // Add only one instance of each name. fSeenNames.Add(AOldIdent); FindReplacement(AOldIdent, Result); diff --git a/debugger/breakpropertydlg.pas b/debugger/breakpropertydlg.pas index 6fea698cab..9e45228096 100644 --- a/debugger/breakpropertydlg.pas +++ b/debugger/breakpropertydlg.pas @@ -8,6 +8,8 @@ uses Classes, SysUtils, // LCL Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, ButtonPanel, EditBtn, Spin, + // LazUtils + LazUTF8, // IdeIntf IDEHelpIntf, // DebuggerIntf @@ -203,12 +205,12 @@ var ws: TDBGWatchPointScope; wk: TDBGWatchPointKind; i: SizeInt; - EnableGroupList, DisableGroupList: TStringList; + EnableGroupList, DisableGroupList: TStringListUTF8Fast; begin if FBreakpoint = nil then Exit; - EnableGroupList := TStringList.Create; - DisableGroupList := TStringList.Create; + EnableGroupList := TStringListUTF8Fast.Create; + DisableGroupList := TStringListUTF8Fast.Create; try EnableGroupList.Delimiter := ';'; diff --git a/debugger/breakpropertydlggroups.pas b/debugger/breakpropertydlggroups.pas index 7b437a57ed..cc49639e7a 100644 --- a/debugger/breakpropertydlggroups.pas +++ b/debugger/breakpropertydlggroups.pas @@ -8,6 +8,8 @@ uses Classes, // LCL Forms, Controls, ButtonPanel, StdCtrls, CheckLst, + // LazUtils + LazUTF8, // IDE Debugger, LazarusIDEStrConsts; @@ -23,7 +25,7 @@ type Label1: TLabel; protected FBrkPointPoint: TIDEBreakPoint; - FGroupList: TStringList; + FGroupList: TStringListUTF8Fast; FAvailableGroups: TIDEBreakPointGroups; public { public declarations } @@ -75,7 +77,7 @@ begin inherited Create(nil); FBrkPointPoint := ABrkPointPoint; FAvailableGroups := AAvailableGroups; - FGroupList := TStringList.Create; + FGroupList := TStringListUTF8Fast.Create; FGroupList.Delimiter := ';'; FGroupList.DelimitedText := AGroupList; diff --git a/debugger/frames/debugger_class_options.pas b/debugger/frames/debugger_class_options.pas index 32aa1b191c..7144c6197a 100644 --- a/debugger/frames/debugger_class_options.pas +++ b/debugger/frames/debugger_class_options.pas @@ -29,7 +29,7 @@ uses // LCL Forms, Controls, StdCtrls, ExtCtrls, Buttons, Dialogs, ComCtrls, Menus, // LazUtils - FileUtil, LazFileUtils, LazStringUtils, LazFileCache, LazLoggerBase, + FileUtil, LazFileUtils, LazStringUtils, LazFileCache, LazLoggerBase, LazUTF8, // DebuggerIntf DbgIntfDebuggerBase, // IdeIntf @@ -294,11 +294,11 @@ end; procedure TDebuggerClassOptionsFrame.FillDebuggerClassDropDown; var - List: TStringList; + List: TStringListUTF8Fast; i: Integer; d: TDebuggerClass; begin - List := TStringList.Create; + List := TStringListUTF8Fast.Create; for i := 0 to TBaseDebugManagerIntf.DebuggerCount - 1 do begin d := TBaseDebugManagerIntf.Debuggers[i]; List.AddObject(d.Caption, TObject(d)); diff --git a/debugger/localsdlg.pp b/debugger/localsdlg.pp index 50a3793385..b0d7212854 100644 --- a/debugger/localsdlg.pp +++ b/debugger/localsdlg.pp @@ -36,9 +36,17 @@ unit LocalsDlg; interface uses - SysUtils, Classes, Forms, ClipBrd, LCLProc, LazLoggerBase, strutils, - IDEWindowIntf, DebuggerStrConst, ComCtrls, ActnList, Menus, BaseDebugManager, - Debugger, DebuggerDlg, DbgIntfDebuggerBase; + SysUtils, Classes, StrUtils, + // LCL + Forms, ClipBrd, ComCtrls, ActnList, Menus, + // LazUtils + LazLoggerBase, LazUTF8, + // IdeIntf + IDEWindowIntf, + // DebuggerIntf + DbgIntfDebuggerBase, + // IDE + DebuggerStrConst, BaseDebugManager, Debugger, DebuggerDlg; type @@ -387,7 +395,7 @@ end; procedure TLocalsDlg.LocalsChanged(Sender: TObject); var n, idx: Integer; - List: TStringList; + List: TStringListUTF8Fast; Item: TListItem; S: String; Locals: TIDELocals; @@ -422,7 +430,7 @@ begin Caption:= lisLocals; end; - List := TStringList.Create; + List := TStringListUTF8Fast.Create; try BeginUpdate; try diff --git a/debugger/registersdlg.pp b/debugger/registersdlg.pp index 0422a1952f..52b8a80fd1 100644 --- a/debugger/registersdlg.pp +++ b/debugger/registersdlg.pp @@ -36,10 +36,17 @@ unit RegistersDlg; interface uses - SysUtils, Classes, Controls, Forms, Clipbrd, - BaseDebugManager, IDEWindowIntf, DebuggerStrConst, - ComCtrls, ActnList, Menus, Grids, Debugger, DebuggerDlg, - LazarusIDEStrConsts, IDEImagesIntf, DbgIntfDebuggerBase, Types; + SysUtils, Classes, Types, + // LCL + Controls, Forms, Clipbrd, ComCtrls, ActnList, Menus, Grids, + // LazUtils + LazUTF8, + // IdeIntf + IDEWindowIntf, IDEImagesIntf, + // DebuggerIntf + DbgIntfDebuggerBase, + // IDE + BaseDebugManager, LazarusIDEStrConsts, DebuggerStrConst, Debugger, DebuggerDlg; type @@ -446,7 +453,7 @@ end; procedure TRegistersDlg.RegistersChanged(Sender: TObject); var n, i, idx, Cnt: Integer; - List: TStringList; + List: TStringListUTF8Fast; S: String; Reg: TRegisters; begin @@ -472,7 +479,7 @@ begin exit; end; - List := TStringList.Create; + List := TStringListUTF8Fast.Create; try //Get existing items for n := 1 to lvRegisters.RowCount - 1 do diff --git a/designer/anchoreditor.pas b/designer/anchoreditor.pas index 31a7270fe9..94eba5e6b4 100644 --- a/designer/anchoreditor.pas +++ b/designer/anchoreditor.pas @@ -39,7 +39,7 @@ uses // LCL Forms, Controls, Dialogs, StdCtrls, Buttons, Spin, ExtCtrls, Graphics, // LazUtils - LazUtilities, + LazUtilities, LazUTF8, // IdeIntf IDECommands, PropEdits, IDEDialogs, IDEImagesIntf, // IDE @@ -937,7 +937,7 @@ end; procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox); var - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; CurControl: TControl; j: Integer; @@ -961,7 +961,7 @@ var end; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; sl.Add(AnchorDesignerNoSiblingText); HasSelectedSiblings:=false; SelectedControls:=GetSelectedControls; diff --git a/designer/menushortcutdisplay.pas b/designer/menushortcutdisplay.pas index 4f883f9593..4a35558b9b 100644 --- a/designer/menushortcutdisplay.pas +++ b/designer/menushortcutdisplay.pas @@ -24,7 +24,7 @@ type strict private FLastSortIndex: integer; FMenu: TMenu; - FscList: TStringList; + FscList: TStringListUTF8Fast; FSingleMenuOnly: boolean; FShortcutsOnly: boolean; FShortcuts: TMenuShortcuts; @@ -371,7 +371,7 @@ var begin Assert(FMenu<>nil,'TShortcutDisplayDlg.UpdateFromMenu: FMenu is nil'); FreeAndNil(FscList); - FscList:=TStringList.Create; + FscList:=TStringListUTF8Fast.Create; FscList.CaseSensitive:=False; FDualDisplay.ClearContents; for i:=0 to FMenu.Items.Count-1 do diff --git a/ide/buildmodediffdlg.pas b/ide/buildmodediffdlg.pas index e1a239cea3..f7b29ced6a 100644 --- a/ide/buildmodediffdlg.pas +++ b/ide/buildmodediffdlg.pas @@ -108,10 +108,10 @@ end; procedure TBuildModeDiffDialog.FillModeComboBox; var - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try if BuildModes<>nil then for i:=0 to BuildModes.Count-1 do diff --git a/ide/checkcompileropts.pas b/ide/checkcompileropts.pas index 51ff535a53..175d3c5d45 100644 --- a/ide/checkcompileropts.pas +++ b/ide/checkcompileropts.pas @@ -205,11 +205,12 @@ begin FOptions:=AValue; end; -procedure TCheckCompilerOptsDlg.SetMsgDirectory(Index: integer; - const CurDir: string); +procedure TCheckCompilerOptsDlg.SetMsgDirectory(Index: integer; const CurDir: string); begin - if FDirectories=nil then FDirectories:=TStringList.Create; - while FDirectories.Count<=Index do FDirectories.Add(''); + if FDirectories=nil then + FDirectories:=TStringList.Create; + while FDirectories.Count<=Index do + FDirectories.Add(''); FDirectories[Index]:=CurDir; end; @@ -694,13 +695,13 @@ var p: Integer; Directory: String; FileInfo: TSearchRec; - WarnedDirectories: TStringList; + WarnedDirectories: TStringListUTF8Fast; begin FTest:=cotCheckFPCUnitPathsContainSources; LabelTest.Caption:=dlgCCOTestSrcInPPUPaths; Result:=mrCancel; - WarnedDirectories:=TStringList.Create; + WarnedDirectories:=TStringListUTF8Fast.Create; p:=1; while p<=length(FPCCfgUnitPath) do begin Directory:=TrimFilename(GetNextDirectoryInSearchPath(FPCCfgUnitPath,p)); diff --git a/ide/checkcompoptsfornewunitdlg.pas b/ide/checkcompoptsfornewunitdlg.pas index c7d2b9aa2f..2b1c3c8a18 100644 --- a/ide/checkcompoptsfornewunitdlg.pas +++ b/ide/checkcompoptsfornewunitdlg.pas @@ -156,18 +156,13 @@ end; procedure TCheckCompOptsForNewUnitDialog.FormCreate(Sender: TObject); var - sl: TStringList; i: Integer; begin Caption:=lisDirectivesForNewUnit; ButtonPanel1.OKButton.Caption:=lisContinue; - ModeLabel.Caption:=lisSyntaxMode; - sl:=TStringList.Create; for i:=low(FPCSyntaxModes) to high(FPCSyntaxModes) do - sl.Add(FPCSyntaxModes[i]); - ModeComboBox.Items.Assign(sl); - sl.Free; + ModeComboBox.Items.Add(FPCSyntaxModes[i]); AnsistringCheckBox.Caption:=lisUseAnsistrings; DoNotWarnCheckBox.Caption:=lisDoNotShowThisDialogForThisProject; end; diff --git a/ide/cleandirdlg.pas b/ide/cleandirdlg.pas index 61c310f8f4..306ce1d481 100644 --- a/ide/cleandirdlg.pas +++ b/ide/cleandirdlg.pas @@ -402,10 +402,8 @@ begin finally RemoveFilterRegExpr.Free; KeepFilterRegExpr.Free; - if not Result then begin - List.Free; - List:=nil; - end; + if not Result then + FreeAndNil(List); end; end; diff --git a/ide/codebrowser.pas b/ide/codebrowser.pas index c12fbf1875..151d0ccf4d 100644 --- a/ide/codebrowser.pas +++ b/ide/codebrowser.pas @@ -54,7 +54,7 @@ uses BasicCodeTools, DefineTemplates, CodeTree, CodeCache, CodeToolManager, PascalParserTool, LinkScanner, FileProcs, CodeIndex, StdCodeTools, SourceLog, // LazUtils - LazFileUtils, LazStringUtils, AvgLvlTree, + LazFileUtils, LazStringUtils, LazUTF8, AvgLvlTree, // IDEIntf IDEWindowIntf, SrcEditorIntf, IDEMsgIntf, IDEDialogs, LazConfigStorage, IDEHelpIntf, PackageIntf, IDECommands, LazIDEIntf, IDEExternToolIntf, @@ -782,11 +782,11 @@ end; procedure TCodeBrowserView.FillScopeComboBox; var - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; begin if ScopeComboBox.Items.Count=0 then begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try if PackageGraph<>nil then begin for i:=0 to PackageGraph.Count-1 do diff --git a/ide/codehelp.pas b/ide/codehelp.pas index 7a991c4565..9c7df17468 100644 --- a/ide/codehelp.pas +++ b/ide/codehelp.pas @@ -2792,7 +2792,6 @@ var I, J, LeftMost : Integer; begin try - Lines := nil; Lines := TStringList.Create; Lines.Text := Comment; diff --git a/ide/codetemplatesdlg.pas b/ide/codetemplatesdlg.pas index 2ada23591b..df6040673e 100644 --- a/ide/codetemplatesdlg.pas +++ b/ide/codetemplatesdlg.pas @@ -36,7 +36,7 @@ uses LCLProc, Forms, Controls, Dialogs, ClipBrd, StdCtrls, ExtCtrls, Menus, ButtonPanel, EditBtn, // LazUtils - FileUtil, LazFileUtils, LazLoggerBase, LazStringUtils, + FileUtil, LazFileUtils, LazLoggerBase, LazStringUtils, LazUTF8, // synedit SynEdit, SynHighlighterPas, SynEditAutoComplete, // codetools @@ -654,9 +654,8 @@ begin lastword:=re.MatchPos[0]; until (not re.ExecNext); end; - s:=st[st.count-1]; - st.Delete(st.count-1); - st.Insert(0,s); + if st.Count>1 then + st.Move(st.count-1, 0); if(iParam<0)then begin p.X:=SrcEdit.CursorTextXY.x; @@ -1069,9 +1068,9 @@ end; procedure TCodeTemplateDialog.FillCodeTemplateListBox; var a: PtrInt; - sl: TStringList; + sl: TStringListUTF8Fast; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try for a:=0 to SynAutoComplete.Completions.Count-1 do begin // Add the index in SynAutoComplete as Object, since both indexes won't diff --git a/ide/compiler.pp b/ide/compiler.pp index 964a38661c..f0753f97e5 100644 --- a/ide/compiler.pp +++ b/ide/compiler.pp @@ -183,7 +183,7 @@ type fInvalidOptions: TStringList; // and will be included in output. // List of categories parsed from "fpc -i". Contains category names, // Objects[] contains another StringList for the selection list. - fSupportedCategories: TStringList; + fSupportedCategories: TStringListUTF8Fast; // Hierarchy of options parsed from "fpc -h". fRootOptGroup: TCompilerOptGroup; fCompilerExecutable: string; // Compiler path must be set by caller. @@ -938,7 +938,7 @@ begin inherited Create; fDefines := TStringList.Create; fInvalidOptions := TStringList.Create; - fSupportedCategories := TStringList.Create; + fSupportedCategories := TStringListUTF8Fast.Create; fSupportedCategories.Sorted := True; fGeneratedOptions := TStringList.Create; fRootOptGroup := TCompilerOptGroup.Create(Self, Nil); diff --git a/ide/componentlist.pas b/ide/componentlist.pas index 1fb0201f17..84471ba930 100644 --- a/ide/componentlist.pas +++ b/ide/componentlist.pas @@ -37,7 +37,7 @@ uses LCLType, Forms, Controls, Graphics, StdCtrls, ExtCtrls, ComCtrls, Menus, Buttons, Dialogs, ImgList, // LazUtils - LazLoggerBase, + LazLoggerBase, LazUTF8, // LazControls TreeFilterEdit, // IdeIntf @@ -94,7 +94,7 @@ type private PrevChangeStamp: Integer; // List for Component inheritence view - FClassList: TStringList; + FClassList: TStringListUTF8Fast; FKeepSelected: Boolean; FInitialized: Boolean; FIgnoreSelection: Boolean; @@ -398,13 +398,12 @@ begin ListTree.BeginUpdate; PalletteTree.BeginUpdate; InheritanceTree.Items.BeginUpdate; - FClassList := TStringList.Create; + FClassList := TStringListUTF8Fast.Create; try ListTree.Items.Clear; PalletteTree.Items.Clear; InheritanceTree.Items.Clear; FClassList.Sorted := true; - FClassList.CaseSensitive := false; FClassList.Duplicates := dupIgnore; // ParentInheritence := InheritanceTree.Items.Add(nil, 'TComponent'); // FClassList.AddObject('TComponent', ParentInheritence); diff --git a/ide/comppagespopup.pas b/ide/comppagespopup.pas index ff6c6734ee..89c96a3016 100644 --- a/ide/comppagespopup.pas +++ b/ide/comppagespopup.pas @@ -34,10 +34,16 @@ unit CompPagesPopup; interface uses - Classes, SysUtils, math, FileUtil, LazLoggerBase, Forms, Controls, Graphics, - LMessages, Dialogs, ComCtrls, ExtCtrls, Buttons, LCLIntf, LCLType, - IDEImagesIntf, MenuIntf, LazarusIDEStrConsts, MainBar, - ComponentPalette_Options, MainBase; + Classes, SysUtils, math, + // LCL + LCLIntf, LCLType, LMessages, Forms, Controls, ComCtrls, ExtCtrls, + Graphics, Dialogs, Buttons, + // LazUtils + LazLoggerBase, LazUTF8, + // IdeIntf + IDEImagesIntf, MenuIntf, + // IDE + LazarusIDEStrConsts, ComponentPalette_Options, MainBase, MainBar; type @@ -55,7 +61,7 @@ type procedure TreeView1Click(Sender: TObject); private fViewAllNode, fOptionsNode: TTreeNode; - fGroups: TStringList; // Objects have group TreeNodes + fGroups: TStringListUTF8Fast; // Objects have group TreeNodes fLastCloseUp: QWord; fLastCanShowCheck: Boolean; procedure AppDeactivated(Sender: TObject); @@ -305,7 +311,7 @@ begin TreeView1.Items.AddChild(nil,'Sorry, No Pages'); Exit; end; - fGroups := TStringList.Create; + fGroups := TStringListUTF8Fast.Create; try FindGroups; for i:=0 to MainIDEBar.ComponentPageControl.PageCount-1 do diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index f560a1d171..44a41266d3 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -45,6 +45,7 @@ uses Forms, Menus, Dialogs, // LazUtils FileUtil, LazFileUtils, LazFileCache, CompWriterPas, LazLoggerBase, LazTracer, + LazUTF8, // Codetools CodeCache, CodeTree, CodeToolManager, FindDeclarationTool, // IDEIntf @@ -1969,7 +1970,7 @@ begin // cache defined properties if (DefinePropertiesReader<>nil) and (DefinePropertiesReader.DefinePropertyNames<>nil) then begin - CacheItem.DefineProperties:=TStringList.Create; + CacheItem.DefineProperties:=TStringListUTF8Fast.Create; CacheItem.DefineProperties.Assign(DefinePropertiesReader.DefinePropertyNames); debugln('TCustomFormEditor.FindDefineProperty Class=',APersistentClassName, ' DefineProps="',CacheItem.DefineProperties.Text,'"'); @@ -2004,7 +2005,7 @@ begin CacheItem:=TDefinePropertiesCacheItem(ANode.Data); end; if (CacheItem.DefineProperties=nil) then - CacheItem.DefineProperties:=TStringList.Create; + CacheItem.DefineProperties:=TStringListUTF8Fast.Create; if (CacheItem.DefineProperties.IndexOf(Identifier)<0) then CacheItem.DefineProperties.Add(Identifier); end; @@ -2618,7 +2619,8 @@ end; procedure TDefinePropertiesReader.AddPropertyName(const Name: string); begin debugln('TDefinePropertiesReader.AddPropertyName Name="',Name,'"'); - if FDefinePropertyNames=nil then FDefinePropertyNames:=TStringList.Create; + if FDefinePropertyNames=nil then + FDefinePropertyNames:=TStringListUTF8Fast.Create; if FDefinePropertyNames.IndexOf(Name)<=0 then FDefinePropertyNames.Add(Name); end; diff --git a/ide/extractprocdlg.pas b/ide/extractprocdlg.pas index ed1fc85286..dd89924b60 100644 --- a/ide/extractprocdlg.pas +++ b/ide/extractprocdlg.pas @@ -35,6 +35,8 @@ uses Classes, SysUtils, Laz_AVL_Tree, // LCL Forms, Controls, Dialogs, ExtCtrls, StdCtrls, ButtonPanel, LCLProc, + // LazUtils + LazUTF8, // Codetools BasicCodeTools, CodeTree, CodeCache, CodeToolManager, ExtractProcTool, // IdeIntf @@ -304,12 +306,12 @@ procedure TExtractProcDialog.UpdateFunction; var AVLNode: TAVLTreeNode; Variable: TExtractedProcVariable; - sl: TStringList; + sl: TStringListUTF8Fast; begin FuncVariableComboBox.Items.BeginUpdate; FuncVariableComboBox.Items.Clear; if Variables<>nil then begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try AVLNode:=Variables.FindLowest; while AVLNode<>nil do begin diff --git a/ide/frames/compiler_config_target.pas b/ide/frames/compiler_config_target.pas index 3a9ab0e227..73a720627e 100644 --- a/ide/frames/compiler_config_target.pas +++ b/ide/frames/compiler_config_target.pas @@ -32,7 +32,7 @@ uses // LCL Controls, Dialogs, Graphics, StdCtrls, // LazUtils - LazFileUtils, LazStringUtils, + LazFileUtils, LazStringUtils, LazUTF8, // CodeTools DefineTemplates, // IdeIntf @@ -229,7 +229,7 @@ end; procedure TCompilerConfigTargetFrame.UpdateByTargetCPU(aTargetCPU: string); var ParsingFrame: TCompilerParsingOptionsFrame; - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; begin if aTargetCPU = '' then @@ -240,7 +240,7 @@ begin end; // Update selection list for target processor - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; GetTargetProcessors(aTargetCPU,sl); sl.Sort; sl.Insert(0,'('+lisDefault+')'); diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index f35224dcf5..376f74e5fb 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -642,16 +642,16 @@ var Macros: TLazBuildMacros; Macro: TLazBuildMacro; LCLWidgetTypeMacro: TLazBuildMacro; - List: TStringList; + xList: TStringListUTF8Fast; MenuIndex: Integer; MacroMenuItem: TMenuItem; PkgList: TFPList; begin LCLWidgetTypeMacro:=Nil; PkgList:=nil; - List:=TStringList.Create; + xList:=TStringListUTF8Fast.Create; try - // First collect all macros from all used packages to a sorted list. + // First collect all macros from all used packages to a sorted xList. PackageGraph.GetAllRequiredPackages(nil,LazProject.FirstRequiredDependency,PkgList); if PkgList<>nil then begin for i:=0 to PkgList.Count-1 do begin @@ -662,20 +662,20 @@ begin if Macro.Identifier = 'LCLWidgetType' then LCLWidgetTypeMacro:=Macro else if IsValidIdent(Macro.Identifier) then - List.AddObject(Macro.Identifier,Macro); + xList.AddObject(Macro.Identifier,Macro); end; end; end; - List.Sort; + xList.Sort; // LCLWidgetType gets its own button. BMMAddLclWidgetButton.Enabled:=Assigned(LCLWidgetTypeMacro); if Assigned(LCLWidgetTypeMacro) then AddLCLWidgetTypeValues(BMMAddLclWidgetPopupMenu, LCLWidgetTypeMacro); // Place other macros to the popup menu opened from "Add" button. MenuIndex:=BMMNewTargetMenuItem.MenuIndex; - for i:=0 to List.Count-1 do begin + for i:=0 to xList.Count-1 do begin inc(MenuIndex); - Macro:=TLazBuildMacro(List.Objects[i]); + Macro:=TLazBuildMacro(xList.Objects[i]); if BMMAddOtherPopupMenu.Items.Count=MenuIndex then BMMAddOtherPopupMenu.Items.Add(TMenuItem.Create(Self)); MacroMenuItem:=BMMAddOtherPopupMenu.Items[MenuIndex]; @@ -684,7 +684,7 @@ begin end; finally PkgList.Free; - List.Free; + xList.Free; end; end; diff --git a/ide/frames/desktop_options.pas b/ide/frames/desktop_options.pas index c18372a5c6..9eac61973a 100644 --- a/ide/frames/desktop_options.pas +++ b/ide/frames/desktop_options.pas @@ -26,10 +26,10 @@ interface uses Classes, SysUtils, - // LazUtils - FileUtil, // LCL Forms, StdCtrls, Dialogs, LCLProc, ExtCtrls, Spin, + // LazUtils + FileUtil, LazUTF8, // LazControls DividerBevel, // IdeIntf @@ -105,14 +105,14 @@ procedure TDesktopOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog); var i: Integer; LangID: String; - sl: TStringList; + sl: TStringListUTF8Fast; begin // language lblLanguage.Caption := dlgEnvLanguage; LanguageComboBox.Hint := dlgEnvLanguageHint; // languages: first the automatic, then sorted the rest - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; for i:=0 to LazarusTranslations.Count-1 do begin LangID:=LazarusTranslations[i].ID; diff --git a/ide/frames/project_forms_options.pas b/ide/frames/project_forms_options.pas index 5d634777c4..9c025f1047 100644 --- a/ide/frames/project_forms_options.pas +++ b/ide/frames/project_forms_options.pas @@ -8,6 +8,8 @@ uses Classes, SysUtils, // LCL Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, + // LazUtils + LazUTF8, // IdeIntf IDEOptionsIntf, IDEOptEditorIntf, ProjectIntf, IDEImagesIntf, // IDE @@ -237,7 +239,7 @@ var procedure FillAvailFormsListBox; var - sl: TStringList; + sl: TStringListUTF8Fast; i: integer; begin FormsAvailFormsListBox.Items.BeginUpdate; @@ -245,7 +247,7 @@ var if (Project <> nil) then begin - sl := TStringList.Create; + sl := TStringListUTF8Fast.Create; try for i := 0 to Project.UnitCount - 1 do if (Project.Units[i].IsPartOfProject) and diff --git a/ide/frames/project_resources_options.pas b/ide/frames/project_resources_options.pas index e5e32e59a5..e65c497497 100644 --- a/ide/frames/project_resources_options.pas +++ b/ide/frames/project_resources_options.pas @@ -46,8 +46,8 @@ type FModified: Boolean; private FAddResourceItemDuplicates: integer; - FResourceNameList: TStringList; // to keep resource names unique - FResourceFileNameList: TStringList; // to keep resource file names unique + FResourceNameList: TStringListUTF8Fast; // to keep resource names unique + FResourceFileNameList: TStringListUTF8Fast; // to keep resource file names unique // Used to know what was resource name before editing. FCurrentResName: string; // Begin adding resources. @@ -288,11 +288,11 @@ constructor TResourcesOptionsFrame.Create(AOwner: TComponent); begin inherited Create(AOwner); - FResourceNameList := TStringList.Create; + FResourceNameList := TStringListUTF8Fast.Create; FResourceNameList.Sorted := True; FResourceNameList.Duplicates := dupError; - FResourceFileNameList := TStringList.Create; + FResourceFileNameList := TStringListUTF8Fast.Create; FResourceFileNameList.Sorted := True; FResourceFileNameList.Duplicates := dupError; end; diff --git a/ide/helpfpcmessages.pas b/ide/helpfpcmessages.pas index 7e68d09a79..d04d5764cf 100644 --- a/ide/helpfpcmessages.pas +++ b/ide/helpfpcmessages.pas @@ -42,7 +42,7 @@ uses LCLProc, LCLIntf, Dialogs, Forms, Controls, StdCtrls, ExtCtrls, Graphics, ButtonPanel, LazHelpHTML, // LazUtils - LazConfigStorage, LazFileUtils, LazFileCache, + LazConfigStorage, LazFileUtils, LazFileCache, LazUTF8, // CodeTools FileProcs, CodeToolsFPCMsgs, CodeToolManager, CodeCache, DefineTemplates, // IdeIntf @@ -639,10 +639,10 @@ end; procedure TEditIDEMsgHelpDialog.FillAdditionsList; var - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try for i:=0 to Additions.Count-1 do sl.Add(Additions[i].Name); diff --git a/ide/ideinfodlg.pas b/ide/ideinfodlg.pas index be99e9923b..90c9de8a0f 100644 --- a/ide/ideinfodlg.pas +++ b/ide/ideinfodlg.pas @@ -264,15 +264,15 @@ end; procedure TIDEInfoDialog.GatherEnvironmentVars(sl: TStrings); var i: Integer; - l: TStringList; + TempList: TStringListUTF8Fast; begin sl.Add('Environment variables:'); - l:=TStringList.Create; + TempList:=TStringListUTF8Fast.Create; for i:=0 to GetEnvironmentVariableCount-1 do - l.Add(GetEnvironmentStringUTF8(i)); - l.Sort; - sl.AddStrings(l); - l.free; + TempList.Add(GetEnvironmentStringUTF8(i)); + TempList.Sort; + sl.AddStrings(TempList); + TempList.free; sl.Add(''); end; diff --git a/ide/ideinfoneedbuild.pas b/ide/ideinfoneedbuild.pas index ec2d089fd9..20b9644365 100644 --- a/ide/ideinfoneedbuild.pas +++ b/ide/ideinfoneedbuild.pas @@ -34,7 +34,7 @@ uses // LCL Forms, Controls, StdCtrls, ButtonPanel, LCLType, // LazUtils - LazUtilities, + LazUtilities, LazUTF8, // IdeIntf IDEWindowIntf, LazIDEIntf, ProjectIntf, PackageIntf, // IDE @@ -195,10 +195,10 @@ end; procedure TIDEInfoNeedBuildDlg.FillTargets; var - sl: TStringList; + sl: TStringListUTF8Fast; i: Integer; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try for i:=0 to PackageGraph.Count-1 do sl.Add(PackageGraph[i].Name); diff --git a/ide/ideinstances.pas b/ide/ideinstances.pas index c91629616a..53c8d7f4be 100644 --- a/ide/ideinstances.pas +++ b/ide/ideinstances.pas @@ -216,19 +216,16 @@ function TIDEInstances.ProjectIsOpenInAnotherInstance(aProjectFileName: string var xStartClient: TResponseClient; I: Integer; - xServerIDs, xOpenedProjectFiles: TStringList; + xServerIDs: TStringList; xProjFileName: string; begin aProjectFileName := ExtractFilePath(aProjectFileName)+ExtractFileNameOnly(aProjectFileName); xStartClient := nil; xServerIDs := nil; - xOpenedProjectFiles := nil; try xStartClient := TResponseClient.Create(nil); xServerIDs := TStringList.Create; - xOpenedProjectFiles := TStringList.Create; - xStartClient.FindRunningServers(LazServerPrefix, xServerIDs); for I := 0 to xServerIDs.Count-1 do @@ -246,9 +243,7 @@ begin finally xStartClient.Free; xServerIDs.Free; - xOpenedProjectFiles.Free; end; - Result := False; end; @@ -395,11 +390,11 @@ function TIDEInstances.AllowStartNewInstance(const aFiles: TStrings; var xStartClient: TResponseClient; I: Integer; - xServerIDs: TStringList; + xServerIDs: TStringListUTF8Fast; begin Result := ofrStartNewInstance; xStartClient := TResponseClient.Create(nil); - xServerIDs := TStringList.Create; + xServerIDs := TStringListUTF8Fast.Create; try //check for multiple instances xStartClient.FindRunningServers(LazServerPrefix, xServerIDs); xServerIDs.Sort; diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index 26f60514b7..6dcdb299da 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -758,7 +758,7 @@ end; function CompareRecentListItem(s1, s2: string; ListType: TRecentListType): boolean; begin case ListType of - rltCaseInsensitive: Result:=UTF8LowerCase(s1)=UTF8LowerCase(s2); + rltCaseInsensitive: Result:=UTF8CompareLatinTextFast(s1,s2)=0; rltFile: Result:=CompareFilenames(ChompPathDelim(s1),ChompPathDelim(s2))=0; else Result:=s1=s2; end; @@ -1059,10 +1059,10 @@ end; procedure RemoveDoubles(List: TStrings); var i: Integer; - List2: TStringList; + List2: TStringListUTF8Fast; begin if List=nil then exit; - List2:=TStringList.Create; + List2:=TStringListUTF8Fast.Create; List2.AddStrings(List); List2.Sort; List.Assign(List2); diff --git a/ide/lazarusmanager.pas b/ide/lazarusmanager.pas index e49b6e6efd..d04f1b98c5 100644 --- a/ide/lazarusmanager.pas +++ b/ide/lazarusmanager.pas @@ -247,7 +247,7 @@ begin SplashForm := nil; // get command line parameters - FCmdLineParams := TStringList.Create; + FCmdLineParams := TStringListUTF8Fast.Create; ParseCommandLine(FCmdLineParams, FLazarusPID, FShowSplashOption); if FShowSplashOption then ShowSplash; diff --git a/ide/mainbase.pas b/ide/mainbase.pas index 582c86a2ab..5987c07af0 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -60,7 +60,7 @@ uses // LCL LCLProc, Buttons, Menus, ComCtrls, Controls, Graphics, Dialogs, Forms, ImgList, // LazUtils - LazFileUtils, + LazFileUtils, LazUTF8, // Codetools CodeToolManager, // SynEdit @@ -1527,8 +1527,8 @@ var i, EditorIndex, ItemCountProject, ItemCountOther, IconInd: Integer; CurMenuItem: TIDEMenuItem; AForm: TForm; - EdList: TStringList; - EditorCur: TSourceEditor; + EdList: TStringListUTF8Fast; + se: TSourceEditor; P: TIDEPackage; aSection: TIDEMenuSection; s: String; @@ -1594,27 +1594,23 @@ begin if SourceEditorManager.SourceEditorCount > 0 then begin ItemCountProject := 0; ItemCountOther := 0; - EdList := TStringList.Create; + EdList := TStringListUTF8Fast.Create; EdList.OwnsObjects := False; - EdList.Sorted := True; - // sort for i := 0 to SourceEditorManager.SourceEditorCount - 1 do begin - EdList.AddObject(SourceEditorManager.SourceEditors[i].PageName+' ' - +SourceEditorManager.SourceEditors[i].FileName - +SourceEditorManager.SourceEditors[i].Owner.Name, - TObject(PtrUInt(i)) - ); + se := SourceEditorManager.SourceEditors[i]; + EdList.AddObject(se.PageName+' '+se.FileName+se.Owner.Name, TObject(PtrUInt(i))); end; + EdList.Sorted := True; for i := 0 to EdList.Count - 1 do begin EditorIndex := PtrUInt(EdList.Objects[i]); - EditorCur := SourceEditorManager.SourceEditors[EditorIndex]; - if (EditorCur.GetProjectFile <> nil) and (EditorCur.GetProjectFile.IsPartOfProject) then begin + se := SourceEditorManager.SourceEditors[EditorIndex]; + if (se.GetProjectFile <> nil) and (se.GetProjectFile.IsPartOfProject) then begin aSection := itmTabListProject; CurMenuItem := GetMenuItem(ItemCountProject, aSection); inc(ItemCountProject); end else begin - SourceEditorManager.OnPackageForSourceEditor(P, EditorCur); + SourceEditorManager.OnPackageForSourceEditor(P, se); if P <> nil then begin s := Format(lisTabsFor, [p.Name]); if itmTabListPackage.FindByName(S) is TIDEMenuSection then @@ -1629,13 +1625,13 @@ begin end; end; aSection.Visible := True; - if EditorCur.SharedEditorCount > 1 then - CurMenuItem.Caption := EditorCur.PageName + ' ('+TForm(EditorCur.Owner).Caption+')' + if se.SharedEditorCount > 1 then + CurMenuItem.Caption := se.PageName + ' ('+TForm(se.Owner).Caption+')' else - CurMenuItem.Caption := EditorCur.PageName; + CurMenuItem.Caption := se.PageName; if CurMenuItem.MenuItem <> nil then - CurMenuItem.Checked := SourceEditorManager.ActiveEditor = EditorCur; - if (SourceEditorManager.ActiveEditor = EditorCur) and (aSection.MenuItem <> nil) then + CurMenuItem.Checked := SourceEditorManager.ActiveEditor = se; + if (SourceEditorManager.ActiveEditor = se) and (aSection.MenuItem <> nil) then aSection.Checked := true; CurMenuItem.OnClick := @mnuWindowSourceItemClick; CurMenuItem.Tag := EditorIndex; diff --git a/ide/newdialog.pas b/ide/newdialog.pas index c1882e41b0..49cd528852 100644 --- a/ide/newdialog.pas +++ b/ide/newdialog.pas @@ -265,14 +265,14 @@ end; // Fill the list of inheritable items in the project procedure TNewOtherDialog.FillProjectInheritableItemsList; var - aComponentList: TStringList; + aComponentList: TStringListUTF8Fast; i: integer; ListItem: TListViewDataItem; AnUnitInfo: TUnitInfo; Begin try // Auxiliar stringlist to sort component list - aComponentList := TStringList.Create; + aComponentList := TStringListUTF8Fast.Create; // Loop trough project units which have a component for i := 0 to Project1.UnitCount-1 do begin diff --git a/ide/patheditordlg.pas b/ide/patheditordlg.pas index 1b4e15aa8d..2bb8d60ff9 100644 --- a/ide/patheditordlg.pas +++ b/ide/patheditordlg.pas @@ -26,7 +26,7 @@ uses LCLType, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs, Menus, Graphics, ButtonPanel, Clipbrd, // LazUtils - FileUtil, LazFileUtils, LazStringUtils, LazFileCache, + FileUtil, LazFileUtils, LazStringUtils, LazFileCache, LazUTF8, // LazControls ShortPathEdit, // IdeIntf @@ -83,7 +83,7 @@ type private FBaseDirectory: string; FEffectiveBaseDirectory: string; - FTemplateList: TStringList; + FTemplateList: TStringListUTF8Fast; procedure AddPath(aPath: String; aObject: TObject); function GetPath: string; function BaseRelative(const APath: string): String; @@ -408,7 +408,7 @@ procedure TPathEditorDialog.FormCreate(Sender: TObject); const Filt = 'Text file (*.txt)|*.txt|All files (*)|*'; begin - FTemplateList := TStringList.Create; + FTemplateList := TStringListUTF8Fast.Create; Caption:=dlgDebugOptionsPathEditorDlgCaption; PathGroupBox.Caption:=lisPathEditSearchPaths; MoveUpButton.Hint:=lisPathEditMovePathUp; diff --git a/ide/publishmoduledlg.pas b/ide/publishmoduledlg.pas index 855245c1c4..fb62e78877 100644 --- a/ide/publishmoduledlg.pas +++ b/ide/publishmoduledlg.pas @@ -36,7 +36,7 @@ uses // LCL LCLType, Forms, StdCtrls, Dialogs, Buttons, ButtonPanel, LCLIntf, // LazUtils - FileUtil, LazFileUtils, LazLoggerBase, UITypes, + FileUtil, LazFileUtils, LazLoggerBase, UITypes, LazUTF8, // BuildIntf ProjPackIntf, CompOptsIntf, PublishModuleIntf, // IdeIntf @@ -94,10 +94,10 @@ type // Some of them may be above the main project/package directory. FTopDir: string; // Project/package member files already copied. Not copied again by filters. - FCopiedFiles: TStringList; + FCopiedFiles: TStringListUTF8Fast; // Copying by filters failed. FCopyFailedCount: Integer; - FProjDirs: TStringList; + FProjDirs: TStringListUTF8Fast; FBackupDir, FLibDir: String; procedure AdjustTopDir(const AFileName: string); function CopyAFile(const AFileName: string): TModalResult; @@ -162,8 +162,8 @@ begin + EnvironmentOptions.BackupInfoProjectFiles.SubDirectory); COpts := FProjPack.LazCompilerOptions as TBaseCompilerOptions; FLibDir := COpts.GetUnitOutPath(True,coptParsed); - FCopiedFiles := TStringList.Create; - FProjDirs := TStringList.Create; + FCopiedFiles := TStringListUTF8Fast.Create; + FProjDirs := TStringListUTF8Fast.Create; end; destructor TPublisher.Destroy; @@ -369,7 +369,7 @@ begin begin for I := 0 to FCopiedFiles.Count - 1 do begin - RelPath := ExtractRelativePath(FTopDir, FCopiedFiles.Strings[I]); + RelPath := ExtractRelativePath(FTopDir, FCopiedFiles[I]); Drive := ExtractFileDrive(RelPath); if Trim(Drive) <> '' then RelPath := StringReplace(RelPath, AppendPathDelim(Drive), '', [rfIgnoreCase]); diff --git a/ide/restrictionbrowser.pas b/ide/restrictionbrowser.pas index bd9824ed09..70ad9d29f2 100644 --- a/ide/restrictionbrowser.pas +++ b/ide/restrictionbrowser.pas @@ -32,7 +32,9 @@ interface uses Classes, Contnrs, // LCL - LCLPlatformDef, LCLProc, Forms, StdCtrls, ComCtrls, ExtCtrls, Buttons, + LCLPlatformDef, Forms, StdCtrls, ComCtrls, ExtCtrls, Buttons, + // LazUtils + LazUTF8, LazLoggerBase, // LazControls TreeFilterEdit, // IdeIntf @@ -150,7 +152,7 @@ end; procedure TRestrictionBrowserView.UpdateIssueList; var I, ID: PtrInt; - Issues: TStringList; + Issues: TStringListUTF8Fast; P: TLCLPlatform; WidgetSetFilter: TLCLPlatforms; Component: TComponent; @@ -163,7 +165,7 @@ begin if (Component as TSpeedButton).Down then Include(WidgetSetFilter, P); end; - Issues := TStringList.Create; + Issues := TStringListUTF8Fast.Create; try for I := 0 to High(FIssueList) do if FIssueList[I].WidgetSet in WidgetSetFilter then diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 5f6b9c60ac..192697ac5a 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -1887,7 +1887,7 @@ var I: integer; Mng: TSourceEditorManager; New: TSourceListItem; - AddedFileNames: TStringList; + AddedFileNames: TStringListUTF8Fast; begin FSourceList.Clear; if FIncludeWords=icwDontInclude then @@ -1906,7 +1906,7 @@ begin if FIncludeWords=icwIncludeFromAllUnits then begin - AddedFileNames := TStringList.Create; + AddedFileNames := TStringListUTF8Fast.Create; try AddedFileNames.Sorted := True; AddedFileNames.Duplicates := dupIgnore; @@ -2286,7 +2286,7 @@ procedure TSourceEditCompletion.ccExecute(Sender: TObject); // init completion form // called by OnExecute just before showing var - S: TStrings; + SL: TStrings; Prefix: String; I: Integer; NewStr: String; @@ -2334,12 +2334,12 @@ Begin FActiveEditTextHighLightColor := SynEditor.MarkupIdentComplWindow.HighlightColor; end; - S := TStringList.Create; + SL := TStringList.Create; try Prefix := CurrentString; case CurrentCompletionType of ctIdentCompletion: - if InitIdentCompletionValues(S) then begin + if InitIdentCompletionValues(SL) then begin ToggleReplaceWhole:=not CodeToolsOpts.IdentComplReplaceIdentifier; end else begin ItemList.Clear; @@ -2361,16 +2361,16 @@ Begin NewStr:=#3'B'+NewStr+#3'b'; while length(NewStr)<10+4 do NewStr:=NewStr+' '; NewStr:=NewStr+' '+Manager.CodeTemplateModul.CompletionComments[I]; - S.Add(NewStr); + SL.Add(NewStr); end; end; end; end; - ItemList := S; + ItemList := SL; finally - S.Free; + SL.Free; end; CurrentString:=Prefix; // set colors @@ -2671,8 +2671,7 @@ begin // let plugin rebuild completion list SL:=TStringList.Create; try - Manager.ActiveCompletionPlugin.PrefixChanged(CurrentString, - APosition,sl); + Manager.ActiveCompletionPlugin.PrefixChanged(CurrentString,APosition,sl); ItemList:=SL; finally SL.Free; @@ -6819,7 +6818,7 @@ var EditorCur: TSourceEditor; P: TIDEPackage; RecMenu, ProjMenu, M: TIDEMenuSection; - EdList: TStringList; + EdList: TStringListUTF8Fast; begin PopM:=TPopupMenu(Sender); SourceTabMenuRoot.MenuItem:=PopM.Items; @@ -6846,13 +6845,11 @@ begin SrcEditMenuSectionEditors.Clear; if Manager <> nil then begin - EdList := TStringList.Create; + EdList := TStringListUTF8Fast.Create; EdList.OwnsObjects := False; - EdList.Sorted := True; - // sort for i := 0 to EditorCount - 1 do EdList.AddObject(Editors[i].PageName+' '+Editors[i].FileName, Editors[i]); - + EdList.Sorted := True; RecMenu := RegisterIDESubMenu(SrcEditMenuSectionEditors, lisRecentTabs, lisRecentTabs); RecMenu.Visible := False; diff --git a/ide/toolbarconfig.pas b/ide/toolbarconfig.pas index dfbc985aa6..70634d859b 100644 --- a/ide/toolbarconfig.pas +++ b/ide/toolbarconfig.pas @@ -30,7 +30,7 @@ uses // LazControls TreeFilterEdit, // LazUtils - Laz2_XMLCfg, + Laz2_XMLCfg, LazUTF8, // IdeIntf ToolBarIntf, IDEImagesIntf, IDEWindowIntf, // IDE @@ -382,10 +382,10 @@ var xCategory: TIDEToolButtonCategory; xCaption: string; Node: TTreeNode; - SortedCtgList: TStringList; + SortedCtgList: TStringListUTF8Fast; begin TV.Items.BeginUpdate; - SortedCtgList := TStringList.Create; + SortedCtgList := TStringListUTF8Fast.Create; try SortedCtgList.OwnsObjects := False; for i := 0 to IDEToolButtonCategories.Count-1 do diff --git a/ide/unitdependencies.pas b/ide/unitdependencies.pas index c08d467d1e..fddafbea5a 100644 --- a/ide/unitdependencies.pas +++ b/ide/unitdependencies.pas @@ -44,8 +44,7 @@ uses CodeToolManager, DefineTemplates, CTUnitGraph, CTUnitGroupGraph, FileProcs, CodeCache, AvgLvlTree, // LazUtils - LazLoggerBase, LazFileUtils, LazFileCache, LazStringUtils, LazUTF8, - LvlGraphCtrl, + LazLoggerBase, LazFileUtils, LazFileCache, LazStringUtils, LazUTF8, LvlGraphCtrl, // IDE interface LazIDEIntf, ProjectIntf, IDEWindowIntf, PackageIntf, SrcEditorIntf, IDEImagesIntf, IDEMsgIntf, IDEExternToolIntf, IDECommands, IDEDialogs, @@ -255,7 +254,7 @@ type fImgIndexOverlayImplCycle: integer; fAllUnitsTVSearchStartNode: TTreeNode; fSelUnitsTVSearchStartNode: TTreeNode; - FGroupLvlGraphSelectionsList: TStringList; + FGroupLvlGraphSelectionsList: TStringListUTF8Fast; function CreateAllUnitsTree: TUDNode; function CreateSelUnitsTree: TUDNode; procedure DoLoadedOpts(Sender: TObject); @@ -565,7 +564,7 @@ procedure TUnitDependenciesWindow.FormCreate(Sender: TObject); begin Name := NonModalIDEWindowNames[nmiwUnitDependencies]; - FGroupLvlGraphSelectionsList := TStringList.Create; + FGroupLvlGraphSelectionsList := TStringListUTF8Fast.Create; FPendingUnitDependencyRoute:=TStringList.Create; CreateUsesGraph(FUsesGraph,FGroups); @@ -1989,8 +1988,8 @@ begin if IsProjectGroup(Group) then begin // project GroupObj:=LazarusIDE.ActiveProject; - GraphGroup.Selected:=(FGroupLvlGraphSelectionsList.Count=0) or - (FGroupLvlGraphSelectionsList.IndexOf(Group.Name)>= 0); + GraphGroup.Selected:=(FGroupLvlGraphSelectionsList.Count=0) + or (FGroupLvlGraphSelectionsList.IndexOf(Group.Name)>=0); GraphGroup.ImageIndex := fImgIndexProject; end else begin // package diff --git a/ide/unusedunitsdlg.pas b/ide/unusedunitsdlg.pas index dac2c49591..38dc17631f 100644 --- a/ide/unusedunitsdlg.pas +++ b/ide/unusedunitsdlg.pas @@ -34,7 +34,9 @@ interface uses Classes, SysUtils, // LCL - LCLProc, Forms, Controls, ComCtrls, StdCtrls, ExtCtrls, Buttons, Dialogs, + Forms, Controls, ComCtrls, StdCtrls, ExtCtrls, Buttons, Dialogs, + // LazUtils + LazUTF8, LazLoggerBase, // Codetools CodeCache, CodeToolManager, // IdeIntf @@ -102,7 +104,7 @@ end; function ShowUnusedUnitsDialog(Code: TCodeBuffer): TModalResult; var UnusedUnitsDialog: TUnusedUnitsDialog; - Units: TStringList; + xUnits: TStringListUTF8Fast; RemoveUnits: TStrings; i: Integer; DlgResult: TModalResult; @@ -114,17 +116,17 @@ begin UnusedUnitsDialog:=nil; RemoveUnits:=nil; - Units:=TStringList.Create; + xUnits:=TStringListUTF8Fast.Create; try - if not CodeToolBoss.FindUnusedUnits(Code,Units) then begin + if not CodeToolBoss.FindUnusedUnits(Code,xUnits) then begin DebugLn(['ShowUnusedUnitsDialog CodeToolBoss.FindUnusedUnits failed']); LazarusIDE.DoJumpToCodeToolBossError; exit(mrCancel); end; - Units.Sort; + xUnits.Sort; UnusedUnitsDialog:=TUnusedUnitsDialog.Create(nil); - UnusedUnitsDialog.Units:=Units; + UnusedUnitsDialog.Units:=xUnits; UnusedUnitsDialog.Code:=Code; DlgResult:=UnusedUnitsDialog.ShowModal; if DlgResult=mrOk then @@ -160,7 +162,7 @@ begin CodeToolBoss.SourceCache.ClearAllSourceLogEntries; RemoveUnits.Free; UnusedUnitsDialog.Free; - Units.Free; + xUnits.Free; end; end; diff --git a/ide/useunitdlg.pas b/ide/useunitdlg.pas index 2498a1cba4..c324a2189f 100644 --- a/ide/useunitdlg.pas +++ b/ide/useunitdlg.pas @@ -30,11 +30,21 @@ unit UseUnitDlg; interface uses - Classes, SysUtils, Forms, Controls, StdCtrls, ExtCtrls, Buttons, ButtonPanel, - Dialogs, LCLProc, FileProcs, Graphics, LCLType, SourceEditor, LazIDEIntf, - IDEImagesIntf, LazarusIDEStrConsts, ProjectIntf, IDEWindowIntf, Project, - CodeCache, CodeToolManager, IdentCompletionTool, CodeTree, ListFilterEdit, - LinkScanner, EnvironmentOpts, MainIntf, LazFileUtils; + Classes, SysUtils, + // LCL + LCLType, Forms, Controls, StdCtrls, ExtCtrls, ButtonPanel, Dialogs, Graphics, + // LazControls + ListFilterEdit, + // LazUtils + LazUTF8, LazFileUtils, + // Codetools + FileProcs, LinkScanner, CodeCache, CodeTree, CodeToolManager, IdentCompletionTool, + // BuildIntf + ProjectIntf, + // IdeIntf + LazIDEIntf, IDEImagesIntf, IDEWindowIntf, + // IDE + LazarusIDEStrConsts, SourceEditor, Project, EnvironmentOpts, MainIntf; type @@ -63,9 +73,8 @@ type var AHeight: Integer); private UnitImgInd: Integer; - FMainUsedUnits: TStringList; - FImplUsedUnits: TStringList; - FProjUnits, FOtherUnits: TStringList; + FMainUsedUnits, FImplUsedUnits: TStringList; + FProjUnits, FOtherUnits: TStringListUTF8Fast; DlgType: TUseUnitDialogType; procedure AddImplUsedUnits; function GetProjUnits(SrcEdit: TSourceEditor): Boolean; @@ -194,7 +203,7 @@ begin ButtonPanel1.OKButton.Caption:=lisMenuOk; ButtonPanel1.CancelButton.Caption:=lisCancel; UnitImgInd := IDEImages.LoadImage('item_unit'); - FProjUnits:=TStringList.Create; + FProjUnits:=TStringListUTF8Fast.Create; end; procedure TUseUnitDialog.FormDestroy(Sender: TObject); @@ -360,14 +369,10 @@ begin FImplUsedUnits := TStringList.Create; end; Result := True; - if Assigned(FMainUsedUnits) then begin + if Assigned(FMainUsedUnits) then FMainUsedUnits.Sorted := True; - FMainUsedUnits.CaseSensitive := False; - end; - if Assigned(FImplUsedUnits) then begin + if Assigned(FImplUsedUnits) then FImplUsedUnits.Sorted := True; - FImplUsedUnits.CaseSensitive := False; - end; if SrcEdit.GetProjectFile is TUnitInfo then CurrentUnitName := TUnitInfo(SrcEdit.GetProjectFile).Unit_Name else @@ -395,8 +400,7 @@ begin if not (Assigned(FMainUsedUnits) and Assigned(FImplUsedUnits)) then Exit; Screen.BeginWaitCursor; try - FOtherUnits := TStringList.Create; - FOtherUnits.Sorted := True; + FOtherUnits := TStringListUTF8Fast.Create; SrcEdit := SourceEditorManager.ActiveEditor; with CodeToolBoss do if GatherUnitNames(SrcEdit.CodeBuffer) then @@ -412,6 +416,7 @@ begin IdentifierList.FilteredItems[i]); end; end; + FOtherUnits.Sorted := True; finally Screen.EndWaitCursor; end; diff --git a/packager/addfpmakedependencydlg.pas b/packager/addfpmakedependencydlg.pas index 2a5e1811ce..f72f7085a5 100644 --- a/packager/addfpmakedependencydlg.pas +++ b/packager/addfpmakedependencydlg.pas @@ -10,6 +10,8 @@ uses LResources, Forms, Controls, Graphics, Dialogs, ButtonPanel, StdCtrls, // LazControls ListFilterEdit, + // LazUtils + LazUTF8, // BuildIntf PackageIntf, // IdeIntf @@ -31,7 +33,7 @@ type procedure OKButtonClick(Sender: TObject); private FResultDependencies: TPkgDependencyList; - FPackageNameList: TStringList; + FPackageNameList: TStringListUTF8Fast; procedure UpdateAvailableDependencyNames; public constructor Create(TheOwner: TComponent); override; @@ -112,7 +114,7 @@ end; constructor TAddFPMakeDependencyDialog.Create(TheOwner: TComponent); begin inherited Create(TheOwner); - FPackageNameList := TStringList.Create; + FPackageNameList := TStringListUTF8Fast.Create; Caption:=lisProjAddNewRequirement; diff --git a/packager/addtopackagedlg.pas b/packager/addtopackagedlg.pas index 7ce60d67f3..2d9ed4d950 100644 --- a/packager/addtopackagedlg.pas +++ b/packager/addtopackagedlg.pas @@ -35,7 +35,7 @@ uses LCLProc, LCLType, Forms, Controls, Buttons, ExtDlgs, StdCtrls, ExtCtrls, Dialogs, ComCtrls, ButtonPanel, // LazUtils - FileUtil, LazFileUtils, + FileUtil, LazFileUtils, LazUTF8, // IDEIntf NewItemIntf, PackageIntf, FormEditingIntf, IDEWindowIntf, ComponentReg, IDEDialogs, @@ -608,7 +608,7 @@ end; procedure TAddToPackageDlg.UpdateAvailableAncestorTypes; var ANode: TAVLTreeNode; - sl: TStringList; + sl: TStringListUTF8Fast; OldAncestorType: String; begin // get all available registered components @@ -620,7 +620,7 @@ begin true,true); end; // put them into a list - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; ANode:=fPkgComponents.FindLowest; while ANode<>nil do begin sl.Add(TPkgComponent(ANode.Data).ComponentClass.ClassName); @@ -641,10 +641,10 @@ procedure TAddToPackageDlg.UpdateAvailablePageNames; var i: Integer; APageName: String; - sl: TStringList; + sl: TStringListUTF8Fast; begin // get all current pagenames (excluding the hidden page) - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; for i:=0 to IDEComponentPalette.Pages.Count-1 do begin APageName:=IDEComponentPalette.Pages[i].PageName; if APageName<>'' then diff --git a/packager/installpkgsetdlg.pas b/packager/installpkgsetdlg.pas index 05dcd4964c..fea6207b36 100644 --- a/packager/installpkgsetdlg.pas +++ b/packager/installpkgsetdlg.pas @@ -46,7 +46,7 @@ uses // Codetools BasicCodeTools, // LazUtils - LazFileUtils, Laz2_XMLCfg, + LazFileUtils, Laz2_XMLCfg, LazUTF8, // IdeIntf PackageDependencyIntf, PackageIntf, IDEImagesIntf, IDEHelpIntf, IDEDialogs, IDEWindowIntf, PackageLinkIntf, // IDE @@ -650,10 +650,10 @@ var NewPackageID: TLazPackageID; APackage: TLazPackage; FilteredBranch: TTreeFilterBranch; - List: TStringList; + List: TStringListUTF8Fast; i: Integer; begin - List:=TStringList.Create; + List:=TStringListUTF8Fast.Create; try for i:=0 to FNewInstalledPackages.Count-1 do begin NewPackageID:=TLazPackageID(FNewInstalledPackages[i]); diff --git a/packager/newpkgcomponentdlg.pas b/packager/newpkgcomponentdlg.pas index bda22f7c31..1352d944f0 100644 --- a/packager/newpkgcomponentdlg.pas +++ b/packager/newpkgcomponentdlg.pas @@ -33,6 +33,8 @@ uses Classes, SysUtils, // LCL Forms, Controls, StdCtrls, ButtonPanel, + // LazUtils + LazUTF8, // IdeIntf PackageIntf, // IDE @@ -89,11 +91,11 @@ end; procedure TNewPkgComponentDialog.FillPkgsListBox; var - sl: TStringList; + sl: TStringListUTF8Fast; Pkg: TLazPackage; i: Integer; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; try for i:=0 to PackageGraph.Count-1 do begin Pkg:=PackageGraph[i]; diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index 8ed9a24a52..a77dbd231b 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -3110,7 +3110,6 @@ var OldPkgName: String; i: Integer; Macro: TLazBuildMacro; - RenamedMacros: TStringList; OldMacroName: String; BaseCompOpts: TBaseCompilerOptions; begin @@ -3123,22 +3122,16 @@ begin if RenameMacros then begin // rename macros - RenamedMacros:=TStringList.Create; - try - for i:=0 to APackage.CompilerOptions.BuildMacros.Count-1 do - begin - Macro:=APackage.CompilerOptions.BuildMacros[i]; - if SysUtils.CompareText(OldPkgName,copy(Macro.Identifier,1,length(OldPkgName)))=0 - then begin - OldMacroName:=Macro.Identifier; - RenamedMacros.Add(OldMacroName); - Macro.Identifier:=NewName+copy(OldMacroName,length(OldPkgName)+1,256); - BaseCompOpts:=TBaseCompilerOptions(APackage.CompilerOptions); - BaseCompOpts.RenameMacro(OldMacroName,Macro.Identifier,true); - end; + for i:=0 to APackage.CompilerOptions.BuildMacros.Count-1 do + begin + Macro:=APackage.CompilerOptions.BuildMacros[i]; + if SysUtils.CompareText(OldPkgName,copy(Macro.Identifier,1,length(OldPkgName)))=0 + then begin + OldMacroName:=Macro.Identifier; + Macro.Identifier:=NewName+copy(OldMacroName,length(OldPkgName)+1,256); + BaseCompOpts:=TBaseCompilerOptions(APackage.CompilerOptions); + BaseCompOpts.RenameMacro(OldMacroName,Macro.Identifier,true); end; - finally - RenamedMacros.Free; end; end; @@ -5526,7 +5519,7 @@ begin continue; // no lpk found again => do not show again end; if ListOfPackages=nil then - ListOfPackages:=TStringList.Create; + ListOfPackages:=TStringListUTF8Fast.Create; ListOfPackages.AddObject(NewFilename,APackage); end; end; diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index f9b1ef41fa..e7d9d5eb58 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -1499,9 +1499,9 @@ end; procedure TPkgManager.SaveAutoInstallDependencies; var Dependency: TPkgDependency; - sl: TStringList; + sl: TStringListUTF8Fast; begin - sl:=TStringList.Create; + sl:=TStringListUTF8Fast.Create; Dependency:=PackageGraph.FirstAutoInstallDependency; while Dependency<>nil do begin if (Dependency.LoadPackageResult=lprSuccess) @@ -2664,18 +2664,14 @@ var MovedFiles: TFilenameToPointerTree; ResFileList: TStringList; j: Integer; - OldFilenames: TStringList; begin Result:=false; TargetFilesEdit.BeginUpdate; SrcFilesEdit.BeginUpdate; - OldFilenames:=TStringList.Create; MovedFiles:=TFilenameToPointerTree.Create(false); try - for i:=0 to IDEFiles.Count-1 do - OldFilenames.Add(TIDEOwnedFile(IDEFiles[i]).GetFullFilename); - for i:=0 to OldFilenames.Count-1 do begin - OldFilename:=OldFilenames[i]; + for i:=0 to IDEFiles.Count-1 do begin + OldFilename:=TIDEOwnedFile(IDEFiles[i]).GetFullFilename; if not MoveOrCopyFile(OldFilename,MovedFiles) then exit; ResFileList:=TStringList(UnitFilenameToResFileList[OldFilename]); if ResFileList=nil then continue; @@ -2684,7 +2680,6 @@ var end; finally MovedFiles.Free; - OldFilenames.Free; SrcFilesEdit.EndUpdate; TargetFilesEdit.EndUpdate; end; @@ -4498,7 +4493,7 @@ begin UnitList:=nil; CurPackages:=nil; AllPackages:=nil; - CurUnitNames:=TStringList.Create; + CurUnitNames:=TStringListUTF8Fast.Create; try for CurClassID:=0 to ComponentClasses.Count-1 do begin @@ -4511,10 +4506,9 @@ begin CurCompReq:=nil; if UnitList=nil then begin - UnitList:=TStringList.Create; + UnitList:=TStringListUTF8Fast.Create; UnitList.Sorted:=True; UnitList.Duplicates:=dupIgnore; - UnitList.CaseSensitive:=False; end; try if CurRegComp.ComponentClass<>nil then @@ -4525,8 +4519,8 @@ begin //DebugLn(['TPkgManager.GetUnitsAndDepsForComps: CurUnitName=',CurUnitName]); if CurUnitName='' then CurUnitName:=CurRegComp.GetUnitName; - Assert(CurUnitNames.IndexOf(CurUnitName)<0, - 'TPkgManager.GetUnitsAndDepsForComps: Name already in CurUnitNames.'); + //Assert(CurUnitNames.IndexOf(CurUnitName)<0, + // 'TPkgManager.GetUnitsAndDepsForComps: Name already in CurUnitNames.'); CurUnitNames.Add(CurUnitName); if CurCompReq<>nil then CurCompReq.RequiredUnits(CurUnitNames); @@ -4547,18 +4541,16 @@ begin begin if CurPackages=nil then begin - CurPackages:=TStringList.Create; + CurPackages:=TStringListUTF8Fast.Create; CurPackages.Sorted:=True; CurPackages.Duplicates:=dupIgnore; - CurPackages.CaseSensitive:=False; end else CurPackages.Clear; if AllPackages=nil then begin - AllPackages:=TStringList.Create; + AllPackages:=TStringListUTF8Fast.Create; AllPackages.Sorted:=True; AllPackages.Duplicates:=dupIgnore; - AllPackages.CaseSensitive:=False; end; CurPackages.Add(RequiredPackage.Name); if Assigned(CurCompReq) then @@ -4715,7 +4707,8 @@ function TPkgManager.GetSourceFilesOfOwners(OwnerList: TFPList): TStrings; procedure AddFile(TheOwner: TObject; const Filename: string); begin - if Result=nil then Result:=TStringList.Create; + if Result=nil then + Result:=TStringList.Create; Result.AddObject(Filename,TheOwner); end;