Преглед на файлове

outline width interface

Unknown преди 6 години
родител
ревизия
97c90d6402
променени са 3 файла, в които са добавени 160 реда и са изтрити 13 реда
  1. 2 2
      lazpaintcontrols/lcvectororiginal.pas
  2. 125 10
      vectoredit/umain.lfm
  3. 33 1
      vectoredit/umain.pas

+ 2 - 2
lazpaintcontrols/lcvectororiginal.pas

@@ -968,7 +968,7 @@ begin
   FContainer := AContainer;
   FPenFill := nil;
   FPenWidth := 1;
-  FOutlineWidth := 2;
+  FOutlineWidth := DefaultShapeOutlineWidth;
   FStroker := nil;
   FOnChange := nil;
   FOnEditingChange := nil;
@@ -1032,7 +1032,7 @@ begin
     if vsfOutlineFill in f then
     begin
       LoadFill(AStorage, 'outline', FOutlineFill);
-      OutlineWidth := AStorage.FloatDef['outline-width', 2];
+      OutlineWidth := AStorage.FloatDef['outline-width', DefaultShapeOutlineWidth];
     end;
     EndUpdate;
   end;

+ 125 - 10
vectoredit/umain.lfm

@@ -572,10 +572,10 @@ object Form1: TForm1
         end
         object UpDownPenWidth: TBCTrackbarUpdown
           Left = 45
-          Height = 25
+          Height = 28
           Top = 29
           Width = 56
-          BarExponent = 1
+          BarExponent = 3
           Increment = 5
           LongTimeInterval = 400
           MinValue = 10
@@ -1024,7 +1024,7 @@ object Form1: TForm1
         end
       end
       object PanelShape: TBCPanel
-        Left = 700
+        Left = 756
         Height = 59
         Top = 0
         Width = 120
@@ -1210,7 +1210,7 @@ object Form1: TForm1
         Left = 549
         Height = 59
         Top = 0
-        Width = 151
+        Width = 207
         Background.Color = clBtnFace
         Background.ColorOpacity = 255
         Background.Gradient1.StartColor = clWhite
@@ -1271,21 +1271,21 @@ object Form1: TForm1
           Left = 1
           Height = 57
           Top = 1
-          Width = 31
+          Width = 87
           Align = alLeft
           BevelOuter = bvNone
           ClientHeight = 57
-          ClientWidth = 31
+          ClientWidth = 87
           TabOrder = 0
           object LOutline: TLabel
             Left = 0
             Height = 28
             Hint = 'Outline color'
             Top = 0
-            Width = 31
+            Width = 87
             Align = alTop
             AutoSize = False
-            Caption = 'Out'
+            Caption = 'Outline'
             Layout = tlCenter
             ParentColor = False
             ParentFont = False
@@ -1296,7 +1296,7 @@ object Form1: TForm1
             Left = 0
             Height = 29
             Top = 28
-            Width = 31
+            Width = 87
             Align = alClient
             ButtonHeight = 28
             ButtonWidth = 28
@@ -1317,10 +1317,125 @@ object Form1: TForm1
               OnClick = ToolButtonClick
               Style = tbsCheck
             end
