From 8412f2ad4e567228b9e69eaaf900e76e9726df75 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 30 Jan 2015 19:42:46 +0100 Subject: [PATCH] ModEdit: add a settings menu option(and the corresponding dialog) to set default values used when creating a footprint or add graphic items to a footprint being edited. These settings are now not common to the board editor, because the footprint editor can be run outside the board editor. download_boost.cmake: ignore .htm* files when installing boost. They are not used, and often have a very very long (and stupid) name which sometimes creates issues. --- CMakeModules/download_boost.cmake | 4 + include/class_board_design_settings.h | 90 +- pcbnew/CMakeLists.txt | 2 + pcbnew/class_board_design_settings.cpp | 24 +- pcbnew/dialogs/dialog_modedit_options.cpp | 133 + .../dialogs/dialog_modedit_options_base.cpp | 197 ++ .../dialogs/dialog_modedit_options_base.fbp | 2643 +++++++++++++++++ pcbnew/dialogs/dialog_modedit_options_base.h | 86 + pcbnew/invoke_pcb_dialog.h | 10 +- pcbnew/librairi.cpp | 23 +- pcbnew/menubar_modedit.cpp | 40 +- pcbnew/modeditoptions.cpp | 75 +- pcbnew/module_editor_frame.h | 22 + pcbnew/moduleframe.cpp | 194 +- 14 files changed, 3471 insertions(+), 72 deletions(-) create mode 100644 pcbnew/dialogs/dialog_modedit_options.cpp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.cpp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.fbp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.h diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index afb7320749..c29888c44d 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -311,6 +311,10 @@ ExternalProject_Add_Step( boost bzr_add_boost ExternalProject_Add_Step( boost bzr_init_boost COMMAND bzr init -q + #creates a .bzrignore file in boost root dir, to avoid copying useless files + #moreover these files have a very very long name, and sometimes + #have a too long full file name to be handled by DOS commands + COMMAND echo "*.htm*" > ${PREFIX}/src/boost/.bzrignore COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches" DEPENDERS bzr_add_boost DEPENDEES download diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 888cba99de..81acc694e5 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -111,15 +111,64 @@ public: double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size ///< The final margin is the sum of these 2 values - // Variables used in footprint handling + // Variables used in footprint edition (default value in item/footprint creation) + int m_ModuleSegmentWidth; ///< Default width for all graphic lines + // Note: the default layer is the active layer wxSize m_ModuleTextSize; ///< Default footprint texts size - int m_ModuleTextWidth; - int m_ModuleSegmentWidth; + int m_ModuleTextWidth; ///< Default footprint texts thickness + + wxString m_RefDefaultText; ///< Default ref text on fp creation + // if empty, use footprint name as default + bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation + int m_RefDefaultlayer; ///< Default ref text layer on fp creation + // should be a LAYER_ID, but use an int + // to save this param in config + + wxString m_ValueDefaultText; ///< Default value text on fp creation + // if empty, use footprint name as default + bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation + int m_ValueDefaultlayer; ///< Default value text layer on fp creation + // should be a LAYER_ID, but use an int + // to save this param in config + + // Miscellaneous wxPoint m_AuxOrigin; ///< origin for plot exports wxPoint m_GridOrigin; ///< origin for grid offsets - D_PAD m_Pad_Master; + D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters + // when importing values or create a new pad +private: + /// Index for #m_ViasDimensionsList to select the current via size. + /// 0 is the index selection of the default value Netclass + unsigned m_viaSizeIndex; + + // Index for m_TrackWidthList to select the value. + /// 0 is the index selection of the default value Netclass + unsigned m_trackWidthIndex; + + ///> Use custom values for track/via sizes (not specified in net class nor in the size lists). + bool m_useCustomTrackVia; + + ///> Custom track width (used after UseCustomTrackViaSize( true ) was called). + int m_customTrackWidth; + + ///> Custom via size (used after UseCustomTrackViaSize( true ) was called). + VIA_DIMENSION m_customViaSize; + + int m_copperLayerCount; ///< Number of copper layers for this design + + LSET m_enabledLayers; ///< Bit-mask for layer enabling + LSET m_visibleLayers; ///< Bit-mask for layer visibility + + int m_visibleElements; ///< Bit-mask for element category visibility + int m_boardThickness; ///< Board thickness for 3D viewer + + /// Current net class name used to display netclass info. + /// This is also the last used netclass after starting a track. + wxString m_currentNetClassName; + +public: BOARD_DESIGN_SETTINGS(); /** @@ -489,35 +538,6 @@ public: inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; } private: - /// Index for #m_ViasDimensionsList to select the current via size. - /// 0 is the index selection of the default value Netclass - unsigned m_viaSizeIndex; - - // Index for m_TrackWidthList to select the value. - /// 0 is the index selection of the default value Netclass - unsigned m_trackWidthIndex; - - ///> Use custom values for track/via sizes (not specified in net class nor in the size lists). - bool m_useCustomTrackVia; - - ///> Custom track width (used after UseCustomTrackViaSize( true ) was called). - int m_customTrackWidth; - - ///> Custom via size (used after UseCustomTrackViaSize( true ) was called). - VIA_DIMENSION m_customViaSize; - - int m_copperLayerCount; ///< Number of copper layers for this design - - LSET m_enabledLayers; ///< Bit-mask for layer enabling - LSET m_visibleLayers; ///< Bit-mask for layer visibility - - int m_visibleElements; ///< Bit-mask for element category visibility - int m_boardThickness; ///< Board thickness for 3D viewer - - /// Current net class name used to display netclass info. - /// This is also the last used netclass after starting a track. - wxString m_currentNetClassName; - void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const throw( IO_ERROR ); }; diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 351f5cc845..0e916943cf 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -96,6 +96,8 @@ set( PCBNEW_DIALOGS dialogs/dialog_layer_selection_base.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup_base.cpp + dialogs/dialog_modedit_options.cpp + dialogs/dialog_modedit_options_base.cpp dialogs/dialog_netlist.cpp dialogs/dialog_netlist_fbp.cpp dialogs/dialog_pcb_text_properties.cpp diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 844eb4211f..de8a318421 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -96,16 +96,28 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : // The final margin is the sum of these 2 values // Usually < 0 because the mask is smaller than pad - m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, - DEFAULT_TEXT_MODULE_SIZE ); - m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; - m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; - // Layer thickness for 3D viewer m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM ); m_viaSizeIndex = 0; m_trackWidthIndex = 0; + + // Default values for the footprint editor and fp creation + // (also covers footprints created on the fly by micor-waves tools) + m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, + DEFAULT_TEXT_MODULE_SIZE ); + m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; + m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; + + // These values will be overriden by config values after reading the config + // Default ref text on fp creation. if empty, use footprint name as default + m_RefDefaultText = wxT( "REF**" ); + m_RefDefaultVisibility = true; // Default ref text visibility on fp creation + m_RefDefaultlayer = int( F_SilkS ); // Default ref text layer on fp creation + // Default value text on fp creation. if empty, use footprint name as default + m_ValueDefaultText = wxEmptyString; + m_ValueDefaultVisibility = true; + m_ValueDefaultlayer = int( F_Fab ); } // Add parameters to save in project config. diff --git a/pcbnew/dialogs/dialog_modedit_options.cpp b/pcbnew/dialogs/dialog_modedit_options.cpp new file mode 100644 index 0000000000..438cbae522 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options.cpp @@ -0,0 +1,133 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/** + * @file dialog_modedit_options.cpp + */ + +#include +#include +#include +#include +#include + +#include +//#include + +#include +class DIALOG_MODEDIT_OPTIONS : public DIALOG_MODEDIT_OPTIONS_BASE +{ + BOARD_DESIGN_SETTINGS m_brdSettings; + FOOTPRINT_EDIT_FRAME * m_parent; + +public: + DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent ); + +private: + void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } + void OnOkClick( wxCommandEvent& event ); + + void initValues( ); +}; + + +DIALOG_MODEDIT_OPTIONS::DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent ) : + DIALOG_MODEDIT_OPTIONS_BASE( aParent ) +{ + m_parent = aParent; + m_brdSettings = m_parent->GetDesignSettings(); + initValues( ); + + GetSizer()->SetSizeHints( this ); + + Centre(); +} + + +bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller ) +{ + DIALOG_MODEDIT_OPTIONS dlg( aCaller ); + + int ret = dlg.ShowModal(); + + return ret == wxID_OK; +} + + +void DIALOG_MODEDIT_OPTIONS::initValues() +{ + EDA_UNITS_T units = g_UserUnit; + + // Modules: graphic lines width: + m_staticTextGrLineUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleGrLineWidth, m_brdSettings.m_ModuleSegmentWidth ); + + // Modules: Texts: Size & width: + m_staticTextTextWidthUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextWidth, m_brdSettings.m_ModuleTextWidth ); + + m_staticTextTextVSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextVSize, m_brdSettings.m_ModuleTextSize.y ); + + m_staticTextTextHSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextHSize, m_brdSettings.m_ModuleTextSize.x ); + + // Ref: default values + m_textCtrlRefText->SetValue( m_brdSettings.m_RefDefaultText ); + int sel = m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1; + m_choiceLayerReference->SetSelection( sel ); + sel = m_brdSettings.m_RefDefaultVisibility ? 0 : 1; + m_choiceVisibleReference->SetSelection( sel ); + + // Value: default values + m_textCtrlValueText->SetValue( m_brdSettings.m_ValueDefaultText ); + sel = m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1; + m_choiceLayerValue->SetSelection( sel ); + sel = m_brdSettings.m_ValueDefaultVisibility ? 0 : 1; + m_choiceVisibleValue->SetSelection( sel ); +} + +void DIALOG_MODEDIT_OPTIONS::OnOkClick( wxCommandEvent& event ) +{ + m_brdSettings.m_ModuleSegmentWidth = ValueFromTextCtrl( *m_OptModuleGrLineWidth ); + m_brdSettings.m_ModuleTextWidth = ValueFromTextCtrl( *m_OptModuleTextWidth ); + m_brdSettings.m_ModuleTextSize.y = ValueFromTextCtrl( *m_OptModuleTextVSize ); + m_brdSettings.m_ModuleTextSize.x = ValueFromTextCtrl( *m_OptModuleTextHSize ); + + // Ref: default values + m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue(); + int sel = m_choiceLayerReference->GetSelection(); + m_brdSettings.m_RefDefaultlayer = sel == 1 ? F_Fab : F_SilkS; + sel = m_choiceVisibleReference->GetSelection(); + m_brdSettings.m_RefDefaultVisibility = sel != 1; + + // Value: default values + m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue(); + sel = m_choiceLayerValue->GetSelection(); + m_brdSettings.m_ValueDefaultlayer = sel == 1 ? F_Fab : F_SilkS; + sel = m_choiceVisibleValue->GetSelection(); + m_brdSettings.m_ValueDefaultVisibility = sel != 1; + + m_parent->SetDesignSettings( m_brdSettings ); + + EndModal( wxID_OK ); +} diff --git a/pcbnew/dialogs/dialog_modedit_options_base.cpp b/pcbnew/dialogs/dialog_modedit_options_base.cpp new file mode 100644 index 0000000000..d0769d2311 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.cpp @@ -0,0 +1,197 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_modedit_options_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_MODEDIT_OPTIONS_BASE::DIALOG_MODEDIT_OPTIONS_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 ); + + m_staticText281 = new wxStaticText( this, wxID_ANY, _("On new graphic item creation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText281->Wrap( -1 ); + m_staticText281->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerUpper->Add( m_staticText281, 0, wxALL, 5 ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizer1->AddGrowableCol( 1 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_EdgeModEWidthTitle = new wxStaticText( this, wxID_ANY, _("Graphic line width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_EdgeModEWidthTitle->Wrap( -1 ); + fgSizer1->Add( m_EdgeModEWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleGrLineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleGrLineWidth->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleGrLineWidth, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextGrLineUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrLineUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextGrLineUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModWidthTitle = new wxStaticText( this, wxID_ANY, _("Text width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModWidthTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleTextWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextWidth->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextWidth, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextWidthUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextWidthUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextWidthUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModSizeVTitle = new wxStaticText( this, wxID_ANY, _("Text size V"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModSizeVTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModSizeVTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleTextVSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextVSize->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextVSize, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextVSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextVSizeUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextVSizeUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModSizeHTitle = new wxStaticText( this, wxID_ANY, _("Text size H"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModSizeHTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModSizeHTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_OptModuleTextHSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextHSize->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextHSize, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextHSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextHSizeUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextHSizeUnit, 0, wxALL, 5 ); + + + bSizerUpper->Add( fgSizer1, 1, wxEXPAND|wxLEFT, 20 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerUpper->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_staticText28 = new wxStaticText( this, wxID_ANY, _("Default values on new footprint creation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText28->Wrap( -1 ); + m_staticText28->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerUpper->Add( m_staticText28, 0, wxALL, 5 ); + + m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Leave ref or value blank to use the footprint name as default text"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextInfo->Wrap( -1 ); + bSizerUpper->Add( m_staticTextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxFlexGridSizer* fgSizer2; + fgSizer2 = new wxFlexGridSizer( 0, 6, 0, 0 ); + fgSizer2->AddGrowableCol( 1 ); + fgSizer2->AddGrowableCol( 3 ); + fgSizer2->AddGrowableCol( 5 ); + fgSizer2->SetFlexibleDirection( wxBOTH ); + fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextRef = new wxStaticText( this, wxID_ANY, _("Ref"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRef->Wrap( -1 ); + fgSizer2->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlRefText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlRefText->SetToolTip( _("Default text for reference\nLeave blank to use the footprint name") ); + + fgSizer2->Add( m_textCtrlRefText, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextRefLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRefLayer->Wrap( -1 ); + fgSizer2->Add( m_staticTextRefLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceLayerReferenceChoices[] = { _("SilkScreen"), _("Fab. Layer") }; + int m_choiceLayerReferenceNChoices = sizeof( m_choiceLayerReferenceChoices ) / sizeof( wxString ); + m_choiceLayerReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 ); + m_choiceLayerReference->SetSelection( 0 ); + fgSizer2->Add( m_choiceLayerReference, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText32 = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText32->Wrap( -1 ); + fgSizer2->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceVisibleReferenceChoices[] = { _("Visible"), _("Invisible") }; + int m_choiceVisibleReferenceNChoices = sizeof( m_choiceVisibleReferenceChoices ) / sizeof( wxString ); + m_choiceVisibleReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 ); + m_choiceVisibleReference->SetSelection( 0 ); + fgSizer2->Add( m_choiceVisibleReference, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextValue = new wxStaticText( this, wxID_ANY, _("Value"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValue->Wrap( -1 ); + fgSizer2->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlValueText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlValueText->SetToolTip( _("Default text for value\nLeave blank to use the footprint name") ); + + fgSizer2->Add( m_textCtrlValueText, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextValLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValLayer->Wrap( -1 ); + fgSizer2->Add( m_staticTextValLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceLayerValueChoices[] = { _("SilkScreen"), _("Fab. Layer") }; + int m_choiceLayerValueNChoices = sizeof( m_choiceLayerValueChoices ) / sizeof( wxString ); + m_choiceLayerValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 ); + m_choiceLayerValue->SetSelection( 1 ); + fgSizer2->Add( m_choiceLayerValue, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticTextValVisibility = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValVisibility->Wrap( -1 ); + fgSizer2->Add( m_staticTextValVisibility, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceVisibleValueChoices[] = { _("Visible"), _("Invisible") }; + int m_choiceVisibleValueNChoices = sizeof( m_choiceVisibleValueChoices ) / sizeof( wxString ); + m_choiceVisibleValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 ); + m_choiceVisibleValue->SetSelection( 0 ); + fgSizer2->Add( m_choiceVisibleValue, 0, wxALL|wxEXPAND, 5 ); + + + bSizerUpper->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 20 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerUpper->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + + bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + // Connect Events + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_MODEDIT_OPTIONS_BASE::~DIALOG_MODEDIT_OPTIONS_BASE() +{ + // Disconnect Events + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_modedit_options_base.fbp b/pcbnew/dialogs/dialog_modedit_options_base.fbp new file mode 100644 index 0000000000..b5dc8fc06e --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.fbp @@ -0,0 +1,2643 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_modedit_options_base + 1000 + none + 1 + dialog_graphic_items_options + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_MODEDIT_OPTIONS_BASE + + 502,352 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Footprint Editor Options + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + On new graphic item creation: + + 0 + + + 0 + + 1 + m_staticText281 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxEXPAND|wxLEFT + 1 + + 3 + wxBOTH + 1 + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphic line width + + 0 + + + 0 + + 1 + m_EdgeModEWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleGrLineWidth + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextGrLineUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text width + + 0 + + + 0 + + 1 + m_TextModWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextWidth + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextTextWidthUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text size V + + 0 + + + 0 + + 1 + m_TextModSizeVTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextVSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextTextVSizeUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text size H + + 0 + + + 0 + + 1 + m_TextModSizeHTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextHSize + 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_staticTextTextHSizeUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + Default values on new footprint creation: + + 0 + + + 0 + + 1 + m_staticText28 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Leave ref or value blank to use the footprint name as default text + + 0 + + + 0 + + 1 + m_staticTextInfo + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxEXPAND|wxLEFT + 0 + + 6 + wxBOTH + 1,3,5 + + 0 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ref + + 0 + + + 0 + + 1 + m_staticTextRef + 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_textCtrlRefText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Default text for reference Leave blank to use the footprint name + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer + + 0 + + + 0 + + 1 + m_staticTextRefLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "SilkScreen" "Fab. Layer" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceLayerReference + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visibility + + 0 + + + 0 + + 1 + m_staticText32 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Visible" "Invisible" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceVisibleReference + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Value + + 0 + + + 0 + + 1 + m_staticTextValue + 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_textCtrlValueText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Default text for value Leave blank to use the footprint name + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer + + 0 + + + 0 + + 1 + m_staticTextValLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "SilkScreen" "Fab. Layer" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceLayerValue + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visibility + + 0 + + + 0 + + 1 + m_staticTextValVisibility + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Visible" "Invisible" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceVisibleValue + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_modedit_options_base.h b/pcbnew/dialogs/dialog_modedit_options_base.h new file mode 100644 index 0000000000..b11c2398be --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_MODEDIT_OPTIONS_BASE_H__ +#define __DIALOG_MODEDIT_OPTIONS_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_MODEDIT_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_MODEDIT_OPTIONS_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticText281; + wxStaticText* m_EdgeModEWidthTitle; + wxTextCtrl* m_OptModuleGrLineWidth; + wxStaticText* m_staticTextGrLineUnit; + wxStaticText* m_TextModWidthTitle; + wxTextCtrl* m_OptModuleTextWidth; + wxStaticText* m_staticTextTextWidthUnit; + wxStaticText* m_TextModSizeVTitle; + wxTextCtrl* m_OptModuleTextVSize; + wxStaticText* m_staticTextTextVSizeUnit; + wxStaticText* m_TextModSizeHTitle; + wxTextCtrl* m_OptModuleTextHSize; + wxStaticText* m_staticTextTextHSizeUnit; + wxStaticLine* m_staticline1; + wxStaticText* m_staticText28; + wxStaticText* m_staticTextInfo; + wxStaticText* m_staticTextRef; + wxTextCtrl* m_textCtrlRefText; + wxStaticText* m_staticTextRefLayer; + wxChoice* m_choiceLayerReference; + wxStaticText* m_staticText32; + wxChoice* m_choiceVisibleReference; + wxStaticText* m_staticTextValue; + wxTextCtrl* m_textCtrlValueText; + wxStaticText* m_staticTextValLayer; + wxChoice* m_choiceLayerValue; + wxStaticText* m_staticTextValVisibility; + wxChoice* m_choiceVisibleValue; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_MODEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 502,352 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_MODEDIT_OPTIONS_BASE(); + +}; + +#endif //__DIALOG_MODEDIT_OPTIONS_BASE_H__ diff --git a/pcbnew/invoke_pcb_dialog.h b/pcbnew/invoke_pcb_dialog.h index 89d5bb5ef4..df9ceaf2d0 100644 --- a/pcbnew/invoke_pcb_dialog.h +++ b/pcbnew/invoke_pcb_dialog.h @@ -46,7 +46,6 @@ class wxTopLevelWindow; class wxPoint; class wxSize; -//class wxRealPoint; class wxString; class BOARD; @@ -55,6 +54,7 @@ class MODULE; // Often this is not used in the prototypes, since wxFrame is good enough and would // represent maximum information hiding. class PCB_BASE_FRAME; +class FOOTPRINT_EDIT_FRAME; class FP_LIB_TABLE; class BOARD; class PCB_PLOT_PARAMS; @@ -124,4 +124,12 @@ bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard ); */ bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings ); +/** + * Function InvokeSVGPrint + * shows the SVG print dialog + * @param aCaller is the FOOTPRINT_EDIT_FRAME which is invoking the dialog. + * @return bool - true if user pressed OK (did not abort), else false. + */ +bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller ); + #endif // INVOKE_A_DIALOG_H_ diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 05d33a7d07..fe6963a717 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -750,22 +750,33 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName ) module->SetFPID( FPID( moduleName ) ); wxPoint default_pos; + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); // Update reference: - module->SetReference( wxT( "REF**" ) ); - module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth ); - module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize ); + if( settings.m_RefDefaultText.IsEmpty() ) + module->SetReference( moduleName ); + else + module->SetReference( settings.m_RefDefaultText ); + + module->Reference().SetThickness( settings.m_ModuleTextWidth ); + module->Reference().SetSize( settings.m_ModuleTextSize ); default_pos.y = GetDesignSettings().m_ModuleTextSize.y / 2; module->Reference().SetPosition( default_pos ); - module->Reference().SetLayer( F_SilkS ); + module->Reference().SetLayer( ToLAYER_ID( settings.m_RefDefaultlayer ) ); + module->Reference().SetVisible( settings.m_RefDefaultVisibility ); // Set the value field to a default value - module->SetValue( moduleName ); + if( settings.m_ValueDefaultText.IsEmpty() ) + module->SetValue( moduleName ); + else + module->SetValue( settings.m_ValueDefaultText ); + module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth ); module->Value().SetSize( GetDesignSettings().m_ModuleTextSize ); default_pos.y = -default_pos.y; module->Value().SetPosition( default_pos ); - module->Value().SetLayer( F_Fab ); + module->Value().SetLayer( ToLAYER_ID( settings.m_ValueDefaultlayer ) ); + module->Value().SetVisible( settings.m_ValueDefaultVisibility ); SetMsgPanel( module ); return module; diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index ca6935ef58..ee4146a1ef 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -2,10 +2,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,6 +30,7 @@ * @brief (Re)Create the main menubar for the module editor */ #include +#include #include #include @@ -150,7 +151,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Close footprint editor" ), KiBitmap( exit_xpm ) ); - // Menu Edit: + //----- Edit menu ------------------ wxMenu* editMenu = new wxMenu; // Undo @@ -198,7 +199,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "&User Grid Size" ), _( "Adjust user grid" ), KiBitmap( grid_xpm ) ); - // View menu + //--------- View menu ---------------- wxMenu* viewMenu = new wxMenu; /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: @@ -237,7 +238,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Show board in 3D viewer" ), KiBitmap( three_d_xpm ) ); - // Menu Place: + //-------- Place menu -------------------- wxMenu* placeMenu = new wxMenu; // Pad @@ -276,7 +277,26 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Place footprint reference anchor" ), KiBitmap( anchor_xpm ) ); - // Menu Help: + + //----- Preferences menu ----------------- + wxMenu* prefs_menu = new wxMenu; + + AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT, + _( "Li&brary Tables" ), _( "Setup footprint libraries" ), + KiBitmap( library_table_xpm ) ); + + // Settings + AddMenuItem( prefs_menu, wxID_PREFERENCES, + _( "&Settings" ), _( "Select default parameters values in Footprint Editor" ), + KiBitmap( preference_xpm ) ); + + // Language submenu + Pgm().AddMenuLanguageList( prefs_menu ); + + // Hotkey submenu + AddHotkeyConfigMenu( prefs_menu ); + + //----- Help menu -------------------- wxMenu* helpMenu = new wxMenu; // Version info @@ -303,10 +323,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); - menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); + menuBar->Append( prefs_menu, _( "P&references" ) ); + menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index 2134d2a304..f4e776afcc 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -3,8 +3,8 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -78,3 +79,73 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; } } + + +PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); + + if( m_configSettings.empty() ) + { + // Display options: + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ), + (int*)&g_UserUnit, MILLIMETRES ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ), + &displ_opts->m_DisplayPolarCood, false ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), + &displ_opts->m_DisplayPadFill, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorGraphicLinesDisplayMode" ), + &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ), + &settings.m_RefDefaultText, wxT( "REF**" ) ) ); + + // design settings + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ), + &settings.m_ModuleSegmentWidth, + Millimeter2iu( 0.15 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ), + &settings.m_ModuleTextSize.x, + Millimeter2iu( 1.5 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ), + &settings.m_ModuleTextSize.y, + Millimeter2iu( 1.5 ), + Millimeter2iu(0.01), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ), + &settings.m_ModuleTextWidth, + Millimeter2iu( 0.15 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ), + NULL, 1/IU_PER_MM ) ); + + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, + wxT( "FpEditorRefDefaultText" ), + &settings.m_RefDefaultText, wxT( "REF**" ) ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, + wxT( "FpEditorRefDefaultVisibility" ), + &settings.m_RefDefaultVisibility, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ), + &settings.m_RefDefaultlayer, + int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) ); + + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ), + &settings.m_ValueDefaultText, wxT( "" ) ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, + wxT( "FpEditorValueDefaultVisibility" ), + &settings.m_ValueDefaultVisibility, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ), + &settings.m_ValueDefaultlayer, + int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) ); + } + + return m_configSettings; +} + diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 282fd1ff5a..1bd3c040d1 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -60,6 +60,23 @@ public: const PCB_PLOT_PARAMS& GetPlotSettings() const; // overload PCB_BASE_FRAME, get parent's void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ); // overload + void LoadSettings( wxConfigBase* aCfg ); // Virtual + void SaveSettings( wxConfigBase* aCfg ); // Virtual + + /** + * Function GetConfigurationSettings + * returns the footprçint editor settings list. + * + * Currently, only the settings that are needed at start + * up by the main window are defined here. There are other locally used + * settings that are scattered throughout the Pcbnew source code. If you need + * to define a configuration setting that needs to be loaded at run time, + * this is the place to define it. + * + * @return - Reference to the list of applications settings. + */ + PARAM_CFG_ARRAY& GetConfigurationSettings(); + void InstallOptionsFrame( const wxPoint& pos ); void OnCloseWindow( wxCloseEvent& Event ); @@ -67,6 +84,8 @@ public: void Process_Special_Functions( wxCommandEvent& event ); + void ProcessPreferences( wxCommandEvent& event ); + /** * Function RedrawActiveWindoow * draws the footprint editor BOARD, and others elements such as axis and grid. @@ -141,6 +160,7 @@ public: void OnVerticalToolbar( wxCommandEvent& aEvent ); void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ); + void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ); void OnUpdateLibSelected( wxUpdateUIEvent& aEvent ); void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent ); void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent ); @@ -486,6 +506,8 @@ protected: PCB_LAYER_WIDGET* m_Layers; + PARAM_CFG_ARRAY m_configSettings; ///< List of footprint editor configuration settings. + /** * Function UpdateTitle * updates window title according to getLibNickName(). diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index a978a1c496..a214f33af8 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2015 Wayne Stambaugh * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * @@ -49,9 +49,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include @@ -115,6 +118,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) + // Preferences et option menus + EVT_MENU( ID_PREFERENCES_HOTKEY_EXPORT_CONFIG, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_IMPORT_CONFIG, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_EDITOR, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PCB_LIB_TABLE_EDIT, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( wxID_PREFERENCES, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + // popup commands EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) @@ -159,10 +176,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard ) EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + + // Option toolbar: + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, - FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected ) @@ -425,11 +452,10 @@ BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const // get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD. // @todo(DICK) change the routing to some default or the board directly, parent may not exist - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// wxASSERT( parentFrame ); - wxASSERT( parentFrame ); - - return parentFrame->GetDesignSettings(); + return GetBoard()->GetDesignSettings(); } @@ -438,11 +464,10 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett // set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD. // @todo(DICK) change the routing to some default or the board directly, parent may not exist - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// wxASSERT( parentFrame ); - wxASSERT( parentFrame ); - - parentFrame->SetDesignSettings( aSettings ); + GetBoard()->SetDesignSettings( aSettings ); } @@ -452,7 +477,6 @@ const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const // @todo(DICK) change the routing to some default or the board directly, parent may not exist PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); - wxASSERT( parentFrame ); return parentFrame->GetPlotSettings(); @@ -465,13 +489,35 @@ void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) // @todo(DICK) change the routing to some default or the board directly, parent may not exist PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); - wxASSERT( parentFrame ); parentFrame->SetPlotSettings( aSettings ); } +void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) +{ + EDA_DRAW_FRAME::LoadSettings( aCfg ); + wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); + + // Ensure some params are valid + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); + + if( ( settings.m_RefDefaultlayer != F_SilkS ) && ( settings.m_RefDefaultlayer != F_Fab ) ) + settings.m_RefDefaultlayer = F_SilkS; + + if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) ) + settings.m_ValueDefaultlayer = F_Fab; +} + + +void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) +{ + EDA_DRAW_FRAME::SaveSettings( aCfg ); + wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); +} + + void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( GetScreen()->IsModify() ) @@ -526,6 +572,43 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) aEvent.Check( GetToolId() == aEvent.GetId() ); } +void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) +{ + int id = aEvent.GetId(); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + bool state = false; + + switch( id ) + { + case ID_TB_OPTIONS_SHOW_PADS_SKETCH: + state = !displ_opts->m_DisplayPadFill; + break; + + case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: + state = !displ_opts->m_DisplayViaFill; + break; + + case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: + state = displ_opts->m_DisplayModText == SKETCH; + break; + + case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: + state = displ_opts->m_DisplayModEdge == SKETCH; + break; + + case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: + state = displ_opts->m_ContrastModeDisplay; + break; + + default: + wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" ) ); + break; + } + + aEvent.Check( state ); +} + void FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected( wxUpdateUIEvent& aEvent ) { @@ -754,3 +837,90 @@ void FOOTPRINT_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState ) m_Layers->SetRenderState( aElement, aNewState ); } + +void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event ) +{ + int id = event.GetId(); + + switch( id ) + { + // Hotkey IDs + case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: + ExportHotkeyConfigToFile( g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG: + ImportHotkeyConfigFromFile( g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: + InstallHotkeyFrame( this, g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: + // Display current hotkey list for the footprint editor. + DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PCB_LIB_TABLE_EDIT: + { + bool tableChanged = false; + int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() ); + + if( r & 1 ) + { + try + { + FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() ); + + GFootprintTable.Format( &sf, 0 ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( + "Error occurred saving the global footprint library " + "table:\n\n%s" ), + GetChars( ioe.errorText.GetData() ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + if( r & 2 ) + { + wxString tblName = Prj().FootprintLibTblName(); + + try + { + Prj().PcbFootprintLibs()->Save( tblName ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( + "Error occurred saving project specific footprint library " + "table:\n\n%s" ), + GetChars( ioe.errorText ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + FOOTPRINT_VIEWER_FRAME* viewer; + viewer = (FOOTPRINT_VIEWER_FRAME*)Kiway().Player( FRAME_PCB_MODULE_VIEWER, false ); + + if( tableChanged && viewer != NULL ) + viewer->ReCreateLibraryList(); + } + break; + + case wxID_PREFERENCES: + InvokeFPEditorPrefsDlg( this ); + break; + + default: + DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" ) ); + } +} +