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.

126 lines
3.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include <fctsys.h>
  25. #include <class_drawpanel.h>
  26. #include <confirm.h>
  27. #include <pcbnew.h>
  28. #include <pcb_edit_frame.h>
  29. #include <pcbnew_id.h>
  30. #include <kicad_device_context.h>
  31. /* Handle microwave commands.
  32. */
  33. void PCB_EDIT_FRAME::ProcessMuWaveFunctions( wxCommandEvent& event )
  34. {
  35. int id = event.GetId();
  36. wxPoint pos;
  37. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  38. wxGetMousePosition( &pos.x, &pos.y );
  39. pos.y += 20;
  40. switch( id ) // End any command in progress.
  41. {
  42. case ID_POPUP_DUPLICATE_BLOCK:
  43. break;
  44. default: // End block command in progress.
  45. m_canvas->EndMouseCapture( );
  46. break;
  47. }
  48. switch( id )
  49. {
  50. case ID_PCB_MUWAVE_TOOL_SELF_CMD:
  51. SetToolID( id, wxCURSOR_PENCIL, _( "Add Line" ) );
  52. break;
  53. case ID_PCB_MUWAVE_TOOL_GAP_CMD:
  54. SetToolID( id, wxCURSOR_PENCIL, _( "Add Gap" ) );
  55. break;
  56. case ID_PCB_MUWAVE_TOOL_STUB_CMD:
  57. SetToolID( id, wxCURSOR_PENCIL, _( "Add Stub" ) );
  58. break;
  59. case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
  60. SetToolID( id, wxCURSOR_PENCIL, _( "Add Arc Stub" ) );
  61. break;
  62. case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
  63. SetToolID( id, wxCURSOR_PENCIL, _( "Add Polynomial Shape" ) );
  64. break;
  65. default:
  66. DisplayError( this,
  67. wxT( "PCB_EDIT_FRAME::ProcessMuWaveFunctions() id error" ) );
  68. break;
  69. }
  70. }
  71. void PCB_EDIT_FRAME::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
  72. {
  73. MODULE* module = NULL;
  74. switch( GetToolId() )
  75. {
  76. case ID_PCB_MUWAVE_TOOL_SELF_CMD:
  77. Begin_Self( DC );
  78. break;
  79. case ID_PCB_MUWAVE_TOOL_GAP_CMD:
  80. module = Create_MuWaveComponent( 0 );
  81. break;
  82. case ID_PCB_MUWAVE_TOOL_STUB_CMD:
  83. module = Create_MuWaveComponent( 1 );
  84. break;
  85. case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
  86. module = Create_MuWaveComponent( 2 );
  87. break;
  88. case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
  89. module = Create_MuWavePolygonShape();
  90. break;
  91. default:
  92. m_canvas->SetCursor( wxCURSOR_ARROW );
  93. DisplayError( this, wxT( "PCB_EDIT_FRAME::MuWaveCommand() id error" ) );
  94. SetNoToolSelected();
  95. break;
  96. }
  97. if( module )
  98. {
  99. StartMoveModule( module, DC, false );
  100. }
  101. m_canvas->MoveCursorToCrossHair();
  102. }