KiCad PCB EDA Suite
event_handlers_tracks_vias_sizes.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2009-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 
31 #include <fctsys.h>
32 #include <class_drawpanel.h>
33 #include <confirm.h>
34 #include <pcb_edit_frame.h>
35 #include <dialog_helpers.h>
36 
37 #include <pcbnew_id.h>
38 #include <pcbnew.h>
39 
40 #include <class_board.h>
41 #include <class_module.h>
42 
43 
44 /* Event handler for tracks and vias size selection (and some options)
45  * relative to toolbars and popup events
46  */
47 void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
48 {
49  int ii;
50  int id = event.GetId();
51 
52  /* Note: none of these events require aborting the current command (if any)
53  * (like move, edit or block command)
54  * so we do not test for a current command in progress and call
55  * m_canvas->m_endMouseCaptureCallback( m_canvas, &dc );
56  */
57  switch( id )
58  {
62  break;
63 
68  break;
69 
73  break;
74 
75  case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
76  case ID_POPUP_PCB_SELECT_WIDTH2: // this is a custom value selection
95  break;
96 
97  case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
98  case ID_POPUP_PCB_SELECT_VIASIZE2: // this is a custom value selection
113  // select the new current value for via size (via diameter)
117  break;
118 
120  ii = m_SelTrackWidthBox->GetSelection();
121 
122  if( ii == int( m_SelTrackWidthBox->GetCount() - 2 ) )
123  {
124  // this is the separator
125  m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
126  }
127  else if( ii == int( m_SelTrackWidthBox->GetCount() - 1 ) )
128  {
129  m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
130  DoShowBoardSetupDialog( _( "Tracks & Vias" ) );
131  }
132  else
134 
135  break;
136 
138  ii = m_SelViaSizeBox->GetSelection();
139 
140  if( ii == int( m_SelViaSizeBox->GetCount() - 2 ) )
141  {
142  // this is the separator
143  m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
144  }
145  else if( ii == int( m_SelViaSizeBox->GetCount() - 1 ) )
146  {
147  m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
148  DoShowBoardSetupDialog( _( "Tracks & Vias" ) );
149  }
150  else
152 
153  break;
154 
155  default:
156  wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
157  break;
158  }
159 
160  // Refresh track in progress, if any, by forcing a mouse event,
161  // to call the current function attached to the mouse
162  /*if( m_canvas->IsMouseCaptured() )
163  {
164  wxMouseEvent event(wxEVT_MOTION);
165  wxPostEvent( m_canvas, event );
166  }*/
167  //+hp
168  //Refresh canvas, that we can see changes instantly. I use this because it dont,t throw mouse up-left corner.
169 
170  if( m_canvas->IsMouseCaptured() )
171  m_canvas->Refresh();
172 }
wxComboBox * m_SelTrackWidthBox
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
This file is part of the common library.
Class BOARD to handle a board.
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::ProcessMuWaveFunctions PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar ID_POPUP_PCB_SELECT_VIASIZE8
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
wxComboBox * m_SelViaSizeBox
Helper dialog and control classes.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:123
void DoShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aInitialParentPage=wxEmptyString)
Module description (excepted pads)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)