2013-06-07 09:49:36 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_edit_component_in_lib.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 1992-2017 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>
|
|
|
|
#include <gestfich.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>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <libeditframe.h>
|
|
|
|
#include <class_library.h>
|
2017-05-31 08:20:49 +00:00
|
|
|
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
|
2017-10-06 18:07:43 +00:00
|
|
|
#include <symbol_lib_table.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_edit_component_in_lib.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
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
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent ):
|
2010-11-18 21:10:52 +00:00
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent )
|
|
|
|
{
|
2012-01-23 04:33:36 +00:00
|
|
|
m_Parent = aParent;
|
|
|
|
m_RecreateToolbar = false;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
initDlg();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2016-07-16 10:54:55 +00:00
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
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( );
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize state of check boxes and texts
|
|
|
|
*/
|
2011-09-20 18:19:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
|
|
|
m_AliasLocation = -1;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
|
|
|
if( component == NULL )
|
|
|
|
{
|
|
|
|
SetTitle( _( "Library Component Properties" ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-09 17:49:01 +00:00
|
|
|
wxString title;
|
2010-11-18 21:10:52 +00:00
|
|
|
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
|
|
|
|
|
|
|
|
if( !isRoot )
|
|
|
|
{
|
2013-04-09 17:49:01 +00:00
|
|
|
title.Printf( _( "Properties for %s (alias of %s)" ),
|
|
|
|
GetChars( m_Parent->GetAliasName() ),
|
|
|
|
GetChars( component->GetName() ) );
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
else
|
2013-04-09 17:49:01 +00:00
|
|
|
title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
|
|
|
SetTitle( title );
|
|
|
|
InitPanelDoc();
|
|
|
|
InitBasicPanel();
|
|
|
|
|
|
|
|
if( isRoot && component->GetAliasCount() == 1 )
|
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
|
|
|
|
/* Place list of alias names in listbox */
|
|
|
|
m_PartAliasListCtrl->Append( component->GetAliasNames( false ) );
|
|
|
|
|
|
|
|
if( component->GetAliasCount() <= 1 )
|
|
|
|
{
|
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
m_ButtonDeleteOneAlias->Enable( false );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
/* Read the Footprint Filter list */
|
2017-12-01 16:49:19 +00:00
|
|
|
m_FootprintFilterListBox->Append( component->GetFootprints() );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2017-12-01 16:49:19 +00:00
|
|
|
if( component->GetFootprints().GetCount() == 0 )
|
2010-11-18 21:10:52 +00:00
|
|
|
{
|
|
|
|
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
|
|
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
2015-02-02 16:43:34 +00:00
|
|
|
m_buttonEditOneFootprintFilter->Enable( false );
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 09:49:36 +00:00
|
|
|
m_NoteBook->SetSelection( m_lastOpenedPage );
|
|
|
|
|
2011-09-20 18:19:09 +00:00
|
|
|
m_stdSizerButtonOK->SetDefault();
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
|
|
|
|
{
|
2012-01-23 04:33:36 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2010-11-18 21:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-11-18 21:10:52 +00:00
|
|
|
LIB_ALIAS* alias;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
if( component == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString aliasname = m_Parent->GetAliasName();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
if( aliasname.IsEmpty() )
|
2009-09-14 13:24:17 +00:00
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
alias = component->GetAlias( aliasname );
|
|
|
|
|
|
|
|
if( alias != NULL )
|
2010-10-25 15:43:42 +00:00
|
|
|
{
|
2010-11-18 21:10:52 +00:00
|
|
|
m_DocCtrl->SetValue( alias->GetDescription() );
|
|
|
|
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
|
|
|
|
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* create the basic panel for component properties editing
|
|
|
|
*/
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
|
|
|
if( m_Parent->GetShowDeMorgan() )
|
|
|
|
m_AsConvertButt->SetValue( true );
|
|
|
|
|
2017-05-31 08:20:49 +00:00
|
|
|
int maxUnits = MAX_UNIT_COUNT_PER_PACKAGE;
|
2015-04-07 11:52:29 +00:00
|
|
|
m_SelNumberOfUnits->SetRange (1, maxUnits );
|
|
|
|
|
|
|
|
m_staticTextNbUnits->SetLabel( wxString::Format(
|
|
|
|
_( "Number of Units (max allowed %d)" ), maxUnits ) );
|
|
|
|
|
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
/* 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;
|
2010-10-25 15:43:42 +00:00
|
|
|
}
|
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
|
|
|
|
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
|
|
|
|
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_SelNumberOfUnits->SetValue( component->GetUnitCount() );
|
2010-11-18 21:10:52 +00:00
|
|
|
m_SetSkew->SetValue( component->GetPinNameOffset() );
|
|
|
|
m_OptionPower->SetValue( component->IsPower() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetUnitCount() > 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
/* Update the doc, keyword and doc filename strings */
|
2010-10-04 18:54:14 +00:00
|
|
|
LIB_ALIAS* alias;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2010-10-04 18:54:14 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if( component == NULL )
|
|
|
|
{
|
|
|
|
EndModal( wxID_CANCEL );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-02-16 08:34:09 +00:00
|
|
|
m_Parent->SaveCopyInUndoList( component );
|
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
alias = component->GetAlias( m_Parent->GetAliasName() );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
wxCHECK_RET( alias != NULL,
|
|
|
|
wxT( "Alias \"" ) + m_Parent->GetAliasName() + wxT( "\" of component \"" ) +
|
|
|
|
component->GetName() + wxT( "\" does not exist." ) );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
alias->SetDescription( m_DocCtrl->GetValue() );
|
|
|
|
alias->SetKeyWords( m_KeywordsCtrl->GetValue() );
|
|
|
|
alias->SetDocFileName( m_DocfileCtrl->GetValue() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
component->SetAliases( m_PartAliasListCtrl->GetStrings() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2014-09-02 11:47:57 +00:00
|
|
|
int unitCount = m_SelNumberOfUnits->GetValue();
|
|
|
|
ChangeNbUnitsPerPackage( unitCount );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( m_AsConvertButt->GetValue() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( !m_Parent->GetShowDeMorgan() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
m_Parent->SetShowDeMorgan( true );
|
2009-09-14 13:24:17 +00:00
|
|
|
SetUnsetConvert();
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_Parent->GetShowDeMorgan() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
m_Parent->SetShowDeMorgan( false );
|
2009-09-14 13:24:17 +00:00
|
|
|
SetUnsetConvert();
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
component->SetShowPinNumbers( m_ShowPinNumButt->GetValue() );
|
|
|
|
component->SetShowPinNames( m_ShowPinNameButt->GetValue() );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if( m_PinsNameInsideButt->GetValue() == false )
|
2010-06-24 18:31:43 +00:00
|
|
|
component->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin)
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-10-10 17:27:53 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
component->SetPinNameOffset( m_SetSkew->GetValue() );
|
2009-10-10 17:27:53 +00:00
|
|
|
// Ensure component->m_TextInside != 0, because the meaning is "text outside".
|
2010-06-24 18:31:43 +00:00
|
|
|
if( component->GetPinNameOffset() == 0 )
|
|
|
|
component->SetPinNameOffset( 20 ); // give a reasonnable value
|
2009-10-10 17:27:53 +00:00
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if( m_OptionPower->GetValue() == true )
|
2009-12-15 21:11:05 +00:00
|
|
|
component->SetPower();
|
2007-09-20 21:06:49 +00:00
|
|
|
else
|
2009-12-15 21:11:05 +00:00
|
|
|
component->SetNormal();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Set the option "Units locked".
|
2009-10-10 17:27:53 +00:00
|
|
|
* Obviously, cannot be true if there is only one part */
|
2010-06-24 18:31:43 +00:00
|
|
|
component->LockUnits( m_OptionPartsLocked->GetValue() );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( component->GetUnitCount() <= 1 )
|
2010-06-24 18:31:43 +00:00
|
|
|
component->LockUnits( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
/* Update the footprint filter list */
|
2017-12-01 16:49:19 +00:00
|
|
|
component->GetFootprints().Clear();
|
|
|
|
component->GetFootprints() = m_FootprintFilterListBox->GetStrings();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2009-09-14 13:24:17 +00:00
|
|
|
EndModal( wxID_OK );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-23 10:06:33 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocFromRootToAlias( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-10-25 15:43:42 +00:00
|
|
|
if( m_Parent == NULL )
|
|
|
|
return;
|
|
|
|
|
2012-05-23 10:06:33 +00:00
|
|
|
LIB_ALIAS* parent_alias;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( component == NULL )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-23 10:06:33 +00:00
|
|
|
// search for the main alias: this is the first alias in alias list
|
|
|
|
// something like the main component
|
|
|
|
parent_alias = component->GetAlias( 0 );
|
2010-10-25 15:43:42 +00:00
|
|
|
|
2012-05-23 10:06:33 +00:00
|
|
|
if( parent_alias == NULL ) // Should never occur (bug)
|
2010-10-25 15:43:42 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-23 10:06:33 +00:00
|
|
|
m_DocCtrl->SetValue( parent_alias->GetDescription() );
|
|
|
|
m_DocfileCtrl->SetValue( parent_alias->GetDocFileName() );
|
|
|
|
m_KeywordsCtrl->SetValue( parent_alias->GetKeyWords() );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-10-04 18:54:14 +00:00
|
|
|
if( m_PartAliasListCtrl->FindString( m_Parent->GetAliasName() ) != wxNOT_FOUND )
|
2009-09-14 13:24:17 +00:00
|
|
|
{
|
|
|
|
wxString msg;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Alias \"%s\" cannot be removed while it is being edited!" ),
|
2009-10-16 17:18:23 +00:00
|
|
|
GetChars( m_Parent->GetAliasName() ) );
|
2009-09-14 13:24:17 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( IsOK( this, _( "Remove all aliases from list?" ) ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2010-02-16 08:34:09 +00:00
|
|
|
m_PartAliasListCtrl->Clear();
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
m_ButtonDeleteOneAlias->Enable( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Add a new name to the alias list box
|
2007-09-20 21:06:49 +00:00
|
|
|
* New name cannot be the root name, and must not exists
|
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
wxString aliasname;
|
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
|
|
|
wxString library = m_Parent->GetCurLib();
|
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;
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
wxTextEntryDialog dlg( this, _( "New Alias:" ), _( "Symbol alias:" ), aliasname );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return; // cancelled by user
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
aliasname = dlg.GetValue( );
|
|
|
|
|
|
|
|
aliasname.Replace( wxT( " " ), wxT( "_" ) );
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( aliasname.IsEmpty() )
|
|
|
|
return;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2011-03-30 10:51:51 +00:00
|
|
|
if( m_PartAliasListCtrl->FindString( aliasname ) != wxNOT_FOUND )
|
|
|
|
{
|
|
|
|
wxString msg;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Alias or component name \"%s\" already in use." ),
|
2011-03-30 10:51:51 +00:00
|
|
|
GetChars( aliasname ) );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
if( !library.empty() && Prj().SchSymbolLibTable()->LoadSymbol( library, aliasname ) != NULL )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
wxString msg;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Symbol name \"%s\" already exists in library \"%s\"." ), aliasname, library );
|
2010-10-04 18:54:14 +00:00
|
|
|
DisplayError( this, msg );
|
2009-09-14 13:24:17 +00:00
|
|
|
return;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
2010-02-16 08:34:09 +00:00
|
|
|
m_PartAliasListCtrl->Append( aliasname );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0 )
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllAlias->Enable( true );
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteOneAlias->Enable( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-02-16 08:34:09 +00:00
|
|
|
wxString aliasname = m_PartAliasListCtrl->GetStringSelection();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
if( aliasname.IsEmpty() )
|
|
|
|
return;
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( aliasname.CmpNoCase( m_Parent->GetAliasName() ) == 0 )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
wxString msg;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Alias \"%s\" cannot be removed while it is being edited!" ),
|
2009-10-16 17:18:23 +00:00
|
|
|
GetChars( aliasname ) );
|
2007-09-20 21:06:49 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-02-16 08:34:09 +00:00
|
|
|
m_PartAliasListCtrl->Delete( m_PartAliasListCtrl->GetSelection() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2010-11-18 21:10:52 +00:00
|
|
|
|
2010-02-17 13:22:25 +00:00
|
|
|
if( component )
|
2010-10-04 18:54:14 +00:00
|
|
|
component->RemoveAlias( aliasname );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-02-16 08:34:09 +00:00
|
|
|
if( m_PartAliasListCtrl->IsEmpty() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
m_ButtonDeleteOneAlias->Enable( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
/*
|
|
|
|
* Change the number of parts per package.
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2009-10-05 17:52:41 +00:00
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = m_Parent->GetCurPart();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !part || part->GetUnitCount() == MaxUnit || MaxUnit < 1 )
|
2009-10-05 17:52:41 +00:00
|
|
|
return false;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( MaxUnit < part->GetUnitCount()
|
2009-10-05 17:52:41 +00:00
|
|
|
&& !IsOK( this, _( "Delete extra parts from component?" ) ) )
|
|
|
|
return false;
|
2007-09-20 21:06:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
part->SetUnitCount( MaxUnit );
|
2009-10-05 17:52:41 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
/*
|
|
|
|
* Set or clear the component alternate body style ( DeMorgan ).
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2009-10-05 17:52:41 +00:00
|
|
|
bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
if( component == NULL || ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) )
|
2009-10-05 17:52:41 +00:00
|
|
|
return false;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
if( m_Parent->GetShowDeMorgan() )
|
2009-10-05 17:52:41 +00:00
|
|
|
{
|
2010-10-04 18:54:14 +00:00
|
|
|
if( !IsOK( this, _( "Add new pins for alternate body style ( DeMorgan ) to component?" ) ) )
|
|
|
|
return false;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2009-10-10 17:27:53 +00:00
|
|
|
else if( component->HasConversion() )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-10-10 17:27:53 +00:00
|
|
|
if( !IsOK( this, _( "Delete alternate body style (DeMorgan) draw items from component?" ) ) )
|
|
|
|
{
|
|
|
|
m_Parent->SetShowDeMorgan( true );
|
|
|
|
return false;
|
|
|
|
}
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2009-10-05 17:52:41 +00:00
|
|
|
|
|
|
|
component->SetConversion( m_Parent->GetShowDeMorgan() );
|
2010-10-04 18:54:14 +00:00
|
|
|
m_Parent->OnModify();
|
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
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
* 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
|
|
|
PROJECT& prj = Prj();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
SEARCH_STACK* search = prj.SchSearchS();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
* 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
|
|
|
wxString mask = wxT( "*" );
|
2014-06-10 15:56:43 +00:00
|
|
|
wxString docpath = prj.GetRString( PROJECT::DOC_PATH );
|
|
|
|
|
|
|
|
if( !docpath )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
docpath = search->LastVisitedPath( wxT( "doc" ) );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString fullFileName = EDA_FILE_SELECTOR( _( "Doc Files" ),
|
|
|
|
docpath,
|
|
|
|
wxEmptyString,
|
|
|
|
wxEmptyString,
|
|
|
|
mask,
|
|
|
|
this,
|
|
|
|
wxFD_OPEN,
|
|
|
|
true );
|
* 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
|
|
|
if( fullFileName.IsEmpty() )
|
2007-09-20 21:06:49 +00:00
|
|
|
return;
|
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
/* If the path is already in the library search paths
|
2009-04-12 14:39:54 +00:00
|
|
|
* 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,
|
2010-10-04 18:54:14 +00:00
|
|
|
* because it preserve use of default libraries paths, when the path is a sub path of
|
|
|
|
* these default paths
|
2009-04-12 14:39:54 +00:00
|
|
|
*/
|
* 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
|
|
|
wxFileName fn = fullFileName;
|
|
|
|
|
2014-06-10 15:56:43 +00:00
|
|
|
prj.SetRString( PROJECT::DOC_PATH, fn.GetPath() );
|
* 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
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString filename = search->FilenameWithRelativePathInSearchList(
|
|
|
|
fullFileName, wxPathOnly( Prj().GetProjectFullName() ) );
|
2009-04-15 15:53:21 +00:00
|
|
|
|
2009-10-23 15:28:45 +00:00
|
|
|
// Filenames are always stored in unix like mode, ie separator "\" is stored as "/"
|
|
|
|
// to ensure files are identical under unices and windows
|
|
|
|
#ifdef __WINDOWS__
|
2010-10-04 18:54:14 +00:00
|
|
|
filename.Replace( wxT( "\\" ), wxT( "/" ) );
|
2009-10-23 15:28:45 +00:00
|
|
|
#endif
|
2010-02-16 08:34:09 +00:00
|
|
|
m_DocfileCtrl->SetValue( filename );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2013-04-10 07:23:20 +00:00
|
|
|
if( IsOK( this, _( "OK to delete the footprint filter list ?" ) ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
|
|
|
m_FootprintFilterListBox->Clear();
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
|
|
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
2015-02-02 16:43:34 +00:00
|
|
|
m_buttonEditOneFootprintFilter->Enable( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
/* Add a new name to the footprint filter list box
|
|
|
|
* Obvioulsy, cannot be void
|
2007-09-20 21:06:49 +00:00
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
wxString Line;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
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;
|
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
wxTextEntryDialog dlg( this, _( "Add Footprint Filter" ), _( "Footprint Filter" ), Line );
|
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return; // cancelled by user
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
Line = dlg.GetValue();
|
2007-09-20 21:06:49 +00:00
|
|
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( Line.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
/* test for an existing name: */
|
2009-09-14 13:24:17 +00:00
|
|
|
int index = m_FootprintFilterListBox->FindString( Line );
|
|
|
|
|
|
|
|
if( index != wxNOT_FOUND )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
wxString msg;
|
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Foot print filter \"%s\" is already defined." ), GetChars( Line ) );
|
2009-09-14 13:24:17 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_FootprintFilterListBox->Append( Line );
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllFootprintFilter->Enable( true );
|
|
|
|
m_ButtonDeleteOneFootprintFilter->Enable( true );
|
2015-02-02 16:43:34 +00:00
|
|
|
m_buttonEditOneFootprintFilter->Enable( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* component = m_Parent->GetCurPart();
|
2007-09-20 21:06:49 +00:00
|
|
|
int ii = m_FootprintFilterListBox->GetSelection();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
m_FootprintFilterListBox->Delete( ii );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-11-18 21:10:52 +00:00
|
|
|
if( !component || ( m_FootprintFilterListBox->GetCount() == 0 ) )
|
2007-09-20 21:06:49 +00:00
|
|
|
{
|
2009-10-10 17:27:53 +00:00
|
|
|
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
|
|
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
2015-02-02 16:43:34 +00:00
|
|
|
m_buttonEditOneFootprintFilter->Enable( false );
|
2007-09-20 21:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
2015-02-02 16:43:34 +00:00
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int idx = m_FootprintFilterListBox->GetSelection();
|
|
|
|
|
|
|
|
if( idx < 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString filter = m_FootprintFilterListBox->GetStringSelection();
|
|
|
|
|
|
|
|
wxTextEntryDialog 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 );
|
|
|
|
}
|
2016-11-09 23:11:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateInterchangeableUnits( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
if( m_SelNumberOfUnits->GetValue() <= 1 )
|
|
|
|
m_OptionPartsLocked->Enable( false );
|
|
|
|
else
|
|
|
|
m_OptionPartsLocked->Enable( true );
|
|
|
|
}
|