Formatting.
This commit is contained in:
parent
0589792a14
commit
f606069bf6
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -175,7 +175,7 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame
|
||||||
m_parent( aParent )
|
m_parent( aParent )
|
||||||
{
|
{
|
||||||
m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 );
|
m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 );
|
||||||
m_layerClassesGrid->SetDefaultRowSize( m_layerClassesGrid->GetDefaultRowSize() + 4 );
|
m_graphicsGrid->SetDefaultRowSize( m_graphicsGrid->GetDefaultRowSize() + 4 );
|
||||||
|
|
||||||
m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true );
|
m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE(), true );
|
||||||
|
|
||||||
|
@ -191,10 +191,10 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame
|
||||||
|
|
||||||
// Work around a bug in wxWidgets where it fails to recalculate the grid height
|
// Work around a bug in wxWidgets where it fails to recalculate the grid height
|
||||||
// after changing the default row size
|
// after changing the default row size
|
||||||
m_layerClassesGrid->AppendRows( 1 );
|
m_graphicsGrid->AppendRows( 1 );
|
||||||
m_layerClassesGrid->DeleteRows( m_layerClassesGrid->GetNumberRows() - 1, 1 );
|
m_graphicsGrid->DeleteRows( m_graphicsGrid->GetNumberRows() - 1, 1 );
|
||||||
|
|
||||||
m_layerClassesGrid->PushEventHandler( new GRID_TRICKS( m_layerClassesGrid ) );
|
m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) );
|
||||||
|
|
||||||
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
||||||
|
@ -204,8 +204,8 @@ PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( FOOTPRINT_EDIT_FRAME* aFrame
|
||||||
|
|
||||||
PANEL_FP_EDITOR_DEFAULTS::~PANEL_FP_EDITOR_DEFAULTS()
|
PANEL_FP_EDITOR_DEFAULTS::~PANEL_FP_EDITOR_DEFAULTS()
|
||||||
{
|
{
|
||||||
// destroy GRID_TRICKS before m_layerClassesGrid.
|
// destroy GRID_TRICKS before m_graphicsGrid.
|
||||||
m_layerClassesGrid->PopEventHandler( true );
|
m_graphicsGrid->PopEventHandler( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,10 +214,11 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow()
|
||||||
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||||
|
|
||||||
#define SET_MILS_CELL( row, col, val ) \
|
#define SET_MILS_CELL( row, col, val ) \
|
||||||
m_layerClassesGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) )
|
m_graphicsGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) )
|
||||||
|
|
||||||
#define DISABLE_CELL( row, col ) \
|
#define DISABLE_CELL( row, col ) \
|
||||||
m_layerClassesGrid->SetReadOnly( row, col ); m_layerClassesGrid->SetCellBackgroundColour( row, col, disabledColour );
|
m_graphicsGrid->SetReadOnly( row, col ); \
|
||||||
|
m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour );
|
||||||
|
|
||||||
for( int i = 0; i < ROW_COUNT; ++i )
|
for( int i = 0; i < ROW_COUNT; ++i )
|
||||||
{
|
{
|
||||||
|
@ -235,13 +236,13 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow()
|
||||||
SET_MILS_CELL( i, COL_TEXT_WIDTH, m_brdSettings.m_TextSize[ i ].x );
|
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_HEIGHT, m_brdSettings.m_TextSize[ i ].y );
|
||||||
SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_brdSettings.m_TextThickness[ i ] );
|
SET_MILS_CELL( i, COL_TEXT_THICKNESS, m_brdSettings.m_TextThickness[ i ] );
|
||||||
m_layerClassesGrid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" );
|
m_graphicsGrid->SetCellValue( i, COL_TEXT_ITALIC, m_brdSettings.m_TextItalic[ i ] ? "1" : "" );
|
||||||
|
|
||||||
auto attr = new wxGridCellAttr;
|
auto attr = new wxGridCellAttr;
|
||||||
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
attr->SetRenderer( new wxGridCellBoolRenderer() );
|
||||||
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
|
||||||
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
m_layerClassesGrid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
m_graphicsGrid->SetAttr( i, COL_TEXT_ITALIC, attr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,17 +258,17 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow()
|
||||||
m_textItemsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer );
|
m_textItemsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int col = 0; col < m_layerClassesGrid->GetNumberCols(); col++ )
|
for( int col = 0; col < m_graphicsGrid->GetNumberCols(); col++ )
|
||||||
{
|
{
|
||||||
// Set the minimal width to the column label size.
|
// Set the minimal width to the column label size.
|
||||||
m_layerClassesGrid->SetColMinimalWidth( col, m_layerClassesGrid->GetVisibleWidth( col, true, false, false ) );
|
m_graphicsGrid->SetColMinimalWidth( col, m_graphicsGrid->GetVisibleWidth( col, true, false, false ) );
|
||||||
|
|
||||||
// Set the width to see the full contents
|
// Set the width to see the full contents
|
||||||
if( m_layerClassesGrid->IsColShown( col ) )
|
if( m_graphicsGrid->IsColShown( col ) )
|
||||||
m_layerClassesGrid->SetColSize( col, m_layerClassesGrid->GetVisibleWidth( col, true, true, true ) );
|
m_graphicsGrid->SetColSize( col, m_graphicsGrid->GetVisibleWidth( col, true, true, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_layerClassesGrid->SetRowLabelSize( m_layerClassesGrid->GetVisibleWidth( -1, true, true, true ) );
|
m_graphicsGrid->SetRowLabelSize( m_graphicsGrid->GetVisibleWidth( -1, true, true, true ) );
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
|
@ -290,7 +291,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow )
|
||||||
|
|
||||||
if( aShow && m_firstShow )
|
if( aShow && m_firstShow )
|
||||||
{
|
{
|
||||||
m_layerClassesGrid->SetColSize( 0, m_layerClassesGrid->GetColSize( 0 ) + 1 );
|
m_graphicsGrid->SetColSize( 0, m_graphicsGrid->GetColSize( 0 ) + 1 );
|
||||||
m_firstShow = false;
|
m_firstShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,13 +302,13 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow )
|
||||||
int PANEL_FP_EDITOR_DEFAULTS::getGridValue( int aRow, int aCol )
|
int PANEL_FP_EDITOR_DEFAULTS::getGridValue( int aRow, int aCol )
|
||||||
{
|
{
|
||||||
return ValueFromString( m_frame->GetUserUnits(),
|
return ValueFromString( m_frame->GetUserUnits(),
|
||||||
m_layerClassesGrid->GetCellValue( aRow, aCol ) );
|
m_graphicsGrid->GetCellValue( aRow, aCol ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PANEL_FP_EDITOR_DEFAULTS::validateData()
|
bool PANEL_FP_EDITOR_DEFAULTS::validateData()
|
||||||
{
|
{
|
||||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Test text parameters.
|
// Test text parameters.
|
||||||
|
@ -320,7 +321,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::validateData()
|
||||||
{
|
{
|
||||||
wxString msg = _( "Text will not be readable with a thickness greater than\n"
|
wxString msg = _( "Text will not be readable with a thickness greater than\n"
|
||||||
"1/4 its width or height." );
|
"1/4 its width or height." );
|
||||||
m_parent->SetError( msg, this, m_layerClassesGrid, row, COL_TEXT_THICKNESS );
|
m_parent->SetError( msg, this, m_graphicsGrid, row, COL_TEXT_THICKNESS );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +346,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow()
|
||||||
getGridValue( i, COL_TEXT_HEIGHT ) );
|
getGridValue( i, COL_TEXT_HEIGHT ) );
|
||||||
m_brdSettings.m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS );
|
m_brdSettings.m_TextThickness[ i ] = getGridValue( i, COL_TEXT_THICKNESS );
|
||||||
|
|
||||||
wxString msg = m_layerClassesGrid->GetCellValue( i, COL_TEXT_ITALIC );
|
wxString msg = m_graphicsGrid->GetCellValue( i, COL_TEXT_ITALIC );
|
||||||
m_brdSettings.m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg );
|
m_brdSettings.m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +374,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow()
|
||||||
|
|
||||||
void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
|
void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxGridTableBase* table = m_textItemsGrid->GetTable();
|
wxGridTableBase* table = m_textItemsGrid->GetTable();
|
||||||
|
@ -393,7 +394,7 @@ void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event )
|
||||||
|
|
||||||
void PANEL_FP_EDITOR_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event )
|
void PANEL_FP_EDITOR_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( !m_textItemsGrid->CommitPendingChanges() || !m_layerClassesGrid->CommitPendingChanges() )
|
if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int curRow = m_textItemsGrid->GetGridCursorRow();
|
int curRow = m_textItemsGrid->GetGridCursorRow();
|
||||||
|
|
|
@ -104,49 +104,49 @@ PANEL_FP_EDITOR_DEFAULTS_BASE::PANEL_FP_EDITOR_DEFAULTS_BASE( wxWindow* parent,
|
||||||
defaultPropertiesLabel->Wrap( -1 );
|
defaultPropertiesLabel->Wrap( -1 );
|
||||||
defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxBOTTOM|wxRIGHT, 5 );
|
defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_layerClassesGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_graphicsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
m_layerClassesGrid->CreateGrid( 6, 5 );
|
m_graphicsGrid->CreateGrid( 6, 5 );
|
||||||
m_layerClassesGrid->EnableEditing( true );
|
m_graphicsGrid->EnableEditing( true );
|
||||||
m_layerClassesGrid->EnableGridLines( true );
|
m_graphicsGrid->EnableGridLines( true );
|
||||||
m_layerClassesGrid->EnableDragGridSize( false );
|
m_graphicsGrid->EnableDragGridSize( false );
|
||||||
m_layerClassesGrid->SetMargins( 0, 0 );
|
m_graphicsGrid->SetMargins( 0, 0 );
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
m_layerClassesGrid->SetColSize( 0, 110 );
|
m_graphicsGrid->SetColSize( 0, 110 );
|
||||||
m_layerClassesGrid->SetColSize( 1, 100 );
|
m_graphicsGrid->SetColSize( 1, 100 );
|
||||||
m_layerClassesGrid->SetColSize( 2, 100 );
|
m_graphicsGrid->SetColSize( 2, 100 );
|
||||||
m_layerClassesGrid->SetColSize( 3, 100 );
|
m_graphicsGrid->SetColSize( 3, 100 );
|
||||||
m_layerClassesGrid->SetColSize( 4, 60 );
|
m_graphicsGrid->SetColSize( 4, 60 );
|
||||||
m_layerClassesGrid->EnableDragColMove( false );
|
m_graphicsGrid->EnableDragColMove( false );
|
||||||
m_layerClassesGrid->EnableDragColSize( true );
|
m_graphicsGrid->EnableDragColSize( true );
|
||||||
m_layerClassesGrid->SetColLabelSize( 22 );
|
m_graphicsGrid->SetColLabelSize( 22 );
|
||||||
m_layerClassesGrid->SetColLabelValue( 0, _("Line Thickness") );
|
m_graphicsGrid->SetColLabelValue( 0, _( "Line Thickness") );
|
||||||
m_layerClassesGrid->SetColLabelValue( 1, _("Text Width") );
|
m_graphicsGrid->SetColLabelValue( 1, _( "Text Width") );
|
||||||
m_layerClassesGrid->SetColLabelValue( 2, _("Text Height") );
|
m_graphicsGrid->SetColLabelValue( 2, _( "Text Height") );
|
||||||
m_layerClassesGrid->SetColLabelValue( 3, _("Text Thickness") );
|
m_graphicsGrid->SetColLabelValue( 3, _( "Text Thickness") );
|
||||||
m_layerClassesGrid->SetColLabelValue( 4, _("Italic") );
|
m_graphicsGrid->SetColLabelValue( 4, _( "Italic") );
|
||||||
m_layerClassesGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
m_graphicsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
m_layerClassesGrid->EnableDragRowSize( false );
|
m_graphicsGrid->EnableDragRowSize( false );
|
||||||
m_layerClassesGrid->SetRowLabelSize( 125 );
|
m_graphicsGrid->SetRowLabelSize( 125 );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 0, _("Silk Layers") );
|
m_graphicsGrid->SetRowLabelValue( 0, _( "Silk Layers") );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 1, _("Copper Layers") );
|
m_graphicsGrid->SetRowLabelValue( 1, _( "Copper Layers") );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 2, _("Edge Cuts") );
|
m_graphicsGrid->SetRowLabelValue( 2, _( "Edge Cuts") );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 3, _("Courtyards") );
|
m_graphicsGrid->SetRowLabelValue( 3, _( "Courtyards") );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 4, _("Fab Layers") );
|
m_graphicsGrid->SetRowLabelValue( 4, _( "Fab Layers") );
|
||||||
m_layerClassesGrid->SetRowLabelValue( 5, _("Other Layers") );
|
m_graphicsGrid->SetRowLabelValue( 5, _( "Other Layers") );
|
||||||
m_layerClassesGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
m_graphicsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||||
|
|
||||||
// Label Appearance
|
// Label Appearance
|
||||||
|
|
||||||
// Cell Defaults
|
// Cell Defaults
|
||||||
m_layerClassesGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
m_graphicsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||||
m_layerClassesGrid->SetToolTip( _("Net Class parameters") );
|
m_graphicsGrid->SetToolTip( _( "Net Class parameters") );
|
||||||
|
|
||||||
defaultPropertiesSizer->Add( m_layerClassesGrid, 1, wxBOTTOM|wxLEFT, 20 );
|
defaultPropertiesSizer->Add( m_graphicsGrid, 1, wxBOTTOM | wxLEFT, 20 );
|
||||||
|
|
||||||
|
|
||||||
bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
|
@ -606,7 +606,7 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size">-1,-1</property>
|
<property name="minimum_size">-1,-1</property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_layerClassesGrid</property>
|
<property name="name">m_graphicsGrid</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PANEL_FP_EDITOR_DEFAULTS_BASE : public wxPanel
|
||||||
wxBitmapButton* m_bpAdd;
|
wxBitmapButton* m_bpAdd;
|
||||||
wxBitmapButton* m_bpDelete;
|
wxBitmapButton* m_bpDelete;
|
||||||
wxStaticText* m_staticTextInfo;
|
wxStaticText* m_staticTextInfo;
|
||||||
WX_GRID* m_layerClassesGrid;
|
WX_GRID* m_graphicsGrid;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
|
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
|
||||||
|
|
Loading…
Reference in New Issue