2
0
Unknown 6 жил өмнө
parent
commit
18d16495db

+ 31 - 0
lazpaintcontrols/lctoolbars.pas

@@ -8,6 +8,7 @@ uses
   Classes, SysUtils, Controls, ComCtrls, Types, LResources, StdCtrls, BCTrackbarUpdown;
 
 function CreateToolBar(AImages: TImageList; AOwner: TComponent = nil): TToolbar;
+procedure ReorderToolbarContent(AToolbar: TToolbar);
 function GetToolbarSize(AToolbar: TToolbar; APadding: integer = 1): TSize;
 procedure SetToolbarImages(AToolbar: TToolbar; AImages: TImageList);
 procedure EnableDisableToolButtons(AButtons: array of TToolButton; AEnabled: boolean);
@@ -43,6 +44,36 @@ begin
   result.EdgeOuter:= esNone;
 end;
 
+procedure ReorderToolbarContent(AToolbar: TToolbar);
+var
+  i,x,y: Integer;
+begin
+  AToolbar.BeginUpdate;
+  x := AToolbar.Indent;
+  y := 0;
+  for i := 0 to AToolbar.ControlCount-1 do
+  begin
+    with AToolbar.Controls[i] do
+    begin
+      if (x+Width > AToolbar.Width) and AToolbar.Wrapable then
+      begin
+        x := AToolbar.Indent;
+        y += AToolbar.ButtonHeight;
+      end;
+      Left := x;
+      Top := y;
+      x += Width;
+    end;
+    if (AToolbar.Controls[i] is TToolButton) and
+      TToolButton(AToolbar.Controls[i]).Wrap then
+    begin
+      x := AToolbar.Indent;
+      y += AToolbar.ButtonHeight;
+    end;
+  end;
+  AToolbar.EndUpdate;
+end;
+
 function GetToolbarSize(AToolbar: TToolbar; APadding: integer = 1): TSize;
 var
   i: Integer;

+ 123 - 123
vectoredit/umain.lfm

@@ -1,5 +1,5 @@
 object Form1: TForm1
-  Left = 599
+  Left = 597
   Height = 622
   Top = 0
   Width = 981
@@ -364,6 +364,128 @@ object Form1: TForm1
           end
         end
       end
+      object PanelPenFill: TBCPanel
+        Left = 62
+        Height = 59
+        Top = 0
+        Width = 151
+        Background.Color = clBtnFace
+        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
+        BevelInner = bvNone
+        BevelOuter = bvRaised
+        BevelWidth = 1
+        Border.Color = clBlack
+        Border.ColorOpacity = 255
+        Border.LightColor = clWhite
+        Border.LightOpacity = 255
+        Border.LightWidth = 0
+        Border.Style = bboNone
+        Border.Width = 1
+        FontEx.Color = clDefault
+        FontEx.EndEllipsis = False
+        FontEx.FontQuality = fqFineAntialiasing
+        FontEx.Height = 0
+        FontEx.SingleLine = True
+        FontEx.Shadow = False
+        FontEx.ShadowColor = clBlack
+        FontEx.ShadowColorOpacity = 255
+        FontEx.ShadowRadius = 5
+        FontEx.ShadowOffsetX = 5
+        FontEx.ShadowOffsetY = 5
+        FontEx.Style = []
+        FontEx.TextAlignment = bcaCenter
+        FontEx.WordBreak = False
+        Rounding.RoundX = 1
+        Rounding.RoundY = 1
+        Rounding.RoundOptions = []
+        TabOrder = 5
+        object PanelPenFillHead: TPanel
+          Left = 1
+          Height = 57
+          Top = 1
+          Width = 31
+          Align = alLeft
+          BevelOuter = bvNone
+          ClientHeight = 57
+          ClientWidth = 31
+          TabOrder = 0
+          object LPen: TLabel
+            Left = 0
+            Height = 28
+            Top = 0
+            Width = 31
+            Align = alTop
+            AutoSize = False
+            Caption = 'Pen'
+            Layout = tlCenter
+            ParentColor = False
+            ParentFont = False
+          end
+          object ToolBarPenFill: TToolBar
+            Left = 0
+            Height = 29
+            Top = 28
+            Width = 31
+            Align = alClient
+            ButtonHeight = 28
+            ButtonWidth = 28
+            Caption = 'ToolBarBackFill'
+            EdgeBorders = []
+            EdgeInner = esNone
+            EdgeOuter = esNone
+            Images = VectorImageList24
+            Indent = 0
+            ParentColor = False
+            ParentShowHint = False
+            ShowHint = True
+            TabOrder = 0
+            object ButtonMovePenFillPoints: TToolButton
+              Left = 0
+              Hint = 'Move gradient/texture points'
+              Top = 0
+              Caption = 'ButtonMoveBackFillPoints'
+              ImageIndex = 12
+              OnClick = ToolButtonClick
+              Style = tbsCheck
+            end
+          end
+        end
+        object PenFillControl: TLCVectorialFillControl
+          Left = 32
+          Height = 57
+          Top = 1
+          Width = 117
+          AutoSize = True
+          Align = alLeft
+          ToolIconSize = 24
+        end
+      end
       object PanelBasicStyle: TBCPanel
         Left = 213
         Height = 59
