mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 22:00:50 +02:00
LCL: Use a faster compare method for case-insensitive StringList.
git-svn-id: trunk@64443 -
This commit is contained in:
parent
d0ac16bcc5
commit
a542627231
@ -848,7 +848,7 @@ begin
|
|||||||
ControlStyle := ControlStyle - [csCaptureMouse];
|
ControlStyle := ControlStyle - [csCaptureMouse];
|
||||||
with GetControlClassDefaultSize do
|
with GetControlClassDefaultSize do
|
||||||
SetInitialBounds(0, 0, CX, CY);
|
SetInitialBounds(0, 0, CX, CY);
|
||||||
FItems := TStringlist.Create;
|
FItems := TStringListUTF8Fast.Create;
|
||||||
FItemIndex := -1;
|
FItemIndex := -1;
|
||||||
FItemWidth := 0;
|
FItemWidth := 0;
|
||||||
FMaxLength := 0;
|
FMaxLength := 0;
|
||||||
|
@ -61,10 +61,10 @@ end;
|
|||||||
constructor TScreen.Create(AOwner : TComponent);
|
constructor TScreen.Create(AOwner : TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FFonts := TStringlist.Create;
|
FFonts := TStringListUTF8Fast.Create;
|
||||||
FCursorMap := TMap.Create(its4, SizeOf(HCursor));
|
FCursorMap := TMap.Create(its4, SizeOf(HCursor));
|
||||||
FMonitors := TMonitorList.Create;
|
FMonitors := TMonitorList.Create;
|
||||||
TStringlist(FFonts).Sorted := True;
|
//TStringlist(FFonts).Sorted := True; Will be sorted in GetFonts
|
||||||
FCustomForms := TFPList.Create;
|
FCustomForms := TFPList.Create;
|
||||||
FCustomFormsZOrdered := TFPList.Create;
|
FCustomFormsZOrdered := TFPList.Create;
|
||||||
FFormList := TFPList.Create;
|
FFormList := TFPList.Create;
|
||||||
|
@ -550,12 +550,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStoreStringList.Sort;
|
procedure TGtkListStoreStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringList;
|
sl: TStringListUTF8Fast;
|
||||||
OldSorted: Boolean;
|
OldSorted: Boolean;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl := TStringList.Create;
|
sl := TStringListUTF8Fast.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort;
|
sl.Sort;
|
||||||
OldSorted := Sorted;
|
OldSorted := Sorted;
|
||||||
@ -623,7 +623,7 @@ begin
|
|||||||
// => don't change if the content is already the same
|
// => don't change if the content is already the same
|
||||||
if Sorted then
|
if Sorted then
|
||||||
begin
|
begin
|
||||||
CmpList := TStringList.Create;
|
CmpList := TStringListUTF8Fast.Create;
|
||||||
CmpList.Assign(TStrings(Source));
|
CmpList.Assign(TStrings(Source));
|
||||||
TStringList(CmpList).Sort;
|
TStringList(CmpList).Sort;
|
||||||
end
|
end
|
||||||
|
@ -497,11 +497,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStringList.Sort;
|
procedure TGtkListStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringList;
|
sl: TStringListUTF8Fast;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl:=TStringList.Create;
|
sl:=TStringListUTF8Fast.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort; // currently this is quicksort ->
|
sl.Sort; // currently this is quicksort ->
|
||||||
// Disadvantages: - worst case on sorted list
|
// Disadvantages: - worst case on sorted list
|
||||||
@ -517,7 +517,7 @@ function TGtkListStringList.IsEqual(List: TStrings;
|
|||||||
CompareObjects: boolean): boolean;
|
CompareObjects: boolean): boolean;
|
||||||
var
|
var
|
||||||
i, Cnt: integer;
|
i, Cnt: integer;
|
||||||
CmpList: TStringList;
|
CmpList: TStringListUTF8Fast;
|
||||||
begin
|
begin
|
||||||
if List=Self then begin
|
if List=Self then begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -528,7 +528,7 @@ begin
|
|||||||
Cnt:=Count;
|
Cnt:=Count;
|
||||||
if (Cnt<>List.Count) then exit;
|
if (Cnt<>List.Count) then exit;
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
CmpList:=TStringList.Create;
|
CmpList:=TStringListUTF8Fast.Create;
|
||||||
try
|
try
|
||||||
CmpList.Assign(List);
|
CmpList.Assign(List);
|
||||||
CmpList.Sorted:=FSorted;
|
CmpList.Sorted:=FSorted;
|
||||||
|
@ -3670,7 +3670,7 @@ var
|
|||||||
Info: TSearchRec;
|
Info: TSearchRec;
|
||||||
DirName: PChar;
|
DirName: PChar;
|
||||||
Dir: string;
|
Dir: string;
|
||||||
StrList: TStringList;
|
StrList: TStringListUTF8Fast;
|
||||||
CurFileMask: String;
|
CurFileMask: String;
|
||||||
|
|
||||||
procedure Add(List: PGtkCList; const s: string);
|
procedure Add(List: PGtkCList; const s: string);
|
||||||
@ -3691,7 +3691,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
StrList := TStringList.Create;
|
StrList := TStringListUTF8Fast.Create;
|
||||||
dirs := PGtkCList(FileSelection^.dir_list);
|
dirs := PGtkCList(FileSelection^.dir_list);
|
||||||
files := PGtkCList(FileSelection^.file_list);
|
files := PGtkCList(FileSelection^.file_list);
|
||||||
DirName := gtk_file_selection_get_filename(FileSelection);
|
DirName := gtk_file_selection_get_filename(FileSelection);
|
||||||
|
@ -24,7 +24,7 @@ uses
|
|||||||
// RTL, FCL, libs
|
// RTL, FCL, libs
|
||||||
Math, Sysutils, Classes, GLib2, Gtk2, Gdk2, Gdk2pixbuf,
|
Math, Sysutils, Classes, GLib2, Gtk2, Gdk2, Gdk2pixbuf,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazTracer,
|
LazTracer, LazUTF8,
|
||||||
// LCL
|
// LCL
|
||||||
LCLType, LCLIntf, LMessages, Controls, Graphics, ComCtrls, StdCtrls, Forms,
|
LCLType, LCLIntf, LMessages, Controls, Graphics, ComCtrls, StdCtrls, Forms,
|
||||||
ImgList, InterfaceBase,
|
ImgList, InterfaceBase,
|
||||||
|
@ -1745,7 +1745,7 @@ begin
|
|||||||
New(Widgets);
|
New(Widgets);
|
||||||
with Widgets^ do
|
with Widgets^ do
|
||||||
begin
|
begin
|
||||||
ItemCache := TStringList.Create;
|
ItemCache := TStringListUTF8Fast.Create;
|
||||||
Images := nil;
|
Images := nil;
|
||||||
OldTreeSelection := nil;
|
OldTreeSelection := nil;
|
||||||
|
|
||||||
|
@ -21,7 +21,12 @@ unit gtk3private;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Classes, SysUtils, Controls, LazGtk3, LazGObject2, LazGLib2;
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
// LazUtils
|
||||||
|
LazUTF8,
|
||||||
|
// LCL
|
||||||
|
Controls, LazGtk3, LazGObject2, LazGLib2;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -315,12 +320,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStoreStringList.Sort;
|
procedure TGtkListStoreStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringList;
|
sl: TStringListUTF8Fast;
|
||||||
OldSorted: Boolean;
|
OldSorted: Boolean;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl := TStringList.Create;
|
sl := TStringListUTF8Fast.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort;
|
sl.Sort;
|
||||||
OldSorted := Sorted;
|
OldSorted := Sorted;
|
||||||
@ -388,7 +393,7 @@ begin
|
|||||||
// => don't change if the content is already the same
|
// => don't change if the content is already the same
|
||||||
if Sorted then
|
if Sorted then
|
||||||
begin
|
begin
|
||||||
CmpList := TStringList.Create;
|
CmpList := TStringListUTF8Fast.Create;
|
||||||
CmpList.Assign(TStrings(Source));
|
CmpList.Assign(TStrings(Source));
|
||||||
TStringList(CmpList).Sort;
|
TStringList(CmpList).Sort;
|
||||||
end
|
end
|
||||||
|
@ -558,7 +558,7 @@ end;
|
|||||||
|
|
||||||
procedure TQtComboStrings.Assign(Source: TPersistent);
|
procedure TQtComboStrings.Assign(Source: TPersistent);
|
||||||
var
|
var
|
||||||
AList: TStringList;
|
AList: TStringListUTF8Fast;
|
||||||
begin
|
begin
|
||||||
if (Source = Self) or (Source = nil) then Exit;
|
if (Source = Self) or (Source = nil) then Exit;
|
||||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||||
@ -566,7 +566,7 @@ begin
|
|||||||
FOwner.BeginUpdate;
|
FOwner.BeginUpdate;
|
||||||
if Sorted then
|
if Sorted then
|
||||||
begin
|
begin
|
||||||
AList := TStringList.Create;
|
AList := TStringListUTF8Fast.Create;
|
||||||
try
|
try
|
||||||
AList.Assign(Source);
|
AList.Assign(Source);
|
||||||
AList.Sort;
|
AList.Sort;
|
||||||
|
@ -111,7 +111,7 @@ type
|
|||||||
FWidgetNeedFontColorInitialization: Boolean;
|
FWidgetNeedFontColorInitialization: Boolean;
|
||||||
FChildOfComplexWidget: TChildOfComplexWidget;
|
FChildOfComplexWidget: TChildOfComplexWidget;
|
||||||
FOwnWidget: Boolean;
|
FOwnWidget: Boolean;
|
||||||
FProps: TStringList;
|
FProps: TStringListUTF8Fast;
|
||||||
FPaintData: TPaintData;
|
FPaintData: TPaintData;
|
||||||
FCentralWidget: QWidgetH;
|
FCentralWidget: QWidgetH;
|
||||||
FContext: HDC;
|
FContext: HDC;
|
||||||
@ -5643,8 +5643,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if FProps=nil then
|
if FProps=nil then
|
||||||
begin
|
begin
|
||||||
FProps:=TStringList.Create;
|
FProps:=TStringListUTF8Fast.Create;
|
||||||
//FProps.CaseSensitive:=false;
|
|
||||||
FProps.Sorted:=true;
|
FProps.Sorted:=true;
|
||||||
end;
|
end;
|
||||||
i := Fprops.IndexOf(AnIndex);
|
i := Fprops.IndexOf(AnIndex);
|
||||||
|
@ -126,12 +126,13 @@ interface
|
|||||||
{$MODE DELPHI}
|
{$MODE DELPHI}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
LazUTF8,
|
||||||
LCLType, LCLStrConsts, LCLIntf, InterfaceBase,
|
LCLType, LCLStrConsts, LCLIntf, InterfaceBase,
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Windows, CommCtrl, Messages,
|
Windows, CommCtrl, Messages,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LResources, Classes, SysUtils,
|
LResources, Menus, Graphics, Forms, Controls, StdCtrls, ExtCtrls, Buttons;
|
||||||
Menus, Graphics, Forms, Controls, StdCtrls, ExtCtrls, Buttons;
|
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
var
|
var
|
||||||
@ -1022,7 +1023,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
// add selection list or query editor
|
// add selection list or query editor
|
||||||
if Selection<>'' then begin
|
if Selection<>'' then begin
|
||||||
List := TStringList.Create;
|
List := TStringListUTF8Fast.Create;
|
||||||
try
|
try
|
||||||
Dialog.Form.Combo := TComboBox.Create(Dialog.Form);
|
Dialog.Form.Combo := TComboBox.Create(Dialog.Form);
|
||||||
with Dialog.Form.Combo do begin
|
with Dialog.Form.Combo do begin
|
||||||
|
@ -1248,7 +1248,7 @@ begin
|
|||||||
fcPenWidth :=0;
|
fcPenWidth :=0;
|
||||||
fcPenStyle :=psSolid;
|
fcPenStyle :=psSolid;
|
||||||
|
|
||||||
fHeader:=TStringList.Create;
|
fHeader:=TStringListUTF8Fast.Create;
|
||||||
fBuffer:=TstringList.Create;
|
fBuffer:=TstringList.Create;
|
||||||
fDocument:=TStringList.Create;
|
fDocument:=TStringList.Create;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, Math,
|
Classes, SysUtils, Math,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
Maps;
|
Maps, LazUTF8;
|
||||||
|
|
||||||
type
|
type
|
||||||
TUnicodeBlock = record
|
TUnicodeBlock = record
|
||||||
@ -44,7 +44,7 @@ type
|
|||||||
FGlyphs: TMap;
|
FGlyphs: TMap;
|
||||||
FBlocks: array of TUnicodeBlock;
|
FBlocks: array of TUnicodeBlock;
|
||||||
FEncodings: array of Integer;
|
FEncodings: array of Integer;
|
||||||
FOutLst, FBaseFonts,FEncodedFonts,FUsedFonts: TStringList;
|
FOutLst, FBaseFonts, FEncodedFonts, FUsedFonts: TStringList;
|
||||||
FLastFontIndex: Integer;
|
FLastFontIndex: Integer;
|
||||||
FFont: string;
|
FFont: string;
|
||||||
procedure CountPSChars;
|
procedure CountPSChars;
|
||||||
@ -67,7 +67,7 @@ type
|
|||||||
property Font: string read FFont write SetFont;
|
property Font: string read FFont write SetFont;
|
||||||
property FontSize: Integer read FFontSize write SetFontSize;
|
property FontSize: Integer read FFontSize write SetFontSize;
|
||||||
property FOntStyle: Integer read FFontStyle write SetFontStyle;
|
property FOntStyle: Integer read FFontStyle write SetFontStyle;
|
||||||
property OutLst: TStringlist read FOutLst write FOutLst;
|
property OutLst: TStringList read FOutLst write FOutLst;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -294,9 +294,9 @@ end;
|
|||||||
constructor TPsUnicode.create;
|
constructor TPsUnicode.create;
|
||||||
begin
|
begin
|
||||||
inherited create;
|
inherited create;
|
||||||
FBaseFonts := TStringList.Create;
|
FBaseFonts := TStringListUTF8Fast.Create;
|
||||||
FEncodedFonts := TStringList.Create;
|
FEncodedFonts := TStringListUTF8Fast.Create;
|
||||||
FUsedFonts := TStringList.Create;
|
FUsedFonts := TStringListUTF8Fast.Create;
|
||||||
FLastFontIndex := -1;
|
FLastFontIndex := -1;
|
||||||
FFontSize := 12;
|
FFontSize := 12;
|
||||||
end;
|
end;
|
||||||
|
@ -22,7 +22,12 @@ unit Printers;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Graphics;
|
Classes, SysUtils,
|
||||||
|
// LazUtils
|
||||||
|
LazLoggerBase, LazUTF8,
|
||||||
|
// LCL
|
||||||
|
LCLProc, Graphics;
|
||||||
|
|
||||||
type
|
type
|
||||||
TPrinter = Class;
|
TPrinter = Class;
|
||||||
EPrinter = class(Exception);
|
EPrinter = class(Exception);
|
||||||
@ -694,7 +699,7 @@ end;
|
|||||||
function TPrinter.GetPrinters: TStrings;
|
function TPrinter.GetPrinters: TStrings;
|
||||||
begin
|
begin
|
||||||
if not Assigned(fPrinters) then
|
if not Assigned(fPrinters) then
|
||||||
fPrinters:=TStringList.Create;
|
fPrinters:=TStringListUTF8Fast.Create;
|
||||||
Result:=fPrinters;
|
Result:=fPrinters;
|
||||||
|
|
||||||
//Only 1 initialization
|
//Only 1 initialization
|
||||||
|
@ -873,7 +873,7 @@ begin
|
|||||||
with TFileItem(Files.Objects[i]) do DoAddItem(FBasePath, FileInfo, CanAdd);
|
with TFileItem(Files.Objects[i]) do DoAddItem(FBasePath, FileInfo, CanAdd);
|
||||||
if CanAdd then
|
if CanAdd then
|
||||||
begin
|
begin
|
||||||
NewNode := Items.AddChildObject(ANode, Files.Strings[i], nil);
|
NewNode := Items.AddChildObject(ANode, Files[i], nil);
|
||||||
TShellTreeNode(NewNode).FFileInfo := TFileItem(Files.Objects[i]).FileInfo;
|
TShellTreeNode(NewNode).FFileInfo := TFileItem(Files.Objects[i]).FileInfo;
|
||||||
TShellTreeNode(NewNode).SetBasePath(TFileItem(Files.Objects[i]).FBasePath);
|
TShellTreeNode(NewNode).SetBasePath(TFileItem(Files.Objects[i]).FBasePath);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user