Speeding up
Posted: Tue Oct 17, 2023 8:19 pm
I use this function many many times in building resources.
Basically it runs down through TRichViewEdit looking for markers like <:> and </:>, <link> and </link> etc then information is pulled out and brought into another TRichViewEdit. Ideas on how to speed this up since it is very core to the whole operation?
I am already using
Basically it runs down through TRichViewEdit looking for markers like <:> and </:>, <link> and </link> etc then information is pulled out and brought into another TRichViewEdit. Ideas on how to speed this up since it is very core to the whole operation?
I am already using
Code: Select all
RVAControlPanel1.ActionsEnabled := False;
rvActionStyleInspector1.Control := nil;
cmbFont.Editor := nil;
cmbFontSize.Editor := nil;
cmbStyles.Editor := nil;
for i := 0 to ActionList1.ActionCount - 1 do
ActionList1.Actions[i].Update;
RichViewEdit.BeginUpdate;
Code: Select all
function TConvertBook.FindSelIndic(indic:String; rve: TRichViewEdit;
var startNo, startOffs,//Not always used but sometimes so keep
endNo, endOffs, //Use var because we don't change unless we have to
endendNo, endendOffs: Integer;
toplink_i: Integer = 0; topid: Integer = 5 {<:>}): Boolean;
var
endstartNo, endstartOffs: Integer;
TopBool: Boolean;
begin
rve.TopLevelEditor.GetSelectionBounds(startNo, startOffs, endNo, endOffs, TRUE);
Result := rve.SearchTextW(indic, [rvseoMatchCase, rvseoDown, rvseoMultiItem]);
//If we are testing toplink_i then do this
TopBool := True;
if toplink_i = topid {<:>} then
TopBool := False;
if Result AND TopBool then
begin
//Get the position before and after this here
rve.TopLevelEditor.GetSelectionBounds(endstartNo, endstartOffs,endendNo, endendOffs, TRUE);
//Select then Get Content between. //eNo, endOffs, endstartNo, endstartOffs
rve.TopLevelEditor.SetSelectionBounds(endNo, endOffs, endstartNo, endstartOffs);
end;
end;