Commit b080f860 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: enhanced dialog for SVG export

parent e435a104
This diff is collapsed.
......@@ -14,11 +14,14 @@ class wxConfig;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config;
long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32];
PCB_BASE_FRAME* m_parent;
BOARD* m_board;
wxConfig* m_config;
long m_printMaskLayer;
wxCheckBox* m_boxSelectLayer[32];
bool m_printBW;
wxString m_outputDirectory;
// Static member to store options
static bool m_printMirror;
static bool m_oneFileOnly;
......@@ -32,6 +35,7 @@ private:
void initDialog( );
void OnButtonPlot( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void SetPenWidth();
void ExportSVGFile( bool aOnlyOneFile );
bool PageIsBoardBoundarySize()
......
......@@ -16,6 +16,25 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextDir = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDir->Wrap( -1 );
bMainSizer->Add( m_staticTextDir, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetToolTip( _("Enter a filename if you do not want to use default file names\nCan be used only when printing the current sheet") );
m_outputDirectoryName->SetMinSize( wxSize( 450,-1 ) );
bSizer4->Add( m_outputDirectoryName, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_browseButton, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bSizer4, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -94,24 +113,14 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
bMainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FileNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FileNameCtrl->SetToolTip( _("Enter a filename if you do not want to use default file names\nCan be used only when printing the current sheet") );
m_FileNameCtrl->SetMinSize( wxSize( 450,-1 ) );
bMainSizer->Add( m_FileNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bMainSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_MessagesBox->SetMinSize( wxSize( -1,100 ) );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_messagesBox->SetMinSize( wxSize( -1,100 ) );
bMainSizer->Add( m_MessagesBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainSizer->Add( m_messagesBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
......@@ -119,6 +128,7 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnOutputDirectoryBrowseClicked ), NULL, this );
m_buttonCreateFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlot ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
}
......@@ -127,6 +137,7 @@ DIALOG_SVG_PRINT_base::~DIALOG_SVG_PRINT_base()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnOutputDirectoryBrowseClicked ), NULL, this );
m_buttonCreateFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlot ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
......
This diff is collapsed.
......@@ -13,17 +13,17 @@
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/gdicmn.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -41,6 +41,9 @@ class DIALOG_SVG_PRINT_base : public DIALOG_SHIM
wxID_PRINT_BOARD = 1000
};
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_CopperLayersBoxSizer;
wxStaticBoxSizer* m_TechnicalBoxSizer;
wxStaticText* m_TextPenWidth;
......@@ -52,13 +55,12 @@ class DIALOG_SVG_PRINT_base : public DIALOG_SHIM
wxRadioBox* m_rbFileOpt;
wxButton* m_buttonCreateFile;
wxButton* m_buttonQuit;
wxStaticText* m_staticText1;
wxTextCtrl* m_FileNameCtrl;
wxStaticText* m_staticText2;
wxTextCtrl* m_MessagesBox;
wxTextCtrl* m_messagesBox;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlot( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
......
......@@ -111,8 +111,9 @@ static wxString GetGerberExtension( int layer )/*{{{*/
/* Complete a plot filename: forces the output directory,
* add a suffix to the name and sets the specified extension
* the suffix is usually the layer name
* replaces not allowed chars in suffix by '_'
*/
static void BuildPlotFileName( wxFileName *aFilename,
void BuildPlotFileName( wxFileName *aFilename,
const wxString& aOutputDir,
const wxString& aSuffix,
const wxString& aExtension )
......@@ -139,8 +140,11 @@ static void BuildPlotFileName( wxFileName *aFilename,
aFilename->SetName( aFilename->GetName() + wxT( "-" ) + suffix );
}
/** Fix the output directory pathname to absolute and ensure it exists */
static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
/*
* Fix the output directory pathname to absolute and ensure it exists
* (Creates it if not exists)
*/
bool EnsureOutputDirectory( wxFileName *aOutputDir,
const wxString& aBoardFilename,
wxTextCtrl* aMessageBox )
{
......@@ -171,13 +175,14 @@ static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
}
else
{
if( aMessageBox )
wxMessageBox( _( "Cannot create output directory!" ),
_( "Plot" ), wxOK | wxICON_ERROR );
return false;
}
}
return true;
}/*}}}*/
}
/*
* DIALOG_PLOT:Plot
......
......@@ -187,6 +187,36 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
* Function EnsureOutputDirectory (helper function)
* Fix the output directory pathname to absolute and ensure it exists
* (Creates it if not exists)
* @param aOutputDir = the wxFileName to modify
* (contains the absolute or relative to the board path
* @param aBoardFilename = the board full filename
* @param aMessageBox = a wxMessageBox to show meesage (can be NULL)
*/
bool EnsureOutputDirectory( wxFileName *aOutputDir,
const wxString& aBoardFilename,
wxTextCtrl* aMessageBox );
/**
* Function BuildPlotFileName (helper function)
* Complete a plot filename: forces the output directory,
* add a suffix to the name and sets the specified extension
* the suffix is usually the layer name
* replaces not allowed chars in suffix by '_'
* @param aFilename = the wxFileName to initialize
* Contians the base filename
* @param aOutputDir = the path
* @param aSuffix = the suffix to add to the base filename
* @param aExtension = the file extension
*/
void BuildPlotFileName( wxFileName *aFilename,
const wxString& aOutputDir,
const wxString& aSuffix,
const wxString& aExtension );
// PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment