Page 1 of 1
[editing]Add cut/remove as well as duplicate
Posted: Sep 14th, '17, 07:12
by SimpleSi
Lots of times I'd like to remove a block from the middle of a script but not actually delete it
I'm thinking that a simple "cut" right-click menu item could copy the block to the clipboard - allowing us to paste it somewhere else
A more advanced idea would be to have a "remove" menu item that simply popped the block out to the right of the script to save paste operation
Re: [editing]Add cut/remove as well as duplicate
Posted: Sep 14th, '17, 07:33
by SimpleSi
I LOVE GP :)
It seems to be very simple to implement :)
In Blocks.gp I just copied and modfied grabDuplicate and added item to the context menu
Code: Select all
addItem menu 'duplicate' 'grabDuplicate' 'just this one block'
if (and ('reporter' != type) (notNil (next this))) {
addItem menu '...all' 'grabDuplicateAll' 'duplicate including all attached blocks'
}
// add in remove block option
addItem menu 'remove' 'grabRemove' 'remove block from script without deleting it'
addItem menu 'copy to clipboard' 'copyToClipboard'
and
Code: Select all
method grabRemove Block {
dup = (duplicate this)
if (notNil (next dup)) {setNext dup nil}
grabCentered morph dup
delete this
}
Re: [editing]Add cut/remove as well as duplicate
Posted: Sep 14th, '17, 07:44
by SimpleSi
I'm not sure about "remove" as users might think that it will act as a delete block action
I'm thinking "extract" could be better syntax
Re: [editing]Add cut/remove as well as duplicate
Posted: Sep 14th, '17, 20:55
by JohnM
Wow, I'm impressed that you figured out how to do!
I agree, I think "extract" or "extract block" would probably communicate the idea more clearly than "remove".
Would you mind if I incorporated this command into GP?
Re: [editing]Add cut/remove as well as duplicate
Posted: Sep 15th, '17, 20:38
by SimpleSi
Mind?
Mind??
I'd be very pleased to have it incorporated :)