KiCad PCB EDA Suite
sch_base_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 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef SCH_BASE_FRAME_H_
26 #define SCH_BASE_FRAME_H_
27 
28 #include <lib_id.h>
29 #include <draw_frame.h>
30 
31 #include <sch_screen.h>
32 
33 class PAGE_INFO;
34 class TITLE_BLOCK;
35 class LIB_VIEW_FRAME;
36 class LIB_EDIT_FRAME;
37 class LIB_ALIAS;
38 class LIB_PART;
39 class PART_LIB;
40 class SCHLIB_FILTER;
41 class LIB_ID;
42 class SYMBOL_LIB_TABLE;
43 
44 
59 LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
60  PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
61  bool aShowErrorMsg = false );
62 
63 LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
64  PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
65  bool aShowErrorMsg = false );
66 
67 
78 {
79 protected:
81  int m_repeatDeltaLabel;
83 
85 
86 public:
87  SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
88  FRAME_T aWindowType,
89  const wxString& aTitle,
90  const wxPoint& aPosition, const wxSize& aSize,
91  long aStyle, const wxString & aFrameName );
92 
93  virtual ~SCH_BASE_FRAME();
94 
95  SCH_SCREEN* GetScreen() const override;
96 
101  const wxPoint GetRepeatStep() const { return m_repeatStep; }
102 
108  void SetRepeatStep( const wxPoint& aStep) { m_repeatStep = aStep; }
109 
114  int GetRepeatDeltaLabel() const { return m_repeatDeltaLabel; }
115 
121  void SetRepeatDeltaLabel( int aDelta ) { m_repeatDeltaLabel = aDelta; }
122 
123 
130  const wxString GetZoomLevelIndicator() const override;
131 
132  void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
133  const PAGE_INFO& GetPageSettings () const override;
134  const wxSize GetPageSizeIU() const override;
135 
136  const wxPoint& GetAuxOrigin() const override;
137  void SetAuxOrigin( const wxPoint& aPosition ) override;
138 
139  const wxPoint& GetGridOrigin() const override
140  {
141  static wxPoint zero;
142  return zero;
143  }
144  void SetGridOrigin( const wxPoint& aPoint ) override {}
145 
146  // Virtual from EDA_DRAW_FRAME
147  // the background color of the draw canvas:
148  COLOR4D GetDrawBgColor() const override;
149  void SetDrawBgColor( COLOR4D aColor) override;
150 
151  const TITLE_BLOCK& GetTitleBlock() const override;
152  void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
153 
154  void UpdateStatusBar() override;
155 
156 
158  {
160  int Unit;
161  int Convert;
162 
163  std::vector<std::pair<int, wxString>> Fields;
164 
166  Unit( 1 ),
167  Convert( 1 )
168  {}
169  };
170 
171  typedef std::vector<COMPONENT_SELECTION> HISTORY_LIST;
172 
198  const SCHLIB_FILTER* aFilter,
199  std::vector<COMPONENT_SELECTION>& aHistoryList,
200  bool aUseLibBrowser,
201  int aUnit,
202  int aConvert,
203  bool aShowFootprints,
204  const LIB_ID* aHighlight = nullptr,
205  bool aAllowFields = true );
206 
207  void OnConfigurePaths( wxCommandEvent& aEvent );
208 
209  virtual void OnEditSymbolLibTable( wxCommandEvent& aEvent );
210 
220  LIB_ALIAS* GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib = false,
221  bool aShowErrorMsg = false );
222 
223  LIB_PART* GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib = false,
224  bool aShowErrorMsg = false );
225 
240  wxTopLevelWindow* aParent,
241  const SCHLIB_FILTER* aFilter,
242  const LIB_ID& aPreselectedLibid,
243  int aUnit, int aConvert );
244 
245 protected:
246 
252  void OnOpenLibraryViewer( wxCommandEvent& event );
253 
266  bool DisplayListComponentsInLib( wxString& aLibrary, wxString& aBuffer,
267  wxString& aPreviousChoice );
268 
277  wxString SelectLibraryFromList();
278 
290  bool SelectPartNameToLoad( wxString& aLibrary, wxString& aBufName );
291 
299  bool saveSymbolLibTables( bool aGlobal, bool aProject );
300 };
301 
302 #endif // SCH_BASE_FRAME_H_
int m_repeatDeltaLabel
the increment value of labels like bus members when they are repeated
Part library alias object definition.
SCH_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aWindowType, const wxString &aTitle, const wxPoint &aPosition, const wxSize &aSize, long aStyle, const wxString &aFrameName)
LIB_PART * SchGetLibPart(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib=NULL, wxWindow *aParent=NULL, bool aShowErrorMsg=false)
virtual void OnEditSymbolLibTable(wxCommandEvent &aEvent)
void OnOpenLibraryViewer(wxCommandEvent &event)
Open the library viewer only to browse library contents.
wxString SelectLibraryFromList()
Dispaly a list of loaded libraries in the symbol library and allows the user to select a library...
Definition: selpart.cpp:76
COMPONENT_SELECTION SelectComponentFromLibBrowser(wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibid, int aUnit, int aConvert)
Function SelectComponentFromLibBrowser Calls the library viewer to select component to import into sc...
Definition: getpart.cpp:54
void SetRepeatDeltaLabel(int aDelta)
Sets the repeat delta label value for repeat command.
void OnConfigurePaths(wxCommandEvent &aEvent)
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
const wxPoint GetRepeatStep() const
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxPoint m_repeatStep
the increment value of the position of an item when it is repeated
const wxPoint & GetGridOrigin() const override
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
std::vector< COMPONENT_SELECTION > HISTORY_LIST
const wxPoint & GetAuxOrigin() const override
Function GetAuxOrigin returns the origin of the axis used for plotting and various exports...
bool DisplayListComponentsInLib(wxString &aLibrary, wxString &aBuffer, wxString &aPreviousChoice)
Select a component from the list of components in a library.
Definition: selpart.cpp:125
LIB_ALIAS * SchGetLibAlias(const LIB_ID &aLibId, SYMBOL_LIB_TABLE *aLibTable, PART_LIB *aCacheLib=NULL, wxWindow *aParent=NULL, bool aShowErrorMsg=false)
Load symbol from symbol library table.
LIB_PART * GetLibPart(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
int GetRepeatDeltaLabel() const
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:63
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:39
const wxString GetZoomLevelIndicator() const override
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Symbol library viewer main window.
Definition: viewlib_frame.h:49
const wxSize GetPageSizeIU() const override
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
void SetAuxOrigin(const wxPoint &aPosition) override
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:49
Define a library symbol object.
virtual ~SCH_BASE_FRAME()
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
bool saveSymbolLibTables(bool aGlobal, bool aProject)
Saves Symbol Library Tables to disk.
bool SelectPartNameToLoad(wxString &aLibrary, wxString &aBufName)
Function SelectPartNameToLoad Select a part name from the list of components (parts) found in a libra...
Definition: selpart.cpp:177
COLOR4D GetDrawBgColor() const override
void SetPageSettings(const PAGE_INFO &aPageSettings) override
std::vector< std::pair< int, wxString > > Fields
const PAGE_INFO & GetPageSettings() const override
void SetGridOrigin(const wxPoint &aPoint) override
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
Definitions for the Eeschema program SCH_SCREEN class.
The symbol library editor main window.
const TITLE_BLOCK & GetTitleBlock() const override
COMPONENT_SELECTION SelectComponentFromLibrary(const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Function SelectComponentFromLib Calls the library viewer to select component to import into schematic...
Definition: getpart.cpp:101
void SetDrawBgColor(COLOR4D aColor) override
void SetRepeatStep(const wxPoint &aStep)
Sets the repeat step value for repeat command.
LIB_ALIAS * GetLibAlias(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
A shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a common way of handling the provided virtual functions for the derived classes.
Object used to load, save, search, and otherwise manipulate symbol library files. ...
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39