// Enable or disable widgets according to the plot format selected // and clear also some optional values void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) { // this option exist only in DXF format: m_DXF_plotModeOpt->Enable( getPlotFormat() == PLOT_FORMAT_DXF ); switch( getPlotFormat() ) { case PLOT_FORMAT_PDF: case PLOT_FORMAT_SVG: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); m_linesWidth->Enable( true ); m_HPGLPenSizeOpt->Enable( false ); m_excludeEdgeLayerOpt->Enable( true ); m_scaleOpt->Enable( false ); m_scaleOpt->SetSelection( 1 ); m_fineAdjustXscaleOpt->Enable( false ); m_fineAdjustYscaleOpt->Enable( false ); m_PSFineAdjustWidthOpt->Enable( false ); m_plotPSNegativeOpt->Enable( true ); m_forcePSA4OutputOpt->Enable( false ); m_forcePSA4OutputOpt->SetValue( false ); m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); 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_excludeEdgeLayerOpt->Enable( true ); 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 ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_GERBER: m_drillShapeOpt->Enable( false ); m_drillShapeOpt->SetSelection( 0 ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); m_linesWidth->Enable( true ); m_HPGLPenSizeOpt->Enable( false ); m_excludeEdgeLayerOpt->Enable( true ); 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 ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); 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_excludeEdgeLayerOpt->Enable( true ); 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 ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); break; case PLOT_FORMAT_DXF: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); m_linesWidth->Enable( false ); m_HPGLPenSizeOpt->Enable( false ); m_excludeEdgeLayerOpt->Enable( true ); 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->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); m_PlotOptionsSizer->Show( m_SizerDXF_options ); OnChangeDXFPlotMode( event ); break; } /* Update the interlock between scale and frame reference * (scaling would mess up the frame border...) */ OnSetScaleOpt( event ); Layout(); m_MainSizer->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 ); // 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 ); // The reasonable width correction value must be in a range of // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils. m_widthAdjustMinValue = -( m_board->GetDesignSettings().m_TrackMinWidth - 1 ); m_widthAdjustMaxValue = m_board->GetDesignSettings().GetSmallestClearanceValue() - 1; 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; case PLOT_FORMAT_PDF: m_plotFormatOpt->SetSelection( 5 ); break; } msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMargin, true ); m_SolderMaskMarginCurrValue->SetLabel( msg ); msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMinWidth, true ); m_SolderMaskMinWidthCurrValue->SetLabel( msg ); // Set units and value for HPGL pen size (this param in in mils). AddUnitSymbol( *m_textPenSize, g_UserUnit ); msg = StringFromValue( g_UserUnit, m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS ); m_HPGLPenSizeOpt->AppendText( msg ); AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit ); msg = StringFromValue( g_UserUnit, m_plotOpts.GetLineWidth() ); m_linesWidth->AppendText( msg ); // Set units for PS global width correction. AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit ); // 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. if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue ) 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() ); // Could devote a PlotOrder() function in place of UIOrder(). m_layerList = m_board->GetEnabledLayers().UIOrder(); // Populate the check list box by all enabled layers names for( LSEQ seq = m_layerList; seq; ++seq ) { PCB_LAYER_ID layer = *seq; int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) ); if( m_plotOpts.GetLayerSelection()[layer] ) m_layerCheckListBox->Check( checkIndex ); } // Option for using proper Gerber extensions m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberProtelExtensions() ); // Option for including Gerber attributes (from Gerber X2 format) in the output m_useGerberX2Attributes->SetValue( m_plotOpts.GetUseGerberAttributes() ); // Option for including Gerber netlist info (from Gerber X2 format) in the output m_useGerberNetAttributes->SetValue( m_plotOpts.GetIncludeGerberNetlistInfo() ); // Grey out if m_useGerberX2Attributes is not checked m_useGerberNetAttributes->Enable( m_useGerberX2Attributes->GetValue() ); // Option to generate a Gerber job file m_generateGerberJobFile->SetValue( m_plotOpts.GetCreateGerberJobFile() ); // Gerber precision for coordinates m_rbGerberFormat->SetSelection( m_plotOpts.GetGerberPrecision() == 5 ? 0 : 1 ); // 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 setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() ); // Plot outline mode m_DXF_plotModeOpt->SetValue( m_plotOpts.GetDXFPlotPolygonMode() ); // Plot text mode m_DXF_plotTextStrokeFontOpt->SetValue( m_plotOpts.GetTextMode() == PLOTTEXTMODE_DEFAULT ); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); // Put vias on mask layer m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() ); // Initialize a few other parameters, which can also be modified // from the drill dialog reInitDialog(); // Update options values: wxCommandEvent cmd_event; SetPlotFormat( cmd_event ); OnSetScaleOpt( cmd_event ); }
// Enable or disable widgets according to the plot format selected // and clear also some optional values void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) { switch( getPlotFormat() ) { case PLOT_FORMAT_PDF: case PLOT_FORMAT_SVG: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); setPlotModeChoiceSelection( FILLED ); 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 ); m_useGerberAttributes->Enable( false ); m_useGerberAttributes->SetValue( false ); m_scaleOpt->Enable( false ); m_scaleOpt->SetSelection( 1 ); m_fineAdjustXscaleOpt->Enable( false ); m_fineAdjustYscaleOpt->Enable( false ); m_PSFineAdjustWidthOpt->Enable( false ); m_plotPSNegativeOpt->Enable( true ); m_forcePSA4OutputOpt->Enable( false ); m_forcePSA4OutputOpt->SetValue( false ); 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 ); m_useGerberAttributes->Enable( false ); m_useGerberAttributes->SetValue( false ); 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 ); setPlotModeChoiceSelection( FILLED ); 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 ); m_useGerberAttributes->Enable( true ); 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 ); m_useGerberAttributes->Enable( false ); m_useGerberAttributes->SetValue( false ); 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 ); m_plotModeOpt->Enable( false ); 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 ); m_useGerberAttributes->Enable( false ); m_useGerberAttributes->SetValue( false ); 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->Hide( m_GerberOptionsSizer ); 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 ); }