KiCad PCB EDA Suite
sch_base_frame.h
Go to the documentation of this file.
1 #ifndef SCH_BASE_FRAME_H_
2 #define SCH_BASE_FRAME_H_
3 /*
4  * This program source code file is part of KiCad, a free EDA CAD application.
5  *
6  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
7  * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include <lib_id.h>
28 #include <draw_frame.h>
29 
30 #include <class_sch_screen.h>
31 
32 class PAGE_INFO;
33 class TITLE_BLOCK;
34 class LIB_VIEW_FRAME;
35 class LIB_EDIT_FRAME;
36 class LIB_ALIAS;
37 class LIB_PART;
38 class PART_LIB;
39 class SCHLIB_FILTER;
40 class LIB_ID;
41 class SYMBOL_LIB_TABLE;
42 
43 
58 LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
59  PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
60  bool aShowErrorMsg = false );
61 
62 LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
63  PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
64  bool aShowErrorMsg = false );
65 
66 
77 {
78 protected:
80  int m_repeatDeltaLabel;
82 
84 
85 public:
86  SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
87  FRAME_T aWindowType,
88  const wxString& aTitle,
89  const wxPoint& aPosition, const wxSize& aSize,
90  long aStyle, const wxString & aFrameName );
91 
92  virtual ~SCH_BASE_FRAME();
93 
94  SCH_SCREEN* GetScreen() const override;
95 
100  const wxPoint GetRepeatStep() const { return m_repeatStep; }
101 
107  void SetRepeatStep( const wxPoint& aStep) { m_repeatStep = aStep; }
108 
113  int GetRepeatDeltaLabel() const { return m_repeatDeltaLabel; }
114 
120  void SetRepeatDeltaLabel( int aDelta ) { m_repeatDeltaLabel = aDelta; }
121 
122 
129  const wxString GetZoomLevelIndicator() const override;
130 
131  void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
132  const PAGE_INFO& GetPageSettings () const override;
133  const wxSize GetPageSizeIU() const override;
134 
135  const wxPoint& GetAuxOrigin() const override;
136  void SetAuxOrigin( const wxPoint& aPosition ) override;
137 
138  const wxPoint& GetGridOrigin() const override
139  {
140  static wxPoint zero;
141  return zero;
142  }
143  void SetGridOrigin( const wxPoint& aPoint ) override {}
144 
145  // Virtual from EDA_DRAW_FRAME
146  // the background color of the draw canvas:
147  COLOR4D GetDrawBgColor() const override;
148  void SetDrawBgColor( COLOR4D aColor) override;
149 
150  const TITLE_BLOCK& GetTitleBlock() const override;
151  void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
152 
153  void UpdateStatusBar() override;
154 
155 
157  {
159  int Unit;
160  int Convert;
161 
162  std::vector<std::pair<int, wxString>> Fields;
163 
165  Unit( 1 ),
166  Convert( 1 )
167  {}
168  };
169 
170  typedef std::vector<COMPONENT_SELECTION> HISTORY_LIST;
171 
196  const SCHLIB_FILTER* aFilter,
197  std::vector<COMPONENT_SELECTION>& aHistoryList,
198  bool aUseLibBrowser,
199  int aUnit,
200  int aConvert,
201  const LIB_ID* aHighlight = nullptr,
202  bool aAllowFields = true );
203 
204  virtual void OnEditSymbolLibTable( wxCommandEvent& aEvent );
205 
215  LIB_ALIAS* GetLibAlias( const LIB_ID& aLibId, bool aUseCacheLib = false,
216  bool aShowErrorMsg = false );
217 
218  LIB_PART* GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib = false,
219  bool aShowErrorMsg = false );
220 
234  const SCHLIB_FILTER* aFilter,
235  const LIB_ID& aPreselectedLibid,
236  int aUnit, int aConvert );
237 
238 protected:
239 
245  void OnOpenLibraryViewer( wxCommandEvent& event );
246 
259  bool DisplayListComponentsInLib( wxString& aLibrary, wxString& aBuffer,
260  wxString& aPreviousChoice );
261 
270  wxString SelectLibraryFromList();
271 
283  bool SelectPartNameToLoad( wxString& aLibrary, wxString& aBufName );
284 
292  bool saveSymbolLibTables( bool aGlobal, bool aProject );
293 };
294 
295 #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
void SetRepeatDeltaLabel(int aDelta)
Sets the repeat delta label value for repeat command.
COMPONENT_SELECTION SelectComponentFromLibBrowser(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:55
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:54
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.
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
Definitions for the Eeschema program SCH_SCREEN class.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
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:257
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.
The symbol library editor main window.
Definition: libeditframe.h:58
const TITLE_BLOCK & GetTitleBlock() const override
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. ...
COMPONENT_SELECTION SelectComponentFromLibrary(const SCHLIB_FILTER *aFilter, std::vector< COMPONENT_SELECTION > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Function SelectComponentFromLib Calls the library viewer to select component to import into schematic...
Definition: getpart.cpp:102
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39