Eeschema, Plot dialog: add Plot directory selection. The patch from 1383026@bugs.launchpad.net was widely used.
This commit is contained in:
parent
fa96780798
commit
ad645abac4
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
#include <wx/process.h>
|
#include <wx/process.h>
|
||||||
#include <wx/config.h>
|
#include <wx/config.h>
|
||||||
|
@ -344,6 +345,61 @@ wxString GetKicadConfigPath()
|
||||||
return cfgpath.GetPath();
|
return cfgpath.GetPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
|
||||||
|
const wxString& aBaseFilename,
|
||||||
|
REPORTER* aReporter )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
wxString baseFilePath = wxFileName( aBaseFilename ).GetPath();
|
||||||
|
|
||||||
|
// make aTargetFullFileName path, which is relative to aBaseFilename path (if it is not
|
||||||
|
// already an absolute path) absolute:
|
||||||
|
if( !aTargetFullFileName->MakeAbsolute( baseFilePath ) )
|
||||||
|
{
|
||||||
|
if( aReporter )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "*** Error: cannot make path '%s' absolute with respect to '%s'! ***" ),
|
||||||
|
GetChars( aTargetFullFileName->GetPath() ),
|
||||||
|
GetChars( baseFilePath ) );
|
||||||
|
aReporter->Report( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the path of aTargetFullFileName exists, and create it if needed:
|
||||||
|
wxString outputPath( aTargetFullFileName->GetPath() );
|
||||||
|
|
||||||
|
if( !wxFileName::DirExists( outputPath ) )
|
||||||
|
{
|
||||||
|
if( wxMkdir( outputPath ) )
|
||||||
|
{
|
||||||
|
if( aReporter )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Output directory '%s' created.\n" ), GetChars( outputPath ) );
|
||||||
|
aReporter->Report( msg );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( aReporter )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "*** Error: cannot create output directory '%s'! ***\n" ),
|
||||||
|
GetChars( outputPath ) );
|
||||||
|
aReporter->Report( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxString GetOSXKicadUserDataDir()
|
wxString GetOSXKicadUserDataDir()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,10 @@ void SCH_EDIT_FRAME::PlotSchematic( wxCommandEvent& event )
|
||||||
DIALOG_PLOT_SCHEMATIC dlg( this );
|
DIALOG_PLOT_SCHEMATIC dlg( this );
|
||||||
|
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
||||||
|
// save project config if the prj config has changed:
|
||||||
|
if( dlg.PrjConfigChanged() )
|
||||||
|
SaveProjectSettings( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,6 +68,7 @@ DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) :
|
||||||
DIALOG_PLOT_SCHEMATIC_BASE( parent )
|
DIALOG_PLOT_SCHEMATIC_BASE( parent )
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
m_configChanged = false;
|
||||||
m_config = Kiface().KifaceSettings();
|
m_config = Kiface().KifaceSettings();
|
||||||
|
|
||||||
initDlg();
|
initDlg();
|
||||||
|
@ -139,11 +144,58 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||||
PutValueInLocalUnits( *m_penHPGLWidthCtrl, m_HPGLPenSize );
|
PutValueInLocalUnits( *m_penHPGLWidthCtrl, m_HPGLPenSize );
|
||||||
m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect );
|
m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect );
|
||||||
|
|
||||||
|
// Plot directory
|
||||||
|
wxString path = m_parent->GetPlotDirectoryName();
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
path.Replace( '/', '\\' );
|
||||||
|
#endif
|
||||||
|
m_outputDirectoryName->SetValue( path );
|
||||||
|
|
||||||
// Hide/show widgets that are not always displayed:
|
// Hide/show widgets that are not always displayed:
|
||||||
wxCommandEvent cmd_event;
|
wxCommandEvent cmd_event;
|
||||||
OnPlotFormatSelection( cmd_event );
|
OnPlotFormatSelection( cmd_event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: Copy of DIALOG_PLOT::OnOutputDirectoryBrowseClicked in dialog_plot.cpp, maybe merge to a common method.
|
||||||
|
*/
|
||||||
|
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
// Build the absolute path of current output plot directory
|
||||||
|
// to preselect it when opening the dialog.
|
||||||
|
wxFileName fn( m_outputDirectoryName->GetValue() );
|
||||||
|
wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
|
||||||
|
|
||||||
|
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
||||||
|
|
||||||
|
if( dirDialog.ShowModal() == wxID_CANCEL )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
||||||
|
|
||||||
|
wxMessageDialog dialog( this, _( "Use a relative path? " ),
|
||||||
|
_( "Plot Output Directory" ),
|
||||||
|
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
||||||
|
|
||||||
|
// relative directory selected
|
||||||
|
if( dialog.ShowModal() == wxID_YES )
|
||||||
|
{
|
||||||
|
|
||||||
|
wxString plotFilePath = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
|
||||||
|
+ PS_PLOTTER::GetDefaultFileExtension();
|
||||||
|
|
||||||
|
plotFilePath = Prj().AbsolutePath(plotFilePath);
|
||||||
|
plotFilePath = wxPathOnly( plotFilePath );
|
||||||
|
|
||||||
|
if( !dirName.MakeRelativeTo( plotFilePath ) )
|
||||||
|
wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ),
|
||||||
|
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
|
||||||
|
}
|
||||||
|
|
||||||
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
|
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
|
||||||
{
|
{
|
||||||
|
@ -161,7 +213,6 @@ PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::OnButtonCancelClick( wxCommandEvent& event )
|
void DIALOG_PLOT_SCHEMATIC::OnButtonCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
getPlotOptions();
|
|
||||||
EndModal( wxID_CANCEL );
|
EndModal( wxID_CANCEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +230,16 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
|
||||||
|
|
||||||
m_pageSizeSelect = m_PaperSizeOption->GetSelection();
|
m_pageSizeSelect = m_PaperSizeOption->GetSelection();
|
||||||
SetDefaultLineThickness( ValueFromTextCtrl( *m_DefaultLineSizeCtrl ) );
|
SetDefaultLineThickness( ValueFromTextCtrl( *m_DefaultLineSizeCtrl ) );
|
||||||
|
|
||||||
|
// Plot directory
|
||||||
|
wxString path = m_outputDirectoryName->GetValue();
|
||||||
|
path.Replace( '\\', '/' );
|
||||||
|
|
||||||
|
if( m_parent->GetPlotDirectoryName() != path )
|
||||||
|
m_configChanged = true;
|
||||||
|
|
||||||
|
m_parent->SetPlotDirectoryName( path );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,12 +311,6 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
|
||||||
createHPGLFile( aPlotAll, getPlotFrameRef() );
|
createHPGLFile( aPlotAll, getPlotFrameRef() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
// Fall through. Default to Postscript.
|
|
||||||
case PLOT_FORMAT_POST:
|
|
||||||
createPSFile( aPlotAll, getPlotFrameRef() );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PLOT_FORMAT_DXF:
|
case PLOT_FORMAT_DXF:
|
||||||
CreateDXFFile( aPlotAll, getPlotFrameRef() );
|
CreateDXFFile( aPlotAll, getPlotFrameRef() );
|
||||||
break;
|
break;
|
||||||
|
@ -267,7 +322,31 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
|
||||||
case PLOT_FORMAT_SVG:
|
case PLOT_FORMAT_SVG:
|
||||||
createSVGFile( aPlotAll, getPlotFrameRef() );
|
createSVGFile( aPlotAll, getPlotFrameRef() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PLOT_FORMAT_POST:
|
||||||
|
// Fall through. Default to Postscript.
|
||||||
|
default:
|
||||||
|
createPSFile( aPlotAll, getPlotFrameRef() );
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MessagesBox->AppendText( wxT( "****\n" ) );
|
m_MessagesBox->AppendText( wxT( "****\n" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxTextCtrl* aOutputDirectoryName,
|
||||||
|
wxString& aPlotFileName,
|
||||||
|
wxString& aExtension,
|
||||||
|
REPORTER* aReporter )
|
||||||
|
{
|
||||||
|
wxString outputDirName = aOutputDirectoryName->GetValue();
|
||||||
|
wxFileName outputDir = wxFileName::DirName( outputDirName );
|
||||||
|
|
||||||
|
wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT(".") + aExtension);
|
||||||
|
|
||||||
|
EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter );
|
||||||
|
wxFileName fn( plotFileName );
|
||||||
|
fn.SetPath( outputDir.GetFullPath() );
|
||||||
|
return fn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
|
* Copyright (C) 1992-2014 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@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
*
|
*
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
#include <class_sch_screen.h>
|
#include <class_sch_screen.h>
|
||||||
#include <wxEeschemaStruct.h>
|
#include <wxEeschemaStruct.h>
|
||||||
#include <dialog_plot_schematic_base.h>
|
#include <dialog_plot_schematic_base.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
||||||
enum PageFormatReq {
|
enum PageFormatReq {
|
||||||
|
@ -46,7 +47,8 @@ class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SCH_EDIT_FRAME* m_parent;
|
SCH_EDIT_FRAME* m_parent;
|
||||||
wxConfigBase* m_config;
|
wxConfigBase* m_config;
|
||||||
|
bool m_configChanged; // true if a project config param has changed
|
||||||
static int m_pageSizeSelect; // Static to keep last option for some format:
|
static int m_pageSizeSelect; // Static to keep last option for some format:
|
||||||
// Static to keep last option:
|
// Static to keep last option:
|
||||||
// use default size or force A or A4 size
|
// use default size or force A or A4 size
|
||||||
|
@ -57,6 +59,9 @@ public:
|
||||||
// / Constructors
|
// / Constructors
|
||||||
DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent );
|
DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent );
|
||||||
|
|
||||||
|
bool PrjConfigChanged() { return m_configChanged; } // return true if the prj config was modified
|
||||||
|
// and therefore should be saved
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPlotFormatSelection( wxCommandEvent& event );
|
void OnPlotFormatSelection( wxCommandEvent& event );
|
||||||
void OnButtonPlotCurrentClick( wxCommandEvent& event );
|
void OnButtonPlotCurrentClick( wxCommandEvent& event );
|
||||||
|
@ -74,6 +79,11 @@ private:
|
||||||
void setModeColor( bool aColor )
|
void setModeColor( bool aColor )
|
||||||
{ m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
|
{ m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the m_outputDirectoryName variable to the selected directory from directory dialog.
|
||||||
|
*/
|
||||||
|
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
|
||||||
|
|
||||||
PlotFormat GetPlotFileFormat();
|
PlotFormat GetPlotFileFormat();
|
||||||
|
|
||||||
bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
|
bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
|
||||||
|
@ -86,6 +96,15 @@ private:
|
||||||
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
|
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
|
||||||
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
|
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Everything done, close the plot and restore the environment
|
||||||
|
* @param aPlotter the plotter to close and destroy
|
||||||
|
* @param aOldsheetpath the stored old sheet path for the current sheet before the plot started
|
||||||
|
* @param aMsg the message which is print to the message box
|
||||||
|
*/
|
||||||
|
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH aOldsheetpath,
|
||||||
|
const wxString& aMsg );
|
||||||
|
|
||||||
// DXF
|
// DXF
|
||||||
void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef );
|
void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef );
|
||||||
bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
|
bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||||
|
@ -96,10 +115,12 @@ private:
|
||||||
{
|
{
|
||||||
return m_plotOriginOpt->GetSelection() == 1;
|
return m_plotOriginOpt->GetSelection() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPlotOriginCenter( bool aCenter )
|
void SetPlotOriginCenter( bool aCenter )
|
||||||
{
|
{
|
||||||
m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
|
m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef );
|
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef );
|
||||||
void SetHPGLPenWidth();
|
void SetHPGLPenWidth();
|
||||||
bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
|
bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||||
|
@ -115,6 +136,20 @@ private:
|
||||||
// SVG
|
// SVG
|
||||||
void createSVGFile( bool aPlotAll, bool aPlotFrameRef );
|
void createSVGFile( bool aPlotAll, bool aPlotFrameRef );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a file name with an absolute path name
|
||||||
|
* @param aOutputDirectoryName the diretory name to plot,
|
||||||
|
* this can be a relative name of the current project diretory or an absolute directory name.
|
||||||
|
* @param aPlotFileName the name for the file to plot without a path
|
||||||
|
* @param aExtension the extension for the file to plot
|
||||||
|
* @param aReporter a point to a REPORTER object use to show messages (can be NULL)
|
||||||
|
* @return the created file name
|
||||||
|
* @throw IO_ERROR on file I/O errors
|
||||||
|
*/
|
||||||
|
wxFileName createPlotFileName( wxTextCtrl* aOutputDirectoryName,
|
||||||
|
wxString& aPlotFileName,
|
||||||
|
wxString& aExtension, REPORTER* aReporter = NULL );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This function is static because it is called by libedit
|
// This function is static because it is called by libedit
|
||||||
// outside a dialog. This is the reason we need aFrame as parameter
|
// outside a dialog. This is the reason we need aFrame as parameter
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Sep 11 2014)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -16,6 +16,31 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||||
wxBoxSizer* bMainSizer;
|
wxBoxSizer* bMainSizer;
|
||||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer6;
|
||||||
|
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_staticTextOutputDirectory = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextOutputDirectory->Wrap( -1 );
|
||||||
|
bSizer6->Add( m_staticTextOutputDirectory, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer5;
|
||||||
|
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_outputDirectoryName->SetMaxLength( 0 );
|
||||||
|
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the schematic file location.") );
|
||||||
|
|
||||||
|
bSizer5->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizer5->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizer6->Add( bSizer5, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bMainSizer->Add( bSizer6, 0, wxEXPAND|wxLEFT|wxTOP, 5 );
|
||||||
|
|
||||||
m_optionsSizer = new wxBoxSizer( wxHORIZONTAL );
|
m_optionsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
m_paperOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Options") ), wxVERTICAL );
|
m_paperOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Options") ), wxVERTICAL );
|
||||||
|
@ -136,6 +161,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
|
||||||
|
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
|
||||||
m_HPGLPaperSizeOption->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
|
m_HPGLPaperSizeOption->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
|
||||||
m_plotFormatOpt->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
|
m_plotFormatOpt->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
|
||||||
m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
|
m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
|
||||||
|
@ -147,6 +173,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::~DIALOG_PLOT_SCHEMATIC_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
|
||||||
|
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
|
||||||
m_HPGLPaperSizeOption->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
|
m_HPGLPaperSizeOption->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
|
||||||
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
|
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
|
||||||
m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
|
m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
|
||||||
|
|
|
@ -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="11" />
|
<FileVersion major="1" minor="13" />
|
||||||
<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>
|
||||||
|
@ -20,8 +20,10 @@
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header"></property>
|
<property name="precompiled_header"></property>
|
||||||
<property name="relative_path">1</property>
|
<property name="relative_path">1</property>
|
||||||
|
<property name="skip_lua_events">1</property>
|
||||||
<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="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">
|
||||||
|
@ -91,6 +93,290 @@
|
||||||
<property name="name">bMainSizer</property>
|
<property name="name">bMainSizer</property>
|
||||||
<property name="orient">wxVERTICAL</property>
|
<property name="orient">wxVERTICAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxBoxSizer" expanded="1">
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">bSizer6</property>
|
||||||
|
<property name="orient">wxVERTICAL</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticText" 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="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">1</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">Output directory:</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_staticTextOutputDirectory</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"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<property name="wrap">-1</property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<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">bSizer5</property>
|
||||||
|
<property name="orient">wxHORIZONTAL</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||||
|
<property name="proportion">1</property>
|
||||||
|
<object class="wxTextCtrl" 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="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">1</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="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="maxlength">0</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_outputDirectoryName</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"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip">Target directory for plot files. Can be absolute or relative to the schematic file location.</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="value"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnText"></event>
|
||||||
|
<event name="OnTextEnter"></event>
|
||||||
|
<event name="OnTextMaxLen"></event>
|
||||||
|
<event name="OnTextURL"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxButton" 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="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="default">0</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">1</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">Browse...</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_browseButton</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"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></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>
|
||||||
|
<event name="OnButtonClick">OnOutputDirectoryBrowseClicked</event>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
|
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Sep 11 2014)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -15,18 +15,18 @@ class DIALOG_SHIM;
|
||||||
|
|
||||||
#include "dialog_shim.h"
|
#include "dialog_shim.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/radiobox.h>
|
#include <wx/stattext.h>
|
||||||
#include <wx/gdicmn.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>
|
||||||
#include <wx/stattext.h>
|
|
||||||
#include <wx/choice.h>
|
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
#include <wx/button.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/radiobox.h>
|
||||||
|
#include <wx/choice.h>
|
||||||
#include <wx/statbox.h>
|
#include <wx/statbox.h>
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/button.h>
|
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -45,6 +45,9 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
|
||||||
wxID_PRINT_ALL
|
wxID_PRINT_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wxStaticText* m_staticTextOutputDirectory;
|
||||||
|
wxTextCtrl* m_outputDirectoryName;
|
||||||
|
wxButton* m_browseButton;
|
||||||
wxBoxSizer* m_optionsSizer;
|
wxBoxSizer* m_optionsSizer;
|
||||||
wxStaticBoxSizer* m_paperOptionsSizer;
|
wxStaticBoxSizer* m_paperOptionsSizer;
|
||||||
wxRadioBox* m_PaperSizeOption;
|
wxRadioBox* m_PaperSizeOption;
|
||||||
|
@ -68,6 +71,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
|
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnHPGLPageSelected( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnHPGLPageSelected( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnPlotFormatSelection( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnPlotFormatSelection( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
|
@ -415,6 +415,9 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParametersList()
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
||||||
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
||||||
|
|
||||||
|
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ),
|
||||||
|
&m_plotDirectoryName ) );
|
||||||
|
|
||||||
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
|
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
|
||||||
LIB_PART::SubpartIdSeparatorPtr(),
|
LIB_PART::SubpartIdSeparatorPtr(),
|
||||||
0, 0, 126 ) );
|
0, 0, 126 ) );
|
||||||
|
|
|
@ -40,7 +40,6 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SHEET_PATH* sheetpath;
|
SCH_SHEET_PATH* sheetpath;
|
||||||
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
|
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
|
||||||
wxString plotFileName;
|
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
* In complex hierarchies, we must setup references and others parameters
|
* In complex hierarchies, we must setup references and others parameters
|
||||||
|
@ -52,6 +51,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
SCH_SHEET_PATH list;
|
SCH_SHEET_PATH list;
|
||||||
|
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||||
|
|
||||||
while( true )
|
while( true )
|
||||||
{
|
{
|
||||||
|
@ -78,23 +78,39 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(".")
|
|
||||||
+ DXF_PLOTTER::GetDefaultFileExtension();
|
|
||||||
|
|
||||||
plotFileName = Prj().AbsolutePath( plotFileName );
|
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( PlotOneSheetDXF( plotFileName, screen, plot_offset, 1.0, aPlotFrameRef ) )
|
try
|
||||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) );
|
{
|
||||||
else // Error
|
wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
|
||||||
msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) );
|
wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
|
||||||
|
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
|
||||||
m_MessagesBox->AppendText( msg );
|
ext, &reporter );
|
||||||
|
|
||||||
|
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0, aPlotFrameRef ) )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Plot: '%s' OK\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
else // Error
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Unable to create '%s'\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (IO_ERROR& e)
|
||||||
|
{
|
||||||
|
msg.Printf( _( "DXF Plotter Exception : '%s'"), wxString(e.errorText ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
schframe->SetCurrentSheet( oldsheetpath );
|
||||||
|
schframe->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
|
schframe->SetSheetNumberAndCount();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if( !aPlotAll )
|
if( !aPlotAll )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
schframe->SetCurrentSheet( oldsheetpath );
|
schframe->SetCurrentSheet( oldsheetpath );
|
||||||
|
|
|
@ -110,7 +110,6 @@ void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth()
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
wxString plotFileName;
|
|
||||||
SCH_SCREEN* screen = m_parent->GetScreen();
|
SCH_SCREEN* screen = m_parent->GetScreen();
|
||||||
SCH_SHEET_PATH* sheetpath;
|
SCH_SHEET_PATH* sheetpath;
|
||||||
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
|
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
|
||||||
|
@ -125,6 +124,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
SCH_SHEET_PATH list;
|
SCH_SHEET_PATH list;
|
||||||
|
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||||
|
|
||||||
SetHPGLPenWidth();
|
SetHPGLPenWidth();
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
|
|
||||||
// Calculate offsets
|
// Calculate offsets
|
||||||
wxPoint plotOffset;
|
wxPoint plotOffset;
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
if( GetPlotOriginCenter() )
|
if( GetPlotOriginCenter() )
|
||||||
{
|
{
|
||||||
|
@ -174,24 +175,32 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
plotOffset.y = -plotPage.GetHeightIU() / 2;
|
plotOffset.y = -plotPage.GetHeightIU() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
|
try
|
||||||
+ HPGL_PLOTTER::GetDefaultFileExtension();
|
{
|
||||||
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
|
wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
|
||||||
|
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
|
||||||
|
ext, &reporter );
|
||||||
|
|
||||||
plotFileName = Prj().AbsolutePath( plotFileName );
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset,
|
||||||
|
plot_scale, aPlotFrameRef ) )
|
||||||
|
msg.Printf( _( "Plot: '%s' OK\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
else // Error
|
||||||
|
msg.Printf( _( "Unable to create '%s'\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
|
||||||
wxString msg;
|
m_MessagesBox->AppendText( msg );
|
||||||
if( Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset,
|
|
||||||
plot_scale, aPlotFrameRef ) )
|
|
||||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) );
|
|
||||||
else // Error
|
|
||||||
msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) );
|
|
||||||
|
|
||||||
m_MessagesBox->AppendText( msg );
|
if( !aPlotAll )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (IO_ERROR& e)
|
||||||
|
{
|
||||||
|
msg.Printf( _( "HPGL Plotter Exception : '%s'"), wxString(e.errorText ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
}
|
||||||
|
|
||||||
if( !aPlotAll )
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->SetCurrentSheet( oldsheetpath );
|
m_parent->SetCurrentSheet( oldsheetpath );
|
||||||
|
|
|
@ -60,7 +60,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
|
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString plotFileName;
|
wxFileName plotFileName;
|
||||||
|
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||||
|
|
||||||
// First page handling is different
|
// First page handling is different
|
||||||
bool first_page = true;
|
bool first_page = true;
|
||||||
|
@ -86,24 +87,37 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
|
|
||||||
if( first_page )
|
if( first_page )
|
||||||
{
|
{
|
||||||
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
|
|
||||||
+ PDF_PLOTTER::GetDefaultFileExtension();
|
|
||||||
|
|
||||||
plotFileName = Prj().AbsolutePath( plotFileName );
|
try
|
||||||
|
|
||||||
if( !plotter->OpenFile( plotFileName ) )
|
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) );
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
m_MessagesBox->AppendText( msg );
|
wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
|
||||||
delete plotter;
|
plotFileName = createPlotFileName( m_outputDirectoryName,
|
||||||
|
fname, ext, &reporter );
|
||||||
|
|
||||||
|
if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Unable to create '%s'\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
delete plotter;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open the plotter and do the first page
|
||||||
|
SetLocaleTo_C_standard();
|
||||||
|
setupPlotPagePDF( plotter, screen );
|
||||||
|
plotter->StartPlot();
|
||||||
|
first_page = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (const IO_ERROR& e)
|
||||||
|
{
|
||||||
|
// Cannot plot PDF file
|
||||||
|
msg.Printf( _( "PDF Plotter Exception : <%s>"), wxString(e.errorText ) );
|
||||||
|
restoreEnvironment(plotter, oldsheetpath, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the plotter and do the first page
|
|
||||||
SetLocaleTo_C_standard();
|
|
||||||
setupPlotPagePDF( plotter, screen );
|
|
||||||
plotter->StartPlot();
|
|
||||||
first_page = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -118,17 +132,25 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
} while( aPlotAll && sheetpath );
|
} while( aPlotAll && sheetpath );
|
||||||
|
|
||||||
// Everything done, close the plot and restore the environment
|
// Everything done, close the plot and restore the environment
|
||||||
plotter->EndPlot();
|
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
delete plotter;
|
restoreEnvironment(plotter, oldsheetpath, msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
|
||||||
|
SCH_SHEET_PATH aOldsheetpath, const wxString& aMsg )
|
||||||
|
{
|
||||||
|
aPlotter->EndPlot();
|
||||||
|
delete aPlotter;
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
|
|
||||||
// Restore the previous sheet
|
// Restore the previous sheet
|
||||||
m_parent->SetCurrentSheet( oldsheetpath );
|
m_parent->SetCurrentSheet( aOldsheetpath );
|
||||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
m_parent->SetSheetNumberAndCount();
|
m_parent->SetSheetNumberAndCount();
|
||||||
|
|
||||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) );
|
m_MessagesBox->AppendText( aMsg );
|
||||||
m_MessagesBox->AppendText( msg );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
#include <dialog_plot_schematic.h>
|
#include <dialog_plot_schematic.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
|
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
|
@ -39,7 +40,6 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
SCH_SCREEN* screen = m_parent->GetScreen();
|
SCH_SCREEN* screen = m_parent->GetScreen();
|
||||||
SCH_SHEET_PATH* sheetpath;
|
SCH_SHEET_PATH* sheetpath;
|
||||||
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
||||||
wxString plotFileName;
|
|
||||||
PAGE_INFO actualPage; // page size selected in schematic
|
PAGE_INFO actualPage; // page size selected in schematic
|
||||||
PAGE_INFO plotPage; // page size selected to plot
|
PAGE_INFO plotPage; // page size selected to plot
|
||||||
|
|
||||||
|
@ -102,21 +102,38 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
double scale = std::min( scalex, scaley );
|
double scale = std::min( scalex, scaley );
|
||||||
|
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
|
|
||||||
+ PS_PLOTTER::GetDefaultFileExtension();
|
|
||||||
|
|
||||||
plotFileName = Prj().AbsolutePath( plotFileName );
|
wxString outputDirName = m_outputDirectoryName->GetValue();
|
||||||
|
wxFileName outputDir = wxFileName::DirName( outputDirName );
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||||
|
|
||||||
if( plotOneSheetPS( plotFileName, screen, plotPage, plot_offset,
|
try
|
||||||
scale, aPlotFrameRef ) )
|
{
|
||||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) );
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
else // Error
|
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
|
||||||
msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) );
|
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
|
||||||
|
fname, ext, &reporter );
|
||||||
|
|
||||||
m_MessagesBox->AppendText( msg );
|
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, plotPage, plot_offset,
|
||||||
|
scale, aPlotFrameRef ) )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Plot: '%s' OK\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Error
|
||||||
|
msg.Printf( _( "Unable to create '%s'\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
}
|
||||||
|
catch (IO_ERROR& e)
|
||||||
|
{
|
||||||
|
msg.Printf( _( "PS Plotter Exception : '%s'"), wxString(e.errorText ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
}
|
||||||
|
|
||||||
if( !aPlotAll )
|
if( !aPlotAll )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
|
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxFileName fn;
|
|
||||||
|
|
||||||
if( aPrintAll )
|
if( aPrintAll )
|
||||||
{
|
{
|
||||||
|
@ -52,11 +51,14 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
|
||||||
SCH_SHEET_LIST SheetList( NULL );
|
SCH_SHEET_LIST SheetList( NULL );
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
SCH_SHEET_PATH list;
|
SCH_SHEET_PATH list;
|
||||||
|
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||||
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
if( sheetpath == NULL )
|
if( sheetpath == NULL )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
list.Clear();
|
list.Clear();
|
||||||
|
@ -69,30 +71,47 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
|
||||||
screen = m_parent->GetCurrentSheet().LastScreen();
|
screen = m_parent->GetCurrentSheet().LastScreen();
|
||||||
}
|
}
|
||||||
else // Should not happen
|
else // Should not happen
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
|
|
||||||
wxString fileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( ".svg" );
|
try
|
||||||
|
|
||||||
fn = Prj().AbsolutePath( fileName );
|
|
||||||
|
|
||||||
bool success = plotOneSheetSVG( m_parent, fn.GetFullPath(), screen,
|
|
||||||
getModeColor() ? false : true,
|
|
||||||
aPrintFrameRef );
|
|
||||||
|
|
||||||
if( !success )
|
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Error creating file <%s>\n" ),
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
GetChars( fn.GetFullPath() ) );
|
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
||||||
}
|
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
|
||||||
else
|
fname, ext, &reporter );
|
||||||
{
|
|
||||||
msg.Printf( _( "File <%s> OK\n" ),
|
|
||||||
GetChars( fn.GetFullPath() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_MessagesBox->AppendText( msg );
|
bool success = plotOneSheetSVG( m_parent, plotFileName.GetFullPath(), screen,
|
||||||
|
getModeColor() ? false : true,
|
||||||
|
aPrintFrameRef );
|
||||||
|
|
||||||
|
if( !success )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Error creating file '%s'\n" ),
|
||||||
|
GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.Printf( _( "File '%s' OK\n" ),
|
||||||
|
GetChars( plotFileName.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
}
|
||||||
|
catch (const IO_ERROR& e)
|
||||||
|
{
|
||||||
|
// Cannot plot SVG file
|
||||||
|
msg.Printf( _( "SVG Plotter Exception : '%s'" ), wxString( e.errorText ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
|
||||||
|
m_parent->SetCurrentSheet( oldsheetpath );
|
||||||
|
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
|
m_parent->SetSheetNumberAndCount();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->SetCurrentSheet( oldsheetpath );
|
m_parent->SetCurrentSheet( oldsheetpath );
|
||||||
|
@ -103,21 +122,34 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = (SCH_SCREEN*) m_parent->GetScreen();
|
SCH_SCREEN* screen = (SCH_SCREEN*) m_parent->GetScreen();
|
||||||
|
|
||||||
fn = screen->GetFileName();
|
try
|
||||||
fn.SetExt( wxT( "svg" ) );
|
{
|
||||||
fn.MakeAbsolute();
|
wxString fname = screen->GetFileName();
|
||||||
|
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
||||||
|
wxFileName fn = createPlotFileName( m_outputDirectoryName, fname, ext );
|
||||||
|
|
||||||
bool success = plotOneSheetSVG( m_parent, fn.GetFullPath(), screen,
|
bool success = plotOneSheetSVG( m_parent, fn.GetFullPath(), screen,
|
||||||
getModeColor() ? false : true,
|
getModeColor() ? false : true,
|
||||||
aPrintFrameRef );
|
aPrintFrameRef );
|
||||||
if( success )
|
if( success )
|
||||||
msg.Printf( _( "Plot: <%s> OK\n" ),
|
{
|
||||||
GetChars( fn.GetFullPath() ) );
|
msg.Printf( _( "Plot: <%s> OK\n" ),
|
||||||
else // Error
|
GetChars( fn.GetFullPath() ) );
|
||||||
msg.Printf( _( "Unable to create <%s>\n" ),
|
}
|
||||||
GetChars( fn.GetFullPath() ) );
|
else // Error
|
||||||
|
{
|
||||||
m_MessagesBox->AppendText( msg );
|
msg.Printf( _( "Unable to create <%s>\n" ),
|
||||||
|
GetChars( fn.GetFullPath() ) );
|
||||||
|
}
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
}
|
||||||
|
catch (const IO_ERROR& e)
|
||||||
|
{
|
||||||
|
// Cannot plot SVG file
|
||||||
|
msg.Printf( _( "SVG Plotter Exception : <%s>"), wxString(e.errorText ) );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
class wxAboutDialogInfo;
|
class wxAboutDialogInfo;
|
||||||
class SEARCH_STACK;
|
class SEARCH_STACK;
|
||||||
class wxSingleInstanceChecker;
|
class wxSingleInstanceChecker;
|
||||||
|
class REPORTER;
|
||||||
|
|
||||||
|
|
||||||
// Flag for special keys
|
// Flag for special keys
|
||||||
|
@ -599,6 +600,19 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack );
|
||||||
*/
|
*/
|
||||||
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
|
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function EnsureFileDirectoryExists
|
||||||
|
* make \a aTargetFullFileName absolute and creates the path of this file if it doesn't yet exist.
|
||||||
|
* @param aTargetFullFileName the wxFileName containing the full path and file name to modify. The path
|
||||||
|
* may be absolute or relative to \a aBaseFilename .
|
||||||
|
* @param aBaseFilename a full filename. Only its path is used to set the aTargetFullFileName path.
|
||||||
|
* @param aReporter a point to a REPORTER object use to show messages (can be NULL)
|
||||||
|
* @return true if \a aOutputDir already exists or was successfully created.
|
||||||
|
*/
|
||||||
|
bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
|
||||||
|
const wxString& aBaseFilename,
|
||||||
|
REPORTER* aReporter = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function LockFile
|
* Function LockFile
|
||||||
* tests to see if aFileName can be locked (is not already locked) and only then
|
* tests to see if aFileName can be locked (is not already locked) and only then
|
||||||
|
|
|
@ -152,6 +152,9 @@ private:
|
||||||
/// Flag to indicate show hidden pins.
|
/// Flag to indicate show hidden pins.
|
||||||
bool m_showAllPins;
|
bool m_showAllPins;
|
||||||
|
|
||||||
|
/// The name of the destination directory to use when generating plot files.
|
||||||
|
wxString m_plotDirectoryName;
|
||||||
|
|
||||||
/// The name of the format to use when generating a net list.
|
/// The name of the format to use when generating a net list.
|
||||||
wxString m_netListFormat;
|
wxString m_netListFormat;
|
||||||
|
|
||||||
|
@ -239,6 +242,10 @@ public:
|
||||||
void SetComponentLibraries( const wxArrayString& aList ) { m_componentLibFiles = aList; }
|
void SetComponentLibraries( const wxArrayString& aList ) { m_componentLibFiles = aList; }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// accessor to the destination directory to use when generating plot files.
|
||||||
|
const wxString& GetPlotDirectoryName() const { return m_plotDirectoryName; }
|
||||||
|
void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; }
|
||||||
|
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
void OnColorConfig( wxCommandEvent& aEvent );
|
void OnColorConfig( wxCommandEvent& aEvent );
|
||||||
void Process_Config( wxCommandEvent& event );
|
void Process_Config( wxCommandEvent& event );
|
||||||
|
|
|
@ -268,7 +268,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
|
||||||
|
|
||||||
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
||||||
|
|
||||||
if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
|
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format(
|
wxString msg = wxString::Format(
|
||||||
_( "Could not write plot files to folder '%s'." ),
|
_( "Could not write plot files to folder '%s'." ),
|
||||||
|
|
|
@ -711,7 +711,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
||||||
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
||||||
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
||||||
|
|
||||||
if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
|
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
|
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
|
||||||
|
|
|
@ -212,7 +212,7 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles()
|
||||||
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
||||||
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
||||||
|
|
||||||
if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
|
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
|
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
|
||||||
GetChars( outputDir.GetPath() ) );
|
GetChars( outputDir.GetPath() ) );
|
||||||
|
|
|
@ -214,56 +214,6 @@ void BuildPlotFileName( wxFileName* aFilename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EnsureOutputDirectory( wxFileName* aOutputDir,
|
|
||||||
const wxString& aBoardFilename,
|
|
||||||
REPORTER* aReporter )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
wxString boardFilePath = wxFileName( aBoardFilename ).GetPath();
|
|
||||||
|
|
||||||
if( !aOutputDir->MakeAbsolute( boardFilePath ) )
|
|
||||||
{
|
|
||||||
if( aReporter )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "*** Error: cannot make path '%s' absolute with respect to '%s'! ***" ),
|
|
||||||
GetChars( aOutputDir->GetPath() ),
|
|
||||||
GetChars( boardFilePath ) );
|
|
||||||
aReporter->Report( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString outputPath( aOutputDir->GetPath() );
|
|
||||||
|
|
||||||
if( !wxFileName::DirExists( outputPath ) )
|
|
||||||
{
|
|
||||||
if( wxMkdir( outputPath ) )
|
|
||||||
{
|
|
||||||
if( aReporter )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Output directory '%s' created.\n" ), GetChars( outputPath ) );
|
|
||||||
aReporter->Report( msg );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( aReporter )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "*** Error: cannot create output directory '%s'! ***\n" ),
|
|
||||||
GetChars( outputPath ) );
|
|
||||||
aReporter->Report( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PLOT_CONTROLLER::PLOT_CONTROLLER( BOARD *aBoard )
|
PLOT_CONTROLLER::PLOT_CONTROLLER( BOARD *aBoard )
|
||||||
: m_plotter( NULL ), m_board( aBoard )
|
: m_plotter( NULL ), m_board( aBoard )
|
||||||
{
|
{
|
||||||
|
@ -313,7 +263,7 @@ bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix,
|
||||||
wxFileName outputDir = wxFileName::DirName( outputDirName );
|
wxFileName outputDir = wxFileName::DirName( outputDirName );
|
||||||
wxString boardFilename = m_board->GetFileName();
|
wxString boardFilename = m_board->GetFileName();
|
||||||
|
|
||||||
if( EnsureOutputDirectory( &outputDir, boardFilename ) )
|
if( EnsureFileDirectoryExists( &outputDir, boardFilename ) )
|
||||||
{
|
{
|
||||||
wxFileName fn( boardFilename );
|
wxFileName fn( boardFilename );
|
||||||
BuildPlotFileName( &fn, outputDirName, aSuffix, GetDefaultPlotExtension( aFormat ) );
|
BuildPlotFileName( &fn, outputDirName, aSuffix, GetDefaultPlotExtension( aFormat ) );
|
||||||
|
|
|
@ -227,19 +227,6 @@ void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
||||||
const PCB_PLOT_PARAMS& aPlotOpt );
|
const PCB_PLOT_PARAMS& aPlotOpt );
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function EnsureOutputDirectory (helper function)
|
|
||||||
* make \a OutputDir absolute and creates the path if it doesn't exist.
|
|
||||||
* @param aOutputDir the wxFileName containing the full path and file name to modify. The path
|
|
||||||
* may be absolute or relative to \a aBoardFilename .
|
|
||||||
* @param aBoardFilename the board full path and filename.
|
|
||||||
* @param aReporter a point to a REPORTER object use to show messages (can be NULL)
|
|
||||||
* @return true if \a aOutputDir already exists or was successfully created.
|
|
||||||
*/
|
|
||||||
bool EnsureOutputDirectory( wxFileName* aOutputDir,
|
|
||||||
const wxString& aBoardFilename,
|
|
||||||
REPORTER* aReporter = NULL );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function BuildPlotFileName (helper function)
|
* Function BuildPlotFileName (helper function)
|
||||||
* Complete a plot filename: forces the output directory,
|
* Complete a plot filename: forces the output directory,
|
||||||
|
|
Loading…
Reference in New Issue