Add "Open file after plot" to Plot dialog

This commit is contained in:
WhiteChairFromIkea 2022-08-21 18:21:09 +03:00 committed by Mike Williams
parent c13b938a4b
commit 77046e9506
7 changed files with 1686 additions and 1557 deletions

View File

@ -144,6 +144,8 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set plot or not frame reference option // Set plot or not frame reference option
setPlotDrawingSheet( cfg->m_PlotPanel.frame_reference ); setPlotDrawingSheet( cfg->m_PlotPanel.frame_reference );
setOpenFileAfterPlot( cfg->m_PlotPanel.open_file_after_plot );
// HPGL plot origin and unit system configuration // HPGL plot origin and unit system configuration
m_plotOriginOpt->SetSelection( cfg->m_PlotPanel.hpgl_origin ); m_plotOriginOpt->SetSelection( cfg->m_PlotPanel.hpgl_origin );
@ -299,6 +301,8 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
selection = m_pageSizeSelect; selection = m_pageSizeSelect;
} }
m_openFileAfterPlot->Enable( fmt == PLOT_FORMAT::PDF );
m_paperSizeOption->Set( paperSizes ); m_paperSizeOption->Set( paperSizes );
m_paperSizeOption->SetSelection( selection ); m_paperSizeOption->SetSelection( selection );
@ -336,6 +340,7 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() ); cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
cfg->m_PlotPanel.hpgl_origin = m_plotOriginOpt->GetSelection(); cfg->m_PlotPanel.hpgl_origin = m_plotOriginOpt->GetSelection();
cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect; cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect;
cfg->m_PlotPanel.open_file_after_plot = getOpenFileAfterPlot();
// HPGL Pen Size is stored in mm in config // HPGL Pen Size is stored in mm in config
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM; cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
@ -877,6 +882,9 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO ); reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
restoreEnvironment( plotter, oldsheetpath ); restoreEnvironment( plotter, oldsheetpath );
if( getOpenFileAfterPlot())
wxLaunchDefaultApplication( plotFileName.GetFullPath() );
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio * Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -94,6 +94,9 @@ private:
bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); } bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); }
void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); } void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); }
bool getOpenFileAfterPlot() { return m_openFileAfterPlot->GetValue(); }
void setOpenFileAfterPlot( bool aOpenFileAfterPlot ) { m_openFileAfterPlot->SetValue( aOpenFileAfterPlot ); }
void plotSchematic( bool aPlotAll ); void plotSchematic( bool aPlotAll );
// PDF // PDF

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -116,6 +116,9 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
m_optionsSizer->Add( sbOptions, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_optionsSizer->Add( sbOptions, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bOptionsRight;
bOptionsRight = new wxBoxSizer( wxVERTICAL );
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL ); m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
wxGridBagSizer* gbSizer2; wxGridBagSizer* gbSizer2;
@ -150,7 +153,21 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
m_HPGLOptionsSizer->Add( gbSizer2, 1, wxEXPAND, 5 ); m_HPGLOptionsSizer->Add( gbSizer2, 1, wxEXPAND, 5 );
m_optionsSizer->Add( m_HPGLOptionsSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bOptionsRight->Add( m_HPGLOptionsSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_otherOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Other options") ), wxVERTICAL );
m_openFileAfterPlot = new wxCheckBox( m_otherOptions->GetStaticBox(), wxID_ANY, _("Open file after plot"), wxDefaultPosition, wxDefaultSize, 0 );
m_openFileAfterPlot->Enable( false );
m_openFileAfterPlot->SetToolTip( _("Open output file with associated application after successful plot") );
m_otherOptions->Add( m_openFileAfterPlot, 0, wxALL, 5 );
bOptionsRight->Add( m_otherOptions, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_optionsSizer->Add( bOptionsRight, 1, wxEXPAND, 5 );
bMainSizer->Add( m_optionsSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_optionsSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="15" /> <FileVersion major="1" minor="16" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_plot_schematic_base</property> <property name="file">dialog_plot_schematic_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">Dialog_plot_schematic_base</property> <property name="name">Dialog_plot_schematic_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Plot Schematic Options</property> <property name="title">Plot Schematic Options</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -207,6 +210,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -345,11 +349,11 @@
<event name="OnRadioBox">OnPlotFormatSelection</event> <event name="OnRadioBox">OnPlotFormatSelection</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Options</property> <property name="label">Options</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -357,11 +361,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="0"> <object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property> <property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property> <property name="growablecols">1</property>
@ -1099,11 +1103,20 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bOptionsRight</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">HPGL Options</property> <property name="label">HPGL Options</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -1111,11 +1124,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="0"> <object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property> <property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property> <property name="growablecols">1</property>
@ -1456,6 +1469,86 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Other options</property>
<property name="minimum_size"></property>
<property name="name">m_otherOptions</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">0</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Open file after plot</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_openFileAfterPlot</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Open output file with associated application after successful plot</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -15,6 +15,7 @@ class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
@ -64,13 +65,15 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
wxStaticText* m_penWidthLabel; wxStaticText* m_penWidthLabel;
wxTextCtrl* m_penWidthCtrl; wxTextCtrl* m_penWidthCtrl;
wxStaticText* m_penWidthUnits; wxStaticText* m_penWidthUnits;
wxStaticBoxSizer* m_otherOptions;
wxCheckBox* m_openFileAfterPlot;
WX_HTML_REPORT_PANEL* m_MessagesBox; WX_HTML_REPORT_PANEL* m_MessagesBox;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply; wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, override them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
@ -83,6 +86,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
public: public:
DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot Schematic Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot Schematic Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_BASE(); ~DIALOG_PLOT_SCHEMATIC_BASE();
}; };

View File

@ -361,6 +361,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin", m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
&m_PlotPanel.hpgl_origin, 0 ) ); &m_PlotPanel.hpgl_origin, 0 ) );
m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
&m_PlotPanel.open_file_after_plot, false ) );
m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x", m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
&m_Simulator.window.state.pos_x, 0 ) ); &m_Simulator.window.state.pos_x, 0 ) );

View File

@ -215,6 +215,7 @@ public:
int hpgl_paper_size; int hpgl_paper_size;
double hpgl_pen_size; double hpgl_pen_size;
int hpgl_origin; int hpgl_origin;
bool open_file_after_plot;
}; };
struct PANEL_SYM_CHOOSER struct PANEL_SYM_CHOOSER