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
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Graphics, StdCtrls;
|
Classes, SysUtils, Graphics, StdCtrls, LazUTF8;
|
||||||
|
|
||||||
type
|
type
|
||||||
TFontParams = record
|
TFontParams = record
|
||||||
@ -60,6 +60,9 @@ type
|
|||||||
|
|
||||||
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles);
|
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles);
|
||||||
|
|
||||||
|
TSearchOption = (soMatchCase, soWholeWord, soBackward);
|
||||||
|
TSearchOptions = set of TSearchOption;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TRichMemoObject = class(TObject);
|
TRichMemoObject = class(TObject);
|
||||||
@ -103,6 +106,10 @@ type
|
|||||||
function LoadRichText(Source: TStream): Boolean; virtual;
|
function LoadRichText(Source: TStream): Boolean; virtual;
|
||||||
function SaveRichText(Dest: 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;
|
property HideSelection : Boolean read fHideSelection write SetHideSelection;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -435,10 +442,10 @@ begin
|
|||||||
finally
|
finally
|
||||||
Self.Lines.EndUpdate;
|
Self.Lines.EndUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end else begin
|
||||||
if not Result then
|
|
||||||
Result := TWSCustomRichMemoClass(WidgetSetClass).LoadRichText(Self, Source);
|
Result := TWSCustomRichMemoClass(WidgetSetClass).LoadRichText(Self, Source);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRichMemo.SaveRichText(Dest: TStream): Boolean;
|
function TCustomRichMemo.SaveRichText(Dest: TStream): Boolean;
|
||||||
@ -451,5 +458,25 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
end;
|
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.
|
end.
|
||||||
|
|
||||||
|
@ -48,6 +48,12 @@ type
|
|||||||
Tabs : array of TTabInfo;
|
Tabs : array of TTabInfo;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TIntSearchOpt = record
|
||||||
|
start : Integer;
|
||||||
|
len : Integer;
|
||||||
|
Options : TSearchOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWSCustomRichMemo }
|
{ TWSCustomRichMemo }
|
||||||
|
|
||||||
TWSCustomRichMemo = class(TWSCustomMemo)
|
TWSCustomRichMemo = class(TWSCustomMemo)
|
||||||
@ -80,6 +86,8 @@ type
|
|||||||
class procedure SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean); override;
|
class procedure SetHideSelection(const ACustomEdit: TCustomEdit; AHideSelection: Boolean); override;
|
||||||
class function LoadRichText(const AWinControl: TWinControl; Source: TStream): Boolean; virtual;
|
class function LoadRichText(const AWinControl: TWinControl; Source: TStream): Boolean; virtual;
|
||||||
class function SaveRichText(const AWinControl: TWinControl; Dest: 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;
|
end;
|
||||||
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
||||||
|
|
||||||
@ -186,5 +194,11 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWSCustomRichMemo.Search(const AWinControl: TWinControl; const ANiddle: string;
|
||||||
|
const SearchOpts: TIntSearchOpt): Integer;
|
||||||
|
begin
|
||||||
|
Result:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user