Root/kicad-patches/cmdline-pcbnew.patch

1diff -ru kicad.3493/pcbnew/build_BOM_from_board.cpp kicad/pcbnew/build_BOM_from_board.cpp
2--- kicad.3493/pcbnew/build_BOM_from_board.cpp 2012-04-08 03:24:18.653600000 +0200
3+++ kicad/pcbnew/build_BOM_from_board.cpp 2012-04-08 06:52:44.569728557 +0200
4@@ -67,6 +67,7 @@
5     fn = GetScreen()->GetFileName();
6     fn.SetExt( CsvFileExtension );
7 
8+ if (!g_CmdLineMode) {
9     wxFileDialog dlg( this, _( "Save Bill of Materials" ), wxGetCwd(),
10                       fn.GetFullName(), CsvFileWildcard,
11                       wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
12@@ -75,6 +76,7 @@
13         return;
14 
15     fn = dlg.GetPath();
16+ }
17 
18     FichBom = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
19 
20diff -ru kicad.3493/pcbnew/CMakeLists.txt kicad/pcbnew/CMakeLists.txt
21--- kicad.3493/pcbnew/CMakeLists.txt 2012-04-08 03:24:18.653600000 +0200
22+++ kicad/pcbnew/CMakeLists.txt 2012-04-08 06:52:44.572728497 +0200
23@@ -162,6 +162,7 @@
24     onleftclick.cpp
25     onrightclick.cpp
26     pcbnew.cpp
27+ pcbnew_cmdline.cpp
28     pcbnew_config.cpp
29     pcbplot.cpp
30     plotgerb.cpp
31diff -ru kicad.3493/pcbnew/dialogs/dialog_gendrill.h kicad/pcbnew/dialogs/dialog_gendrill.h
32--- kicad.3493/pcbnew/dialogs/dialog_gendrill.h 2012-04-08 03:24:18.653600000 +0200
33+++ kicad/pcbnew/dialogs/dialog_gendrill.h 2012-04-08 06:52:44.574728462 +0200
34@@ -33,6 +33,7 @@
35 
36 class DIALOG_GENDRILL : public DIALOG_GENDRILL_BASE
37 {
38+friend bool Pcbnew_CmdLine();
39 public:
40     DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
41     ~DIALOG_GENDRILL();
42diff -ru kicad.3493/pcbnew/dialogs/dialog_SVG_print.h kicad/pcbnew/dialogs/dialog_SVG_print.h
43--- kicad.3493/pcbnew/dialogs/dialog_SVG_print.h 2012-04-08 03:24:18.653600000 +0200
44+++ kicad/pcbnew/dialogs/dialog_SVG_print.h 2012-04-08 06:52:44.575728446 +0200
45@@ -13,6 +13,7 @@
46 
47 class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
48 {
49+friend bool Pcbnew_CmdLine();
50 private:
51     PCB_BASE_FRAME* m_Parent;
52     wxConfig* m_Config;
53diff -ru kicad.3493/pcbnew/drc_stuff.h kicad/pcbnew/drc_stuff.h
54--- kicad.3493/pcbnew/drc_stuff.h 2012-04-08 03:24:18.653600000 +0200
55+++ kicad/pcbnew/drc_stuff.h 2012-04-08 06:52:44.576728430 +0200
56@@ -146,6 +146,7 @@
57  */
58 class DRC
59 {
60+ friend bool Pcbnew_CmdLine();
61     friend class DIALOG_DRC_CONTROL;
62 
63 private:
64diff -ru kicad.3493/pcbnew/gendrill.cpp kicad/pcbnew/gendrill.cpp
65--- kicad.3493/pcbnew/gendrill.cpp 2012-04-08 03:24:18.653600000 +0200
66+++ kicad/pcbnew/gendrill.cpp 2012-04-08 06:52:44.582728348 +0200
67@@ -155,8 +155,13 @@
68                               fn.GetFullName(), wxGetTranslation( DrillFileWildcard ),
69                               wxFD_SAVE | wxFD_CHANGE_DIR );
70 
71+ if ( g_CmdLineMode ) {
72+ dlg.SetPath( fn.GetFullPath() );
73+ wxTheApp->Yield();
74+ } else {
75             if( dlg.ShowModal() == wxID_CANCEL )
76                 break;
77+ }
78 
79             FILE* aFile = wxFopen( dlg.GetPath(), wxT( "w" ) );
80 
81@@ -615,8 +620,13 @@
82                       fn.GetFullName(), wildcard,
83                       wxFD_SAVE );
84 
85+ if ( g_CmdLineMode ) {
86+ dlg.SetPath( fn.GetFullPath() );
87+ wxTheApp->Yield();
88+ } else {
89     if( dlg.ShowModal() == wxID_CANCEL )
90         return;
91+ }
92 
93     FILE* plotfile = wxFopen( dlg.GetPath(), wxT( "wt" ) );
94 
95@@ -655,8 +665,13 @@
96                       fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
97                       wxFD_SAVE );
98 
99+ if ( g_CmdLineMode ) {
100+ dlg.SetPath( fn.GetFullPath() );
101+ wxTheApp->Yield();
102+ } else {
103     if( dlg.ShowModal() == wxID_CANCEL )
104         return;
105+ }
106 
107     FILE* report_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
108 
109diff -ru kicad.3493/pcbnew/gen_modules_placefile.cpp kicad/pcbnew/gen_modules_placefile.cpp
110--- kicad.3493/pcbnew/gen_modules_placefile.cpp 2012-04-08 03:24:18.653600000 +0200
111+++ kicad/pcbnew/gen_modules_placefile.cpp 2012-04-08 06:52:44.586728303 +0200
112@@ -501,10 +501,10 @@
113 {
114     wxFileName fn;
115 
116- wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
117+ wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetFullPath();
118     wxDirDialog dirDialog( this, _( "Select Output Directory" ), boardFilePath );
119 
120- if( dirDialog.ShowModal() == wxID_CANCEL )
121+ if( !g_CmdLineMode && dirDialog.ShowModal() == wxID_CANCEL )
122         return;
123 
124     fn = GetScreen()->GetFileName();
125diff -ru kicad.3493/pcbnew/pcbnew.cpp kicad/pcbnew/pcbnew.cpp
126--- kicad.3493/pcbnew/pcbnew.cpp 2012-04-08 03:24:18.653600000 +0200
127+++ kicad/pcbnew/pcbnew.cpp 2012-04-08 06:53:10.458587343 +0200
128@@ -42,6 +42,7 @@
129 #include <wx/snglinst.h>
130 
131 #include <pcbnew.h>
132+#include <pcbnew_cmdline.h>
133 #include <protos.h>
134 #include <hotkeys.h>
135 #include <wildcards_and_files_ext.h>
136@@ -102,6 +103,9 @@
137     wxFileName fn;
138     PCB_EDIT_FRAME* frame = NULL;
139 
140+ if ( argc >= 2 && argv[1][0] == '-' )
141+ return Pcbnew_CmdLine();
142+
143     InitEDA_Appl( wxT( "Pcbnew" ), APP_PCBNEW_T );
144 
145     if( m_Checker && m_Checker->IsAnotherRunning() )
146diff -ru kicad.3493/pcbnew/pcbnew.h kicad/pcbnew/pcbnew.h
147--- kicad.3493/pcbnew/pcbnew.h 2012-04-08 03:24:18.653600000 +0200
148+++ kicad/pcbnew/pcbnew.h 2012-04-08 06:52:44.592728207 +0200
149@@ -49,6 +49,7 @@
150 extern wxString g_DocModulesFileName;
151 
152 /* variables */
153+extern bool g_CmdLineMode;
154 extern bool Drc_On;
155 extern bool g_AutoDeleteOldTrack;
156 extern bool g_Drag_Pistes_On;
157diff -ru kicad.3493/pcbnew/pcbplot.cpp kicad/pcbnew/pcbplot.cpp
158--- kicad.3493/pcbnew/pcbplot.cpp 2012-04-08 03:24:18.653600000 +0200
159+++ kicad/pcbnew/pcbplot.cpp 2012-04-08 07:03:09.733176047 +0200
160@@ -806,7 +806,7 @@
161 
162             case PLOT_FORMAT_DXF:
163                 success = m_parent->ExportToDxfFile( fn.GetFullPath(), layer,
164- m_plotOpts.m_PlotMode );
165+ false, m_plotOpts.m_PlotMode );
166                 break;
167             }
168 
169diff -ru kicad.3493/pcbnew/plotdxf.cpp kicad/pcbnew/plotdxf.cpp
170--- kicad.3493/pcbnew/plotdxf.cpp 2012-04-08 03:24:18.653600000 +0200
171+++ kicad/pcbnew/plotdxf.cpp 2012-04-08 06:52:44.599728094 +0200
172@@ -16,7 +16,7 @@
173 
174 
175 bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
176- EDA_DRAW_MODE_T aTraceMode )
177+ bool aPlotOriginIsAuxAxis, EDA_DRAW_MODE_T aTraceMode )
178 {
179     LOCALE_IO toggle;
180 
181@@ -29,9 +29,21 @@
182         return false;
183     }
184 
185+ wxPoint offset;
186+
187+ if( aPlotOriginIsAuxAxis )
188+ {
189+ offset = GetOriginAxisPosition();
190+ }
191+ else
192+ {
193+ offset.x = 0;
194+ offset.y = 0;
195+ }
196+
197     DXF_PLOTTER* plotter = new DXF_PLOTTER();
198     plotter->SetPageSettings( GetPageSettings() );
199- plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
200+ plotter->set_viewport( offset, 1, 0 );
201     plotter->set_creator( wxT( "PCBNEW-DXF" ) );
202     plotter->set_filename( aFullFileName );
203     plotter->start_plot( output_file );
204diff -ru kicad.3493/pcbnew/xchgmod.cpp kicad/pcbnew/xchgmod.cpp
205--- kicad.3493/pcbnew/xchgmod.cpp 2012-04-08 03:24:18.653600000 +0200
206+++ kicad/pcbnew/xchgmod.cpp 2012-04-08 06:52:44.602728064 +0200
207@@ -602,6 +602,7 @@
208     fn.SetExt( ComponentFileExtension );
209     wildcard = wxGetTranslation( ComponentFileWildcard );
210 
211+ if ( !g_CmdLineMode) {
212     wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
213                       fn.GetFullName(), wildcard,
214                       wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
215@@ -610,6 +611,7 @@
216         return;
217 
218     fn = dlg.GetPath();
219+ }
220 
221     FichCmp = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
222 
223

Archive Download this file

Branches:
master



interactive