2012-09-15 12:13:03 +00:00
|
|
|
/**
|
2012-12-18 13:54:44 +00:00
|
|
|
* @file dialog_plot.cpp
|
2012-09-15 12:13:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-02 08:06:39 +00:00
|
|
|
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-09-15 12:13:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
|
|
|
|
#include <kiface_i.h>
|
2012-09-15 12:13:03 +00:00
|
|
|
#include <plot_common.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <pcbplot.h>
|
|
|
|
#include <base_units.h>
|
2013-05-10 19:22:29 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <reporter.h>
|
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <wx/ffile.h>
|
|
|
|
#include <dialog_plot.h>
|
2015-06-16 12:20:42 +00:00
|
|
|
#include <wx_html_report_panel.h>
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
|
|
|
|
DIALOG_PLOT_BASE( aParent ), m_parent( aParent ),
|
|
|
|
m_board( aParent->GetBoard() ),
|
|
|
|
m_plotOpts( aParent->GetPlotSettings() )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_config = Kiface().KifaceSettings();
|
2012-09-15 12:13:03 +00:00
|
|
|
Init_Dialog();
|
|
|
|
|
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::Init_Dialog()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
wxFileName fileName;
|
|
|
|
|
|
|
|
m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust );
|
|
|
|
m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
|
2012-09-24 06:39:59 +00:00
|
|
|
|
|
|
|
// m_PSWidthAdjust is stored in mm in user config
|
|
|
|
double dtmp;
|
|
|
|
m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &dtmp, 0 );
|
|
|
|
m_PSWidthAdjust = KiROUND( dtmp * IU_PER_MM );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
// The reasonable width correction value must be in a range of
|
|
|
|
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
|
2014-05-13 09:22:51 +00:00
|
|
|
m_widthAdjustMinValue = -( m_board->GetDesignSettings().m_TrackMinWidth - 1 );
|
|
|
|
m_widthAdjustMaxValue = m_board->GetDesignSettings().GetSmallestClearanceValue() - 1;
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
switch( m_plotOpts.GetFormat() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
m_plotFormatOpt->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
m_plotFormatOpt->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_SVG:
|
|
|
|
m_plotFormatOpt->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_DXF:
|
|
|
|
m_plotFormatOpt->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
m_plotFormatOpt->SetSelection( 4 );
|
|
|
|
break;
|
2013-10-15 18:22:35 +00:00
|
|
|
|
|
|
|
case PLOT_FORMAT_PDF:
|
|
|
|
m_plotFormatOpt->SetSelection( 5 );
|
|
|
|
break;
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-26 06:54:04 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMargin, true );
|
2012-11-05 20:20:34 +00:00
|
|
|
m_SolderMaskMarginCurrValue->SetLabel( msg );
|
2014-05-26 06:54:04 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMinWidth, true );
|
2012-11-05 20:20:34 +00:00
|
|
|
m_SolderMaskMinWidthCurrValue->SetLabel( msg );
|
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
// Set units and value for HPGL pen size (this param in in mils).
|
|
|
|
AddUnitSymbol( *m_textPenSize, g_UserUnit );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit,
|
2015-06-16 12:20:42 +00:00
|
|
|
m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_HPGLPenSizeOpt->AppendText( msg );
|
|
|
|
|
|
|
|
// Set units and value for HPGL pen overlay (this param in in mils).
|
|
|
|
AddUnitSymbol( *m_textPenOvr, g_UserUnit );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit,
|
2012-09-15 12:13:03 +00:00
|
|
|
m_plotOpts.GetHPGLPenOverlay() * IU_PER_MILS );
|
|
|
|
m_HPGLPenOverlayOpt->AppendText( msg );
|
|
|
|
|
|
|
|
AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_plotOpts.GetLineWidth() );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_linesWidth->AppendText( msg );
|
|
|
|
|
|
|
|
// Set units for PS global width correction.
|
|
|
|
AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit );
|
|
|
|
|
|
|
|
m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
|
|
|
|
|
|
|
|
// Test for a reasonable scale value. Set to 1 if problem
|
|
|
|
if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
|
|
|
|
|| m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
|
|
|
|
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
|
|
|
|
|
|
|
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
|
|
|
|
m_fineAdjustXscaleOpt->AppendText( msg );
|
|
|
|
|
|
|
|
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
|
|
|
|
m_fineAdjustYscaleOpt->AppendText( msg );
|
|
|
|
|
|
|
|
// Test for a reasonable PS width correction value. Set to 0 if problem.
|
2012-09-24 06:39:59 +00:00
|
|
|
if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
|
2012-09-15 12:13:03 +00:00
|
|
|
m_PSWidthAdjust = 0.;
|
|
|
|
|
|
|
|
msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
|
|
|
|
m_PSFineAdjustWidthOpt->AppendText( msg );
|
|
|
|
|
|
|
|
m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
|
|
|
|
m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
// Could devote a PlotOrder() function in place of UIOrder().
|
|
|
|
m_layerList = m_board->GetEnabledLayers().UIOrder();
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2015-11-15 18:04:19 +00:00
|
|
|
// Populate the check list box by all enabled layers names
|
2014-06-24 16:17:18 +00:00
|
|
|
for( LSEQ seq = m_layerList; seq; ++seq )
|
2012-09-15 12:13:03 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
LAYER_ID layer = *seq;
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
|
|
|
|
|
|
|
|
if( m_plotOpts.GetLayerSelection()[layer] )
|
2012-09-15 12:13:03 +00:00
|
|
|
m_layerCheckListBox->Check( checkIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Option for using proper Gerber extensions
|
2015-10-21 06:55:30 +00:00
|
|
|
m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberProtelExtensions() );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2014-06-19 06:26:53 +00:00
|
|
|
// Option for including Gerber attributes (from Gerber X2 format) in the output
|
|
|
|
m_useGerberAttributes->SetValue( m_plotOpts.GetUseGerberAttributes() );
|
|
|
|
|
2014-07-04 14:22:38 +00:00
|
|
|
// Gerber precision for coordinates
|
|
|
|
m_rbGerberFormat->SetSelection( m_plotOpts.GetGerberPrecision() == 5 ? 0 : 1 );
|
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
// Option for excluding contents of "Edges Pcb" layer
|
|
|
|
m_excludeEdgeLayerOpt->SetValue( m_plotOpts.GetExcludeEdgeLayer() );
|
|
|
|
|
|
|
|
m_subtractMaskFromSilk->SetValue( m_plotOpts.GetSubtractMaskFromSilk() );
|
|
|
|
|
|
|
|
// Option to plot page references:
|
|
|
|
m_plotSheetRef->SetValue( m_plotOpts.GetPlotFrameRef() );
|
|
|
|
|
|
|
|
// Option to allow pads on silkscreen layers
|
|
|
|
m_plotPads_on_Silkscreen->SetValue( m_plotOpts.GetPlotPadsOnSilkLayer() );
|
|
|
|
|
|
|
|
// Options to plot texts on footprints
|
|
|
|
m_plotModuleValueOpt->SetValue( m_plotOpts.GetPlotValue() );
|
|
|
|
m_plotModuleRefOpt->SetValue( m_plotOpts.GetPlotReference() );
|
|
|
|
m_plotInvisibleText->SetValue( m_plotOpts.GetPlotInvisibleText() );
|
|
|
|
|
|
|
|
// Options to plot pads and vias holes
|
|
|
|
m_drillShapeOpt->SetSelection( m_plotOpts.GetDrillMarksType() );
|
|
|
|
|
|
|
|
// Scale option
|
|
|
|
m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
|
|
|
|
|
|
|
|
// Plot mode
|
2015-02-03 10:35:46 +00:00
|
|
|
setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
// Plot mirror option
|
|
|
|
m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
|
|
|
|
|
|
|
|
// Put vias on mask layer
|
|
|
|
m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
|
|
|
|
|
|
|
|
// Output directory
|
|
|
|
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
|
|
|
|
|
|
|
|
// Update options values:
|
|
|
|
wxCommandEvent cmd_event;
|
|
|
|
SetPlotFormat( cmd_event );
|
|
|
|
OnSetScaleOpt( cmd_event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::OnQuit( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
Close( true ); // true is to force the frame to close
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::OnClose( wxCloseEvent& event )
|
|
|
|
{
|
|
|
|
applyPlotSettings();
|
|
|
|
EndModal( 0 );
|
|
|
|
}
|
|
|
|
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2013-02-21 20:53:50 +00:00
|
|
|
// A helper function to show a popup menu, when the dialog is right clicked.
|
|
|
|
void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
|
|
|
|
{
|
|
|
|
PopupMenu( m_popMenu );
|
|
|
|
}
|
|
|
|
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2013-02-21 20:53:50 +00:00
|
|
|
// Select or deselect groups of layers in the layers list:
|
|
|
|
#include <layers_id_colors_and_visibility.h>
|
|
|
|
void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
switch( event.GetId() )
|
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
case ID_LAYER_FAB: // Select layers usually needed to build a board
|
|
|
|
for( i = 0; i < m_layerList.size(); i++ )
|
|
|
|
{
|
|
|
|
LSET layermask( m_layerList[ i ] );
|
|
|
|
|
|
|
|
if( ( layermask & ( LSET::AllCuMask() | LSET::AllTechMask() ) ).any() )
|
|
|
|
m_layerCheckListBox->Check( i, true );
|
|
|
|
else
|
|
|
|
m_layerCheckListBox->Check( i, false );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SELECT_COPPER_LAYERS:
|
|
|
|
for( i = 0; i < m_layerList.size(); i++ )
|
|
|
|
{
|
|
|
|
if( IsCopperLayer( m_layerList[i] ) )
|
2013-02-21 20:53:50 +00:00
|
|
|
m_layerCheckListBox->Check( i, true );
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-02-21 20:53:50 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
case ID_DESELECT_COPPER_LAYERS:
|
|
|
|
for( i = 0; i < m_layerList.size(); i++ )
|
|
|
|
{
|
|
|
|
if( IsCopperLayer( m_layerList[i] ) )
|
2013-02-21 20:53:50 +00:00
|
|
|
m_layerCheckListBox->Check( i, false );
|
2014-06-24 16:17:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SELECT_ALL_LAYERS:
|
|
|
|
for( i = 0; i < m_layerList.size(); i++ )
|
|
|
|
m_layerCheckListBox->Check( i, true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_DESELECT_ALL_LAYERS:
|
|
|
|
for( i = 0; i < m_layerList.size(); i++ )
|
|
|
|
m_layerCheckListBox->Check( i, false );
|
|
|
|
break;
|
2013-02-21 20:53:50 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
default:
|
|
|
|
break;
|
2013-02-21 20:53:50 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
m_parent->InstallDrillFrame( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
/* Disable sheet reference for scale != 1:1 */
|
|
|
|
bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
|
|
|
|
|
|
|
|
m_plotSheetRef->Enable( scale1 );
|
|
|
|
|
|
|
|
if( !scale1 )
|
|
|
|
m_plotSheetRef->SetValue( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Build the absolute path of current output plot directory
|
|
|
|
// to preselect it when opening the dialog.
|
|
|
|
wxFileName fn( m_outputDirectoryName->GetValue() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
|
|
|
|
|
|
|
if( dirDialog.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
|
|
|
|
2014-11-06 15:27:22 +00:00
|
|
|
fn = Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() );
|
|
|
|
wxString defaultPath = fn.GetPathWithSep();
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "Do you want to use a path relative to\n'%s'" ),
|
|
|
|
GetChars( defaultPath ) );
|
|
|
|
|
|
|
|
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
2012-09-15 12:13:03 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
|
|
|
|
|
|
|
if( dialog.ShowModal() == wxID_YES )
|
|
|
|
{
|
2014-11-06 15:27:22 +00:00
|
|
|
if( !dirName.MakeRelativeTo( defaultPath ) )
|
|
|
|
wxMessageBox( _( "Cannot make path relative (target volume different from file volume)!" ),
|
2012-09-15 12:13:03 +00:00
|
|
|
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-03 10:35:46 +00:00
|
|
|
PlotFormat DIALOG_PLOT::getPlotFormat()
|
2012-09-15 12:13:03 +00:00
|
|
|
{
|
|
|
|
// plot format id's are ordered like displayed in m_plotFormatOpt
|
|
|
|
static const PlotFormat plotFmt[] =
|
|
|
|
{
|
|
|
|
PLOT_FORMAT_GERBER,
|
|
|
|
PLOT_FORMAT_POST,
|
|
|
|
PLOT_FORMAT_SVG,
|
|
|
|
PLOT_FORMAT_DXF,
|
|
|
|
PLOT_FORMAT_HPGL,
|
|
|
|
PLOT_FORMAT_PDF
|
|
|
|
};
|
|
|
|
|
|
|
|
return plotFmt[ m_plotFormatOpt->GetSelection() ];
|
|
|
|
}
|
|
|
|
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
// Enable or disable widgets according to the plot format selected
|
|
|
|
// and clear also some optional values
|
2012-09-15 12:13:03 +00:00
|
|
|
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
|
|
|
|
{
|
2015-02-03 10:35:46 +00:00
|
|
|
switch( getPlotFormat() )
|
2012-09-15 12:13:03 +00:00
|
|
|
{
|
|
|
|
case PLOT_FORMAT_PDF:
|
|
|
|
case PLOT_FORMAT_SVG:
|
|
|
|
m_drillShapeOpt->Enable( true );
|
|
|
|
m_plotModeOpt->Enable( false );
|
2015-02-03 10:35:46 +00:00
|
|
|
setPlotModeChoiceSelection( FILLED );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_plotMirrorOpt->Enable( true );
|
|
|
|
m_useAuxOriginCheckBox->Enable( false );
|
|
|
|
m_useAuxOriginCheckBox->SetValue( false );
|
|
|
|
m_linesWidth->Enable( true );
|
|
|
|
m_HPGLPenSizeOpt->Enable( false );
|
|
|
|
m_HPGLPenOverlayOpt->Enable( false );
|
|
|
|
m_excludeEdgeLayerOpt->Enable( true );
|
|
|
|
m_subtractMaskFromSilk->Enable( false );
|
|
|
|
m_subtractMaskFromSilk->SetValue( false );
|
|
|
|
m_useGerberExtensions->Enable( false );
|
|
|
|
m_useGerberExtensions->SetValue( false );
|
2014-06-19 06:26:53 +00:00
|
|
|
m_useGerberAttributes->Enable( false );
|
|
|
|
m_useGerberAttributes->SetValue( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_scaleOpt->Enable( false );
|
2012-09-24 06:39:59 +00:00
|
|
|
m_scaleOpt->SetSelection( 1 );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_fineAdjustXscaleOpt->Enable( false );
|
|
|
|
m_fineAdjustYscaleOpt->Enable( false );
|
|
|
|
m_PSFineAdjustWidthOpt->Enable( false );
|
2012-09-24 06:39:59 +00:00
|
|
|
m_plotPSNegativeOpt->Enable( true );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_forcePSA4OutputOpt->Enable( false );
|
2012-09-24 06:39:59 +00:00
|
|
|
m_forcePSA4OutputOpt->SetValue( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
m_drillShapeOpt->Enable( true );
|
|
|
|
m_plotModeOpt->Enable( true );
|
|
|
|
m_plotMirrorOpt->Enable( true );
|
|
|
|
m_useAuxOriginCheckBox->Enable( false );
|
|
|
|
m_useAuxOriginCheckBox->SetValue( false );
|
|
|
|
m_linesWidth->Enable( true );
|
|
|
|
m_HPGLPenSizeOpt->Enable( false );
|
|
|
|
m_HPGLPenOverlayOpt->Enable( false );
|
|
|
|
m_excludeEdgeLayerOpt->Enable( true );
|
|
|
|
m_subtractMaskFromSilk->Enable( false );
|
|
|
|
m_subtractMaskFromSilk->SetValue( false );
|
|
|
|
m_useGerberExtensions->Enable( false );
|
|
|
|
m_useGerberExtensions->SetValue( false );
|
2014-06-19 06:26:53 +00:00
|
|
|
m_useGerberAttributes->Enable( false );
|
|
|
|
m_useGerberAttributes->SetValue( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_scaleOpt->Enable( true );
|
|
|
|
m_fineAdjustXscaleOpt->Enable( true );
|
|
|
|
m_fineAdjustYscaleOpt->Enable( true );
|
|
|
|
m_PSFineAdjustWidthOpt->Enable( true );
|
|
|
|
m_plotPSNegativeOpt->Enable( true );
|
|
|
|
m_forcePSA4OutputOpt->Enable( true );
|
|
|
|
|
|
|
|
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Show( m_PSOptionsSizer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_GERBER:
|
|
|
|
m_drillShapeOpt->Enable( false );
|
|
|
|
m_drillShapeOpt->SetSelection( 0 );
|
|
|
|
m_plotModeOpt->Enable( false );
|
2015-02-03 10:35:46 +00:00
|
|
|
setPlotModeChoiceSelection( FILLED );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_plotMirrorOpt->Enable( false );
|
|
|
|
m_plotMirrorOpt->SetValue( false );
|
|
|
|
m_useAuxOriginCheckBox->Enable( true );
|
|
|
|
m_linesWidth->Enable( true );
|
|
|
|
m_HPGLPenSizeOpt->Enable( false );
|
|
|
|
m_HPGLPenOverlayOpt->Enable( false );
|
|
|
|
m_excludeEdgeLayerOpt->Enable( true );
|
|
|
|
m_subtractMaskFromSilk->Enable( true );
|
|
|
|
m_useGerberExtensions->Enable( true );
|
2014-06-19 06:26:53 +00:00
|
|
|
m_useGerberAttributes->Enable( true );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_scaleOpt->Enable( false );
|
|
|
|
m_scaleOpt->SetSelection( 1 );
|
|
|
|
m_fineAdjustXscaleOpt->Enable( false );
|
|
|
|
m_fineAdjustYscaleOpt->Enable( false );
|
|
|
|
m_PSFineAdjustWidthOpt->Enable( false );
|
|
|
|
m_plotPSNegativeOpt->Enable( false );
|
|
|
|
m_plotPSNegativeOpt->SetValue( false );
|
|
|
|
m_forcePSA4OutputOpt->Enable( false );
|
|
|
|
m_forcePSA4OutputOpt->SetValue( false );
|
|
|
|
|
|
|
|
m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_HPGL:
|
|
|
|
m_drillShapeOpt->Enable( true );
|
|
|
|
m_plotModeOpt->Enable( true );
|
|
|
|
m_plotMirrorOpt->Enable( true );
|
|
|
|
m_useAuxOriginCheckBox->Enable( false );
|
|
|
|
m_useAuxOriginCheckBox->SetValue( false );
|
|
|
|
m_linesWidth->Enable( false );
|
|
|
|
m_HPGLPenSizeOpt->Enable( true );
|
|
|
|
m_HPGLPenOverlayOpt->Enable( true );
|
|
|
|
m_excludeEdgeLayerOpt->Enable( true );
|
|
|
|
m_subtractMaskFromSilk->Enable( false );
|
|
|
|
m_subtractMaskFromSilk->SetValue( false );
|
|
|
|
m_useGerberExtensions->Enable( false );
|
|
|
|
m_useGerberExtensions->SetValue( false );
|
2014-06-19 06:26:53 +00:00
|
|
|
m_useGerberAttributes->Enable( false );
|
|
|
|
m_useGerberAttributes->SetValue( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_scaleOpt->Enable( true );
|
|
|
|
m_fineAdjustXscaleOpt->Enable( false );
|
|
|
|
m_fineAdjustYscaleOpt->Enable( false );
|
|
|
|
m_PSFineAdjustWidthOpt->Enable( false );
|
|
|
|
m_plotPSNegativeOpt->SetValue( false );
|
|
|
|
m_plotPSNegativeOpt->Enable( false );
|
|
|
|
m_forcePSA4OutputOpt->Enable( true );
|
|
|
|
|
|
|
|
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Show( m_HPGLOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PLOT_FORMAT_DXF:
|
|
|
|
m_drillShapeOpt->Enable( true );
|
2014-05-19 18:24:07 +00:00
|
|
|
m_plotModeOpt->Enable( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_plotMirrorOpt->Enable( false );
|
|
|
|
m_plotMirrorOpt->SetValue( false );
|
|
|
|
m_useAuxOriginCheckBox->Enable( true );
|
|
|
|
m_linesWidth->Enable( false );
|
|
|
|
m_HPGLPenSizeOpt->Enable( false );
|
|
|
|
m_HPGLPenOverlayOpt->Enable( false );
|
|
|
|
m_excludeEdgeLayerOpt->Enable( true );
|
|
|
|
m_subtractMaskFromSilk->Enable( false );
|
|
|
|
m_subtractMaskFromSilk->SetValue( false );
|
|
|
|
m_useGerberExtensions->Enable( false );
|
|
|
|
m_useGerberExtensions->SetValue( false );
|
2014-06-19 06:26:53 +00:00
|
|
|
m_useGerberAttributes->Enable( false );
|
|
|
|
m_useGerberAttributes->SetValue( false );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_scaleOpt->Enable( false );
|
|
|
|
m_scaleOpt->SetSelection( 1 );
|
|
|
|
m_fineAdjustXscaleOpt->Enable( false );
|
|
|
|
m_fineAdjustYscaleOpt->Enable( false );
|
|
|
|
m_PSFineAdjustWidthOpt->Enable( false );
|
|
|
|
m_plotPSNegativeOpt->Enable( false );
|
|
|
|
m_plotPSNegativeOpt->SetValue( false );
|
|
|
|
m_forcePSA4OutputOpt->Enable( false );
|
|
|
|
m_forcePSA4OutputOpt->SetValue( false );
|
|
|
|
|
2014-05-19 18:24:07 +00:00
|
|
|
m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
|
|
|
|
m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxASSERT( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the interlock between scale and frame reference
|
|
|
|
* (scaling would mess up the frame border...) */
|
|
|
|
OnSetScaleOpt( event );
|
|
|
|
|
|
|
|
Layout();
|
|
|
|
m_MainSizer->SetSizeHints( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// A helper function to "clip" aValue between aMin and aMax
|
|
|
|
// and write result in * aResult
|
|
|
|
// return false if clipped, true if aValue is just copied into * aResult
|
|
|
|
static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
|
|
|
|
{
|
|
|
|
if( aValue < aMin )
|
|
|
|
{
|
|
|
|
*aResult = aMin;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if( aValue > aMax )
|
|
|
|
{
|
|
|
|
*aResult = aMax;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = aValue;
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-10 19:22:29 +00:00
|
|
|
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
static bool setInt( int* aResult, int aValue, int aMin, int aMax )
|
|
|
|
{
|
|
|
|
if( aValue < aMin )
|
|
|
|
{
|
|
|
|
*aResult = aMin;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if( aValue > aMax )
|
|
|
|
{
|
|
|
|
*aResult = aMax;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = aValue;
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT::applyPlotSettings()
|
|
|
|
{
|
2015-06-16 12:20:42 +00:00
|
|
|
REPORTER& reporter = m_messagesPanel->Reporter();
|
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
PCB_PLOT_PARAMS tempOptions;
|
|
|
|
|
|
|
|
tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
|
|
|
|
tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
|
|
|
|
tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
|
|
|
|
tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
|
|
|
|
tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
|
|
|
|
tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
|
|
|
|
tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
|
|
|
|
tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
|
|
|
|
tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
|
|
|
|
tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
|
|
|
|
( m_drillShapeOpt->GetSelection() ) );
|
|
|
|
tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
|
2015-02-02 08:06:39 +00:00
|
|
|
tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
|
2012-09-15 12:13:03 +00:00
|
|
|
tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
|
|
|
|
|
|
|
|
// Update settings from text fields. Rewrite values back to the fields,
|
|
|
|
// since the values may have been constrained by the setters.
|
|
|
|
|
|
|
|
// read HPLG pen size (this param is stored in mils)
|
|
|
|
wxString msg = m_HPGLPenSizeOpt->GetValue();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
if( !tempOptions.SetHPGLPenDiameter( tmp ) )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_HPGLPenSizeOpt->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "HPGL pen size constrained." ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_INFO );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Read HPGL pen overlay (this param is stored in mils)
|
|
|
|
msg = m_HPGLPenOverlayOpt->GetValue();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
if( !tempOptions.SetHPGLPenOverlay( tmp ) )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit,
|
2012-09-15 12:13:03 +00:00
|
|
|
tempOptions.GetHPGLPenOverlay() * IU_PER_MILS );
|
|
|
|
m_HPGLPenOverlayOpt->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "HPGL pen overlay constrained." ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_INFO );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Default linewidth
|
|
|
|
msg = m_linesWidth->GetValue();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
tmp = ValueFromString( g_UserUnit, msg );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
if( !tempOptions.SetLineWidth( tmp ) )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, tempOptions.GetLineWidth() );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_linesWidth->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "Default line width constrained." ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_INFO );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// X scale
|
|
|
|
double tmpDouble;
|
|
|
|
msg = m_fineAdjustXscaleOpt->GetValue();
|
|
|
|
msg.ToDouble( &tmpDouble );
|
|
|
|
|
|
|
|
if( !setDouble( &m_XScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
|
|
|
|
{
|
|
|
|
msg.Printf( wxT( "%f" ), m_XScaleAdjust );
|
|
|
|
m_fineAdjustXscaleOpt->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "X scale constrained." ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_INFO );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
2015-07-20 14:24:56 +00:00
|
|
|
ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
// Y scale
|
|
|
|
msg = m_fineAdjustYscaleOpt->GetValue();
|
|
|
|
msg.ToDouble( &tmpDouble );
|
|
|
|
|
|
|
|
if( !setDouble( &m_YScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
|
|
|
|
{
|
|
|
|
msg.Printf( wxT( "%f" ), m_YScaleAdjust );
|
|
|
|
m_fineAdjustYscaleOpt->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "Y scale constrained." ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_INFO );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
|
|
|
// PS Width correction
|
|
|
|
msg = m_PSFineAdjustWidthOpt->GetValue();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int itmp = ValueFromString( g_UserUnit, msg );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) )
|
2012-09-15 12:13:03 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_PSWidthAdjust );
|
2012-09-15 12:13:03 +00:00
|
|
|
m_PSFineAdjustWidthOpt->SetValue( msg );
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "Width correction constrained. "
|
|
|
|
"The reasonable width correction value must be in a range of "
|
|
|
|
" [%+f; %+f] (%s) for current design rules. " ),
|
2012-09-24 06:39:59 +00:00
|
|
|
To_User_Unit( g_UserUnit, m_widthAdjustMinValue ),
|
|
|
|
To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ),
|
2012-09-15 12:13:03 +00:00
|
|
|
( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
|
2015-06-16 12:20:42 +00:00
|
|
|
reporter.Report( msg, REPORTER::RPT_WARNING );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
2012-09-24 06:39:59 +00:00
|
|
|
// Store m_PSWidthAdjust in mm in user config
|
2013-03-29 10:14:32 +00:00
|
|
|
ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ,
|
|
|
|
(double)m_PSWidthAdjust / IU_PER_MM );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2015-02-03 10:35:46 +00:00
|
|
|
tempOptions.SetFormat( getPlotFormat() );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2015-10-21 06:55:30 +00:00
|
|
|
tempOptions.SetUseGerberProtelExtensions( m_useGerberExtensions->GetValue() );
|
2014-06-19 06:26:53 +00:00
|
|
|
tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() );
|
2014-07-04 14:22:38 +00:00
|
|
|
tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 );
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
LSET selectedLayers;
|
2012-09-15 12:13:03 +00:00
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
2012-09-15 12:13:03 +00:00
|
|
|
{
|
|
|
|
if( m_layerCheckListBox->IsChecked( i ) )
|
2014-06-24 16:17:18 +00:00
|
|
|
selectedLayers.set( m_layerList[i] );
|
2012-09-15 12:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tempOptions.SetLayerSelection( selectedLayers );
|
|
|
|
tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
|
|
|
|
tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
|
|
|
|
|
|
|
|
// Set output directory and replace backslashes with forward ones
|
|
|
|
wxString dirStr;
|
|
|
|
dirStr = m_outputDirectoryName->GetValue();
|
|
|
|
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
|
|
|
|
tempOptions.SetOutputDirectory( dirStr );
|
|
|
|
|
|
|
|
if( m_plotOpts != tempOptions )
|
|
|
|
{
|
|
|
|
m_parent->SetPlotSettings( tempOptions );
|
|
|
|
m_plotOpts = tempOptions;
|
|
|
|
m_parent->OnModify();
|
|
|
|
}
|
|
|
|
}
|
2013-05-10 19:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2015-06-16 12:20:42 +00:00
|
|
|
wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
|
|
|
|
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
|
|
|
REPORTER& reporter = m_messagesPanel->Reporter();
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2014-10-26 13:59:01 +00:00
|
|
|
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
2013-05-10 19:22:29 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
|
2014-05-16 19:03:45 +00:00
|
|
|
wxBusyCursor dummy;
|
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
|
2013-05-10 19:22:29 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
LAYER_ID layer = *seq;
|
|
|
|
|
|
|
|
// 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() )
|
2015-10-20 18:03:07 +00:00
|
|
|
file_ext = GetGerberProtelExtension( layer );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2015-10-20 18:03:07 +00:00
|
|
|
// Create file name (from the English default layer name for non copper layers).
|
2014-06-24 16:17:18 +00:00
|
|
|
BuildPlotFileName( &fn, outputDir.GetPath(),
|
2015-10-20 18:03:07 +00:00
|
|
|
// m_board->GetStandardLayerName( layer ),
|
|
|
|
m_board->GetLayerName( layer ),
|
2014-06-24 16:17:18 +00:00
|
|
|
file_ext );
|
|
|
|
|
|
|
|
LOCALE_IO toggle;
|
|
|
|
|
|
|
|
BOARD* board = m_parent->GetBoard();
|
2014-06-30 06:44:46 +00:00
|
|
|
PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, layer, fn.GetFullPath(), wxEmptyString );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
|
|
|
// Print diags in messages box:
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
if( plotter )
|
2013-05-10 19:22:29 +00:00
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
PlotOneBoardLayer( board, plotter, layer, m_plotOpts );
|
|
|
|
plotter->EndPlot();
|
|
|
|
delete plotter;
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2015-06-16 12:20:42 +00:00
|
|
|
msg.Printf( _( "Plot file '%s' created." ), GetChars( fn.GetFullPath() ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_ACTION );
|
2013-05-10 19:22:29 +00:00
|
|
|
}
|
2014-06-24 16:17:18 +00:00
|
|
|
else
|
2015-06-16 12:20:42 +00:00
|
|
|
{
|
|
|
|
msg.Printf( _( "Unable to create file '%s'." ), GetChars( fn.GetFullPath() ) );
|
|
|
|
reporter.Report( msg, REPORTER::RPT_ERROR );
|
|
|
|
}
|
2013-05-10 19:22:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If no layer selected, we have nothing plotted.
|
|
|
|
// Prompt user if it happens because he could think there is a bug in Pcbnew.
|
2014-06-24 16:17:18 +00:00
|
|
|
if( !m_plotOpts.GetLayerSelection().any() )
|
2013-05-10 19:22:29 +00:00
|
|
|
DisplayError( this, _( "No layer selected" ) );
|
|
|
|
}
|