KiCad PCB EDA Suite
lib_edit_frame.cpp File Reference

LIB_EDIT_FRAME class is the symbol library editor frame. More...

#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <kiway_express.h>
#include <sch_draw_panel.h>
#include <base_screen.h>
#include <confirm.h>
#include <eda_doc.h>
#include <gr_basic.h>
#include <sch_edit_frame.h>
#include <msgpanel.h>
#include <eda_dockart.h>
#include <general.h>
#include <eeschema_id.h>
#include <lib_edit_frame.h>
#include <class_library.h>
#include <lib_polyline.h>
#include <lib_pin.h>
#include <lib_manager.h>
#include <widgets/symbol_tree_pane.h>
#include <widgets/lib_tree.h>
#include <symbol_lib_table.h>
#include <list_operations.h>
#include <kicad_device_context.h>
#include <hotkeys.h>
#include <eeschema_config.h>
#include <dialogs/dialog_lib_edit_text.h>
#include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_lib_edit_pin_table.h>
#include <wildcards_and_files_ext.h>
#include <menus_helpers.h>
#include <wx/progdlg.h>
#include <tool/context_menu.h>
#include <sch_view.h>
#include <sch_painter.h>

Go to the source code of this file.

Functions

 EVT_TOOL_RANGE (ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT, LIB_EDIT_FRAME::OnSelectTool) EVT_MENU_RANGE(ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM
 
LIB_EDIT_FRAME::Process_Special_Functions EVT_MENU_RANGE (ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, LIB_EDIT_FRAME::Process_Special_Functions) EVT_MENU_RANGE(ID_LIBEDIT_MIRROR_X
 
LIB_EDIT_FRAME::Process_Special_Functions LIB_EDIT_FRAME::OnOrient EVT_UPDATE_UI_RANGE (ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT, LIB_EDIT_FRAME::OnUpdateEditingPart) LIB_EDIT_FRAME
 

Variables

 ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT
 
LIB_EDIT_FRAME::Process_Special_Functions ID_LIBEDIT_ORIENT_NORMAL
 

Detailed Description

LIB_EDIT_FRAME class is the symbol library editor frame.

Definition in file lib_edit_frame.cpp.

Function Documentation

Definition at line 189 of file lib_edit_frame.cpp.

References DEFAULT_REPEAT_OFFSET_PIN, g_Libedit_Hokeys_Descr, GetDefaultTextSize(), ID_EDIT_SYM_LIB_TABLE, ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_LEVEL_50, ID_PREFERENCES_CONFIGURE_PATHS, ID_ZOOM_PAGE, KiBitmap(), PCAD2KICAD::Left, SCH_BASE_FRAME::OnConfigurePaths(), LIB_EDIT_FRAME::OnEditSymbolLibTable(), PCAD2KICAD::Right, BOX2< Vec >::SetOrigin(), and BOX2< Vec >::SetSize().

196  :
197  SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
198  wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
199 {
200  m_showAxis = true; // true to draw axis
201  SetShowDeMorgan( false );
202  m_drawSpecificConvert = true;
203  m_drawSpecificUnit = false;
204  m_hotkeysDescrList = g_Libedit_Hokeys_Descr;
205  m_syncPinEdit = false;
206  m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
207  SetShowElectricalType( true );
208  m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
209 
210  m_my_part = NULL;
211  m_tempCopyComponent = NULL;
212  m_treePane = nullptr;
213  m_libMgr = nullptr;
214 
215  // Delayed initialization
216  if( m_textSize == -1 )
217  m_textSize = GetDefaultTextSize();
218 
219  // Initialize grid id to the default value 50 mils:
221 
222  wxIcon icon;
223  icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
224  SetIcon( icon );
225 
226  LoadSettings( config() );
227 
228  m_dummyScreen = new SCH_SCREEN( aKiway );
229  SetScreen( m_dummyScreen );
230  GetScreen()->m_Center = true;
231  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
232 
233  SetCrossHairPosition( wxPoint( 0, 0 ) );
234 
235  SetPresetGrid( m_LastGridSizeId );
236 
237  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
238 
239  if( m_canvas )
240  m_canvas->SetEnableBlockCommands( true );
241 
242  m_libMgr = new LIB_MANAGER( *this );
243  SyncLibraries( true );
244  m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );
245 
246  ReCreateMenuBar();
247  ReCreateHToolbar();
248  ReCreateVToolbar();
249  ReCreateOptToolbar();
250 
251  updateTitle();
252  DisplayCmpDoc();
253  UpdatePartSelectList();
254 
255  m_auimgr.SetManagedWindow( this );
256  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
257 
258 
259  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
260  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
261 
262  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
263  m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1)
264  .Caption( _( "Libraries" ) ).MinSize( 250, -1 ).Resizable() );
265  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
266 
267  m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
268 
269  m_auimgr.Update();
270 
271  Raise();
272  Show( true );
273 
274  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnConfigurePaths, this,
276 
277  Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
279 
280  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
281  wxPostEvent( this, evt );
282 
283  SyncView();
284  GetGalCanvas()->GetViewControls()->SetSnapping( true );
285  GetGalCanvas()->GetView()->UseDrawPriority( true );
286  GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
287  GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
288 
289  // Set the working/draw area size to display a symbol to a reasonable value:
290  // A 600mm x 600mm with a origin at the area center looks like a large working area
291  double max_size_x = Millimeter2iu( 600 );
292  double max_size_y = Millimeter2iu( 600 );
293  BOX2D bbox;
294  bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
295  bbox.SetSize( max_size_x, max_size_y );
296  GetCanvas()->GetView()->SetBoundary( bbox );
297 }
#define LIB_EDIT_FRAME_NAME
Definition: draw_frame.h:49
void OnEditSymbolLibTable(wxCommandEvent &aEvent) override
void OnConfigurePaths(wxCommandEvent &aEvent)
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
void SetSize(const Vec &size)
Definition: box2.h:210
#define DEFAULT_REPEAT_OFFSET_PIN
the default value (overwritten by the eeschema config)
Definition: general.h:50
Library Editor pane with component tree and symbol library table selector.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Specialization of the wxAuiPaneInfo class for KiCad panels.
Class to handle modifications to the symbol libraries.
Definition: lib_manager.h:49
void SetOrigin(const Vec &pos)
Definition: box2.h:208
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.
int GetDefaultTextSize()
Default size for text in general.

Variable Documentation

Definition at line 169 of file lib_edit_frame.cpp.

ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT

Definition at line 163 of file lib_edit_frame.cpp.

Referenced by LIB_EDIT_FRAME::Process_Special_Functions().