Pcbnew: enhanced dialog for SVG export

This commit is contained in:
jean-pierre charras 2012-11-16 15:13:31 +01:00
parent e435a104c9
commit b080f860c9
8 changed files with 474 additions and 269 deletions

View File

@ -36,6 +36,7 @@
#include <class_pcb_screen.h>
#include <base_units.h>
#include <convert_from_iu.h>
#include <wildcards_and_files_ext.h>
#include <pcbnew.h>
#include <pcbplot.h>
@ -56,15 +57,14 @@
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
/*!
/*
* DIALOG_SVG_PRINT functions
*/
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
DIALOG_SVG_PRINT_base( parent )
{
m_Parent = (PCB_BASE_FRAME*) parent;
m_Config = wxGetApp().GetSettings();
m_parent = (PCB_BASE_FRAME*) parent;
m_config = wxGetApp().GetSettings();
initDialog();
GetSizer()->SetSizeHints( this );
Centre();
@ -75,16 +75,21 @@ bool DIALOG_SVG_PRINT::m_oneFileOnly = false;
void DIALOG_SVG_PRINT::initDialog()
{
if( m_Config )
m_board = m_parent->GetBoard();
if( m_config )
{
m_Config->Read( PLOTSVGMODECOLOR_KEY, &m_printBW, false );
m_config->Read( PLOTSVGMODECOLOR_KEY, &m_printBW, false );
long ltmp;
m_Config->Read( PLOTSVGPAGESIZEOPT_KEY, &ltmp, 0 );
m_config->Read( PLOTSVGPAGESIZEOPT_KEY, &ltmp, 0 );
m_rbSvgPageSizeOpt->SetSelection( ltmp );
m_Config->Read( PLOTSVGPLOT_BRD_EDGE_KEY, &ltmp, 1 );
m_config->Read( PLOTSVGPLOT_BRD_EDGE_KEY, &ltmp, 1 );
m_PrintBoardEdgesCtrl->SetValue( ltmp );
}
m_outputDirectory = m_parent->GetPlotSettings().GetOutputDirectory();
m_outputDirectoryName->SetValue( m_outputDirectory );
if( m_printBW )
m_ModeColorOption->SetSelection( 1 );
else
@ -99,16 +104,14 @@ void DIALOG_SVG_PRINT::initDialog()
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
// Create layers list
BOARD* board = m_Parent->GetBoard();
int layer;
for( layer = 0; layer < NB_LAYERS; ++layer )
{
if( !board->IsLayerEnabled( layer ) )
m_BoxSelectLayer[layer] = NULL;
if( !m_board->IsLayerEnabled( layer ) )
m_boxSelectLayer[layer] = NULL;
else
m_BoxSelectLayer[layer] =
new wxCheckBox( this, -1, board->GetLayerName( layer ) );
m_boxSelectLayer[layer] =
new wxCheckBox( this, -1, m_board->GetLayerName( layer ) );
}
// Add wxCheckBoxes in layers lists dialog
@ -122,27 +125,27 @@ void DIALOG_SVG_PRINT::initDialog()
wxASSERT( layer < NB_LAYERS );
if( m_BoxSelectLayer[layer] == NULL )
if( m_boxSelectLayer[layer] == NULL )
continue;
long mask = 1 << layer;
if( mask & s_SelectedLayers )
m_BoxSelectLayer[layer]->SetValue( true );
m_boxSelectLayer[layer]->SetValue( true );
if( layer < 16 )
m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer],
m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer],
0,
wxGROW | wxALL,
1 );
else
m_TechnicalBoxSizer->Add( m_BoxSelectLayer[layer],
m_TechnicalBoxSizer->Add( m_boxSelectLayer[layer],
0,
wxGROW | wxALL,
1 );
}
if( m_Config )
if( m_config )
{
wxString layerKey;
@ -150,17 +153,53 @@ void DIALOG_SVG_PRINT::initDialog()
{
bool option;
if( m_BoxSelectLayer[layer] == NULL )
if( m_boxSelectLayer[layer] == NULL )
continue;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
if( m_Config->Read( layerKey, &option ) )
m_BoxSelectLayer[layer]->SetValue( option );
if( m_config->Read( layerKey, &option ) )
m_boxSelectLayer[layer]->SetValue( option );
}
}
}
void DIALOG_SVG_PRINT::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;
if( fn.IsRelative() )
path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
else
path = 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 );
if( dialog.ShowModal() == wxID_YES )
{
wxString boardFilePath = ( (wxFileName) m_board->GetFileName() ).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _(
"Cannot make path relative (target volume different from board file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
}
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
m_outputDirectory = m_outputDirectoryName->GetValue();
}
void DIALOG_SVG_PRINT::SetPenWidth()
{
@ -182,8 +221,15 @@ void DIALOG_SVG_PRINT::SetPenWidth()
void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
{
wxFileName fn;
wxString msg;
m_outputDirectory = m_outputDirectoryName->GetValue();
// Create output directory if it does not exist (also transform it in
// absolute form). Bail if it fails
wxFileName outputDir = wxFileName::DirName( m_outputDirectory );
wxString boardFilename = m_board->GetFileName();
if( !EnsureOutputDirectory( &outputDir, boardFilename, m_messagesBox ) )
return;
m_printMirror = m_printMirrorOpt->GetValue();
m_printBW = m_ModeColorOption->GetSelection();
@ -194,45 +240,41 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
for( int layer = 0; layer<NB_LAYERS; layer++ )
{
if( m_BoxSelectLayer[layer] && m_BoxSelectLayer[layer]->GetValue() )
if( m_boxSelectLayer[layer] && m_boxSelectLayer[layer]->GetValue() )
printMaskLayer |= 1 << layer;
}
wxString msg;
for( int layer = 0; layer<NB_LAYERS; layer++ )
{
int currlayer_mask = 1 << layer;
if( (printMaskLayer & currlayer_mask ) == 0 )
continue;
fn = m_FileNameCtrl->GetValue();
if( !fn.IsOk() )
fn = m_Parent->GetBoard()->GetFileName();
wxString suffix = m_board->GetLayerName( layer, false );
if( aOnlyOneFile )
{
m_PrintMaskLayer = printMaskLayer;
fn.SetName( fn.GetName() + wxT( "-brd" ) );
}
m_printMaskLayer = printMaskLayer;
suffix = wxT( "-brd" );
}
else
{
m_PrintMaskLayer = currlayer_mask;
wxString suffix = m_Parent->GetBoard()->GetLayerName( layer, false );
suffix.Trim(); // remove leading and trailing spaces if any
suffix.Trim( false );
fn.SetName( fn.GetName() + wxT( "-" ) + suffix );
m_printMaskLayer = currlayer_mask;
suffix = m_board->GetLayerName( layer, false );
}
fn.SetExt( wxT( "svg" ) );
wxFileName fn(boardFilename);
BuildPlotFileName( &fn, outputDir.GetPath(), suffix, SVGFileExtension );
if( m_PrintBoardEdgesCtrl->IsChecked() )
m_PrintMaskLayer |= EDGE_LAYER;
m_printMaskLayer |= EDGE_LAYER;
if( CreateSVGFile( fn.GetFullPath() ) )
msg.Printf( _( "Plot: %s OK\n" ), GetChars( fn.GetFullPath() ) );
else // Error
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fn.GetFullPath() ) );
m_MessagesBox->AppendText( msg );
m_messagesBox->AppendText( msg );
if( aOnlyOneFile )
break;
@ -243,14 +285,12 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
// Actual SVG file export function.
bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
{
BOARD* brd = m_Parent->GetBoard();
PCB_PLOT_PARAMS m_plotOpts;
m_plotOpts.SetPlotFrameRef( PrintPageRef() );
// Adding drill marks, for copper layers
if( (m_PrintMaskLayer & ALL_CU_LAYERS) )
if( (m_printMaskLayer & ALL_CU_LAYERS) )
m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );
else
m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
@ -263,36 +303,36 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
m_plotOpts.SetReferenceColor( color );
m_plotOpts.SetValueColor( color );
PAGE_INFO pageInfo = brd->GetPageSettings();
wxPoint axisorigin = brd->GetOriginAxisPosition();
PAGE_INFO pageInfo = m_board->GetPageSettings();
wxPoint axisorigin = m_board->GetOriginAxisPosition();
if( PageIsBoardBoundarySize() )
{
EDA_RECT bbox = brd->ComputeBoundingBox();
PAGE_INFO currpageInfo = brd->GetPageSettings();
EDA_RECT bbox = m_board->ComputeBoundingBox();
PAGE_INFO currpageInfo = m_board->GetPageSettings();
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
brd->SetPageSettings( currpageInfo );
m_board->SetPageSettings( currpageInfo );
m_plotOpts.SetUseAuxOrigin( true );
wxPoint origin = bbox.GetOrigin();
brd->SetOriginAxisPosition( origin );
m_board->SetOriginAxisPosition( origin );
}
LOCALE_IO toggle;
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( brd,
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( m_board,
&m_plotOpts, aFullFileName,
wxEmptyString );
if( plotter )
{
plotter->SetColorMode( m_ModeColorOption->GetSelection() == 0 );
PlotStandardLayer( brd, plotter, m_PrintMaskLayer, m_plotOpts );
PlotStandardLayer( m_board, plotter, m_printMaskLayer, m_plotOpts );
plotter->EndPlot();
}
plotter->EndPlot();
delete plotter;
brd->SetOriginAxisPosition( axisorigin );
brd->SetPageSettings( pageInfo );
m_board->SetOriginAxisPosition( axisorigin );
m_board->SetPageSettings( pageInfo );
return true;
}
@ -316,23 +356,37 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
m_printBW = m_ModeColorOption->GetSelection();
m_oneFileOnly = m_rbFileOpt->GetSelection() == 1;
if( m_Config )
if( m_config )
{
m_Config->Write( PLOTSVGMODECOLOR_KEY, m_printBW );
m_Config->Write( PLOTSVGPAGESIZEOPT_KEY, m_rbSvgPageSizeOpt->GetSelection() );
m_Config->Write( PLOTSVGPLOT_BRD_EDGE_KEY, m_PrintBoardEdgesCtrl->GetValue() );
m_config->Write( PLOTSVGMODECOLOR_KEY, m_printBW );
m_config->Write( PLOTSVGPAGESIZEOPT_KEY, m_rbSvgPageSizeOpt->GetSelection() );
m_config->Write( PLOTSVGPLOT_BRD_EDGE_KEY, m_PrintBoardEdgesCtrl->GetValue() );
wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer )
{
if( m_BoxSelectLayer[layer] == NULL )
if( m_boxSelectLayer[layer] == NULL )
continue;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );
m_config->Write( layerKey, m_boxSelectLayer[layer]->IsChecked() );
}
}
// Set output directory and replace backslashes with forward ones
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
if( dirStr != m_parent->GetPlotSettings().GetOutputDirectory() )
{
PCB_PLOT_PARAMS tempOptions( m_parent->GetPlotSettings() );
tempOptions.SetOutputDirectory( dirStr );
m_parent->SetPlotSettings( tempOptions );
m_parent->OnModify();
}
EndModal( 0 );
}

