From 90b820a52c621cfd2a8e339f79d0736853d29041 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 28 Aug 2013 18:14:39 +0200 Subject: [PATCH] Pcbnew: enhancements for blind/buried vias palcement, and save blind/buried vias allowed option in .kicad_pcb file --- common/pcb.keywords | 1 + include/class_board_design_settings.h | 1 + pcbnew/CMakeLists.txt | 3 +- pcbnew/class_board_design_settings.cpp | 1 + pcbnew/dialogs/dialog_design_rules.cpp | 8 +- pcbnew/dialogs/dialog_design_rules_base.cpp | 6 +- pcbnew/dialogs/dialog_design_rules_base.fbp | 6 +- .../dialogs/dialog_target_properties_base.cpp | 98 ++ .../dialogs/dialog_target_properties_base.fbp | 928 ++++++++++++++++++ .../dialogs/dialog_target_properties_base.h | 65 ++ pcbnew/edit.cpp | 19 +- pcbnew/hotkeys.cpp | 8 +- pcbnew/hotkeys.h | 3 +- pcbnew/hotkeys_board_editor.cpp | 12 +- pcbnew/kicad_plugin.cpp | 2 + pcbnew/onrightclick.cpp | 10 +- pcbnew/pcb_parser.cpp | 6 + pcbnew/pcbnew_id.h | 3 +- pcbnew/scripting/plugins/qfp_wizard.py | 230 +++++ pcbnew/{mirepcb.cpp => target_edit.cpp} | 72 +- 20 files changed, 1402 insertions(+), 80 deletions(-) create mode 100644 pcbnew/dialogs/dialog_target_properties_base.cpp create mode 100644 pcbnew/dialogs/dialog_target_properties_base.fbp create mode 100644 pcbnew/dialogs/dialog_target_properties_base.h create mode 100644 pcbnew/scripting/plugins/qfp_wizard.py rename pcbnew/{mirepcb.cpp => target_edit.cpp} (77%) diff --git a/common/pcb.keywords b/common/pcb.keywords index 93809b5d3a..0126f5602e 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -39,6 +39,7 @@ autoplace_cost90 autoplace_cost180 aux_axis_origin blind +blind_buried_vias_allowed bold bottom center diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 75a22dc99d..9b516308b2 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -18,6 +18,7 @@ class BOARD_DESIGN_SETTINGS { public: 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) /// if true, when creating a new track starting on an existing track, use this track width diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 805ef45788..393740ae7b 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -101,6 +101,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_SVG_print_base.cpp dialogs/dialog_set_grid.cpp dialogs/dialog_set_grid_base.cpp + dialogs/dialog_target_properties_base.cpp footprint_wizard.cpp footprint_wizard_frame.cpp dialogs/dialog_footprint_wizard_list_base.cpp @@ -172,7 +173,6 @@ set( PCBNEW_CLASS_SRCS menubar_modedit.cpp menubar_pcbframe.cpp minimun_spanning_tree.cpp - mirepcb.cpp modedit.cpp modedit_onclick.cpp modeditoptions.cpp @@ -200,6 +200,7 @@ set( PCBNEW_CLASS_SRCS specctra_import.cpp specctra_keywords.cpp swap_layers.cpp + target_edit.cpp tool_modedit.cpp tool_onrightclick.cpp tool_pcb.cpp diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index f1f5ce0c88..e98dc81ef1 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -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 m_UseConnectedTrackWidth = false; + m_BlindBuriedViaAllowed = false; // true to allow blind/buried vias m_MicroViasAllowed = false; // true to allow micro vias m_DrawSegmentWidth = DEFAULT_GRAPHIC_THICKNESS; // current graphic line width (not EDGE layer) diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index 07d6bef24e..c2a278aecb 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -276,7 +276,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill ); - if( m_BrdSettings.m_CurrentViaType != VIA_THROUGH ) + if( m_BrdSettings.m_BlindBuriedViaAllowed ) m_OptViaType->SetSelection( 1 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 ); @@ -286,7 +286,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() // Initialize Vias and Tracks sizes lists. // 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.erase( m_TracksWidthList.begin() ); // remove the netclass value m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; @@ -579,9 +579,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() /*************************************************/ { - m_BrdSettings.m_CurrentViaType = VIA_THROUGH; - if( m_OptViaType->GetSelection() > 0 ) - m_BrdSettings.m_CurrentViaType = VIA_BLIND_BURIED; + m_BrdSettings.m_BlindBuriedViaAllowed = m_OptViaType->GetSelection() > 0; // Update vias minimum values for DRC m_BrdSettings.m_ViasMinSize = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl ); diff --git a/pcbnew/dialogs/dialog_design_rules_base.cpp b/pcbnew/dialogs/dialog_design_rules_base.cpp index d58d7b31a8..c9a61997dc 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.cpp +++ b/pcbnew/dialogs/dialog_design_rules_base.cpp @@ -167,11 +167,11 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID wxStaticBoxSizer* sbViasOptionSizer; 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 ); - 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->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 ); diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index 54321e8484..d0808ee3ac 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -1604,7 +1604,7 @@ 1 0 - "Through via" "Blind or buried via" + "Do not allow blind/buried vias" "Allow blind/buried vias" 1 1 @@ -1619,7 +1619,7 @@ 0 0 wxID_ANY - Default Via Type: + Blind/buried Vias: 1 0 @@ -1642,7 +1642,7 @@ wxRA_SPECIFY_COLS 0 - Select the current via type. Trough via is the usual selection + Allows or not blind/buried vias. Do not allow is the usual selection Note: micro vias are a special type of blind vias and are not managed here wxFILTER_NONE wxDefaultValidator diff --git a/pcbnew/dialogs/dialog_target_properties_base.cpp b/pcbnew/dialogs/dialog_target_properties_base.cpp new file mode 100644 index 0000000000..4027e64c0c --- /dev/null +++ b/pcbnew/dialogs/dialog_target_properties_base.cpp @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 ); + +} diff --git a/pcbnew/dialogs/dialog_target_properties_base.fbp b/pcbnew/dialogs/dialog_target_properties_base.fbp new file mode 100644 index 0000000000..e10ec98e5b --- /dev/null +++ b/pcbnew/dialogs/dialog_target_properties_base.fbp @@ -0,0 +1,928 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_target_properties_base + 1000 + none + 0 + dialog_target_properties_base + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + TARGET_PROPERTIES_DIALOG_EDITOR_BASE + + 285,170 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Target Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 3 + wxBOTH + 1 + + 0 + + fgSizer + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Size + + 0 + + + 0 + + 1 + m_staticTextSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_MireWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thickness + + 0 + + + 0 + + 1 + m_staticTextThickness + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_MireSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextThicknessUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Shape + + 0 + + + 0 + + 1 + m_staticTextShape + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "+" "X" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_MireShape + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizerButts + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_target_properties_base.h b/pcbnew/dialogs/dialog_target_properties_base.h new file mode 100644 index 0000000000..e8a815dd7a --- /dev/null +++ b/pcbnew/dialogs/dialog_target_properties_base.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// 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__ diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index a74c844019..a154b8677f 100755 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -94,9 +94,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_BEGIN_TRACK: case ID_POPUP_PCB_END_TRACK: - case ID_POPUP_PCB_PLACE_VIA: - case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: + case ID_POPUP_PCB_PLACE_THROUGH_VIA: + case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA: case ID_POPUP_PCB_PLACE_MICROVIA: + case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: @@ -379,8 +380,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_PLACE_MICROVIA: if( !IsMicroViaAcceptable() ) break; - - case ID_POPUP_PCB_PLACE_VIA: + // fall through + case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA: + case ID_POPUP_PCB_PLACE_THROUGH_VIA: m_canvas->MoveCursorToCrossHair(); if( GetCurItem()->IsDragging() ) @@ -390,11 +392,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) else { int v_type = GetDesignSettings().m_CurrentViaType; - - // place micro via and switch layer. - if( id == ID_POPUP_PCB_PLACE_MICROVIA ) + if( id == ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA ) + GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED; + else if( id == ID_POPUP_PCB_PLACE_MICROVIA ) GetDesignSettings().m_CurrentViaType = VIA_MICROVIA; + else + GetDesignSettings().m_CurrentViaType = VIA_THROUGH; + // place via and switch layer. Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); GetDesignSettings().m_CurrentViaType = v_type; diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index c0a3830388..ff10c1945d 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -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 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 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 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 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 HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' ); @@ -207,7 +208,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete, &HkBackspace, - &HkAddNewTrack, &HkAddVia, &HkAddMicroVia, + &HkAddNewTrack, &HkAddThroughVia, &HkAddBlindBuriedVia, + &HkAddMicroVia, &HkSwitchTrackPosture, &HkDragTrackKeepSlope, &HkPlaceItem, &HkCopyItem, diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index dca43f3aa0..9e2c1fa5d1 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -21,7 +21,8 @@ enum hotkey_id_commnand { HK_GET_AND_MOVE_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT, HK_ADD_NEW_TRACK, - HK_ADD_VIA, + HK_ADD_THROUGH_VIA, + HK_ADD_BLIND_BURIED_VIA, HK_ADD_MICROVIA, HK_SWITCH_TRACK_POSTURE, HK_DRAG_TRACK_KEEP_SLOPE, diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index c7e42649f7..5f961d5e28 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -458,7 +458,14 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit 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 { Other_Layer_Route( NULL, aDC ); @@ -476,7 +483,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( !GetCurItem()->IsNew() ) 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; case HK_SWITCH_TRACK_POSTURE: diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 815472e1d1..847571940c 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -510,6 +510,8 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const FMTIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() ); // 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", FMTIU( aBoard->m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() ); m_out->Print( aNestLevel+1, "(uvia_drill %s)\n", diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 1d482743fe..44545393cf 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -515,8 +515,14 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( apply_xpm ) ); } - msg = AddHotkeyName( _( "Place Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_VIA ); - AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_VIA, msg, KiBitmap( via_xpm ) ); + msg = AddHotkeyName( _( "Place Through Via" ), g_Board_Editor_Hokeys_Descr, HK_ADD_THROUGH_VIA ); + 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, HK_SWITCH_TRACK_POSTURE ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index bd255e84b2..0c4c77358e 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 CERN + * @author Wayne Stambaugh * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -906,6 +907,11 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) NeedRIGHT(); break; + case T_blind_buried_vias_allowed: + designSettings.m_BlindBuriedViaAllowed = parseBool(); + NeedRIGHT(); + break; + case T_uvia_min_size: designSettings.m_MicroViasMinSize = parseBoardUnits( T_uvia_min_size ); NeedRIGHT(); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index a579b9ecbe..f4e5caa83b 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -120,7 +120,8 @@ enum pcbnew_ids ID_POPUP_PCB_EDIT_DIMENSION, 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_SWITCH_TRACK_POSTURE, diff --git a/pcbnew/scripting/plugins/qfp_wizard.py b/pcbnew/scripting/plugins/qfp_wizard.py new file mode 100644 index 0000000000..680c7faf35 --- /dev/null +++ b/pcbnew/scripting/plugins/qfp_wizard.py @@ -0,0 +1,230 @@ +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 diff --git a/pcbnew/mirepcb.cpp b/pcbnew/target_edit.cpp similarity index 77% rename from pcbnew/mirepcb.cpp rename to pcbnew/target_edit.cpp index d937793e73..348f56b102 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/target_edit.cpp @@ -1,8 +1,8 @@ /* * 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) 1992-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors. * * * This program is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ */ /** - * @file mirepcb.cpp + * @file dialog_target_properties.cpp * @brief Functions to edit targets (class #PCB_TARGET). */ @@ -32,13 +32,15 @@ #include #include #include +#include #include +#include #include #include #include -#include +#include // Routines Locales @@ -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 : public wxDialog +class TARGET_PROPERTIES_DIALOG_EDITOR : public TARGET_PROPERTIES_DIALOG_EDITOR_BASE { private: - PCB_EDIT_FRAME* m_Parent; wxDC* m_DC; PCB_TARGET* m_Target; - EDA_VALUE_CTRL* m_MireWidthCtrl; - EDA_VALUE_CTRL* m_MireSizeCtrl; - wxRadioBox* m_MireShape; public: TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, PCB_TARGET* Mire, wxDC* DC ); @@ -79,15 +77,8 @@ public: private: void OnOkClick( 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 ) { @@ -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, 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_DC = DC; - Centre(); - 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: - m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), - m_Target->GetSize(), - g_UserUnit, LeftBoxSizer ); + m_staticTextSizeUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); + m_MireSizeCtrl->SetValue( ReturnStringFromValue( g_UserUnit, m_Target->GetSize() ) ); - // Width: - m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), - m_Target->GetWidth(), - g_UserUnit, LeftBoxSizer ); + // Thickness: + m_staticTextThicknessUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); + m_MireWidthCtrl->SetValue( ReturnStringFromValue( g_UserUnit, m_Target->GetWidth() ) ); // 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 ); - LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 ); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); + Centre(); } @@ -170,9 +135,12 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) m_Target->SetFlags( IN_EDIT ); // set flag in edit to force // undo/redo/abort proper operation - m_Target->SetWidth( m_MireWidthCtrl->GetValue() ); - MireDefaultSize = m_MireSizeCtrl->GetValue(); - m_Target->SetSize( m_MireSizeCtrl->GetValue() ); + int tmp = ReturnValueFromString( g_UserUnit, m_MireWidthCtrl->GetValue() ); + m_Target->SetWidth( tmp ); + + MireDefaultSize = ReturnValueFromString( g_UserUnit, m_MireSizeCtrl->GetValue() ); + m_Target->SetSize( MireDefaultSize ); + m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 ); m_Target->Draw( m_Parent->GetCanvas(), m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR );