Commit 2d49ced7 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix compil warning and a minor bug in plot negative (frame fer...

Pcbnew: fix  compil warning and a minor bug in plot negative (frame fer plotted in white therefore not visible).
minor code cleaning
parent c646c2f8
...@@ -189,7 +189,8 @@ set(PCBNEW_CLASS_SRCS ...@@ -189,7 +189,8 @@ set(PCBNEW_CLASS_SRCS
pcbnew.cpp pcbnew.cpp
pcbnew_config.cpp pcbnew_config.cpp
pcbplot.cpp pcbplot.cpp
plot_rtn.cpp plot_board_layers.cpp
plot_brditems_plotter.cpp
print_board_functions.cpp print_board_functions.cpp
printout_controler.cpp printout_controler.cpp
ratsnest.cpp ratsnest.cpp
......
...@@ -145,6 +145,10 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, ...@@ -145,6 +145,10 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
m_useAuxOrigin ? trueStr : falseStr ); m_useAuxOrigin ? trueStr : falseStr );
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ), aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ),
m_HPGLPenNum ); m_HPGLPenNum );
// Obsolete parameter, pen speed is no more managed, because hpgl format
// is now an export format, and for this, pen speed has no meaning
// aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
// m_HPGLPenSpeed );
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ), aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
m_HPGLPenSpeed ); m_HPGLPenSpeed );
aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpendiameter ), aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpendiameter ),
......
...@@ -41,11 +41,13 @@ class BOARD; ...@@ -41,11 +41,13 @@ class BOARD;
// Convert pcb dimension of 0.1 mil to PS units of inches. // Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001 #define SCALE_PS .0001
// Convert dimension 0.1 mil -> HPGL units: // Convert dimension 0.1 mil -> HPGL units (1 HPGL unit = 25 micrometers):
#define SCALE_HPGL 0.102041 #define SCALE_HPGL 0.102041
// Small drill marks diameter value (in 1/10000 inch) // Small drill marks (small pad holes) diameter value
#define SMALL_DRILL 150 #define SMALL_DRILL (int)( 0.35 * IU_PER_MM )
// A helper class to plot board items // A helper class to plot board items
class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS
{ {
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
PYTHON_FOOTPRINT_WIZARD::PYTHON_FOOTPRINT_WIZARD(PyObject *aWizard) PYTHON_FOOTPRINT_WIZARD::PYTHON_FOOTPRINT_WIZARD(PyObject *aWizard)
{ {
this->m_PyWizard= aWizard; this->m_PyWizard= aWizard;
Py_XINCREF( aWizard ); Py_XINCREF( aWizard );
} }
PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD() PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD()
...@@ -22,18 +22,18 @@ PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD() ...@@ -22,18 +22,18 @@ PYTHON_FOOTPRINT_WIZARD::~PYTHON_FOOTPRINT_WIZARD()
PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aArglist) PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aArglist)
{ {
PyObject *pFunc; PyObject *pFunc;
/* pFunc is a new reference to the desired method */ /* pFunc is a new reference to the desired method */
pFunc = PyObject_GetAttrString( this->m_PyWizard, aMethod ); pFunc = PyObject_GetAttrString( this->m_PyWizard, aMethod );
if ( pFunc && PyCallable_Check( pFunc ) ) if ( pFunc && PyCallable_Check( pFunc ) )
{ {
PyObject *result; PyObject *result;
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
result = PyObject_CallObject( pFunc, aArglist ); result = PyObject_CallObject( pFunc, aArglist );
if ( PyErr_Occurred() ) if ( PyErr_Occurred() )
{ {
PyObject *t, *v, *b; PyObject *t, *v, *b;
...@@ -44,29 +44,29 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aAr ...@@ -44,29 +44,29 @@ PyObject* PYTHON_FOOTPRINT_WIZARD::CallMethod(const char* aMethod, PyObject *aAr
} }
PY_UNBLOCK_THREADS( blocked ); PY_UNBLOCK_THREADS( blocked );
if ( result ) if ( result )
{ {
Py_XDECREF( pFunc ); Py_XDECREF( pFunc );
return result; return result;
} }
} }
else else
{ {
printf( "method not found, or not callable: %s\n", aMethod ); printf( "method not found, or not callable: %s\n", aMethod );
} }
if ( pFunc ) if ( pFunc )
Py_XDECREF( pFunc ); Py_XDECREF( pFunc );
return NULL; return NULL;
} }
wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObject *aArglist ) wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObject *aArglist )
{ {
wxString ret; wxString ret;
ret.Clear(); ret.Clear();
PyObject *result = CallMethod( aMethod, aArglist ); PyObject *result = CallMethod( aMethod, aArglist );
if ( result ) if ( result )
...@@ -74,7 +74,7 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec ...@@ -74,7 +74,7 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
const char *str_res = PyString_AsString( result ); const char *str_res = PyString_AsString( result );
ret = wxString::FromUTF8( str_res ); ret = wxString::FromUTF8( str_res );
Py_DECREF( result ); Py_DECREF( result );
PY_UNBLOCK_THREADS( blocked ); PY_UNBLOCK_THREADS( blocked );
} }
...@@ -87,9 +87,9 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod ...@@ -87,9 +87,9 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
PyObject *result, *element; PyObject *result, *element;
wxArrayString ret; wxArrayString ret;
wxString str_item; wxString str_item;
result = CallMethod( aMethod, aArglist ); result = CallMethod( aMethod, aArglist );
if ( result ) if ( result )
{ {
if ( !PyList_Check(result) ) if ( !PyList_Check(result) )
...@@ -101,9 +101,9 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod ...@@ -101,9 +101,9 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
} }
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
int list_size = PyList_Size( result ); int list_size = PyList_Size( result );
for ( int n=0; n<list_size; n++ ) for ( int n=0; n<list_size; n++ )
{ {
element = PyList_GetItem( result, n ); element = PyList_GetItem( result, n );
...@@ -112,16 +112,16 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod ...@@ -112,16 +112,16 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::CallRetArrayStrMethod
str_item = wxString::FromUTF8( str_res ); str_item = wxString::FromUTF8( str_res );
ret.Add( str_item, 1 ); ret.Add( str_item, 1 );
} }
Py_DECREF( result ); Py_DECREF( result );
PY_UNBLOCK_THREADS( blocked ); PY_UNBLOCK_THREADS( blocked );
} }
return ret; return ret;
} }
wxString PYTHON_FOOTPRINT_WIZARD::GetName() wxString PYTHON_FOOTPRINT_WIZARD::GetName()
...@@ -141,21 +141,21 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetDescription() ...@@ -141,21 +141,21 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetDescription()
int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages() int PYTHON_FOOTPRINT_WIZARD::GetNumParameterPages()
{ {
int ret; int ret = 0;
PyObject *result; PyObject *result;
/* Time to call the callback */ /* Time to call the callback */
result = CallMethod( "GetNumParameterPages" , NULL ); result = CallMethod( "GetNumParameterPages" , NULL );
if (result) if (result)
{ {
if ( !PyInt_Check( result ) ) if ( !PyInt_Check( result ) )
return -1; return -1;
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
ret = PyInt_AsLong( result ); ret = PyInt_AsLong( result );
Py_DECREF( result ); Py_DECREF( result );
PY_UNBLOCK_THREADS( blocked ); PY_UNBLOCK_THREADS( blocked );
} }
...@@ -167,19 +167,19 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage ) ...@@ -167,19 +167,19 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
wxString ret; wxString ret;
PyObject *arglist; PyObject *arglist;
PyObject *result; PyObject *result;
/* Time to call the callback */ /* Time to call the callback */
arglist = Py_BuildValue( "(i)", aPage ); arglist = Py_BuildValue( "(i)", aPage );
result = CallMethod( "GetParameterPageName", arglist ); result = CallMethod( "GetParameterPageName", arglist );
Py_DECREF( arglist ); Py_DECREF( arglist );
if ( result ) if ( result )
{ {
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
const char *str_res = PyString_AsString( result ); const char *str_res = PyString_AsString( result );
ret = wxString::FromUTF8( str_res ); ret = wxString::FromUTF8( str_res );
Py_DECREF( result ); Py_DECREF( result );
PY_UNBLOCK_THREADS( blocked ); PY_UNBLOCK_THREADS( blocked );
} }
...@@ -188,16 +188,16 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage ) ...@@ -188,16 +188,16 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage ) wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage )
{ {
PyObject *arglist; PyObject *arglist;
wxArrayString ret; wxArrayString ret;
arglist = Py_BuildValue( "(i)", aPage ); arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterNames", arglist ); ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
Py_DECREF( arglist ); Py_DECREF( arglist );
for ( unsigned i=0; i<ret.GetCount(); i++ ) for ( unsigned i=0; i<ret.GetCount(); i++ )
{ {
wxString rest; wxString rest;
wxString item = ret[i]; wxString item = ret[i];
if ( item.StartsWith( wxT("*"), &rest ) ) if ( item.StartsWith( wxT("*"), &rest ) )
...@@ -206,22 +206,22 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage ) ...@@ -206,22 +206,22 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterNames( int aPage )
} }
} }
return ret; return ret;
} }
wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage ) wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage )
{ {
PyObject *arglist; PyObject *arglist;
wxArrayString ret; wxArrayString ret;
arglist = Py_BuildValue( "(i)", aPage ); arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterNames", arglist ); ret = CallRetArrayStrMethod( "GetParameterNames", arglist );
Py_DECREF(arglist); Py_DECREF(arglist);
for ( unsigned i=0; i<ret.GetCount(); i++ ) for ( unsigned i=0; i<ret.GetCount(); i++ )
{ {
wxString rest; wxString rest;
wxString item = ret[i]; wxString item = ret[i];
if ( item.StartsWith( wxT("*"), &rest ) ) if ( item.StartsWith( wxT("*"), &rest ) )
...@@ -234,7 +234,7 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage ) ...@@ -234,7 +234,7 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterTypes( int aPage )
} }
} }
return ret; return ret;
} }
...@@ -244,11 +244,11 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterValues( int aPage ) ...@@ -244,11 +244,11 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterValues( int aPage )
{ {
PyObject *arglist; PyObject *arglist;
wxArrayString ret; wxArrayString ret;
arglist = Py_BuildValue( "(i)", aPage ); arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterValues", arglist ); ret = CallRetArrayStrMethod( "GetParameterValues", arglist );
Py_DECREF( arglist ); Py_DECREF( arglist );
return ret; return ret;
} }
...@@ -256,35 +256,35 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterErrors( int aPage ) ...@@ -256,35 +256,35 @@ wxArrayString PYTHON_FOOTPRINT_WIZARD::GetParameterErrors( int aPage )
{ {
PyObject *arglist; PyObject *arglist;
wxArrayString ret; wxArrayString ret;
arglist = Py_BuildValue( "(i)", aPage ); arglist = Py_BuildValue( "(i)", aPage );
ret = CallRetArrayStrMethod( "GetParameterErrors", arglist ); ret = CallRetArrayStrMethod( "GetParameterErrors", arglist );
Py_DECREF( arglist ); Py_DECREF( arglist );
return ret; return ret;
} }
wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues( int aPage, wxArrayString& aValues ) wxString PYTHON_FOOTPRINT_WIZARD::SetParameterValues( int aPage, wxArrayString& aValues )
{ {
int len = aValues.size(); int len = aValues.size();
PyObject *py_list; PyObject *py_list;
py_list = PyList_New( len ); py_list = PyList_New( len );
for ( int i=0; i<len ; i++ ) for ( int i=0; i<len ; i++ )
{ {
wxString str = aValues[i]; wxString str = aValues[i];
PyObject *py_str = PyString_FromString( (const char*)str.mb_str() ); PyObject *py_str = PyString_FromString( (const char*)str.mb_str() );
PyList_SetItem( py_list, i, py_str ); PyList_SetItem( py_list, i, py_str );
} }
PyObject *arglist; PyObject *arglist;
arglist = Py_BuildValue( "(i,O)", aPage, py_list ); arglist = Py_BuildValue( "(i,O)", aPage, py_list );
wxString res = CallRetStrMethod( "SetParameterValues", arglist ); wxString res = CallRetStrMethod( "SetParameterValues", arglist );
Py_DECREF( arglist ); Py_DECREF( arglist );
return res; return res;
} }
...@@ -296,13 +296,13 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule() ...@@ -296,13 +296,13 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule()
PyObject *result, *obj; PyObject *result, *obj;
result = CallMethod( "GetModule", NULL ); result = CallMethod( "GetModule", NULL );
if (!result) if (!result)
return NULL; return NULL;
PY_BLOCK_THREADS( blocked ); PY_BLOCK_THREADS( blocked );
obj = PyObject_GetAttrString( result, "this" ); obj = PyObject_GetAttrString( result, "this" );
if ( PyErr_Occurred() ) if ( PyErr_Occurred() )
{ {
/* /*
...@@ -325,31 +325,31 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule() ...@@ -325,31 +325,31 @@ MODULE *PYTHON_FOOTPRINT_WIZARD::GetModule()
void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard) void PYTHON_FOOTPRINT_WIZARDS::register_wizard(PyObject* aPyWizard)
{ {
PYTHON_FOOTPRINT_WIZARD *fw; PYTHON_FOOTPRINT_WIZARD *fw;
fw = new PYTHON_FOOTPRINT_WIZARD( aPyWizard ); fw = new PYTHON_FOOTPRINT_WIZARD( aPyWizard );
//printf( "Registered python footprint wizard '%s'\n", //printf( "Registered python footprint wizard '%s'\n",
// (const char*)fw->GetName().mb_str() // (const char*)fw->GetName().mb_str()
// ); // );
// this get the wizard registered in the common // this get the wizard registered in the common
// FOOTPRINT_WIZARDS class // FOOTPRINT_WIZARDS class
fw->register_wizard(); fw->register_wizard();
#if 0 #if 0
/* just to test if it works correctly */ /* just to test if it works correctly */
int pages = fw->GetNumParameterPages(); int pages = fw->GetNumParameterPages();
printf(" %d pages\n",pages); printf(" %d pages\n",pages);
for (int n=0; n<pages; n++) for (int n=0; n<pages; n++)
{ {
printf(" page %d->'%s'\n",n, printf(" page %d->'%s'\n",n,
(const char*)fw->GetParameterPageName(n).mb_str()); (const char*)fw->GetParameterPageName(n).mb_str());
} }
#endif #endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment