2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2014-09-29 10:51:04 +00:00
|
|
|
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-11-12 17:55:20 +00:00
|
|
|
* Copyright (C) 2017 CERN
|
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
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-10-07 14:41:30 +00:00
|
|
|
/**
|
2018-01-30 10:49:51 +00:00
|
|
|
* @file lib_edit_frame.h
|
2011-10-07 14:41:30 +00:00
|
|
|
* @brief Definition of class LIB_EDIT_FRAME
|
|
|
|
*/
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2018-01-30 10:49:51 +00:00
|
|
|
#ifndef LIB_EDIT_FRAME_H
|
|
|
|
#define LIB_EDIT_FRAME_H
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2012-01-09 17:24:01 +00:00
|
|
|
#include <sch_base_frame.h>
|
2018-01-30 08:56:43 +00:00
|
|
|
#include <sch_screen.h>
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2012-01-09 17:24:01 +00:00
|
|
|
#include <lib_draw_item.h>
|
|
|
|
#include <lib_collectors.h>
|
2010-10-22 12:11:52 +00:00
|
|
|
|
2017-11-13 19:39:36 +00:00
|
|
|
#include <core/optional.h>
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2017-11-12 17:55:20 +00:00
|
|
|
class SYMBOL_LIB_TABLE;
|
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
|
|
|
class LIB_PART;
|
2010-02-04 17:46:12 +00:00
|
|
|
class LIB_ALIAS;
|
2010-11-10 15:30:12 +00:00
|
|
|
class LIB_FIELD;
|
2010-11-17 21:47:27 +00:00
|
|
|
class DIALOG_LIB_EDIT_TEXT;
|
2017-11-12 17:55:20 +00:00
|
|
|
class CMP_TREE_PANE;
|
2017-10-06 18:07:43 +00:00
|
|
|
class LIB_ID;
|
2017-11-12 17:55:20 +00:00
|
|
|
class LIB_MANAGER;
|
2017-10-06 18:07:43 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* The symbol library editor main window.
|
2010-02-04 17:46:12 +00:00
|
|
|
*/
|
2012-01-09 17:24:01 +00:00
|
|
|
class LIB_EDIT_FRAME : public SCH_BASE_FRAME
|
2010-02-04 17:46:12 +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* m_my_part; ///< a part I own, it is not in any library, but a copy could be.
|
|
|
|
LIB_PART* m_tempCopyComponent; ///< temp copy of a part during edit, I own it here.
|
* 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
|
|
|
LIB_COLLECTOR m_collectedItems; ///< Used for hit testing.
|
|
|
|
wxComboBox* m_partSelectBox; ///< a Box to select a part to edit (if any)
|
|
|
|
wxComboBox* m_aliasSelectBox; ///< a box to select the alias to edit (if any)
|
2017-11-12 17:55:20 +00:00
|
|
|
CMP_TREE_PANE* m_treePane; ///< component search tree widget
|
|
|
|
LIB_MANAGER* m_libMgr; ///< manager taking care of temporary modificatoins
|
2011-04-27 19:44:32 +00:00
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
/** Convert of the item currently being drawn. */
|
|
|
|
bool m_drawSpecificConvert;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specify which component parts the current draw item applies to.
|
|
|
|
*
|
|
|
|
* If true, the item being drawn or edited applies only to the selected
|
|
|
|
* part. Otherwise it applies to all parts in the component.
|
|
|
|
*/
|
|
|
|
bool m_drawSpecificUnit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set to true to not synchronize pins at the same position when editing
|
2018-01-08 09:48:33 +00:00
|
|
|
* symbols with multiple units or multiple body styles.
|
|
|
|
* Therefore deleting, moving pins are made for all pins at the same location
|
|
|
|
* When units are interchangeable, synchronizing edition of pins is usually
|
|
|
|
* the best way, because if units are interchangeable, it imply all similar
|
2018-01-23 11:15:19 +00:00
|
|
|
* pins are on the same location.
|
2018-01-08 09:48:33 +00:00
|
|
|
* When units are non interchangeable, do not synchronize edition of pins, because
|
2018-01-23 11:15:19 +00:00
|
|
|
* each part is specific, and there are no similar pins between units.
|
2018-01-08 09:48:33 +00:00
|
|
|
*
|
|
|
|
* Setting this to false allows editing each pin per part or body style
|
|
|
|
* regardless other pins at the same location.
|
2011-12-09 16:37:11 +00:00
|
|
|
* This requires the user to open each part or body style to make changes
|
2018-01-08 09:48:33 +00:00
|
|
|
* to the other pins at the same location.
|
2018-01-22 12:33:24 +00:00
|
|
|
* To know if others pins must be coupled when editing a pin, use
|
2018-01-23 11:15:19 +00:00
|
|
|
* SynchronizePins() instead of m_syncPinEdit, because SynchronizePins()
|
2018-01-22 12:33:24 +00:00
|
|
|
* is more reliable (takes in account the fact units are interchangeable,
|
2018-01-23 11:15:19 +00:00
|
|
|
* there are more than one unit).
|
2011-12-09 16:37:11 +00:00
|
|
|
*/
|
2018-01-23 11:15:19 +00:00
|
|
|
bool m_syncPinEdit;
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2016-11-04 11:13:22 +00:00
|
|
|
/**
|
|
|
|
* the option to show the pin electrical name in the component editor
|
|
|
|
*/
|
|
|
|
bool m_showPinElectricalTypeName;
|
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
/** The current draw or edit graphic item fill style. */
|
|
|
|
static FILL_T m_drawFillStyle;
|
|
|
|
|
|
|
|
/** Default line width for drawing or editing graphic items. */
|
|
|
|
static int m_drawLineWidth;
|
|
|
|
|
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
|
|
|
static LIB_ITEM* m_lastDrawItem;
|
|
|
|
static wxString m_aliasName;
|
2011-12-09 16:37:11 +00:00
|
|
|
|
|
|
|
// The unit number to edit and show
|
|
|
|
static int m_unit;
|
|
|
|
|
|
|
|
// Show the normal shape ( m_convert <= 1 ) or the converted shape
|
|
|
|
// ( m_convert > 1 )
|
|
|
|
static int m_convert;
|
|
|
|
|
|
|
|
// true to force DeMorgan/normal tools selection enabled.
|
|
|
|
// They are enabled when the loaded component has
|
|
|
|
// Graphic items for converted shape
|
|
|
|
// But under some circumstances (New component created)
|
2014-08-25 16:31:32 +00:00
|
|
|
// these tools must left enabled
|
2011-12-09 16:37:11 +00:00
|
|
|
static bool m_showDeMorgan;
|
|
|
|
|
|
|
|
/// The current text size setting.
|
|
|
|
static int m_textSize;
|
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
/// Current text angle setting.
|
|
|
|
static double m_current_text_angle;
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2014-08-25 16:31:32 +00:00
|
|
|
/// The default pin num text size setting.
|
|
|
|
static int m_textPinNumDefaultSize;
|
|
|
|
|
|
|
|
/// The default pin name text size setting.
|
|
|
|
static int m_textPinNameDefaultSize;
|
|
|
|
|
|
|
|
/// Default pin length
|
|
|
|
static int m_defaultPinLength;
|
|
|
|
|
2015-04-22 11:39:00 +00:00
|
|
|
/// Default repeat offset for pins in repeat place pin
|
|
|
|
int m_repeatPinStep;
|
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
static wxSize m_clientSize;
|
|
|
|
|
|
|
|
friend class DIALOG_LIB_EDIT_TEXT;
|
|
|
|
|
|
|
|
LIB_ITEM* locateItem( const wxPoint& aPosition, const KICAD_T aFilterList[] );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
public:
|
* 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
|
|
|
|
2014-05-05 15:15:54 +00:00
|
|
|
LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
~LIB_EDIT_FRAME();
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
/** The nickname of the current library being edited and empty string if none. */
|
2017-11-12 17:55:20 +00:00
|
|
|
wxString GetCurLib() const;
|
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-10-06 18:07:43 +00:00
|
|
|
/** Sets the current library nickname and returns the old library nickname. */
|
|
|
|
wxString SetCurLib( const wxString& aLibNickname );
|
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-10-06 18:07:43 +00:00
|
|
|
* Return the current part being edited or NULL if none selected.
|
|
|
|
*
|
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
|
|
|
* This is a LIB_PART that I own, it is at best a copy of one in a library.
|
|
|
|
*/
|
2017-11-12 17:55:20 +00:00
|
|
|
LIB_PART* GetCurPart() const
|
|
|
|
{
|
|
|
|
return m_my_part;
|
|
|
|
}
|
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-10-06 18:07:43 +00:00
|
|
|
* Take ownership of aPart and notes that it is the one currently being edited.
|
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
|
|
|
*/
|
|
|
|
void SetCurPart( LIB_PART* aPart );
|
|
|
|
|
2014-08-25 16:31:32 +00:00
|
|
|
/** @return the default pin num text size.
|
|
|
|
*/
|
|
|
|
static int GetPinNumDefaultSize() { return m_textPinNumDefaultSize; }
|
|
|
|
|
|
|
|
/** @return The default pin name text size setting.
|
|
|
|
*/
|
|
|
|
static int GetPinNameDefaultSize() { return m_textPinNameDefaultSize; }
|
|
|
|
|
|
|
|
/** @return The default pin len setting.
|
|
|
|
*/
|
|
|
|
static int GetDefaultPinLength() { return m_defaultPinLength; }
|
|
|
|
|
|
|
|
/** Set the default pin len.
|
|
|
|
*/
|
2015-04-22 11:39:00 +00:00
|
|
|
static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the increment value of the position of a pin
|
|
|
|
* for the pin repeat command
|
|
|
|
*/
|
|
|
|
int GetRepeatPinStep() const { return m_repeatPinStep; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the repeat step value for pins repeat command
|
|
|
|
* @param aStep the increment value of the position of an item
|
|
|
|
* for the repeat command
|
|
|
|
*/
|
|
|
|
void SetRepeatPinStep( int aStep) { m_repeatPinStep = aStep; }
|
2014-08-25 16:31:32 +00:00
|
|
|
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateMenuBar() override;
|
2010-03-18 20:35:29 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void InstallConfigFrame( wxCommandEvent& event );
|
2014-08-25 16:31:32 +00:00
|
|
|
void OnPreferencesOptions( wxCommandEvent& event );
|
2011-10-07 14:41:30 +00:00
|
|
|
void Process_Config( wxCommandEvent& event );
|
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
/**
|
2018-01-09 07:54:24 +00:00
|
|
|
* Pin edition (add, delete, move...) can be synchronized between units
|
|
|
|
* when units are interchangeable because in this case similar pins are expected
|
|
|
|
* at the same location
|
|
|
|
* @return true if the edit pins separately option is false and the current symbol
|
|
|
|
* has multiple interchengeable units.
|
|
|
|
* Otherwise return false.
|
2011-10-28 13:43:37 +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
|
|
|
bool SynchronizePins();
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Plot the current symbol in SVG or PNG format.
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
|
|
|
void OnPlotCurrentComponent( wxCommandEvent& event );
|
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void OnSelectTool( wxCommandEvent& aEvent );
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
/**
|
|
|
|
* Creates a new library. The library is added to the project libraries table.
|
|
|
|
*/
|
|
|
|
void OnCreateNewLibrary( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
addLibraryFile( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds an existing library. The library is added to the project libraries table.
|
|
|
|
*/
|
|
|
|
void OnAddLibrary( wxCommandEvent& aEvent )
|
|
|
|
{
|
|
|
|
addLibraryFile( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The command event handler to save the changes to the current library.
|
|
|
|
*
|
|
|
|
* A backup file of the current library is saved with the .bak extension before the
|
|
|
|
* changes made to the library are saved.
|
|
|
|
*/
|
|
|
|
void OnSaveLibrary( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves all changes in modified libraries.
|
|
|
|
*/
|
|
|
|
void OnSaveAllLibraries( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverts unsaved changes in a library.
|
|
|
|
*/
|
|
|
|
void OnRevertLibrary( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new part in the selected library.
|
|
|
|
*/
|
|
|
|
void OnCreateNewPart( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the selected part for editing.
|
|
|
|
*/
|
|
|
|
void OnEditPart( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* Routine to read one part.
|
|
|
|
* The format is that of libraries, but it loads only 1 component.
|
|
|
|
* Or 1 component if there are several.
|
|
|
|
* If the first component is an alias, it will load the corresponding root.
|
|
|
|
*/
|
|
|
|
void OnImportPart( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
2017-11-12 17:55:20 +00:00
|
|
|
* Creates a new library and backup the current component in this library or exports
|
2011-10-07 14:41:30 +00:00
|
|
|
* the component of the current library.
|
|
|
|
*/
|
|
|
|
void OnExportPart( wxCommandEvent& event );
|
2017-10-31 11:13:20 +00:00
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
/**
|
|
|
|
* Saves a single part in the selected library. The library file is updated without including
|
|
|
|
* the remaining unsaved changes.
|
|
|
|
*/
|
|
|
|
void OnSavePart( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverts unsaved changes in a part, restoring to the last saved state.
|
|
|
|
*/
|
|
|
|
void OnRevertPart( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a part from the working copy of a library.
|
|
|
|
*/
|
|
|
|
void OnRemovePart( wxCommandEvent& aEvent );
|
|
|
|
|
2017-11-13 19:39:36 +00:00
|
|
|
void OnCopyCutPart( wxCommandEvent& aEvent );
|
|
|
|
void OnPasteDuplicatePart( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnSelectAlias( wxCommandEvent& event );
|
|
|
|
void OnSelectPart( wxCommandEvent& event );
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2016-11-04 12:59:45 +00:00
|
|
|
/**
|
|
|
|
* From Option toolbar: option to show the electrical pin type name
|
|
|
|
*/
|
|
|
|
void OnShowElectricalType( wxCommandEvent& event );
|
|
|
|
|
2017-10-31 11:13:20 +00:00
|
|
|
void OnToggleSearchTree( wxCommandEvent& event );
|
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
|
2017-10-31 11:13:20 +00:00
|
|
|
|
2017-11-12 17:55:20 +00:00
|
|
|
bool IsSearchTreeShown();
|
2018-01-20 17:15:46 +00:00
|
|
|
void ClearSearchTreeSelection();
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnEditComponentProperties( wxCommandEvent& event );
|
2017-11-12 17:55:20 +00:00
|
|
|
void InstallFieldsEditorDialog( wxCommandEvent& event );
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnViewEntryDoc( wxCommandEvent& event );
|
|
|
|
void OnCheckComponent( wxCommandEvent& event );
|
|
|
|
void OnSelectBodyStyle( wxCommandEvent& event );
|
|
|
|
void OnEditPin( wxCommandEvent& event );
|
2011-04-27 19:44:32 +00:00
|
|
|
void OnSelectItem( wxCommandEvent& aEvent );
|
2010-11-13 11:02:24 +00:00
|
|
|
|
2015-03-27 10:26:07 +00:00
|
|
|
void OnOpenPinTable( wxCommandEvent& aEvent );
|
|
|
|
|
2017-11-20 14:38:38 +00:00
|
|
|
void OnUpdatePaste( wxUpdateUIEvent& event );
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
2017-11-12 17:55:20 +00:00
|
|
|
void OnUpdatePartModified( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateLibModified( wxUpdateUIEvent& aEvent );
|
2017-11-13 19:39:36 +00:00
|
|
|
void OnUpdateClipboardNotEmpty( wxUpdateUIEvent& aEvent );
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnUpdateUndo( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateRedo( wxUpdateUIEvent& event );
|
2017-11-13 10:38:20 +00:00
|
|
|
void OnUpdateSaveLib( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSaveLibAs( wxUpdateUIEvent& event );
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnUpdateViewDoc( wxUpdateUIEvent& event );
|
2018-01-23 11:15:19 +00:00
|
|
|
void OnUpdateSyncPinEdit( wxUpdateUIEvent& event );
|
2015-03-27 10:26:07 +00:00
|
|
|
void OnUpdatePinTable( wxUpdateUIEvent& event );
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnUpdatePartNumber( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateDeMorganNormal( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateDeMorganConvert( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSelectAlias( wxUpdateUIEvent& event );
|
2016-11-04 12:59:45 +00:00
|
|
|
void OnUpdateElectricalType( wxUpdateUIEvent& aEvent );
|
2011-10-07 14:41:30 +00:00
|
|
|
|
|
|
|
void UpdateAliasSelectList();
|
|
|
|
void UpdatePartSelectList();
|
2011-08-12 17:43:16 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Updates the main window title bar with the current library name and read only status
|
2011-08-12 17:43:16 +00:00
|
|
|
* of the library.
|
|
|
|
*/
|
|
|
|
void DisplayLibInfos();
|
|
|
|
|
2012-03-06 14:08:59 +00:00
|
|
|
/**
|
|
|
|
* Redraw the current component loaded in library editor
|
|
|
|
* Display reference like in schematic (a reference U is shown U? or U?A)
|
|
|
|
* accordint to the current selected unit and De Morgan selection
|
|
|
|
* although it is stored without ? and part id.
|
|
|
|
* @param aDC = the current device context
|
2013-05-13 17:30:27 +00:00
|
|
|
* @param aOffset = a draw offset. usually 0,0 to draw on the screen, but
|
2012-03-06 14:08:59 +00:00
|
|
|
* can be set to page size / 2 to draw or print in SVG format.
|
|
|
|
*/
|
|
|
|
void RedrawComponent( wxDC* aDC, wxPoint aOffset );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraw the current component loaded in library editor, an axes
|
|
|
|
* Display reference like in schematic (a reference U is shown U? or U?A)
|
|
|
|
* update status bar and info shown in the bottom of the window
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
2012-03-06 14:08:59 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateHToolbar() override;
|
|
|
|
void ReCreateVToolbar() override;
|
2018-01-08 04:05:03 +00:00
|
|
|
void ReCreateOptToolbar();
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
|
|
|
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
|
2016-09-25 17:06:49 +00:00
|
|
|
double BestZoom() override; // Returns the best zoom
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
2015-05-05 18:39:42 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
2011-08-12 17:43:16 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void SaveSettings( wxConfigBase* aCfg ) override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-07-23 14:12:37 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro:
|
2010-07-23 14:12:37 +00:00
|
|
|
* <p>
|
2010-11-19 16:28:46 +00:00
|
|
|
* EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
|
2017-10-06 18:07:43 +00:00
|
|
|
* </p>
|
2010-07-23 14:12:37 +00:00
|
|
|
*/
|
2010-12-14 21:39:31 +00:00
|
|
|
void CloseWindow( wxCommandEvent& event )
|
2010-07-23 14:12:37 +00:00
|
|
|
{
|
|
|
|
// Generate a wxCloseEvent
|
|
|
|
Close( false );
|
|
|
|
}
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Must be called after a schematic change in order to set the "modify" flag of the
|
|
|
|
* current screen.
|
2010-02-18 20:07:29 +00:00
|
|
|
*/
|
2017-11-12 17:55:20 +00:00
|
|
|
void OnModify();
|
2010-02-18 20:07:29 +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
|
|
|
const wxString& GetAliasName() { return m_aliasName; }
|
2010-11-13 11:02:24 +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
|
|
|
int GetUnit() { return m_unit; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void SetUnit( int unit )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
wxASSERT( unit >= 1 );
|
|
|
|
m_unit = unit;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
int GetConvert() { return m_convert; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void SetConvert( int convert )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
wxASSERT( convert >= 0 );
|
|
|
|
m_convert = convert;
|
|
|
|
}
|
|
|
|
|
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_ITEM* GetLastDrawItem() { return m_lastDrawItem; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
void SetLastDrawItem( LIB_ITEM* drawItem )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
m_lastDrawItem = drawItem;
|
|
|
|
}
|
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
LIB_ITEM* GetDrawItem() const { return GetScreen()->GetCurLibItem(); }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
void SetDrawItem( LIB_ITEM* drawItem ) { GetScreen()->SetCurLibItem( drawItem ); }
|
2010-02-04 17:46:12 +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
|
|
|
bool GetShowDeMorgan() { return m_showDeMorgan; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2016-11-04 11:13:22 +00:00
|
|
|
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
|
|
|
|
|
|
|
|
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
|
|
|
|
|
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
|
|
|
FILL_T GetFillStyle() { return m_drawFillStyle; }
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Create a temporary copy of the current edited component.
|
|
|
|
*
|
|
|
|
* Used to prepare an undo and/or abort command before editing the symbol.
|
2010-10-23 10:09:23 +00:00
|
|
|
*/
|
2010-11-13 11:02:24 +00:00
|
|
|
void TempCopyComponent();
|
2010-10-23 10:09:23 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-10-23 10:09:23 +00:00
|
|
|
* Restore the current edited component from its temporary copy.
|
|
|
|
* Used to abort a command
|
|
|
|
*/
|
2010-11-13 11:02:24 +00:00
|
|
|
void RestoreComponent();
|
2010-10-23 10:09:23 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-10-23 10:09:23 +00:00
|
|
|
* @return the temporary copy of the current component.
|
|
|
|
*/
|
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* GetTempCopyComponent() { return m_tempCopyComponent; }
|
2010-10-20 20:24:26 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Delete temporary copy of the current component and clear pointer
|
2010-10-23 13:49:14 +00:00
|
|
|
*/
|
|
|
|
void ClearTempCopyComponent();
|
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
bool IsEditingDrawItem() { return GetDrawItem() && GetDrawItem()->InEditMode(); }
|
2010-10-22 12:11:52 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
private:
|
2017-11-12 17:55:20 +00:00
|
|
|
void loadPart( const wxString& aLibrary, const wxString& aPart, int Unit );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves the changes to the current library.
|
|
|
|
*
|
|
|
|
* A backup file of the current library is saved with the .bak extension before the
|
|
|
|
* changes made to the library are saved.
|
|
|
|
* @param aLibrary is the library name.
|
|
|
|
* @param aNewFile Ask for a new file name to save the library.
|
|
|
|
* @return True if the library was successfully saved.
|
|
|
|
*/
|
|
|
|
bool saveLibrary( const wxString& aLibrary, bool aNewFile );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-07-23 14:12:37 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Called when the frame is activated. Tests if the current library exists.
|
2010-07-23 14:12:37 +00:00
|
|
|
* The library list can be changed by the schematic editor after reloading a new schematic
|
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
|
|
|
* and the current library can point a non existent lib.
|
2010-02-04 17:46:12 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void OnActivate( wxActivateEvent& event ) override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
// General:
|
2011-05-28 18:51:32 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Set the current active library to \a aLibrary.
|
2011-08-12 17:43:16 +00:00
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @param aLibrary the nickname of the library in the symbol library table. If wxEmptyString,
|
|
|
|
* then display list of available libraries to select from.
|
2011-05-28 18:51:32 +00:00
|
|
|
*/
|
2017-10-06 18:07:43 +00:00
|
|
|
void SelectActiveLibrary( const wxString& aLibrary = wxEmptyString );
|
2011-05-28 18:51:32 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Loads a symbol from the current active library, optionally setting the selected
|
|
|
|
* unit and convert.
|
|
|
|
*
|
|
|
|
* @param aAliasName The symbol alias name to load from the current library.
|
2017-07-19 17:34:55 +00:00
|
|
|
* @param aUnit Unit to be selected
|
|
|
|
* @param aConvert Convert to be selected
|
2017-10-06 18:07:43 +00:00
|
|
|
* @return true if the symbol loaded correctly.
|
2011-05-28 18:51:32 +00:00
|
|
|
*/
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aConvert = 0 );
|
2011-05-28 18:51:32 +00:00
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Create a copy of \a aLibEntry into memory.
|
2011-08-12 17:43:16 +00:00
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @param aLibEntry A pointer to the LIB_ALIAS object to an already loaded.
|
|
|
|
* @param aLibrary the path to the library file that \a aLibEntry was loaded from. This is
|
|
|
|
* for error messaging purposes only.
|
|
|
|
* @return True if a copy of \a aLibEntry was successfully copied.
|
2011-08-12 17:43:16 +00:00
|
|
|
*/
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LoadOneLibraryPartAux( LIB_ALIAS* aLibEntry, const wxString& aLibrary );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-08-12 17:43:16 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Display the documentation of the selected component.
|
2011-08-12 17:43:16 +00:00
|
|
|
*/
|
|
|
|
void DisplayCmpDoc();
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-02-28 13:53:49 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Rotates the current item.
|
2011-02-28 13:53:49 +00:00
|
|
|
*/
|
|
|
|
void OnRotateItem( wxCommandEvent& aEvent );
|
|
|
|
|
2016-04-22 14:15:16 +00:00
|
|
|
/**
|
|
|
|
* Handles the ID_LIBEDIT_MIRROR_X and ID_LIBEDIT_MIRROR_Y events.
|
|
|
|
*/
|
|
|
|
void OnOrient( wxCommandEvent& aEvent );
|
|
|
|
|
2011-02-24 22:29:43 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Deletes the currently selected draw item.
|
|
|
|
*
|
2011-02-24 22:29:43 +00:00
|
|
|
* @param aDC The device context to draw upon when removing item.
|
|
|
|
*/
|
|
|
|
void deleteItem( wxDC* aDC );
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// General editing
|
|
|
|
public:
|
2015-01-27 11:01:58 +00:00
|
|
|
/**
|
|
|
|
* Create a copy of the current component, and save it in the undo list.
|
2017-10-06 18:07:43 +00:00
|
|
|
*
|
2018-01-19 18:56:01 +00:00
|
|
|
* Because a component in library editor does not have a lot of primitives,
|
|
|
|
* the full data is duplicated. It is not worth to try to optimize this save function.
|
2015-01-27 11:01:58 +00:00
|
|
|
*/
|
2018-01-19 18:56:01 +00:00
|
|
|
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
private:
|
2011-10-07 14:41:30 +00:00
|
|
|
void GetComponentFromUndoList( wxCommandEvent& event );
|
|
|
|
void GetComponentFromRedoList( wxCommandEvent& event );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
// Editing pins
|
2011-10-07 14:41:30 +00:00
|
|
|
void CreatePin( wxDC* DC );
|
|
|
|
void StartMovePin( wxDC* DC );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
/**
|
2018-01-09 07:54:24 +00:00
|
|
|
* Adds copies of \a aPin in components with multiple units in all units
|
2011-10-28 13:43:37 +00:00
|
|
|
*
|
2018-01-09 07:54:24 +00:00
|
|
|
* @param aPin The pin to copy to others units.
|
2011-10-28 13:43:37 +00:00
|
|
|
*/
|
2018-01-09 07:54:24 +00:00
|
|
|
void CreateImagePins( LIB_PIN* aPin );
|
2011-10-28 13:43:37 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Places an anchor reference coordinate for the current component.
|
2011-10-07 14:41:30 +00:00
|
|
|
* <p>
|
|
|
|
* All object coordinates are offset to the current cursor position.
|
|
|
|
* </p>
|
|
|
|
*/
|
|
|
|
void PlaceAnchor();
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
// Editing graphic items
|
2017-10-06 18:07:43 +00:00
|
|
|
LIB_ITEM* CreateGraphicItem( LIB_PART* LibEntry, wxDC* DC );
|
2011-10-07 14:41:30 +00:00
|
|
|
void GraphicItemBeginDraw( wxDC* DC );
|
|
|
|
void StartMoveDrawSymbol( wxDC* DC );
|
|
|
|
void StartModifyDrawSymbol( wxDC* DC ); //<! Modify the item, adjust size etc.
|
|
|
|
void EndDrawGraphicItem( wxDC* DC );
|
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Read a component symbol file (*.sym ) and add graphic items to the current component.
|
|
|
|
*
|
|
|
|
* A symbol file *.sym has the same format as a library, and contains only one symbol.
|
2011-10-07 14:41:30 +00:00
|
|
|
*/
|
|
|
|
void LoadOneSymbol();
|
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Saves the current symbol to a symbol file.
|
|
|
|
*
|
2011-10-07 14:41:30 +00:00
|
|
|
* The symbol file format is similar to the standard component library file format, but
|
|
|
|
* there is only one symbol. Invisible pins are not saved.
|
|
|
|
*/
|
|
|
|
void SaveOneSymbol();
|
|
|
|
|
|
|
|
void EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem );
|
|
|
|
void EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem );
|
2011-04-27 19:44:32 +00:00
|
|
|
LIB_ITEM* LocateItemUsingCursor( const wxPoint& aPosition,
|
|
|
|
const KICAD_T aFilterList[] = LIB_COLLECTOR::AllItems );
|
2012-02-21 17:47:30 +00:00
|
|
|
void EditField( LIB_FIELD* Field );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2017-03-10 15:09:55 +00:00
|
|
|
void refreshSchematic();
|
2017-03-10 13:38:39 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
public:
|
2011-05-28 18:51:32 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Selects the currently active library and loads the symbol from \a aLibId.
|
2011-08-12 17:43:16 +00:00
|
|
|
*
|
2017-10-06 18:07:43 +00:00
|
|
|
* @param aLibId is the #LIB_ID of the symbol to select.
|
|
|
|
* @return true if the symbol defined by \a aLibId was loaded.
|
2011-05-28 18:51:32 +00:00
|
|
|
*/
|
2017-10-06 18:07:43 +00:00
|
|
|
bool LoadComponentAndSelectLib( const LIB_ID& aLibId );
|
2011-05-28 18:51:32 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
/* Block commands: */
|
2011-11-10 15:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Returns the block command (BLOCK_MOVE, BLOCK_DUPLICATE...) corresponding to
|
2011-11-10 15:55:05 +00:00
|
|
|
* the \a aKey (ALT, SHIFT ALT ..)
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual int BlockCommand( EDA_KEY aKey ) override;
|
2011-11-10 15:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Handles the block place command.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void HandleBlockPlace( wxDC* DC ) override;
|
2011-11-10 15:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Performs a block end command.
|
|
|
|
*
|
2011-11-10 15:55:05 +00:00
|
|
|
* @return If command finished (zoom, delete ...) false is returned otherwise true
|
|
|
|
* is returned indicating more processing is required.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool HandleBlockEnd( wxDC* DC ) override;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-02-06 11:54:51 +00:00
|
|
|
/**
|
|
|
|
* Place at cursor location the pin currently moved (i.e. pin pointed by m_drawItem)
|
|
|
|
* (and the linked pins, if any)
|
|
|
|
*/
|
|
|
|
void PlacePin();
|
2013-01-01 20:52:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aMasterPin is the "template" pin
|
|
|
|
* @param aId is a param to select what should be mofified:
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
|
|
|
|
* Change pins text name size
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
|
|
|
|
* Change pins text num size
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
|
|
|
|
* Change pins length.
|
|
|
|
*
|
|
|
|
* If aMasterPin is selected ( .m_flag == IS_SELECTED ),
|
|
|
|
* only the other selected pins are modified
|
|
|
|
*/
|
|
|
|
void GlobalSetPins( LIB_PIN* aMasterPin, int aId );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
// Automatic placement of pins
|
2011-10-28 13:43:37 +00:00
|
|
|
void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Creates an image (screenshot) of the current component in PNG or JPEG format.
|
2010-03-18 20:35:29 +00:00
|
|
|
* @param aFileName = the full filename
|
2011-10-28 13:43:37 +00:00
|
|
|
* @param aFmt_jpeg = true to use JPEG file format, false to use PNG file format
|
2010-03-18 20:35:29 +00:00
|
|
|
*/
|
2011-10-07 14:41:30 +00:00
|
|
|
void CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg );
|
2010-03-18 20:35:29 +00:00
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
2017-10-06 18:07:43 +00:00
|
|
|
* Print a page
|
|
|
|
*
|
2010-03-18 20:35:29 +00:00
|
|
|
* @param aDC = wxDC given by the calling print function
|
|
|
|
* @param aPrintMask = not used here
|
|
|
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
|
|
|
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
|
|
|
|
*/
|
2014-06-24 16:17:18 +00:00
|
|
|
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
|
2016-09-25 17:06:49 +00:00
|
|
|
bool aPrintMirrorMode, void* aData = NULL ) override;
|
2010-03-18 20:35:29 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-03-28 14:46:49 +00:00
|
|
|
* Creates the SVG print file for the current edited component.
|
2017-10-06 18:07:43 +00:00
|
|
|
*
|
2013-05-18 09:38:23 +00:00
|
|
|
* @param aFullFileName = the full filename
|
2011-08-12 17:43:16 +00:00
|
|
|
*/
|
2013-05-18 09:38:23 +00:00
|
|
|
void SVG_PlotComponent( const wxString& aFullFileName );
|
2010-03-28 14:46:49 +00:00
|
|
|
|
2017-11-22 11:06:17 +00:00
|
|
|
/**
|
|
|
|
* Synchronize the library manager and the symbol library table. Displays a progress dialog.
|
|
|
|
*/
|
2017-11-30 11:31:36 +00:00
|
|
|
void SyncLibraries( bool aLoad );
|
2017-11-22 11:06:17 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
int GetIconScale() override;
|
|
|
|
void SetIconScale( int aScale ) override;
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
private:
|
2017-11-12 17:55:20 +00:00
|
|
|
///> Helper screen used when no part is loaded
|
|
|
|
SCH_SCREEN* m_dummyScreen;
|
|
|
|
|
2017-11-22 13:02:45 +00:00
|
|
|
/**
|
|
|
|
* Displays a dialog asking the user to select a symbol library table.
|
|
|
|
* @return Pointer to the selected symbol library table or nullptr if cancelled.
|
|
|
|
*/
|
|
|
|
SYMBOL_LIB_TABLE* selectSymLibTable();
|
|
|
|
|
2017-11-13 14:15:10 +00:00
|
|
|
///> Creates a backup copy of a file with requested extension
|
|
|
|
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Returns currently edited part.
|
2017-11-12 17:55:20 +00:00
|
|
|
LIB_PART* getTargetPart() const;
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Returns either the part selected in the component tree, if context menu is active
|
|
|
|
///> or the currently modified part.
|
2017-11-12 17:55:20 +00:00
|
|
|
LIB_ID getTargetLibId() const;
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Returns either the library selected in the component tree, if context menu is active
|
|
|
|
///> or the library that is currently modified.
|
|
|
|
wxString getTargetLib() const;
|
|
|
|
|
2017-11-13 09:55:05 +00:00
|
|
|
///> Returns true when the operation has succeded (all requested libraries have been saved or
|
|
|
|
///> none was selected and confirmed by OK).
|
|
|
|
bool saveAllLibraries();
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Creates or adds an existing library to the symbol library table.
|
2017-11-12 17:55:20 +00:00
|
|
|
bool addLibraryFile( bool aCreateNew );
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Displays a file browser dialog to select a library file.
|
2017-11-12 17:55:20 +00:00
|
|
|
wxFileName getLibraryFileName( bool aExisting );
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Stores the currently modified part in the library manager buffer.
|
2017-11-12 17:55:20 +00:00
|
|
|
void storeCurrentPart();
|
|
|
|
|
2018-01-19 18:56:01 +00:00
|
|
|
///> Returns true if \a aLibId is an alias for the editor screen part.
|
2017-11-12 17:55:20 +00:00
|
|
|
bool isCurrentPart( const LIB_ID& aLibId ) const;
|
|
|
|
|
2017-11-13 21:12:49 +00:00
|
|
|
///> Restores the empty editor screen, without any part or library selected.
|
2017-11-12 17:55:20 +00:00
|
|
|
void emptyScreen();
|
|
|
|
|
2017-11-13 19:39:36 +00:00
|
|
|
///> Renames LIB_PART aliases to avoid conflicts before adding a component to a library
|
|
|
|
void fixDuplicateAliases( LIB_PART* aPart, const wxString& aLibrary );
|
|
|
|
|
2017-11-20 13:11:50 +00:00
|
|
|
void InitBlockPasteInfos() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies items selected in the current part to the internal clipboard.
|
|
|
|
*/
|
|
|
|
void copySelectedItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pastes items from the internal clipboard to the current part.
|
|
|
|
* @param aOffset is the offset where the pasted items should be located.
|
|
|
|
*/
|
|
|
|
void pasteClipboard( const wxPoint& aOffset );
|
|
|
|
|
|
|
|
///> Clipboard buffer storing LIB_ITEMs
|
|
|
|
BLOCK_SELECTOR m_clipboard;
|
|
|
|
|
|
|
|
// Copy/cut/paste buffer to move parts between libraries
|
2017-11-13 19:39:36 +00:00
|
|
|
std::unique_ptr<LIB_PART> m_copiedPart;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2018-01-30 10:49:51 +00:00
|
|
|
#endif // LIB_EDIT_FRAME_H
|