DIALOG_EXPORT_3DFILE( PCB_EDIT_FRAME* parent ) : DIALOG_EXPORT_3DFILE_BASE( parent ) { m_parent = parent; m_config = Kiface().KifaceSettings(); m_filePicker->SetFocus(); m_config->Read( OPTKEY_OUTPUT_UNIT, &m_unitsOpt, 1 ); m_config->Read( OPTKEY_3DFILES_OPT, &m_copy3DFilesOpt, false ); m_config->Read( OPTKEY_USE_RELATIVE_PATHS, &m_useRelativePathsOpt, false ); m_config->Read( OPTKEY_USE_PLAIN_PCB, &m_usePlainPCBOpt, false ); m_config->Read( OPTKEY_VRML_REF_UNITS, &m_RefUnits, 0 ); m_config->Read( OPTKEY_VRML_REF_X, &m_XRef, 0.0 ); m_config->Read( OPTKEY_VRML_REF_Y, &m_YRef, 0.0 ); m_rbSelectUnits->SetSelection( m_unitsOpt ); m_cbCopyFiles->SetValue( m_copy3DFilesOpt ); m_cbUseRelativePaths->SetValue( m_useRelativePathsOpt ); m_cbPlainPCB->SetValue( m_usePlainPCBOpt ); m_VRML_RefUnitChoice->SetSelection( m_RefUnits ); wxString tmpStr; tmpStr << m_XRef; m_VRML_Xref->SetValue( tmpStr ); tmpStr = wxT( "" ); tmpStr << m_YRef; m_VRML_Yref->SetValue( tmpStr ); m_sdbSizer1OK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); Connect( ID_USE_ABS_PATH, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EXPORT_3DFILE::OnUpdateUseRelativePath ) ); }
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ) : DIALOG_PRINT_USING_PRINTER_BASE( aParent ) { wxASSERT( aParent != NULL ); m_checkReference->SetValue( aParent->GetPrintSheetReference() ); m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() ); // We use a sdbSizer to get platform-dependent ordering of the action buttons, but // that requires us to correct the button labels here. m_sdbSizer1OK->SetLabel( _( "Print" ) ); m_sdbSizer1Apply->SetLabel( _( "Preview" ) ); m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); m_sdbSizer1->Layout(); #ifdef __WXMAC__ // Problems with modal on wx-2.9 - Anyway preview is standard for OSX m_sdbSizer1Apply->Hide(); #endif m_sdbSizer1OK->SetDefault(); // on linux, this is inadequate to determine // what ENTER does. Must also SetFocus(). m_sdbSizer1OK->SetFocus(); FinishDialogSettings(); }
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent, PCB_TARGET* aTarget, wxDC* DC ) : TARGET_PROPERTIES_DIALOG_EDITOR_BASE( parent ) { m_Parent = parent; m_DC = DC; m_Target = aTarget; // Size: m_staticTextSizeUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_TargetSizeCtrl->SetValue( StringFromValue( g_UserUnit, m_Target->GetSize() ) ); // Thickness: m_staticTextThicknessUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_TargetThicknessCtrl->SetValue( StringFromValue( g_UserUnit, m_Target->GetWidth() ) ); // Shape m_TargetShape->SetSelection( m_Target->GetShape() ? 1 : 0 ); // OK button on return key. SetDefaultItem( m_sdbSizerButtsOK ); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
void DIALOG_LIB_EDIT_PIN::OnInitDialog( wxInitDialogEvent& event ) { m_textPinName->SetFocus(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) : DIALOG_PLOT_SCHEMATIC_BASE( parent ), m_parent( parent ), m_plotFormat( PLOT_FORMAT_UNDEFINED ), m_defaultLineWidth( parent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ), m_penWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true ) { m_config = Kiface().KifaceSettings(); m_configChanged = false; m_browseButton->SetBitmap( KiBitmap( folder_xpm ) ); // We use a sdbSizer to get platform-dependent ordering of the action buttons, but // that requires us to correct the button labels here. m_sdbSizer1OK->SetLabel( _( "Plot All Pages" ) ); m_sdbSizer1Apply->SetLabel( _( "Plot Current Page" ) ); m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); m_sdbSizer1->Layout(); m_sdbSizer1OK->SetDefault(); initDlg(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad ) : DIALOG_PAD_PROPERTIES_BASE( aParent ), m_OrientValidator( 1, &m_OrientValue ) { m_canUpdate = false; m_parent = aParent; m_currentPad = aPad; // aPad can be NULL, if the dialog is called // from the footprint editor to set default pad setup m_board = m_parent->GetBoard(); m_OrientValidator.SetRange( -360.0, 360.0 ); m_PadOrientCtrl->SetValidator( m_OrientValidator ); m_OrientValidator.SetWindow( m_PadOrientCtrl ); m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master; m_dummyPad = new D_PAD( (MODULE*) NULL ); if( aPad ) *m_dummyPad = *aPad; else // We are editing a "master" pad, i.e. a template to create new pads *m_dummyPad = *m_padMaster; // Show the X and Y axis. It is usefull because pad shape can have an offset // or be a complex shape. m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D(0.0, 0.0, 0.8, 1.0), KIGFX::ORIGIN_VIEWITEM::CROSS, Millimeter2iu( 0.2 ), VECTOR2D( m_dummyPad->GetPosition() ) ); m_axisOrigin->SetDrawAtZero( true ); if( m_parent->IsGalCanvasActive() ) { m_panelShowPadGal->UseColorScheme( m_board->GetColorsSettings() ); m_panelShowPadGal->SwitchBackend( m_parent->GetGalCanvas()->GetBackend() ); m_panelShowPadGal->Show(); m_panelShowPad->Hide(); m_panelShowPadGal->GetView()->Add( m_dummyPad ); m_panelShowPadGal->GetView()->Add( m_axisOrigin ); m_panelShowPadGal->StartDrawing(); Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) ); } else { m_panelShowPad->Show(); m_panelShowPadGal->Hide(); } initValues(); TransferDataToWindow(); m_sdbSizerOK->SetDefault(); m_PadNumCtrl->SetFocus(); m_canUpdate = true; FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
void OnInitDlg( wxInitDialogEvent& event ) { // Call the default wxDialog handler of a wxInitDialogEvent TransferDataToWindow(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
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; m_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().GetTextWidth() ); AddUnitSymbol( *m_staticTextSizeX ); PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->Text().GetTextHeight() ); 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().GetTextPos().x ); AddUnitSymbol( *m_staticTextPosX ); PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPos().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 ); } m_sdbSizerBtsOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) : DIALOG_PLOT_SCHEMATIC_BASE( parent ) { m_parent = parent; m_configChanged = false; m_config = Kiface().KifaceSettings(); initDlg(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
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(); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* parent ) : DIALOG_EXPORT_STEP_BASE( parent ) { m_parent = parent; m_config = Kiface().KifaceSettings(); SetFocus(); m_useDrillOrg = false; m_config->Read( OPTKEY_STEP_USE_DRILL_ORG, &m_useDrillOrg ); m_cbDrillOrigin->SetValue( m_useDrillOrg ); m_useAuxOrg = false; m_config->Read( OPTKEY_STEP_USE_AUX_ORG, &m_useAuxOrg ); m_cbAuxOrigin->SetValue( m_useAuxOrg ); m_useUserOrg = false; m_config->Read( OPTKEY_STEP_USE_USER_ORG, &m_useUserOrg ); m_cbUserOrigin->SetValue( m_useUserOrg ); m_cbUserOrigin->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_STEP::OnUserOriginSelect, this ); m_config->Read( OPTKEY_STEP_UORG_UNITS, &m_OrgUnits, 0 ); m_config->Read( OPTKEY_STEP_UORG_X, &m_XOrg, 0.0 ); m_config->Read( OPTKEY_STEP_UORG_Y, &m_YOrg, 0.0 ); m_config->Read( OPTKEY_STEP_NOVIRT, &m_noVirtual ); m_cbRemoveVirtual->SetValue( m_noVirtual ); m_STEP_OrgUnitChoice->SetSelection( m_OrgUnits ); wxString tmpStr; tmpStr << m_XOrg; m_STEP_Xorg->SetValue( tmpStr ); tmpStr = ""; tmpStr << m_YOrg; m_STEP_Yorg->SetValue( tmpStr ); if( m_useUserOrg ) { m_STEP_OrgUnitChoice->Enable( true ); m_STEP_Xorg->Enable( true ); m_STEP_Yorg->Enable( true ); } else { m_STEP_OrgUnitChoice->Enable( false ); m_STEP_Xorg->Enable( false ); m_STEP_Yorg->Enable( false ); } m_sdbSizerOK->SetDefault(); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent ): DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent ) { m_Parent = aParent; m_RecreateToolbar = false; initDlg(); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) : DIALOG_DRC_CONTROL_BASE( aParent ) { m_tester = aTester; m_brdEditor = aEditorFrame; m_currentBoard = m_brdEditor->GetBoard(); m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings(); InitValues(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) : DIALOG_LIBEDIT_OPTIONS_BASE( parent ) { m_sdbSizerOK->SetDefault(); SetRepeatLabelInc( Parent()->GetRepeatDeltaLabel() ); SetItemRepeatStep( Parent()->GetRepeatStep() ); SetPinRepeatStep( Parent()->GetRepeatPinStep() ); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
void DIALOG_EDIT_ONE_FIELD::init() { wxString msg; m_TextValue->SetFocus(); SCH_BASE_FRAME* parent = static_cast<SCH_BASE_FRAME*>( GetParent() ); m_TextValue->SetValidator( SCH_FIELD_VALIDATOR( parent->IsType( FRAME_SCH_LIB_EDITOR ), m_fieldId, &m_text ) ); // Disable options for graphic text editing which are not needed for fields. m_CommonConvert->Show( false ); m_CommonUnit->Show( false ); // Show the footprint selection dialog if this is the footprint field. if( m_fieldId == FOOTPRINT ) { m_TextValueSelectButton->Show(); m_TextValueSelectButton->Enable(); } else { m_TextValueSelectButton->Hide(); m_TextValueSelectButton->Disable(); } msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol(); m_TextSizeText->SetLabel( msg ); // Value fields of power components cannot be modified. This will grey out // the text box and display an explanation. if( m_fieldId == VALUE && m_isPower ) { m_PowerComponentValues->Show( true ); m_TextValue->Enable( false ); } else { m_PowerComponentValues->Show( false ); m_TextValue->Enable( true ); } m_sdbSizerButtonsOK->SetDefault(); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ) : DIALOG_SWAP_LAYERS_BASE( aParent ), m_parent( aParent ), m_layerDestinations( aArray ) { m_gridTable = new LAYER_GRID_TABLE( m_parent->GetBoard()->GetCopperLayerCount() ); m_grid->SetTable( m_gridTable ); m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 ); m_grid->SetCellHighlightROPenWidth( 0 ); m_sdbSizerOK->SetDefault(); FinishDialogSettings(); }
DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) : DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( aParent ) { m_parent = aParent; m_config = Kiface().KifaceSettings(); m_ptr = aSettings; m_zonesettings = *aSettings; m_zonesettings.SetupLayersList( m_layers, m_parent, true ); m_sdbSizerButtonsOK->SetDefault(); FinishDialogSettings(); }
DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES( PCB_EDIT_FRAME* aParent, PCB_TARGET* aTarget, wxDC* aDC ) : DIALOG_TARGET_PROPERTIES_BASE( aParent ), m_Parent( aParent ), m_DC( aDC ), m_Target( aTarget ), m_Size( aParent, m_sizeLabel, m_sizeCtrl, m_sizeUnits, true ), m_Thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true ) { m_sdbSizerButtsOK->SetDefault(); SetInitialFocus( m_sizeCtrl ); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( LIB_EDIT_FRAME* aParent, LIB_ITEM* aItem ) : DIALOG_LIB_EDIT_DRAW_ITEM_BASE( aParent ), m_frame( aParent ), m_item( aItem ), m_lineWidth( aParent, m_widthLabel, m_widthCtrl, m_widthUnits, true ) { SetTitle( aItem->GetTypeName() + wxT( " " ) + GetTitle() ); SetInitialFocus( m_widthCtrl ); // Required under wxGTK if we want to dismiss the dialog with the ESC key SetFocus(); m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) : DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent ) { for( size_t i = 0; i < SHEET_PIN_TYPE_CNT; i++ ) m_choiceConnectionType->Append( sheetPinTypes[ i ] ); m_choiceConnectionType->SetSelection( 0 ); m_textName->SetFocus(); m_sdbSizerOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); // On some windows manager (Unity, XFCE), this dialog is // not always raised, depending on this dialog is run. // Force it to be raised Raise(); }
DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent ) : DIALOG_FOOTPRINT_WIZARD_LIST_BASE( aParent ) { m_config = Kiface().KifaceSettings(); initLists(); if( m_config ) { wxSize size; m_config->Read( FPWIZARTDLIST_WIDTH_KEY, &size.x, -1 ); m_config->Read( FPWIZARTDLIST_HEIGHT_KEY, &size.y, -1 ); SetSize( size ); } m_sdbSizerOK->SetDefault(); FinishDialogSettings(); Center(); }
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) : DIALOG_DRC_CONTROL_BASE( aParent ), m_trackMinWidth( aEditorFrame, m_TrackMinWidthTitle, m_SetTrackMinWidthCtrl, m_TrackMinWidthUnit, true ), m_viaMinSize( aEditorFrame, m_ViaMinTitle, m_SetViaMinSizeCtrl, m_ViaMinUnit, true ), m_uviaMinSize( aEditorFrame, m_MicroViaMinTitle, m_SetMicroViakMinSizeCtrl, m_MicroViaMinUnit, true ) { m_config = Kiface().KifaceSettings(); m_tester = aTester; m_brdEditor = aEditorFrame; m_currentBoard = m_brdEditor->GetBoard(); m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings(); m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) ); // We use a sdbSizer here to get the order right, which is platform-dependent m_sdbSizer1OK->SetLabel( _( "Run DRC" ) ); m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); m_sizerButtons->Layout(); m_sdbSizer1OK->SetDefault(); InitValues(); // Connect events 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 ); m_FootprintsListBox->Connect( ID_FOOTPRINTS_LIST, wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickFootprints ), NULL, this ); m_FootprintsListBox->Connect( ID_FOOTPRINTS_LIST, wxEVT_RIGHT_UP, wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpFootprints ), NULL, this ); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) : DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent ), m_minWidth( aParent, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ), m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation, m_staticTextRotUnits, false ), m_gridStyleThickness( aParent, m_staticTextStyleThickness, m_tcGridStyleThickness, m_GridStyleThicknessUnits, false), m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits, false ), m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ), m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits, true ) { m_parent = aParent; m_ptr = aSettings; m_settings = *aSettings; m_settings.SetupLayersList( m_layers, m_parent, false ); m_sdbSizerButtonsOK->SetDefault(); FinishDialogSettings(); }
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(); }
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems, COMMIT& aCommit ) : DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ), m_frame( aParent ), m_items( aItems ), m_commit( aCommit ), m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, m_TrackStartXUnit ), m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ), m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, m_TrackEndXUnit ), m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ), m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit, true ), m_viaX( aParent, m_ViaXLabel, m_ViaXCtrl, m_ViaXUnit ), m_viaY( aParent, m_ViaYLabel, m_ViaYCtrl, m_ViaYUnit ), m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit, true ), m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit, true ), m_tracks( false ), m_vias( false ) { wxASSERT( !m_items.Empty() ); VIATYPE_T viaType = VIA_NOT_DEFINED; m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() ); m_TrackLayerCtrl->SetLayersHotkeys( false ); m_TrackLayerCtrl->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); m_TrackLayerCtrl->SetBoardFrame( aParent ); m_TrackLayerCtrl->Resync(); m_ViaStartLayer->SetLayersHotkeys( false ); m_ViaStartLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); m_ViaStartLayer->SetBoardFrame( aParent ); m_ViaStartLayer->Resync(); m_ViaEndLayer->SetLayersHotkeys( false ); m_ViaEndLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); m_ViaEndLayer->SetBoardFrame( aParent ); m_ViaEndLayer->Resync(); bool nets = false; int net = 0; bool hasLocked = false; bool hasUnlocked = false; // Look for values that are common for every item that is selected for( auto& item : m_items ) { if( !nets ) { net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode(); nets = true; } else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() ) { net = -1; } switch( item->Type() ) { case PCB_TRACE_T: { const TRACK* t = static_cast<const TRACK*>( item ); if( !m_tracks ) // first track in the list { m_trackStartX.SetValue( t->GetStart().x ); m_trackStartY.SetValue( t->GetStart().y ); m_trackEndX.SetValue( t->GetEnd().x ); m_trackEndY.SetValue( t->GetEnd().y ); m_trackWidth.SetValue( t->GetWidth() ); m_TrackLayerCtrl->SetLayerSelection( t->GetLayer() ); m_tracks = true; } else // check if values are the same for every selected track { if( m_trackStartX.GetValue() != t->GetStart().x ) m_trackStartX.SetValue( INDETERMINATE ); if( m_trackStartY.GetValue() != t->GetStart().y ) m_trackStartY.SetValue( INDETERMINATE ); if( m_trackEndX.GetValue() != t->GetEnd().x ) m_trackEndX.SetValue( INDETERMINATE ); if( m_trackEndY.GetValue() != t->GetEnd().y ) m_trackEndY.SetValue( INDETERMINATE ); if( m_trackWidth.GetValue() != t->GetWidth() ) m_trackWidth.SetValue( INDETERMINATE ); if( m_TrackLayerCtrl->GetLayerSelection() != t->GetLayer() ) m_TrackLayerCtrl->SetLayerSelection( UNDEFINED_LAYER ); } if( t->IsLocked() ) hasLocked = true; else hasUnlocked = true; break; } case PCB_VIA_T: { const VIA* v = static_cast<const VIA*>( item ); if( !m_vias ) // first via in the list { m_viaX.SetValue( v->GetPosition().x ); m_viaY.SetValue( v->GetPosition().y ); m_viaDiameter.SetValue( v->GetWidth() ); m_viaDrill.SetValue( v->GetDrillValue() ); m_vias = true; viaType = v->GetViaType(); m_ViaStartLayer->SetLayerSelection( v->TopLayer() ); m_ViaEndLayer->SetLayerSelection( v->BottomLayer() ); } else // check if values are the same for every selected via { if( m_viaX.GetValue() != v->GetPosition().x ) m_viaX.SetValue( INDETERMINATE ); if( m_viaY.GetValue() != v->GetPosition().y ) m_viaY.SetValue( INDETERMINATE ); if( m_viaDiameter.GetValue() != v->GetWidth() ) m_viaDiameter.SetValue( INDETERMINATE ); if( m_viaDrill.GetValue() != v->GetDrillValue() ) m_viaDrill.SetValue( INDETERMINATE ); if( viaType != v->GetViaType() ) viaType = VIA_NOT_DEFINED; if( m_ViaStartLayer->GetLayerSelection() != v->TopLayer() ) m_ViaStartLayer->SetLayerSelection( UNDEFINED_LAYER ); if( m_ViaEndLayer->GetLayerSelection() != v->BottomLayer() ) m_ViaEndLayer->SetLayerSelection( UNDEFINED_LAYER ); } if( v->IsLocked() ) hasLocked = true; else hasUnlocked = true; break; } default: { wxASSERT( false ); break; } } } if ( net >= 0 ) m_netSelector->SetSelectedNetcode( net ); else m_netSelector->SetIndeterminate(); wxASSERT( m_tracks || m_vias ); if( m_vias ) { m_DesignRuleViasUnit->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) ); int viaSelection = wxNOT_FOUND; for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ ) { VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii]; wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false, true ) + " / " + StringFromValue( m_units, viaDimension->m_Drill, false, true ); m_DesignRuleViasCtrl->Append( msg, viaDimension ); if( viaSelection == wxNOT_FOUND && m_viaDiameter.GetValue() == viaDimension->m_Diameter && m_viaDrill.GetValue() == viaDimension->m_Drill ) { viaSelection = ii; } } m_DesignRuleViasCtrl->SetSelection( viaSelection ); m_DesignRuleViasCtrl->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaSelect ), NULL, this ); m_ViaDiameterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this ); m_ViaDrillCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this ); m_ViaTypeChoice->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this ); SetInitialFocus( m_ViaDiameterCtrl ); m_ViaTypeChoice->Enable(); switch( viaType ) { case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break; case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break; case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break; case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break; } m_ViaStartLayer->Enable( viaType != VIA_THROUGH ); m_ViaEndLayer->Enable( viaType != VIA_THROUGH ); } else { m_MainSizer->Hide( m_sbViaSizer, true ); } if( m_tracks ) { m_DesignRuleWidthsUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) ); int widthSelection = wxNOT_FOUND; for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ ) { int width = aParent->GetDesignSettings().m_TrackWidthList[ii]; wxString msg = StringFromValue( m_units, width, false, true ); m_DesignRuleWidthsCtrl->Append( msg ); if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width ) widthSelection = ii; } m_DesignRuleWidthsCtrl->SetSelection( widthSelection ); m_DesignRuleWidthsCtrl->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onWidthSelect ), NULL, this ); m_TrackWidthCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onWidthEdit ), NULL, this ); SetInitialFocus( m_TrackWidthCtrl ); } else { m_MainSizer->Hide( m_sbTrackSizer, true ); } if( hasLocked && hasUnlocked ) m_lockedCbox->Set3StateValue( wxCHK_UNDETERMINED ); else if( hasLocked ) m_lockedCbox->Set3StateValue( wxCHK_CHECKED ); else m_lockedCbox->Set3StateValue( wxCHK_UNCHECKED ); SetInitialFocus( m_tracks ? m_TrackStartXCtrl : m_ViaXCtrl ); m_StdButtonsOK->SetDefault(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); }
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ) : DIALOG_TEXT_PROPERTIES_BASE( aParent ), m_Parent( aParent ), m_item( aItem ), m_edaText( nullptr ), m_modText( nullptr ), m_pcbText( nullptr ), m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits, true ), m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits, true ), m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits, true ), m_posX( aParent, m_PositionXLabel, m_PositionXCtrl, m_PositionXUnits ), m_posY( aParent, m_PositionYLabel, m_PositionYCtrl, m_PositionYUnits ), m_OrientValidator( 1, &m_OrientValue ) { wxString title; if( m_item->Type() == PCB_DIMENSION_T ) { title = _( "Dimension Text Properties" ); DIMENSION* dimension = (DIMENSION*) m_item; m_edaText = &dimension->Text(); m_pcbText = &dimension->Text(); SetInitialFocus( m_DimensionText ); m_SingleLineSizer->Show( false ); m_MultiLineSizer->Show( false ); m_KeepUpright->Show( false ); m_statusLine->Show( false ); } else if( m_item->Type() == PCB_MODULE_TEXT_T ) { title = _( "Footprint Text Properties" ); m_modText = (TEXTE_MODULE*) m_item; m_edaText = static_cast<EDA_TEXT*>( m_modText ); switch( m_modText->GetType() ) { case TEXTE_MODULE::TEXT_is_REFERENCE: m_TextLabel->SetLabel( _( "Reference:" ) ); break; case TEXTE_MODULE::TEXT_is_VALUE: m_TextLabel->SetLabel( _( "Value:" ) ); break; case TEXTE_MODULE::TEXT_is_DIVERS: m_TextLabel->SetLabel( _( "Text:" ) ); break; } SetInitialFocus( m_SingleLineText ); m_MultiLineSizer->Show( false ); m_DimensionTextSizer->Show( false ); } else { title = _( "Text Properties" ); m_pcbText = (TEXTE_PCB*) aItem; m_edaText = static_cast<EDA_TEXT*>( m_pcbText ); SetInitialFocus( m_MultiLineText ); m_SingleLineSizer->Show( false ); m_DimensionTextSizer->Show( false ); // This option make sense only for footprint texts, // Texts on board are always visible: m_Visible->SetValue( true ); m_Visible->Show( false ); m_KeepUpright->Show( false ); m_statusLine->Show( false ); } SetTitle( title ); m_hash_key = title; // Configure the layers list selector. Note that footprints are built outside the current // board and so we may need to show all layers if the text is on an unactivated layer. if( !m_Parent->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) ) m_LayerSelectionCtrl->ShowNonActivatedLayers( true ); m_LayerSelectionCtrl->SetLayersHotkeys( false ); m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() ); m_LayerSelectionCtrl->SetBoardFrame( m_Parent ); m_LayerSelectionCtrl->Resync(); m_OrientValue = 0.0; m_OrientValidator.SetRange( -360.0, 360.0 ); m_OrientCtrl->SetValidator( m_OrientValidator ); m_OrientValidator.SetWindow( m_OrientCtrl ); // Handle decimal separators in combo dropdown for( size_t i = 0; i < m_OrientCtrl->GetCount(); ++i ) { wxString item = m_OrientCtrl->GetString( i ); item.Replace( '.', localeconv()->decimal_point[0] ); m_OrientCtrl->SetString( i, item ); } // Set font sizes wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); infoFont.SetSymbolicSize( wxFONTSIZE_SMALL ); m_statusLine->SetFont( infoFont ); m_sdbSizerOK->SetDefault(); // Tab down the left side first KIUI::SetControlsTabOrder( { m_LayerLabel, m_LayerSelectionCtrl, m_SizeXCtrl, m_SizeYCtrl, m_ThicknessCtrl, m_PositionXCtrl, m_PositionYCtrl, m_Visible, m_Italic, m_JustifyChoice, m_OrientCtrl, m_Mirrored, m_KeepUpright, } ); // wxTextCtrls fail to generate wxEVT_CHAR events when the wxTE_MULTILINE flag is set, // so we have to listen to wxEVT_CHAR_HOOK events instead. Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( DIALOG_TEXT_PROPERTIES::OnCharHook ), NULL, this ); FinishDialogSettings(); }
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems ) : DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ), m_items( aItems ), m_trackStartX( aParent, m_TrackStartXCtrl, m_TrackStartXUnit ), m_trackStartY( aParent, m_TrackStartYCtrl, m_TrackStartYUnit ), m_trackEndX( aParent, m_TrackEndXCtrl, m_TrackEndXUnit ), m_trackEndY( aParent, m_TrackEndYCtrl, m_TrackEndYUnit ), m_trackWidth( aParent, m_TrackWidthCtrl, m_TrackWidthUnit ), m_viaX( aParent, m_ViaXCtrl, m_ViaXUnit ), m_viaY( aParent, m_ViaYCtrl, m_ViaYUnit ), m_viaDiameter( aParent, m_ViaDiameterCtrl, m_ViaDiameterUnit ), m_viaDrill( aParent, m_ViaDrillCtrl, m_ViaDrillUnit ), m_tracks( false ), m_vias( false ) { assert( !m_items.Empty() ); boost::optional<int> trackStartX, trackStartY, trackEndX, trackEndY, trackWidth; boost::optional<LAYER_ID> trackLayer; boost::optional<int> viaX, viaY, viaDiameter, viaDrill; // Look for values that are common for every item that is selected for( int i = 0; i < m_items.Size(); ++i ) { const BOARD_ITEM* item = m_items.Item<BOARD_ITEM>( i ); switch( item->Type() ) { case PCB_TRACE_T: { const TRACK* t = static_cast<const TRACK*>( item ); if( !m_tracks ) // first track in the list { trackStartX = t->GetStart().x; trackStartY = t->GetStart().y; trackEndX = t->GetEnd().x; trackEndY = t->GetEnd().y; trackWidth = t->GetWidth(); trackLayer = t->GetLayer(); m_tracks = true; } else // check if values are the same for every selected track { if( trackStartX && *trackStartX != t->GetStart().x ) trackStartX = boost::none; if( trackStartY && *trackStartY != t->GetStart().y ) trackStartY = boost::none; if( trackEndX && *trackEndX != t->GetEnd().x ) trackEndX = boost::none; if( trackEndY && *trackEndY != t->GetEnd().y ) trackEndY = boost::none; if( trackWidth && *trackWidth != t->GetWidth() ) trackWidth = boost::none; if( trackLayer && *trackLayer != t->GetLayer() ) trackLayer = boost::none; } break; } case PCB_VIA_T: { const VIA* v = static_cast<const VIA*>( item ); if( !m_vias ) // first via in the list { viaX = v->GetPosition().x; viaY = v->GetPosition().y; viaDiameter = v->GetWidth(); viaDrill = v->GetDrillValue(); m_vias = true; } else // check if values are the same for every selected via { if( viaX && *viaX != v->GetPosition().x ) viaX = boost::none; if( viaY && *viaY != v->GetPosition().y ) viaY = boost::none; if( viaDiameter && *viaDiameter != v->GetWidth() ) viaDiameter = boost::none; if( viaDrill && *viaDrill != v->GetDrillValue() ) viaDrill = boost::none; } break; } default: assert( false ); break; } } assert( m_tracks || m_vias ); if( m_vias ) { setCommonVal( viaX, m_ViaXCtrl, m_viaX ); setCommonVal( viaY, m_ViaYCtrl, m_viaY ); setCommonVal( viaDiameter, m_ViaDiameterCtrl, m_viaDiameter ); setCommonVal( viaDrill, m_ViaDrillCtrl, m_viaDrill ); m_ViaDiameterCtrl->SetFocus(); } else { m_MainSizer->Hide( m_sbViaSizer, true ); } if( m_tracks ) { setCommonVal( trackStartX, m_TrackStartXCtrl, m_trackStartX ); setCommonVal( trackStartY, m_TrackStartYCtrl, m_trackStartY ); setCommonVal( trackEndX, m_TrackEndXCtrl, m_trackEndX ); setCommonVal( trackEndY, m_TrackEndYCtrl, m_trackEndY ); setCommonVal( trackWidth, m_TrackWidthCtrl, m_trackWidth ); m_TrackLayerCtrl->SetLayersHotkeys( false ); m_TrackLayerCtrl->SetLayerSet( LSET::AllNonCuMask() ); m_TrackLayerCtrl->SetBoardFrame( aParent ); m_TrackLayerCtrl->Resync(); if( trackLayer ) m_TrackLayerCtrl->SetLayerSelection( *trackLayer ); m_TrackWidthCtrl->SetFocus(); } else { m_MainSizer->Hide( m_sbTrackSizer, true ); } m_StdButtonsOK->SetDefault(); FixOSXCancelButtonIssue(); // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); // Pressing ENTER when any of the text input fields is active applies changes Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onOkClick ), NULL, this ); }