Skip to content

Commit

Permalink
Merge pull request #514 from bgrabitmap/dev-lazpaint
Browse files Browse the repository at this point in the history
LazPaint v7.2 (testing)
  • Loading branch information
circular17 authored Aug 6, 2022
2 parents 98300cd + b92b958 commit 2bac451
Show file tree
Hide file tree
Showing 92 changed files with 3,829 additions and 582 deletions.
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/umotionblur.pas
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ procedure TFMotionBlur.PaintBox1MouseDown(Sender: TObject;
procedure TFMotionBlur.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if not (ssLeft in Shift) then selectingAngle:= false;
PaintBoxMouseMovePos := Point(X,Y);
if InPaintBoxMouseMove then Exit;
InPaintBoxMouseMove := True;
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/dialog/filter/utwirl.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ object FTwirl: TFTwirl
Font.Height = -15
Increment = 30
MaxValue = 10000
MinValue = 1
MinValue = -10000
OnChange = SpinEdit_AngleChange
ParentFont = False
TabOrder = 1
Expand Down
20 changes: 3 additions & 17 deletions lazpaint/dialog/ublendop.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object FBlendOp: TFBlendOp
OnResize = FormResize
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '1.6.0.4'
LCLVersion = '2.2.0.1'
object ListBox_PatternUnder: TListBox
Left = 8
Height = 248
Expand All @@ -39,7 +39,6 @@ object FBlendOp: TFBlendOp
OnDrawItem = ListBox_DrawPatternItem
OnMeasureItem = ListBox_MeasureItem
OnSelectionChange = ListBox_PatternSelectionChange
ScrollWidth = 149
Style = lbOwnerDrawFixed
TabOrder = 0
end
Expand All @@ -52,7 +51,6 @@ object FBlendOp: TFBlendOp
Alignment = taCenter
AutoSize = False
Caption = 'Pattern under'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
Expand Down Expand Up @@ -82,7 +80,6 @@ object FBlendOp: TFBlendOp
OnDrawItem = ListBox_DrawPatternItem
OnMeasureItem = ListBox_MeasureItem
OnSelectionChange = ListBox_PatternSelectionChange
ScrollWidth = 149
Style = lbOwnerDrawFixed
TabOrder = 1
end
Expand All @@ -95,7 +92,6 @@ object FBlendOp: TFBlendOp
Alignment = taCenter
AutoSize = False
Caption = 'Pattern over'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
Expand Down Expand Up @@ -124,7 +120,6 @@ object FBlendOp: TFBlendOp
OnDrawItem = ListBox_DrawBlendItem
OnMeasureItem = ListBox_MeasureItem
OnSelectionChange = ListBox_BlendSelectionChange
ScrollWidth = 120
Style = lbOwnerDrawFixed
TabOrder = 2
end
Expand All @@ -137,7 +132,6 @@ object FBlendOp: TFBlendOp
Alignment = taCenter
AutoSize = False
Caption = 'Basic SVG'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
Expand Down Expand Up @@ -174,7 +168,6 @@ object FBlendOp: TFBlendOp
OnDrawItem = ListBox_DrawBlendItem
OnMeasureItem = ListBox_MeasureItem
OnSelectionChange = ListBox_BlendSelectionChange
ScrollWidth = 156
Style = lbOwnerDrawFixed
TabOrder = 3
end
Expand All @@ -187,7 +180,6 @@ object FBlendOp: TFBlendOp
Alignment = taCenter
AutoSize = False
Caption = 'Krita'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
Expand Down Expand Up @@ -220,7 +212,6 @@ object FBlendOp: TFBlendOp
OnDrawItem = ListBox_DrawBlendItem
OnMeasureItem = ListBox_MeasureItem
OnSelectionChange = ListBox_BlendSelectionChange
ScrollWidth = 114
Style = lbOwnerDrawFixed
TabOrder = 4
end
Expand All @@ -233,7 +224,6 @@ object FBlendOp: TFBlendOp
Alignment = taCenter
AutoSize = False
Caption = 'Other'
ParentColor = False
ParentShowHint = False
ShowHint = True
end
Expand All @@ -244,7 +234,6 @@ object FBlendOp: TFBlendOp
Width = 137
Anchors = [akLeft, akBottom]
Caption = 'Selected blend operation :'
ParentColor = False
end
object Label_BlendOpValue: TLabel
Left = 152
Expand All @@ -253,7 +242,6 @@ object FBlendOp: TFBlendOp
Width = 3
Anchors = [akLeft, akBottom]
Caption = '.'
ParentColor = False
end
object Button_OK: TButton
Left = 192
Expand Down Expand Up @@ -286,7 +274,6 @@ object FBlendOp: TFBlendOp
AutoSize = False
Caption = 'Preview with'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object Label_BlendOpCategory: TLabel
Expand All @@ -299,7 +286,6 @@ object FBlendOp: TFBlendOp
AutoSize = False
Caption = 'Category of blend operation'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object ScrollBar1: TScrollBar
Expand All @@ -315,7 +301,7 @@ object FBlendOp: TFBlendOp
Enabled = False
Interval = 100
OnTimer = TimerResizeTimer
left = 382
top = 288
Left = 382
Top = 288
end
end
23 changes: 22 additions & 1 deletion lazpaint/dialog/ubrowseimages.pas
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,26 @@ procedure TFBrowseImages.Edit_FilenameChange(Sender: TObject);
begin
if InFilenameChange then exit;
InFilenameChange := true;
txt := trim(Edit_Filename.Text);
{$IFDEF WINDOWS}
if (length(txt) >= 3) and (upcase(txt[1]) in ['A'..'Z']) and (txt[2]=':') and (txt[3]='\') then
{$ELSE}
if (length(txt) >= 1) and (txt[1] = PathDelim) then
{$ENDIF}
begin
DirectoryEdit1.Text := ExtractFilePath(txt);
txt := ExtractFileName(txt);
Edit_Filename.Text := txt;
end else
if pos(PathDelim, txt) > 1 then
begin
DirectoryEdit1.Text := ConcatPaths([DirectoryEdit1.Text,ExtractFilePath(txt)]);
txt := ExtractFileName(txt);
Edit_Filename.Text := txt;
end;
ShellListView1.DeselectAll;
UpdatePreview('');
first := true;
txt := trim(Edit_Filename.Text);
for i := 0 to ShellListView1.ItemCount-1 do
if UTF8CompareText(ShellListView1.ItemName[i],txt) = 0 then
begin
Expand Down Expand Up @@ -1128,6 +1144,11 @@ procedure TFBrowseImages.ValidateFileOrDir;
if DefaultExtension <> '' then
FFilename += DefaultExtension;
end;
if not FileManager.IsValidFileName(ExtractFileName(FFilename)) and IsSaveDialog then
begin
ShowMessage(rsInvalidName);
exit;
end;
if FileManager.FileExists(FFilename) and IsSaveDialog and OverwritePrompt then
begin
if QuestionDlg(rsSave, rsOverwriteFile, mtConfirmation, [mrOk, rsOkay, mrCancel, rsCancel],0) <> mrOk then exit;
Expand Down
22 changes: 15 additions & 7 deletions lazpaint/dialog/ucanvassize.pas
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ procedure TFCanvasSize.Button_OKClick(Sender: TObject);
begin
case FMUnit of
0: begin //pixels
tx:=SpinEdit_Width.Value;
tx:= SpinEdit_Width.Value;
ty:= SpinEdit_Height.Value;
end;
1: begin //percent
Expand Down Expand Up @@ -246,18 +246,26 @@ procedure TFCanvasSize.ComboBox_AnchorChange(Sender: TObject);
end;

procedure TFCanvasSize.ComboBox_MUnitChange(Sender: TObject);
var
curWidth, curHeight: Integer;
begin
if FMUnit= ComboBox_MUnit.ItemIndex then exit;
FMUnit:= ComboBox_MUnit.ItemIndex;
FIgnoreInput:=True;
curWidth := SpinEdit_Width.Value;
curHeight := SpinEdit_Height.Value;
case FMUnit of
0: begin //pixels
SpinEdit_Width.Value:= round (LazPaintInstance.Image.Width*SpinEdit_Width.Value/100);
SpinEdit_Height.Value:= round (LazPaintInstance.Image.Height*SpinEdit_Height.Value/100);
0: begin //percent -> pixels
SpinEdit_Width.MaxValue := MaxImageWidth;
SpinEdit_Height.MaxValue := MaxImageHeight;
SpinEdit_Width.Value:= round (LazPaintInstance.Image.Width*curWidth/100);
SpinEdit_Height.Value:= round (LazPaintInstance.Image.Height*curHeight/100);
end;
1: begin //percent
SpinEdit_Width.Value:= round (SpinEdit_Width.Value/ LazPaintInstance.Image.Width*100);
SpinEdit_Height.Value:= round (SpinEdit_Height.Value/ LazPaintInstance.Image.Height*100);
1: begin //pixels -> percent
SpinEdit_Width.MaxValue := round(MaxImageWidth / LazPaintInstance.Image.Width * 100);
SpinEdit_Height.MaxValue := round(MaxImageHeight / LazPaintInstance.Image.Height * 100);
SpinEdit_Width.Value:= round (curWidth/ LazPaintInstance.Image.Width*100);
SpinEdit_Height.Value:= round (curHeight/ LazPaintInstance.Image.Height*100);
end;
end;
FIgnoreInput:=False;
Expand Down
5 changes: 4 additions & 1 deletion lazpaint/dialog/uchoosecolorinterface.pas
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,9 @@ function TChooseColorInterface.DrawTriangleCursor(dest: TBGRABitmap;

procedure TChooseColorInterface.DoClick(X, Y: single);
begin
if FColorCircle.Bounds.Contains(PointF(X,Y)) then
if FColorCircle.Bounds.Contains(PointF(X,Y)) and
(VectLen(PointF(X,Y) - FColorCircle.center) <=
max(FColorCircle.bounds.Width, FColorCircle.bounds.Height)/2 + DoScaleX(14, 96)) then
begin
FSelectZone := szColorCircle;
DoSelect(X,Y);
Expand Down Expand Up @@ -1072,6 +1074,7 @@ constructor TChooseColorInterface.Create(AContainer: TWinControl; ADPI: integer)
EColor.Text:= '#FFFFFF';
LColor.Visible := true;
LColor.Caption := '#FFFFFF';
LColor.Hint := rsColorDescription;
FCurrentColorFormatError:= false;
vsColorView.Left := ExternalMargin;
vsColorView.Top := 0;
Expand Down
25 changes: 21 additions & 4 deletions lazpaint/dialog/ulayerstackinterface.pas
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,16 @@ procedure TLayerStackInterface.BGRALayerStack_MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var i: integer;
str: string;
isRightClick: boolean;
begin
if Assigned(LazPaintInstance) then LazPaintInstance.ExitColorEditor;
X := round(X*FScaling);
Y := round(Y*FScaling);
if PtInRect(Point(X,Y),FScrollButtonRect) then exit;
If (Button = mbLeft) then
isRightClick := (Button = mbRight) {$IFDEF DARWIN}or ((Button = mbLeft) and (ssCtrl in Shift)){$ENDIF};
If (Button = mbLeft) and not isRightClick then
begin
FRightClickOrigin := EmptyPoint;
if ((VolatileHorzScrollBar <> nil) and VolatileHorzScrollBar.MouseDown(X,Y)) or
((VolatileVertScrollBar <> nil) and VolatileVertScrollBar.MouseDown(X,Y)) then
begin
Expand Down Expand Up @@ -266,7 +269,7 @@ procedure TLayerStackInterface.BGRALayerStack_MouseDown(Sender: TObject;
exit;
end;
end else
if Button = mbRight then
if isRightClick then
FRightClickOrigin := Point(X,Y);
end;

Expand Down Expand Up @@ -302,6 +305,18 @@ procedure TLayerStackInterface.BGRALayerStack_MouseMove(Sender: TObject;
BGRALayerStack.Hint := FLayerInfo[i].KindIconHint;
BGRALayerStack.ShowHint:= true;
exit;
end else
if FLayerInfo[i].VisibleCheckbox.Contains(Point(X,Y)) then
begin
BGRALayerStack.Hint := rsVisible;
BGRALayerStack.ShowHint:= true;
exit;
end else
if FLayerInfo[i].RightPart.OpacityBar.Contains(Point(X,Y)) then
begin
BGRALayerStack.Hint := rsOpacity;
BGRALayerStack.ShowHint:= true;
exit;
end;
BGRALayerStack.ShowHint:= false;
end;
Expand All @@ -312,10 +327,12 @@ procedure TLayerStackInterface.BGRALayerStack_MouseUp(Sender: TObject;
indexF: single;
res: TModalResult;
topmostInfo: TTopMostInfo;
isRightClick: Boolean;
begin
X := round(X*FScaling);
Y := round(Y*FScaling);
if Button = mbLeft then
isRightClick := (Button = mbRight) {$IFDEF DARWIN}or ((Button = mbLeft) and not IsEmptyPoint(FRightClickOrigin)){$ENDIF};
if (Button = mbLeft) and not isRightClick then
begin
FMovingItemStart := false;
if FMovingItemBitmap <> nil then
Expand Down Expand Up @@ -362,7 +379,7 @@ procedure TLayerStackInterface.BGRALayerStack_MouseUp(Sender: TObject;
FAskTransferSelectionLayerIndex := -1;
end;
end else
if (Button = mbRight) and (Abs(X - FRightClickOrigin.X) <= 2) and
if isRightClick and (Abs(X - FRightClickOrigin.X) <= 2) and
(Abs(Y - FRightClickOrigin.Y) <= 2) then
begin
for i := 0 to high(FLayerInfo) do
Expand Down
16 changes: 0 additions & 16 deletions lazpaint/dialog/unewimage.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,6 @@ object FNewImage: TFNewImage
Top = 103
Width = 63
ItemHeight = 15
Items.Strings = (
''
'1:1'
'6:5'
'5:4'
'4:3'
'11:8'
'1.414:1'
'1.43:1'
'3:2'
'8:5'
'1.618:1'
'5:3'
'16:9'
'2:1'
)
MaxLength = 12
OnChange = ComboBox_RatioChange
OnEnter = ComboBox_RatioEnter
Expand Down
Loading

0 comments on commit 2bac451

Please sign in to comment.