Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-25 Thread Kristoffer Ödmark

Hi tom!

I took a look at your branch and your changes are a lot more smooth than 
mine, I went back to your implementation and added the net propagation 
stuff, they did indeed crash kicad when copying between different PCBs. 
How should I submit this patch to you?


Also, I think that we should think how we should address the situation 
proper, since if we copy from a pcb with 4 layers to a pcb with 2 
layers. What would be the correct way?


Personally I think that warning the user with a dialog if extra layers 
are going to be added, explaining that extra layers will be added is the 
correct way of doing this. But when doing this, this [1] bug must be 
addressed, since it will become more problematic with copy-pasting.


[1] https://bugs.launchpad.net/kicad/+bug/893950

My attached patch makes applies on top of your changes tom.

 -Kristoffer

On 09/25/2017 11:46 AM, Tomasz Wlostowski wrote:

On 25.09.2017 10:03, Kristoffer Ödmark wrote:

Maybe I could get access to the work you have done and cherry pick
patches from there, or just test it and see the difference?


Hi,

Sorry, I totally forgot to send you the link:

https://github.com/twlostow/kicad-dev/tree/tom-copypasta

Tom



- Kristoffer

On 09/25/2017 01:15 AM, Kristoffer Ödmark wrote:

On 09/25/2017 12:21 AM, Tomasz Wlostowski wrote:


Hi Kristoffer,

I've had some time to work on your code during the past few days (I
wasn't aware you're still improving it). I fixed the crashes, refactored
placement of pasted items, fixed the zone refill issue, added snapping
to item's anchors and selection of a reference point.


I was not sure that I would find time to improve the code myself.
I fixed the crashes, and refactored the placement, and fixed the
zone-refill aswell.

The adding of a reference point I assume are all on the copy-side of
the code, I have not changed that one in a while so that could be
merged to either one of our branches


The only outstanding bug I'm aware of is with net code propagation (not
updated after pasting items).

I am not sure what you mean here? I add all the nets that are not
existing on the current board and that are used by the imported items,
I add them as new nets on the current board ( by creating a
NETINFO_ITEM with -1 as netcode and adding it )
pcbnew_control.cpp:847-860 in my branch for an example of how. And it
seems to work.



How do you want to proceed with this? I'd like to merge the copy
feature as soon as possible.

I would also like the functionality merged as soon as possible and
although it is unfortunate that we have now done some duplicate work,
it seems you have made some more improvements than me. Merge what you
seem fit.



Best,
Tom





>From 441e4d499b9b5c32583ef909c98ebccde383f058 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= 
Date: Mon, 25 Sep 2017 23:37:59 +0200
Subject: [PATCH] Propagate nets and layers when moving from one layer to the
 other

---
 pcbnew/tools/pcbnew_control.cpp | 60 +
 1 file changed, 60 insertions(+)

diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp
index ff9248645..34d0d0dbe 100644
--- a/pcbnew/tools/pcbnew_control.cpp
+++ b/pcbnew/tools/pcbnew_control.cpp
@@ -835,14 +835,56 @@ int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent )
 int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard )
 {
 std::vector items;
+auto currentBoard = board();
+
+PCB_EDIT_FRAME* editFrame = dynamic_cast( m_frame );
+
+if( currentBoard->GetCopperLayerCount() < aBoard->GetCopperLayerCount() )
+{
+
+if( !IsOK( editFrame, _( "Pasting will add extra layers to the PCB, continue? ") ) )
+return 0;
+
+currentBoard->SetCopperLayerCount( aBoard->GetCopperLayerCount() );
+currentBoard->SetEnabledLayers( aBoard->GetEnabledLayers() );
+
+editFrame->ReCreateLayerBox();
+editFrame->ReFillLayerWidget();
+}
 
 for( auto track : aBoard->Tracks() )
 {
+if( !currentBoard->FindNet( track->GetNetname() ) )
+{
+NETINFO_ITEM* newNet = new NETINFO_ITEM( currentBoard,
+track->GetNet()->GetNetname(), -1 );
+currentBoard->Add( newNet );
+currentBoard->BuildListOfNets();
+}
+track->SetParent( currentBoard );
+track->SetNet( currentBoard->FindNet( track->GetNetname()) );
 items.push_back( track );
 }
 
 for( auto module : aBoard->Modules() )
 {
+module->SetParent( currentBoard );
+for( auto pad : module->Pads() )
+{
+// Check if the net is there by name, otherwise, add a new net and
+// reassign the item to the new net
+if( !currentBoard->FindNet( pad->GetNet()->GetNetname() ) )
+{
+// A net with -1 in netcode will be autoassigned a net
+NETINFO_ITEM* newNet = new 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-25 Thread Kristoffer Ödmark
Unfortunately I cannot test this at work. But I took a look at the diff 
between what I had made in the and your additions.


Are you no longer using the pi.Load() function to append the items from 
the clipboard? From where I am looking it looks this way. This is good. 
Same thing I did in my branch, but your implementation is cleaner.


Although, I think I get the problem with netcode propagation. I cannot 
seem to find that you are adding the new nets that are transfered. Since 
I cannot test, I suspect that this will cause segfaults when copying 
between boards with different number/names of nets. I tested this by 
copying from one of the beaglebone projects into the complex-hierarchy.


Allinall from what I can see, this is a cleaner implemenentation of what 
I did, I wish I had written it :D If you merge this into master, I can 
submit a patch for the netcode propagation I am using, or you can do it, 
doesnt really matter to me.


I Will test it when I get the time! Either during the weekend or some 
evening here.


- Kristoffer



On 09/25/2017 11:46 AM, Tomasz Wlostowski wrote:

On 25.09.2017 10:03, Kristoffer Ödmark wrote:

Maybe I could get access to the work you have done and cherry pick
patches from there, or just test it and see the difference?


Hi,

Sorry, I totally forgot to send you the link:

https://github.com/twlostow/kicad-dev/tree/tom-copypasta

Tom



- Kristoffer

On 09/25/2017 01:15 AM, Kristoffer Ödmark wrote:

On 09/25/2017 12:21 AM, Tomasz Wlostowski wrote:


Hi Kristoffer,

I've had some time to work on your code during the past few days (I
wasn't aware you're still improving it). I fixed the crashes, refactored
placement of pasted items, fixed the zone refill issue, added snapping
to item's anchors and selection of a reference point.


I was not sure that I would find time to improve the code myself.
I fixed the crashes, and refactored the placement, and fixed the
zone-refill aswell.

The adding of a reference point I assume are all on the copy-side of
the code, I have not changed that one in a while so that could be
merged to either one of our branches


The only outstanding bug I'm aware of is with net code propagation (not
updated after pasting items).

I am not sure what you mean here? I add all the nets that are not
existing on the current board and that are used by the imported items,
I add them as new nets on the current board ( by creating a
NETINFO_ITEM with -1 as netcode and adding it )
pcbnew_control.cpp:847-860 in my branch for an example of how. And it
seems to work.



How do you want to proceed with this? I'd like to merge the copy
feature as soon as possible.

I would also like the functionality merged as soon as possible and
although it is unfortunate that we have now done some duplicate work,
it seems you have made some more improvements than me. Merge what you
seem fit.



Best,
Tom







--
 -Kristoffer

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-25 Thread Tomasz Wlostowski
On 25.09.2017 10:03, Kristoffer Ödmark wrote:
> Maybe I could get access to the work you have done and cherry pick
> patches from there, or just test it and see the difference?

Hi,

Sorry, I totally forgot to send you the link:

https://github.com/twlostow/kicad-dev/tree/tom-copypasta

Tom

> 
> - Kristoffer
> 
> On 09/25/2017 01:15 AM, Kristoffer Ödmark wrote:
>> On 09/25/2017 12:21 AM, Tomasz Wlostowski wrote:
>>
>>> Hi Kristoffer,
>>>
>>> I've had some time to work on your code during the past few days (I
>>> wasn't aware you're still improving it). I fixed the crashes, refactored
>>> placement of pasted items, fixed the zone refill issue, added snapping
>>> to item's anchors and selection of a reference point.
>>
>> I was not sure that I would find time to improve the code myself.
>> I fixed the crashes, and refactored the placement, and fixed the
>> zone-refill aswell.
>>
>> The adding of a reference point I assume are all on the copy-side of
>> the code, I have not changed that one in a while so that could be
>> merged to either one of our branches
>>>
>>> The only outstanding bug I'm aware of is with net code propagation (not
>>> updated after pasting items).
>> I am not sure what you mean here? I add all the nets that are not
>> existing on the current board and that are used by the imported items,
>> I add them as new nets on the current board ( by creating a
>> NETINFO_ITEM with -1 as netcode and adding it )
>> pcbnew_control.cpp:847-860 in my branch for an example of how. And it
>> seems to work.
>>
>>>
>>> How do you want to proceed with this? I'd like to merge the copy
>>> feature as soon as possible.
>> I would also like the functionality merged as soon as possible and
>> although it is unfortunate that we have now done some duplicate work,
>> it seems you have made some more improvements than me. Merge what you
>> seem fit.
>>
>>>
>>> Best,
>>> Tom
>>>
> 


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-24 Thread Kristoffer Ödmark

