|
@@ -22,12 +22,12 @@ const
|
|
'Horizontal cylinder', 'Vertical cylinder');
|
|
'Horizontal cylinder', 'Vertical cylinder');
|
|
|
|
|
|
type
|
|
type
|
|
- TPaintTool = (ptHand, ptMoveBackFillPoint, ptRectangle, ptEllipse, ptPolyline, ptCurve, ptPolygon, ptClosedCurve,
|
|
|
|
|
|
+ TPaintTool = (ptHand, ptMovePenFillPoint, ptMoveBackFillPoint, ptRectangle, ptEllipse, ptPolyline, ptCurve, ptPolygon, ptClosedCurve,
|
|
ptPhongShape);
|
|
ptPhongShape);
|
|
|
|
|
|
const
|
|
const
|
|
PaintToolClass : array[TPaintTool] of TVectorShapeAny =
|
|
PaintToolClass : array[TPaintTool] of TVectorShapeAny =
|
|
- (nil, nil, TRectShape, TEllipseShape, TPolylineShape, TCurveShape, TPolylineShape, TCurveShape,
|
|
|
|
|
|
+ (nil, nil, nil, TRectShape, TEllipseShape, TPolylineShape, TCurveShape, TPolylineShape, TCurveShape,
|
|
TPhongShape);
|
|
TPhongShape);
|
|
|
|
|
|
function IsCreateShapeTool(ATool: TPaintTool): boolean;
|
|
function IsCreateShapeTool(ATool: TPaintTool): boolean;
|
|
@@ -40,15 +40,21 @@ type
|
|
{ TForm1 }
|
|
{ TForm1 }
|
|
|
|
|
|
TForm1 = class(TForm)
|
|
TForm1 = class(TForm)
|
|
|
|
+ PenFillControl: TLCVectorialFillControl;
|
|
ButtonMoveBackFillPoints: TToolButton;
|
|
ButtonMoveBackFillPoints: TToolButton;
|
|
|
|
+ ButtonMovePenFillPoints: TToolButton;
|
|
LBack: TLabel;
|
|
LBack: TLabel;
|
|
BackFillControl: TLCVectorialFillControl;
|
|
BackFillControl: TLCVectorialFillControl;
|
|
|
|
+ LPen: TLabel;
|
|
|
|
+ PanelPenFill: TBCPanel;
|
|
PanelBackFillHead: TPanel;
|
|
PanelBackFillHead: TPanel;
|
|
|
|
+ PanelPenFillHead: TPanel;
|
|
ShapeSendToBack: TAction;
|
|
ShapeSendToBack: TAction;
|
|
ShapeBringToFront: TAction;
|
|
ShapeBringToFront: TAction;
|
|
ShapeMoveDown: TAction;
|
|
ShapeMoveDown: TAction;
|
|
ShapeMoveUp: TAction;
|
|
ShapeMoveUp: TAction;
|
|
ToolBarBackFill: TToolBar;
|
|
ToolBarBackFill: TToolBar;
|
|
|
|
+ ToolBarPenFill: TToolBar;
|
|
VectorImageList24: TBGRAImageList;
|
|
VectorImageList24: TBGRAImageList;
|
|
ActionList: TActionList;
|
|
ActionList: TActionList;
|
|
EditCopy: TAction;
|
|
EditCopy: TAction;
|
|
@@ -60,7 +66,6 @@ type
|
|
FileSave: TAction;
|
|
FileSave: TAction;
|
|
FileSaveAs: TAction;
|
|
FileSaveAs: TAction;
|
|
ButtonPenStyle: TBCButton;
|
|
ButtonPenStyle: TBCButton;
|
|
- Label1: TLabel;
|
|
|
|
Label3: TLabel;
|
|
Label3: TLabel;
|
|
PanelBackFill: TBCPanel;
|
|
PanelBackFill: TBCPanel;
|
|
PanelBasicStyle: TBCPanel;
|
|
PanelBasicStyle: TBCPanel;
|
|
@@ -70,7 +75,6 @@ type
|
|
PhongImageList: TBGRAImageList;
|
|
PhongImageList: TBGRAImageList;
|
|
PenStyleImageList: TBGRAImageList;
|
|
PenStyleImageList: TBGRAImageList;
|
|
CurveImageList: TBGRAImageList;
|
|
CurveImageList: TBGRAImageList;
|
|
- ShapePenColor: TShape;
|
|
|
|
ToolBarFile: TToolBar;
|
|
ToolBarFile: TToolBar;
|
|
ToolBarEdit: TToolBar;
|
|
ToolBarEdit: TToolBar;
|
|
ToolBarTop: TToolBar;
|
|
ToolBarTop: TToolBar;
|
|
@@ -107,7 +111,6 @@ type
|
|
ToolButtonPolygon: TToolButton;
|
|
ToolButtonPolygon: TToolButton;
|
|
ToolButtonRectangle: TToolButton;
|
|
ToolButtonRectangle: TToolButton;
|
|
ToolButtonEllipse: TToolButton;
|
|
ToolButtonEllipse: TToolButton;
|
|
- UpDownPenAlpha: TBCTrackbarUpdown;
|
|
|
|
UpDownPenWidth: TBCTrackbarUpdown;
|
|
UpDownPenWidth: TBCTrackbarUpdown;
|
|
procedure BCPanelToolbarResize(Sender: TObject);
|
|
procedure BCPanelToolbarResize(Sender: TObject);
|
|
procedure BCPanelToolChoiceResize(Sender: TObject);
|
|
procedure BCPanelToolChoiceResize(Sender: TObject);
|
|
@@ -142,12 +145,9 @@ type
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
|
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
procedure FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
procedure FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
- procedure ShapePenColorMouseUp(Sender: TObject; {%H-}Button: TMouseButton;
|
|
|
|
- {%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
|
|
|
procedure ToolButtonClick(Sender: TObject);
|
|
procedure ToolButtonClick(Sender: TObject);
|
|
procedure UpDownPenAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure UpDownPenAlphaChange(Sender: TObject; AByUser: boolean);
|
|
private
|
|
private
|
|
- FPenColor: TBGRAPixel;
|
|
|
|
FPenWidth: single;
|
|
FPenWidth: single;
|
|
FPenStyle: TBGRAPenStyle;
|
|
FPenStyle: TBGRAPenStyle;
|
|
FPenJoinStyle: TPenJoinStyle;
|
|
FPenJoinStyle: TPenJoinStyle;
|
|
@@ -168,7 +168,6 @@ type
|
|
FUpDownPhongBorderSize: TBCTrackbarUpdown;
|
|
FUpDownPhongBorderSize: TBCTrackbarUpdown;
|
|
FInRemoveShapeIfEmpty: Boolean;
|
|
FInRemoveShapeIfEmpty: Boolean;
|
|
procedure ComboBoxSplineStyleClick(Sender: TObject);
|
|
procedure ComboBoxSplineStyleClick(Sender: TObject);
|
|
- function GetPenColor: TBGRAPixel;
|
|
|
|
function GetPenStyle: TBGRAPenStyle;
|
|
function GetPenStyle: TBGRAPenStyle;
|
|
function GetPenWidth: single;
|
|
function GetPenWidth: single;
|
|
function GetSplineStyle: TSplineStyle;
|
|
function GetSplineStyle: TSplineStyle;
|
|
@@ -187,7 +186,6 @@ type
|
|
procedure RequestBackFillUpdate(Sender: TObject);
|
|
procedure RequestBackFillUpdate(Sender: TObject);
|
|
procedure OnBackFillChange({%H-}ASender: TObject);
|
|
procedure OnBackFillChange({%H-}ASender: TObject);
|
|
procedure SetCurrentTool(AValue: TPaintTool);
|
|
procedure SetCurrentTool(AValue: TPaintTool);
|
|
- procedure SetPenColor(AValue: TBGRAPixel);
|
|
|
|
procedure SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
procedure SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
procedure SetPenStyle(AValue: TBGRAPenStyle);
|
|
procedure SetPenStyle(AValue: TBGRAPenStyle);
|
|
procedure SetPenWidth(AValue: single);
|
|
procedure SetPenWidth(AValue: single);
|
|
@@ -204,13 +202,18 @@ type
|
|
function CreateShape(const APoint1, APoint2: TPointF): TVectorShape;
|
|
function CreateShape(const APoint1, APoint2: TPointF): TVectorShape;
|
|
procedure RemoveExtendedStyleControls;
|
|
procedure RemoveExtendedStyleControls;
|
|
procedure UpdateBackToolFillPoints;
|
|
procedure UpdateBackToolFillPoints;
|
|
|
|
+ procedure UpdatePenToolFillPoints;
|
|
procedure UpdateShapeBackFill;
|
|
procedure UpdateShapeBackFill;
|
|
|
|
+ procedure UpdateShapePenFill;
|
|
procedure UpdateShapeUserMode;
|
|
procedure UpdateShapeUserMode;
|
|
procedure UpdateShapeActions(AShape: TVectorShape);
|
|
procedure UpdateShapeActions(AShape: TVectorShape);
|
|
procedure RemoveShapeIfEmpty(AShape: TVectorShape);
|
|
procedure RemoveShapeIfEmpty(AShape: TVectorShape);
|
|
function VirtualScreenToImgCoord(X,Y: Integer): TPointF;
|
|
function VirtualScreenToImgCoord(X,Y: Integer): TPointF;
|
|
procedure SetEditorGrid(AActive: boolean);
|
|
procedure SetEditorGrid(AActive: boolean);
|
|
procedure RequestBackFillAdjustToShape(Sender: TObject);
|
|
procedure RequestBackFillAdjustToShape(Sender: TObject);
|
|
|
|
+ procedure PenFillControlResize(Sender: TObject);
|
|
|
|
+ procedure RequestPenFillAdjustToShape(Sender: TObject);
|
|
|
|
+ procedure RequestPenFillUpdate(Sender: TObject);
|
|
public
|
|
public
|
|
{ public declarations }
|
|
{ public declarations }
|
|
img: TBGRALazPaintImage;
|
|
img: TBGRALazPaintImage;
|
|
@@ -229,7 +232,6 @@ type
|
|
procedure DoPaste;
|
|
procedure DoPaste;
|
|
procedure DoDelete;
|
|
procedure DoDelete;
|
|
property vectorTransform: TAffineMatrix read GetVectorTransform;
|
|
property vectorTransform: TAffineMatrix read GetVectorTransform;
|
|
- property penColor: TBGRAPixel read GetPenColor write SetPenColor;
|
|
|
|
property penWidth: single read GetPenWidth write SetPenWidth;
|
|
property penWidth: single read GetPenWidth write SetPenWidth;
|
|
property penStyle: TBGRAPenStyle read GetPenStyle write SetPenStyle;
|
|
property penStyle: TBGRAPenStyle read GetPenStyle write SetPenStyle;
|
|
property splineStyle: TSplineStyle read GetSplineStyle write SetSplineStyle;
|
|
property splineStyle: TSplineStyle read GetSplineStyle write SetSplineStyle;
|
|
@@ -332,8 +334,18 @@ begin
|
|
FPenStyleMenu.Items.Add(item);
|
|
FPenStyleMenu.Items.Add(item);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ PenFillControl.ToolIconSize:= ActionIconSize;
|
|
|
|
+ PenFillControl.SolidColor := BGRABlack;
|
|
|
|
+ PenFillControl.GradStartColor := BGRAWhite;
|
|
|
|
+ PenFillControl.GradEndColor := BGRABlack;
|
|
|
|
+ PenFillControl.OnFillChange:=@RequestPenFillUpdate;
|
|
|
|
+ PenFillControl.OnAdjustToShape:=@RequestPenFillAdjustToShape;
|
|
|
|
+ PenFillControl.OnResize:=@PenFillControlResize;
|
|
|
|
+
|
|
BackFillControl.ToolIconSize:= ActionIconSize;
|
|
BackFillControl.ToolIconSize:= ActionIconSize;
|
|
BackFillControl.SolidColor := CSSDodgerBlue;
|
|
BackFillControl.SolidColor := CSSDodgerBlue;
|
|
|
|
+ BackFillControl.GradStartColor := MergeBGRA(CSSDodgerBlue,BGRAWhite);
|
|
|
|
+ BackFillControl.GradEndColor := MergeBGRA(CSSDodgerBlue,BGRABlack);
|
|
BackFillControl.OnFillChange:= @RequestBackFillUpdate;
|
|
BackFillControl.OnFillChange:= @RequestBackFillUpdate;
|
|
BackFillControl.OnAdjustToShape:= @RequestBackFillAdjustToShape;
|
|
BackFillControl.OnAdjustToShape:= @RequestBackFillAdjustToShape;
|
|
BackFillControl.OnResize:= @BackFillControlResize;
|
|
BackFillControl.OnResize:= @BackFillControlResize;
|
|
@@ -348,7 +360,6 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
newShape:= nil;
|
|
newShape:= nil;
|
|
- penColor := BGRABlack;
|
|
|
|
penWidth := 5;
|
|
penWidth := 5;
|
|
penStyle := SolidPenStyle;
|
|
penStyle := SolidPenStyle;
|
|
joinStyle:= pjsBevel;
|
|
joinStyle:= pjsBevel;
|
|
@@ -358,6 +369,7 @@ begin
|
|
FPhongBorderSize := DefaultPhongBorderSizePercent;
|
|
FPhongBorderSize := DefaultPhongBorderSizePercent;
|
|
UpdateTitleBar;
|
|
UpdateTitleBar;
|
|
UpdateBackToolFillPoints;
|
|
UpdateBackToolFillPoints;
|
|
|
|
+ UpdatePenToolFillPoints;
|
|
UpdateShapeActions(nil);
|
|
UpdateShapeActions(nil);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -629,6 +641,12 @@ begin
|
|
newShape.BackFill := vectorFill;
|
|
newShape.BackFill := vectorFill;
|
|
vectorFill.Free;
|
|
vectorFill.Free;
|
|
end;
|
|
end;
|
|
|
|
+ if (vsfPenFill in newShape.Fields) and (newShape.PenFill.FillType in [vftGradient, vftTexture]) then
|
|
|
|
+ begin
|
|
|
|
+ vectorFill := PenFillControl.CreateShapeFill(newShape);
|
|
|
|
+ newShape.PenFill := vectorFill;
|
|
|
|
+ vectorFill.Free;
|
|
|
|
+ end;
|
|
rF := newShape.GetRenderBounds(InfiniteRect, vectorTransform);
|
|
rF := newShape.GetRenderBounds(InfiniteRect, vectorTransform);
|
|
ImageChange(rF.Union(prevRF, true));
|
|
ImageChange(rF.Union(prevRF, true));
|
|
end;
|
|
end;
|
|
@@ -738,26 +756,24 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TForm1.ShapePenColorMouseUp(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
-begin
|
|
|
|
- ColorDialog1.Color := ShapePenColor.Brush.Color;
|
|
|
|
- if ColorDialog1.Execute then
|
|
|
|
- begin
|
|
|
|
- if penColor.alpha <> 0 then
|
|
|
|
- penColor := ColorToBGRA(ColorDialog1.Color, penColor.alpha)
|
|
|
|
- else
|
|
|
|
- penColor := ColorDialog1.Color;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TForm1.ToolButtonClick(Sender: TObject);
|
|
procedure TForm1.ToolButtonClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
if Sender = ButtonMoveBackFillPoints then
|
|
if Sender = ButtonMoveBackFillPoints then
|
|
- if ButtonMoveBackFillPoints.Down then ToolButtonMove.Down := true;
|
|
|
|
|
|
+ if ButtonMoveBackFillPoints.Down then
|
|
|
|
+ begin
|
|
|
|
+ ToolButtonMove.Down := true;
|
|
|
|
+ ButtonMovePenFillPoints.Down := false;
|
|
|
|
+ end;
|
|
|
|
+ if Sender = ButtonMovePenFillPoints then
|
|
|
|
+ if ButtonMovePenFillPoints.Down then
|
|
|
|
+ begin
|
|
|
|
+ ToolButtonMove.Down := true;
|
|
|
|
+ ButtonMoveBackFillPoints.Down := false;
|
|
|
|
+ end;
|
|
|
|
|
|
FCurrentTool := ptHand;
|
|
FCurrentTool := ptHand;
|
|
if ButtonMoveBackFillPoints.Down then FCurrentTool:= ptMoveBackFillPoint;
|
|
if ButtonMoveBackFillPoints.Down then FCurrentTool:= ptMoveBackFillPoint;
|
|
|
|
+ if ButtonMovePenFillPoints.Down then FCurrentTool:= ptMovePenFillPoint;
|
|
if ToolButtonEllipse.Down then FCurrentTool:= ptEllipse;
|
|
if ToolButtonEllipse.Down then FCurrentTool:= ptEllipse;
|
|
if ToolButtonRectangle.Down then FCurrentTool:= ptRectangle;
|
|
if ToolButtonRectangle.Down then FCurrentTool:= ptRectangle;
|
|
if ToolButtonPolyline.Down then FCurrentTool:= ptPolyline;
|
|
if ToolButtonPolyline.Down then FCurrentTool:= ptPolyline;
|
|
@@ -766,8 +782,8 @@ begin
|
|
if ToolButtonClosedCurve.Down then FCurrentTool:= ptClosedCurve;
|
|
if ToolButtonClosedCurve.Down then FCurrentTool:= ptClosedCurve;
|
|
if ToolButtonPhongShape.Down then FCurrentTool:= ptPhongShape;
|
|
if ToolButtonPhongShape.Down then FCurrentTool:= ptPhongShape;
|
|
|
|
|
|
- if currentTool <> ptMoveBackFillPoint then
|
|
|
|
- ButtonMoveBackFillPoints.Down := false;
|
|
|
|
|
|
+ if currentTool <> ptMoveBackFillPoint then ButtonMoveBackFillPoints.Down := false;
|
|
|
|
+ if currentTool <> ptMovePenFillPoint then ButtonMovePenFillPoints.Down := false;
|
|
|
|
|
|
if IsCreateShapeTool(currentTool) then
|
|
if IsCreateShapeTool(currentTool) then
|
|
begin
|
|
begin
|
|
@@ -786,12 +802,7 @@ end;
|
|
|
|
|
|
procedure TForm1.UpDownPenAlphaChange(Sender: TObject; AByUser: boolean);
|
|
procedure TForm1.UpDownPenAlphaChange(Sender: TObject; AByUser: boolean);
|
|
begin
|
|
begin
|
|
- if AByUser then
|
|
|
|
- begin
|
|
|
|
- FPenColor:= ColorToBGRA(ShapePenColor.Brush.Color, UpDownPenAlpha.Value);
|
|
|
|
- if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
|
|
|
|
- vectorOriginal.SelectedShape.PenColor:= FPenColor;
|
|
|
|
- end;
|
|
|
|
|
|
+
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.ComboBoxSplineStyleClick(Sender: TObject);
|
|
procedure TForm1.ComboBoxSplineStyleClick(Sender: TObject);
|
|
@@ -801,11 +812,6 @@ begin
|
|
FSplineStyleMenu.PopUp(X,Y);
|
|
FSplineStyleMenu.PopUp(X,Y);
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TForm1.GetPenColor: TBGRAPixel;
|
|
|
|
-begin
|
|
|
|
- result := FPenColor;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TForm1.GetPenStyle: TBGRAPenStyle;
|
|
function TForm1.GetPenStyle: TBGRAPenStyle;
|
|
begin
|
|
begin
|
|
result := FPenStyle;
|
|
result := FPenStyle;
|
|
@@ -892,13 +898,23 @@ procedure TForm1.OnSelectShape(ASender: TObject; AShape: TVectorShape;
|
|
begin
|
|
begin
|
|
if ASender <> vectorOriginal then exit;
|
|
if ASender <> vectorOriginal then exit;
|
|
UpdateToolbarFromShape(AShape);
|
|
UpdateToolbarFromShape(AShape);
|
|
- if currentTool = ptMoveBackFillPoint then
|
|
|
|
- begin
|
|
|
|
- if Assigned(AShape) and (vsuEditBackFill in AShape.Usermodes) and
|
|
|
|
- AShape.BackFill.IsEditable then
|
|
|
|
- AShape.Usermode:= vsuEditBackFill
|
|
|
|
- else
|
|
|
|
- currentTool:= ptHand;
|
|
|
|
|
|
+ case currentTool of
|
|
|
|
+ ptMoveBackFillPoint:
|
|
|
|
+ begin
|
|
|
|
+ if Assigned(AShape) and (vsuEditBackFill in AShape.Usermodes) and
|
|
|
|
+ AShape.BackFill.IsEditable then
|
|
|
|
+ AShape.Usermode:= vsuEditBackFill
|
|
|
|
+ else
|
|
|
|
+ currentTool:= ptHand;
|
|
|
|
+ end;
|
|
|
|
+ ptMovePenFillPoint:
|
|
|
|
+ begin
|
|
|
|
+ if Assigned(AShape) and (vsuEditPenFill in AShape.Usermodes) and
|
|
|
|
+ AShape.PenFill.IsEditable then
|
|
|
|
+ AShape.Usermode:= vsuEditPenFill
|
|
|
|
+ else
|
|
|
|
+ currentTool:= ptHand;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
UpdateShapeActions(AShape);
|
|
UpdateShapeActions(AShape);
|
|
@@ -950,21 +966,10 @@ begin
|
|
ToolButtonCurve.Down := FCurrentTool = ptCurve;
|
|
ToolButtonCurve.Down := FCurrentTool = ptCurve;
|
|
ToolButtonPhongShape.Down:= FCurrentTool = ptPhongShape;
|
|
ToolButtonPhongShape.Down:= FCurrentTool = ptPhongShape;
|
|
ButtonMoveBackFillPoints.Down := FCurrentTool = ptMoveBackFillPoint;
|
|
ButtonMoveBackFillPoints.Down := FCurrentTool = ptMoveBackFillPoint;
|
|
|
|
+ ButtonMovePenFillPoints.Down := FCurrentTool = ptMovePenFillPoint;
|
|
UpdateShapeUserMode;
|
|
UpdateShapeUserMode;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TForm1.SetPenColor(AValue: TBGRAPixel);
|
|
|
|
-begin
|
|
|
|
- FPenColor := AValue;
|
|
|
|
- ShapePenColor.Brush.Color := BGRA(AValue.red,AValue.green,AValue.blue).ToColor;
|
|
|
|
- UpDownPenAlpha.Value := AValue.alpha;
|
|
|
|
- if not FUpdatingFromShape and Assigned(vectorOriginal) then
|
|
|
|
- begin
|
|
|
|
- if Assigned(vectorOriginal.SelectedShape) then
|
|
|
|
- vectorOriginal.SelectedShape.PenColor := AValue;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TForm1.SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
procedure TForm1.SetPenJoinStyle(AValue: TPenJoinStyle);
|
|
begin
|
|
begin
|
|
if FPenJoinStyle=AValue then Exit;
|
|
if FPenJoinStyle=AValue then Exit;
|
|
@@ -1169,7 +1174,7 @@ begin
|
|
FUpdatingFromShape := true;
|
|
FUpdatingFromShape := true;
|
|
mode := AShape.Usermode;
|
|
mode := AShape.Usermode;
|
|
f := AShape.Fields;
|
|
f := AShape.Fields;
|
|
- if vsfPenColor in f then penColor := AShape.PenColor;
|
|
|
|
|
|
+ if vsfPenFill in f then PenFillControl.AssignFill(AShape.PenFill);
|
|
if vsfPenWidth in f then penWidth:= AShape.PenWidth;
|
|
if vsfPenWidth in f then penWidth:= AShape.PenWidth;
|
|
if vsfPenStyle in f then penStyle:= AShape.PenStyle;
|
|
if vsfPenStyle in f then penStyle:= AShape.PenStyle;
|
|
if vsfJoinStyle in f then joinStyle:= AShape.JoinStyle;
|
|
if vsfJoinStyle in f then joinStyle:= AShape.JoinStyle;
|
|
@@ -1210,6 +1215,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
UpdateBackToolFillPoints;
|
|
UpdateBackToolFillPoints;
|
|
|
|
+ UpdatePenToolFillPoints;
|
|
UpDownPenWidth.Enabled := vsfPenWidth in f;
|
|
UpDownPenWidth.Enabled := vsfPenWidth in f;
|
|
ButtonPenStyle.Enabled:= vsfPenStyle in f;
|
|
ButtonPenStyle.Enabled:= vsfPenStyle in f;
|
|
EnableDisableToolButtons([ToolButtonJoinRound,ToolButtonJoinBevel,ToolButtonJoinMiter], vsfJoinStyle in f);
|
|
EnableDisableToolButtons([ToolButtonJoinRound,ToolButtonJoinBevel,ToolButtonJoinMiter], vsfJoinStyle in f);
|
|
@@ -1312,7 +1318,7 @@ begin
|
|
raise exception.Create('No shape type selected');
|
|
raise exception.Create('No shape type selected');
|
|
result := PaintToolClass[currentTool].Create(vectorOriginal);
|
|
result := PaintToolClass[currentTool].Create(vectorOriginal);
|
|
if (result is TCustomPolypointShape) and (BackFillControl.FillType = vftGradient) then BackFillControl.FillType := vftSolid;
|
|
if (result is TCustomPolypointShape) and (BackFillControl.FillType = vftGradient) then BackFillControl.FillType := vftSolid;
|
|
- result.PenColor := penColor;
|
|
|
|
|
|
+ if (result is TCustomPolypointShape) and (PenFillControl.FillType = vftGradient) then PenFillControl.FillType := vftSolid;
|
|
result.PenWidth := penWidth;
|
|
result.PenWidth := penWidth;
|
|
result.PenStyle := penStyle;
|
|
result.PenStyle := penStyle;
|
|
if vsfJoinStyle in result.Fields then result.JoinStyle := joinStyle;
|
|
if vsfJoinStyle in result.Fields then result.JoinStyle := joinStyle;
|
|
@@ -1335,6 +1341,12 @@ begin
|
|
result.BackFill := vectorFill;
|
|
result.BackFill := vectorFill;
|
|
vectorFill.Free;
|
|
vectorFill.Free;
|
|
end;
|
|
end;
|
|
|
|
+ if vsfPenFill in result.Fields then
|
|
|
|
+ begin
|
|
|
|
+ vectorFill := PenFillControl.CreateShapeFill(result);
|
|
|
|
+ result.PenFill := vectorFill;
|
|
|
|
+ vectorFill.Free;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.RemoveExtendedStyleControls;
|
|
procedure TForm1.RemoveExtendedStyleControls;
|
|
@@ -1376,11 +1388,28 @@ begin
|
|
if (currentTool = ptMoveBackFillPoint) and not canEdit then currentTool:= ptHand;
|
|
if (currentTool = ptMoveBackFillPoint) and not canEdit then currentTool:= ptHand;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.UpdatePenToolFillPoints;
|
|
|
|
+var
|
|
|
|
+ canEdit: Boolean;
|
|
|
|
+begin
|
|
|
|
+ canEdit := (PenFillControl.FillType in[vftGradient,vftTexture]) and
|
|
|
|
+ Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape);
|
|
|
|
+ ButtonMovePenFillPoints.Enabled := canEdit;
|
|
|
|
+ if (currentTool = ptMovePenFillPoint) and not canEdit then currentTool:= ptHand;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.UpdateShapeBackFill;
|
|
procedure TForm1.UpdateShapeBackFill;
|
|
begin
|
|
begin
|
|
if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) and
|
|
if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) and
|
|
(vsfBackFill in vectorOriginal.SelectedShape.Fields) then
|
|
(vsfBackFill in vectorOriginal.SelectedShape.Fields) then
|
|
- BackFillControl.UpdateShapeFill(vectorOriginal.SelectedShape);
|
|
|
|
|
|
+ BackFillControl.UpdateShapeFill(vectorOriginal.SelectedShape, True);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TForm1.UpdateShapePenFill;
|
|
|
|
+begin
|
|
|
|
+ if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) and
|
|
|
|
+ (vsfPenFill in vectorOriginal.SelectedShape.Fields) then
|
|
|
|
+ PenFillControl.UpdateShapeFill(vectorOriginal.SelectedShape, FAlse);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.UpdateShapeUserMode;
|
|
procedure TForm1.UpdateShapeUserMode;
|
|
@@ -1394,8 +1423,15 @@ begin
|
|
if vectorOriginal.SelectedShape.Usermode <> vsuEditBackFill then
|
|
if vectorOriginal.SelectedShape.Usermode <> vsuEditBackFill then
|
|
vectorOriginal.SelectedShape.Usermode := vsuEditBackFill;
|
|
vectorOriginal.SelectedShape.Usermode := vsuEditBackFill;
|
|
end else
|
|
end else
|
|
|
|
+ if (currentTool = ptMovePenFillPoint) and
|
|
|
|
+ (vsfPenFill in vectorOriginal.SelectedShape.Fields) and
|
|
|
|
+ vectorOriginal.SelectedShape.PenFill.IsEditable then
|
|
|
|
+ begin
|
|
|
|
+ if vectorOriginal.SelectedShape.Usermode <> vsuEditPenFill then
|
|
|
|
+ vectorOriginal.SelectedShape.Usermode := vsuEditPenFill;
|
|
|
|
+ end else
|
|
begin
|
|
begin
|
|
- if vectorOriginal.SelectedShape.Usermode = vsuEditBackFill then
|
|
|
|
|
|
+ if vectorOriginal.SelectedShape.Usermode in[vsuEditPenFill,vsuEditBackFill] then
|
|
vectorOriginal.SelectedShape.Usermode := vsuEdit;
|
|
vectorOriginal.SelectedShape.Usermode := vsuEdit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1411,6 +1447,7 @@ begin
|
|
EditCut.Enabled := AShape <> nil;
|
|
EditCut.Enabled := AShape <> nil;
|
|
EditDelete.Enabled := AShape <> nil;
|
|
EditDelete.Enabled := AShape <> nil;
|
|
BackFillControl.CanAdjustToShape := AShape <> nil;
|
|
BackFillControl.CanAdjustToShape := AShape <> nil;
|
|
|
|
+ PenFillControl.CanAdjustToShape := AShape <> nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.RemoveShapeIfEmpty(AShape: TVectorShape);
|
|
procedure TForm1.RemoveShapeIfEmpty(AShape: TVectorShape);
|
|
@@ -1469,6 +1506,32 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.PenFillControlResize(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ PanelPenFill.ClientWidth := PanelPenFillHead.Width+PenFillControl.Width+2;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TForm1.RequestPenFillAdjustToShape(Sender: TObject);
|
|
|
|
+var
|
|
|
|
+ vectorFill: TVectorialFill;
|
|
|
|
+begin
|
|
|
|
+ if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
|
|
|
|
+ begin
|
|
|
|
+ vectorFill := PenFillControl.CreateShapeFill(vectorOriginal.SelectedShape);
|
|
|
|
+ vectorOriginal.SelectedShape.PenFill := vectorFill;
|
|
|
|
+ vectorFill.Free;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TForm1.RequestPenFillUpdate(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if not FUpdatingFromShape then
|
|
|
|
+ begin
|
|
|
|
+ UpdateShapePenFill;
|
|
|
|
+ UpdatePenToolFillPoints;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.DoCopy;
|
|
procedure TForm1.DoCopy;
|
|
begin
|
|
begin
|
|
if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
|
|
if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
|