You've already forked lazarus-ccr
richmemo: Search and SetSetLengthFor methods
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3771 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -24,7 +24,7 @@ unit RichMemo;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Graphics, StdCtrls;
|
||||
Classes, SysUtils, Graphics, StdCtrls, LazUTF8;
|
||||
|
||||
type
|
||||
TFontParams = record
|
||||
@ -60,6 +60,9 @@ type
|
||||
|
||||
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles);
|
||||
|
||||
TSearchOption = (soMatchCase, soWholeWord, soBackward);
|
||||
TSearchOptions = set of TSearchOption;
|
||||
|
||||
|
||||
type
|
||||
TRichMemoObject = class(TObject);
|
||||
@ -103,6 +106,10 @@ type
|
||||
function LoadRichText(Source: TStream): Boolean; virtual;
|
||||
function SaveRichText(Dest: TStream): Boolean; virtual;
|
||||
|
||||
procedure SetSelLengthFor(const aselstr: string);
|
||||
|
||||
function Search(const ANiddle: string; Start, Len: Integer; const SearchOpt: TSearchOptions): Integer;
|
||||
|
||||
property HideSelection : Boolean read fHideSelection write SetHideSelection;
|
||||
end;
|
||||
|
||||
@ -435,11 +442,11 @@ begin
|
||||
finally
|
||||
Self.Lines.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
if not Result then
|
||||
end else begin
|
||||
Result := TWSCustomRichMemoClass(WidgetSetClass).LoadRichText(Self, Source);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomRichMemo.SaveRichText(Dest: TStream): Boolean;
|
||||
begin
|
||||
@ -451,5 +458,25 @@ begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
procedure TCustomRichMemo.SetSelLengthFor(const aselstr: string);
|
||||
begin
|
||||
SelLength:=UTF8Length(aselstr);
|
||||
end;
|
||||
|
||||
function TCustomRichMemo.Search(const ANiddle: string; Start, Len: Integer;
|
||||
const SearchOpt: TSearchOptions): Integer;
|
||||
var
|
||||
so : TIntSearchOpt;
|
||||
begin
|
||||
if not HandleAllocated then HandleNeeded;
|
||||
if HandleAllocated then begin
|
||||
so.len:=Len;
|
||||
so.start:=Start;
|
||||
so.options:=SearchOpt;
|
||||
Result:=TWSCustomRichMemoClass(WidgetSetClass).Search(Self, ANiddle, so);
|
||||
end else
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -48,6 +48,12 @@ type
|
||||
Tabs : array of TTabInfo;
|
||||
end;
|
||||
|
||||
TIntSearchOpt = record
|
||||
start : Integer;
|
||||
len : Integer;
|
||||
Options : TSearchOptions;
|
||||
end;
|
||||
|
||||
{ TWSCustomRichMemo }
|
||||
|
||||
TWSCustomRichMemo = class(TWSCustomMemo)
|
||||
@ -80,6 +86,8 @@ type
|
||||
class procedure SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean); override;
|
||||
class function LoadRichText(const AWinControl: TWinControl; Source: TStream): Boolean; virtual;
|
||||
class function SaveRichText(const AWinControl: TWinControl; Dest: TStream): Boolean; virtual;
|
||||
|
||||
class function Search(const AWinControl: TWinControl; const ANiddle: string; const SearchOpts: TIntSearchOpt): Integer; virtual;
|
||||
end;
|
||||
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
||||
|
||||
@ -186,5 +194,11 @@ begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
class function TWSCustomRichMemo.Search(const AWinControl: TWinControl; const ANiddle: string;
|
||||
const SearchOpts: TIntSearchOpt): Integer;
|
||||
begin
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user