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 <wxPcbStruct.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->GetCurrentSelection();
122  break;
123 
125  ii = m_SelViaSizeBox->GetCurrentSelection();
127  break;
128 
129  default:
130  wxMessageBox( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
131  break;
132  }
133 
134  // Refresh track in progress, if any, by forcing a mouse event,
135  // to call the current function attached to the mouse
136  /*if( m_canvas->IsMouseCaptured() )
137  {
138  wxMouseEvent event(wxEVT_MOTION);
139  wxPostEvent( m_canvas, event );
140  }*/
141  //+hp
142  //Refresh canvas, that we can see changes instantly. I use this because it dont,t throw mouse up-left corner.
143 
144  if( m_canvas->IsMouseCaptured() )
145  m_canvas->Refresh();
146 }
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
This file is part of the common library.
Class BOARD to handle a board.
wxChoice * m_SelViaSizeBox
Definition: wxPcbStruct.h:240
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
wxChoice * m_SelTrackWidthBox
Definition: wxPcbStruct.h:239
bool m_UseConnectedTrackWidth
if true, when creating a new track starting on an existing track, use this track width ...
PCB_EDIT_FRAME::OnResetModuleTextSizes PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::OnUpdateShowLayerManager PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ID_POPUP_PCB_SELECT_WIDTH8
Definition: pcbframe.cpp:307
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
bool IsMouseCaptured() const
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:92
Module description (excepted pads)