[editing]Add cut/remove as well as duplicate

Request a new command, feature, or improvement

Moderator: MSandro

Post Reply
SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

[editing]Add cut/remove as well as duplicate

Post by SimpleSi » Sep 14th, '17, 07:12

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

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: [editing]Add cut/remove as well as duplicate

Post by SimpleSi » Sep 14th, '17, 07:33

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  
}

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: [editing]Add cut/remove as well as duplicate

Post by SimpleSi » Sep 14th, '17, 07:44

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

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: [editing]Add cut/remove as well as duplicate

Post by JohnM » Sep 14th, '17, 20:55

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?

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: [editing]Add cut/remove as well as duplicate

Post by SimpleSi » Sep 15th, '17, 20:38

Mind?

Mind??

I'd be very pleased to have it incorporated :)

Post Reply