[Lazarus] HiRes for IDC icons

Sandro Cumerlato sandro.cumerlato at gmail.com
Tue Aug 23 13:33:26 CEST 2016


Hello Mattias,
please take a look at the following image and at the attached "partial"
patch:


​

Well, attached patch introduces a ButtonSizeSpinEdit and a ButtonSizeLabel
within the ComponentPalette - IDE Options frame.

SpinEdit value is saved/restored to/from the Lazarus - IDE Options settings
file.


*** TODO ***

1) implement ButtonSizeLabel localizations (recalling localizations from
.po files, I huess).

2) connect ButtonSizeSpinEdit changed value to
ComponentPalette[Image/Btn][Width/Height],
these values are actually *hardcoded* within the
"components/ideintf/formeditingintf.pas"
file as listed here:

Index: components/ideintf/formeditingintf.pas
===================================================================
--- components/ideintf/formeditingintf.pas (revision 51215)
+++ components/ideintf/formeditingintf.pas (working copy)
@@ -20,8 +20,8 @@
   LCLClasses, ProjectIntf, ComponentEditors, ObjectInspector,
UnitResources;

 const
-  ComponentPaletteImageWidth = 24;
-  ComponentPaletteImageHeight = 24;
+  ComponentPaletteImageWidth = 48;
+  ComponentPaletteImageHeight = 48;
   ComponentPaletteBtnWidth  = ComponentPaletteImageWidth + 3;
   ComponentPaletteBtnHeight = ComponentPaletteImageHeight + 3;
   DesignerBaseClassId_TForm = 0;


...

Can you please take care of the missing part of the patch? I've looked
within the Lazarus IDE source code, but it seems an hard task for me to
implement it, sorry.

Thank you for your cooperation.

Sandro Cumerlato

On 23 August 2016 at 13:14, Mattias Gaertner <nc-gaertnma at netcologne.de>
wrote:

> On Tue, 23 Aug 2016 12:39:38 +0200
> Sandro Cumerlato <sandro.cumerlato at gmail.com> wrote:
>
> > Hello Don,
> > this is a "known" issue of the Lazarus IDE.
> >
> > Is it already listed on the Lazarus Bugtracker?
> >
> > If the problem is related to the size of the component palette
> > buttons, I have a partial patch for it to work on...
> >
> > Best regards,
> > Sandro Cumerlato
> >
> >
> > Index: components/ideintf/formeditingintf.pas
> > ===================================================================
> > --- components/ideintf/formeditingintf.pas (revision 51215)
> > +++ components/ideintf/formeditingintf.pas (working copy)
> > @@ -20,8 +20,8 @@
> >    LCLClasses, ProjectIntf, ComponentEditors, ObjectInspector,
> UnitResources;
> >
> >  const
> > -  ComponentPaletteImageWidth = 24;
> > -  ComponentPaletteImageHeight = 24;
> > +  ComponentPaletteImageWidth = 48;
> > +  ComponentPaletteImageHeight = 48;
>
> That needs a more flexible solution.
> What do you purpose?
>
> Mattias
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus-ide.org
> http://lists.lazarus-ide.org/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160823/e59790c9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: button_size.png
Type: image/png
Size: 23742 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160823/e59790c9/attachment-0001.png>
-------------- next part --------------
Index: components/ideintf/componentreg.pas
===================================================================
--- components/ideintf/componentreg.pas	(revision 51215)
+++ components/ideintf/componentreg.pas	(working copy)
@@ -84,6 +84,7 @@
     // Pages removed or renamed. They must be hidden in the palette.
     FHiddenPageNames: TStringList;
     FVisible: boolean;
+    FButtonSize: integer;
   public
     constructor Create;
     destructor Destroy; override;
@@ -95,6 +96,7 @@
   public
     property HiddenPageNames: TStringList read FHiddenPageNames;
     property Visible: boolean read FVisible write FVisible;
+    property ButtonSize: integer read FButtonSize write FButtonSize;
   end;
 
   { TCompPaletteUserOrder }
@@ -407,6 +409,7 @@
   inherited Create;
   FHiddenPageNames := TStringList.Create;
   FVisible := True;
+  FButtonSize := 24;
 end;
 
 destructor TCompPaletteOptions.Destroy;
@@ -426,6 +429,7 @@
   inherited Assign(Source);
   FHiddenPageNames.Assign(Source.FHiddenPageNames);
   FVisible := Source.FVisible;
+  FButtonSize := Source.FButtonSize;
 end;
 
 function TCompPaletteOptions.IsDefault: Boolean;
@@ -446,6 +450,7 @@
   Path := Path + BasePath;
   try
     FVisible:=XMLConfig.GetValue(Path+'Visible/Value',true);
+    FButtonSize:=XMLConfig.GetValue(Path+'ButtonSize/Value',24);
 
     // Pages
     FPageNames.Clear;
@@ -498,7 +503,8 @@
 begin
   try
     Path := Path + BasePath;
