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.

60 lines
1.5 KiB

  1. /*
  2. * events_called_functions.cpp
  3. * some events functions
  4. */
  5. #include "fctsys.h"
  6. #include "gr_basic.h"
  7. #include "common.h"
  8. #include "class_drawpanel.h"
  9. #include "program.h"
  10. #include "general.h"
  11. #include "kicad_device_context.h"
  12. #include "protos.h"
  13. /** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest
  14. * duplicate the current located item
  15. */
  16. void WinEDA_SchematicFrame::OnCopySchematicItemRequest( wxCommandEvent& event )
  17. {
  18. SCH_ITEM * curr_item = GetScreen()->GetCurItem();
  19. if( !curr_item || curr_item->m_Flags )
  20. return;
  21. INSTALL_DC( dc, DrawPanel );
  22. switch( curr_item->Type() )
  23. {
  24. case TYPE_SCH_COMPONENT:
  25. {
  26. SCH_COMPONENT* newitem;
  27. newitem = ((SCH_COMPONENT*) curr_item)->GenCopy();
  28. newitem->m_TimeStamp = GetTimeStamp();
  29. newitem->ClearAnnotation( NULL );
  30. newitem->m_Flags = IS_NEW;
  31. StartMovePart( newitem, &dc );
  32. /* Redraw the original part, because StartMovePart() erased
  33. * it from screen */
  34. RedrawOneStruct( DrawPanel, &dc, curr_item, GR_DEFAULT_DRAWMODE );
  35. }
  36. break;
  37. case TYPE_SCH_TEXT:
  38. case TYPE_SCH_LABEL:
  39. case TYPE_SCH_GLOBALLABEL:
  40. case TYPE_SCH_HIERLABEL:
  41. {
  42. SCH_TEXT* newitem = ((SCH_TEXT*) curr_item)->GenCopy();
  43. newitem->m_Flags = IS_NEW;
  44. StartMoveTexte( newitem, &dc );
  45. /* Redraw the original part in XOR mode */
  46. RedrawOneStruct( DrawPanel, &dc, curr_item, g_XorMode );
  47. }
  48. break;
  49. default:
  50. break;
  51. }
  52. }