void PCB_EDIT_FRAME::updateViaSizeSelectBox() { if( m_SelViaSizeBox == NULL ) return; wxString msg; m_SelViaSizeBox->Clear(); bool mmFirst = g_UserUnit != INCHES; for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ ) { int diam = GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter; double valueMils = To_User_Unit( INCHES, diam ) * 1000; double value_mm = To_User_Unit( MILLIMETRES, diam ); if( mmFirst ) msg.Printf( _( "Via: %.2f mm (%.1f mils)" ), value_mm, valueMils ); else msg.Printf( _( "Via: %.1f mils (%.2f mm)" ), valueMils, value_mm ); int hole = GetDesignSettings().m_ViasDimensionsList[ii].m_Drill; if( hole ) { msg << wxT("/ "); wxString hole_str; valueMils = To_User_Unit( INCHES, hole ) * 1000; value_mm = To_User_Unit( MILLIMETRES, hole ); if( mmFirst ) hole_str.Printf( _( "%.2f mm (%.1f mils)" ), value_mm, valueMils ); else hole_str.Printf( _( "%.1f mils (%.2f mm)" ), valueMils, value_mm ); msg += hole_str; } // Mark the netclass via size value (the first in list) if( ii == 0 ) msg << wxT( " *" ); m_SelViaSizeBox->Append( msg ); } if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() ) GetDesignSettings().SetViaSizeIndex( 0 ); m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() ); }
void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) { static SCH_MARKER* lastMarker = NULL; wxString msg; SCH_SHEET_LIST schematic; SCH_SHEET_PATH* sheetFoundIn = NULL; bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0; wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() ); bool warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) || !( event.GetFlags() & FR_NO_WARP_CURSOR ) ); if( event.GetFlags() & FR_CURRENT_SHEET_ONLY ) { sheetFoundIn = m_CurrentSheet; lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap ); } else { lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn, lastMarker, wrap ); } if( lastMarker != NULL ) { if( *sheetFoundIn != *m_CurrentSheet ) { sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() ); *m_CurrentSheet = *sheetFoundIn; m_CurrentSheet->UpdateAllScreenReferences(); } sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() ); RedrawScreen( lastMarker->GetPosition(), warpCursor ); wxString path = sheetFoundIn->Path(); wxString units = GetAbbreviatedUnitsLabel(); double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x, m_internalUnits ); double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y, m_internalUnits ); msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ), GetChars( path ), x, GetChars( units ), y, GetChars( units) ); SetStatusText( msg ); } else { SetStatusText( _( "No more markers were found." ) ); } }
void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::SaveSettings( aCfg ); wxString baseCfgName = GetName(); aCfg->Write( baseCfgName + UserGridSizeXEntry, To_User_Unit( m_UserUnits, m_UserGridSize.x ) ); aCfg->Write( baseCfgName + UserGridSizeYEntry, To_User_Unit( m_UserUnits, m_UserGridSize.y ) ); aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserUnits ); aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum ); aCfg->Write( baseCfgName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill ); aCfg->Write( baseCfgName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill ); aCfg->Write( baseCfgName + FastGrid1Entry, ( long )m_FastGrid1 ); aCfg->Write( baseCfgName + FastGrid2Entry, ( long )m_FastGrid2 ); }
void PCB_BASE_FRAME::updateGridSelectBox() { UpdateStatusBar(); DisplayUnitsMsg(); if( m_gridSelectBox == NULL ) return; // Update grid values with the current units setting. m_gridSelectBox->Clear(); wxString msg; wxString format = _( "Grid"); switch( g_UserUnit ) { case INCHES: format += wxT( " %.1f" ); break; case MILLIMETRES: format += wxT( " %.3f" ); break; case UNSCALED_UNITS: format += wxT( " %f" ); break; } for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) { GRID_TYPE& grid = GetScreen()->GetGrid( i ); double value = To_User_Unit( g_UserUnit, grid.m_Size.x ); if( grid.m_Id != ID_POPUP_GRID_USER ) { switch( g_UserUnit ) { case INCHES: msg.Printf( format.GetData(), value * 1000 ); break; case MILLIMETRES: case UNSCALED_UNITS: msg.Printf( format.GetData(), value ); break; } } else msg = _( "User Grid" ); m_gridSelectBox->Append( msg, (void*) &grid.m_Id ); if( ( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) == GetScreen()->GetGrid( i ).m_Id ) m_gridSelectBox->SetSelection( i ); } }
int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst) const { wxString msg; wxRealPoint curr_grid_size = GetGridSize(); int idx = -1; int idx_usergrid = -1; for( size_t i = 0; i < GetGridCount(); i++ ) { const GRID_TYPE& grid = m_grids[i]; double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000; double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x ); if( grid.m_CmdId == ID_POPUP_GRID_USER ) { if( aMmFirst ) msg.Printf( _( "User grid: %.4f mm (%.2f mils)" ), gridValue_mm, gridValueMils ); else msg.Printf( _( "User grid: %.2f mils (%.4f mm)" ), gridValueMils, gridValue_mm ); idx_usergrid = i; } else { if( aMmFirst ) msg.Printf( _( "Grid: %.4f mm (%.2f mils)" ), gridValue_mm, gridValueMils ); else msg.Printf( _( "Grid: %.2f mils (%.4f mm)" ), gridValueMils, gridValue_mm ); } aGridsList.Add( msg ); if( curr_grid_size == grid.m_Size ) idx = i; } if( idx < 0 ) idx = idx_usergrid; return idx; }
/* Convert a value to a string using double notation. * For readability, the mantissa has 3 or more digits, * the trailing 0 are removed if the mantissa has more than 3 digits * and some trailing 0 * This function should be used to display values in dialogs because a value * entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa * if displayed in inch to avoid truncation or rounding made just by the printf function. * otherwise the actual value is rounded when read from dialog and converted * in internal units, and therefore modified. */ wxString StringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol ) { double value_to_print = To_User_Unit( aUnit, aValue ); #if defined( EESCHEMA ) wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print ); // Strip trailing zeros. However, keep at least 3 digits in mantissa // For readability StripTrailingZeros( stringValue, 3 ); #else char buf[50]; int len; if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 ) { len = sprintf( buf, "%.10f", value_to_print ); while( --len > 0 && buf[len] == '0' ) buf[len] = '\0'; if( buf[len]=='.' || buf[len]==',' ) buf[len] = '\0'; else ++len; } else { len = sprintf( buf, "%.10g", value_to_print ); } wxString stringValue( buf, wxConvUTF8 ); #endif if( aAddUnitSymbol ) { switch( aUnit ) { case INCHES: stringValue += _( " \"" ); break; case MILLIMETRES: stringValue += _( " mm" ); break; case UNSCALED_UNITS: break; } } return stringValue; }
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) : DIALOG_TRACK_VIA_SIZE_BASE( aParent ), m_settings( aSettings ) { // Load router settings to dialog fields m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetTrackWidth() ) ); m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetViaDiameter() ) ); m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetViaDrill() ) ); m_trackWidth->SetFocus(); GetSizer()->SetSizeHints( this ); // Pressing ENTER when any of the text input fields is active applies changes #if wxCHECK_VERSION( 3, 0, 0 ) Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this ); #else Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this ); #endif }
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar(void) /*********************************************************/ { int ii; wxString msg; if ( m_AuxiliaryToolBar == NULL ) { m_AuxiliaryToolBar = new WinEDA_Toolbar(TOOLBAR_AUX, this, ID_AUX_TOOLBAR, TRUE); // Set up toolbar m_AuxiliaryToolBar->AddSeparator(); // Boite de selection du pas de grille m_SelGridBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_ON_GRID_SELECT, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH , -1)); m_AuxiliaryToolBar->AddControl( m_SelGridBox); // Boite de selection du Zoom m_AuxiliaryToolBar->AddSeparator(); m_SelZoomBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_ON_ZOOM_SELECT, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH , -1)); msg = _("Auto"); m_SelZoomBox->Append(msg); for ( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ ) { msg.Printf(_("Zoom %d"), ii); m_SelZoomBox->Append(msg); } m_SelZoomBox->Append(wxT("")); m_AuxiliaryToolBar->AddControl( m_SelZoomBox); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes m_AuxiliaryToolBar->Realize(); } // mise a jour des affichages m_SelGridBox->Clear(); for ( ii = 0; g_GridList[ii].x > 0; ii++ ) { double value = To_User_Unit(UnitMetric, g_GridList[ii].x, PCB_INTERNAL_UNIT); if ( UnitMetric == INCHES ) msg.Printf(_("Grid %.1f"), value * 1000); else msg.Printf(_("Grid %.3f"), value); m_SelGridBox->Append(msg); } m_SelGridBox->Append( _("User Grid") ); SetToolbars(); }
static wxMenu * Append_Track_Width_List(void) /********************************************/ /* Ajoute au menu wxMenu * menu un sous-menu liste des epaisseurs de pistes disponibles */ { int ii; wxString msg; wxMenu * trackwidth; double value; trackwidth = new wxMenu; for ( ii = 0; ii < 6; ii++ ) { if ( g_DesignSettings.m_TrackWidhtHistory[ii] == 0 ) break; value = To_User_Unit(g_UnitMetric, g_DesignSettings.m_TrackWidhtHistory[ii], PCB_INTERNAL_UNIT); if ( g_UnitMetric == INCHES ) // Affichage en mils msg.Printf(_("Track %.1f"), value * 1000); else msg.Printf(_("Track %.3f"), value); trackwidth->Append(ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE); if( g_DesignSettings.m_TrackWidhtHistory[ii] == g_DesignSettings.m_CurrentTrackWidth ) trackwidth->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE); } trackwidth->AppendSeparator(); for ( ii = 0; ii < 4; ii++ ) { if ( g_DesignSettings.m_ViaSizeHistory[ii] == 0 ) break; value = To_User_Unit(g_UnitMetric, g_DesignSettings.m_ViaSizeHistory[ii], PCB_INTERNAL_UNIT); if ( g_UnitMetric == INCHES ) msg.Printf(_("Via %.1f"), value * 1000); else msg.Printf(_("Via %.3f"), value); trackwidth->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, TRUE); if( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize ) trackwidth->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, TRUE); } return trackwidth; }
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) : DIALOG_LABEL_EDITOR_BASE( aParent ) { m_Parent = aParent; m_CurrentText = aTextItem; InitDialog(); // Conservative limits 0.0 to 10.0 inches const int minSize = 0; // a value like 0.01 is better, but if > 0, creates // annoying issues when trying to enter a value starting by 0 or .0 const int maxSize = 10 * 1000 * IU_PER_MILS; wxFloatingPointValidator<double> textSizeValidator( NULL, wxNUM_VAL_NO_TRAILING_ZEROES ); textSizeValidator.SetPrecision( 4 ); textSizeValidator.SetRange( To_User_Unit( g_UserUnit, minSize ), To_User_Unit( g_UserUnit, maxSize ) ); m_TextSize->SetValidator( textSizeValidator ); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
void PCB_EDIT_FRAME::updateTraceWidthSelectBox() { if( m_SelTrackWidthBox == NULL ) return; wxString msg; bool mmFirst = g_UserUnit != INCHES; m_SelTrackWidthBox->Clear(); for( unsigned ii = 0; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ ) { int size = GetDesignSettings().m_TrackWidthList[ii]; double valueMils = To_User_Unit( INCHES, size ) * 1000; double value_mm = To_User_Unit( MILLIMETRES, size ); if( mmFirst ) msg.Printf( _( "Track: %.3f mm (%.2f mils)" ), value_mm, valueMils ); else msg.Printf( _( "Track: %.2f mils (%.3f mm)" ), valueMils, value_mm ); // Mark the netclass track width value (the first in list) if( ii == 0 ) msg << wxT( " *" ); m_SelTrackWidthBox->Append( msg ); } if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() ) GetDesignSettings().SetTrackWidthIndex( 0 ); m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() ); }
/* * Update the status bar information. */ void PCB_BASE_FRAME::UpdateStatusBar() { EDA_DRAW_FRAME::UpdateStatusBar(); if( DisplayOpt.DisplayPolarCood ) // display polar coordinates { PCB_SCREEN* screen = GetScreen(); if( !screen ) return; wxString Line; double theta, ro; int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; if( dx==0 && dy==0 ) theta = 0.0; else theta = atan2( (double) -dy, (double) dx ); theta = theta * 180.0 / M_PI; ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); wxString formatter; switch( g_UserUnit ) { case INCHES: formatter = wxT( "Ro %.4f Th %.1f" ); break; case MILLIMETRES: formatter = wxT( "Ro %.3f Th %.1f" ); break; case UNSCALED_UNITS: formatter = wxT( "Ro %f Th %f" ); break; } Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_internalUnits ), theta ); // overwrite the absolute cartesian coordinates SetStatusText( Line, 2 ); } }
wxString LengthDoubleToString( double aValue, bool aConvertToMils ) { wxString text; const wxChar* format; double value = To_User_Unit( g_UserUnit, aValue ); if( g_UserUnit == INCHES ) { if( aConvertToMils ) { #if defined( EESCHEMA ) format = wxT( "%.0f" ); #else format = wxT( "%.1f" ); #endif value *= 1000; } else { #if defined( EESCHEMA ) format = wxT( "%.3f" ); #else format = wxT( "%.4f" ); #endif } } else { #if defined( EESCHEMA ) format = wxT( "%.2f" ); #else format = wxT( "%.3f" ); #endif } text.Printf( format, value ); if( g_UserUnit == INCHES ) text += ( aConvertToMils ) ? _( " mils" ) : _( " in" ); else text += _( " mm" ); return text; }
void DIALOG_PLOT::applyPlotSettings() { REPORTER& reporter = m_messagesPanel->Reporter(); 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() ); tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option tempOptions.SetTextMode( PLOTTEXTMODE_DEFAULT ); else tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOTTEXTMODE_DEFAULT : PLOTTEXTMODE_NATIVE ); // 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(); int tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS; if( !tempOptions.SetHPGLPenDiameter( tmp ) ) { msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS ); m_HPGLPenSizeOpt->SetValue( msg ); msg.Printf( _( "HPGL pen size constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } // Default linewidth msg = m_linesWidth->GetValue(); tmp = ValueFromString( g_UserUnit, msg ); if( !tempOptions.SetLineWidth( tmp ) ) { msg = StringFromValue( g_UserUnit, tempOptions.GetLineWidth() ); m_linesWidth->SetValue( msg ); msg.Printf( _( "Default line width constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } // 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 ); msg.Printf( _( "X scale constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust ); // 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 ); msg.Printf( _( "Y scale constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust ); // PS Width correction msg = m_PSFineAdjustWidthOpt->GetValue(); int itmp = ValueFromString( g_UserUnit, msg ); if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) ) { msg = StringFromValue( g_UserUnit, m_PSWidthAdjust ); m_PSFineAdjustWidthOpt->SetValue( msg ); msg.Printf( _( "Width correction constrained. " "The reasonable width correction value must be in a range of " " [%+f; %+f] (%s) for current design rules. " ), To_User_Unit( g_UserUnit, m_widthAdjustMinValue ), To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ), ( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) ); reporter.Report( msg, REPORTER::RPT_WARNING ); } // Store m_PSWidthAdjust in mm in user config ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM ); tempOptions.SetFormat( getPlotFormat() ); tempOptions.SetUseGerberProtelExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberAttributes( m_useGerberX2Attributes->GetValue() ); tempOptions.SetIncludeGerberNetlistInfo( m_useGerberNetAttributes->GetValue() ); tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() ); tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 ); LSET selectedLayers; for( unsigned i = 0; i < m_layerList.size(); i++ ) { if( m_layerCheckListBox->IsChecked( i ) ) selectedLayers.set( m_layerList[i] ); } // Get a list of copper layers that aren't being used by inverting enabled layers. LSET disabledCopperLayers = LSET::AllCuMask() & ~m_board->GetEnabledLayers(); // Enable all of the disabled copper layers. // If someone enables more copper layers they will be selected by default. selectedLayers = selectedLayers | disabledCopperLayers; 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.IsSameAs( tempOptions, false ) ) { // First, mark board as modified only for parameters saved in file if( !m_plotOpts.IsSameAs( tempOptions, true ) ) m_parent->OnModify(); // Now, save any change, for the session m_parent->SetPlotSettings( tempOptions ); m_plotOpts = tempOptions; } }
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 ); }
/* * Update the status bar information. */ void PCB_BASE_FRAME::UpdateStatusBar() { PCB_SCREEN* screen = GetScreen(); if( !screen ) return; int dx; int dy; double dXpos; double dYpos; wxString line; wxString locformatter; DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); EDA_DRAW_FRAME::UpdateStatusBar(); if( displ_opts->m_DisplayPolarCood ) // display polar coordinates { double theta, ro; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; theta = ArcTangente( -dy, dx ) / 10; ro = hypot( dx, dy ); wxString formatter; switch( g_UserUnit ) { case INCHES: formatter = wxT( "Ro %.6f Th %.1f" ); break; case MILLIMETRES: formatter = wxT( "Ro %.6f Th %.1f" ); break; case UNSCALED_UNITS: formatter = wxT( "Ro %f Th %f" ); break; case DEGREES: wxASSERT( false ); break; } line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta ); SetStatusText( line, 3 ); } // Display absolute coordinates: dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x ); dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y ); // The following sadly is an if Eeschema/if Pcbnew wxString absformatter; switch( g_UserUnit ) { case INCHES: absformatter = wxT( "X %.6f Y %.6f" ); locformatter = wxT( "dx %.6f dy %.6f dist %.4f" ); break; case MILLIMETRES: absformatter = wxT( "X %.6f Y %.6f" ); locformatter = wxT( "dx %.6f dy %.6f dist %.3f" ); break; case UNSCALED_UNITS: absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f dist %f" ); break; case DEGREES: wxASSERT( false ); break; } line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates { // Display relative coordinates: dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; dXpos = To_User_Unit( g_UserUnit, dx ); dYpos = To_User_Unit( g_UserUnit, dy ); // We already decided the formatter above line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); SetStatusText( line, 3 ); } }
/* * Update the status bar information. */ void GERBVIEW_FRAME::UpdateStatusBar() { EDA_DRAW_FRAME::UpdateStatusBar(); GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen(); if( !screen ) return; int dx; int dy; double dXpos; double dYpos; wxString line; wxString locformatter; if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates { double theta, ro; dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; // atan2 in the 0,0 case returns 0 theta = RAD2DEG( atan2( -dy, dx ) ); ro = hypot( dx, dy ); wxString formatter; switch( g_UserUnit ) { case INCHES: formatter = wxT( "Ro %.6f Th %.1f" ); break; case MILLIMETRES: formatter = wxT( "Ro %.5f Th %.1f" ); break; case UNSCALED_UNITS: formatter = wxT( "Ro %f Th %f" ); break; case DEGREES: wxASSERT( false ); break; } line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta ); SetStatusText( line, 3 ); } // Display absolute coordinates: dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x ); dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y ); wxString absformatter; switch( g_UserUnit ) { case INCHES: absformatter = wxT( "X %.6f Y %.6f" ); locformatter = wxT( "dx %.6f dy %.6f dist %.4f" ); break; case MILLIMETRES: absformatter = wxT( "X %.5f Y %.5f" ); locformatter = wxT( "dx %.5f dy %.5f dist %.3f" ); break; case UNSCALED_UNITS: absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f dist %f" ); break; case DEGREES: wxASSERT( false ); break; } line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates { // Display relative coordinates: dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; dXpos = To_User_Unit( g_UserUnit, dx ); dYpos = To_User_Unit( g_UserUnit, dy ); // We already decided the formatter above line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); SetStatusText( line, 3 ); } }
void SCH_BASE_FRAME::UpdateStatusBar() { wxString line; int dx, dy; BASE_SCREEN* screen = GetScreen(); if( !screen ) return; EDA_DRAW_FRAME::UpdateStatusBar(); // Display absolute coordinates: double dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x ); double dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y ); if ( g_UserUnit == MILLIMETRES ) { dXpos = RoundTo0( dXpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 ); } wxString absformatter; wxString locformatter; switch( g_UserUnit ) { case INCHES: absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f d %.3f" ); break; case MILLIMETRES: absformatter = wxT( "X %.2f Y %.2f" ); locformatter = wxT( "dx %.2f dy %.2f d %.2f" ); break; case UNSCALED_UNITS: absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f d %f" ); break; } line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); // Display relative coordinates: dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; dXpos = To_User_Unit( g_UserUnit, dx ); dYpos = To_User_Unit( g_UserUnit, dy ); if( g_UserUnit == MILLIMETRES ) { dXpos = RoundTo0( dXpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 ); } // We already decided the formatter above line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); SetStatusText( line, 3 ); // refresh units display DisplayUnitsMsg(); }
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() { if( m_parameterGrid == NULL ) return; FOOTPRINT_WIZARD* footprintWizard = GetMyWizard(); if( footprintWizard == NULL ) return; int page = m_pageList->GetSelection(); if( page<0 ) return; m_parameterGrid->ClearGrid(); // Rows m_parameterGrid->AutoSizeRows(); m_parameterGrid->EnableDragRowSize( true ); m_parameterGrid->SetRowLabelSize( 1 ); m_parameterGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // Get the list of names, values, and types wxArrayString fpList = footprintWizard->GetParameterNames( page ); wxArrayString fvList = footprintWizard->GetParameterValues( page ); wxArrayString ptList = footprintWizard->GetParameterTypes( page ); // Dimension the wxGrid m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() ); m_parameterGrid->AppendRows( fpList.size() ); wxString name, value, units; for( unsigned int i = 0; i<fpList.size(); i++ ) { name = fpList[i]; value = fvList[i]; m_parameterGrid->SetCellValue( i, 0, name ); m_parameterGrid->SetReadOnly( i, 0 ); if( ptList[i]==wxT( "IU" ) ) { LOCALE_IO toggle; // We are handling internal units, so convert them to the current // system selected units and store into value. double dValue; value.ToDouble( &dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); if( g_UserUnit==INCHES ) // we convert inches into mils for more detail { dValue = dValue * 1000.0; units = wxT( "mils" ); } else if( g_UserUnit==MILLIMETRES ) { units = wxT( "mm" ); } std::string s = Double2Str( dValue ); value = FROM_UTF8( s.c_str() ); } else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N { units = wxT( "" ); } m_parameterGrid->SetCellValue( i, 1, value ); m_parameterGrid->SetCellValue( i, 2, units ); m_parameterGrid->SetReadOnly( i, 2 ); } m_parameterGrid->AutoSizeColumns(); }
/* * Update the status bar information. */ void PCB_BASE_FRAME::UpdateStatusBar() { PCB_SCREEN* screen = GetScreen(); if( !screen ) return; wxString line; wxString locformatter; EDA_DRAW_FRAME::UpdateStatusBar(); if( GetShowPolarCoords() ) // display polar coordinates { double dx = (double)GetCrossHairPosition().x - (double)screen->m_O_Curseur.x; double dy = (double)GetCrossHairPosition().y - (double)screen->m_O_Curseur.y; double theta = ArcTangente( -dy, dx ) / 10; double ro = hypot( dx, dy ); wxString formatter; switch( GetUserUnits() ) { case INCHES: formatter = "r %.6f theta %.1f"; break; case MILLIMETRES: formatter = "r %.6f theta %.1f"; break; case UNSCALED_UNITS: formatter = "r %f theta %f"; break; case DEGREES: wxASSERT( false ); break; } line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta ); SetStatusText( line, 3 ); } // Display absolute coordinates: double dXpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().x ); double dYpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().y ); // The following sadly is an if Eeschema/if Pcbnew wxString absformatter; switch( GetUserUnits() ) { case INCHES: absformatter = "X %.6f Y %.6f"; locformatter = "dx %.6f dy %.6f dist %.4f"; break; case MILLIMETRES: absformatter = "X %.6f Y %.6f"; locformatter = "dx %.6f dy %.6f dist %.3f"; break; case UNSCALED_UNITS: absformatter = "X %f Y %f"; locformatter = "dx %f dy %f dist %f"; break; case DEGREES: wxASSERT( false ); break; } line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); if( !GetShowPolarCoords() ) // display relative cartesian coordinates { // Display relative coordinates: double dx = (double)GetCrossHairPosition().x - (double)screen->m_O_Curseur.x; double dy = (double)GetCrossHairPosition().y - (double)screen->m_O_Curseur.y; dXpos = To_User_Unit( GetUserUnits(), dx ); dYpos = To_User_Unit( GetUserUnits(), dy ); // We already decided the formatter above line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) ); SetStatusText( line, 3 ); } }
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar(void) /****************************************************/ /* Create auxiliary horizontal toolbar */ { int ii; wxString msg; if ( m_AuxiliaryToolBar == NULL ) { m_AuxiliaryToolBar = new WinEDA_Toolbar(TOOLBAR_AUX, this, ID_AUX_TOOLBAR, TRUE); // Set up toolbar m_AuxiliaryToolBar->AddSeparator(); m_SelTrackWidthBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH+20, -1)); m_AuxiliaryToolBar->AddControl(m_SelTrackWidthBox); m_SelTrackWidthBox_Changed = TRUE; m_AuxiliaryToolBar->AddSeparator(); m_SelViaSizeBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_AUX_TOOLBAR_PCB_VIA_SIZE, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH+10, -1)); m_AuxiliaryToolBar->AddControl(m_SelViaSizeBox); m_AuxiliaryToolBar->AddSeparator(); // Boite de selection du pas de grille m_SelGridBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_ON_GRID_SELECT, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH, -1)); m_AuxiliaryToolBar->AddControl( m_SelGridBox); // Boite de selection du Zoom m_AuxiliaryToolBar->AddSeparator(); m_SelZoomBox = new WinEDAChoiceBox(m_AuxiliaryToolBar, ID_ON_ZOOM_SELECT, wxPoint(-1,-1), wxSize(LISTBOX_WIDTH, -1)); msg = _("Auto"); m_SelZoomBox->Append(msg); for ( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ ) { msg = _("Zoom "); msg << ii; m_SelZoomBox->Append(msg); } m_SelZoomBox->Append(wxT("")); m_AuxiliaryToolBar->AddControl( m_SelZoomBox); // after adding the buttons to the toolbar, must call Realize() m_AuxiliaryToolBar->Realize(); } // mise a jour des affichages m_SelGridBox->Clear(); wxString format = _("Grid"); if ( UnitMetric == INCHES ) format += wxT(" %.1f"); else format += wxT(" %.3f"); for ( ii = 0; g_GridList[ii].x > 0; ii++ ) { double value = To_User_Unit(UnitMetric, g_GridList[ii].x, PCB_INTERNAL_UNIT); if ( UnitMetric == INCHES ) msg.Printf( format.GetData(), value * 1000); else msg.Printf( format.GetData(), value); m_SelGridBox->Append(msg); } m_SelGridBox->Append( _("User Grid") ); m_SelViaSizeBox_Changed = TRUE; m_SelTrackWidthBox_Changed = TRUE; SetToolbars(); }
void WinEDA_PcbFrame::SetToolbars(void) /***************************************/ /* Active ou desactive les tools des toolbars, en fonction des commandes en cours */ { int ii, jj; if ( m_ID_current_state == ID_TRACK_BUTT ) { if ( Drc_On ) DrawPanel->SetCursor(wxCursor(wxCURSOR_PENCIL)); else DrawPanel->SetCursor(wxCursor(wxCURSOR_QUESTION_ARROW)); } if( m_HToolBar == NULL ) return; m_HToolBar->EnableTool(ID_SAVE_BOARD,m_CurrentScreen->IsModify()); if ( m_CurrentScreen->BlockLocate.m_Command == BLOCK_MOVE ) { m_HToolBar->EnableTool(wxID_CUT,TRUE); m_HToolBar->EnableTool(wxID_COPY,TRUE); } else { m_HToolBar->EnableTool(wxID_CUT,FALSE); m_HToolBar->EnableTool(wxID_COPY,FALSE); } if ( g_UnDeleteStackPtr ) { m_HToolBar->EnableTool(wxID_PASTE,TRUE); } else { m_HToolBar->EnableTool(wxID_PASTE,FALSE); } if ( g_UnDeleteStackPtr ) { m_HToolBar->EnableTool(ID_UNDO_BUTT,TRUE); } else m_HToolBar->EnableTool(ID_UNDO_BUTT,FALSE); if ( m_OptionsToolBar ) { m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_DRC_OFF, ! Drc_On); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_DRC_OFF, Drc_On ? _("DCR Off (Disable !!!), Currently: DRC is active") : _("DRC On (Currently: DRC is DISABLE !!!)")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_MM, UnitMetric == MILLIMETRE ? TRUE : FALSE); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_UNIT_INCH, UnitMetric == INCHES ? TRUE : FALSE); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLAR_COORD, DisplayOpt.DisplayPolarCood); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_POLAR_COORD, DisplayOpt.DisplayPolarCood ? _("Polar Coords not show") : _("Display Polar Coords")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid ? _("Grid not show") : _("Show Grid")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SELECT_CURSOR, g_CursorShape); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_RATSNEST, g_Show_Ratsnest); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_RATSNEST, g_Show_Ratsnest ? _("General ratsnest not show") : _("Show General ratsnest")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, g_Show_Module_Ratsnest); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, g_Show_Module_Ratsnest ? _("Module ratsnest not show") : _("Show Module ratsnest")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_AUTO_DEL_TRACK, g_AutoDeleteOldTrack); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_AUTO_DEL_TRACK, g_AutoDeleteOldTrack ? _("Disable Auto Delete old Track") : _("Enable Auto Delete old Track")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_ZONES, DisplayOpt.DisplayZones); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_ZONES, DisplayOpt.DisplayZones ? _("Do not Show Zones") : _("Show Zones")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_PADS_SKETCH, ! m_DisplayPadFill); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_DisplayPadFill ? _("Show Pads Sketch mode") : _("Show pads filled mode")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, ! m_DisplayPcbTrackFill); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_DisplayPcbTrackFill ? _("Show Tracks Sketch mode") : _("Show Tracks filled mode")); m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE, DisplayOpt.ContrastModeDisplay); m_OptionsToolBar->SetToolShortHelp(ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE, DisplayOpt.ContrastModeDisplay ? _("Normal Contrast Mode Display") : _("Hight Contrast Mode Display")); } if ( m_AuxiliaryToolBar ) { wxString msg; if ( m_SelTrackWidthBox && m_SelTrackWidthBox_Changed) { m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox->Clear(); wxString format = _("Track"); if ( UnitMetric == INCHES ) format += wxT(" %.1f"); else format += wxT(" %.3f"); for ( ii = 0; ii < HIST0RY_NUMBER; ii++) { if ( g_DesignSettings.m_TrackWidhtHistory[ii] == 0 ) break; // Fin de liste double value = To_User_Unit(UnitMetric, g_DesignSettings.m_TrackWidhtHistory[ii], PCB_INTERNAL_UNIT); if ( UnitMetric == INCHES ) msg.Printf(format.GetData(), value * 1000); else msg.Printf(format.GetData(), value); m_SelTrackWidthBox->Append(msg); if ( g_DesignSettings.m_TrackWidhtHistory[ii] == g_DesignSettings.m_CurrentTrackWidth ) m_SelTrackWidthBox->SetSelection(ii); } } if ( m_SelViaSizeBox && m_SelViaSizeBox_Changed ) { m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox->Clear(); wxString format = _("Via"); if ( UnitMetric == INCHES ) format += wxT(" %.1f"); else format += wxT(" %.3f"); for ( ii = 0; ii < HIST0RY_NUMBER; ii++) { if ( g_DesignSettings.m_ViaSizeHistory[ii] == 0 ) break; // Fin de liste double value = To_User_Unit(UnitMetric, g_DesignSettings.m_ViaSizeHistory[ii], PCB_INTERNAL_UNIT); if ( UnitMetric == INCHES ) msg.Printf(format.GetData(), value * 1000); else msg.Printf(format.GetData(), value); m_SelViaSizeBox->Append(msg); if ( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize ) m_SelViaSizeBox->SetSelection(ii); } } if ( m_SelZoomBox ) { int kk = m_SelZoomBox->GetSelection(); for ( jj = 0, ii = 1; ii <= 2048; ii <<= 1, jj++ ) { if ( m_CurrentScreen && (m_CurrentScreen->GetZoom() == ii) ) { if ( kk != jj )m_SelZoomBox->SetSelection(jj); kk = jj; break; } } if ( kk != jj )m_SelZoomBox->SetSelection(-1); } if ( m_SelGridBox && m_CurrentScreen) { int kk = m_SelGridBox->GetSelection(); for ( ii = 0; g_GridList[ii].x > 0; ii++ ) { if ( !m_CurrentScreen->m_UserGridIsON && (m_CurrentScreen->GetGrid().x == g_GridList[ii].x) && (m_CurrentScreen->GetGrid().y == g_GridList[ii].y) ) { if (kk != ii) m_SelGridBox->SetSelection(ii); kk = ii; break; } } if ( kk != ii ) m_SelGridBox->SetSelection(ii); /* User Grid */ } } ReCreateLayerBox(NULL); DisplayUnitsMsg(); }
/* * Update the status bar information. */ void PCB_BASE_FRAME::UpdateStatusBar() { EDA_DRAW_FRAME::UpdateStatusBar(); PCB_SCREEN* screen = GetScreen(); if( !screen ) return; int dx; int dy; double dXpos; double dYpos; wxString line; wxString locformatter; if( DisplayOpt.DisplayPolarCood ) // display polar coordinates { double theta, ro; dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; if( dx==0 && dy==0 ) theta = 0.0; else theta = atan2( (double) -dy, (double) dx ); theta = theta * 180.0 / M_PI; ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); wxString formatter; switch( g_UserUnit ) { #if defined( USE_PCBNEW_NANOMETRE ) case INCHES: formatter = wxT( "Ro %.6f Th %.1f" ); break; case MILLIMETRES: formatter = wxT( "Ro %.6f Th %.1f" ); break; #else case INCHES: formatter = wxT( "Ro %.4f Th %.1f" ); break; case MILLIMETRES: formatter = wxT( "Ro %.3f Th %.1f" ); break; #endif case UNSCALED_UNITS: formatter = wxT( "Ro %f Th %f" ); break; } line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta ); SetStatusText( line, 3 ); } // Display absolute coordinates: dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x ); dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y ); if ( g_UserUnit == MILLIMETRES ) { dXpos = RoundTo0( dXpos, 1000.0 ); dYpos = RoundTo0( dYpos, 1000.0 ); } // The following sadly is an if Eeschema/if Pcbnew wxString absformatter; switch( g_UserUnit ) { #if defined( USE_PCBNEW_NANOMETRES ) case INCHES: absformatter = wxT( "X %.6f Y %.6f" ); locformatter = wxT( "dx %.6f dy %.6f d %.6f" ); break; case MILLIMETRES: absformatter = wxT( "X %.6f Y %.6f" ); locformatter = wxT( "dx %.6f dy %.6f d %.6f" ); break; #else case INCHES: absformatter = wxT( "X %.4f Y %.4f" ); locformatter = wxT( "dx %.4f dy %.4f d %.4f" ); break; case MILLIMETRES: absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f d %.3f" ); break; #endif case UNSCALED_UNITS: absformatter = wxT( "X %f Y %f" ); locformatter = wxT( "dx %f dy %f d %f" ); break; } line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates { // Display relative coordinates: dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dXpos = To_User_Unit( g_UserUnit, dx ); dYpos = To_User_Unit( g_UserUnit, dy ); if ( g_UserUnit == MILLIMETRES ) { dXpos = RoundTo0( dXpos, 1000.0 ); dYpos = RoundTo0( dYpos, 1000.0 ); } // We already decided the formatter above line.Printf( locformatter, dXpos, dYpos, sqrt( dXpos * dXpos + dYpos * dYpos ) ); SetStatusText( line, 3 ); } }
void DIALOG_PLOT::applyPlotSettings() { REPORTER& reporter = m_messagesPanel->Reporter(); 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() ); tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); 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(); int tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS; if( !tempOptions.SetHPGLPenDiameter( tmp ) ) { msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS ); m_HPGLPenSizeOpt->SetValue( msg ); msg.Printf( _( "HPGL pen size constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } // Read HPGL pen overlay (this param is stored in mils) msg = m_HPGLPenOverlayOpt->GetValue(); tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS; if( !tempOptions.SetHPGLPenOverlay( tmp ) ) { msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenOverlay() * IU_PER_MILS ); m_HPGLPenOverlayOpt->SetValue( msg ); msg.Printf( _( "HPGL pen overlay constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } // Default linewidth msg = m_linesWidth->GetValue(); tmp = ValueFromString( g_UserUnit, msg ); if( !tempOptions.SetLineWidth( tmp ) ) { msg = StringFromValue( g_UserUnit, tempOptions.GetLineWidth() ); m_linesWidth->SetValue( msg ); msg.Printf( _( "Default line width constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } // 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 ); msg.Printf( _( "X scale constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust ); // 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 ); msg.Printf( _( "Y scale constrained." ) ); reporter.Report( msg, REPORTER::RPT_INFO ); } ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust ); // PS Width correction msg = m_PSFineAdjustWidthOpt->GetValue(); int itmp = ValueFromString( g_UserUnit, msg ); if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) ) { msg = StringFromValue( g_UserUnit, m_PSWidthAdjust ); m_PSFineAdjustWidthOpt->SetValue( msg ); msg.Printf( _( "Width correction constrained. " "The reasonable width correction value must be in a range of " " [%+f; %+f] (%s) for current design rules. " ), To_User_Unit( g_UserUnit, m_widthAdjustMinValue ), To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ), ( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) ); reporter.Report( msg, REPORTER::RPT_WARNING ); } // Store m_PSWidthAdjust in mm in user config ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM ); tempOptions.SetFormat( getPlotFormat() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() ); tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 ); LSET selectedLayers; for( unsigned i = 0; i < m_layerList.size(); i++ ) { if( m_layerCheckListBox->IsChecked( i ) ) selectedLayers.set( m_layerList[i] ); } 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(); } }
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() { if( m_parameterGrid == NULL ) return; FOOTPRINT_WIZARD* footprintWizard = GetMyWizard(); if( footprintWizard == NULL ) return; int page = m_pageList->GetSelection(); if( page<0 ) return; m_parameterGrid->ClearGrid(); // Get the list of names, values, and types wxArrayString fpList = footprintWizard->GetParameterNames( page ); wxArrayString fvList = footprintWizard->GetParameterValues( page ); wxArrayString ptList = footprintWizard->GetParameterTypes( page ); // Dimension the wxGrid if( m_parameterGrid->GetNumberRows() > 0 ) m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() ); m_parameterGrid->AppendRows( fpList.size() ); wxString value, units; for( unsigned int i = 0; i< fpList.size(); i++ ) { value = fvList[i]; m_parameterGrid->SetCellValue( i, m_columnPrmName, fpList[i] ); m_parameterGrid->SetReadOnly( i, m_columnPrmName ); if( ptList[i]==wxT( "IU" ) ) { LOCALE_IO toggle; // We are handling internal units, so convert them to the current // system selected units and store into value. double dValue; value.ToDouble( &dValue ); dValue = To_User_Unit( g_UserUnit, dValue ); if( g_UserUnit==INCHES ) // we convert inches into mils for more detail { dValue = dValue * 1000.0; units = wxT( "mils" ); } else if( g_UserUnit==MILLIMETRES ) { units = wxT( "mm" ); } // Use Double2Str to build the string, because useless trailing 0 // are removed. The %f format does not remove them std::string s = Double2Str( dValue ); value = FROM_UTF8( s.c_str() ); } else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N { units = wxT( "" ); } m_parameterGrid->SetCellValue( i, m_columnPrmValue, value ); m_parameterGrid->SetCellValue( i, m_columnPrmUnit, units ); m_parameterGrid->SetReadOnly( i, m_columnPrmUnit ); } m_parameterGrid->AutoSizeColumns(); }
void PL_EDITOR_FRAME::UpdateStatusBar() { PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen(); if( !screen ) return; // Display Zoom level: EDA_DRAW_FRAME::UpdateStatusBar(); // coordinate origin can be the paper Top Left corner, or each of 4 page corners wxPoint originCoord; int Xsign = 1; int Ysign = 1; WS_DATA_ITEM dummy( WS_DATA_ITEM::WS_SEGMENT ); switch( m_originSelectChoice ) { default: case 0: // Origin = paper Left Top corner break; case 1: // Origin = page Right Bottom corner Xsign = -1; Ysign = -1; dummy.SetStart( 0, 0, RB_CORNER ); originCoord = dummy.GetStartPosUi(); break; case 2: // Origin = page Left Bottom corner Ysign = -1; dummy.SetStart( 0, 0, LB_CORNER ); originCoord = dummy.GetStartPosUi(); break; case 3: // Origin = page Right Top corner Xsign = -1; dummy.SetStart( 0, 0, RT_CORNER ); originCoord = dummy.GetStartPosUi(); break; case 4: // Origin = page Left Top corner dummy.SetStart( 0, 0, LT_CORNER ); originCoord = dummy.GetStartPosUi(); break; } SetGridOrigin( originCoord ); // Display absolute coordinates: wxPoint coord = GetCrossHairPosition() - originCoord; double dXpos = To_User_Unit( GetUserUnits(), coord.x*Xsign ); double dYpos = To_User_Unit( GetUserUnits(), coord.y*Ysign ); wxString pagesizeformatter = _( "Page size: width %.4g height %.4g" ); wxString absformatter = wxT( "X %.4g Y %.4g" ); wxString locformatter = wxT( "dx %.4g dy %.4g" ); switch( GetUserUnits() ) { case INCHES: SetStatusText( _("inches"), 5 ); break; case MILLIMETRES: SetStatusText( _("mm"), 5 ); break; case UNSCALED_UNITS: SetStatusText( wxEmptyString, 5 ); break; case DEGREES: wxASSERT( false ); break; } wxString line; // Display page size #define MILS_TO_MM (25.4/1000) DSIZE size = GetPageSettings().GetSizeMils(); size = size * MILS_TO_MM; line.Printf( pagesizeformatter, size.x, size.y ); SetStatusText( line, 0 ); // Display abs coordinates line.Printf( absformatter, dXpos, dYpos ); SetStatusText( line, 2 ); // Display relative coordinates: int dx = GetCrossHairPosition().x - screen->m_O_Curseur.x; int dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; dXpos = To_User_Unit( GetUserUnits(), dx * Xsign ); dYpos = To_User_Unit( GetUserUnits(), dy * Ysign ); line.Printf( locformatter, dXpos, dYpos ); SetStatusText( line, 3 ); // Display corner reference for coord origin line.Printf( _("coord origin: %s"), m_originSelectBox->GetString( m_originSelectChoice ). GetData() ); SetStatusText( line, 4 ); // Display units }