mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 18:17:18 +02:00
ExamplesWindow: Minor fixes, remove debug lines and timing code. Issue #40190, patch by dbannon.
This commit is contained in:
parent
ffa9a8a233
commit
c5ffb2e914
@ -30,8 +30,6 @@ project in a remote git repo. As we now do cover third party project, a remote
|
||||
{$mode ObjFPC}{$H+}
|
||||
{$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
|
||||
|
||||
{X$define SHOW_DEBUG} // ToDo : remove this
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -174,7 +172,6 @@ type
|
||||
// directory (ThirdParty) or in the copy in ExampleWorkArea (Lazarus SRC).
|
||||
function IsValidProject(ExIndex: integer): boolean;
|
||||
destructor Destroy; override;
|
||||
procedure DumpExData();
|
||||
function Count : integer;
|
||||
property ErrorMsg : string read ErrorString write FSetErrorString;
|
||||
class function EscJSON(InStr: string): string;
|
||||
@ -222,7 +219,7 @@ begin
|
||||
Result := Result.Replace('"', '\"', [rfReplaceAll] );
|
||||
end; *)
|
||||
|
||||
function TExampleList.IsInKeywords(St: string; AnIndex: integer): boolean; // ToDo : private now I think
|
||||
function TExampleList.IsInKeywords(St: string; AnIndex: integer): boolean;
|
||||
var KeyWord : String;
|
||||
begin
|
||||
result := false;
|
||||
@ -668,11 +665,6 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TExampleData.DumpExData; // ToDo : remove this, just a debug thingo
|
||||
begin
|
||||
ExList.DumpList('TExampleData.Dump', True);
|
||||
end;
|
||||
|
||||
constructor TExampleData.Create();
|
||||
begin
|
||||
ExList := TExampleList.Create;
|
||||
@ -716,18 +708,12 @@ begin
|
||||
while True do begin
|
||||
inc(GetListDataIndex);
|
||||
if GetListDataIndex >= ExList.Count then exit; // end of list
|
||||
if TheCatFilter <> '' then begin // Find an entry in one of the categories
|
||||
// skip ahead until we find next item with complient Category
|
||||
if pos(ExList.Items[GetListDataIndex]^.Category, TheCatFilter) < 1 then begin
|
||||
inc(GetListDataIndex);
|
||||
if GetListDataIndex >= ExList.Count then exit;
|
||||
continue;
|
||||
end;
|
||||
end; // if to here, have an entry thats a match for category, how about keywords ?
|
||||
if pos(ExList.Items[GetListDataIndex]^.Category, TheCatFilter) < 1 then
|
||||
continue;
|
||||
// if to here, have an entry thats a match for category, how about keywords ?
|
||||
if KeyList = nil then exit(GetListDataIndex); // thats all we need then
|
||||
if ExList.IsInKeywords(KeyList, GetListDataIndex) then // Found one !
|
||||
exit(GetListDataIndex);
|
||||
// else, we loop around again, first find a category match then a keyword match, in both cases, if required.
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -766,8 +752,6 @@ begin
|
||||
if FindFirst(CheckPath + '*.lpi', faAnyFile, Info) = 0 then begin
|
||||
Result := CheckPath + Info.Name;
|
||||
end;
|
||||
if Result = '' then
|
||||
debugln('Hint : [TExampleData.GetProjectFile] - ' + CheckPath + ' does not contain an LPI file');
|
||||
FindClose(Info);
|
||||
end;
|
||||
|
||||
|
@ -154,7 +154,7 @@ begin
|
||||
KeyW := '';
|
||||
for St in EX.ExList.Items[ExIndex]^.Keywords do
|
||||
KeyW := KeyW + St + ' ';
|
||||
NewLVItem(Ex.ExList[ExIndex]^.EName, KeyW, ExIndex); // ToDo : review items
|
||||
NewLVItem(Ex.ExList[ExIndex]^.EName, KeyW, ExIndex);
|
||||
ExIndex := Ex.FindListData(False, CFilter, KeyList);
|
||||
end;
|
||||
finally
|
||||
@ -517,12 +517,12 @@ end;
|
||||
procedure TFormLazExam.FormShow(Sender: TObject);
|
||||
var
|
||||
i : integer;
|
||||
T1, T2, T3, T4, T5 : dword; // ToDo : remove
|
||||
// T1, T2, T3, T4, T5 : dword;
|
||||
begin
|
||||
Screen.BeginWaitCursor;
|
||||
Application.ProcessMessages;
|
||||
DisableAutoSizing; // good improvement on form draw time
|
||||
T1 := gettickcount64();
|
||||
//T1 := gettickcount64();
|
||||
Memo1.clear;
|
||||
EditSearch.text := '';
|
||||
Top := Screen.Height div 10;
|
||||
@ -533,23 +533,23 @@ begin
|
||||
Ex := TExampleData.Create();
|
||||
Ex.ExamplesHome := ExamplesHome;
|
||||
EX.LazConfigDir := LazConfigDir;
|
||||
T2 := gettickcount64();
|
||||
//T2 := gettickcount64();
|
||||
Ex.LoadExData(FromLazSrcTree);
|
||||
T3 := gettickcount64();
|
||||
//T3 := gettickcount64();
|
||||
Ex.LoadExData(FromThirdParty);
|
||||
if Ex.ErrorMsg <> '' then
|
||||
Showmessage(Ex.ErrorMsg); // Note : previously, we treated this as fatal ?
|
||||
T4 := gettickcount64();
|
||||
//T4 := gettickcount64();
|
||||
CheckGroupCategory.Items := Ex.CatList;
|
||||
for i := 0 to CheckGroupCategory.items.Count-1 do // check all the categories we found.
|
||||
CheckGroupCategory.Checked[i] := true;
|
||||
ListView1.Clear;
|
||||
LoadUpListView();
|
||||
ListView1.SetFocus;
|
||||
T5 := gettickcount64();
|
||||
//T5 := gettickcount64();
|
||||
Screen.EndWaitCursor;
|
||||
Application.ProcessMessages;
|
||||
debugln('TFormLazExam.FormShow Timing ' + inttostr(T2-T1) + 'mS ' + inttostr(T3-T2) + 'mS ' + inttostr(T4-T3) + 'mS ' + inttostr(T5-T4) + 'mS');
|
||||
//debugln('TFormLazExam.FormShow Timing ' + inttostr(T2-T1) + 'mS ' + inttostr(T3-T2) + 'mS ' + inttostr(T4-T3) + 'mS ' + inttostr(T5-T4) + 'mS');
|
||||
EnableAutoSizing;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user