You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB

  1. /*
  2. * @file events_called_functions.cpp
  3. */
  4. #include <fctsys.h>
  5. #include <gr_basic.h>
  6. #include <class_drawpanel.h>
  7. #include <general.h>
  8. #include <kicad_device_context.h>
  9. #include <wxEeschemaStruct.h>
  10. #include <sch_component.h>
  11. #include <sch_text.h>
  12. void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
  13. {
  14. SCH_ITEM * curr_item = GetScreen()->GetCurItem();
  15. if( !curr_item || curr_item->GetFlags() )
  16. return;
  17. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  18. switch( curr_item->Type() )
  19. {
  20. case SCH_COMPONENT_T:
  21. {
  22. SCH_COMPONENT* newitem;
  23. newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
  24. newitem->SetTimeStamp( GetNewTimeStamp() );
  25. newitem->ClearAnnotation( NULL );
  26. newitem->SetFlags( IS_NEW );
  27. // Draw the new part, MoveItem() expects it to be already on screen.
  28. newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
  29. MoveItem( newitem, &dc );
  30. }
  31. break;
  32. case SCH_TEXT_T:
  33. case SCH_LABEL_T:
  34. case SCH_GLOBAL_LABEL_T:
  35. case SCH_HIERARCHICAL_LABEL_T:
  36. {
  37. SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
  38. newitem->SetFlags( IS_NEW );
  39. // Draw the new item, MoveItem() expects it to be already on screen.
  40. newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
  41. MoveItem( newitem, &dc );
  42. }
  43. break;
  44. default:
  45. break;
  46. }
  47. }