瀏覽代碼

resizing tool icon

Unknown 6 年之前
父節點
當前提交
a6d77ce39e
共有 3 個文件被更改,包括 51 次插入35 次删除
  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
 object Form1: TForm1
-  Left = 483
+  Left = 481
   Height = 622
   Height = 622
-  Top = 132
+  Top = 82
   Width = 981
   Width = 981
   Caption = 'Vector Edit'
   Caption = 'Vector Edit'
   ClientHeight = 622
   ClientHeight = 622
@@ -97,12 +97,12 @@ object Form1: TForm1
       Top = 1
       Top = 1
       Width = 55
       Width = 55
       Align = alLeft
       Align = alLeft
-      ButtonHeight = 55
-      ButtonWidth = 54
+      ButtonHeight = 52
+      ButtonWidth = 53
       EdgeBorders = []
       EdgeBorders = []
       EdgeInner = esNone
       EdgeInner = esNone
       EdgeOuter = esNone
       EdgeOuter = esNone
-      Images = BGRAImageList48
+      Images = ToolImageList48
       ParentColor = False
       ParentColor = False
       ParentShowHint = False
       ParentShowHint = False
       ShowHint = True
       ShowHint = True
@@ -110,7 +110,7 @@ object Form1: TForm1
       object ToolButtonRectangle: TToolButton
       object ToolButtonRectangle: TToolButton
         Left = 1
         Left = 1
         Hint = 'Rectangle'
         Hint = 'Rectangle'
-        Top = 55
+        Top = 52
         Caption = 'Rectangle'
         Caption = 'Rectangle'
         Grouped = True
         Grouped = True
         ImageIndex = 19
         ImageIndex = 19
@@ -120,7 +120,7 @@ object Form1: TForm1
       object ToolButtonEllipse: TToolButton
       object ToolButtonEllipse: TToolButton
         Left = 1
         Left = 1
         Hint = 'Ellipse'
         Hint = 'Ellipse'
-        Top = 110
+        Top = 104
         Caption = 'Ellipse'
         Caption = 'Ellipse'
         Grouped = True
         Grouped = True
         ImageIndex = 20
         ImageIndex = 20
@@ -130,7 +130,7 @@ object Form1: TForm1
       object ToolButtonPolygon: TToolButton
       object ToolButtonPolygon: TToolButton
         Left = 1
         Left = 1
         Hint = 'Polygon'
         Hint = 'Polygon'
-        Top = 275
+        Top = 260
         Caption = 'Polygon'
         Caption = 'Polygon'
         Grouped = True
         Grouped = True
         ImageIndex = 21
         ImageIndex = 21
@@ -140,7 +140,7 @@ object Form1: TForm1
       object ToolButtonClosedCurve: TToolButton
       object ToolButtonClosedCurve: TToolButton
         Left = 1
         Left = 1
         Hint = 'Closed curve'
         Hint = 'Closed curve'
-        Top = 330
+        Top = 312
         Caption = 'Closed curve'
         Caption = 'Closed curve'
         Grouped = True
         Grouped = True
         ImageIndex = 22
         ImageIndex = 22
@@ -160,7 +160,7 @@ object Form1: TForm1
       object ToolButtonPolyline: TToolButton
       object ToolButtonPolyline: TToolButton
         Left = 1
         Left = 1
         Hint = 'Polyline'
         Hint = 'Polyline'
-        Top = 165
+        Top = 156
         Caption = 'ToolButtonPolyline'
         Caption = 'ToolButtonPolyline'
         Grouped = True
         Grouped = True
         ImageIndex = 122
         ImageIndex = 122
@@ -170,7 +170,7 @@ object Form1: TForm1
       object ToolButtonCurve: TToolButton
       object ToolButtonCurve: TToolButton
         Left = 1
         Left = 1
         Hint = 'Curve'
         Hint = 'Curve'
-        Top = 220
+        Top = 208
         Caption = 'ToolButtonCurve'
         Caption = 'ToolButtonCurve'
         Grouped = True
         Grouped = True
         ImageIndex = 123
         ImageIndex = 123
@@ -180,7 +180,7 @@ object Form1: TForm1
       object ToolButtonPhongShape: TToolButton
       object ToolButtonPhongShape: TToolButton
         Left = 1
         Left = 1
         Hint = 'Phong-shaded shape'
         Hint = 'Phong-shaded shape'
-        Top = 385
+        Top = 364
         Caption = 'ToolButtonPhongShape'
         Caption = 'ToolButtonPhongShape'
         Grouped = True
         Grouped = True
         ImageIndex = 70
         ImageIndex = 70
@@ -2750,7 +2750,7 @@ object Form1: TForm1
           Align = alNone
           Align = alNone
           Caption = 'ToolBar2'
           Caption = 'ToolBar2'
           EdgeBorders = [ebLeft, ebBottom]
           EdgeBorders = [ebLeft, ebBottom]
-          Images = BGRAFillImageList16
+          Images = FillImageList16
           ParentShowHint = False
           ParentShowHint = False
           ShowHint = True
           ShowHint = True
           TabOrder = 1
           TabOrder = 1
@@ -5619,7 +5619,7 @@ object Form1: TForm1
     left = 104
     left = 104
     top = 96
     top = 96
   end
   end
-  object BGRAImageList48: TBGRAImageList
+  object ToolImageList48: TBGRAImageList
     Height = 48
     Height = 48
     Width = 48
     Width = 48
     left = 104
     left = 104
@@ -41356,7 +41356,7 @@ object Form1: TForm1
     left = 392
     left = 392
     top = 96
     top = 96
   end
   end
-  object BGRAFillImageList16: TBGRAImageList
+  object FillImageList16: TBGRAImageList
     left = 536
     left = 536
     top = 96
     top = 96
     Bitmap = {
     Bitmap = {

+ 30 - 19
vectoredit/umain.pas

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

+ 6 - 1
vectoredit/vectoredit.lpi

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