KiCad PCB EDA Suite
pcbnew_scripting_helpers.h File Reference
#include <wxPcbStruct.h>
#include <io_mgr.h>

Go to the source code of this file.

Functions

void ScriptingSetPcbEditFrame (PCB_EDIT_FRAME *aPCBEdaFrame)
 
BOARDGetBoard ()
 
BOARDLoadBoard (wxString &aFileName, IO_MGR::PCB_FILE_T aFormat)
 
BOARDLoadBoard (wxString &aFileName)
 
bool SaveBoard (wxString &aFileName, BOARD *aBoard)
 
void Refresh ()
 
void WindowZoom (int xl, int yl, int width, int height)
 

Function Documentation

BOARD* LoadBoard ( wxString &  aFileName,
IO_MGR::PCB_FILE_T  aFormat 
)

Definition at line 73 of file pcbnew_scripting_helpers.cpp.

References BOARD::BuildConnectivity(), and IO_MGR::Load().

74 {
75  BOARD* brd = IO_MGR::Load( aFormat, aFileName );
76 
77  if( brd )
78  brd->BuildConnectivity();
79 
80  return brd;
81 }
static BOARD * Load(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aAppendToMe=NULL, const PROPERTIES *aProperties=NULL)
Function Load finds the requested PLUGIN and if found, calls the PLUGIN->Load(..) funtion on it using...
Definition: io_mgr.cpp:229
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
BOARD* LoadBoard ( wxString &  aFileName)

Definition at line 60 of file pcbnew_scripting_helpers.cpp.

References IO_MGR::KICAD, IO_MGR::LEGACY, and LoadBoard().

Referenced by LoadBoard().

61 {
62  if( aFileName.EndsWith( wxT( ".kicad_pcb" ) ) )
63  return LoadBoard( aFileName, IO_MGR::KICAD );
64 
65  else if( aFileName.EndsWith( wxT( ".brd" ) ) )
66  return LoadBoard( aFileName, IO_MGR::LEGACY );
67 
68  // as fall back for any other kind use the legacy format
69  return LoadBoard( aFileName, IO_MGR::LEGACY );
70 }
BOARD * LoadBoard(wxString &aFileName)
S-expression Pcbnew file format.
Definition: io_mgr.h:54
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:53
void Refresh ( )

Definition at line 102 of file pcbnew_scripting_helpers.cpp.

References EDA_DRAW_FRAME::GetCanvas(), and EDA_DRAW_PANEL::Refresh().

Referenced by EDA_MSG_PANEL::AppendMessage(), C3D_MODEL_VIEWER::Clear3DModel(), DRCLISTBOX::DeleteAllItems(), DRCLISTBOX::DeleteItem(), EDA_MSG_PANEL::EraseMsgBox(), PCB_EDIT_FRAME::ImportSpecctraSession(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), PCB_EDIT_FRAME::OnFlipPcbView(), C3D_MODEL_VIEWER::OnMouseMove(), C3D_MODEL_VIEWER::OnMouseWheel(), FOOTPRINT_PREVIEW_WIDGET::OnStatusChange(), DIALOG_FP_LIB_TABLE::optionsEditor(), EDA_DRAW_PANEL::Refresh(), TEMPLATE_WIDGET::Select(), C3D_MODEL_VIEWER::Set3DModel(), WIDGET_EESCHEMA_COLOR_CONFIG::SetColor(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::SetGroupingColumn(), DRCLISTBOX::SetList(), EDA_MSG_PANEL::SetMessage(), FOOTPRINTS_LISTBOX::SetSelection(), LIBRARY_LISTBOX::SetSelection(), EDA_3D_VIEWER::takeScreenshot(), TEMPLATE_WIDGET::Unselect(), mpWindow::UpdateAll(), KIGFX::OPENGL_GAL::updatedGalDisplayOptions(), KIGFX::CAIRO_GAL::updatedGalDisplayOptions(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), and PCB_EDIT_FRAME::UseGalCanvas().

103 {
104  // first argument is erase background, second is a wxRect
105  PcbEditFrame->GetCanvas()->Refresh( true, NULL );
106 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
static PCB_EDIT_FRAME * PcbEditFrame
bool SaveBoard ( wxString &  aFileName,
BOARD aBoard 
)

Definition at line 96 of file pcbnew_scripting_helpers.cpp.

References IO_MGR::KICAD, and SaveBoard().

97 {
98  return SaveBoard( aFileName, aBoard, IO_MGR::KICAD );
99 }
S-expression Pcbnew file format.
Definition: io_mgr.h:54
bool SaveBoard(wxString &aFileName, BOARD *aBoard, IO_MGR::PCB_FILE_T aFormat)
void ScriptingSetPcbEditFrame ( PCB_EDIT_FRAME aPCBEdaFrame)

Definition at line 54 of file pcbnew_scripting_helpers.cpp.

Referenced by PCB::IFACE::CreateWindow().

55 {
56  PcbEditFrame = aPCBEdaFrame;
57 }
static PCB_EDIT_FRAME * PcbEditFrame
void WindowZoom ( int  xl,
int  yl,
int  width,
int  height 
)

Definition at line 109 of file pcbnew_scripting_helpers.cpp.

References EDA_DRAW_FRAME::Window_Zoom().

110 {
111  EDA_RECT Rect( wxPoint( xl, yl ), wxSize( width, height )) ;
112  PcbEditFrame->Window_Zoom( Rect );
113 }
static PCB_EDIT_FRAME * PcbEditFrame
Class EDA_RECT handles the component boundary box.
void Window_Zoom(EDA_RECT &Rect)
Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window scree...
Definition: zoom.cpp:103