Generalize default footprint fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/2289
This commit is contained in:
parent
7305f407fc
commit
3c3984a6fc
|
@ -38,9 +38,14 @@ extern const char* traceSettings;
|
|||
JSON_SETTINGS::JSON_SETTINGS( const std::string& aFilename, SETTINGS_LOC aLocation,
|
||||
int aSchemaVersion, bool aCreateIfMissing, bool aWriteFile,
|
||||
nlohmann::json aDefault ) :
|
||||
nlohmann::json( std::move( aDefault ) ), m_filename( aFilename ), m_legacy_filename( "" ),
|
||||
m_location( aLocation ), m_createIfMissing( aCreateIfMissing ), m_writeFile( aWriteFile ),
|
||||
m_schemaVersion( aSchemaVersion ), m_manager( nullptr )
|
||||
nlohmann::json( std::move( aDefault ) ),
|
||||
m_filename( aFilename ),
|
||||
m_legacy_filename( "" ),
|
||||
m_location( aLocation ),
|
||||
m_createIfMissing( aCreateIfMissing ),
|
||||
m_writeFile( aWriteFile ),
|
||||
m_schemaVersion( aSchemaVersion ),
|
||||
m_manager( nullptr )
|
||||
{
|
||||
m_params.emplace_back(
|
||||
new PARAM<std::string>( "meta.filename", &m_filename, m_filename, true ) );
|
||||
|
|
|
@ -151,8 +151,8 @@ bool PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromGrid()
|
|||
for( int row = 0; row < m_grid->GetNumberRows(); ++row )
|
||||
{
|
||||
m_fields[row].m_Name = m_grid->GetCellValue( row, 0 );
|
||||
m_fields[row].m_Visible = ( m_grid->GetCellValue( row, 1 ) != wxEmptyString );
|
||||
m_fields[row].m_URL = ( m_grid->GetCellValue( row, 2 ) != wxEmptyString );
|
||||
m_fields[row].m_Visible = m_grid->GetCellValue( row, 1 ) != wxEmptyString;
|
||||
m_fields[row].m_URL = m_grid->GetCellValue( row, 2 ) != wxEmptyString;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -175,6 +175,22 @@ enum
|
|||
LAYER_CLASS_COUNT
|
||||
};
|
||||
|
||||
|
||||
struct TEXT_ITEM_INFO
|
||||
{
|
||||
wxString m_Text;
|
||||
bool m_Visible;
|
||||
int m_Layer;
|
||||
|
||||
TEXT_ITEM_INFO( const wxString& aText, bool aVisible, int aLayer )
|
||||
{
|
||||
m_Text = aText;
|
||||
m_Visible = aVisible;
|
||||
m_Layer = aLayer;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// forward declaration from class_track.h
|
||||
enum class VIATYPE : int;
|
||||
|
||||
|
@ -230,6 +246,9 @@ 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 editing (default value in item/footprint creation)
|
||||
std::vector<TEXT_ITEM_INFO> m_DefaultFPTextItems;
|
||||
|
||||
// Arrays of default values for the various layer classes.
|
||||
int m_LineThickness[ LAYER_CLASS_COUNT ];
|
||||
wxSize m_TextSize[ LAYER_CLASS_COUNT ];
|
||||
|
@ -240,22 +259,6 @@ public:
|
|||
int m_DimensionUnits;
|
||||
int m_DimensionPrecision;
|
||||
|
||||
// Variables used in footprint editing (default value in item/footprint creation)
|
||||
|
||||
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 PCB_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 PCB_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
|
||||
|
|
|
@ -150,10 +150,7 @@ public:
|
|||
|
||||
if( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
|
||||
aNumRows );
|
||||
|
||||
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
|
@ -170,11 +167,7 @@ public:
|
|||
erase( start, start + aNumRows );
|
||||
if( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this,
|
||||
wxGRIDTABLE_NOTIFY_ROWS_DELETED,
|
||||
aPos,
|
||||
aNumRows );
|
||||
|
||||
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -33,7 +33,9 @@ class PARAM_BASE
|
|||
{
|
||||
public:
|
||||
PARAM_BASE( std::string aJsonPath, bool aReadOnly ) :
|
||||
m_path( std::move( aJsonPath ) ), m_readOnly( aReadOnly ) {}
|
||||
m_path( std::move( aJsonPath ) ),
|
||||
m_readOnly( aReadOnly )
|
||||
{}
|
||||
|
||||
virtual ~PARAM_BASE() = default;
|
||||
|
||||
|
@ -65,15 +67,23 @@ class PARAM : public PARAM_BASE
|
|||
public:
|
||||
PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault,
|
||||
bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ),
|
||||
m_min(), m_max(), m_use_minmax( false )
|
||||
{}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault ),
|
||||
m_min(),
|
||||
m_max(),
|
||||
m_use_minmax( false )
|
||||
{ }
|
||||
|
||||
PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin,
|
||||
ValueType aMax, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ),
|
||||
m_min( aMin ), m_max( aMax ), m_use_minmax( true )
|
||||
{}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault ),
|
||||
m_min( aMin ),
|
||||
m_max( aMax ),
|
||||
m_use_minmax( true )
|
||||
{ }
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
|
@ -119,6 +129,7 @@ private:
|
|||
bool m_use_minmax;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Like a normal param, but with custom getter and setter functions
|
||||
* @tparam ValueType is the value to store
|
||||
|
@ -128,10 +139,13 @@ class PARAM_LAMBDA : public PARAM_BASE
|
|||
{
|
||||
public:
|
||||
PARAM_LAMBDA( const std::string& aJsonPath, std::function<ValueType()> aGetter,
|
||||
std::function<void( ValueType )> aSetter, ValueType aDefault, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_default( aDefault ), m_getter( aGetter ),
|
||||
std::function<void( ValueType )> aSetter, ValueType aDefault,
|
||||
bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_default( aDefault ),
|
||||
m_getter( aGetter ),
|
||||
m_setter( aSetter )
|
||||
{}
|
||||
{ }
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
|
@ -183,6 +197,7 @@ private:
|
|||
std::function<void( ValueType )> m_setter;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Represents a parameter that has a scaling factor between the value in the file and the
|
||||
* value used internally (i.e. the value pointer). This basically only makes sense to use
|
||||
|
@ -195,15 +210,25 @@ class PARAM_SCALED: public PARAM_BASE
|
|||
public:
|
||||
PARAM_SCALED( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault,
|
||||
double aScale = 1.0, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ),
|
||||
m_min(), m_max(), m_use_minmax( false ), m_scale( aScale )
|
||||
{}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault ),
|
||||
m_min(),
|
||||
m_max(),
|
||||
m_use_minmax( false ),
|
||||
m_scale( aScale )
|
||||
{ }
|
||||
|
||||
PARAM_SCALED( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin,
|
||||
ValueType aMax, double aScale = 1.0, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ),
|
||||
m_min( aMin ), m_max( aMax ), m_use_minmax( true ), m_scale( aScale )
|
||||
{}
|
||||
PARAM_SCALED( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault,
|
||||
ValueType aMin, ValueType aMax, double aScale = 1.0, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault ),
|
||||
m_min( aMin ),
|
||||
m_max( aMax ),
|
||||
m_use_minmax( true ),
|
||||
m_scale( aScale )
|
||||
{ }
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
|
@ -256,11 +281,17 @@ class PARAM_LIST : public PARAM_BASE
|
|||
public:
|
||||
PARAM_LIST( const std::string& aJsonPath, std::vector<Type>* aPtr,
|
||||
std::initializer_list<Type> aDefault, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ) {}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault )
|
||||
{ }
|
||||
|
||||
PARAM_LIST( const std::string& aJsonPath, std::vector<Type>* aPtr,
|
||||
std::vector<Type> aDefault, bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ) {}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault )
|
||||
{ }
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
|
@ -304,6 +335,7 @@ private:
|
|||
std::vector<Type> m_default;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Represents a map of <std::string, Value>. The key parameter has to be a string in JSON.
|
||||
*
|
||||
|
@ -323,7 +355,10 @@ public:
|
|||
PARAM_MAP( const std::string& aJsonPath, std::map<std::string, Value>* aPtr,
|
||||
std::initializer_list<std::pair<const std::string, Value>> aDefault,
|
||||
bool aReadOnly = false ) :
|
||||
PARAM_BASE( aJsonPath, aReadOnly ), m_ptr( aPtr ), m_default( aDefault ) {}
|
||||
PARAM_BASE( aJsonPath, aReadOnly ),
|
||||
m_ptr( aPtr ),
|
||||
m_default( aDefault )
|
||||
{ }
|
||||
|
||||
void Load( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
|
|
|
@ -551,6 +551,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
m_BlindBuriedViaAllowed = false;
|
||||
m_MicroViasAllowed = false;
|
||||
|
||||
// First is always the reference designator
|
||||
m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
|
||||
// Second is always the value
|
||||
m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
|
||||
// Any following ones are freebies
|
||||
m_DefaultFPTextItems.emplace_back( wxT( "${REF}" ), true, F_Fab );
|
||||
|
||||
m_LineThickness[ LAYER_CLASS_SILK ] = Millimeter2iu( DEFAULT_SILK_LINE_WIDTH );
|
||||
m_TextSize[ LAYER_CLASS_SILK ] = wxSize( Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
|
||||
Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ) );
|
||||
|
@ -642,15 +649,6 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
m_viaSizeIndex = 0;
|
||||
m_trackWidthIndex = 0;
|
||||
m_diffPairIndex = 0;
|
||||
|
||||
// Default ref text on fp creation. If empty, use footprint name as default
|
||||
m_RefDefaultText = "REF**";
|
||||
m_RefDefaultVisibility = true;
|
||||
m_RefDefaultlayer = int( F_SilkS );
|
||||
// Default value text on fp creation. If empty, use footprint name as default
|
||||
m_ValueDefaultText = "";
|
||||
m_ValueDefaultVisibility = true;
|
||||
m_ValueDefaultlayer = int( F_Fab );
|
||||
}
|
||||
|
||||
// Add parameters to save in project config.
|
||||
|
|
|
@ -29,6 +29,120 @@
|
|||
#include <grid_tricks.h>
|
||||
|
||||
#include <panel_modedit_defaults.h>
|
||||
#include <grid_layer_box_helpers.h>
|
||||
#include <bitmaps_png/include/bitmaps_png/bitmaps_list.h>
|
||||
|
||||
class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase
|
||||
{
|
||||
std::vector<TEXT_ITEM_INFO> m_items;
|
||||
|
||||
public:
|
||||
TEXT_ITEMS_GRID_TABLE()
|
||||
{ }
|
||||
|
||||
int GetNumberRows() override { return m_items.size(); }
|
||||
int GetNumberCols() override { return 3; }
|
||||
|
||||
wxString GetColLabelValue( int aCol ) override
|
||||
{
|
||||
switch( aCol )
|
||||
{
|
||||
case 0: return _( "Text Items" );
|
||||
case 1: return _( "Show" );
|
||||
case 2: return _( "Layer" );
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
wxString GetRowLabelValue( int aRow )
|
||||
{
|
||||
switch( aRow )
|
||||
{
|
||||
case 0: return _( "Reference designator" );
|
||||
case 1: return _( "Value" );
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
{
|
||||
switch( aCol )
|
||||
{
|
||||
case 0: return aTypeName == wxGRID_VALUE_STRING;
|
||||
case 1: return aTypeName == wxGRID_VALUE_BOOL;
|
||||
case 2: return aTypeName == wxGRID_VALUE_NUMBER;
|
||||
default: wxFAIL; return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName )
|
||||
{
|
||||
return CanGetValueAs( aRow, aCol, aTypeName );
|
||||
}
|
||||
|
||||
wxString GetValue( int row, int col ) override
|
||||
{
|
||||
return m_items[row].m_Text;
|
||||
}
|
||||
void SetValue( int row, int col, const wxString& value ) override
|
||||
{
|
||||
if( col == 0 )
|
||||
m_items[row].m_Text = value;
|
||||
}
|
||||
|
||||
bool GetValueAsBool( int row, int col ) override
|
||||
{
|
||||
return m_items[row].m_Visible;
|
||||
}
|
||||
void SetValueAsBool( int row, int col, bool value ) override
|
||||
{
|
||||
if( col == 1 )
|
||||
m_items[row].m_Visible = value;
|
||||
}
|
||||
|
||||
long GetValueAsLong( int row, int col ) override
|
||||
{
|
||||
return m_items[row].m_Layer;
|
||||
}
|
||||
void SetValueAsLong( int row, int col, long value ) override
|
||||
{
|
||||
if( col == 2 )
|
||||
m_items[row].m_Layer = value;
|
||||
}
|
||||
|
||||
bool AppendRows( size_t aNumRows = 1 ) override
|
||||
{
|
||||
for( int i = 0; i < aNumRows; ++i )
|
||||
m_items.emplace_back( wxT( "" ), true, F_SilkS );
|
||||
|
||||
if( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, aNumRows );
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeleteRows( size_t aPos, size_t aNumRows ) override
|
||||
{
|
||||
// aPos may be a large positive, e.g. size_t(-1), and the sum of
|
||||
// aPos+aNumRows may wrap here, so both ends of the range are tested.
|
||||
if( aPos < m_items.size() && aPos + aNumRows <= m_items.size() )
|
||||
{
|
||||
m_items.erase( m_items.begin() + aPos, m_items.begin() + aPos + aNumRows );
|
||||
|
||||
if( GetView() )
|
||||
{
|
||||
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, aPos, aNumRows );
|
||||
GetView()->ProcessTableMessage( msg );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Columns of layer classes grid
|
||||
|
@ -60,14 +174,27 @@ PANEL_MODEDIT_DEFAULTS::PANEL_MODEDIT_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame, PA
|
|||
m_frame( aFrame ),
|
||||
m_Parent( aParent )
|
||||
{
|
||||
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
|
||||
m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 );
|
||||
m_layerClassesGrid->SetDefaultRowSize( m_layerClassesGrid->GetDefaultRowSize() + 4 );
|
||||
|
||||
m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true );
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
m_textItemsGrid->SetColAttr( 1, attr );
|
||||
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_frame ) );
|
||||
attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_frame, LSET::ForbiddenTextLayers() ) );
|
||||
m_textItemsGrid->SetColAttr( 2, attr );
|
||||
|
||||
// Work around a bug in wxWidgets where it fails to recalculate the grid height
|
||||
// after changing the default row size
|
||||
m_grid->AppendRows( 1 );
|
||||
m_grid->DeleteRows( m_grid->GetNumberRows() - 1, 1 );
|
||||
m_layerClassesGrid->AppendRows( 1 );
|
||||
m_layerClassesGrid->DeleteRows( m_layerClassesGrid->GetNumberRows() - 1, 1 );
|
||||
|
||||
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
|
||||
m_layerClassesGrid->PushEventHandler( new GRID_TRICKS( m_layerClassesGrid ) );
|
||||
|
||||
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
||||
|
@ -77,8 +204,8 @@ PANEL_MODEDIT_DEFAULTS::PANEL_MODEDIT_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame, PA
|
|||
|
||||
PANEL_MODEDIT_DEFAULTS::~PANEL_MODEDIT_DEFAULTS()
|
||||
{
|
||||
// destroy GRID_TRICKS before m_grid.
|
||||
m_grid->PopEventHandler( true );
|
||||
// destroy GRID_TRICKS before m_layerClassesGrid.
|
||||
m_layerClassesGrid->PopEventHandler( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,10 +214,10 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
|
|||
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||
|
||||
#define SET_MILS_CELL( row, col, val ) \
|
||||
m_grid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true, true ) )
|
||||
m_layerClassesGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true, true ) )
|
||||
|
||||
#define DISABLE_CELL( row, col ) \
|
||||
m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour );
|
||||
m_layerClassesGrid->SetReadOnly( row, col ); m_layerClassesGrid->SetCellBackgroundColour( row, col, disabledColour );
|
||||
|
||||
for( int i = 0; i < ROW_COUNT; ++i )
|
||||
{
|
||||
|
@ -108,36 +235,39 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
|
|||
SET_MILS_CELL( i, COL_TEXT_WIDTH, m_brdSettings.m_TextSize[ i ].x );
|
||||
SET_MILS_CELL( i, COL_TEXT_HEIGHT, m_brdSettings.m_TextSize[ i ].y );
|
||||
SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_brdSettings.m_TextThickness[ i ] );
|
||||
m_grid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" );
|
||||
m_layerClassesGrid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" );
|
||||
|
||||
auto attr = new wxGridCellAttr;
|
||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_BOTTOM );
|
||||
m_grid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
||||
m_layerClassesGrid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
||||
}
|
||||
}
|
||||
|
||||
// Footprint defaults
|
||||
m_textCtrlRefText->SetValue( m_brdSettings.m_RefDefaultText );
|
||||
m_choiceLayerReference->SetSelection( m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1 );
|
||||
m_choiceVisibleReference->SetSelection( m_brdSettings.m_RefDefaultVisibility ? 0 : 1 );
|
||||
m_textItemsGrid->GetTable()->AppendRows( m_brdSettings.m_DefaultFPTextItems.size() );
|
||||
|
||||
m_textCtrlValueText->SetValue( m_brdSettings.m_ValueDefaultText );
|
||||
m_choiceLayerValue->SetSelection( m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1 );
|
||||
m_choiceVisibleValue->SetSelection( m_brdSettings.m_ValueDefaultVisibility ? 0 : 1 );
|
||||
|
||||
for( int col = 0; col < m_grid->GetNumberCols(); col++ )
|
||||
for( int i = 0; i < m_brdSettings.m_DefaultFPTextItems.size(); ++i )
|
||||
{
|
||||
// Set the minimal width to the column label size.
|
||||
m_grid->SetColMinimalWidth( col, m_grid->GetVisibleWidth( col, true, false, false ) );
|
||||
TEXT_ITEM_INFO item = m_brdSettings.m_DefaultFPTextItems[i];
|
||||
|
||||
// Set the width to see the full contents
|
||||
if( m_grid->IsColShown( col ) )
|
||||
m_grid->SetColSize( col, m_grid->GetVisibleWidth( col, true, true, true ) );
|
||||
m_textItemsGrid->GetTable()->SetValue( i, 0, item.m_Text );
|
||||
m_textItemsGrid->GetTable()->SetValueAsBool( i, 1, item.m_Visible );
|
||||
m_textItemsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer );
|
||||
}
|
||||
|
||||
m_grid->SetRowLabelSize( m_grid->GetVisibleWidth( -1, true, true, true ) );
|
||||
for( int col = 0; col < m_layerClassesGrid->GetNumberCols(); col++ )
|
||||
{
|
||||
// Set the minimal width to the column label size.
|
||||
m_layerClassesGrid->SetColMinimalWidth( col, m_layerClassesGrid->GetVisibleWidth( col, true, false, false ) );
|
||||
|
||||
// Set the width to see the full contents
|
||||
if( m_layerClassesGrid->IsColShown( col ) )
|
||||
m_layerClassesGrid->SetColSize( col, m_layerClassesGrid->GetVisibleWidth( col, true, true, true ) );
|
||||
}
|
||||
|
||||
m_layerClassesGrid->SetRowLabelSize( m_layerClassesGrid->GetVisibleWidth( -1, true, true, true ) );
|
||||
|
||||
Layout();
|
||||
|
||||
|
@ -145,15 +275,39 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_MODEDIT_DEFAULTS::Show( bool aShow )
|
||||
{
|
||||
bool retVal = wxPanel::Show( aShow );
|
||||
|
||||
if( aShow )
|
||||
{
|
||||
// These *should* work in the constructor, and indeed they do if this panel is the
|
||||
// first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
|
||||
// first then the icons will be blank unless they're set here.
|
||||
m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) );
|
||||
m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) );
|
||||
}
|
||||
|
||||
if( aShow && m_firstShow )
|
||||
{
|
||||
m_layerClassesGrid->SetColumnWidth( 0, m_layerClassesGrid->GetColumnWidth( 0 ) + 1 );
|
||||
m_firstShow = false;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
int PANEL_MODEDIT_DEFAULTS::getGridValue( int aRow, int aCol )
|
||||
{
|
||||
return ValueFromString( m_frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ), true );
|
||||
return ValueFromString( m_frame->GetUserUnits(),
|
||||
m_layerClassesGrid->GetCellValue( aRow, aCol ), true );
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_MODEDIT_DEFAULTS::validateData()
|
||||
{
|
||||
if( !m_grid->CommitPendingChanges() )
|
||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
||||
return false;
|
||||
|
||||
// Test text parameters.
|
||||
|
@ -166,7 +320,7 @@ bool PANEL_MODEDIT_DEFAULTS::validateData()
|
|||
{
|
||||
wxString msg = _( "Text will not be readable with a thickness greater than\n"
|
||||
"1/4 its width or height." );
|
||||
m_Parent->SetError( msg, this, m_grid, row, COL_TEXT_THICKNESS );
|
||||
m_Parent->SetError( msg, this, m_layerClassesGrid, row, COL_TEXT_THICKNESS );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -187,24 +341,68 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataFromWindow()
|
|||
if( i == ROW_EDGES || i == ROW_COURTYARD )
|
||||
continue;
|
||||
|
||||
m_brdSettings.m_TextSize[ i ] =
|
||||
wxSize( getGridValue( i, COL_TEXT_WIDTH ), getGridValue( i, COL_TEXT_HEIGHT ) );
|
||||
m_brdSettings.m_TextSize[ i ] = wxSize( getGridValue( i, COL_TEXT_WIDTH ),
|
||||
getGridValue( i, COL_TEXT_HEIGHT ) );
|
||||
m_brdSettings.m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS );
|
||||
m_brdSettings.m_TextItalic[ i ] =
|
||||
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_ITALIC ) );
|
||||
|
||||
wxString msg = m_layerClassesGrid->GetCellValue( i, COL_TEXT_ITALIC );
|
||||
m_brdSettings.m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg );
|
||||
}
|
||||
|
||||
// Footprint defaults
|
||||
m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue();
|
||||
m_brdSettings.m_RefDefaultlayer = (m_choiceLayerReference->GetSelection() == 0) ? F_SilkS : F_Fab;
|
||||
m_brdSettings.m_RefDefaultVisibility = m_choiceVisibleReference->GetSelection() == 0;
|
||||
wxGridTableBase* table = m_textItemsGrid->GetTable();
|
||||
m_brdSettings.m_DefaultFPTextItems.clear();
|
||||
|
||||
for( int i = 0; i < m_textItemsGrid->GetNumberRows(); ++i )
|
||||
{
|
||||
wxString text = table->GetValue( i, 0 );
|
||||
bool visible = table->GetValueAsBool( i, 1 );
|
||||
int layer = (int) table->GetValueAsLong( i, 2 );
|
||||
|
||||
m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue();
|
||||
m_brdSettings.m_ValueDefaultlayer = (m_choiceLayerValue->GetSelection() == 0) ? F_SilkS : F_Fab;
|
||||
m_brdSettings.m_ValueDefaultVisibility = m_choiceVisibleValue->GetSelection() == 0;
|
||||
m_brdSettings.m_DefaultFPTextItems.emplace_back( text, visible, layer );
|
||||
}
|
||||
|
||||
m_frame->SetDesignSettings( m_brdSettings );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_MODEDIT_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
wxGridTableBase* table = m_textItemsGrid->GetTable();
|
||||
|
||||
int newRow = m_textItemsGrid->GetNumberRows();
|
||||
table->AppendRows( 1 );
|
||||
table->SetValueAsBool( newRow, 1, table->GetValueAsBool( newRow - 1, 1 ) );
|
||||
table->SetValueAsLong( newRow, 2, table->GetValueAsLong( newRow - 1, 2 ) );
|
||||
|
||||
m_textItemsGrid->MakeCellVisible( newRow, 0 );
|
||||
m_textItemsGrid->SetGridCursor( newRow, 0 );
|
||||
|
||||
m_textItemsGrid->EnableCellEditControl( true );
|
||||
m_textItemsGrid->ShowCellEditControl();
|
||||
}
|
||||
|
||||
|
||||
void PANEL_MODEDIT_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event )
|
||||
{
|
||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
int curRow = m_textItemsGrid->GetGridCursorRow();
|
||||
|
||||
if( curRow < 2 ) // First two rows are required
|
||||
return;
|
||||
|
||||
m_textItemsGrid->GetTable()->DeleteRows( curRow, 1 );
|
||||
|
||||
curRow = std::max( 0, curRow - 1 );
|
||||
m_textItemsGrid->MakeCellVisible( curRow, m_textItemsGrid->GetGridCursorCol() );
|
||||
m_textItemsGrid->SetGridCursor( curRow, m_textItemsGrid->GetGridCursorCol() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,12 +32,18 @@ class PANEL_MODEDIT_DEFAULTS : public PANEL_MODEDIT_DEFAULTS_BASE
|
|||
BOARD_DESIGN_SETTINGS m_brdSettings;
|
||||
FOOTPRINT_EDIT_FRAME* m_frame;
|
||||
PAGED_DIALOG* m_Parent;
|
||||
bool m_firstShow = true;
|
||||
|
||||
public:
|
||||
PANEL_MODEDIT_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame, PAGED_DIALOG* aParent );
|
||||
~PANEL_MODEDIT_DEFAULTS() override;
|
||||
|
||||
private:
|
||||
virtual void OnAddTextItem( wxCommandEvent& event ) override;
|
||||
virtual void OnDeleteTextItem( wxCommandEvent& event ) override;
|
||||
|
||||
bool Show( bool aShow ) override;
|
||||
|
||||
int getGridValue( int aRow, int aCol );
|
||||
|
||||
bool validateData();
|
||||
|
|
|
@ -19,127 +19,134 @@ PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWi
|
|||
wxBoxSizer* bSizerMargins;
|
||||
bSizerMargins = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Default values for new footprints:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText13->Wrap( -1 );
|
||||
bSizerMargins->Add( m_staticText13, 0, wxTOP|wxLEFT, 5 );
|
||||
defaultTextItemsLabel = new wxStaticText( this, wxID_ANY, _("Default text items for new footprints:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
defaultTextItemsLabel->Wrap( -1 );
|
||||
bSizerMargins->Add( defaultTextItemsLabel, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* defaultValuesSizer;
|
||||
defaultValuesSizer = new wxFlexGridSizer( 0, 4, 5, 5 );
|
||||
defaultValuesSizer->AddGrowableCol( 1 );
|
||||
defaultValuesSizer->SetFlexibleDirection( wxBOTH );
|
||||
defaultValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
wxStaticBoxSizer* sbSizerTexts;
|
||||
sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
|
||||
|
||||
m_staticTextRef = new wxStaticText( this, wxID_ANY, _("&Reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextRef->Wrap( -1 );
|
||||
defaultValuesSizer->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
|
||||
m_textItemsGrid = new WX_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
|
||||
|
||||
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") );
|
||||
// Grid
|
||||
m_textItemsGrid->CreateGrid( 2, 3 );
|
||||
m_textItemsGrid->EnableEditing( true );
|
||||
m_textItemsGrid->EnableGridLines( true );
|
||||
m_textItemsGrid->EnableDragGridSize( false );
|
||||
m_textItemsGrid->SetMargins( 0, 0 );
|
||||
|
||||
defaultValuesSizer->Add( m_textCtrlRefText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 5 );
|
||||
// Columns
|
||||
m_textItemsGrid->SetColSize( 0, 233 );
|
||||
m_textItemsGrid->SetColSize( 1, 60 );
|
||||
m_textItemsGrid->SetColSize( 2, 120 );
|
||||
m_textItemsGrid->EnableDragColMove( false );
|
||||
m_textItemsGrid->EnableDragColSize( true );
|
||||
m_textItemsGrid->SetColLabelSize( 24 );
|
||||
m_textItemsGrid->SetColLabelValue( 0, _("Text Items") );
|
||||
m_textItemsGrid->SetColLabelValue( 1, _("Show") );
|
||||
m_textItemsGrid->SetColLabelValue( 2, _("Layer") );
|
||||
m_textItemsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
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 );
|
||||
defaultValuesSizer->Add( m_choiceLayerReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
// Rows
|
||||
m_textItemsGrid->EnableDragRowSize( false );
|
||||
m_textItemsGrid->SetRowLabelSize( 160 );
|
||||
m_textItemsGrid->SetRowLabelValue( 0, _("Reference designator") );
|
||||
m_textItemsGrid->SetRowLabelValue( 1, _("Value") );
|
||||
m_textItemsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
|
||||
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 );
|
||||
defaultValuesSizer->Add( m_choiceVisibleReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
// Label Appearance
|
||||
|
||||
m_staticTextValue = new wxStaticText( this, wxID_ANY, _("V&alue:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextValue->Wrap( -1 );
|
||||
defaultValuesSizer->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
// Cell Defaults
|
||||
m_textItemsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_textItemsGrid->SetMinSize( wxSize( -1,140 ) );
|
||||
|
||||
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") );
|
||||
m_textCtrlValueText->SetMinSize( wxSize( 160,-1 ) );
|
||||
sbSizerTexts->Add( m_textItemsGrid, 1, wxALL|wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
defaultValuesSizer->Add( m_textCtrlValueText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 );
|
||||
wxBoxSizer* bButtonSize;
|
||||
bButtonSize = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
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 );
|
||||
defaultValuesSizer->Add( m_choiceLayerValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
m_bpAdd = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpAdd->SetMinSize( wxSize( 30,29 ) );
|
||||
|
||||
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 );
|
||||
defaultValuesSizer->Add( m_choiceVisibleValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
bButtonSize->Add( m_bpAdd, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerMargins->Add( defaultValuesSizer, 0, wxEXPAND|wxLEFT, 25 );
|
||||
bButtonSize->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_bpDelete = new wxBitmapButton( sbSizerTexts->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
m_bpDelete->SetMinSize( wxSize( 30,29 ) );
|
||||
|
||||
bButtonSize->Add( m_bpDelete, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
sbSizerTexts->Add( bButtonSize, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("A blank reference designator or value will use the footprint name."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
||||
bSizerMargins->Add( sbSizerTexts, 1, wxEXPAND|wxLEFT, 20 );
|
||||
|
||||
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Note: a blank reference designator or value will use the footprint name."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInfo->Wrap( -1 );
|
||||
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||
|
||||
bSizerMargins->Add( m_staticTextInfo, 0, wxBOTTOM|wxLEFT, 25 );
|
||||
|
||||
|
||||
bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
|
||||
|
||||
wxBoxSizer* defaultSizesSizer1;
|
||||
defaultSizesSizer1 = new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer* defaultPropertiesSizer;
|
||||
defaultPropertiesSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
defaultSizesSizer1->Add( m_staticText1, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
wxStaticText* defaultPropertiesLabel;
|
||||
defaultPropertiesLabel = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
defaultPropertiesLabel->Wrap( -1 );
|
||||
defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_layerClassesGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
|
||||
// Grid
|
||||
m_grid->CreateGrid( 6, 5 );
|
||||
m_grid->EnableEditing( true );
|
||||
m_grid->EnableGridLines( true );
|
||||
m_grid->EnableDragGridSize( false );
|
||||
m_grid->SetMargins( 0, 0 );
|
||||
m_layerClassesGrid->CreateGrid( 6, 5 );
|
||||
m_layerClassesGrid->EnableEditing( true );
|
||||
m_layerClassesGrid->EnableGridLines( true );
|
||||
m_layerClassesGrid->EnableDragGridSize( false );
|
||||
m_layerClassesGrid->SetMargins( 0, 0 );
|
||||
|
||||
// Columns
|
||||
m_grid->SetColSize( 0, 110 );
|
||||
m_grid->SetColSize( 1, 100 );
|
||||
m_grid->SetColSize( 2, 100 );
|
||||
m_grid->SetColSize( 3, 100 );
|
||||
m_grid->SetColSize( 4, 60 );
|
||||
m_grid->EnableDragColMove( false );
|
||||
m_grid->EnableDragColSize( true );
|
||||
m_grid->SetColLabelSize( 22 );
|
||||
m_grid->SetColLabelValue( 0, _("Line Thickness") );
|
||||
m_grid->SetColLabelValue( 1, _("Text Width") );
|
||||
m_grid->SetColLabelValue( 2, _("Text Height") );
|
||||
m_grid->SetColLabelValue( 3, _("Text Thickness") );
|
||||
m_grid->SetColLabelValue( 4, _("Italic") );
|
||||
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
m_layerClassesGrid->SetColSize( 0, 110 );
|
||||
m_layerClassesGrid->SetColSize( 1, 100 );
|
||||
m_layerClassesGrid->SetColSize( 2, 100 );
|
||||
m_layerClassesGrid->SetColSize( 3, 100 );
|
||||
m_layerClassesGrid->SetColSize( 4, 60 );
|
||||
m_layerClassesGrid->EnableDragColMove( false );
|
||||
m_layerClassesGrid->EnableDragColSize( true );
|
||||
m_layerClassesGrid->SetColLabelSize( 22 );
|
||||
m_layerClassesGrid->SetColLabelValue( 0, _("Line Thickness") );
|
||||
m_layerClassesGrid->SetColLabelValue( 1, _("Text Width") );
|
||||
m_layerClassesGrid->SetColLabelValue( 2, _("Text Height") );
|
||||
m_layerClassesGrid->SetColLabelValue( 3, _("Text Thickness") );
|
||||
m_layerClassesGrid->SetColLabelValue( 4, _("Italic") );
|
||||
m_layerClassesGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_grid->EnableDragRowSize( false );
|
||||
m_grid->SetRowLabelSize( 125 );
|
||||
m_grid->SetRowLabelValue( 0, _("Silk Layers") );
|
||||
m_grid->SetRowLabelValue( 1, _("Copper Layers") );
|
||||
m_grid->SetRowLabelValue( 2, _("Edge Cuts") );
|
||||
m_grid->SetRowLabelValue( 3, _("Courtyards") );
|
||||
m_grid->SetRowLabelValue( 4, _("Fab Layers") );
|
||||
m_grid->SetRowLabelValue( 5, _("Other Layers") );
|
||||
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
m_layerClassesGrid->EnableDragRowSize( false );
|
||||
m_layerClassesGrid->SetRowLabelSize( 125 );
|
||||
m_layerClassesGrid->SetRowLabelValue( 0, _("Silk Layers") );
|
||||
m_layerClassesGrid->SetRowLabelValue( 1, _("Copper Layers") );
|
||||
m_layerClassesGrid->SetRowLabelValue( 2, _("Edge Cuts") );
|
||||
m_layerClassesGrid->SetRowLabelValue( 3, _("Courtyards") );
|
||||
m_layerClassesGrid->SetRowLabelValue( 4, _("Fab Layers") );
|
||||
m_layerClassesGrid->SetRowLabelValue( 5, _("Other Layers") );
|
||||
m_layerClassesGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
// Cell Defaults
|
||||
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_grid->SetToolTip( _("Net Class parameters") );
|
||||
m_layerClassesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_layerClassesGrid->SetToolTip( _("Net Class parameters") );
|
||||
|
||||
defaultSizesSizer1->Add( m_grid, 1, wxBOTTOM|wxLEFT, 20 );
|
||||
defaultPropertiesSizer->Add( m_layerClassesGrid, 1, wxBOTTOM|wxLEFT, 20 );
|
||||
|
||||
|
||||
bSizerMargins->Add( defaultSizesSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerMargins, 1, wxRIGHT|wxLEFT, 5 );
|
||||
|
@ -148,8 +155,18 @@ PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWi
|
|||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_textItemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnGridSize ), NULL, this );
|
||||
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnAddTextItem ), NULL, this );
|
||||
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_MODEDIT_DEFAULTS_BASE::~PANEL_MODEDIT_DEFAULTS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_textItemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnGridSize ), NULL, this );
|
||||
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnAddTextItem ), NULL, this );
|
||||
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_MODEDIT_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default values for new footprints:</property>
|
||||
<property name="label">Default text items for new footprints:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -104,7 +104,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText13</property>
|
||||
<property name="name">defaultTextItemsLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -125,26 +125,22 @@
|
|||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">25</property>
|
||||
<property name="border">20</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">4</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">5</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">defaultValuesSizer</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="name">sbSizerTexts</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">5</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="flag">wxALL|wxBOTTOM|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGrid" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -153,35 +149,58 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="autosize_cols">0</property>
|
||||
<property name="autosize_rows">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="cell_bg"></property>
|
||||
<property name="cell_font"></property>
|
||||
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="cell_text"></property>
|
||||
<property name="cell_vert_alignment">wxALIGN_TOP</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="col_label_size">24</property>
|
||||
<property name="col_label_values">"Text Items" "Show" "Layer"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">3</property>
|
||||
<property name="column_sizes">233,60,120</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_col_move">0</property>
|
||||
<property name="drag_col_size">1</property>
|
||||
<property name="drag_grid_size">0</property>
|
||||
<property name="drag_row_size">0</property>
|
||||
<property name="editing">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="grid_line_color"></property>
|
||||
<property name="grid_lines">1</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">&Reference designator:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="label_bg"></property>
|
||||
<property name="label_font"></property>
|
||||
<property name="label_text"></property>
|
||||
<property name="margin_height">0</property>
|
||||
<property name="margin_width">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="minimum_size">-1,140</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextRef</property>
|
||||
<property name="name">m_textItemsGrid</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -189,468 +208,108 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="row_label_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="row_label_size">160</property>
|
||||
<property name="row_label_values">"Reference designator" "Value"</property>
|
||||
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_sizes"></property>
|
||||
<property name="rows">2</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textCtrlRefText</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Default text for reference
Leave blank to use the footprint name</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"SilkScreen" "Fab. Layer"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_choiceLayerReference</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Visible" "Invisible"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_choiceVisibleReference</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">V&alue:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextValue</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">160,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textCtrlValueText</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Default text for value
Leave blank to use the footprint name</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"SilkScreen" "Fab. Layer"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_choiceLayerValue</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Visible" "Invisible"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_choiceVisibleValue</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<event name="OnSize">OnGridSize</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bButtonSize</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add Field</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">30,29</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpAdd</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnAddTextItem</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
|
@ -658,6 +317,83 @@
|
|||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Delete Field</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">30,29</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpDelete</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnDeleteTextItem</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">25</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT</property>
|
||||
|
@ -686,11 +422,11 @@
|
|||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font">,90,92,-1,70,0</property>
|
||||
<property name="font">,90,90,-1,70,0</property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">A blank reference designator or value will use the footprint name.</property>
|
||||
<property name="label">Note: a blank reference designator or value will use the footprint name.</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -735,7 +471,7 @@
|
|||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">defaultSizesSizer1</property>
|
||||
<property name="name">defaultPropertiesSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
@ -779,11 +515,11 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText1</property>
|
||||
<property name="name">defaultPropertiesLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
|
@ -863,7 +599,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_grid</property>
|
||||
<property name="name">m_layerClassesGrid</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
|
|
@ -18,10 +18,14 @@ class WX_GRID;
|
|||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -35,18 +39,18 @@ class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText13;
|
||||
wxStaticText* m_staticTextRef;
|
||||
wxTextCtrl* m_textCtrlRefText;
|
||||
wxChoice* m_choiceLayerReference;
|
||||
wxChoice* m_choiceVisibleReference;
|
||||
wxStaticText* m_staticTextValue;
|
||||
wxTextCtrl* m_textCtrlValueText;
|
||||
wxChoice* m_choiceLayerValue;
|
||||
wxChoice* m_choiceVisibleValue;
|
||||
wxStaticText* defaultTextItemsLabel;
|
||||
WX_GRID* m_textItemsGrid;
|
||||
wxBitmapButton* m_bpAdd;
|
||||
wxBitmapButton* m_bpDelete;
|
||||
wxStaticText* m_staticTextInfo;
|
||||
wxStaticText* m_staticText1;
|
||||
WX_GRID* m_grid;
|
||||
WX_GRID* m_layerClassesGrid;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddTextItem( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDeleteTextItem( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -123,6 +123,8 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::Show( bool aShow )
|
|||
{
|
||||
bool retVal = wxPanel::Show( aShow );
|
||||
|
||||
if( aShow )
|
||||
{
|
||||
// These *should* work in the constructor, and indeed they do if this panel is the
|
||||
// first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
|
||||
// first then the icons will be blank unless they're set here.
|
||||
|
@ -137,6 +139,7 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::Show( bool aShow )
|
|||
m_bitmapEdgeClearance->SetBitmap( KiBitmap( edge_to_copper_clearance_xpm ) );
|
||||
m_bitmapBlindBuried->SetBitmap( KiBitmap( via_buried_xpm ) );
|
||||
m_bitmap_uVia->SetBitmap( KiBitmap( via_microvia_xpm ) );
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -128,13 +128,18 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(), m_canvasType );
|
||||
SetCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// In modedit, the default net clearance is not known.
|
||||
// (it depends on the actual board)
|
||||
// So we do not show the default clearance, by setting it to 0
|
||||
// The footprint or pad specific clearance will be shown
|
||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );
|
||||
|
||||
// LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
|
||||
// parameters in m_LayersManager
|
||||
// NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
|
||||
LoadSettings( GetSettings() );
|
||||
|
||||
// In modedit, the default net clearance is not known (it depends on the actual board).
|
||||
// So we do not show the default clearance, by setting it to 0.
|
||||
// The footprint or pad specific clearance will be shown.
|
||||
GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
|
||||
|
||||
// Don't show the default board solder mask clearance in the footprint editor. Only the
|
||||
|
@ -145,27 +150,18 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
restoreLastFootprint();
|
||||
|
||||
// Ensure all layers and items are visible:
|
||||
// In footprint editor, some layers have no meaning or
|
||||
// cannot be used, but we show all of them, at least to be able
|
||||
// to edit a bad layer
|
||||
// In footprint editor, some layers have no meaning or cannot be used, but we show all of
|
||||
// them, at least to be able to edit a bad layer
|
||||
GetBoard()->SetVisibleAlls();
|
||||
|
||||
// However the "no net" mark on pads is useless, because there is
|
||||
// no net in footprint editor: make it non visible
|
||||
// However the "no net" mark on pads is useless, because there are no nets in footprint
|
||||
// editor: make it non visible.
|
||||
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
|
||||
|
||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );
|
||||
|
||||
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
|
||||
// initialize parameters in m_LayersManager
|
||||
// NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
|
||||
LoadSettings( GetSettings() );
|
||||
|
||||
// Must be set after calling LoadSettings() to be sure these parameters are
|
||||
// non dependent on what is read in stored settings.
|
||||
// Enable one internal layer, because footprints support keepout areas that
|
||||
// can be on internal layers only (therefore on the first internal layer)
|
||||
// This is needed to handle these keepout in internal layers only
|
||||
// Must be set after calling LoadSettings() to be sure these parameters are not dependent
|
||||
// on what is read in stored settings. Enable one internal layer, because footprints
|
||||
// support keepout areas that can be on internal layers only (therefore on the first internal
|
||||
// layer). This is needed to handle these keepout in internal layers only.
|
||||
GetBoard()->SetCopperLayerCount( 3 );
|
||||
GetBoard()->SetEnabledLayers( GetBoard()->GetEnabledLayers().set( In1_Cu ) );
|
||||
GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() );
|
||||
|
@ -179,8 +175,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS::UNSCALED, ID_POPUP_GRID_USER );
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
// In modedit, set the default paper size to A4:
|
||||
// this should be OK for all footprint to plot/print
|
||||
// In modedit, set the default paper size to A4 for plot/print
|
||||
SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
|
||||
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
|
@ -437,22 +432,11 @@ FOOTPRINT_EDITOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetSettings()
|
|||
void FOOTPRINT_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
// aCfg will be the PCBNEW_SETTINGS
|
||||
auto cfg = GetSettings();
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
|
||||
|
||||
EDA_DRAW_FRAME::LoadSettings( cfg );
|
||||
|
||||
// Ensure some params are valid
|
||||
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
|
||||
|
||||
settings = cfg->m_DesignSettings;
|
||||
|
||||
// Usually, graphic items are drawn on F_SilkS or F_Fab layer
|
||||
// Force these layers if not default
|
||||
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;
|
||||
GetDesignSettings() = cfg->m_DesignSettings;
|
||||
|
||||
m_DisplayOptions = cfg->m_Display;
|
||||
m_defaultLibWidth = cfg->m_LibWidth;
|
||||
|
|
|
@ -36,11 +36,19 @@ const int fpEditSchemaVersion = 1;
|
|||
|
||||
|
||||
FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
||||
APP_SETTINGS_BASE( "fpedit", fpEditSchemaVersion ), m_DesignSettings(), m_MagneticPads(),
|
||||
m_Display(), m_UserGrid(), m_PolarCoords( false ), m_Use45DegreeGraphicSegments( true ),
|
||||
m_LibWidth( 250 ), m_LastImportExportPath(), m_FootprintTextShownColumns()
|
||||
APP_SETTINGS_BASE( "fpedit", fpEditSchemaVersion ),
|
||||
m_DesignSettings(),
|
||||
m_MagneticPads(),
|
||||
m_Display(),
|
||||
m_UserGrid(),
|
||||
m_PolarCoords( false ),
|
||||
m_Use45DegreeGraphicSegments( true ),
|
||||
m_LibWidth( 250 ),
|
||||
m_LastImportExportPath(),
|
||||
m_FootprintTextShownColumns()
|
||||
{
|
||||
m_params.emplace_back( new PARAM<int>( "window.lib_width", &m_LibWidth, 250 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "window.lib_width",
|
||||
&m_LibWidth, 250 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path",
|
||||
&m_LastImportExportPath, "" ) );
|
||||
|
@ -57,14 +65,56 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "editing.use_45_degree_graphic_segments",
|
||||
&m_Use45DegreeGraphicSegments, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>(
|
||||
"pcb_display.footprint_text", &m_Display.m_DisplayModTextFill, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "pcb_display.footprint_text",
|
||||
&m_Display.m_DisplayModTextFill, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>(
|
||||
"pcb_display.graphic_items_fill", &m_Display.m_DisplayDrawItemsFill, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "pcb_display.graphic_items_fill",
|
||||
&m_Display.m_DisplayDrawItemsFill, true ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "pcb_display.pad_fill", &m_Display.m_DisplayPadFill, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_fill",
|
||||
&m_Display.m_DisplayPadFill, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>(
|
||||
"design_settings.default_footprint_text_items",
|
||||
[&] () -> nlohmann::json
|
||||
{
|
||||
nlohmann::json js = nlohmann::json::array();
|
||||
|
||||
for( const TEXT_ITEM_INFO& item : m_DesignSettings.m_DefaultFPTextItems )
|
||||
{
|
||||
js.push_back( nlohmann::json( { item.m_Text.ToUTF8(),
|
||||
item.m_Visible,
|
||||
item.m_Layer } ) );
|
||||
}
|
||||
|
||||
return js;
|
||||
},
|
||||
[&] ( const nlohmann::json& aObj )
|
||||
{
|
||||
m_DesignSettings.m_DefaultFPTextItems.clear();
|
||||
|
||||
if( !aObj.is_array() )
|
||||
return;
|
||||
|
||||
for( const nlohmann::json& entry : aObj )
|
||||
{
|
||||
if( entry.empty() || !entry.is_array() )
|
||||
continue;
|
||||
|
||||
TEXT_ITEM_INFO textInfo( wxT( "" ), true, F_SilkS );
|
||||
|
||||
textInfo.m_Text = entry.at(0).get<wxString>();
|
||||
textInfo.m_Visible = entry.at(1).get<bool>();
|
||||
textInfo.m_Layer = entry.at(2).get<int>();
|
||||
|
||||
m_DesignSettings.m_DefaultFPTextItems.push_back( std::move( textInfo ) );
|
||||
}
|
||||
},
|
||||
nlohmann::json::array( {
|
||||
{ "REF**", true, F_SilkS },
|
||||
{ "", true, F_Fab },
|
||||
{ "${REFERENCE}", true, F_Fab }
|
||||
} ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.silk_line_width",
|
||||
&m_DesignSettings.m_LineThickness[ LAYER_CLASS_SILK ],
|
||||
|
@ -158,24 +208,6 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
|
||||
m_params.emplace_back( new PARAM<bool>( "design_settings.others_text_italic",
|
||||
&m_DesignSettings.m_TextItalic[ LAYER_CLASS_OTHERS ], false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "design_settings.default_ref_layer",
|
||||
&m_DesignSettings.m_RefDefaultlayer, F_SilkS, F_SilkS, F_Fab ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "design_settings.default_ref_text",
|
||||
&m_DesignSettings.m_RefDefaultText, "REF**" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "design_settings.default_ref_visibility",
|
||||
&m_DesignSettings.m_RefDefaultVisibility, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "design_settings.default_value_layer",
|
||||
&m_DesignSettings.m_ValueDefaultlayer, F_SilkS, F_SilkS, F_Fab ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "design_settings.default_value_text",
|
||||
&m_DesignSettings.m_ValueDefaultText, "" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "design_settings.default_value_visibility",
|
||||
&m_DesignSettings.m_ValueDefaultVisibility, true ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,61 +215,53 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
{
|
||||
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
|
||||
|
||||
//
|
||||
// NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
|
||||
//
|
||||
ret &= fromLegacy<int>( aCfg, "ModeditLibWidth", "window.lib_width" );
|
||||
ret &= fromLegacyString( aCfg, "import_last_path", "system.last_import_export_path" );
|
||||
ret &= fromLegacyString(
|
||||
aCfg, "LibFootprintTextShownColumns", "window.footprint_text_shown_columns" );
|
||||
ret &= fromLegacyString( aCfg, "LibFootprintTextShownColumns", "window.footprint_text_shown_columns" );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "FpEditorMagneticPads", "editing.magnetic_pads" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorDisplayPolarCoords", "editing.polar_coords" );
|
||||
ret &= fromLegacy<int>( aCfg,
|
||||
"FpEditorUse45DegreeGraphicSegments", "editing.use_45_degree_graphic_segments" );
|
||||
ret &= fromLegacy<int>( aCfg, "FpEditorUse45DegreeGraphicSegments", "editing.use_45_degree_graphic_segments" );
|
||||
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"FpEditorGraphicLinesDisplayMode", "pcb_display.graphic_items_fill" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorGraphicLinesDisplayMode", "pcb_display.graphic_items_fill" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorPadDisplayMode", "pcb_display.pad_fill" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorTextsDisplayMode", "pcb_display.footprint_text" );
|
||||
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorSilkLineWidth", "design_settings.silk_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextSizeH", "design_settings.silk_text_size_h" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextSizeV", "design_settings.silk_text_size_v" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorSilkTextThickness", "design_settings.silk_text_thickness" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextThickness", "design_settings.silk_text_thickness" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorSilkTextItalic", "design_settings.silk_text_italic" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorCopperLineWidth", "design_settings.copper_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorCopperTextSizeH", "design_settings.copper_text_size_h" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorCopperTextSizeV", "design_settings.copper_text_size_v" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorCopperTextThickness", "design_settings.copper_text_thickness" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"FpEditorCopperTextItalic", "design_settings.copper_text_italic" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorEdgeCutLineWidth", "design_settings.edge_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorCourtyardLineWidth", "design_settings.courtyard_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorOthersLineWidth", "design_settings.others_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorOthersTextSizeH", "design_settings.others_text_size_h" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorOthersTextSizeV", "design_settings.others_text_size_v" );
|
||||
ret &= fromLegacy<double>( aCfg,
|
||||
"FpEditorOthersTextSizeThickness", "design_settings.others_text_thickness" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"FpEditorOthersTextItalic", "design_settings.others_text_italic" );
|
||||
ret &= fromLegacy<int>( aCfg, "FpEditorRefDefaultLayer", "design_settings.default_ref_layer" );
|
||||
ret &= fromLegacyString( aCfg, "FpEditorRefDefaultText", "design_settings.default_ref_text" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"FpEditorRefDefaultVisibility", "design_settings.default_ref_visibility" );
|
||||
ret &= fromLegacy<int>( aCfg,
|
||||
"FpEditorValueDefaultLayer", "design_settings.default_value_layer" );
|
||||
ret &= fromLegacyString( aCfg,
|
||||
"FpEditorValueDefaultText", "design_settings.default_value_text" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"FpEditorValueDefaultVisibility", "design_settings.default_value_visibility" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorCopperLineWidth", "design_settings.copper_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextSizeH", "design_settings.copper_text_size_h" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextSizeV", "design_settings.copper_text_size_v" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextThickness", "design_settings.copper_text_thickness" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorCopperTextItalic", "design_settings.copper_text_italic" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorEdgeCutLineWidth", "design_settings.edge_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorCourtyardLineWidth", "design_settings.courtyard_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorOthersLineWidth", "design_settings.others_line_width" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextSizeH", "design_settings.others_text_size_h" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextSizeV", "design_settings.others_text_size_v" );
|
||||
ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextThickness", "design_settings.others_text_thickness" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorOthersTextItalic", "design_settings.others_text_italic" );
|
||||
|
||||
nlohmann::json textItems = nlohmann::json::array( {
|
||||
{ "REF**", true, F_SilkS },
|
||||
{ "", true, F_Fab }
|
||||
} );
|
||||
|
||||
( *this )[PointerFromString( "design_settings.default_footprint_text_items" )] = textItems;
|
||||
|
||||
ret &= fromLegacyString( aCfg, "FpEditorRefDefaultText", "design_settings.default_footprint_text_items.0.0" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorRefDefaultVisibility", "design_settings.default_footprint_text_items.0.1" );
|
||||
ret &= fromLegacy<int>( aCfg, "FpEditorRefDefaultLayer", "design_settings.default_footprint_text_items.0.2" );
|
||||
ret &= fromLegacyString( aCfg, "FpEditorValueDefaultText", "design_settings.default_footprint_text_items.1.0" );
|
||||
ret &= fromLegacy<bool>( aCfg, "FpEditorValueDefaultVisibility", "design_settings.default_footprint_text_items.1.1" );
|
||||
ret &= fromLegacy<int>( aCfg, "FpEditorValueDefaultLayer", "design_settings.default_footprint_text_items.1.2" );
|
||||
|
||||
|
||||
const std::string f = "ModEdit";
|
||||
|
||||
|
@ -250,7 +274,8 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
cs->SetName( wxT( "KiCad Default (Footprints)" ) );
|
||||
manager.Save( cs );
|
||||
|
||||
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
|
||||
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId )
|
||||
{
|
||||
wxString str;
|
||||
|
||||
if( aCfg->Read( aKey, &str ) )
|
||||
|
|
|
@ -51,22 +51,6 @@
|
|||
|
||||
// unique, "file local" translations:
|
||||
|
||||
#define FMT_OK_DELETE _( "OK to delete footprint \"%s\" in library \"%s\"" )
|
||||
#define FMT_IMPORT_MODULE _( "Import Footprint" )
|
||||
#define FMT_FILE_NOT_FOUND _( "File \"%s\" not found" )
|
||||
#define FMT_NOT_MODULE _( "Not a footprint file" )
|
||||
#define FMT_MOD_NOT_FOUND _( "Unable to find or load footprint \"%s\" from lib path \"%s\"" )
|
||||
#define FMT_LIB_READ_ONLY _( "Library \"%s\" is read only, not writable" )
|
||||
|
||||
#define FMT_EXPORT_MODULE _( "Export Footprint" )
|
||||
#define FMT_SAVE_MODULE _( "Save Footprint" )
|
||||
#define FMT_MOD_REF _( "Enter footprint name:" )
|
||||
#define FMT_EXPORTED _( "Footprint exported to file \"%s\"" )
|
||||
#define FMT_MOD_DELETED _( "Footprint \"%s\" deleted from library \"%s\"" )
|
||||
#define FMT_MOD_CREATE _( "New Footprint" )
|
||||
|
||||
#define FMT_NO_REF_ABORTED _( "No footprint name defined." )
|
||||
#define FMT_SELECT_LIB _( "Select Library" )
|
||||
|
||||
static const wxString INFO_LEGACY_LIB_WARN_EDIT(
|
||||
_( "Writing/modifying legacy libraries (.mod files) is not allowed\n"\
|
||||
|
@ -96,7 +80,7 @@ static wxFileName getFootprintFilenameFromUser( wxWindow* aParent, const wxStrin
|
|||
<< GedaPcbFootprintLibFileWildcard() << wxChar( '|' )
|
||||
<< AllFilesWildcard();
|
||||
|
||||
wxFileDialog dlg( aParent, FMT_IMPORT_MODULE, aLastPath, wxEmptyString, wildCard,
|
||||
wxFileDialog dlg( aParent, _( "Import Footprint" ), aLastPath, wxEmptyString, wildCard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
dlg.SetFilterIndex( lastFilterIndex );
|
||||
|
@ -262,7 +246,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
|||
|
||||
if( !fp )
|
||||
{
|
||||
wxString msg = wxString::Format( FMT_FILE_NOT_FOUND, GetChars( fn.GetFullPath() ) );
|
||||
wxString msg = wxString::Format( _( "File \"%s\" not found" ), fn.GetFullPath() );
|
||||
DisplayError( this, msg );
|
||||
return NULL;
|
||||
}
|
||||
|
@ -274,7 +258,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
|||
|
||||
if( fileType == IO_MGR::FILE_TYPE_NONE )
|
||||
{
|
||||
DisplayError( this, FMT_NOT_MODULE );
|
||||
DisplayError( this, _( "Not a footprint file" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -286,8 +270,9 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
|
|||
|
||||
if( !module )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
FMT_MOD_NOT_FOUND, GetChars( moduleName ), GetChars( fn.GetFullPath() ) );
|
||||
wxString msg = wxString::Format( _( "Unable to load footprint '%s' from '%s'" ),
|
||||
moduleName,
|
||||
fn.GetFullPath() );
|
||||
DisplayError( this, msg );
|
||||
return NULL;
|
||||
}
|
||||
|
@ -342,7 +327,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
|
|||
else
|
||||
fn.SetPath( m_mruPath );
|
||||
|
||||
wxFileDialog dlg( this, FMT_EXPORT_MODULE, fn.GetPath(), fn.GetFullName(),
|
||||
wxFileDialog dlg( this, _( "Export Footprint" ), fn.GetPath(), fn.GetFullName(),
|
||||
wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
@ -385,7 +370,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
|
|||
return;
|
||||
}
|
||||
|
||||
wxString msg = wxString::Format( FMT_EXPORTED, GetChars( dlg.GetPath() ) );
|
||||
wxString msg = wxString::Format( _( "Footprint exported to file \"%s\"" ), dlg.GetPath() );
|
||||
DisplayInfoMessage( this, msg );
|
||||
}
|
||||
|
||||
|
@ -449,7 +434,8 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary(const wxString& aLibName )
|
|||
{
|
||||
if( !writable )
|
||||
{
|
||||
wxString msg = wxString::Format( FMT_LIB_READ_ONLY, libPath );
|
||||
wxString msg = wxString::Format( _( "Library \"%s\" is read only, not writable" ),
|
||||
libPath );
|
||||
DisplayError( this, msg );
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
@ -585,13 +571,15 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aC
|
|||
|
||||
if( !Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Library \"%s\" is read only" ), nickname );
|
||||
wxString msg = wxString::Format( _( "Library '%s' is read only" ), nickname );
|
||||
DisplayError( this, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Confirmation
|
||||
wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() );
|
||||
wxString msg = wxString::Format( _( "Delete footprint '%s' from library '%s'?" ),
|
||||
fpname.GetData(),
|
||||
nickname.GetData() );
|
||||
|
||||
if( aConfirm && !IsOK( this, msg ) )
|
||||
return false;
|
||||
|
@ -606,7 +594,9 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary( const LIB_ID& aFPID, bool aC
|
|||
return false;
|
||||
}
|
||||
|
||||
msg.Printf( FMT_MOD_DELETED, fpname.GetData(), nickname.GetData() );
|
||||
msg.Printf( _( "Footprint '%s' deleted from library '%s'" ),
|
||||
fpname.GetData(),
|
||||
nickname.GetData() );
|
||||
|
||||
SetStatusText( msg );
|
||||
|
||||
|
@ -880,7 +870,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule )
|
|||
itemsToDisplay.push_back( item );
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( this, FMT_SAVE_MODULE, headers, itemsToDisplay, libraryName );
|
||||
EDA_LIST_DIALOG dlg( this, _( "Save Footprint" ), headers, itemsToDisplay, libraryName );
|
||||
dlg.SetListLabel( _( "Save in library:" ) );
|
||||
dlg.SetOKLabel( _( "Save" ) );
|
||||
|
||||
|
@ -1011,19 +1001,13 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
|
|||
|
||||
MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
|
||||
{
|
||||
// Creates a new footprint at position 0,0 which contains the minimal items:
|
||||
// the reference and the value.
|
||||
// Value : initialized to the footprint name.
|
||||
// put on fab layer (front side)
|
||||
// Reference : initialized to a default value (REF**).
|
||||
// put on silkscreen layer (front side)
|
||||
|
||||
wxString moduleName = aModuleName;
|
||||
|
||||
// Ask for the new module name
|
||||
if( moduleName.IsEmpty() )
|
||||
{
|
||||
WX_TEXT_ENTRY_DIALOG dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName );
|
||||
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Enter footprint name:" ), _( "New Footprint" ),
|
||||
moduleName );
|
||||
dlg.SetTextValidator( MODULE_NAME_CHAR_VALIDATOR( &moduleName ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
|
@ -1035,7 +1019,7 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
|
|||
|
||||
if( moduleName.IsEmpty() )
|
||||
{
|
||||
DisplayInfoMessage( this, FMT_NO_REF_ABORTED );
|
||||
DisplayInfoMessage( this, _( "No footprint name defined." ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1048,40 +1032,59 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
|
|||
// Update its name in lib
|
||||
module->SetFPID( LIB_ID( wxEmptyString, moduleName ) );
|
||||
|
||||
PCB_LAYER_ID layer;
|
||||
wxPoint default_pos;
|
||||
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
|
||||
|
||||
// Update reference:
|
||||
if( settings.m_RefDefaultText.empty() )
|
||||
module->SetReference( moduleName );
|
||||
else
|
||||
module->SetReference( settings.m_RefDefaultText );
|
||||
|
||||
PCB_LAYER_ID layer = ToLAYER_ID( settings.m_RefDefaultlayer );
|
||||
module->Reference().SetTextThickness( settings.GetTextThickness( layer ));
|
||||
module->Reference().SetTextSize( settings.GetTextSize( layer ) );
|
||||
module->Reference().SetItalic( settings.GetTextItalic( layer ) );
|
||||
module->Reference().SetKeepUpright( settings.GetTextUpright( layer ) );
|
||||
default_pos.y = GetDesignSettings().GetTextSize( layer ).y / 2;
|
||||
module->Reference().SetPosition( default_pos );
|
||||
module->Reference().SetText( settings.m_DefaultFPTextItems[0].m_Text );
|
||||
module->Reference().SetVisible( settings.m_DefaultFPTextItems[0].m_Visible );
|
||||
layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[0].m_Layer;
|
||||
module->Reference().SetLayer( layer );
|
||||
module->Reference().SetVisible( settings.m_RefDefaultVisibility );
|
||||
default_pos.y -= settings.GetTextSize( layer ).y / 2;
|
||||
module->Reference().SetPosition( default_pos );
|
||||
default_pos.y += settings.GetTextSize( layer ).y;
|
||||
|
||||
// Set the value field to a default value
|
||||
if( settings.m_ValueDefaultText.empty() )
|
||||
module->SetValue( moduleName );
|
||||
else
|
||||
module->SetValue( settings.m_ValueDefaultText );
|
||||
|
||||
layer = ToLAYER_ID( settings.m_ValueDefaultlayer );
|
||||
module->Value().SetTextThickness( settings.GetTextThickness( layer ));
|
||||
module->Value().SetTextSize( settings.GetTextSize( layer ) );
|
||||
module->Value().SetItalic( settings.GetTextItalic( layer ) );
|
||||
module->Value().SetKeepUpright( settings.GetTextUpright( layer ) );
|
||||
default_pos.y = -default_pos.y;
|
||||
module->Value().SetPosition( default_pos );
|
||||
module->Value().SetText( settings.m_DefaultFPTextItems[1].m_Text );
|
||||
module->Value().SetVisible( settings.m_DefaultFPTextItems[1].m_Visible );
|
||||
layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[1].m_Layer;
|
||||
module->Value().SetLayer( layer );
|
||||
module->Value().SetVisible( settings.m_ValueDefaultVisibility );
|
||||
default_pos.y += settings.GetTextSize( layer ).y / 2;
|
||||
module->Value().SetPosition( default_pos );
|
||||
default_pos.y += settings.GetTextSize( layer ).y;
|
||||
|
||||
for( int i = 2; i < settings.m_DefaultFPTextItems.size(); ++i )
|
||||
{
|
||||
TEXTE_MODULE* textItem = new TEXTE_MODULE( module );
|
||||
textItem->SetText( settings.m_DefaultFPTextItems[i].m_Text );
|
||||
textItem->SetVisible( settings.m_DefaultFPTextItems[i].m_Visible );
|
||||
layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[i].m_Layer;
|
||||
textItem->SetLayer( layer );
|
||||
default_pos.y += settings.GetTextSize( layer ).y / 2;
|
||||
textItem->SetPosition( default_pos );
|
||||
default_pos.y += settings.GetTextSize( layer ).y;
|
||||
module->GraphicalItems().push_back( textItem );
|
||||
}
|
||||
|
||||
if( module->GetReference().IsEmpty() )
|
||||
module->SetReference( moduleName );
|
||||
|
||||
if( module->GetValue().IsEmpty() )
|
||||
module->SetValue( moduleName );
|
||||
|
||||
module->RunOnChildren(
|
||||
[&] ( BOARD_ITEM* aChild )
|
||||
{
|
||||
if( aChild->Type() == PCB_MODULE_TEXT_T )
|
||||
{
|
||||
TEXTE_MODULE* textItem = static_cast<TEXTE_MODULE*>( aChild );
|
||||
PCB_LAYER_ID layer = textItem->GetLayer();
|
||||
|
||||
textItem->SetTextThickness( settings.GetTextThickness( layer ) );
|
||||
textItem->SetTextSize( settings.GetTextSize( layer ) );
|
||||
textItem->SetItalic( settings.GetTextItalic( layer ) );
|
||||
textItem->SetKeepUpright( settings.GetTextUpright( layer ) );
|
||||
}
|
||||
} );
|
||||
|
||||
SetMsgPanel( module );
|
||||
return module;
|
||||
|
@ -1100,24 +1103,20 @@ wxString PCB_BASE_FRAME::SelectLibrary( const wxString& aNicknameExisting )
|
|||
std::vector< wxArrayString > itemsToDisplay;
|
||||
std::vector< wxString > nicknames = fptbl->GetLogicalLibs();
|
||||
|
||||
for( unsigned i = 0; i < nicknames.size(); i++ )
|
||||
for( const wxString& nickname : nicknames )
|
||||
{
|
||||
wxArrayString item;
|
||||
|
||||
item.Add( nicknames[i] );
|
||||
item.Add( fptbl->GetDescription( nicknames[i] ) );
|
||||
item.Add( nickname );
|
||||
item.Add( fptbl->GetDescription( nickname ) );
|
||||
|
||||
itemsToDisplay.push_back( item );
|
||||
}
|
||||
|
||||
EDA_LIST_DIALOG dlg( this, FMT_SELECT_LIB, headers, itemsToDisplay, aNicknameExisting );
|
||||
EDA_LIST_DIALOG dlg( this, _( "Select Library" ), headers, itemsToDisplay, aNicknameExisting );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return wxEmptyString;
|
||||
|
||||
wxString nickname = dlg.GetTextSelection();
|
||||
|
||||
wxLogDebug( wxT( "Chose footprint library \"%s\"." ), GetChars( nickname ) );
|
||||
|
||||
return nickname;
|
||||
return dlg.GetTextSelection();
|
||||
}
|
||||
|
|
|
@ -352,22 +352,25 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe
|
|||
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
|
||||
&m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "footprint_wizard_list.width", &m_FootprintWizardList.width, -1 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "footprint_wizard_list.width",
|
||||
&m_FootprintWizardList.width, -1 ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "footprint_wizard_list.height", &m_FootprintWizardList.height, -1 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "footprint_wizard_list.height",
|
||||
&m_FootprintWizardList.height, -1 ) );
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
m_params.emplace_back(
|
||||
new PARAM_LAMBDA<nlohmann::json>( "action_plugins", [&]() -> nlohmann::json {
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "action_plugins",
|
||||
[&]() -> nlohmann::json
|
||||
{
|
||||
nlohmann::json js = nlohmann::json::array();
|
||||
|
||||
for( const auto& pair : m_VisibleActionPlugins )
|
||||
js.push_back( nlohmann::json( { { pair.first.ToUTF8(), pair.second } } ) );
|
||||
|
||||
return js;
|
||||
}, [&]( const nlohmann::json& aObj ) {
|
||||
},
|
||||
[&]( const nlohmann::json& aObj )
|
||||
{
|
||||
m_VisibleActionPlugins.clear();
|
||||
|
||||
if( !aObj.is_array() )
|
||||
|
@ -386,7 +389,8 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe
|
|||
wxString( pair.key().c_str(), wxConvUTF8 ), pair.value() ) );
|
||||
}
|
||||
}
|
||||
}, nlohmann::json::array() ) );
|
||||
},
|
||||
nlohmann::json::array() ) );
|
||||
#endif
|
||||
|
||||
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
|
||||
|
@ -404,6 +408,9 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
|
||||
const std::string f = getLegacyFrameName();
|
||||
|
||||
//
|
||||
// NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
|
||||
//
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowLayerManagerTools", "aui.show_layer_manager" );
|
||||
ret &= fromLegacy<bool>( aCfg, "ShowMicrowaveTools", "aui.show_microwave_tools" );
|
||||
|
||||
|
@ -533,6 +540,9 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
( *this )[PointerFromString( "action_plugins" ) ] = js;
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
|
||||
//
|
||||
ret &= fromLegacy<int>( aCfg, "VrmlExportUnit", "export_vrml.units" );
|
||||
ret &= fromLegacy<bool>( aCfg, "VrmlExportCopyFiles", "export_vrml.copy_3d_models" );
|
||||
ret &= fromLegacy<bool>( aCfg, "VrmlUseRelativePaths", "export_vrml.use_relative_paths" );
|
||||
|
@ -551,8 +561,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
|
||||
aCfg->SetPath( "ImportGraphics" );
|
||||
ret &= fromLegacy<int>( aCfg, "BoardLayer", "import_graphics.layer" );
|
||||
ret &= fromLegacy<bool>(
|
||||
aCfg, "InteractivePlacement", "import_graphics.interactive_placement" );
|
||||
ret &= fromLegacy<bool>( aCfg, "InteractivePlacement", "import_graphics.interactive_placement" );
|
||||
ret &= fromLegacyString( aCfg, "LastFile", "import_graphics.last_file" );
|
||||
ret &= fromLegacy<double>( aCfg, "LineWidth", "import_graphics.line_width" );
|
||||
ret &= fromLegacy<int>( aCfg, "LineWidthUnits", "import_graphics.line_width_units" );
|
||||
|
@ -563,10 +572,8 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
|
||||
ret &= fromLegacy<int>( aCfg, "NetlistReportFilterMsg", "netlist.report_filter" );
|
||||
ret &= fromLegacy<bool>( aCfg, "NetlistUpdateFootprints", "netlist.update_footprints" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"NetlistDeleteShortingTracks", "netlist.delete_shorting_tracks" );
|
||||
ret &= fromLegacy<bool>( aCfg,
|
||||
"NetlistDeleteExtraFootprints", "netlist.delete_extra_footprints" );
|
||||
ret &= fromLegacy<bool>( aCfg, "NetlistDeleteShortingTracks", "netlist.delete_shorting_tracks" );
|
||||
ret &= fromLegacy<bool>( aCfg, "NetlistDeleteExtraFootprints", "netlist.delete_extra_footprints" );
|
||||
ret &= fromLegacy<bool>( aCfg, "NetlistDeleteSinglePadNets", "netlist.delete_single_pad_nets" );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "PlaceFileUnits", "place_file.units" );
|
||||
|
@ -581,8 +588,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
ret &= fromLegacy<double>( aCfg, "PSPlotFineWidthAdj", "plot.ps_fine_width_adjust" );
|
||||
ret &= fromLegacy<bool>( aCfg, "CheckZonesBeforePlotting", "plot.check_zones_before_plotting" );
|
||||
|
||||
ret &= fromLegacyString( aCfg,
|
||||
"FootprintTextShownColumns", "window.footprint_text_shown_columns" );
|
||||
ret &= fromLegacyString( aCfg, "FootprintTextShownColumns", "window.footprint_text_shown_columns" );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "FpWizardListWidth", "footprint_wizard_list.width" );
|
||||
ret &= fromLegacy<int>( aCfg, "FpWizardListHeight", "footprint_wizard_list.height" );
|
||||
|
@ -595,7 +601,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
|
||||
const std::string p = "pcbnew.InteractiveRouter.";
|
||||
|
||||
( *this )[PointerFromString( "tools.pns.meta" ) ] = nlohmann::json( {
|
||||
( *this )[PointerFromString( "tools.pns.meta" )] = nlohmann::json( {
|
||||
{ "filename", "pns" },
|
||||
{ "version", 0 }
|
||||
} );
|
||||
|
|
|
@ -69,18 +69,21 @@ ROUTING_SETTINGS::ROUTING_SETTINGS( JSON_SETTINGS* aParent, const std::string& a
|
|||
m_params.emplace_back( new PARAM<bool>( "start_diagonal", &m_startDiagonal, false ) );
|
||||
m_params.emplace_back( new PARAM<int>( "shove_iteration_limit", &m_shoveIterationLimit, 250 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_LAMBDA<int>( "shove_time_limit", [this] () -> int {
|
||||
m_params.emplace_back( new PARAM_LAMBDA<int>( "shove_time_limit",
|
||||
[this] () -> int
|
||||
{
|
||||
return m_shoveTimeLimit.Get();
|
||||
}, [this] ( int aVal ) {
|
||||
},
|
||||
[this] ( int aVal )
|
||||
{
|
||||
m_shoveTimeLimit.Set( aVal );
|
||||
}, 1000 ) );
|
||||
},
|
||||
1000 ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<int>( "walkaround_iteration_limit", &m_walkaroundIterationLimit, 40 ) );
|
||||
m_params.emplace_back( new PARAM<int>( "walkaround_iteration_limit", &m_walkaroundIterationLimit, 40 ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "jump_over_obstacles", &m_jumpOverObstacles, false ) );
|
||||
|
||||
m_params.emplace_back(
|
||||
new PARAM<bool>( "smooth_dragged_segments", &m_smoothDraggedSegments, true ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "smooth_dragged_segments", &m_smoothDraggedSegments, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "can_violate_drc", &m_canViolateDRC, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "free_angle_mode", &m_freeAngleMode, false ) );
|
||||
|
|
|
@ -105,7 +105,7 @@ wxString TEXT_MOD_GRID_TABLE::GetRowLabelValue( int aRow )
|
|||
{
|
||||
switch( aRow )
|
||||
{
|
||||
case 0: return _( "Reference" );
|
||||
case 0: return _( "Reference designator" );
|
||||
case 1: return _( "Value" );
|
||||
default: return wxEmptyString;
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol )
|
|||
return text.GetLayerName();
|
||||
|
||||
case TMC_ORIENTATION:
|
||||
return StringFromValue(
|
||||
EDA_UNITS::DEGREES, (int) NormalizeAnglePos( text.GetTextAngle() ), true );
|
||||
return StringFromValue( EDA_UNITS::DEGREES, (int) NormalizeAnglePos( text.GetTextAngle() ),
|
||||
true );
|
||||
|
||||
case TMC_XOFFSET:
|
||||
return StringFromValue( m_userUnits, text.GetPos0().x, true );
|
||||
|
|
Loading…
Reference in New Issue