-    XMLConfig.SetDeleteValue(Path+'Visible/Value', FVisible,true);
+    XMLConfig.SetDeleteValue(Path+'Visible/Value', FVisible, true);
+    XMLConfig.SetDeleteValue(Path+'ButtonSize/Value', FButtonSize, 24);
 
     SubPath:=Path+'Pages/';
     XMLConfig.DeletePath(SubPath);
Index: components/ideintf/formeditingintf.pas
===================================================================
--- components/ideintf/formeditingintf.pas	(revision 51215)
+++ components/ideintf/formeditingintf.pas	(working copy)
@@ -20,8 +20,8 @@
   LCLClasses, ProjectIntf, ComponentEditors, ObjectInspector, UnitResources;
   
 const
-  ComponentPaletteImageWidth = 24;
-  ComponentPaletteImageHeight = 24;
+  ComponentPaletteImageWidth = 48;
+  ComponentPaletteImageHeight = 48;
   ComponentPaletteBtnWidth  = ComponentPaletteImageWidth + 3;
   ComponentPaletteBtnHeight = ComponentPaletteImageHeight + 3;
   DesignerBaseClassId_TForm = 0;
Index: ide/frames/componentpalette_options.lfm
===================================================================
--- ide/frames/componentpalette_options.lfm	(revision 51215)
+++ ide/frames/componentpalette_options.lfm	(working copy)
@@ -7,11 +7,11 @@
   ClientWidth = 589
   TabOrder = 0
   Visible = False
-  DesignLeft = 494
-  DesignTop = 307
+  DesignLeft = 644
+  DesignTop = 315
   object PagesGroupBox: TGroupBox
     AnchorSideLeft.Control = Owner
-    AnchorSideTop.Control = cbPaletteVisible
+    AnchorSideTop.Control = ButtonSizeSpinEdit
     AnchorSideTop.Side = asrBottom
     AnchorSideRight.Control = Splitter1
     AnchorSideRight.Side = asrBottom
@@ -18,13 +18,13 @@
     AnchorSideBottom.Control = Owner
     AnchorSideBottom.Side = asrBottom
     Left = 0
-    Height = 440
-    Top = 28
+    Height = 394
+    Top = 74
     Width = 195
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Top = 6
     Caption = 'PagesGroupBox'
-    ClientHeight = 419
+    ClientHeight = 364
     ClientWidth = 191
     Constraints.MinWidth = 100
     TabOrder = 0
@@ -34,7 +34,7 @@
       AnchorSideRight.Control = PageMoveUpBtn
       AnchorSideBottom.Control = AddPageButton
       Left = 1
-      Height = 326
+      Height = 251
       Top = 0
       Width = 156
       Anchors = [akTop, akLeft, akRight, akBottom]
@@ -54,9 +54,9 @@
       AnchorSideTop.Side = asrBottom
       AnchorSideBottom.Control = ImportDividerBevel
       Left = 1
-      Height = 29
-      Top = 332
-      Width = 49
+      Height = 35
+      Top = 257
+      Width = 77
       Anchors = [akLeft, akBottom]
       AutoSize = True
       BorderSpacing.Top = 6
@@ -70,10 +70,10 @@
       AnchorSideLeft.Side = asrBottom
       AnchorSideTop.Control = AddPageButton
       AnchorSideBottom.Side = asrBottom
-      Left = 59
-      Height = 29
-      Top = 332
-      Width = 101
+      Left = 87
+      Height = 35
+      Top = 257
+      Width = 146
       AutoSize = True
       BorderSpacing.Left = 9
       BorderSpacing.Bottom = 6
@@ -118,8 +118,8 @@
       AnchorSideRight.Side = asrBottom
       AnchorSideBottom.Control = ImportButton
       Left = 1
-      Height = 17
-      Top = 367
+      Height = 25
+      Top = 298
       Width = 190
       Caption = 'Import / Export'
       Anchors = [akLeft, akRight, akBottom]
@@ -133,10 +133,10 @@
       AnchorSideTop.Side = asrCenter
       AnchorSideBottom.Control = PagesGroupBox
       AnchorSideBottom.Side = asrBottom
-      Left = 77
-      Height = 29
-      Top = 384
-      Width = 65
+      Left = 108
+      Height = 35
+      Top = 323
+      Width = 98
       AutoSize = True
       BorderSpacing.Left = 13
       BorderSpacing.Bottom = 6
@@ -151,9 +151,9 @@
       AnchorSideBottom.Control = PagesGroupBox
       AnchorSideBottom.Side = asrBottom
       Left = 1
-      Height = 29
-      Top = 384
-      Width = 63
+      Height = 35
+      Top = 323
+      Width = 94
       Anchors = [akLeft, akBottom]
       AutoSize = True
       BorderSpacing.Top = 3
@@ -177,7 +177,7 @@
     Anchors = [akTop, akLeft, akRight, akBottom]
     BorderSpacing.Left = 6
     Caption = 'ComponentsGroupBox'
