Commit 90029a4e authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: enhancements for blind/buried vias placement ( separate keys to add a...

Pcbnew:  enhancements for blind/buried vias placement ( separate keys to add a buried via or a through via), and save" blind/buried vias allowed" option in .kicad_pcb file
Minor code cleaning.
Allows compiling under wxMSW-2.8.12, only for test purposes, because there are serious bugs for Kicad under wxWidgets version < 2.9.3.  (compil warning generated for these versions)
parents 0b481161 90b820a5
...@@ -39,6 +39,7 @@ autoplace_cost90 ...@@ -39,6 +39,7 @@ autoplace_cost90
autoplace_cost180 autoplace_cost180
aux_axis_origin aux_axis_origin
blind blind
blind_buried_vias_allowed
bold bold
bottom bottom
center center
......
...@@ -18,6 +18,7 @@ class BOARD_DESIGN_SETTINGS ...@@ -18,6 +18,7 @@ class BOARD_DESIGN_SETTINGS
{ {
public: public:
bool m_MicroViasAllowed; ///< true to allow micro vias bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
/// if true, when creating a new track starting on an existing track, use this track width /// if true, when creating a new track starting on an existing track, use this track width
......
...@@ -101,6 +101,7 @@ set( PCBNEW_DIALOGS ...@@ -101,6 +101,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_SVG_print_base.cpp dialogs/dialog_SVG_print_base.cpp
dialogs/dialog_set_grid.cpp dialogs/dialog_set_grid.cpp
dialogs/dialog_set_grid_base.cpp dialogs/dialog_set_grid_base.cpp
dialogs/dialog_target_properties_base.cpp
footprint_wizard.cpp footprint_wizard.cpp
footprint_wizard_frame.cpp footprint_wizard_frame.cpp
dialogs/dialog_footprint_wizard_list_base.cpp dialogs/dialog_footprint_wizard_list_base.cpp
...@@ -172,7 +173,6 @@ set( PCBNEW_CLASS_SRCS ...@@ -172,7 +173,6 @@ set( PCBNEW_CLASS_SRCS
menubar_modedit.cpp menubar_modedit.cpp
menubar_pcbframe.cpp menubar_pcbframe.cpp
minimun_spanning_tree.cpp minimun_spanning_tree.cpp
mirepcb.cpp
modedit.cpp modedit.cpp
modedit_onclick.cpp modedit_onclick.cpp
modeditoptions.cpp modeditoptions.cpp
...@@ -200,6 +200,7 @@ set( PCBNEW_CLASS_SRCS ...@@ -200,6 +200,7 @@ set( PCBNEW_CLASS_SRCS
specctra_import.cpp specctra_import.cpp
specctra_keywords.cpp specctra_keywords.cpp
swap_layers.cpp swap_layers.cpp
target_edit.cpp
tool_modedit.cpp tool_modedit.cpp
tool_onrightclick.cpp tool_onrightclick.cpp
tool_pcb.cpp tool_pcb.cpp
......
...@@ -70,6 +70,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : ...@@ -70,6 +70,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
// if true, when creating a new track starting on an existing track, use this track width // if true, when creating a new track starting on an existing track, use this track width
m_UseConnectedTrackWidth = false; m_UseConnectedTrackWidth = false;
m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias
m_MicroViasAllowed = false; // true to allow micro vias m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer) m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer)
......
...@@ -276,7 +276,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() ...@@ -276,7 +276,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize ); PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill );
if( m_BrdSettings.m_CurrentViaType != VIA_THROUGH ) if( m_BrdSettings.m_BlindBuriedViaAllowed )
m_OptViaType->SetSelection( 1 ); m_OptViaType->SetSelection( 1 );
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 );
...@@ -286,7 +286,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() ...@@ -286,7 +286,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
// Initialize Vias and Tracks sizes lists. // Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value. // note we display only extra values, never the current netclass value.
// (the first value in histories list) // (the first value in history list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList; m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList;
...@@ -579,9 +579,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() ...@@ -579,9 +579,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/ /*************************************************/
{ {
m_BrdSettings.m_CurrentViaType = VIA_THROUGH; m_BrdSettings.m_BlindBuriedViaAllowed = m_OptViaType->GetSelection() > 0;
if( m_OptViaType->GetSelection() > 0 )
m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED;
// Update vias minimum values for DRC // Update vias minimum values for DRC
m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl ); m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl );
......
...@@ -167,11 +167,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -167,11 +167,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* sbViasOptionSizer; wxStaticBoxSizer* sbViasOptionSizer;
sbViasOptionSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Via Options:") ), wxVERTICAL ); sbViasOptionSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Via Options:") ), wxVERTICAL );
wxString m_OptViaTypeChoices[] = { _("Through via"), _("Blind or buried via") }; wxString m_OptViaTypeChoices[] = { _("Do not allow blind/buried vias"), _("Allow blind/buried vias") };
int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString ); int m_OptViaTypeNChoices = sizeof( m_OptViaTypeChoices ) / sizeof( wxString );
m_OptViaType = new wxRadioBox( m_panelGolbalDesignRules, wxID_ANY, _("Default Via Type:"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS ); m_OptViaType = new wxRadioBox( m_panelGolbalDesignRules, wxID_ANY, _("Blind/buried Vias:"), wxDefaultPosition, wxDefaultSize, m_OptViaTypeNChoices, m_OptViaTypeChoices, 1, wxRA_SPECIFY_COLS );
m_OptViaType->SetSelection( 0 ); m_OptViaType->SetSelection( 0 );
m_OptViaType->SetToolTip( _("Select the current via type.\nTrough via is the usual selection") ); m_OptViaType->SetToolTip( _("Allows or not blind/buried vias.\nDo not allow is the usual selection\nNote: micro vias are a special type of blind vias and are not managed here") );
sbViasOptionSizer->Add( m_OptViaType, 0, wxALL|wxEXPAND, 5 ); sbViasOptionSizer->Add( m_OptViaType, 0, wxALL|wxEXPAND, 5 );
......
...@@ -1604,7 +1604,7 @@ ...@@ -1604,7 +1604,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="choices">&quot;Through via&quot; &quot;Blind or buried via&quot;</property> <property name="choices">&quot;Do not allow blind/buried vias&quot; &quot;Allow blind/buried vias&quot;</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
...@@ -1619,7 +1619,7 @@ ...@@ -1619,7 +1619,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Default Via Type:</property> <property name="label">Blind/buried Vias:</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
...@@ -1642,7 +1642,7 @@ ...@@ -1642,7 +1642,7 @@
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">Select the current via type.&#x0A;Trough via is the usual selection</property> <property name="tooltip">Allows or not blind/buried vias.&#x0A;Do not allow is the usual selection&#x0A;Note: micro vias are a special type of blind vias and are not managed here</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
......
...@@ -134,6 +134,8 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event ) ...@@ -134,6 +134,8 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
// Find the Java web start application on Windows. // Find the Java web start application on Windows.
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#if wxCHECK_VERSION( 2, 9, 0 )
// If you thought the registry was brain dead before, now you have to deal with // If you thought the registry was brain dead before, now you have to deal with
// accessing it in either 64 or 32 bit mode depending on the build version of // accessing it in either 64 or 32 bit mode depending on the build version of
// Windows and the build version of KiCad. // Windows and the build version of KiCad.
...@@ -164,7 +166,10 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event ) ...@@ -164,7 +166,10 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
key.SetName( key.GetName() + wxT( "\\" ) + value ); key.SetName( key.GetName() + wxT( "\\" ) + value );
key.QueryValue( wxT( "Home" ), value ); key.QueryValue( wxT( "Home" ), value );
javaWebStartCommand = value + wxFileName::GetPathSeparator() + javaWebStartCommand; javaWebStartCommand = value + wxFileName::GetPathSeparator() + javaWebStartCommand;
#endif #else
#warning Kicad needs wxWidgets >= 2.9.4. version 2.8 is only supported for testing purposes
#endif // wxCHECK_VERSION( 2, 9, 0 )
#endif // __WINDOWS__
// Wrap FullFileName in double quotes in case it has C:\Program Files in it. // Wrap FullFileName in double quotes in case it has C:\Program Files in it.
// The space is interpreted as an argument separator. // The space is interpreted as an argument separator.
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_target_properties_base.h"
///////////////////////////////////////////////////////////////////////////
TARGET_PROPERTIES_DIALOG_EDITOR_BASE::TARGET_PROPERTIES_DIALOG_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer;
fgSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer->AddGrowableCol( 1 );
fgSizer->SetFlexibleDirection( wxBOTH );
fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextSize = new wxStaticText( this, wxID_ANY, wxT("Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSize->Wrap( -1 );
fgSizer->Add( m_staticTextSize, 0, wxALL, 5 );
m_MireWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer->Add( m_MireWidthCtrl, 0, wxALL|wxEXPAND, 5 );
m_staticTextSizeUnits = new wxStaticText( this, wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeUnits->Wrap( -1 );
fgSizer->Add( m_staticTextSizeUnits, 0, wxALL, 5 );
m_staticTextThickness = new wxStaticText( this, wxID_ANY, wxT("Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextThickness->Wrap( -1 );
fgSizer->Add( m_staticTextThickness, 0, wxALL, 5 );
m_MireSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer->Add( m_MireSizeCtrl, 0, wxALL|wxEXPAND, 5 );
m_staticTextThicknessUnits = new wxStaticText( this, wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextThicknessUnits->Wrap( -1 );
fgSizer->Add( m_staticTextThicknessUnits, 0, wxALL, 5 );
m_staticTextShape = new wxStaticText( this, wxID_ANY, wxT("Shape"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextShape->Wrap( -1 );
fgSizer->Add( m_staticTextShape, 0, wxALL, 5 );
wxString m_MireShapeChoices[] = { wxT("+"), wxT("X") };
int m_MireShapeNChoices = sizeof( m_MireShapeChoices ) / sizeof( wxString );
m_MireShape = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_MireShapeNChoices, m_MireShapeChoices, 0 );
m_MireShape->SetSelection( 0 );
fgSizer->Add( m_MireShape, 0, wxALL|wxEXPAND, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerUpper->Add( fgSizer, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizerButts = new wxStdDialogButtonSizer();
m_sdbSizerButtsOK = new wxButton( this, wxID_OK );
m_sdbSizerButts->AddButton( m_sdbSizerButtsOK );
m_sdbSizerButtsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButts->AddButton( m_sdbSizerButtsCancel );
m_sdbSizerButts->Realize();
bSizerMain->Add( m_sdbSizerButts, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_sdbSizerButtsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TARGET_PROPERTIES_DIALOG_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TARGET_PROPERTIES_DIALOG_EDITOR_BASE::OnOkClick ), NULL, this );
}
TARGET_PROPERTIES_DIALOG_EDITOR_BASE::~TARGET_PROPERTIES_DIALOG_EDITOR_BASE()
{
// Disconnect Events
m_sdbSizerButtsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TARGET_PROPERTIES_DIALOG_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerButtsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( TARGET_PROPERTIES_DIALOG_EDITOR_BASE::OnOkClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_TARGET_PROPERTIES_BASE_H__
#define __DIALOG_TARGET_PROPERTIES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class TARGET_PROPERTIES_DIALOG_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class TARGET_PROPERTIES_DIALOG_EDITOR_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticTextSize;
wxTextCtrl* m_MireWidthCtrl;
wxStaticText* m_staticTextSizeUnits;
wxStaticText* m_staticTextThickness;
wxTextCtrl* m_MireSizeCtrl;
wxStaticText* m_staticTextThicknessUnits;
wxStaticText* m_staticTextShape;
wxChoice* m_MireShape;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButts;
wxButton* m_sdbSizerButtsOK;
wxButton* m_sdbSizerButtsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
TARGET_PROPERTIES_DIALOG_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Target Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 285,170 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~TARGET_PROPERTIES_DIALOG_EDITOR_BASE();
};
#endif //__DIALOG_TARGET_PROPERTIES_BASE_H__
...@@ -94,9 +94,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -94,9 +94,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
case ID_POPUP_PCB_BEGIN_TRACK: case ID_POPUP_PCB_BEGIN_TRACK:
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_THROUGH_VIA:
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
...@@ -379,8 +380,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -379,8 +380,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
if( !IsMicroViaAcceptable() ) if( !IsMicroViaAcceptable() )
break; break;
// fall through
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
case ID_POPUP_PCB_PLACE_THROUGH_VIA:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
if( GetCurItem()->IsDragging() ) if( GetCurItem()->IsDragging() )
...@@ -390,11 +392,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -390,11 +392,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else else
{ {
int v_type = GetDesignSettings().m_CurrentViaType; int v_type = GetDesignSettings().m_CurrentViaType;
if( id == ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA )
// place micro via and switch layer. GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED;
if( id == ID_POPUP_PCB_PLACE_MICROVIA ) else if( id == ID_POPUP_PCB_PLACE_MICROVIA )
GetDesignSettings().m_CurrentViaType = VIA_MICROVIA; GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
else
GetDesignSettings().m_CurrentViaType = VIA_THROUGH;
// place via and switch layer.
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetDesignSettings().m_CurrentViaType = v_type; GetDesignSettings().m_CurrentViaType = v_type;
......
...@@ -60,11 +60,12 @@ static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CT ...@@ -60,11 +60,12 @@ static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CT
static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK ); static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' ); static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' ); static EDA_HOTKEY HkAddThroughVia( wxT( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' );
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static EDA_HOTKEY HkAddBlindBuriedVia( wxT( "Add Blind/Buried Via" ), HK_ADD_BLIND_BURIED_VIA, 'V' + GR_KB_ALT );
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' ); static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' );
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' ); static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' ); static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' );
...@@ -207,7 +208,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = ...@@ -207,7 +208,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
{ {
&HkTrackDisplayMode, &HkDelete, &HkTrackDisplayMode, &HkDelete,
&HkBackspace, &HkBackspace,
&HkAddNewTrack, &HkAddVia, &HkAddMicroVia, &HkAddNewTrack, &HkAddThroughVia, &HkAddBlindBuriedVia,
&HkAddMicroVia,
&HkSwitchTrackPosture, &HkSwitchTrackPosture,
&HkDragTrackKeepSlope, &HkDragTrackKeepSlope,
&HkPlaceItem, &HkCopyItem, &HkPlaceItem, &HkCopyItem,
......
...@@ -21,7 +21,8 @@ enum hotkey_id_commnand { ...@@ -21,7 +21,8 @@ enum hotkey_id_commnand {
HK_GET_AND_MOVE_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT,
HK_LOCK_UNLOCK_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_NEW_TRACK, HK_ADD_NEW_TRACK,
HK_ADD_VIA, HK_ADD_THROUGH_VIA,
HK_ADD_BLIND_BURIED_VIA,
HK_ADD_MICROVIA, HK_ADD_MICROVIA,
HK_SWITCH_TRACK_POSTURE, HK_SWITCH_TRACK_POSTURE,
HK_DRAG_TRACK_KEEP_SLOPE, HK_DRAG_TRACK_KEEP_SLOPE,
......
...@@ -458,7 +458,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -458,7 +458,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_ADD_VIA: // Switch to alternate layer and Place a via if a track is in progress case HK_ADD_BLIND_BURIED_VIA:
case HK_ADD_THROUGH_VIA: // Switch to alternate layer and Place a via if a track is in progress
if( GetBoard()->GetDesignSettings().m_BlindBuriedViaAllowed &&
hk_id == HK_ADD_BLIND_BURIED_VIA )
GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED;
else
GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_THROUGH;
if( !itemCurrentlyEdited ) // no track in progress: switch layer only if( !itemCurrentlyEdited ) // no track in progress: switch layer only
{ {
Other_Layer_Route( NULL, aDC ); Other_Layer_Route( NULL, aDC );
...@@ -476,7 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -476,7 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( !GetCurItem()->IsNew() ) if( !GetCurItem()->IsNew() )
return; return;
evt_type = ID_POPUP_PCB_PLACE_VIA; evt_type = hk_id == HK_ADD_BLIND_BURIED_VIA ?
ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA : ID_POPUP_PCB_PLACE_THROUGH_VIA;
break; break;
case HK_SWITCH_TRACK_POSTURE: case HK_SWITCH_TRACK_POSTURE:
......
...@@ -510,6 +510,8 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const ...@@ -510,6 +510,8 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
FMTIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() ); FMTIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility: // for old versions compatibility:
if( aBoard->GetDesignSettings().m_BlindBuriedViaAllowed )
m_out->Print( aNestLevel+1, "(blind_buried_vias_allowed yes)\n" );
m_out->Print( aNestLevel+1, "(uvia_size %s)\n", m_out->Print( aNestLevel+1, "(uvia_size %s)\n",
FMTIU( aBoard->m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() ); FMTIU( aBoard->m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() );
m_out->Print( aNestLevel+1, "(uvia_drill %s)\n", m_out->Print( aNestLevel+1, "(uvia_drill %s)\n",
......
...@@ -515,8 +515,14 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -515,8 +515,14 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) );
} }
msg = AddHotkeyName( _( "Place Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_VIA ); msg = AddHotkeyName( _( "Place Through Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_THROUGH_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_VIA, msg, KiBitmap( via_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_THROUGH_VIA, msg, KiBitmap( via_xpm ) );
if( GetBoard()->GetDesignSettings().m_BlindBuriedViaAllowed )
{
msg = AddHotkeyName( _( "Place Blind/Buried Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_BLIND_BURIED_VIA );
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA, msg, KiBitmap( via_xpm ) );
}
msg = AddHotkeyName( _( "Switch Track Posture" ), g_Board_Editor_Hokeys_Descr, msg = AddHotkeyName( _( "Switch Track Posture" ), g_Board_Editor_Hokeys_Descr,
HK_SWITCH_TRACK_POSTURE ); HK_SWITCH_TRACK_POSTURE );
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 CERN * Copyright (C) 2012 CERN
* @author Wayne Stambaugh <stambaughw@verizon.net>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -906,6 +907,11 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -906,6 +907,11 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
NeedRIGHT(); NeedRIGHT();
break; break;
case T_blind_buried_vias_allowed:
designSettings.m_BlindBuriedViaAllowed = parseBool();
NeedRIGHT();
break;
case T_uvia_min_size: case T_uvia_min_size:
designSettings.m_MicroViasMinSize = parseBoardUnits( T_uvia_min_size ); designSettings.m_MicroViasMinSize = parseBoardUnits( T_uvia_min_size );
NeedRIGHT(); NeedRIGHT();
......
...@@ -120,7 +120,8 @@ enum pcbnew_ids ...@@ -120,7 +120,8 @@ enum pcbnew_ids
ID_POPUP_PCB_EDIT_DIMENSION, ID_POPUP_PCB_EDIT_DIMENSION,
ID_POPUP_PCB_END_TRACK, ID_POPUP_PCB_END_TRACK,
ID_POPUP_PCB_PLACE_VIA, ID_POPUP_PCB_PLACE_THROUGH_VIA,
ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA,
ID_POPUP_PCB_PLACE_MICROVIA, ID_POPUP_PCB_PLACE_MICROVIA,
ID_POPUP_PCB_SWITCH_TRACK_POSTURE, ID_POPUP_PCB_SWITCH_TRACK_POSTURE,
......
import pcbnew
def abs(x):
if x < 0:
return -x
return x
class QFPWizard(pcbnew.FootprintWizardPlugin):
def __init__(self):
pcbnew.FootprintWizardPlugin.__init__(self)
self.name = "QFP"
self.description = "QFP Footprint Wizard"
self.parameters = {
"Pads": {
"*n": 100,
"pitch": pcbnew.FromMM(0.5),
"width": pcbnew.FromMM(0.25),
"length": pcbnew.FromMM(1.5),
"horizontal pitch": pcbnew.FromMM(15),
"vertical pitch": pcbnew.FromMM(15),
"*oval": "True"
},
"Package": {
"width": pcbnew.FromMM(14),
"height": pcbnew.FromMM(14)
}
}
self.ClearErrors()
def smd_rect_pad(self, module, size, pos, name):
pad = pcbnew.D_PAD(module)
pad.SetSize(size)
if self.parameters['Pads'].get('*oval', "true").lower() == "true":
pad.SetShape(pcbnew.PAD_OVAL)
else:
pad.SetShape(pcbnew.PAD_RECT)
pad.SetAttribute(pcbnew.PAD_SMD)
pad.SetLayerMask(pcbnew.PAD_SMD_DEFAULT_LAYERS)
pad.SetPos0(pos)
pad.SetPosition(pos)
pad.SetPadName(name)
return pad
def CheckParameters(self):
errors = ""
pads = self.parameters
num_pads = pads["Pads"]["*n"]
if (num_pads < 1):
self.parameter_errors["Pads"]["*n"] = "Must be positive"
errors +="Pads/n has wrong value, "
pads["Pads"]["*n"] = int(num_pads) # Reset to int instead of float
return errors
def BuildFootprint(self):
if self.has_errors():
print "Cannot build footprint: Parameters have errors:"
print self.parameter_errors
return
print "Building new QFP footprint with the following parameters:"
self.print_parameter_table()
self.module = pcbnew.MODULE(None) # create a new module
pads = self.parameters
num_pads = int(pads["Pads"]["*n"])
pad_width = pads["Pads"]["width"]
pad_length = pads["Pads"]["length"]
pad_pitch = pads["Pads"]["pitch"]
pad_horizontal_pitch = pads["Pads"]["horizontal pitch"]
pad_vertical_pitch = pads["Pads"]["vertical pitch"]
package_width = pads["Package"]["width"]
package_height = pads["Package"]["height"]
side_length = pad_pitch * ((num_pads / 4) - 1)
offsetX = pad_pitch * ((num_pads / 4) - 1) / 2
text_size = pcbnew.wxSize(pcbnew.FromMM(0.8), pcbnew.FromMM(0.8))
self.module.SetReference("QFP %d" % int(num_pads))
self.module.Reference().SetPos0(pcbnew.wxPoint(0, pcbnew.FromMM(-0.8)))
self.module.Reference().SetTextPosition(self.module.Reference().GetPos0())
self.module.Reference().SetSize(text_size)
self.module.SetValue("U**")
self.module.Value().SetPos0(pcbnew.wxPoint(0, pcbnew.FromMM(+0.8)))
self.module.Value().SetTextPosition(self.module.Value().GetPos0())
self.module.Value().SetSize(text_size)
self.module.SetLibRef("QFP-%d" % int(num_pads))
pad_size_left_right = pcbnew.wxSize(pad_length, pad_width)
pad_size_bottom_top = pcbnew.wxSize(pad_width, pad_length)
for cur_pad in range(0, num_pads):
side = int(cur_pad / (num_pads / 4)) # 0 -> left, 1 -> bottom, 2 -> right, 3 -> top
if side == 0 or side == 2:
pad_size = pad_size_left_right
pad_pos_x = -(pad_horizontal_pitch / 2)
if side == 2:
pad_pos_x = -pad_pos_x
pad_pos_y = (cur_pad % (num_pads / 4)) * pad_pitch - (side_length / 2)
else:
pad_size = pad_size_bottom_top
pad_pos_x = (cur_pad % (num_pads / 4)) * pad_pitch - (side_length / 2)
pad_pos_y = -(pad_vertical_pitch / 2)
if side == 1:
pad_pos_y = -pad_pos_y
pad_pos = pcbnew.wxPoint(pad_pos_x, pad_pos_y)
pad = self.smd_rect_pad(self.module, pad_size, pad_pos, str(cur_pad + 1))
self.module.Add(pad)
half_package_width = package_width / 2
half_package_height = package_height / 2
package_pad_height_offset = abs(package_height - side_length) / 2 - pad_pitch
package_pad_width_offset = abs(package_width - side_length) / 2 - pad_pitch
# Bottom Left Edge, vertical line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(-half_package_width, half_package_height - package_pad_height_offset)
end = pcbnew.wxPoint(-half_package_width, half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Bottom Left Edge, horizontal line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(-half_package_width, half_package_height)
end = pcbnew.wxPoint(-half_package_width + package_pad_width_offset, half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Bottom Right Edge, vertical line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(half_package_width, half_package_height - package_pad_height_offset)
end = pcbnew.wxPoint(half_package_width, half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Bottom Right Edge, horizontal line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(half_package_width, half_package_height)
end = pcbnew.wxPoint(half_package_width - package_pad_width_offset, half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Top Right Edge, vertical line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(half_package_width, -half_package_height + package_pad_height_offset)
end = pcbnew.wxPoint(half_package_width, -half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Top Right Edge, horizontal line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(half_package_width, -half_package_height)
end = pcbnew.wxPoint(half_package_width - package_pad_width_offset, -half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
# Top Left Edge, straight line
outline = pcbnew.EDGE_MODULE(self.module)
outline.SetWidth(pcbnew.FromMM(0.2))
outline.SetLayer(pcbnew.SILKSCREEN_N_FRONT)
outline.SetShape(pcbnew.S_SEGMENT)
start = pcbnew.wxPoint(-half_package_width, -half_package_height + package_pad_height_offset)
end = pcbnew.wxPoint(-half_package_width + package_pad_width_offset, -half_package_height)
outline.SetStartEnd(start, end)
self.module.Add(outline)
def print_parameter_table(self):
for name, section in self.parameters.iteritems():
print " %s:" % name
for key, value in section.iteritems():
unit = ""
if (type(value) is int or type(value) is float) and not "*" in key:
unit = "mm"
if "*" in key:
key = key[1:]
else:
value = pcbnew.ToMM(value)
print " %s: %s%s" % (key, value, unit)
def has_errors(self):
for name, section in self.parameter_errors.iteritems():
for k, v in section.iteritems():
if v:
return True
return False
QFPWizard().register()
\ No newline at end of file
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*/ */
/** /**
* @file mirepcb.cpp * @file dialog_target_properties.cpp
* @brief Functions to edit targets (class #PCB_TARGET). * @brief Functions to edit targets (class #PCB_TARGET).
*/ */
...@@ -32,13 +32,15 @@ ...@@ -32,13 +32,15 @@
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
#include <base_units.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <protos.h>
#include <class_board.h> #include <class_board.h>
#include <class_mire.h> #include <class_mire.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h> #include <dialog_target_properties_base.h>
// Routines Locales // Routines Locales
...@@ -61,16 +63,12 @@ static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the ...@@ -61,16 +63,12 @@ static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
/* class TARGET_PROPERTIES_DIALOG_EDITOR */ /* class TARGET_PROPERTIES_DIALOG_EDITOR */
/*****************************************/ /*****************************************/
class TARGET_PROPERTIES_DIALOG_EDITOR : public wxDialog class TARGET_PROPERTIES_DIALOG_EDITOR : public TARGET_PROPERTIES_DIALOG_EDITOR_BASE
{ {
private: private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC; wxDC* m_DC;
PCB_TARGET* m_Target; PCB_TARGET* m_Target;
EDA_VALUE_CTRL* m_MireWidthCtrl;
EDA_VALUE_CTRL* m_MireSizeCtrl;
wxRadioBox* m_MireShape;
public: public:
TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, PCB_TARGET* Mire, wxDC* DC ); TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, PCB_TARGET* Mire, wxDC* DC );
...@@ -79,15 +77,8 @@ public: ...@@ -79,15 +77,8 @@ public:
private: private:
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE( TARGET_PROPERTIES_DIALOG_EDITOR, wxDialog )
EVT_BUTTON( wxID_OK, TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick )
EVT_BUTTON( wxID_CANCEL, TARGET_PROPERTIES_DIALOG_EDITOR::OnCancelClick )
END_EVENT_TABLE()
void PCB_EDIT_FRAME::ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC ) void PCB_EDIT_FRAME::ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC )
{ {
...@@ -101,52 +92,26 @@ void PCB_EDIT_FRAME::ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC ) ...@@ -101,52 +92,26 @@ void PCB_EDIT_FRAME::ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC )
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent,
PCB_TARGET* aTarget, wxDC* DC ) : PCB_TARGET* aTarget, wxDC* DC ) :
wxDialog( parent, wxID_ANY, wxString( _( "Target Properties" ) ) ) TARGET_PROPERTIES_DIALOG_EDITOR_BASE( parent )
{ {
wxString number;
wxButton* Button;
m_Parent = parent; m_Parent = parent;
m_DC = DC; m_DC = DC;
Centre();
m_Target = aTarget; m_Target = aTarget;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( MainBoxSizer );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
// Create of the command buttons.
Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
// Size: // Size:
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), m_staticTextSizeUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_Target->GetSize(), m_MireSizeCtrl->SetValue( ReturnStringFromValue( g_UserUnit, m_Target->GetSize() ) );
g_UserUnit, LeftBoxSizer );
// Width: // Thickness:
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), m_staticTextThicknessUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_Target->GetWidth(), m_MireWidthCtrl->SetValue( ReturnStringFromValue( g_UserUnit, m_Target->GetWidth() ) );
g_UserUnit, LeftBoxSizer );
// Shape // Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };
m_MireShape = new wxRadioBox( this, wxID_ANY,
_( "Target Shape:" ),
wxDefaultPosition, wxSize( -1, -1 ),
2, shape_list, 1 );
m_MireShape->SetSelection( m_Target->GetShape() ? 1 : 0 ); m_MireShape->SetSelection( m_Target->GetShape() ? 1 : 0 );
LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre();
} }
...@@ -170,9 +135,12 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -170,9 +135,12 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
// undo/redo/abort proper operation // undo/redo/abort proper operation
m_Target->SetWidth( m_MireWidthCtrl->GetValue() ); int tmp = ReturnValueFromString( g_UserUnit, m_MireWidthCtrl->GetValue() );
MireDefaultSize = m_MireSizeCtrl->GetValue(); m_Target->SetWidth( tmp );
m_Target->SetSize( m_MireSizeCtrl->GetValue() );
MireDefaultSize = ReturnValueFromString( g_UserUnit, m_MireSizeCtrl->GetValue() );
m_Target->SetSize( MireDefaultSize );
m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 ); m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 );
m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR ); m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment