|
@@ -5,10 +5,6 @@ unit LazpaintMainForm;
|
|
|
|
|
|
interface
|
|
interface
|
|
|
|
|
|
-{$IFDEF DARWIN}
|
|
|
|
- {$DEFINE USEPAINTBOXPICTURE}
|
|
|
|
-{$ENDIF}
|
|
|
|
-
|
|
|
|
uses
|
|
uses
|
|
Classes, LMessages, SysUtils, LazFileUtils, LResources, Forms, Controls,
|
|
Classes, LMessages, SysUtils, LazFileUtils, LResources, Forms, Controls,
|
|
Graphics, Dialogs, Menus, ExtDlgs, ComCtrls, ActnList, StdCtrls, ExtCtrls,
|
|
Graphics, Dialogs, Menus, ExtDlgs, ComCtrls, ActnList, StdCtrls, ExtCtrls,
|
|
@@ -21,7 +17,7 @@ uses
|
|
ubrowseimages, UToolPolygon, UToolVectorial, LCVectorRectShapes,
|
|
ubrowseimages, UToolPolygon, UToolVectorial, LCVectorRectShapes,
|
|
LCVectorialFillControl, LCVectorialFill,
|
|
LCVectorialFillControl, LCVectorialFill,
|
|
|
|
|
|
- laztablet, udarktheme, UScriptType;
|
|
|
|
|
|
+ udarktheme, UScriptType;
|
|
|
|
|
|
type
|
|
type
|
|
{ TFMain }
|
|
{ TFMain }
|
|
@@ -345,7 +341,6 @@ type
|
|
Panel_Text: TPanel;
|
|
Panel_Text: TPanel;
|
|
ToolBar15: TToolBar;
|
|
ToolBar15: TToolBar;
|
|
Tool_TextFont: TToolButton;
|
|
Tool_TextFont: TToolButton;
|
|
- PaintBox_Picture: TPaintBox;
|
|
|
|
PaintBox_PenPreview: TPaintBox;
|
|
PaintBox_PenPreview: TPaintBox;
|
|
Panel_Embedded: TPanel;
|
|
Panel_Embedded: TPanel;
|
|
Panel_PenWidthPreview: TPanel;
|
|
Panel_PenWidthPreview: TPanel;
|
|
@@ -480,7 +475,6 @@ type
|
|
procedure FileUseImageBrowserUpdate(Sender: TObject);
|
|
procedure FileUseImageBrowserUpdate(Sender: TObject);
|
|
procedure ForgetDialogAnswersExecute(Sender: TObject);
|
|
procedure ForgetDialogAnswersExecute(Sender: TObject);
|
|
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
|
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
|
- procedure FormMouseLeave(Sender: TObject);
|
|
|
|
procedure FormWindowStateChange(Sender: TObject);
|
|
procedure FormWindowStateChange(Sender: TObject);
|
|
procedure ItemDockLayersAndColorsClick(Sender: TObject);
|
|
procedure ItemDockLayersAndColorsClick(Sender: TObject);
|
|
procedure ItemFullscreenClick(Sender: TObject);
|
|
procedure ItemFullscreenClick(Sender: TObject);
|
|
@@ -518,7 +512,6 @@ type
|
|
procedure FileSaveSelectionAsUpdate(Sender: TObject);
|
|
procedure FileSaveSelectionAsUpdate(Sender: TObject);
|
|
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
|
|
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
|
|
procedure FormKeyUp(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
|
procedure FormKeyUp(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
|
- procedure FormMouseEnter(Sender: TObject);
|
|
|
|
procedure FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
procedure FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
procedure ImageCropLayerUpdate(Sender: TObject);
|
|
procedure ImageCropLayerUpdate(Sender: TObject);
|
|
procedure ImageFlattenExecute(Sender: TObject);
|
|
procedure ImageFlattenExecute(Sender: TObject);
|
|
@@ -533,7 +526,6 @@ type
|
|
procedure LayerRotateExecute(Sender: TObject);
|
|
procedure LayerRotateExecute(Sender: TObject);
|
|
procedure LayerRotateUpdate(Sender: TObject);
|
|
procedure LayerRotateUpdate(Sender: TObject);
|
|
procedure ItemDonateClick(Sender: TObject);
|
|
procedure ItemDonateClick(Sender: TObject);
|
|
- procedure PaintBox_PictureMouseEnter(Sender: TObject);
|
|
|
|
procedure Perspective_TwoPlanesClick(Sender: TObject);
|
|
procedure Perspective_TwoPlanesClick(Sender: TObject);
|
|
procedure SpinEdit_ShapeAltitudeChange(Sender: TObject; AByUser: boolean);
|
|
procedure SpinEdit_ShapeAltitudeChange(Sender: TObject; AByUser: boolean);
|
|
procedure SpinEdit_BrushSpacingChange(Sender: TObject; AByUser: boolean);
|
|
procedure SpinEdit_BrushSpacingChange(Sender: TObject; AByUser: boolean);
|
|
@@ -545,15 +537,6 @@ type
|
|
procedure ToolButton_DonateClick(Sender: TObject);
|
|
procedure ToolButton_DonateClick(Sender: TObject);
|
|
procedure VectorialFill_TextureClick(Sender: TObject);
|
|
procedure VectorialFill_TextureClick(Sender: TObject);
|
|
procedure PaintBox_PenPreviewPaint(Sender: TObject);
|
|
procedure PaintBox_PenPreviewPaint(Sender: TObject);
|
|
- procedure PaintBox_PictureMouseDown(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
- procedure PaintBox_PictureMouseMove(Sender: TObject; Shift: TShiftState; X,
|
|
|
|
- Y: Integer);
|
|
|
|
- procedure PaintBox_PictureMouseUp(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
- procedure PaintBox_PictureMouseWheel(Sender: TObject; Shift: TShiftState;
|
|
|
|
- WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
|
|
|
- procedure PaintBox_PicturePaint(Sender: TObject);
|
|
|
|
procedure Panel_PenWidthMouseMove(Sender: TObject; {%H-}Shift: TShiftState; {%H-}X,
|
|
procedure Panel_PenWidthMouseMove(Sender: TObject; {%H-}Shift: TShiftState; {%H-}X,
|
|
{%H-}Y: Integer);
|
|
{%H-}Y: Integer);
|
|
procedure Panel_ToolbarBackgroundMouseMove(Sender: TObject;
|
|
procedure Panel_ToolbarBackgroundMouseMove(Sender: TObject;
|
|
@@ -566,8 +549,6 @@ type
|
|
procedure ToolAnyExecute(Sender: TObject);
|
|
procedure ToolAnyExecute(Sender: TObject);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
procedure FormHide(Sender: TObject);
|
|
procedure FormHide(Sender: TObject);
|
|
- procedure FormMouseWheel(Sender: TObject; {%H-}Shift: TShiftState;
|
|
|
|
- WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
|
|
|
procedure HelpAboutExecute(Sender: TObject);
|
|
procedure HelpAboutExecute(Sender: TObject);
|
|
procedure HelpIndexExecute(Sender: TObject);
|
|
procedure HelpIndexExecute(Sender: TObject);
|
|
procedure ImageChangeCanvasSizeExecute(Sender: TObject);
|
|
procedure ImageChangeCanvasSizeExecute(Sender: TObject);
|
|
@@ -633,12 +614,6 @@ type
|
|
procedure FormResize(Sender: TObject);
|
|
procedure FormResize(Sender: TObject);
|
|
procedure ImageActionExecute(Sender: TObject);
|
|
procedure ImageActionExecute(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
- procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
- procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|
|
|
- procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
- procedure FormPaint(Sender: TObject);
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure Image_SwapColorsMouseDown(Sender: TObject; {%H-}Button: TMouseButton;
|
|
procedure Image_SwapColorsMouseDown(Sender: TObject; {%H-}Button: TMouseButton;
|
|
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
|
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
|
@@ -688,6 +663,10 @@ type
|
|
procedure ManagerToleranceChanged(Sender: TObject);
|
|
procedure ManagerToleranceChanged(Sender: TObject);
|
|
procedure ManagerToolbarChanged(Sender: TObject);
|
|
procedure ManagerToolbarChanged(Sender: TObject);
|
|
procedure Perspective_RepeatClick(Sender: TObject);
|
|
procedure Perspective_RepeatClick(Sender: TObject);
|
|
|
|
+ procedure PictureMouseBefore(Sender: TObject; AShift: TShiftState);
|
|
|
|
+ procedure PictureMouseMove(Sender: TObject; APosition: TPointF);
|
|
|
|
+ procedure PictureOnPaint(Sender: TObject);
|
|
|
|
+ procedure PictureToolbarUpdate(Sender: TObject);
|
|
function ScriptShowColorDialog(AVars: TVariableSet): TScriptResult;
|
|
function ScriptShowColorDialog(AVars: TVariableSet): TScriptResult;
|
|
procedure VectorialFill_Change(Sender: TObject);
|
|
procedure VectorialFill_Change(Sender: TObject);
|
|
procedure VectorialFill_TypeChange(Sender: TObject);
|
|
procedure VectorialFill_TypeChange(Sender: TObject);
|
|
@@ -711,9 +690,6 @@ type
|
|
FBrowseBrushes: TFBrowseImages;
|
|
FBrowseBrushes: TFBrowseImages;
|
|
FSaveImage: TFBrowseImages;
|
|
FSaveImage: TFBrowseImages;
|
|
FSaveSelection: TFBrowseImages;
|
|
FSaveSelection: TFBrowseImages;
|
|
-
|
|
|
|
- FTablet: TLazTablet;
|
|
|
|
-
|
|
|
|
FLoadInitialDir, FSaveInitialDir, FExportInitialDir: string;
|
|
FLoadInitialDir, FSaveInitialDir, FExportInitialDir: string;
|
|
FSaveSelectionInitialFilename: string;
|
|
FSaveSelectionInitialFilename: string;
|
|
FInFillChange, FInPenWidthChange, FInBrush, FInShapeRatio, FInEraserOption,
|
|
FInFillChange, FInPenWidthChange, FInBrush, FInShapeRatio, FInEraserOption,
|
|
@@ -723,31 +699,20 @@ type
|
|
FOnlineUpdater: TLazPaintCustomOnlineUpdater;
|
|
FOnlineUpdater: TLazPaintCustomOnlineUpdater;
|
|
FInitialized: boolean;
|
|
FInitialized: boolean;
|
|
FShouldArrange: boolean;
|
|
FShouldArrange: boolean;
|
|
- btnLeftDown, btnRightDown, btnMiddleDown: boolean;
|
|
|
|
spacePressed, altPressed, snapPressed, shiftPressed: boolean;
|
|
spacePressed, altPressed, snapPressed, shiftPressed: boolean;
|
|
- FormMouseMovePos: TPoint;
|
|
|
|
- InFormMouseMove: boolean;
|
|
|
|
- InFormPaint: boolean;
|
|
|
|
FirstPaint, LoadToolWindow: boolean;
|
|
FirstPaint, LoadToolWindow: boolean;
|
|
- CanCompressOrUpdateStack: boolean;
|
|
|
|
FShowSelectionNormal: boolean;
|
|
FShowSelectionNormal: boolean;
|
|
FLazPaintInstance: TLazPaintCustomInstance;
|
|
FLazPaintInstance: TLazPaintCustomInstance;
|
|
Config: TLazPaintConfig;
|
|
Config: TLazPaintConfig;
|
|
StartDirectory: string;
|
|
StartDirectory: string;
|
|
previousToolImg: integer;
|
|
previousToolImg: integer;
|
|
currentToolLabel: string;
|
|
currentToolLabel: string;
|
|
- InShowNoPicture: boolean;
|
|
|
|
FTopMostInfo: TTopMostInfo;
|
|
FTopMostInfo: TTopMostInfo;
|
|
- DelayedPaintPicture, CatchPaintPicture, PaintPictureCatched: boolean;
|
|
|
|
Panel_LineCap_FullSize: integer;
|
|
Panel_LineCap_FullSize: integer;
|
|
FCoordinatesCaption: string;
|
|
FCoordinatesCaption: string;
|
|
FCoordinatesCaptionCount: NativeInt;
|
|
FCoordinatesCaptionCount: NativeInt;
|
|
- FImageView: TImageView;
|
|
|
|
- FLastPaintDate: TDateTime;
|
|
|
|
- FUpdateStackWhenIdle: boolean;
|
|
|
|
FToolbarElementsInitDone: boolean;
|
|
FToolbarElementsInitDone: boolean;
|
|
|
|
|
|
- function GetCurrentPressure: single;
|
|
|
|
function GetDarkTheme: boolean;
|
|
function GetDarkTheme: boolean;
|
|
function GetImageAction: TImageActions;
|
|
function GetImageAction: TImageActions;
|
|
function GetUpdatingPopup: boolean;
|
|
function GetUpdatingPopup: boolean;
|
|
@@ -789,7 +754,6 @@ type
|
|
|
|
|
|
procedure CreateMenuAndToolbar;
|
|
procedure CreateMenuAndToolbar;
|
|
function GetToolManager: TToolManager;
|
|
function GetToolManager: TToolManager;
|
|
- procedure LayoutPictureAreaChange({%H-}ASender: TObject; {%H-}ANewArea: TRect);
|
|
|
|
function GetCurrentTool: TPaintToolType;
|
|
function GetCurrentTool: TPaintToolType;
|
|
procedure SwitchColors;
|
|
procedure SwitchColors;
|
|
function EditingColors: boolean;
|
|
function EditingColors: boolean;
|
|
@@ -797,7 +761,6 @@ type
|
|
procedure OnLatestVersionUpdate(ANewVersion: string);
|
|
procedure OnLatestVersionUpdate(ANewVersion: string);
|
|
procedure ManagerToolChanged({%H-}sender: TToolManager; {%H-}ANewTool: TPaintToolType);
|
|
procedure ManagerToolChanged({%H-}sender: TToolManager; {%H-}ANewTool: TPaintToolType);
|
|
procedure OnQueryExitToolHandler({%H-}sender: TLazPaintImage);
|
|
procedure OnQueryExitToolHandler({%H-}sender: TLazPaintImage);
|
|
- procedure OnZoomChanged({%H-}sender: TZoom; {%H-}ANewZoom: single);
|
|
|
|
procedure SetLazPaintInstance(const AValue: TLazPaintCustomInstance);
|
|
procedure SetLazPaintInstance(const AValue: TLazPaintCustomInstance);
|
|
procedure SetShowSelectionNormal(const AValue: boolean);
|
|
procedure SetShowSelectionNormal(const AValue: boolean);
|
|
procedure ToggleToolwindowsVisible;
|
|
procedure ToggleToolwindowsVisible;
|
|
@@ -813,20 +776,15 @@ type
|
|
procedure HidePenPreview(ATimeMs: Integer = 300; AClearTime: boolean = false);
|
|
procedure HidePenPreview(ATimeMs: Integer = 300; AClearTime: boolean = false);
|
|
procedure ShowFill(AFillControl: TLCVectorialFillControl; APanel: TPanel);
|
|
procedure ShowFill(AFillControl: TLCVectorialFillControl; APanel: TPanel);
|
|
procedure HideFill(ATimeMs: Integer = 300; AClearTime: boolean = false);
|
|
procedure HideFill(ATimeMs: Integer = 300; AClearTime: boolean = false);
|
|
- procedure OnPaintHandler;
|
|
|
|
procedure OnImageChangedHandler({%H-}AEvent: TLazPaintImageObservationEvent);
|
|
procedure OnImageChangedHandler({%H-}AEvent: TLazPaintImageObservationEvent);
|
|
procedure OnImageRenderChanged({%H-}Sender: TObject);
|
|
procedure OnImageRenderChanged({%H-}Sender: TObject);
|
|
procedure LabelAutosize(ALabel: TLabel);
|
|
procedure LabelAutosize(ALabel: TLabel);
|
|
procedure AskMergeSelection(ACaption: string);
|
|
procedure AskMergeSelection(ACaption: string);
|
|
- procedure ReleaseMouseButtons(Shift: TShiftState);
|
|
|
|
procedure UpdateSpecialKeys({%H-}Shift: TShiftState);
|
|
procedure UpdateSpecialKeys({%H-}Shift: TShiftState);
|
|
procedure UpdateCurveModeToolbar;
|
|
procedure UpdateCurveModeToolbar;
|
|
function ShowOpenTextureDialog(ATargetFill: TVectorialFill): boolean;
|
|
function ShowOpenTextureDialog(ATargetFill: TVectorialFill): boolean;
|
|
procedure ShowNoPicture;
|
|
procedure ShowNoPicture;
|
|
procedure SetCurveMode(AMode: TToolSplineMode);
|
|
procedure SetCurveMode(AMode: TToolSplineMode);
|
|
- procedure IncreasePenSize;
|
|
|
|
- procedure DecreasePenSize;
|
|
|
|
- function PenSizeDelta(direction: integer): integer;
|
|
|
|
procedure UpdatePenWidthFromSpinEdit;
|
|
procedure UpdatePenWidthFromSpinEdit;
|
|
procedure UpdateWindowCaption;
|
|
procedure UpdateWindowCaption;
|
|
procedure ImageCurrentFilenameChanged({%H-}sender: TLazPaintImage);
|
|
procedure ImageCurrentFilenameChanged({%H-}sender: TLazPaintImage);
|
|
@@ -864,15 +822,15 @@ type
|
|
|
|
|
|
public
|
|
public
|
|
{ public declarations }
|
|
{ public declarations }
|
|
- UpdateStackOnTimer: boolean;
|
|
|
|
Zoom: TZoom;
|
|
Zoom: TZoom;
|
|
|
|
|
|
procedure PaintPictureNow;
|
|
procedure PaintPictureNow;
|
|
|
|
+ procedure PaintPictureLater;
|
|
|
|
+ procedure NotifyImagePaint;
|
|
procedure InvalidatePicture(AInvalidateAll: boolean = true);
|
|
procedure InvalidatePicture(AInvalidateAll: boolean = true);
|
|
function TryOpenFileUTF8(filenameUTF8: string; AddToRecent: Boolean=True;
|
|
function TryOpenFileUTF8(filenameUTF8: string; AddToRecent: Boolean=True;
|
|
ALoadedImage: PImageEntry = nil; ASkipDialogIfSingleImage: boolean = false;
|
|
ALoadedImage: PImageEntry = nil; ASkipDialogIfSingleImage: boolean = false;
|
|
AAllowDuplicate: boolean = false; AEntryToLoad: integer = -1): Boolean;
|
|
AAllowDuplicate: boolean = false; AEntryToLoad: integer = -1): Boolean;
|
|
- function PictureCanvasOfs: TPoint;
|
|
|
|
procedure UpdateLineCapBar;
|
|
procedure UpdateLineCapBar;
|
|
procedure UpdateFillToolbar(AUpdateColorDiff: boolean);
|
|
procedure UpdateFillToolbar(AUpdateColorDiff: boolean);
|
|
procedure UpdateToolbar;
|
|
procedure UpdateToolbar;
|
|
@@ -890,7 +848,6 @@ type
|
|
property ToolManager: TToolManager read GetToolManager;
|
|
property ToolManager: TToolManager read GetToolManager;
|
|
property Layout: TMainFormLayout read FLayout;
|
|
property Layout: TMainFormLayout read FLayout;
|
|
property UseImageBrowser: boolean read GetUseImageBrowser;
|
|
property UseImageBrowser: boolean read GetUseImageBrowser;
|
|
- property CurrentPressure: single read GetCurrentPressure;
|
|
|
|
property DarkTheme: boolean read GetDarkTheme write SetDarkTheme;
|
|
property DarkTheme: boolean read GetDarkTheme write SetDarkTheme;
|
|
property Initialized: boolean read FInitialized;
|
|
property Initialized: boolean read FInitialized;
|
|
property UpdatingPopup: boolean read GetUpdatingPopup write SetUpdatingPopup;
|
|
property UpdatingPopup: boolean read GetUpdatingPopup write SetUpdatingPopup;
|
|
@@ -915,17 +872,16 @@ procedure TFMain.FormCreate(Sender: TObject);
|
|
begin
|
|
begin
|
|
FInitialized := false;
|
|
FInitialized := false;
|
|
|
|
|
|
- FLayout := TMainFormLayout.Create(self);
|
|
|
|
- FImageView := nil;
|
|
|
|
|
|
+ Zoom := TZoom.Create(Label_CurrentZoom,Edit_Zoom,FLayout);
|
|
|
|
+ FLayout := TMainFormLayout.Create(self, Zoom);
|
|
|
|
+ FLayout.OnPaintPicture:=@PictureOnPaint;
|
|
|
|
+ FLayout.OnToolbarUpdate:=@PictureToolbarUpdate;
|
|
|
|
+ FLayout.OnPictureMouseMove:=@PictureMouseMove;
|
|
|
|
+ FLayout.OnPictureMouseBefore:=@PictureMouseBefore;
|
|
|
|
|
|
ScaleControl(Self,OriginalDPI);
|
|
ScaleControl(Self,OriginalDPI);
|
|
self.Color := clBtnFace; //toolbar color inherited on mac
|
|
self.Color := clBtnFace; //toolbar color inherited on mac
|
|
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}
|
|
|
|
- PaintBox_Picture.SetBounds(0,0,ClientWidth,ClientHeight);
|
|
|
|
- PaintBox_Picture.Visible := True;
|
|
|
|
- {$ENDIF}
|
|
|
|
-
|
|
|
|
//mac interface
|
|
//mac interface
|
|
CheckActions(ActionList1);
|
|
CheckActions(ActionList1);
|
|
CheckQuitMenu(ItemQuit,ItemQuitSeparator);
|
|
CheckQuitMenu(ItemQuit,ItemQuitSeparator);
|
|
@@ -944,29 +900,13 @@ begin
|
|
ExportPictureDialog.Filter := SavePictureDialog1.Filter;
|
|
ExportPictureDialog.Filter := SavePictureDialog1.Filter;
|
|
SaveSelectionDialog.Filter := SavePictureDialog1.Filter;
|
|
SaveSelectionDialog.Filter := SavePictureDialog1.Filter;
|
|
|
|
|
|
- Zoom := TZoom.Create(Label_CurrentZoom,Edit_Zoom,FLayout);
|
|
|
|
- Zoom.OnZoomChanged:= @OnZoomChanged;
|
|
|
|
previousToolImg:= -1;
|
|
previousToolImg:= -1;
|
|
|
|
|
|
- //mouse status
|
|
|
|
- btnLeftDown := false;
|
|
|
|
- btnRightDown := false;
|
|
|
|
- btnMiddleDown:= false;
|
|
|
|
- try
|
|
|
|
- FTablet := TLazTablet.Create(self);
|
|
|
|
- except
|
|
|
|
- on ex: exception do
|
|
|
|
- FTablet := nil;
|
|
|
|
- end;
|
|
|
|
spacePressed:= false;
|
|
spacePressed:= false;
|
|
altPressed:= false;
|
|
altPressed:= false;
|
|
snapPressed:= false;
|
|
snapPressed:= false;
|
|
shiftPressed:= false;
|
|
shiftPressed:= false;
|
|
|
|
|
|
- //recursive calls
|
|
|
|
- InFormMouseMove:= false;
|
|
|
|
- InFormPaint := false;
|
|
|
|
-
|
|
|
|
{$IFDEF LINUX}
|
|
{$IFDEF LINUX}
|
|
ComboBox_BrushSelect.Top := ComboBox_BrushSelect.Top - 2;
|
|
ComboBox_BrushSelect.Top := ComboBox_BrushSelect.Top - 2;
|
|
ComboBox_BrushSelect.Font.Height := -10;
|
|
ComboBox_BrushSelect.Font.Height := -10;
|
|
@@ -978,56 +918,10 @@ begin
|
|
ComboBox_ArrowEnd.Font.Height := ComboBox_BrushSelect.Font.Height;
|
|
ComboBox_ArrowEnd.Font.Height := ComboBox_BrushSelect.Font.Height;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
|
|
- FLayout.OnPictureAreaChange := @LayoutPictureAreaChange;
|
|
|
|
FInitialized := true;
|
|
FInitialized := true;
|
|
FirstPaint := true;
|
|
FirstPaint := true;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TFMain.CatchToolKeyDown(var AKey: Word): boolean;
|
|
|
|
-begin
|
|
|
|
- if Assigned(ToolManager) then
|
|
|
|
- begin
|
|
|
|
- CatchPaintPicture:= true;
|
|
|
|
- PaintPictureCatched := false;
|
|
|
|
- try
|
|
|
|
- result := ToolManager.ToolKeyDown(AKey) or PaintPictureCatched;
|
|
|
|
- finally
|
|
|
|
- CatchPaintPicture:= false;
|
|
|
|
- end;
|
|
|
|
- end else
|
|
|
|
- result := false;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TFMain.CatchToolKeyUp(var AKey: Word): boolean;
|
|
|
|
-begin
|
|
|
|
- if Assigned(ToolManager) then
|
|
|
|
- begin
|
|
|
|
- CatchPaintPicture:= true;
|
|
|
|
- PaintPictureCatched := false;
|
|
|
|
- try
|
|
|
|
- result := ToolManager.ToolKeyUp(AKey) or PaintPictureCatched;
|
|
|
|
- finally
|
|
|
|
- CatchPaintPicture:= false;
|
|
|
|
- end;
|
|
|
|
- end else
|
|
|
|
- result := false;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TFMain.CatchToolKeyPress(var AKey: TUTF8Char): boolean;
|
|
|
|
-begin
|
|
|
|
- if Assigned(ToolManager) then
|
|
|
|
- begin
|
|
|
|
- CatchPaintPicture:= true;
|
|
|
|
- PaintPictureCatched := false;
|
|
|
|
- try
|
|
|
|
- result := ToolManager.ToolKeyPress(AKey) or PaintPictureCatched;
|
|
|
|
- finally
|
|
|
|
- CatchPaintPicture:= false;
|
|
|
|
- end;
|
|
|
|
- end else
|
|
|
|
- result := false;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.CreateMenuAndToolbar;
|
|
procedure TFMain.CreateMenuAndToolbar;
|
|
begin
|
|
begin
|
|
CreateToolbarElements;
|
|
CreateToolbarElements;
|
|
@@ -1079,8 +973,6 @@ begin
|
|
FreeAndNil(Zoom);
|
|
FreeAndNil(Zoom);
|
|
FreeAndNil(FOnlineUpdater);
|
|
FreeAndNil(FOnlineUpdater);
|
|
|
|
|
|
- FreeAndNil(FTablet);
|
|
|
|
-
|
|
|
|
FreeAndNil(FBrowseSelections);
|
|
FreeAndNil(FBrowseSelections);
|
|
FreeAndNil(FBrowseImages);
|
|
FreeAndNil(FBrowseImages);
|
|
FreeAndNil(FBrowseTextures);
|
|
FreeAndNil(FBrowseTextures);
|
|
@@ -1095,7 +987,6 @@ begin
|
|
FreeAndNil(FSaveImage);
|
|
FreeAndNil(FSaveImage);
|
|
FreeAndNil(FSaveSelection);
|
|
FreeAndNil(FSaveSelection);
|
|
|
|
|
|
- FreeAndNil(FImageView);
|
|
|
|
FreeAndNil(FLayout);
|
|
FreeAndNil(FLayout);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1137,9 +1028,6 @@ begin
|
|
ExportPictureDialog.FilterIndex:= 1;
|
|
ExportPictureDialog.FilterIndex:= 1;
|
|
end;
|
|
end;
|
|
|
|
|
|
- FImageView := TImageView.Create(LazPaintInstance, Zoom,
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}PaintBox_Picture.Canvas{$ELSE}self.Canvas{$ENDIF});
|
|
|
|
-
|
|
|
|
LazPaintInstance.EmbeddedResult := mrNone;
|
|
LazPaintInstance.EmbeddedResult := mrNone;
|
|
|
|
|
|
Image.OnSelectedLayerIndexChanged:= @PictureSelectedLayerIndexChanged;
|
|
Image.OnSelectedLayerIndexChanged:= @PictureSelectedLayerIndexChanged;
|
|
@@ -1316,146 +1204,6 @@ begin
|
|
Scripting.RegisterScriptFunction('ShowColorDialog',@ScriptShowColorDialog,ARegister);
|
|
Scripting.RegisterScriptFunction('ShowColorDialog',@ScriptShowColorDialog,ARegister);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.FormMouseDown(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
-begin
|
|
|
|
- if not Assigned(FImageView) then exit;
|
|
|
|
- ReleaseMouseButtons(Shift);
|
|
|
|
- if not (Button in[mbLeft,mbRight,mbMiddle]) or not FImageView.PictureCoordsDefined then exit;
|
|
|
|
- CanCompressOrUpdateStack := false;
|
|
|
|
- if Assigned(LazPaintInstance) then LazPaintInstance.ExitColorEditor;
|
|
|
|
- Image.OnImageChanged.DelayedStackUpdate := True;
|
|
|
|
-
|
|
|
|
- if btnLeftDown or btnRightDown or btnMiddleDown then exit;
|
|
|
|
-
|
|
|
|
- if Button = mbMiddle then
|
|
|
|
- begin
|
|
|
|
- btnMiddleDown:= true;
|
|
|
|
- if not ToolManager.ToolSleeping and not (ssAlt in Shift) then ToolManager.ToolSleep;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- if FImageView.PictureCoordsDefined then
|
|
|
|
- begin
|
|
|
|
- if Button = mbLeft then
|
|
|
|
- btnLeftDown := true else
|
|
|
|
- if Button = mbRight then
|
|
|
|
- btnRightDown := true;
|
|
|
|
-
|
|
|
|
- if (
|
|
|
|
- (ToolManager.GetCurrentToolType = ptHand) or
|
|
|
|
- ((ToolManager.GetCurrentToolType = ptEditShape) and
|
|
|
|
- Assigned(ToolManager.CurrentTool) and
|
|
|
|
- (ToolManager.CurrentTool as TEditShapeTool).NothingSelected)
|
|
|
|
- ) and
|
|
|
|
- (ssShift in Shift) then
|
|
|
|
- Image.SelectLayerContainingPixelAt(FImageView.FormToBitmap(X,Y).Round);
|
|
|
|
-
|
|
|
|
- if ToolManager.ToolDown(FImageView.FormToBitmap(X,Y),
|
|
|
|
- btnRightDown{$IFDEF DARWIN} or (ssCtrl in Shift){$ENDIF},
|
|
|
|
- CurrentPressure) then
|
|
|
|
- PaintPictureNow;
|
|
|
|
- UpdateToolbar;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
|
|
|
|
- Y: Integer);
|
|
|
|
-var BmpPos: TPointF;
|
|
|
|
- updateForVSCursor: boolean;
|
|
|
|
-
|
|
|
|
-//var tickstart:DWord;
|
|
|
|
-begin
|
|
|
|
- //tickstart := GetTickCount;
|
|
|
|
- if not Assigned(FImageView) then exit;
|
|
|
|
-
|
|
|
|
- ReleaseMouseButtons(Shift);
|
|
|
|
- UpdateSpecialKeys(Shift);
|
|
|
|
- HidePenPreview;
|
|
|
|
- HideFill;
|
|
|
|
- if LazPaintInstance.TopMostHasFocus then
|
|
|
|
- begin
|
|
|
|
- if LazPaintInstance.TopMostOkToUnfocus then
|
|
|
|
- SafeSetFocus(self)
|
|
|
|
- else
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- if (CurrentTool in[ptText,ptEditShape]) and TextSpinEditFocused then VectorialFill_Pen.SetFocus;
|
|
|
|
- Image.CurrentState.LayeredBitmap.EditorFocused := true;
|
|
|
|
-
|
|
|
|
- FormMouseMovePos := Point(X,Y);
|
|
|
|
- if InFormMouseMove then exit;
|
|
|
|
- InFormMouseMove := True;
|
|
|
|
- if not FImageView.PictureCoordsDefined then
|
|
|
|
- Application.ProcessMessages; //empty message stack
|
|
|
|
- if not FImageView.PictureCoordsDefined then
|
|
|
|
- begin
|
|
|
|
- InFormMouseMove:= false;
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- BmpPos := FImageView.FormToBitmap(FormMouseMovePos);
|
|
|
|
- FCoordinatesCaption := IntToStr(round(BmpPos.X))+','+IntToStr(round(BmpPos.Y));
|
|
|
|
- Inc(FCoordinatesCaptionCount);
|
|
|
|
- if FCoordinatesCaptionCount > 8 then
|
|
|
|
- begin
|
|
|
|
- FCoordinatesCaptionCount := 0;
|
|
|
|
- Label_Coordinates.caption := FCoordinatesCaption;
|
|
|
|
- Label_Coordinates.Update;
|
|
|
|
- UpdateStatusText;
|
|
|
|
- end;
|
|
|
|
- updateForVSCursor:= false;
|
|
|
|
- if ToolManager.ToolMove(BmpPos,CurrentPressure) then
|
|
|
|
- begin
|
|
|
|
- FImageView.UpdatePicture(PictureCanvasOfs, FLayout.WorkArea, self);
|
|
|
|
- end else
|
|
|
|
- updateForVSCursor := true;
|
|
|
|
- UpdateToolbar;
|
|
|
|
-
|
|
|
|
- if updateForVSCursor then
|
|
|
|
- FImageView.UpdateCursor(X,Y, PictureCanvasOfs, FLayout.WorkArea,
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}PaintBox_Picture{$ELSE}self{$ENDIF},
|
|
|
|
- Point(0,0), self);
|
|
|
|
-
|
|
|
|
- if ToolManager.ToolSleeping and not spacePressed and not btnLeftDown and not btnRightDown
|
|
|
|
- and not btnMiddleDown then
|
|
|
|
- ToolManager.ToolWakeUp;
|
|
|
|
-
|
|
|
|
- InFormMouseMove := False;
|
|
|
|
- //Canvas.TextOut(FLayout.WorkArea.Left,FLayout.WorkArea.Top,inttostr(GetTickCount-tickstart)+' ');
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.FormMouseUp(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
-var redraw: boolean;
|
|
|
|
-begin
|
|
|
|
- if not Assigned(FImageView) then exit;
|
|
|
|
-
|
|
|
|
- redraw := false;
|
|
|
|
- if (btnLeftDown and (Button = mbLeft)) or (btnRightDown and (Button=mbRight))
|
|
|
|
- or (btnMiddleDown and (Button = mbMiddle)) then
|
|
|
|
- begin
|
|
|
|
- if FImageView.PictureCoordsDefined then
|
|
|
|
- redraw := ToolManager.ToolMove(FImageView.FormToBitmap(X,Y),CurrentPressure)
|
|
|
|
- else redraw := false;
|
|
|
|
- if ToolManager.ToolUp then redraw := true;
|
|
|
|
- btnLeftDown := false;
|
|
|
|
- btnRightDown := false;
|
|
|
|
- btnMiddleDown:= false;
|
|
|
|
- end;
|
|
|
|
- if redraw then PaintPictureNow;
|
|
|
|
- if FUpdateStackWhenIdle then
|
|
|
|
- begin
|
|
|
|
- UpdateStackOnTimer:= true;
|
|
|
|
- FUpdateStackWhenIdle:= false;
|
|
|
|
- end;
|
|
|
|
- UpdateToolbar;
|
|
|
|
- ReleaseMouseButtons(Shift);
|
|
|
|
-
|
|
|
|
- if ToolManager.ToolSleeping and not spacePressed and not btnLeftDown and not btnRightDown
|
|
|
|
- and not btnMiddleDown then
|
|
|
|
- ToolManager.ToolWakeUp;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
function TFMain.ScriptFileOpen(AVars: TVariableSet): TScriptResult;
|
|
function TFMain.ScriptFileOpen(AVars: TVariableSet): TScriptResult;
|
|
var vFilename: TScriptVariableReference;
|
|
var vFilename: TScriptVariableReference;
|
|
topInfo: TTopMostInfo;
|
|
topInfo: TTopMostInfo;
|
|
@@ -2030,7 +1778,7 @@ begin
|
|
if Zoom.EditingZoom or EditingColors then exit;
|
|
if Zoom.EditingZoom or EditingColors then exit;
|
|
if not ((CurrentTool = ptText) and TextSpinEditFocused and (Key = VK_BACK)) and CatchToolKeyDown(Key) then
|
|
if not ((CurrentTool = ptText) and TextSpinEditFocused and (Key = VK_BACK)) and CatchToolKeyDown(Key) then
|
|
begin
|
|
begin
|
|
- DelayedPaintPicture := True;
|
|
|
|
|
|
+ PaintPictureLater;
|
|
end else
|
|
end else
|
|
if Key = VK_F6 then
|
|
if Key = VK_F6 then
|
|
begin
|
|
begin
|
|
@@ -2041,7 +1789,7 @@ begin
|
|
begin
|
|
begin
|
|
spacePressed:= true;
|
|
spacePressed:= true;
|
|
Key := 0;
|
|
Key := 0;
|
|
- if not ToolManager.ToolSleeping and not btnLeftDown and not btnRightDown then ToolManager.ToolSleep;
|
|
|
|
|
|
+ if not ToolManager.ToolSleeping and ([ssLeft,ssRight] * FLayout.MouseButtonState = []) then ToolManager.ToolSleep;
|
|
end else
|
|
end else
|
|
if LazPaintInstance.ImageListWindowVisible then
|
|
if LazPaintInstance.ImageListWindowVisible then
|
|
LazPaintInstance.ImageListWindowVisibleKeyDown(Key,Shift);
|
|
LazPaintInstance.ImageListWindowVisibleKeyDown(Key,Shift);
|
|
@@ -2450,22 +2198,18 @@ begin
|
|
else if Key = VK_SHIFT then shiftPressed:= false;
|
|
else if Key = VK_SHIFT then shiftPressed:= false;
|
|
if CatchToolKeyUp(Key) then
|
|
if CatchToolKeyUp(Key) then
|
|
begin
|
|
begin
|
|
- DelayedPaintPicture := True;
|
|
|
|
|
|
+ PaintPictureLater;
|
|
end else
|
|
end else
|
|
If Key = VK_SPACE then
|
|
If Key = VK_SPACE then
|
|
begin
|
|
begin
|
|
spacePressed:= false;
|
|
spacePressed:= false;
|
|
- if ToolManager.ToolSleeping and not spacePressed and not btnRightDown and not btnLeftDown then
|
|
|
|
|
|
+ if ToolManager.ToolSleeping and not spacePressed and
|
|
|
|
+ ([ssLeft,ssRight] * FLayout.MouseButtonState = []) then
|
|
ToolManager.ToolWakeUp;
|
|
ToolManager.ToolWakeUp;
|
|
Key := 0;
|
|
Key := 0;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.FormMouseEnter(Sender: TObject);
|
|
|
|
-begin
|
|
|
|
- Image.PrepareForRendering;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
procedure TFMain.FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
|
var selectedTool: TPaintToolType;
|
|
var selectedTool: TPaintToolType;
|
|
toolProcessKey: boolean;
|
|
toolProcessKey: boolean;
|
|
@@ -2480,7 +2224,7 @@ begin
|
|
end;
|
|
end;
|
|
if toolProcessKey and CatchToolKeyPress(UTF8Key) then
|
|
if toolProcessKey and CatchToolKeyPress(UTF8Key) then
|
|
begin
|
|
begin
|
|
- DelayedPaintPicture := true;
|
|
|
|
|
|
+ PaintPictureLater;
|
|
UpdateToolbar;
|
|
UpdateToolbar;
|
|
end else
|
|
end else
|
|
if UTF8Key <> '' then
|
|
if UTF8Key <> '' then
|
|
@@ -2522,11 +2266,6 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.FormMouseLeave(Sender: TObject);
|
|
|
|
-begin
|
|
|
|
- Cursor := crDefault;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.FormWindowStateChange(Sender: TObject);
|
|
procedure TFMain.FormWindowStateChange(Sender: TObject);
|
|
begin
|
|
begin
|
|
{$IFDEF LINUX}
|
|
{$IFDEF LINUX}
|
|
@@ -2694,43 +2433,6 @@ begin
|
|
LazPaintInstance.Donate;
|
|
LazPaintInstance.Donate;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.PaintBox_PictureMouseEnter(Sender: TObject);
|
|
|
|
-begin
|
|
|
|
- FormMouseEnter(Sender);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.PaintBox_PictureMouseDown(Sender: TObject;
|
|
|
|
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
|
-begin
|
|
|
|
- FormMouseDown(Sender,Button,Shift,X+PaintBox_Picture.Left,Y+PaintBox_Picture.Top);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.PaintBox_PictureMouseMove(Sender: TObject; Shift: TShiftState;
|
|
|
|
- X, Y: Integer);
|
|
|
|
-begin
|
|
|
|
- FormMouseMove(Sender,Shift,X+PaintBox_Picture.Left,Y+PaintBox_Picture.Top);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.PaintBox_PictureMouseUp(Sender: TObject; Button: TMouseButton;
|
|
|
|
- Shift: TShiftState; X, Y: Integer);
|
|
|
|
-begin
|
|
|
|
- FormMouseUp(Sender,Button,Shift,X+PaintBox_Picture.Left,Y+PaintBox_Picture.Top);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.PaintBox_PictureMouseWheel(Sender: TObject;
|
|
|
|
- Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
|
|
|
|
- var Handled: Boolean);
|
|
|
|
-begin
|
|
|
|
- FormMouseWheel(Sender,Shift,WheelDelta,Point(MousePos.X+PaintBox_Picture.Left,MousePos.Y+PaintBox_Picture.Top),Handled);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-procedure TFMain.PaintBox_PicturePaint(Sender: TObject);
|
|
|
|
-begin
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}
|
|
|
|
- OnPaintHandler;
|
|
|
|
- {$ENDIF}
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
procedure TFMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|
var topmostInfo: TTopMostInfo;
|
|
var topmostInfo: TTopMostInfo;
|
|
begin
|
|
begin
|
|
@@ -2784,24 +2486,6 @@ begin
|
|
LazPaintInstance.SaveMainWindowPosition;
|
|
LazPaintInstance.SaveMainWindowPosition;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.FormMouseWheel(Sender: TObject; Shift: TShiftState;
|
|
|
|
- WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
|
|
|
-begin
|
|
|
|
- if not Assigned(FImageView) or not FImageView.PictureCoordsDefined then exit;
|
|
|
|
- if ssAlt in Shift then
|
|
|
|
- begin
|
|
|
|
- if WheelDelta > 0 then IncreasePenSize
|
|
|
|
- else if WheelDelta < 0 then DecreasePenSize;
|
|
|
|
- end else
|
|
|
|
- begin
|
|
|
|
- Zoom.SetPosition(FImageView.FormToBitmap(MousePos.X,MousePos.Y), MousePos);
|
|
|
|
- if WheelDelta > 0 then Zoom.ZoomIn(ssSnap in Shift) else
|
|
|
|
- if WheelDelta < 0 then Zoom.ZoomOut(ssSnap in Shift);
|
|
|
|
- Zoom.ClearPosition;
|
|
|
|
- end;
|
|
|
|
- Handled := True;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.HelpAboutExecute(Sender: TObject);
|
|
procedure TFMain.HelpAboutExecute(Sender: TObject);
|
|
begin
|
|
begin
|
|
LazPaintInstance.ShowAboutDlg;
|
|
LazPaintInstance.ShowAboutDlg;
|
|
@@ -2896,9 +2580,11 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TFMain.TimerUpdateTimer(Sender: TObject);
|
|
procedure TFMain.TimerUpdateTimer(Sender: TObject);
|
|
-const SelectionPaintDelay = 100/(1000*60*60*24);
|
|
|
|
begin
|
|
begin
|
|
TimerUpdate.Enabled := false;
|
|
TimerUpdate.Enabled := false;
|
|
|
|
+ if ToolManager.ToolSleeping and not spacePressed and
|
|
|
|
+ ([ssLeft,ssRight,ssMiddle] * FLayout.MouseButtonState = []) then
|
|
|
|
+ ToolManager.ToolWakeUp;
|
|
EditUndo.Update;
|
|
EditUndo.Update;
|
|
EditRedo.Update;
|
|
EditRedo.Update;
|
|
UpdateStatusText;
|
|
UpdateStatusText;
|
|
@@ -2908,22 +2594,7 @@ begin
|
|
Label_Coordinates.Update;
|
|
Label_Coordinates.Update;
|
|
FCoordinatesCaptionCount := 0;
|
|
FCoordinatesCaptionCount := 0;
|
|
end;
|
|
end;
|
|
- if CanCompressOrUpdateStack and UpdateStackOnTimer then
|
|
|
|
- begin
|
|
|
|
- LazPaintInstance.NotifyStackChange;
|
|
|
|
- UpdateStackOnTimer := false;
|
|
|
|
- end else
|
|
|
|
- begin
|
|
|
|
- if CanCompressOrUpdateStack then image.CompressUndo;
|
|
|
|
- end;
|
|
|
|
- if DelayedPaintPicture or ToolManager.ToolUpdateNeeded or
|
|
|
|
- (Assigned(FImageView) and not FImageView.ShowSelection and
|
|
|
|
- (Now > FLastPaintDate+SelectionPaintDelay) ) then
|
|
|
|
- begin
|
|
|
|
- if ToolManager.ToolUpdateNeeded then ToolManager.ToolUpdate;
|
|
|
|
- if Assigned(FImageView) then FImageView.ShowSelection := true;
|
|
|
|
- PaintPictureNow;
|
|
|
|
- end;
|
|
|
|
|
|
+ FLayout.CheckDelayedUpdate;
|
|
TimerUpdate.Enabled := true;
|
|
TimerUpdate.Enabled := true;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -3076,14 +2747,6 @@ begin
|
|
params.Free;
|
|
params.Free;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.LayoutPictureAreaChange(ASender: TObject; ANewArea: TRect);
|
|
|
|
-begin
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}
|
|
|
|
- PaintBox_Picture.SetBounds(ANewArea.Left,ANewArea.Top,ANewArea.Right-ANewArea.Left,ANewArea.Bottom-ANewArea.Top);
|
|
|
|
- {$ENDIF}
|
|
|
|
- if Assigned(FImageView) then FImageView.InvalidatePicture(True, ANewArea, Point(0,0), self);
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.ToggleGridVisible;
|
|
procedure TFMain.ToggleGridVisible;
|
|
begin
|
|
begin
|
|
LazPaintInstance.GridVisible := not LazPaintInstance.GridVisible;
|
|
LazPaintInstance.GridVisible := not LazPaintInstance.GridVisible;
|
|
@@ -3301,8 +2964,7 @@ begin
|
|
ToolManager.ToolMove(texMapBounds.Right-0.5, texMapBounds.Bottom-0.5, 1);
|
|
ToolManager.ToolMove(texMapBounds.Right-0.5, texMapBounds.Bottom-0.5, 1);
|
|
ToolManager.ToolUp;
|
|
ToolManager.ToolUp;
|
|
end;
|
|
end;
|
|
- if Assigned(FImageView) then
|
|
|
|
- FImageView.FillSelectionHighlight := ToolManager.DisplayFilledSelection and not FShowSelectionNormal;
|
|
|
|
|
|
+ FLayout.FillSelectionHighlight := ToolManager.DisplayFilledSelection and not FShowSelectionNormal;
|
|
except
|
|
except
|
|
on ex:Exception do
|
|
on ex:Exception do
|
|
begin
|
|
begin
|
|
@@ -3382,7 +3044,6 @@ begin
|
|
|
|
|
|
if needUpdate then
|
|
if needUpdate then
|
|
begin
|
|
begin
|
|
- FImageView.UpdatePicture(PictureCanvasOfs, FLayout.WorkArea, self);
|
|
|
|
PaintPictureNow;
|
|
PaintPictureNow;
|
|
UpdateToolbar;
|
|
UpdateToolbar;
|
|
end;
|
|
end;
|
|
@@ -3460,7 +3121,6 @@ begin
|
|
|
|
|
|
if needUpdate then
|
|
if needUpdate then
|
|
begin
|
|
begin
|
|
- FImageView.UpdatePicture(PictureCanvasOfs, FLayout.WorkArea, self);
|
|
|
|
PaintPictureNow;
|
|
PaintPictureNow;
|
|
UpdateToolbar;
|
|
UpdateToolbar;
|
|
end;
|
|
end;
|
|
@@ -3508,7 +3168,6 @@ begin
|
|
end;
|
|
end;
|
|
if needUpdate then
|
|
if needUpdate then
|
|
begin
|
|
begin
|
|
- FImageView.UpdatePicture(PictureCanvasOfs, FLayout.WorkArea, self);
|
|
|
|
PaintPictureNow;
|
|
PaintPictureNow;
|
|
UpdateToolbar;
|
|
UpdateToolbar;
|
|
end;
|
|
end;
|
|
@@ -4007,30 +3666,6 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.ReleaseMouseButtons(Shift: TShiftState);
|
|
|
|
-begin
|
|
|
|
- if not (ssLeft in Shift) and btnLeftDown then
|
|
|
|
- begin
|
|
|
|
- btnLeftDown := false;
|
|
|
|
- if ToolManager.ToolUp then PaintPictureNow;
|
|
|
|
- end;
|
|
|
|
- if not (ssRight in Shift) and btnRightDown then
|
|
|
|
- begin
|
|
|
|
- btnRightDown := false;
|
|
|
|
- if ToolManager.ToolUp then PaintPictureNow;
|
|
|
|
- end;
|
|
|
|
- if not (ssMiddle in Shift) and btnMiddleDown then
|
|
|
|
- begin
|
|
|
|
- btnMiddleDown := false;
|
|
|
|
- if ToolManager.ToolUp then PaintPictureNow;
|
|
|
|
- end;
|
|
|
|
- if not btnLeftDown and not btnRightDown then
|
|
|
|
- begin
|
|
|
|
- CanCompressOrUpdateStack := true;
|
|
|
|
- Image.OnImageChanged.DelayedStackUpdate := False;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.UpdateSpecialKeys(Shift: TShiftState);
|
|
procedure TFMain.UpdateSpecialKeys(Shift: TShiftState);
|
|
procedure UpdateKey(AShift: TShiftStateEnum; ACode: Word; var APressed: boolean);
|
|
procedure UpdateKey(AShift: TShiftStateEnum; ACode: Word; var APressed: boolean);
|
|
begin
|
|
begin
|
|
@@ -4194,9 +3829,8 @@ end;
|
|
|
|
|
|
procedure TFMain.ShowNoPicture;
|
|
procedure TFMain.ShowNoPicture;
|
|
begin
|
|
begin
|
|
- InShowNoPicture := true;
|
|
|
|
- PaintPictureNow;
|
|
|
|
- InShowNoPicture:= false;
|
|
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ FLayout.ShowNoPicture;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TFMain.UpdateWindowCaption;
|
|
procedure TFMain.UpdateWindowCaption;
|
|
@@ -4430,36 +4064,8 @@ end;
|
|
|
|
|
|
{****************************** Picture ************************}
|
|
{****************************** Picture ************************}
|
|
|
|
|
|
-procedure TFMain.OnPaintHandler;
|
|
|
|
-var
|
|
|
|
- ac: TWinControl;
|
|
|
|
-begin
|
|
|
|
- if FirstPaint then
|
|
|
|
- begin
|
|
|
|
- LoadToolwindow := True;
|
|
|
|
- TimerLoadToolWin.Enabled := true;
|
|
|
|
- FirstPaint := false;
|
|
|
|
- end;
|
|
|
|
- if InFormPaint then exit;
|
|
|
|
- InFormPaint := true;
|
|
|
|
-
|
|
|
|
- if Assigned(FImageView) then FImageView.DoPaint(PictureCanvasOfs, FLayout.WorkArea, InShowNoPicture);
|
|
|
|
- DelayedPaintPicture:= false;
|
|
|
|
-
|
|
|
|
- ac := ActiveControl;
|
|
|
|
- if ac is TBCTrackbarUpdown then
|
|
|
|
- TBCTrackbarUpdown(ac).DelayTimer;
|
|
|
|
-
|
|
|
|
- InFormPaint := false;
|
|
|
|
- FLastPaintDate := Now;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
procedure TFMain.OnImageChangedHandler(AEvent: TLazPaintImageObservationEvent);
|
|
procedure TFMain.OnImageChangedHandler(AEvent: TLazPaintImageObservationEvent);
|
|
begin
|
|
begin
|
|
- if CatchPaintPicture then
|
|
|
|
- PaintPictureCatched := true
|
|
|
|
- else InvalidatePicture(false);
|
|
|
|
-
|
|
|
|
if (image.Width <> FLastWidth) or (image.Height <> FLastHeight)
|
|
if (image.Width <> FLastWidth) or (image.Height <> FLastHeight)
|
|
or (image.BPP <> FLastBPP) or (image.FrameIndex <> FLastFrameIndex) then
|
|
or (image.BPP <> FLastBPP) or (image.FrameIndex <> FLastFrameIndex) then
|
|
begin
|
|
begin
|
|
@@ -4474,7 +4080,6 @@ begin
|
|
ChooseTool(ptHand);
|
|
ChooseTool(ptHand);
|
|
MessagePopup(rsToolOnInvisibleLayer,5000);
|
|
MessagePopup(rsToolOnInvisibleLayer,5000);
|
|
end;
|
|
end;
|
|
- if AEvent.DelayedStackUpdate then FUpdateStackWhenIdle := true;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TFMain.OnImageRenderChanged(Sender: TObject);
|
|
procedure TFMain.OnImageRenderChanged(Sender: TObject);
|
|
@@ -4486,37 +4091,78 @@ procedure TFMain.UpdateEditPicture(ADelayed: boolean = false);
|
|
begin
|
|
begin
|
|
if ToolManager.ToolUpdate then
|
|
if ToolManager.ToolUpdate then
|
|
begin
|
|
begin
|
|
- if ADelayed then DelayedPaintPicture := True
|
|
|
|
|
|
+ if ADelayed then PaintPictureLater
|
|
else
|
|
else
|
|
PaintPictureNow;
|
|
PaintPictureNow;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.OnZoomChanged(sender: TZoom; ANewZoom: single);
|
|
|
|
|
|
+procedure TFMain.PaintPictureNow;
|
|
|
|
+begin
|
|
|
|
+ if not visible then exit;
|
|
|
|
+ if Assigned(LazPaintInstance) then LazPaintInstance.UpdateStackOnTimer := true;
|
|
|
|
+ if Assigned(FLayout) then FLayout.PaintPictureNow;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFMain.PaintPictureLater;
|
|
|
|
+begin
|
|
|
|
+ if Assigned(FLayout) then FLayout.DelayedPaintPicture := True;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFMain.NotifyImagePaint;
|
|
|
|
+begin
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ FLayout.DelayedPaintPicture:= false;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFMain.PictureMouseBefore(Sender: TObject; AShift: TShiftState);
|
|
|
|
+begin
|
|
|
|
+ UpdateSpecialKeys(AShift);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFMain.PictureMouseMove(Sender: TObject; APosition: TPointF);
|
|
begin
|
|
begin
|
|
- if Assigned(FImageView) then
|
|
|
|
|
|
+ HidePenPreview;
|
|
|
|
+ HideFill;
|
|
|
|
+
|
|
|
|
+ FCoordinatesCaption := IntToStr(round(APosition.X))+','+IntToStr(round(APosition.Y));
|
|
|
|
+ Inc(FCoordinatesCaptionCount);
|
|
|
|
+ if FCoordinatesCaptionCount > 8 then
|
|
begin
|
|
begin
|
|
- if not Image.SelectionMaskEmpty then
|
|
|
|
- FImageView.ShowSelection := false;
|
|
|
|
- FImageView.OnZoomChanged(sender, ANewZoom, FLayout.WorkArea);
|
|
|
|
|
|
+ FCoordinatesCaptionCount := 0;
|
|
|
|
+ Label_Coordinates.caption := FCoordinatesCaption;
|
|
|
|
+ Label_Coordinates.Update;
|
|
|
|
+ UpdateStatusText;
|
|
end;
|
|
end;
|
|
- UpdateToolbar;
|
|
|
|
- PaintPictureNow;
|
|
|
|
|
|
+
|
|
|
|
+ if LazPaintInstance.TopMostHasFocus then
|
|
|
|
+ begin
|
|
|
|
+ if LazPaintInstance.TopMostOkToUnfocus then
|
|
|
|
+ SafeSetFocus(self)
|
|
|
|
+ else
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ if (CurrentTool in[ptText,ptEditShape]) and TextSpinEditFocused then VectorialFill_Pen.SetFocus;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.PaintPictureNow;
|
|
|
|
|
|
+procedure TFMain.PictureOnPaint(Sender: TObject);
|
|
|
|
+var
|
|
|
|
+ ac: TWinControl;
|
|
begin
|
|
begin
|
|
- if not visible then exit;
|
|
|
|
- UpdateStackOnTimer := true;
|
|
|
|
- Image.OnImageChanged.NotifyObservers;
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}PaintBox_Picture{$ELSE}self{$ENDIF}.Update;
|
|
|
|
|
|
+ if FirstPaint then
|
|
|
|
+ begin
|
|
|
|
+ LoadToolwindow := True;
|
|
|
|
+ TimerLoadToolWin.Enabled := true;
|
|
|
|
+ FirstPaint := false;
|
|
|
|
+ end;
|
|
|
|
+ ac := ActiveControl;
|
|
|
|
+ if ac is TBCTrackbarUpdown then
|
|
|
|
+ TBCTrackbarUpdown(ac).DelayTimer;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TFMain.FormPaint(Sender: TObject);
|
|
|
|
|
|
+procedure TFMain.PictureToolbarUpdate(Sender: TObject);
|
|
begin
|
|
begin
|
|
- {$IFNDEF USEPAINTBOXPICTURE}
|
|
|
|
- OnPaintHandler;
|
|
|
|
- {$ENDIF}
|
|
|
|
|
|
+ UpdateToolbar;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TFMain.PictureSelectedLayerIndexChanged(sender: TLazPaintImage);
|
|
procedure TFMain.PictureSelectedLayerIndexChanged(sender: TLazPaintImage);
|
|
@@ -4538,8 +4184,8 @@ end;
|
|
procedure TFMain.SetShowSelectionNormal(const AValue: boolean);
|
|
procedure TFMain.SetShowSelectionNormal(const AValue: boolean);
|
|
begin
|
|
begin
|
|
FShowSelectionNormal := AValue;
|
|
FShowSelectionNormal := AValue;
|
|
- if Assigned(FImageView) then
|
|
|
|
- FImageView.FillSelectionHighlight := ToolManager.DisplayFilledSelection and not FShowSelectionNormal;
|
|
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ FLayout.FillSelectionHighlight := ToolManager.DisplayFilledSelection and not FShowSelectionNormal;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TFMain.WMEraseBkgnd(var Message: TLMEraseBkgnd);
|
|
procedure TFMain.WMEraseBkgnd(var Message: TLMEraseBkgnd);
|
|
@@ -4673,8 +4319,8 @@ end;
|
|
|
|
|
|
procedure TFMain.InvalidatePicture(AInvalidateAll: boolean = true);
|
|
procedure TFMain.InvalidatePicture(AInvalidateAll: boolean = true);
|
|
begin
|
|
begin
|
|
- if Assigned(FImageView) and Assigned(FLayout) then
|
|
|
|
- FImageView.InvalidatePicture(AInvalidateAll, FLayout.WorkArea, Point(0,0), self);
|
|
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ FLayout.InvalidatePicture(AInvalidateAll);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFMain.GetUseImageBrowser: boolean;
|
|
function TFMain.GetUseImageBrowser: boolean;
|
|
@@ -4695,15 +4341,8 @@ end;
|
|
|
|
|
|
procedure TFMain.SetUpdatingPopup(AValue: boolean);
|
|
procedure TFMain.SetUpdatingPopup(AValue: boolean);
|
|
begin
|
|
begin
|
|
- FImageView.UpdatingPopup := AValue;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
-function TFMain.GetCurrentPressure: single;
|
|
|
|
-begin
|
|
|
|
- if Assigned(FTablet) and FTablet.Present and FTablet.Entering and (FTablet.Max > 0) then
|
|
|
|
- result := FTablet.Pressure/FTablet.Max
|
|
|
|
- else
|
|
|
|
- result := 1;
|
|
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ FLayout.UpdatingPopup := AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFMain.GetDarkTheme: boolean;
|
|
function TFMain.GetDarkTheme: boolean;
|
|
@@ -4719,7 +4358,9 @@ end;
|
|
|
|
|
|
function TFMain.GetUpdatingPopup: boolean;
|
|
function TFMain.GetUpdatingPopup: boolean;
|
|
begin
|
|
begin
|
|
- result := FImageView.UpdatingPopup;
|
|
|
|
|
|
+ if Assigned(FLayout) then
|
|
|
|
+ result := FLayout.UpdatingPopup
|
|
|
|
+ else result := false;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TFMain.GetScriptContext: TScriptContext;
|
|
function TFMain.GetScriptContext: TScriptContext;
|
|
@@ -4741,15 +4382,6 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TFMain.PictureCanvasOfs: TPoint;
|
|
|
|
-begin
|
|
|
|
- {$IFDEF USEPAINTBOXPICTURE}
|
|
|
|
- result := Point(-PaintBox_Picture.Left,-PaintBox_Picture.Top);
|
|
|
|
- {$ELSE}
|
|
|
|
- result := Point(0,0);
|
|
|
|
- {$ENDIF}
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
{$R *.lfm}
|
|
{$R *.lfm}
|
|
|
|
|
|
end.
|
|
end.
|