2013-06-07 09:49:36 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-02-16 00:51:16 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-06-07 09:49:36 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiway.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <confirm.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <pgm_base.h>
|
2018-08-13 17:00:08 +00:00
|
|
|
#include <kiface_i.h>
|
2018-03-12 22:45:17 +00:00
|
|
|
#include <dialog_text_entry.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
2018-08-13 17:00:08 +00:00
|
|
|
#include <widgets/wx_grid.h>
|
|
|
|
#include <widgets/grid_text_button_helpers.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <lib_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_library.h>
|
2017-10-06 18:07:43 +00:00
|
|
|
#include <symbol_lib_table.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2018-08-13 17:00:08 +00:00
|
|
|
#include <sch_component.h>
|
|
|
|
#include <dialog_helpers.h>
|
|
|
|
#include <bitmaps.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-01-10 05:42:14 +00:00
|
|
|
#ifdef KICAD_SPICE
|
|
|
|
#include <dialog_spice_model.h>
|
|
|
|
#include <netlist_exporter_pspice.h>
|
|
|
|
#endif /* KICAD_SPICE */
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_edit_component_in_lib.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
#define LibEditFieldsShownColumnsKey wxT( "LibEditFieldsShownColumns" )
|
|
|
|
|
2013-06-07 09:49:36 +00:00
|
|
|
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_lastOpenedPage = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
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 ),
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusGrid( nullptr ),
|
2019-01-12 14:58:40 +00:00
|
|
|
m_delayedFocusRow( -1 ),
|
|
|
|
m_delayedFocusColumn( -1 ),
|
2019-03-02 13:47:10 +00:00
|
|
|
m_delayedFocusPage( -1 ),
|
|
|
|
m_width( 0 )
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
m_config = Kiface().KifaceSettings();
|
|
|
|
|
|
|
|
// Give a bit more room for combobox editors
|
|
|
|
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
|
|
|
|
m_aliasGrid->SetDefaultRowSize( m_aliasGrid->GetDefaultRowSize() + 4 );
|
2018-08-25 12:20:50 +00:00
|
|
|
|
|
|
|
// Work around a bug in wxWidgets where it fails to recalculate the grid height
|
|
|
|
// after changing the default row size
|
|
|
|
m_aliasGrid->AppendRows( 1 );
|
|
|
|
m_aliasGrid->DeleteRows( m_grid->GetNumberRows() - 1, 1 );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
m_fields = new FIELDS_GRID_TABLE<LIB_FIELD>( 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 );
|
2019-03-18 15:44:44 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// 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 ) );
|
2019-03-18 15:44:44 +00:00
|
|
|
m_aliasGrid->SetCellValue( DATASHEET, FDC_NAME,
|
|
|
|
TEMPLATE_FIELDNAME::GetDefaultFieldName( DATASHEET ) );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
attr = new wxGridCellAttr;
|
|
|
|
attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) );
|
|
|
|
m_aliasGrid->SetAttr( DATASHEET, FDC_VALUE, attr );
|
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// 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 ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_stdSizerButtonOK->SetDefault();
|
|
|
|
|
2019-01-12 14:58:40 +00:00
|
|
|
#ifndef KICAD_SPICE
|
|
|
|
m_spiceFieldsButton->Hide();
|
|
|
|
#endif
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// wxFormBuilder doesn't include this event...
|
2019-03-18 15:44:44 +00:00
|
|
|
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 );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
m_grid->GetParent()->Layout();
|
|
|
|
m_aliasGrid->GetParent()->Layout();
|
|
|
|
Layout();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2016-07-16 10:54:55 +00:00
|
|
|
FinishDialogSettings();
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
|
|
|
|
{
|
2013-06-07 09:49:36 +00:00
|
|
|
m_lastOpenedPage = m_NoteBook->GetSelection( );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
m_config->Write( LibEditFieldsShownColumnsKey, m_grid->GetShownColumns() );
|
|
|
|
|
|
|
|
// Prevents crash bug in wxGrid's d'tor
|
|
|
|
m_grid->DestroyTable( m_fields );
|
|
|
|
|
2019-03-18 15:44:44 +00:00
|
|
|
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 );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
// Delete the GRID_TRICKS.
|
|
|
|
m_grid->PopEventHandler( true );
|
|
|
|
m_aliasGrid->PopEventHandler( true );
|
|
|
|
|
|
|
|
// 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;
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataToWindow()
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !wxDialog::TransferDataToWindow() )
|
|
|
|
return false;
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-11-22 21:30:36 +00:00
|
|
|
LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// Push a copy of each field into m_fields
|
|
|
|
m_libEntry->GetFields( *m_fields );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2019-05-23 12:57:24 +00:00
|
|
|
// The datasheet field is special. Grab its value from the LIB_ALIAS document file
|
|
|
|
// member except for old libraries that saved the root alias document file in the
|
|
|
|
// datasheet field in the LIB_PART object.
|
|
|
|
if( rootAlias->GetDocFileName().IsEmpty() )
|
|
|
|
{
|
|
|
|
m_fields->at( DATASHEET ).SetText( m_libEntry->GetField( DATASHEET )->GetText() );
|
|
|
|
rootAlias->SetDocFileName( m_libEntry->GetField( DATASHEET )->GetText() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_fields->at( DATASHEET ).SetText( rootAlias->GetDocFileName() );
|
|
|
|
}
|
2018-11-22 21:30:36 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// 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 )
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
wxPoint pos = m_fields->at( i ).GetPosition();
|
|
|
|
pos.y = -pos.y;
|
|
|
|
m_fields->at( i ).SetPosition( pos );
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// notify the grid
|
|
|
|
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->GetNumberRows() );
|
|
|
|
m_grid->ProcessTableMessage( msg );
|
|
|
|
adjustGridColumns( m_grid->GetRect().GetWidth());
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_SymbolNameCtrl->SetValue( m_libEntry->GetName() );
|
2018-01-22 17:59:44 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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() );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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() ) );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
const LIB_ALIASES aliases = m_libEntry->GetAliases();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
for( LIB_ALIAS* alias : aliases )
|
|
|
|
{
|
|
|
|
if( alias->IsRoot() )
|
|
|
|
continue;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_aliasesBuffer.push_back( new LIB_ALIAS( *alias, m_libEntry ) );
|
|
|
|
m_aliasListBox->Append( alias->GetName() );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_aliasListBox->GetCount() )
|
|
|
|
m_aliasListBox->SetSelection( 0 );
|
|
|
|
|
2019-03-28 17:08:37 +00:00
|
|
|
wxCommandEvent dummy;
|
|
|
|
OnSelectAlias( dummy );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
adjustAliasGridColumns( m_aliasGrid->GetClientRect().GetWidth() - 4 );
|
2013-06-07 09:49:36 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_FootprintFilterListBox->Append( m_libEntry->GetFootprints() );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_NoteBook->SetSelection( (unsigned) m_lastOpenedPage );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
return true;
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::Validate()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !m_grid->CommitPendingChanges() || !m_aliasGrid->CommitPendingChanges() )
|
|
|
|
return false;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE ).GetText() ) )
|
|
|
|
{
|
|
|
|
if( m_NoteBook->GetSelection() != 0 )
|
|
|
|
m_NoteBook->SetSelection( 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedErrorMessage = _( "References must start with a letter." );
|
|
|
|
m_delayedFocusGrid = m_grid;
|
|
|
|
m_delayedFocusColumn = FDC_VALUE;
|
|
|
|
m_delayedFocusRow = REFERENCE;
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusPage = 0;
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
return false;
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// 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 );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( fieldName.IsEmpty() )
|
|
|
|
{
|
|
|
|
if( m_NoteBook->GetSelection() != 0 )
|
|
|
|
m_NoteBook->SetSelection( 0 );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedErrorMessage = _( "Fields must have a name." );
|
|
|
|
m_delayedFocusGrid = m_grid;
|
|
|
|
m_delayedFocusColumn = FDC_NAME;
|
|
|
|
m_delayedFocusRow = i;
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusPage = 0;
|
2015-04-07 11:52:29 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2015-04-07 11:52:29 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_SelNumberOfUnits->GetValue() < m_libEntry->GetUnitCount() )
|
|
|
|
{
|
|
|
|
if( !IsOK( this, _( "Delete extra units from symbol?" ) ) )
|
|
|
|
return false;
|
|
|
|
}
|
2015-04-07 11:52:29 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_AsConvertButt->GetValue() && !m_libEntry->HasConversion() )
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !IsOK( this, _( "Add new pins for alternate body style (DeMorgan) to symbol?" ) ) )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if( !m_AsConvertButt->GetValue() && m_libEntry->HasConversion() )
|
|
|
|
{
|
|
|
|
if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from symbol?" ) ) )
|
|
|
|
return false;
|
2010-10-25 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2019-03-18 15:44:44 +00:00
|
|
|
if( !wxDialog::TransferDataFromWindow() )
|
2018-08-13 17:00:08 +00:00
|
|
|
return false;
|
2010-10-04 18:54:14 +00:00
|
|
|
|
2018-11-22 21:30:36 +00:00
|
|
|
LIB_ALIAS* rootAlias = m_libEntry->GetAlias( m_libEntry->GetName() );
|
2019-05-11 14:38:05 +00:00
|
|
|
// We need to keep the name and the value the same at the moment!
|
|
|
|
wxString newName = m_libEntry->GetValueField().GetText();
|
2018-11-22 21:30:36 +00:00
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
if( m_libEntry->GetName() != newName )
|
|
|
|
m_Parent->SaveCopyInUndoList( m_libEntry, UR_LIB_RENAME );
|
|
|
|
else
|
|
|
|
m_Parent->SaveCopyInUndoList( m_libEntry );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
// 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 )
|
2009-10-10 17:27:53 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
wxPoint pos = m_fields->at( i ).GetPosition();
|
|
|
|
pos.y = -pos.y;
|
|
|
|
m_fields->at( i ).SetPosition( pos );
|
2009-10-10 17:27:53 +00:00
|
|
|
}
|
|
|
|
|
2018-11-22 21:30:36 +00:00
|
|
|
// Datasheet field is special; copy it to the root alias docfilename
|
|
|
|
rootAlias->SetDocFileName( m_fields->at( DATASHEET ).GetText() );
|
|
|
|
m_fields->at( DATASHEET ).SetText( wxEmptyString );
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_libEntry->SetFields( *m_fields );
|
|
|
|
|
|
|
|
// We need to keep the name and the value the same at the moment!
|
2019-05-11 14:38:05 +00:00
|
|
|
m_libEntry->SetName( newName );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
rootAlias->SetDescription( m_DescCtrl->GetValue() );
|
|
|
|
rootAlias->SetKeyWords( m_KeywordCtrl->GetValue() );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
|
|
|
|
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 && m_OptionPartsLocked->GetValue() );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_OptionPower->GetValue() )
|
|
|
|
m_libEntry->SetPower();
|
|
|
|
else
|
|
|
|
m_libEntry->SetNormal();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_libEntry->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
|
|
|
|
m_libEntry->SetShowPinNames( m_ShowPinNameButt->GetValue() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_PinsNameInsideButt->GetValue() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
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 );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
m_libEntry->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin)
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
transferAliasDataToBuffer();
|
|
|
|
m_libEntry->RemoveAllAliases();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
for( LIB_ALIAS* alias : m_aliasesBuffer )
|
|
|
|
m_libEntry->AddAlias( alias ); // Transfers ownership; no need to delete
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_aliasesBuffer.clear();
|
|
|
|
|
|
|
|
m_libEntry->GetFootprints().Clear();
|
|
|
|
m_libEntry->GetFootprints() = m_FootprintFilterListBox->GetStrings();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging( wxGridEvent& event )
|
|
|
|
{
|
|
|
|
wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
|
|
|
|
wxControl* control = editor->GetControl();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
|
|
|
|
{
|
|
|
|
event.Veto();
|
|
|
|
|
|
|
|
m_delayedFocusGrid = m_grid;
|
|
|
|
m_delayedFocusRow = event.GetRow();
|
|
|
|
m_delayedFocusColumn = event.GetCol();
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusPage = 0;
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
2018-09-13 15:39:14 +00:00
|
|
|
else if( event.GetRow() == VALUE && event.GetCol() == FDC_VALUE )
|
|
|
|
m_SymbolNameCtrl->ChangeValue( event.GetString() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
editor->DecRef();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSymbolNameText( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
m_grid->SetCellValue( VALUE, FDC_VALUE, m_SymbolNameCtrl->GetValue() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSymbolNameKillFocus( wxFocusEvent& event )
|
|
|
|
{
|
|
|
|
if( !m_delayedFocusCtrl && !m_SymbolNameCtrl->GetValidator()->Validate( m_SymbolNameCtrl ) )
|
|
|
|
{
|
|
|
|
m_delayedFocusCtrl = m_SymbolNameCtrl;
|
|
|
|
m_delayedFocusPage = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !m_grid->CommitPendingChanges() )
|
2010-10-25 15:43:42 +00:00
|
|
|
return;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
int fieldID = m_fields->size();
|
|
|
|
LIB_FIELD newField( m_libEntry, fieldID );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_fields->push_back( newField );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// notify the grid
|
|
|
|
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
|
|
|
|
m_grid->ProcessTableMessage( msg );
|
2010-10-25 15:43:42 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_grid->MakeCellVisible( m_fields->size() - 1, 0 );
|
|
|
|
m_grid->SetGridCursor( m_fields->size() - 1, 0 );
|
2010-10-25 15:43:42 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_grid->EnableCellEditControl();
|
|
|
|
m_grid->ShowCellEditControl();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteField( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
int curRow = m_grid->GetGridCursorRow();
|
2018-01-22 17:59:44 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( curRow < 0 )
|
|
|
|
return;
|
|
|
|
else if( curRow < MANDATORY_FIELDS )
|
2009-09-14 13:24:17 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
|
|
|
|
MANDATORY_FIELDS ) );
|
2009-09-14 13:24:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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() );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnMoveUp( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !m_grid->CommitPendingChanges() )
|
2018-01-23 14:17:51 +00:00
|
|
|
return;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
int i = m_grid->GetGridCursorRow();
|
2018-01-23 14:17:51 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( i > MANDATORY_FIELDS )
|
2018-01-23 14:17:51 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
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() )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
int i = m_grid->GetGridCursorRow();
|
|
|
|
|
2019-03-18 03:19:21 +00:00
|
|
|
if( i >= MANDATORY_FIELDS && i + 1 < m_fields->GetNumberRows() )
|
2018-08-13 17:00:08 +00:00
|
|
|
{
|
|
|
|
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() );
|
2018-01-23 14:17:51 +00:00
|
|
|
}
|
2018-08-13 17:00:08 +00:00
|
|
|
else
|
|
|
|
wxBell();
|
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::updateAliasName( bool aFromGrid, const wxString& aName )
|
|
|
|
{
|
|
|
|
int idx = m_aliasListBox->GetSelection();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( idx >= 0 )
|
|
|
|
{
|
|
|
|
m_aliasListBox->SetString( (unsigned) idx, aName );
|
|
|
|
m_aliasesBuffer[ idx ]->SetName( aName );
|
2018-01-23 14:17:51 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( aFromGrid )
|
|
|
|
m_AliasNameCtrl->ChangeValue( aName );
|
|
|
|
else
|
|
|
|
m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, aName );
|
|
|
|
}
|
2018-01-23 14:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasGridCellChanging( wxGridEvent& event )
|
2018-01-23 14:17:51 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( event.GetRow() == VALUE )
|
|
|
|
{
|
|
|
|
int idx = m_aliasListBox->GetSelection();
|
|
|
|
wxString newName = event.GetString();
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( idx < 0 || !checkAliasName( newName ) )
|
|
|
|
{
|
|
|
|
event.Veto();
|
2018-01-23 14:17:51 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedFocusGrid = m_aliasGrid;
|
|
|
|
m_delayedFocusRow = event.GetRow();
|
|
|
|
m_delayedFocusColumn = event.GetCol();
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusPage = 1;
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
2018-09-13 15:39:14 +00:00
|
|
|
else
|
|
|
|
updateAliasName( true, newName );
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
|
|
|
}
|
2018-01-23 14:17:51 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameText( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
updateAliasName( false, m_AliasNameCtrl->GetValue() );
|
2018-01-23 14:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAliasNameKillFocus( wxFocusEvent& event )
|
2018-01-23 14:17:51 +00:00
|
|
|
{
|
2018-09-13 15:39:14 +00:00
|
|
|
if( !m_delayedFocusCtrl && !checkAliasName( m_AliasNameCtrl->GetValue() ) )
|
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedFocusCtrl = m_AliasNameCtrl;
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusPage = 1;
|
|
|
|
}
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::transferAliasDataToBuffer()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_currentAlias >= 0 )
|
|
|
|
{
|
|
|
|
LIB_ALIAS* alias = m_aliasesBuffer[ m_currentAlias ];
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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() );
|
|
|
|
}
|
|
|
|
}
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2018-01-23 14:17:51 +00:00
|
|
|
|
2019-01-10 05:42:14 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditSpiceModel( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
#ifdef KICAD_SPICE
|
|
|
|
int diff = m_fields->size();
|
|
|
|
auto cmp = SCH_COMPONENT( *m_libEntry, m_libEntry->GetLibId(), nullptr );
|
|
|
|
|
|
|
|
DIALOG_SPICE_MODEL dialog( this, cmp, m_fields );
|
|
|
|
|
|
|
|
if( dialog.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
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 */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSelectAlias( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_delayedFocusCtrl || !m_aliasGrid->CommitPendingChanges() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
m_aliasListBox->SetSelection( m_currentAlias ); // veto selection change
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// Copy any pending changes back into the buffer
|
|
|
|
transferAliasDataToBuffer();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
LIB_ALIAS* alias = nullptr;
|
|
|
|
int newIdx = m_aliasListBox->GetSelection();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( newIdx >= 0 )
|
|
|
|
{
|
|
|
|
alias = m_aliasesBuffer[ newIdx ];
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, alias->GetName() );
|
|
|
|
m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, alias->GetDocFileName() );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_aliasGrid->Enable( true );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// Use ChangeValue() so we don't generate events
|
|
|
|
m_AliasNameCtrl->ChangeValue( alias->GetName() );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasNameCtrl->Enable( true );
|
2018-08-13 17:00:08 +00:00
|
|
|
m_AliasDescCtrl->ChangeValue( alias->GetDescription() );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasDescCtrl->Enable( true );
|
2018-08-13 17:00:08 +00:00
|
|
|
m_AliasKeywordsCtrl->ChangeValue( alias->GetKeyWords() );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasKeywordsCtrl->Enable( true );
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_aliasGrid->SetCellValue( VALUE, FDC_VALUE, wxEmptyString );
|
|
|
|
m_aliasGrid->SetCellValue( DATASHEET, FDC_VALUE, wxEmptyString );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_aliasGrid->Enable( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// Use ChangeValue() so we don't generate events
|
|
|
|
m_AliasNameCtrl->ChangeValue( wxEmptyString );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasNameCtrl->Enable( false );
|
2018-08-13 17:00:08 +00:00
|
|
|
m_AliasDescCtrl->ChangeValue( wxEmptyString );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasDescCtrl->Enable( false );
|
2018-08-13 17:00:08 +00:00
|
|
|
m_AliasKeywordsCtrl->ChangeValue( wxEmptyString );
|
2019-03-28 17:08:37 +00:00
|
|
|
m_AliasKeywordsCtrl->Enable( false );
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_currentAlias = newIdx;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName( const wxString& aName )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( aName.IsEmpty() )
|
2009-10-05 17:52:41 +00:00
|
|
|
return false;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2019-04-10 17:11:30 +00:00
|
|
|
if( m_SymbolNameCtrl->GetValue().CmpNoCase( aName ) == 0 )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Alias can not have same name as symbol." ) );
|
|
|
|
DisplayInfoMessage( this, msg );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-08-15 11:19:41 +00:00
|
|
|
for( int i = 0; i < (int)m_aliasListBox->GetCount(); ++i )
|
2009-10-05 17:52:41 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
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 );
|
2010-10-04 18:54:14 +00:00
|
|
|
return false;
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
wxString library = m_Parent->GetCurLib();
|
|
|
|
|
|
|
|
if( !library.empty() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
LIB_ALIAS* existing = Prj().SchSymbolLibTable()->LoadSymbol( library, aName );
|
|
|
|
|
|
|
|
if( existing && existing->GetPart()->GetName() != m_libEntry->GetName() )
|
2009-10-10 17:27:53 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
wxString msg;
|
2019-03-18 15:44:44 +00:00
|
|
|
msg.Printf( _( "Symbol name \"%s\" already exists in library \"%s\"." ),
|
|
|
|
aName, library );
|
2018-08-13 17:00:08 +00:00
|
|
|
DisplayErrorMessage( this, msg );
|
2009-10-10 17:27:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2009-10-05 17:52:41 +00:00
|
|
|
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddAlias( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_delayedFocusCtrl || !m_aliasGrid->CommitPendingChanges() )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
wxCommandEvent dummy;
|
|
|
|
wxString aliasname = _( "untitled" );
|
|
|
|
int suffix = 1;
|
|
|
|
|
2019-04-10 17:11:30 +00:00
|
|
|
while( m_aliasListBox->FindString( aliasname ) != wxNOT_FOUND )
|
2018-08-13 17:00:08 +00:00
|
|
|
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 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteAlias( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
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 );
|
2019-01-10 16:04:58 +00:00
|
|
|
m_currentAlias = wxNOT_FOUND;
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
if( m_aliasListBox->GetCount() == 0 )
|
|
|
|
m_aliasListBox->SetSelection( wxNOT_FOUND );
|
|
|
|
else
|
|
|
|
m_aliasListBox->SetSelection( std::max( 0, sel - 1 ) );
|
|
|
|
|
|
|
|
wxCommandEvent dummy;
|
|
|
|
OnSelectAlias( dummy );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2019-02-16 00:51:16 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnFilterDClick( wxMouseEvent& event)
|
|
|
|
{
|
2019-02-20 01:50:17 +00:00
|
|
|
int idx = m_FootprintFilterListBox->HitTest( event.GetPosition() );
|
2019-02-16 00:51:16 +00:00
|
|
|
wxCommandEvent dummy;
|
2019-02-20 01:50:17 +00:00
|
|
|
|
|
|
|
if( idx >= 0 )
|
|
|
|
OnEditFootprintFilter( dummy );
|
|
|
|
else
|
|
|
|
OnAddFootprintFilter( dummy );
|
2019-02-16 00:51:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-02-20 22:57:39 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Running the Footprint Browser gums up the works and causes the automatic cancel
|
|
|
|
// stuff to no longer work. So we do it here ourselves.
|
|
|
|
EndQuasiModal( wxID_CANCEL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddFootprintFilter( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
wxString filterLine;
|
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
if( component == NULL )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Add Footprint Filter" ), filterLine );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetValue().IsEmpty() )
|
2010-07-20 10:30:40 +00:00
|
|
|
return;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
filterLine = dlg.GetValue();
|
|
|
|
filterLine.Replace( wxT( " " ), wxT( "_" ) );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// duplicate filters do no harm, so don't be a nanny.
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_FootprintFilterListBox->Append( filterLine );
|
|
|
|
m_FootprintFilterListBox->SetSelection( m_FootprintFilterListBox->GetCount() - 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnDeleteFootprintFilter( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
int ii = m_FootprintFilterListBox->GetSelection();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( ii >= 0 )
|
2018-06-05 21:33:49 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
m_FootprintFilterListBox->Delete( (unsigned) ii );
|
|
|
|
|
|
|
|
if( m_FootprintFilterListBox->GetCount() == 0 )
|
|
|
|
m_FootprintFilterListBox->SetSelection( wxNOT_FOUND );
|
|
|
|
else
|
|
|
|
m_FootprintFilterListBox->SetSelection( std::max( 0, ii - 1 ) );
|
2018-06-05 21:33:49 +00:00
|
|
|
}
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
2018-06-05 21:33:49 +00:00
|
|
|
|
2019-03-18 15:44:44 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnEditFootprintFilter( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int idx = m_FootprintFilterListBox->GetSelection();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( idx >= 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2018-08-13 17:00:08 +00:00
|
|
|
wxString filter = m_FootprintFilterListBox->GetStringSelection();
|
|
|
|
|
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Filter:" ), _( "Edit Footprint Filter" ), filter );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_OK && !dlg.GetValue().IsEmpty() )
|
|
|
|
m_FootprintFilterListBox->SetString( (unsigned) idx, dlg.GetValue() );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::adjustGridColumns( int aWidth )
|
2015-02-02 16:43:34 +00:00
|
|
|
{
|
2019-03-02 13:47:10 +00:00
|
|
|
m_width = aWidth;
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// Account for scroll bars
|
|
|
|
aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x );
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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 );
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
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() );
|
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
if( m_grid->IsCellEditControlShown() )
|
|
|
|
{
|
|
|
|
int row = m_grid->GetGridCursorRow();
|
|
|
|
int col = m_grid->GetGridCursorCol();
|
|
|
|
|
|
|
|
if( row == VALUE && col == FDC_VALUE )
|
|
|
|
{
|
|
|
|
wxGridCellEditor* editor = m_grid->GetCellEditor( row, col );
|
|
|
|
m_SymbolNameCtrl->ChangeValue( editor->GetValue() );
|
|
|
|
editor->DecRef();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
// 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;
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( !m_grid->IsCellEditControlShown() )
|
2018-08-25 12:20:50 +00:00
|
|
|
adjustGridColumns( m_grid->GetRect().GetWidth() );
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
// Handle a delayed focus. The delay allows us to:
|
|
|
|
// a) change focus when the error was triggered from within a killFocus handler
|
|
|
|
// b) show the correct notebook page in the background before the error dialog comes up
|
|
|
|
// when triggered from an OK or a notebook page change
|
|
|
|
|
|
|
|
if( m_delayedFocusPage >= 0 && m_NoteBook->GetSelection() != m_delayedFocusPage )
|
|
|
|
{
|
|
|
|
m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage );
|
|
|
|
m_delayedFocusPage = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !m_delayedErrorMessage.IsEmpty() )
|
|
|
|
{
|
|
|
|
// We will re-enter this routine when the error dialog is displayed, so make
|
|
|
|
// sure we don't keep putting up more dialogs.
|
|
|
|
wxString msg = m_delayedErrorMessage;
|
|
|
|
m_delayedErrorMessage = wxEmptyString;
|
|
|
|
|
|
|
|
// Do not use DisplayErrorMessage(); it screws up window order on Mac
|
|
|
|
DisplayError( nullptr, msg );
|
|
|
|
}
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
if( m_delayedFocusCtrl )
|
|
|
|
{
|
|
|
|
m_delayedFocusCtrl->SetFocus();
|
|
|
|
|
|
|
|
if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
|
|
|
dynamic_cast<wxTextEntry*>( 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 );
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedFocusGrid->EnableCellEditControl( true );
|
|
|
|
m_delayedFocusGrid->ShowCellEditControl();
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
m_delayedFocusGrid = nullptr;
|
2018-09-13 15:39:14 +00:00
|
|
|
m_delayedFocusRow = -1;
|
|
|
|
m_delayedFocusColumn = -1;
|
2018-08-13 17:00:08 +00:00
|
|
|
}
|
|
|
|
}
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeGrid( wxSizeEvent& event )
|
|
|
|
{
|
2019-03-02 13:47:10 +00:00
|
|
|
auto new_size = event.GetSize().GetX();
|
2018-08-13 17:00:08 +00:00
|
|
|
|
2019-03-02 13:47:10 +00:00
|
|
|
if( new_size != m_width )
|
|
|
|
{
|
|
|
|
adjustGridColumns( event.GetSize().GetX() );
|
|
|
|
}
|
2019-05-11 08:07:30 +00:00
|
|
|
|
|
|
|
// Always propagate a wxSizeEvent:
|
|
|
|
event.Skip();
|
2015-02-02 16:43:34 +00:00
|
|
|
}
|
2016-11-09 23:11:47 +00:00
|
|
|
|
|
|
|
|
2018-08-13 17:00:08 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnSizeAliasGrid( wxSizeEvent& event )
|
2016-11-09 23:11:47 +00:00
|
|
|
{
|
2018-08-25 12:20:50 +00:00
|
|
|
adjustAliasGridColumns( event.GetSize().GetX() );
|
2018-08-13 17:00:08 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2016-11-09 23:11:47 +00:00
|
|
|
}
|