1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-27 02:45:21 +02:00
eda-tools/kicad-patches/cmdline-pcbnew.patch

223 lines
7.5 KiB
Diff
Raw Normal View History

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
2012-01-25 14:20:03 +02:00
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
2012-01-25 14:20:03 +02:00
@@ -33,6 +33,7 @@
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
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
2012-01-25 14:20:03 +02:00
@@ -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
2012-01-25 14:20:03 +02:00
@@ -146,6 +146,7 @@
*/
class DRC
{
+ friend bool Pcbnew_CmdLine();
friend class DIALOG_DRC_CONTROL;
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
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 @@
2012-01-25 14:20:03 +02:00
fn.GetFullName(), wxGetTranslation( DrillFileWildcard ),
wxFD_SAVE | wxFD_CHANGE_DIR );
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
break;
+ }
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
FILE* aFile = wxFopen( dlg.GetPath(), wxT( "w" ) );
2012-01-25 13:32:10 +02:00
@@ -615,8 +620,13 @@
2012-01-25 14:20:03 +02:00
fn.GetFullName(), wildcard,
wxFD_SAVE );
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
return;
+ }
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
FILE* plotfile = wxFopen( dlg.GetPath(), wxT( "wt" ) );
2012-01-25 13:32:10 +02:00
@@ -655,8 +665,13 @@
fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
2012-01-25 14:20:03 +02:00
wxFD_SAVE );
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
+ if ( g_CmdLineMode ) {
+ dlg.SetPath( fn.GetFullPath() );
+ wxTheApp->Yield();
+ } else {
if( dlg.ShowModal() == wxID_CANCEL )
return;
+ }
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
FILE* report_dest = wxFopen( dlg.GetPath(), wxT( "w" ) );
2012-01-25 13:32:10 +02:00
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;
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
- wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetPath();
+ wxString boardFilePath = ( (wxFileName) GetScreen()->GetFileName()).GetFullPath();
wxDirDialog dirDialog( this, _( "Select Output Directory" ), boardFilePath );
2012-01-25 13:32:10 +02:00
2012-01-25 14:20:03 +02:00
- if( dirDialog.ShowModal() == wxID_CANCEL )
+ if( !g_CmdLineMode && dirDialog.ShowModal() == wxID_CANCEL )
return;
2012-01-25 13:32:10 +02:00
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>
2012-01-25 13:32:10 +02:00
#include <pcbnew.h>
+#include <pcbnew_cmdline.h>
2012-01-25 13:32:10 +02:00
#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 @@
2012-01-11 12:50:47 +02:00
case PLOT_FORMAT_DXF:
success = m_parent->ExportToDxfFile( fn.GetFullPath(), layer,
- m_plotOpts.m_PlotMode );
+ false, m_plotOpts.m_PlotMode );
2012-01-11 12:50:47 +02:00
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
2012-01-11 12:50:47 +02:00
@@ -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 )
2012-01-11 12:50:47 +02:00
{
LOCALE_IO toggle;
2012-01-11 12:50:47 +02:00
@@ -29,9 +29,21 @@
2012-01-11 12:50:47 +02:00
return false;
}
+ wxPoint offset;
+
+ if( aPlotOriginIsAuxAxis )
+ {
+ offset = GetOriginAxisPosition();
2012-01-11 12:50:47 +02:00
+ }
+ else
+ {
+ offset.x = 0;
+ offset.y = 0;
+ }
+
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->SetPageSettings( GetPageSettings() );
2012-01-11 12:50:47 +02:00
- 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" ) );