Procházet zdrojové kódy

resizing tool icon

Unknown před 6 roky
rodič
revize
a6d77ce39e
3 změnil soubory, kde provedl 51 přidání a 35 odebrání
  1. 15 15
      vectoredit/umain.lfm
  2. 30 19
      vectoredit/umain.pas
  3. 6 1
      vectoredit/vectoredit.lpi

+ 15 - 15
vectoredit/umain.lfm

@@ -1,7 +1,7 @@
 object Form1: TForm1
-  Left = 483
+  Left = 481
   Height = 622
-  Top = 132
+  Top = 82
   Width = 981
   Caption = 'Vector Edit'
   ClientHeight = 622
@@ -97,12 +97,12 @@ object Form1: TForm1
       Top = 1
       Width = 55
       Align = alLeft
-      ButtonHeight = 55
-      ButtonWidth = 54
+      ButtonHeight = 52
+      ButtonWidth = 53
       EdgeBorders = []
       EdgeInner = esNone
       EdgeOuter = esNone
-      Images = BGRAImageList48
+      Images = ToolImageList48
       ParentColor = False
       ParentShowHint = False
       ShowHint = True
@@ -110,7 +110,7 @@ object Form1: TForm1
       object ToolButtonRectangle: TToolButton
         Left = 1
         Hint = 'Rectangle'
-        Top = 55
+        Top = 52
         Caption = 'Rectangle'
         Grouped = True
         ImageIndex = 19
@@ -120,7 +120,7 @@ object Form1: TForm1
       object ToolButtonEllipse: TToolButton
         Left = 1
         Hint = 'Ellipse'
-        Top = 110
+        Top = 104
         Caption = 'Ellipse'
         Grouped = True
         ImageIndex = 20
@@ -130,7 +130,7 @@ object Form1: TForm1
       object ToolButtonPolygon: TToolButton
         Left = 1
         Hint = 'Polygon'
-        Top = 275
+        Top = 260
         Caption = 'Polygon'
         Grouped = True
         ImageIndex = 21
@@ -140,7 +140,7 @@ object Form1: TForm1
       object ToolButtonClosedCurve: TToolButton
         Left = 1
         Hint = 'Closed curve'
-        Top = 330
+        Top = 312
         Caption = 'Closed curve'
         Grouped = True
         ImageIndex = 22
@@ -160,7 +160,7 @@ object Form1: TForm1
       object ToolButtonPolyline: TToolButton
         Left = 1
         Hint = 'Polyline'
-        Top = 165
+        Top = 156
         Caption = 'ToolButtonPolyline'
         Grouped = True
         ImageIndex = 122
@@ -170,7 +170,7 @@ object Form1: TForm1
       object ToolButtonCurve: TToolButton
         Left = 1
         Hint = 'Curve'
-        Top = 220
+        Top = 208
         Caption = 'ToolButtonCurve'
         Grouped = True
         ImageIndex = 123
@@ -180,7 +180,7 @@ object Form1: TForm1
       object ToolButtonPhongShape: TToolButton
         Left = 1
         Hint = 'Phong-shaded shape'
-        Top = 385
+        Top = 364
         Caption = 'ToolButtonPhongShape'
         Grouped = True
         ImageIndex = 70
@@ -2750,7 +2750,7 @@ object Form1: TForm1
           Align = alNone
           Caption = 'ToolBar2'
           EdgeBorders = [ebLeft, ebBottom]
-          Images = BGRAFillImageList16
+          Images = FillImageList16
           ParentShowHint = False
           ShowHint = True
           TabOrder = 1
@@ -5619,7 +5619,7 @@ object Form1: TForm1
     left = 104
     top = 96
   end
-  object BGRAImageList48: TBGRAImageList
+  object ToolImageList48: TBGRAImageList
     Height = 48
     Width = 48
     left = 104
@@ -41356,7 +41356,7 @@ object Form1: TForm1
     left = 392
     top = 96
   end
-  object BGRAFillImageList16: TBGRAImageList
+  object FillImageList16: TBGRAImageList
     left = 536
     top = 96
     Bitmap = {

+ 30 - 19
vectoredit/umain.pas

@@ -7,11 +7,13 @@ interface
 uses
   Classes, SysUtils, Types, FileUtil, Forms, Controls, Graphics, Dialogs,
   ExtCtrls, StdCtrls, ComCtrls, ExtDlgs, Menus, BGRAVirtualScreen,
-  BCTrackbarUpdown, BCPanel, BGRAImageList, BCButton, BGRALazPaint,
-  BGRABitmap, BGRABitmapTypes, BGRATransform, BGRALayerOriginal, BGRAGraphics,
-  uvectororiginal, uvectorialfill, uvectorshapes, BGRAGradientScanner, LCLType;
+  BCTrackbarUpdown, BCPanel, BCButton, BGRAImageList, BGRALazPaint, BGRABitmap,
+  BGRABitmapTypes, BGRATransform, BGRALayerOriginal, BGRAGraphics,
+  uvectororiginal, uvectorialfill, uvectorshapes, BGRAGradientScanner, LCLType,
+  ActnList, uscaledpi;
 
 const
+  ToolIconSize = 36;
   EditorPointSize = 7;
   PenStyleToStr : array[TPenStyle] of string = ('─────', '─ ─ ─ ─', '···············', '─ · ─ · ─', '─ ·· ─ ·· ╴', 'InsideFrame', 'Pattern', 'Clear');
   GradRepetitionToStr : array[TBGRAGradientRepetition] of string = ('Pad', 'Repeat', 'Reflect', 'Sine');
@@ -40,7 +42,7 @@ type
 
   TForm1 = class(TForm)
     BackImage: TImage;
-    BGRAFillImageList16: TBGRAImageList;
+    FillImageList16: TBGRAImageList;
     ButtonBackGradInterp: TBCButton;
     ButtonBackGradRepetion: TBCButton;
     ButtonBackLoadTex: TBCButton;
@@ -96,7 +98,7 @@ type
     ToolButtonPhongShape: TToolButton;
     BCPanelToolChoice: TBCPanel;
     BCPanelToolbar: TBCPanel;
-    BGRAImageList48: TBGRAImageList;
+    ToolImageList48: TBGRAImageList;
     BGRAVirtualScreen1: TBGRAVirtualScreen;
     ColorDialog1: TColorDialog;
     OpenDialog1: TOpenDialog;
@@ -362,10 +364,19 @@ var
   ci: TBGRAColorInterpolation;
   tr: TTextureRepetition;
   ss: TSplineStyle;
+  toolImageList: TBGRAImageList;
 begin
   baseCaption:= Caption;
+  if ToolIconSize <> ToolImageList48.Width then
+  begin
+    toolImageList := TBGRAImageList.Create(self);
+    ScaleImageList(ToolImageList48, ToolIconSize,ToolIconSize, toolImageList);
+    ToolBarTools.Images := toolImageList;
+    ToolBarTools.ButtonWidth:= toolImageList.Width+5;
+    ToolBarTools.ButtonHeight:= toolImageList.Height+4;
+  end;
 
-  img := TBGRALazPaintImage.Create(640,480);
+  img := TBGRALazPaintImage.Create(16,16);
   filename := '';
   vectorOriginal := TVectorOriginal.Create;
   vectorLayer := img.AddLayerFromOwnedOriginal(vectorOriginal);
@@ -374,7 +385,7 @@ begin
   img.OnOriginalEditingChange:= @OnEditingChange;
   img.OnOriginalChange:= @OnOriginalChange;
 
-  zoom := AffineMatrixScale(1,1);
+  zoom := AffineMatrixScale(10,10);
   FPenStyleMenu := TPopupMenu.Create(nil);
   item:= TMenuItem.Create(FPenStyleMenu); item.Caption := PenStyleToStr[psClear];
   item.OnClick := @OnClickPenStyle;       item.Tag := ord(psClear);
@@ -387,7 +398,7 @@ begin
   end;
 
   FBackGradRepetitionMenu := TPopupMenu.Create(nil);
-  FBackGradRepetitionMenu.Images := BGRAFillImageList16;
+  FBackGradRepetitionMenu.Images := FillImageList16;
   for gr := low(TBGRAGradientRepetition) to high(TBGRAGradientRepetition) do
   begin
     item := TMenuItem.Create(FBackGradRepetitionMenu); item.Caption := GradRepetitionToStr[gr];
@@ -397,7 +408,7 @@ begin
   end;
 
   FBackGradInterpMenu := TPopupMenu.Create(nil);
-  FBackGradInterpMenu.Images := BGRAFillImageList16;
+  FBackGradInterpMenu.Images := FillImageList16;
   for ci := low(TBGRAColorInterpolation) to high(TBGRAColorInterpolation) do
   begin
     item := TMenuItem.Create(FBackGradInterpMenu); item.Caption := ColorInterpToStr[ci];
@@ -416,7 +427,7 @@ begin
   end;
 
   FBackTexRepetitionMenu := TPopupMenu.Create(nil);
-  FBackTexRepetitionMenu.Images := BGRAFillImageList16;
+  FBackTexRepetitionMenu.Images := FillImageList16;
   for tr := low(TTextureRepetition) to high(TTextureRepetition) do
   begin
     item := TMenuItem.Create(FBackTexRepetitionMenu); item.Caption := TextureRepetitionToStr[tr];
@@ -1156,12 +1167,12 @@ begin
   If FBackGradInterp=AValue then exit;
   FBackGradInterp:=AValue;
   glyph := TBitmap.Create;
-  glyph.Width := BGRAFillImageList16.Width;
-  glyph.Height := BGRAFillImageList16.Height;
+  glyph.Width := FillImageList16.Width;
+  glyph.Height := FillImageList16.Height;
   glyph.Canvas.Brush.Color := MergeBGRA(ColorToBGRA(ButtonBackGradInterp.StateNormal.Background.Gradient1.EndColor),
                                         ColorToBGRA(ButtonBackGradInterp.StateNormal.Background.Gradient2.StartColor));
   glyph.Canvas.FillRect(0,0,glyph.Width,glyph.Height);
-  BGRAFillImageList16.Draw(glyph.Canvas,0,0,11+ord(FBackGradInterp));
+  FillImageList16.Draw(glyph.Canvas,0,0,11+ord(FBackGradInterp));
   ButtonBackGradInterp.Glyph.Assign(glyph);
   glyph.Free;
   if not FUpdatingFromShape and ToolButtonBackFillGradDown then
@@ -1175,12 +1186,12 @@ begin
   If FBackGradRepetition=AValue then exit;
   FBackGradRepetition:=AValue;
   glyph := TBitmap.Create;
-  glyph.Width := BGRAFillImageList16.Width;
-  glyph.Height := BGRAFillImageList16.Height;
+  glyph.Width := FillImageList16.Width;
+  glyph.Height := FillImageList16.Height;
   glyph.Canvas.Brush.Color := MergeBGRA(ColorToBGRA(ButtonBackGradRepetion.StateNormal.Background.Gradient1.EndColor),
                                         ColorToBGRA(ButtonBackGradRepetion.StateNormal.Background.Gradient2.StartColor));
   glyph.Canvas.FillRect(0,0,glyph.Width,glyph.Height);
-  BGRAFillImageList16.Draw(glyph.Canvas,0,0,7+ord(FBackGradRepetition));
+  FillImageList16.Draw(glyph.Canvas,0,0,7+ord(FBackGradRepetition));
   ButtonBackGradRepetion.Glyph.Assign(glyph);
   glyph.Free;
   if not FUpdatingFromShape and ToolButtonBackFillGradDown then
@@ -1204,12 +1215,12 @@ begin
   if FBackTexRepetition=AValue then Exit;
   FBackTexRepetition:=AValue;
   glyph := TBitmap.Create;
-  glyph.Width := BGRAFillImageList16.Width;
-  glyph.Height := BGRAFillImageList16.Height;
+  glyph.Width := FillImageList16.Width;
+  glyph.Height := FillImageList16.Height;
   glyph.Canvas.Brush.Color := MergeBGRA(ColorToBGRA(ButtonBackGradInterp.StateNormal.Background.Gradient1.EndColor),
                                         ColorToBGRA(ButtonBackGradInterp.StateNormal.Background.Gradient2.StartColor));
   glyph.Canvas.FillRect(0,0,glyph.Width,glyph.Height);
-  BGRAFillImageList16.Draw(glyph.Canvas,0,0,17+ord(FBackTexRepetition));
+  FillImageList16.Draw(glyph.Canvas,0,0,17+ord(FBackTexRepetition));
   ButtonBackTexRepeat.Glyph.Assign(glyph);
   glyph.Free;
   if not FUpdatingFromShape and ToolButtonBackFillTexture.Down then

+ 6 - 1
vectoredit/vectoredit.lpi

@@ -38,7 +38,7 @@
         <PackageName Value="LCL"/>
       </Item3>
     </RequiredPackages>
-    <Units Count="6">
+    <Units Count="7">
       <Unit0>
         <Filename Value="vectoredit.lpr"/>
         <IsPartOfProject Value="True"/>
@@ -66,6 +66,11 @@
         <Filename Value="uvectorclipboard.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit5>
+      <Unit6>
+        <Filename Value="../lazpaint/uscaledpi.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="UScaleDPI"/>
+      </Unit6>
     </Units>
   </ProjectOptions>
   <CompilerOptions>