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
|
|
|
|
2010-01-09 08:50:30 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "kicad_device_context.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "wxEeschemaStruct.h"
|
2010-01-09 08:50:30 +00:00
|
|
|
|
|
|
|
#include "protos.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#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();
|
|
|
|
|
|
|
|
if( !curr_item || curr_item->m_Flags )
|
|
|
|
return;
|
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
|
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 ) );
|
2010-01-09 08:50:30 +00:00
|
|
|
newitem->m_TimeStamp = GetTimeStamp();
|
|
|
|
newitem->ClearAnnotation( NULL );
|
|
|
|
newitem->m_Flags = IS_NEW;
|
2011-10-19 20:32:21 +00:00
|
|
|
MoveItem( (SCH_ITEM*) newitem, &dc );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
|
|
|
/* Redraw the original part, because StartMovePart() erased
|
|
|
|
* it from screen */
|
2011-01-10 16:50:40 +00:00
|
|
|
curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
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 );
|
2011-10-19 20:32:21 +00:00
|
|
|
MoveItem( (SCH_ITEM*) newitem, &dc );
|
|
|
|
|
2010-01-09 08:50:30 +00:00
|
|
|
/* Redraw the original part in XOR mode */
|
2011-01-10 16:50:40 +00:00
|
|
|
curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
|
2010-01-09 08:50:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|