1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-10-01 13:27:38 +03:00
eda-tools/kicad-patches/cmdline-pcbnew.patch

184 lines
6.2 KiB
Diff
Raw Normal View History

diff -ru kicad.orig/pcbnew/build_BOM_from_board.cpp kicad/pcbnew/build_BOM_from_board.cpp
--- kicad.orig/pcbnew/build_BOM_from_board.cpp 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/build_BOM_from_board.cpp 2012-01-10 23:23:32.338040998 +0100
@@ -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.orig/pcbnew/CMakeLists.txt kicad/pcbnew/CMakeLists.txt
--- kicad.orig/pcbnew/CMakeLists.txt 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/CMakeLists.txt 2012-01-05 01:53:42.424887775 +0100
@@ -150,6 +150,7 @@
onrightclick.cpp
pcb_plot_params.cpp
pcbnew.cpp
+ pcbnew_cmdline.cpp
pcbnew_config.cpp
pcbplot.cpp
plotgerb.cpp
diff -ru kicad.orig/pcbnew/dialogs/dialog_gendrill.h kicad/pcbnew/dialogs/dialog_gendrill.h
--- kicad.orig/pcbnew/dialogs/dialog_gendrill.h 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/dialogs/dialog_gendrill.h 2012-01-05 18:07:15.289119747 +0100
@@ -33,6 +33,7 @@
class DIALOG_GENDRILL : public DIALOG_GENDRILL_BASE
{
+friend bool Pcbnew_CmdLine();
public:
static int m_UnitDrillIsInch;
static int m_ZerosFormat;
diff -ru kicad.orig/pcbnew/dialogs/dialog_SVG_print.h kicad/pcbnew/dialogs/dialog_SVG_print.h
--- kicad.orig/pcbnew/dialogs/dialog_SVG_print.h 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/dialogs/dialog_SVG_print.h 2012-01-10 19:40:48.754648647 +0100
@@ -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.orig/pcbnew/drc_stuff.h kicad/pcbnew/drc_stuff.h
--- kicad.orig/pcbnew/drc_stuff.h 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/drc_stuff.h 2012-01-05 18:08:06.047781508 +0100
@@ -146,6 +146,7 @@
*/
class DRC
{
+ friend bool Pcbnew_CmdLine();
friend class DIALOG_DRC_CONTROL;
private:
diff -ru kicad.orig/pcbnew/gendrill.cpp kicad/pcbnew/gendrill.cpp
--- kicad.orig/pcbnew/gendrill.cpp 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/gendrill.cpp 2012-01-08 17:26:28.429837548 +0100
@@ -159,8 +159,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" ) );
@@ -619,8 +624,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" ) );
@@ -659,8 +669,13 @@
fn.GetFullName(), wxGetTranslation( RptFileWildcard ),
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.orig/pcbnew/gen_modules_placefile.cpp kicad/pcbnew/gen_modules_placefile.cpp
--- kicad.orig/pcbnew/gen_modules_placefile.cpp 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/gen_modules_placefile.cpp 2012-01-08 18:32:33.547634589 +0100
@@ -138,10 +138,10 @@
return;
}
- 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;
fnFront = GetScreen()->GetFileName();
@@ -298,6 +298,7 @@
msg.Append( fnBack.GetFullPath() );
}
+ if ( !g_CmdLineMode )
wxMessageBox( msg, _( "Module Position File" ), wxICON_INFORMATION );
exit: // the only safe way out of here, no returns please.
diff -ru kicad.orig/pcbnew/pcbnew.cpp kicad/pcbnew/pcbnew.cpp
--- kicad.orig/pcbnew/pcbnew.cpp 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/pcbnew.cpp 2012-01-05 21:49:03.036099308 +0100
@@ -44,6 +44,7 @@
#include "pcbnew.h"
#include "protos.h"
#include "hotkeys.h"
+#include "pcbnew_cmdline.h"
// Colors for layers and items
@@ -111,6 +112,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.orig/pcbnew/pcbnew.h kicad/pcbnew/pcbnew.h
--- kicad.orig/pcbnew/pcbnew.h 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/pcbnew.h 2012-01-05 21:47:10.422652798 +0100
@@ -41,6 +41,7 @@
#define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT )
/* variables */
+extern bool g_CmdLineMode;
extern bool Drc_On;
extern bool g_AutoDeleteOldTrack;
extern bool g_Drag_Pistes_On;
diff -ru kicad.orig/pcbnew/xchgmod.cpp kicad/pcbnew/xchgmod.cpp
--- kicad.orig/pcbnew/xchgmod.cpp 2012-01-02 15:12:29.461843000 +0100
+++ kicad/pcbnew/xchgmod.cpp 2012-01-05 21:47:50.531456715 +0100
@@ -599,6 +599,7 @@
fn.SetExt( NetCmpExtBuffer );
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) + NetCmpExtBuffer;
+ if ( !g_CmdLineMode) {
wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
@@ -607,6 +608,7 @@
return;
fn = dlg.GetPath();
+ }
FichCmp = wxFopen( fn.GetFullPath(), wxT( "wt" ) );