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.
This commit is contained in:
jean-pierre charras 2015-01-30 19:42:46 +01:00
parent 789bb9663c
commit 8412f2ad4e
14 changed files with 3471 additions and 72 deletions

View File

@ -311,6 +311,10 @@ ExternalProject_Add_Step( boost bzr_add_boost
ExternalProject_Add_Step( boost bzr_init_boost
COMMAND bzr init -q <SOURCE_DIR>
#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

View File

@ -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 );
};

View File

@ -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

View File

@ -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.

View File

@ -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 <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <base_units.h>
#include <module_editor_frame.h>
//#include <class_board.h>
#include <dialog_modedit_options_base.h>
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 );
}

View File

@ -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 );
}

File diff suppressed because it is too large Load Diff

View File

@ -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 <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// 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__

View File

@ -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_

View File

@ -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
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;

View File

@ -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 <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* 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 <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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 <fctsys.h>
#include <pgm_base.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
@ -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();

View File

@ -3,8 +3,8 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* 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 <wxPcbStruct.h>
#include <module_editor_frame.h>
#include <class_board_design_settings.h>
#include <layers_id_colors_and_visibility.h>
#include <pcbnew_id.h>
@ -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;
}

View File

@ -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().

View File

@ -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 <dick@softplc.com>
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -49,9 +49,12 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <dialog_hotkeys_editor.h>
#include <module_editor_frame.h>
#include <modview_frame.h>
#include <wildcards_and_files_ext.h>
#include <class_pcb_layer_widget.h>
#include <invoke_pcb_dialog.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -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" ) );
}
}