Commit 8412f2ad authored by jean-pierre charras's avatar jean-pierre charras
Browse files

ModEdit: add a settings menu option(and the corresponding dialog) to set...

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.
parent 789bb966
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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
+55 −35
Original line number Diff line number Diff line
/*
 * 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 );
};
+2 −0
Original line number Diff line number Diff line
@@ -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
+18 −6
Original line number Diff line number Diff line
/*
 * 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.
+133 −0
Original line number Diff line number Diff line
/*
 * 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 );
}
Loading