+            object UpDownOutlineWidth: TBCTrackbarUpdown
+              Left = 28
+              Height = 28
+              Top = 0
+              Width = 56
+              BarExponent = 3
+              Increment = 5
+              LongTimeInterval = 400
+              MinValue = 5
+              MaxValue = 999
+              OnChange = UpDownOutlineWidthChange
+              Value = 20
+              ShortTimeInterval = 100
+              Background.Color = clWindow
+              Background.ColorOpacity = 255
+              Background.Gradient1.StartColor = clWhite
+              Background.Gradient1.StartColorOpacity = 255
+              Background.Gradient1.DrawMode = dmSet
+              Background.Gradient1.EndColor = clBlack
+              Background.Gradient1.EndColorOpacity = 255
+              Background.Gradient1.ColorCorrection = True
+              Background.Gradient1.GradientType = gtLinear
+              Background.Gradient1.Point1XPercent = 0
+              Background.Gradient1.Point1YPercent = 0
+              Background.Gradient1.Point2XPercent = 0
+              Background.Gradient1.Point2YPercent = 100
+              Background.Gradient1.Sinus = False
+              Background.Gradient2.StartColor = clWhite
+              Background.Gradient2.StartColorOpacity = 255
+              Background.Gradient2.DrawMode = dmSet
+              Background.Gradient2.EndColor = clBlack
+              Background.Gradient2.EndColorOpacity = 255
+              Background.Gradient2.ColorCorrection = True
+              Background.Gradient2.GradientType = gtLinear
+              Background.Gradient2.Point1XPercent = 0
+              Background.Gradient2.Point1YPercent = 0
+              Background.Gradient2.Point2XPercent = 0
+              Background.Gradient2.Point2YPercent = 100
+              Background.Gradient2.Sinus = False
+              Background.Gradient1EndPercent = 35
+              Background.Style = bbsColor
+              ButtonBackground.Color = clBlack
+              ButtonBackground.ColorOpacity = 255
+              ButtonBackground.Gradient1.StartColor = clBtnShadow
+              ButtonBackground.Gradient1.StartColorOpacity = 255
+              ButtonBackground.Gradient1.DrawMode = dmSet
+              ButtonBackground.Gradient1.EndColor = clBtnFace
+              ButtonBackground.Gradient1.EndColorOpacity = 255
+              ButtonBackground.Gradient1.ColorCorrection = True
+              ButtonBackground.Gradient1.GradientType = gtLinear
+              ButtonBackground.Gradient1.Point1XPercent = 0
+              ButtonBackground.Gradient1.Point1YPercent = -50
+              ButtonBackground.Gradient1.Point2XPercent = 0
+              ButtonBackground.Gradient1.Point2YPercent = 50
+              ButtonBackground.Gradient1.Sinus = False
+              ButtonBackground.Gradient2.StartColor = clBtnFace
+              ButtonBackground.Gradient2.StartColorOpacity = 255
+              ButtonBackground.Gradient2.DrawMode = dmSet
+              ButtonBackground.Gradient2.EndColor = clBtnShadow
+              ButtonBackground.Gradient2.EndColorOpacity = 255
+              ButtonBackground.Gradient2.ColorCorrection = True
+              ButtonBackground.Gradient2.GradientType = gtLinear
+              ButtonBackground.Gradient2.Point1XPercent = 0
+              ButtonBackground.Gradient2.Point1YPercent = 50
+              ButtonBackground.Gradient2.Point2XPercent = 0
+              ButtonBackground.Gradient2.Point2YPercent = 150
+              ButtonBackground.Gradient2.Sinus = False
+              ButtonBackground.Gradient1EndPercent = 50
+              ButtonBackground.Style = bbsGradient
+              ButtonDownBackground.Color = clBtnShadow
+              ButtonDownBackground.ColorOpacity = 255
+              ButtonDownBackground.Gradient1.StartColor = clWhite
+              ButtonDownBackground.Gradient1.StartColorOpacity = 255
+              ButtonDownBackground.Gradient1.DrawMode = dmSet
+              ButtonDownBackground.Gradient1.EndColor = clBlack
+              ButtonDownBackground.Gradient1.EndColorOpacity = 255
+              ButtonDownBackground.Gradient1.ColorCorrection = True
+              ButtonDownBackground.Gradient1.GradientType = gtLinear
+              ButtonDownBackground.Gradient1.Point1XPercent = 0
+              ButtonDownBackground.Gradient1.Point1YPercent = 0
+              ButtonDownBackground.Gradient1.Point2XPercent = 0
+              ButtonDownBackground.Gradient1.Point2YPercent = 100
+              ButtonDownBackground.Gradient1.Sinus = False
+              ButtonDownBackground.Gradient2.StartColor = clWhite
+              ButtonDownBackground.Gradient2.StartColorOpacity = 255
+              ButtonDownBackground.Gradient2.DrawMode = dmSet
+              ButtonDownBackground.Gradient2.EndColor = clBlack
+              ButtonDownBackground.Gradient2.EndColorOpacity = 255
+              ButtonDownBackground.Gradient2.ColorCorrection = True
+              ButtonDownBackground.Gradient2.GradientType = gtLinear
+              ButtonDownBackground.Gradient2.Point1XPercent = 0
+              ButtonDownBackground.Gradient2.Point1YPercent = 0
+              ButtonDownBackground.Gradient2.Point2XPercent = 0
+              ButtonDownBackground.Gradient2.Point2YPercent = 100
+              ButtonDownBackground.Gradient2.Sinus = False
+              ButtonDownBackground.Gradient1EndPercent = 35
+              ButtonDownBackground.Style = bbsColor
+              Border.Color = clWindowText
+              Border.ColorOpacity = 255
+              Border.LightColor = clWhite
+              Border.LightOpacity = 255
+              Border.LightWidth = 0
+              Border.Style = bboSolid
+              Border.Width = 1
+              Rounding.RoundX = 1
+              Rounding.RoundY = 1
+              Rounding.RoundOptions = []
+              Font.Color = clWindowText
+              Font.Name = 'Arial'
+              HasTrackBar = True
+              ArrowColor = clBtnText
+              TabOrder = 0
+              TabStop = True
+              UseDockManager = False
+            end
           end
         end
         object OutlineFillControl: TLCVectorialFillControl
-          Left = 32
+          Left = 88
           Height = 57
           Top = 1
           Width = 117

+ 33 - 1
vectoredit/umain.pas

@@ -67,6 +67,7 @@ type
     ToolBarOutlineFill: TToolBar;
     ToolBarPenFill: TToolBar;
     ToolButtonTextShape: TToolButton;
+    UpDownOutlineWidth: TBCTrackbarUpdown;
     VectorImageList24: TBGRAImageList;
     ActionList: TActionList;
     EditCopy: TAction;
@@ -147,6 +148,7 @@ type
     procedure ShapeMoveUpExecute(Sender: TObject);
     procedure ShapeSendToBackExecute(Sender: TObject);
     procedure ToolButtonJoinClick(Sender: TObject);
+    procedure UpDownOutlineWidthChange(Sender: TObject; AByUser: boolean);
     procedure UpDownPenWidthChange(Sender: TObject; AByUser: boolean);
     procedure BGRAVirtualScreen1MouseDown(Sender: TObject;
       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
@@ -171,6 +173,8 @@ type
     FPenStyle: TBGRAPenStyle;
     FPenJoinStyle: TPenJoinStyle;
     FPenStyleMenu: TPopupMenu;
+    FOutlineWidth: Single;
+
     FFlattened: TBGRABitmap;
     FLastEditorBounds: TRect;
     FUpdatingFromShape: boolean;
@@ -202,6 +206,7 @@ type
     FFullIconHeight: integer;
     FVectorImageList: TBGRAImageList;
     procedure ComboBoxSplineStyleClick(Sender: TObject);
+    function GetOutlineWidth: single;
     function GetPenStyle: TBGRAPenStyle;
     function GetPenWidth: single;
     function GetSplineStyle: TSplineStyle;
@@ -222,6 +227,7 @@ type
     procedure RequestOutlineFillUpdate(Sender: TObject);
     procedure OnBackFillChange({%H-}ASender: TObject);
     procedure SetCurrentTool(AValue: TPaintTool);
+    procedure SetOutlineWidth(AValue: single);
     procedure SetPenJoinStyle(AValue: TPenJoinStyle);
     procedure SetPenStyle(AValue: TBGRAPenStyle);
     procedure SetPenWidth(AValue: single);
@@ -289,6 +295,7 @@ type
     property vectorTransform: TAffineMatrix read GetVectorTransform;
     property penWidth: single read GetPenWidth write SetPenWidth;
     property penStyle: TBGRAPenStyle read GetPenStyle write SetPenStyle;
+    property outlineWidth: single read GetOutlineWidth write SetOutlineWidth;
     property splineStyle: TSplineStyle read GetSplineStyle write SetSplineStyle;
     property currentTool: TPaintTool read FCurrentTool write SetCurrentTool;
     property joinStyle: TPenJoinStyle read FPenJoinStyle write SetPenJoinStyle;
@@ -439,6 +446,7 @@ begin
   newShape:= nil;
   penWidth := 5;
   penStyle := SolidPenStyle;
+  outlineWidth := DefaultShapeOutlineWidth;
   joinStyle:= pjsBevel;
   currentTool:= ptHand;
   splineStyle:= ssEasyBezier;
@@ -554,6 +562,12 @@ begin
   end;
 end;
 
+procedure TForm1.UpDownOutlineWidthChange(Sender: TObject; AByUser: boolean);
+begin
+  if not AByUser then exit;
+  outlineWidth := UpDownOutlineWidth.Value/10;
+end;
+
 procedure TForm1.EditCopyExecute(Sender: TObject);
 begin
   DoCopy;
@@ -1005,6 +1019,11 @@ begin
   end;
 end;
 
+function TForm1.GetOutlineWidth: single;
+begin
+  result := FOutlineWidth;
+end;
+
 function TForm1.GetPenStyle: TBGRAPenStyle;
 begin
   result := FPenStyle;
@@ -1209,6 +1228,14 @@ begin
   UpdateShapeUserMode;
 end;
 
+procedure TForm1.SetOutlineWidth(AValue: single);
+begin
+  FOutlineWidth := AValue;
+  UpDownOutlineWidth.Value := round(AValue*10);
+  if not FUpdatingFromShape and Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
+    vectorOriginal.SelectedShape.OutlineWidth:= FOutlineWidth;
+end;
+
 procedure TForm1.SetPenJoinStyle(AValue: TPenJoinStyle);
 begin
   if FPenJoinStyle=AValue then Exit;
@@ -1557,7 +1584,11 @@ begin
     if vsfJoinStyle in f then joinStyle:= AShape.JoinStyle;
 
     if vsfBackFill in f then BackFillControl.AssignFill(AShape.BackFill);
-    if vsfOutlineFill in f then OutlineFillControl.AssignFill(AShape.OutlineFill);
+    if vsfOutlineFill in f then
+    begin
+      OutlineFillControl.AssignFill(AShape.OutlineFill);
+      outlineWidth := AShape.OutlineWidth;
+    end;
 
     if AShape is TCurveShape then
       splineStyle:= TCurveShape(AShape).SplineStyle;
@@ -1794,6 +1825,7 @@ begin
     vectorFill := OutlineFillControl.CreateShapeFill(result);
     result.OutlineFill := vectorFill;
     vectorFill.Free;
+    result.OutlineWidth:= outlineWidth;
   end;
 end;