diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 1d4d80d14c..f78ececf7f 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -1182,7 +1182,8 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent book->AddLazySubPage( LAZY_CTOR( PANEL_FP_ORIGINS_AXES ), _( "Origins & Axes" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_FIELDS ), _( "New Footprint Defaults" ) ); + book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_GRAPHICS_VALUES ), _( "Graphics Defaults" ) ); if( GetFrameType() == FRAME_PCB_EDITOR ) expand.push_back( (int) book->GetPageCount() ); diff --git a/include/frame_type.h b/include/frame_type.h index a3fa800942..398d8249d4 100644 --- a/include/frame_type.h +++ b/include/frame_type.h @@ -86,7 +86,8 @@ enum FRAME_T PANEL_FP_GRIDS, PANEL_FP_EDIT_OPTIONS, PANEL_FP_COLORS, - PANEL_FP_DEFAULT_VALUES, + PANEL_FP_DEFAULT_FIELDS, + PANEL_FP_DEFAULT_GRAPHICS_VALUES, PANEL_FP_ORIGINS_AXES, PANEL_PCB_DISPLAY_OPTS, diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 7ef42e11f0..6cf2b26753 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -168,8 +168,10 @@ set( PCBNEW_DIALOGS dialogs/panel_fp_lib_table.cpp dialogs/panel_fp_lib_table_base.cpp dialogs/panel_fp_editor_color_settings.cpp - dialogs/panel_fp_editor_defaults.cpp - dialogs/panel_fp_editor_defaults_base.cpp + dialogs/panel_fp_editor_field_defaults.cpp + dialogs/panel_fp_editor_field_defaults_base.cpp + dialogs/panel_fp_editor_graphics_defaults.cpp + dialogs/panel_fp_editor_graphics_defaults_base.cpp dialogs/panel_fp_properties_3d_model.cpp dialogs/panel_fp_properties_3d_model_base.cpp dialogs/panel_pcbnew_action_plugins.cpp diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_defaults.cpp deleted file mode 100644 index d3c93c9a7a..0000000000 --- a/pcbnew/dialogs/panel_fp_editor_defaults.cpp +++ /dev/null @@ -1,557 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "panel_fp_editor_defaults.h" - -#include <pgm_base.h> -#include <settings/settings_manager.h> -#include <footprint_editor_settings.h> -#include <template_fieldnames.h> -#include <widgets/std_bitmap_button.h> -#include <grid_tricks.h> -#include <eda_text.h> -#include <panel_setup_dimensions.h> -#include <grid_layer_box_helpers.h> -#include <bitmaps.h> -#include <confirm.h> -#include <kidialog.h> - -class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase -{ - bool m_forFieldProps; - std::vector<TEXT_ITEM_INFO> m_items; - -public: - TEXT_ITEMS_GRID_TABLE( bool aForFieldProps ) : - m_forFieldProps( aForFieldProps ) - { } - - int GetNumberRows() override { return m_items.size(); } - int GetNumberCols() override { return 3; } - - wxString GetColLabelValue( int aCol ) override - { - switch( aCol ) - { - case 0: return m_forFieldProps ? _( "Value" ) : _( "Text Items" ); - case 1: return _( "Show" ); - case 2: return _( "Layer" ); - default: return wxEmptyString; - } - } - - wxString GetRowLabelValue( int aRow ) override - { - switch( aRow ) - { - case 0: return _( "Reference designator" ); - case 1: return _( "Value" ); - default: return wxEmptyString; - } - } - - bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override - { - 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 ) override - { - 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 = (int) value; - } - - bool AppendRows( size_t aNumRows = 1 ) override - { - for( size_t 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 graphics grid -enum -{ - COL_LINE_THICKNESS = 0, - COL_TEXT_WIDTH, - COL_TEXT_HEIGHT, - COL_TEXT_THICKNESS, - COL_TEXT_ITALIC -}; - -enum -{ - ROW_SILK = 0, - ROW_COPPER, - ROW_EDGES, - ROW_COURTYARD, - ROW_FAB, - ROW_OTHERS, - - ROW_COUNT -}; - - -static BOARD_DESIGN_SETTINGS& GetPgmDesignSettings() -{ - SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); - return mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" )->m_DesignSettings; -} - - -PANEL_FP_EDITOR_DEFAULTS::PANEL_FP_EDITOR_DEFAULTS( wxWindow* aParent, - UNITS_PROVIDER* aUnitsProvider ) : - PANEL_FP_EDITOR_DEFAULTS_BASE( aParent ), - m_unitProvider( aUnitsProvider ), - m_designSettings( GetPgmDesignSettings() ), - m_dimensionsPanel( - std::make_unique<PANEL_SETUP_DIMENSIONS>( this, *m_unitProvider, m_designSettings ) ) -{ - m_fieldPropsGrid->SetDefaultRowSize( m_fieldPropsGrid->GetDefaultRowSize() + 4 ); - - m_fieldPropsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE( true ), true ); - m_fieldPropsGrid->PushEventHandler( new GRID_TRICKS( m_fieldPropsGrid ) ); - m_fieldPropsGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); - - wxGridCellAttr* attr = new wxGridCellAttr; - attr->SetRenderer( new wxGridCellBoolRenderer() ); - attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS - attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - m_fieldPropsGrid->SetColAttr( 1, attr ); - - attr = new wxGridCellAttr; - attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) ); - attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, {} ) ); - m_fieldPropsGrid->SetColAttr( 2, attr ); - - m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 ); - - m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE( false ), true ); - m_textItemsGrid->PushEventHandler( new GRID_TRICKS( m_textItemsGrid ) ); - m_textItemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); - - attr = new wxGridCellAttr; - attr->SetRenderer( new wxGridCellBoolRenderer() ); - attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS - attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - m_textItemsGrid->SetColAttr( 1, attr ); - - attr = new wxGridCellAttr; - attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) ); - attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, {} ) ); - m_textItemsGrid->SetColAttr( 2, attr ); - - m_graphicsGrid->SetUnitsProvider( aUnitsProvider ); - m_graphicsGrid->SetAutoEvalCols( { COL_LINE_THICKNESS, - COL_TEXT_WIDTH, - COL_TEXT_HEIGHT, - COL_TEXT_THICKNESS } ); - - m_graphicsGrid->SetDefaultRowSize( m_graphicsGrid->GetDefaultRowSize() + 4 ); - - // Work around a bug in wxWidgets where it fails to recalculate the grid height - // after changing the default row size - m_graphicsGrid->AppendRows( 1 ); - m_graphicsGrid->DeleteRows( m_graphicsGrid->GetNumberRows() - 1, 1 ); - - m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) ); - - GetSizer()->Add( m_dimensionsPanel.get(), 0, wxEXPAND | wxALL, 5 ); -} - - -PANEL_FP_EDITOR_DEFAULTS::~PANEL_FP_EDITOR_DEFAULTS() -{ - // destroy GRID_TRICKS before grids. - m_fieldPropsGrid->PopEventHandler( true ); - m_textItemsGrid->PopEventHandler( true ); - m_graphicsGrid->PopEventHandler( true ); -} - - -void PANEL_FP_EDITOR_DEFAULTS::loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg ) -{ - wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ); - - auto disableCell = - [&]( int row, int col ) - { - m_graphicsGrid->SetReadOnly( row, col ); - m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour ); - }; - - for( int i = 0; i < ROW_COUNT; ++i ) - { - m_graphicsGrid->SetUnitValue( i, COL_LINE_THICKNESS, aCfg->m_DesignSettings.m_LineThickness[ i ] ); - - if( i == ROW_EDGES || i == ROW_COURTYARD ) - { - disableCell( i, COL_TEXT_WIDTH ); - disableCell( i, COL_TEXT_HEIGHT ); - disableCell( i, COL_TEXT_THICKNESS ); - disableCell( i, COL_TEXT_ITALIC ); - } - else - { - m_graphicsGrid->SetUnitValue( i, COL_TEXT_WIDTH, aCfg->m_DesignSettings.m_TextSize[ i ].x ); - m_graphicsGrid->SetUnitValue( i, COL_TEXT_HEIGHT, aCfg->m_DesignSettings.m_TextSize[ i ].y ); - m_graphicsGrid->SetUnitValue( i, COL_TEXT_THICKNESS, aCfg->m_DesignSettings.m_TextThickness[ i ] ); - m_graphicsGrid->SetCellValue( i, COL_TEXT_ITALIC, aCfg->m_DesignSettings.m_TextItalic[ i ] ? wxT( "1" ) : wxT( "" ) ); - - auto attr = new wxGridCellAttr; - attr->SetRenderer( new wxGridCellBoolRenderer() ); - attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS - attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - m_graphicsGrid->SetAttr( i, COL_TEXT_ITALIC, attr ); - } - } - - // Footprint defaults - m_fieldPropsGrid->GetTable()->DeleteRows( 0, m_textItemsGrid->GetNumberRows() ); - m_fieldPropsGrid->GetTable()->AppendRows( 2 ); - - for( int i : { REFERENCE_FIELD, VALUE_FIELD } ) - { - TEXT_ITEM_INFO item = aCfg->m_DesignSettings.m_DefaultFPTextItems[i]; - - m_fieldPropsGrid->GetTable()->SetValue( i, 0, item.m_Text ); - m_fieldPropsGrid->GetTable()->SetValueAsBool( i, 1, item.m_Visible ); - m_fieldPropsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer ); - } - - m_textItemsGrid->GetTable()->DeleteRows( 0, m_textItemsGrid->GetNumberRows() ); - m_textItemsGrid->GetTable()->AppendRows( aCfg->m_DesignSettings.m_DefaultFPTextItems.size() - 2 ); - - for( int i = 2; i < (int) aCfg->m_DesignSettings.m_DefaultFPTextItems.size(); ++i ) - { - TEXT_ITEM_INFO item = aCfg->m_DesignSettings.m_DefaultFPTextItems[i]; - - m_textItemsGrid->GetTable()->SetValue( i - 2, 0, item.m_Text ); - m_textItemsGrid->GetTable()->SetValueAsBool( i - 2, 1, item.m_Visible ); - m_textItemsGrid->GetTable()->SetValueAsLong( i - 2, 2, item.m_Layer ); - } - - for( int col = 0; col < m_graphicsGrid->GetNumberCols(); col++ ) - { - // Set the minimal width to the column label size. - m_graphicsGrid->SetColMinimalWidth( col, m_graphicsGrid->GetVisibleWidth( col, true, false ) ); - - // Set the width to see the full contents - if( m_graphicsGrid->IsColShown( col ) ) - m_graphicsGrid->SetColSize( col, m_graphicsGrid->GetVisibleWidth( col, true, true, true ) ); - } - - m_graphicsGrid->SetRowLabelSize( m_graphicsGrid->GetVisibleWidth( -1, true, true, true ) ); - - m_dimensionsPanel->LoadFromSettings( aCfg->m_DesignSettings ); - - Layout(); -} - - -bool PANEL_FP_EDITOR_DEFAULTS::TransferDataToWindow() -{ - SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); - FOOTPRINT_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ); - - loadFPSettings( cfg ); - - return true; -} - - -bool PANEL_FP_EDITOR_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( KiBitmapBundle( BITMAPS::small_plus ) ); - m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) ); - } - - if( aShow && m_firstShow ) - { - m_graphicsGrid->SetColSize( 0, m_graphicsGrid->GetColSize( 0 ) + 1 ); - m_firstShow = false; - } - - return retVal; -} - - -bool PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow() -{ - if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) - return false; - - BOARD_DESIGN_SETTINGS& cfg = m_designSettings; - - // A minimal value for sizes and thickness: - const int minWidth = pcbIUScale.mmToIU( MINIMUM_LINE_WIDTH_MM ); - const int maxWidth = pcbIUScale.mmToIU( MAXIMUM_LINE_WIDTH_MM ); - const int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM ); - const int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM ); - wxString errorsMsg; - - for( int i = 0; i < ROW_COUNT; ++i ) - { - bool badParam = false; - - int lineWidth = m_graphicsGrid->GetUnitValue( i, COL_LINE_THICKNESS ); - - if( lineWidth < minWidth || lineWidth > maxWidth ) - { - if( !errorsMsg.IsEmpty() ) - errorsMsg += wxT( "\n\n" ); - - errorsMsg += wxString::Format( _( "%s: Incorrect line width.\n" - "It must be between %s and %s" ), - m_graphicsGrid->GetRowLabelValue( i ), - m_unitProvider->StringFromValue( minWidth , true), - m_unitProvider->StringFromValue( maxWidth , true) ); - badParam = true; - } - - if( !badParam ) - cfg.m_LineThickness[ i ] = lineWidth; - - if( i == ROW_EDGES || i == ROW_COURTYARD ) - continue; - - badParam = false; - int textWidth = m_graphicsGrid->GetUnitValue( i, COL_TEXT_WIDTH ); - int textHeight = m_graphicsGrid->GetUnitValue( i, COL_TEXT_HEIGHT ); - int textThickness = m_graphicsGrid->GetUnitValue( i, COL_TEXT_THICKNESS ); - - if( textWidth < minSize || textHeight < minSize - || textWidth > maxSize || textHeight > maxSize ) - { - if( !errorsMsg.IsEmpty() ) - errorsMsg += wxT( "\n\n" ); - - errorsMsg += wxString::Format( _( "%s: Text size is incorrect.\n" - "Size must be between %s and %s" ), - m_graphicsGrid->GetRowLabelValue( i ), - m_unitProvider->StringFromValue( minSize , true), - m_unitProvider->StringFromValue( maxSize , true) ); - badParam = true; - } - - // Text thickness cannot be > text size /4 to be readable - int textMinDim = std::min( textWidth, textHeight ); - int textMaxThickness = std::min( maxWidth, textMinDim /4); - - if( !badParam && ( textThickness < minWidth || textThickness > textMaxThickness ) ) - { - if( !errorsMsg.IsEmpty() ) - errorsMsg += wxT( "\n\n" ); - - if( textThickness > textMaxThickness ) - errorsMsg += wxString::Format( _( "%s: Text thickness is too large.\n" - "It will be truncated to %s" ), - m_graphicsGrid->GetRowLabelValue( i ), - m_unitProvider->StringFromValue( textMaxThickness , true) ); - - else if( textThickness < minWidth ) - errorsMsg += wxString::Format( _( "%s: Text thickness is too small.\n" - "It will be truncated to %s" ), - m_graphicsGrid->GetRowLabelValue( i ), - m_unitProvider->StringFromValue( minWidth , true ) ); - - textThickness = std::min( textThickness, textMaxThickness ); - textThickness = std::max( textThickness, minWidth ); - m_graphicsGrid->SetUnitValue( i, COL_TEXT_THICKNESS, textThickness ); - } - - if( !badParam ) - { - cfg.m_TextSize[i] = VECTOR2I( textWidth, textHeight ); - cfg.m_TextThickness[ i ] = textThickness; - } - - wxString msg = m_graphicsGrid->GetCellValue( i, COL_TEXT_ITALIC ); - cfg.m_TextItalic[ i ] = wxGridCellBoolEditor::IsTrueValue( msg ); - } - - // Footprint defaults - cfg.m_DefaultFPTextItems.clear(); - - wxGridTableBase* table = m_fieldPropsGrid->GetTable(); - - for( int i : { REFERENCE_FIELD, VALUE_FIELD } ) - { - wxString text = table->GetValue( i, 0 ); - bool visible = table->GetValueAsBool( i, 1 ); - int layer = (int) table->GetValueAsLong( i, 2 ); - - cfg.m_DefaultFPTextItems.emplace_back( text, visible, layer ); - } - - table = m_textItemsGrid->GetTable(); - - 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 ); - - cfg.m_DefaultFPTextItems.emplace_back( text, visible, layer ); - } - - m_dimensionsPanel->TransferDataFromWindow(); - - if( errorsMsg.IsEmpty() ) - return true; - - KIDIALOG dlg( wxGetTopLevelParent( this ), errorsMsg, KIDIALOG::KD_ERROR, - _( "Parameter error" ) ); - dlg.ShowModal(); - - return false; -} - - -void PANEL_FP_EDITOR_DEFAULTS::OnAddTextItem( wxCommandEvent& event ) -{ - if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->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_FP_EDITOR_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event ) -{ - wxArrayInt selectedRows = m_textItemsGrid->GetSelectedRows(); - - if( selectedRows.empty() && m_textItemsGrid->GetGridCursorRow() >= 0 ) - selectedRows.push_back( m_textItemsGrid->GetGridCursorRow() ); - - if( selectedRows.empty() ) - return; - - if( !m_textItemsGrid->CommitPendingChanges() || !m_graphicsGrid->CommitPendingChanges() ) - return; - - // Reverse sort so deleting a row doesn't change the indexes of the other rows. - selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } ); - - for( int row : selectedRows ) - { - m_textItemsGrid->GetTable()->DeleteRows( row, 1 ); - - if( m_textItemsGrid->GetNumberRows() > 0 ) - { - m_textItemsGrid->MakeCellVisible( std::max( 0, row-1 ), - m_textItemsGrid->GetGridCursorCol() ); - m_textItemsGrid->SetGridCursor( std::max( 0, row-1 ), - m_textItemsGrid->GetGridCursorCol() ); - } - } -} - - -void PANEL_FP_EDITOR_DEFAULTS::ResetPanel() -{ - FOOTPRINT_EDITOR_SETTINGS cfg; - cfg.Load(); // Loading without a file will init to defaults - - loadFPSettings( &cfg ); -} diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp b/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp deleted file mode 100644 index 9621800043..0000000000 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.fbp +++ /dev/null @@ -1,785 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<wxFormBuilder_Project> - <FileVersion major="1" minor="16" /> - <object class="Project" expanded="1"> - <property name="class_decoration"></property> - <property name="code_generation">C++</property> - <property name="disconnect_events">1</property> - <property name="disconnect_mode">source_name</property> - <property name="disconnect_php_events">0</property> - <property name="disconnect_python_events">0</property> - <property name="embedded_files_path">res</property> - <property name="encoding">UTF-8</property> - <property name="event_generation">connect</property> - <property name="file">panel_fp_editor_defaults_base</property> - <property name="first_id">1000</property> - <property name="help_provider">none</property> - <property name="image_path_wrapper_function_name"></property> - <property name="indent_with_spaces"></property> - <property name="internationalize">1</property> - <property name="name">PanelFPEditorDefaults</property> - <property name="namespace"></property> - <property name="path">.</property> - <property name="precompiled_header"></property> - <property name="relative_path">1</property> - <property name="skip_lua_events">1</property> - <property name="skip_php_events">1</property> - <property name="skip_python_events">1</property> - <property name="ui_table">UI</property> - <property name="use_array_enum">0</property> - <property name="use_enum">0</property> - <property name="use_microsoft_bom">0</property> - <object class="Panel" expanded="1"> - <property name="aui_managed">0</property> - <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> - <property name="bg"></property> - <property name="context_help"></property> - <property name="context_menu">1</property> - <property name="enabled">1</property> - <property name="event_handler">impl_virtual</property> - <property name="fg"></property> - <property name="font"></property> - <property name="hidden">0</property> - <property name="id">wxID_ANY</property> - <property name="maximum_size"></property> - <property name="minimum_size"></property> - <property name="name">PANEL_FP_EDITOR_DEFAULTS_BASE</property> - <property name="pos"></property> - <property name="size">-1,-1</property> - <property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property> - <property name="tooltip"></property> - <property name="two_step_creation">0</property> - <property name="window_extra_style"></property> - <property name="window_name"></property> - <property name="window_style">wxTAB_TRAVERSAL</property> - <object class="wxBoxSizer" expanded="1"> - <property name="minimum_size"></property> - <property name="name">bSizerMain</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">1</property> - <object class="wxBoxSizer" expanded="1"> - <property name="minimum_size"></property> - <property name="name">bSizerMargins</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <object class="sizeritem" expanded="1"> - <property name="border">8</property> - <property name="flag">wxTOP|wxRIGHT|wxLEFT</property> - <property name="proportion">0</property> - <object class="wxStaticText" 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="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">Default field properties for new footprints:</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">defaultFieldPropertiesLabel</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">; ; 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="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">4</property> - <property name="permission">protected</property> - <property name="width">0</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="wxBoxSizer" expanded="1"> - <property name="minimum_size"></property> - <property name="name">defaultFieldPropertiesSizer</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="wxGrid" 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="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_CENTER</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">wxGRID_AUTOSIZE</property> - <property name="col_label_values">"Value" "Show" "Layer"</property> - <property name="col_label_vert_alignment">wxALIGN_CENTER</property> - <property name="cols">3</property> - <property name="column_sizes">240,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_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">-1,-1</property> - <property name="moveable">1</property> - <property name="name">m_fieldPropsGrid</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="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">-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">wxTAB_TRAVERSAL</property> - <event name="OnSize">OnGridSize</event> - </object> - </object> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">25</property> - <property name="permission">protected</property> - <property name="width">5</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">8</property> - <property name="flag">wxTOP|wxLEFT|wxEXPAND</property> - <property name="proportion">0</property> - <object class="wxStaticText" 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="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">Default text items for new footprints:</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">defaultTextItemsLabel</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">; 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="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">4</property> - <property name="permission">protected</property> - <property name="width">0</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">20</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">1</property> - <object class="wxBoxSizer" expanded="1"> - <property name="minimum_size"></property> - <property name="name">defaultTextItemsSizer</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">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> - <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="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_CENTER</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">wxGRID_AUTOSIZE</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">400,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_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">-1,140</property> - <property name="moveable">1</property> - <property name="name">m_textItemsGrid</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="row_label_horiz_alignment">wxALIGN_LEFT</property> - <property name="row_label_size">0</property> - <property name="row_label_values"></property> - <property name="row_label_vert_alignment">wxALIGN_CENTER</property> - <property name="row_sizes"></property> - <property name="rows">0</property> - <property name="show">1</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">wxTAB_TRAVERSAL</property> - <event name="OnSize">OnGridSize</event> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</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|wxTOP</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="auth_needed">0</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">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; 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</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">0</property> - <property name="permission">protected</property> - <property name="width">20</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT|wxTOP</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="auth_needed">0</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">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; 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 class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">1</property> - <object class="spacer" expanded="1"> - <property name="height">0</property> - <property name="permission">protected</property> - <property name="width">0</property> - </object> - </object> - </object> - </object> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">20</property> - <property name="permission">protected</property> - <property name="width">0</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND|wxTOP</property> - <property name="proportion">0</property> - <object class="wxBoxSizer" expanded="1"> - <property name="minimum_size"></property> - <property name="name">defaultPropertiesSizer</property> - <property name="orient">wxVERTICAL</property> - <property name="permission">none</property> - <object class="sizeritem" expanded="1"> - <property name="border">8</property> - <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> - <property name="proportion">0</property> - <object class="wxStaticText" 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="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">Default properties for new graphic items:</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">defaultPropertiesLabel</property> - <property name="pane_border">1</property> - <property name="pane_position"></property> - <property name="pane_size"></property> - <property name="permission">none</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">; 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="1"> - <property name="border">5</property> - <property name="flag">wxEXPAND</property> - <property name="proportion">0</property> - <object class="spacer" expanded="1"> - <property name="height">4</property> - <property name="permission">protected</property> - <property name="width">0</property> - </object> - </object> - <object class="sizeritem" expanded="1"> - <property name="border">1</property> - <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</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> - <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="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_CENTER</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">wxGRID_AUTOSIZE</property> - <property name="col_label_values">"Line Thickness" "Text Width" "Text Height" "Text Thickness" "Italic"</property> - <property name="col_label_vert_alignment">wxALIGN_CENTER</property> - <property name="cols">5</property> - <property name="column_sizes">110,100,100,100,60</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_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">-1,-1</property> - <property name="moveable">1</property> - <property name="name">m_graphicsGrid</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="row_label_horiz_alignment">wxALIGN_LEFT</property> - <property name="row_label_size">125</property> - <property name="row_label_values">"Silk Layers" "Copper Layers" "Edge Cuts" "Courtyards" "Fab Layers" "Other Layers"</property> - <property name="row_label_vert_alignment">wxALIGN_CENTER</property> - <property name="row_sizes"></property> - <property name="rows">6</property> - <property name="show">1</property> - <property name="size"></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">wxTAB_TRAVERSAL</property> - </object> - </object> - </object> - </object> - </object> - </object> - </object> - </object> - </object> -</wxFormBuilder_Project> diff --git a/pcbnew/dialogs/panel_fp_editor_field_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_field_defaults.cpp new file mode 100644 index 0000000000..832a7d26de --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_field_defaults.cpp @@ -0,0 +1,354 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "panel_fp_editor_field_defaults.h" + +#include <pgm_base.h> +#include <settings/settings_manager.h> +#include <footprint_editor_settings.h> +#include <template_fieldnames.h> +#include <widgets/std_bitmap_button.h> +#include <grid_tricks.h> +#include <eda_text.h> +#include <grid_layer_box_helpers.h> +#include <bitmaps.h> +#include <confirm.h> + + +class TEXT_ITEMS_GRID_TABLE : public wxGridTableBase +{ + bool m_forFieldProps; + std::vector<TEXT_ITEM_INFO> m_items; + +public: + TEXT_ITEMS_GRID_TABLE( bool aForFieldProps ) : m_forFieldProps( aForFieldProps ) {} + + int GetNumberRows() override { return m_items.size(); } + int GetNumberCols() override { return 3; } + + wxString GetColLabelValue( int aCol ) override + { + switch( aCol ) + { + case 0: return m_forFieldProps ? _( "Value" ) : _( "Text Items" ); + case 1: return _( "Show" ); + case 2: return _( "Layer" ); + default: return wxEmptyString; + } + } + + wxString GetRowLabelValue( int aRow ) override + { + switch( aRow ) + { + case 0: return _( "Reference designator" ); + case 1: return _( "Value" ); + default: return wxEmptyString; + } + } + + bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override + { + 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 ) override + { + 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 = (int) value; + } + + bool AppendRows( size_t aNumRows = 1 ) override + { + for( size_t 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; + } +}; + + +static FOOTPRINT_EDITOR_SETTINGS& GetPgmSettings() +{ + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + return *mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ); +} + + +PANEL_FP_EDITOR_FIELD_DEFAULTS::PANEL_FP_EDITOR_FIELD_DEFAULTS( wxWindow* aParent, + UNITS_PROVIDER* aUnitsProvider ) : + PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE( aParent ), m_unitProvider( aUnitsProvider ), + m_designSettings( GetPgmSettings().m_DesignSettings ) +{ + m_fieldPropsGrid->SetDefaultRowSize( m_fieldPropsGrid->GetDefaultRowSize() + 4 ); + + m_fieldPropsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE( true ), true ); + m_fieldPropsGrid->PushEventHandler( new GRID_TRICKS( m_fieldPropsGrid ) ); + m_fieldPropsGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); + + wxGridCellAttr* attr = new wxGridCellAttr; + attr->SetRenderer( new wxGridCellBoolRenderer() ); + attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS + attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + m_fieldPropsGrid->SetColAttr( 1, attr ); + + attr = new wxGridCellAttr; + attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) ); + attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, {} ) ); + m_fieldPropsGrid->SetColAttr( 2, attr ); + + m_textItemsGrid->SetDefaultRowSize( m_textItemsGrid->GetDefaultRowSize() + 4 ); + + m_textItemsGrid->SetTable( new TEXT_ITEMS_GRID_TABLE( false ), true ); + m_textItemsGrid->PushEventHandler( new GRID_TRICKS( m_textItemsGrid ) ); + m_textItemsGrid->SetSelectionMode( wxGrid::wxGridSelectRows ); + + attr = new wxGridCellAttr; + attr->SetRenderer( new wxGridCellBoolRenderer() ); + attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS + attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + m_textItemsGrid->SetColAttr( 1, attr ); + + attr = new wxGridCellAttr; + attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( nullptr ) ); + attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( nullptr, {} ) ); + m_textItemsGrid->SetColAttr( 2, attr ); +} + + +PANEL_FP_EDITOR_FIELD_DEFAULTS::~PANEL_FP_EDITOR_FIELD_DEFAULTS() +{ + // destroy GRID_TRICKS before grids. + m_fieldPropsGrid->PopEventHandler( true ); + m_textItemsGrid->PopEventHandler( true ); +} + + +void PANEL_FP_EDITOR_FIELD_DEFAULTS::loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg ) +{ + // Footprint defaults + m_fieldPropsGrid->GetTable()->DeleteRows( 0, m_textItemsGrid->GetNumberRows() ); + m_fieldPropsGrid->GetTable()->AppendRows( 2 ); + + for( int i : { REFERENCE_FIELD, VALUE_FIELD } ) + { + TEXT_ITEM_INFO item = aCfg->m_DesignSettings.m_DefaultFPTextItems[i]; + + m_fieldPropsGrid->GetTable()->SetValue( i, 0, item.m_Text ); + m_fieldPropsGrid->GetTable()->SetValueAsBool( i, 1, item.m_Visible ); + m_fieldPropsGrid->GetTable()->SetValueAsLong( i, 2, item.m_Layer ); + } + + m_textItemsGrid->GetTable()->DeleteRows( 0, m_textItemsGrid->GetNumberRows() ); + m_textItemsGrid->GetTable()->AppendRows( aCfg->m_DesignSettings.m_DefaultFPTextItems.size() + - 2 ); + + for( int i = 2; i < (int) aCfg->m_DesignSettings.m_DefaultFPTextItems.size(); ++i ) + { + TEXT_ITEM_INFO item = aCfg->m_DesignSettings.m_DefaultFPTextItems[i]; + + m_textItemsGrid->GetTable()->SetValue( i - 2, 0, item.m_Text ); + m_textItemsGrid->GetTable()->SetValueAsBool( i - 2, 1, item.m_Visible ); + m_textItemsGrid->GetTable()->SetValueAsLong( i - 2, 2, item.m_Layer ); + } + + Layout(); +} + + +bool PANEL_FP_EDITOR_FIELD_DEFAULTS::TransferDataToWindow() +{ + const FOOTPRINT_EDITOR_SETTINGS& cfg = GetPgmSettings(); + + loadFPSettings( &cfg ); + + return true; +} + + +bool PANEL_FP_EDITOR_FIELD_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( KiBitmapBundle( BITMAPS::small_plus ) ); + m_bpDelete->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) ); + } + + return retVal; +} + + +bool PANEL_FP_EDITOR_FIELD_DEFAULTS::TransferDataFromWindow() +{ + if( !m_textItemsGrid->CommitPendingChanges() ) + return false; + + BOARD_DESIGN_SETTINGS& cfg = m_designSettings; + + // Footprint defaults + cfg.m_DefaultFPTextItems.clear(); + + wxGridTableBase* table = m_fieldPropsGrid->GetTable(); + + for( int i : { REFERENCE_FIELD, VALUE_FIELD } ) + { + wxString text = table->GetValue( i, 0 ); + bool visible = table->GetValueAsBool( i, 1 ); + int layer = (int) table->GetValueAsLong( i, 2 ); + + cfg.m_DefaultFPTextItems.emplace_back( text, visible, layer ); + } + + table = m_textItemsGrid->GetTable(); + + 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 ); + + cfg.m_DefaultFPTextItems.emplace_back( text, visible, layer ); + } + + return true; +} + + +void PANEL_FP_EDITOR_FIELD_DEFAULTS::OnAddTextItem( wxCommandEvent& event ) +{ + if( !m_textItemsGrid->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_FP_EDITOR_FIELD_DEFAULTS::OnDeleteTextItem( wxCommandEvent& event ) +{ + wxArrayInt selectedRows = m_textItemsGrid->GetSelectedRows(); + + if( selectedRows.empty() && m_textItemsGrid->GetGridCursorRow() >= 0 ) + selectedRows.push_back( m_textItemsGrid->GetGridCursorRow() ); + + if( selectedRows.empty() ) + return; + + if( !m_textItemsGrid->CommitPendingChanges() ) + return; + + // Reverse sort so deleting a row doesn't change the indexes of the other rows. + selectedRows.Sort( + []( int* first, int* second ) + { + return *second - *first; + } ); + + for( int row : selectedRows ) + { + m_textItemsGrid->GetTable()->DeleteRows( row, 1 ); + + if( m_textItemsGrid->GetNumberRows() > 0 ) + { + m_textItemsGrid->MakeCellVisible( std::max( 0, row - 1 ), + m_textItemsGrid->GetGridCursorCol() ); + m_textItemsGrid->SetGridCursor( std::max( 0, row - 1 ), + m_textItemsGrid->GetGridCursorCol() ); + } + } +} + + +void PANEL_FP_EDITOR_FIELD_DEFAULTS::ResetPanel() +{ + FOOTPRINT_EDITOR_SETTINGS cfg; + cfg.Load(); // Loading without a file will init to defaults + + loadFPSettings( &cfg ); +} diff --git a/pcbnew/dialogs/panel_fp_editor_field_defaults.h b/pcbnew/dialogs/panel_fp_editor_field_defaults.h new file mode 100644 index 0000000000..6c84c4b3e6 --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_field_defaults.h @@ -0,0 +1,54 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include <memory> + +#include <panel_fp_editor_field_defaults_base.h> + +class BOARD_DESIGN_SETTINGS; +class PAGED_DIALOG; +class FOOTPRINT_EDITOR_SETTINGS; +class UNITS_PROVIDER; + + +class PANEL_FP_EDITOR_FIELD_DEFAULTS : public PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE +{ +public: + PANEL_FP_EDITOR_FIELD_DEFAULTS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider ); + ~PANEL_FP_EDITOR_FIELD_DEFAULTS() override; + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + void ResetPanel() override; + +private: + virtual void OnAddTextItem( wxCommandEvent& event ) override; + virtual void OnDeleteTextItem( wxCommandEvent& event ) override; + + bool Show( bool aShow ) override; + + void loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg ); + +private: + UNITS_PROVIDER* m_unitProvider; + BOARD_DESIGN_SETTINGS& m_designSettings; +}; diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.cpp similarity index 63% rename from pcbnew/dialogs/panel_fp_editor_defaults_base.cpp rename to pcbnew/dialogs/panel_fp_editor_field_defaults_base.cpp index 8393e74e21..bf7095927f 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.cpp +++ b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -8,11 +8,11 @@ #include "widgets/std_bitmap_button.h" #include "widgets/wx_grid.h" -#include "panel_fp_editor_defaults_base.h" +#include "panel_fp_editor_field_defaults_base.h" /////////////////////////////////////////////////////////////////////////// -PANEL_FP_EDITOR_DEFAULTS_BASE::PANEL_FP_EDITOR_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) +PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) { wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); @@ -140,86 +140,26 @@ PANEL_FP_EDITOR_DEFAULTS_BASE::PANEL_FP_EDITOR_DEFAULTS_BASE( wxWindow* parent, bSizerMargins->Add( defaultTextItemsSizer, 1, wxEXPAND, 20 ); - bSizerMargins->Add( 0, 20, 0, wxEXPAND, 5 ); - - wxBoxSizer* defaultPropertiesSizer; - defaultPropertiesSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticText* defaultPropertiesLabel; - defaultPropertiesLabel = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 ); - defaultPropertiesLabel->Wrap( -1 ); - defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxEXPAND|wxRIGHT|wxLEFT, 8 ); - - - defaultPropertiesSizer->Add( 0, 4, 0, wxEXPAND, 5 ); - - m_graphicsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - - // Grid - m_graphicsGrid->CreateGrid( 6, 5 ); - m_graphicsGrid->EnableEditing( true ); - m_graphicsGrid->EnableGridLines( true ); - m_graphicsGrid->EnableDragGridSize( false ); - m_graphicsGrid->SetMargins( 0, 0 ); - - // Columns - m_graphicsGrid->SetColSize( 0, 110 ); - m_graphicsGrid->SetColSize( 1, 100 ); - m_graphicsGrid->SetColSize( 2, 100 ); - m_graphicsGrid->SetColSize( 3, 100 ); - m_graphicsGrid->SetColSize( 4, 60 ); - m_graphicsGrid->EnableDragColMove( false ); - m_graphicsGrid->EnableDragColSize( true ); - m_graphicsGrid->SetColLabelValue( 0, _("Line Thickness") ); - m_graphicsGrid->SetColLabelValue( 1, _("Text Width") ); - m_graphicsGrid->SetColLabelValue( 2, _("Text Height") ); - m_graphicsGrid->SetColLabelValue( 3, _("Text Thickness") ); - m_graphicsGrid->SetColLabelValue( 4, _("Italic") ); - m_graphicsGrid->SetColLabelSize( wxGRID_AUTOSIZE ); - m_graphicsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - - // Rows - m_graphicsGrid->EnableDragRowSize( false ); - m_graphicsGrid->SetRowLabelValue( 0, _("Silk Layers") ); - m_graphicsGrid->SetRowLabelValue( 1, _("Copper Layers") ); - m_graphicsGrid->SetRowLabelValue( 2, _("Edge Cuts") ); - m_graphicsGrid->SetRowLabelValue( 3, _("Courtyards") ); - m_graphicsGrid->SetRowLabelValue( 4, _("Fab Layers") ); - m_graphicsGrid->SetRowLabelValue( 5, _("Other Layers") ); - m_graphicsGrid->SetRowLabelSize( 125 ); - m_graphicsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); - - // Label Appearance - - // Cell Defaults - m_graphicsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); - defaultPropertiesSizer->Add( m_graphicsGrid, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 1 ); - - - bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP, 5 ); - - bSizerMain->Add( bSizerMargins, 1, wxEXPAND, 5 ); - this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); // Connect Events - m_fieldPropsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnGridSize ), NULL, this ); - m_textItemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnGridSize ), NULL, this ); - m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnAddTextItem ), NULL, this ); - m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this ); + m_fieldPropsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this ); + m_textItemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this ); + m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddTextItem ), NULL, this ); + m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this ); } -PANEL_FP_EDITOR_DEFAULTS_BASE::~PANEL_FP_EDITOR_DEFAULTS_BASE() +PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::~PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE() { // Disconnect Events - m_fieldPropsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnGridSize ), NULL, this ); - m_textItemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnGridSize ), NULL, this ); - m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnAddTextItem ), NULL, this ); - m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this ); + m_fieldPropsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this ); + m_textItemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnGridSize ), NULL, this ); + m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnAddTextItem ), NULL, this ); + m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE::OnDeleteTextItem ), NULL, this ); } diff --git a/pcbnew/dialogs/panel_fp_editor_field_defaults_base.fbp b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.fbp new file mode 100644 index 0000000000..bf0d6a47e3 --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.fbp @@ -0,0 +1,614 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<wxFormBuilder_Project> + <FileVersion major="1" minor="18"/> + <object class="Project" expanded="true"> + <property name="code_generation">C++</property> + <property name="cpp_class_decoration"></property> + <property name="cpp_disconnect_events">1</property> + <property name="cpp_event_generation">connect</property> + <property name="cpp_help_provider">none</property> + <property name="cpp_namespace"></property> + <property name="cpp_precompiled_header"></property> + <property name="cpp_use_array_enum">0</property> + <property name="cpp_use_enum">0</property> + <property name="embedded_files_path">res</property> + <property name="encoding">UTF-8</property> + <property name="file">panel_fp_editor_field_defaults_base</property> + <property name="first_id">1000</property> + <property name="internationalize">1</property> + <property name="lua_skip_events">1</property> + <property name="lua_ui_table">UI</property> + <property name="name">panel_fp_editor_field_defaults_base</property> + <property name="path">.</property> + <property name="php_disconnect_events">0</property> + <property name="php_disconnect_mode">source_name</property> + <property name="php_skip_events">1</property> + <property name="python_disconnect_events">0</property> + <property name="python_disconnect_mode">source_name</property> + <property name="python_image_path_wrapper_function_name"></property> + <property name="python_indent_with_spaces"></property> + <property name="python_skip_events">1</property> + <property name="relative_path">1</property> + <property name="use_microsoft_bom">0</property> + <property name="use_native_eol">0</property> + <object class="Panel" expanded="true"> + <property name="aui_managed">0</property> + <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> + <property name="bg"></property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="drag_accept_files">0</property> + <property name="enabled">1</property> + <property name="event_handler">impl_virtual</property> + <property name="fg"></property> + <property name="font"></property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="maximum_size"></property> + <property name="minimum_size"></property> + <property name="name">PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE</property> + <property name="pos"></property> + <property name="size">-1,-1</property> + <property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property> + <property name="tooltip"></property> + <property name="two_step_creation">0</property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style">wxTAB_TRAVERSAL</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">bSizerMain</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">bSizerMargins</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">8</property> + <property name="flag">wxTOP|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxStaticText" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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="drag_accept_files">0</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">Default field properties for new footprints:</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">defaultFieldPropertiesLabel</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">; ; 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="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="true"> + <property name="height">4</property> + <property name="permission">protected</property> + <property name="width">0</property> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">defaultFieldPropertiesSizer</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxGrid" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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_CENTER</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">wxGRID_AUTOSIZE</property> + <property name="col_label_values">"Value" "Show" "Layer"</property> + <property name="col_label_vert_alignment">wxALIGN_CENTER</property> + <property name="cols">3</property> + <property name="column_sizes">240,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_accept_files">0</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_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">-1,-1</property> + <property name="moveable">1</property> + <property name="name">m_fieldPropsGrid</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="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">-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">wxTAB_TRAVERSAL</property> + <event name="OnSize">OnGridSize</event> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="true"> + <property name="height">25</property> + <property name="permission">protected</property> + <property name="width">5</property> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">8</property> + <property name="flag">wxTOP|wxLEFT|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxStaticText" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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="drag_accept_files">0</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">Default text items for new footprints:</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">defaultTextItemsLabel</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">; 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="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="true"> + <property name="height">4</property> + <property name="permission">protected</property> + <property name="width">0</property> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">20</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">defaultTextItemsSizer</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxGrid" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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_CENTER</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">wxGRID_AUTOSIZE</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">400,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_accept_files">0</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_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">-1,140</property> + <property name="moveable">1</property> + <property name="name">m_textItemsGrid</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="row_label_horiz_alignment">wxALIGN_LEFT</property> + <property name="row_label_size">0</property> + <property name="row_label_values"></property> + <property name="row_label_vert_alignment">wxALIGN_CENTER</property> + <property name="row_sizes"></property> + <property name="rows">0</property> + <property name="show">1</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">wxTAB_TRAVERSAL</property> + <event name="OnSize">OnGridSize</event> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">bButtonSize</property> + <property name="orient">wxHORIZONTAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxBOTTOM|wxLEFT|wxTOP</property> + <property name="proportion">0</property> + <object class="wxBitmapButton" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> + <property name="auth_needed">0</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="drag_accept_files">0</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">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; 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="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="true"> + <property name="height">0</property> + <property name="permission">protected</property> + <property name="width">20</property> + </object> + </object> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT|wxTOP</property> + <property name="proportion">0</property> + <object class="wxBitmapButton" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</property> + <property name="auth_needed">0</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="drag_accept_files">0</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">STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; 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 class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="spacer" expanded="true"> + <property name="height">0</property> + <property name="permission">protected</property> + <property name="width">0</property> + </object> + </object> + </object> + </object> + </object> + </object> + </object> + </object> + </object> + </object> + </object> +</wxFormBuilder_Project> diff --git a/pcbnew/dialogs/panel_fp_editor_defaults_base.h b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.h similarity index 76% rename from pcbnew/dialogs/panel_fp_editor_defaults_base.h rename to pcbnew/dialogs/panel_fp_editor_field_defaults_base.h index 2f82d5329a..4b3e4773b3 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults_base.h +++ b/pcbnew/dialogs/panel_fp_editor_field_defaults_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -31,11 +31,10 @@ class WX_GRID; /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// -/// Class PANEL_FP_EDITOR_DEFAULTS_BASE +/// Class PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_FP_EDITOR_DEFAULTS_BASE : public RESETTABLE_PANEL +class PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE : public RESETTABLE_PANEL { private: @@ -46,7 +45,6 @@ class PANEL_FP_EDITOR_DEFAULTS_BASE : public RESETTABLE_PANEL WX_GRID* m_textItemsGrid; STD_BITMAP_BUTTON* m_bpAdd; STD_BITMAP_BUTTON* m_bpDelete; - WX_GRID* m_graphicsGrid; // Virtual event handlers, override them in your derived class virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); } @@ -56,9 +54,9 @@ class PANEL_FP_EDITOR_DEFAULTS_BASE : public RESETTABLE_PANEL public: - PANEL_FP_EDITOR_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); - ~PANEL_FP_EDITOR_DEFAULTS_BASE(); + ~PANEL_FP_EDITOR_FIELD_DEFAULTS_BASE(); }; diff --git a/pcbnew/dialogs/panel_fp_editor_graphics_defaults.cpp b/pcbnew/dialogs/panel_fp_editor_graphics_defaults.cpp new file mode 100644 index 0000000000..e52178faaf --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_graphics_defaults.cpp @@ -0,0 +1,299 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "panel_fp_editor_graphics_defaults.h" + +#include <pgm_base.h> +#include <settings/settings_manager.h> +#include <footprint_editor_settings.h> +#include <grid_tricks.h> +#include <eda_text.h> +#include <panel_setup_dimensions.h> +#include <grid_layer_box_helpers.h> +#include <bitmaps.h> +#include <confirm.h> +#include <kidialog.h> + + +// Columns of graphics grid +enum +{ + COL_LINE_THICKNESS = 0, + COL_TEXT_WIDTH, + COL_TEXT_HEIGHT, + COL_TEXT_THICKNESS, + COL_TEXT_ITALIC +}; + +enum +{ + ROW_SILK = 0, + ROW_COPPER, + ROW_EDGES, + ROW_COURTYARD, + ROW_FAB, + ROW_OTHERS, + + ROW_COUNT +}; + + +static FOOTPRINT_EDITOR_SETTINGS& GetPgmSettings() +{ + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + return *mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ); +} + + +PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::PANEL_FP_EDITOR_GRAPHICS_DEFAULTS( + wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider ) : + PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE( aParent ), m_unitProvider( aUnitsProvider ), + m_designSettings( GetPgmSettings().m_DesignSettings ), + m_dimensionsPanel( std::make_unique<PANEL_SETUP_DIMENSIONS>( this, *m_unitProvider, + m_designSettings ) ) +{ + m_graphicsGrid->SetUnitsProvider( aUnitsProvider ); + m_graphicsGrid->SetAutoEvalCols( + { COL_LINE_THICKNESS, COL_TEXT_WIDTH, COL_TEXT_HEIGHT, COL_TEXT_THICKNESS } ); + + m_graphicsGrid->SetDefaultRowSize( m_graphicsGrid->GetDefaultRowSize() + 4 ); + + // Work around a bug in wxWidgets where it fails to recalculate the grid height + // after changing the default row size + m_graphicsGrid->AppendRows( 1 ); + m_graphicsGrid->DeleteRows( m_graphicsGrid->GetNumberRows() - 1, 1 ); + + m_graphicsGrid->PushEventHandler( new GRID_TRICKS( m_graphicsGrid ) ); + + GetSizer()->Add( m_dimensionsPanel.get(), 0, wxEXPAND | wxALL, 5 ); +} + + +PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::~PANEL_FP_EDITOR_GRAPHICS_DEFAULTS() +{ + // destroy GRID_TRICKS before grids. + m_graphicsGrid->PopEventHandler( true ); +} + + +void PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg ) +{ + wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ); + + auto disableCell = [&]( int row, int col ) + { + m_graphicsGrid->SetReadOnly( row, col ); + m_graphicsGrid->SetCellBackgroundColour( row, col, disabledColour ); + }; + + for( int i = 0; i < ROW_COUNT; ++i ) + { + m_graphicsGrid->SetUnitValue( i, COL_LINE_THICKNESS, + aCfg->m_DesignSettings.m_LineThickness[i] ); + + if( i == ROW_EDGES || i == ROW_COURTYARD ) + { + disableCell( i, COL_TEXT_WIDTH ); + disableCell( i, COL_TEXT_HEIGHT ); + disableCell( i, COL_TEXT_THICKNESS ); + disableCell( i, COL_TEXT_ITALIC ); + } + else + { + m_graphicsGrid->SetUnitValue( i, COL_TEXT_WIDTH, + aCfg->m_DesignSettings.m_TextSize[i].x ); + m_graphicsGrid->SetUnitValue( i, COL_TEXT_HEIGHT, + aCfg->m_DesignSettings.m_TextSize[i].y ); + m_graphicsGrid->SetUnitValue( i, COL_TEXT_THICKNESS, + aCfg->m_DesignSettings.m_TextThickness[i] ); + m_graphicsGrid->SetCellValue( i, COL_TEXT_ITALIC, + aCfg->m_DesignSettings.m_TextItalic[i] ? wxT( "1" ) + : wxT( "" ) ); + + auto attr = new wxGridCellAttr; + attr->SetRenderer( new wxGridCellBoolRenderer() ); + attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS + attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + m_graphicsGrid->SetAttr( i, COL_TEXT_ITALIC, attr ); + } + } + + for( int col = 0; col < m_graphicsGrid->GetNumberCols(); col++ ) + { + // Set the minimal width to the column label size. + m_graphicsGrid->SetColMinimalWidth( col, + m_graphicsGrid->GetVisibleWidth( col, true, false ) ); + + // Set the width to see the full contents + if( m_graphicsGrid->IsColShown( col ) ) + m_graphicsGrid->SetColSize( col, + m_graphicsGrid->GetVisibleWidth( col, true, true, true ) ); + } + + m_graphicsGrid->SetRowLabelSize( m_graphicsGrid->GetVisibleWidth( -1, true, true, true ) ); + + m_dimensionsPanel->LoadFromSettings( aCfg->m_DesignSettings ); + + Layout(); +} + + +bool PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::TransferDataToWindow() +{ + const FOOTPRINT_EDITOR_SETTINGS& cfg = GetPgmSettings(); + + loadFPSettings( &cfg ); + + return true; +} + + +bool PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::Show( bool aShow ) +{ + bool retVal = wxPanel::Show( aShow ); + + if( aShow && m_firstShow ) + { + m_graphicsGrid->SetColSize( 0, m_graphicsGrid->GetColSize( 0 ) + 1 ); + m_firstShow = false; + } + + return retVal; +} + + +bool PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::TransferDataFromWindow() +{ + if( !m_graphicsGrid->CommitPendingChanges() ) + return false; + + BOARD_DESIGN_SETTINGS& cfg = m_designSettings; + + // A minimal value for sizes and thickness: + const int minWidth = pcbIUScale.mmToIU( MINIMUM_LINE_WIDTH_MM ); + const int maxWidth = pcbIUScale.mmToIU( MAXIMUM_LINE_WIDTH_MM ); + const int minSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM ); + const int maxSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM ); + wxString errorsMsg; + + for( int i = 0; i < ROW_COUNT; ++i ) + { + bool badParam = false; + + int lineWidth = m_graphicsGrid->GetUnitValue( i, COL_LINE_THICKNESS ); + + if( lineWidth < minWidth || lineWidth > maxWidth ) + { + if( !errorsMsg.IsEmpty() ) + errorsMsg += wxT( "\n\n" ); + + errorsMsg += wxString::Format( _( "%s: Incorrect line width.\n" + "It must be between %s and %s" ), + m_graphicsGrid->GetRowLabelValue( i ), + m_unitProvider->StringFromValue( minWidth, true ), + m_unitProvider->StringFromValue( maxWidth, true ) ); + badParam = true; + } + + if( !badParam ) + cfg.m_LineThickness[i] = lineWidth; + + if( i == ROW_EDGES || i == ROW_COURTYARD ) + continue; + + badParam = false; + int textWidth = m_graphicsGrid->GetUnitValue( i, COL_TEXT_WIDTH ); + int textHeight = m_graphicsGrid->GetUnitValue( i, COL_TEXT_HEIGHT ); + int textThickness = m_graphicsGrid->GetUnitValue( i, COL_TEXT_THICKNESS ); + + if( textWidth < minSize || textHeight < minSize || textWidth > maxSize + || textHeight > maxSize ) + { + if( !errorsMsg.IsEmpty() ) + errorsMsg += wxT( "\n\n" ); + + errorsMsg += wxString::Format( _( "%s: Text size is incorrect.\n" + "Size must be between %s and %s" ), + m_graphicsGrid->GetRowLabelValue( i ), + m_unitProvider->StringFromValue( minSize, true ), + m_unitProvider->StringFromValue( maxSize, true ) ); + badParam = true; + } + + // Text thickness cannot be > text size /4 to be readable + int textMinDim = std::min( textWidth, textHeight ); + int textMaxThickness = std::min( maxWidth, textMinDim / 4 ); + + if( !badParam && ( textThickness < minWidth || textThickness > textMaxThickness ) ) + { + if( !errorsMsg.IsEmpty() ) + errorsMsg += wxT( "\n\n" ); + + if( textThickness > textMaxThickness ) + errorsMsg += wxString::Format( + _( "%s: Text thickness is too large.\n" + "It will be truncated to %s" ), + m_graphicsGrid->GetRowLabelValue( i ), + m_unitProvider->StringFromValue( textMaxThickness, true ) ); + + else if( textThickness < minWidth ) + errorsMsg += wxString::Format( _( "%s: Text thickness is too small.\n" + "It will be truncated to %s" ), + m_graphicsGrid->GetRowLabelValue( i ), + m_unitProvider->StringFromValue( minWidth, true ) ); + + textThickness = std::min( textThickness, textMaxThickness ); + textThickness = std::max( textThickness, minWidth ); + m_graphicsGrid->SetUnitValue( i, COL_TEXT_THICKNESS, textThickness ); + } + + if( !badParam ) + { + cfg.m_TextSize[i] = VECTOR2I( textWidth, textHeight ); + cfg.m_TextThickness[i] = textThickness; + } + + wxString msg = m_graphicsGrid->GetCellValue( i, COL_TEXT_ITALIC ); + cfg.m_TextItalic[i] = wxGridCellBoolEditor::IsTrueValue( msg ); + } + + m_dimensionsPanel->TransferDataFromWindow(); + + if( errorsMsg.IsEmpty() ) + return true; + + KIDIALOG dlg( wxGetTopLevelParent( this ), errorsMsg, KIDIALOG::KD_ERROR, + _( "Parameter error" ) ); + dlg.ShowModal(); + + return false; +} + + +void PANEL_FP_EDITOR_GRAPHICS_DEFAULTS::ResetPanel() +{ + FOOTPRINT_EDITOR_SETTINGS cfg; + cfg.Load(); // Loading without a file will init to defaults + + loadFPSettings( &cfg ); +} diff --git a/pcbnew/dialogs/panel_fp_editor_defaults.h b/pcbnew/dialogs/panel_fp_editor_graphics_defaults.h similarity index 76% rename from pcbnew/dialogs/panel_fp_editor_defaults.h rename to pcbnew/dialogs/panel_fp_editor_graphics_defaults.h index 25da49a589..4cc572e6cc 100644 --- a/pcbnew/dialogs/panel_fp_editor_defaults.h +++ b/pcbnew/dialogs/panel_fp_editor_graphics_defaults.h @@ -21,7 +21,7 @@ #include <memory> -#include <panel_fp_editor_defaults_base.h> +#include <panel_fp_editor_graphics_defaults_base.h> class BOARD_DESIGN_SETTINGS; class PAGED_DIALOG; @@ -30,11 +30,11 @@ class PANEL_SETUP_DIMENSIONS; class UNITS_PROVIDER; -class PANEL_FP_EDITOR_DEFAULTS : public PANEL_FP_EDITOR_DEFAULTS_BASE +class PANEL_FP_EDITOR_GRAPHICS_DEFAULTS : public PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE { public: - PANEL_FP_EDITOR_DEFAULTS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider ); - ~PANEL_FP_EDITOR_DEFAULTS() override; + PANEL_FP_EDITOR_GRAPHICS_DEFAULTS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider ); + ~PANEL_FP_EDITOR_GRAPHICS_DEFAULTS() override; bool TransferDataToWindow() override; bool TransferDataFromWindow() override; @@ -42,12 +42,9 @@ public: void ResetPanel() override; private: - virtual void OnAddTextItem( wxCommandEvent& event ) override; - virtual void OnDeleteTextItem( wxCommandEvent& event ) override; - bool Show( bool aShow ) override; - void loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg ); + void loadFPSettings( const FOOTPRINT_EDITOR_SETTINGS* aCfg ); private: bool m_firstShow = true; diff --git a/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.cpp b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.cpp new file mode 100644 index 0000000000..9cd7a437eb --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.cpp @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "widgets/wx_grid.h" + +#include "panel_fp_editor_graphics_defaults_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE::PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerMargins; + bSizerMargins = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* defaultPropertiesSizer; + defaultPropertiesSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticText* defaultPropertiesLabel; + defaultPropertiesLabel = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 ); + defaultPropertiesLabel->Wrap( -1 ); + defaultPropertiesSizer->Add( defaultPropertiesLabel, 0, wxEXPAND|wxRIGHT|wxLEFT, 8 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + defaultPropertiesSizer->Add( m_staticline1, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + + + defaultPropertiesSizer->Add( 0, 4, 0, wxEXPAND, 5 ); + + m_graphicsGrid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + + // Grid + m_graphicsGrid->CreateGrid( 6, 5 ); + m_graphicsGrid->EnableEditing( true ); + m_graphicsGrid->EnableGridLines( true ); + m_graphicsGrid->EnableDragGridSize( false ); + m_graphicsGrid->SetMargins( 0, 0 ); + + // Columns + m_graphicsGrid->SetColSize( 0, 110 ); + m_graphicsGrid->SetColSize( 1, 100 ); + m_graphicsGrid->SetColSize( 2, 100 ); + m_graphicsGrid->SetColSize( 3, 100 ); + m_graphicsGrid->SetColSize( 4, 60 ); + m_graphicsGrid->EnableDragColMove( false ); + m_graphicsGrid->EnableDragColSize( true ); + m_graphicsGrid->SetColLabelValue( 0, _("Line Thickness") ); + m_graphicsGrid->SetColLabelValue( 1, _("Text Width") ); + m_graphicsGrid->SetColLabelValue( 2, _("Text Height") ); + m_graphicsGrid->SetColLabelValue( 3, _("Text Thickness") ); + m_graphicsGrid->SetColLabelValue( 4, _("Italic") ); + m_graphicsGrid->SetColLabelSize( wxGRID_AUTOSIZE ); + m_graphicsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + + // Rows + m_graphicsGrid->EnableDragRowSize( false ); + m_graphicsGrid->SetRowLabelValue( 0, _("Silk Layers") ); + m_graphicsGrid->SetRowLabelValue( 1, _("Copper Layers") ); + m_graphicsGrid->SetRowLabelValue( 2, _("Edge Cuts") ); + m_graphicsGrid->SetRowLabelValue( 3, _("Courtyards") ); + m_graphicsGrid->SetRowLabelValue( 4, _("Fab Layers") ); + m_graphicsGrid->SetRowLabelValue( 5, _("Other Layers") ); + m_graphicsGrid->SetRowLabelSize( 125 ); + m_graphicsGrid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); + + // Label Appearance + + // Cell Defaults + m_graphicsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); + defaultPropertiesSizer->Add( m_graphicsGrid, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 1 ); + + + bSizerMargins->Add( defaultPropertiesSizer, 0, wxEXPAND|wxTOP, 5 ); + + + bSizerMargins->Add( 0, 20, 0, wxEXPAND, 5 ); + + + bSizerMain->Add( bSizerMargins, 1, wxEXPAND, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + bSizerMain->Fit( this ); +} + +PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE::~PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE() +{ +} diff --git a/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.fbp b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.fbp new file mode 100644 index 0000000000..1ccb701156 --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.fbp @@ -0,0 +1,318 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<wxFormBuilder_Project> + <FileVersion major="1" minor="18"/> + <object class="Project" expanded="true"> + <property name="code_generation">C++</property> + <property name="cpp_class_decoration"></property> + <property name="cpp_disconnect_events">1</property> + <property name="cpp_event_generation">connect</property> + <property name="cpp_help_provider">none</property> + <property name="cpp_namespace"></property> + <property name="cpp_precompiled_header"></property> + <property name="cpp_use_array_enum">0</property> + <property name="cpp_use_enum">0</property> + <property name="embedded_files_path">res</property> + <property name="encoding">UTF-8</property> + <property name="file">panel_fp_editor_graphics_defaults_base</property> + <property name="first_id">1000</property> + <property name="internationalize">1</property> + <property name="lua_skip_events">1</property> + <property name="lua_ui_table">UI</property> + <property name="name">panel_fp_editor_graphics_defaults_base</property> + <property name="path">.</property> + <property name="php_disconnect_events">0</property> + <property name="php_disconnect_mode">source_name</property> + <property name="php_skip_events">1</property> + <property name="python_disconnect_events">0</property> + <property name="python_disconnect_mode">source_name</property> + <property name="python_image_path_wrapper_function_name"></property> + <property name="python_indent_with_spaces"></property> + <property name="python_skip_events">1</property> + <property name="relative_path">1</property> + <property name="use_microsoft_bom">0</property> + <property name="use_native_eol">0</property> + <object class="Panel" expanded="true"> + <property name="aui_managed">0</property> + <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property> + <property name="bg"></property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="drag_accept_files">0</property> + <property name="enabled">1</property> + <property name="event_handler">impl_virtual</property> + <property name="fg"></property> + <property name="font"></property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="maximum_size"></property> + <property name="minimum_size"></property> + <property name="name">PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE</property> + <property name="pos"></property> + <property name="size">-1,-1</property> + <property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property> + <property name="tooltip"></property> + <property name="two_step_creation">0</property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style">wxTAB_TRAVERSAL</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">bSizerMain</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">1</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">bSizerMargins</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="true"> + <property name="border">5</property> + <property name="flag">wxEXPAND|wxTOP</property> + <property name="proportion">0</property> + <object class="wxBoxSizer" expanded="true"> + <property name="minimum_size"></property> + <property name="name">defaultPropertiesSizer</property> + <property name="orient">wxVERTICAL</property> + <property name="permission">none</property> + <object class="sizeritem" expanded="false"> + <property name="border">8</property> + <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> + <property name="proportion">0</property> + <object class="wxStaticText" expanded="false"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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="drag_accept_files">0</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">Default properties for new graphic items:</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">defaultPropertiesLabel</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">none</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">; 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="true"> + <property name="border">5</property> + <property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property> + <property name="proportion">0</property> + <object class="wxStaticLine" expanded="true"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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="drag_accept_files">0</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_staticline1</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">wxLI_HORIZONTAL</property> + <property name="subclass">; ; 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> + </object> + </object> + <object class="sizeritem" expanded="false"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="false"> + <property name="height">4</property> + <property name="permission">protected</property> + <property name="width">0</property> + </object> + </object> + <object class="sizeritem" expanded="false"> + <property name="border">1</property> + <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property> + <property name="proportion">1</property> + <object class="wxGrid" expanded="false"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer">0</property> + <property name="aui_name"></property> + <property name="aui_position">0</property> + <property name="aui_row">0</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_CENTER</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">wxGRID_AUTOSIZE</property> + <property name="col_label_values">"Line Thickness" "Text Width" "Text Height" "Text Thickness" "Italic"</property> + <property name="col_label_vert_alignment">wxALIGN_CENTER</property> + <property name="cols">5</property> + <property name="column_sizes">110,100,100,100,60</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_accept_files">0</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_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">-1,-1</property> + <property name="moveable">1</property> + <property name="name">m_graphicsGrid</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="row_label_horiz_alignment">wxALIGN_LEFT</property> + <property name="row_label_size">125</property> + <property name="row_label_values">"Silk Layers" "Copper Layers" "Edge Cuts" "Courtyards" "Fab Layers" "Other Layers"</property> + <property name="row_label_vert_alignment">wxALIGN_CENTER</property> + <property name="row_sizes"></property> + <property name="rows">6</property> + <property name="show">1</property> + <property name="size"></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">wxTAB_TRAVERSAL</property> + </object> + </object> + </object> + </object> + <object class="sizeritem" expanded="false"> + <property name="border">5</property> + <property name="flag">wxEXPAND</property> + <property name="proportion">0</property> + <object class="spacer" expanded="false"> + <property name="height">20</property> + <property name="permission">protected</property> + <property name="width">0</property> + </object> + </object> + </object> + </object> + </object> + </object> + </object> +</wxFormBuilder_Project> diff --git a/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.h b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.h new file mode 100644 index 0000000000..186de36ef4 --- /dev/null +++ b/pcbnew/dialogs/panel_fp_editor_graphics_defaults_base.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include <wx/artprov.h> +#include <wx/xrc/xmlres.h> +#include <wx/intl.h> +class WX_GRID; + +#include "widgets/resettable_panel.h" +#include <wx/string.h> +#include <wx/stattext.h> +#include <wx/gdicmn.h> +#include <wx/font.h> +#include <wx/colour.h> +#include <wx/settings.h> +#include <wx/statline.h> +#include <wx/grid.h> +#include <wx/sizer.h> +#include <wx/panel.h> + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE : public RESETTABLE_PANEL +{ + private: + + protected: + wxStaticLine* m_staticline1; + WX_GRID* m_graphicsGrid; + + public: + + PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PANEL_FP_EDITOR_GRAPHICS_DEFAULTS_BASE(); + +}; + diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 5bc04116bd..b8d47a4c4a 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -51,7 +51,8 @@ #include <dialog_global_fp_lib_table_config.h> #include <panel_pcb_display_options.h> #include <panel_edit_options.h> -#include <panel_fp_editor_defaults.h> +#include <panel_fp_editor_field_defaults.h> +#include <panel_fp_editor_graphics_defaults.h> #include <panel_fp_editor_color_settings.h> #include <panel_pcbnew_color_settings.h> #include <panel_pcbnew_action_plugins.h> @@ -196,7 +197,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_EDIT_OPTIONS( aParent, this, frame, true ); } - case PANEL_FP_DEFAULT_VALUES: + case PANEL_FP_DEFAULT_FIELDS: { EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false ); @@ -209,7 +210,23 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER if( frame ) SetUserUnits( frame->GetUserUnits() ); - return new PANEL_FP_EDITOR_DEFAULTS( aParent, this ); + return new PANEL_FP_EDITOR_FIELD_DEFAULTS( aParent, this ); + } + + case PANEL_FP_DEFAULT_GRAPHICS_VALUES: + { + EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false ); + + if( !frame ) + frame = aKiway->Player( FRAME_PCB_EDITOR, false ); + + if( frame ) + SetUserUnits( frame->GetUserUnits() ); + + return new PANEL_FP_EDITOR_GRAPHICS_DEFAULTS( aParent, this ); } case PANEL_FP_COLORS: