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.

97 lines
3.2 KiB

  1. /* event_handlers_tracks_vias_sizes.cpp
  2. *
  3. * Handlers for popup and toolbars events relative
  4. * to the tracks and vias sizes
  5. */
  6. #include "fctsys.h"
  7. //#include "appl_wxstruct.h"
  8. #include "class_drawpanel.h"
  9. #include "confirm.h"
  10. #include "pcbnew_id.h"
  11. #include "pcbnew.h"
  12. #include "wxPcbStruct.h"
  13. #include "class_board_design_settings.h"
  14. /** Function Tracks_and_Vias_Size_Event
  15. * Event handler for tracks and vias size selection (and some options)
  16. * relative to toolbars and popup events
  17. */
  18. void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
  19. {
  20. int ii;
  21. int id = event.GetId();
  22. /* Note: none of these events require aborting the current command (if any)
  23. * (like move, edit or block command)
  24. * so we do not test for a current command in progress and call
  25. * DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
  26. */
  27. switch( id )
  28. {
  29. case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
  30. g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
  31. AuxiliaryToolBar_Update_UI( );
  32. break;
  33. case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
  34. g_DesignSettings.m_UseConnectedTrackWidth = false;
  35. GetBoard()->m_TrackWidthSelector = 0;
  36. GetBoard()->m_ViaSizeSelector = 0;
  37. AuxiliaryToolBar_Update_UI( );
  38. break;
  39. case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
  40. DrawPanel->MouseToCursorSchema();
  41. g_DesignSettings.m_UseConnectedTrackWidth = true;
  42. AuxiliaryToolBar_Update_UI( );
  43. break;
  44. case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
  45. case ID_POPUP_PCB_SELECT_WIDTH2: // this is a custom value selection
  46. case ID_POPUP_PCB_SELECT_WIDTH3:
  47. case ID_POPUP_PCB_SELECT_WIDTH4:
  48. case ID_POPUP_PCB_SELECT_WIDTH5:
  49. case ID_POPUP_PCB_SELECT_WIDTH6:
  50. case ID_POPUP_PCB_SELECT_WIDTH7:
  51. case ID_POPUP_PCB_SELECT_WIDTH8:
  52. DrawPanel->MouseToCursorSchema();
  53. g_DesignSettings.m_UseConnectedTrackWidth = false;
  54. ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
  55. GetBoard()->m_TrackWidthSelector = ii;
  56. AuxiliaryToolBar_Update_UI( );
  57. break;
  58. case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
  59. case ID_POPUP_PCB_SELECT_VIASIZE2: // this is a custom value selection
  60. case ID_POPUP_PCB_SELECT_VIASIZE3:
  61. case ID_POPUP_PCB_SELECT_VIASIZE4:
  62. case ID_POPUP_PCB_SELECT_VIASIZE5:
  63. case ID_POPUP_PCB_SELECT_VIASIZE6:
  64. case ID_POPUP_PCB_SELECT_VIASIZE7:
  65. case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter)
  66. DrawPanel->MouseToCursorSchema();
  67. ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
  68. GetBoard()->m_ViaSizeSelector = ii;
  69. AuxiliaryToolBar_Update_UI( );
  70. break;
  71. case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
  72. ii = m_SelTrackWidthBox->GetChoice();
  73. GetBoard()->m_TrackWidthSelector = ii;
  74. break;
  75. case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
  76. ii = m_SelViaSizeBox->GetChoice();
  77. GetBoard()->m_ViaSizeSelector = ii;
  78. break;
  79. default:
  80. wxMessageBox( wxT( "WinEDA_PcbFrame::Tracks_and_Vias_Size_Event() error") );
  81. break;
  82. }
  83. }