1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-05 16:31:53 +02:00
eda-tools/kicad-patches/cmdline-pcbnew.patch
2012-04-08 08:37:48 +02:00

223 lines
7.5 KiB
Diff

diff -ru kicad.3493/pcbnew/build_BOM_from_board.cpp kicad/pcbnew/build_BOM_from_board.cpp
--- kicad.3493/pcbnew/build_BOM_from_board.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/build_BOM_from_board.cpp 2012-04-08 06:52:44.569728557 +0200
@@ -67,6 +67,7 @@
fn = GetScreen()->GetFileName();
fn.SetExt( CsvFileExtension );
+ if (!g_CmdLineMode) {
wxFileDialog dlg( this, _( "Save Bill of Materials" ), wxGetCwd(),
fn.GetFullName(), CsvFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
@@ -75,6 +76,7 @@
return;
fn = dlg.GetPath();
+ }
FichBom = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
diff -ru kicad.3493/pcbnew/CMakeLists.txt kicad/pcbnew/CMakeLists.txt
--- kicad.3493/pcbnew/CMakeLists.txt 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/CMakeLists.txt 2012-04-08 06:52:44.572728497 +0200
@@ -162,6 +162,7 @@
onleftclick.cpp
onrightclick.cpp
pcbnew.cpp
+ pcbnew_cmdline.cpp
pcbnew_config.cpp
pcbplot.cpp
plotgerb.cpp
diff -ru kicad.3493/pcbnew/dialogs/dialog_gendrill.h kicad/pcbnew/dialogs/dialog_gendrill.h
--- kicad.3493/pcbnew/dialogs/dialog_gendrill.h 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/dialogs/dialog_gendrill.h 2012-04-08 06:52:44.574728462 +0200
@@ -33,6 +33,7 @@
class DIALOG_GENDRILL : public DIALOG_GENDRILL_BASE
{
+friend bool Pcbnew_CmdLine();
public:
DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
~DIALOG_GENDRILL();
diff -ru kicad.3493/pcbnew/dialogs/dialog_SVG_print.h kicad/pcbnew/dialogs/dialog_SVG_print.h
--- kicad.3493/pcbnew/dialogs/dialog_SVG_print.h 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/dialogs/dialog_SVG_print.h 2012-04-08 06:52:44.575728446 +0200
@@ -13,6 +13,7 @@
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
+friend bool Pcbnew_CmdLine();
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config;
diff -ru kicad.3493/pcbnew/drc_stuff.h kicad/pcbnew/drc_stuff.h
--- kicad.3493/pcbnew/drc_stuff.h 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/drc_stuff.h 2012-04-08 06:52:44.576728430 +0200
@@ -146,6 +146,7 @@
*/
class DRC
{
+ friend bool Pcbnew_CmdLine();
friend class DIALOG_DRC_CONTROL;
private:
diff -ru kicad.3493/pcbnew/gendrill.cpp kicad/pcbnew/gendrill.cpp
--- kicad.3493/pcbnew/gendrill.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/gendrill.cpp 2012-04-08 06:52:44.582728348 +0200
@@ -155,8 +155,13 @@
fn.GetFullName(), wxGetTranslation( DrillFileWildcard ),
wxFD_SAVE | wxFD_CHANGE_DIR );
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
break;
+ }
FILE* aFile = wxFopen( dlg.GetPath(), wxT( "w" ) );
@@ -615,8 +620,13 @@
fn.GetFullName(), wildcard,
wxFD_SAVE );
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
return;
+ }
FILE* plotfile = wxFopen( dlg.GetPath(), wxT( "wt" ) );
@@ -655,8 +665,13 @@
fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
wxFD_SAVE );
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
return;
+ }
FILE* report_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
diff -ru kicad.3493/pcbnew/gen_modules_placefile.cpp kicad/pcbnew/gen_modules_placefile.cpp
--- kicad.3493/pcbnew/gen_modules_placefile.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/gen_modules_placefile.cpp 2012-04-08 06:52:44.586728303 +0200
@@ -501,10 +501,10 @@
{
wxFileName fn;
- wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
+ wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetFullPath();
wxDirDialog dirDialog( this, _( "Select Output Directory" ), boardFilePath );
- if( dirDialog.ShowModal() == wxID_CANCEL )
+ if( !g_CmdLineMode && dirDialog.ShowModal() == wxID_CANCEL )
return;
fn = GetScreen()->GetFileName();
diff -ru kicad.3493/pcbnew/pcbnew.cpp kicad/pcbnew/pcbnew.cpp
--- kicad.3493/pcbnew/pcbnew.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/pcbnew.cpp 2012-04-08 06:53:10.458587343 +0200
@@ -42,6 +42,7 @@
#include <wx/snglinst.h>
#include <pcbnew.h>
+#include <pcbnew_cmdline.h>
#include <protos.h>
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
@@ -102,6 +103,9 @@
wxFileName fn;
PCB_EDIT_FRAME* frame = NULL;
+ if ( argc >= 2 && argv[1][0] == '-' )
+ return Pcbnew_CmdLine();
+
InitEDA_Appl( wxT( "Pcbnew" ), APP_PCBNEW_T );
if( m_Checker && m_Checker->IsAnotherRunning() )
diff -ru kicad.3493/pcbnew/pcbnew.h kicad/pcbnew/pcbnew.h
--- kicad.3493/pcbnew/pcbnew.h 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/pcbnew.h 2012-04-08 06:52:44.592728207 +0200
@@ -49,6 +49,7 @@
extern wxString g_DocModulesFileName;
/* variables */
+extern bool g_CmdLineMode;
extern bool Drc_On;
extern bool g_AutoDeleteOldTrack;
extern bool g_Drag_Pistes_On;
diff -ru kicad.3493/pcbnew/pcbplot.cpp kicad/pcbnew/pcbplot.cpp
--- kicad.3493/pcbnew/pcbplot.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/pcbplot.cpp 2012-04-08 07:03:09.733176047 +0200
@@ -806,7 +806,7 @@
case PLOT_FORMAT_DXF:
success = m_parent->ExportToDxfFile( fn.GetFullPath(), layer,
- m_plotOpts.m_PlotMode );
+ false, m_plotOpts.m_PlotMode );
break;
}
diff -ru kicad.3493/pcbnew/plotdxf.cpp kicad/pcbnew/plotdxf.cpp
--- kicad.3493/pcbnew/plotdxf.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/plotdxf.cpp 2012-04-08 06:52:44.599728094 +0200
@@ -16,7 +16,7 @@
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
- EDA_DRAW_MODE_T aTraceMode )
+ bool aPlotOriginIsAuxAxis, EDA_DRAW_MODE_T aTraceMode )
{
LOCALE_IO toggle;
@@ -29,9 +29,21 @@
return false;
}
+ wxPoint offset;
+
+ if( aPlotOriginIsAuxAxis )
+ {
+ offset = GetOriginAxisPosition();
+ }
+ else
+ {
+ offset.x = 0;
+ offset.y = 0;
+ }
+
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->SetPageSettings( GetPageSettings() );
- plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
+ plotter->set_viewport( offset, 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( aFullFileName );
plotter->start_plot( output_file );
diff -ru kicad.3493/pcbnew/xchgmod.cpp kicad/pcbnew/xchgmod.cpp
--- kicad.3493/pcbnew/xchgmod.cpp 2012-04-08 03:24:18.653600000 +0200
+++ kicad/pcbnew/xchgmod.cpp 2012-04-08 06:52:44.602728064 +0200
@@ -602,6 +602,7 @@
fn.SetExt( ComponentFileExtension );
wildcard = wxGetTranslation( ComponentFileWildcard );
+ if ( !g_CmdLineMode) {
wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
@@ -610,6 +611,7 @@
return;
fn = dlg.GetPath();
+ }
FichCmp = wxFopen( fn.GetFullPath(), wxT( "wt" ) );