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.

108 lines
2.5 KiB

  1. /*****************************************************/
  2. /* muwave_command.cpp: micro wave functions commands */
  3. /*****************************************************/
  4. #include <fctsys.h>
  5. #include <class_drawpanel.h>
  6. #include <confirm.h>
  7. #include <pcbnew.h>
  8. #include <wxPcbStruct.h>
  9. #include <pcbnew_id.h>
  10. #include <kicad_device_context.h>
  11. #include <protos.h>
  12. /* Handle microwave commands.
  13. */
  14. void PCB_EDIT_FRAME::ProcessMuWaveFunctions( wxCommandEvent& event )
  15. {
  16. int id = event.GetId();
  17. wxPoint pos;
  18. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  19. wxGetMousePosition( &pos.x, &pos.y );
  20. pos.y += 20;
  21. switch( id ) // End any command in progress.
  22. {
  23. case ID_POPUP_COPY_BLOCK:
  24. break;
  25. default: // End block command in progress.
  26. m_canvas->EndMouseCapture( );
  27. break;
  28. }
  29. switch( id )
  30. {
  31. case ID_PCB_MUWAVE_TOOL_SELF_CMD:
  32. SetToolID( id, wxCURSOR_PENCIL, _( "Add Line" ) );
  33. break;
  34. case ID_PCB_MUWAVE_TOOL_GAP_CMD:
  35. SetToolID( id, wxCURSOR_PENCIL, _( "Add Gap" ) );
  36. break;
  37. case ID_PCB_MUWAVE_TOOL_STUB_CMD:
  38. SetToolID( id, wxCURSOR_PENCIL, _( "Add Stub" ) );
  39. break;
  40. case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
  41. SetToolID( id, wxCURSOR_PENCIL, _( "Add Arc Stub" ) );
  42. break;
  43. case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
  44. SetToolID( id, wxCURSOR_PENCIL, _( "Add Polynomial Shape" ) );
  45. break;
  46. default:
  47. DisplayError( this,
  48. wxT( "PCB_EDIT_FRAME::ProcessMuWaveFunctions() id error" ) );
  49. break;
  50. }
  51. }
  52. void PCB_EDIT_FRAME::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
  53. {
  54. MODULE* module = NULL;
  55. switch( GetToolId() )
  56. {
  57. case ID_PCB_MUWAVE_TOOL_SELF_CMD:
  58. Begin_Self( DC );
  59. break;
  60. case ID_PCB_MUWAVE_TOOL_GAP_CMD:
  61. module = Create_MuWaveComponent( 0 );
  62. break;
  63. case ID_PCB_MUWAVE_TOOL_STUB_CMD:
  64. module = Create_MuWaveComponent( 1 );
  65. break;
  66. case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
  67. module = Create_MuWaveComponent( 2 );
  68. break;
  69. case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
  70. module = Create_MuWavePolygonShape();
  71. break;
  72. default:
  73. m_canvas->SetCursor( wxCURSOR_ARROW );
  74. DisplayError( this, wxT( "PCB_EDIT_FRAME::MuWaveCommand() id error" ) );
  75. SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
  76. break;
  77. }
  78. if( module )
  79. {
  80. StartMoveModule( module, DC, false );
  81. }
  82. m_canvas->MoveCursorToCrossHair();
  83. }