2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file event_handlers_tracks_vias_sizes.cpp
|
|
|
|
* @brief Handlers for popup and toolbars events relative to the tracks and vias sizes.
|
2009-10-03 17:18:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "wxPcbStruct.h"
|
2010-11-18 21:16:28 +00:00
|
|
|
#include "dialog_helpers.h"
|
2009-10-03 17:18:08 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "pcbnew_id.h"
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
|
|
|
#include "class_board.h"
|
|
|
|
#include "class_module.h"
|
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function Tracks_and_Vias_Size_Event
|
2009-10-03 17:18:08 +00:00
|
|
|
* Event handler for tracks and vias size selection (and some options)
|
|
|
|
* relative to toolbars and popup events
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
2009-10-03 17:18:08 +00:00
|
|
|
{
|
|
|
|
int ii;
|
|
|
|
int id = event.GetId();
|
|
|
|
|
|
|
|
/* Note: none of these events require aborting the current command (if any)
|
|
|
|
* (like move, edit or block command)
|
|
|
|
* so we do not test for a current command in progress and call
|
2011-12-22 13:28:11 +00:00
|
|
|
* m_canvas->m_endMouseCaptureCallback( m_canvas, &dc );
|
2009-10-03 17:18:08 +00:00
|
|
|
*/
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth =
|
|
|
|
not GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth;
|
2009-10-03 17:18:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
|
2009-10-03 17:18:08 +00:00
|
|
|
GetBoard()->m_TrackWidthSelector = 0;
|
|
|
|
GetBoard()->m_ViaSizeSelector = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true;
|
2009-10-03 17:18:08 +00:00
|
|
|
break;
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH2: // this is a custom value selection
|
2009-10-03 17:18:08 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH3:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH4:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH5:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH6:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH7:
|
|
|
|
case ID_POPUP_PCB_SELECT_WIDTH8:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
|
2009-10-03 17:18:08 +00:00
|
|
|
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
|
|
|
|
GetBoard()->m_TrackWidthSelector = ii;
|
|
|
|
break;
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE2: // this is a custom value selection
|
2009-10-03 17:18:08 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
2011-03-01 19:26:17 +00:00
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter)
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-10-03 17:18:08 +00:00
|
|
|
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
|
|
|
|
GetBoard()->m_ViaSizeSelector = ii;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
|
2011-04-19 19:19:41 +00:00
|
|
|
ii = m_SelTrackWidthBox->GetCurrentSelection();
|
2009-10-03 17:18:08 +00:00
|
|
|
GetBoard()->m_TrackWidthSelector = ii;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
|
2011-04-19 19:19:41 +00:00
|
|
|
ii = m_SelViaSizeBox->GetCurrentSelection();
|
2011-03-01 19:26:17 +00:00
|
|
|
GetBoard()->m_ViaSizeSelector = ii;
|
2009-10-03 17:18:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-01 19:26:17 +00:00
|
|
|
wxMessageBox( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
|
2009-10-03 17:18:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|