@@ -1068,128 +1190,6 @@ object Form1: TForm1
         TabOrder = 4
         Visible = False
       end
-      object PanelPenFill: TBCPanel
-        Left = 62
-        Height = 59
-        Top = 0
-        Width = 151
-        Background.Color = clBtnFace
-        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
-        BevelInner = bvNone
-        BevelOuter = bvRaised
-        BevelWidth = 1
-        Border.Color = clBlack
-        Border.ColorOpacity = 255
-        Border.LightColor = clWhite
-        Border.LightOpacity = 255
-        Border.LightWidth = 0
-        Border.Style = bboNone
-        Border.Width = 1
-        FontEx.Color = clDefault
-        FontEx.EndEllipsis = False
-        FontEx.FontQuality = fqFineAntialiasing
-        FontEx.Height = 0
-        FontEx.SingleLine = True
-        FontEx.Shadow = False
-        FontEx.ShadowColor = clBlack
-        FontEx.ShadowColorOpacity = 255
-        FontEx.ShadowRadius = 5
-        FontEx.ShadowOffsetX = 5
-        FontEx.ShadowOffsetY = 5
-        FontEx.Style = []
-        FontEx.TextAlignment = bcaCenter
-        FontEx.WordBreak = False
-        Rounding.RoundX = 1
-        Rounding.RoundY = 1
-        Rounding.RoundOptions = []
-        TabOrder = 5
-        object PanelPenFillHead: TPanel
-          Left = 1
-          Height = 57
-          Top = 1
-          Width = 31
-          Align = alLeft
-          BevelOuter = bvNone
-          ClientHeight = 57
-          ClientWidth = 31
-          TabOrder = 0
-          object LPen: TLabel
-            Left = 0
-            Height = 28
-            Top = 0
-            Width = 31
-            Align = alTop
-            AutoSize = False
-            Caption = 'Pen'
-            Layout = tlCenter
-            ParentColor = False
-            ParentFont = False
-          end
-          object ToolBarPenFill: TToolBar
-            Left = 0
-            Height = 29
-            Top = 28
-            Width = 31
-            Align = alClient
-            ButtonHeight = 28
-            ButtonWidth = 28
-            Caption = 'ToolBarBackFill'
-            EdgeBorders = []
-            EdgeInner = esNone
-            EdgeOuter = esNone
-            Images = VectorImageList24
-            Indent = 0
-            ParentColor = False
-            ParentShowHint = False
-            ShowHint = True
-            TabOrder = 0
-            object ButtonMovePenFillPoints: TToolButton
-              Left = 0
-              Hint = 'Move gradient/texture points'
-              Top = 0
-              Caption = 'ButtonMoveBackFillPoints'
-              ImageIndex = 12
-              OnClick = ToolButtonClick
-              Style = tbsCheck
-            end
-          end
-        end
-        object PenFillControl: TLCVectorialFillControl
-          Left = 32
-          Height = 57
-          Top = 1
-          Width = 117
-          AutoSize = True
-          Align = alLeft
-          ToolIconSize = 24
-        end
-      end
     end
   end
   object ColorDialog1: TColorDialog

+ 2 - 6
vectoredit/umain.pas

@@ -146,7 +146,6 @@ type
     procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     procedure FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
     procedure ToolButtonClick(Sender: TObject);
-    procedure UpDownPenAlphaChange(Sender: TObject; {%H-}AByUser: boolean);
   private
     FPenWidth: single;
     FPenStyle: TBGRAPenStyle;
@@ -816,11 +815,6 @@ begin
     UpdateToolbarFromShape(nil);
 end;
 
-procedure TForm1.UpDownPenAlphaChange(Sender: TObject; AByUser: boolean);
-begin
-
-end;
-
 procedure TForm1.ComboBoxSplineStyleClick(Sender: TObject);
 var
   btn: TControl;
@@ -1553,6 +1547,8 @@ end;
 
 procedure TForm1.AdjustToolbarTop;
 begin
+  ReorderToolbarContent(ToolbarTop);
+
   ToolBarTop.Height := GetToolbarSize(ToolBarTop,0).cy;
   BCPanelToolbar.Height := ToolBarTop.Height;
 end;