Skip to content

Commit

Permalink
Clipboard operations: allow them to be recorded during macros
Browse files Browse the repository at this point in the history
It's hard to explain how this solves #320, but it does!

Basically I had concerns with allowing certain operations to be recorded during macros, specifically Edit > Paste in this context.  Why?
 If the clipboard's contents are not valid when that macro is played-back, prompts will be raised during macro playback which can ruin the batch processing experience.

That said, some elements of PD's central command processor rely on macro state to know how to handle things like Undo/Redo data (e.g. Undo/Redo generation is suspended during batch processing for performance reasons).  This interplay is complicated and I don't want to mess with it so close to 8.0's release, so an easier fix is to simply reinstate Edit > Copy/Paste commands during macro recording, which is probably preferable anyway as those ops may be useful to automate for some workflows?

Apologies for the lengthy explanation.  Some PD interactions are weird!

Thank you to @mizka76 for catching and reporting.  He has been an all-star tester on this release!
  • Loading branch information
tannerhelland committed Aug 21, 2020
1 parent 1c80901 commit dd09263
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Modules/Menus.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1641,29 +1641,29 @@ Private Function PDA_ByName_MenuEdit(ByRef srcMenuName As String) As Boolean
Process "Fade", True

Case "edit_cut"
Process "Cut", False, , UNDO_Image, , True
Process "Cut", False, , UNDO_Image

'If a selection is active, the Undo/Redo engine can simply back up the current layer contents.
' If, however, no selection is active, we will delete the entire layer. That requires a backup
' of the full layer stack.
Case "edit_cutlayer"
If PDImages.GetActiveImage.IsSelectionActive Then
Process "Cut from layer", False, , UNDO_Layer, , True
Process "Cut from layer", False, , UNDO_Layer
Else
Process "Cut from layer", False, , UNDO_Image, , True
Process "Cut from layer", False, , UNDO_Image
End If

Case "edit_copy"
Process "Copy", False, , UNDO_Nothing, , False
Process "Copy", False, , UNDO_Nothing

Case "edit_copylayer"
Process "Copy from layer", False, , UNDO_Nothing, , False
Process "Copy from layer", False, , UNDO_Nothing

Case "edit_pasteasimage"
Process "Paste as new image", False, , UNDO_Nothing, , False

Case "edit_pasteaslayer"
Process "Paste as new layer", False, , UNDO_Image_VectorSafe, , False
Process "Paste as new layer", False, , UNDO_Image_VectorSafe

'The cut/copy/paste special menus allow the user to specify the format used for cut/copy/paste
Case "edit_specialcut"
Expand Down
6 changes: 3 additions & 3 deletions PhotoDemon.vbp
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ Name="PhotoDemon"
HelpContextID="0"
Description="PhotoDemon Photo Editor"
CompatibleMode="0"
MajorVer=7
MinorVer=9
RevisionVer=2171
MajorVer=8
MinorVer=0
RevisionVer=1
AutoIncrementVer=1
ServerSupportFiles=0
VersionComments="Copyright 2000-2020 Tanner Helland - photodemon.org"
Expand Down

0 comments on commit dd09263

Please sign in to comment.