diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 349b20b689..7f9fcfd547 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -252,7 +252,6 @@ set( BMAPS_MID export_step export fabrication - field_properties file_footprint fill_zone find diff --git a/bitmaps_png/cpp_26/field_properties.cpp b/bitmaps_png/cpp_26/field_properties.cpp deleted file mode 100644 index ff02f2fc17..0000000000 --- a/bitmaps_png/cpp_26/field_properties.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -/* Do not modify this file, it was automatically generated by the - * PNG2cpp CMake script, using a *.png file as input. - */ - -#include - -static const unsigned char png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, - 0xce, 0x00, 0x00, 0x02, 0x84, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xe5, 0x95, 0x6f, 0x48, 0x13, - 0x71, 0x18, 0xc7, 0x9f, 0xdd, 0xee, 0x7a, 0x17, 0x92, 0xf5, 0xc2, 0x66, 0x85, 0x09, 0xab, 0x17, - 0x7b, 0xdd, 0xbb, 0x88, 0x11, 0xd1, 0x3b, 0x91, 0xea, 0x45, 0x45, 0x7b, 0x51, 0x2f, 0x32, 0x32, - 0x2a, 0x22, 0x28, 0xe8, 0x45, 0x39, 0x08, 0x63, 0xb6, 0x17, 0x15, 0x21, 0xfd, 0xb3, 0xed, 0xce, - 0x92, 0xca, 0xb6, 0x82, 0x28, 0x92, 0x74, 0xad, 0xc2, 0x49, 0xac, 0x69, 0xa1, 0x96, 0x0a, 0x4b, - 0x36, 0xf4, 0x45, 0x61, 0x53, 0xd7, 0x2a, 0x6e, 0xb6, 0x7b, 0x7a, 0x7e, 0xe7, 0x6e, 0x6c, 0xab, - 0xec, 0xb6, 0xb9, 0x57, 0x1d, 0x7c, 0xb9, 0x83, 0x7b, 0xf8, 0x7e, 0xee, 0xf9, 0xf7, 0x3b, 0x80, - 0xff, 0xe6, 0xea, 0x00, 0x58, 0x81, 0x00, 0x86, 0xb2, 0x83, 0x44, 0x8e, 0x9b, 0x96, 0x04, 0xc1, - 0x77, 0x13, 0x60, 0x75, 0x79, 0x41, 0x46, 0x4e, 0xee, 0xa8, 0xac, 0x48, 0x89, 0x3c, 0xff, 0xcd, - 0x05, 0xb0, 0xb7, 0xac, 0xa0, 0x31, 0x97, 0x03, 0x07, 0xec, 0x47, 0x91, 0x60, 0xa9, 0x76, 0x41, - 0xe8, 0x16, 0x01, 0xaa, 0xcb, 0x03, 0x72, 0xb7, 0xe0, 0xd7, 0xc9, 0x5e, 0x9c, 0xf4, 0xdd, 0xc2, - 0x07, 0x16, 0x73, 0x52, 0xe2, 0xf9, 0x84, 0x1b, 0xa0, 0xa1, 0x24, 0xe3, 0x76, 0x80, 0x95, 0xd4, - 0x8f, 0x5a, 0x4d, 0x04, 0x4a, 0x6a, 0x20, 0xa6, 0x78, 0xe4, 0x25, 0x86, 0x4e, 0x1d, 0x54, 0xdc, - 0x46, 0x23, 0x2b, 0xe7, 0x53, 0x16, 0x5f, 0x30, 0xe4, 0x2a, 0x40, 0x05, 0x7d, 0x69, 0x92, 0x84, - 0xd9, 0xea, 0x3f, 0x73, 0x38, 0x03, 0xd2, 0x34, 0xd1, 0x23, 0xa1, 0x77, 0x7d, 0xad, 0x2c, 0x0a, - 0xfc, 0x34, 0xc5, 0xec, 0x58, 0xb4, 0x8c, 0x86, 0x2f, 0x9d, 0xc6, 0xc0, 0x21, 0x9b, 0xaa, 0xd7, - 0xc7, 0xf6, 0xe1, 0x6c, 0xe4, 0x85, 0x2a, 0x96, 0x1d, 0xc5, 0xb0, 0xec, 0xbc, 0xd4, 0xbb, 0xe5, - 0x25, 0xf7, 0x88, 0x0d, 0x04, 0x99, 0xaa, 0x62, 0x83, 0x11, 0x8f, 0xbe, 0xca, 0x64, 0x17, 0x7d, - 0x7c, 0x1d, 0x3b, 0x6b, 0x56, 0x25, 0x25, 0x81, 0x8f, 0x11, 0xac, 0xbe, 0xe4, 0x61, 0x58, 0x48, - 0x33, 0x1f, 0x9f, 0x63, 0xa0, 0x71, 0x8f, 0x22, 0x72, 0x06, 0x45, 0x32, 0x1a, 0xef, 0xdf, 0x06, - 0x58, 0x56, 0x16, 0x90, 0xa6, 0x71, 0x6f, 0x2b, 0xde, 0xab, 0xae, 0x92, 0x29, 0xbb, 0x29, 0x09, - 0xe0, 0x32, 0x65, 0x78, 0x92, 0x89, 0xfa, 0x68, 0x59, 0x54, 0x50, 0xec, 0x43, 0x17, 0x3e, 0xab, - 0xdb, 0xfc, 0x53, 0x34, 0x18, 0x14, 0x32, 0x1f, 0x27, 0xbd, 0x21, 0x05, 0x09, 0xb6, 0x4d, 0x37, - 0x28, 0x7c, 0xe7, 0x02, 0xf6, 0x36, 0xec, 0xca, 0x31, 0xfe, 0x3e, 0x35, 0x84, 0x72, 0x3c, 0xaa, - 0x2a, 0x36, 0xd8, 0x87, 0x43, 0xe7, 0x5b, 0x52, 0x83, 0x0e, 0x47, 0xfc, 0x4b, 0x28, 0xe4, 0x42, - 0xc4, 0xa6, 0x2c, 0x59, 0x75, 0x81, 0xde, 0xb7, 0xda, 0xb1, 0x6b, 0xeb, 0x46, 0xf4, 0x98, 0x6b, - 0x30, 0x78, 0x62, 0xbf, 0xba, 0x4f, 0x0c, 0xc4, 0x00, 0x26, 0x93, 0xe9, 0x9f, 0x62, 0x30, 0x5d, - 0xa0, 0xd1, 0xb6, 0x73, 0xd8, 0x53, 0xbf, 0x05, 0x1f, 0x5a, 0xcc, 0xd8, 0xdf, 0x74, 0x24, 0x33, - 0x75, 0x33, 0x23, 0x41, 0xd5, 0xe8, 0x53, 0x20, 0x20, 0x7f, 0x0e, 0x06, 0x45, 0x32, 0xf4, 0xa7, - 0x8d, 0xfd, 0xe9, 0x4c, 0xfc, 0xbf, 0x81, 0xda, 0x00, 0x96, 0x52, 0x3d, 0x07, 0x48, 0x61, 0x4d, - 0x54, 0x5b, 0xe5, 0x6d, 0xf3, 0xf1, 0xf9, 0xd2, 0xdd, 0xbd, 0x88, 0x81, 0x03, 0xbb, 0xe7, 0x01, - 0x61, 0x1f, 0xf6, 0x35, 0xda, 0x52, 0xef, 0xec, 0x76, 0xc5, 0xe9, 0x74, 0xe2, 0x5c, 0x22, 0xd1, - 0xcc, 0x3c, 0x98, 0x61, 0xb6, 0x31, 0xbb, 0xb3, 0xf7, 0x39, 0x20, 0x7a, 0xe2, 0xc8, 0xd8, 0xc6, - 0xce, 0x31, 0x4d, 0x34, 0xae, 0x73, 0x23, 0x57, 0xce, 0xe6, 0xf4, 0x25, 0xf2, 0xe8, 0x1a, 0x76, - 0xae, 0x31, 0xa9, 0x93, 0x45, 0x27, 0x7a, 0x5d, 0x76, 0x05, 0xf2, 0x41, 0x45, 0x8d, 0x77, 0x7a, - 0x57, 0x50, 0xdd, 0x15, 0x9e, 0xf7, 0xdc, 0x00, 0xa8, 0xcc, 0x8f, 0x2f, 0x19, 0x34, 0xd1, 0x2d, - 0xa2, 0x77, 0xdd, 0x5a, 0x39, 0xbd, 0xfd, 0x7f, 0x1d, 0xd5, 0x92, 0x40, 0x4f, 0x36, 0x6d, 0x40, - 0x37, 0xc7, 0xa5, 0xa4, 0x25, 0xbc, 0x87, 0xfd, 0xda, 0x17, 0x8a, 0x2f, 0x1e, 0xc4, 0x71, 0x3f, - 0xa8, 0x4c, 0xb3, 0x94, 0xc5, 0x4e, 0x3d, 0xf1, 0x45, 0x83, 0xa8, 0xd9, 0xdb, 0x49, 0x55, 0x3a, - 0x00, 0xd6, 0xbc, 0x71, 0xf6, 0xeb, 0x5a, 0xd4, 0x42, 0x2f, 0x2d, 0x93, 0x82, 0x17, 0xb5, 0x08, - 0x90, 0x35, 0xef, 0xc8, 0xf9, 0xe3, 0xd1, 0xf3, 0x0b, 0x8e, 0x72, 0xb8, 0xd9, 0x73, 0x64, 0xb3, - 0xfc, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -}; - -const BITMAP_OPAQUE field_properties_xpm[1] = {{ png, sizeof( png ), "field_properties_xpm" }}; - -//EOF diff --git a/bitmaps_png/sources/field_properties.svg b/bitmaps_png/sources/field_properties.svg deleted file mode 100644 index 82efd475d4..0000000000 --- a/bitmaps_png/sources/field_properties.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/widgets/wx_grid.cpp b/common/widgets/wx_grid.cpp index d4a198199d..dc63d91660 100644 --- a/common/widgets/wx_grid.cpp +++ b/common/widgets/wx_grid.cpp @@ -119,3 +119,52 @@ void WX_GRID::DrawColLabel( wxDC& dc, int col ) rend.DrawLabel( *this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient ); } + + +bool WX_GRID::CommitPendingChanges( bool aQuietMode ) +{ + if( !IsCellEditControlEnabled() ) + return true; + + if( !aQuietMode && SendEvent( wxEVT_GRID_EDITOR_HIDDEN ) == -1 ) + return false; + + HideCellEditControl(); + + // do it after HideCellEditControl() + m_cellEditCtrlEnabled = false; + + int row = m_currentCellCoords.GetRow(); + int col = m_currentCellCoords.GetCol(); + + wxString oldval = GetCellValue( row, col ); + wxString newval; + + wxGridCellAttr* attr = GetCellAttr( row, col ); + wxGridCellEditor* editor = attr->GetEditor( this, row, col ); + + bool changed = editor->EndEdit( row, col, this, oldval, &newval ); + + editor->DecRef(); + attr->DecRef(); + + if( changed ) + { + if( !aQuietMode && SendEvent(wxEVT_GRID_CELL_CHANGING, newval) == -1 ) + return false; + + editor->ApplyEdit(row, col, this); + + // for compatibility reasons dating back to wx 2.8 when this event + // was called wxEVT_GRID_CELL_CHANGE and wxEVT_GRID_CELL_CHANGING + // didn't exist we allow vetoing this one too + if( !aQuietMode && SendEvent( wxEVT_GRID_CELL_CHANGED, oldval ) == -1 ) + { + // Event has been vetoed, set the data back. + SetCellValue( row, col, oldval ); + return false; + } + } + + return true; +} \ No newline at end of file diff --git a/common/widgets/wx_grid.h b/common/widgets/wx_grid.h index 7aecb46f9a..11703e77a1 100644 --- a/common/widgets/wx_grid.h +++ b/common/widgets/wx_grid.h @@ -60,6 +60,13 @@ public: */ void DestroyTable( wxGridTableBase* aTable ); + /** + * Close any open cell edit controls. + * @param aQuietMode if true don't send events (ie: for row/col delete operations) + * @return false if validation failed + */ + bool CommitPendingChanges( bool aQuietMode = false ); + protected: void DrawColLabel( wxDC& dc, int col ) override; }; diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 69eb0be642..84e4923f04 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -37,8 +37,6 @@ set( EESCHEMA_DLGS dialogs/dialog_edit_components_libid_base.cpp dialogs/dialog_edit_label.cpp dialogs/dialog_edit_label_base.cpp - dialogs/dialog_edit_libentry_fields_in_lib.cpp - dialogs/dialog_edit_libentry_fields_in_lib_base.cpp dialogs/dialog_edit_line_style.cpp dialogs/dialog_edit_line_style_base.cpp dialogs/dialog_edit_one_field.cpp diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index cdd1c8fbc1..2531e4d47e 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -1280,39 +1280,6 @@ bool LIB_PART::HasAlias( const wxString& aName ) const } -void LIB_PART::SetAliases( const wxArrayString& aAliasList ) -{ - wxCHECK_RET( !m_library, - wxT( "Symbol aliases cannot be changed when they are owned by a library." ) ); - wxCHECK_RET( !aAliasList.IsEmpty(), wxT( "Alias list cannot be empty" ) ); - - if( aAliasList == GetAliasNames() ) - return; - - // Add names not existing in the current component alias list. - for( size_t i = 0; i < aAliasList.GetCount(); i++ ) - { - if( HasAlias( aAliasList[ i ] ) ) - continue; - - m_aliases.push_back( new LIB_ALIAS( aAliasList[ i ], this ) ); - } - - // Remove names in the current component that are not in the new alias list. - LIB_ALIASES::iterator it = m_aliases.begin(); - - while( it != m_aliases.end() ) - { - int index = aAliasList.Index( (*it)->GetName(), false ); - - if( index != wxNOT_FOUND || (*it)->IsRoot() ) - ++it; - else - it = m_aliases.erase( it ); - } -} - - void LIB_PART::RemoveAlias( const wxString& aName ) { LIB_ALIAS* a = GetAlias( aName ); @@ -1394,14 +1361,16 @@ LIB_ALIAS* LIB_PART::GetAlias( size_t aIndex ) void LIB_PART::AddAlias( const wxString& aName ) { - wxCHECK_RET( !HasAlias( aName ), - wxT( "Symbol <" ) + GetName() + wxT( "> already has an alias <" ) + - aName + wxT( ">. Bad programmer." ) ); - m_aliases.push_back( new LIB_ALIAS( aName, this ) ); } +void LIB_PART::AddAlias( LIB_ALIAS* aAlias ) +{ + m_aliases.push_back( aAlias ); +} + + void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId ) { m_subpartFirstId = 'A'; diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 42c0bfb7a0..851e16dcf6 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -281,6 +281,8 @@ public: wxArrayString GetAliasNames( bool aIncludeRoot = true ) const; + LIB_ALIASES GetAliases() const { return m_aliases; } + size_t GetAliasCount() const { return m_aliases.size(); } LIB_ALIAS* GetAlias( size_t aIndex ); @@ -299,6 +301,8 @@ public: */ void AddAlias( const wxString& aName ); + void AddAlias( LIB_ALIAS* aAlias ); + /** * Test if alias \a aName is in part alias list. * @@ -309,8 +313,6 @@ public: */ bool HasAlias( const wxString& aName ) const; - void SetAliases( const wxArrayString& aAliasList ); - void RemoveAlias( const wxString& aName ); LIB_ALIAS* RemoveAlias( LIB_ALIAS* aAlias ); diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index 28260222af..1e6ed5c860 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -223,7 +223,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : m_buttonAddPlugin->SetBitmap( KiBitmap( plus_xpm ) ); m_buttonDelPlugin->SetBitmap( KiBitmap( delete_xpm ) ); - m_buttonEdit->SetBitmap( KiBitmap( edit_xpm ) ); + m_buttonEdit->SetBitmap( KiBitmap( small_edit_xpm ) ); installPluginsList(); diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index bc154d0993..59ba37fa51 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2018 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 @@ -29,29 +29,89 @@ #include #include #include -#include #include +#include #include #include +#include +#include #include #include -#include // for MAX_UNIT_COUNT_PER_PACKAGE definition #include +#include +#include +#include #include + +#define LibEditFieldsShownColumnsKey wxT( "LibEditFieldsShownColumns" ) + int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_lastOpenedPage = 0; -DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent ): - DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent ) + +DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent, + LIB_PART* aLibEntry ) : + DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent ), + m_Parent( aParent ), + m_libEntry( aLibEntry ), + m_currentAlias( wxNOT_FOUND ), + m_pinNameOffset( aParent, m_nameOffsetLabel, m_nameOffsetCtrl, m_nameOffsetUnits, true ), + m_delayedFocusCtrl( nullptr ), + m_delayedFocusGrid( nullptr ) { - m_Parent = aParent; - m_RecreateToolbar = false; + m_config = Kiface().KifaceSettings(); - initDlg(); + // Give a bit more room for combobox editors + m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 ); + m_aliasGrid->SetDefaultRowSize( m_aliasGrid->GetDefaultRowSize() + 4 ); + m_aliasGrid->SetMinClientSize( wxSize( -1, 24 + m_aliasGrid->GetDefaultRowSize() * 2 ) ); + + m_fields = new FIELDS_GRID_TABLE( this, aParent, m_libEntry ); + m_grid->SetTable( m_fields ); + + m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) ); + m_aliasGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) ); + + // Show/hide columns according to the user's preference + m_config->Read( LibEditFieldsShownColumnsKey, &m_shownColumns, wxT( "0 1 2 3 4 5 6 7" ) ); + m_grid->ShowHideColumns( m_shownColumns ); + // Hide non-overridden rows in aliases grid + m_aliasGrid->HideRow( REFERENCE ); + m_aliasGrid->HideRow( FOOTPRINT ); + + wxGridCellAttr* attr = new wxGridCellAttr; + attr->SetReadOnly(); + m_aliasGrid->SetColAttr( FDC_NAME, attr ); + m_aliasGrid->SetCellValue( VALUE, FDC_NAME, TEMPLATE_FIELDNAME::GetDefaultFieldName( VALUE ) ); + m_aliasGrid->SetCellValue( DATASHEET, FDC_NAME, TEMPLATE_FIELDNAME::GetDefaultFieldName( DATASHEET ) ); + + attr = new wxGridCellAttr; + attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) ); + m_aliasGrid->SetAttr( DATASHEET, FDC_VALUE, attr ); + + // Configure button logos + m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) ); + m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) ); + m_bpMoveUp->SetBitmap( KiBitmap( small_up_xpm ) ); + m_bpMoveDown->SetBitmap( KiBitmap( small_down_xpm ) ); + m_addAliasButton->SetBitmap( KiBitmap( small_plus_xpm ) ); + m_deleteAliasButton->SetBitmap( KiBitmap( trash_xpm ) ); + m_addFilterButton->SetBitmap( KiBitmap( small_plus_xpm ) ); + m_deleteFilterButton->SetBitmap( KiBitmap( trash_xpm ) ); + m_editFilterButton->SetBitmap( KiBitmap( small_edit_xpm ) ); + + m_stdSizerButtonOK->SetDefault(); + + // wxFormBuilder doesn't include this event... + m_grid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging ), NULL, this ); + m_aliasGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging ), NULL, this ); + + m_grid->GetParent()->Layout(); + m_aliasGrid->GetParent()->Layout(); + Layout(); - // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); } @@ -59,544 +119,684 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRA DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY() { m_lastOpenedPage = m_NoteBook->GetSelection( ); -} -/* Initialize state of check boxes and texts -*/ -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() -{ - m_AliasLocation = -1; + m_config->Write( LibEditFieldsShownColumnsKey, m_grid->GetShownColumns() ); - LIB_PART* component = m_Parent->GetCurPart(); + // Prevents crash bug in wxGrid's d'tor + m_grid->DestroyTable( m_fields ); - if( component == NULL ) - { - SetTitle( _( "Library Component Properties" ) ); - return; - } + m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging ), NULL, this ); + m_aliasGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging ), NULL, this ); - wxString title, staticText; - bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0; + // Delete the GRID_TRICKS. + m_grid->PopEventHandler( true ); + m_aliasGrid->PopEventHandler( true ); - if( !isRoot ) - { - title.Printf( _( "Properties for %s (alias of %s)" ), - GetChars( m_Parent->GetAliasName() ), - GetChars( component->GetName() ) ); - - staticText.Printf( _( "Alias List of %s" ), GetChars( component->GetName() ) ); - m_staticTextAlias->SetLabelText( staticText ); - } - else - title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) ); - - SetTitle( title ); - InitPanelDoc(); - InitBasicPanel(); - - // The component's alias list contains all names (including the root). The UI list - // contains only aliases, so exclude the root. - m_PartAliasListCtrl->Append( component->GetAliasNames( false ) ); - - // Note: disabling the delete buttons gives us no opportunity to tell the user - // why they're disabled. Leave them enabled and bring up an error message instead. - - /* Read the Footprint Filter list */ - m_FootprintFilterListBox->Append( component->GetFootprints() ); - - if( component->GetFootprints().GetCount() == 0 ) - { - m_ButtonDeleteAllFootprintFilter->Enable( false ); - m_ButtonDeleteOneFootprintFilter->Enable( false ); - m_buttonEditOneFootprintFilter->Enable( false ); - } - - m_NoteBook->SetSelection( m_lastOpenedPage ); - - m_stdSizerButtonOK->SetDefault(); + // An OK will have transferred these and cleared the buffer, but we have to delete them + // on a Cancel. + for( LIB_ALIAS* alias : m_aliasesBuffer ) + delete alias; } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event ) +bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow() { - EndModal( wxID_CANCEL ); + if( !wxDialog::TransferDataToWindow() ) + return false; + + // Push a copy of each field into m_fields + m_libEntry->GetFields( *m_fields ); + + // The Y axis for components in lib is from bottom to top while the screen axis is top + // to bottom: we must change the y coord sign for editing + for( size_t i = 0; i < m_fields->size(); ++i ) + { + wxPoint pos = m_fields->at( i ).GetPosition(); + pos.y = -pos.y; + m_fields->at( i ).SetPosition( pos ); + } + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() ); + m_grid->ProcessTableMessage( msg ); + adjustGridColumns( m_grid->GetRect().GetWidth()); + + m_SymbolNameCtrl->SetValue( m_libEntry->GetName() ); + + LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() ); + m_DescCtrl->SetValue( rootAlias->GetDescription() ); + m_KeywordCtrl->SetValue( rootAlias->GetKeyWords() ); + + m_SelNumberOfUnits->SetValue( m_libEntry->GetUnitCount() ); + m_OptionPartsLocked->SetValue( m_libEntry->UnitsLocked() && m_libEntry->GetUnitCount() > 1 ); + m_AsConvertButt->SetValue( m_libEntry->HasConversion() ); + m_OptionPower->SetValue( m_libEntry->IsPower() ); + + m_ShowPinNumButt->SetValue( m_libEntry->ShowPinNumbers() ); + m_ShowPinNameButt->SetValue( m_libEntry->ShowPinNames() ); + m_PinsNameInsideButt->SetValue( m_libEntry->GetPinNameOffset() != 0 ); + m_pinNameOffset.SetValue( Mils2iu( m_libEntry->GetPinNameOffset() ) ); + + const LIB_ALIASES aliases = m_libEntry->GetAliases(); + + for( LIB_ALIAS* alias : aliases ) + { + if( alias->IsRoot() ) + continue; + + m_aliasesBuffer.push_back( new LIB_ALIAS( *alias, m_libEntry ) ); + m_aliasListBox->Append( alias->GetName() ); + } + + if( m_aliasListBox->GetCount() ) + { + m_aliasListBox->SetSelection( 0 ); + + wxCommandEvent dummy; + OnSelectAlias( dummy ); + } + + adjustAliasGridColumns( m_aliasGrid->GetClientRect().GetWidth() - 4 ); + + m_FootprintFilterListBox->Append( m_libEntry->GetFootprints() ); + + m_NoteBook->SetSelection( (unsigned) m_lastOpenedPage ); + + return true; } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc() +bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate() { - LIB_ALIAS* alias; - LIB_PART* component = m_Parent->GetCurPart(); + if( !m_grid->CommitPendingChanges() || !m_aliasGrid->CommitPendingChanges() ) + return false; - if( component == NULL ) - return; - - wxString aliasname = m_Parent->GetAliasName(); - - if( aliasname.IsEmpty() ) - return; - - alias = component->GetAlias( aliasname ); - - if( alias != NULL ) + if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) ) { - m_DocCtrl->SetValue( alias->GetDescription() ); - m_KeywordsCtrl->SetValue( alias->GetKeyWords() ); - m_DocfileCtrl->SetValue( alias->GetDocFileName() ); - } -} + if( m_NoteBook->GetSelection() != 0 ) + m_NoteBook->SetSelection( 0 ); + m_delayedErrorMessage = _( "References must start with a letter." ); + m_delayedFocusGrid = m_grid; + m_delayedFocusColumn = FDC_VALUE; + m_delayedFocusRow = REFERENCE; -/* - * create the basic panel for component properties editing - */ -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel() -{ - LIB_PART* component = m_Parent->GetCurPart(); - - if( m_Parent->GetShowDeMorgan() ) - m_AsConvertButt->SetValue( true ); - - int maxUnits = MAX_UNIT_COUNT_PER_PACKAGE; - m_SelNumberOfUnits->SetRange (1, maxUnits ); - - m_staticTextNbUnits->SetLabel( wxString::Format( - _( "Number of Units (max allowed %d)" ), maxUnits ) ); - - - /* Default values for a new component. */ - if( component == NULL ) - { - m_ShowPinNumButt->SetValue( true ); - m_ShowPinNameButt->SetValue( true ); - m_PinsNameInsideButt->SetValue( true ); - m_SelNumberOfUnits->SetValue( 1 ); - m_SetSkew->SetValue( 40 ); - m_OptionPower->SetValue( false ); - m_OptionPartsLocked->SetValue( false ); - return; + return false; } - m_ShowPinNumButt->SetValue( component->ShowPinNumbers() ); - m_ShowPinNameButt->SetValue( component->ShowPinNames() ); - m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 ); - m_SelNumberOfUnits->SetValue( component->GetUnitCount() ); - m_SetSkew->SetValue( component->GetPinNameOffset() ); - m_OptionPower->SetValue( component->IsPower() ); - m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetUnitCount() > 1 ); -} - - -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) -{ - /* Update the doc, keyword and doc filename strings */ - LIB_ALIAS* alias; - LIB_PART* component = m_Parent->GetCurPart(); - - if( component == NULL ) + // Check for missing field names. + for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i ) { - EndModal( wxID_CANCEL ); - return; - } + LIB_FIELD& field = m_fields->at( i ); + wxString fieldName = field.GetName( false ); - m_Parent->SaveCopyInUndoList( component ); - - alias = component->GetAlias( m_Parent->GetAliasName() ); - - wxCHECK_RET( alias != NULL, - wxT( "Alias \"" ) + m_Parent->GetAliasName() + wxT( "\" of symbol \"" ) + - component->GetName() + wxT( "\" does not exist." ) ); - - alias->SetDescription( m_DocCtrl->GetValue() ); - alias->SetKeyWords( m_KeywordsCtrl->GetValue() ); - alias->SetDocFileName( m_DocfileCtrl->GetValue() ); - - // The UI list contains only aliases (ie: not the root's name), while the component's - // alias list contains all names (including the root). - wxArrayString aliases = m_PartAliasListCtrl->GetStrings(); - aliases.Add( component->GetName() ); - component->SetAliases( aliases ); - - int unitCount = m_SelNumberOfUnits->GetValue(); - ChangeNbUnitsPerPackage( unitCount ); - - if( m_AsConvertButt->GetValue() ) - { - if( !m_Parent->GetShowDeMorgan() ) + if( fieldName.IsEmpty() ) { - m_Parent->SetShowDeMorgan( true ); - SetUnsetConvert(); - } - } - else - { - if( m_Parent->GetShowDeMorgan() ) - { - m_Parent->SetShowDeMorgan( false ); - SetUnsetConvert(); + if( m_NoteBook->GetSelection() != 0 ) + m_NoteBook->SetSelection( 0 ); + + m_delayedErrorMessage = _( "Fields must have a name." ); + m_delayedFocusGrid = m_grid; + m_delayedFocusColumn = FDC_NAME; + m_delayedFocusRow = i; + + return false; } } - component->SetShowPinNumbers( m_ShowPinNumButt->GetValue() ); - component->SetShowPinNames( m_ShowPinNameButt->GetValue() ); - - if( m_PinsNameInsideButt->GetValue() == false ) - component->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin) - else + if( m_SelNumberOfUnits->GetValue() < m_libEntry->GetUnitCount() ) { - component->SetPinNameOffset( m_SetSkew->GetValue() ); - // Ensure component->m_TextInside != 0, because the meaning is "text outside". - if( component->GetPinNameOffset() == 0 ) - component->SetPinNameOffset( 20 ); // give a reasonnable value + if( !IsOK( this, _( "Delete extra units from symbol?" ) ) ) + return false; } - if( m_OptionPower->GetValue() == true ) - component->SetPower(); - else - component->SetNormal(); - - /* Set the option "Units locked". - * Obviously, cannot be true if there is only one part */ - component->LockUnits( m_OptionPartsLocked->GetValue() ); - - if( component->GetUnitCount() <= 1 ) - component->LockUnits( false ); - - /* Update the footprint filter list */ - component->GetFootprints().Clear(); - component->GetFootprints() = m_FootprintFilterListBox->GetStrings(); - - EndModal( wxID_OK ); -} - - -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias( wxCommandEvent& event ) -{ - if( m_Parent == NULL ) - return; - - LIB_ALIAS* parent_alias; - LIB_PART* component = m_Parent->GetCurPart(); - - if( component == NULL ) - return; - - // search for the main alias: this is the first alias in alias list - // something like the main component - parent_alias = component->GetAlias( 0 ); - - if( parent_alias == NULL ) // Should never occur (bug) - return; - - m_DocCtrl->SetValue( parent_alias->GetDescription() ); - m_DocfileCtrl->SetValue( parent_alias->GetDocFileName() ); - m_KeywordsCtrl->SetValue( parent_alias->GetKeyWords() ); -} - - -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& event ) -{ - if( m_PartAliasListCtrl->GetCount() == 0 ) - return; - - if( m_PartAliasListCtrl->FindString( m_Parent->GetAliasName() ) != wxNOT_FOUND ) + if( m_AsConvertButt->GetValue() && !m_libEntry->HasConversion() ) { - DisplayErrorMessage( this, _( "Delete All can be done only when editing the main symbol." ) ); - return; + if( !IsOK( this, _( "Add new pins for alternate body style (DeMorgan) to symbol?" ) ) ) + return false; } - - if( IsOK( this, _( "Remove all aliases from list?" ) ) ) - m_PartAliasListCtrl->Clear(); -} - - -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditAliasOfPart( wxCommandEvent& aEvent ) -{ - int sel = m_PartAliasListCtrl->GetSelection(); - - if( sel == wxNOT_FOUND ) - return; - - wxString aliasname = m_PartAliasListCtrl->GetString( sel ); - - if( aliasname.CmpNoCase( m_Parent->GetAliasName() ) == 0 ) + else if( !m_AsConvertButt->GetValue() && m_libEntry->HasConversion() ) { - wxString msg; - msg.Printf( _( "Current alias \"%s\" cannot be edited." ), GetChars( aliasname ) ); - DisplayError( this, msg ); - return; - } - - WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Alias:" ), _( "Symbol alias:" ), aliasname ); - - if( dlg.ShowModal() != wxID_OK ) - return; // cancelled by user - - aliasname = LIB_ID::FixIllegalChars( dlg.GetValue(), LIB_ID::ID_SCH ); - - if( checkNewAlias( aliasname ) ) - m_PartAliasListCtrl->SetString( sel, aliasname ); -} - - -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event ) -{ - wxString aliasname; - - WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Alias:" ), _( "Symbol alias:" ), aliasname ); - - if( dlg.ShowModal() != wxID_OK ) - return; // cancelled by user - - aliasname = LIB_ID::FixIllegalChars( dlg.GetValue(), LIB_ID::ID_SCH ); - - if( checkNewAlias( aliasname ) ) - m_PartAliasListCtrl->Append( aliasname ); -} - - -bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias( wxString aliasname ) -{ - if( aliasname.IsEmpty() ) - return false; - - if( m_PartAliasListCtrl->FindString( aliasname ) != wxNOT_FOUND ) - { - wxString msg; - msg.Printf( _( "Alias \"%s\" already exists." ), GetChars( aliasname ) ); - DisplayInfoMessage( this, msg ); - return false; - } - - wxString library = m_Parent->GetCurLib(); - - if( !library.empty() && Prj().SchSymbolLibTable()->LoadSymbol( library, aliasname ) != NULL ) - { - wxString msg; - msg.Printf( _( "Symbol name \"%s\" already exists in library \"%s\"." ), aliasname, library ); - DisplayErrorMessage( this, msg ); - return false; + if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from symbol?" ) ) ) + return false; } return true; } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& event ) +bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow() { - int sel = m_PartAliasListCtrl->GetSelection(); - - if( sel == wxNOT_FOUND ) - return; - - wxString aliasname = m_PartAliasListCtrl->GetString( sel ); - - if( aliasname.CmpNoCase( m_Parent->GetAliasName() ) == 0 ) - { - wxString msg; - msg.Printf( _( "Current alias \"%s\" cannot be removed." ), GetChars( aliasname ) ); - DisplayError( this, msg ); - return; - } - - m_PartAliasListCtrl->Delete( sel ); -} - - -/* - * Change the number of parts per package. - */ -bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit ) -{ - LIB_PART* part = m_Parent->GetCurPart(); - - if( !part || part->GetUnitCount() == MaxUnit || MaxUnit < 1 ) + if( !Validate() ) return false; - if( MaxUnit < part->GetUnitCount() - && !IsOK( this, _( "Delete extra parts from component?" ) ) ) - return false; + m_Parent->SaveCopyInUndoList( m_libEntry ); - part->SetUnitCount( MaxUnit ); - return true; -} - - -/* - * Set or clear the component alternate body style ( DeMorgan ). - */ -bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert() -{ - LIB_PART* component = m_Parent->GetCurPart(); - - if( component == NULL || ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) ) - return false; - - if( m_Parent->GetShowDeMorgan() ) + // The Y axis for components in lib is from bottom to top while the screen axis is top + // to bottom: we must change the y coord sign when writing back to the library + for( size_t i = 0; i < m_fields->size(); ++i ) { - if( !IsOK( this, _( "Add new pins for alternate body style ( DeMorgan ) to component?" ) ) ) - return false; - } - else if( component->HasConversion() ) - { - if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from component?" ) ) ) - { - m_Parent->SetShowDeMorgan( true ); - return false; - } + wxPoint pos = m_fields->at( i ).GetPosition(); + pos.y = -pos.y; + m_fields->at( i ).SetPosition( pos ); } - component->SetConversion( m_Parent->GetShowDeMorgan() ); + m_libEntry->SetFields( *m_fields ); + + // We need to keep the name and the value the same at the moment! + SetName( m_libEntry->GetValueField().GetText() ); + + LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() ); + + rootAlias->SetDescription( m_DescCtrl->GetValue() ); + rootAlias->SetKeyWords( m_KeywordCtrl->GetValue() ); + + m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() ); + m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 && m_OptionPartsLocked->GetValue() ); + + m_libEntry->SetConversion( m_AsConvertButt->GetValue() ); + + if( m_OptionPower->GetValue() ) + m_libEntry->SetPower(); + else + m_libEntry->SetNormal(); + + m_libEntry->SetShowPinNumbers( m_ShowPinNumButt->GetValue() ); + m_libEntry->SetShowPinNames( m_ShowPinNameButt->GetValue() ); + + if( m_PinsNameInsideButt->GetValue() ) + { + int offset = KiROUND( (double) m_pinNameOffset.GetValue() / IU_PER_MILS ); + + // We interpret an offset of 0 as "outside", so make sure it's non-zero + m_libEntry->SetPinNameOffset( offset == 0 ? 20 : offset ); + } + else + { + m_libEntry->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin) + } + + transferAliasDataToBuffer(); + m_libEntry->RemoveAllAliases(); + + for( LIB_ALIAS* alias : m_aliasesBuffer ) + m_libEntry->AddAlias( alias ); // Transfers ownership; no need to delete + + m_aliasesBuffer.clear(); + + m_libEntry->GetFootprints().Clear(); + m_libEntry->GetFootprints() = m_FootprintFilterListBox->GetStrings(); + m_Parent->OnModify(); return true; } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging( wxGridEvent& event ) { - PROJECT& prj = Prj(); - SEARCH_STACK* search = prj.SchSearchS(); + wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() ); + wxControl* control = editor->GetControl(); - wxString mask = wxT( "*" ); - wxString docpath = prj.GetRString( PROJECT::DOC_PATH ); + if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) ) + { + event.Veto(); - if( !docpath ) - docpath = search->LastVisitedPath( wxT( "doc" ) ); + if( m_NoteBook->GetSelection() != 0 ) + m_NoteBook->SetSelection( 0 ); - wxString fullFileName = EDA_FILE_SELECTOR( _( "Doc Files" ), - docpath, - wxEmptyString, - wxEmptyString, - mask, - this, - wxFD_OPEN, - true ); - if( fullFileName.IsEmpty() ) - return; + m_delayedFocusGrid = m_grid; + m_delayedFocusRow = event.GetRow(); + m_delayedFocusColumn = event.GetCol(); + } - /* If the path is already in the library search paths - * list, just add the library name to the list. Otherwise, add - * the library name with the full or relative path. - * the relative path, when possible is preferable, - * because it preserve use of default libraries paths, when the path is a sub path of - * these default paths - */ - wxFileName fn = fullFileName; - - prj.SetRString( PROJECT::DOC_PATH, fn.GetPath() ); - - wxString filename = search->FilenameWithRelativePathInSearchList( - fullFileName, wxPathOnly( Prj().GetProjectFullName() ) ); - - // Filenames are always stored in unix like mode, ie separator "\" is stored as "/" - // to ensure files are identical under unices and windows -#ifdef __WINDOWS__ - filename.Replace( wxT( "\\" ), wxT( "/" ) ); -#endif - m_DocfileCtrl->SetValue( filename ); + editor->DecRef(); } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event ) { - if( IsOK( this, _( "OK to delete the footprint filter list ?" ) ) ) + if( !m_grid->CommitPendingChanges() ) + return; + + int fieldID = m_fields->size(); + LIB_FIELD newField( m_libEntry, fieldID ); + + m_fields->push_back( newField ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 ); + m_grid->ProcessTableMessage( msg ); + + m_grid->MakeCellVisible( m_fields->size() - 1, 0 ); + m_grid->SetGridCursor( m_fields->size() - 1, 0 ); + + m_grid->EnableCellEditControl(); + m_grid->ShowCellEditControl(); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteField( wxCommandEvent& event ) +{ + int curRow = m_grid->GetGridCursorRow(); + + if( curRow < 0 ) + return; + else if( curRow < MANDATORY_FIELDS ) { - m_FootprintFilterListBox->Clear(); - m_ButtonDeleteAllFootprintFilter->Enable( false ); - m_ButtonDeleteOneFootprintFilter->Enable( false ); - m_buttonEditOneFootprintFilter->Enable( false ); + DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ), + MANDATORY_FIELDS ) ); + return; + } + + m_grid->CommitPendingChanges( true /* quiet mode */ ); + + m_fields->erase( m_fields->begin() + curRow ); + + // notify the grid + wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 ); + m_grid->ProcessTableMessage( msg ); + + if( m_grid->GetNumberRows() > 0 ) + { + m_grid->MakeCellVisible( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); + m_grid->SetGridCursor( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); } } -/* Add a new name to the footprint filter list box - * Obvioulsy, cannot be void - */ -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnMoveUp( wxCommandEvent& event ) { - wxString Line; - LIB_PART* component = m_Parent->GetCurPart(); + if( !m_grid->CommitPendingChanges() ) + return; + + int i = m_grid->GetGridCursorRow(); + + if( i > MANDATORY_FIELDS ) + { + LIB_FIELD tmp = m_fields->at( (unsigned) i ); + m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); + m_fields->insert( m_fields->begin() + i - 1, tmp ); + m_grid->ForceRefresh(); + + m_grid->SetGridCursor( i - 1, m_grid->GetGridCursorCol() ); + m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() ); + } + else + wxBell(); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnMoveDown( wxCommandEvent& event ) +{ + if( !m_grid->CommitPendingChanges() ) + return; + + int i = m_grid->GetGridCursorRow(); + + if( i >= MANDATORY_FIELDS ) + { + LIB_FIELD tmp = m_fields->at( (unsigned) i ); + m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); + m_fields->insert( m_fields->begin() + i + 1, tmp ); + m_grid->ForceRefresh(); + + m_grid->SetGridCursor( i + 1, m_grid->GetGridCursorCol() ); + m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() ); + } + else + wxBell(); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::updateAliasName( bool aFromGrid, const wxString& aName ) +{ + int idx = m_aliasListBox->GetSelection(); + + if( idx >= 0 ) + { + m_aliasListBox->SetString( (unsigned) idx, aName ); + m_aliasesBuffer[ idx ]->SetName( aName ); + + if( aFromGrid ) + m_AliasNameCtrl->ChangeValue( aName ); + else + m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, aName ); + } +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging( wxGridEvent& event ) +{ + if( event.GetRow() == VALUE ) + { + int idx = m_aliasListBox->GetSelection(); + wxString newName = event.GetString(); + + if( idx < 0 || !checkAliasName( newName ) ) + { + event.Veto(); + + if( m_NoteBook->GetSelection() != 1 ) + m_NoteBook->SetSelection( 1 ); + + m_delayedFocusGrid = m_aliasGrid; + m_delayedFocusRow = event.GetRow(); + m_delayedFocusColumn = event.GetCol(); + } + } +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameText( wxCommandEvent& event ) +{ + updateAliasName( false, m_AliasNameCtrl->GetValue() ); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameKillFocus( wxFocusEvent& event ) +{ + static bool inKillFocus = false; + + // If we get an error then we're going to throw up a dialog. Since we haven't yet + // finished the KillFocus event, we'll end up getting another one. Side-effects may + // include death. + if( inKillFocus ) + return; + + inKillFocus = true; + + if( !checkAliasName( m_AliasNameCtrl->GetValue() ) ) + m_delayedFocusCtrl = m_AliasNameCtrl; + + inKillFocus = false; + + event.Skip(); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::transferAliasDataToBuffer() +{ + if( m_currentAlias >= 0 ) + { + LIB_ALIAS* alias = m_aliasesBuffer[ m_currentAlias ]; + + alias->SetName( m_aliasGrid->GetCellValue( VALUE, FDC_VALUE ) ); + alias->SetDocFileName( m_aliasGrid->GetCellValue( DATASHEET, FDC_VALUE ) ); + alias->SetDescription( m_AliasDescCtrl->GetValue() ); + alias->SetKeyWords( m_AliasKeywordsCtrl->GetValue() ); + } +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSelectAlias( wxCommandEvent& event ) +{ + if( m_delayedFocusCtrl || !m_aliasGrid->CommitPendingChanges() ) + { + m_aliasListBox->SetSelection( m_currentAlias ); // veto selection change + return; + } + + // Copy any pending changes back into the buffer + transferAliasDataToBuffer(); + + LIB_ALIAS* alias = nullptr; + int newIdx = m_aliasListBox->GetSelection(); + + if( newIdx >= 0 ) + { + alias = m_aliasesBuffer[ newIdx ]; + + m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, alias->GetName() ); + m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, alias->GetDocFileName() ); + + // Use ChangeValue() so we don't generate events + m_AliasNameCtrl->ChangeValue( alias->GetName() ); + m_AliasDescCtrl->ChangeValue( alias->GetDescription() ); + m_AliasKeywordsCtrl->ChangeValue( alias->GetKeyWords() ); + } + else + { + m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, wxEmptyString ); + m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, wxEmptyString ); + + // Use ChangeValue() so we don't generate events + m_AliasNameCtrl->ChangeValue( wxEmptyString ); + m_AliasDescCtrl->ChangeValue( wxEmptyString ); + m_AliasKeywordsCtrl->ChangeValue( wxEmptyString ); + } + + m_currentAlias = newIdx; +} + + +bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName( const wxString& aName ) +{ + if( aName.IsEmpty() ) + return false; + + for( size_t i = 0; i < m_aliasListBox->GetCount(); ++i ) + { + if( i == m_aliasListBox->GetSelection() ) + continue; + + if( m_aliasListBox->GetString( i ).CmpNoCase( aName ) == 0 ) + { + wxString msg; + msg.Printf( _( "Alias \"%s\" already exists." ), aName ); + DisplayInfoMessage( this, msg ); + return false; + } + } + + wxString library = m_Parent->GetCurLib(); + + if( !library.empty() ) + { + LIB_ALIAS* existing = Prj().SchSymbolLibTable()->LoadSymbol( library, aName ); + + if( existing && existing->GetPart()->GetName() != m_libEntry->GetName() ) + { + wxString msg; + msg.Printf( _( "Symbol name \"%s\" already exists in library \"%s\"." ), aName, library ); + DisplayErrorMessage( this, msg ); + return false; + } + } + + return true; +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddAlias( wxCommandEvent& event ) +{ + if( m_delayedFocusCtrl || !m_aliasGrid->CommitPendingChanges() ) + return; + + wxCommandEvent dummy; + wxString aliasname = _( "untitled" ); + int suffix = 1; + + while( m_libEntry->HasAlias( aliasname ) ) + aliasname = wxString::Format( _( "untitled%i" ), suffix++ ); + + LIB_ALIAS* alias = new LIB_ALIAS( aliasname, m_libEntry ); + + // Initialize with parent's data + alias->SetDescription( m_DescCtrl->GetValue() ); + alias->SetKeyWords( m_KeywordCtrl->GetValue() ); + alias->SetDocFileName( m_grid->GetCellValue( DATASHEET, FDC_VALUE ) ); + + m_aliasesBuffer.push_back( alias ); // transfers ownership of alias to aliasesBuffer + + m_aliasListBox->Append( aliasname ); + m_aliasListBox->SetSelection( m_aliasListBox->GetCount() - 1 ); + OnSelectAlias( dummy ); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteAlias( wxCommandEvent& event ) +{ + if( m_delayedFocusCtrl || !m_aliasGrid->CommitPendingChanges() ) + return; + + int sel = m_aliasListBox->GetSelection(); + + if( sel == wxNOT_FOUND ) + return; + + m_aliasListBox->Delete( (unsigned) sel ); + m_aliasesBuffer.erase( m_aliasesBuffer.begin() + sel ); + + if( m_aliasListBox->GetCount() == 0 ) + m_aliasListBox->SetSelection( wxNOT_FOUND ); + else + m_aliasListBox->SetSelection( std::max( 0, sel - 1 ) ); + + wxCommandEvent dummy; + OnSelectAlias( dummy ); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddFootprintFilter( wxCommandEvent& event ) +{ + wxString filterLine; + LIB_PART* component = m_Parent->GetCurPart(); if( component == NULL ) return; - WX_TEXT_ENTRY_DIALOG dlg( this, _( "Add Footprint Filter" ), _( "Footprint Filter" ), Line ); - if( dlg.ShowModal() != wxID_OK ) - return; // cancelled by user + WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Add Footprint Filter" ), filterLine ); - Line = dlg.GetValue(); - Line.Replace( wxT( " " ), wxT( "_" ) ); - - if( Line.IsEmpty() ) + if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue().IsEmpty() ) return; - /* test for an existing name: */ - int index = m_FootprintFilterListBox->FindString( Line ); + filterLine = dlg.GetValue(); + filterLine.Replace( wxT( " " ), wxT( "_" ) ); - if( index != wxNOT_FOUND ) - { - wxString msg; + // duplicate filters do no harm, so don't be a nanny. - msg.Printf( _( "Footprint filter \"%s\" is already defined." ), GetChars( Line ) ); - DisplayError( this, msg ); - return; - } - - m_FootprintFilterListBox->Append( Line ); - m_ButtonDeleteAllFootprintFilter->Enable( true ); - m_ButtonDeleteOneFootprintFilter->Enable( true ); - m_buttonEditOneFootprintFilter->Enable( true ); + m_FootprintFilterListBox->Append( filterLine ); + m_FootprintFilterListBox->SetSelection( m_FootprintFilterListBox->GetCount() - 1 ); } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteFootprintFilter( wxCommandEvent& event ) { - LIB_PART* component = m_Parent->GetCurPart(); int ii = m_FootprintFilterListBox->GetSelection(); - if( ii == wxNOT_FOUND ) + if( ii >= 0 ) { - return; - } + m_FootprintFilterListBox->Delete( (unsigned) ii ); - m_FootprintFilterListBox->Delete( ii ); - - if( !component || ( m_FootprintFilterListBox->GetCount() == 0 ) ) - { - m_ButtonDeleteAllFootprintFilter->Enable( false ); - m_ButtonDeleteOneFootprintFilter->Enable( false ); - m_buttonEditOneFootprintFilter->Enable( false ); + if( m_FootprintFilterListBox->GetCount() == 0 ) + m_FootprintFilterListBox->SetSelection( wxNOT_FOUND ); + else + m_FootprintFilterListBox->SetSelection( std::max( 0, ii - 1 ) ); } } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditFootprintFilter( wxCommandEvent& event ) { int idx = m_FootprintFilterListBox->GetSelection(); - if( idx < 0 ) - return; + if( idx >= 0 ) + { + wxString filter = m_FootprintFilterListBox->GetStringSelection(); - wxString filter = m_FootprintFilterListBox->GetStringSelection(); + WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Edit Footprint Filter" ), filter ); - WX_TEXT_ENTRY_DIALOG dlg( this, wxEmptyString, _( "Edit footprint filter" ), filter ); - - if( dlg.ShowModal() != wxID_OK ) - return; // Aborted by user - - filter = dlg.GetValue(); - - if( filter.IsEmpty() ) - return; // do not accept blank filter. - - m_FootprintFilterListBox->SetString( idx, filter ); + if( dlg.ShowModal() == wxID_OK && !dlg.GetValue().IsEmpty() ) + m_FootprintFilterListBox->SetString( (unsigned) idx, dlg.GetValue() ); + } } -void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustGridColumns( int aWidth ) { - if( m_SelNumberOfUnits->GetValue() <= 1 ) - m_OptionPartsLocked->Enable( false ); - else - m_OptionPartsLocked->Enable( true ); + // Account for scroll bars + aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x ); + + m_grid->AutoSizeColumn( FDC_NAME ); + + int fixedColsWidth = m_grid->GetColSize( FDC_NAME ); + + for( int i = 2; i < m_grid->GetNumberCols(); i++ ) + fixedColsWidth += m_grid->GetColSize( i ); + + m_grid->SetColSize( FDC_VALUE, aWidth - fixedColsWidth ); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustAliasGridColumns( int aWidth ) +{ + m_aliasGrid->AutoSizeColumn( FDC_NAME ); + m_aliasGrid->SetColSize( FDC_VALUE, aWidth - m_aliasGrid->GetColSize( FDC_NAME ) - 2 ); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI( wxUpdateUIEvent& event ) +{ + m_OptionPartsLocked->Enable( m_SelNumberOfUnits->GetValue() > 1 ); + m_pinNameOffset.Enable( m_PinsNameInsideButt->GetValue() ); + + // Synthesize a Select event when the selection is cleared + if( m_aliasListBox->GetSelection() == wxNOT_FOUND && m_currentAlias != wxNOT_FOUND ) + { + wxCommandEvent dummy; + OnSelectAlias( dummy ); + } + + // Handle shown columns changes + wxString shownColumns = m_grid->GetShownColumns(); + + if( shownColumns != m_shownColumns ) + { + m_shownColumns = shownColumns; + + if( !m_grid->IsCellEditControlShown() ) + adjustGridColumns( m_grid->GetRect().GetWidth()); + } + + // Handle a delayed focus + if( m_delayedFocusCtrl ) + { + m_delayedFocusCtrl->SetFocus(); + + if( dynamic_cast( m_delayedFocusCtrl ) ) + dynamic_cast( m_delayedFocusCtrl )->SelectAll(); + + m_delayedFocusCtrl = nullptr; + } + else if( m_delayedFocusGrid ) + { + m_delayedFocusGrid->SetFocus(); + m_delayedFocusGrid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn ); + m_delayedFocusGrid->SetGridCursor( m_delayedFocusRow, m_delayedFocusColumn ); + + if( !m_delayedErrorMessage.IsEmpty() ) + DisplayErrorMessage( this, m_delayedErrorMessage ); + + m_delayedFocusGrid->EnableCellEditControl( true ); + m_delayedFocusGrid->ShowCellEditControl(); + + m_delayedErrorMessage = wxEmptyString; + m_delayedFocusGrid = nullptr; + } +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid( wxSizeEvent& event ) +{ + adjustGridColumns( event.GetSize().GetX()); + + event.Skip(); +} + + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeAliasGrid( wxSizeEvent& event ) +{ + adjustAliasGridColumns( event.GetSize().GetX()); + + event.Skip(); } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.h b/eeschema/dialogs/dialog_edit_component_in_lib.h index ce049cd691..c4bc1640bb 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib.h @@ -29,43 +29,75 @@ #ifndef _DIALOG_EDIT_COMPONENT_IN_LIB_H_ #define _DIALOG_EDIT_COMPONENT_IN_LIB_H_ +#include +#include +#include #include +class LIB_EDIT_FRAME; +class LIB_PART; +class WX_GRID; + + class DIALOG_EDIT_COMPONENT_IN_LIBRARY: public DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE { static int m_lastOpenedPage; // To remember the last notebook selection public: + wxConfigBase* m_config; + LIB_EDIT_FRAME* m_Parent; - bool m_RecreateToolbar; - int m_AliasLocation; + LIB_PART* m_libEntry; + + FIELDS_GRID_TABLE* m_fields; + + int m_currentAlias; + LIB_ALIASES m_aliasesBuffer; + UNIT_BINDER m_pinNameOffset; + + wxControl* m_delayedFocusCtrl; + wxString m_delayedErrorMessage; + WX_GRID* m_delayedFocusGrid; + int m_delayedFocusRow; + int m_delayedFocusColumn; + wxString m_shownColumns; + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + bool Validate() override; public: /// Constructors - DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* parent); + DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* parent, LIB_PART* aLibEntry ); ~DIALOG_EDIT_COMPONENT_IN_LIBRARY(); private: - void initDlg(); - void InitPanelDoc(); - void InitBasicPanel(); - void OnCancelClick( wxCommandEvent& event ) override; - void OnOkClick(wxCommandEvent& event) override; - void DeleteAllAliasOfPart(wxCommandEvent& event) override; - void DeleteAliasOfPart(wxCommandEvent& event) override; - void EditAliasOfPart(wxCommandEvent& event) override; - void AddAliasOfPart(wxCommandEvent& event) override; - bool checkNewAlias( wxString aliasname ); - bool ChangeNbUnitsPerPackage(int newUnit); - bool SetUnsetConvert(); - void CopyDocFromRootToAlias(wxCommandEvent& event) override; - void BrowseAndSelectDocFile(wxCommandEvent& event) override; - void DeleteAllFootprintFilter(wxCommandEvent& event) override; - void DeleteOneFootprintFilter(wxCommandEvent& event) override; - void AddFootprintFilter(wxCommandEvent& event) override; - void EditOneFootprintFilter( wxCommandEvent& event ) override; - void OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) override; + void transferAliasDataToBuffer(); + + void OnAddField( wxCommandEvent& event ) override; + void OnDeleteField( wxCommandEvent& event ) override; + void OnMoveUp( wxCommandEvent& event ) override; + void OnMoveDown( wxCommandEvent& event ) override; + void OnSelectAlias( wxCommandEvent& event ) override; + void OnAddAlias( wxCommandEvent& event ) override; + void OnDeleteAlias( wxCommandEvent& event ) override; + void OnAddFootprintFilter( wxCommandEvent& event ) override; + void OnDeleteFootprintFilter( wxCommandEvent& event ) override; + void OnEditFootprintFilter( wxCommandEvent& event ) override; + void OnSizeGrid( wxSizeEvent& event ) override; + void OnSizeAliasGrid( wxSizeEvent& event ) override; + void OnGridCellChanging( wxGridEvent& event ); + void OnAliasGridCellChanging( wxGridEvent& event ); + void OnAliasNameKillFocus( wxFocusEvent& event ) override; + void OnAliasNameText( wxCommandEvent& event ) override; + void OnUpdateUI( wxUpdateUIEvent& event ) override; + + void updateAliasName( bool aFromGrid, const wxString& aName ); + bool checkAliasName( const wxString& aName ); + void adjustGridColumns( int aWidth ); + void adjustAliasGridColumns( int aWidth ); }; #endif diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp index 3b88a6dcfa..63e47297de 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "widgets/wx_grid.h" + #include "dialog_edit_component_in_lib_base.h" /////////////////////////////////////////////////////////////////////////// @@ -24,140 +26,237 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx wxBoxSizer* bSizerBasicPanel; bSizerBasicPanel = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* m_OptionsBoxSizer; - m_OptionsBoxSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("General:") ), wxVERTICAL ); + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Fields") ), wxVERTICAL ); - m_AsConvertButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Has alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AsConvertButt->SetToolTip( _("Check this option if the symbol has an alternate body style (De Morgan)") ); + m_grid = new WX_GRID( sbSizer4->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER ); - m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + // Grid + m_grid->CreateGrid( 4, 11 ); + m_grid->EnableEditing( true ); + m_grid->EnableGridLines( true ); + m_grid->EnableDragGridSize( false ); + m_grid->SetMargins( 0, 0 ); - m_ShowPinNumButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Show pin number"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowPinNumButt->SetValue(true); - m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") ); + // Columns + m_grid->SetColSize( 0, 72 ); + m_grid->SetColSize( 1, 120 ); + m_grid->SetColSize( 2, 48 ); + m_grid->SetColSize( 3, 72 ); + m_grid->SetColSize( 4, 72 ); + m_grid->SetColSize( 5, 48 ); + m_grid->SetColSize( 6, 48 ); + m_grid->SetColSize( 7, 84 ); + m_grid->SetColSize( 8, 84 ); + m_grid->SetColSize( 9, 84 ); + m_grid->SetColSize( 10, 84 ); + m_grid->EnableDragColMove( false ); + m_grid->EnableDragColSize( true ); + m_grid->SetColLabelSize( 22 ); + m_grid->SetColLabelValue( 0, _("Name") ); + m_grid->SetColLabelValue( 1, _("Value") ); + m_grid->SetColLabelValue( 2, _("Show") ); + m_grid->SetColLabelValue( 3, _("H Align") ); + m_grid->SetColLabelValue( 4, _("V Align") ); + m_grid->SetColLabelValue( 5, _("Italic") ); + m_grid->SetColLabelValue( 6, _("Bold") ); + m_grid->SetColLabelValue( 7, _("Text Size") ); + m_grid->SetColLabelValue( 8, _("Orientation") ); + m_grid->SetColLabelValue( 9, _("X Position") ); + m_grid->SetColLabelValue( 10, _("Y Position") ); + m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + // Rows + m_grid->EnableDragRowSize( true ); + m_grid->SetRowLabelSize( 0 ); + m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - m_ShowPinNameButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Show pin name"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowPinNameButt->SetValue(true); - m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") ); + // Label Appearance - m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + // Cell Defaults + m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_grid->SetMinSize( wxSize( -1,180 ) ); - m_PinsNameInsideButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Place pin names inside"), wxDefaultPosition, wxDefaultSize, 0 ); - m_PinsNameInsideButt->SetValue(true); - m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") ); + sbSizer4->Add( m_grid, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 ); - m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 ); + wxBoxSizer* bButtonSize; + bButtonSize = new wxBoxSizer( wxHORIZONTAL ); + + m_bpAdd = new wxBitmapButton( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bpAdd->SetMinSize( wxSize( 30,29 ) ); + + bButtonSize->Add( m_bpAdd, 0, wxRIGHT, 5 ); + + m_bpDelete = new wxBitmapButton( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bpDelete->SetMinSize( wxSize( 30,29 ) ); + + bButtonSize->Add( m_bpDelete, 0, wxRIGHT, 10 ); + + m_bpMoveUp = new wxBitmapButton( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bpMoveUp->SetMinSize( wxSize( 30,29 ) ); + + bButtonSize->Add( m_bpMoveUp, 0, wxLEFT, 10 ); + + m_bpMoveDown = new wxBitmapButton( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bpMoveDown->SetMinSize( wxSize( 30,29 ) ); + + bButtonSize->Add( m_bpMoveDown, 0, wxRIGHT|wxLEFT, 5 ); - bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 ); + bButtonSize->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerBasicPanel->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 ); + + sbSizer4->Add( bButtonSize, 1, wxEXPAND|wxBOTTOM, 5 ); + + + bSizerBasicPanel->Add( sbSizer4, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizerMidBasicPanel; - bSizerMidBasicPanel = new wxBoxSizer( wxHORIZONTAL ); + bSizerMidBasicPanel = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizernbunits; - bSizernbunits = new wxBoxSizer( wxVERTICAL ); + wxFlexGridSizer* fgSizerFPID; + fgSizerFPID = new wxFlexGridSizer( 4, 2, 3, 0 ); + fgSizerFPID->AddGrowableCol( 1 ); + fgSizerFPID->SetFlexibleDirection( wxBOTH ); + fgSizerFPID->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextNbUnits = new wxStaticText( m_PanelBasic, wxID_ANY, _("Number of Units:"), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText* staticNameLabel; + staticNameLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Symbol name:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticNameLabel->Wrap( -1 ); + fgSizerFPID->Add( staticNameLabel, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_SymbolNameCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID->Add( m_SymbolNameCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + wxStaticText* staticDescriptionLabel; + staticDescriptionLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticDescriptionLabel->Wrap( -1 ); + fgSizerFPID->Add( staticDescriptionLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_DescCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID->Add( m_DescCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + staticKeywordsLabel = new wxStaticText( m_PanelBasic, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticKeywordsLabel->Wrap( -1 ); + fgSizerFPID->Add( staticKeywordsLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_KeywordCtrl = new wxTextCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID->Add( m_KeywordCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + bSizerMidBasicPanel->Add( fgSizerFPID, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + + bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerLowerBasicPanel; + bSizerLowerBasicPanel = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerLeftCol; + bSizerLeftCol = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerSymbol; + sbSizerSymbol = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Symbol") ), wxVERTICAL ); + + m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_AsConvertButt->SetToolTip( _("Check this option if the symbol has an alternate body style (De Morgan)") ); + + sbSizerSymbol->Add( m_AsConvertButt, 0, wxRIGHT|wxLEFT, 5 ); + + m_OptionPower = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Define as power symbol"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptionPower->SetToolTip( _("Check this option when the symbol is a power symbol") ); + + sbSizerSymbol->Add( m_OptionPower, 0, wxALL, 5 ); + + wxBoxSizer* bSizerUnitCount; + bSizerUnitCount = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextNbUnits = new wxStaticText( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Number of Units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextNbUnits->Wrap( -1 ); m_staticTextNbUnits->SetToolTip( _("Enter the number of units for a symbol that contains more than one unit") ); - bSizernbunits->Add( m_staticTextNbUnits, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerUnitCount->Add( m_staticTextNbUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 ); - bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_SelNumberOfUnits = new wxSpinCtrl( sbSizerSymbol->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 ); + bSizerUnitCount->Add( m_SelNumberOfUnits, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 ); + sbSizerSymbol->Add( bSizerUnitCount, 1, wxEXPAND, 5 ); - wxBoxSizer* bSizerOffset; - bSizerOffset = new wxBoxSizer( wxVERTICAL ); - - m_staticTextskew = new wxStaticText( m_PanelBasic, wxID_ANY, _("Pin Name Position Offset:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextskew->Wrap( -1 ); - m_staticTextskew->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") ); - - bSizerOffset->Add( m_staticTextskew, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); - bSizerOffset->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bSizerMidBasicPanel->Add( bSizerOffset, 1, wxEXPAND, 5 ); - - - bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 ); - - m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerBasicPanel->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - - m_OptionPower = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Define as power symbol"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OptionPower->SetToolTip( _("Check this option when the symbol is a power symbol") ); - - bSizerBasicPanel->Add( m_OptionPower, 0, wxALL, 5 ); - - m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, wxID_ANY, _("All units are not interchangeable"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptionPartsLocked = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("All units are not interchangeable"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptionPartsLocked->SetToolTip( _("Check this option when creating multiple unit symbols and all units are not interchangeable") ); - bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 ); + sbSizerSymbol->Add( m_OptionPartsLocked, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerLeftCol->Add( sbSizerSymbol, 0, wxEXPAND|wxALL, 5 ); + + + bSizerLowerBasicPanel->Add( bSizerLeftCol, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerRightCol; + bSizerRightCol = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerAnnotations; + sbSizerAnnotations = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("Annotations") ), wxVERTICAL ); + + m_ShowPinNumButt = new wxCheckBox( sbSizerAnnotations->GetStaticBox(), wxID_ANY, _("Show pin number"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ShowPinNumButt->SetValue(true); + m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") ); + + sbSizerAnnotations->Add( m_ShowPinNumButt, 0, wxRIGHT|wxLEFT, 5 ); + + m_ShowPinNameButt = new wxCheckBox( sbSizerAnnotations->GetStaticBox(), wxID_ANY, _("Show pin name"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ShowPinNameButt->SetValue(true); + m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") ); + + sbSizerAnnotations->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + + sbSizerAnnotations->Add( 0, 0, 1, wxEXPAND, 5 ); + + m_PinsNameInsideButt = new wxCheckBox( sbSizerAnnotations->GetStaticBox(), wxID_ANY, _("Place pin names inside"), wxDefaultPosition, wxDefaultSize, 0 ); + m_PinsNameInsideButt->SetValue(true); + m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") ); + + sbSizerAnnotations->Add( m_PinsNameInsideButt, 0, wxALL, 5 ); + + wxBoxSizer* bSizerNameOffset; + bSizerNameOffset = new wxBoxSizer( wxHORIZONTAL ); + + m_nameOffsetLabel = new wxStaticText( sbSizerAnnotations->GetStaticBox(), wxID_ANY, _("Position offset:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_nameOffsetLabel->Wrap( -1 ); + m_nameOffsetLabel->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") ); + + bSizerNameOffset->Add( m_nameOffsetLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 30 ); + + m_nameOffsetCtrl = new wxTextCtrl( sbSizerAnnotations->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerNameOffset->Add( m_nameOffsetCtrl, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_nameOffsetUnits = new wxStaticText( sbSizerAnnotations->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_nameOffsetUnits->Wrap( -1 ); + bSizerNameOffset->Add( m_nameOffsetUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + + sbSizerAnnotations->Add( bSizerNameOffset, 0, wxEXPAND, 5 ); + + + sbSizerAnnotations->Add( 0, 0, 1, wxEXPAND, 5 ); + + + bSizerRightCol->Add( sbSizerAnnotations, 1, wxEXPAND|wxALL, 5 ); + + + bSizerLowerBasicPanel->Add( bSizerRightCol, 1, wxEXPAND, 5 ); + + + bSizerBasicPanel->Add( bSizerLowerBasicPanel, 0, wxEXPAND, 5 ); m_PanelBasic->SetSizer( bSizerBasicPanel ); m_PanelBasic->Layout(); bSizerBasicPanel->Fit( m_PanelBasic ); - m_NoteBook->AddPage( m_PanelBasic, _("Options"), true ); - m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* m_PanelDocBoxSizer; - m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL ); - - m_staticTextDescription = new wxStaticText( m_PanelDoc, wxID_ANY, _("Description:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDescription->Wrap( -1 ); - m_staticTextDescription->SetToolTip( _("A short description that is displayed in Eeschema.\nCan be a very good help when selecting components in libraries components lists.") ); - - m_PanelDocBoxSizer->Add( m_staticTextDescription, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_DocCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_PanelDocBoxSizer->Add( m_DocCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextKeywords->Wrap( -1 ); - m_staticTextKeywords->SetToolTip( _("Enter key words that can be used to select this symbol.\nKey words cannot have spaces and are separated by a space.") ); - - m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_KeywordsCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_PanelDocBoxSizer->Add( m_KeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticTextDocFileName = new wxStaticText( m_PanelDoc, wxID_ANY, _("Documentation File Name:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDocFileName->Wrap( -1 ); - m_staticTextDocFileName->SetToolTip( _("Enter the documentation file (a .pdf document) associated with the symbol.") ); - - m_PanelDocBoxSizer->Add( m_staticTextDocFileName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_DocfileCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 ); - m_PanelDocBoxSizer->Add( m_DocfileCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizerPaneldocbutts; - bSizerPaneldocbutts = new wxBoxSizer( wxHORIZONTAL ); - - m_ButtonCopyDoc = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS, _("Copy Document from Parent"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerPaneldocbutts->Add( m_ButtonCopyDoc, 0, wxALL, 5 ); - - m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse Files"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 ); - - - m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - m_PanelDoc->SetSizer( m_PanelDocBoxSizer ); - m_PanelDoc->Layout(); - m_PanelDocBoxSizer->Fit( m_PanelDoc ); - m_NoteBook->AddPage( m_PanelDoc, _("Description"), false ); + m_NoteBook->AddPage( m_PanelBasic, _("General"), true ); m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerMainPanelAlias; bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL ); @@ -165,35 +264,116 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx wxBoxSizer* bLeftBoxSizerPanelAlias; bLeftBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL ); - m_staticTextAlias = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias List:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextAlias->Wrap( -1 ); - m_staticTextAlias->SetToolTip( _("An alias is a symbol that uses the body of its root symbol.\nIt has its own documentation and keywords.\nA fast way to extend a library with similar symbols.") ); + wxStaticText* staticAliasesLabel; + staticAliasesLabel = new wxStaticText( m_PanelAlias, wxID_ANY, _("Aliases:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticAliasesLabel->Wrap( -1 ); + bLeftBoxSizerPanelAlias->Add( staticAliasesLabel, 0, wxRIGHT|wxLEFT, 5 ); - bLeftBoxSizerPanelAlias->Add( m_staticTextAlias, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + m_aliasListBox = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bLeftBoxSizerPanelAlias->Add( m_aliasListBox, 1, wxEXPAND|wxLEFT, 5 ); - m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + wxBoxSizer* bSizerButtons; + bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_addAliasButton = new wxBitmapButton( m_PanelAlias, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_addAliasButton->SetMinSize( wxSize( 30,29 ) ); + + bSizerButtons->Add( m_addAliasButton, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_deleteAliasButton = new wxBitmapButton( m_PanelAlias, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_deleteAliasButton->SetMinSize( wxSize( 30,29 ) ); + + bSizerButtons->Add( m_deleteAliasButton, 0, wxBOTTOM|wxRIGHT, 5 ); - bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 ); + bLeftBoxSizerPanelAlias->Add( bSizerButtons, 0, wxEXPAND, 5 ); + + + bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 2, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bRightBoxSizerPanelAlias; bRightBoxSizerPanelAlias = new wxBoxSizer( wxVERTICAL ); - m_ButtonAddeAlias = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightBoxSizerPanelAlias->Add( m_ButtonAddeAlias, 0, wxALL|wxEXPAND, 5 ); + m_staticText12 = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias field substitutions:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText12->Wrap( -1 ); + bRightBoxSizerPanelAlias->Add( m_staticText12, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_ButtonEditAlias = new wxButton( m_PanelAlias, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightBoxSizerPanelAlias->Add( m_ButtonEditAlias, 0, wxALL, 5 ); + m_aliasGrid = new WX_GRID( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER ); - m_ButtonDeleteOneAlias = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightBoxSizerPanelAlias->Add( m_ButtonDeleteOneAlias, 0, wxALL|wxEXPAND, 5 ); + // Grid + m_aliasGrid->CreateGrid( 4, 2 ); + m_aliasGrid->EnableEditing( true ); + m_aliasGrid->EnableGridLines( true ); + m_aliasGrid->EnableDragGridSize( false ); + m_aliasGrid->SetMargins( 0, 0 ); - m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 ); + // Columns + m_aliasGrid->SetColSize( 0, 72 ); + m_aliasGrid->SetColSize( 1, 420 ); + m_aliasGrid->EnableDragColMove( false ); + m_aliasGrid->EnableDragColSize( true ); + m_aliasGrid->SetColLabelSize( 22 ); + m_aliasGrid->SetColLabelValue( 0, _("Name") ); + m_aliasGrid->SetColLabelValue( 1, _("Value") ); + m_aliasGrid->SetColLabelValue( 2, _("Show") ); + m_aliasGrid->SetColLabelValue( 3, _("H Align") ); + m_aliasGrid->SetColLabelValue( 4, _("V Align") ); + m_aliasGrid->SetColLabelValue( 5, _("Italic") ); + m_aliasGrid->SetColLabelValue( 6, _("Bold") ); + m_aliasGrid->SetColLabelValue( 7, _("Text Size") ); + m_aliasGrid->SetColLabelValue( 8, _("Orientation") ); + m_aliasGrid->SetColLabelValue( 9, _("X Position") ); + m_aliasGrid->SetColLabelValue( 10, _("Y Position") ); + m_aliasGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_aliasGrid->EnableDragRowSize( true ); + m_aliasGrid->SetRowLabelSize( 0 ); + m_aliasGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_aliasGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + bRightBoxSizerPanelAlias->Add( m_aliasGrid, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bRightBoxSizerPanelAlias->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxFlexGridSizer* fgSizerFPID1; + fgSizerFPID1 = new wxFlexGridSizer( 6, 1, 0, 0 ); + fgSizerFPID1->AddGrowableCol( 0 ); + fgSizerFPID1->SetFlexibleDirection( wxBOTH ); + fgSizerFPID1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticText* staticAliasNameLabel; + staticAliasNameLabel = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias name:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticAliasNameLabel->Wrap( -1 ); + fgSizerFPID1->Add( staticAliasNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_AliasNameCtrl = new wxTextCtrl( m_PanelAlias, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID1->Add( m_AliasNameCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxStaticText* staticAliasDescLabel; + staticAliasDescLabel = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias description:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticAliasDescLabel->Wrap( -1 ); + fgSizerFPID1->Add( staticAliasDescLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_AliasDescCtrl = new wxTextCtrl( m_PanelAlias, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID1->Add( m_AliasDescCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + staticAliasKeywordsLabel = new wxStaticText( m_PanelAlias, wxID_ANY, _("Alias keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); + staticAliasKeywordsLabel->Wrap( -1 ); + fgSizerFPID1->Add( staticAliasKeywordsLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + m_AliasKeywordsCtrl = new wxTextCtrl( m_PanelAlias, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerFPID1->Add( m_AliasKeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bRightBoxSizerPanelAlias->Add( fgSizerFPID1, 1, wxEXPAND, 5 ); + + + bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 7, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 20 ); m_PanelAlias->SetSizer( bSizerMainPanelAlias ); @@ -207,41 +387,41 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx wxBoxSizer* bFpFilterLeftBoxSizer; bFpFilterLeftBoxSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextFootprints = new wxStaticText( m_PanelFootprintFilter, wxID_ANY, _("Footprints:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextFootprints = new wxStaticText( m_PanelFootprintFilter, wxID_ANY, _("Footprint filters:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFootprints->Wrap( -1 ); m_staticTextFootprints->SetToolTip( _("A list of footprints names that can be used for this symbol.\nFootprints names can used wildcards like sm* to allow all footprints names starting by sm.") ); bFpFilterLeftBoxSizer->Add( m_staticTextFootprints, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 ); + bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bFpFilterRightBoxSizer; - bFpFilterRightBoxSizer = new wxBoxSizer( wxVERTICAL ); + bFpFilterRightBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); - bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 ); + m_addFilterButton = new wxBitmapButton( m_PanelFootprintFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bFpFilterRightBoxSizer->Add( m_addFilterButton, 0, wxBOTTOM|wxLEFT, 5 ); - m_buttonEditOneFootprintFilter = new wxButton( m_PanelFootprintFilter, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); - bFpFilterRightBoxSizer->Add( m_buttonEditOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); - - m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); - bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); - - m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); - bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 ); + m_editFilterButton = new wxBitmapButton( m_PanelFootprintFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bFpFilterRightBoxSizer->Add( m_editFilterButton, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bFpFilterRightBoxSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + m_deleteFilterButton = new wxBitmapButton( m_PanelFootprintFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), wxBU_AUTODRAW ); + bFpFilterRightBoxSizer->Add( m_deleteFilterButton, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bFpFilterLeftBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer ); m_PanelFootprintFilter->Layout(); bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter ); - m_NoteBook->AddPage( m_PanelFootprintFilter, _("Footprint Filter"), false ); + m_NoteBook->AddPage( m_PanelFootprintFilter, _("Footprint Filters"), false ); bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 ); @@ -263,36 +443,40 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx bMainSizer->Fit( this ); // Connect Events - m_OptionPartsLocked->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateInterchangeableUnits ), NULL, this ); - m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this ); - m_buttonBrowseDocFiles->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this ); - m_ButtonAddeAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this ); - m_ButtonEditAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditAliasOfPart ), NULL, this ); - m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); - m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); - m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); - m_buttonEditOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); - m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); - m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); - m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); - m_stdSizerButtonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this ); + this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateUI ) ); + m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSizeGrid ), NULL, this ); + m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddField ), NULL, this ); + m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteField ), NULL, this ); + m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnMoveUp ), NULL, this ); + m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnMoveDown ), NULL, this ); + m_aliasListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSelectAlias ), NULL, this ); + m_addAliasButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddAlias ), NULL, this ); + m_deleteAliasButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteAlias ), NULL, this ); + m_aliasGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSizeAliasGrid ), NULL, this ); + m_AliasNameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAliasNameKillFocus ), NULL, this ); + m_AliasNameCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAliasNameText ), NULL, this ); + m_addFilterButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddFootprintFilter ), NULL, this ); + m_editFilterButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnEditFootprintFilter ), NULL, this ); + m_deleteFilterButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteFootprintFilter ), NULL, this ); } DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE() { // Disconnect Events - m_OptionPartsLocked->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateInterchangeableUnits ), NULL, this ); - m_ButtonCopyDoc->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocFromRootToAlias ), NULL, this ); - m_buttonBrowseDocFiles->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::BrowseAndSelectDocFile ), NULL, this ); - m_ButtonAddeAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddAliasOfPart ), NULL, this ); - m_ButtonEditAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditAliasOfPart ), NULL, this ); - m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); - m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); - m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); - m_buttonEditOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); - m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); - m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); - m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); - m_stdSizerButtonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnOkClick ), NULL, this ); + this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnUpdateUI ) ); + m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSizeGrid ), NULL, this ); + m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddField ), NULL, this ); + m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteField ), NULL, this ); + m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnMoveUp ), NULL, this ); + m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnMoveDown ), NULL, this ); + m_aliasListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSelectAlias ), NULL, this ); + m_addAliasButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddAlias ), NULL, this ); + m_deleteAliasButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteAlias ), NULL, this ); + m_aliasGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnSizeAliasGrid ), NULL, this ); + m_AliasNameCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAliasNameKillFocus ), NULL, this ); + m_AliasNameCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAliasNameText ), NULL, this ); + m_addFilterButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnAddFootprintFilter ), NULL, this ); + m_editFilterButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnEditFootprintFilter ), NULL, this ); + m_deleteFilterButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnDeleteFootprintFilter ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp index 9f39ddd573..90d5920d2d 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp @@ -14,7 +14,6 @@ dialog_edit_component_in_lib_base 1000 none - 1 DIALOG_EDIT_COMPONENT_IN_LIBRARY_FBP @@ -88,7 +87,7 @@ - + OnUpdateUI bMainSizer @@ -187,7 +186,7 @@ - Options + General 1 1 @@ -270,22 +269,22 @@ none 5 - - 0 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 wxID_ANY - General: + Fields - m_OptionsBoxSizer + sbSizer4 wxVERTICAL 1 none 5 - wxTOP|wxRIGHT|wxLEFT + wxTOP|wxBOTTOM|wxEXPAND 0 - + 1 1 1 @@ -294,35 +293,58 @@ + 0 + 0 1 + + + wxALIGN_LEFT + + wxALIGN_TOP 0 - 0 1 + wxALIGN_CENTRE + 22 + "Name" "Value" "Show" "H Align" "V Align" "Italic" "Bold" "Text Size" "Orientation" "X Position" "Y Position" + wxALIGN_CENTRE + 11 + 72,120,48,72,72,48,48,84,84,84,84 1 0 Dock 0 Left + 0 + 1 + 0 + 1 + 1 1 1 + + 1 0 0 wxID_ANY - Has alternate symbol (DeMorgan) + + + + 0 + 0 0 0 - + -1,180 1 - m_AsConvertButt + m_grid 1 @@ -330,23 +352,55 @@ 1 Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 4 1 - - + WX_GRID; widgets/wx_grid.h; forward_declare 0 - Check this option if the symbol has an alternate body style (De Morgan) - - wxFILTER_NONE - wxDefaultValidator - + - + wxSIMPLE_BORDER - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -365,355 +419,954 @@ - + OnSizeGrid 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pin number - - 0 - - - 0 + wxEXPAND|wxBOTTOM + 1 + - 1 - m_ShowPinNumButt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Show or hide pin numbers - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pin name - - 0 - - - 0 - - 1 - m_ShowPinNameButt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Show or hide pin names - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Place pin names inside - - 0 - - - 0 - - 1 - m_PinsNameInsideButt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Check this option to have pin names inside the body and pin number outside. If not checked pins names and pins numbers are outside. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + bButtonSize + wxHORIZONTAL + none + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Field + + 0 + + + 0 + 30,29 + 1 + m_bpAdd + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddField + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Field + + 0 + + + 0 + 30,29 + 1 + m_bpDelete + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteField + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Up + + 0 + + + 0 + 30,29 + 1 + m_bpMoveUp + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveUp + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Down + + 0 + + + 0 + 30,29 + 1 + m_bpMoveDown + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveDown + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + 5 - wxEXPAND | wxALL + wxEXPAND|wxRIGHT|wxLEFT 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 + - 1 - m_staticline3 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - + bSizerMidBasicPanel + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + 2 + wxBOTH + 1 + + 0 + + fgSizerFPID + wxFLEX_GROWMODE_SPECIFIED + none + 4 + 3 + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Symbol name: + + 0 + + + 0 + + 1 + staticNameLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_SymbolNameCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Description: + + 0 + + + 0 + + 1 + staticDescriptionLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_DescCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Keywords: + + 0 + + + 0 + + 1 + staticKeywordsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_KeywordCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -722,7 +1375,7 @@ 0 - bSizerMidBasicPanel + bSizerLowerBasicPanel wxHORIZONTAL none @@ -731,178 +1384,468 @@ 1 - bSizernbunits + bSizerLeftCol wxVERTICAL none 5 - wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY - Number of Units: - - 0 - - - 0 + Symbol - 1 - m_staticTextNbUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the number of units for a symbol that contains more than one unit - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 1 - 26 - - 0 - - 1 - - 0 - - 1 - m_SelNumberOfUnits - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + sbSizerSymbol + wxVERTICAL + 1 + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Has alternate symbol (DeMorgan) + + 0 + + + 0 + + 1 + m_AsConvertButt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check this option if the symbol has an alternate body style (De Morgan) + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Define as power symbol + + 0 + + + 0 + + 1 + m_OptionPower + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check this option when the symbol is a power symbol + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerUnitCount + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Number of Units: + + 0 + + + 0 + + 1 + m_staticTextNbUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Enter the number of units for a symbol that contains more than one unit + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 26 + + 0 + + 1 + + 0 + + 1 + m_SelNumberOfUnits + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + All units are not interchangeable + + 0 + + + 0 + + 1 + m_OptionPartsLocked + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check this option when creating multiple unit symbols and all units are not interchangeable + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -913,1232 +1856,576 @@ 1 - bSizerOffset + bSizerRightCol wxVERTICAL none 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxEXPAND|wxALL + 1 + wxID_ANY - Pin Name Position Offset: - - 0 - - - 0 + Annotations - 1 - m_staticTextskew - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Margin (in 0.001 inches) between a pin name position and the component body. A value from 10 to 40 is usually good. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - + sbSizerAnnotations + wxVERTICAL + 1 + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pin number + + 0 + + + 0 + + 1 + m_ShowPinNumButt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Show or hide pin numbers + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pin name + + 0 + + + 0 + + 1 + m_ShowPinNameButt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Show or hide pin names + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Place pin names inside + + 0 + + + 0 + + 1 + m_PinsNameInsideButt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check this option to have pin names inside the body and pin number outside. If not checked pins names and pins numbers are outside. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerNameOffset + wxHORIZONTAL + none + + 30 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Position offset: + + 0 + + + 0 + + 1 + m_nameOffsetLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Margin (in 0.001 inches) between a pin name position and the component body. A value from 10 to 40 is usually good. + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_nameOffsetCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_nameOffsetUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0 - 100 - - 0 - - 1 - - 0 - - 1 - m_SetSkew - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Define as power symbol - - 0 - - - 0 - - 1 - m_OptionPower - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Check this option when the symbol is a power symbol - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - All units are not interchangeable - - 0 - - - 0 - - 1 - m_OptionPartsLocked - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Check this option when creating multiple unit symbols and all units are not interchangeable - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnUpdateInterchangeableUnits - - - - - - - - Description - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_PanelDoc - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_PanelDocBoxSizer - wxVERTICAL - none - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Description: - - 0 - - - 0 - - 1 - m_staticTextDescription - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - A short description that is displayed in Eeschema. Can be a very good help when selecting components in libraries components lists. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_DocCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Keywords: - - 0 - - - 0 - - 1 - m_staticTextKeywords - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter key words that can be used to select this symbol. Key words cannot have spaces and are separated by a space. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_KeywordsCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Documentation File Name: - - 0 - - - 0 - - 1 - m_staticTextDocFileName - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the documentation file (a .pdf document) associated with the symbol. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_DocfileCtrl - 1 - - - protected - 1 - - Resizable - 1 - 400,-1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL - 0 - - - bSizerPaneldocbutts - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_COPY_DOC_TO_ALIAS - Copy Document from Parent - - 0 - - - 0 - - 1 - m_ButtonCopyDoc - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - CopyDocFromRootToAlias - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_BROWSE_DOC_FILES - Browse Files - - 0 - - - 0 - - 1 - m_buttonBrowseDocFiles - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - BrowseAndSelectDocFile - - - - - - - - - - - - - - - - - - - - - - - @@ -2231,18 +2518,18 @@ none 5 - wxEXPAND - 1 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 2 bLeftBoxSizerPanelAlias wxVERTICAL none - + 5 - wxTOP|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -2270,7 +2557,7 @@ 0 0 wxID_ANY - Alias List: + Aliases: 0 @@ -2278,20 +2565,20 @@ 0 1 - m_staticTextAlias + staticAliasesLabel 1 - protected + none 1 Resizable 1 - + ; forward_declare 0 - An alias is a symbol that uses the body of its root symbol. It has its own documentation and keywords. A fast way to extend a library with similar symbols. + @@ -2321,11 +2608,11 @@ - + 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxLEFT 1 - + 1 1 1 @@ -2361,195 +2648,7 @@ 0 1 - m_PartAliasListCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bRightBoxSizerPanelAlias - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_ADD_ALIAS - Add - - 0 - - - 0 - - 1 - m_ButtonAddeAlias - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - AddAliasOfPart - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Edit - - 0 - - - 0 - - 1 - m_ButtonEditAlias + m_aliasListBox 1 @@ -2570,7 +2669,299 @@ - EditAliasOfPart + + + + + + + + + + + OnSelectAlias + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizerButtons + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Alias + + 0 + + + 0 + 30,29 + 1 + m_addAliasButton + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddAlias + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Alias + + 0 + + + 0 + 30,29 + 1 + m_deleteAliasButton + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteAlias + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT + 7 + + + bRightBoxSizerPanelAlias + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Alias field substitutions: + + 0 + + + 0 + + 1 + m_staticText12 + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 @@ -2596,11 +2987,11 @@ - + 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -2609,35 +3000,58 @@ + 0 + 0 1 + + + wxALIGN_LEFT + + wxALIGN_TOP 0 1 + wxALIGN_CENTRE + 22 + "Name" "Value" "Show" "H Align" "V Align" "Italic" "Bold" "Text Size" "Orientation" "X Position" "Y Position" + wxALIGN_CENTRE + 2 + 72,420 1 - 0 0 Dock 0 Left + 0 + 1 + 0 + 1 + 1 1 1 + + 1 0 0 - ID_DELETE_ONE_ALIAS - Delete + wxID_ANY + + + + 0 + 0 0 0 - + -1,-1 1 - m_ButtonDeleteOneAlias + m_aliasGrid 1 @@ -2645,23 +3059,55 @@ 1 Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 4 1 - - + WX_GRID; widgets/wx_grid.h; forward_declare 0 - - wxFILTER_NONE - wxDefaultValidator - - - DeleteAliasOfPart + wxSIMPLE_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2680,96 +3126,558 @@ - + OnSizeAliasGrid + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_DELETE_ALL_ALIAS - Delete All - - 0 - - - 0 + wxEXPAND + 1 + + 1 + wxBOTH + 0 + + 0 - 1 - m_ButtonDeleteAllAlias - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - DeleteAllAliasOfPart - - - - - - - - - - - - - - - - - - - - - - - + fgSizerFPID1 + wxFLEX_GROWMODE_SPECIFIED + none + 6 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Alias name: + + 0 + + + 0 + + 1 + staticAliasNameLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_AliasNameCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + OnAliasNameKillFocus + + + + + + + + + + + + + + + + + OnAliasNameText + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Alias description: + + 0 + + + 0 + + 1 + staticAliasDescLabel + 1 + + + none + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_AliasDescCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Alias keywords: + + 0 + + + 0 + + 1 + staticAliasKeywordsLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_AliasKeywordsCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2779,7 +3687,7 @@ - Footprint Filter + Footprint Filters 0 1 @@ -2862,7 +3770,7 @@ none 5 - wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 @@ -2901,7 +3809,7 @@ 0 0 wxID_ANY - Footprints: + Footprint filters: 0 @@ -2954,7 +3862,7 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 1 1 @@ -3040,367 +3948,304 @@ - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bFpFilterRightBoxSizer - wxVERTICAL - none 5 - wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_ADD_FOOTPRINT_FILTER - Add - - 0 - - - 0 + - 1 - m_buttonAddFpF - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - AddFootprintFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Edit - - 0 - - - 0 - - 1 - m_buttonEditOneFootprintFilter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - EditOneFootprintFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_DELETE_ONE_FOOTPRINT_FILTER - Delete - - 0 - - - 0 - - 1 - m_ButtonDeleteOneFootprintFilter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - DeleteOneFootprintFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_DELETE_ALL_FOOTPRINT_FILTER - Delete All - - 0 - - - 0 - - 1 - m_ButtonDeleteAllFootprintFilter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - DeleteAllFootprintFilter - - - - - - - - - - - - - - - - - - - - - - - + bFpFilterRightBoxSizer + wxHORIZONTAL + none + + 5 + wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Filter + + 0 + + + 0 + + 1 + m_addFilterButton + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddFootprintFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Edit Filter + + 0 + + + 0 + + 1 + m_editFilterButton + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnEditFootprintFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Filter + + 0 + + + 0 + + 1 + m_deleteFilterButton + 1 + + + protected + 1 + + Resizable + + 1 + 30,30 + wxBU_AUTODRAW + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteFootprintFilter + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3429,11 +4274,11 @@ m_stdSizerButton protected - OnCancelClick + - OnOkClick + diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.h b/eeschema/dialogs/dialog_edit_component_in_lib_base.h index 386b26eb6c..20cbad12cf 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,24 +11,27 @@ #include #include #include +class WX_GRID; + #include "dialog_shim.h" -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include -#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -36,14 +39,6 @@ /////////////////////////////////////////////////////////////////////////// #define ID_LIBEDIT_NOTEBOOK 1000 -#define ID_COPY_DOC_TO_ALIAS 1001 -#define ID_BROWSE_DOC_FILES 1002 -#define ID_ADD_ALIAS 1003 -#define ID_DELETE_ONE_ALIAS 1004 -#define ID_DELETE_ALL_ALIAS 1005 -#define ID_ADD_FOOTPRINT_FILTER 1006 -#define ID_DELETE_ONE_FOOTPRINT_FILTER 1007 -#define ID_DELETE_ALL_FOOTPRINT_FILTER 1008 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE @@ -55,59 +50,62 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM protected: wxNotebook* m_NoteBook; wxPanel* m_PanelBasic; + WX_GRID* m_grid; + wxBitmapButton* m_bpAdd; + wxBitmapButton* m_bpDelete; + wxBitmapButton* m_bpMoveUp; + wxBitmapButton* m_bpMoveDown; + wxTextCtrl* m_SymbolNameCtrl; + wxTextCtrl* m_DescCtrl; + wxStaticText* staticKeywordsLabel; + wxTextCtrl* m_KeywordCtrl; wxCheckBox* m_AsConvertButt; + wxCheckBox* m_OptionPower; + wxStaticText* m_staticTextNbUnits; + wxSpinCtrl* m_SelNumberOfUnits; + wxCheckBox* m_OptionPartsLocked; wxCheckBox* m_ShowPinNumButt; wxCheckBox* m_ShowPinNameButt; wxCheckBox* m_PinsNameInsideButt; - wxStaticLine* m_staticline3; - wxStaticText* m_staticTextNbUnits; - wxSpinCtrl* m_SelNumberOfUnits; - wxStaticText* m_staticTextskew; - wxSpinCtrl* m_SetSkew; - wxStaticLine* m_staticline1; - wxCheckBox* m_OptionPower; - wxCheckBox* m_OptionPartsLocked; - wxPanel* m_PanelDoc; - wxStaticText* m_staticTextDescription; - wxTextCtrl* m_DocCtrl; - wxStaticText* m_staticTextKeywords; - wxTextCtrl* m_KeywordsCtrl; - wxStaticText* m_staticTextDocFileName; - wxTextCtrl* m_DocfileCtrl; - wxButton* m_ButtonCopyDoc; - wxButton* m_buttonBrowseDocFiles; + wxStaticText* m_nameOffsetLabel; + wxTextCtrl* m_nameOffsetCtrl; + wxStaticText* m_nameOffsetUnits; wxPanel* m_PanelAlias; - wxStaticText* m_staticTextAlias; - wxListBox* m_PartAliasListCtrl; - wxButton* m_ButtonAddeAlias; - wxButton* m_ButtonEditAlias; - wxButton* m_ButtonDeleteOneAlias; - wxButton* m_ButtonDeleteAllAlias; + wxListBox* m_aliasListBox; + wxBitmapButton* m_addAliasButton; + wxBitmapButton* m_deleteAliasButton; + wxStaticText* m_staticText12; + WX_GRID* m_aliasGrid; + wxTextCtrl* m_AliasNameCtrl; + wxTextCtrl* m_AliasDescCtrl; + wxStaticText* staticAliasKeywordsLabel; + wxTextCtrl* m_AliasKeywordsCtrl; wxPanel* m_PanelFootprintFilter; wxStaticText* m_staticTextFootprints; wxListBox* m_FootprintFilterListBox; - wxButton* m_buttonAddFpF; - wxButton* m_buttonEditOneFootprintFilter; - wxButton* m_ButtonDeleteOneFootprintFilter; - wxButton* m_ButtonDeleteAllFootprintFilter; + wxBitmapButton* m_addFilterButton; + wxBitmapButton* m_editFilterButton; + wxBitmapButton* m_deleteFilterButton; wxStdDialogButtonSizer* m_stdSizerButton; wxButton* m_stdSizerButtonOK; wxButton* m_stdSizerButtonCancel; // Virtual event handlers, overide them in your derived class - virtual void OnUpdateInterchangeableUnits( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void CopyDocFromRootToAlias( wxCommandEvent& event ) { event.Skip(); } - virtual void BrowseAndSelectDocFile( wxCommandEvent& event ) { event.Skip(); } - virtual void AddAliasOfPart( wxCommandEvent& event ) { event.Skip(); } - virtual void EditAliasOfPart( wxCommandEvent& event ) { event.Skip(); } - virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); } - virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); } - virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void EditOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); } + virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSelectAlias( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddAlias( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeleteAlias( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSizeAliasGrid( wxSizeEvent& event ) { event.Skip(); } + virtual void OnAliasNameKillFocus( wxFocusEvent& event ) { event.Skip(); } + virtual void OnAliasNameText( wxCommandEvent& event ) { event.Skip(); } + virtual void OnAddFootprintFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnEditFootprintFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void OnDeleteFootprintFilter( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 336dc62045..31496be49f 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -76,11 +76,11 @@ private: FIELDS_GRID_TABLE* m_fields; bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; bool Validate() override; // event handlers - void OnOKButtonClick( wxCommandEvent& event ) override; void UpdateFieldsFromLibrary( wxCommandEvent& event ) override; void OnAddField( wxCommandEvent& event ) override; void OnDeleteField( wxCommandEvent& event ) override; @@ -351,8 +351,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate() wxString msg; LIB_ID id; - // Commit any pending in-place edits and close the editor - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return false; if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) ) { @@ -401,14 +401,14 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate() m_libraryNameTextCtrl->SetValue( id.Format() ); // Check for missing field names. - for( int i = MANDATORY_FIELDS; i < (int) m_fields->size(); ++i ) + for( size_t i = MANDATORY_FIELDS; i < (int) m_fields->size(); ++i ) { SCH_FIELD& field = m_fields->at( i ); wxString fieldName = field.GetName( false ); if( fieldName.IsEmpty() ) { - DisplayErrorMessage( nullptr, _( "Fields must have a name." ) ); + DisplayErrorMessage( this, _( "Fields must have a name." ) ); m_delayedFocusColumn = FDC_NAME; m_delayedFocusRow = i; @@ -421,10 +421,10 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate() } -void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event ) +bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow() { if( !Validate() ) - return; + return false; // save old cmp in undo list if not already in edit, or moving ... // or the component to be edited is part of a block @@ -483,7 +483,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event // Remove any TEMPLATE_FIELDNAMES which were not set (given values). TEMPLATE_FIELDNAMES templateFieldnames = GetParent()->GetTemplateFieldNames(); - for( int i = MANDATORY_FIELDS; i < (int) m_fields->size(); ++i ) + for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i ) { SCH_FIELD& field = m_fields->at( i ); @@ -536,7 +536,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event GetParent()->OnModify(); GetParent()->GetScreen()->TestDanglingEnds(); - EndQuasiModal( wxID_OK ); + return true; } @@ -558,6 +558,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int fieldID = m_fields->size(); SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp ); @@ -573,50 +576,50 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event ) m_grid->MakeCellVisible( m_fields->size() - 1, 0 ); m_grid->SetGridCursor( m_fields->size() - 1, 0 ); - m_grid->EnableCellEditControl( true ); + m_grid->EnableCellEditControl(); m_grid->ShowCellEditControl(); } void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnDeleteField( wxCommandEvent& event ) { - int rowCount = m_grid->GetNumberRows(); - int curRow = m_grid->GetGridCursorRow(); + int curRow = m_grid->GetGridCursorRow(); - if( curRow < 0 || curRow >= (int) m_fields->size() ) + if( curRow < 0 ) return; - - if( curRow < MANDATORY_FIELDS ) + else if( curRow < MANDATORY_FIELDS ) { - DisplayError( nullptr, wxString::Format( _( "The first %d fields are mandatory." ), - MANDATORY_FIELDS ) ); + DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ), + MANDATORY_FIELDS ) ); return; } - SCH_FIELDS::iterator start = m_fields->begin() + curRow; - m_fields->erase( start, start + 1 ); + m_grid->CommitPendingChanges( true /* quiet mode */ ); + + m_fields->erase( m_fields->begin() + curRow ); // notify the grid wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 ); m_grid->ProcessTableMessage( msg ); - if( curRow == rowCount - 1 ) + if( m_grid->GetNumberRows() > 0 ) { - m_grid->MakeCellVisible( curRow-1, m_grid->GetGridCursorCol() ); - m_grid->SetGridCursor( curRow-1, m_grid->GetGridCursorCol() ); + m_grid->MakeCellVisible( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); + m_grid->SetGridCursor( std::max( 0, curRow-1 ), m_grid->GetGridCursorCol() ); } } void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveUp( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int i = m_grid->GetGridCursorRow(); - m_grid->DisableCellEditControl(); - - if( i > MANDATORY_FIELDS && i < (int) m_fields->size() ) + if( i > MANDATORY_FIELDS ) { - SCH_FIELD tmp = m_fields->at( i ); + SCH_FIELD tmp = m_fields->at( (unsigned) i ); m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); m_fields->insert( m_fields->begin() + i - 1, tmp ); m_grid->ForceRefresh(); @@ -631,13 +634,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveUp( wxCommandEvent& event ) void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveDown( wxCommandEvent& event ) { + if( !m_grid->CommitPendingChanges() ) + return; + int i = m_grid->GetGridCursorRow(); - m_grid->DisableCellEditControl(); - - if( i >= MANDATORY_FIELDS && i < (int) m_fields->size() - 1 ) + if( i >= MANDATORY_FIELDS ) { - SCH_FIELD tmp = m_fields->at( i ); + SCH_FIELD tmp = m_fields->at( (unsigned) i ); m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); m_fields->insert( m_fields->begin() + i + 1, tmp ); m_grid->ForceRefresh(); @@ -652,16 +656,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnMoveDown( wxCommandEvent& event ) void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent& event ) { - m_grid->DisableCellEditControl(); + if( !m_grid->CommitPendingChanges() ) + return; SCH_COMPONENT copy( *m_cmp ); copy.SetFields( *m_fields ); + // Update the requested fields in the component copy std::list components; components.push_back( © ); InvokeDialogUpdateFields( GetParent(), components, false ); - // Copy fields from the modified component copy to the dialog buffer + // Copy fields from the component copy to the dialog buffer m_fields->clear(); std::set defined; diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp index 401ed34cfd..949a2b0b5a 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -130,10 +130,10 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE m_libraryNameTextCtrl = new wxTextCtrl( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_libraryNameTextCtrl->SetToolTip( _("Name of the symbol in the library to which this symbol is linked") ); - bLibraryReferenceSizer->Add( m_libraryNameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + bLibraryReferenceSizer->Add( m_libraryNameTextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); m_buttonBrowseLibrary = new wxBitmapButton( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonBrowseLibrary->SetMinSize( wxSize( 29,29 ) ); + m_buttonBrowseLibrary->SetMinSize( wxSize( 30,29 ) ); bLibraryReferenceSizer->Add( m_buttonBrowseLibrary, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -142,14 +142,14 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE m_unitLabel = new wxStaticText( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Unit:"), wxDefaultPosition, wxDefaultSize, 0 ); m_unitLabel->Wrap( -1 ); - fgSizer1->Add( m_unitLabel, 0, wxBOTTOM|wxRIGHT, 5 ); + fgSizer1->Add( m_unitLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_unitChoiceChoices; m_unitChoice = new wxChoice( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_unitChoiceChoices, 0 ); m_unitChoice->SetSelection( 0 ); m_unitChoice->SetMinSize( wxSize( 100,-1 ) ); - fgSizer1->Add( m_unitChoice, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + fgSizer1->Add( m_unitChoice, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -157,10 +157,10 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE m_cbAlternateSymbol = new wxCheckBox( sbSizerLibraryReference->GetStaticBox(), wxID_ANY, _("Alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbAlternateSymbol->SetToolTip( _("Use the alternate shape of this symbol.\nFor gates, this is the \"De Morgan\" conversion") ); - fgSizer1->Add( m_cbAlternateSymbol, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + fgSizer1->Add( m_cbAlternateSymbol, 0, wxALL, 5 ); - sbSizerLibraryReference->Add( fgSizer1, 1, wxEXPAND, 5 ); + sbSizerLibraryReference->Add( fgSizer1, 0, wxEXPAND, 5 ); lowerSizer->Add( sbSizerLibraryReference, 5, wxEXPAND|wxRIGHT|wxLEFT, 10 ); @@ -243,7 +243,6 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE m_updateFieldValues->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFieldsFromLibrary ), NULL, this ); m_buttonBrowseLibrary->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnBrowseLibrary ), NULL, this ); m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnEditSpiceModel ), NULL, this ); - m_stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this ); } DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE() @@ -259,6 +258,5 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BAS m_updateFieldValues->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::UpdateFieldsFromLibrary ), NULL, this ); m_buttonBrowseLibrary->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnBrowseLibrary ), NULL, this ); m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnEditSpiceModel ), NULL, this ); - m_stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::OnOKButtonClick ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp index 216054da3e..35be9dac7a 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.fbp @@ -1,2094 +1,1920 @@ - - - - - ; - C++ - 1 - source_name - 0 - 0 - res - ANSI - connect - dialog_edit_component_in_schematic_base - 1000 - none - - 1 - dialog_edit_component_in_schematic_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE - - -1,-1 - wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU - DIALOG_SHIM; dialog_shim.h - Symbol Properties - - - - - - - - - - - - - - - - - - - - - - - - - - - OnInitDlg - - - - - - - - - - - - - - - - - - - - - - - - - - OnUpdateUI - - - mainSizer - wxVERTICAL - none - - 10 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 1 - - wxID_ANY - Fields - - sbFields - wxVERTICAL - 1 - none - - - 5 - wxEXPAND|wxBOTTOM - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Name" "Value" "Show" "H Align" "V Align" "Italic" "Bold" "Text Size" "Orientation" "X Position" "Y Position" - wxALIGN_CENTRE - 11 - 72,120,48,72,72,48,48,84,84,84,84 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - -1,180 - 1 - m_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 4 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - - - - wxBORDER_SIMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnSizeGrid - - - - - 10 - wxEXPAND - 0 - - - bButtonSize - wxHORIZONTAL - none - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Field - - 0 - - 0 - - - 0 - 30,30 - 1 - m_bpAdd - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnAddField - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Delete Field - - 0 - - 0 - - - 0 - 30,30 - 1 - m_bpDelete - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnDeleteField - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Up - - 0 - - 0 - - - 0 - 30,30 - 1 - m_bpMoveUp - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnMoveUp - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Down - - 0 - - 0 - - - 0 - 30,30 - 1 - m_bpMoveDown - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnMoveDown - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Update Fields from Library... - - 0 - - 0 - - - 0 - - 1 - m_updateFieldValues - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - Sets fields to the original library values - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - UpdateFieldsFromLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT - 0 - - - lowerSizer - wxHORIZONTAL - none - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 5 - - wxID_ANY - Symbol - - sbSizerLibraryReference - wxVERTICAL - 1 - none - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - 1 - - 0 - - fgSizer1 - wxFLEX_GROWMODE_SPECIFIED - none - 3 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Library Reference: - 0 - - 0 - - - 0 - - 1 - m_staticText3 - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT - 1 - - - bLibraryReferenceSizer - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_libraryNameTextCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Name of the symbol in the library to which this symbol is linked - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Browse Library - - 0 - - 0 - - - 0 - 29,29 - 1 - m_buttonBrowseLibrary - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnBrowseLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Unit: - 0 - - 0 - - - 0 - - 1 - m_unitLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - 100,-1 - 1 - m_unitChoice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Alternate symbol (DeMorgan) - - 0 - - - 0 - - 1 - m_cbAlternateSymbol - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Use the alternate shape of this symbol. For gates, this is the "De Morgan" conversion - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxEXPAND|wxRIGHT|wxLEFT - 2 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "0" "+90" "+180" "-90" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Orientation - 1 - - 0 - - - 0 - - 1 - m_rbOrientation - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - Select if the symbol is to be rotated when drawn - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxEXPAND|wxRIGHT|wxLEFT - 2 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Default" "Mirror around X axis " "Mirror around Y axis " - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Aspect - 1 - - 0 - - - 0 - - 1 - m_rbMirror - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Pick the graphical transformation to be used when displaying the symbol - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; forward_declare - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizer101 - wxHORIZONTAL - none - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - - bSizer11 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Unique ID: - 0 - - 0 - - - 0 - - 1 - timeStampLabel - 1 - - - none - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_textCtrlTimeStamp - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - - 0 - Unique ID that identifies the symbol - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Edit Spice Model... - - 0 - - 0 - - - 0 - - 1 - m_spiceFieldsButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnEditSpiceModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_stdDialogButtonSizer - protected - - - - - - OnOKButtonClick - - - - - - - - - - + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + ANSI + connect + dialog_edit_component_in_schematic_base + 1000 + none + 1 + dialog_edit_component_in_schematic_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE + + -1,-1 + wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU + DIALOG_SHIM; dialog_shim.h + Symbol Properties + + + + + + + + + + + + + + + + + + + + OnInitDlg + + + + + + + + + + + + + + + + + + + + OnUpdateUI + + + mainSizer + wxVERTICAL + none + + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + wxID_ANY + Fields + + sbFields + wxVERTICAL + 1 + none + + + 5 + wxEXPAND|wxBOTTOM + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 22 + "Name" "Value" "Show" "H Align" "V Align" "Italic" "Bold" "Text Size" "Orientation" "X Position" "Y Position" + wxALIGN_CENTRE + 11 + 72,120,48,72,72,48,48,84,84,84,84 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + -1,180 + 1 + m_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 0 + + wxALIGN_CENTRE + + 4 + 1 + + WX_GRID; widgets/wx_grid.h; forward_declare + 0 + + + + wxBORDER_SIMPLE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnSizeGrid + + + + + 10 + wxEXPAND + 0 + + + bButtonSize + wxHORIZONTAL + none + + 5 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Add Field + + 0 + + + 0 + 30,30 + 1 + m_bpAdd + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddField + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Delete Field + + 0 + + + 0 + 30,30 + 1 + m_bpDelete + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteField + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Up + + 0 + + + 0 + 30,30 + 1 + m_bpMoveUp + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveUp + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Move Down + + 0 + + + 0 + 30,30 + 1 + m_bpMoveDown + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnMoveDown + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Update Fields from Library... + + 0 + + + 0 + + 1 + m_updateFieldValues + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Sets fields to the original library values + + wxFILTER_NONE + wxDefaultValidator + + + + + UpdateFieldsFromLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT + 0 + + + lowerSizer + wxHORIZONTAL + none + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 5 + + wxID_ANY + Symbol + + sbSizerLibraryReference + wxVERTICAL + 1 + none + + + 5 + wxEXPAND + 0 + + 2 + wxBOTH + 1 + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Library Reference: + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT + 1 + + + bLibraryReferenceSizer + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_libraryNameTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Name of the symbol in the library to which this symbol is linked + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + + wxID_ANY + Browse Library + + 0 + + + 0 + 30,29 + 1 + m_buttonBrowseLibrary + 1 + + + protected + 1 + + Resizable + + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnBrowseLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Unit: + + 0 + + + 0 + + 1 + m_unitLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 100,-1 + 1 + m_unitChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Alternate symbol (DeMorgan) + + 0 + + + 0 + + 1 + m_cbAlternateSymbol + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Use the alternate shape of this symbol. For gates, this is the "De Morgan" conversion + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxEXPAND|wxRIGHT|wxLEFT + 2 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "0" "+90" "+180" "-90" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Orientation + 1 + + 0 + + + 0 + + 1 + m_rbOrientation + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + Select if the symbol is to be rotated when drawn + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxEXPAND|wxRIGHT|wxLEFT + 2 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Default" "Mirror around X axis " "Mirror around Y axis " + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Aspect + 1 + + 0 + + + 0 + + 1 + m_rbMirror + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + Pick the graphical transformation to be used when displaying the symbol + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; forward_declare + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer101 + wxHORIZONTAL + none + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bSizer11 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Unique ID: + + 0 + + + 0 + + 1 + timeStampLabel + 1 + + + none + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlTimeStamp + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + + 0 + Unique ID that identifies the symbol + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Spice Model... + + 0 + + + 0 + + 1 + m_spiceFieldsButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnEditSpiceModel + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_stdDialogButtonSizer + protected + + + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_base.h b/eeschema/dialogs/dialog_edit_component_in_schematic_base.h index 53ae435bd3..7380ea341c 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -20,10 +20,10 @@ class WX_GRID; #include #include #include -#include #include #include #include +#include #include #include #include @@ -78,7 +78,6 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE : public DIALOG_SHIM virtual void UpdateFieldsFromLibrary( wxCommandEvent& event ) { event.Skip(); } virtual void OnBrowseLibrary( wxCommandEvent& event ) { event.Skip(); } virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp deleted file mode 100644 index 198b649055..0000000000 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2011-2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2007-2018 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 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef KICAD_SPICE -#include -#include -#endif /* KICAD_SPICE */ - - -#define LibEditFieldsShownColumnsKey wxT( "LibEditFieldsShownColumns" ) - - - -class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE -{ -public: - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( LIB_EDIT_FRAME* aParent, LIB_PART* aLibEntry ); - ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB() override; - -private: - wxConfigBase* m_config; - - LIB_EDIT_FRAME* m_parent; - LIB_PART* m_libEntry; - - FIELDS_GRID_TABLE* m_fields; - - int m_delayedFocusRow; - int m_delayedFocusColumn; - wxString m_shownColumns; - - bool TransferDataToWindow() override; - - bool Validate() override; - - // event handlers: - void OnOKButtonClick( wxCommandEvent& event ) override; - void OnAddField( wxCommandEvent& event ) override; - void OnDeleteField( wxCommandEvent& event ) override; - void OnMoveUp( wxCommandEvent& event ) override; - void OnMoveDown( wxCommandEvent& event ) override; - void OnEditSpiceModel( wxCommandEvent& event ) override; - void OnSizeGrid( wxSizeEvent& event ) override; - void OnGridCellChanging( wxGridEvent& event ); - void OnUpdateUI( wxUpdateUIEvent& event ) override; - - void AdjustGridColumns( int aWidth ); -}; - - -void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event ) -{ - if( !GetCurPart() ) - return; - - m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); - - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, GetCurPart() ); - - if( GetDrawItem() && GetDrawItem()->Type() == LIB_FIELD_T ) - SetDrawItem( nullptr ); // selected LIB_FIELD might be deleted - - // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal - // frame. Therefore this dialog as a modal frame parent, MUST be run under - // quasimodal mode for the quasimodal frame support to work. So don't use - // the QUASIMODAL macros here. - if( dlg.ShowQuasiModal() != wxID_OK ) - return; - - UpdateAliasSelectList(); - UpdatePartSelectList(); - DisplayLibInfos(); - Refresh(); -} - - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( LIB_EDIT_FRAME* aParent, - LIB_PART* aLibEntry ) : - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent ) -{ - m_config = Kiface().KifaceSettings(); - - m_parent = aParent; - m_libEntry = aLibEntry; - m_fields = new FIELDS_GRID_TABLE( this, aParent, m_libEntry ); - - m_delayedFocusRow = REFERENCE; - m_delayedFocusColumn = FDC_VALUE; - -#ifndef KICAD_SPICE - m_spiceFieldsButton->Hide(); -#endif - - // Give a bit more room for combobox editors - m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 2 ); - - m_grid->SetTable( m_fields ); - m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) ); - - stdDialogButtonSizerOK->SetDefault(); - - // Configure button logos - m_bpAdd->SetBitmap( KiBitmap( small_plus_xpm ) ); - m_bpDelete->SetBitmap( KiBitmap( trash_xpm ) ); - m_bpMoveUp->SetBitmap( KiBitmap( small_up_xpm ) ); - m_bpMoveDown->SetBitmap( KiBitmap( small_down_xpm ) ); - - // wxFormBuilder doesn't include this event... - m_grid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnGridCellChanging ), NULL, this ); - - FinishDialogSettings(); -} - - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB() -{ - m_config->Write( LibEditFieldsShownColumnsKey, m_grid->GetShownColumns() ); - - // Prevents crash bug in wxGrid's d'tor - m_grid->DestroyTable( m_fields ); - - m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnGridCellChanging ), NULL, this ); - - // Delete the GRID_TRICKS. - m_grid->PopEventHandler( true ); -} - - -bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::TransferDataToWindow() -{ - if( !wxDialog::TransferDataToWindow() ) - return false; - - // Push a copy of each field into m_fields - m_libEntry->GetFields( *m_fields ); - - // The Y axis for components in lib is from bottom to top while the screen axis is top - // to bottom: we must change the y coord sign for editing - for( size_t i = 0; i < m_fields->size(); ++i ) - { - wxPoint pos = m_fields->at( i ).GetPosition(); - pos.y = -pos.y; - m_fields->at( i ).SetPosition( pos ); - } - - // notify the grid - wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() ); - m_grid->ProcessTableMessage( msg ); - - // Show/hide columns according to the user's preference - m_config->Read( LibEditFieldsShownColumnsKey, &m_shownColumns, wxT( "0 1 2 3 4 5 6 7" ) ); - m_grid->ShowHideColumns( m_shownColumns ); - - Layout(); - - return true; -} - - -bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::Validate() -{ - // Commit any pending in-place edits and close the editor - m_grid->DisableCellEditControl(); - - if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) ) - { - DisplayErrorMessage( nullptr, _( "References must start with a letter." ) ); - - m_delayedFocusColumn = FDC_VALUE; - m_delayedFocusRow = REFERENCE; - - return false; - } - - // Check for missing field names. - for( size_t i = MANDATORY_FIELDS; i < m_fields->size(); ++i ) - { - LIB_FIELD& field = m_fields->at( i ); - wxString fieldName = field.GetName( false ); - - if( fieldName.IsEmpty() ) - { - DisplayErrorMessage( nullptr, _( "Fields must have a name." ) ); - - m_delayedFocusColumn = FDC_NAME; - m_delayedFocusRow = i; - - return false; - } - } - - return true; -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ) -{ - if( !Validate() ) - return; - - // save old cmp in undo list - m_parent->SaveCopyInUndoList( m_libEntry ); - - // The Y axis for components in lib is from bottom to top while the screen axis is top - // to bottom: we must change the y coord sign when writing back to the library - for( size_t i = 0; i < m_fields->size(); ++i ) - { - wxPoint pos = m_fields->at( i ).GetPosition(); - pos.y = -pos.y; - m_fields->at( i ).SetPosition( pos ); - } - - m_libEntry->SetFields( *m_fields ); - - // We need to keep the name and the value the same at the moment! - SetName( m_libEntry->GetValueField().GetText() ); - - m_parent->OnModify(); - - EndQuasiModal( wxID_OK ); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnEditSpiceModel( wxCommandEvent& event ) -{ -#ifdef KICAD_SPICE - // DIALOG_SPICE_MODEL expects a SCH_COMPONENT, - // and a list of SCH_FIELDS to create/edit/delete Spice fields. - SCH_COMPONENT component; // This dummy component - - // Build fields list from the m_FieldsBuf fields buffer dialog - // to be sure to use the current fields. - SCH_FIELDS schFields; - - for( unsigned ii = 0; ii < m_fields->size(); ++ii ) - { - LIB_FIELD& libField = m_fields->at( ii ); - SCH_FIELD schField( libField.GetTextPos(), libField.GetId(), - &component, libField.GetName() ); - schField.ImportValues( m_fields->at( ii ) ); - schField.SetText( m_fields->at( ii ).GetText() ); - - schFields.push_back( schField ); - } - - component.SetFields( schFields ); - int diff = schFields.size(); - - DIALOG_SPICE_MODEL dialog( this, component, schFields ); - - if( dialog.ShowModal() != wxID_OK ) - return; - - // Transfer sch fields to the m_FieldsBuf fields buffer dialog: - m_fields->clear(); - - for( auto& schField : schFields ) - { - LIB_FIELD libField; - schField.ExportValues( libField ); - m_fields->push_back( libField ); - } - - diff = m_fields->size() - diff; - - if( diff > 0 ) - { - wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, diff ); - m_grid->ProcessTableMessage( msg ); - } - else if( diff < 0 ) - { - wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, diff ); - m_grid->ProcessTableMessage( msg ); - } - - m_grid->ForceRefresh(); -#endif /* KICAD_SPICE */ -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnGridCellChanging( wxGridEvent& event ) -{ - wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() ); - wxControl* control = editor->GetControl(); - - if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) ) - { - event.Veto(); - m_delayedFocusRow = event.GetRow(); - m_delayedFocusColumn = event.GetCol(); - } - - editor->DecRef(); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnAddField( wxCommandEvent& event ) -{ - int fieldID = m_fields->size(); - LIB_FIELD& refField = m_fields->at( REFERENCE ); - LIB_FIELD newField( fieldID ); - - newField.SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) ); - - // Give new fields a slight offset so they don't all end up on top of each other - newField.SetPosition( refField.GetTextPos() - + wxPoint( (fieldID - MANDATORY_FIELDS + 1) * 100, - (fieldID - MANDATORY_FIELDS + 1) * 100 ) ); - - newField.SetTextAngle( refField.GetTextAngle() ); - - m_fields->push_back( newField ); - - // notify the grid - wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 ); - m_grid->ProcessTableMessage( msg ); - - m_grid->MakeCellVisible( m_fields->size() - 1, 0 ); - m_grid->SetGridCursor( m_fields->size() - 1, 0 ); - - m_grid->EnableCellEditControl( true ); - m_grid->ShowCellEditControl(); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnDeleteField( wxCommandEvent& event ) -{ - int rowCount = m_grid->GetNumberRows(); - int curRow = m_grid->GetGridCursorRow(); - - if( curRow < 0 || curRow >= (int) m_fields->size() ) - return; - - if( curRow < MANDATORY_FIELDS ) - { - DisplayError( nullptr, wxString::Format( _( "The first %d fields are mandatory." ), - MANDATORY_FIELDS ) ); - return; - } - - auto start = m_fields->begin() + curRow; - m_fields->erase( start, start + 1 ); - - // notify the grid - wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, curRow, 1 ); - m_grid->ProcessTableMessage( msg ); - - if( curRow == rowCount - 1 ) - { - m_grid->MakeCellVisible( curRow-1, m_grid->GetGridCursorCol() ); - m_grid->SetGridCursor( curRow-1, m_grid->GetGridCursorCol() ); - } -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnMoveUp( wxCommandEvent& event ) -{ - int i = m_grid->GetGridCursorRow(); - - m_grid->DisableCellEditControl(); - - if( i > MANDATORY_FIELDS && i < (int) m_fields->size() ) - { - LIB_FIELD tmp = m_fields->at( i ); - m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); - m_fields->insert( m_fields->begin() + i - 1, tmp ); - m_grid->ForceRefresh(); - - m_grid->SetGridCursor( i - 1, m_grid->GetGridCursorCol() ); - m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() ); - } - else - wxBell(); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnMoveDown( wxCommandEvent& event ) -{ - int i = m_grid->GetGridCursorRow(); - - m_grid->DisableCellEditControl(); - - if( i >= MANDATORY_FIELDS && i < (int) m_fields->size() - 1 ) - { - LIB_FIELD tmp = m_fields->at( i ); - m_fields->erase( m_fields->begin() + i, m_fields->begin() + i + 1 ); - m_fields->insert( m_fields->begin() + i + 1, tmp ); - m_grid->ForceRefresh(); - - m_grid->SetGridCursor( i + 1, m_grid->GetGridCursorCol() ); - m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() ); - } - else - wxBell(); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::AdjustGridColumns( int aWidth ) -{ - // Account for scroll bars - aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x ); - - m_grid->AutoSizeColumn( 0 ); - - int fixedColsWidth = m_grid->GetColSize( 0 ); - - for( int i = 2; i < m_grid->GetNumberCols(); i++ ) - fixedColsWidth += m_grid->GetColSize( i ); - - m_grid->SetColSize( 1, aWidth - fixedColsWidth ); -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnUpdateUI( wxUpdateUIEvent& event ) -{ - wxString shownColumns = m_grid->GetShownColumns(); - - if( shownColumns != m_shownColumns ) - { - m_shownColumns = shownColumns; - - if( !m_grid->IsCellEditControlShown() ) - AdjustGridColumns( m_grid->GetRect().GetWidth() ); - } - - // Handle a delayed focus - if( m_delayedFocusRow >= 0 ) - { - m_grid->SetFocus(); - m_grid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn ); - m_grid->SetGridCursor( m_delayedFocusRow, m_delayedFocusColumn ); - - m_grid->EnableCellEditControl( true ); - m_grid->ShowCellEditControl(); - - m_delayedFocusRow = -1; - m_delayedFocusColumn = -1; - } -} - - -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnSizeGrid( wxSizeEvent& event ) -{ - AdjustGridColumns( event.GetSize().GetX() ); - - event.Skip(); -} diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp deleted file mode 100644 index 148ea3a81f..0000000000 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "widgets/wx_grid.h" - -#include "dialog_edit_libentry_fields_in_lib_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* mainSizer; - mainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerFieldsSetup; - bSizerFieldsSetup = new wxBoxSizer( wxVERTICAL ); - - m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE ); - - // Grid - m_grid->CreateGrid( 4, 11 ); - m_grid->EnableEditing( true ); - m_grid->EnableGridLines( true ); - m_grid->EnableDragGridSize( false ); - m_grid->SetMargins( 0, 0 ); - - // Columns - m_grid->SetColSize( 0, 72 ); - m_grid->SetColSize( 1, 120 ); - m_grid->SetColSize( 2, 48 ); - m_grid->SetColSize( 3, 72 ); - m_grid->SetColSize( 4, 72 ); - m_grid->SetColSize( 5, 48 ); - m_grid->SetColSize( 6, 48 ); - m_grid->SetColSize( 7, 84 ); - m_grid->SetColSize( 8, 84 ); - m_grid->SetColSize( 9, 84 ); - m_grid->SetColSize( 10, 84 ); - m_grid->EnableDragColMove( false ); - m_grid->EnableDragColSize( true ); - m_grid->SetColLabelSize( 22 ); - m_grid->SetColLabelValue( 0, _("Name") ); - m_grid->SetColLabelValue( 1, _("Value") ); - m_grid->SetColLabelValue( 2, _("Show") ); - m_grid->SetColLabelValue( 3, _("H Align") ); - m_grid->SetColLabelValue( 4, _("V Align") ); - m_grid->SetColLabelValue( 5, _("Italic") ); - m_grid->SetColLabelValue( 6, _("Bold") ); - m_grid->SetColLabelValue( 7, _("Text Size") ); - m_grid->SetColLabelValue( 8, _("Orientation") ); - m_grid->SetColLabelValue( 9, _("X Position") ); - m_grid->SetColLabelValue( 10, _("Y Position") ); - m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_grid->EnableDragRowSize( true ); - m_grid->SetRowLabelSize( 0 ); - m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - m_grid->SetMinSize( wxSize( -1,180 ) ); - - bSizerFieldsSetup->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* bButtonSize; - bButtonSize = new wxBoxSizer( wxHORIZONTAL ); - - m_bpAdd = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bpAdd->SetMinSize( wxSize( 30,29 ) ); - - bButtonSize->Add( m_bpAdd, 0, wxRIGHT, 5 ); - - m_bpDelete = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bpDelete->SetMinSize( wxSize( 30,29 ) ); - - bButtonSize->Add( m_bpDelete, 0, wxRIGHT, 10 ); - - m_bpMoveUp = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bpMoveUp->SetMinSize( wxSize( 30,29 ) ); - - bButtonSize->Add( m_bpMoveUp, 0, wxLEFT, 10 ); - - m_bpMoveDown = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bpMoveDown->SetMinSize( wxSize( 30,29 ) ); - - bButtonSize->Add( m_bpMoveDown, 0, wxRIGHT|wxLEFT, 5 ); - - - bButtonSize->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizerFieldsSetup->Add( bButtonSize, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - - mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 ); - - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizerButtons; - bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); - - - bSizerButtons->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_spiceFieldsButton = new wxButton( this, wxID_ANY, _(" Edit Spice Model... "), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButtons->Add( m_spiceFieldsButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizerButtons->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - stdDialogButtonSizer = new wxStdDialogButtonSizer(); - stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); - stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); - stdDialogButtonSizer->Realize(); - - bSizerButtons->Add( stdDialogButtonSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 6 ); - - - mainSizer->Add( bSizerButtons, 0, wxEXPAND, 5 ); - - - this->SetSizer( mainSizer ); - this->Layout(); - mainSizer->Fit( this ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) ); - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); - this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnUpdateUI ) ); - m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeGrid ), NULL, this ); - m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnAddField ), NULL, this ); - m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnDeleteField ), NULL, this ); - m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveUp ), NULL, this ); - m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveDown ), NULL, this ); - m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnEditSpiceModel ), NULL, this ); - stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); -} - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) ); - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); - this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnUpdateUI ) ); - m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnSizeGrid ), NULL, this ); - m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnAddField ), NULL, this ); - m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnDeleteField ), NULL, this ); - m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveUp ), NULL, this ); - m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnMoveDown ), NULL, this ); - m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnEditSpiceModel ), NULL, this ); - stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp deleted file mode 100644 index ad079334fa..0000000000 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp +++ /dev/null @@ -1,955 +0,0 @@ - - - - - ; - C++ - 1 - source_name - 0 - 0 - res - ANSI - connect - dialog_edit_libentry_fields_in_lib_base - 1000 - none - - 1 - DialogEditLibentryFields_in_lib_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE - - -1,-1 - wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU - DIALOG_SHIM; dialog_shim.h - Symbol Fields - - - - - - - - - - - - - - - - - - - - - OnCloseDialog - - - - - - OnInitDialog - - - - - - - - - - - - - - - - - - - - - - - - - - OnUpdateUI - - - mainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - bSizerFieldsSetup - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 22 - "Name" "Value" "Show" "H Align" "V Align" "Italic" "Bold" "Text Size" "Orientation" "X Position" "Y Position" - wxALIGN_CENTRE - 11 - 72,120,48,72,72,48,48,84,84,84,84 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - -1,180 - 1 - m_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 4 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - - - - wxBORDER_SIMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnSizeGrid - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - - bButtonSize - wxHORIZONTAL - none - - 5 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Add Field - - 0 - - 0 - - - 0 - 30,29 - 1 - m_bpAdd - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnAddField - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Delete Field - - 0 - - 0 - - - 0 - 30,29 - 1 - m_bpDelete - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnDeleteField - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Up - - 0 - - 0 - - - 0 - 30,29 - 1 - m_bpMoveUp - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnMoveUp - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Move Down - - 0 - - 0 - - - 0 - 30,29 - 1 - m_bpMoveDown - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnMoveDown - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerButtons - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Edit Spice Model... - - 0 - - 0 - - - 0 - - 1 - m_spiceFieldsButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - OnEditSpiceModel - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - protected - 0 - - - - 6 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - stdDialogButtonSizer - protected - - OnCancelButtonClick - - - - OnOKButtonClick - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h deleted file mode 100644 index d4204dec9f..0000000000 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ -#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ - -#include -#include -#include -class WX_GRID; - -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM -{ - private: - - protected: - WX_GRID* m_grid; - wxBitmapButton* m_bpAdd; - wxBitmapButton* m_bpDelete; - wxBitmapButton* m_bpMoveUp; - wxBitmapButton* m_bpMoveDown; - wxStaticLine* m_staticline1; - wxButton* m_spiceFieldsButton; - wxStdDialogButtonSizer* stdDialogButtonSizer; - wxButton* stdDialogButtonSizerOK; - wxButton* stdDialogButtonSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } - virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } - virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void OnSizeGrid( wxSizeEvent& event ) { event.Skip(); } - virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); } - virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); } - virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Symbol Fields"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); - ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); - -}; - -#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index 645c964f0e..07bdc73f20 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -229,7 +229,6 @@ enum id_eeschema_frm ID_LIBEDIT_VIEW_DOC, ID_LIBEDIT_CHECK_PART, ID_LIBEDIT_GET_FRAME_EDIT_PART, - ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, ID_LIBEDIT_SELECT_PART_NUMBER, ID_LIBEDIT_SELECT_ALIAS, diff --git a/eeschema/lib_edit_frame.cpp b/eeschema/lib_edit_frame.cpp index 2ed40b7090..99f240c8ac 100644 --- a/eeschema/lib_edit_frame.cpp +++ b/eeschema/lib_edit_frame.cpp @@ -67,7 +67,6 @@ #include -wxString LIB_EDIT_FRAME:: m_aliasName; int LIB_EDIT_FRAME:: m_unit = 1; int LIB_EDIT_FRAME:: m_convert = 1; LIB_ITEM* LIB_EDIT_FRAME::m_lastDrawItem = NULL; @@ -113,7 +112,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( wxID_UNDO, LIB_EDIT_FRAME::GetComponentFromUndoList ) EVT_TOOL( wxID_REDO, LIB_EDIT_FRAME::GetComponentFromRedoList ) EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_PART, LIB_EDIT_FRAME::OnEditComponentProperties ) - EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, LIB_EDIT_FRAME::InstallFieldsEditorDialog ) EVT_TOOL( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnCheckComponent ) EVT_TOOL( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle ) EVT_TOOL( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle ) @@ -122,7 +120,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( ID_LIBEDIT_EDIT_PIN_BY_TABLE, LIB_EDIT_FRAME::OnOpenPinTable ) EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectPart ) - EVT_COMBOBOX( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnSelectAlias ) // Right vertical toolbar. EVT_TOOL( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnSelectTool ) @@ -171,16 +168,13 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_UPDATE_UI( ID_LIBEDIT_SAVE, LIB_EDIT_FRAME::OnUpdateSave ) EVT_UPDATE_UI( ID_LIBEDIT_SAVE_AS, LIB_EDIT_FRAME::OnUpdateSaveAs ) EVT_UPDATE_UI( ID_LIBEDIT_REVERT, LIB_EDIT_FRAME::OnUpdateRevert ) - EVT_UPDATE_UI( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, LIB_EDIT_FRAME::OnUpdateEditingPart ) EVT_UPDATE_UI( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnUpdateEditingPart ) EVT_UPDATE_UI( ID_LIBEDIT_GET_FRAME_EDIT_PART, LIB_EDIT_FRAME::OnUpdateEditingPart ) EVT_UPDATE_UI( wxID_UNDO, LIB_EDIT_FRAME::OnUpdateUndo ) EVT_UPDATE_UI( wxID_REDO, LIB_EDIT_FRAME::OnUpdateRedo ) - EVT_UPDATE_UI( ID_LIBEDIT_VIEW_DOC, LIB_EDIT_FRAME::OnUpdateViewDoc ) EVT_UPDATE_UI( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnUpdateSyncPinEdit ) EVT_UPDATE_UI( ID_LIBEDIT_EDIT_PIN_BY_TABLE, LIB_EDIT_FRAME::OnUpdatePinTable ) EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnUpdatePartNumber ) - EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS, LIB_EDIT_FRAME::OnUpdateSelectAlias ) EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal ) EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert ) EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnUpdateSelectTool ) @@ -251,29 +245,10 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); - - // Ensure the current alias name is valid if a part is loaded - // Sometimes it is not valid. This is the case when a part value (the part lib name), or - // the alias list was modified during a previous session and the modifications not saved - // in lib. Reopen libedit in a new session gives a non valid m_aliasName because the curr - // part is reloaded from the library (and this is the unmodified part) and the old alias - // name (from the previous session) can be invalid - LIB_PART* part = GetCurPart(); - - if( part == NULL ) - m_aliasName.Empty(); - else if( m_aliasName != part->GetName() ) - { - LIB_ALIAS* alias = part->GetAlias( m_aliasName ); - - if( !alias ) - m_aliasName = part->GetName(); - } - ReCreateOptToolbar(); + DisplayLibInfos(); DisplayCmpDoc(); - UpdateAliasSelectList(); UpdatePartSelectList(); m_auimgr.SetManagedWindow( this ); @@ -356,28 +331,6 @@ double LIB_EDIT_FRAME::BestZoom() } -void LIB_EDIT_FRAME::UpdateAliasSelectList() -{ - if( m_aliasSelectBox == NULL ) - return; - - m_aliasSelectBox->Clear(); - - LIB_PART* part = GetCurPart(); - - if( !part ) - return; - - m_aliasSelectBox->Append( part->GetAliasNames() ); - m_aliasSelectBox->SetSelection( 0 ); - - int index = m_aliasSelectBox->FindString( m_aliasName ); - - if( index != wxNOT_FOUND ) - m_aliasSelectBox->SetSelection( index ); -} - - void LIB_EDIT_FRAME::UpdatePartSelectList() { if( m_partSelectBox == NULL ) @@ -544,27 +497,6 @@ void LIB_EDIT_FRAME::OnUpdateRedo( wxUpdateUIEvent& event ) } -void LIB_EDIT_FRAME::OnUpdateViewDoc( wxUpdateUIEvent& event ) -{ - bool enable = false; - - LIB_PART* part = GetCurPart(); - - if( part ) - { - LIB_ALIAS* alias = part->GetAlias( m_aliasName ); - - wxCHECK_RET( alias != NULL, - wxString::Format( "Alias \"%s\" not found in symbol \"%s\".", - m_aliasName, part->GetName() ) ); - - enable = !alias->GetDocFileName().IsEmpty(); - } - - event.Enable( enable ); -} - - void LIB_EDIT_FRAME::OnUpdateSyncPinEdit( wxUpdateUIEvent& event ) { LIB_PART* part = GetCurPart(); @@ -617,33 +549,6 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event ) } -void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event ) -{ - if( m_aliasSelectBox == NULL ) - return; - - LIB_PART* part = GetCurPart(); - - // Using the typical event.Enable() call doesn't seem to work with wxGTK - // so use the pointer to alias combobox to directly enable or disable. - m_aliasSelectBox->Enable( part && part->GetAliasCount() > 1 ); -} - - -void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event ) -{ - if( m_aliasSelectBox == NULL - || ( m_aliasSelectBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) ) - return; - - m_lastDrawItem = NULL; - m_aliasName = m_aliasSelectBox->GetStringSelection(); - - DisplayCmpDoc(); - m_canvas->Refresh(); -} - - void LIB_EDIT_FRAME::OnSelectPart( wxCommandEvent& event ) { int i = event.GetSelection(); @@ -666,9 +571,9 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event ) return; wxString fileName; - LIB_ALIAS* alias = part->GetAlias( m_aliasName ); - wxCHECK_RET( alias != NULL, "Alias not found." ); + // TODO: it would be nice to offer a menu here of aliases.... + LIB_ALIAS* alias = part->GetAlias( part->GetName() ); fileName = alias->GetDocFileName(); @@ -1090,9 +995,18 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event ) bool partLocked = GetCurPart()->UnitsLocked(); wxString oldName = GetCurPart()->GetName(); - DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this ); + m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); - if( dlg.ShowModal() == wxID_CANCEL ) + if( GetDrawItem() && GetDrawItem()->Type() == LIB_FIELD_T ) + SetDrawItem( nullptr ); // selected LIB_FIELD might be deleted + + DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this, GetCurPart() ); + + // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal + // frame. Therefore this dialog as a modal frame parent, MUST be run under + // quasimodal mode for the quasimodal frame support to work. So don't use + // the QUASIMODAL macros here. + if( dlg.ShowQuasiModal() != wxID_OK ) return; // if m_UnitSelectionLocked has changed, set some edit options or defaults @@ -1104,7 +1018,7 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event ) // also set default edit options to the better value // Usually if units are locked, graphic items are specific to each unit // and if units are interchangeable, graphic items are common to units - m_drawSpecificUnit = GetCurPart()->UnitsLocked() ? true : false; + m_drawSpecificUnit = GetCurPart()->UnitsLocked(); } if( oldName != GetCurPart()->GetName() ) @@ -1112,7 +1026,6 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event ) m_libMgr->UpdatePart( GetCurPart(), GetCurLib() ); - UpdateAliasSelectList(); UpdatePartSelectList(); DisplayLibInfos(); DisplayCmpDoc(); @@ -1696,7 +1609,6 @@ void LIB_EDIT_FRAME::emptyScreen() { SetCurLib( wxEmptyString ); SetCurPart( nullptr ); - m_aliasName.Empty(); m_lastDrawItem = nullptr; SetDrawItem( NULL ); SetScreen( m_dummyScreen ); diff --git a/eeschema/lib_edit_frame.h b/eeschema/lib_edit_frame.h index 800dbafe0d..b23cd0fac0 100644 --- a/eeschema/lib_edit_frame.h +++ b/eeschema/lib_edit_frame.h @@ -59,7 +59,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME LIB_PART* m_tempCopyComponent; ///< temp copy of a part during edit, I own it here. LIB_COLLECTOR m_collectedItems; ///< Used for hit testing. wxComboBox* m_partSelectBox; ///< a Box to select a part to edit (if any) - wxComboBox* m_aliasSelectBox; ///< a box to select the alias to edit (if any) SYMBOL_TREE_PANE* m_treePane; ///< component search tree widget LIB_MANAGER* m_libMgr; ///< manager taking care of temporary modificatoins @@ -107,7 +106,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME static int m_drawLineWidth; static LIB_ITEM* m_lastDrawItem; - static wxString m_aliasName; // The unit number to edit and show static int m_unit; @@ -296,7 +294,6 @@ public: void OnDuplicatePart( wxCommandEvent& aEvent ); - void OnSelectAlias( wxCommandEvent& event ); void OnSelectPart( wxCommandEvent& event ); /** @@ -312,7 +309,6 @@ public: void ClearSearchTreeSelection(); void OnEditComponentProperties( wxCommandEvent& event ); - void InstallFieldsEditorDialog( wxCommandEvent& event ); void OnViewEntryDoc( wxCommandEvent& event ); void OnCheckComponent( wxCommandEvent& event ); @@ -331,17 +327,14 @@ public: void OnUpdateRevert( wxUpdateUIEvent& aEvent ); void OnUpdateUndo( wxUpdateUIEvent& event ); void OnUpdateRedo( wxUpdateUIEvent& event ); - void OnUpdateViewDoc( wxUpdateUIEvent& event ); void OnUpdateSyncPinEdit( wxUpdateUIEvent& event ); void OnUpdatePinTable( wxUpdateUIEvent& event ); void OnUpdatePartNumber( wxUpdateUIEvent& event ); void OnUpdateDeMorganNormal( wxUpdateUIEvent& event ); void OnUpdateDeMorganConvert( wxUpdateUIEvent& event ); - void OnUpdateSelectAlias( wxUpdateUIEvent& event ); void OnUpdateElectricalType( wxUpdateUIEvent& aEvent ); void OnUpdateSearchTreeTool( wxUpdateUIEvent& aEvent ); - void UpdateAliasSelectList(); void UpdatePartSelectList(); /** @@ -406,8 +399,6 @@ public: */ void OnModify(); - const wxString& GetAliasName() { return m_aliasName; } - int GetUnit() { return m_unit; } void SetUnit( int unit ) diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 7992b66a74..5a978a9fd0 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -171,9 +171,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, const wxString& a return false; } - m_aliasName = aEntry->GetName(); - - LIB_PART* lib_part = m_libMgr->GetBufferedPart( m_aliasName, aLibrary ); + LIB_PART* lib_part = m_libMgr->GetBufferedPart( aEntry->GetName(), aLibrary ); wxASSERT( lib_part ); SetScreen( m_libMgr->GetScreen( lib_part->GetName(), aLibrary ) ); SetCurPart( new LIB_PART( *lib_part ) ); @@ -185,7 +183,6 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, const wxString& a Zoom_Automatique( false ); DisplayLibInfos(); - UpdateAliasSelectList(); UpdatePartSelectList(); // Display the document information based on the entry selected just in @@ -294,7 +291,6 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event ) } LIB_PART new_part( name ); // do not create part on the heap, it will be buffered soon - m_aliasName = name; new_part.GetReferenceField().SetText( dlg.GetReference() ); new_part.SetUnitCount( dlg.GetUnitCount() ); @@ -552,7 +548,6 @@ void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent ) return; bool currentPart = isCurrentPart( libId ); - wxString alias = m_aliasName; int unit = m_unit; if( currentPart ) @@ -570,8 +565,8 @@ void LIB_EDIT_FRAME::OnRevert( wxCommandEvent& aEvent ) m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() ); } - if( currentPart && m_libMgr->PartExists( alias, libName ) ) - loadPart( alias, libName, unit ); + if( currentPart && m_libMgr->PartExists( partName, libName ) ) + loadPart( partName, libName, unit ); m_treePane->Refresh(); } @@ -593,7 +588,6 @@ void LIB_EDIT_FRAME::loadPart( const wxString& aAlias, const wxString& aLibrary, m_lastDrawItem = nullptr; SetDrawItem( NULL ); - m_aliasName = aAlias; m_unit = ( aUnit <= part->GetUnitCount() ? aUnit : 1 ); // Optimize default edit options for this symbol @@ -683,7 +677,6 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) wxString msg1; msg1.Printf( _( "Symbol library documentation file \"%s\" saved" ), docFileName.GetFullPath() ); AppendMsgPanel( msg, msg1, BLUE ); - UpdateAliasSelectList(); UpdatePartSelectList(); refreshSchematic(); @@ -737,29 +730,18 @@ bool LIB_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation ) void LIB_EDIT_FRAME::DisplayCmpDoc() { - LIB_ALIAS* alias; - LIB_PART* part = GetCurPart(); + LIB_PART* part = GetCurPart(); ClearMsgPanel(); if( !part ) return; + LIB_ALIAS* alias = part->GetAlias( part->GetName() ); wxString msg = part->GetName(); AppendMsgPanel( _( "Name" ), msg, BLUE, 8 ); - if( m_aliasName == part->GetName() ) - msg = _( "None" ); - else - msg = m_aliasName; - - alias = part->GetAlias( m_aliasName ); - - wxCHECK_RET( alias != NULL, "Alias not found in symbol." ); - - AppendMsgPanel( _( "Alias" ), msg, RED, 8 ); - static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); msg = UnitLetter[m_unit]; diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index 130442b8f1..3de2dcb516 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -89,11 +89,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event ) m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) ); } - if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) ) - m_aliasName = part->GetName(); - SetDrawItem( NULL ); - UpdateAliasSelectList(); UpdatePartSelectList(); SetShowDeMorgan( part->HasConversion() ); DisplayLibInfos(); @@ -140,11 +136,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event ) m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) ); } - if( !m_aliasName.IsEmpty() && !part->HasAlias( m_aliasName ) ) - m_aliasName = part->GetName(); - SetDrawItem( NULL ); - UpdateAliasSelectList(); UpdatePartSelectList(); SetShowDeMorgan( part->HasConversion() ); DisplayLibInfos(); diff --git a/eeschema/libfield.cpp b/eeschema/libfield.cpp index e33b9e5654..76a6572620 100644 --- a/eeschema/libfield.cpp +++ b/eeschema/libfield.cpp @@ -87,9 +87,6 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField ) SaveCopyInUndoList( parent, UR_LIB_RENAME ); parent->SetName( newFieldValue ); - if( !parent->HasAlias( m_aliasName ) ) - m_aliasName = newFieldValue; - m_libMgr->UpdatePartAfterRename( parent, oldFieldValue, lib ); // Reselect the renamed part @@ -103,5 +100,4 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField ) m_canvas->Refresh(); OnModify(); - UpdateAliasSelectList(); } diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index 7ade9e427f..4675e04335 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -157,12 +157,6 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() _( "Edit symbol properties" ), KiBitmap( part_properties_xpm ) ); - AddMenuItem( editMenu, - ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, - _( "&Fields..." ), - _( "Edit field properties" ), - KiBitmap( field_properties_xpm ) ); - AddMenuItem( editMenu, ID_LIBEDIT_EDIT_PIN_BY_TABLE, _( "Pin &Table..." ), diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 0029f096c5..6e85fdb0b5 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -153,10 +153,6 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() KiScaledBitmap( part_properties_xpm, this ), _( "Edit symbol properties" ) ); - m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString, - KiScaledBitmap( field_properties_xpm, this ), - _( "Edit symbol fields" ) ); - m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_TABLE, wxEmptyString, KiScaledBitmap( pin_table_xpm, this ), _( "Show pin table" ) ); @@ -189,14 +185,6 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() 0, nullptr, wxCB_READONLY ); m_mainToolBar->AddControl( m_partSelectBox ); - m_aliasSelectBox = new wxComboBox( m_mainToolBar, - ID_LIBEDIT_SELECT_ALIAS, - wxEmptyString, - wxDefaultPosition, - wxSize( LISTBOX_WIDTH, -1 ), - 0, nullptr, wxCB_READONLY ); - m_mainToolBar->AddControl( m_aliasSelectBox ); - KiScaledSeparator( m_mainToolBar, this ); msg = _( "Synchronized pin edit mode\n" diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 19369f64de..5bfc6f795b 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -82,7 +82,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) EVT_MENU( ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, LIB_VIEW_FRAME::OnShowElectricalType ) - EVT_UPDATE_UI( ID_LIBVIEW_VIEWDOC, LIB_VIEW_FRAME::onUpdateViewDoc ) EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton ) EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onUpdateAlternateBodyStyleButton ) @@ -283,14 +282,6 @@ void LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton( wxUpdateUIEvent& aEvent ) } -void LIB_VIEW_FRAME::onUpdateViewDoc( wxUpdateUIEvent& aEvent ) -{ - LIB_ALIAS* alias = getSelectedAlias(); - - aEvent.Enable( alias && !alias->GetDocFileName().IsEmpty() ); -} - - void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( !IsModal() ) diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index cd7882c9c4..4654424b6d 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -169,7 +169,6 @@ private: void onUpdateAlternateBodyStyleButton( wxUpdateUIEvent& aEvent ); void onUpdateNormalBodyStyleButton( wxUpdateUIEvent& aEvent ); - void onUpdateViewDoc( wxUpdateUIEvent& aEvent ); void OnUpdateElectricalType( wxUpdateUIEvent& aEvent ); void OnUpdateSelectionPartBox( wxUpdateUIEvent& aEvent ); void onSelectNextSymbol( wxCommandEvent& aEvent ); diff --git a/include/bitmaps.h b/include/bitmaps.h index 3b703a8d2f..f7703e5318 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -174,7 +174,6 @@ EXTERN_BITMAP( export_part_xpm ) EXTERN_BITMAP( export_step_xpm ) EXTERN_BITMAP( export_xpm ) EXTERN_BITMAP( fabrication_xpm ) -EXTERN_BITMAP( field_properties_xpm ) EXTERN_BITMAP( file_footprint_xpm ) EXTERN_BITMAP( fill_zone_xpm ) EXTERN_BITMAP( find_xpm )