← Back to team overview

kicad-developers team mailing list archive

Re: [Patch] pcbnew clipboard support

 

On 17.09.2017 20:43, Simon Küppers wrote:
> Oh wait, there are a few mistakes.
> 
> 1. Select elements
> 2. Ctrl+C (or Ctrl+X)
> 3. Cursor changes. Now select origin by clicking.
> 
> 4. Ctrl+V (paste)
> 5. Elements are now moving with the offset to the cursor that has been
> selected in Step 3
> 6. Final Click to place the items. Cursor might be snapping to the grid
> here.

Hi Simon,

Thanks, that's what I've though about.

Tom
> 
> Best Regards
> 
> Am 17.09.2017 um 20:39 schrieb Simon Küppers:
>> Altium Designer handles it the following way:
>>
>> 1. Select elements
>> 2. Ctrl+C (or Ctrl+V)
>> 3. Cursor changes. Now select origin by clicking.
>> 4. Elements are now moving along with constant offset to cursor
>> 5. Move to destination and click again (cursor might be snapping to
>> grid) to paste elements
>>
>>
>>
>> Am 17.09.2017 um 19:56 schrieb Kristoffer Ödmark:
>>> Thanks for taking the time to test this, I know testing takes time!
>>>
>>> I took a look at some of the things you mentioned.
>>>
>>>  - I fixed menu entries
>>>  - I changed some names of functions ( still kept appendFromClipboard,
>>> but made the action called pasteFromClipboard )
>>>  - Footprints now render correctly
>>>  - Added Cut functionality ( not thoroughly tested, just chained a
>>> copyToClipboard and then a EDIT_TOOL::Remove action after that
>>>
>>> I am a bit unsure about how to proceed with the reference point you
>>> mentioned, but I think I understand what you want there.
>>>
>>> Please have a look when appropriate, I rather not have to update the
>>> entire branch in a few months though
>>>
>>> - Kristoffer
>>>
>>> On 09/17/2017 05:33 PM, Tomasz Wlostowski wrote:
>>>> On 17.09.2017 17:06, Kristoffer Ödmark wrote:
>>>>> Hey again, I needed this feature again when copying some tedious
>>>>> silkscreen drawings that I have not made into a footprint.
>>>>>
>>>>> Updated my branch to fit into master. I do agree that adding context
>>>>> menu entries should be done, but I do not feel it necessary for merging
>>>>> this unless any other bugs are found.
>>>>
>>>> Hi Kristoffer,
>>>>
>>>> I tried your patch and I would really love to merge it after some
>>>> polishing up. Few observations below:
>>>> - Menu items are necessary. I consider the feature incomplete if it can
>>>> be only invoked by a keyboard shortcut. We have a lot of users
>>>> complaining that some functions can be only accessed by shortcuts, why
>>>> add another item to their list of complaints?
>>>> - Missing 'Cut' function (Ctrl-X). If we are to add copy-paste, it
>>>> should work as in every other program.
>>>> - Name internal events/actions correspondingly to the actions visible in
>>>> the menus (e.g. copyToClipboard, pasteFromClipboard, etc.), using names
>>>> like appendFromClipboard, etc. is IMHO confusing.
>>>> - It would be useful to let the user select a reference point with a
>>>> mouse when copying/cutting items. This point would become attached to
>>>> the mouse cursor when the items are being pasted.
>>>> - While pasting a footprint, it only appears when you click LMB. Other
>>>> items are displayed while moving the mouse in paste mode.
>>>>
>>>> Cheers,
>>>> Tom
>>>>
>>>>
>>>>
>>>>>
>>>>> I am unsure what you mean with netlist-path. If that is that the
>>>>> timestamp or unique identifier is not there, then from what i gather
>>>>> that is the same as manually adding a component in pcbnew.
>>>>>
>>>>> - Kristoffer
>>>>>
>>>>> On 06/23/2017 07:00 PM, Wayne Stambaugh wrote:
>>>>>> Kristoffer,
>>>>>>
>>>>>> I finally had a chance to test this and it seems to work fine.  You
>>>>>> definitely need to add copy and paste to the context menu and probably
>>>>>> to the main menu as well.  While ctrl-c and ctrl-v are will known,
>>>>>> Pcbnew has never had a copy and paste feature so it may be wise to add
>>>>>> the menu entries for existing users.  The only issue I see is that the
>>>>>> netlist path is empty so I'm not sure how the this will effect the
>>>>>> ratsnest and connectivity algorithms.  I'm OK with it as long as no one
>>>>>> else objects.
>>>>>>
>>>>>> Orson,
>>>>>>
>>>>>> would you please take a look at this when you get a chance to see if
>>>>>> this makes sense as far as the tool framework goes.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Wayne
>>>>>>
>>>>>> On 5/21/2017 4:32 PM, Kristoffer Ödmark wrote:
>>>>>>> Hello!
>>>>>>>
>>>>>>> I fixed the kicad clipboard code according to your comments, it is now
>>>>>>> linked to ctrl+c and ctrl+v, utilizing different code paths
>>>>>>> depending on
>>>>>>> what frame they are invoked at.
>>>>>>>
>>>>>>> I also fixed the crashes when trying to paste strange stuff.
>>>>>>>
>>>>>>> The code is available for testing at:
>>>>>>>     
>>>>>>> https://code.launchpad.net/~kristoffer-odmark/kicad/+git/kicad/+ref/copypasta
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> One thing is missing since I am unsure how to proceed,
>>>>>>> the context menu entries.
>>>>>>>
>>>>>>> Should I create a new clipboard_tool.cpp/h file and add context
>>>>>>> entries
>>>>>>> from there?
>>>>>>>
>>>>>>> Should I add the context entries in the files where they are now?
>>>>>>> ( selection menu for copying to clipboard, pcbnew_control for pasting,
>>>>>>> module editor tool for pasting in module editor )
>>>>>>>
>>>>>>> Should I do it someway enterily different?
>>>>>>>
>>>>>>> Please advice
>>>>>>>
>>>>>>> - Kristoffer
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 2017-05-08 15:41, Maciej Sumiński wrote:
>>>>>>>> Hi Kristoffer,
>>>>>>>>
>>>>>>>> It is a neat feature. Your application is a good application, but I
>>>>>>>> think it would really shine in the footprint editor.
>>>>>>>> Unfortunately, it
>>>>>>>> crashes when I tried to copy and paste a bunch of pads. Could you
>>>>>>>> check it?
>>>>>>>>
>>>>>>>> IMHO it would be better to keep standard Ctrl+C and Ctrl+V hot
>>>>>>>> keys, as
>>>>>>>> this is what people are likely to press when they want to copy or
>>>>>>>> paste
>>>>>>>> items. These two functions also deserve an entry in the right-click
>>>>>>>> context menu. Let's not add more hidden features in KiCad.
>>>>>>>>
>>>>>>>> Speaking of which, you can also have a look at
>>>>>>>> MODULE_EDITOR_TOOLS::{Copy,Paste}Items()
>>>>>>>> (pcbnew/tools/module_editor_tools.cpp). Yes, you guessed it -
>>>>>>>> there was
>>>>>>>> already copy & paste for the module editor, but it was not properly
>>>>>>>> exposed, mea culpa. We need to pick one way, and remove the other.
>>>>>>>>
>>>>>>>> There are also some code formatting violations that also should be
>>>>>>>> handled before merging the patch. Tools like uncrustify or
>>>>>>>> clang-format
>>>>>>>> will do most of the boring work for you.
>>>>>>>>
>>>>>>>> If we decide to choose your way, then you need to add GPL license
>>>>>>>> header
>>>>>>>> for kicad_clipboard.{cpp,h} too.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Orson
>>>>>>>>
>>>>>>>> On 05/04/2017 10:40 AM, Kristoffer Ödmark wrote:
>>>>>>>>> Hello all!
>>>>>>>>>
>>>>>>>>> Last night I was doing some design that used a PCB antenna. I had
>>>>>>>>> this
>>>>>>>>> antenna design made in zones, It was very frustrating to try to copy
>>>>>>>>> this between an old design and a new one since I had to use a
>>>>>>>>> texteditor
>>>>>>>>> ( very glad that I could though ).
>>>>>>>>>
>>>>>>>>> After this I figured that this should be able to be copy-pasted
>>>>>>>>> between
>>>>>>>>> pcbs.
>>>>>>>>>
>>>>>>>>> So I have now implemented a subclass of the PCB_IO, that can
>>>>>>>>> format an
>>>>>>>>> entire board or a selection to the clipboard in textformat, and then
>>>>>>>>> created a subclass to the PCB_PARSER that parses from the clipboard
>>>>>>>>> and
>>>>>>>>> reuses the "append board" functionality to add them back. It also
>>>>>>>>> does
>>>>>>>>> remove the "path" properties of modules. This allows me to
>>>>>>>>> copy-paste
>>>>>>>>> things between different PCBs in kicad. The shortcut keys are
>>>>>>>>> ctrl+shift+c and ctrl+shift+v so that people dont use this by
>>>>>>>>> mistake :)
>>>>>>>>>
>>>>>>>>> I think that this might be useful for reusing designs in some
>>>>>>>>> manner,
>>>>>>>>> and if this is in Kicad, my next step would be to start looking into
>>>>>>>>> some tool to link the pasted modules to symbols in the schematic.
>>>>>>>>>
>>>>>>>>> Give me some insight on what you think about this please :)
>>>>>>>>>
>>>>>>>>> video: https://youtu.be/4SuUzma0Ua4
>>>>>>>>>
>>>>>>>>> (only tested in linux)
>>>>>>>>>
>>>>>>>>> - Kristoffer
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References