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
setPlotDrawingSheet( cfg->m_PlotPanel.frame_reference );
setOpenFileAfterPlot( cfg->m_PlotPanel.open_file_after_plot );
// HPGL plot origin and unit system configuration
m_plotOriginOpt->SetSelection( cfg->m_PlotPanel.hpgl_origin );
@ -299,6 +301,8 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
selection = m_pageSizeSelect;
}
m_openFileAfterPlot->Enable( fmt == PLOT_FORMAT::PDF );
m_paperSizeOption->Set( paperSizes );
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.hpgl_origin = m_plotOriginOpt->GetSelection();
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
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 );
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-2010 Lorenzo Marcantonio
* 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
* modify it under the terms of the GNU General Public License
@ -94,6 +94,9 @@ private:
bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); }
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 );
// 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/
//
// 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 );
wxBoxSizer* bOptionsRight;
bOptionsRight = new wxBoxSizer( wxVERTICAL );
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
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_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 );

File diff suppressed because it is too large Load Diff

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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -15,6 +15,7 @@ class WX_HTML_REPORT_PANEL;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
@ -64,13 +65,15 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
wxStaticText* m_penWidthLabel;
wxTextCtrl* m_penWidthCtrl;
wxStaticText* m_penWidthUnits;
wxStaticBoxSizer* m_otherOptions;
wxCheckBox* m_openFileAfterPlot;
WX_HTML_REPORT_PANEL* m_MessagesBox;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply;
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 OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
@ -83,6 +86,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
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();
};

View File

@ -361,6 +361,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
&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_Simulator.window.state.pos_x, 0 ) );

View File

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