2011-10-19 20:32:21 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-20 08:17:54 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
|
2017-10-22 00:48:25 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2018-01-03 02:52:35 +00:00
|
|
|
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-19 20:32:21 +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-02 20:24:41 +00:00
|
|
|
/**
|
2018-01-30 10:49:51 +00:00
|
|
|
* @file sch_edit_frame.h
|
2011-10-02 20:24:41 +00:00
|
|
|
*/
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2018-01-30 10:49:51 +00:00
|
|
|
#ifndef SCH_EDIT_FRAME_H
|
|
|
|
#define SCH_EDIT_FRAME_H
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <sch_base_frame.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 <config_params.h>
|
2018-01-31 08:23:20 +00:00
|
|
|
#include <undo_redo_container.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <template_fieldnames.h>
|
|
|
|
#include <block_commande.h>
|
|
|
|
#include <sch_collectors.h>
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2016-02-28 18:16:59 +00:00
|
|
|
// enum PINSHEETLABEL_SHAPE
|
2016-02-28 17:33:29 +00:00
|
|
|
#include <sch_text.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
class LIB_EDIT_FRAME;
|
2010-11-20 21:59:00 +00:00
|
|
|
class LIB_VIEW_FRAME;
|
2009-02-04 15:25:03 +00:00
|
|
|
class DRAWSEGMENT;
|
2008-04-14 19:22:48 +00:00
|
|
|
class SCH_ITEM;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_NO_CONNECT;
|
2010-12-08 20:12:46 +00:00
|
|
|
class EDA_ITEM;
|
2013-04-01 10:35:20 +00:00
|
|
|
class SCH_BUS_ENTRY_BASE;
|
|
|
|
class SCH_BUS_WIRE_ENTRY;
|
|
|
|
class SCH_BUS_BUS_ENTRY;
|
2008-09-17 17:26:25 +00:00
|
|
|
class SCH_GLOBALLABEL;
|
|
|
|
class SCH_TEXT;
|
2011-08-31 14:59:20 +00:00
|
|
|
class SCH_BITMAP;
|
2009-11-04 20:46:53 +00:00
|
|
|
class SCH_SHEET;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2009-11-04 20:46:53 +00:00
|
|
|
class SCH_SHEET_PIN;
|
2008-09-17 17:26:25 +00:00
|
|
|
class SCH_COMPONENT;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_FIELD;
|
2009-10-08 13:19:28 +00:00
|
|
|
class LIB_PIN;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_JUNCTION;
|
2010-03-16 18:22:59 +00:00
|
|
|
class DIALOG_SCH_FIND;
|
2018-02-18 20:44:33 +00:00
|
|
|
class DIALOG_ANNOTATE;
|
2010-03-16 18:22:59 +00:00
|
|
|
class wxFindDialogEvent;
|
|
|
|
class wxFindReplaceData;
|
2015-04-16 15:26:51 +00:00
|
|
|
class SCHLIB_FILTER;
|
2017-10-22 00:48:25 +00:00
|
|
|
class RESCUER;
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2009-07-26 17:16:42 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
/// enum used in RotationMiroir()
|
2011-10-28 20:30:50 +00:00
|
|
|
enum COMPONENT_ORIENTATION_T {
|
2010-07-14 13:24:36 +00:00
|
|
|
CMP_NORMAL, // Normal orientation, no rotation or mirror
|
|
|
|
CMP_ROTATE_CLOCKWISE, // Rotate -90
|
|
|
|
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
|
|
|
|
CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
|
|
|
|
CMP_ORIENT_90, // Rotate 90, no mirror
|
|
|
|
CMP_ORIENT_180, // Rotate 180, no mirror
|
|
|
|
CMP_ORIENT_270, // Rotate -90, no mirror
|
|
|
|
CMP_MIRROR_X = 0x100, // Mirror around X axis
|
|
|
|
CMP_MIRROR_Y = 0x200 // Mirror around Y axis
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2011-05-20 19:21:09 +00:00
|
|
|
/** Schematic annotation order options. */
|
|
|
|
enum ANNOTATE_ORDER_T {
|
|
|
|
SORT_BY_X_POSITION, ///< Annotate by X position from left to right.
|
|
|
|
SORT_BY_Y_POSITION, ///< Annotate by Y position from top to bottom.
|
|
|
|
UNSORTED, ///< Annotate by position of component in the schematic sheet
|
|
|
|
///< object list.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** Schematic annotation type options. */
|
|
|
|
enum ANNOTATE_OPTION_T {
|
|
|
|
INCREMENTAL_BY_REF, ///< Annotate incrementally using the first free reference number.
|
|
|
|
SHEET_NUMBER_X_100, ///< Annotate using the first free reference number starting at
|
|
|
|
///< the sheet number * 100.
|
|
|
|
SHEET_NUMBER_X_1000, ///< Annotate using the first free reference number starting at
|
|
|
|
///< the sheet number * 1000.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-11-17 01:06:08 +00:00
|
|
|
/// Schematic search type used by the socket link with Pcbnew
|
|
|
|
enum SCH_SEARCH_T {
|
|
|
|
FIND_COMPONENT_ONLY, ///< Find a component in the schematic.
|
|
|
|
FIND_PIN, ///< Find a component pin in the schematic.
|
|
|
|
FIND_REFERENCE, ///< Find an item by it's reference designator.
|
|
|
|
FIND_VALUE, ///< Find an item by it's value field.
|
|
|
|
FIND_FIELD ///< Find a component field.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-03-02 17:29:18 +00:00
|
|
|
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
/**
|
2011-09-30 18:15:37 +00:00
|
|
|
* Schematic editor (Eeschema) main window.
|
2009-09-22 12:27:57 +00:00
|
|
|
*/
|
2012-01-09 17:24:01 +00:00
|
|
|
class SCH_EDIT_FRAME : public SCH_BASE_FRAME
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
private:
|
2013-06-07 20:56:55 +00:00
|
|
|
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
|
|
|
|
wxString m_DefaultSchematicFileName;
|
2016-11-16 10:07:02 +00:00
|
|
|
wxString m_SelectedNetName;
|
2014-09-07 19:01:26 +00:00
|
|
|
|
2013-06-07 20:56:55 +00:00
|
|
|
PARAM_CFG_ARRAY m_projectFileParams;
|
|
|
|
PARAM_CFG_ARRAY m_configSettings;
|
|
|
|
wxPageSetupDialogData m_pageSetupData;
|
|
|
|
wxFindReplaceData* m_findReplaceData;
|
|
|
|
wxPoint m_previewPosition;
|
|
|
|
wxSize m_previewSize;
|
|
|
|
wxPoint m_printDialogPosition;
|
|
|
|
wxSize m_printDialogSize;
|
|
|
|
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
|
|
|
|
bool m_printSheetReference;
|
2018-02-18 20:44:33 +00:00
|
|
|
DIALOG_ANNOTATE* m_annotateDialog;
|
2013-06-07 20:56:55 +00:00
|
|
|
DIALOG_SCH_FIND* m_dlgFindReplace;
|
|
|
|
wxPoint m_findDialogPosition;
|
|
|
|
wxSize m_findDialogSize;
|
|
|
|
wxArrayString m_findStringHistoryList;
|
|
|
|
wxArrayString m_replaceStringHistoryList;
|
|
|
|
BLOCK_SELECTOR m_blockItems; ///< List of selected items.
|
2013-08-05 21:02:41 +00:00
|
|
|
SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command.
|
2013-06-07 20:56:55 +00:00
|
|
|
int m_repeatLabelDelta; ///< Repeat label number increment step.
|
|
|
|
SCH_COLLECTOR m_collectedItems; ///< List of collected items.
|
|
|
|
SCH_FIND_COLLECTOR m_foundItems; ///< List of find/replace items.
|
|
|
|
SCH_ITEM* m_undoItem; ///< Copy of the current item being edited.
|
|
|
|
wxString m_simulatorCommand; ///< Command line used to call the circuit
|
|
|
|
///< simulator (gnucap, spice, ...)
|
|
|
|
wxString m_netListerCommand; ///< Command line to call a custom net list
|
|
|
|
///< generator.
|
2016-03-31 06:28:16 +00:00
|
|
|
int m_exec_flags; ///< Flags of the wxExecute() function
|
|
|
|
///< to call a custom net list generator.
|
2013-06-07 20:56:55 +00:00
|
|
|
|
|
|
|
bool m_forceHVLines; ///< force H or V directions for wires, bus, line
|
2012-09-28 17:47:41 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
bool m_autoplaceFields; ///< automatically place component fields
|
|
|
|
bool m_autoplaceJustify; ///< allow autoplace to change justification
|
|
|
|
bool m_autoplaceAlign; ///< align autoplaced fields to the grid
|
2018-01-03 02:52:35 +00:00
|
|
|
bool m_footprintPreview; ///< whether to show footprint previews
|
2015-12-13 16:56:47 +00:00
|
|
|
|
2011-12-01 16:49:28 +00:00
|
|
|
/// An index to the last find item in the found items list #m_foundItems.
|
2013-06-07 20:56:55 +00:00
|
|
|
int m_foundItemIndex;
|
2011-12-01 16:49:28 +00:00
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
/// Flag to indicate show hidden pins.
|
2013-06-07 20:56:55 +00:00
|
|
|
bool m_showAllPins;
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2014-10-26 13:59:01 +00:00
|
|
|
/// The name of the destination directory to use when generating plot files.
|
|
|
|
wxString m_plotDirectoryName;
|
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
/// The name of the format to use when generating a net list.
|
2013-06-07 20:56:55 +00:00
|
|
|
wxString m_netListFormat;
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2014-06-26 19:20:05 +00:00
|
|
|
/// Use netcodes (net number) as net names when generating spice net lists.
|
2016-09-16 18:36:19 +00:00
|
|
|
bool m_spiceAjustPassiveValues;
|
2011-12-09 16:37:11 +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
|
|
|
/* these are PROJECT specific, not schematic editor specific
|
|
|
|
wxString m_userLibraryPath;
|
|
|
|
wxArrayString m_componentLibFiles;
|
|
|
|
*/
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2016-02-28 18:16:59 +00:00
|
|
|
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
|
|
|
|
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
|
|
|
|
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
2011-03-30 19:26:05 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
protected:
|
|
|
|
TEMPLATES m_TemplateFieldNames;
|
|
|
|
|
2014-05-16 13:57:53 +00:00
|
|
|
/**
|
|
|
|
* Initializing accessor for the pin text size
|
|
|
|
*/
|
|
|
|
const wxSize &GetLastSheetPinTextSize();
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Save the schematic files that have been modified and not yet saved.
|
2011-10-15 13:25:57 +00:00
|
|
|
*
|
|
|
|
* @return true if the auto save was successful otherwise false.
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool doAutoSave() override;
|
2011-10-15 13:25:57 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Returns true if the schematic has been modified.
|
2011-10-15 13:25:57 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool isAutoSaveRequired() const override;
|
2011-10-15 13:25:57 +00:00
|
|
|
|
2012-01-04 22:08:46 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add the item currently being edited to the schematic and adds the changes to
|
2012-01-04 22:08:46 +00:00
|
|
|
* the undo/redo container.
|
|
|
|
*
|
2015-06-28 16:45:05 +00:00
|
|
|
* @param aRedraw = true (default) to redrw -the screen after adding the item.
|
2012-01-04 22:08:46 +00:00
|
|
|
*/
|
2015-06-28 16:45:05 +00:00
|
|
|
void addCurrentItemToList( bool aRedraw = true );
|
2011-03-30 19:26:05 +00:00
|
|
|
|
2013-10-27 18:21:53 +00:00
|
|
|
void updateFindReplaceView( wxFindDialogEvent& aEvent );
|
|
|
|
|
2017-06-08 21:47:21 +00:00
|
|
|
void backAnnotateFootprints( const std::string& aChangedSetOfReferences );
|
2014-07-07 04:12:04 +00:00
|
|
|
|
2015-06-07 18:18:45 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Verify that annotation is complete so that a proper netlist is even
|
2015-06-07 18:18:45 +00:00
|
|
|
* possible. If not, asks the user if annotation should be done.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2015-06-07 18:18:45 +00:00
|
|
|
* @return bool - true if annotation is complete, else false.
|
|
|
|
*/
|
|
|
|
bool prepareForNetlist();
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Send the kicad netlist over to CVPCB.
|
2015-06-07 18:18:45 +00:00
|
|
|
*/
|
|
|
|
void sendNetlist();
|
|
|
|
|
2008-04-14 19:22:48 +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
|
|
|
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
2010-12-08 20:12:46 +00:00
|
|
|
~SCH_EDIT_FRAME();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
SCH_SCREEN* GetScreen() const override;
|
2012-01-09 17:24:01 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
2011-12-08 21:05:43 +00:00
|
|
|
|
2012-09-28 17:47:41 +00:00
|
|
|
bool GetForceHVLines() const { return m_forceHVLines; }
|
|
|
|
void SetForceHVLines( bool aForceHVdirection ) { m_forceHVLines = aForceHVdirection; }
|
|
|
|
|
2011-12-09 16:37:11 +00:00
|
|
|
bool GetShowAllPins() const { return m_showAllPins; }
|
|
|
|
|
|
|
|
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
|
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
const wxString GetNetListFormatName() const { return m_netListFormat; }
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; }
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2016-09-16 18:36:19 +00:00
|
|
|
bool GetSpiceAjustPassiveValues() const { return m_spiceAjustPassiveValues; }
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2016-09-16 18:36:19 +00:00
|
|
|
void SetSpiceAjustPassiveValues( bool aEnable ) { m_spiceAjustPassiveValues = aEnable; }
|
2011-12-09 16:37:11 +00:00
|
|
|
|
2014-10-26 13:59:01 +00:00
|
|
|
/// accessor to the destination directory to use when generating plot files.
|
|
|
|
const wxString& GetPlotDirectoryName() const { return m_plotDirectoryName; }
|
|
|
|
void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; }
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void Process_Config( wxCommandEvent& event );
|
|
|
|
void OnSelectTool( wxCommandEvent& aEvent );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the project file parameter list for Eeschema.
|
2011-08-18 19:25: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
|
|
|
*<p>
|
2011-09-30 18:15:37 +00:00
|
|
|
* Populate the project file parameter array specific to Eeschema if it hasn't
|
2011-08-18 19:25:12 +00:00
|
|
|
* already been populated and return a reference to the array to the caller.
|
|
|
|
* </p>
|
|
|
|
*/
|
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
|
|
|
PARAM_CFG_ARRAY& GetProjectFileParametersList();
|
2011-08-18 19:25:12 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Save changes to the project settings to the project (.pro) file.
|
|
|
|
*
|
2013-07-19 18:27:22 +00:00
|
|
|
* @param aAskForSave = true to open a dialog before saving the settings
|
2011-08-18 19:25:12 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void SaveProjectSettings( bool aAskForSave ) override;
|
2011-08-18 19:25:12 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Loads the KiCad project file (*.pro) settings specific to Eeschema.
|
2011-08-18 19:25:12 +00:00
|
|
|
*
|
|
|
|
* @return True if the project file was loaded correctly.
|
|
|
|
*/
|
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 LoadProjectFile();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a default symbol field name for field \a aFieldNdx for all components.
|
|
|
|
*
|
2011-03-29 15:21:35 +00:00
|
|
|
* These field names are not modifiable, but template field names are.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2010-06-17 16:30:10 +00:00
|
|
|
* @param aFieldNdx The field number index
|
|
|
|
*/
|
2011-08-18 19:25:12 +00:00
|
|
|
static wxString GetDefaultFieldName( int aFieldNdx );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Insert or append a wanted symbol field name into the field names template.
|
|
|
|
*
|
|
|
|
* Should be used for any symbol property editor. If the name already exists, it
|
|
|
|
* overwrites the same name.
|
2010-06-17 16:30:10 +00:00
|
|
|
*
|
|
|
|
* @param aFieldName is a full description of the wanted field, and it must not match
|
2011-03-29 15:21:35 +00:00
|
|
|
* any of the default field names.
|
2010-06-17 16:30:10 +00:00
|
|
|
* @return int - the index within the config container at which aFieldName was
|
2011-03-29 15:21:35 +00:00
|
|
|
* added, or -1 if the name is illegal because it matches a default field name.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
|
|
|
|
{
|
|
|
|
return m_TemplateFieldNames.AddTemplateFieldName( aFieldName );
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return a template field names list for read only access.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames()
|
|
|
|
{
|
|
|
|
return m_TemplateFieldNames.GetTemplateFieldNames();
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2011-08-30 19:24:28 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the field names template for read only access.
|
2011-08-30 19:24:28 +00:00
|
|
|
*/
|
|
|
|
const TEMPLATES& GetTemplates()
|
|
|
|
{
|
|
|
|
return m_TemplateFieldNames;
|
|
|
|
}
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Remove all template field names.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
void DeleteAllTemplateFieldNames()
|
|
|
|
{
|
|
|
|
m_TemplateFieldNames.DeleteAllTemplateFieldNames();
|
|
|
|
}
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the Eeschema applications settings.
|
2011-08-18 19:25:12 +00:00
|
|
|
* <p>
|
|
|
|
* This replaces the old statically define list that had the project file settings and
|
|
|
|
* the application settings mixed together. This was confusing and caused some settings
|
|
|
|
* to get saved and loaded incorrectly. Currently, only the settings that are needed at
|
|
|
|
* start up by the main window are defined here. There are other locally used settings
|
2011-09-30 18:15:37 +00:00
|
|
|
* scattered throughout the Eeschema source code. If you need to define a configuration
|
2011-08-18 19:25:12 +00:00
|
|
|
* setting that need to be loaded at run time, this is the place to define it.
|
|
|
|
* </p>
|
|
|
|
*/
|
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
|
|
|
PARAM_CFG_ARRAY& GetConfigurationSettings();
|
2011-08-18 19:25:12 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
|
|
|
void SaveSettings( wxConfigBase* aCfg ) override;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void CreateScreens();
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateHToolbar() override;
|
|
|
|
void ReCreateVToolbar() override;
|
2011-10-15 13:25:57 +00:00
|
|
|
void ReCreateOptToolbar();
|
2016-09-24 18:53:15 +00:00
|
|
|
void ReCreateMenuBar() override;
|
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;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Must be called after a schematic change in order to set the "modify" flag of the
|
|
|
|
* current screen* and update the date in frame reference.
|
2010-02-18 20:07:29 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnModify();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual wxString GetScreenDesc() const override;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void InstallConfigFrame( wxCommandEvent& event );
|
2014-01-08 14:18:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute a remote command send by Pcbnew via a socket,
|
|
|
|
* port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
|
|
|
|
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
|
|
|
|
* @param cmdline = received command from socket
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ExecuteRemoteCommand( const char* cmdline ) override;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
|
2014-04-21 06:51:33 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) override;
|
|
|
|
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) override;
|
|
|
|
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override;
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
2016-09-24 18:53:15 +00:00
|
|
|
double BestZoom() override;
|
2009-04-10 14:53:24 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Check the schematic at \a aPosition in logical (drawing) units for a item
|
2011-05-20 19:21:09 +00:00
|
|
|
* matching the types in \a aFilterList.
|
2011-03-25 19:16:05 +00:00
|
|
|
* <p>
|
|
|
|
* The search is first performed at the nearest grid position to \a aPosition. If no
|
|
|
|
* item if found on grid, then \a aPosition is tested for any items. If the item found
|
2011-09-30 18:15:37 +00:00
|
|
|
* can be cross probed, a message is send to Pcbnew and the selected item is highlighted
|
2011-03-25 19:16:05 +00:00
|
|
|
* in PCB editor.
|
|
|
|
* </p>
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aPosition The wxPoint on the schematic to search.
|
|
|
|
* @param aFilterList A list of #KICAD_T types to to filter.
|
|
|
|
* @param aHotKeyCommandId A hot key command ID for performing additional tests when
|
|
|
|
* multiple items are found at \a aPosition.
|
2018-04-25 12:28:41 +00:00
|
|
|
* @param aClarifySelectionMenuCancelled is a pointer to a bool to handle a cancel command
|
|
|
|
* from user when the user cancels the locate menu disambiguation (selection between located items)
|
2011-03-25 19:16:05 +00:00
|
|
|
* @return A SCH_ITEM pointer of the item found or NULL if no item found
|
|
|
|
*/
|
|
|
|
SCH_ITEM* LocateAndShowItem( const wxPoint& aPosition,
|
|
|
|
const KICAD_T aFilterList[] = SCH_COLLECTOR::AllItems,
|
2018-01-16 23:48:13 +00:00
|
|
|
int aHotKeyCommandId = 0,
|
2018-04-25 12:28:41 +00:00
|
|
|
bool* aClarifySelectionMenuCancelled = nullptr );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Check for items at \a aPosition matching the types in \a aFilterList.
|
2011-03-10 19:36:30 +00:00
|
|
|
* <p>
|
2011-03-25 19:16:05 +00:00
|
|
|
* If multiple items are located at \a aPosition, a context menu is displayed to clarify
|
|
|
|
* which item the user intended to select. If the user aborts the context menu, NULL is
|
|
|
|
* returned and the abort request flag will be set to true. Make sure to clear this flag
|
|
|
|
* before attempting to display any other context menus.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint location where to search.
|
|
|
|
* @param aFilterList A list of #KICAD_T types to to filter.
|
|
|
|
* @param aHotKeyCommandId A hot key command ID for performing additional tests when
|
|
|
|
* multiple items are found at \a aPosition.
|
|
|
|
* @return The SCH_ITEM pointer of the item found or NULL if no item found.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* LocateItem( const wxPoint& aPosition,
|
|
|
|
const KICAD_T aFilterList[] = SCH_COLLECTOR::AllItems,
|
|
|
|
int aHotKeyCommandId = 0 );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Delete the item found under the cross hair. If multiple items are found at the
|
2011-03-25 19:16:05 +00:00
|
|
|
* cross hair position, a context menu is displayed to clarify which item to delete.
|
|
|
|
* See LocateItem() for more information on locating multiple items.
|
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aDC The device context to update if and item is deleted.
|
|
|
|
* @return True if an item was deleted.
|
|
|
|
*/
|
2011-03-29 15:21:35 +00:00
|
|
|
bool DeleteItemAtCrossHair( wxDC* aDC );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2016-11-16 12:09:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Highlight the connection found at aPosition.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2016-11-16 12:09:34 +00:00
|
|
|
* If no connection to highlight is found, clear the current highlighted connect (if any).
|
|
|
|
*
|
|
|
|
* @param aPosition is the location of the test point (usually cross hair position).
|
2017-11-17 17:00:04 +00:00
|
|
|
* @return true if OK, false if there was an issue to build the netlist
|
2016-11-16 12:09:34 +00:00
|
|
|
* needed to highlight a connection.
|
|
|
|
*/
|
|
|
|
bool HighlightConnectionAtPosition( wxPoint aPosition );
|
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Finds a component in the schematic and an item in this component.
|
|
|
|
*
|
2011-11-17 01:06:08 +00:00
|
|
|
* @param aReference The component reference designator to find.
|
|
|
|
* @param aSearchHierarchy If false, search the current sheet only. Otherwise,
|
|
|
|
* the entire hierarchy
|
|
|
|
* @param aSearchType A #SCH_SEARCH_T value used to determine what to search for.
|
|
|
|
* @param aSearchText The text to search for, either in value, reference or elsewhere.
|
|
|
|
* @param aWarpMouse If true, then move the mouse cursor to the item.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* FindComponentAndItem( const wxString& aReference,
|
|
|
|
bool aSearchHierarchy,
|
|
|
|
SCH_SEARCH_T aSearchType,
|
|
|
|
const wxString& aSearchText,
|
|
|
|
bool aWarpMouse );
|
|
|
|
|
2017-10-26 15:25:47 +00:00
|
|
|
/**
|
|
|
|
* Breaks a single segment into two at the specified point
|
|
|
|
*
|
|
|
|
* @param aSegment Line segment to break
|
|
|
|
* @param aPoint Point at which to break the segment
|
|
|
|
* @param aAppend Add the changes to the previous undo state
|
2017-12-01 22:53:23 +00:00
|
|
|
* @param aNewSegment Pointer to the newly created segment (if given and created)
|
2017-10-26 15:25:47 +00:00
|
|
|
* @return True if any wires or buses were broken.
|
|
|
|
*/
|
2017-12-01 22:53:23 +00:00
|
|
|
bool BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, bool aAppend = false,
|
|
|
|
SCH_LINE** aNewSegment = NULL );
|
2017-10-26 15:25:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks every wire and bus for a intersection at \a aPoint and break into two segments
|
|
|
|
* at \a aPoint if an intersection is found.
|
|
|
|
*
|
|
|
|
* @param aPoint Test this point for an intersection.
|
|
|
|
* @param aAppend Add the changes to the previous undo state
|
|
|
|
* @return True if any wires or buses were broken.
|
|
|
|
*/
|
|
|
|
bool BreakSegments( const wxPoint& aPoint, bool aAppend = false );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests all junctions and bus entries in the schematic for intersections with wires and
|
|
|
|
* buses and breaks any intersections into multiple segments.
|
|
|
|
*
|
|
|
|
* @param aAppend Add the changes to the previous undo state
|
|
|
|
* @return True if any wires or buses were broken.
|
|
|
|
*/
|
|
|
|
bool BreakSegmentsOnJunctions( bool aApped = false );
|
|
|
|
|
2011-11-17 01:06:08 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Send a message to Pcbnew via a socket connection.
|
|
|
|
*
|
|
|
|
* Commands are:
|
|
|
|
* - $PART: reference put cursor on footprint anchor
|
|
|
|
* - $PIN: number $PART: reference put cursor on the footprint pad
|
|
|
|
* - $SHEET: time_stamp select all footprints of components is the schematic sheet path
|
|
|
|
*
|
2017-03-04 15:28:26 +00:00
|
|
|
* @param aObjectToSync = item to be located on board
|
|
|
|
* (footprint, pad, text or schematic sheet)
|
|
|
|
* @param aPart = component if objectToSync is a sub item of a symbol (like a pin)
|
2011-11-17 01:06:08 +00:00
|
|
|
*/
|
2017-03-04 15:28:26 +00:00
|
|
|
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aPart );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2018-01-06 20:50:49 +00:00
|
|
|
/**
|
|
|
|
* Sends a net name to eeschema for highlighting
|
|
|
|
*
|
|
|
|
* @param aNetName is the name of a net, or empty string to clear highlight
|
|
|
|
*/
|
|
|
|
void SendCrossProbeNetName( const wxString& aNetName );
|
|
|
|
|
2013-09-27 12:30:35 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a flat list which stores all connected objects.
|
|
|
|
*
|
|
|
|
* @param updateStatusText decides if window StatusText should be modified.
|
2015-06-07 18:18:45 +00:00
|
|
|
* @return NETLIST_OBJECT_LIST* - caller owns the object.
|
2013-09-27 12:30:35 +00:00
|
|
|
*/
|
2016-11-16 10:07:02 +00:00
|
|
|
NETLIST_OBJECT_LIST* BuildNetListBase( bool updateStatusText = true );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a netlist for the current schematic.
|
|
|
|
*
|
|
|
|
* - Test for some issues (missing or duplicate references and sheet names)
|
|
|
|
* - Build netlist info
|
|
|
|
* - Create the netlist file (different formats)
|
|
|
|
*
|
2010-07-14 13:24:36 +00:00
|
|
|
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
|
|
* @param aFullFileName = full netlist file name
|
2012-01-26 09:37:36 +00:00
|
|
|
* @param aNetlistOptions = netlist options using OR'ed bits.
|
|
|
|
* <p>
|
|
|
|
* For SPICE netlist only:
|
|
|
|
* if NET_USE_NETNAMES is set, use net names from labels in schematic
|
|
|
|
* else use net numbers (net codes)
|
2017-11-17 17:00:04 +00:00
|
|
|
* if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"
|
2012-01-26 09:37:36 +00:00
|
|
|
* </p>
|
2015-06-12 07:02:06 +00:00
|
|
|
* @param aReporter = a REPORTER to report error messages,
|
|
|
|
* mainly if a command line must be run (can be NULL
|
2010-07-14 13:24:36 +00:00
|
|
|
* @return true if success.
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
bool CreateNetlist( int aFormat,
|
|
|
|
const wxString& aFullFileName,
|
2015-06-12 07:02:06 +00:00
|
|
|
unsigned aNetlistOptions,
|
2017-08-25 07:14:26 +00:00
|
|
|
REPORTER* aReporter = NULL,
|
2018-02-16 18:29:47 +00:00
|
|
|
bool silent = false );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a netlist file.
|
|
|
|
*
|
2015-06-07 18:18:45 +00:00
|
|
|
* @param aConnectedItemsList = the initialized list of connected items, take ownership.
|
2010-07-14 13:24:36 +00:00
|
|
|
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
|
|
* @param aFullFileName = full netlist file name
|
2012-01-26 09:37:36 +00:00
|
|
|
* @param aNetlistOptions = netlist options using OR'ed bits.
|
|
|
|
* <p>
|
|
|
|
* For SPICE netlist only:
|
|
|
|
* if NET_USE_NETNAMES is set, use net names from labels in schematic
|
|
|
|
* else use net numbers (net codes)
|
2017-11-17 17:00:04 +00:00
|
|
|
* if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"
|
2012-01-26 09:37:36 +00:00
|
|
|
* </p>
|
2015-06-12 07:02:06 +00:00
|
|
|
* @param aReporter = a REPORTER to report error messages,
|
|
|
|
* mainly if a command line must be run (can be NULL
|
2010-07-14 13:24:36 +00:00
|
|
|
* @return true if success.
|
|
|
|
*/
|
2015-06-07 18:18:45 +00:00
|
|
|
bool WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
|
2013-09-27 12:30:35 +00:00
|
|
|
int aFormat,
|
2011-10-15 13:25:57 +00:00
|
|
|
const wxString& aFullFileName,
|
2015-06-12 07:02:06 +00:00
|
|
|
unsigned aNetlistOptions,
|
|
|
|
REPORTER* aReporter = NULL );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Clear the current component annotation.
|
|
|
|
*
|
2015-03-23 11:45:31 +00:00
|
|
|
* @param aCurrentSheetOnly Clear only the annotation for the current sheet if true.
|
|
|
|
* Otherwise clear the entire schematic annotation.
|
2009-04-10 14:53:24 +00:00
|
|
|
*/
|
2011-05-20 19:21:09 +00:00
|
|
|
void DeleteAnnotation( bool aCurrentSheetOnly );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-01 17:28:21 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Annotate the components in the schematic that are not currently annotated.
|
2011-05-20 19:21:09 +00:00
|
|
|
*
|
|
|
|
* @param aAnnotateSchematic Annotate the entire schematic if true. Otherwise annotate
|
|
|
|
* the current sheet only.
|
|
|
|
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
|
|
|
|
* @param aAlgoOption Define the annotation style. See #ANNOTATE_OPTION_T.
|
2018-02-18 20:44:33 +00:00
|
|
|
* @param aStartNumber The start number for non-sheet-based annotation styles.
|
2011-05-20 19:21:09 +00:00
|
|
|
* @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the
|
|
|
|
* existing component annotation.
|
|
|
|
* @param aRepairTimestamps Test for and repair any duplicate time stamps if true.
|
|
|
|
* Otherwise, keep the existing time stamps. This option
|
|
|
|
* could change previous annotation because time stamps are
|
|
|
|
* used to handle annotation in complex hierarchies.
|
2015-03-23 11:45:31 +00:00
|
|
|
* @param aLockUnits When both aLockUnits and aResetAnnotation are true, all unit
|
|
|
|
* associations should be kept when reannotating. That is, if
|
|
|
|
* two components were R8A and R8B, they may become R3A and R3B,
|
|
|
|
* but not R3A and R3C or R3C and R4D.
|
|
|
|
* When aResetAnnotation is true but aLockUnits is false, the
|
|
|
|
* usual behavior of annotating each part individually is
|
|
|
|
* performed.
|
|
|
|
* When aResetAnnotation is false, this option has no effect.
|
2018-02-17 11:43:56 +00:00
|
|
|
* @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
|
2011-05-20 19:21:09 +00:00
|
|
|
*
|
|
|
|
* When the sheet number is used in annotation, each sheet annotation starts from sheet
|
|
|
|
* number * 100. In other words the first sheet uses 100 to 199, the second sheet uses
|
|
|
|
* 200 to 299, and so on.
|
|
|
|
*/
|
|
|
|
void AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption,
|
2018-02-18 20:44:33 +00:00
|
|
|
ANNOTATE_OPTION_T aAlgoOption, int aStartNumber,
|
|
|
|
bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits,
|
|
|
|
REPORTER& aReporter );
|
2011-05-20 19:21:09 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Check for annotation errors.
|
2011-05-20 19:21:09 +00:00
|
|
|
*
|
|
|
|
* The following list of items are checked:
|
2017-11-17 17:00:04 +00:00
|
|
|
* - Components that are not annotated.
|
|
|
|
* - Duplicate component references.
|
|
|
|
* - Multiple part per package components where the part number is greater number of parts
|
|
|
|
* in the package.
|
|
|
|
* - Multiple part per package components where the reference designator is different
|
|
|
|
* between parts.
|
2011-05-20 19:21:09 +00:00
|
|
|
*
|
|
|
|
* @return Number of annotation errors found.
|
2018-02-17 11:43:56 +00:00
|
|
|
* @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
|
2011-05-20 19:21:09 +00:00
|
|
|
* @param aOneSheetOnly Check the current sheet only if true. Otherwise check
|
|
|
|
* the entire schematic.
|
|
|
|
*/
|
2018-02-17 11:43:56 +00:00
|
|
|
int CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly );
|
2011-02-05 02:21:11 +00:00
|
|
|
|
2018-02-18 20:44:33 +00:00
|
|
|
/**
|
|
|
|
* Run a modal version of the Annotate dialog for a specific purpose.
|
|
|
|
* @param aMessage A user message indicating the purpose.
|
|
|
|
* @return the result of ShowModal()
|
|
|
|
*/
|
|
|
|
int ModalAnnotate( const wxString& aMessage );
|
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
// Functions used for hierarchy handling
|
2011-12-08 21:05:43 +00:00
|
|
|
SCH_SHEET_PATH& GetCurrentSheet();
|
|
|
|
|
|
|
|
void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
|
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Draw the current sheet on the display.
|
2011-02-05 02:21:11 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void DisplayCurrentSheet();
|
2009-04-10 14:53:24 +00:00
|
|
|
|
2016-11-16 12:09:34 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Set or reset the BRIGHTENED of connected objects inside the current sheet,
|
|
|
|
* according to the highlighted net name.
|
|
|
|
*
|
2016-11-16 12:09:34 +00:00
|
|
|
* @return true if the flags are correctly set, and false if something goes wrong
|
|
|
|
* (duplicate sheet names)
|
|
|
|
*/
|
|
|
|
bool SetCurrentSheetHighlightFlags();
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2009-01-08 20:29:07 +00:00
|
|
|
* @return a filename that can be used in plot and print functions
|
2009-11-04 20:46:53 +00:00
|
|
|
* for the current screen and sheet path.
|
|
|
|
* This filename is unique and must be used instead of the screen filename
|
|
|
|
* (or screen filename) when one must creates file for each sheet in the
|
|
|
|
* hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
|
2009-09-22 12:27:57 +00:00
|
|
|
* used more than once
|
2010-12-14 21:39:31 +00:00
|
|
|
* Name is <root sheet filename>-<sheet path> and has no extension.
|
|
|
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
2009-01-08 20:29:07 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
wxString GetUniqueFilenameForCurrentSheet();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Set the m_ScreenNumber and m_NumberOfScreens members for screens.
|
|
|
|
*
|
|
|
|
* @note This must be called after deleting or adding a sheet and when entering a sheet.
|
2008-04-30 17:04:22 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void SetSheetNumberAndCount();
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-02-02 15:01:09 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Show the print dialog.
|
2010-01-01 13:30:39 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnPrint( wxCommandEvent& event );
|
2010-02-02 15:01:09 +00:00
|
|
|
|
|
|
|
wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void SetPreviewPosition( const wxPoint& aPoint ) { m_previewPosition = aPoint; }
|
|
|
|
void SetPreviewSize( const wxSize& aSize ) { m_previewSize = aSize; }
|
2010-07-14 13:24:36 +00:00
|
|
|
const wxPoint& GetPreviewPosition() { return m_previewPosition; }
|
2011-10-15 13:25:57 +00:00
|
|
|
const wxSize& GetPreviewSize() { return m_previewSize; }
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void SetPrintDialogPosition( const wxPoint& aPoint )
|
2010-02-02 15:01:09 +00:00
|
|
|
{
|
|
|
|
m_printDialogPosition = aPoint;
|
|
|
|
}
|
2010-07-14 13:24:36 +00:00
|
|
|
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void SetPrintDialogSize( const wxSize& aSize ) { m_printDialogSize = aSize; }
|
2010-07-14 13:24:36 +00:00
|
|
|
const wxPoint& GetPrintDialogPosition() { return m_printDialogPosition; }
|
2011-10-15 13:25:57 +00:00
|
|
|
const wxSize& GetPrintDialogSize() { return m_printDialogSize; }
|
2010-02-02 15:01:09 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
bool GetPrintMonochrome() { return m_printMonochrome; }
|
|
|
|
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
|
|
|
|
bool GetPrintSheetReference() { return m_printSheetReference; }
|
|
|
|
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
2010-01-01 13:30:39 +00:00
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
// Plot functions:
|
2012-09-17 17:42:27 +00:00
|
|
|
void PlotSchematic( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
// read and save files
|
2011-08-18 19:25:12 +00:00
|
|
|
void Save_File( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Command event handler to save the entire project and create a component library archive.
|
2011-08-18 19:25:12 +00:00
|
|
|
*
|
|
|
|
* The component library archive name is <root_name>-cache.lib
|
|
|
|
*/
|
|
|
|
void OnSaveProject( wxCommandEvent& aEvent );
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
|
2011-08-18 19:25:12 +00:00
|
|
|
|
2013-01-24 17:46:37 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Import a KiCad schematic into the current page.
|
|
|
|
*
|
|
|
|
* In order to import a schematic a lot of things have to happen to before the contents
|
|
|
|
* of the imported schematic can be appended to the current page. The following list
|
|
|
|
* describes this process:
|
|
|
|
*
|
|
|
|
* - Load the schematic into a temporary SCH_SHEET object.
|
|
|
|
* - Make sure the imported schematic does not cause any hierarchy recursion issues.
|
|
|
|
* - Verify the imported schematic uses fully qualified #LIB_ID objects (symbol library table).
|
|
|
|
* - Check to see if any symbol libraries need to be added to the current project's symbol
|
|
|
|
* library table. This includes:
|
|
|
|
* - Check if the symbol library already exists in the project or global symbol library
|
|
|
|
* table.
|
|
|
|
* - Convert symbol library URLS that use the ${KIPRJMOD} environment variable to absolute
|
|
|
|
* paths. ${KIPRJMOD} will not be the same for this project.
|
|
|
|
* - Check for duplicate symbol library nicknames and change the new symbol library nickname
|
|
|
|
* to prevent library name clashes.
|
|
|
|
* - Update all schematic symbol LIB_ID object library nicknames when the library nickname
|
|
|
|
* was changed to prevent clashes.
|
|
|
|
* - Check for duplicate sheet names which is illegal and automatically rename any duplicate
|
|
|
|
* sheets in the imported schematic.
|
|
|
|
* - Clear all of the annotation in the imported schematic to prevent clashes.
|
|
|
|
* - Append the objects from the temporary sheet to the current page.
|
|
|
|
* - Replace any duplicate time stamps.
|
|
|
|
* - Refresh the symbol library links.
|
|
|
|
*
|
2013-01-24 17:46:37 +00:00
|
|
|
* @return True if the project was imported properly.
|
|
|
|
*/
|
2017-11-17 17:00:04 +00:00
|
|
|
bool AppendSchematic();
|
2013-01-24 17:46:37 +00:00
|
|
|
|
2013-02-02 17:39:59 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Loads a .cmp file from CvPcb and update the footprint field of components.
|
|
|
|
*
|
|
|
|
* Prepares parameters and calls ProcessCmpToFootprintLinkFileto actually read the file and
|
|
|
|
* update the footprint fields
|
2013-02-02 17:39:59 +00:00
|
|
|
*/
|
|
|
|
bool LoadCmpToFootprintLinkFile();
|
2008-05-07 23:41:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Read the footprint info from each line in the stuff file by reference designator.
|
|
|
|
*
|
|
|
|
* The footprint link file (.cmp) entries created by CvPcb:
|
2010-12-14 15:56:30 +00:00
|
|
|
*
|
2013-02-02 17:39:59 +00:00
|
|
|
* BeginCmp
|
|
|
|
* TimeStamp = /32307DE2/AA450F67;
|
|
|
|
* Reference = C1;
|
|
|
|
* ValeurCmp = 47uF;
|
|
|
|
* IdModule = CP6;
|
|
|
|
* EndCmp
|
2010-12-14 15:56:30 +00:00
|
|
|
*
|
2013-02-02 17:39:59 +00:00
|
|
|
* @param aFullFilename = the full filename to read
|
2014-08-28 23:44:28 +00:00
|
|
|
* @param aForceVisibilityState = Set to true to change the footprint field visibility
|
|
|
|
* state to \a aVisibilityState. False retains the
|
|
|
|
* current footprint field visibility state.
|
2014-10-06 01:18:24 +00:00
|
|
|
* @param aVisibilityState True to show the footprint field or false to hide the footprint
|
|
|
|
* field if \a aForceVisibilityState is true.
|
2013-02-02 17:39:59 +00:00
|
|
|
* @return bool = true if success.
|
2008-05-07 23:41:05 +00:00
|
|
|
*/
|
2014-07-07 04:12:04 +00:00
|
|
|
bool ProcessCmpToFootprintLinkFile( const wxString& aFullFilename,
|
2014-08-28 23:44:28 +00:00
|
|
|
bool aForceVisibilityState,
|
|
|
|
bool aVisibilityState );
|
2008-05-07 23:41:05 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Save \a aScreen to a schematic file.
|
2011-08-18 19:25:12 +00:00
|
|
|
*
|
|
|
|
* @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves
|
|
|
|
* the current screen.
|
2012-09-28 17:47:41 +00:00
|
|
|
* @param aSaveUnderNewName Controls how the file is to be saved;: using previous name
|
|
|
|
* or under a new name .
|
2011-10-15 13:25:57 +00:00
|
|
|
* @param aCreateBackupFile Creates a back of the file associated with \a aScreen
|
2012-09-28 17:47:41 +00:00
|
|
|
* if true.
|
|
|
|
* Helper definitions #CREATE_BACKUP_FILE and
|
2011-10-15 13:25:57 +00:00
|
|
|
* #NO_BACKUP_FILE are defined for improved code readability.
|
2011-08-18 19:25:12 +00:00
|
|
|
* @return True if the file has been saved.
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
bool SaveEEFile( SCH_SCREEN* aScreen,
|
2012-09-28 17:47:41 +00:00
|
|
|
bool aSaveUnderNewName = false,
|
2011-10-15 13:25:57 +00:00
|
|
|
bool aCreateBackupFile = CREATE_BACKUP_FILE );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// General search:
|
|
|
|
|
2015-04-09 19:37:48 +00:00
|
|
|
bool IsSearchCacheObsolete( const SCH_FIND_REPLACE_DATA& aSearchCriteria );
|
|
|
|
|
2017-09-20 14:20:38 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Checks if any of the screens has unsaved changes and asks the user whether to save or
|
|
|
|
* drop them.
|
|
|
|
*
|
2017-09-20 14:20:38 +00:00
|
|
|
* @return True if user decided to save or drop changes, false if the
|
2017-11-17 17:00:04 +00:00
|
|
|
* operation should be canceled.
|
2017-09-20 14:20:38 +00:00
|
|
|
*/
|
|
|
|
bool AskToSaveChanges();
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
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
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_AUTOPLACE_FIELDS event.
|
2015-12-13 16:56:47 +00:00
|
|
|
*/
|
|
|
|
void OnAutoplaceFields( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-27 13:34:28 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_SCH_MOVE_ITEM event used to move schematic items.
|
2011-10-27 13:34:28 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnMoveItem( wxCommandEvent& aEvent );
|
2011-10-26 20:46:04 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_SCH_ROTATE_CLOCKWISE and #ID_SCH_ROTATE_COUNTERCLOCKWISE events
|
|
|
|
* used to rotate schematic items and blocks.
|
2011-10-26 20:46:04 +00:00
|
|
|
*/
|
|
|
|
void OnRotate( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-27 13:34:28 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_SCH_EDIT_ITEM event used to edit schematic items.
|
2011-10-27 13:34:28 +00:00
|
|
|
*/
|
|
|
|
void OnEditItem( wxCommandEvent& aEvent );
|
|
|
|
|
2017-07-24 19:58:55 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_POPUP_SCH_SELECT_ON_PCB event used to select items in Pcbnew
|
2017-07-24 19:58:55 +00:00
|
|
|
* based on the sheet they are placed on.
|
|
|
|
*/
|
|
|
|
void SelectAllFromSheet( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-27 17:51:22 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_SCH_DRAG_ITEM event used to drag schematic items.
|
2011-10-27 17:51:22 +00:00
|
|
|
*/
|
|
|
|
void OnDragItem( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-28 20:30:50 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Handle the #ID_SCH_MIRROR_X, #ID_SCH_MIRROR_Y, and #ID_SCH_ORIENT_NORMAL events
|
|
|
|
* used to orient schematic items and blocks.
|
2011-10-28 20:30:50 +00:00
|
|
|
*/
|
|
|
|
void OnOrient( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnExit( wxCommandEvent& event );
|
|
|
|
void OnAnnotate( wxCommandEvent& event );
|
|
|
|
void OnErc( wxCommandEvent& event );
|
|
|
|
void OnCreateNetlist( wxCommandEvent& event );
|
2016-01-29 10:24:39 +00:00
|
|
|
void OnUpdatePCB( wxCommandEvent& event );
|
2016-08-11 12:41:16 +00:00
|
|
|
void OnSimulate( wxCommandEvent& event );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnCreateBillOfMaterials( wxCommandEvent& event );
|
2017-04-02 12:09:01 +00:00
|
|
|
void OnLaunchBomManager( wxCommandEvent& event );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnFindItems( wxCommandEvent& event );
|
|
|
|
void OnFindDialogClose( wxFindDialogEvent& event );
|
|
|
|
void OnFindDrcMarker( wxFindDialogEvent& event );
|
|
|
|
void OnFindCompnentInLib( wxFindDialogEvent& event );
|
2011-10-19 20:32:21 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Find an item in the schematic matching the search criteria in \a aEvent.
|
2011-10-19 20:32:21 +00:00
|
|
|
*
|
|
|
|
* @param aEvent - Find dialog event containing the find parameters.
|
|
|
|
*/
|
|
|
|
void OnFindSchematicItem( wxFindDialogEvent& aEvent );
|
|
|
|
|
2011-11-17 01:06:08 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Perform a search and replace of text in an item in the schematic matching the
|
2011-11-17 01:06:08 +00:00
|
|
|
* search and replace criteria in \a aEvent.
|
|
|
|
*
|
|
|
|
* @param aEvent - Find dialog event containing the search and replace parameters.
|
|
|
|
*/
|
|
|
|
void OnFindReplace( wxFindDialogEvent& aEvent );
|
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnLoadFile( wxCommandEvent& event );
|
2013-02-02 17:39:59 +00:00
|
|
|
void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event );
|
2017-08-25 13:27:06 +00:00
|
|
|
void OnUpdateFields( wxCommandEvent& event );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnNewProject( wxCommandEvent& event );
|
|
|
|
void OnLoadProject( wxCommandEvent& event );
|
2013-01-24 17:46:37 +00:00
|
|
|
void OnAppendProject( wxCommandEvent& event );
|
2017-09-20 14:20:38 +00:00
|
|
|
void OnImportProject( wxCommandEvent& event );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnOpenPcbnew( wxCommandEvent& event );
|
2014-05-05 17:28:40 +00:00
|
|
|
void OnOpenPcbModuleEditor( wxCommandEvent& event );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnOpenCvpcb( wxCommandEvent& event );
|
|
|
|
void OnOpenLibraryEditor( wxCommandEvent& event );
|
2015-06-22 15:38:54 +00:00
|
|
|
void OnRescueProject( wxCommandEvent& event );
|
2017-10-22 00:48:25 +00:00
|
|
|
void OnRemapSymbols( wxCommandEvent& aEvent );
|
2017-12-24 17:57:57 +00:00
|
|
|
|
2017-11-20 16:14:25 +00:00
|
|
|
// a helper function to run the dialog that allows to rename the symbol library Id of
|
|
|
|
// groups of components, for instance after a symbol has moved from a library to
|
2018-04-08 10:28:59 +00:00
|
|
|
// another library
|
2017-11-20 16:14:25 +00:00
|
|
|
void OnEditComponentSymbolsId( wxCommandEvent& aEvent );
|
2014-08-25 16:31:32 +00:00
|
|
|
void OnPreferencesOptions( wxCommandEvent& event );
|
2017-12-24 17:57:57 +00:00
|
|
|
void OnConfigurePaths( wxCommandEvent& aEvent );
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
void OnSelectItem( wxCommandEvent& aEvent );
|
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Command event handler for duplicating the item at the current location.
|
2011-10-19 20:32:21 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnCopySchematicItemRequest( wxCommandEvent& event );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
/* User interface update event handlers. */
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnUpdatePaste( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateHiddenPins( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
2015-06-11 17:27:36 +00:00
|
|
|
void OnUpdateSave( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent );
|
|
|
|
void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent );
|
2017-10-22 00:48:25 +00:00
|
|
|
void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2012-01-14 11:52:46 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Set the main window title bar text.
|
|
|
|
*
|
2012-01-14 11:52:46 +00:00
|
|
|
* If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
|
|
|
|
* application name appended with no file.
|
|
|
|
* Otherwise, the title is set to the hierarchical sheet path and the full file name,
|
|
|
|
* and read only is appended to the title if the user does not have write
|
|
|
|
* access to the file.
|
|
|
|
*/
|
|
|
|
void UpdateTitle();
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
// Bus Entry
|
2015-06-28 16:45:05 +00:00
|
|
|
SCH_BUS_WIRE_ENTRY* CreateBusWireEntry();
|
|
|
|
SCH_BUS_BUS_ENTRY* CreateBusBusEntry();
|
2013-04-01 10:35:20 +00:00
|
|
|
void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add no connect item to the current schematic sheet at \a aPosition.
|
|
|
|
*
|
2011-02-03 19:27:28 +00:00
|
|
|
* @param aPosition The position in logical (drawing) units to add the no connect.
|
|
|
|
* @return The no connect item added.
|
|
|
|
*/
|
2017-11-16 20:39:59 +00:00
|
|
|
SCH_NO_CONNECT* AddNoConnect( const wxPoint& aPosition );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add a new junction at \a aPosition.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2017-11-16 20:39:59 +00:00
|
|
|
SCH_JUNCTION* AddJunction( const wxPoint& aPosition, bool aPutInUndoList = false );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2017-10-26 15:25:47 +00:00
|
|
|
/**
|
2017-11-27 19:27:24 +00:00
|
|
|
* Save a copy of the current wire image in the undo list.
|
2017-10-26 15:25:47 +00:00
|
|
|
*/
|
|
|
|
void SaveWireImage();
|
|
|
|
|
2017-10-25 22:21:42 +00:00
|
|
|
/**
|
2017-11-27 19:27:24 +00:00
|
|
|
* Collects a unique list of all possible connection points in the schematic.
|
|
|
|
*
|
|
|
|
* @param aConnections vector of connections
|
|
|
|
*/
|
|
|
|
void GetSchematicConnections( std::vector< wxPoint >& aConnections );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs routine schematic cleaning including breaking wire and buses and
|
2017-10-25 22:21:42 +00:00
|
|
|
* deleting identical objects superimposed on top of each other.
|
|
|
|
*
|
2017-11-27 19:27:24 +00:00
|
|
|
* @param aAppend The changes to the schematic should be appended to the previous undo
|
2017-10-25 22:21:42 +00:00
|
|
|
* @return True if any schematic clean up was performed.
|
|
|
|
*/
|
2017-11-27 19:27:24 +00:00
|
|
|
bool SchematicCleanUp( bool aAppend = false );
|
2017-10-25 22:21:42 +00:00
|
|
|
|
2017-12-01 22:53:23 +00:00
|
|
|
/**
|
|
|
|
* If any single wire passes through _both points_, remove the portion between the two points,
|
|
|
|
* potentially splitting the wire into two.
|
|
|
|
*
|
|
|
|
* @param aStart The starting point for trimmming
|
|
|
|
* @param aEnd The ending point for trimming
|
|
|
|
* @param aAppend Should the line changes be appended to a previous undo state
|
2017-12-29 20:01:56 +00:00
|
|
|
* @return True if any wires were changed by this operation
|
2017-12-01 22:53:23 +00:00
|
|
|
*/
|
2017-12-29 20:01:56 +00:00
|
|
|
bool TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool aAppend = true );
|
2017-12-01 22:53:23 +00:00
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Start moving \a aItem using the mouse.
|
2011-10-19 20:32:21 +00:00
|
|
|
*
|
|
|
|
* @param aItem A pointer to an SCH_ITEM to move.
|
|
|
|
* @param aDC The device context to draw \a aItem.
|
|
|
|
*/
|
2015-02-28 16:56:09 +00:00
|
|
|
void PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC );
|
2011-10-19 20:32:21 +00:00
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
// Text, label, glabel
|
2011-10-15 13:25:57 +00:00
|
|
|
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
|
|
|
|
void EditSchematicText( SCH_TEXT* TextStruct );
|
2016-03-23 12:16:27 +00:00
|
|
|
void ChangeTextOrient( SCH_TEXT* aTextItem );
|
2011-03-03 01:58:12 +00:00
|
|
|
|
|
|
|
/**
|
2018-04-08 10:28:59 +00:00
|
|
|
* Command event handler to change a text type to another one.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
|
|
|
* The new text, label, hierarchical label, or global label is created from the old text
|
|
|
|
* and the old text object is deleted.
|
2011-03-03 01:58:12 +00:00
|
|
|
*/
|
|
|
|
void OnConvertTextType( wxCommandEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Creates a new segment ( WIRE, BUS ) or terminates the current segment in progress.
|
2011-11-10 15:55:05 +00:00
|
|
|
*
|
2018-04-08 10:28:59 +00:00
|
|
|
* If the end of the current segment is on a different segment, place a junction if needed
|
2011-11-10 15:55:05 +00:00
|
|
|
* and terminates the command. If the end of the current segment is on a pin, terminate
|
|
|
|
* the command. In all other cases starts a new segment.
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void BeginSegment( wxDC* DC, int type );
|
2011-11-10 15:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Terminate a bus, wire, or line creation.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2017-11-16 20:39:59 +00:00
|
|
|
void EndSegment();
|
2011-11-10 15:55:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Erase the last segment at the current mouse position.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void DeleteCurrentSegment( wxDC* DC );
|
|
|
|
void DeleteConnection( bool DeleteFullConnection );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// graphic lines
|
2011-10-15 13:25:57 +00:00
|
|
|
void Edge( DRAWSEGMENT* Segment, wxDC* DC );
|
|
|
|
void SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
|
|
|
|
void Layer( DRAWSEGMENT* Segment, wxDC* DC );
|
|
|
|
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
// Images:
|
2011-10-15 13:25:57 +00:00
|
|
|
SCH_BITMAP* CreateNewImage( wxDC* aDC );
|
|
|
|
void MoveImage( SCH_BITMAP* aItem, wxDC* aDC );
|
|
|
|
void RotateImage( SCH_BITMAP* aItem );
|
2017-11-17 17:00:04 +00:00
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Mirror a bitmap.
|
|
|
|
*
|
2011-08-31 14:59:20 +00:00
|
|
|
* @param aItem = the SCH_BITMAP item to mirror
|
|
|
|
* @param Is_X_axis = true to mirror relative to Horizontal axis
|
|
|
|
* false to mirror relative to vertical axis
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis );
|
|
|
|
void EditImage( SCH_BITMAP* aItem );
|
2011-08-31 14:59:20 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
// Hierarchical Sheet & PinSheet
|
2015-07-11 07:37:52 +00:00
|
|
|
void InstallHierarchyFrame( wxPoint& pos );
|
2013-08-05 21:02:41 +00:00
|
|
|
SCH_SHEET* CreateSheet( wxDC* DC );
|
|
|
|
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
|
|
|
|
|
2015-04-26 16:32:16 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Rotate a sheet object.
|
|
|
|
*
|
|
|
|
* Sheets do not have a anchor point. Because rotating it from its origin or its end is
|
|
|
|
* not friendly, the rotation is made around its center.
|
|
|
|
*
|
2015-04-26 16:32:16 +00:00
|
|
|
* @param aSheet the hierarchical sheet to rotate
|
|
|
|
* @param aRotCCW = true to rotate CCW, false to rotate CW
|
|
|
|
*/
|
|
|
|
void RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Mirror a hierarchical sheet.
|
|
|
|
*
|
|
|
|
* Mirroring is performed around its center.
|
|
|
|
*
|
2015-04-26 16:32:16 +00:00
|
|
|
* @param aSheet = the SCH_SHEET to mirror
|
|
|
|
* @param aFromXaxis = true to mirror relative to Horizontal axis
|
|
|
|
* false to mirror relative to vertical axis
|
|
|
|
*/
|
|
|
|
void MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis );
|
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
/// Loads the cache library associated to the aFileName
|
|
|
|
bool LoadCacheLibrary( const wxString& aFileName );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2017-10-31 16:33:37 +00:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Function EditLine
|
|
|
|
* displays the dialog for editing the parameters of \a aLine.
|
|
|
|
* @param aLine The Line/Wire/Bus to edit.
|
|
|
|
* @param aRedraw = true to refresh the screen
|
|
|
|
* @return The user response from the edit dialog.
|
|
|
|
*/
|
|
|
|
int EditLine( SCH_LINE* aLine, bool aRedraw );
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2011-06-07 15:29:01 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Edit an existing sheet or add a new sheet to the schematic.
|
|
|
|
*
|
2011-06-07 15:29:01 +00:00
|
|
|
* When \a aSheet is a new sheet:
|
2017-11-17 17:00:04 +00:00
|
|
|
* - and the file name already exists in the schematic hierarchy, the screen associated
|
|
|
|
* with the sheet found in the hierarchy is associated with \a aSheet.
|
|
|
|
* - and the file name already exists on the system, then \a aSheet is loaded with the
|
|
|
|
* existing file.
|
|
|
|
* - and the file name does not exist in the schematic hierarchy or on the file system,
|
|
|
|
* then a new screen is created and associated with \a aSheet.
|
|
|
|
*
|
2011-06-07 15:29:01 +00:00
|
|
|
* When \a aSheet is an existing sheet:
|
2017-11-17 17:00:04 +00:00
|
|
|
* - and the file name already exists in the schematic hierarchy, the current associated
|
|
|
|
* screen is replace by the one found in the hierarchy.
|
|
|
|
* - and the file name already exists on the system, the current associated screen file
|
|
|
|
* name is changed and the file is loaded.
|
|
|
|
* - and the file name does not exist in the schematic hierarchy or on the file system,
|
|
|
|
* the current associated screen file name is changed and saved to disk.
|
2015-06-28 16:45:05 +00:00
|
|
|
*
|
|
|
|
* Note: the screen is not refresh. The caller is responsible to do that
|
2011-06-07 15:29:01 +00:00
|
|
|
*/
|
2016-02-15 20:12:42 +00:00
|
|
|
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
2018-02-26 10:34:36 +00:00
|
|
|
/**
|
|
|
|
* Load the given filename but sets the path to the current project path.
|
|
|
|
*
|
|
|
|
* @param full filepath of file to be imported.
|
|
|
|
* @param aFileType SCH_FILE_T value for file type
|
|
|
|
*/
|
|
|
|
bool importFile( const wxString& aFileName, int aFileType );
|
|
|
|
|
2017-11-17 17:00:04 +00:00
|
|
|
bool validateSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.
|
|
|
|
*
|
2011-03-30 19:26:05 +00:00
|
|
|
* @param aSheet The sheet to add the new sheet pin to.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Display the dialog for editing the parameters of \a aSheetPin.
|
|
|
|
*
|
2011-03-30 19:26:05 +00:00
|
|
|
* @param aSheetPin The sheet pin item to edit.
|
2015-06-27 09:12:32 +00:00
|
|
|
* @param aRedraw = true to refresh the screen
|
2011-03-30 19:26:05 +00:00
|
|
|
* @return The user response from the edit dialog.
|
|
|
|
*/
|
2015-06-27 09:12:32 +00:00
|
|
|
int EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw );
|
2011-03-30 19:26:05 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Automatically create a sheet pin from the hierarchical labels in the schematic
|
2011-03-30 19:26:05 +00:00
|
|
|
* referenced by \a aSheet.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2011-03-30 19:26:05 +00:00
|
|
|
* @param aSheet The sheet to import the new sheet pin to.
|
|
|
|
* @param aDC The device context to draw on.
|
2017-11-17 17:00:04 +00:00
|
|
|
* @return The new sheet pin object imported or NULL if the task was aborted by the user.
|
2011-03-30 19:26:05 +00:00
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Remove \a aItem from the current screen and saves it in the undo list.
|
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aItem The item to remove from the current screen.
|
2017-10-25 22:21:42 +00:00
|
|
|
* @param aAppend True if we are updating a previous Undo state
|
2011-03-10 19:36:30 +00:00
|
|
|
*/
|
2017-10-12 23:41:25 +00:00
|
|
|
void DeleteItem( SCH_ITEM* aItem, bool aAppend = false );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all items (and unused junctions that connect to them) and saves
|
|
|
|
* each in the undo list
|
|
|
|
*
|
|
|
|
* @param aItemsList The list of items to delete
|
|
|
|
* @param aAppend True if we are updating a previous commit
|
|
|
|
*/
|
|
|
|
void DeleteItemsInList( PICKED_ITEMS_LIST& aItemsList, bool aAppend = false );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2018-02-02 20:04:36 +00:00
|
|
|
/**
|
|
|
|
* Removes a given junction and heals any wire segments under the junction
|
|
|
|
*
|
|
|
|
* @param aItem The junction to delete
|
|
|
|
* @param aAppend True if we are updating an ongoing commit
|
|
|
|
*/
|
|
|
|
void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false );
|
|
|
|
|
2017-11-27 19:27:24 +00:00
|
|
|
/**
|
|
|
|
* Adds junctions if needed to each item in the list after they have been
|
|
|
|
* moved.
|
|
|
|
*
|
|
|
|
* @param aItemsList The list of items to check
|
|
|
|
* @param aAppend True if we are updating a previous commit
|
|
|
|
*/
|
2017-12-29 20:01:56 +00:00
|
|
|
void CheckListConnections( PICKED_ITEMS_LIST& aItemsList, bool aAppend = false );
|
2017-11-27 19:27:24 +00:00
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
int GetLabelIncrement() const { return m_repeatLabelDelta; }
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
|
|
|
|
2013-05-24 23:58:29 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Load a symbol library and places it on the current schematic.
|
|
|
|
*.
|
2013-05-24 23:58:29 +00:00
|
|
|
* if libname != "", search in lib "libname"
|
|
|
|
* else search in all loaded libs
|
2014-02-18 21:41:27 +00:00
|
|
|
*
|
2014-10-06 01:18:24 +00:00
|
|
|
* @param aDC is the device context to draw upon.
|
2017-06-16 00:31:42 +00:00
|
|
|
* @param aFilter is a filter to pass the allowed lib names list, or library name
|
2015-04-16 15:26:51 +00:00
|
|
|
* to load the component from and/or some other filters
|
|
|
|
* if NULL, no filtering.
|
2014-02-18 21:41:27 +00:00
|
|
|
* @param aHistoryList list remembering recently used component names.
|
2014-10-06 01:18:24 +00:00
|
|
|
* @param aUseLibBrowser is the flag to determine if the library browser should be launched.
|
|
|
|
* @return a pointer the SCH_COMPONENT object selected or NULL if no component was selected.
|
2014-02-18 21:41:27 +00:00
|
|
|
* (TODO(hzeller): This really should be a class doing history, but didn't
|
|
|
|
* want to change too much while other refactoring is going on)
|
2013-05-24 23:58:29 +00:00
|
|
|
*/
|
2017-03-23 00:59:25 +00:00
|
|
|
SCH_COMPONENT* Load_Component( wxDC* aDC,
|
|
|
|
const SCHLIB_FILTER* aFilter,
|
|
|
|
SCH_BASE_FRAME::HISTORY_LIST& aHistoryList,
|
|
|
|
bool aUseLibBrowser );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-08-30 19:24:28 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Display the edit component dialog to edit the parameters of \a aComponent.
|
2011-08-30 19:24:28 +00:00
|
|
|
*
|
|
|
|
* @param aComponent is a pointer to the SCH_COMPONENT object to be edited.
|
|
|
|
*/
|
|
|
|
void EditComponent( SCH_COMPONENT* aComponent );
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2013-05-24 23:58:29 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Rotate and mirror a component.
|
2013-05-24 23:58:29 +00:00
|
|
|
*/
|
2011-10-28 20:30:50 +00:00
|
|
|
void OrientComponent( COMPONENT_ORIENTATION_T aOrientation = CMP_NORMAL );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2011-10-15 13:25:57 +00:00
|
|
|
void OnSelectUnit( wxCommandEvent& aEvent );
|
|
|
|
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
|
|
|
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
2011-03-29 15:21:35 +00:00
|
|
|
|
2012-06-03 11:16:08 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Display the edit field dialog to edit the parameters of \a aField.
|
2012-06-03 11:16:08 +00:00
|
|
|
*
|
|
|
|
* @param aField is a pointer to the SCH_FIELD object to be edited.
|
|
|
|
*/
|
|
|
|
void EditComponentFieldText( SCH_FIELD* aField );
|
|
|
|
|
2016-03-23 12:16:27 +00:00
|
|
|
void RotateField( SCH_FIELD* aField );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Paste a list of items from the block stack.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void PasteListOfItems( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Undo - redo */
|
|
|
|
public:
|
2009-07-26 17:16:42 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Create a copy of the current schematic item, and put it in the undo list.
|
|
|
|
*
|
|
|
|
* flag_type_command =
|
|
|
|
* UR_CHANGED
|
|
|
|
* UR_NEW
|
|
|
|
* UR_DELETED
|
|
|
|
* UR_WIRE_IMAGE
|
|
|
|
* UR_MOVED
|
|
|
|
*
|
|
|
|
* If it is a delete command, items are put on list with the .Flags member
|
|
|
|
* set to UR_DELETED. When it will be really deleted, the GetDrawItems() and the
|
|
|
|
* sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
|
|
|
|
* sub-hierarchy must NOT be deleted.
|
|
|
|
*
|
2010-12-28 11:24:42 +00:00
|
|
|
* @note
|
2010-12-14 21:39:31 +00:00
|
|
|
* Edit wires and buses is a bit complex.
|
2010-12-28 11:24:42 +00:00
|
|
|
* because when a new wire is added, a lot of modifications in wire list is made
|
|
|
|
* (wire concatenation): modified items, deleted items and new items
|
2010-12-14 21:39:31 +00:00
|
|
|
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
|
|
|
|
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
|
|
|
|
* exchanged with current wire list
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2009-07-26 17:16:42 +00:00
|
|
|
* @param aItemToCopy = the schematic item modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2017-11-16 20:36:09 +00:00
|
|
|
* @param aAppend = add the item to the previous undo list
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-07-26 17:16:42 +00:00
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
2017-11-16 20:36:09 +00:00
|
|
|
bool aAppend = false,
|
2010-12-14 21:39:31 +00:00
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2009-07-26 17:16:42 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a new entry in undo list of commands.
|
|
|
|
*
|
2009-07-26 17:16:42 +00:00
|
|
|
* @param aItemsList = the list of items modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
2017-11-16 20:36:09 +00:00
|
|
|
* @param aAppend = add the item to the previous undo list
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-07-26 17:16:42 +00:00
|
|
|
*/
|
2013-12-18 12:27:18 +00:00
|
|
|
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
2017-11-16 20:36:09 +00:00
|
|
|
bool aAppend = false,
|
2010-12-14 21:39:31 +00:00
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Restore an undo or redo command to put data pointed by \a aList in the previous state.
|
|
|
|
*
|
2010-12-14 21:39:31 +00:00
|
|
|
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
|
|
|
* @param aRedoCommand a bool: true for redo, false for undo
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2010-12-14 21:39:31 +00:00
|
|
|
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Redo the last edition.
|
|
|
|
*
|
2009-08-01 19:26:05 +00:00
|
|
|
* - Save the current schematic in Undo list
|
|
|
|
* - Get an old version of the schematic from Redo list
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2009-08-01 19:26:05 +00:00
|
|
|
* @return none
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void GetSchematicFromRedoList( wxCommandEvent& event );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Perform an undo the last edition.
|
|
|
|
*
|
2009-08-01 19:26:05 +00:00
|
|
|
* - Save the current schematic in Redo list
|
|
|
|
* - Get an old version of the schematic from Undo list
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void GetSchematicFromUndoList( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Copy the list of block item.
|
|
|
|
*
|
2011-01-07 19:24:24 +00:00
|
|
|
* @sa m_blockItems
|
2011-06-07 15:29:01 +00:00
|
|
|
* @param aItemsList List to copy the block select items into.
|
2011-01-07 19:24:24 +00:00
|
|
|
*/
|
|
|
|
void copyBlockItems( PICKED_ITEMS_LIST& aItemsList );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-05-20 19:21:09 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Add the context menu items to \a aMenu for \a aJunction.
|
|
|
|
*
|
2011-06-07 15:29:01 +00:00
|
|
|
* @param aMenu The menu to add the items to.
|
|
|
|
* @param aJunction The SCH_JUNCTION object selected.
|
2011-05-20 19:21:09 +00:00
|
|
|
*/
|
|
|
|
void addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction );
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2011-10-15 13:25:57 +00:00
|
|
|
void Key( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Initialize the parameters used by the block paste command.
|
2011-11-10 15:55:05 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void InitBlockPasteInfos() override;
|
2011-11-10 15:55:05 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the block command internal code (BLOCK_MOVE, BLOCK_DUPLICATE...)
|
2010-11-13 11:02:24 +00:00
|
|
|
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
|
|
|
|
* block command is started by dragging the mouse.
|
2017-11-17 17:00:04 +00:00
|
|
|
*
|
2010-11-13 11:02:24 +00:00
|
|
|
* @param aKey = the key modifiers (Alt, Shift ...)
|
2017-07-04 08:08:33 +00:00
|
|
|
* @return the block command id (BLOCK_MOVE, BLOCK_DUPLICATE...)
|
2010-11-13 11:02:24 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual int BlockCommand( EDA_KEY aKey ) override;
|
2010-11-13 11:02:24 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Call after HandleBlockEnd, when a block command needs to be executed after the block
|
|
|
|
* is moved to its new place.
|
|
|
|
*
|
2010-11-13 11:02:24 +00:00
|
|
|
* Parameters must be initialized in GetScreen()->m_BlockLocate
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void HandleBlockPlace( wxDC* DC ) override;
|
2010-11-13 11:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle the "end" of a block command,
|
|
|
|
* i.e. is called at the end of the definition of the area of a block.
|
|
|
|
* depending on the current block command, this command is executed
|
|
|
|
* or parameters are initialized to prepare a call to HandleBlockPlace
|
|
|
|
* in GetScreen()->m_BlockLocate
|
2013-10-15 16:18:30 +00:00
|
|
|
*
|
|
|
|
* @param aDC is a device context to draw on.
|
2010-11-13 11:02:24 +00:00
|
|
|
* @return false if no item selected, or command finished,
|
|
|
|
* true if some items found and HandleBlockPlace must be called later
|
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool HandleBlockEnd( wxDC* aDC ) override;
|
2010-11-13 11:02:24 +00:00
|
|
|
|
2011-11-10 15:55:05 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Repeat the last item placement if the last item was a bus, bus entry,
|
2011-11-10 15:55:05 +00:00
|
|
|
* label, or component.
|
|
|
|
*
|
|
|
|
* Labels that end with a number will be incremented.
|
|
|
|
*/
|
2011-10-15 13:25:57 +00:00
|
|
|
void RepeatDrawItem( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2013-08-05 21:02:41 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Clone \a aItem and owns that clone in this container.
|
2013-08-05 21:02:41 +00:00
|
|
|
*/
|
|
|
|
void SetRepeatItem( SCH_ITEM* aItem );
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Return the item which is to be repeated with the insert key.
|
|
|
|
*
|
|
|
|
* Such object is owned by this container, and must be cloned.
|
2013-08-05 21:02:41 +00:00
|
|
|
*/
|
|
|
|
SCH_ITEM* GetRepeatItem() const { return m_item_to_repeat; }
|
2011-01-12 21:47:54 +00:00
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Clone \a aItem which can be used to restore the state of the item being edited
|
2011-04-05 14:46:51 +00:00
|
|
|
* when the user cancels the editing in progress.
|
|
|
|
*
|
|
|
|
* @param aItem The item to make a clone of for undoing the last change. Set to
|
|
|
|
* NULL to free the current undo item.
|
|
|
|
*/
|
|
|
|
void SetUndoItem( const SCH_ITEM* aItem );
|
|
|
|
|
|
|
|
SCH_ITEM* GetUndoItem() const { return m_undoItem; }
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Swap the cloned item in member variable m_undoItem with \a aItem and saves it to
|
|
|
|
* the undo list then swap the data back.
|
|
|
|
*
|
|
|
|
* This swaps the internal structure of the item with the cloned item. It does not
|
|
|
|
* swap the actual item pointers themselves.
|
2011-04-05 14:46:51 +00:00
|
|
|
*
|
|
|
|
* @param aItem The item to swap with the current undo item.
|
|
|
|
*/
|
|
|
|
void SaveUndoItemInUndoList( SCH_ITEM* aItem );
|
|
|
|
|
2013-01-21 19:58:02 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a symbol library file with the name of the root document plus the '-cache' suffix,
|
2013-01-21 19:58:02 +00:00
|
|
|
*
|
2017-11-17 17:00:04 +00:00
|
|
|
* This file will contain all components used in the current schematic.
|
|
|
|
*
|
|
|
|
* @param aUseCurrentSheetFilename = false to use the root sheet filename
|
2013-05-07 18:32:06 +00:00
|
|
|
* (default) or true to use the currently opened sheet.
|
|
|
|
* @return true if the file was written successfully.
|
2013-01-21 19:58:02 +00:00
|
|
|
*/
|
2013-05-07 18:32:06 +00:00
|
|
|
bool CreateArchiveLibraryCacheFile( bool aUseCurrentSheetFilename = false );
|
2013-01-21 19:58:02 +00:00
|
|
|
|
2011-11-11 20:10:24 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Create a library \a aFileName that contains all components used in the current schematic.
|
2011-11-11 20:10:24 +00:00
|
|
|
*
|
|
|
|
* @param aFileName The full path and file name of the archive library.
|
|
|
|
* @return True if \a aFileName was written successfully.
|
|
|
|
*/
|
|
|
|
bool CreateArchiveLibrary( const wxString& aFileName );
|
|
|
|
|
2015-04-25 22:26:51 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Perform rescue operations to recover old projects from before certain changes were made.
|
2015-06-22 15:38:54 +00:00
|
|
|
*
|
2017-11-17 17:00:04 +00:00
|
|
|
* - Exports cached symbols that conflict with new symbols to a separate library.
|
|
|
|
* - Exports cached symbols not found in any symbol library.
|
|
|
|
* - Renames symbols named before libraries were case sensitive.
|
2015-04-25 22:26:51 +00:00
|
|
|
*
|
|
|
|
* @param aRunningOnDemand - indicates whether the tool has been called up by the user
|
|
|
|
* (as opposed to being run automatically). If true, an information dialog is
|
|
|
|
* displayed if there are no components to rescue. If false, the tool is silent
|
|
|
|
* if there are no components to rescue, and a "Never Show Again" button is
|
|
|
|
* displayed.
|
|
|
|
*/
|
2017-10-22 00:48:25 +00:00
|
|
|
bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand );
|
|
|
|
bool RescueLegacyProject( bool aRunningOnDemand );
|
|
|
|
bool RescueSymbolLibTableProject( bool aRunningOnDemand );
|
2015-04-25 22:26:51 +00:00
|
|
|
|
2011-03-29 15:21:35 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Plot or print the current sheet to the clipboard.
|
|
|
|
*
|
2011-03-28 19:26:31 +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;
|
2011-03-28 19:26:31 +00:00
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
|
|
|
|
|
|
|
|
wxString GetSimulatorCommand() const { return m_simulatorCommand; }
|
|
|
|
|
|
|
|
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
|
|
|
|
|
2016-03-31 06:28:16 +00:00
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Reset the execution flags to defaults for external netlist and bom generators.
|
2016-03-31 06:28:16 +00:00
|
|
|
*/
|
|
|
|
void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Set (adds) specified flags for next execution of external generator of the netlist or bom.
|
|
|
|
*
|
2016-03-31 06:28:16 +00:00
|
|
|
* @param aFlags = wxEXEC_* flags, see wxExecute docs.
|
|
|
|
*/
|
|
|
|
void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
|
|
|
|
|
|
|
|
/**
|
2017-11-17 17:00:04 +00:00
|
|
|
* Clear (removes) specified flags that not needed for next execution of external generator
|
|
|
|
* of the netlist or bom.
|
|
|
|
*
|
2016-03-31 06:28:16 +00:00
|
|
|
* @param aFlags = wxEXEC_* flags, see wxExecute docs.
|
|
|
|
*/
|
|
|
|
void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
|
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
wxString GetNetListerCommand() const { return m_netListerCommand; }
|
|
|
|
|
2018-02-16 18:26:11 +00:00
|
|
|
/**
|
|
|
|
* Updates netlist and sends it to pcbnew.
|
|
|
|
* @param aUpdateOptions is a string defining update options:
|
|
|
|
* - "no-annotate" does not perform schematic annotation
|
|
|
|
* - "quiet-annotate" performs schematic annotation without showing annotation dialog
|
|
|
|
* aUpdateOptions may also contain other options accepted for netlist reader.
|
|
|
|
* @see PCB_EDIT_FRAME::KiwayMailIn()
|
|
|
|
*/
|
|
|
|
void doUpdatePcb( const wxString& aUpdateOptions = "" );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
int GetIconScale() override;
|
|
|
|
void SetIconScale( int aScale ) override;
|
|
|
|
|
2016-08-11 12:41:45 +00:00
|
|
|
///> Probe cursor, used by circuit simulator
|
2016-08-11 12:41:12 +00:00
|
|
|
const static wxCursor CURSOR_PROBE;
|
|
|
|
|
2016-08-11 12:41:45 +00:00
|
|
|
///> Tuner cursor, used by circuit simulator
|
|
|
|
const static wxCursor CURSOR_TUNE;
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-01-30 10:49:51 +00:00
|
|
|
#endif // SCH_EDIT_FRAME_H
|