2010-01-09 08:50:30 +00:00
|
|
|
/*
|
2011-10-07 14:41:30 +00:00
|
|
|
* @file events_called_functions.cpp
|
2010-01-09 08:50:30 +00:00
|
|
|
*/
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <general.h>
|
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <wxEeschemaStruct.h>
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <protos.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_text.h>
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
|
2010-01-09 08:50:30 +00:00
|
|
|
{
|
|
|
|
SCH_ITEM * curr_item = GetScreen()->GetCurItem();
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !curr_item || curr_item->GetFlags() )
|
2010-01-09 08:50:30 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
|
|
|
switch( curr_item->Type() )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2010-01-09 08:50:30 +00:00
|
|
|
{
|
|
|
|
SCH_COMPONENT* newitem;
|
2010-12-21 15:13:09 +00:00
|
|
|
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
|
2011-12-12 08:37:05 +00:00
|
|
|
newitem->SetTimeStamp( GetNewTimeStamp() );
|
2010-01-09 08:50:30 +00:00
|
|
|
newitem->ClearAnnotation( NULL );
|
2011-12-21 13:42:02 +00:00
|
|
|
newitem->SetFlags( IS_NEW );
|
2013-04-16 10:53:23 +00:00
|
|
|
// Draw the new part, MoveItem() expects it to be already on screen.
|
|
|
|
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
|
|
|
|
MoveItem( newitem, &dc );
|
2010-01-09 08:50:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2010-01-09 08:50:30 +00:00
|
|
|
{
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
|
2011-04-05 14:46:51 +00:00
|
|
|
newitem->SetFlags( IS_NEW );
|
2013-04-16 10:53:23 +00:00
|
|
|
// Draw the new item, MoveItem() expects it to be already on screen.
|
|
|
|
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
|
|
|
|
MoveItem( newitem, &dc );
|
2010-01-09 08:50:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|