|
@@ -12,6 +12,65 @@ const
|
|
AlwaysVectorialText = true;
|
|
AlwaysVectorialText = true;
|
|
|
|
|
|
type
|
|
type
|
|
|
|
+ TTextShape = class;
|
|
|
|
+
|
|
|
|
+ { TTextShapeFontDiff }
|
|
|
|
+
|
|
|
|
+ TTextShapeFontDiff = class(TVectorShapeDiff)
|
|
|
|
+ protected
|
|
|
|
+ FFontBidiModeBefore: TFontBidiMode;
|
|
|
|
+ FFontEmHeightBefore: single;
|
|
|
|
+ FFontNameBefore: string;
|
|
|
|
+ FFontStyleBefore: TFontStyles;
|
|
|
|
+ FFontBidiModeAfter: TFontBidiMode;
|
|
|
|
+ FFontEmHeightAfter: single;
|
|
|
|
+ FFontNameAfter: string;
|
|
|
|
+ FFontStyleAfter: TFontStyles;
|
|
|
|
+ public
|
|
|
|
+ constructor Create(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure ComputeDiff(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Apply(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure Unapply(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Append(ADiff: TVectorShapeDiff); override;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { TTextShapePhongDiff }
|
|
|
|
+
|
|
|
|
+ TTextShapePhongDiff = class(TVectorShapeDiff)
|
|
|
|
+ protected
|
|
|
|
+ FAltitudePercentBefore: single;
|
|
|
|
+ FPenPhongBefore: boolean;
|
|
|
|
+ FLightPositionBefore: TPointF;
|
|
|
|
+ FAltitudePercentAfter: single;
|
|
|
|
+ FPenPhongAfter: boolean;
|
|
|
|
+ FLightPositionAfter: TPointF;
|
|
|
|
+ public
|
|
|
|
+ constructor Create(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure ComputeDiff(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Apply(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure Unapply(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Append(ADiff: TVectorShapeDiff); override;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { TTextShapeTextDiff }
|
|
|
|
+
|
|
|
|
+ TTextShapeTextDiff = class(TVectorShapeDiff)
|
|
|
|
+ protected
|
|
|
|
+ FTextBefore: string;
|
|
|
|
+ FSelStartBefore,FSelEndBefore: integer;
|
|
|
|
+ FVertAlignBefore: TTextLayout;
|
|
|
|
+ FParaAlignBefore: array of TBidiTextAlignment;
|
|
|
|
+ FTextAfter: string;
|
|
|
|
+ FSelStartAfter,FSelEndAfter: integer;
|
|
|
|
+ FVertAlignAfter: TTextLayout;
|
|
|
|
+ FParaAlignAfter: array of TBidiTextAlignment;
|
|
|
|
+ public
|
|
|
|
+ constructor Create(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure ComputeDiff(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Apply(AStartShape: TVectorShape); override;
|
|
|
|
+ procedure Unapply(AEndShape: TVectorShape); override;
|
|
|
|
+ procedure Append(ADiff: TVectorShapeDiff); override;
|
|
|
|
+ end;
|
|
|
|
|
|
{ TTextShape }
|
|
{ TTextShape }
|
|
|
|
|
|
@@ -19,18 +78,18 @@ type
|
|
private
|
|
private
|
|
FAltitudePercent: single;
|
|
FAltitudePercent: single;
|
|
FPenPhong: boolean;
|
|
FPenPhong: boolean;
|
|
|
|
+ FLightPosition: TPointF;
|
|
FFontBidiMode: TFontBidiMode;
|
|
FFontBidiMode: TFontBidiMode;
|
|
FFontEmHeight: single;
|
|
FFontEmHeight: single;
|
|
FFontName: string;
|
|
FFontName: string;
|
|
FFontStyle: TFontStyles;
|
|
FFontStyle: TFontStyles;
|
|
- FLightPosition: TPointF;
|
|
|
|
FText: string;
|
|
FText: string;
|
|
FSelStart,FSelEnd: integer;
|
|
FSelStart,FSelEnd: integer;
|
|
|
|
+ FVertAlign: TTextLayout;
|
|
FEnteringUnicode: boolean;
|
|
FEnteringUnicode: boolean;
|
|
FUnicodeValue: cardinal;
|
|
FUnicodeValue: cardinal;
|
|
FUnicodeDigitCount: integer;
|
|
FUnicodeDigitCount: integer;
|
|
FMouseSelecting: boolean;
|
|
FMouseSelecting: boolean;
|
|
- FVertAlign: TTextLayout;
|
|
|
|
function GetBidiParagraphAlignment: TBidiTextAlignment;
|
|
function GetBidiParagraphAlignment: TBidiTextAlignment;
|
|
function GetCanPasteSelection: boolean;
|
|
function GetCanPasteSelection: boolean;
|
|
function GetHasSelection: boolean;
|
|
function GetHasSelection: boolean;
|
|
@@ -52,7 +111,7 @@ type
|
|
FTextLayout: TBidiTextLayout;
|
|
FTextLayout: TBidiTextLayout;
|
|
FFontRenderer: TBGRACustomFontRenderer;
|
|
FFontRenderer: TBGRACustomFontRenderer;
|
|
FGlobalMatrix: TAffineMatrix;
|
|
FGlobalMatrix: TAffineMatrix;
|
|
- procedure DoOnChange(ABoundsBefore: TRectF); override;
|
|
|
|
|
|
+ procedure DoOnChange(ABoundsBefore: TRectF; ADiff: TVectorShapeDiff); override;
|
|
procedure SetGlobalMatrix(AMatrix: TAffineMatrix);
|
|
procedure SetGlobalMatrix(AMatrix: TAffineMatrix);
|
|
function PenVisible(AAssumePenFill: boolean = false): boolean;
|
|
function PenVisible(AAssumePenFill: boolean = false): boolean;
|
|
function AllowShearTransform: boolean; override;
|
|
function AllowShearTransform: boolean; override;
|
|
@@ -169,12 +228,224 @@ begin
|
|
else result := fbmAuto;
|
|
else result := fbmAuto;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ TTextShapeTextDiff }
|
|
|
|
+
|
|
|
|
+constructor TTextShapeTextDiff.Create(AStartShape: TVectorShape);
|
|
|
|
+var
|
|
|
|
+ tl: TBidiTextLayout;
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FTextBefore:= FText;
|
|
|
|
+ FVertAlignBefore:= FVertAlign;
|
|
|
|
+ tl := GetTextLayout;
|
|
|
|
+ FSelStartBefore := FSelStart;
|
|
|
|
+ FSelEndBefore:= FSelEnd;
|
|
|
|
+ setlength(FParaAlignBefore, tl.ParagraphCount);
|
|
|
|
+ for i := 0 to high(FParaAlignBefore) do
|
|
|
|
+ FParaAlignBefore[i] := tl.ParagraphAlignment[i];
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeTextDiff.ComputeDiff(AEndShape: TVectorShape);
|
|
|
|
+var
|
|
|
|
+ tl: TBidiTextLayout;
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FTextAfter:= FText;
|
|
|
|
+ FVertAlignAfter:= FVertAlign;
|
|
|
|
+ FSelStartAfter := FSelStart;
|
|
|
|
+ FSelEndAfter:= FSelEnd;
|
|
|
|
+ tl := GetTextLayout;
|
|
|
|
+ setlength(FParaAlignAfter, tl.ParagraphCount);
|
|
|
|
+ for i := 0 to high(FParaAlignAfter) do
|
|
|
|
+ FParaAlignAfter[i] := tl.ParagraphAlignment[i];
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeTextDiff.Apply(AStartShape: TVectorShape);
|
|
|
|
+var
|
|
|
|
+ tl: TBidiTextLayout;
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FreeAndNil(FTextLayout);
|
|
|
|
+ FText := FTextAfter;
|
|
|
|
+ FVertAlign := FVertAlignAfter;
|
|
|
|
+ FSelStart := FSelStartAfter;
|
|
|
|
+ FSelEnd := FSelEndAfter;
|
|
|
|
+ tl := GetTextLayout;
|
|
|
|
+ for i := 0 to min(length(FParaAlignAfter),tl.ParagraphCount)-1 do
|
|
|
|
+ tl.ParagraphAlignment[i] := FParaAlignAfter[i];
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeTextDiff.Unapply(AEndShape: TVectorShape);
|
|
|
|
+var
|
|
|
|
+ tl: TBidiTextLayout;
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FreeAndNil(FTextLayout);
|
|
|
|
+ FText := FTextBefore;
|
|
|
|
+ FVertAlign := FVertAlignBefore;
|
|
|
|
+ FSelStart := FSelStartBefore;
|
|
|
|
+ FSelEnd := FSelEndBefore;
|
|
|
|
+ tl := GetTextLayout;
|
|
|
|
+ for i := 0 to min(length(FParaAlignBefore),tl.ParagraphCount)-1 do
|
|
|
|
+ tl.ParagraphAlignment[i] := FParaAlignBefore[i];
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeTextDiff.Append(ADiff: TVectorShapeDiff);
|
|
|
|
+var
|
|
|
|
+ next: TTextShapeTextDiff;
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ next := ADiff as TTextShapeTextDiff;
|
|
|
|
+ FTextAfter := next.FTextAfter;
|
|
|
|
+ FVertAlignAfter := next.FVertAlignAfter;
|
|
|
|
+ FSelStartAfter := next.FSelStartAfter;
|
|
|
|
+ FSelEndAfter := next.FSelEndAfter;
|
|
|
|
+ setlength(FParaAlignAfter, length(next.FParaAlignAfter));
|
|
|
|
+ for i := 0 to high(FParaAlignAfter) do
|
|
|
|
+ FParaAlignAfter[i] := next.FParaAlignAfter[i];
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+{ TTextShapePhongDiff }
|
|
|
|
+
|
|
|
|
+constructor TTextShapePhongDiff.Create(AStartShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FAltitudePercentBefore := FAltitudePercent;
|
|
|
|
+ FPenPhongBefore := FPenPhong;
|
|
|
|
+ FLightPositionBefore := FLightPosition;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapePhongDiff.ComputeDiff(AEndShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FAltitudePercentAfter := FAltitudePercent;
|
|
|
|
+ FPenPhongAfter := FPenPhong;
|
|
|
|
+ FLightPositionAfter := FLightPosition;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapePhongDiff.Apply(AStartShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FAltitudePercent := FAltitudePercentAfter;
|
|
|
|
+ FPenPhong := FPenPhongAfter;
|
|
|
|
+ FLightPosition := FLightPositionAfter;
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapePhongDiff.Unapply(AEndShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FAltitudePercent := FAltitudePercentBefore;
|
|
|
|
+ FPenPhong := FPenPhongBefore;
|
|
|
|
+ FLightPosition := FLightPositionBefore;
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapePhongDiff.Append(ADiff: TVectorShapeDiff);
|
|
|
|
+var
|
|
|
|
+ next: TTextShapePhongDiff;
|
|
|
|
+begin
|
|
|
|
+ next := ADiff as TTextShapePhongDiff;
|
|
|
|
+ FAltitudePercentAfter:= next.FAltitudePercentAfter;
|
|
|
|
+ FPenPhongAfter:= next.FPenPhongAfter;
|
|
|
|
+ FLightPositionAfter:= next.FLightPositionAfter;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+{ TTextShapeFontDiff }
|
|
|
|
+
|
|
|
|
+constructor TTextShapeFontDiff.Create(AStartShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FFontBidiModeBefore:= FFontBidiMode;
|
|
|
|
+ FFontEmHeightBefore:= FFontEmHeight;
|
|
|
|
+ FFontNameBefore:= FFontName;
|
|
|
|
+ FFontStyleBefore:= FFontStyle;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeFontDiff.ComputeDiff(AEndShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ FFontBidiModeAfter:= FFontBidiMode;
|
|
|
|
+ FFontEmHeightAfter:= FFontEmHeight;
|
|
|
|
+ FFontNameAfter:= FFontName;
|
|
|
|
+ FFontStyleAfter:= FFontStyle;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeFontDiff.Apply(AStartShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AStartShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FFontBidiMode := FFontBidiModeAfter;
|
|
|
|
+ FFontEmHeight := FFontEmHeightAfter;
|
|
|
|
+ FFontName := FFontNameAfter;
|
|
|
|
+ FFontStyle := FFontStyleAfter;
|
|
|
|
+ if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeFontDiff.Unapply(AEndShape: TVectorShape);
|
|
|
|
+begin
|
|
|
|
+ with (AEndShape as TTextShape) do
|
|
|
|
+ begin
|
|
|
|
+ BeginUpdate;
|
|
|
|
+ FFontBidiMode := FFontBidiModeBefore;
|
|
|
|
+ FFontEmHeight := FFontEmHeightBefore;
|
|
|
|
+ FFontName := FFontNameBefore;
|
|
|
|
+ FFontStyle := FFontStyleBefore;
|
|
|
|
+ if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
|
|
+ EndUpdate;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TTextShapeFontDiff.Append(ADiff: TVectorShapeDiff);
|
|
|
|
+var
|
|
|
|
+ next: TTextShapeFontDiff;
|
|
|
|
+begin
|
|
|
|
+ next := ADiff as TTextShapeFontDiff;
|
|
|
|
+ FFontBidiModeAfter := next.FFontBidiModeAfter;
|
|
|
|
+ FFontEmHeightAfter := next.FFontEmHeightAfter;
|
|
|
|
+ FFontNameAfter := next.FFontNameAfter;
|
|
|
|
+ FFontStyleAfter := next.FFontStyleAfter;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TTextShape }
|
|
{ TTextShape }
|
|
|
|
|
|
procedure TTextShape.SetText(AValue: string);
|
|
procedure TTextShape.SetText(AValue: string);
|
|
begin
|
|
begin
|
|
if FText=AValue then Exit;
|
|
if FText=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
FText:=AValue;
|
|
FText:=AValue;
|
|
FSelStart:=0;
|
|
FSelStart:=0;
|
|
FSelEnd :=0;
|
|
FSelEnd :=0;
|
|
@@ -185,7 +456,7 @@ end;
|
|
procedure TTextShape.SetFontBidiMode(AValue: TFontBidiMode);
|
|
procedure TTextShape.SetFontBidiMode(AValue: TFontBidiMode);
|
|
begin
|
|
begin
|
|
if FFontBidiMode=AValue then Exit;
|
|
if FFontBidiMode=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeFontDiff);
|
|
FFontBidiMode:=AValue;
|
|
FFontBidiMode:=AValue;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
@@ -240,7 +511,7 @@ begin
|
|
if AValue < 0 then AValue := 0;
|
|
if AValue < 0 then AValue := 0;
|
|
if AValue > 100 then AValue := 100;
|
|
if AValue > 100 then AValue := 100;
|
|
if FAltitudePercent=AValue then Exit;
|
|
if FAltitudePercent=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapePhongDiff);
|
|
FAltitudePercent:=AValue;
|
|
FAltitudePercent:=AValue;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
@@ -248,7 +519,7 @@ end;
|
|
procedure TTextShape.SetPenPhong(AValue: boolean);
|
|
procedure TTextShape.SetPenPhong(AValue: boolean);
|
|
begin
|
|
begin
|
|
if FPenPhong=AValue then Exit;
|
|
if FPenPhong=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapePhongDiff);
|
|
FPenPhong:=AValue;
|
|
FPenPhong:=AValue;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
@@ -256,7 +527,7 @@ end;
|
|
procedure TTextShape.SetFontEmHeight(AValue: single);
|
|
procedure TTextShape.SetFontEmHeight(AValue: single);
|
|
begin
|
|
begin
|
|
if FFontEmHeight=AValue then Exit;
|
|
if FFontEmHeight=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeFontDiff);
|
|
FFontEmHeight:=AValue;
|
|
FFontEmHeight:=AValue;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
@@ -265,7 +536,7 @@ end;
|
|
procedure TTextShape.SetFontName(AValue: string);
|
|
procedure TTextShape.SetFontName(AValue: string);
|
|
begin
|
|
begin
|
|
if FFontName=AValue then Exit;
|
|
if FFontName=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeFontDiff);
|
|
FFontName:=AValue;
|
|
FFontName:=AValue;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
@@ -274,7 +545,7 @@ end;
|
|
procedure TTextShape.SetFontStyle(AValue: TFontStyles);
|
|
procedure TTextShape.SetFontStyle(AValue: TFontStyles);
|
|
begin
|
|
begin
|
|
if FFontStyle=AValue then Exit;
|
|
if FFontStyle=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeFontDiff);
|
|
FFontStyle:=AValue;
|
|
FFontStyle:=AValue;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
@@ -303,7 +574,7 @@ begin
|
|
begin
|
|
begin
|
|
if not needUpdate then
|
|
if not needUpdate then
|
|
begin
|
|
begin
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
needUpdate := true;
|
|
needUpdate := true;
|
|
end;
|
|
end;
|
|
tl.ParagraphAlignment[i] := AValue;
|
|
tl.ParagraphAlignment[i] := AValue;
|
|
@@ -314,7 +585,7 @@ end;
|
|
procedure TTextShape.SetLightPosition(AValue: TPointF);
|
|
procedure TTextShape.SetLightPosition(AValue: TPointF);
|
|
begin
|
|
begin
|
|
if FLightPosition=AValue then Exit;
|
|
if FLightPosition=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapePhongDiff);
|
|
FLightPosition:=AValue;
|
|
FLightPosition:=AValue;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
@@ -351,7 +622,7 @@ begin
|
|
begin
|
|
begin
|
|
if not needUpdate then
|
|
if not needUpdate then
|
|
begin
|
|
begin
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
needUpdate := true;
|
|
needUpdate := true;
|
|
end;
|
|
end;
|
|
tl.ParagraphAlignment[i] := bidiAlign;
|
|
tl.ParagraphAlignment[i] := bidiAlign;
|
|
@@ -363,12 +634,12 @@ end;
|
|
procedure TTextShape.SetVertAlign(AValue: TTextLayout);
|
|
procedure TTextShape.SetVertAlign(AValue: TTextLayout);
|
|
begin
|
|
begin
|
|
if FVertAlign=AValue then Exit;
|
|
if FVertAlign=AValue then Exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
FVertAlign:=AValue;
|
|
FVertAlign:=AValue;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TTextShape.DoOnChange(ABoundsBefore: TRectF);
|
|
|
|
|
|
+procedure TTextShape.DoOnChange(ABoundsBefore: TRectF; ADiff: TVectorShapeDiff);
|
|
var freeRenderer: boolean;
|
|
var freeRenderer: boolean;
|
|
begin
|
|
begin
|
|
if Assigned(FFontRenderer) then
|
|
if Assigned(FFontRenderer) then
|
|
@@ -390,7 +661,7 @@ begin
|
|
FTextLayout.FontRenderer := GetFontRenderer;
|
|
FTextLayout.FontRenderer := GetFontRenderer;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
- inherited DoOnChange(ABoundsBefore);
|
|
|
|
|
|
+ inherited DoOnChange(ABoundsBefore, ADiff);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TTextShape.SetGlobalMatrix(AMatrix: TAffineMatrix);
|
|
procedure TTextShape.SetGlobalMatrix(AMatrix: TAffineMatrix);
|
|
@@ -527,7 +798,7 @@ var
|
|
delCount, selLeft: Integer;
|
|
delCount, selLeft: Integer;
|
|
begin
|
|
begin
|
|
if UserMode <> vsuEditText then exit;
|
|
if UserMode <> vsuEditText then exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
selLeft := Min(FSelStart,FSelEnd);
|
|
selLeft := Min(FSelStart,FSelEnd);
|
|
if selLeft > 0 then
|
|
if selLeft > 0 then
|
|
begin
|
|
begin
|
|
@@ -546,7 +817,7 @@ var
|
|
tl: TBidiTextLayout;
|
|
tl: TBidiTextLayout;
|
|
begin
|
|
begin
|
|
if UserMode <> vsuEditText then exit;
|
|
if UserMode <> vsuEditText then exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
selRight := Max(FSelStart,FSelEnd);
|
|
selRight := Max(FSelStart,FSelEnd);
|
|
tl := GetTextLayout;
|
|
tl := GetTextLayout;
|
|
if selRight+ACount <= tl.CharCount then
|
|
if selRight+ACount <= tl.CharCount then
|
|
@@ -566,7 +837,7 @@ begin
|
|
if UserMode <> vsuEditText then exit;
|
|
if UserMode <> vsuEditText then exit;
|
|
if FSelStart <> FSelEnd then
|
|
if FSelStart <> FSelEnd then
|
|
begin
|
|
begin
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
selLeft := Min(FSelStart,FSelEnd);
|
|
selLeft := Min(FSelStart,FSelEnd);
|
|
GetTextLayout.DeleteText(selLeft, Abs(FSelEnd-FSelStart));
|
|
GetTextLayout.DeleteText(selLeft, Abs(FSelEnd-FSelStart));
|
|
FText := GetTextLayout.TextUTF8;
|
|
FText := GetTextLayout.TextUTF8;
|
|
@@ -581,7 +852,7 @@ var
|
|
insertCount: Integer;
|
|
insertCount: Integer;
|
|
begin
|
|
begin
|
|
if UserMode <> vsuEditText then exit;
|
|
if UserMode <> vsuEditText then exit;
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeTextDiff);
|
|
DeleteSelectedText;
|
|
DeleteSelectedText;
|
|
insertCount := GetTextLayout.InsertText(ATextUTF8, FSelStart);
|
|
insertCount := GetTextLayout.InsertText(ATextUTF8, FSelStart);
|
|
FText := GetTextLayout.TextUTF8;
|
|
FText := GetTextLayout.TextUTF8;
|
|
@@ -1369,7 +1640,7 @@ procedure TTextShape.SetFontNameAndStyle(AFontName: string;
|
|
begin
|
|
begin
|
|
if (AFontName <> FFontName) or (AFontStyle <> FFontStyle) then
|
|
if (AFontName <> FFontName) or (AFontStyle <> FFontStyle) then
|
|
begin
|
|
begin
|
|
- BeginUpdate;
|
|
|
|
|
|
+ BeginUpdate(TTextShapeFontDiff);
|
|
FFontName := AFontName;
|
|
FFontName := AFontName;
|
|
FFontStyle:= AFontStyle;
|
|
FFontStyle:= AFontStyle;
|
|
EndUpdate;
|
|
EndUpdate;
|
|
@@ -1424,10 +1695,12 @@ var
|
|
zoom: Single;
|
|
zoom: Single;
|
|
begin
|
|
begin
|
|
BeginUpdate;
|
|
BeginUpdate;
|
|
- inherited Transform(AMatrix);
|
|
|
|
|
|
+ AddDiffHandler(TTextShapeFontDiff);
|
|
|
|
+ AddDiffHandler(TTextShapePhongDiff);
|
|
zoom := (VectLen(AMatrix[1,1],AMatrix[2,1])+VectLen(AMatrix[1,2],AMatrix[2,2]))/2;
|
|
zoom := (VectLen(AMatrix[1,1],AMatrix[2,1])+VectLen(AMatrix[1,2],AMatrix[2,2]))/2;
|
|
FontEmHeight:= zoom*FontEmHeight;
|
|
FontEmHeight:= zoom*FontEmHeight;
|
|
LightPosition := AMatrix*LightPosition;
|
|
LightPosition := AMatrix*LightPosition;
|
|
|
|
+ inherited Transform(AMatrix);
|
|
EndUpdate;
|
|
EndUpdate;
|
|
end;
|
|
end;
|
|
|
|
|