On 09/25/2017 12:21 AM, Tomasz Wlostowski wrote:


Hi Kristoffer,

I've had some time to work on your code during the past few days (I
wasn't aware you're still improving it). I fixed the crashes, refactored
placement of pasted items, fixed the zone refill issue, added snapping
to item's anchors and selection of a reference point.


I was not sure that I would find time to improve the code myself.
I fixed the crashes, and refactored the placement, and fixed the 
zone-refill aswell.


The adding of a reference point I assume are all on the copy-side of the 
code, I have not changed that one in a while so that could be merged to 
either one of our branches


The only outstanding bug I'm aware of is with net code propagation (not
updated after pasting items).
I am not sure what you mean here? I add all the nets that are not 
existing on the current board and that are used by the imported items, I 
add them as new nets on the current board ( by creating a NETINFO_ITEM 
with -1 as netcode and adding it ) pcbnew_control.cpp:847-860 in my 
branch for an example of how. And it seems to work.




How do you want to proceed with this? I'd like to merge the copy
feature as soon as possible.
I would also like the functionality merged as soon as possible and 
although it is unfortunate that we have now done some duplicate work, it 
seems you have made some more improvements than me. Merge what you seem fit.




Best,
Tom



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-24 Thread Tomasz Wlostowski
On 24.09.2017 19:44, Kristoffer Ödmark wrote:
> I just pushed a larger change for this patch. Before the items was
> always added to the board on paste, even if the user aborted the action.
> This resulted in duplicate items stuck on the board since they were
> pasted directly to the same position, making it easy to miss and would
> be tedious to clean up at a later time.
> 
> Now, when pasting and pressing escape to abort. The items pasted will
> not be added to the board. This is a rewrite of the appendBoard stuff
> with a few changes.
> 
> Please try to crash it.
> 
> The code is available for testing at:
> 
> https://code.launchpad.net/~kristoffer-odmark/kicad/+git/kicad/+ref/copypasta
> 
> 
Hi Kristoffer,

I've had some time to work on your code during the past few days (I
wasn't aware you're still improving it). I fixed the crashes, refactored
placement of pasted items, fixed the zone refill issue, added snapping
to item's anchors and selection of a reference point.

The only outstanding bug I'm aware of is with net code propagation (not
updated after pasting items).

How do you want to proceed with this? I'd like to merge the copy
feature as soon as possible.

Best,
Tom


> 
> On 09/19/2017 01:12 AM, Kristoffer Ödmark wrote:
>> Thank you Tomasz!
>>
>> That was most likely the error, I cannot reproduce the crash after
>> fixing so that I do not modify the existing board!
>>
>> I updated the branch, now bed for me!
>>
>> - Kristofffer
>>
>> On 09/18/2017 11:54 PM, Tomasz Wlostowski wrote:
>>> On 18.09.2017 22:37, Kristoffer Ödmark wrote:
 I have made almost no changes as of yet. Just trying to figure out what
 causes the crash.
>>>
>>> Hi,
>>>
>>> Looking at kicad_clipboard.cpp:
>>>
>>> // only a module selected.
>>>  if( aSelected.Size() == 1 && aSelected.Front()->Type() ==
>>> PCB_MODULE_T )
>>>  {
>>>  // make the module safe to transfer to other pcbs
>>>  MODULE* mod = static_cast( aSelected.Front() );
>>>  for( D_PAD* pad = mod->PadsList().begin(); pad; pad =
>>> pad->Next() )
>>>  {
>>>  pad->SetNetCode( 0,0 );
>>>  }
>>>
>>>  Format(static_cast( mod ) );
>>>  }
>>>
>>> Why are you modifying the net codes of the items owned by the BOARD
>>> class here? Shouldn't this be performed on a copy that to be formatted
>>> for the clipboard? I noticed you're creating a stack MODULE object a few
>>> lines up, but you're not using it in this particular case, could this be
>>> the problem?
>>>
>>> Tom
>>>
>>>
>>>

 I noticed in pcbnew/tools/edit_tool.cpp cutToClipboard that the method
 does not cause a crash If i only run on of the two method calls in it.
 Doesnt matter which one I remove, I also noticed that the crash is due
 to a CN_ANCHOR not being valid.

 #4  0x7fffe5cd1ab3 in CN_ANCHOR::Parent (this=0x588178a0) at
 /home/krille/projects/kicad/pcbnew/connectivity_algo.cpp:924
 924    assert( m_item->Valid() );
 (gdb) p *m_item
 $1 = { = {m_count = 1484021408, m_prev =
 0x67006e, m_next = 0x220020, m_root = 0x6c0025},
 _vptr.CN_ITEM = 0x5753f9c0, m_parent = 0x220073, m_connected =
 std::vector of length -40802189302, capacity 1610612745 = {>>> reading variable>


 On 09/18/2017 09:44 PM, Tomasz Wlostowski wrote:
> On 18.09.2017 21:18, Kristoffer Ödmark wrote:
>> I cannot reproduce the crash on copying, I can however crash it on
>> the
>> Cut functionality, I am at a total loss as to why though.
>>
>> I noticed that the crash does not happen if one hides the board
>> ratsnest, but it will later crash when trying to re-enable the
>> ratsnest.
>>
>> Can someone maybe help shed some light on this?
> Push the latest code, if it's ratsnest-related, I might have a look.
>
> Tom
>>
>> On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:
>>> On 18.09.2017 12:57, Kristoffer Ödmark wrote:
 Hmm, I cannot manage to reproduce the crash.

 The things you are testing on, is the components pasted in using an
 earlier version?

>>> Hi Kristoffer,
>>>
>>> Open the attached board, select P19 (connector on the right side)
>>> and
>>> press Ctrl-C. A segfault will occur (at least on my machine) -
>>> release
>>> x86_64 build.
>>>
>>> PS. Why all the zones are refilled after pasting something? Is this
>>> intentional?
>>>
>>> Tom
>>>
>>
>

>>>


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Kristoffer Ödmark

Thank you Tomasz!

That was most likely the error, I cannot reproduce the crash after 
fixing so that I do not modify the existing board!


I updated the branch, now bed for me!

- Kristofffer

On 09/18/2017 11:54 PM, Tomasz Wlostowski wrote:

On 18.09.2017 22:37, Kristoffer Ödmark wrote:

I have made almost no changes as of yet. Just trying to figure out what
causes the crash.


Hi,

Looking at kicad_clipboard.cpp:

// only a module selected.
 if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_MODULE_T )
 {
 // make the module safe to transfer to other pcbs
 MODULE* mod = static_cast( aSelected.Front() );
 for( D_PAD* pad = mod->PadsList().begin(); pad; pad = pad->Next() )
 {
 pad->SetNetCode( 0,0 );
 }

 Format(static_cast( mod ) );
 }

Why are you modifying the net codes of the items owned by the BOARD
class here? Shouldn't this be performed on a copy that to be formatted
for the clipboard? I noticed you're creating a stack MODULE object a few
lines up, but you're not using it in this particular case, could this be
the problem?

Tom





I noticed in pcbnew/tools/edit_tool.cpp cutToClipboard that the method
does not cause a crash If i only run on of the two method calls in it.
Doesnt matter which one I remove, I also noticed that the crash is due
to a CN_ANCHOR not being valid.

#4  0x7fffe5cd1ab3 in CN_ANCHOR::Parent (this=0x588178a0) at
/home/krille/projects/kicad/pcbnew/connectivity_algo.cpp:924
924    assert( m_item->Valid() );
(gdb) p *m_item
$1 = { = {m_count = 1484021408, m_prev =
0x67006e, m_next = 0x220020, m_root = 0x6c0025},
_vptr.CN_ITEM = 0x5753f9c0, m_parent = 0x220073, m_connected =
std::vector of length -40802189302, capacity 1610612745 = {


On 09/18/2017 09:44 PM, Tomasz Wlostowski wrote:

On 18.09.2017 21:18, Kristoffer Ödmark wrote:

I cannot reproduce the crash on copying, I can however crash it on the
Cut functionality, I am at a total loss as to why though.

I noticed that the crash does not happen if one hides the board
ratsnest, but it will later crash when trying to re-enable the ratsnest.

Can someone maybe help shed some light on this?

Push the latest code, if it's ratsnest-related, I might have a look.

Tom


On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:

On 18.09.2017 12:57, Kristoffer Ödmark wrote:

Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an
earlier version?


Hi Kristoffer,

Open the attached board, select P19 (connector on the right side) and
press Ctrl-C. A segfault will occur (at least on my machine) - release
x86_64 build.

PS. Why all the zones are refilled after pasting something? Is this
intentional?

Tom











___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Tomasz Wlostowski
On 18.09.2017 22:37, Kristoffer Ödmark wrote:
> I have made almost no changes as of yet. Just trying to figure out what
> causes the crash.

Hi,

Looking at kicad_clipboard.cpp:

// only a module selected.
if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_MODULE_T )
{
// make the module safe to transfer to other pcbs
MODULE* mod = static_cast( aSelected.Front() );
for( D_PAD* pad = mod->PadsList().begin(); pad; pad = pad->Next() )
{
pad->SetNetCode( 0,0 );
}

Format(static_cast( mod ) );
}

Why are you modifying the net codes of the items owned by the BOARD
class here? Shouldn't this be performed on a copy that to be formatted
for the clipboard? I noticed you're creating a stack MODULE object a few
lines up, but you're not using it in this particular case, could this be
the problem?

Tom



> 
> I noticed in pcbnew/tools/edit_tool.cpp cutToClipboard that the method
> does not cause a crash If i only run on of the two method calls in it.
> Doesnt matter which one I remove, I also noticed that the crash is due
> to a CN_ANCHOR not being valid.
> 
> #4  0x7fffe5cd1ab3 in CN_ANCHOR::Parent (this=0x588178a0) at
> /home/krille/projects/kicad/pcbnew/connectivity_algo.cpp:924
> 924    assert( m_item->Valid() );
> (gdb) p *m_item
> $1 = { = {m_count = 1484021408, m_prev =
> 0x67006e, m_next = 0x220020, m_root = 0x6c0025},
> _vptr.CN_ITEM = 0x5753f9c0, m_parent = 0x220073, m_connected =
> std::vector of length -40802189302, capacity 1610612745 = { reading variable>
> 
> 
> On 09/18/2017 09:44 PM, Tomasz Wlostowski wrote:
>> On 18.09.2017 21:18, Kristoffer Ödmark wrote:
>>> I cannot reproduce the crash on copying, I can however crash it on the
>>> Cut functionality, I am at a total loss as to why though.
>>>
>>> I noticed that the crash does not happen if one hides the board
>>> ratsnest, but it will later crash when trying to re-enable the ratsnest.
>>>
>>> Can someone maybe help shed some light on this?
>> Push the latest code, if it's ratsnest-related, I might have a look.
>>
>> Tom
>>>
>>> On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:
 On 18.09.2017 12:57, Kristoffer Ödmark wrote:
> Hmm, I cannot manage to reproduce the crash.
>
> The things you are testing on, is the components pasted in using an
> earlier version?
>
 Hi Kristoffer,

 Open the attached board, select P19 (connector on the right side) and
 press Ctrl-C. A segfault will occur (at least on my machine) - release
 x86_64 build.

 PS. Why all the zones are refilled after pasting something? Is this
 intentional?

 Tom

>>>
>>
> 


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Kristoffer Ödmark
I have made almost no changes as of yet. Just trying to figure out what 
causes the crash.


I noticed in pcbnew/tools/edit_tool.cpp cutToClipboard that the method 
does not cause a crash If i only run on of the two method calls in it. 
Doesnt matter which one I remove, I also noticed that the crash is due 
to a CN_ANCHOR not being valid.


#4  0x7fffe5cd1ab3 in CN_ANCHOR::Parent (this=0x588178a0) at 
/home/krille/projects/kicad/pcbnew/connectivity_algo.cpp:924

924 assert( m_item->Valid() );
(gdb) p *m_item
$1 = { = {m_count = 1484021408, m_prev = 
0x67006e, m_next = 0x220020, m_root = 0x6c0025}, 
_vptr.CN_ITEM = 0x5753f9c0, m_parent = 0x220073, m_connected = 
std::vector of length -40802189302, capacity 1610612745 = {reading variable>



On 09/18/2017 09:44 PM, Tomasz Wlostowski wrote:

On 18.09.2017 21:18, Kristoffer Ödmark wrote:

I cannot reproduce the crash on copying, I can however crash it on the
Cut functionality, I am at a total loss as to why though.

I noticed that the crash does not happen if one hides the board
ratsnest, but it will later crash when trying to re-enable the ratsnest.

Can someone maybe help shed some light on this?

Push the latest code, if it's ratsnest-related, I might have a look.

Tom


On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:

On 18.09.2017 12:57, Kristoffer Ödmark wrote:

Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an
earlier version?


Hi Kristoffer,

Open the attached board, select P19 (connector on the right side) and
press Ctrl-C. A segfault will occur (at least on my machine) - release
x86_64 build.

PS. Why all the zones are refilled after pasting something? Is this
intentional?

Tom







___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Tomasz Wlostowski
On 18.09.2017 21:18, Kristoffer Ödmark wrote:
> I cannot reproduce the crash on copying, I can however crash it on the
> Cut functionality, I am at a total loss as to why though.
> 
> I noticed that the crash does not happen if one hides the board
> ratsnest, but it will later crash when trying to re-enable the ratsnest.
> 
> Can someone maybe help shed some light on this?
Push the latest code, if it's ratsnest-related, I might have a look.

Tom
> 
> On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:
>> On 18.09.2017 12:57, Kristoffer Ödmark wrote:
>>> Hmm, I cannot manage to reproduce the crash.
>>>
>>> The things you are testing on, is the components pasted in using an
>>> earlier version?
>>>
>> Hi Kristoffer,
>>
>> Open the attached board, select P19 (connector on the right side) and
>> press Ctrl-C. A segfault will occur (at least on my machine) - release
>> x86_64 build.
>>
>> PS. Why all the zones are refilled after pasting something? Is this
>> intentional?
>>
>> Tom
>>
> 


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Kristoffer Ödmark
I cannot reproduce the crash on copying, I can however crash it on the 
Cut functionality, I am at a total loss as to why though.


I noticed that the crash does not happen if one hides the board 
ratsnest, but it will later crash when trying to re-enable the ratsnest.


Can someone maybe help shed some light on this?

On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:

On 18.09.2017 12:57, Kristoffer Ödmark wrote:

Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an
earlier version?


Hi Kristoffer,

Open the attached board, select P19 (connector on the right side) and
press Ctrl-C. A segfault will occur (at least on my machine) - release
x86_64 build.

PS. Why all the zones are refilled after pasting something? Is this
intentional?

Tom



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Kristoffer Ödmark

Thank you! I will take a look at that PCB when I get home from work.

The refill zones is probably only one of the few quirks that comes with 
the fact that I am piggybacking on the appendBoard function.


This is the broad flow:

I wrapped/inherited the real parser and redirected the output/input into 
the the clipboard. This way I will not have to rewrite the parsing code 
when the file format changes, it will follow the regular file parsing.


The copy tool checks if the selected items are only module parts or 
mixed. If they are mixed it fakes a new pcb in the clipboard, otherwise 
it creates a new module in the clipboard.


I then use same parser when pasting, swithcing on the result of the 
parsed objects type


type = module, invoke the add part tool
type = pcb, invoke the appendBoard.

So to make a very long answer short, the appendBoard probably redraws 
the zones, and I have not checked why.


On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:

On 18.09.2017 12:57, Kristoffer Ödmark wrote:

Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an
earlier version?


Hi Kristoffer,

Open the attached board, select P19 (connector on the right side) and
press Ctrl-C. A segfault will occur (at least on my machine) - release
x86_64 build.

PS. Why all the zones are refilled after pasting something? Is this
intentional?

Tom



--
 -Kristoffer

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Kristoffer Ödmark

Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an 
earlier version?


On 09/18/2017 11:19 AM, Tomasz Wlostowski wrote:

On 18.09.2017 00:32, Kristoffer Ödmark wrote:

That being said, I dont like the way the ref.pt is set now either, which
is not at all. Personally I would like have the components added at the
point of the cursor, but I also believe having a copy functionality that
is not perfect as of now is better than none at all.


Hi Kristoffer,

Some more comments (after your most recent patches):
- if you select a single module on a PCB and try to copy/paste it, it
sometimes crashes (see attached trace)
- call the actions Cut/Copy/Paste, just like any other app.
- there's no Cut/Copy/Paste in the Edit menu.

Cheers,
Tom


0x7fffdec60136 in KIGFX::RATSNEST_VIEWITEM::ViewDraw(int,
KIGFX::VIEW*) const () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
(gdb) bt
#0  0x7fffdec60136 in KIGFX::RATSNEST_VIEWITEM::ViewDraw(int,
KIGFX::VIEW*) const () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#1  0x7fffdee24d00 in
KIGFX::VIEW::drawItem::operator()(KIGFX::VIEW_ITEM*) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#2  0x7fffdee24c00 in bool RTree::Search(RTree::Node*, RTree::Rect*, KIGFX::VIEW::drawItem&, int&) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#3  0x7fffdee20237 in KIGFX::VIEW::redrawRect(BOX2
const&) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#4  0x7fffdee20a85 in KIGFX::VIEW::Redraw() () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#5  0x7fffdee90716 in EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) ()
from /home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#6  0x76466bfe in
wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&,
wxEvent&) const () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7  0x765da032 in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8  0x765da396 in
wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9  0x765da41e in wxEvtHandler::TryHereOnly(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x765da4b3 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x765da515 in wxEvtHandler::ProcessEvent(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#12 0x765db533 in wxEvtHandler::ProcessPendingEvents() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#13 0x7646a7b7 in wxAppConsoleBase::ProcessPendingEvents() ()
from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x76d2ad82 in wxApp::DoIdle() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#15 0x76d2ae93 in ?? () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#16 0x71df6ce5 in g_main_context_dispatch () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x71df7048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x71df730a in g_main_loop_run () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x72b53447 in gtk_main () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x76d3dab5 in wxGUIEventLoop::DoRun() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#21 0x764a9d70 in wxEventLoopBase::Run() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#22 0x76468cdd in wxAppConsoleBase::MainLoop() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0


-

I do not have the time currently to look into the ref.pt properly.


On 09/17/2017 11:30 PM, Kristoffer Ödmark wrote:

I hope that the branch can be merged as is, and that the reference
point can be marked as a wishlist.

I will think about the reference point. I do not know if I like the
extra step of adding a reference point compared to having it set
automatically.

On Sep 17, 2017 22:38, "Tomasz Wlostowski" > wrote:

     On 17.09.2017 19:56, Kristoffer Ödmark wrote:
  > 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 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-18 Thread Tomasz Wlostowski
On 18.09.2017 00:32, Kristoffer Ödmark wrote:
> That being said, I dont like the way the ref.pt is set now either, which
> is not at all. Personally I would like have the components added at the
> point of the cursor, but I also believe having a copy functionality that
> is not perfect as of now is better than none at all.
> 
Hi Kristoffer,

Some more comments (after your most recent patches):
- if you select a single module on a PCB and try to copy/paste it, it
sometimes crashes (see attached trace)
- call the actions Cut/Copy/Paste, just like any other app.
- there's no Cut/Copy/Paste in the Edit menu.

Cheers,
Tom


0x7fffdec60136 in KIGFX::RATSNEST_VIEWITEM::ViewDraw(int,
KIGFX::VIEW*) const () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
(gdb) bt
#0  0x7fffdec60136 in KIGFX::RATSNEST_VIEWITEM::ViewDraw(int,
KIGFX::VIEW*) const () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#1  0x7fffdee24d00 in
KIGFX::VIEW::drawItem::operator()(KIGFX::VIEW_ITEM*) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#2  0x7fffdee24c00 in bool RTree::Search(RTree::Node*, RTree::Rect*, KIGFX::VIEW::drawItem&, int&) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#3  0x7fffdee20237 in KIGFX::VIEW::redrawRect(BOX2
const&) () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#4  0x7fffdee20a85 in KIGFX::VIEW::Redraw() () from
/home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#5  0x7fffdee90716 in EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) ()
from /home/twl/Kicad-dev/kicad-build/release/pcbnew/_pcbnew.kiface
#6  0x76466bfe in
wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&,
wxEvent&) const () from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#7  0x765da032 in
wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#8  0x765da396 in
wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9  0x765da41e in wxEvtHandler::TryHereOnly(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 0x765da4b3 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#11 0x765da515 in wxEvtHandler::ProcessEvent(wxEvent&) () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#12 0x765db533 in wxEvtHandler::ProcessPendingEvents() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#13 0x7646a7b7 in wxAppConsoleBase::ProcessPendingEvents() ()
from /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#14 0x76d2ad82 in wxApp::DoIdle() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#15 0x76d2ae93 in ?? () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#16 0x71df6ce5 in g_main_context_dispatch () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x71df7048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x71df730a in g_main_loop_run () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x72b53447 in gtk_main () from
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x76d3dab5 in wxGUIEventLoop::DoRun() () from
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#21 0x764a9d70 in wxEventLoopBase::Run() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#22 0x76468cdd in wxAppConsoleBase::MainLoop() () from
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0


-
> I do not have the time currently to look into the ref.pt properly.
> 
> 
> On 09/17/2017 11:30 PM, Kristoffer Ödmark wrote:
>> I hope that the branch can be merged as is, and that the reference
>> point can be marked as a wishlist.
>>
>> I will think about the reference point. I do not know if I like the
>> extra step of adding a reference point compared to having it set
>> automatically.
>>
>> On Sep 17, 2017 22:38, "Tomasz Wlostowski" > > wrote:
>>
>>     On 17.09.2017 19:56, Kristoffer Ödmark wrote:
>>  > 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.
>>  

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Kristoffer Ödmark
I hope that the branch can be merged as is, and that the reference point
can be marked as a wishlist.

I will think about the reference point. I do not know if I like the extra
step of adding a reference point compared to having it set automatically.

On Sep 17, 2017 22:38, "Tomasz Wlostowski" 
wrote:

On 17.09.2017 19:56, Kristoffer Ödmark wrote:
> 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.
>
Hi Kristoffer,

Thanks for your quick reaction. I agree with Simon's proposal concerning
the reference point.

Thx,
Tom
> 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 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Tomasz Wlostowski
On 17.09.2017 19:56, Kristoffer Ödmark wrote:
> 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.
> 
Hi Kristoffer,

Thanks for your quick reaction. I agree with Simon's proposal concerning
the reference point.

Thx,
Tom
> 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. 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Tomasz Wlostowski
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 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Simon Küppers
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.

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 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread 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?
>>
>> 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread 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.


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Tomasz Wlostowski
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 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-09-17 Thread Kristoffer Ödmark
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.


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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-06-23 Thread Wayne Stambaugh
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@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>>
>>
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-06-05 Thread Wayne Stambaugh
I will review it as soon as I can free up the time.  It certainly is
something we could use.  If other developers can review it and give
feedback, that would be helpful.

Wayne

On 6/5/2017 7:03 AM, Nick Østergaard wrote:
> Sure seems interesting, but I suspect people just have not had time to
> review or test this yet, including me.
> 
> 2017-06-05 10:07 GMT+02:00 Kristoffer Ödmark :
>> Hello!
>>
>> Is there any interest in this?
>>
>> - Kristoffer
>>
>>
>> On 2017-05-21 22:32, 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@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>




 ___
 Mailing list: https://launchpad.net/~kicad-developers
 Post to : kicad-developers@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp

>>
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : 

Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-06-05 Thread Nick Østergaard
Sure seems interesting, but I suspect people just have not had time to
review or test this yet, including me.

2017-06-05 10:07 GMT+02:00 Kristoffer Ödmark :
> Hello!
>
> Is there any interest in this?
>
> - Kristoffer
>
>
> On 2017-05-21 22:32, 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@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp

>>>
>>>
>>>
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-06-05 Thread Kristoffer Ödmark

Hello!

Is there any interest in this?

- Kristoffer

On 2017-05-21 22:32, 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-05-21 Thread Kristoffer Ödmark

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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-05-15 Thread Kristoffer Ödmark

Hey!

I made some tests and I think that the best way to move forward with 
this is to have separate copy paste functionality for the Module editor 
and the pcb editor, since the module editor doesnt allow for much things 
from the pcb editor. In short keeping both the module-copy paste and the 
pcb-append version in the patch.


The reason It crashed was that there is no edit_frame when in the module 
editor, that one is an easy fix. I do not however know how to have two 
tools on the same hotkey and also I do not really know how to enable 
them only in the pcbnew or only in the module editor.


Anyone knows where to point me?

- 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-05-08 Thread Kristoffer Ödmark

Thank you Orson!

I also saw the copy/paste in the footprint editor. But that one needs to 
only accept modules or primitives to modules. I will investigate the 
crashes, to be honest I hadnt really checked the functionality of my 
implementation in the footprint editor at all.


Regarding the licenses I will ofcourse add them right away :)

- Kristoffer


On 05/08/2017 03:41 PM, 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp






___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



--
 -Kristoffer

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-05-08 Thread Maciej Sumiński
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@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] pcbnew clipboard support

2017-05-04 Thread Eldar Khayrullin

It will be cool to have this feature. Good work

В Четверг, 4 май. 2017 в 11:41 , Kristoffer Ödmark 
 написал:

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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp