Minor Pcbnew Python scripting improvements.
Add typedef for wxCoord to wx.i to enable usage of methods like EDA_RECT.Inflate. Added id.h to pcbnew.i to expose window toolbar identifier names. Added Refresh() and WindowZoom() to pcbnew_scripting_helper.
This commit is contained in:
parent
9ddb4fe67e
commit
db174862c8
|
@ -39,6 +39,10 @@
|
|||
void wxSetDefaultPyEncoding(const char* encoding);
|
||||
const char* wxGetDefaultPyEncoding();
|
||||
|
||||
// wxCoord /////////////////////////////////////////////////////////
|
||||
// need to let swig know that wxCoord is an int. Ref: wx/defs.h
|
||||
typedef int wxCoord;
|
||||
|
||||
|
||||
// wxRect class wrapper ///////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete)
|
|||
%include <plot_common.h>
|
||||
%include <exporters/gendrill_Excellon_writer.h>
|
||||
%include <gal/color4d.h>
|
||||
%include <id.h>
|
||||
|
||||
%include <pcbnew_scripting_helpers.h>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include <pcbnew_id.h>
|
||||
#include <build_version.h>
|
||||
#include <class_board.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <kicad_string.h>
|
||||
#include <io_mgr.h>
|
||||
#include <macros.h>
|
||||
|
@ -92,7 +93,7 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard,
|
|||
wxString header;
|
||||
PROPERTIES props;
|
||||
|
||||
if( aFormat==IO_MGR::LEGACY )
|
||||
if( aFormat == IO_MGR::LEGACY )
|
||||
{
|
||||
header = wxString::Format(
|
||||
wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s scripting\n\n" ),
|
||||
|
@ -107,3 +108,17 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard,
|
|||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
// first argument is erase background, second is a wxRect
|
||||
PcbEditFrame->GetCanvas()->Refresh( true, NULL );
|
||||
}
|
||||
|
||||
|
||||
void WindowZoom( int xl, int yl, int width, int height )
|
||||
{
|
||||
EDA_RECT Rect( wxPoint( xl, yl ), wxSize( width, height )) ;
|
||||
PcbEditFrame->Window_Zoom( Rect );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
|
||||
* Copyright (C) 2013 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2013-2017 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -43,5 +43,7 @@ BOARD* LoadBoard( wxString& aFileName );
|
|||
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat );
|
||||
bool SaveBoard( wxString& aFileName, BOARD* aBoard );
|
||||
|
||||
void Refresh();
|
||||
void WindowZoom( int xl, int yl, int width, int height );
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue