Root/kicad-patches/cmdline-eeschema.patch

1diff -ru kicad.3493/eeschema/CMakeLists.txt kicad/eeschema/CMakeLists.txt
2--- kicad.3493/eeschema/CMakeLists.txt 2012-04-08 03:24:18.653600000 +0200
3+++ kicad/eeschema/CMakeLists.txt 2012-04-08 06:50:45.274378556 +0200
4@@ -82,6 +82,7 @@
5     eeredraw.cpp
6     eeschema.cpp
7     eeschema_config.cpp
8+ eeschema_cmdline.cpp
9     erc.cpp
10     events_called_functions_for_edit.cpp
11     files-io.cpp
12diff -ru kicad.3493/eeschema/dialogs/dialog_build_BOM.h kicad/eeschema/dialogs/dialog_build_BOM.h
13--- kicad.3493/eeschema/dialogs/dialog_build_BOM.h 2012-04-08 03:24:18.653600000 +0200
14+++ kicad/eeschema/dialogs/dialog_build_BOM.h 2012-04-08 06:50:45.278378536 +0200
15@@ -17,6 +17,7 @@
16 
17 class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
18 {
19+friend class EESCHEMA_CMDLINE;
20 private:
21     EDA_DRAW_FRAME* m_Parent;
22     wxConfig* m_Config;
23diff -ru kicad.3493/eeschema/dialogs/dialog_erc.cpp kicad/eeschema/dialogs/dialog_erc.cpp
24--- kicad.3493/eeschema/dialogs/dialog_erc.cpp 2012-04-08 03:24:18.653600000 +0200
25+++ kicad/eeschema/dialogs/dialog_erc.cpp 2012-04-08 06:50:45.279378530 +0200
26@@ -574,10 +574,10 @@
27                           _( "Electronic rule check file (.erc)|*.erc" ),
28                           wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
29 
30- if( dlg.ShowModal() == wxID_CANCEL )
31+ if( !g_CmdLineMode && dlg.ShowModal() == wxID_CANCEL )
32             return;
33 
34- if( WriteDiagnosticERC( dlg.GetPath() ) )
35+ if( WriteDiagnosticERC( g_CmdLineMode ? fn.GetFullPath() : dlg.GetPath() ) )
36         {
37             Close( true );
38             ExecuteFile( this, wxGetApp().GetEditorName(), QuoteFullPath( fn ) );
39diff -ru kicad.3493/eeschema/dialogs/dialog_erc.h kicad/eeschema/dialogs/dialog_erc.h
40--- kicad.3493/eeschema/dialogs/dialog_erc.h 2012-04-08 03:24:18.653600000 +0200
41+++ kicad/eeschema/dialogs/dialog_erc.h 2012-04-08 06:50:45.280378524 +0200
42@@ -29,6 +29,7 @@
43 
44 class DIALOG_ERC : public DIALOG_ERC_BASE
45 {
46+friend class EESCHEMA_CMDLINE;
47     DECLARE_EVENT_TABLE()
48 
49 private:
50diff -ru kicad.3493/eeschema/dialogs/dialog_plot_schematic_DXF.cpp kicad/eeschema/dialogs/dialog_plot_schematic_DXF.cpp
51--- kicad.3493/eeschema/dialogs/dialog_plot_schematic_DXF.cpp 2012-04-08 03:24:18.653600000 +0200
52+++ kicad/eeschema/dialogs/dialog_plot_schematic_DXF.cpp 2012-04-08 06:50:45.281378518 +0200
53@@ -42,6 +42,7 @@
54 
55 class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE
56 {
57+friend class SCH_EDIT_FRAME;
58 private:
59     SCH_EDIT_FRAME* m_Parent;
60 
61@@ -73,6 +74,15 @@
62 
63 
64 
65+void SCH_EDIT_FRAME::CmdLineToPlot_DXF( bool PlotBW, bool PlotSheetRef )
66+{
67+ DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = !PlotBW;
68+ DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = PlotSheetRef;
69+ DIALOG_PLOT_SCHEMATIC_DXF dlg( this );
70+ wxCommandEvent dummy;
71+ dlg.OnPlotAll( dummy );
72+}
73+
74 void SCH_EDIT_FRAME::ToPlot_DXF( wxCommandEvent& event )
75 {
76     DIALOG_PLOT_SCHEMATIC_DXF DXF_frame( this );
77diff -ru kicad.3493/eeschema/dialogs/dialog_plot_schematic_PS.cpp kicad/eeschema/dialogs/dialog_plot_schematic_PS.cpp
78--- kicad.3493/eeschema/dialogs/dialog_plot_schematic_PS.cpp 2012-04-08 03:24:18.653600000 +0200
79+++ kicad/eeschema/dialogs/dialog_plot_schematic_PS.cpp 2012-04-08 06:50:45.282378513 +0200
80@@ -48,6 +48,7 @@
81 
82 class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE
83 {
84+friend class SCH_EDIT_FRAME;
85 private:
86     SCH_EDIT_FRAME* m_Parent;
87 
88@@ -80,6 +81,15 @@
89 bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
90 
91 
92+void SCH_EDIT_FRAME::CmdLineToPlot_PS( bool PlotBW, bool PlotSheetRef )
93+{
94+ DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = !PlotBW;
95+ DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = PlotSheetRef;
96+ DIALOG_PLOT_SCHEMATIC_PS dlg( this );
97+ wxCommandEvent dummy;
98+ dlg.OnPlotAll( dummy );
99+}
100+
101 void SCH_EDIT_FRAME::ToPlot_PS( wxCommandEvent& event )
102 {
103     DIALOG_PLOT_SCHEMATIC_PS dlg( this );
104diff -ru kicad.3493/eeschema/dialogs/dialog_SVG_print.cpp kicad/eeschema/dialogs/dialog_SVG_print.cpp
105--- kicad.3493/eeschema/dialogs/dialog_SVG_print.cpp 2012-04-08 03:24:18.653600000 +0200
106+++ kicad/eeschema/dialogs/dialog_SVG_print.cpp 2012-04-08 06:50:45.283378508 +0200
107@@ -53,6 +53,13 @@
108 static bool s_Print_Frame_Ref = true;
109 static int s_PlotBlackAndWhite = 0;
110 
111+void CmdLinePrintSVGDoc( EDA_DRAW_FRAME* frame, bool aPrintAll, bool aPrint_Sheet_Ref, bool aPrintBlackAndWhite )
112+{
113+ class DIALOG_SVG_PRINT* dlg = new DIALOG_SVG_PRINT( frame );
114+ dlg->m_ModeColorOption->SetSelection( aPrintBlackAndWhite );
115+ dlg->PrintSVGDoc( aPrintAll, aPrint_Sheet_Ref );
116+ delete dlg;
117+}
118 
119 /*!
120  * DIALOG_SVG_PRINT functions
121diff -ru kicad.3493/eeschema/dialogs/dialog_SVG_print.h kicad/eeschema/dialogs/dialog_SVG_print.h
122--- kicad.3493/eeschema/dialogs/dialog_SVG_print.h 2012-04-08 03:24:18.653600000 +0200
123+++ kicad/eeschema/dialogs/dialog_SVG_print.h 2012-04-08 06:50:45.283378508 +0200
124@@ -11,6 +11,8 @@
125 
126 class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
127 {
128+friend void CmdLinePrintSVGDoc( EDA_DRAW_FRAME* frame, bool aPrintAll, bool aPrint_Sheet_Ref, bool aPrintBlackAndWhite );
129+ private:
130 private:
131     EDA_DRAW_FRAME* m_Parent;
132     wxConfig* m_Config;
133diff -ru kicad.3493/eeschema/eeschema.cpp kicad/eeschema/eeschema.cpp
134--- kicad.3493/eeschema/eeschema.cpp 2012-04-08 03:24:18.653600000 +0200
135+++ kicad/eeschema/eeschema.cpp 2012-04-08 06:51:29.448137537 +0200
136@@ -39,6 +39,7 @@
137 #include <general.h>
138 #include <protos.h>
139 #include <hotkeys.h>
140+#include <eeschema_cmdline.h>
141 #include <dialogs/dialog_color_config.h>
142 #include <transform.h>
143 #include <wildcards_and_files_ext.h>
144@@ -123,6 +124,9 @@
145     wxFileName filename;
146     SCH_EDIT_FRAME* frame = NULL;
147 
148+ if ( argc >= 2 && argv[1][0] == '-' )
149+ return g_EESchemaCmdLine.Run();
150+
151     InitEDA_Appl( wxT( "Eeschema" ), APP_EESCHEMA_T );
152 
153     if( m_Checker && m_Checker->IsAnotherRunning() )
154

Archive Download this file

Branches:
master



interactive