Commit f78497bf authored by Wayne Stambaugh's avatar Wayne Stambaugh

Decouple PLOT_CONTROLLER from UI dependencies.

parent b5bb5642
...@@ -72,6 +72,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -72,6 +72,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
} }
} }
wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintsLibNames[ii] ),
GetChars( filename.GetFullPath() ) );
if( !filename.FileExists() ) if( !filename.FileExists() )
{ {
m_filesNotFound << filename.GetFullName() << wxT( "\n" ); m_filesNotFound << filename.GetFullName() << wxT( "\n" );
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <convert_from_iu.h> #include <convert_from_iu.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <macros.h> #include <macros.h>
#include <reporter.h>
#include <confirm.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbplot.h> #include <pcbplot.h>
...@@ -49,7 +51,7 @@ ...@@ -49,7 +51,7 @@
#define PLOTSVGPAGESIZEOPT_KEY wxT( "PlotSVGPageOpt" ) #define PLOTSVGPAGESIZEOPT_KEY wxT( "PlotSVGPageOpt" )
#define PLOTSVGPLOT_BRD_EDGE_KEY wxT( "PlotSVGBrdEdge" ) #define PLOTSVGPLOT_BRD_EDGE_KEY wxT( "PlotSVGBrdEdge" )
// reasonnable values for default pen width // reasonable values for default pen width
#define WIDTH_MAX_VALUE (2 * IU_PER_MM) #define WIDTH_MAX_VALUE (2 * IU_PER_MM)
#define WIDTH_MIN_VALUE (0.05 * IU_PER_MM) #define WIDTH_MIN_VALUE (0.05 * IU_PER_MM)
...@@ -164,6 +166,7 @@ void DIALOG_SVG_PRINT::initDialog() ...@@ -164,6 +166,7 @@ void DIALOG_SVG_PRINT::initDialog()
} }
} }
void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
{ {
// Build the absolute path of current output plot directory // Build the absolute path of current output plot directory
...@@ -192,8 +195,7 @@ void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -192,8 +195,7 @@ void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
wxString boardFilePath = ( (wxFileName) m_board->GetFileName() ).GetPath(); wxString boardFilePath = ( (wxFileName) m_board->GetFileName() ).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) ) if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _( 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 ); _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
} }
...@@ -201,6 +203,7 @@ void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -201,6 +203,7 @@ void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
m_outputDirectory = m_outputDirectoryName->GetValue(); m_outputDirectory = m_outputDirectoryName->GetValue();
} }
void DIALOG_SVG_PRINT::SetPenWidth() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
int pensize = ReturnValueFromTextCtrl( *m_DialogDefaultPenSize ); int pensize = ReturnValueFromTextCtrl( *m_DialogDefaultPenSize );
...@@ -219,6 +222,7 @@ void DIALOG_SVG_PRINT::SetPenWidth() ...@@ -219,6 +222,7 @@ void DIALOG_SVG_PRINT::SetPenWidth()
m_DialogDefaultPenSize->SetValue( ReturnStringFromValue( g_UserUnit, pensize ) ); m_DialogDefaultPenSize->SetValue( ReturnStringFromValue( g_UserUnit, pensize ) );
} }
void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
{ {
m_outputDirectory = m_outputDirectoryName->GetValue(); m_outputDirectory = m_outputDirectoryName->GetValue();
...@@ -227,9 +231,16 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) ...@@ -227,9 +231,16 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
// absolute form). Bail if it fails // absolute form). Bail if it fails
wxFileName outputDir = wxFileName::DirName( m_outputDirectory ); wxFileName outputDir = wxFileName::DirName( m_outputDirectory );
wxString boardFilename = m_board->GetFileName(); wxString boardFilename = m_board->GetFileName();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
if( !EnsureOutputDirectory( &outputDir, boardFilename, m_messagesBox ) ) if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
{
wxString msg;
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
DisplayError( this, msg );
return; return;
}
m_printMirror = m_printMirrorOpt->GetValue(); m_printMirror = m_printMirrorOpt->GetValue();
m_printBW = m_ModeColorOption->GetSelection(); m_printBW = m_ModeColorOption->GetSelection();
...@@ -245,9 +256,11 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) ...@@ -245,9 +256,11 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
} }
wxString msg; wxString msg;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{ {
LAYER_MSK currlayer_mask = GetLayerMask( layer ); LAYER_MSK currlayer_mask = GetLayerMask( layer );
if( (printMaskLayer & currlayer_mask ) == 0 ) if( (printMaskLayer & currlayer_mask ) == 0 )
continue; continue;
...@@ -257,7 +270,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) ...@@ -257,7 +270,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
{ {
m_printMaskLayer = printMaskLayer; m_printMaskLayer = printMaskLayer;
suffix = wxT( "-brd" ); suffix = wxT( "-brd" );
} }
else else
{ {
m_printMaskLayer = currlayer_mask; m_printMaskLayer = currlayer_mask;
...@@ -320,8 +333,8 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) ...@@ -320,8 +333,8 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
LOCALE_IO toggle; LOCALE_IO toggle;
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( m_board, SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( m_board,
&m_plotOpts, aFullFileName, &m_plotOpts, aFullFileName,
wxEmptyString ); wxEmptyString );
if( plotter ) if( plotter )
{ {
...@@ -387,6 +400,5 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event ) ...@@ -387,6 +400,5 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
m_parent->OnModify(); m_parent->OnModify();
} }
EndModal( 0 ); EndModal( 0 );
} }
...@@ -31,14 +31,13 @@ ...@@ -31,14 +31,13 @@
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <pcbplot.h> #include <pcbplot.h>
#include <base_units.h> #include <base_units.h>
#include <macros.h>
#include <reporter.h>
#include <class_board.h> #include <class_board.h>
#include <plotcontroller.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#include <dialog_plot.h> #include <dialog_plot.h>
/**
* Class DIALOG_PLOT
*/
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
DIALOG_PLOT_BASE( aParent ), m_parent( aParent ), DIALOG_PLOT_BASE( aParent ), m_parent( aParent ),
...@@ -102,7 +101,6 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -102,7 +101,6 @@ void DIALOG_PLOT::Init_Dialog()
msg = ReturnStringFromValue( g_UserUnit, m_brdSettings.m_SolderMaskMinWidth, true ); msg = ReturnStringFromValue( g_UserUnit, m_brdSettings.m_SolderMaskMinWidth, true );
m_SolderMaskMinWidthCurrValue->SetLabel( msg ); m_SolderMaskMinWidthCurrValue->SetLabel( msg );
// Set units and value for HPGL pen size (this param in in mils). // Set units and value for HPGL pen size (this param in in mils).
AddUnitSymbol( *m_textPenSize, g_UserUnit ); AddUnitSymbol( *m_textPenSize, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
...@@ -163,7 +161,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -163,7 +161,7 @@ void DIALOG_PLOT::Init_Dialog()
m_layerList.push_back( layer ); m_layerList.push_back( layer );
checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) ); checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) )
m_layerCheckListBox->Check( checkIndex ); m_layerCheckListBox->Check( checkIndex );
} }
...@@ -224,12 +222,14 @@ void DIALOG_PLOT::OnClose( wxCloseEvent& event ) ...@@ -224,12 +222,14 @@ void DIALOG_PLOT::OnClose( wxCloseEvent& event )
EndModal( 0 ); EndModal( 0 );
} }
// A helper function to show a popup menu, when the dialog is right clicked. // A helper function to show a popup menu, when the dialog is right clicked.
void DIALOG_PLOT::OnRightClick( wxMouseEvent& event ) void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
{ {
PopupMenu( m_popMenu ); PopupMenu( m_popMenu );
} }
// Select or deselect groups of layers in the layers list: // Select or deselect groups of layers in the layers list:
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
...@@ -283,6 +283,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) ...@@ -283,6 +283,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
} }
} }
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event ) void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{ {
m_parent->InstallDrillFrame( event ); m_parent->InstallDrillFrame( event );
...@@ -329,8 +330,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -329,8 +330,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath(); wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath();
if( !dirName.MakeRelativeTo( boardFilePath ) ) if( !dirName.MakeRelativeTo( boardFilePath ) )
wxMessageBox( _( 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 ); _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
} }
...@@ -354,6 +354,7 @@ PlotFormat DIALOG_PLOT::GetPlotFormat() ...@@ -354,6 +354,7 @@ PlotFormat DIALOG_PLOT::GetPlotFormat()
return plotFmt[ m_plotFormatOpt->GetSelection() ]; return plotFmt[ m_plotFormatOpt->GetSelection() ];
} }
// Enable or disable widgets according to the plot format selected // Enable or disable widgets according to the plot format selected
// and clear also some optional values // and clear also some optional values
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
...@@ -533,6 +534,8 @@ static bool setDouble( double* aResult, double aValue, double aMin, double aMax ...@@ -533,6 +534,8 @@ static bool setDouble( double* aResult, double aValue, double aMin, double aMax
*aResult = aValue; *aResult = aValue;
return true; return true;
} }
static bool setInt( int* aResult, int aValue, int aMin, int aMax ) static bool setInt( int* aResult, int aValue, int aMin, int aMax )
{ {
if( aValue < aMin ) if( aValue < aMin )
...@@ -691,3 +694,126 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -691,3 +694,126 @@ void DIALOG_PLOT::applyPlotSettings()
m_parent->OnModify(); m_parent->OnModify();
} }
} }
void DIALOG_PLOT::Plot( wxCommandEvent& event )
{
applyPlotSettings();
// Create output directory if it does not exist (also transform it in
// absolute form). Bail if it fails
wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
wxString boardFilename = m_parent->GetBoard()->GetFileName();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
{
wxString msg;
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
DisplayError( this, msg );
return;
}
m_plotOpts.SetAutoScale( false );
m_plotOpts.SetScale( 1 );
switch( m_plotOpts.GetScaleSelection() )
{
default:
break;
case 0: // Autoscale option
m_plotOpts.SetAutoScale( true );
break;
case 2: // 3:2 option
m_plotOpts.SetScale( 1.5 );
break;
case 3: // 2:1 option
m_plotOpts.SetScale( 2 );
break;
case 4: // 3:1 option
m_plotOpts.SetScale( 3 );
break;
}
/* If the scale factor edit controls are disabled or the scale value
* is 0, don't adjust the base scale factor. This fixes a bug when
* the default scale adjust is initialized to 0 and saved in program
* settings resulting in a divide by zero fault.
*/
if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 )
m_plotOpts.SetFineScaleAdjustX( m_XScaleAdjust );
if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
m_plotOpts.SetFineScaleAdjustY( m_YScaleAdjust );
if( m_PSFineAdjustWidthOpt->IsEnabled() )
m_plotOpts.SetWidthAdjust( m_PSWidthAdjust );
wxString file_ext( GetDefaultPlotExtension( m_plotOpts.GetFormat() ) );
// Test for a reasonable scale value
// XXX could this actually happen? isn't it constrained in the apply
// function?
if( m_plotOpts.GetScale() < PLOT_MIN_SCALE )
DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) );
if( m_plotOpts.GetScale() > PLOT_MAX_SCALE )
DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) );
// Save the current plot options in the board
m_parent->SetPlotSettings( m_plotOpts );
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) )
{
// Pick the basename from the board file
wxFileName fn( boardFilename );
// Use Gerber Extensions based on layer number
// (See http://en.wikipedia.org/wiki/Gerber_File)
if( ( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER )
&& m_useGerberExtensions->GetValue() )
file_ext = GetGerberExtension( layer );
// Create file name (from the English layer name for non copper layers).
BuildPlotFileName( &fn, outputDir.GetPath(),
m_board->GetStandardLayerName( layer ),
file_ext );
LOCALE_IO toggle;
BOARD *board = m_parent->GetBoard();
PLOTTER *plotter = StartPlotBoard(board, &m_plotOpts,
fn.GetFullPath(),
wxEmptyString );
// Print diags in messages box:
wxString msg;
if( plotter )
{
PlotOneBoardLayer( board, plotter, layer, m_plotOpts );
plotter->EndPlot();
delete plotter;
msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) );
}
else
msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
msg << wxT( "\n" );
m_messagesBox->AppendText( msg );
}
}
// If no layer selected, we have nothing plotted.
// Prompt user if it happens because he could think there is a bug in Pcbnew.
if( !m_plotOpts.GetLayerSelection() )
DisplayError( this, _( "No layer selected" ) );
}
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <module_editor_frame.h> #include <module_editor_frame.h>
#include <dialog_SVG_print.h> #include <dialog_SVG_print.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
#include <dialog_plot.h>
#include <convert_from_iu.h> #include <convert_from_iu.h>
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
...@@ -853,3 +854,9 @@ void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent ) ...@@ -853,3 +854,9 @@ void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
} }
} }
void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
{
DIALOG_PLOT dlg( this );
dlg.ShowModal();
}
This diff is collapsed.
...@@ -44,6 +44,7 @@ class PCB_TARGET; ...@@ -44,6 +44,7 @@ class PCB_TARGET;
class TEXTE_MODULE; class TEXTE_MODULE;
class ZONE_CONTAINER; class ZONE_CONTAINER;
class BOARD; class BOARD;
class REPORTER;
// Shared Config keys for plot and print // Shared Config keys for plot and print
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" ) #define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
...@@ -218,16 +219,16 @@ void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, ...@@ -218,16 +219,16 @@ void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask,
/** /**
* Function EnsureOutputDirectory (helper function) * Function EnsureOutputDirectory (helper function)
* Fix the output directory pathname to absolute and ensure it exists * make \a OutputDir absolute and creates the path if it doesn't exist.
* (Creates it if not exists) * @param aOutputDir the wxFileName containing the full path and file name to modify. The path
* @param aOutputDir = the wxFileName to modify * may be absolute or relative to \a aBoardFilename .
* (contains the absolute or relative to the board path * @param aBoardFilename the board full path and filename.
* @param aBoardFilename = the board full filename * @param aReporter a point to a REPORTER object use to show messages (can be NULL)
* @param aMessageBox = a wxMessageBox to show message (can be NULL) * @return true if \a aOutputDir already exists or was successfully created.
*/ */
bool EnsureOutputDirectory( wxFileName* aOutputDir, bool EnsureOutputDirectory( wxFileName* aOutputDir,
const wxString& aBoardFilename, const wxString& aBoardFilename,
wxTextCtrl* aMessageBox ); REPORTER* aReporter = NULL );
/** /**
* Function BuildPlotFileName (helper function) * Function BuildPlotFileName (helper function)
...@@ -236,16 +237,24 @@ bool EnsureOutputDirectory( wxFileName* aOutputDir, ...@@ -236,16 +237,24 @@ bool EnsureOutputDirectory( wxFileName* aOutputDir,
* the suffix is usually the layer name * the suffix is usually the layer name
* replaces not allowed chars in suffix by '_' * replaces not allowed chars in suffix by '_'
* @param aFilename = the wxFileName to initialize * @param aFilename = the wxFileName to initialize
* Contians the base filename * Contains the base filename
* @param aOutputDir = the path * @param aOutputDir = the path
* @param aSuffix = the suffix to add to the base filename * @param aSuffix = the suffix to add to the base filename
* @param aExtension = the file extension * @param aExtension = the file extension
*/ */
void BuildPlotFileName( wxFileName* aFilename, void BuildPlotFileName( wxFileName* aFilename,
const wxString& aOutputDir, const wxString& aOutputDir,
const wxString& aSuffix, const wxString& aSuffix,
const wxString& aExtension ); const wxString& aExtension );
/**
* Function GetGerberExtension
* @return the appropriate Gerber file extension for \a aLayer
*/
extern wxString GetGerberExtension( LAYER_NUM aLayer );
// PLOTGERB.CPP // PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize ); void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Lorenzo Marcantonio, <l.marcantonio@logossrl.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file pcbnew/pcbplot.h * @file pcbnew/pcbplot.h
*/ */
...@@ -10,34 +34,46 @@ ...@@ -10,34 +34,46 @@
class PLOTTER; class PLOTTER;
class BOARD; class BOARD;
class REPORTER;
/** /**
* Batch plotter state object. Keeps the plot options and handles multiple * Batch plotter state object. Keeps the plot options and handles multiple
* plot requests * plot requests
*/ */
class PLOT_CONTROLLER class PLOT_CONTROLLER
{ {
public: public:
/** Batch plotter constructor, nothing interesting here */
PLOT_CONTROLLER( BOARD *aBoard ); PLOT_CONTROLLER( BOARD *aBoard );
/** Batch plotter destructor, ensures that the last plot is closed */
~PLOT_CONTROLLER(); ~PLOT_CONTROLLER();
PCB_PLOT_PARAMS *AccessPlotOpts() { return &m_plotOpts; } PCB_PLOT_PARAMS *AccessPlotOpts() { return &m_plotOpts; }
bool IsPlotOpen() const { return m_plotter != NULL; } bool IsPlotOpen() const { return m_plotter != NULL; }
/** Close the current plot, nothing happens if it isn't open */
void ClosePlot(); void ClosePlot();
/** Open a new plotfile; works as a factory for plotter objects
*/
bool OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat, bool OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat,
const wxString &aSheetDesc ); const wxString &aSheetDesc );
/** Plot a single layer on the current plotfile */
bool PlotLayer( LAYER_NUM layer ); bool PlotLayer( LAYER_NUM layer );
void SetColorMode( bool aColorMode ); void SetColorMode( bool aColorMode );
bool GetColorMode(); bool GetColorMode();
private: private:
/// Option bank /// Option bank
PCB_PLOT_PARAMS m_plotOpts; PCB_PLOT_PARAMS m_plotOpts;
/// This is the plotter object; it starts NULL and become instantiated /// This is the plotter object; it starts NULL and become instantiated
// when a plotfile is requested /// when a plotfile is requested
PLOTTER *m_plotter; PLOTTER* m_plotter;
/// The board we're plotting /// The board we're plotting
BOARD* m_board; BOARD* m_board;
......
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