View File

@ -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];
bool m_printBW;
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()

View File

@ -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 );

View File

@ -91,6 +91,279 @@
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</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_staticTextDir</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|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</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">450,-1</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">Enter a filename if you do not want to use default file names&#x0A;Can be used only when printing the current sheet</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">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</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 class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@ -965,180 +1238,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</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">Filename:</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_staticText1</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|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</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">450,-1</property>
<property name="moveable">1</property>
<property name="name">m_FileNameCtrl</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">Enter a filename if you do not want to use default file names&#x0A;Can be used only when printing the current sheet</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">wxTOP|wxRIGHT|wxLEFT</property>
@ -1262,7 +1361,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size">-1,100</property>
<property name="moveable">1</property>
<property name="name">m_MessagesBox</property>
<property name="name">m_messagesBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -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(); }

View File

@ -271,7 +271,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _(
"Cannot make path relative (target volume different from board file volume)!" ),
"Cannot make path relative (target volume different from board file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
}

View File

@ -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,10 +140,13 @@ 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, /*{{{*/
const wxString& aBoardFilename,
wxTextCtrl* aMessageBox )
/*
* 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 )
{
wxString boardFilePath = wxFileName( aBoardFilename ).GetPath();
@ -171,13 +175,14 @@ static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
}
else
{
wxMessageBox( _( "Cannot create output directory!" ),
_( "Plot" ), wxOK | wxICON_ERROR );
if( aMessageBox )
wxMessageBox( _( "Cannot create output directory!" ),
_( "Plot" ), wxOK | wxICON_ERROR );
return false;
}
}
return true;
}/*}}}*/
}
/*
* DIALOG_PLOT:Plot

View File

@ -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 );