From 986d7a21a25125167dd441f18a22120f24c102d5 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 10:43:08 +0200 Subject: [PATCH 01/26] move to trash on MacOS --- lazpaint/ufilesystem.pas | 56 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/lazpaint/ufilesystem.pas b/lazpaint/ufilesystem.pas index 894c449d..51f5e758 100644 --- a/lazpaint/ufilesystem.pas +++ b/lazpaint/ufilesystem.pas @@ -543,6 +543,56 @@ function MoveToTrashOnLinux(AForm: TForm; const AFilenamesUTF8: array of string; end; {$ENDIF} +{$IFDEF DARWIN} +function RunAppleScriptLine(AScriptLine: string): boolean; +var + p: TProcess; +begin + p := nil; + try + p := TProcess.Create(nil); + p.Executable := 'osascript'; + p.Parameters.Add('-e'); + p.Parameters.Add(AScriptLine); + p.Options := [poWaitOnExit]; + p.Execute; + result := true; + except + result := false; + end; + p.Free; +end; + +function AppleScriptEscape(AText: string): string; +begin + result := StringReplace(AText, '\', '\\', [rfReplaceAll]); + result := StringReplace(result, '"', '\"', [rfReplaceAll]); +end; + +function MoveToTrashOnMacOS(AForm: TForm; const AFilenamesUTF8: array of string; AConfirmationCallback: TDeleteConfirmationFunction): boolean; +var + appleScript: String; + i: Integer; +begin + if length(AFilenamesUTF8) = 0 then exit(true); + if Assigned(AConfirmationCallback) then + begin + if not AConfirmationCallback(AForm, AFilenamesUTF8, False) then exit(false); + end; + appleScript := 'tell application "Finder" to delete {'; + for i := 0 to high(AFilenamesUTF8) do + begin + if i > 0 then appleScript += ', '; + appleScript += 'POSIX file "' + AppleScriptEscape(AFilenamesUTF8[i]) + '"'; + end; + appleScript += '}'; + if not RunAppleScriptLine(appleScript) then exit(false); + result := true; + for i := 0 to high(AFilenamesUTF8) do + if FileExists(AFilenamesUTF8[i]) then result := false; +end; +{$ENDIF} + function IsMultiFileContainerName(AFilenameUTF8: string): boolean; var ext: String; @@ -612,7 +662,11 @@ function TFileManager.MoveToTrash(AForm: TForm; const AFilenamesUTF8: array of s {$IFDEF WINDOWS} result := MoveToTrashOnWindows(AForm, realFiles, AConfirmationCallback); {$ELSE} - result := false; + {$IFDEF DARWIN} + result := MoveToTrashOnMacOS(AForm, realFiles, AConfirmationCallback); + {$ELSE} + result := false; + {$ENDIF} {$ENDIF} {$ENDIF} end; From 8df12041534f4652b9be234870f893ec0270f167 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 10:43:26 +0200 Subject: [PATCH 02/26] F5 to update file list --- lazpaint/dialog/ubrowseimages.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lazpaint/dialog/ubrowseimages.pas b/lazpaint/dialog/ubrowseimages.pas index efda7d1b..4642ed5b 100644 --- a/lazpaint/dialog/ubrowseimages.pas +++ b/lazpaint/dialog/ubrowseimages.pas @@ -374,6 +374,12 @@ procedure TFBrowseImages.FormKeyDown(Sender: TObject; var Key: Word; begin DeleteSelectedFiles; Key := 0; + end else + if (KEY = VK_F5) then + begin + ResetDirectory(false, true); + SelectFile(Edit_Filename.Text); + Key := 0; end; end; From c36b72c06c065f2cc1977c0b81cb8544beaa1cb1 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 10:54:31 +0200 Subject: [PATCH 03/26] catch error in delete file --- lazpaint/ufilesystem.pas | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lazpaint/ufilesystem.pas b/lazpaint/ufilesystem.pas index 51f5e758..534e0035 100644 --- a/lazpaint/ufilesystem.pas +++ b/lazpaint/ufilesystem.pas @@ -650,9 +650,16 @@ function TFileManager.MoveToTrash(AForm: TForm; const AFilenamesUTF8: array of s setlength(containedFiles, nbContainedFiles); if nbContainedFiles > 0 then begin - if not AConfirmationCallback(AForm, containedFiles, True) then exit; - for i := 0 to high(containedFiles) do - DeleteFile(containedFiles[i]); + if not AConfirmationCallback(AForm, containedFiles, True) then exit(false); + try + for i := 0 to high(containedFiles) do + DeleteFile(containedFiles[i]); + except on ex: exception do + begin + ShowMessage(ex.Message); + exit(false); + end; + end; end; if nbRealFiles > 0 then begin From 1b606b797532f0667fb0c54e0bd2860464626a76 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 13:40:19 +0200 Subject: [PATCH 04/26] restore combobox blendop after cancel --- lazpaint/dialog/ulayerstackinterface.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lazpaint/dialog/ulayerstackinterface.pas b/lazpaint/dialog/ulayerstackinterface.pas index 4ff69f95..31e9dcb1 100644 --- a/lazpaint/dialog/ulayerstackinterface.pas +++ b/lazpaint/dialog/ulayerstackinterface.pas @@ -912,8 +912,8 @@ procedure TLayerStackInterface.SelectBlendOp; FDontUpdateStack := true; LazPaintInstance.Image.BlendOperation[LazPaintInstance.Image.CurrentLayerIndex] := blendOp; FDontUpdateStack := false; - UpdateComboBlendOp; end; + UpdateComboBlendOp; tempUnder.Free; LazPaintInstance.ShowTopmost(topmostInfo); if LazPaintInstance.Image.CurrentLayerIndex = 0 then From 7eede3b4a82fea1b73a7604d86e3c332bc05af8e Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 16:28:28 +0200 Subject: [PATCH 05/26] go to right folder, remove old code --- lazpaint/release/macOS/makedmg.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lazpaint/release/macOS/makedmg.sh b/lazpaint/release/macOS/makedmg.sh index 6ad4f3f8..b84e2ea3 100755 --- a/lazpaint/release/macOS/makedmg.sh +++ b/lazpaint/release/macOS/makedmg.sh @@ -1,16 +1,12 @@ #!/bin/bash set -e +cd `dirname $0` if ! [ ${OSTYPE:0:6} = "darwin" ]; then echo "This script is for OS X only" exit 1 fi -if [ -e "macOS" ]; then - rm -R macOS -fi - - appname=LazPaint appversion=7.1.4 pkgversion=0 From b8ce550e5f3306123ea6a0a8c5d91a7241365d4a Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 10 Oct 2020 16:29:23 +0200 Subject: [PATCH 06/26] go to right directory --- lazpaint/release/debian/makedeb.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lazpaint/release/debian/makedeb.sh b/lazpaint/release/debian/makedeb.sh index 2b802859..7464676a 100755 --- a/lazpaint/release/debian/makedeb.sh +++ b/lazpaint/release/debian/makedeb.sh @@ -1,4 +1,6 @@ #!/bin/bash +cd `dirname $0` + STAGING_RELATIVEDIR="./staging" STAGING_DIR=$(readlink --canonicalize "${STAGING_RELATIVEDIR}") USER_DIR="${STAGING_DIR}/usr" From 02bccb3f9ac346cad4c7c0447cceb8c5ec3dbcd9 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Mon, 12 Oct 2020 23:25:10 +0200 Subject: [PATCH 07/26] update website if possible --- lazpaint.logic | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lazpaint.logic b/lazpaint.logic index 2d960238..e9cae71f 100644 --- a/lazpaint.logic +++ b/lazpaint.logic @@ -8,3 +8,8 @@ echo "DON'T FORGET TO UPDATE release/debian/changelog" text release/macOS/makedmg.sh "appversion=$(Version)" bundle release/macOS/LazPaint.app copy ../resources/icon/lazpaint.icns release/macOS/LazPaint.app/Contents/Resources/lazpaint.icns +if exists ../../lazpaint.github.io/app.js + text ../../lazpaint.github.io/app.js " var version = '$(Version)'" +else + echo "WEBSITE FOLDER NOT FOUND, UPDATE MANUALLY app.js" +end \ No newline at end of file From 3257547207113d5924460f7aba3e32cd2ba44d28 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Mon, 12 Oct 2020 23:32:09 +0200 Subject: [PATCH 08/26] more visible warning for changelog --- lazpaint.logic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lazpaint.logic b/lazpaint.logic index e9cae71f..86350f91 100644 --- a/lazpaint.logic +++ b/lazpaint.logic @@ -4,7 +4,6 @@ package lazpaintembeddedpack.lpk const lazpainttype.pas LazPaintVersion text release/windows/lazpaint.iss "#define MyAppVersion ""$(Version)""" text release/debian/debian/control "Version: $(Version)" -echo "DON'T FORGET TO UPDATE release/debian/changelog" text release/macOS/makedmg.sh "appversion=$(Version)" bundle release/macOS/LazPaint.app copy ../resources/icon/lazpaint.icns release/macOS/LazPaint.app/Contents/Resources/lazpaint.icns @@ -12,4 +11,5 @@ if exists ../../lazpaint.github.io/app.js text ../../lazpaint.github.io/app.js " var version = '$(Version)'" else echo "WEBSITE FOLDER NOT FOUND, UPDATE MANUALLY app.js" -end \ No newline at end of file +end +echo ">> DON'T FORGET TO ADD VERSION IN release/debian/changelog <<" From c1f0312c333c8dde4af15f7fc3211065fc10459a Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 14:35:38 +0200 Subject: [PATCH 09/26] add DPI scaling of checkers --- lazpaint/dialog/usaveoption.pas | 7 +++++-- lazpaint/uimagepreview.pas | 4 ++-- lazpaint/uimageview.pas | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lazpaint/dialog/usaveoption.pas b/lazpaint/dialog/usaveoption.pas index 04aacc64..063fe608 100644 --- a/lazpaint/dialog/usaveoption.pas +++ b/lazpaint/dialog/usaveoption.pas @@ -274,7 +274,7 @@ procedure DrawHourglass(bmp: TBGRABitmap); procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject; Bitmap: TBGRABitmap); -var ratioX,ratioY,ratio: single; +var ratioX,ratioY,ratio, checkerScale: single; picture: TBGRABitmap; mustFreePic: boolean; x,y,visualWidth,visualHeight: integer; @@ -341,7 +341,10 @@ procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject; thumb.Free; end else begin - DrawCheckers(Bitmap, r); + checkerScale := DoScaleX(60, OriginalDPI)/60; + if not BGRAPreview.BitmapAutoScale then + checkerScale *= BGRAPreview.GetCanvasScaleFactor; + DrawCheckers(Bitmap, r, checkerScale); Bitmap.StretchPutImage(r, picture, dmDrawWithTransparency); end; if mustFreePic then picture.Free; diff --git a/lazpaint/uimagepreview.pas b/lazpaint/uimagepreview.pas index d9eed1b3..bf88594d 100644 --- a/lazpaint/uimagepreview.pas +++ b/lazpaint/uimagepreview.pas @@ -110,7 +110,7 @@ TImagePreview = class implementation uses FPimage, BGRAReadJpeg, BGRAOpenRaster, BGRAPaintNet, BGRAReadLzp, Dialogs, UNewimage, - LCLType, BGRAPhoxo, BGRASVG, math, URaw, UImage; + LCLType, BGRAPhoxo, BGRASVG, math, URaw, UImage, LCScaleDPI; { TImagePreview } @@ -336,7 +336,7 @@ procedure TImagePreview.DrawCurrentFrame(Bitmap: TBGRABitmap); bitmap.FillRect(rect(x+w,y+ofs,x+ofs+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency); bitmap.FillRect(rect(x+ofs,y+h,x+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency); - DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, FScaling); + DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, DoScaleX(round(60*FScaling), OriginalDPI)/60); bitmap.StretchPutImage(rect(x,y,x+w,y+h), frame, dmDrawWithTransparency) end; diff --git a/lazpaint/uimageview.pas b/lazpaint/uimageview.pas index e0b43331..0d513722 100644 --- a/lazpaint/uimageview.pas +++ b/lazpaint/uimageview.pas @@ -467,7 +467,7 @@ procedure TImageView.PaintPictureImplementation(AWorkArea: TRect; AInvalidatedPa OffsetRect(renderRect, -FLastPictureParameters.scaledVirtualScreenArea.Left, -FLastPictureParameters.scaledVirtualScreenArea.Top); - DrawThumbnailCheckers(FVirtualScreen, renderRect, Image.IsIconCursor, CanvasScale); + DrawThumbnailCheckers(FVirtualScreen, renderRect, Image.IsIconCursor, DoScaleX(60*CanvasScale, OriginalDPI)/60); //draw image (with merged selection) FVirtualScreen.StretchPutImage(renderRect,Image.RenderedImage,dmDrawWithTransparency); From 6188f3b70b46773a31088930db0f93c1eb4ea39c Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 14:57:04 +0200 Subject: [PATCH 10/26] canvas scale for checkers and shadow, save option background and shadow --- lazpaint/dialog/usaveoption.pas | 19 ++++++++++++++----- lazpaint/uimagepreview.pas | 6 ++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lazpaint/dialog/usaveoption.pas b/lazpaint/dialog/usaveoption.pas index 063fe608..0969e798 100644 --- a/lazpaint/dialog/usaveoption.pas +++ b/lazpaint/dialog/usaveoption.pas @@ -179,6 +179,8 @@ procedure TFSaveOption.FormCreate(Sender: TObject); FFlattenedOriginal := nil; FSizeCaption:= Label_Size.Caption; LayoutRadioButtonDepth; + BGRAPreview.BitmapAutoScale:= false; + BGRAPreview.Color := clGray; end; procedure TFSaveOption.FormDestroy(Sender: TObject); @@ -277,7 +279,7 @@ procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject; var ratioX,ratioY,ratio, checkerScale: single; picture: TBGRABitmap; mustFreePic: boolean; - x,y,visualWidth,visualHeight: integer; + x,y,visualWidth,visualHeight,ofs: integer; r: TRect; thumb: TBGRABitmap; begin @@ -333,7 +335,17 @@ procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject; if visualHeight < 1 then visualHeight:= 1; x := (Bitmap.Width-visualWidth) div 2; y := (Bitmap.Height-visualHeight) div 2; - r := rect(x,y,x+visualWidth,y+visualHeight); + r := RectWithSize(x, y, visualWidth, visualHeight); + + checkerScale := DoScaleX(60, OriginalDPI)/60; + if not BGRAPreview.BitmapAutoScale then + checkerScale *= BGRAPreview.GetCanvasScaleFactor; + ofs := round(4*checkerScale); + if visualWidth < ofs then ofs := visualWidth; + if visualHeight < ofs then ofs := visualHeight; + bitmap.FillRect(rect(x+visualWidth,y+ofs,x+ofs+visualWidth,y+ofs+visualHeight), BGRA(0,0,0,128),dmDrawWithTransparency); + bitmap.FillRect(rect(x+ofs,y+visualHeight,x+visualWidth,y+ofs+visualHeight), BGRA(0,0,0,128),dmDrawWithTransparency); + if ImageFormat in[ifIco,ifCur] then begin thumb := GetBitmapThumbnail(picture, ImageFormat, visualWidth,visualHeight, BGRAPixelTransparent, true); @@ -341,9 +353,6 @@ procedure TFSaveOption.BGRAPreviewRedraw(Sender: TObject; thumb.Free; end else begin - checkerScale := DoScaleX(60, OriginalDPI)/60; - if not BGRAPreview.BitmapAutoScale then - checkerScale *= BGRAPreview.GetCanvasScaleFactor; DrawCheckers(Bitmap, r, checkerScale); Bitmap.StretchPutImage(r, picture, dmDrawWithTransparency); end; diff --git a/lazpaint/uimagepreview.pas b/lazpaint/uimagepreview.pas index bf88594d..8fd6a2d3 100644 --- a/lazpaint/uimagepreview.pas +++ b/lazpaint/uimagepreview.pas @@ -304,6 +304,7 @@ procedure TImagePreview.SurfaceKeyDown(Sender: TObject; var Key: Word; procedure TImagePreview.DrawCurrentFrame(Bitmap: TBGRABitmap); var x,y,w,h,ofs: integer; frame: TBGRABitmap; + checkerScale: single; begin ClearMenu; frame := GetCurrentFrameBitmap; @@ -330,13 +331,14 @@ procedure TImagePreview.DrawCurrentFrame(Bitmap: TBGRABitmap); end; x := (bitmap.Width-w) div 2; y := (bitmap.Height-h) div 2; - ofs := 4; + checkerScale := DoScaleX(round(60*FScaling), OriginalDPI)/60; + ofs := round(4*checkerScale); if w < ofs then ofs := w; if h < ofs then ofs := h; bitmap.FillRect(rect(x+w,y+ofs,x+ofs+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency); bitmap.FillRect(rect(x+ofs,y+h,x+w,y+ofs+h), BGRA(0,0,0,128),dmDrawWithTransparency); - DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, DoScaleX(round(60*FScaling), OriginalDPI)/60); + DrawThumbnailCheckers(Bitmap, rect(x,y,x+w,y+h), false, checkerScale); bitmap.StretchPutImage(rect(x,y,x+w,y+h), frame, dmDrawWithTransparency) end; From 682eb8bb0924c9b9063db73ada7c89e994ea74b6 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 15:32:00 +0200 Subject: [PATCH 11/26] scale image browser --- lazpaint/dialog/ubrowseimages.lfm | 6 +++--- lazpaint/dialog/ubrowseimages.pas | 10 ++++++++-- lazpaintcontrols/lcscaledpi.pas | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lazpaint/dialog/ubrowseimages.lfm b/lazpaint/dialog/ubrowseimages.lfm index 461a020a..4368afc8 100644 --- a/lazpaint/dialog/ubrowseimages.lfm +++ b/lazpaint/dialog/ubrowseimages.lfm @@ -105,7 +105,7 @@ object FBrowseImages: TFBrowseImages Left = 1 Height = 41 Top = 2 - Width = 281 + Width = 248 Align = alNone ButtonHeight = 40 ButtonWidth = 40 @@ -171,10 +171,10 @@ object FBrowseImages: TFBrowseImages TabOrder = 1 end object DirectoryEdit1: TEdit - Left = 280 + Left = 250 Height = 34 Top = 6 - Width = 280 + Width = 310 Anchors = [akTop, akLeft, akRight] OnChange = DirectoryEdit1Change ParentFont = False diff --git a/lazpaint/dialog/ubrowseimages.pas b/lazpaint/dialog/ubrowseimages.pas index 4642ed5b..140693a8 100644 --- a/lazpaint/dialog/ubrowseimages.pas +++ b/lazpaint/dialog/ubrowseimages.pas @@ -15,7 +15,7 @@ interface { TFBrowseImages } - TFBrowseImages = class(TForm) + TFBrowseImages = class(TForm) ComboBox_FileExtension: TBCComboBox; CheckBox_UseDirectoryOnStartup: TCheckBox; DirectoryEdit1: TEdit; @@ -174,7 +174,7 @@ implementation UConfig, bgrareadjpeg, FPReadJPEG, UFileExtensions, BGRAUTF8, LazFileUtils, UGraph, URaw, UDarkTheme, ShellCtrls, - UIconCache; + UIconCache, LCScaleDPI; { TFBrowseImages } @@ -268,6 +268,12 @@ procedure TFBrowseImages.FormCreate(Sender: TObject); FPreview.OnValidate:= @PreviewValidate; FChosenImage := TImageEntry.Empty; + ScaleImageList(ImageListToolbar, DoScaleX(32, OriginalDPI), + DoScaleY(32, OriginalDPI), ImageListToolbar); + + ScaleControl(Panel1, OriginalDPI); + ScaleControl(Panel2, OriginalDPI); + DarkThemeInstance.Apply(ComboBox_FileExtension, False, 0.40); vsList.BitmapAutoScale:= false; diff --git a/lazpaintcontrols/lcscaledpi.pas b/lazpaintcontrols/lcscaledpi.pas index 722f6237..26ae4e50 100644 --- a/lazpaintcontrols/lcscaledpi.pas +++ b/lazpaintcontrols/lcscaledpi.pas @@ -36,6 +36,9 @@ procedure ScaleImageList(SourceList: TImageList; newWidth, newHeight: Integer; T i: Integer; begin + if (TargetList = SourceList) and (newWidth = SourceList.Width) and + (newHeight = SourceList.Height) then exit; + setlength(TempBGRA, SourceList.Count); TempBmp := TBitmap.Create; for i := 0 to SourceList.Count-1 do From add8d84836c48ab450bd22e8b596dee7269a33ab Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 16:34:53 +0200 Subject: [PATCH 12/26] retina scale volatile scrollbar --- lazpaint/dialog/ulayerstackinterface.pas | 1 + lazpaint/lazpaintinstance.pas | 2 -- lazpaint/uimagepreview.pas | 1 + lazpaint/umyslv.pas | 16 ++++++++-------- lazpaint/upalettetoolbar.pas | 19 +++++++++++++++---- lazpaint/uvolatilescrollbar.pas | 21 +++++++++++++-------- 6 files changed, 38 insertions(+), 22 deletions(-) diff --git a/lazpaint/dialog/ulayerstackinterface.pas b/lazpaint/dialog/ulayerstackinterface.pas index 31e9dcb1..40ab1b2d 100644 --- a/lazpaint/dialog/ulayerstackinterface.pas +++ b/lazpaint/dialog/ulayerstackinterface.pas @@ -166,6 +166,7 @@ procedure TLayerStackInterface.Toolbar_Resize(Sender: TObject); procedure TLayerStackInterface.BGRALayerStack_Redraw(Sender: TObject; Bitmap: TBGRABitmap); begin + TVolatileScrollBar.InitDPI((Sender as TControl).GetCanvasScaleFactor); DrawLayerStack(Bitmap, not FPartialRedraw, -1); end; diff --git a/lazpaint/lazpaintinstance.pas b/lazpaint/lazpaintinstance.pas index 176b8720..a74fdb09 100644 --- a/lazpaint/lazpaintinstance.pas +++ b/lazpaint/lazpaintinstance.pas @@ -430,8 +430,6 @@ function TLazPaintInstance.ScriptFileGetTemporaryName(AVars: TVariableSet): TScr procedure TLazPaintInstance.Init(AEmbedded: boolean); begin - TVolatileScrollBar.InitDPI; - Title := 'LazPaint ' + LazPaintCurrentVersion; FCustomImageList := TImageListList.Create; FTopMostInfo.choosecolorHidden := 0; diff --git a/lazpaint/uimagepreview.pas b/lazpaint/uimagepreview.pas index 8fd6a2d3..96f10bed 100644 --- a/lazpaint/uimagepreview.pas +++ b/lazpaint/uimagepreview.pas @@ -140,6 +140,7 @@ procedure TImagePreview.SetFilename(AValue: string); procedure TImagePreview.SurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap); begin FScaling := FSurface.GetCanvasScaleFactor; + TVolatileScrollBar.InitDPI(FScaling); FSurfaceScaledHeight := Bitmap.Height; if (Bitmap.Width = 0) or (Bitmap.Height = 0) then begin diff --git a/lazpaint/umyslv.pas b/lazpaint/umyslv.pas index 97c1b958..40aa4242 100644 --- a/lazpaint/umyslv.pas +++ b/lazpaint/umyslv.pas @@ -539,15 +539,9 @@ procedure TLCShellListView.Redraw(Sender: TObject; ABitmap: TBGRABitmap); FVScrollBar := TVolatileScrollBar.Create(w-VolatileScrollBarSize,textHeight, VolatileScrollBarSize,h-textHeight,sbVertical,FVerticalScrollPos,0,maxScroll); end; - if Assigned(FVScrollBar) then - begin - FVScrollBar.Draw(ABitmap); - clientArea := rect(0,textHeight,w-VolatileScrollBarSize,h); - end else - begin - clientArea := rect(0,textHeight,w,h); + if not Assigned(FVScrollBar) then FVerticalScrollPos:= 0; - end; + clientArea := rect(0,textHeight,w,h); FItemsPerPage:= Size(clientArea).cy div FActualRowHeight; setlength(colPos,ColumnCount+1); @@ -603,6 +597,10 @@ procedure TLCShellListView.Redraw(Sender: TObject; ABitmap: TBGRABitmap); inc(curY, FActualRowHeight); inc(row); end; + ABitmap.NoClip; + + if Assigned(FVScrollBar) then + FVScrollBar.Draw(ABitmap); end; procedure DrawIcons; @@ -692,6 +690,8 @@ procedure TLCShellListView.Redraw(Sender: TObject; ABitmap: TBGRABitmap); var i: integer; begin + TVolatileScrollBar.InitDPI((Sender as TControl).GetCanvasScaleFactor); + if SelectedIndex = -1 then FKeySelectionRangeStart := -1 else if FKeySelectionRangeStart = -1 then FKeySelectionRangeStart:= SelectedIndex; for i := 0 to ColumnCount-1 do diff --git a/lazpaint/upalettetoolbar.pas b/lazpaint/upalettetoolbar.pas index 8c562120..5106d958 100644 --- a/lazpaint/upalettetoolbar.pas +++ b/lazpaint/upalettetoolbar.pas @@ -45,6 +45,7 @@ TPaletteToolbar = class FLazPaintInstance: TLazPaintCustomInstance; FOnVisibilityChangedByUser: TPaletteVisibilityChangedByUserHandler; FPanelPalette: TBGRAVirtualScreen; + FCanvasScale: single; FVisible: boolean; FScrollbar: TVolatileScrollBar; FScrollPos: integer; @@ -132,6 +133,8 @@ function TPaletteToolbar.GetWidth: integer; procedure TPaletteToolbar.PanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin + X := round(X*FCanvasScale); + Y := round(Y*FCanvasScale); if (Button = mbLeft) and Assigned(FScrollbar) then begin if FScrollbar.MouseDown(X,Y) then @@ -147,6 +150,8 @@ procedure TPaletteToolbar.PanelMouseDown(Sender: TObject; Button: TMouseButton; procedure TPaletteToolbar.PanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin + X := round(X*FCanvasScale); + Y := round(Y*FCanvasScale); if Assigned(FScrollbar) then begin if FScrollbar.MouseMove(X,Y) then @@ -166,6 +171,8 @@ procedure TPaletteToolbar.PanelMouseMove(Sender: TObject; Shift: TShiftState; procedure TPaletteToolbar.PanelMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin + X := round(X*FCanvasScale); + Y := round(Y*FCanvasScale); if (Button = mbLeft) and Assigned(FScrollbar) then begin if FScrollbar.MouseUp(X,Y) then @@ -481,6 +488,7 @@ function TPaletteToolbar.GetPanelPalette: TBGRAVirtualScreen; FPanelPalette.OnMouseDown:=@PanelMouseDown; FPanelPalette.OnMouseUp:=@PanelMouseUp; FPanelPalette.OnMouseMove:=@PanelMouseMove; + FPanelPalette.BitmapAutoScale:= false; ApplyTheme; FPanelPalette.Caption := ''; FColors := TBGRAPalette.Create; @@ -730,6 +738,9 @@ procedure TPaletteToolbar.RepaintPalette(Sender: TObject; Bitmap: TBGRABitmap); nbVisible, maxScroll, availHeight: integer; clInterm, cSign: TBGRAPixel; begin + FCanvasScale := (Sender as TControl).GetCanvasScaleFactor; + TVolatileScrollBar.InitDPI(FCanvasScale); + if DarkTheme then begin clInterm := MergeBGRA(ColorToBGRA(clDarkBtnFace),ColorToBGRA(clLightText)); @@ -739,11 +750,11 @@ procedure TPaletteToolbar.RepaintPalette(Sender: TObject; Bitmap: TBGRABitmap); else clInterm := MergeBGRA(ColorToBGRA(ColorToRGB(clBtnFace)),ColorToBGRA(ColorToRGB(clBtnText))); - x := 2; - y := FMenuButton.Top+FMenuButton.Height+1; + x := round(2*FCanvasScale); + y := round((FMenuButton.Top+FMenuButton.Height+1)*FCanvasScale); w := Bitmap.Width-(VolatileScrollBarSize+1)-x; - aw := DoScaleX(FPaletteAlphaWidth, OriginalDPI); - h := DoScaleY(FPaletteItemHeight, OriginalDPI); + aw := DoScaleX(round(FPaletteAlphaWidth*FCanvasScale), OriginalDPI); + h := DoScaleY(round(FPaletteItemHeight*FCanvasScale), OriginalDPI); if h < 3 then h := 3; availHeight := Bitmap.Height - 2 - y - 1; nbVisible := availHeight div (h-1); diff --git a/lazpaint/uvolatilescrollbar.pas b/lazpaint/uvolatilescrollbar.pas index 7a2a5bac..edf7f9db 100644 --- a/lazpaint/uvolatilescrollbar.pas +++ b/lazpaint/uvolatilescrollbar.pas @@ -8,10 +8,15 @@ interface uses Classes, SysUtils, Forms, BGRABitmap, BGRAGradients; +const + OrigVolatileScrollBarSize = 14; + OrigVolatileThumbSize = 24; + OrigVolatileBorderSize = 3; + var - VolatileScrollBarSize : integer = 14; - VolatileThumbSize : integer = 24; - VolatileBorderSize : integer = 3; + VolatileScrollBarSize : integer = OrigVolatileScrollBarSize; + VolatileThumbSize : integer = OrigVolatileThumbSize; + VolatileBorderSize : integer = OrigVolatileBorderSize; type TScrollBarKind = Forms.TScrollBarKind; @@ -42,7 +47,7 @@ TVolatileScrollBar = class public constructor Create(X,Y,AWidth,AHeight: integer; ADirection: TScrollBarKind; APosition, AMinimum, AMaximum: integer); destructor Destroy; override; - class procedure InitDPI; + class procedure InitDPI(ACanvasScaleFactor: single); function MouseDown(X,Y: integer): boolean; function MouseMove(X,Y: integer): boolean; function MouseUp({%H-}X,{%H-}Y: integer): boolean; @@ -208,13 +213,13 @@ procedure TVolatileScrollBar.Draw(ADest: TBGRABitmap); FPhong.DrawRectangle(ADest,lThumb,VolatileBorderSize,h,ColorToBGRA(ColorToRGB(clBtnFace)),true,[]); end; -class procedure TVolatileScrollBar.InitDPI; +class procedure TVolatileScrollBar.InitDPI(ACanvasScaleFactor: single); begin if not FInitDPI then begin - VolatileScrollBarSize := ScaleX(VolatileScrollBarSize, OriginalDPI); - VolatileThumbSize := ScaleX(VolatileThumbSize, OriginalDPI); - VolatileBorderSize := ScaleX(VolatileBorderSize, OriginalDPI); + VolatileScrollBarSize := ScaleX(round(VolatileScrollBarSize * ACanvasScaleFactor), OriginalDPI); + VolatileThumbSize := ScaleX(round(VolatileThumbSize * ACanvasScaleFactor), OriginalDPI); + VolatileBorderSize := ScaleX(round(VolatileBorderSize * ACanvasScaleFactor), OriginalDPI); FInitDPI := true; end; end; From 9a51ebd08328351eb05a3237eca03519ae64b2cc Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 16:38:22 +0200 Subject: [PATCH 13/26] unused units --- lazpaint/lazpaintinstance.pas | 2 +- lazpaint/lazpaintmainform.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lazpaint/lazpaintinstance.pas b/lazpaint/lazpaintinstance.pas index a74fdb09..c06d1f7c 100644 --- a/lazpaint/lazpaintinstance.pas +++ b/lazpaint/lazpaintinstance.pas @@ -277,7 +277,7 @@ implementation USharpen, uposterize, UPhongFilter, UFilterFunction, uprint, USaveOption, UFormRain, - ugraph, LCScaleDPI, ucommandline, uabout, UPython, UVolatileScrollBar; + ugraph, LCScaleDPI, ucommandline, uabout, UPython; { TLazPaintInstance } diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas index 66a6340b..13a8b73c 100644 --- a/lazpaint/lazpaintmainform.pas +++ b/lazpaint/lazpaintmainform.pas @@ -12,7 +12,7 @@ interface BGRABitmap, BGRABitmapTypes, BGRALayers, BGRASVGOriginal, BGRAGradientScanner, BGRAGradientOriginal, - LazPaintType, UMainFormLayout, UTool, UImage, UImageAction, UZoom, UImageView, + LazPaintType, UMainFormLayout, UTool, UImage, UImageAction, UZoom, UImageObservation, UConfig, LCScaleDPI, UResourceStrings, UMenu, uscripting, ubrowseimages, UToolPolygon, UToolVectorial, LCVectorRectShapes, LCVectorialFillControl, LCVectorialFill, From 8afde223e8a6f5d8c52f0db54d6466a94c143e81 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Wed, 14 Oct 2020 16:47:49 +0200 Subject: [PATCH 14/26] draw icons behind volatile scrollbar --- lazpaint/umyslv.pas | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lazpaint/umyslv.pas b/lazpaint/umyslv.pas index 40aa4242..fb636764 100644 --- a/lazpaint/umyslv.pas +++ b/lazpaint/umyslv.pas @@ -630,15 +630,9 @@ procedure TLCShellListView.Redraw(Sender: TObject; ABitmap: TBGRABitmap); FVScrollBar := TVolatileScrollBar.Create(w-VolatileScrollBarSize,0, VolatileScrollBarSize,h,sbVertical,FVerticalScrollPos,0,maxScroll); end; - if Assigned(FVScrollBar) then - begin - FVScrollBar.Draw(ABitmap); - clientArea := rect(0,0,w-VolatileScrollBarSize,h); - end else - begin - clientArea := rect(0,0,w,h); + if not Assigned(FVScrollBar) then FVerticalScrollPos := 0; - end; + clientArea := rect(0,0,w,h); FItemsPerPage:= (Size(clientArea).cy div totalIconVSize)*FIconsPerLine; for item := 0 to ItemCount-1 do SetDisplayRect(item,EmptyRect); item := (FVerticalScrollPos div (32*FIconsPerLine))*FIconsPerLine; @@ -685,6 +679,8 @@ procedure TLCShellListView.Redraw(Sender: TObject; ABitmap: TBGRABitmap); end; inc(item); end; + if Assigned(FVScrollBar) then + FVScrollBar.Draw(ABitmap); end; var i: integer; From 1eae39367b08ca2e8669ae3db3a355daa27c97c7 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sat, 17 Oct 2020 17:43:32 +0200 Subject: [PATCH 15/26] tab stop on file extension combobox --- lazpaint/dialog/ubrowseimages.pas | 1 + lazpaint/udarktheme.pas | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lazpaint/dialog/ubrowseimages.pas b/lazpaint/dialog/ubrowseimages.pas index 140693a8..cd888df2 100644 --- a/lazpaint/dialog/ubrowseimages.pas +++ b/lazpaint/dialog/ubrowseimages.pas @@ -323,6 +323,7 @@ procedure TFBrowseImages.FormCreate(Sender: TObject); FCreateFolderOrContainerCaption := ToolButton_CreateFolderOrContainer.Hint; ToolButton_CreateFolderOrContainer.Hint := ToolButton_CreateFolderOrContainer.Hint + '...'; + ComboBox_FileExtension.TabStop := true; end; procedure TFBrowseImages.FormDestroy(Sender: TObject); diff --git a/lazpaint/udarktheme.pas b/lazpaint/udarktheme.pas index 183f346f..014bc545 100644 --- a/lazpaint/udarktheme.pas +++ b/lazpaint/udarktheme.pas @@ -400,6 +400,7 @@ procedure TDarkTheme.Apply(ACombo: TBCComboBox; ADarkTheme: boolean; Apply(ACombo.Button, ADarkTheme, AFontHeightRatio); with ACombo do begin + FocusBorderOpacity:= 128; fh := round((Height+4)*AFontHeightRatio); Button.StateNormal.FontEx.Height := fh; Button.StateNormal.FontEx.ShadowColorOpacity:= 96; @@ -412,11 +413,13 @@ procedure TDarkTheme.Apply(ACombo: TBCComboBox; ADarkTheme: boolean; DropDownBorderColor:= clBlack; DropDownFontColor:= clLightText; DropDownColor:= clDarkBtnFace; + FocusBorderColor:= clLightText; end else begin DropDownBorderColor := MergeBGRA(ColorToBGRA(clWindowText),ColorToBGRA(clWindow)); DropDownFontColor:= clWindowText; DropDownColor:= clWindow; + FocusBorderColor:= clWindowText; end; DropDownFontHighlight:= clHighlightText; DropDownHighlight:= clHighlight; From 0109c448b08387763e61762eb66ba85221829675 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 14:59:35 +0200 Subject: [PATCH 16/26] scaling icons on MacOS Retina --- lazpaint/lazpaintinstance.pas | 76 +++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/lazpaint/lazpaintinstance.pas b/lazpaint/lazpaintinstance.pas index c06d1f7c..b04f1b0e 100644 --- a/lazpaint/lazpaintinstance.pas +++ b/lazpaint/lazpaintinstance.pas @@ -277,7 +277,7 @@ implementation USharpen, uposterize, UPhongFilter, UFilterFunction, uprint, USaveOption, UFormRain, - ugraph, LCScaleDPI, ucommandline, uabout, UPython; + ugraph, LCScaleDPI, ucommandline, uabout, UPython, BGRAGraphics; { TLazPaintInstance } @@ -1250,37 +1250,87 @@ procedure TLazPaintInstance.ToolFillChanged(Sender: TObject); end; function TLazPaintInstance.GetIcons(ASize: integer): TImageList; -var - i: Integer; -begin - if Assigned(FMain) then - begin - for i := 0 to FCustomImageList.Count-1 do - if FCustomImageList[i].Height = ASize then - exit(FCustomImageList[i]); + function GetUnscaledIcons(ASize: integer): TImageList; + begin if ASize < 24 then begin; if ASize = 16 then - result := FMain.ImageList16 + begin + result := TImageList.Create(nil); + result.Assign(FMain.ImageList16); + end else begin result := TImageList.Create(nil); ScaleImageList(FMain.ImageList16, ASize,ASize, result); - FCustomImageList.Add(result); end; end else begin if ASize = 48 then - result := FMain.ImageList48 + begin + result := TImageList.Create(nil); + result.Assign(FMain.ImageList48); + end else begin result := TImageList.Create(nil); ScaleImageList(FMain.ImageList48, ASize,ASize, result); - FCustomImageList.Add(result); end; end; + end; + +var + i: Integer; + {$IFDEF DARWIN} + retina, unscaled: TImageList; + bmpUnscaled, bmpRetina: TBitmap; + {$ENDIF} + +begin + if Assigned(FMain) then + begin + for i := 0 to FCustomImageList.Count-1 do + if FCustomImageList[i].Height = ASize then + exit(FCustomImageList[i]); + + {$IFDEF DARWIN} + unscaled := GetUnscaledIcons(ASize); + retina := GetUnscaledIcons(ASize*2); + bmpUnscaled := TBitmap.Create; + bmpRetina := TBitmap.Create; + + result := TImageList.Create(nil); + result.Width := ASize; + result.Height := ASize; + result.Scaled := true; + result.RegisterResolutions([ASize, ASize*2]); + for i := 0 to unscaled.Count-1 do + begin + unscaled.GetBitmap(i, bmpUnscaled); + retina.GetBitmap(i, bmpRetina); + result.AddMultipleResolutions([bmpUnscaled, bmpRetina]); + end; + + bmpUnscaled.Free; + bmpRetina.Free; + unscaled.Free; + retina.Free; + {$ELSE} + if ASize = 16 then + begin + result := FMain.ImageList16; + exit + end else + if ASize = 48 then + begin + result := FMain.ImageList48; + exit; + end else + result := GetUnscaledIcons(ASize); + {$ENDIF} + FCustomImageList.Add(result); end else result := nil; end; From 9e176f13f51e675149462f21c75f974e2195e878 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 15:06:13 +0200 Subject: [PATCH 17/26] retina scaling of toolbar dropdown --- lazpaint/lazpaintmainform.pas | 2 +- lazpaint/maintoolbar.inc | 4 ++++ lazpaint/ugraph.pas | 14 +++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas index 13a8b73c..37095da4 100644 --- a/lazpaint/lazpaintmainform.pas +++ b/lazpaint/lazpaintmainform.pas @@ -862,7 +862,7 @@ implementation ufilters, ULoadImage, ULoading, UFileExtensions, UBrushType, ugeometricbrush, UPreviewDialog, UQuestion, BGRALayerOriginal, BGRATransform, LCVectorPolyShapes, URaw, UFileSystem, - UTranslation, UPython; + UTranslation, UPython, BCTypes; const PenWidthFactor = 10; diff --git a/lazpaint/maintoolbar.inc b/lazpaint/maintoolbar.inc index de7443fc..7b9c3ff1 100644 --- a/lazpaint/maintoolbar.inc +++ b/lazpaint/maintoolbar.inc @@ -65,15 +65,18 @@ begin ComboBox_ArrowStart.OnChange := @ComboBox_ArrowStartChange; ComboBox_ArrowStart.OnDrawItem := @ComboBox_ArrowStartDrawItem; ComboBox_ArrowStart.OnDrawSelectedItem := @ComboBox_ArrowStartDrawSelectedItem; + ComboBox_ArrowStart.CanvasScaleMode:= csmFullResolution; ComboBox_ArrowEnd.OnChange := @ComboBox_ArrowEndChange; ComboBox_ArrowEnd.OnDrawItem := @ComboBox_ArrowEndDrawItem; ComboBox_ArrowEnd.OnDrawSelectedItem := @ComboBox_ArrowEndDrawSelectedItem; + ComboBox_ArrowEnd.CanvasScaleMode:= csmFullResolution; Tool_JoinBevel.OnClick := @Tool_JoinBevelClick; Tool_JoinRound.OnClick := @Tool_JoinRoundClick; Tool_JoinMiter.OnClick := @Tool_JoinMiterClick; ComboBox_PenStyle.OnChange:=@ComboBox_PenStyleChange; ComboBox_PenStyle.OnDrawItem:=@ComboBox_PenStyleDrawItem; ComboBox_PenStyle.OnDrawSelectedItem:=@ComboBox_PenStyleDrawSelectedItem; + ComboBox_PenStyle.CanvasScaleMode:= csmFullResolution; for ps := psSolid to psDashDotDot do ComboBox_PenStyle.Items.Add(inttostr(ord(ps))); Tool_GridMoveWithoutDeformation.OnClick := @Tool_GridMoveWithoutDeformationClick; Combo_SplineStyle.Items.Add('Inside'); @@ -115,6 +118,7 @@ begin ComboBox_BrushSelect.OnChange := @ComboBox_BrushSelectChange; ComboBox_BrushSelect.OnDrawItem := @ComboBox_BrushSelectDrawItem; ComboBox_BrushSelect.OnDrawSelectedItem:= @ComboBox_BrushSelectDrawSelectedItem; + ComboBox_BrushSelect.CanvasScaleMode:= csmFullResolution; Combo_Ratio.OnChange := @Combo_RatioChange; Panel_LineCap_FullSize := Panel_LineCap.Width; diff --git a/lazpaint/ugraph.pas b/lazpaint/ugraph.pas index bb48aca8..31befb33 100644 --- a/lazpaint/ugraph.pas +++ b/lazpaint/ugraph.pas @@ -792,6 +792,7 @@ procedure DrawPenStyle(AComboBox: TBCComboBox; ARect: TRect; APenStyle: TPenStyle; State: TOwnerDrawState); var bmp : TBGRABitmap; c,c2: TBGRAPixel; + scale: Double; begin if odSelected in State then begin @@ -803,9 +804,10 @@ procedure DrawPenStyle(AComboBox: TBCComboBox; ARect: TRect; c := ColorToBGRA(AComboBox.DropDownFontColor); c2 := ColorToBGRA(AComboBox.DropDownColor); end; - with Size(ARect) do bmp := TBGRABitmap.Create(cx,cy,c2); - DrawPenStyle(bmp, rect(0,0,ARect.Width,ARect.Height),APenStyle, c); - bmp.Draw(ACombobox.Canvas,ARect.Left,ARect.Top,true); + scale := AComboBox.GetCanvasScaleFactor; + with Size(ARect) do bmp := TBGRABitmap.Create(round(cx*scale),round(cy*scale),c2); + DrawPenStyle(bmp, bmp.ClipRect,APenStyle, c); + bmp.Draw(ACombobox.Canvas,ARect,true); bmp.Free; end; @@ -821,6 +823,7 @@ procedure DrawPenStyle(ABitmap: TBGRABitmap; ARect: TRect; procedure DrawArrow(AComboBox: TBCComboBox; ARect: TRect; AStart: boolean; AKindStr: string; ALineCap: TPenEndCap; State: TOwnerDrawState); var mask, bmp : TBGRABitmap; c,c2: TBGRAPixel; + scale: Double; begin if odSelected in State then begin @@ -831,11 +834,12 @@ procedure DrawArrow(AComboBox: TBCComboBox; ARect: TRect; AStart: boolean; AKind c2 := ColorToBGRA(AComboBox.DropDownColor); c := ColorToBGRA(AComboBox.DropDownFontColor); end; - with Size(ARect) do mask:= TBGRABitmap.Create(cx,cy,BGRABlack); + scale := AComboBox.GetCanvasScaleFactor; + with Size(ARect) do mask:= TBGRABitmap.Create(round(cx*scale),round(cy*scale),BGRABlack); DrawArrowMask(mask, AStart, AKindStr, ALineCap); bmp := TBGRABitmap.Create(mask.Width,mask.Height,c2); bmp.FillMask(0,0,mask,c,dmDrawWithTransparency); - bmp.Draw(ACombobox.Canvas,ARect.Left,ARect.Top,true); + bmp.Draw(ACombobox.Canvas,ARect,true); bmp.Free; mask.Free; end; From c84f3da2154e026fa05336879122f3ecd3d60644 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 15:47:22 +0200 Subject: [PATCH 18/26] dpi scale toolbar optional --- lazpaint/dialog/ubrowseimages.pas | 4 ++-- lazpaintcontrols/lcscaledpi.pas | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lazpaint/dialog/ubrowseimages.pas b/lazpaint/dialog/ubrowseimages.pas index cd888df2..45fb56d6 100644 --- a/lazpaint/dialog/ubrowseimages.pas +++ b/lazpaint/dialog/ubrowseimages.pas @@ -271,8 +271,8 @@ procedure TFBrowseImages.FormCreate(Sender: TObject); ScaleImageList(ImageListToolbar, DoScaleX(32, OriginalDPI), DoScaleY(32, OriginalDPI), ImageListToolbar); - ScaleControl(Panel1, OriginalDPI); - ScaleControl(Panel2, OriginalDPI); + ScaleControl(Panel1, OriginalDPI, 0,0, true); + ScaleControl(Panel2, OriginalDPI, 0,0, true); DarkThemeInstance.Apply(ComboBox_FileExtension, False, 0.40); vsList.BitmapAutoScale:= false; diff --git a/lazpaintcontrols/lcscaledpi.pas b/lazpaintcontrols/lcscaledpi.pas index 26ae4e50..5e4071a4 100644 --- a/lazpaintcontrols/lcscaledpi.pas +++ b/lazpaintcontrols/lcscaledpi.pas @@ -9,7 +9,8 @@ interface Forms, Graphics, Controls, ComCtrls; procedure ScaleForms(FromDPI: Integer); -procedure ScaleControl(Control: TControl; FromDPI: Integer; ToDPI_X: Integer = 0; ToDPI_Y: Integer = 0); +procedure ScaleControl(Control: TControl; FromDPI: Integer; + ToDPI_X: Integer = 0; ToDPI_Y: Integer = 0; ScaleToolbar: boolean = false); procedure ScaleImageList(SourceList: TImageList; newWidth, newHeight: Integer; TargetList: TImageList); function DoScaleX(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer; function DoScaleY(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer; @@ -104,7 +105,8 @@ function DoScaleYF(Size: single; FromDPI: Integer; ToDPI: Integer): single; Result := Size * ToDPI / FromDPI; end; -procedure ScaleControl(Control: TControl; FromDPI: Integer; ToDPI_X: Integer; ToDPI_Y: integer); +procedure ScaleControl(Control: TControl; FromDPI: Integer; ToDPI_X: Integer; ToDPI_Y: integer; + ScaleToolbar: boolean = false); var n: Integer; WinControl: TWinControl; @@ -129,11 +131,13 @@ procedure ScaleControl(Control: TControl; FromDPI: Integer; ToDPI_X: Integer; To end; if Control is TToolBar then begin + if not ScaleToolbar then exit; ToolBarControl:=TToolBar(Control); with ToolBarControl do begin ButtonWidth:=DoScaleX(ButtonWidth,FromDPI,ToDPI_X); ButtonHeight:=DoScaleY(ButtonHeight,FromDPI,ToDPI_Y); end; + exit; end; if Control is TWinControl then begin From 686914004e4b75ed409ed1f7507cba16a3175a67 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 15:49:49 +0200 Subject: [PATCH 19/26] recursive scale parameter --- lazpaintcontrols/lcscaledpi.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lazpaintcontrols/lcscaledpi.pas b/lazpaintcontrols/lcscaledpi.pas index 5e4071a4..8de1cb29 100644 --- a/lazpaintcontrols/lcscaledpi.pas +++ b/lazpaintcontrols/lcscaledpi.pas @@ -152,7 +152,8 @@ procedure ScaleControl(Control: TControl; FromDPI: Integer; ToDPI_X: Integer; To if WinControl.ControlCount > 0 then begin for n:=0 to WinControl.ControlCount-1 do begin if WinControl.Controls[n] is TControl then begin - ScaleControl(WinControl.Controls[n],FromDPI,ToDPI_X,ToDPI_Y); + ScaleControl(WinControl.Controls[n],FromDPI,ToDPI_X,ToDPI_Y, + ScaleToolbar); end; end; end; From 10eb018c4e64ccd7e761e1be3f64fc3558bc6c80 Mon Sep 17 00:00:00 2001 From: lainz Date: Sun, 18 Oct 2020 12:54:16 -0300 Subject: [PATCH 20/26] Added proportional and stretch to color switch image --- lazpaint/lazpaintmainform.lfm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lazpaint/lazpaintmainform.lfm b/lazpaint/lazpaintmainform.lfm index 6eba51bc..ee77b453 100644 --- a/lazpaint/lazpaintmainform.lfm +++ b/lazpaint/lazpaintmainform.lfm @@ -3056,6 +3056,8 @@ object FMain: TFMain 93794A89288EE7EDFD7151874569D446E3CAD0C6C25555FF01E3A570E78DDA12 390000000049454E44AE426082 } + Proportional = True + Stretch = True end end object Panel_BackFill: TPanel From eb55d34624efc3ea4fc8cd9135e6b84afaa2bd96 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 18:15:11 +0200 Subject: [PATCH 21/26] using latest BGRABitmap 11.2.5 --- lazpaint/lazpaint.lpi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lazpaint/lazpaint.lpi b/lazpaint/lazpaint.lpi index 51be4970..521471e6 100644 --- a/lazpaint/lazpaint.lpi +++ b/lazpaint/lazpaint.lpi @@ -334,7 +334,7 @@ - + From 3c85663af1cae0ee66bb41c2413ef7a53a9ba86f Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 20:13:37 +0200 Subject: [PATCH 22/26] need latest BGRAControls 7.0 --- lazpaint/lazpaint.lpi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lazpaint/lazpaint.lpi b/lazpaint/lazpaint.lpi index 521471e6..65c6fd6d 100644 --- a/lazpaint/lazpaint.lpi +++ b/lazpaint/lazpaint.lpi @@ -338,7 +338,7 @@ - + From 24adabad251a931f7ef532909ced18da3d827ca9 Mon Sep 17 00:00:00 2001 From: Johann Date: Sun, 18 Oct 2020 21:20:06 +0200 Subject: [PATCH 23/26] add button to clear ratio, move rotate button --- lazpaint/dialog/unewimage.lfm | 218 +++++++--------------------------- lazpaint/dialog/unewimage.pas | 13 ++ 2 files changed, 59 insertions(+), 172 deletions(-) diff --git a/lazpaint/dialog/unewimage.lfm b/lazpaint/dialog/unewimage.lfm index d9aa281b..f58e965d 100644 --- a/lazpaint/dialog/unewimage.lfm +++ b/lazpaint/dialog/unewimage.lfm @@ -12,7 +12,7 @@ object FNewImage: TFNewImage OnCreate = FormCreate OnShow = FormShow Position = poOwnerFormCenter - LCLVersion = '1.8.2.0' + LCLVersion = '2.0.10.0' object Label_Width: TLabel Left = 16 Height = 15 @@ -37,7 +37,7 @@ object FNewImage: TFNewImage Caption = 'OK' Default = True OnClick = Button_OKClick - TabOrder = 6 + TabOrder = 5 end object Button_Cancel: TButton Left = 152 @@ -47,7 +47,7 @@ object FNewImage: TFNewImage Cancel = True Caption = 'Cancel' ModalResult = 2 - TabOrder = 7 + TabOrder = 6 end object SpinEdit_Width: TSpinEdit Left = 80 @@ -80,24 +80,29 @@ object FNewImage: TFNewImage Width = 134 OnRedraw = vsPreviewRedraw Alignment = taLeftJustify + ClientHeight = 128 + ClientWidth = 134 Color = clForm ParentColor = False TabOrder = 4 - end - object ToolBar_Rotate: TToolBar - Left = 104 - Height = 24 - Top = 73 - Width = 24 - Align = alNone - EdgeBorders = [] - Images = FMain.ImageList16 - TabOrder = 5 - object ToolButton_Rotate: TToolButton - Left = 1 - Top = 0 - ImageIndex = 43 - OnClick = ToolButton_RotateClick + object ToolBar_Rotate: TToolBar + Left = 51 + Height = 22 + Top = 49 + Width = 24 + Align = alNone + AutoSize = True + Color = clForm + EdgeBorders = [] + Images = FMain.ImageList16 + ParentColor = False + TabOrder = 0 + object ToolButton_Rotate: TToolButton + Left = 1 + Top = 0 + ImageIndex = 43 + OnClick = ToolButton_RotateClick + end end end object Label_Height1: TLabel @@ -112,7 +117,7 @@ object FNewImage: TFNewImage Left = 80 Height = 23 Top = 103 - Width = 79 + Width = 63 ItemHeight = 15 Items.Strings = ( '' @@ -121,11 +126,11 @@ object FNewImage: TFNewImage '5:4' '4:3' '11:8' - '1.4142:1' + '1.414:1' '1.43:1' '3:2' '8:5' - '1.6180:1' + '1.618:1' '5:3' '16:9' '2:1' @@ -146,31 +151,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clBlack FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape1' RoundRadius = 5 OnClick = BGRAShapeClick @@ -185,31 +175,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clBlue FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape2' RoundRadius = 5 OnClick = BGRAShapeClick @@ -224,31 +199,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clRed FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape3' RoundRadius = 5 OnClick = BGRAShapeClick @@ -263,31 +223,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clLime FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape4' RoundRadius = 5 OnClick = BGRAShapeClick @@ -302,31 +247,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clFuchsia FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape5' RoundRadius = 5 OnClick = BGRAShapeClick @@ -341,31 +271,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clAqua FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape6' RoundRadius = 5 OnClick = BGRAShapeClick @@ -380,31 +295,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clYellow FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape7' RoundRadius = 5 OnClick = BGRAShapeClick @@ -419,31 +319,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = 11796479 FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape8' RoundRadius = 5 OnClick = BGRAShapeClick @@ -458,31 +343,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clWhite FillOpacity = 255 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape9' RoundRadius = 5 OnClick = BGRAShapeClick @@ -511,31 +381,16 @@ object FNewImage: TFNewImage BorderOpacity = 180 BorderColor = clBlack BorderGradient.StartColor = clWhite - BorderGradient.StartColorOpacity = 255 - BorderGradient.DrawMode = dmSet BorderGradient.EndColor = clBlack - BorderGradient.EndColorOpacity = 255 - BorderGradient.ColorCorrection = True BorderGradient.GradientType = gtLinear - BorderGradient.Point1XPercent = 0 - BorderGradient.Point1YPercent = 0 BorderGradient.Point2XPercent = 100 BorderGradient.Point2YPercent = 100 - BorderGradient.Sinus = False FillColor = clWhite FillOpacity = 0 FillGradient.StartColor = clWhite - FillGradient.StartColorOpacity = 255 - FillGradient.DrawMode = dmSet FillGradient.EndColor = clBlack - FillGradient.EndColorOpacity = 255 - FillGradient.ColorCorrection = True FillGradient.GradientType = gtLinear - FillGradient.Point1XPercent = 0 - FillGradient.Point1YPercent = 0 - FillGradient.Point2XPercent = 0 FillGradient.Point2YPercent = 100 - FillGradient.Sinus = False Caption = 'BGRAShape10' RoundRadius = 5 OnClick = BGRAShapeClick @@ -567,7 +422,7 @@ object FNewImage: TFNewImage Left = 80 Height = 23 Top = 72 - Width = 79 + Width = 63 ItemHeight = 15 ItemIndex = 5 Items.Strings = ( @@ -584,4 +439,23 @@ object FNewImage: TFNewImage TabOrder = 2 Text = '32' end + object ToolBar_Ratio: TToolBar + Left = 143 + Height = 22 + Top = 103 + Width = 24 + Align = alNone + AutoSize = True + Caption = 'ToolBar_Ratio' + EdgeBorders = [] + Images = FMain.ImageList16 + TabOrder = 7 + object ToolButton_ClearRatio: TToolButton + Left = 1 + Top = 0 + Caption = 'ToolButton_ClearRatio' + ImageIndex = 39 + OnClick = ToolButton_ClearRatioClick + end + end end diff --git a/lazpaint/dialog/unewimage.pas b/lazpaint/dialog/unewimage.pas index ab4dc32e..62ab733e 100644 --- a/lazpaint/dialog/unewimage.pas +++ b/lazpaint/dialog/unewimage.pas @@ -38,7 +38,9 @@ TFNewImage = class(TForm) Label_MemoryRequiredValue: TLabel; Label_Height1: TLabel; Label_MemoryRequired: TLabel; + ToolBar_Ratio: TToolBar; ToolBar_Rotate: TToolBar; + ToolButton_ClearRatio: TToolButton; ToolButton_Rotate: TToolButton; vsPreview: TBGRAVirtualScreen; Button_OK: TButton; @@ -53,6 +55,7 @@ TFNewImage = class(TForm) procedure ComboBox_RatioEnter(Sender: TObject); procedure ComboBox_RatioExit(Sender: TObject); procedure SpinEdit_HeightChange(Sender: TObject); + procedure ToolButton_ClearRatioClick(Sender: TObject); procedure ToolButton_RotateClick(Sender: TObject); procedure vsPreviewRedraw(Sender: TObject; Bitmap: TBGRABitmap); procedure Button_OKClick(Sender: TObject); @@ -263,6 +266,12 @@ procedure TFNewImage.SpinEdit_HeightChange(Sender: TObject); UpdatePreview; end; +procedure TFNewImage.ToolButton_ClearRatioClick(Sender: TObject); +begin + ComboBox_Ratio.ItemIndex:= 0; + ComboBox_RatioChange(ComboBox_Ratio); +end; + procedure TFNewImage.FormCreate(Sender: TObject); begin ScaleControl(Self,OriginalDPI); @@ -282,6 +291,7 @@ procedure TFNewImage.FormCreate(Sender: TObject); procedure TFNewImage.FormShow(Sender: TObject); begin ToolBar_Rotate.Images := LazPaintInstance.Icons[DoScaleY(16,OriginalDPI)]; + ToolBar_Ratio.Images := ToolBar_Rotate.Images; Label_MemoryRequiredValue.Left := Label_MemoryRequired.BoundsRect.Right + DoScaleX(4,OriginalDPI); FRecomputing := true; @@ -342,6 +352,9 @@ procedure TFNewImage.UpdatePreview; begin vsPreview.DiscardBitmap; Label_MemoryRequiredValue.Caption := FileSizeToStr(int64((SpinEdit_Width.Value*GetBitDepth+7) div 8)*SpinEdit_Height.Value,rsBytes); + if FBackColor.alpha = 0 then + ToolBar_Rotate.Color := MergeBGRA(ColorToBGRA(clSilver), ColorToBGRA(clWhite)) + else ToolBar_Rotate.Color := ColorToBGRA(FBackColor); end; function TFNewImage.GetBitDepth: integer; From 82d5425005b26c52655ed23142ea9b3ccdd78a84 Mon Sep 17 00:00:00 2001 From: Johann Date: Sun, 18 Oct 2020 21:25:57 +0200 Subject: [PATCH 24/26] fix tab order and use normal DPI --- lazpaint/dialog/ubrowseimages.lfm | 170 +++++++++++++----------------- 1 file changed, 76 insertions(+), 94 deletions(-) diff --git a/lazpaint/dialog/ubrowseimages.lfm b/lazpaint/dialog/ubrowseimages.lfm index 4368afc8..abd21deb 100644 --- a/lazpaint/dialog/ubrowseimages.lfm +++ b/lazpaint/dialog/ubrowseimages.lfm @@ -1,12 +1,11 @@ object FBrowseImages: TFBrowseImages Left = 376 - Height = 375 + Height = 300 Top = 101 - Width = 855 + Width = 684 Caption = 'Browse images' - ClientHeight = 375 - ClientWidth = 855 - DesignTimePPI = 120 + ClientHeight = 300 + ClientWidth = 684 KeyPreview = True OnCloseQuery = FormCloseQuery OnCreate = FormCreate @@ -18,119 +17,118 @@ object FBrowseImages: TFBrowseImages OnUTF8KeyPress = FormUTF8KeyPress Position = poScreenCenter ShowInTaskBar = stAlways - LCLVersion = '2.0.2.0' + LCLVersion = '2.0.10.0' object Panel1: TPanel - Left = 580 - Height = 375 + Left = 464 + Height = 300 Top = 0 - Width = 275 + Width = 220 Align = alClient - ClientHeight = 375 - ClientWidth = 275 + ClientHeight = 300 + ClientWidth = 220 ParentFont = False - TabOrder = 0 + TabOrder = 1 object Label_Status: TLabel - Left = 4 - Height = 22 - Top = 6 - Width = 4 + Left = 3 + Height = 15 + Top = 5 + Width = 3 Caption = '.' ParentColor = False ParentFont = False end object vsPreview: TBGRAVirtualScreen - Left = 4 - Height = 338 - Top = 32 - Width = 267 + Left = 3 + Height = 270 + Top = 26 + Width = 214 Alignment = taLeftJustify Anchors = [akTop, akLeft, akRight, akBottom] Color = clGray ParentColor = False ParentFont = False - TabOrder = 0 + TabOrder = 2 end object ListBox_RecentDirs: TListBox - Left = 4 - Height = 337 - Top = 32 - Width = 265 + Left = 3 + Height = 269 + Top = 26 + Width = 212 Anchors = [akTop, akLeft, akRight, akBottom] ItemHeight = 0 OnClick = ListBox_RecentDirsClick ParentFont = False ScrollWidth = 263 TabOrder = 1 - TopIndex = -1 end object CheckBox_UseDirectoryOnStartup: TCheckBox - Left = 70 - Height = 26 - Top = 4 - Width = 222 + Left = 56 + Height = 19 + Top = 3 + Width = 168 Caption = 'Use this directory on startup' ParentFont = False - TabOrder = 2 + TabOrder = 0 Visible = False end end object Splitter1: TSplitter - Left = 572 - Height = 375 + Left = 458 + Height = 300 Top = 0 - Width = 8 + Width = 6 MinSize = 64 end object Panel2: TPanel Left = 0 - Height = 375 + Height = 300 Top = 0 - Width = 572 + Width = 458 Align = alLeft - ClientHeight = 375 - ClientWidth = 572 + ClientHeight = 300 + ClientWidth = 458 ParentFont = False TabOrder = 2 object Panel3: TPanel Left = 1 - Height = 91 + Height = 73 Top = 1 - Width = 570 + Width = 456 Align = alTop - ClientHeight = 91 - ClientWidth = 570 + ClientHeight = 73 + ClientWidth = 456 ParentFont = False TabOrder = 0 object ToolBar1: TToolBar Left = 1 - Height = 41 + Height = 33 Top = 2 - Width = 248 + Width = 198 Align = alNone - ButtonHeight = 40 - ButtonWidth = 40 + ButtonHeight = 32 + ButtonWidth = 32 EdgeBorders = [] Images = ImageListToolbar ParentFont = False ParentShowHint = False ShowHint = True - TabOrder = 0 + TabOrder = 3 object ToolButton_GoUp: TToolButton - Left = 161 + Left = 145 Hint = 'Go one directory up' Top = 0 ImageIndex = 0 OnClick = ToolButton_GoUpClick end object ToolButton_ViewBigIcon: TToolButton - Left = 81 + Left = 73 Hint = 'Show big icons' Top = 0 ImageIndex = 2 OnClick = ToolButton_ViewBigIconClick end object ToolButton_ViewDetails: TToolButton - Left = 41 + Left = 37 Hint = 'Show details and preview' Top = 0 ImageIndex = 3 @@ -145,7 +143,7 @@ object FBrowseImages: TFBrowseImages OnClick = ToolButton_OpenSelectedFilesClick end object Tool_SelectDrive: TToolButton - Left = 121 + Left = 109 Hint = 'Select drive' Top = 0 ImageIndex = 6 @@ -153,41 +151,42 @@ object FBrowseImages: TFBrowseImages Visible = False end object ToolButton_CreateFolderOrContainer: TToolButton - Left = 201 + Left = 1 Hint = 'Create folder or container' - Top = 0 + Top = 32 ImageIndex = 8 OnClick = ToolButton_CreateFolderOrContainerClick end end object Edit_Filename: TEdit - Left = 280 - Height = 34 - Top = 50 - Width = 280 + Left = 224 + Height = 23 + Top = 40 + Width = 224 Anchors = [akTop, akLeft, akRight] OnChange = Edit_FilenameChange ParentFont = False - TabOrder = 1 + TabOrder = 2 end object DirectoryEdit1: TEdit - Left = 250 - Height = 34 - Top = 6 - Width = 310 + Left = 200 + Height = 23 + Top = 5 + Width = 248 Anchors = [akTop, akLeft, akRight] OnChange = DirectoryEdit1Change ParentFont = False - TabOrder = 2 + TabOrder = 0 end object ComboBox_FileExtension: TBCComboBox - Left = 8 - Height = 34 - Top = 50 - Width = 262 + Left = 6 + Height = 27 + Top = 40 + Width = 210 ItemIndex = -1 ArrowSize = 8 ArrowWidth = 16 + FocusBorderOpacity = 0 GlobalOpacity = 255 MemoryUsage = bmuHigh Rounding.RoundX = 3 @@ -195,16 +194,10 @@ object FBrowseImages: TFBrowseImages StateClicked.Background.Gradient1.StartColor = clBtnShadow StateClicked.Background.Gradient1.EndColor = clBtnFace StateClicked.Background.Gradient1.GradientType = gtLinear - StateClicked.Background.Gradient1.Point1XPercent = 0 - StateClicked.Background.Gradient1.Point1YPercent = 0 - StateClicked.Background.Gradient1.Point2XPercent = 0 StateClicked.Background.Gradient1.Point2YPercent = 250 StateClicked.Background.Gradient2.StartColor = clBtnShadow StateClicked.Background.Gradient2.EndColor = clBtnText StateClicked.Background.Gradient2.GradientType = gtLinear - StateClicked.Background.Gradient2.Point1XPercent = 0 - StateClicked.Background.Gradient2.Point1YPercent = 0 - StateClicked.Background.Gradient2.Point2XPercent = 0 StateClicked.Background.Gradient2.Point2YPercent = 100 StateClicked.Background.Gradient1EndPercent = 70 StateClicked.Background.Style = bbsGradient @@ -224,16 +217,10 @@ object FBrowseImages: TFBrowseImages StateHover.Background.Gradient1.StartColor = clBtnFace StateHover.Background.Gradient1.EndColor = clBtnHighlight StateHover.Background.Gradient1.GradientType = gtLinear - StateHover.Background.Gradient1.Point1XPercent = 0 - StateHover.Background.Gradient1.Point1YPercent = 0 - StateHover.Background.Gradient1.Point2XPercent = 0 StateHover.Background.Gradient1.Point2YPercent = 150 StateHover.Background.Gradient2.StartColor = clBtnFace StateHover.Background.Gradient2.EndColor = clBtnShadow StateHover.Background.Gradient2.GradientType = gtLinear - StateHover.Background.Gradient2.Point1XPercent = 0 - StateHover.Background.Gradient2.Point1YPercent = 0 - StateHover.Background.Gradient2.Point2XPercent = 0 StateHover.Background.Gradient2.Point2YPercent = 100 StateHover.Background.Gradient1EndPercent = 85 StateHover.Background.Style = bbsGradient @@ -253,16 +240,10 @@ object FBrowseImages: TFBrowseImages StateNormal.Background.Gradient1.StartColor = clBtnFace StateNormal.Background.Gradient1.EndColor = clBtnHighlight StateNormal.Background.Gradient1.GradientType = gtLinear - StateNormal.Background.Gradient1.Point1XPercent = 0 - StateNormal.Background.Gradient1.Point1YPercent = 0 - StateNormal.Background.Gradient1.Point2XPercent = 0 StateNormal.Background.Gradient1.Point2YPercent = 150 StateNormal.Background.Gradient2.StartColor = clBtnFace StateNormal.Background.Gradient2.EndColor = clBtnShadow StateNormal.Background.Gradient2.GradientType = gtLinear - StateNormal.Background.Gradient2.Point1XPercent = 0 - StateNormal.Background.Gradient2.Point1YPercent = 0 - StateNormal.Background.Gradient2.Point2XPercent = 0 StateNormal.Background.Gradient2.Point2YPercent = 100 StateNormal.Background.Gradient1EndPercent = 70 StateNormal.Background.Style = bbsGradient @@ -281,13 +262,14 @@ object FBrowseImages: TFBrowseImages StateNormal.FontEx.PaddingLeft = 3 StaticButton = False OnChange = ComboBox_FileExtensionChange + TabOrder = 1 end end object vsList: TBGRAVirtualScreen Left = 1 - Height = 282 - Top = 92 - Width = 570 + Height = 225 + Top = 74 + Width = 456 Align = alClient Alignment = taLeftJustify Color = clWindow @@ -300,8 +282,8 @@ object FBrowseImages: TFBrowseImages object ImageList128: TImageList Height = 128 Width = 128 - left = 50 - top = 220 + Left = 40 + Top = 176 Bitmap = { 4C69080000008000000080000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF @@ -16694,14 +16676,14 @@ object FBrowseImages: TFBrowseImages Enabled = False Interval = 30 OnTimer = Timer1Timer - left = 320 - top = 220 + Left = 256 + Top = 176 end object ImageListToolbar: TImageList Height = 32 Width = 32 - left = 234 - top = 221 + Left = 187 + Top = 177 Bitmap = { 4C69090000002000000020000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 From b5abb22ff70ec0503a7787a7931a43e5cc699c1c Mon Sep 17 00:00:00 2001 From: Johann Date: Sun, 18 Oct 2020 21:49:59 +0200 Subject: [PATCH 25/26] fix toolbar width --- lazpaint/dialog/ubrowseimages.pas | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lazpaint/dialog/ubrowseimages.pas b/lazpaint/dialog/ubrowseimages.pas index 45fb56d6..dd0e96a1 100644 --- a/lazpaint/dialog/ubrowseimages.pas +++ b/lazpaint/dialog/ubrowseimages.pas @@ -258,7 +258,7 @@ procedure TFBrowseImages.FormCloseQuery(Sender: TObject; var CanClose: boolean); end; procedure TFBrowseImages.FormCreate(Sender: TObject); -var bmp : TBitmap; delta: integer; +var bmp : TBitmap; begin FLastDirectory := ''; FOverwritePrompt:= true; @@ -309,17 +309,8 @@ procedure TFBrowseImages.FormCreate(Sender: TObject); BGRAPaintNet.RegisterPaintNetFormat; BGRAOpenRaster.RegisterOpenRasterFormat; - if FileManager.CanGetFileSystems then - begin - Tool_SelectDrive.Visible := true; - end else - begin - Tool_SelectDrive.Visible := false; - delta := ImageListToolbar.Width+Toolbar1.Indent; - ToolBar1.Width := ToolBar1.Width-delta; - DirectoryEdit1.Left := DirectoryEdit1.Left-delta; - DirectoryEdit1.Width := DirectoryEdit1.Width+delta; - end; + Tool_SelectDrive.Visible := FileManager.CanGetFileSystems; + Toolbar1.AutoSize := true; FCreateFolderOrContainerCaption := ToolButton_CreateFolderOrContainer.Hint; ToolButton_CreateFolderOrContainer.Hint := ToolButton_CreateFolderOrContainer.Hint + '...'; @@ -396,11 +387,16 @@ procedure TFBrowseImages.FormResize(Sender: TObject); end; procedure TFBrowseImages.FormShow(Sender: TObject); -var r:TRect; i: integer; +var r:TRect; i, delta: integer; begin if FInFormShow then exit; FInFormShow:= true; + delta := DirectoryEdit1.Left - (Toolbar1.Left + Toolbar1.Width + + DoScaleX(4, OriginalDPI)); + DirectoryEdit1.Left := DirectoryEdit1.Left-delta; + DirectoryEdit1.Width := DirectoryEdit1.Width+delta; + BGRAThumbnail.CheckersScale:= GetCanvasScaleFactor; ShellListView1.FontHeight:= ScaleY(round(13*GetCanvasScaleFactor),OriginalDPI); ShellListView1.SmallIconSize := round(ScaleX(round(64*GetCanvasScaleFactor),OriginalDPI)/16)*16; From 489cf38d5e93621b330a6bf2a6b9796846c70fe6 Mon Sep 17 00:00:00 2001 From: Johann ELSASS Date: Sun, 18 Oct 2020 21:52:48 +0200 Subject: [PATCH 26/26] version 7.1.5 --- lazpaint/lazpaint.lpi | 2 +- lazpaint/lazpaintembeddedpack.lpk | 2 +- lazpaint/lazpainttype.pas | 2 +- lazpaint/release/debian/debian/changelog | 13 +++++++++++++ lazpaint/release/debian/debian/control | 2 +- .../release/macOS/LazPaint.app/Contents/Info.plist | 4 ++-- lazpaint/release/macOS/makedmg.sh | 2 +- lazpaint/release/windows/lazpaint.iss | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lazpaint/lazpaint.lpi b/lazpaint/lazpaint.lpi index 65c6fd6d..d7a5da2b 100644 --- a/lazpaint/lazpaint.lpi +++ b/lazpaint/lazpaint.lpi @@ -24,7 +24,7 @@ - + diff --git a/lazpaint/lazpaintembeddedpack.lpk b/lazpaint/lazpaintembeddedpack.lpk index a85e94a5..ac029dac 100644 --- a/lazpaint/lazpaintembeddedpack.lpk +++ b/lazpaint/lazpaintembeddedpack.lpk @@ -26,7 +26,7 @@ - + diff --git a/lazpaint/lazpainttype.pas b/lazpaint/lazpainttype.pas index 8679e6e8..4e416492 100644 --- a/lazpaint/lazpainttype.pas +++ b/lazpaint/lazpainttype.pas @@ -11,7 +11,7 @@ interface {$IFDEF LINUX}, InterfaceBase{$ENDIF}; const - LazPaintVersion = 7010400; + LazPaintVersion = 7010500; function LazPaintVersionStr: string; diff --git a/lazpaint/release/debian/debian/changelog b/lazpaint/release/debian/debian/changelog index 26a4ed6d..14dbb363 100644 --- a/lazpaint/release/debian/debian/changelog +++ b/lazpaint/release/debian/debian/changelog @@ -1,3 +1,16 @@ +lazpaint (7.1.5) stable; urgency=low + + * image browser: can move to trash on MacOS + * image browser: F5 to update file list + * image browser: fix tab stops + * macOS: scaling of icons, comboboxes and buttons + * comboboxes: fix scaling and non responsive drop down + * checkers: scaled according to DPI + * file new: add icon to discard ratio + * top toolbar: stretch switch color button to DPI + + -- circular Sun, 18 Oct 2020 21:51:00 +0100 + lazpaint (7.1.4) stable; urgency=low * add --help command line diff --git a/lazpaint/release/debian/debian/control b/lazpaint/release/debian/debian/control index 5d826b65..3b3637cd 100644 --- a/lazpaint/release/debian/debian/control +++ b/lazpaint/release/debian/debian/control @@ -6,7 +6,7 @@ Build-Depends: lazarus-project (>= 2.0.2), dpkg-dev (>= 7) Homepage: https://wiki.freepascal.org/LazPaint Package: lazpaint Architecture: any -Version: 7.1.4 +Version: 7.1.5 Depends: ${shlibs:Depends} Description: Graphics viewer and editor. Can read layered files (lzp, ora, pdn, oXo), multi-images (gif, ico, tiff), diff --git a/lazpaint/release/macOS/LazPaint.app/Contents/Info.plist b/lazpaint/release/macOS/LazPaint.app/Contents/Info.plist index 9e88d195..95e2dc8f 100644 --- a/lazpaint/release/macOS/LazPaint.app/Contents/Info.plist +++ b/lazpaint/release/macOS/LazPaint.app/Contents/Info.plist @@ -19,9 +19,9 @@ CFBundleSignature lazp CFBundleShortVersionString - 7.1.4 + 7.1.5 CFBundleVersion - 7.1.4 + 7.1.5 CSResourcesFileMapped CFBundleDocumentTypes diff --git a/lazpaint/release/macOS/makedmg.sh b/lazpaint/release/macOS/makedmg.sh index b84e2ea3..ad3b49eb 100755 --- a/lazpaint/release/macOS/makedmg.sh +++ b/lazpaint/release/macOS/makedmg.sh @@ -8,7 +8,7 @@ if ! [ ${OSTYPE:0:6} = "darwin" ]; then fi appname=LazPaint -appversion=7.1.4 +appversion=7.1.5 pkgversion=0 appnamenospaces=lazpaint appbundle="$appname.app" diff --git a/lazpaint/release/windows/lazpaint.iss b/lazpaint/release/windows/lazpaint.iss index 07c20865..a7eb6b8f 100644 --- a/lazpaint/release/windows/lazpaint.iss +++ b/lazpaint/release/windows/lazpaint.iss @@ -1,7 +1,7 @@ #define MyAppName "LazPaint" #define MyAppOutputName "lazpaint" #define MyInstallerSuffix "_setup_win32_win64" -#define MyAppVersion "7.1.4" +#define MyAppVersion "7.1.5" #define MyAppPublisher "Circular, Fabien Wang, Lainz and others" #define MyAppURL "http://sourceforge.net/projects/lazpaint/" #define MyAppExeName "lazpaint.exe"