KiCad PCB EDA Suite
viewlib_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <eeschema_id.h>
#include <class_drawpanel.h>
#include <schframe.h>
#include <msgpanel.h>
#include <bitmaps.h>
#include <general.h>
#include <viewlib_frame.h>
#include <class_library.h>
#include <hotkeys.h>
#include <dialog_helpers.h>

Go to the source code of this file.

Macros

#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT
 
#define LIB_VIEW_FRAME_NAME   "ViewlibFrame"
 
#define LIB_VIEW_FRAME_NAME_MODAL   "ViewlibFrameModal"
 
#define LIBLIST_WIDTH_KEY   "ViewLiblistWidth"
 
#define CMPLIST_WIDTH_KEY   "ViewCmplistWidth"
 
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY   "ViewCmpShowPinElectricalType"
 
#define LIBVIEW_BGCOLOR   "LibviewBgColor"
 

Functions

 EVT_TOOL_RANGE (ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onSelectSymbolBodyStyle) LIB_VIEW_FRAME
 

Macro Definition Documentation

#define CMPLIST_WIDTH_KEY   "ViewCmplistWidth"
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY   "ViewCmpShowPinElectricalType"
#define LIB_VIEW_FRAME_NAME   "ViewlibFrame"

Referenced by EVT_TOOL_RANGE().

#define LIB_VIEW_FRAME_NAME_MODAL   "ViewlibFrameModal"
#define LIBLIST_WIDTH_KEY   "ViewLiblistWidth"
#define LIBVIEW_BGCOLOR   "LibviewBgColor"

Definition at line 625 of file viewlib_frame.cpp.

#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT

Function Documentation

Definition at line 65 of file viewlib_frame.cpp.

References FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, g_Viewlib_Hokeys_Descr, PART_LIB::GetName(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_50, EDA_PANEINFO::InfoToolbarPane(), KiBitmap(), PCAD2KICAD::Left, LIB_VIEW_FRAME_NAME, EDA_PANEINFO::MessageToolbarPane(), and EDA_PANEINFO::VerticalToolbarPane().

112  :
113  SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ),
114  wxDefaultPosition, wxDefaultSize,
115  aFrameType == FRAME_SCH_VIEWER_MODAL ?
117  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
119  aFrameType == FRAME_SCH_VIEWER_MODAL ?
121 {
122  wxASSERT( aFrameType == FRAME_SCH_VIEWER ||
123  aFrameType == FRAME_SCH_VIEWER_MODAL );
124 
125  if( aFrameType == FRAME_SCH_VIEWER_MODAL )
126  SetModal( true );
127 
128  // Force the frame name used in config. the lib viewer frame has a name
129  // depending on aFrameType (needed to identify the frame by wxWidgets),
130  // but only one configuration is preferable.
131  m_configFrameName = LIB_VIEW_FRAME_NAME;
132 
133  // Give an icon
134  wxIcon icon;
135  icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
136  SetIcon( icon );
137 
138  m_hotkeysDescrList = g_Viewlib_Hokeys_Descr;
139  m_cmpList = NULL;
140  m_libList = NULL;
141  m_listPowerCmpOnly = false;
142  SetShowElectricalType( true );
143 
144  SetScreen( new SCH_SCREEN( aKiway ) );
145  GetScreen()->m_Center = true; // Axis origin centered on screen.
146  LoadSettings( config() );
147 
148  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
149 
150  // Initialize grid id to the default value (50 mils):
152  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
153 
154  // Menu bar is not mandatory: uncomment/comment the next line
155  // to add/remove the menubar
156  ReCreateMenuBar();
157  ReCreateHToolbar();
158  ReCreateVToolbar();
159 
160  if( !aLibrary )
161  {
162  // Creates the libraries window display
163  m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
164  wxPoint( 0, 0 ), wxSize( m_libListWidth, -1 ),
165  0, NULL, wxLB_HSCROLL );
166  }
167  else
168  {
169  m_libraryName = aLibrary->GetName();
170  m_entryName.Clear();
171  m_unit = 1;
172  m_convert = 1;
173  m_libListWidth = 0;
174  }
175 
176  // Creates the component window display
177  m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ),
178  wxSize( m_cmpListWidth, -1 ), 0, NULL, wxLB_HSCROLL );
179 
180  if( m_libList )
181  ReCreateListLib();
182 
183  DisplayLibInfos();
184 
185  m_auimgr.SetManagedWindow( this );
186 
187  EDA_PANEINFO horiz;
188  horiz.HorizontalToolbarPane();
189 
190  EDA_PANEINFO vert;
191  vert.VerticalToolbarPane();
192 
193  EDA_PANEINFO info;
194  info.InfoToolbarPane();
195 
196  EDA_PANEINFO mesg;
197  mesg.MessageToolbarPane();
198 
199 
200  // Manage main toolbal
201  m_auimgr.AddPane( m_mainToolBar,
202  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top().Row( 0 ) );
203 
204  // Manage the left window (list of libraries)
205  if( m_libList )
206  m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( "m_libList" ).Left().Row( 0 ) );
207 
208  // Manage the list of components)
209  m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( "m_cmpList" ).Left().Row( 1 ) );
210 
211  // Manage the draw panel
212  m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
213 
214  // Manage the message panel
215  m_auimgr.AddPane( m_messagePanel,
216  wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
217 
218  /* Now the minimum windows are fixed, set library list
219  * and component list of the previous values from last viewlib use
220  */
221  if( m_libList )
222  {
223  m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1 ) );
224  m_auimgr.GetPane( m_libList ).BestSize( wxSize( m_libListWidth, -1 ) );
225  }
226 
227  m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
228  m_auimgr.GetPane( m_cmpList ).BestSize( wxSize( m_cmpListWidth, -1 ) );
229 
230  m_auimgr.Update();
231 
232  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
233 #ifdef USE_WX_GRAPHICS_CONTEXT
234  GetScreen()->SetZoom( BestZoom() );
235 #else
236  Zoom_Automatique( false );
237 #endif
238 
239  if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
240  {
241  Raise();
242  Show( true );
243  }
244 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:475
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
#define LIB_VIEW_FRAME_NAME
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:466
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:493
int Row
Definition: queue.cpp:46
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
Definition: wxstruct.h:540
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:512
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
#define MODAL_MODE_EXTRASTYLE
#define LIB_VIEW_FRAME_NAME_MODAL
Class SCH_BASE_FRAME is a shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRA...