void DIALOG_DESIGN_RULES::InitGlobalRules() { AddUnitSymbol( *m_ViaMinTitle ); AddUnitSymbol( *m_ViaMinDrillTitle ); AddUnitSymbol( *m_MicroViaMinSizeTitle ); AddUnitSymbol( *m_MicroViaMinDrillTitle ); AddUnitSymbol( *m_TrackMinWidthTitle ); PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill ); if( m_BrdSettings->m_BlindBuriedViaAllowed ) m_OptViaType->SetSelection( 1 ); m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 ); PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize ); PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill ); PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth ); // Initialize Vias and Tracks sizes lists. // note we display only extra values, never the current netclass value. // (the first value in history list) m_TracksWidthList = m_BrdSettings->m_TrackWidthList; m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value m_ViasDimensionsList = m_BrdSettings->m_ViasDimensionsList; m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value InitDimensionsLists(); }
void DIALOG_DRC_CONTROL::InitValues() { // Connect events and objects m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this ); m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this ); m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL:: OnLeftDClickUnconnected ), NULL, this ); m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this ); AddUnitSymbol( *m_TrackMinWidthTitle ); AddUnitSymbol( *m_ViaMinTitle ); AddUnitSymbol( *m_MicroViaMinTitle ); m_DeleteCurrentMarkerButton->Enable( false ); Layout(); // adding the units above expanded Clearance text, now resize. // Set the initial "enabled" status of the browse button and the text // field for report name wxCommandEvent junk; OnReportCheckBoxClicked( junk ); SetFocus(); }
DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, DIMENSION* aDimension, wxDC* aDC ) : DIALOG_DIMENSION_EDITOR_BASE( aParent ) { SetFocus(); m_Parent = aParent; m_DC = aDC; CurrentDimension = aDimension; if( aDimension->Text().IsMirrored() ) m_rbMirror->SetSelection( 1 ); else m_rbMirror->SetSelection( 0 ); m_Name->SetValue( aDimension->Text().GetText() ); // Enter size value in dialog PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->Text().GetSize().x ); AddUnitSymbol( *m_staticTextSizeX ); PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->Text().GetSize().y ); AddUnitSymbol( *m_staticTextSizeY ); // Enter lines thickness value in dialog PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->GetWidth() ); AddUnitSymbol( *m_staticTextWidth ); // Enter position value in dialog PutValueInLocalUnits( *m_textCtrlPosX, aDimension->Text().GetTextPosition().x ); AddUnitSymbol( *m_staticTextPosX ); PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPosition().y ); AddUnitSymbol( *m_staticTextPosY ); // Configure the layers list selector if( !m_Parent->GetBoard()->IsLayerEnabled( aDimension->GetLayer() ) ) // Should not happens, because one cannot select a board item on a // not activated layer, but ... m_SelLayerBox->ShowNonActivatedLayers( true ); m_SelLayerBox->SetLayersHotkeys( false ); m_SelLayerBox->SetLayerSet( LSET::AllCuMask().set( Edge_Cuts ) ); m_SelLayerBox->SetBoardFrame( m_Parent ); m_SelLayerBox->Resync(); if( m_SelLayerBox->SetLayerSelection( aDimension->GetLayer() ) < 0 ) { wxMessageBox( _( "This item has an illegal layer id.\n" "Now, forced on the drawings layer. Please, fix it" ) ); m_SelLayerBox->SetLayerSelection( Dwgs_User ); } SetDefaultItem( m_sdbSizerBtsOK ); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); Centre(); }
DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, DIMENSION* aDimension, wxDC* aDC ) : DIALOG_DIMENSION_EDITOR_BASE( aParent ) { SetFocus(); m_Parent = aParent; m_DC = aDC; CurrentDimension = aDimension; if( aDimension->Text().IsMirrored() ) m_rbMirror->SetSelection( 1 ); else m_rbMirror->SetSelection( 0 ); m_Name->SetValue( aDimension->Text().GetText() ); // Enter size value in dialog PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->Text().GetSize().x ); AddUnitSymbol( *m_staticTextSizeX ); PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->Text().GetSize().y ); AddUnitSymbol( *m_staticTextSizeY ); // Enter lines thickness value in dialog PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->GetWidth() ); AddUnitSymbol( *m_staticTextWidth ); // Enter position value in dialog PutValueInLocalUnits( *m_textCtrlPosX, aDimension->Text().GetTextPosition().x ); AddUnitSymbol( *m_staticTextPosX ); PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPosition().y ); AddUnitSymbol( *m_staticTextPosY ); // Configure the layers list selector m_SelLayerBox->SetLayersHotkeys( false ); m_SelLayerBox->SetLayerMask( ALL_CU_LAYERS | EDGE_LAYER ); m_SelLayerBox->SetBoardFrame( m_Parent ); m_SelLayerBox->Resync(); if( m_SelLayerBox->SetLayerSelection( aDimension->GetLayer() ) < 0 ) { wxMessageBox( _("This item has an illegal layer id.\n" "Now, forced on the drawings layer. Please, fix it") ); m_SelLayerBox->SetLayerSelection( DRAW_N ); } GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); Centre(); }
void DIALOG_NON_COPPER_ZONES_EDITOR::Init() { BOARD* board = m_parent->GetBoard(); SetReturnCode( ZONE_ABORT ); // Will be changed on button click AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); m_ZoneMinThicknessCtrl->SetValue( msg ); if( m_settings.m_Zone_45_Only ) m_OrientEdgesOpt->SetSelection( 1 ); switch( m_settings.m_Zone_HatchingStyle ) { case CPolyLine::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; case CPolyLine::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; case CPolyLine::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } // Create one column in m_LayerSelectionCtrl wxListItem column0; column0.SetId( 0 ); m_LayerSelectionCtrl->InsertColumn( 0, column0 ); // Create an icon list: wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); int ii = 0; int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer; if( m_zone ) lyrSelect = m_zone->GetLayer(); for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii ) { LAYER_ID layer = *seq; EDA_COLOR_T layerColor = board->GetLayerColor( layer ); imageList->Add( makeLayerBitmap( layerColor ) ); wxString msg = board->GetLayerName( layer ); msg.Trim(); int itemIndex = m_LayerSelectionCtrl->InsertItem( m_LayerSelectionCtrl->GetItemCount(), msg, ii ); if(lyrSelect == layer ) m_LayerSelectionCtrl->Select( itemIndex ); } }
void WinEDA_TextModPropertiesFrame::SetDisplayValue(void) /********************************************************/ { wxString msg; if ( m_Module ) { wxString format = m_ModuleInfoText->GetLabel(); msg.Printf( format, m_Module->m_Reference->m_Text.GetData(), m_Module->m_Value->m_Text.GetData(), (float)(m_Module->m_Orient/10) ); m_ModuleInfoText->SetLabel(msg); } if(m_CurrentTextMod->m_Type == TEXT_is_VALUE) m_TextDataTitle->SetLabel(_("Value:")); else if(m_CurrentTextMod->m_Type == TEXT_is_DIVERS) m_TextDataTitle->SetLabel(_("Text:")); else if(m_CurrentTextMod->m_Type != TEXT_is_REFERENCE) m_TextDataTitle->SetLabel(wxT("???")); m_Name->SetValue(m_CurrentTextMod->m_Text); AddUnitSymbol(*m_SizeXTitle); PutValueInLocalUnits(*m_TxtSizeCtrlX, m_CurrentTextMod->m_Size.x, m_Parent->m_InternalUnits); AddUnitSymbol(*m_SizeYTitle); PutValueInLocalUnits(*m_TxtSizeCtrlY, m_CurrentTextMod->m_Size.y, m_Parent->m_InternalUnits); AddUnitSymbol(*m_PosXTitle); PutValueInLocalUnits(*m_TxtPosCtrlX, m_CurrentTextMod->m_Pos0.x, m_Parent->m_InternalUnits); AddUnitSymbol(*m_PosYTitle); PutValueInLocalUnits(*m_TxtPosCtrlY, m_CurrentTextMod->m_Pos0.y, m_Parent->m_InternalUnits); AddUnitSymbol(*m_WidthTitle); PutValueInLocalUnits(*m_TxtWidthCtlr, m_CurrentTextMod->m_Width, m_Parent->m_InternalUnits); if ( (m_CurrentTextMod->m_Orient != 0) && (m_CurrentTextMod->m_Orient != 1800) && (m_CurrentTextMod->m_Orient != -1800) ) m_Orient->SetSelection(1);; if ( m_CurrentTextMod->m_NoShow ) m_Show->SetSelection(1);; }
void UnitType::InitSymbol(vector< UeStdString > &array) { vector<UeStdString>::const_iterator ItBegin = array.begin(); for ( ;ItBegin != array.end();ItBegin++ ) { AddUnitSymbol(ItBegin->c_str()); } }
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent, DrawSheetStruct * currentsheet, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_Parent = parent; m_CurrentSheet = currentsheet; Create(parent, id, caption, pos, size, style); AddUnitSymbol(*m_SheetNameTextSize); PutValueInLocalUnits(*m_SheetNameSize,m_CurrentSheet->m_Field[VALUE].m_Size.x, m_Parent->m_InternalUnits); AddUnitSymbol(*m_FileNameTextSize); PutValueInLocalUnits(*m_FileNameSize, m_CurrentSheet->m_Field[SHEET_FILENAME].m_Size.x, m_Parent->m_InternalUnits); }
void DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice( wxCommandEvent& event ) { int selection = m_cornerSmoothingChoice->GetSelection(); switch( selection ) { case ZONE_SETTINGS::SMOOTHING_NONE: m_cornerSmoothingTitle->Enable( false ); m_cornerSmoothingCtrl->Enable( false ); break; case ZONE_SETTINGS::SMOOTHING_CHAMFER: m_cornerSmoothingTitle->Enable( true ); m_cornerSmoothingCtrl->Enable( true ); m_cornerSmoothingTitle->SetLabel( _( "Chamfer distance" ) ); AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit ); break; case ZONE_SETTINGS::SMOOTHING_FILLET: m_cornerSmoothingTitle->Enable( true ); m_cornerSmoothingCtrl->Enable( true ); m_cornerSmoothingTitle->SetLabel( _( "Fillet radius" ) ); AddUnitSymbol( *m_cornerSmoothingTitle, g_UserUnit ); break; } }
void DialogEditModuleText::initDlg( ) { SetFocus(); wxString msg; if( m_module ) { wxString format = m_ModuleInfoText->GetLabel(); msg.Printf( format, GetChars( m_module->GetReference() ), GetChars( m_module->GetValue() ), m_module->GetOrientation() / 10.0 ); } else { msg.Empty(); } m_ModuleInfoText->SetLabel( msg ); switch( m_currentText->GetType() ) { case TEXTE_MODULE::TEXT_is_VALUE: m_TextDataTitle->SetLabel( _( "Value:" ) ); break; case TEXTE_MODULE::TEXT_is_DIVERS: m_TextDataTitle->SetLabel( _( "Text:" ) ); break; default: m_TextDataTitle->SetLabel( _( "Reference:" ) ); break; } m_Name->SetValue( m_currentText->GetText() ); m_Style->SetSelection( m_currentText->IsItalic() ? 1 : 0 ); AddUnitSymbol( *m_SizeXTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->GetSize().x ); AddUnitSymbol( *m_SizeYTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->GetSize().y ); AddUnitSymbol( *m_PosXTitle ); PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x ); AddUnitSymbol( *m_PosYTitle ); PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y ); AddUnitSymbol( *m_WidthTitle ); PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); double text_orient = m_currentText->GetOrientation(); NORMALIZE_ANGLE_90( text_orient ); if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); if( !m_currentText->IsVisible() ) m_Show->SetSelection( 1 );; }
void DIALOG_COPPER_ZONE::initDialog() { BOARD* board = m_Parent->GetBoard(); wxString msg; if( m_settings.m_Zone_45_Only ) m_OrientEdgesOpt->SetSelection( 1 ); m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 ); AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit ); msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneClearance ); m_ZoneClearanceCtrl->SetValue( msg ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); m_ZoneMinThicknessCtrl->SetValue( msg ); switch( m_settings.GetPadConnection() ) { case THT_THERMAL: // Thermals only for THT pads m_PadInZoneOpt->SetSelection( 2 ); break; case PAD_NOT_IN_ZONE: // Pads are not covered m_PadInZoneOpt->SetSelection( 3 ); break; default: case THERMAL_PAD: // Use thermal relief for pads m_PadInZoneOpt->SetSelection( 1 ); break; case PAD_IN_ZONE: // pads are covered by copper m_PadInZoneOpt->SetSelection( 0 ); break; } // Antipad and spokes are significant only for thermals if( m_settings.GetPadConnection() != THERMAL_PAD && m_settings.GetPadConnection() != THT_THERMAL ) { m_AntipadSizeValue->Enable( false ); m_CopperWidthValue->Enable( false ); } else { m_AntipadSizeValue->Enable( true ); m_CopperWidthValue->Enable( true ); } m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority ); AddUnitSymbol( *m_AntipadSizeText, g_UserUnit ); AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit ); PutValueInLocalUnits( *m_AntipadSizeValue, m_settings.m_ThermalReliefGap ); PutValueInLocalUnits( *m_CopperWidthValue, m_settings.m_ThermalReliefCopperBridge ); m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() ); PutValueInLocalUnits( *m_cornerSmoothingCtrl, m_settings.GetCornerRadius() ); switch( m_settings.m_Zone_HatchingStyle ) { case CPolyLine::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; case CPolyLine::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; case CPolyLine::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } m_ArcApproximationOpt->SetSelection( m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 ); // Create one column in m_LayerSelectionCtrl wxListItem column0; column0.SetId( 0 ); m_LayerSelectionCtrl->InsertColumn( 0, column0 ); // Build copper layer list and append to layer widget int layerCount = board->GetCopperLayerCount(); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names for( LAYER_NUM ii = FIRST_LAYER; ii < layerCount; ++ii ) { LAYER_NUM layerNumber = LAYER_N_BACK; if( layerCount <= 1 || ii < layerCount - 1 ) layerNumber = ii; else if( ii == layerCount - 1 ) layerNumber = LAYER_N_FRONT; m_LayerId.insert( m_LayerId.begin(), layerNumber ); msg = board->GetLayerName( layerNumber ).Trim(); EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber ); imageList->Add( makeLayerBitmap( layerColor ) ); int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii ); if( m_settings.m_CurrentZone_Layer == layerNumber ) m_LayerSelectionCtrl->Select( itemIndex ); wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); ctrlWidth = std::max( ctrlWidth, tsize.x ); } // The most easy way to ensure the right size is to use wxLIST_AUTOSIZE // unfortunately this option does not work well both on // wxWidgets 2.8 ( column witdth too small), and // wxWidgets 2.9 ( column witdth too large) ctrlWidth += LAYER_BITMAP_SIZE_X + 16; // Add bitmap width + margin between bitmap and text m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); ctrlWidth += 4; // add small margin between text and window borders m_LayerSelectionCtrl->SetMinSize( wxSize(ctrlWidth, -1)); wxString netNameDoNotShowFilter = wxT( "Net-*" ); if( m_Config ) { int opt = m_Config->Read( ZONE_NET_SORT_OPTION_KEY, 1l ); m_NetDisplayOption->SetSelection( opt ); m_Config->Read( ZONE_NET_FILTER_STRING_KEY, netNameDoNotShowFilter ); } else m_NetDisplayOption->SetSelection( 1 ); m_ShowNetNameFilter->SetValue( m_netNameShowFilter ); initListNetsParams(); // Build list of nets: m_DoNotShowNetNameFilter->SetValue( netNameDoNotShowFilter ); buildAvailableListOfNets(); wxCommandEvent event; OnCornerSmoothingModeChoice( event ); }
void DIALOG_SVG_PRINT::initDialog() { m_board = m_parent->GetBoard(); if( m_config ) { m_config->Read( PLOTSVGMODECOLOR_KEY, &m_printBW, false ); long ltmp; m_config->Read( PLOTSVGPAGESIZEOPT_KEY, <mp, 0 ); m_rbSvgPageSizeOpt->SetSelection( ltmp ); m_config->Read( PLOTSVGPLOT_BRD_EDGE_KEY, <mp, 1 ); m_PrintBoardEdgesCtrl->SetValue( ltmp ); } m_outputDirectory = m_parent->GetPlotSettings().GetOutputDirectory(); m_outputDirectoryName->SetValue( m_outputDirectory ); if( m_printBW ) m_ModeColorOption->SetSelection( 1 ); else m_ModeColorOption->SetSelection( 0 ); m_printMirrorOpt->SetValue( m_printMirror ); m_rbFileOpt->SetSelection( m_oneFileOnly ? 1 : 0 ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); m_DialogDefaultPenSize->SetValue( ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) ); // Create layers list LAYER_NUM layer; for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( !m_board->IsLayerEnabled( layer ) ) m_boxSelectLayer[layer] = NULL; else m_boxSelectLayer[layer] = new wxCheckBox( this, -1, m_board->GetLayerName( layer ) ); } // Add wxCheckBoxes in layers lists dialog // List layers in same order than in setup layers dialog // (Front or Top to Back or Bottom) DECLARE_LAYERS_ORDER_LIST( layersOrder ); for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_PCB_LAYERS; ++layer_idx ) { layer = layersOrder[layer_idx]; wxASSERT( layer < NB_PCB_LAYERS ); if( m_boxSelectLayer[layer] == NULL ) continue; LAYER_MSK mask = GetLayerMask( layer ); if( mask & s_SelectedLayers ) m_boxSelectLayer[layer]->SetValue( true ); if( layer <= LAST_COPPER_LAYER ) m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); else m_TechnicalBoxSizer->Add( m_boxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); } if( m_config ) { wxString layerKey; for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { bool option; if( m_boxSelectLayer[layer] == NULL ) continue; layerKey.Printf( OPTKEY_LAYERBASE, layer ); if( m_config->Read( layerKey, &option ) ) m_boxSelectLayer[layer]->SetValue( option ); } } }
void DIALOG_PRINT_USING_PRINTER::initValues( ) { wxString msg; BOARD* board = m_parent->GetBoard(); s_Parameters.m_PageSetupData = s_pageSetupData; // Create layer list. wxString layerKey; LSEQ seq = board->GetEnabledLayers().UIOrder(); for( ; seq; ++seq ) { LAYER_ID layer = *seq; m_BoxSelectLayer[layer] = new wxCheckBox( this, -1, board->GetLayerName( layer ) ); if( IsCopperLayer( layer ) ) m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); else m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); layerKey.Printf( OPTKEY_LAYERBASE, layer ); bool option; if( m_config->Read( layerKey, &option ) ) m_BoxSelectLayer[layer]->SetValue( option ); else { if( s_SelectedLayers[layer] ) m_BoxSelectLayer[layer]->SetValue( true ); } } // Option for excluding contents of "Edges Pcb" layer m_Exclude_Edges_Pcb->Show( true ); // Read the scale adjust option int scale_idx = 4; // default selected scale = ScaleList[4] = 1.000 if( m_config ) { m_config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &s_Parameters.m_XScaleAdjust ); m_config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &s_Parameters.m_YScaleAdjust ); m_config->Read( OPTKEY_PRINT_SCALE, &scale_idx ); m_config->Read( OPTKEY_PRINT_PAGE_FRAME, &s_Parameters.m_Print_Sheet_Ref, 1); m_config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1); m_config->Read( OPTKEY_PRINT_PAGE_PER_LAYER, &s_Parameters.m_OptionPrintPage, 0); int tmp; m_config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE ); s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp; // Test for a reasonnable scale value. Set to 1 if problem if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE || s_Parameters.m_XScaleAdjust > MAX_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE ) s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0; s_SelectedLayers = LSET(); for( seq.Rewind(); seq; ++seq ) { LAYER_ID layer = *seq; wxString layerKey; bool option; layerKey.Printf( OPTKEY_LAYERBASE, layer ); option = false; if( m_config->Read( layerKey, &option ) ) { m_BoxSelectLayer[layer]->SetValue( option ); if( option ) s_SelectedLayers.set( layer ); } } } m_ScaleOption->SetSelection( scale_idx ); scale_idx = m_ScaleOption->GetSelection(); s_Parameters.m_PrintScale = s_ScaleList[scale_idx]; m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror); m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer); m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref ); // Options to plot pads and vias holes m_Drill_Shape_Opt->SetSelection( s_Parameters.m_DrillShapeOpt ); if( s_Parameters.m_Print_Black_and_White ) m_ModeColorOption->SetSelection( 1 ); else m_ModeColorOption->SetSelection( 0 ); m_PagesOption->SetSelection(s_Parameters.m_OptionPrintPage); s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness; AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); m_DialogPenWidth->SetValue( StringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize ) ); // Create scale adjust option msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust ); m_FineAdjustXscaleOpt->SetValue( msg ); msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust ); m_FineAdjustYscaleOpt->SetValue( msg ); bool enable = (s_Parameters.m_PrintScale == 1.0); m_FineAdjustXscaleOpt->Enable(enable); m_FineAdjustYscaleOpt->Enable(enable); }
// Initialize the dialog options: void DIALOG_PLOT_SCHEMATIC::initDlg() { SetFocus(); // make the ESC work // Set paper size option m_PaperSizeOption->SetSelection( m_pageSizeSelect ); // Set color or B&W plot option bool tmp; m_config->Read( PLOT_MODECOLOR_KEY, &tmp, true ); setModeColor( tmp ); // Set plot or not frame reference option m_config->Read( PLOT_FRAME_REFERENCE_KEY, &tmp, true ); setPlotFrameRef( tmp ); // Set HPGL plot origin to center of paper of left bottom corner m_config->Read( PLOT_HPGL_ORIGIN_KEY, &tmp, false ); SetPlotOriginCenter( tmp ); m_config->Read( PLOT_HPGL_PAPERSIZE_KEY, &m_HPGLPaperSizeSelect, 0 ); m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect ); // HPGL Pen Size is stored in mm in config m_config->Read( PLOT_HPGL_PEN_SIZE_KEY, &m_HPGLPenSize, 0.5 ); m_HPGLPenSize *= IU_PER_MM; // Switch to the last save plot format long plotfmt; m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 ); switch( plotfmt ) { default: case PLOT_FORMAT_POST: m_plotFormatOpt->SetSelection( 0 ); break; case PLOT_FORMAT_PDF: 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; } // Set the default line width (pen width which should be used for // items that do not have a pen size defined (like frame ref) AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit ); PutValueInLocalUnits( *m_DefaultLineSizeCtrl, GetDefaultLineThickness() ); // Initialize HPGL specific widgets AddUnitSymbol( *m_penHPLGWidthTitle, g_UserUnit ); PutValueInLocalUnits( *m_penHPGLWidthCtrl, m_HPGLPenSize ); m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect ); // Hide/show widgets that are not always displayed: wxCommandEvent cmd_event; OnPlotFormatSelection( cmd_event ); }
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 ); }
void WinEDA_DrcFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin WinEDA_DrcFrame content construction // Generated by DialogBlocks, 27/02/2006 21:15:33 (unregistered) WinEDA_DrcFrame* itemDialog1 = this; m_MainSizer = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(m_MainSizer); m_CommandSizer = new wxBoxSizer(wxHORIZONTAL); m_MainSizer->Add(m_CommandSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); m_CommandSizer->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5); m_ClearenceTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer4->Add(m_ClearenceTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_SetClearance = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer4->Add(m_SetClearance, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL); m_CommandSizer->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); itemBoxSizer7->Add(itemBoxSizer8, 0, wxGROW|wxALL, 5); wxButton* itemButton9 = new wxButton( itemDialog1, ID_DRC_RUN, _("Test Drc"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton9->SetForegroundColour(wxColour(202, 0, 0)); itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5); wxButton* itemButton10 = new wxButton( itemDialog1, ID_STOP_CONTROL_DRC, _("Stop Drc"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton10->SetForegroundColour(wxColour(0, 128, 128)); itemBoxSizer8->Add(itemButton10, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); itemBoxSizer7->Add(itemBoxSizer11, 0, wxGROW|wxALL, 5); wxButton* itemButton12 = new wxButton( itemDialog1, ID_ERASE_DRC_MARKERS, _("Del Markers"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton12->SetForegroundColour(wxColour(0, 128, 0)); itemBoxSizer11->Add(itemButton12, 0, wxGROW|wxALL, 5); wxButton* itemButton13 = new wxButton( itemDialog1, ID_LIST_UNCONNECTED_PADS, _("List Unconn"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton13->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer11->Add(itemButton13, 0, wxGROW|wxALL, 5); wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer11->Add(itemButton14, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_MainSizer->Add(itemStaticText15, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_logWindow = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE|wxTE_READONLY ); m_MainSizer->Add(m_logWindow, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); ////@end WinEDA_DrcFrame content construction AddUnitSymbol(*m_ClearenceTitle); }
bool DialogEditModuleText::TransferDataToWindow() { if( !wxDialog::TransferDataToWindow() ) return false; wxString msg; if( m_module ) { wxString format = m_ModuleInfoText->GetLabel(); msg.Printf( format, GetChars( m_module->GetReference() ), GetChars( m_module->GetValue() ), m_module->GetOrientation() / 10.0 ); } else { msg.Empty(); } m_ModuleInfoText->SetLabel( msg ); // Create a list of not allowed layers. // could be slightly dependent of the type of footprint text. LSET forbiddenLayers( LSET::AllCuMask() ); forbiddenLayers.set( Edge_Cuts ).set( Margin ).set( F_Paste ).set( B_Paste ).set( F_Mask ).set( B_Mask ); switch( m_currentText->GetType() ) { case TEXTE_MODULE::TEXT_is_VALUE: m_TextDataTitle->SetLabel( _( "Value:" ) ); break; case TEXTE_MODULE::TEXT_is_DIVERS: m_TextDataTitle->SetLabel( _( "Text:" ) ); break; case TEXTE_MODULE::TEXT_is_REFERENCE: m_TextDataTitle->SetLabel( _( "Reference:" ) ); break; } m_Name->SetValue( m_currentText->GetText() ); m_Style->SetSelection( m_currentText->IsItalic() ? 1 : 0 ); AddUnitSymbol( *m_SizeXTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->GetSize().x ); AddUnitSymbol( *m_SizeYTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->GetSize().y ); AddUnitSymbol( *m_PosXTitle ); PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x ); AddUnitSymbol( *m_PosYTitle ); PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y ); AddUnitSymbol( *m_WidthTitle ); PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); double text_orient = m_currentText->GetOrientation(); NORMALIZE_ANGLE_90( text_orient ); if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); if( !m_currentText->IsVisible() ) m_Show->SetSelection( 1 ); bool custom_orientation = false; switch( int( text_orient ) ) { case 0: m_Orient->SetSelection( 0 ); break; case 900: m_Orient->SetSelection( 1 ); break; case -900: m_Orient->SetSelection( 2 ); break; default: m_Orient->SetSelection( 3 ); custom_orientation = true; break; } m_OrientValueCtrl->Enable( custom_orientation ); m_OrientValue = text_orient / 10.0; m_OrientValidator.TransferToWindow(); // Configure the layers list selector if( !m_parent->GetBoard()->IsLayerEnabled( m_currentText->GetLayer() ) ) // Footprints are built outside the current board, so items cann be // on a not activated layer, therefore show it if happens. m_LayerSelectionCtrl->ShowNonActivatedLayers( true ); m_LayerSelectionCtrl->SetLayersHotkeys( false ); m_LayerSelectionCtrl->SetLayerSet( forbiddenLayers ); m_LayerSelectionCtrl->SetBoardFrame( m_parent ); m_LayerSelectionCtrl->Resync(); if( m_LayerSelectionCtrl->SetLayerSelection( m_currentText->GetLayer() ) < 0 ) { wxMessageBox( _( "This item has an illegal layer id.\n" "Now, forced on the front silk screen layer. Please, fix it" ) ); m_LayerSelectionCtrl->SetLayerSelection( F_SilkS ); } return true; }
void DIALOG_NON_COPPER_ZONES_EDITOR::Init() { BOARD* board = m_parent->GetBoard(); SetReturnCode( ZONE_ABORT ); // Will be changed on button click AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); m_ZoneMinThicknessCtrl->SetValue( msg ); if( m_settings.m_Zone_45_Only ) m_OrientEdgesOpt->SetSelection( 1 ); switch( m_settings.m_Zone_HatchingStyle ) { case CPolyLine::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; case CPolyLine::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; case CPolyLine::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } // Create one column in m_LayerSelectionCtrl wxListItem column0; column0.SetId( 0 ); m_LayerSelectionCtrl->InsertColumn( 0, column0 ); // Create an icon list: wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); int lyrSelect = ( (PCB_SCREEN*) m_parent->GetScreen() )->m_Active_Layer; if( m_zone ) lyrSelect = m_zone->GetLayer(); int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names int imgIdx = 0; for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx ) { LAYER_ID layer = *seq; EDA_COLOR_T layerColor = board->GetLayerColor( layer ); imageList->Add( makeLayerBitmap( layerColor ) ); wxString msg = board->GetLayerName( layer ); msg.Trim(); int itemIndex = m_LayerSelectionCtrl->InsertItem( m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx ); if(lyrSelect == layer ) m_LayerSelectionCtrl->Select( itemIndex ); wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); ctrlWidth = std::max( ctrlWidth, tsize.x ); } // The most easy way to ensure the right size is to use wxLIST_AUTOSIZE // unfortunately this option does not work well both on // wxWidgets 2.8 ( column witdth too small), and // wxWidgets 2.9 ( column witdth too large) ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); ctrlWidth += 25; // add small margin between text and window borders // and room for vertical scroll bar m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); }