You've already forked lazarus-ccr
fix in carbonrichedit getting attributes. changes richedit getting atttributes interface. updated simpletest
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@840 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -40,9 +40,9 @@ type
|
||||
class function GetStyleRange(const AWinControl: TWinControl; TextStart: Integer;
|
||||
var RangeStart, RangeLen: Integer): Boolean; override;
|
||||
class function GetTextAttributes(const AWinControl: TWinControl; TextStart: Integer;
|
||||
var Params: TFontParams): Boolean; override;
|
||||
var Params: TIntFontParams): Boolean; override;
|
||||
class procedure SetTextAttributes(const AWinControl: TWinControl; TextStart, TextLen: Integer;
|
||||
Mask: TTextStyleMask; const Params: TFontParams); override;
|
||||
{Mask: TTextStyleMask;} const Params: TIntFontParams); override;
|
||||
class procedure SetHideSelection(const AWinControl: TWinControl; AHideSelection: Boolean); override;
|
||||
class function LoadRichText(const AWinControl: TWinControl; Src: TStream): Boolean; override;
|
||||
class function SaveRichText(const AWinControl: TWinControl; Dst: TStream): Boolean; override;
|
||||
@ -163,32 +163,32 @@ begin
|
||||
Attr.data.dataPtr := astyle;
|
||||
end;
|
||||
|
||||
procedure ParamsToTXNAttribs(ParamsMask: TTextStyleMask; const Params: TFontParams;
|
||||
procedure ParamsToTXNAttribs({ParamsMask: TTextStyleMask;} const Params: TIntFontParams;
|
||||
var Attr: array of TXNTypeAttributes; var AttrCount: Integer; var MacColor: RGBColor);
|
||||
begin
|
||||
AttrCount := 0;
|
||||
//todo: replace QuickDraw style by ATSU style
|
||||
|
||||
if tsm_Color in ParamsMask then begin
|
||||
//if tsm_Color in ParamsMask then begin
|
||||
MacColor := ColorToRGBColor(Params.Color);
|
||||
AttrSetColor(MacColor, Attr[AttrCount] );
|
||||
inc(AttrCount);
|
||||
end;
|
||||
//end;
|
||||
|
||||
if tsm_Name in ParamsMask then begin
|
||||
//if tsm_Name in ParamsMask then begin
|
||||
AttrSetFontName(Params.Name, Attr[AttrCount] );
|
||||
inc(AttrCount);
|
||||
end;
|
||||
//end;
|
||||
|
||||
if tsm_Size in ParamsMask then begin
|
||||
//if tsm_Size in ParamsMask then begin
|
||||
AttrSetSize(Params.Size, Attr[AttrCount] );
|
||||
inc(AttrCount);
|
||||
end;
|
||||
//end;
|
||||
|
||||
if tsm_Styles in ParamsMask then begin
|
||||
//if tsm_Styles in ParamsMask then begin
|
||||
AttrSetStyle(Params.Style, Attr[AttrCount]);
|
||||
inc(AttrCount);
|
||||
end;
|
||||
//end;
|
||||
end;
|
||||
|
||||
{ TCarbonWSCustomRichMemo }
|
||||
@ -203,8 +203,6 @@ class function TCarbonWSCustomRichMemo.GetStyleRange(const AWinControl: TWinCont
|
||||
TextStart: Integer; var RangeStart, RangeLen: Integer): Boolean;
|
||||
var
|
||||
edit : TCarbonRichEdit;
|
||||
obj : TXNObject;
|
||||
sst, slen : Integer;
|
||||
st, len : Integer;
|
||||
send : Integer;
|
||||
fndstyle : Boolean;
|
||||
@ -227,77 +225,12 @@ begin
|
||||
RangeLen := RngEnd - RngStart;
|
||||
end;
|
||||
|
||||
{ edit.GetSelStart(sst);
|
||||
edit.GetSelLength(slen);
|
||||
|
||||
edit.SetSelStart(TextStart);
|
||||
edit.SetSelLength(1);
|
||||
|
||||
ATSUCreateStyle(astyle);
|
||||
AttrSetATSUStyle(nil, wattr[0]);
|
||||
AttrSetColor(macrgb, wattr[1]);
|
||||
edit.GetContinuousTypeAttributes(flags, 2, wattr[0]);
|
||||
|
||||
GetTextLen(AWinControl, len);
|
||||
dec(len, TextStart);
|
||||
st:=TextStart;
|
||||
|
||||
writeln('TextStart = ', TextStart);
|
||||
writeln('TextLength = ', 2);
|
||||
edit.SetSelStart(TextStart);
|
||||
edit.SetSelLength(2);//send-TextStart);
|
||||
attr := wattr;
|
||||
edit.GetContinuousTypeAttributes(flags, 2, attr);
|
||||
|
||||
writeln('contflags ',flags);
|
||||
|
||||
Result := true;}
|
||||
|
||||
{ fndstyle := false;
|
||||
while not fndstyle do begin
|
||||
edit.SetSelStart(st);
|
||||
edit.SetSelLength(len);
|
||||
attr := wattr;
|
||||
|
||||
send := st + len;
|
||||
repeat
|
||||
writeln(st,' ', send);
|
||||
d := (st+send) div 2; {разделить пополам интервал просмотра}
|
||||
edit.SetSelStart(TextStart);
|
||||
edit.SetSelLength(send-TextStart);
|
||||
attr := wattr;
|
||||
edit.GetContinuousTypeAttributes(flags, 2, attr);
|
||||
if flags = (kTXNColorContinuousMask or kTXNATSUIStyleContinuousMask) then
|
||||
st := st+1
|
||||
else
|
||||
send := d-1;
|
||||
until (st>send);}
|
||||
|
||||
{ while send > st do begin
|
||||
writeln(st, ' ', send, ' ', send - st, ' ', (send - st) div 2);
|
||||
attr := wattr;
|
||||
edit.SetSelStart(st);
|
||||
edit.SetSelLength(st+len);
|
||||
edit.GetContinuousTypeAttributes(flags, 2, attr);
|
||||
writeln(' flags = ', flags);
|
||||
{d := (send - st) div 2;
|
||||
if d = 0 then d := 1;}
|
||||
if flags = (kTXNColorContinuousMask or kTXNATSUIStyleContinuousMask)
|
||||
then st := send
|
||||
else dec(send, d);
|
||||
end;
|
||||
Result := send - TextStart;}
|
||||
// end;
|
||||
|
||||
{ edit.SetSelStart(sst);
|
||||
edit.SetSelLength(slen);
|
||||
ATSUDisposeStyle(astyle);}
|
||||
end;
|
||||
|
||||
class function TCarbonWSCustomRichMemo.GetTextAttributes(const AWinControl: TWinControl;
|
||||
TextStart: Integer; var Params: TFontParams): Boolean;
|
||||
TextStart: Integer; var Params: TIntFontParams): Boolean;
|
||||
var
|
||||
memo : TCarbonRichEdit;
|
||||
edit : TCarbonRichEdit;
|
||||
attr : array [0..1] of TXNTypeAttributes;
|
||||
sstart : Integer;
|
||||
slen : Integer;
|
||||
@ -307,20 +240,20 @@ var
|
||||
|
||||
begin
|
||||
Result := false;
|
||||
memo := GetValidRichEdit(AWinControl);
|
||||
if not Assigned(memo) then Exit;
|
||||
edit := GetValidRichEdit(AWinControl);
|
||||
if not Assigned(edit) then Exit;
|
||||
|
||||
memo.GetSelStart(sstart);
|
||||
memo.GetSelLength(slen);
|
||||
edit.GetSelStart(sstart);
|
||||
edit.GetSelLength(slen);
|
||||
|
||||
memo.SetSelStart(TextStart);
|
||||
memo.SetSelLength(1);
|
||||
edit.SetSelStart(TextStart);
|
||||
edit.SetSelLength(1);
|
||||
|
||||
ATSUCreateStyle(astyle);
|
||||
AttrSetATSUStyle(astyle, attr[0]);
|
||||
AttrSetStyle([], attr[1]);
|
||||
|
||||
Result := memo.GetContinuousTypeAttributes(flags, 2, attr);
|
||||
Result := edit.GetContinuousTypeAttributes(flags, 2, attr);
|
||||
Params.Name := GetATSUFontName(astyle);
|
||||
Params.Color := GetATSUFontColor(astyle);
|
||||
Params.Style := GetATSUFontStyles(astyle) + QDStyleToFontStyle(attr[1].data.dataValue);
|
||||
@ -328,13 +261,12 @@ begin
|
||||
|
||||
ATSUDisposeStyle(astyle);
|
||||
|
||||
memo.SetSelLength(sstart);
|
||||
memo.SetSelLength(slen);
|
||||
edit.SetSelStart(sstart);
|
||||
edit.SetSelLength(slen);
|
||||
end;
|
||||
|
||||
class procedure TCarbonWSCustomRichMemo.SetTextAttributes(const AWinControl: TWinControl;
|
||||
TextStart, TextLen: Integer;
|
||||
Mask: TTextStyleMask; const Params: TFontParams);
|
||||
TextStart, TextLen: Integer; {Mask: TTextStyleMask; }const Params: TIntFontParams);
|
||||
var
|
||||
memo : TCarbonRichEdit;
|
||||
Attr : array [0..TXNAttributesMax-1] of TXNTypeAttributes;
|
||||
@ -344,7 +276,7 @@ begin
|
||||
memo := GetValidRichEdit(AWinControl);
|
||||
if not Assigned(memo) then Exit;
|
||||
|
||||
ParamsToTXNAttribs(Mask, Params, attr, Count, maccolor);
|
||||
ParamsToTXNAttribs({Mask,} Params, attr, Count, maccolor);
|
||||
|
||||
memo.SetTypeAttributes(Count, Attr, TextStart, TextStart+TextLen);
|
||||
end;
|
||||
|
@ -10,6 +10,17 @@ uses
|
||||
|
||||
type
|
||||
|
||||
TFontParams = TIntFontParams;
|
||||
{TIntFontParams = record // declared at WSRichMemo
|
||||
Name : String;
|
||||
Size : Integer;
|
||||
Color : TColor;
|
||||
Style : TFontStyles;
|
||||
end; }
|
||||
|
||||
|
||||
TTextModifyMask = set of (tmm_Color, tmm_Name, tmm_Size, tmm_Styles);
|
||||
|
||||
{ TCustomRichMemo }
|
||||
|
||||
TCustomRichMemo = class(TCustomMemo)
|
||||
@ -21,12 +32,15 @@ type
|
||||
procedure UpdateRichMemo; virtual;
|
||||
procedure SetHideSelection(AValue: Boolean);
|
||||
public
|
||||
procedure SetTextAttributes(TextStart, TextLen: Integer; SetMask: TTextStyleMask; const TextParams: TFontParams); virtual;
|
||||
procedure SetTextAttributes(TextStart, TextLen: Integer; const TextParams: TFontParams); virtual;
|
||||
function GetTextAttributes(TextStart: Integer; var TextParams: TFontParams): Boolean; virtual;
|
||||
function GetStyleRange(TextStart: Integer; var RangeStart, RangeLen: Integer): Boolean; virtual;
|
||||
|
||||
procedure SetTextAttributes(TextStart, TextLen: Integer; AFont: TFont);
|
||||
function GetStyleLength(TextStart: Integer): Integer;
|
||||
procedure SetRangeColor(TextStart, TextLength: Integer; FontColor: TColor);
|
||||
procedure SetRangeParams(TextStart, TextLength: Integer; ModifyMask: TTextModifyMask;
|
||||
const FontName: String; FontSize: Integer; FontColor: TColor; AddFontStyle, RemoveFontStyle: TFontStyles);
|
||||
|
||||
function LoadRichText(Source: TStream): Boolean; virtual;
|
||||
function SaveRichText(Dest: TStream): Boolean; virtual;
|
||||
@ -91,9 +105,6 @@ type
|
||||
property WordWrap;
|
||||
end;
|
||||
|
||||
const
|
||||
TextStyleAll : TTextStyleMask = [tsm_Color, tsm_Name, tsm_Size, tsm_Styles];
|
||||
|
||||
function GetFontParams(styles: TFontStyles): TFontParams; overload;
|
||||
function GetFontParams(color: TColor; styles: TFontStyles): TFontParams; overload;
|
||||
function GetFontParams(const Name: String; color: TColor; styles: TFontStyles): TFontParams; overload;
|
||||
@ -160,14 +171,14 @@ begin
|
||||
params.Color := AFont.Color;
|
||||
params.Size := AFont.Size;
|
||||
params.Style := AFont.Style;
|
||||
SetTextAttributes(TextStart, TextLen, TextStyleAll, params);
|
||||
SetTextAttributes(TextStart, TextLen, {TextStyleAll,} params);
|
||||
end;
|
||||
|
||||
procedure TCustomRichMemo.SetTextAttributes(TextStart, TextLen: Integer;
|
||||
SetMask: TTextStyleMask; const TextParams: TFontParams);
|
||||
{SetMask: TTextStyleMask;} const TextParams: TFontParams);
|
||||
begin
|
||||
if HandleAllocated then
|
||||
TWSCustomRichMemoClass(WidgetSetClass).SetTextAttributes(Self, TextStart, TextLen, SetMask, TextParams);
|
||||
TWSCustomRichMemoClass(WidgetSetClass).SetTextAttributes(Self, TextStart, TextLen, {SetMask,} TextParams);
|
||||
end;
|
||||
|
||||
function TCustomRichMemo.GetTextAttributes(TextStart: Integer; var TextParams: TFontParams): Boolean;
|
||||
@ -194,10 +205,42 @@ function TCustomRichMemo.GetStyleLength(TextStart: Integer): Integer;
|
||||
var
|
||||
ofs, len : Integer;
|
||||
begin
|
||||
if GetStyleRange(TextStart, ofs, len) then
|
||||
Result := len - (TextStart-ofs)
|
||||
else
|
||||
Result := 0;
|
||||
if GetStyleRange(TextStart, ofs, len) then Result := len - (TextStart-ofs)
|
||||
else Result := 1;
|
||||
if Result = 0 then Result := 1;
|
||||
end;
|
||||
|
||||
procedure TCustomRichMemo.SetRangeColor(TextStart, TextLength: Integer; FontColor: TColor);
|
||||
begin
|
||||
SetRangeParams(TextStart, TextLength, [tmm_Color], '', 0, FontColor, [], []);
|
||||
end;
|
||||
|
||||
procedure TCustomRichMemo.SetRangeParams(TextStart, TextLength: Integer; ModifyMask: TTextModifyMask;
|
||||
const FontName: String; FontSize: Integer; FontColor: TColor; AddFontStyle, RemoveFontStyle: TFontStyles);
|
||||
var
|
||||
i : Integer;
|
||||
j : Integer;
|
||||
l : Integer;
|
||||
p : TFontParams;
|
||||
begin
|
||||
if (ModifyMask = []) or (TextLength = 0) then Exit;
|
||||
|
||||
i := TextStart;
|
||||
j := TextStart + TextLength;
|
||||
while i < j do begin
|
||||
GetTextAttributes(i, p);
|
||||
|
||||
if tmm_Name in ModifyMask then p.Name := FontName;
|
||||
if tmm_Color in ModifyMask then p.Color := FontColor;
|
||||
if tmm_Size in ModifyMask then p.Size := FontSize;
|
||||
if tmm_Styles in ModifyMask then p.Style := p.Style + AddFontStyle - RemoveFontStyle;
|
||||
|
||||
l := GetStyleLength(i);
|
||||
if i + l > j then l := j - i;
|
||||
if l = 0 then l := 1;
|
||||
SetTextAttributes(i, l, p);
|
||||
inc(i, l);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
unit RichMemoTypes;
|
||||
unit RichMemoTypes; //todo: remove
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -7,16 +7,6 @@ interface
|
||||
uses
|
||||
Graphics;
|
||||
|
||||
type
|
||||
TTextStyleMask = set of (tsm_Color, tsm_Name, tsm_Size, tsm_Styles);
|
||||
|
||||
TFontParams = record
|
||||
Name : String;
|
||||
Size : Integer;
|
||||
Color : TColor;
|
||||
Style : TFontStyles;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -40,7 +40,7 @@
|
||||
<CursorPos X="32" Y="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="46"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -49,10 +49,10 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<CursorPos X="62" Y="83"/>
|
||||
<TopLine Value="76"/>
|
||||
<CursorPos X="46" Y="51"/>
|
||||
<TopLine Value="42"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="46"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
@ -60,84 +60,84 @@
|
||||
<UnitName Value="CarbonRichMemo"/>
|
||||
<CursorPos X="31" Y="137"/>
|
||||
<TopLine Value="114"/>
|
||||
<UsageCount Value="14"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../RichMemo/win32/win32richmemo.pas"/>
|
||||
<UnitName Value="Win32RichMemo"/>
|
||||
<CursorPos X="1" Y="32"/>
|
||||
<TopLine Value="15"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../RichMemo/richmemofactory.pas"/>
|
||||
<UnitName Value="RichMemoFactory"/>
|
||||
<CursorPos X="20" Y="22"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../RichMemo/wsrichmemo.pas"/>
|
||||
<UnitName Value="WSRichMemo"/>
|
||||
<CursorPos X="32" Y="18"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../lazarus/lcl/widgetset/wsstdctrls.pp"/>
|
||||
<UnitName Value="WSStdCtrls"/>
|
||||
<CursorPos X="32" Y="140"/>
|
||||
<TopLine Value="126"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../lazarus/lcl/widgetset/wscontrols.pp"/>
|
||||
<UnitName Value="WSControls"/>
|
||||
<CursorPos X="33" Y="115"/>
|
||||
<TopLine Value="100"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../lazarus/lcl/lcltype.pp"/>
|
||||
<UnitName Value="LCLType"/>
|
||||
<CursorPos X="3" Y="2330"/>
|
||||
<TopLine Value="2316"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbonedits.pp"/>
|
||||
<UnitName Value="CarbonEdits"/>
|
||||
<CursorPos X="3" Y="140"/>
|
||||
<TopLine Value="124"/>
|
||||
<UsageCount Value="14"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="../lazarus/lcl/widgetset/wscomctrls.pp"/>
|
||||
<UnitName Value="WSComCtrls"/>
|
||||
<CursorPos X="1" Y="144"/>
|
||||
<TopLine Value="144"/>
|
||||
<UsageCount Value="8"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbonwsstdctrls.pp"/>
|
||||
<UnitName Value="CarbonWSStdCtrls"/>
|
||||
<CursorPos X="20" Y="39"/>
|
||||
<TopLine Value="30"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="../fpc/packages/univint/src/MacOSAll.pas"/>
|
||||
<UnitName Value="MacOSAll"/>
|
||||
<CursorPos X="3" Y="35065"/>
|
||||
<TopLine Value="35051"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbongdiobjects.pp"/>
|
||||
<UnitName Value="CarbonGDIObjects"/>
|
||||
<CursorPos X="3" Y="1109"/>
|
||||
<TopLine Value="1100"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="25" Y="150" ID="1"/>
|
||||
</Bookmarks>
|
||||
@ -148,7 +148,7 @@
|
||||
<UnitName Value="CarbonProc"/>
|
||||
<CursorPos X="13" Y="554"/>
|
||||
<TopLine Value="538"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="25" Y="151" ID="1"/>
|
||||
<Item1 X="3" Y="536" ID="2"/>
|
||||
@ -159,81 +159,81 @@
|
||||
<UnitName Value="Controls"/>
|
||||
<CursorPos X="3" Y="2457"/>
|
||||
<TopLine Value="2448"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="../fpc/rtl/objpas/sysutils/sysutilh.inc"/>
|
||||
<CursorPos X="17" Y="34"/>
|
||||
<TopLine Value="2"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="../fpc/rtl/bsd/system.pp"/>
|
||||
<UnitName Value="System"/>
|
||||
<CursorPos X="64" Y="52"/>
|
||||
<TopLine Value="29"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="../fpc/rtl/amiga/sysosh.inc"/>
|
||||
<CursorPos X="22" Y="18"/>
|
||||
<TopLine Value="7"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="../RichMemo/richmemo.pas"/>
|
||||
<UnitName Value="RichMemo"/>
|
||||
<CursorPos X="15" Y="39"/>
|
||||
<TopLine Value="23"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbonprivate.pp"/>
|
||||
<UnitName Value="CarbonPrivate"/>
|
||||
<CursorPos X="17" Y="649"/>
|
||||
<TopLine Value="640"/>
|
||||
<UsageCount Value="21"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbonprivatecontrol.inc"/>
|
||||
<CursorPos X="42" Y="499"/>
|
||||
<TopLine Value="495"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbondef.pp"/>
|
||||
<UnitName Value="CarbonDef"/>
|
||||
<CursorPos X="17" Y="649"/>
|
||||
<TopLine Value="640"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="../lazarus/lcl/graphics.pp"/>
|
||||
<UnitName Value="Graphics"/>
|
||||
<CursorPos X="3" Y="59"/>
|
||||
<TopLine Value="45"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="../lazarus/lcl/interfaces/carbon/carbondbgconsts.pp"/>
|
||||
<UnitName Value="CarbonDbgConsts"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
<Filename Value="Unit1.lrs"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
<Filename Value="../../../lazarus/ide/keymapping.pp"/>
|
||||
<UnitName Value="KeyMapping"/>
|
||||
<CursorPos X="74" Y="1565"/>
|
||||
<TopLine Value="1558"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="../../richmemo.pas"/>
|
||||
@ -241,7 +241,7 @@
|
||||
<CursorPos X="14" Y="29"/>
|
||||
<TopLine Value="19"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
@ -250,16 +250,16 @@
|
||||
<CursorPos X="66" Y="42"/>
|
||||
<TopLine Value="41"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit28>
|
||||
<Unit29>
|
||||
<Filename Value="../../carbon/carbonrichmemo.pas"/>
|
||||
<UnitName Value="CarbonRichMemo"/>
|
||||
<CursorPos X="24" Y="222"/>
|
||||
<TopLine Value="262"/>
|
||||
<TopLine Value="222"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="17"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="16" Y="230" ID="2"/>
|
||||
<Item1 X="33" Y="467" ID="4"/>
|
||||
@ -272,26 +272,26 @@
|
||||
<CursorPos X="39" Y="220678"/>
|
||||
<TopLine Value="220670"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="16"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit30>
|
||||
<Unit31>
|
||||
<Filename Value="../../../fpc/rtl/objpas/sysutils/osutilsh.inc"/>
|
||||
<CursorPos X="10" Y="34"/>
|
||||
<TopLine Value="20"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit31>
|
||||
<Unit32>
|
||||
<Filename Value="../../../fpc/rtl/objpas/classes/classesh.inc"/>
|
||||
<CursorPos X="19" Y="728"/>
|
||||
<TopLine Value="714"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit32>
|
||||
<Unit33>
|
||||
<Filename Value="../../../fpc/rtl/objpas/classes/streams.inc"/>
|
||||
<CursorPos X="8" Y="147"/>
|
||||
<TopLine Value="140"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="../../../../wnlibsvn/CarbonPaste.pas"/>
|
||||
@ -299,13 +299,13 @@
|
||||
<UnitName Value="CarbonPaste"/>
|
||||
<CursorPos X="43" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="30"/>
|
||||
<UsageCount Value="33"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="../../../fpc/rtl/objpas/sysutils/sysutilh.inc"/>
|
||||
<CursorPos X="13" Y="185"/>
|
||||
<TopLine Value="169"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit35>
|
||||
<Unit36>
|
||||
<Filename Value="../../../lazarus/lcl/widgetset/wsstdctrls.pp"/>
|
||||
@ -313,130 +313,130 @@
|
||||
<CursorPos X="20" Y="145"/>
|
||||
<TopLine Value="138"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit36>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../carbon/carbonrichmemo.pas"/>
|
||||
<Caret Line="451" Column="48" TopLine="439"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="21" TopLine="15"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="21" TopLine="15"/>
|
||||
<Caret Line="110" Column="1" TopLine="94"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="110" Column="1" TopLine="94"/>
|
||||
<Caret Line="109" Column="45" TopLine="99"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="109" Column="45" TopLine="99"/>
|
||||
<Caret Line="25" Column="26" TopLine="9"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="26" TopLine="9"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
<Caret Line="25" Column="32" TopLine="9"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="32" TopLine="9"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
<Caret Line="26" Column="30" TopLine="9"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="26" Column="30" TopLine="9"/>
|
||||
<Caret Line="25" Column="26" TopLine="9"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="26" TopLine="9"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="18" TopLine="9"/>
|
||||
<Caret Line="23" Column="30" TopLine="9"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="23" Column="30" TopLine="9"/>
|
||||
<Caret Line="111" Column="29" TopLine="101"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="111" Column="29" TopLine="101"/>
|
||||
<Caret Line="74" Column="1" TopLine="71"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="74" Column="1" TopLine="71"/>
|
||||
<Caret Line="78" Column="1" TopLine="73"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="78" Column="1" TopLine="73"/>
|
||||
<Caret Line="88" Column="33" TopLine="80"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="88" Column="33" TopLine="80"/>
|
||||
<Caret Line="75" Column="1" TopLine="73"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="75" Column="1" TopLine="73"/>
|
||||
<Caret Line="25" Column="30" TopLine="25"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="30" TopLine="25"/>
|
||||
<Caret Line="26" Column="52" TopLine="25"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="26" Column="52" TopLine="25"/>
|
||||
<Caret Line="25" Column="30" TopLine="25"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="30" TopLine="25"/>
|
||||
<Caret Line="24" Column="30" TopLine="24"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="24" Column="30" TopLine="24"/>
|
||||
<Caret Line="88" Column="33" TopLine="81"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="88" Column="33" TopLine="81"/>
|
||||
<Caret Line="80" Column="7" TopLine="75"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="80" Column="7" TopLine="75"/>
|
||||
<Caret Line="88" Column="1" TopLine="75"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="88" Column="1" TopLine="75"/>
|
||||
<Caret Line="79" Column="3" TopLine="75"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="79" Column="3" TopLine="75"/>
|
||||
<Caret Line="33" Column="44" TopLine="33"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="33" Column="44" TopLine="33"/>
|
||||
<Caret Line="110" Column="3" TopLine="108"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="110" Column="3" TopLine="108"/>
|
||||
<Caret Line="93" Column="1" TopLine="91"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="93" Column="1" TopLine="91"/>
|
||||
<Caret Line="89" Column="1" TopLine="76"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="89" Column="1" TopLine="76"/>
|
||||
<Caret Line="104" Column="1" TopLine="91"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="104" Column="1" TopLine="91"/>
|
||||
<Caret Line="98" Column="21" TopLine="88"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -1,7 +1,7 @@
|
||||
object Form1: TForm1
|
||||
Left = 333
|
||||
Left = 344
|
||||
Height = 596
|
||||
Top = 22
|
||||
Top = 51
|
||||
Width = 751
|
||||
Align = alNone
|
||||
AllowDropFiles = False
|
||||
@ -28,9 +28,9 @@ object Form1: TForm1
|
||||
LCLVersion = '0.9.27'
|
||||
WindowState = wsNormal
|
||||
object RichMemo1: TRichMemo
|
||||
Left = 40
|
||||
Left = 24
|
||||
Height = 432
|
||||
Top = 32
|
||||
Top = 24
|
||||
Width = 704
|
||||
Align = alNone
|
||||
Alignment = taLeftJustify
|
||||
|
@ -1,7 +1,7 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'M'#1#6'Height'#3'T'#2#3'Top'#2#22#5'Width'
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'X'#1#6'Height'#3'T'#2#3'Top'#2'3'#5'Width'
|
||||
+#3#239#2#5'Align'#7#6'alNone'#14'AllowDropFiles'#8#10'AutoScroll'#9#8'AutoSi'
|
||||
+'ze'#8#11'BorderIcons'#11#12'biSystemMenu'#10'biMinimize'#10'biMaximize'#0#11
|
||||
+'BorderStyle'#7#10'bsSizeable'#11'BorderWidth'#2#0#7'Caption'#6#5'Form1'#12
|
||||
@ -10,8 +10,8 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
||||
+'nabled'#9#9'FormStyle'#7#8'fsNormal'#8'OnCreate'#7#10'FormCreate'#14'Parent'
|
||||
+'BiDiMode'#9#10'ParentFont'#8#8'Position'#7#10'poDesigned'#13'ShowInTaskBar'
|
||||
+#7#9'stDefault'#14'UseDockManager'#8#10'LCLVersion'#6#6'0.9.27'#11'WindowSta'
|
||||
+'te'#7#8'wsNormal'#0#9'TRichMemo'#9'RichMemo1'#4'Left'#2'('#6'Height'#3#176#1
|
||||
+#3'Top'#2' '#5'Width'#3#192#2#5'Align'#7#6'alNone'#9'Alignment'#7#13'taLeftJ'
|
||||
+'te'#7#8'wsNormal'#0#9'TRichMemo'#9'RichMemo1'#4'Left'#2#24#6'Height'#3#176#1
|
||||
+#3'Top'#2#24#5'Width'#3#192#2#5'Align'#7#6'alNone'#9'Alignment'#7#13'taLeftJ'
|
||||
+'ustify'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#11'Border'
|
||||
+'Style'#7#8'bsSingle'#5'Color'#7#8'clWindow'#10'DragCursor'#7#6'crDrag'#8'Dr'
|
||||
+'agKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#13'HideSelection'
|
||||
|
@ -48,8 +48,7 @@ procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
Caption := Format('sel start %d, sel length %d', [RichMemo1.SelStart, RichMemo1.SelLength]);
|
||||
RichMemo1.SetTextAttributes(
|
||||
RichMemo1.SelStart, RichMemo1.SelLength,
|
||||
[tsm_Color, tsm_Styles], GetFontParams(clRed, [fsBold]) );
|
||||
RichMemo1.SelStart, RichMemo1.SelLength, GetFontParams(clRed, [fsBold]) );
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
|
@ -9,28 +9,33 @@ uses
|
||||
|
||||
Graphics, Controls,
|
||||
|
||||
RichMemoTypes,
|
||||
|
||||
WSStdCtrls;
|
||||
|
||||
type
|
||||
|
||||
TIntFontParams = record
|
||||
Name : String;
|
||||
Size : Integer;
|
||||
Color : TColor;
|
||||
Style : TFontStyles;
|
||||
end;
|
||||
|
||||
|
||||
{ TWSCustomRichMemo }
|
||||
|
||||
TWSCustomRichMemo = class(TWSCustomMemo)
|
||||
published
|
||||
class function GetStyleRange(const AWinControl: TWinControl; TextStart: Integer; var RangeStart, RangeLen: Integer): Boolean; virtual;
|
||||
class function GetTextAttributes(const AWinControl: TWinControl; TextStart: Integer;
|
||||
var Params: TFontParams): Boolean; virtual;
|
||||
var Params: TIntFontParams): Boolean; virtual;
|
||||
class procedure SetTextAttributes(const AWinControl: TWinControl; TextStart, TextLen: Integer;
|
||||
Mask: TTextStyleMask; const Params: TFontParams); virtual;
|
||||
{Mask: TTextStyleMask;} const Params: TIntFontParams); virtual;
|
||||
class procedure SetHideSelection(const AWinControl: TWinControl; AHideSelection: Boolean); virtual;
|
||||
class function LoadRichText(const AWinControl: TWinControl; Source: TStream): Boolean; virtual;
|
||||
class function SaveRichText(const AWinControl: TWinControl; Dest: TStream): Boolean; virtual;
|
||||
end;
|
||||
TWSCustomRichMemoClass = class of TWSCustomRichMemo;
|
||||
|
||||
|
||||
|
||||
|
||||
function WSRegisterCustomRichMemo: Boolean; external name 'WSRegisterCustomRichMemo';
|
||||
|
||||
@ -47,14 +52,14 @@ begin
|
||||
end;
|
||||
|
||||
class function TWSCustomRichMemo.GetTextAttributes(const AWinControl: TWinControl;
|
||||
TextStart: Integer; var Params: TFontParams): Boolean;
|
||||
TextStart: Integer; var Params: TIntFontParams): Boolean;
|
||||
begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
class procedure TWSCustomRichMemo.SetTextAttributes(const AWinControl: TWinControl;
|
||||
TextStart, TextLen: Integer;
|
||||
Mask: TTextStyleMask; const Params: TFontParams);
|
||||
{Mask: TTextStyleMask;} const Params: TIntFontParams);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user