2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-04-29 15:37:37 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2017-01-30 21:53:48 +00:00
|
|
|
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-28 13:43:37 +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
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file libedit.cpp
|
|
|
|
* @brief Eeschema component library editor.
|
|
|
|
*/
|
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 <gr_basic.h>
|
|
|
|
#include <macros.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>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
#include <class_sch_screen.h>
|
|
|
|
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <general.h>
|
|
|
|
#include <libeditframe.h>
|
|
|
|
#include <class_library.h>
|
|
|
|
#include <template_fieldnames.h>
|
2012-09-28 17:47:41 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2017-03-04 19:49:55 +00:00
|
|
|
#include <schframe.h>
|
2017-09-15 14:17:44 +00:00
|
|
|
#include <symbol_lib_table.h>
|
2017-11-12 17:55:20 +00:00
|
|
|
#include <lib_manager.h>
|
|
|
|
#include <cmp_tree_pane.h>
|
|
|
|
#include <component_tree.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2017-02-02 10:38:34 +00:00
|
|
|
#include <dialog_choose_component.h>
|
2017-03-06 14:50:48 +00:00
|
|
|
#include <cmp_tree_model_adapter.h>
|
2017-02-02 10:38:34 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialogs/dialog_lib_new_component.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::DisplayLibInfos()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
wxString lib = GetCurLib();
|
|
|
|
wxString title = _( "Symbol Library Editor - " );
|
|
|
|
|
|
|
|
if( !lib.empty() && Prj().SchSymbolLibTable()->HasLibrary( lib ) )
|
|
|
|
{
|
|
|
|
wxString fileName = Prj().SchSymbolLibTable()->GetFullURI( lib );
|
|
|
|
|
|
|
|
title += lib + " (" + fileName + ")";
|
|
|
|
|
2017-11-14 13:19:11 +00:00
|
|
|
if( wxFileName::FileExists( fileName ) && !wxFileName::IsFileWritable( fileName ) )
|
2017-10-06 18:07:43 +00:00
|
|
|
title += " " + _( "[Read Only]" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
title += _( "no library selected" );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2016-09-26 17:15:33 +00:00
|
|
|
SetTitle( title );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void LIB_EDIT_FRAME::SelectActiveLibrary( const wxString& aLibrary )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
wxString selectedLib = aLibrary;
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
if( selectedLib.empty() )
|
|
|
|
selectedLib = SelectLibraryFromList();
|
|
|
|
|
|
|
|
if( !selectedLib.empty() )
|
|
|
|
SetCurLib( selectedLib );
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
DisplayLibInfos();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId )
|
2011-05-28 18:51:32 +00:00
|
|
|
{
|
|
|
|
if( GetScreen()->IsModify()
|
2017-10-06 18:07:43 +00:00
|
|
|
&& !IsOK( this, _( "The current symbol is not saved.\n\nDiscard current changes?" ) ) )
|
2011-05-28 18:51:32 +00:00
|
|
|
return false;
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
SelectActiveLibrary( aLibId.GetLibNickname() );
|
|
|
|
return LoadComponentFromCurrentLib( aLibId.GetLibItemName() );
|
2011-05-28 18:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit,
|
|
|
|
int aConvert )
|
2011-05-28 18:51:32 +00:00
|
|
|
{
|
2017-10-06 18:07:43 +00:00
|
|
|
LIB_ALIAS* alias = nullptr;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
alias = Prj().SchSymbolLibTable()->LoadSymbol( GetCurLib(), aAliasName );
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Error occurred loading symbol \"%s\" from library \"%s\"." ),
|
2017-10-06 18:07:43 +00:00
|
|
|
aAliasName, GetCurLib() );
|
|
|
|
DisplayErrorMessage( this, msg, ioe.What() );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !alias || !LoadOneLibraryPartAux( alias, GetCurLib() ) )
|
2011-05-28 18:51:32 +00:00
|
|
|
return false;
|
|
|
|
|
2017-07-19 17:34:55 +00:00
|
|
|
if( aUnit > 0 )
|
|
|
|
m_unit = aUnit;
|
|
|
|
|
|
|
|
if( aConvert > 0 )
|
|
|
|
m_convert = aConvert;
|
|
|
|
|
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_editPinsPerPartOrConvert = GetCurPart()->UnitsLocked() ? true : false;
|
2011-05-28 18:51:32 +00:00
|
|
|
|
|
|
|
GetScreen()->ClearUndoRedoList();
|
|
|
|
Zoom_Automatique( false );
|
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
|
|
|
SetShowDeMorgan( GetCurPart()->HasConversion() );
|
2011-05-28 18:51:32 +00:00
|
|
|
|
2017-07-19 17:34:55 +00:00
|
|
|
if( aUnit > 0 )
|
|
|
|
UpdatePartSelectList();
|
|
|
|
|
2011-05-28 18:51:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, const wxString& aLibrary )
|
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
|
|
|
wxString msg, rootName;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
if( !aEntry || aLibrary.empty() )
|
2009-08-27 11:41:56 +00:00
|
|
|
return false;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( aEntry->GetName().IsEmpty() )
|
2009-08-27 11:41:56 +00:00
|
|
|
{
|
2017-12-15 11:37:46 +00:00
|
|
|
wxLogWarning( "Symbol in library \"%s\" has empty name field.", aLibrary );
|
2009-08-27 11:41:56 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
m_aliasName = aEntry->GetName();
|
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
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
LIB_PART* lib_part = m_libMgr->GetBufferedPart( m_aliasName, aLibrary );
|
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
|
|
|
wxASSERT( lib_part );
|
2017-11-12 17:55:20 +00:00
|
|
|
SetScreen( m_libMgr->GetScreen( lib_part->GetName(), aLibrary ) );
|
|
|
|
SetCurPart( new LIB_PART( *lib_part ) );
|
|
|
|
SetCurLib( aLibrary );
|
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
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
m_unit = 1;
|
|
|
|
m_convert = 1;
|
2017-11-12 17:55:20 +00:00
|
|
|
SetShowDeMorgan( GetCurPart()->HasConversion() );
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
Zoom_Automatique( false );
|
2009-09-14 13:24:17 +00:00
|
|
|
DisplayLibInfos();
|
|
|
|
UpdateAliasSelectList();
|
|
|
|
UpdatePartSelectList();
|
|
|
|
|
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
|
|
|
// Display the document information based on the entry selected just in
|
|
|
|
// case the entry is an alias.
|
2009-09-18 14:56:05 +00:00
|
|
|
DisplayCmpDoc();
|
2017-11-13 10:38:20 +00:00
|
|
|
Refresh();
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2012-03-06 14:08:59 +00:00
|
|
|
void LIB_EDIT_FRAME::RedrawComponent( wxDC* aDC, wxPoint aOffset )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2016-11-04 11:13:22 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
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 )
|
2010-07-20 10:30:40 +00:00
|
|
|
{
|
|
|
|
// display reference like in schematic (a reference U is shown U? or U?A)
|
|
|
|
// although it is stored without ? and part id.
|
|
|
|
// So temporary change the reference by a schematic like reference
|
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_FIELD* field = part->GetField( REFERENCE );
|
|
|
|
wxString fieldText = field->GetText();
|
|
|
|
wxString fieldfullText = field->GetFullText( m_unit );
|
|
|
|
|
2013-05-28 08:05:10 +00:00
|
|
|
field->EDA_TEXT::SetText( fieldfullText ); // change the field text string only
|
2017-02-19 18:40:26 +00:00
|
|
|
auto opts = PART_DRAW_OPTIONS::Default();
|
|
|
|
opts.show_elec_type = GetShowElectricalType();
|
|
|
|
part->Draw( m_canvas, aDC, aOffset, m_unit, m_convert, opts );
|
2013-05-28 08:05:10 +00:00
|
|
|
field->EDA_TEXT::SetText( fieldText ); // restore the field text string
|
2010-07-20 10:30:40 +00:00
|
|
|
}
|
2012-03-06 14:08:59 +00:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:38:39 +00:00
|
|
|
|
2012-03-06 14:08:59 +00:00
|
|
|
void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|
|
|
{
|
|
|
|
if( GetScreen() == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_canvas->DrawBackGround( DC );
|
|
|
|
|
|
|
|
RedrawComponent( DC, wxPoint( 0, 0 ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2014-06-16 16:32:23 +00:00
|
|
|
#ifdef USE_WX_OVERLAY
|
|
|
|
if( IsShown() )
|
|
|
|
{
|
|
|
|
m_overlay.Reset();
|
|
|
|
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC );
|
|
|
|
overlaydc.Clear();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->DrawCrossHair( DC );
|
2010-01-22 18:13:43 +00:00
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
DisplayLibInfos();
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
void LIB_EDIT_FRAME::OnSaveLibrary( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
saveLibrary( getTargetLib(), event.GetId() == ID_LIBEDIT_SAVE_LIBRARY_AS );
|
|
|
|
m_treePane->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnSaveAllLibraries( wxCommandEvent& event )
|
|
|
|
{
|
2017-11-13 09:55:05 +00:00
|
|
|
saveAllLibraries();
|
2017-11-12 17:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnRevertLibrary( wxCommandEvent& aEvent )
|
2013-02-07 17:35:37 +00:00
|
|
|
{
|
2017-11-12 17:55:20 +00:00
|
|
|
wxString libName = getTargetLib();
|
|
|
|
bool currentLib = ( libName == GetCurLib() );
|
|
|
|
|
|
|
|
// Save the current part name/unit to reload after revert
|
|
|
|
wxString alias = m_aliasName;
|
|
|
|
int unit = m_unit;
|
|
|
|
|
|
|
|
if( !IsOK( this, _( "The revert operation cannot be undone!\n\nRevert changes?" ) ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( currentLib )
|
|
|
|
emptyScreen();
|
|
|
|
|
|
|
|
m_libMgr->RevertLibrary( libName );
|
|
|
|
|
|
|
|
if( currentLib && m_libMgr->PartExists( alias, libName ) )
|
|
|
|
loadPart( alias, libName, unit );
|
2013-02-07 17:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
|
|
|
m_drawItem = NULL;
|
2017-11-13 11:30:03 +00:00
|
|
|
wxString lib = getTargetLib();
|
|
|
|
|
|
|
|
if( !m_libMgr->LibraryExists( lib ) )
|
|
|
|
{
|
|
|
|
lib = SelectLibraryFromList();
|
|
|
|
|
|
|
|
if( !m_libMgr->LibraryExists( lib ) )
|
|
|
|
return;
|
|
|
|
}
|
2017-11-12 17:55:20 +00:00
|
|
|
|
|
|
|
DIALOG_LIB_NEW_COMPONENT dlg( this );
|
|
|
|
dlg.SetMinSize( dlg.GetSize() );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( dlg.GetName().IsEmpty() )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "This new symbol has no name and cannot be created." ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString name = dlg.GetName();
|
|
|
|
name.Replace( " ", "_" );
|
|
|
|
|
|
|
|
// Test if there is a component with this name already.
|
|
|
|
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
|
|
|
|
{
|
2017-12-15 11:37:46 +00:00
|
|
|
wxString msg = wxString::Format( _( "Symbol \"%s\" already exists in library \"%s\"" ),
|
2017-11-12 17:55:20 +00:00
|
|
|
name, lib );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-13 11:34:37 +00:00
|
|
|
LIB_PART new_part( name ); // do not create part on the heap, it will be buffered soon
|
|
|
|
m_aliasName = name;
|
|
|
|
new_part.GetReferenceField().SetText( dlg.GetReference() );
|
|
|
|
new_part.SetUnitCount( dlg.GetUnitCount() );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2017-11-13 11:34:37 +00:00
|
|
|
// Initialize new_part.m_TextInside member:
|
2017-11-12 17:55:20 +00:00
|
|
|
// if 0, pin text is outside the body (on the pin)
|
|
|
|
// if > 0, pin text is inside the body
|
2017-11-13 11:34:37 +00:00
|
|
|
new_part.SetConversion( dlg.GetAlternateBodyStyle() );
|
2017-11-12 17:55:20 +00:00
|
|
|
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
|
|
|
|
|
|
|
|
if( dlg.GetPinNameInside() )
|
|
|
|
{
|
2017-11-13 11:34:37 +00:00
|
|
|
new_part.SetPinNameOffset( dlg.GetPinTextPosition() );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2017-11-13 11:34:37 +00:00
|
|
|
if( new_part.GetPinNameOffset() == 0 )
|
|
|
|
new_part.SetPinNameOffset( 1 );
|
2017-11-12 17:55:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-13 11:34:37 +00:00
|
|
|
new_part.SetPinNameOffset( 0 );
|
2017-11-12 17:55:20 +00:00
|
|
|
}
|
|
|
|
|
2017-11-13 11:34:37 +00:00
|
|
|
( dlg.GetPowerSymbol() ) ? new_part.SetPower() : new_part.SetNormal();
|
|
|
|
new_part.SetShowPinNumbers( dlg.GetShowPinNumber() );
|
|
|
|
new_part.SetShowPinNames( dlg.GetShowPinName() );
|
|
|
|
new_part.LockUnits( dlg.GetLockItems() );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
|
|
|
if( dlg.GetUnitCount() < 2 )
|
2017-11-13 11:34:37 +00:00
|
|
|
new_part.LockUnits( false );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
2017-11-13 11:34:37 +00:00
|
|
|
m_libMgr->UpdatePart( &new_part, lib );
|
2017-11-12 17:55:20 +00:00
|
|
|
loadPart( name, lib, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnEditPart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
int unit = 0;
|
|
|
|
LIB_ID partId = m_treePane->GetCmpTree()->GetSelectedLibId( &unit );
|
|
|
|
loadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnSavePart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
LIB_ID libId = getTargetLibId();
|
2017-11-13 22:13:10 +00:00
|
|
|
|
|
|
|
if( m_libMgr->FlushPart( libId.GetLibItemName(), libId.GetLibNickname() ) )
|
|
|
|
m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() );
|
|
|
|
|
|
|
|
m_treePane->Refresh();
|
2017-11-12 17:55:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnRemovePart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
LIB_ID libId = getTargetLibId();
|
|
|
|
|
|
|
|
if( m_libMgr->IsPartModified( libId.GetLibItemName(), libId.GetLibNickname() )
|
|
|
|
&& !IsOK( this, _( wxString::Format( "Component %s has been modified\n"
|
|
|
|
"Do you want to remove it from the library?", libId.GetLibItemName().c_str() ) ) ) )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( isCurrentPart( libId ) )
|
|
|
|
emptyScreen();
|
|
|
|
|
|
|
|
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-13 19:39:36 +00:00
|
|
|
void LIB_EDIT_FRAME::OnCopyCutPart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
int unit = 0;
|
|
|
|
LIB_ID partId = m_treePane->GetCmpTree()->GetSelectedLibId( &unit );
|
|
|
|
LIB_PART* part = m_libMgr->GetBufferedPart( partId.GetLibItemName(), partId.GetLibNickname() );
|
|
|
|
|
|
|
|
if( !part )
|
|
|
|
return;
|
|
|
|
|
|
|
|
LIB_ID libId = getTargetLibId();
|
|
|
|
m_copiedPart.reset( new LIB_PART( *part ) );
|
|
|
|
|
|
|
|
if( aEvent.GetId() == ID_LIBEDIT_CUT_PART )
|
|
|
|
{
|
|
|
|
if( isCurrentPart( libId ) )
|
|
|
|
emptyScreen();
|
|
|
|
|
|
|
|
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::OnPasteDuplicatePart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
int unit = 0;
|
|
|
|
LIB_ID libId = m_treePane->GetCmpTree()->GetSelectedLibId( &unit );
|
|
|
|
wxString lib = libId.GetLibNickname();
|
|
|
|
|
|
|
|
if( !m_libMgr->LibraryExists( lib ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
LIB_PART* srcPart = nullptr;
|
|
|
|
|
|
|
|
if( aEvent.GetId() == ID_LIBEDIT_DUPLICATE_PART )
|
|
|
|
srcPart = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
|
|
|
|
else if( aEvent.GetId() == ID_LIBEDIT_PASTE_PART )
|
|
|
|
srcPart = m_copiedPart.get();
|
|
|
|
else
|
|
|
|
wxFAIL;
|
|
|
|
|
|
|
|
if( !srcPart )
|
|
|
|
return;
|
|
|
|
|
|
|
|
LIB_PART newPart( *srcPart );
|
|
|
|
fixDuplicateAliases( &newPart, lib );
|
|
|
|
m_libMgr->UpdatePart( &newPart, lib );
|
2017-11-14 11:03:19 +00:00
|
|
|
m_treePane->GetCmpTree()->SelectLibId( LIB_ID( lib, newPart.GetName() ) );
|
2017-11-13 19:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary )
|
|
|
|
{
|
|
|
|
wxString newName;
|
|
|
|
|
2017-11-14 14:05:35 +00:00
|
|
|
for( unsigned int i = 0; i < aPart->GetAliasCount(); ++i )
|
2017-11-13 19:39:36 +00:00
|
|
|
{
|
|
|
|
LIB_ALIAS* alias = aPart->GetAlias( i );
|
|
|
|
int sfx = 0;
|
|
|
|
newName = alias->GetName();
|
|
|
|
|
|
|
|
while( m_libMgr->PartExists( newName, aLibrary ) )
|
|
|
|
{
|
2017-11-24 16:39:58 +00:00
|
|
|
newName = wxString::Format( "%s_%d", alias->GetName(), sfx );
|
2017-11-13 19:39:36 +00:00
|
|
|
++sfx;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( i == 0 )
|
|
|
|
aPart->SetName( newName );
|
|
|
|
else
|
|
|
|
alias->SetName( newName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
void LIB_EDIT_FRAME::OnRevertPart( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
LIB_ID libId = getTargetLibId();
|
|
|
|
bool currentPart = isCurrentPart( libId );
|
|
|
|
int unit = m_unit;
|
|
|
|
|
|
|
|
if( currentPart )
|
|
|
|
emptyScreen();
|
|
|
|
|
2017-11-13 22:13:10 +00:00
|
|
|
if( m_libMgr->RevertPart( libId.GetLibItemName(), libId.GetLibNickname() ) )
|
|
|
|
m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() );
|
2017-11-12 17:55:20 +00:00
|
|
|
|
|
|
|
if( currentPart && m_libMgr->PartExists( libId.GetLibItemName(), libId.GetLibNickname() ) )
|
|
|
|
loadPart( libId.GetLibItemName(), libId.GetLibNickname(), unit );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_FRAME::loadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit )
|
|
|
|
{
|
|
|
|
wxCHECK( m_libMgr->PartExists( aAlias, aLibrary ), /* void */ );
|
|
|
|
LIB_PART* part = m_libMgr->GetBufferedPart( aAlias, aLibrary );
|
|
|
|
LIB_ALIAS* alias = part ? part->GetAlias( aAlias ) : nullptr;
|
|
|
|
|
|
|
|
if( !alias )
|
|
|
|
{
|
2017-12-15 11:37:46 +00:00
|
|
|
wxString msg = wxString::Format( _( "Part name \"%s\" not found in library \"%s\"" ),
|
2017-11-12 17:55:20 +00:00
|
|
|
GetChars( aAlias ), GetChars( aLibrary ) );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_lastDrawItem = m_drawItem = nullptr;
|
|
|
|
m_aliasName = aAlias;
|
|
|
|
m_unit = ( aUnit <= part->GetUnitCount() ? aUnit : 1 );
|
|
|
|
|
|
|
|
LoadOneLibraryPartAux( alias, aLibrary );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn;
|
2009-08-27 11:41:56 +00:00
|
|
|
wxString msg;
|
2017-10-06 18:07:43 +00:00
|
|
|
PROJECT& prj = Prj();
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2017-11-13 09:55:05 +00:00
|
|
|
if( !aNewFile && ( aLibrary.empty() || !prj.SchSymbolLibTable()->HasLibrary( aLibrary ) ) )
|
2009-09-14 13:24:17 +00:00
|
|
|
{
|
2011-08-12 17:43:16 +00:00
|
|
|
DisplayError( this, _( "No library specified." ) );
|
2013-02-07 17:35:37 +00:00
|
|
|
return false;
|
2009-09-14 13:24:17 +00:00
|
|
|
}
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
if( aNewFile )
|
* 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
|
|
|
{
|
2017-11-13 09:55:05 +00:00
|
|
|
SEARCH_STACK* search = prj.SchSearchS();
|
* 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
|
|
|
|
|
|
|
// Get a new name for the library
|
2014-06-10 15:56:43 +00:00
|
|
|
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
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
|
|
|
|
2014-06-10 15:56:43 +00:00
|
|
|
if( !default_path )
|
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
|
|
|
default_path = search->LastVisitedPath();
|
* 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
|
|
|
|
2017-11-13 09:55:05 +00:00
|
|
|
fn.SetName( aLibrary );
|
|
|
|
fn.SetExt( SchematicLibraryFileExtension );
|
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
wxFileDialog dlg( this, wxString::Format( _( "Save Library \"%s\" As..." ), aLibrary ),
|
2017-11-13 09:55:05 +00:00
|
|
|
default_path, fn.GetFullName(), SchematicLibraryFileWildcard(),
|
2010-03-18 20:35:29 +00:00
|
|
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
2013-02-07 17:35:37 +00:00
|
|
|
return false;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
fn = dlg.GetPath();
|
|
|
|
|
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
|
|
|
// The GTK file chooser doesn't return the file extension added to
|
|
|
|
// file name so add it here.
|
2010-03-18 20:35:29 +00:00
|
|
|
if( fn.GetExt().IsEmpty() )
|
2012-09-28 17:47:41 +00:00
|
|
|
fn.SetExt( SchematicLibraryFileExtension );
|
2010-03-18 20:35:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-13 09:55:05 +00:00
|
|
|
fn = prj.SchSymbolLibTable()->GetFullURI( aLibrary );
|
2010-03-18 20:35:29 +00:00
|
|
|
}
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
// Verify the user has write privileges before attempting to save the library file.
|
2011-08-18 19:25:12 +00:00
|
|
|
if( !IsWritable( fn ) )
|
2013-02-07 17:35:37 +00:00
|
|
|
return false;
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
ClearMsgPanel();
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
// Copy .lib file to .bak.
|
2017-11-13 14:15:10 +00:00
|
|
|
if( !backupFile( fn, "bak" ) )
|
|
|
|
return false;
|
2011-11-11 20:10:24 +00:00
|
|
|
|
2017-11-13 14:15:10 +00:00
|
|
|
wxFileName docFileName = fn;
|
2011-11-11 20:10:24 +00:00
|
|
|
docFileName.SetExt( DOC_EXT );
|
|
|
|
|
2017-11-13 14:15:10 +00:00
|
|
|
// Copy .dcm file to .bck.
|
|
|
|
if( !backupFile( docFileName, "bck" ) )
|
|
|
|
return false;
|
2011-11-11 20:10:24 +00:00
|
|
|
|
2017-11-13 14:15:10 +00:00
|
|
|
if( !m_libMgr->SaveLibrary( aLibrary, fn.GetFullPath() ) )
|
2011-11-11 20:10:24 +00:00
|
|
|
{
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Failed to save changes to symbol library file \"%s\"" ),
|
2017-11-13 14:15:10 +00:00
|
|
|
fn.GetFullPath() );
|
2017-11-13 13:58:39 +00:00
|
|
|
DisplayErrorMessage( this, _( "Error saving library" ), msg );
|
|
|
|
return false;
|
2011-11-11 20:10:24 +00:00
|
|
|
}
|
|
|
|
|
2017-11-13 22:13:10 +00:00
|
|
|
if( !aNewFile )
|
|
|
|
m_libMgr->ClearLibraryModified( aLibrary );
|
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Symbol library file \"%s\" saved" ), fn.GetFullPath() );
|
2013-04-09 17:49:01 +00:00
|
|
|
wxString msg1;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg1.Printf( _( "Symbol library documentation file \"%s\" saved" ), docFileName.GetFullPath() );
|
2011-11-11 20:10:24 +00:00
|
|
|
AppendMsgPanel( msg, msg1, BLUE );
|
2017-02-16 01:28:36 +00:00
|
|
|
UpdateAliasSelectList();
|
|
|
|
UpdatePartSelectList();
|
2017-03-10 13:38:39 +00:00
|
|
|
refreshSchematic();
|
2017-03-04 19:49:55 +00:00
|
|
|
|
2013-02-07 17:35:37 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-13 09:55:05 +00:00
|
|
|
bool LIB_EDIT_FRAME::saveAllLibraries()
|
|
|
|
{
|
|
|
|
wxArrayString unsavedLibraries;
|
|
|
|
// There are two stages: first try to save libraries to the original files.
|
|
|
|
// In case of problems, ask the user to save them in a new location.
|
|
|
|
bool firstRun = true;
|
|
|
|
bool allSaved = false;
|
|
|
|
|
|
|
|
while( !allSaved )
|
|
|
|
{
|
|
|
|
allSaved = true;
|
|
|
|
unsavedLibraries.Empty();
|
|
|
|
|
|
|
|
for( const auto& lib : m_libMgr->GetLibraryNames() )
|
|
|
|
{
|
|
|
|
if( m_libMgr->IsLibraryModified( lib ) )
|
|
|
|
unsavedLibraries.Add( lib );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !unsavedLibraries.IsEmpty() )
|
|
|
|
{
|
|
|
|
auto res = SelectMultipleOptions( this, _( "Save Libraries" ),
|
|
|
|
firstRun ? _( "Select libraries to save before closing" )
|
|
|
|
: _( "Some libraries could not be saved to their original files.\n\n"
|
|
|
|
"Do you want to save them to a new file?" ),
|
|
|
|
unsavedLibraries, true );
|
|
|
|
|
|
|
|
if( !res.first )
|
|
|
|
return false; // dialog has been cancelled
|
|
|
|
|
|
|
|
for( auto libIndex : res.second )
|
|
|
|
allSaved &= saveLibrary( unsavedLibraries[libIndex], !firstRun );
|
|
|
|
|
|
|
|
firstRun = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::DisplayCmpDoc()
|
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_ALIAS* alias;
|
|
|
|
LIB_PART* part = GetCurPart();
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
ClearMsgPanel();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
if( !part )
|
2009-01-29 14:26:20 +00:00
|
|
|
return;
|
|
|
|
|
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 msg = part->GetName();
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2013-11-09 16:30:49 +00:00
|
|
|
AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
|
2009-09-18 14:56:05 +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( m_aliasName == part->GetName() )
|
2009-09-18 14:56:05 +00:00
|
|
|
msg = _( "None" );
|
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
msg = m_aliasName;
|
2009-09-18 14:56:05 +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
|
|
|
alias = part->GetAlias( m_aliasName );
|
2010-10-04 18:54:14 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
wxCHECK_RET( alias != NULL, "Alias not found in symbol." );
|
2010-10-04 18:54:14 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
AppendMsgPanel( _( "Alias" ), msg, RED, 8 );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
|
|
|
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
|
2009-09-25 18:49:04 +00:00
|
|
|
msg = UnitLetter[m_unit];
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_convert > 1 )
|
2009-09-18 14:56:05 +00:00
|
|
|
msg = _( "Convert" );
|
|
|
|
else
|
|
|
|
msg = _( "Normal" );
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
|
2009-09-18 14:56:05 +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->IsPower() )
|
2009-09-18 14:56:05 +00:00
|
|
|
msg = _( "Power Symbol" );
|
|
|
|
else
|
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
|
|
|
msg = _( "Part" );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
|
2010-10-04 18:54:14 +00:00
|
|
|
AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
|
|
|
|
AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
|
|
|
|
AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|