KiCad PCB EDA Suite
sch_edit_frame.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef SCH_EDIT_FRAME_H
27 #define SCH_EDIT_FRAME_H
28 
29 #include <sch_base_frame.h>
30 #include <config_params.h>
31 #include <undo_redo_container.h>
32 #include <template_fieldnames.h>
33 #include <block_commande.h>
34 #include <ee_collectors.h>
35 #include <tool/selection.h>
36 #include <erc_settings.h>
37 #include <sch_draw_panel.h>
38 
39 // enum PINSHEETLABEL_SHAPE
40 #include <sch_text.h>
41 #include <tool/selection.h>
42 
43 class SCH_ITEM;
44 class EDA_ITEM;
45 class SCH_TEXT;
46 class SCH_BITMAP;
47 class SCH_SHEET;
48 class SCH_SHEET_PATH;
49 class SCH_SHEET_PIN;
50 class SCH_COMPONENT;
51 class SCH_FIELD;
52 class SCH_JUNCTION;
53 class DIALOG_SCH_FIND;
54 class wxFindDialogEvent;
55 class wxFindReplaceData;
56 class RESCUER;
57 
58 
61  CMP_NORMAL, // Normal orientation, no rotation or mirror
62  CMP_ROTATE_CLOCKWISE, // Rotate -90
64  CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
65  CMP_ORIENT_90, // Rotate 90, no mirror
66  CMP_ORIENT_180, // Rotate 180, no mirror
67  CMP_ORIENT_270, // Rotate -90, no mirror
68  CMP_MIRROR_X = 0x100, // Mirror around X axis
69  CMP_MIRROR_Y = 0x200 // Mirror around Y axis
70 };
71 
72 
78 };
80 
81 
88 };
90 
91 
99 };
100 
101 
106 {
107 private:
110 
114  wxPageSetupDialogData m_pageSetupData;
115  wxFindReplaceData* m_findReplaceData;
120  wxArrayString m_findStringHistoryList;
128  wxString m_netListerCommand;
130  int m_exec_flags;
132 
135 
140 
143 
146 
149 
151  wxString m_netListFormat;
152 
155 
156 private:
157 
158  /* these are PROJECT specific, not schematic editor specific
159  wxString m_userLibraryPath;
160  wxArrayString m_componentLibFiles;
161  */
162 
164  static wxSize m_lastSheetPinTextSize;
165  static wxPoint m_lastSheetPinPosition;
166 
167 protected:
171  const wxSize &GetLastSheetPinTextSize();
172 
178  virtual bool doAutoSave() override;
179 
183  virtual bool isAutoSaveRequired() const override;
184 
185  void updateFindReplaceView( wxFindDialogEvent& aEvent );
186 
187  void backAnnotateFootprints( const std::string& aChangedSetOfReferences );
188 
195  bool prepareForNetlist();
196 
200  void sendNetlistToCvpcb();
201 
202 public:
203  SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
204  ~SCH_EDIT_FRAME();
205 
206  SCH_SCREEN* GetScreen() const override;
207 
208  void OnCloseWindow( wxCloseEvent& Event );
209 
210  bool GetForceHVLines() const { return m_forceHVLines; }
211  void SetForceHVLines( bool aForceHVdirection ) { m_forceHVLines = aForceHVdirection; }
212 
213  bool GetShowAllPins() const override { return m_showAllPins; }
214  void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
215 
217  void SetShowFootprintPreviews( bool aEnable ) { m_footprintPreview = aEnable; }
218 
219  bool GetAutoplaceFields() const { return m_autoplaceFields; }
220  void SetAutoplaceFields( bool aEnable ) { m_autoplaceFields = aEnable; }
221 
222  bool GetAutoplaceAlign() const { return m_autoplaceAlign; }
223  void SetAutoplaceAlign( bool aEnable ) { m_autoplaceAlign = aEnable; }
224 
225  bool GetAutoplaceJustify() const { return m_autoplaceJustify; }
226  void SetAutoplaceJustify( bool aEnable ) { m_autoplaceJustify = aEnable; }
227 
228  const wxString GetNetListFormatName() const { return m_netListFormat; }
229  void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; }
230 
232  void SetSpiceAjustPassiveValues( bool aEnable ) { m_spiceAjustPassiveValues = aEnable; }
233 
235  const wxString& GetPlotDirectoryName() const { return m_plotDirectoryName; }
236  void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; }
237 
238  void Process_Config( wxCommandEvent& event );
239 
249 
255  void SaveProjectSettings( bool aAskForSave ) override;
256 
262  bool LoadProjectFile();
263 
265 
266  void UpdateErcSettings( const ERC_SETTINGS& aSettings ) { m_ercSettings = aSettings; }
267 
279  int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
280  {
281  return m_templateFieldNames.AddTemplateFieldName( aFieldName );
282  }
283 
288  {
290  }
291 
304 
305  void LoadSettings( wxConfigBase* aCfg ) override;
306  void SaveSettings( wxConfigBase* aCfg ) override;
307 
308  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
309 
310  void CreateScreens();
311  void ReCreateHToolbar() override;
312  void ReCreateVToolbar() override;
313  void ReCreateOptToolbar();
314  void ReCreateMenuBar() override;
315 
317  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
318 
319  bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem ) override;
320 
325  void OnModify() override;
326 
327  virtual wxString GetScreenDesc() const override;
328 
335  virtual void ExecuteRemoteCommand( const char* cmdline ) override;
336 
337  void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
338 
339  bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override { return true; }
340  double BestZoom() override;
341 
346  void AddItemToScreenAndUndoList( SCH_ITEM* aItem, bool aUndoAppend = false );
347 
357  SCH_ITEM* FindComponentAndItem( const wxString& aReference,
358  bool aSearchHierarchy,
359  SCH_SEARCH_T aSearchType,
360  const wxString& aSearchText );
361 
373  bool BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
374  SCH_LINE** aNewSegment = NULL, SCH_SCREEN* aScreen = nullptr );
375 
386  bool BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen = nullptr );
387 
397  bool BreakSegmentsOnJunctions( SCH_SCREEN* aScreen = nullptr );
398 
403  bool TestDanglingEnds();
404 
417  void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aPart );
418 
424  void SendCrossProbeNetName( const wxString& aNetName );
425 
430 
431  const wxString& GetSelectedNetName() const { return m_SelectedNetName; }
432  void SetSelectedNetName( const wxString& aNetName ) { m_SelectedNetName = aNetName; }
433 
440  NETLIST_OBJECT_LIST* BuildNetListBase( bool updateStatusText = true );
441 
453  NETLIST_OBJECT_LIST* CreateNetlist( bool aSilent = false,
454  bool aSilentAnnotate = false );
455 
473  bool WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
474  int aFormat,
475  const wxString& aFullFileName,
476  unsigned aNetlistOptions,
477  REPORTER* aReporter = NULL );
478 
485  void DeleteAnnotation( bool aCurrentSheetOnly );
486 
515  void AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption,
516  ANNOTATE_OPTION_T aAlgoOption, int aStartNumber,
517  bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits,
518  REPORTER& aReporter );
519 
536  int CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly );
537 
543  int ModalAnnotate( const wxString& aMessage );
544 
545  // Functions used for hierarchy handling
547 
548  void SetCurrentSheet( const SCH_SHEET_PATH& aSheet );
549 
553  void HardRedraw() override;
554 
558  void DisplayCurrentSheet();
559 
565  void OnPageSettingsChange() override;
566 
578 
584  void SetSheetNumberAndCount();
585 
589  void OnPrint( wxCommandEvent& event );
590 
591  wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
592 
594  void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
596  void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
597 
598  // Plot functions:
599  void PlotSchematic( wxCommandEvent& event );
600 
601  // read and save files
602  void Save_File( wxCommandEvent& event );
603 
609  void OnSaveProject( wxCommandEvent& aEvent );
610  bool SaveProject();
611 
612  bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
613 
614  void OnOpenLibraryEditor( wxCommandEvent& event );
615 
645  bool AppendSchematic();
646 
654 
675  bool ProcessCmpToFootprintLinkFile( const wxString& aFullFilename,
676  bool aForceVisibilityState,
677  bool aVisibilityState );
678 
692  bool SaveEEFile( SCH_SCREEN* aScreen,
693  bool aSaveUnderNewName = false,
694  bool aCreateBackupFile = CREATE_BACKUP_FILE );
695 
696  // General search:
697 
698  bool IsSearchCacheObsolete( const SCH_FIND_REPLACE_DATA& aSearchCriteria );
699 
707  bool AskToSaveChanges();
708 
709  SCH_JUNCTION* AddJunction( const wxPoint& aPos, bool aAppendToUndo = false,
710  bool aFinal = true );
711 
712  SCH_TEXT* CreateNewText( int aType );
713 
723  bool SchematicCleanUp( SCH_SCREEN* aScreen = nullptr );
724 
735  bool TrimWire( const wxPoint& aStart, const wxPoint& aEnd );
736 
742  void GetSchematicConnections( std::vector< wxPoint >& aConnections );
743 
744 private:
745  // Sets up the tool framework
746  void setupTools();
747 
748  void OnExit( wxCommandEvent& event );
749  void OnAnnotate( wxCommandEvent& event );
750  void OnErc( wxCommandEvent& event );
751  void OnCreateNetlist( wxCommandEvent& event );
752  void OnUpdatePCB( wxCommandEvent& event );
753  void OnSimulate( wxCommandEvent& event );
754  void OnCreateBillOfMaterials( wxCommandEvent& event );
755  void OnLaunchBomManager( wxCommandEvent& event );
756  void OnLaunchBusManager( wxCommandEvent& event );
757  void OnFindItems( wxCommandEvent& event );
758  void OnFindDialogClose( wxFindDialogEvent& event );
759  void OnFindDrcMarker( wxFindDialogEvent& event );
760 
766  void OnFindSchematicItem( wxFindDialogEvent& aEvent );
767 
774  void OnFindReplace( wxFindDialogEvent& aEvent );
775 
776  void OnLoadFile( wxCommandEvent& event );
777  void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event );
778  void OnUpdateFields( wxCommandEvent& event );
779  void OnNewProject( wxCommandEvent& event );
780  void OnLoadProject( wxCommandEvent& event );
781  void OnAppendProject( wxCommandEvent& event );
782  void OnImportProject( wxCommandEvent& event );
783  void OnOpenPcbnew( wxCommandEvent& event );
784  void OnOpenPcbModuleEditor( wxCommandEvent& event );
785  void OnOpenCvpcb( wxCommandEvent& event );
786  void OnRescueProject( wxCommandEvent& event );
787  void OnRemapSymbols( wxCommandEvent& aEvent );
788 
789  // a helper function to run the dialog that allows to rename the symbol library Id of
790  // groups of components, for instance after a symbol has moved from a library to
791  // another library
792  void OnEditComponentSymbolsId( wxCommandEvent& aEvent );
793  void OnPreferencesOptions( wxCommandEvent& event );
794 
795  /* User interface update event handlers. */
796  void OnUpdatePaste( wxUpdateUIEvent& event );
797  void OnUpdateSave( wxUpdateUIEvent& aEvent );
798  void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent );
799  void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
800 
804  void CloseErc();
805 
815  void UpdateTitle();
816 
821  bool AddMissingJunctions( SCH_SCREEN* aScreen );
822 
827  void NormalizeSchematicOnFirstLoad( bool recalculateConnections );
828 
829 public:
836  void ConvertTextType( SCH_TEXT* aText, KICAD_T aType );
837 
841  void EditSchematicText( SCH_TEXT* aText );
842 
848  bool EditImage( SCH_BITMAP* aItem );
849 
857  int EditLine( SCH_LINE* aLine, bool aRedraw );
858 
887  bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, bool* aClearAnnotationNewItems );
888 
889  void InitSheet( SCH_SHEET* aSheet, const wxString& aFilename );
890 
892 
893 private:
900  bool importFile( const wxString& aFileName, int aFileType );
901 
902 public:
910 
918  int EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw );
919 
928 
935  void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false );
936 
937  int GetLabelIncrement() const { return m_repeatLabelDelta; }
938 
944  void EditComponent( SCH_COMPONENT* aComponent );
945 
946 public:
947 
953  void EditComponentFieldText( SCH_FIELD* aField );
954 
955  void ConvertPart( SCH_COMPONENT* aComponent );
956 
957  void SelectUnit( SCH_COMPONENT* aComponent, int aUnit );
958 
959  /* Undo - redo */
960 public:
961 
991  void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
992  UNDO_REDO_T aTypeCommand,
993  bool aAppend = false,
994  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
995 
1005  void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
1006  UNDO_REDO_T aTypeCommand,
1007  bool aAppend = false,
1008  const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
1009 
1016  void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
1017 
1021  void SaveCopyForRepeatItem( SCH_ITEM* aItem );
1022 
1029 
1040  void SaveUndoItemInUndoList( SCH_ITEM* aItem, bool aAppend = false );
1041 
1047 
1057  bool CreateArchiveLibraryCacheFile( bool aUseCurrentSheetFilename = false );
1058 
1065  bool CreateArchiveLibrary( const wxString& aFileName );
1066 
1080  bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand );
1081  bool RescueLegacyProject( bool aRunningOnDemand );
1082  bool RescueSymbolLibTableProject( bool aRunningOnDemand );
1083 
1092  virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
1093  bool aPrintMirrorMode, void* aData = NULL ) override;
1094 
1095  void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
1096 
1097  wxString GetSimulatorCommand() const { return m_simulatorCommand; }
1098 
1099  void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
1100 
1104  void DefaultExecFlags() { m_exec_flags = wxEXEC_SYNC; }
1105 
1111  void SetExecFlags( const int aFlags ) { m_exec_flags |= aFlags; }
1112 
1119  void ClearExecFlags( const int aFlags ) { m_exec_flags &= ~( aFlags ); }
1120 
1121  wxString GetNetListerCommand() const { return m_netListerCommand; }
1122 
1126  void RecalculateConnections( bool aDoCleanup = true );
1127 
1131  void InstallPreferences( PAGED_DIALOG* aParent ) override;
1132 
1136  void CommonSettingsChanged() override;
1137 
1138  void ShowChangedLanguage() override;
1139 
1140  void SyncMenusAndToolbars() override;
1141 
1142  virtual void SetScreen( BASE_SCREEN* aScreen ) override;
1143 
1144  virtual const BOX2I GetDocumentExtents() const override;
1145 
1146  DECLARE_EVENT_TABLE()
1147 };
1148 
1149 
1150 #endif // SCH_EDIT_FRAME_H
void OnLoadProject(wxCommandEvent &event)
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void OnFindDrcMarker(wxFindDialogEvent &event)
Definition: find.cpp:60
bool GetAutoplaceJustify() const
wxString m_netListerCommand
Command line to call a custom net list generator.
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
void EditComponent(SCH_COMPONENT *aComponent)
Display the edit component dialog to edit the parameters of aComponent.
const wxString GetNetListFormatName() const
void OnOpenCvpcb(wxCommandEvent &event)
A list of parameters type.
bool SchematicCleanUp(SCH_SCREEN *aScreen=nullptr)
Performs routine schematic cleaning including breaking wire and buses and deleting identical objects ...
Class KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
void DefaultExecFlags()
Reset the execution flags to defaults for external netlist and bom generators.
int EditLine(SCH_LINE *aLine, bool aRedraw)
Function EditLine displays the dialog for editing the parameters of aLine.
Definition: sch_line.cpp:816
Class SCH_FIND_COLLECTOR is used to iterate over all of the items in a schematic or sheet and collect...
void Process_Config(wxCommandEvent &event)
wxString * m_findReplaceStatus
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
const wxString & GetSelectedNetName() const
void CloseErc()
Close the ERC dialog if it is open.
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
void OnFindItems(wxCommandEvent &event)
void OnLoadFile(wxCommandEvent &event)
void OnUpdateSaveSheet(wxUpdateUIEvent &aEvent)
SCH_TEXT * CreateNewText(int aType)
Definition: edit_label.cpp:47
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to pcbnew for highlighting.
bool LoadCmpToFootprintLinkFile()
Loads a .cmp file from CvPcb and update the footprint field of components.
Definition: backanno.cpp:221
void SetPlotDirectoryName(const wxString &aDirName)
void OnOpenPcbModuleEditor(wxCommandEvent &event)
int AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName)
Insert or append a wanted symbol field name into the field names template.
void GetSchematicConnections(std::vector< wxPoint > &aConnections)
Collects a unique list of all possible connection points in the schematic.
PARAM_CFG_ARRAY m_projectFileParams
void OnPreferencesOptions(wxCommandEvent &event)
COMPONENT_ORIENTATION_T
enum used in RotationMiroir()
wxArrayString m_findStringHistoryList
void SetForceHVLines(bool aForceHVdirection)
ANNOTATE_ORDER_T
Schematic annotation order options.
bool BreakSegments(const wxPoint &aPoint, SCH_SCREEN *aScreen=nullptr)
Checks every wire and bus for a intersection at aPoint and break into two segments at aPoint if an in...
virtual void SetScreen(BASE_SCREEN *aScreen) override
void OnNewProject(wxCommandEvent &event)
void OnUpdateRemapSymbols(wxUpdateUIEvent &aEvent)
bool BreakSegment(SCH_LINE *aSegment, const wxPoint &aPoint, SCH_LINE **aNewSegment=NULL, SCH_SCREEN *aScreen=nullptr)
Breaks a single segment into two at the specified point.
void OnFindDialogClose(wxFindDialogEvent &event)
void ReCreateMenuBar() override
Recreates the menu bar.
wxString m_DefaultSchematicFileName
static wxSize m_lastSheetPinTextSize
Last sheet pin text size.
bool GetPrintMonochrome()
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem) override
Definition: ee_hotkeys.cpp:437
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void SetAutoplaceAlign(bool aEnable)
void OnLaunchBomManager(wxCommandEvent &event)
bool GetShowFootprintPreviews() const
SCH_FIND_COLLECTOR m_foundItems
List of find/replace items.
void SendCrossProbeClearHighlight()
Tells PcbNew to clear the existing highlighted net, if one exists.
void AnnotateComponents(bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, REPORTER &aReporter)
Annotate the components in the schematic that are not currently annotated.
Definition: annotate.cpp:82
Find a component in the schematic.
bool AskToSaveChanges()
Checks if any of the screens has unsaved changes and asks the user whether to save or drop them.
TEMPLATES m_templateFieldNames
PARAM_CFG_ARRAY & GetConfigurationSettings()
Return the Eeschema applications settings.
void OnCloseWindow(wxCloseEvent &Event)
PARAM_CFG_ARRAY & GetProjectFileParameters()
Return the project file parameter list for Eeschema.
SCH_SHEET_PIN * CreateSheetPin(SCH_SHEET *aSheet)
Create a new SCH_SHEET_PIN object and add it to aSheet at the current cursor position.
Definition: sheet.cpp:345
void UpdateTitle()
Set the main window title bar text.
Find an item by it's value field.
Annotate incrementally using the first free reference number.
wxFindReplaceData * m_findReplaceData
void OnAppendProject(wxCommandEvent &event)
int m_repeatLabelDelta
Repeat label number increment step.
bool GetPrintSheetReference()
The common library.
void OnPrint(wxCommandEvent &event)
Show the print dialog.
int AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName)
Function AddTemplateFieldName inserts or appends a wanted symbol field name into the fieldnames templ...
void SetSimulatorCommand(const wxString &aCommand)
Schematic editor (Eeschema) main window.
bool TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
void SetPrintSheetReference(bool aShow)
void OnPageSettingsChange() override
Called when modifying the page settings.
void SetPrintMonochrome(bool aMonochrome)
void OnRescueProject(wxCommandEvent &event)
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:258
bool m_autoplaceAlign
align autoplaced fields to the grid
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void EditComponentFieldText(SCH_FIELD *aField)
Display the edit field dialog to edit the parameters of aField.
bool GetAutoplaceFields() const
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
bool EditSheet(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy, bool *aClearAnnotationNewItems)
Edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:49
Implementing DIALOG_SCH_FIND_BASE.
Find a component pin in the schematic.
void SetAutoplaceJustify(bool aEnable)
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_ITEM * FindComponentAndItem(const wxString &aReference, bool aSearchHierarchy, SCH_SEARCH_T aSearchType, const wxString &aSearchText)
Finds a component in the schematic and an item in this component.
Definition: find.cpp:109
void SaveProjectSettings(bool aAskForSave) override
Save changes to the project settings to the project (.pro) file.
void updateFindReplaceView(wxFindDialogEvent &aEvent)
Definition: find.cpp:393
void OnUpdateSave(wxUpdateUIEvent &aEvent)
void OnImportProject(wxCommandEvent &event)
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual wxString GetScreenDesc() const override
virtual const BOX2I GetDocumentExtents() const override
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
double BestZoom() override
Return the zoom level which displays the full page on screen.
void SendMessageToPCBNEW(EDA_ITEM *aObjectToSync, SCH_COMPONENT *aPart)
Send a message to Pcbnew via a socket connection.
void OnFindSchematicItem(wxFindDialogEvent &aEvent)
Find an item in the schematic matching the search criteria in aEvent.
Definition: find.cpp:264
void DeleteAllTemplateFieldNames()
Remove all template field names.
bool m_forceHVLines
force H or V directions for wires, bus, line
void Save_File(wxCommandEvent &event)
void ReCreateHToolbar() override
Class LSET is a set of PCB_LAYER_IDs.
bool m_footprintPreview
whether to show footprint previews
DIALOG_SCH_FIND * m_dlgFindReplace
static PINSHEETLABEL_SHAPE m_lastSheetPinType
Last sheet pin type.
void DeleteAnnotation(bool aCurrentSheetOnly)
Clear the current component annotation.
Definition: annotate.cpp:59
void HardRedraw() override
Rebuild the GAL and redraw the screen.
wxPageSetupDialogData m_pageSetupData
void OnUpdatePaste(wxUpdateUIEvent &event)
bool prepareForNetlist()
Verify that annotation is complete so that a proper netlist is even possible.
bool GetForceHVLines() const
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:76
Annotate by position of component in the schematic sheet object list.
SCH_SHEET_PATH & GetCurrentSheet()
void InstallPreferences(PAGED_DIALOG *aParent) override
Allows Eeschema to install its preferences panels into the preferences dialog.
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, bool aAppend=false, const wxPoint &aTransformPoint=wxPoint(0, 0))
Create a copy of the current schematic item, and put it in the undo list.
void PlotSchematic(wxCommandEvent &event)
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
ERC_SETTINGS m_ercSettings
void SaveCopyForRepeatItem(SCH_ITEM *aItem)
Clone aItem and owns that clone in this container.
bool AppendSchematic()
Import a KiCad schematic into the current page.
SCH_SHEET_PIN * ImportSheetPin(SCH_SHEET *aSheet)
Automatically create a sheet pin from the hierarchical labels in the schematic referenced by aSheet.
Definition: sheet.cpp:372
bool SaveEEFile(SCH_SCREEN *aScreen, bool aSaveUnderNewName=false, bool aCreateBackupFile=CREATE_BACKUP_FILE)
Save aScreen to a schematic file.
bool CreateArchiveLibraryCacheFile(bool aUseCurrentSheetFilename=false)
Create a symbol library file with the name of the root document plus the '-cache' suffix,...
Definition: libarch.cpp:42
const wxSize & GetLastSheetPinTextSize()
Initializing accessor for the pin text size.
Definition: sheet.cpp:316
void OnSaveProject(wxCommandEvent &aEvent)
Command event handler to save the entire project and create a component library archive.
SCH_JUNCTION * AddJunction(const wxPoint &aPos, bool aAppendToUndo=false, bool aFinal=true)
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
void OnUpdateFields(wxCommandEvent &event)
ANNOTATE_OPTION_T
Schematic annotation type options.
SCH_ITEM * m_item_to_repeat
Last item to insert by the repeat command.
void backAnnotateFootprints(const std::string &aChangedSetOfReferences)
Definition: backanno.cpp:51
bool LoadProjectFile()
Loads the KiCad project file (*.pro) settings specific to Eeschema.
wxArrayString m_replaceStringHistoryList
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:56
virtual bool isAutoSaveRequired() const override
Returns true if the schematic has been modified.
void InitSheet(SCH_SHEET *aSheet, const wxString &aFilename)
Definition: sheet.cpp:40
Container for ERC settings.
Definition: erc_settings.h:30
Class SCH_SHEET_PATH.
void DeleteAllTemplateFieldNames()
Function DeleteAllTemplateFieldNames deletes the entire contents.
wxPageSetupDialogData & GetPageSetupData()
bool IsSearchCacheObsolete(const SCH_FIND_REPLACE_DATA &aSearchCriteria)
Definition: find.cpp:246
bool m_printMonochrome
Print monochrome instead of grey scale.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void UpdateErcSettings(const ERC_SETTINGS &aSettings)
void ConvertTextType(SCH_TEXT *aText, KICAD_T aType)
Change a text type to another one.
Definition: edit_label.cpp:105
wxPoint GetLastSheetPinPosition() const
int m_foundItemIndex
An index to the last find item in the found items list m_foundItems.
void OnUpdatePCB(wxCommandEvent &event)
void SaveUndoItemInUndoList(SCH_ITEM *aItem, bool aAppend=false)
Swap the cloned item in member variable m_undoItem with aItem and saves it to the undo list then swap...
void OnLoadCmpToFootprintLinkFile(wxCommandEvent &event)
void OnLaunchBusManager(wxCommandEvent &event)
wxString GetSimulatorCommand() const
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
PARAM_CFG_ARRAY m_configSettings
int GetLabelIncrement() const
void SelectUnit(SCH_COMPONENT *aComponent, int aUnit)
Definition: getpart.cpp:207
bool m_autoplaceFields
automatically place component fields
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
void OnOpenLibraryEditor(wxCommandEvent &event)
void SetShowFootprintPreviews(bool aEnable)
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
Definition: annotate.cpp:245
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:201
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList, bool aRedoCommand)
Restore an undo or redo command to put data pointed by aList in the previous state.
virtual bool doAutoSave() override
Save the schematic files that have been modified and not yet saved.
void OnEditComponentSymbolsId(wxCommandEvent &aEvent)
void RedrawActiveWindow(wxDC *DC, bool EraseBg) override
Annotate by Y position from top to bottom.
bool BreakSegmentsOnJunctions(SCH_SCREEN *aScreen=nullptr)
Tests all junctions and bus entries in the schematic for intersections with wires and buses and break...
void OnAnnotate(wxCommandEvent &event)
bool m_showAllPins
Flag to indicate show hidden pins.
void EditSchematicText(SCH_TEXT *aText)
Launches the "Edit Text/Label" dialog.
bool m_printSheetReference
wxString m_SelectedNetName
Annotate using the first free reference number starting at the sheet number * 100.
void OnRemapSymbols(wxCommandEvent &aEvent)
Find a component field.
const ERC_SETTINGS & GetErcSettings()
This file is part of the common library.
#define CREATE_BACKUP_FILE
void ClearExecFlags(const int aFlags)
Clear (removes) specified flags that not needed for next execution of external generator of the netli...
PINSHEETLABEL_SHAPE
Definition: sch_text.h:47
void SetNetListFormatName(const wxString &aFormat)
SCH_ITEM * GetRepeatItem() const
Return the item which is to be repeated with the insert key.
int ModalAnnotate(const wxString &aMessage)
Run a modal version of the Annotate dialog for a specific purpose.
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
SCH_SEARCH_T
Schematic search type used by the socket link with Pcbnew.
BLOCK_SELECTOR m_blockItems
List of selected items.
void OnExit(wxCommandEvent &event)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
NETLIST_OBJECT_LIST * CreateNetlist(bool aSilent=false, bool aSilentAnnotate=false)
Create a netlist for the current schematic.
SCH_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
bool EditImage(SCH_BITMAP *aItem)
Launches the "Edit Image" dialog to modify an image.
Definition: edit_bitmap.cpp:35
wxString m_plotDirectoryName
The name of the destination directory to use when generating plot files.
SCH_ITEM * m_undoItem
Copy of the current item being edited.
void DeleteJunction(SCH_ITEM *aItem, bool aAppend=false)
Removes a given junction and heals any wire segments under the junction.
void OnErc(wxCommandEvent &event)
bool m_autoplaceJustify
allow autoplace to change justification
void RollbackSchematicFromUndo()
Performs an undo of the last edit WITHOUT logging a corresponding redo.
Class SCH_FIND_REPLACE_DATA adds missing useful comparison and assignment operators to the wxFindRepl...
void SetAutoplaceFields(bool aEnable)
Find an item by it's reference designator.
Annotate by X position from left to right.
Annotate using the first free reference number starting at the sheet number * 1000.
void OnOpenPcbnew(wxCommandEvent &event)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
bool RescueSymbolLibTableProject(bool aRunningOnDemand)
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL) override
Plot or print the current sheet to the clipboard.
virtual void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command send by Pcbnew via a socket, port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4...
wxString GetUniqueFilenameForCurrentSheet()
void OnCreateNetlist(wxCommandEvent &event)
wxString m_simulatorCommand
Command line used to call the circuit simulator (gnucap, spice, ...)
Struct TEMPLATE_FIELDNAME holds a name of a component's field, field value, and default visibility.
wxString GetNetListerCommand() const
wxString m_netListFormat
The name of the format to use when generating a net list.
bool TrimWire(const wxPoint &aStart, const wxPoint &aEnd)
If any single wire passes through both points, remove the portion between the two points,...
bool OnRightClick(const wxPoint &aPosition, wxMenu *PopMenu) override
bool GetAutoplaceAlign() const
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
void OnSimulate(wxCommandEvent &event)
Definition: simulate.cpp:29
bool GetSpiceAjustPassiveValues() const
int m_exec_flags
Flags of the wxExecute() function to call a custom net list generator.
bool RescueLegacyProject(bool aRunningOnDemand)
static wxPoint m_lastSheetPinPosition
Last sheet pin position.
void OnCreateBillOfMaterials(wxCommandEvent &event)
int EditSheetPin(SCH_SHEET_PIN *aSheetPin, bool aRedraw)
Display the dialog for editing the parameters of aSheetPin.
Definition: sheet.cpp:328
bool WriteNetListFile(NETLIST_OBJECT_LIST *aConnectedItemsList, int aFormat, const wxString &aFullFileName, unsigned aNetlistOptions, REPORTER *aReporter=NULL)
Create a netlist file.
bool CreateArchiveLibrary(const wxString &aFileName)
Create a library aFileName that contains all components used in the current schematic.
Definition: libarch.cpp:65
void SetExecFlags(const int aFlags)
Set (adds) specified flags for next execution of external generator of the netlist or bom.
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME,...
void ConvertPart(SCH_COMPONENT *aComponent)
Definition: getpart.cpp:248
void SetSelectedNetName(const wxString &aNetName)
bool m_spiceAjustPassiveValues
Use netcodes (net number) as net names when generating spice net lists.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
Implementation of the label properties dialog.
void SetNetListerCommand(const wxString &aCommand)
void SetSpiceAjustPassiveValues(bool aEnable)
void RecalculateConnections(bool aDoCleanup=true)
Generates the connection data for the entire schematic hierarchy.
bool AddMissingJunctions(SCH_SCREEN *aScreen)
Checks all wires and adds any junctions that are missing (Intended to be called only on file load)
bool GetShowAllPins() const override
Allow some frames to show/hide hidden pins.
void CommonSettingsChanged() override
Called after the preferences dialog is run.
void SyncMenusAndToolbars() override
Update the toolbars and menus (mostly settings/check buttons/checkboxes) with the current controller ...
void NormalizeSchematicOnFirstLoad(bool recalculateConnections)
Perform all cleanup and normalization steps so that the whole schematic is in a good state.
void SetShowAllPins(bool aEnable)
void ReCreateVToolbar() override
void sendNetlistToCvpcb()
Send the kicad netlist over to CVPCB.
void OnFindReplace(wxFindDialogEvent &aEvent)
Perform a search and replace of text in an item in the schematic matching the search and replace crit...
Definition: find.cpp:303
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
Definition: ee_hotkeys.cpp:423
void AddItemToScreenAndUndoList(SCH_ITEM *aItem, bool aUndoAppend=false)
Add an item to the schematic and adds the changes to the undo/redo container.
bool rescueProject(RESCUER &aRescuer, bool aRunningOnDemand)
Perform rescue operations to recover old projects from before certain changes were made.
bool ProcessCmpToFootprintLinkFile(const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
Read the footprint info from each line in the stuff file by reference designator.
Definition: backanno.cpp:132