-    ClientHeight = 447
+    ClientHeight = 438
     ClientWidth = 384
     TabOrder = 1
     object ComponentsListView: TListView
@@ -187,7 +187,7 @@
       AnchorSideBottom.Control = ComponentsGroupBox
       AnchorSideBottom.Side = asrBottom
       Left = 1
-      Height = 445
+      Height = 436
       Top = 1
       Width = 349
       Anchors = [akTop, akLeft, akRight, akBottom]
@@ -276,13 +276,46 @@
   object cbPaletteVisible: TCheckBox
     AnchorSideTop.Side = asrBottom
     Left = 1
-    Height = 22
+    Height = 29
     Top = 0
-    Width = 115
+    Width = 154
     BorderSpacing.Top = 6
     Caption = 'Palette is visible'
     TabOrder = 3
   end
+  object ButtonSizeSpinEdit: TSpinEdit
+    AnchorSideLeft.Control = Owner
+    AnchorSideTop.Control = cbPaletteVisible
+    AnchorSideTop.Side = asrBottom
+    AnchorSideRight.Control = ButtonSizeLabel
+    Left = 0
+    Height = 33
+    Top = 35
+    Width = 72
+    BorderSpacing.Top = 6
+    Increment = 24
+    MaxValue = 96
+    MinValue = 24
+    TabOrder = 4
+    Value = 24
+  end
+  object ButtonSizeLabel: TLabel
+    AnchorSideLeft.Control = ButtonSizeSpinEdit
+    AnchorSideLeft.Side = asrBottom
+    AnchorSideTop.Control = cbPaletteVisible
+    AnchorSideTop.Side = asrBottom
+    AnchorSideRight.Control = Splitter1
+    AnchorSideRight.Side = asrBottom
+    Left = 78
+    Height = 25
+    Top = 38
+    Width = 117
+    Anchors = [akTop, akLeft, akRight]
+    BorderSpacing.Left = 6
+    BorderSpacing.Top = 9
+    Caption = 'Button size'
+    ParentColor = False
+  end
   object ImportDialog: TOpenDialog
     left = 168
     top = 432
Index: ide/frames/componentpalette_options.pas
===================================================================
--- ide/frames/componentpalette_options.pas	(revision 51215)
+++ ide/frames/componentpalette_options.pas	(working copy)
@@ -26,10 +26,9 @@
 
 uses
   Classes, SysUtils, Graphics, Forms, Controls, StdCtrls, Dialogs, Buttons,
-  ComCtrls, ExtCtrls, FileUtil, LCLProc, LCLType, Menus, IDEProcs, Laz2_XMLCfg,
-  EnvironmentOpts, LazarusIDEStrConsts, IDEOptionsIntf,
-  IDEImagesIntf, DividerBevel, ComponentReg, IDEOptionDefs,
-  PackageDefs;
+  ComCtrls, ExtCtrls, FileUtil, LCLProc, LCLType, Menus, Spin, IDEProcs,
+  Laz2_XMLCfg, EnvironmentOpts, LazarusIDEStrConsts, IDEOptionsIntf,
+  IDEImagesIntf, DividerBevel, ComponentReg, IDEOptionDefs, PackageDefs;
 
 type
   { TCompPaletteOptionsFrame }
@@ -41,6 +40,7 @@
     ComponentsListView: TListView;
     CompMoveDownBtn: TSpeedButton;
     DeleteMenuItem: TMenuItem;
+    ButtonSizeLabel: TLabel;
     RenameMenuItem: TMenuItem;
     PagesPopupMenu: TPopupMenu;
     ExportButton: TBitBtn;
@@ -54,6 +54,7 @@
     PagesGroupBox: TGroupBox;
     RestoreButton: TBitBtn;
     ExportDialog: TSaveDialog;
+    ButtonSizeSpinEdit: TSpinEdit;
     Splitter1: TSplitter;
     procedure AddPageButtonClick(Sender: TObject);
     procedure ComponentsListViewChange(Sender: TObject; Item: TListItem;
@@ -194,6 +195,7 @@
   fLocalOptions.Assign(Opts);
   fLocalUserOrder.Options := fLocalOptions;
   cbPaletteVisible.Checked := Opts.Visible;
+  ButtonSizeSpinEdit.Value := Opts.ButtonSize;
   ActualReadSettings;
 end;
 
@@ -213,6 +215,7 @@
 begin
   Opts := (AOptions as TEnvironmentOptions).Desktop.ComponentPaletteOptions;
   Opts.Visible := cbPaletteVisible.Checked;
+  Opts.ButtonSize := ButtonSizeSpinEdit.Value;
   MainIDEBar.DoSetViewComponentPalette(cbPaletteVisible.Checked);
   if not fConfigChanged then Exit;
   ActualWriteSettings(Opts);


More information about the Lazarus mailing list