diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index c72c783f52..0144f0b583 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1613,7 +1613,8 @@ static struct EDA_SHAPE_DESC .Map( PLOT_DASH_TYPE::SOLID, _HKI( "Solid" ) ) .Map( PLOT_DASH_TYPE::DASH, _HKI( "Dashed" ) ) .Map( PLOT_DASH_TYPE::DOT, _HKI( "Dotted" ) ) - .Map( PLOT_DASH_TYPE::DASHDOT, _HKI( "Dash-Dot" ) ); + .Map( PLOT_DASH_TYPE::DASHDOT, _HKI( "Dash-Dot" ) ) + .Map( PLOT_DASH_TYPE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) ); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); REGISTER_TYPE( EDA_SHAPE ); diff --git a/common/hash_eda.cpp b/common/hash_eda.cpp index 7105c53ebf..cb561d7a52 100644 --- a/common/hash_eda.cpp +++ b/common/hash_eda.cpp @@ -160,7 +160,6 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags ) { hash_combine( ret, shape->GetCenter0().x ); hash_combine( ret, shape->GetCenter0().y ); - hash_combine( ret, shape->GetArcAngle() ); } } else @@ -174,7 +173,6 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags ) { hash_combine( ret, shape->GetCenter().x ); hash_combine( ret, shape->GetCenter().y ); - hash_combine( ret, shape->GetArcAngle() ); } } } diff --git a/common/pcb.keywords b/common/pcb.keywords index db9d313237..a2cfd3706c 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -256,6 +256,7 @@ solid stackup start status +stroke style suffix suppress_zeroes diff --git a/common/pcb_plot_params.keywords b/common/pcb_plot_params.keywords index 6a97d9a0be..4863eec609 100644 --- a/common/pcb_plot_params.keywords +++ b/common/pcb_plot_params.keywords @@ -1,4 +1,6 @@ creategerberjobfile +dashed_line_dash_ratio +dashed_line_gap_ratio disableapertmacros drillshape dxfimperialunits diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index 4c28099b17..dd7de7631b 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -185,4 +185,10 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ) wxString labelSizeRatio = wxString::Format( "%f", aSettings.m_LabelSizeRatio * 100.0 ); m_labelSizeRatioCtrl->SetValue( labelSizeRatio ); + + m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + aSettings.m_DashedLineDashRatio ) ); + + m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + aSettings.m_DashedLineGapRatio ) ); } diff --git a/eeschema/schematic.keywords b/eeschema/schematic.keywords index fceef87873..072085038f 100644 --- a/eeschema/schematic.keywords +++ b/eeschema/schematic.keywords @@ -127,3 +127,4 @@ xy x y yes + diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index 841a59a1aa..4f43374dad 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -50,8 +50,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_IntersheetRefsFormatShort( false ), m_IntersheetRefsPrefix( DEFAULT_IREF_PREFIX ), m_IntersheetRefsSuffix( DEFAULT_IREF_SUFFIX ), - m_DashedLineDashRatio( 5 ), - m_DashedLineGapRatio( 3 ), + m_DashedLineDashRatio( 5.0 ), + m_DashedLineGapRatio( 3.0 ), m_SpiceAdjustPassiveValues( false ), m_NgspiceSimulatorSettings( nullptr ) { @@ -92,10 +92,10 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin &m_IntersheetRefsSuffix, defaultIntersheetsRefSuffix ) ); m_params.emplace_back( new PARAM( "drawing.dashed_lines_dash_length_ratio", - &m_DashedLineDashRatio, 5 ) ); + &m_DashedLineDashRatio, 5.0 ) ); m_params.emplace_back( new PARAM( "drawing.dashed_lines_gap_length_ratio", - &m_DashedLineGapRatio, 3 ) ); + &m_DashedLineGapRatio, 3.0 ) ); m_params.emplace_back( new PARAM_SCALED( "drawing.default_line_thickness", &m_DefaultLineWidth, Mils2iu( defaultLineThickness ), Mils2iu( 5 ), Mils2iu( 1000 ), diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 3ab6e269cb..985b811a1f 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -164,6 +164,8 @@ set( PCBNEW_DIALOGS dialogs/panel_pcbnew_display_origin_base.cpp dialogs/panel_setup_constraints.cpp dialogs/panel_setup_constraints_base.cpp + dialogs/panel_setup_formatting.cpp + dialogs/panel_setup_formatting_base.cpp dialogs/panel_setup_mask_and_paste.cpp dialogs/panel_setup_mask_and_paste_base.cpp dialogs/panel_setup_layers.cpp diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index d93753166f..7ab636ebdc 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -220,56 +220,56 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std: m_params.emplace_back( new PARAM( "rules.use_height_for_length_calcs", &m_UseHeightForLengthCalcs, true ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_clearance", &m_MinClearance, - Millimeter2iu( DEFAULT_MINCLEARANCE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_clearance", + &m_MinClearance, Millimeter2iu( DEFAULT_MINCLEARANCE ), + Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_track_width", &m_TrackMinWidth, - Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_track_width", + &m_TrackMinWidth, Millimeter2iu( DEFAULT_TRACKMINWIDTH ), + Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); m_params.emplace_back( new PARAM_SCALED( "rules.min_via_annular_width", - &m_ViasMinAnnularWidth, Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), - Millimeter2iu( 25.0 ), MM_PER_IU ) ); + &m_ViasMinAnnularWidth, Millimeter2iu( DEFAULT_VIASMINSIZE ), + Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_via_diameter", &m_ViasMinSize, - Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_via_diameter", + &m_ViasMinSize, Millimeter2iu( DEFAULT_VIASMINSIZE ), + Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); m_params.emplace_back( new PARAM_SCALED( "rules.min_through_hole_diameter", - &m_MinThroughDrill, Millimeter2iu( DEFAULT_MINTHROUGHDRILL ), Millimeter2iu( 0.01 ), - Millimeter2iu( 25.0 ), MM_PER_IU ) ); + &m_MinThroughDrill, Millimeter2iu( DEFAULT_MINTHROUGHDRILL ), + Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); m_params.emplace_back( new PARAM_SCALED( "rules.min_microvia_diameter", - &m_MicroViasMinSize, Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ), - Millimeter2iu( 10.0 ), MM_PER_IU ) ); + &m_MicroViasMinSize, Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), + Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_microvia_drill", &m_MicroViasMinDrill, - Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ), - Millimeter2iu( 10.0 ), MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_microvia_drill", + &m_MicroViasMinDrill, Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), + Millimeter2iu( 0.01 ), Millimeter2iu( 10.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_hole_to_hole", &m_HoleToHoleMin, - Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.00 ), Millimeter2iu( 10.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_hole_to_hole", + &m_HoleToHoleMin, Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), + Millimeter2iu( 0.00 ), Millimeter2iu( 10.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_hole_clearance", &m_HoleClearance, - Millimeter2iu( DEFAULT_HOLECLEARANCE ), Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_hole_clearance", + &m_HoleClearance, Millimeter2iu( DEFAULT_HOLECLEARANCE ), + Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_silk_clearance", &m_SilkClearance, - Millimeter2iu( DEFAULT_SILKCLEARANCE ), Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), - MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_silk_clearance", + &m_SilkClearance, Millimeter2iu( DEFAULT_SILKCLEARANCE ), + Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) ); m_params.emplace_back( new PARAM( "rules.min_resolved_spokes", &m_MinResolvedSpokes, DEFAULT_MINRESOLVEDSPOKES, 0, 4 ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_text_height", &m_MinSilkTextHeight, - Millimeter2iu( DEFAULT_SILK_TEXT_SIZE * 0.8 ), Millimeter2iu( 0.00 ), - Millimeter2iu( 100.0 ), MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_text_height", + &m_MinSilkTextHeight, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE * 0.8 ), + Millimeter2iu( 0.00 ), Millimeter2iu( 100.0 ), MM_PER_IU ) ); - m_params.emplace_back( new PARAM_SCALED( "rules.min_text_thickness", &m_MinSilkTextThickness, - Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH * 0.8 ), Millimeter2iu( 0.00 ), - Millimeter2iu( 25.0 ), MM_PER_IU ) ); + m_params.emplace_back( new PARAM_SCALED( "rules.min_text_thickness", + &m_MinSilkTextThickness, Millimeter2iu( DEFAULT_SILK_TEXT_WIDTH * 0.8 ), + Millimeter2iu( 0.00 ), Millimeter2iu( 25.0 ), MM_PER_IU ) ); // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method // based on the edge cut thicknesses. diff --git a/pcbnew/board_stackup_manager/panel_board_finish_base.cpp b/pcbnew/board_stackup_manager/panel_board_finish_base.cpp index 76f13b88ba..89a4eab655 100644 --- a/pcbnew/board_stackup_manager/panel_board_finish_base.cpp +++ b/pcbnew/board_stackup_manager/panel_board_finish_base.cpp @@ -53,7 +53,7 @@ PANEL_SETUP_BOARD_FINISH_BASE::PANEL_SETUP_BOARD_FINISH_BASE( wxWindow* parent, bMargins->Add( fgSizer2, 1, wxEXPAND|wxTOP, 10 ); - bMainSizer->Add( bMargins, 1, wxEXPAND, 10 ); + bMainSizer->Add( bMargins, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); this->SetSizer( bMainSizer ); diff --git a/pcbnew/board_stackup_manager/panel_board_finish_base.fbp b/pcbnew/board_stackup_manager/panel_board_finish_base.fbp index bb7cd934ba..5eae5a676a 100644 --- a/pcbnew/board_stackup_manager/panel_board_finish_base.fbp +++ b/pcbnew/board_stackup_manager/panel_board_finish_base.fbp @@ -55,8 +55,8 @@ wxVERTICAL none - 10 - wxEXPAND + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 diff --git a/pcbnew/dialogs/dialog_board_setup.cpp b/pcbnew/dialogs/dialog_board_setup.cpp index 5261ebf224..5c3086801b 100644 --- a/pcbnew/dialogs/dialog_board_setup.cpp +++ b/pcbnew/dialogs/dialog_board_setup.cpp @@ -58,6 +58,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : m_layers = new PANEL_SETUP_LAYERS( this, aFrame ); m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame ); + m_formatting = new PANEL_SETUP_FORMATTING( this, aFrame ); m_constraints = new PANEL_SETUP_CONSTRAINTS( this, aFrame ); m_rules = new PANEL_SETUP_RULES( this, aFrame ); m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints ); @@ -99,6 +100,7 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) : m_treebook->AddPage( new wxPanel( this ), _( "Text & Graphics" ) ); m_treebook->AddSubPage( m_textAndGraphics, _( "Defaults" ) ); + m_treebook->AddSubPage( m_formatting, _( "Fomatting" ) ); m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) ); m_treebook->AddPage( new wxPanel( this ), _( "Design Rules" ) ); @@ -251,11 +253,15 @@ void DIALOG_BOARD_SETUP::OnAuxiliaryAction( wxCommandEvent& event ) { m_layers->ImportSettingsFrom( otherBoard ); m_physicalStackup->ImportSettingsFrom( otherBoard ); + m_boardFinish->ImportSettingsFrom( otherBoard ); } if( importDlg.m_TextAndGraphicsOpt->GetValue() ) m_textAndGraphics->ImportSettingsFrom( otherBoard ); + if( importDlg.m_FormattingOpt->GetValue() ) + m_formatting->ImportSettingsFrom( otherBoard ); + if( importDlg.m_ConstraintsOpt->GetValue() ) m_constraints->ImportSettingsFrom( otherBoard ); diff --git a/pcbnew/dialogs/dialog_board_setup.h b/pcbnew/dialogs/dialog_board_setup.h index f77401fdc6..d17632261c 100644 --- a/pcbnew/dialogs/dialog_board_setup.h +++ b/pcbnew/dialogs/dialog_board_setup.h @@ -22,6 +22,7 @@ #define KICAD_DIALOG_BOARD_SETUP_H #include +#include "panel_setup_formatting.h" class PCB_EDIT_FRAME; class PANEL_SETUP_CONSTRAINTS; @@ -51,6 +52,7 @@ protected: PANEL_SETUP_CONSTRAINTS* m_constraints; PANEL_SETUP_LAYERS* m_layers; PANEL_SETUP_TEXT_AND_GRAPHICS* m_textAndGraphics; + PANEL_SETUP_FORMATTING* m_formatting; PANEL_SETUP_NETCLASSES* m_netclasses; PANEL_SETUP_RULES* m_rules; PANEL_SETUP_TRACKS_AND_VIAS* m_tracksAndVias; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 01b7c15f0b..b97354258f 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -78,6 +78,8 @@ private: finishDialogSettings(); } + void onFilledCheckbox( wxCommandEvent& event ) override; + bool Validate() override; }; @@ -132,6 +134,11 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR m_LayerSelectionCtrl->SetNotAllowedLayerSet( forbiddenLayers ); } + for( const std::pair& typeEntry : lineTypeNames ) + m_lineStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); + + m_lineStyleCombo->Append( DEFAULT_STYLE ); + m_LayerSelectionCtrl->SetLayersHotkeys( false ); m_LayerSelectionCtrl->SetBoardFrame( m_parent ); m_LayerSelectionCtrl->Resync(); @@ -151,6 +158,29 @@ void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem ) } +void DIALOG_GRAPHIC_ITEM_PROPERTIES::onFilledCheckbox( wxCommandEvent& event ) +{ + if( m_filledCtrl->GetValue() ) + { + m_lineStyleCombo->SetSelection( 0 ); + m_lineStyleLabel->Enable( false ); + m_lineStyleCombo->Enable( false ); + } + else + { + int style = static_cast( m_item->GetStroke().GetPlotStyle() ); + + if( style == -1 ) + m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE ); + else if( style < (int) lineTypeNames.size() ) + m_lineStyleCombo->SetSelection( style ); + + m_lineStyleLabel->Enable( true ); + m_lineStyleCombo->Enable( true ); + } +} + + bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow() { if( !m_item ) @@ -254,7 +284,17 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow() m_filledCtrl->SetValue( m_item->IsFilled() ); m_locked->SetValue( m_item->IsLocked() ); - m_thickness.SetValue( m_item->GetWidth() ); + + m_thickness.SetValue( m_item->GetStroke().GetWidth() ); + + int style = static_cast( m_item->GetStroke().GetPlotStyle() ); + + if( style == -1 ) + m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE ); + else if( style < (int) lineTypeNames.size() ) + m_lineStyleCombo->SetSelection( style ); + else + wxFAIL_MSG( "Line type not found in the type lookup map" ); m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ); @@ -340,7 +380,17 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow() m_item->SetLocked( m_locked->GetValue() ); STROKE_PARAMS stroke = m_item->GetStroke(); + stroke.SetWidth( m_thickness.GetValue() ); + + auto it = lineTypeNames.begin(); + std::advance( it, m_lineStyleCombo->GetSelection() ); + + if( it == lineTypeNames.end() ) + stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT ); + else + stroke.SetPlotStyle( it->first ); + m_item->SetStroke( stroke ); m_item->SetLayer( ToLAYER_ID( layer ) ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp index 0e96f92b3a..c779eeb6a5 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -21,7 +21,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxVERTICAL ); - m_sizerLeft = new wxGridBagSizer( 5, 5 ); + m_sizerLeft = new wxGridBagSizer( 5, 3 ); m_sizerLeft->SetFlexibleDirection( wxBOTH ); m_sizerLeft->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_sizerLeft->SetEmptyCellSize( wxSize( 5,5 ) ); @@ -131,72 +131,67 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind m_sizerLeft->Add( m_BezierPointC2YUnit, wxGBPosition( 6, 5 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - bUpperSizer->Add( m_sizerLeft, 1, wxEXPAND, 20 ); + bUpperSizer->Add( m_sizerLeft, 0, wxEXPAND, 20 ); - wxBoxSizer* bUpperRightSizer; - bUpperRightSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMiddleSizer; + bMiddleSizer = new wxBoxSizer( wxVERTICAL ); - wxFlexGridSizer* fgUpperRightGridSizer; - fgUpperRightGridSizer = new wxFlexGridSizer( 0, 3, 3, 0 ); - fgUpperRightGridSizer->AddGrowableCol( 1 ); - fgUpperRightGridSizer->SetFlexibleDirection( wxBOTH ); - fgUpperRightGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + wxGridBagSizer* gbSizer2; + gbSizer2 = new wxGridBagSizer( 5, 0 ); + gbSizer2->SetFlexibleDirection( wxBOTH ); + gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_angleLabel = new wxStaticText( this, wxID_ANY, _("Arc angle:"), wxDefaultPosition, wxDefaultSize, 0 ); m_angleLabel->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_angleLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT, 5 ); + gbSizer2->Add( m_angleLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_angleCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_angleCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + gbSizer2->Add( m_angleCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_angleUnits = new wxStaticText( this, wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 ); m_angleUnits->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_angleUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); + gbSizer2->Add( m_angleUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_locked = new wxCheckBox( this, wxID_ANY, _("Locked"), wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_locked, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - - fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); - - - fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + gbSizer2->Add( m_locked, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT, 5 ); m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Filled shape"), wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_filledCtrl, 0, wxTOP|wxLEFT, 5 ); - - - fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); - - - fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + gbSizer2->Add( m_filledCtrl, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_thicknessLabel = new wxStaticText( this, wxID_ANY, _("Line width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_thicknessLabel->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_thicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + gbSizer2->Add( m_thicknessLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); m_thicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgUpperRightGridSizer->Add( m_thicknessCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + gbSizer2->Add( m_thicknessCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); m_thicknessUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); m_thicknessUnits->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_thicknessUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + gbSizer2->Add( m_thicknessUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_lineStyleLabel = new wxStaticText( this, wxID_ANY, _("Line style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lineStyleLabel->Wrap( -1 ); + gbSizer2->Add( m_lineStyleLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_lineStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + m_lineStyleCombo->SetMinSize( wxSize( 210,-1 ) ); + + gbSizer2->Add( m_lineStyleCombo, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 ); m_LayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_LayerLabel->Wrap( -1 ); - fgUpperRightGridSizer->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 ); + gbSizer2->Add( m_LayerLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgUpperRightGridSizer->Add( m_LayerSelectionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); - + gbSizer2->Add( m_LayerSelectionCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - fgUpperRightGridSizer->Add( 0, 0, 1, wxEXPAND, 5 ); + gbSizer2->AddGrowableCol( 1 ); - bUpperRightSizer->Add( fgUpperRightGridSizer, 0, wxEXPAND|wxTOP, 5 ); + bMiddleSizer->Add( gbSizer2, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - bUpperSizer->Add( bUpperRightSizer, 0, wxEXPAND, 5 ); + bUpperSizer->Add( bMiddleSizer, 0, wxEXPAND, 5 ); bMainSizer->Add( bUpperSizer, 1, wxEXPAND|wxALL, 5 ); @@ -223,6 +218,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); + m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onFilledCheckbox ), NULL, this ); } DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() @@ -230,5 +226,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); + m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onFilledCheckbox ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp index 7f5bb0c6b7..25a786f742 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,7 +14,6 @@ dialog_graphic_item_properties_base 1000 none - 1 DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE @@ -26,7 +25,6 @@ 1 1 UI - 0 0 0 @@ -52,7 +50,6 @@ DIALOG_SHIM; dialog_shim.h Graphic Item Properties - 0 @@ -75,13 +72,13 @@ 20 wxEXPAND - 1 + 0 5,5 wxBOTH - 5 + 3 m_sizerLeft wxFLEX_GROWMODE_SPECIFIED @@ -1911,29 +1908,31 @@ 0 - bUpperRightSizer + bMiddleSizer wxVERTICAL none 5 - wxEXPAND|wxTOP - 0 - - 3 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + wxBOTH 1 0 - fgUpperRightGridSizer + gbSizer2 wxFLEX_GROWMODE_SPECIFIED none - 0 - 3 - + 5 + 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT - 0 + 1 + 0 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + 1 1 1 @@ -1991,10 +1990,13 @@ -1 - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM + 0 + 1 1 1 @@ -2055,10 +2057,13 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 + 1 + 2 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + 1 1 1 @@ -2116,10 +2121,13 @@ -1 - + 5 - wxTOP|wxRIGHT|wxLEFT - 0 + 1 + 0 + wxRIGHT|wxLEFT + 1 + 1 1 1 @@ -2180,30 +2188,13 @@ - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - + 5 - wxTOP|wxLEFT - 0 + 2 + 0 + wxBOTTOM|wxRIGHT|wxLEFT + 2 + 1 1 1 @@ -2262,32 +2253,16 @@ + onFilledCheckbox - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - + 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 3 + 1 1 1 @@ -2345,10 +2320,13 @@ -1 - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT - 0 + 1 + 1 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP + 3 + 1 1 1 @@ -2409,10 +2387,13 @@ - + 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 3 + 1 1 1 @@ -2470,10 +2451,145 @@ -1 - + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Line style: + 0 + + 0 + + + 0 + + 1 + m_lineStyleLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 210,-1 + 1 + m_lineStyleCombo + 1 + + + protected + 1 + + Resizable + -1 + 1 + + wxCB_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + Combo! + + + + + + 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 5 + 1 1 1 @@ -2531,10 +2647,13 @@ -1 - - 3 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 5 + 1 1 1 @@ -2596,16 +2715,6 @@ - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_base.h b/pcbnew/dialogs/dialog_graphic_item_properties_base.h index 9e51961b65..5eb32c2d89 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_base.h +++ b/pcbnew/dialogs/dialog_graphic_item_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -76,6 +76,8 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_thicknessLabel; wxTextCtrl* m_thicknessCtrl; wxStaticText* m_thicknessUnits; + wxStaticText* m_lineStyleLabel; + wxBitmapComboBox* m_lineStyleCombo; wxStaticText* m_LayerLabel; PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl; wxStaticLine* m_staticline1; @@ -83,15 +85,15 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_StandardButtonsSizerOK; wxButton* m_StandardButtonsSizerCancel; - // Virtual event handlers, override them in your derived class + // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } + virtual void onFilledCheckbox( wxCommandEvent& event ) { event.Skip(); } public: DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Graphic Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); - ~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE(); }; diff --git a/pcbnew/dialogs/dialog_import_settings.cpp b/pcbnew/dialogs/dialog_import_settings.cpp index 435904a01f..f5d1befa51 100644 --- a/pcbnew/dialogs/dialog_import_settings.cpp +++ b/pcbnew/dialogs/dialog_import_settings.cpp @@ -84,7 +84,7 @@ bool DIALOG_IMPORT_SETTINGS::UpdateImportSettingsButton() bool buttonEnableState = ( m_LayersOpt->IsChecked() || m_MaskAndPasteOpt->IsChecked() || m_ConstraintsOpt->IsChecked() || m_NetclassesOpt->IsChecked() || m_SeveritiesOpt->IsChecked() || m_TextAndGraphicsOpt->IsChecked() - || m_TracksAndViasOpt->IsChecked() ); + || m_FormattingOpt->IsChecked() || m_TracksAndViasOpt->IsChecked() ); m_sdbSizer1OK->Enable( buttonEnableState ); @@ -140,6 +140,7 @@ void DIALOG_IMPORT_SETTINGS::OnSelectAll( wxCommandEvent& event ) // Select or deselect all options based on internal flag m_LayersOpt->SetValue( m_showSelectAllOnBtn ); m_TextAndGraphicsOpt->SetValue( m_showSelectAllOnBtn ); + m_FormattingOpt->SetValue( m_showSelectAllOnBtn ); m_ConstraintsOpt->SetValue( m_showSelectAllOnBtn ); m_NetclassesOpt->SetValue( m_showSelectAllOnBtn ); m_TracksAndViasOpt->SetValue( m_showSelectAllOnBtn ); diff --git a/pcbnew/dialogs/dialog_import_settings_base.cpp b/pcbnew/dialogs/dialog_import_settings_base.cpp index 30e04dfac2..3ce7550105 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.cpp +++ b/pcbnew/dialogs/dialog_import_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -46,39 +46,33 @@ DIALOG_IMPORT_SETTINGS_BASE::DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWi importLabel->Wrap( -1 ); bLeftCol->Add( importLabel, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); - m_LayersOpt = new wxCheckBox( this, wxID_ANY, _("Layers setup"), wxDefaultPosition, wxDefaultSize, 0 ); + m_LayersOpt = new wxCheckBox( this, wxID_ANY, _("Board layers and physical stackup"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftCol->Add( m_LayersOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_TextAndGraphicsOpt = new wxCheckBox( this, wxID_ANY, _("Text and graphics default properties"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MaskAndPasteOpt = new wxCheckBox( this, wxID_ANY, _("Solder mask/paste defaults"), wxDefaultPosition, wxDefaultSize, 0 ); + bLeftCol->Add( m_MaskAndPasteOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_TextAndGraphicsOpt = new wxCheckBox( this, wxID_ANY, _("Text && graphics default properties"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftCol->Add( m_TextAndGraphicsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_ConstraintsOpt = new wxCheckBox( this, wxID_ANY, _("Design rules"), wxDefaultPosition, wxDefaultSize, 0 ); + m_FormattingOpt = new wxCheckBox( this, wxID_ANY, _("Text && graphics formatting"), wxDefaultPosition, wxDefaultSize, 0 ); + bLeftCol->Add( m_FormattingOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_ConstraintsOpt = new wxCheckBox( this, wxID_ANY, _("Design rule constraints"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftCol->Add( m_ConstraintsOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_TracksAndViasOpt = new wxCheckBox( this, wxID_ANY, _("Predefined track and via dimensions"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TracksAndViasOpt = new wxCheckBox( this, wxID_ANY, _("Predefined track && via dimensions"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftCol->Add( m_TracksAndViasOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_MaskAndPasteOpt = new wxCheckBox( this, wxID_ANY, _("Solder mask/paste defaults"), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftCol->Add( m_MaskAndPasteOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_NetclassesOpt = new wxCheckBox( this, wxID_ANY, _("Net classes"), wxDefaultPosition, wxDefaultSize, 0 ); + bLeftCol->Add( m_NetclassesOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_SeveritiesOpt = new wxCheckBox( this, wxID_ANY, _("Violation severities"), wxDefaultPosition, wxDefaultSize, 0 ); bLeftCol->Add( m_SeveritiesOpt, 0, wxRIGHT|wxLEFT, 5 ); - m_NetclassesOpt = new wxCheckBox( this, wxID_ANY, _("Net classes"), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftCol->Add( m_NetclassesOpt, 0, wxALL, 5 ); - bMiddleSizer->Add( bLeftCol, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - wxBoxSizer* bRightCol; - bRightCol = new wxBoxSizer( wxVERTICAL ); - - m_selectAllButton = new wxButton( this, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightCol->Add( m_selectAllButton, 0, wxALIGN_CENTER|wxALL, 10 ); - - - bMiddleSizer->Add( bRightCol, 1, wxEXPAND|wxALL, 20 ); - m_MainSizer->Add( bMiddleSizer, 1, wxEXPAND|wxBOTTOM, 5 ); @@ -87,6 +81,9 @@ DIALOG_IMPORT_SETTINGS_BASE::DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWi m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); + m_selectAllButton = new wxButton( this, wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonsSizer->Add( m_selectAllButton, 0, wxALIGN_CENTER|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 10 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); @@ -109,12 +106,12 @@ DIALOG_IMPORT_SETTINGS_BASE::DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWi // Connect Events m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnBrowseClicked ), NULL, this ); m_LayersOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); + m_MaskAndPasteOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_TextAndGraphicsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_ConstraintsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_TracksAndViasOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); - m_MaskAndPasteOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); - m_SeveritiesOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_NetclassesOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); + m_SeveritiesOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_selectAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnSelectAll ), NULL, this ); } @@ -123,12 +120,12 @@ DIALOG_IMPORT_SETTINGS_BASE::~DIALOG_IMPORT_SETTINGS_BASE() // Disconnect Events m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnBrowseClicked ), NULL, this ); m_LayersOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); + m_MaskAndPasteOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_TextAndGraphicsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_ConstraintsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_TracksAndViasOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); - m_MaskAndPasteOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); - m_SeveritiesOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_NetclassesOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); + m_SeveritiesOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnCheckboxClicked ), NULL, this ); m_selectAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_SETTINGS_BASE::OnSelectAll ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_import_settings_base.fbp b/pcbnew/dialogs/dialog_import_settings_base.fbp index 92e93c16ea..6c77725a78 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.fbp +++ b/pcbnew/dialogs/dialog_import_settings_base.fbp @@ -14,7 +14,6 @@ dialog_import_settings_base 1000 none - 1 dialog_import_settings_base @@ -26,7 +25,6 @@ 1 1 UI - 0 1 0 @@ -207,7 +205,6 @@ - 0 @@ -382,7 +379,7 @@ 0 0 wxID_ANY - Layers setup + Board layers and physical stackup 0 @@ -447,7 +444,7 @@ 0 0 wxID_ANY - Text and graphics default properties + Solder mask/paste defaults 0 @@ -455,7 +452,7 @@ 0 1 - m_TextAndGraphicsOpt + m_MaskAndPasteOpt 1 @@ -512,7 +509,7 @@ 0 0 wxID_ANY - Design rules + Text && graphics default properties 0 @@ -520,7 +517,7 @@ 0 1 - m_ConstraintsOpt + m_TextAndGraphicsOpt 1 @@ -544,11 +541,11 @@ OnCheckboxClicked - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -577,7 +574,7 @@ 0 0 wxID_ANY - Predefined track and via dimensions + Text && graphics formatting 0 @@ -585,7 +582,7 @@ 0 1 - m_TracksAndViasOpt + m_FormattingOpt 1 @@ -596,7 +593,7 @@ 1 - ; forward_declare + ; ; forward_declare 0 @@ -606,7 +603,6 @@ - OnCheckboxClicked @@ -642,7 +638,7 @@ 0 0 wxID_ANY - Solder mask/paste defaults + Design rule constraints 0 @@ -650,7 +646,7 @@ 0 1 - m_MaskAndPasteOpt + m_ConstraintsOpt 1 @@ -676,7 +672,7 @@ 5 - wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -707,7 +703,7 @@ 0 0 wxID_ANY - Violation severities + Predefined track && via dimensions 0 @@ -715,7 +711,7 @@ 0 1 - m_SeveritiesOpt + m_TracksAndViasOpt 1 @@ -726,7 +722,7 @@ 1 - ; ; forward_declare + ; forward_declare 0 @@ -741,7 +737,7 @@ 5 - wxALL + wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -804,22 +800,11 @@ OnCheckboxClicked - - - - 20 - wxEXPAND|wxALL - 1 - - - bRightCol - wxVERTICAL - none - 10 - wxALIGN_CENTER|wxALL + 5 + wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -828,34 +813,27 @@ - 0 - 1 0 + 0 1 1 - - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY - Select All - - 0 + Violation severities 0 @@ -863,20 +841,18 @@ 0 1 - m_selectAllButton + m_SeveritiesOpt 1 - protected + public 1 - - Resizable 1 - ; forward_declare + ; ; forward_declare 0 @@ -886,7 +862,7 @@ - OnSelectAll + OnCheckboxClicked @@ -960,6 +936,79 @@ m_buttonsSizer wxHORIZONTAL protected + + 10 + wxALIGN_CENTER|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Select All + + 0 + + 0 + + + 0 + + 1 + m_selectAllButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSelectAll + + 5 wxALL|wxEXPAND diff --git a/pcbnew/dialogs/dialog_import_settings_base.h b/pcbnew/dialogs/dialog_import_settings_base.h index 96b6f6964f..8ab191c4f7 100644 --- a/pcbnew/dialogs/dialog_import_settings_base.h +++ b/pcbnew/dialogs/dialog_import_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -41,9 +41,9 @@ class DIALOG_IMPORT_SETTINGS_BASE : public DIALOG_SHIM wxBoxSizer* m_MainSizer; wxTextCtrl* m_filePathCtrl; wxBitmapButton* m_browseButton; - wxButton* m_selectAllButton; wxStaticLine* m_staticline1; wxBoxSizer* m_buttonsSizer; + wxButton* m_selectAllButton; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; @@ -56,12 +56,13 @@ class DIALOG_IMPORT_SETTINGS_BASE : public DIALOG_SHIM public: wxCheckBox* m_LayersOpt; + wxCheckBox* m_MaskAndPasteOpt; wxCheckBox* m_TextAndGraphicsOpt; + wxCheckBox* m_FormattingOpt; wxCheckBox* m_ConstraintsOpt; wxCheckBox* m_TracksAndViasOpt; - wxCheckBox* m_MaskAndPasteOpt; - wxCheckBox* m_SeveritiesOpt; wxCheckBox* m_NetclassesOpt; + wxCheckBox* m_SeveritiesOpt; DIALOG_IMPORT_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_IMPORT_SETTINGS_BASE(); diff --git a/pcbnew/dialogs/panel_setup_formatting.cpp b/pcbnew/dialogs/panel_setup_formatting.cpp new file mode 100644 index 0000000000..df1bae26b8 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_formatting.cpp @@ -0,0 +1,84 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include + + +PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, PCB_EDIT_FRAME* aFrame ) : + PANEL_SETUP_FORMATTING_BASE( aWindow ), + m_frame( aFrame ) +{ +} + +bool PANEL_SETUP_FORMATTING::TransferDataToWindow() +{ + const PCB_PLOT_PARAMS& settings = m_frame->GetBoard()->GetPlotOptions(); + + m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + settings.GetDashedLineDashRatio() ) ); + + m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + settings.GetDashedLineGapRatio() ) ); + + return true; +} + + +bool PANEL_SETUP_FORMATTING::TransferDataFromWindow() +{ + PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions(); + + settings.SetDashedLineDashRatio( DoubleValueFromString( EDA_UNITS::UNSCALED, + m_dashLengthCtrl->GetValue() ) ); + + settings.SetDashedLineGapRatio( DoubleValueFromString( EDA_UNITS::UNSCALED, + m_gapLengthCtrl->GetValue() ) ); + + m_frame->GetBoard()->SetPlotOptions( settings ); + + KIGFX::PCB_VIEW* view = m_frame->GetCanvas()->GetView(); + + view->GetPainter()->GetSettings()->SetDashLengthRatio( settings.GetDashedLineDashRatio() ); + view->GetPainter()->GetSettings()->SetGapLengthRatio( settings.GetDashedLineGapRatio() ); + view->MarkDirty(); + view->UpdateAllItems( KIGFX::REPAINT ); + m_frame->GetCanvas()->Refresh(); + + return true; +} + + +void PANEL_SETUP_FORMATTING::ImportSettingsFrom( BOARD* aBoard ) +{ + const PCB_PLOT_PARAMS& importedSettings = aBoard->GetPlotOptions(); + + m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + importedSettings.GetDashedLineDashRatio() ) ); + + m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, + importedSettings.GetDashedLineGapRatio() ) ); +} diff --git a/pcbnew/dialogs/panel_setup_formatting.h b/pcbnew/dialogs/panel_setup_formatting.h new file mode 100644 index 0000000000..ad98abd1f5 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_formatting.h @@ -0,0 +1,45 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef PANEL_SETUP_FORMATTING_H +#define PANEL_SETUP_FORMATTING_H + +#include +#include "panel_setup_formatting_base.h" + +class PCB_EDIT_FRAME; +class BOARD; + + +class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE +{ +public: + PANEL_SETUP_FORMATTING( wxWindow* aWindow, PCB_EDIT_FRAME* aFrame ); + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + void ImportSettingsFrom( BOARD* aBoard ); + +private: + PCB_EDIT_FRAME* m_frame; +}; + + +#endif //PANEL_SETUP_FORMATTING_H diff --git a/pcbnew/dialogs/panel_setup_formatting_base.cpp b/pcbnew/dialogs/panel_setup_formatting_base.cpp new file mode 100644 index 0000000000..7ec394220b --- /dev/null +++ b/pcbnew/dialogs/panel_setup_formatting_base.cpp @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_setup_formatting_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bMargins; + bMargins = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer6; + sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dashed Lines") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer41; + fgSizer41 = new wxFlexGridSizer( 0, 2, 5, 0 ); + fgSizer41->SetFlexibleDirection( wxBOTH ); + fgSizer41->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + dashLengthLabel = new wxStaticText( sbSizer6->GetStaticBox(), wxID_ANY, _("Dash length:"), wxDefaultPosition, wxDefaultSize, 0 ); + dashLengthLabel->Wrap( -1 ); + fgSizer41->Add( dashLengthLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_dashLengthCtrl = new wxTextCtrl( sbSizer6->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer41->Add( m_dashLengthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + gapLengthLabel = new wxStaticText( sbSizer6->GetStaticBox(), wxID_ANY, _("Gap length:"), wxDefaultPosition, wxDefaultSize, 0 ); + gapLengthLabel->Wrap( -1 ); + fgSizer41->Add( gapLengthLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_gapLengthCtrl = new wxTextCtrl( sbSizer6->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer41->Add( m_gapLengthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer6->Add( fgSizer41, 0, wxEXPAND|wxBOTTOM, 5 ); + + m_dashedLineHelp = new wxStaticText( sbSizer6->GetStaticBox(), wxID_ANY, _("Dash and dot lengths are ratios of the line width."), wxDefaultPosition, wxDefaultSize, 0 ); + m_dashedLineHelp->Wrap( -1 ); + sbSizer6->Add( m_dashedLineHelp, 0, wxALL, 5 ); + + + bMargins->Add( sbSizer6, 1, wxEXPAND|wxALL, 10 ); + + + bMainSizer->Add( bMargins, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + bMainSizer->Fit( this ); +} + +PANEL_SETUP_FORMATTING_BASE::~PANEL_SETUP_FORMATTING_BASE() +{ +} diff --git a/pcbnew/dialogs/panel_setup_formatting_base.fbp b/pcbnew/dialogs/panel_setup_formatting_base.fbp new file mode 100644 index 0000000000..6c8f26f351 --- /dev/null +++ b/pcbnew/dialogs/panel_setup_formatting_base.fbp @@ -0,0 +1,414 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_setup_formatting_base + 1000 + none + + 1 + PANEL_SETUP_FORMATTING_BASE + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_SETUP_FORMATTING_BASE + + -1,-1 + ; ; forward_declare + + + + wxTAB_TRAVERSAL + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + + bMargins + wxVERTICAL + none + + 10 + wxEXPAND|wxALL + 1 + + wxID_ANY + Dashed Lines + + sbSizer6 + wxVERTICAL + 1 + none + + 5 + wxEXPAND|wxBOTTOM + 0 + + 2 + wxBOTH + + + 0 + + fgSizer41 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Dash length: + 0 + + 0 + + + 0 + + 1 + dashLengthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_dashLengthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Gap length: + 0 + + 0 + + + 0 + + 1 + gapLengthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_gapLengthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Dash and dot lengths are ratios of the line width. + 0 + + 0 + + + 0 + + 1 + m_dashedLineHelp + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + + + diff --git a/pcbnew/dialogs/panel_setup_formatting_base.h b/pcbnew/dialogs/panel_setup_formatting_base.h new file mode 100644 index 0000000000..906a6affad --- /dev/null +++ b/pcbnew/dialogs/panel_setup_formatting_base.h @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_SETUP_FORMATTING_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_SETUP_FORMATTING_BASE : public wxPanel +{ + private: + + protected: + wxStaticText* dashLengthLabel; + wxTextCtrl* m_dashLengthCtrl; + wxStaticText* gapLengthLabel; + wxTextCtrl* m_gapLengthCtrl; + wxStaticText* m_dashedLineHelp; + + public: + + PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_SETUP_FORMATTING_BASE(); + +}; + diff --git a/pcbnew/dialogs/panel_setup_mask_and_paste_base.cpp b/pcbnew/dialogs/panel_setup_mask_and_paste_base.cpp index f38fadc53d..753d836bc2 100644 --- a/pcbnew/dialogs/panel_setup_mask_and_paste_base.cpp +++ b/pcbnew/dialogs/panel_setup_mask_and_paste_base.cpp @@ -129,7 +129,7 @@ PANEL_SETUP_MASK_AND_PASTE_BASE::PANEL_SETUP_MASK_AND_PASTE_BASE( wxWindow* pare gbSizer1->Add( m_pasteMarginRatioUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bSizer3->Add( gbSizer1, 1, wxEXPAND|wxTOP, 5 ); + bSizer3->Add( gbSizer1, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_staticTextInfoPaste = new wxStaticText( this, wxID_ANY, _("Note: Solder paste clearances (absolute and relative) are added to determine the final clearance."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfoPaste->Wrap( -1 ); diff --git a/pcbnew/dialogs/panel_setup_mask_and_paste_base.fbp b/pcbnew/dialogs/panel_setup_mask_and_paste_base.fbp index 2b275f4235..17f3432c2f 100644 --- a/pcbnew/dialogs/panel_setup_mask_and_paste_base.fbp +++ b/pcbnew/dialogs/panel_setup_mask_and_paste_base.fbp @@ -335,8 +335,8 @@ 5 - wxEXPAND|wxTOP - 1 + wxEXPAND|wxTOP|wxBOTTOM + 0 wxBOTH diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 41747e9512..44be182b80 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -167,6 +167,17 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter ) delete m_pcb; m_pcb = aBoard; + if( GetBoard() && GetCanvas() ) + { + RENDER_SETTINGS* rs = GetCanvas()->GetView()->GetPainter()->GetSettings(); + + if( rs ) + { + rs->SetDashLengthRatio( GetBoard()->GetPlotOptions().GetDashedLineDashRatio() ); + rs->SetGapLengthRatio( GetBoard()->GetPlotOptions().GetDashedLineGapRatio() ); + } + } + wxCommandEvent e( BOARD_CHANGED ); ProcessEventLocally( e ); } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index f293ec2ce0..49a0f20871 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -84,6 +84,9 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS() for( unsigned int i = 0; i < arrayDim( m_sketchMode ); ++i ) m_sketchMode[i] = false; + SetDashLengthRatio( 5 ); + SetGapLengthRatio( 3 ); + update(); } @@ -1353,6 +1356,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) const COLOR4D& color = m_pcbSettings.GetColor( aShape, aShape->GetLayer() ); bool sketch = m_pcbSettings.m_sketchGraphics; int thickness = getLineThickness( aShape->GetWidth() ); + PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle(); if( sketch ) { @@ -1364,131 +1368,120 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) m_gal->SetFillColor( color ); m_gal->SetStrokeColor( color ); - switch( aShape->GetShape() ) + if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE ) { - case SHAPE_T::SEGMENT: - if( sketch ) - { - m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness ); - } - else + switch( aShape->GetShape() ) { - m_gal->SetIsFill( true ); - m_gal->SetIsStroke( false ); - - m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness ); - } + case SHAPE_T::SEGMENT: + if( sketch ) + { + m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness ); + } + else + { + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); - break; + m_gal->DrawSegment( aShape->GetStart(), aShape->GetEnd(), thickness ); + } - case SHAPE_T::RECT: - { - std::vector pts = aShape->GetRectCorners(); + break; - if( sketch ) - { - m_gal->DrawSegment( pts[0], pts[1], thickness ); - m_gal->DrawSegment( pts[1], pts[2], thickness ); - m_gal->DrawSegment( pts[2], pts[3], thickness ); - m_gal->DrawSegment( pts[3], pts[0], thickness ); - } - else + case SHAPE_T::RECT: { - m_gal->SetIsFill( true ); - m_gal->SetIsStroke( false ); + std::vector pts = aShape->GetRectCorners(); - if( thickness > 0 ) + if( sketch ) { m_gal->DrawSegment( pts[0], pts[1], thickness ); m_gal->DrawSegment( pts[1], pts[2], thickness ); m_gal->DrawSegment( pts[2], pts[3], thickness ); m_gal->DrawSegment( pts[3], pts[0], thickness ); } - - if( aShape->IsFilled() ) + else { - SHAPE_POLY_SET poly; - poly.NewOutline(); - - for( const wxPoint& pt : pts ) - poly.Append( pt ); + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); - m_gal->DrawPolygon( poly ); - } - } + if( thickness > 0 ) + { + m_gal->DrawSegment( pts[0], pts[1], thickness ); + m_gal->DrawSegment( pts[1], pts[2], thickness ); + m_gal->DrawSegment( pts[2], pts[3], thickness ); + m_gal->DrawSegment( pts[3], pts[0], thickness ); + } - break; - } + if( aShape->IsFilled() ) + { + SHAPE_POLY_SET poly; + poly.NewOutline(); - case SHAPE_T::ARC: - { - double startAngle; - double endAngle; - aShape->CalcArcAngles( startAngle, endAngle ); + for( const wxPoint& pt : pts ) + poly.Append( pt ); - if( sketch ) - { - m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), - DEG2RAD( startAngle ), DEG2RAD( endAngle ), thickness, - m_maxError ); - } - else - { - m_gal->SetIsFill( true ); - m_gal->SetIsStroke( false ); + m_gal->DrawPolygon( poly ); + } + } - m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), - DEG2RAD( startAngle ), DEG2RAD( endAngle ), thickness, - m_maxError ); + break; } - break; - } - case SHAPE_T::CIRCLE: - if( sketch ) + case SHAPE_T::ARC: { - m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() - thickness / 2 ); - m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() + thickness / 2 ); - } - else - { - m_gal->SetIsFill( aShape->IsFilled() ); - m_gal->SetIsStroke( thickness > 0 ); - m_gal->SetLineWidth( thickness ); + double startAngle; + double endAngle; + aShape->CalcArcAngles( startAngle, endAngle ); + + if( sketch ) + { + m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), + DEG2RAD( startAngle ), DEG2RAD( endAngle ), thickness, + m_maxError ); + } + else + { + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); - m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() ); + m_gal->DrawArcSegment( aShape->GetCenter(), aShape->GetRadius(), + DEG2RAD( startAngle ), DEG2RAD( endAngle ), thickness, + m_maxError ); + } + break; } - break; - case SHAPE_T::POLY: - { - SHAPE_POLY_SET& shape = const_cast( aShape )->GetPolyShape(); - const FOOTPRINT* parentFootprint = aShape->GetParentFootprint(); + case SHAPE_T::CIRCLE: + if( sketch ) + { + m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() - thickness / 2 ); + m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() + thickness / 2 ); + } + else + { + m_gal->SetIsFill( aShape->IsFilled() ); + m_gal->SetIsStroke( thickness > 0 ); + m_gal->SetLineWidth( thickness ); - if( shape.OutlineCount() == 0 ) + m_gal->DrawCircle( aShape->GetStart(), aShape->GetRadius() ); + } break; - if( parentFootprint ) + case SHAPE_T::POLY: { - m_gal->Save(); - m_gal->Translate( parentFootprint->GetPosition() ); - m_gal->Rotate( -parentFootprint->GetOrientationRadians() ); - } + SHAPE_POLY_SET& shape = const_cast( aShape )->GetPolyShape(); + const FOOTPRINT* parentFootprint = aShape->GetParentFootprint(); - if( sketch ) - { - for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii ) + if( shape.OutlineCount() == 0 ) + break; + + if( parentFootprint ) { - SEG seg = shape.Outline( 0 ).Segment( ii ); - m_gal->DrawSegment( seg.A, seg.B, thickness ); + m_gal->Save(); + m_gal->Translate( parentFootprint->GetPosition() ); + m_gal->Rotate( -parentFootprint->GetOrientationRadians() ); } - } - else - { - m_gal->SetIsFill( true ); - m_gal->SetIsStroke( false ); - if( thickness > 0 ) + if( sketch ) { for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii ) { @@ -1496,61 +1489,97 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) m_gal->DrawSegment( seg.A, seg.B, thickness ); } } - - if( aShape->IsFilled() ) + else { - // On Opengl, a not convex filled polygon is usually drawn by using triangles - // as primitives. CacheTriangulation() can create basic triangle primitives to - // draw the polygon solid shape on Opengl. GLU tessellation is much slower, so - // currently we are using our tessellation. - if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() ) - shape.CacheTriangulation(); - - m_gal->DrawPolygon( shape ); + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); + + if( thickness > 0 ) + { + for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii ) + { + SEG seg = shape.Outline( 0 ).Segment( ii ); + m_gal->DrawSegment( seg.A, seg.B, thickness ); + } + } + + if( aShape->IsFilled() ) + { + // On Opengl, a not convex filled polygon is usually drawn by using triangles + // as primitives. CacheTriangulation() can create basic triangle primitives to + // draw the polygon solid shape on Opengl. GLU tessellation is much slower, + // so currently we are using our tessellation. + if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() ) + shape.CacheTriangulation(); + + m_gal->DrawPolygon( shape ); + } } - } - if( parentFootprint ) - m_gal->Restore(); + if( parentFootprint ) + m_gal->Restore(); - break; - } + break; + } - case SHAPE_T::BEZIER: - if( sketch ) - { - std::vector output; - std::vector pointCtrl; + case SHAPE_T::BEZIER: + if( sketch ) + { + std::vector output; + std::vector pointCtrl; - pointCtrl.push_back( aShape->GetStart() ); - pointCtrl.push_back( aShape->GetBezierC1() ); - pointCtrl.push_back( aShape->GetBezierC2() ); - pointCtrl.push_back( aShape->GetEnd() ); + pointCtrl.push_back( aShape->GetStart() ); + pointCtrl.push_back( aShape->GetBezierC1() ); + pointCtrl.push_back( aShape->GetBezierC2() ); + pointCtrl.push_back( aShape->GetEnd() ); - BEZIER_POLY converter( pointCtrl ); - converter.GetPoly( output, thickness ); + BEZIER_POLY converter( pointCtrl ); + converter.GetPoly( output, thickness ); - for( unsigned ii = 0; ii + 1 < output.size(); ++ii ) - m_gal->DrawSegment( output[ii], output[ii+1], thickness ); - } - else - { + for( unsigned ii = 0; ii + 1 < output.size(); ++ii ) + m_gal->DrawSegment( output[ii], output[ii+1], thickness ); + } + else + { m_gal->SetIsFill( aShape->IsFilled() ); m_gal->SetIsStroke( thickness > 0 ); m_gal->SetLineWidth( thickness ); - // Use thickness as filter value to convert the curve to polyline when the curve - // is not supported - m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ), - VECTOR2D( aShape->GetBezierC1() ), - VECTOR2D( aShape->GetBezierC2() ), - VECTOR2D( aShape->GetEnd() ), thickness ); + // Use thickness as filter value to convert the curve to polyline when the curve + // is not supported + m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ), + VECTOR2D( aShape->GetBezierC1() ), + VECTOR2D( aShape->GetBezierC2() ), + VECTOR2D( aShape->GetEnd() ), thickness ); + } + + break; + + case SHAPE_T::LAST: + break; + } + } + else + { + if( !sketch ) + { + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); } - break; + std::vector shapes = aShape->MakeEffectiveShapes( true ); - case SHAPE_T::LAST: - break; + for( SHAPE* shape : shapes ) + { + STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings, + [&]( const wxPoint& a, const wxPoint& b ) + { + m_gal->DrawSegment( a, b, thickness ); + } ); + } + + for( SHAPE* shape : shapes ) + delete shape; } } diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 4af8a1a2b6..6f45783c13 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -96,6 +96,8 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() m_includeGerberNetlistInfo = true; m_createGerberJobFile = true; m_gerberPrecision = gbrDefaultPrecision; + m_dashedLineDashRatio = 5.0; + m_dashedLineGapRatio = 3.0; // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm m_svgPrecision = SVG_PRECISION_DEFAULT; @@ -166,91 +168,79 @@ void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision, bool aUseInch ) void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ) const { - const char* falseStr = getTokenName( T_false ); - const char* trueStr = getTokenName( T_true ); + auto printBool = + []( bool aBool ) -> const char* + { + return aBool ? "true" : "false"; + }; - aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) ); + aFormatter->Print( aNestLevel, "(pcbplotparams\n" ); - aFormatter->Print( aNestLevel+1, "(%s 0x%s)\n", getTokenName( T_layerselection ), + aFormatter->Print( aNestLevel+1, "(layerselection 0x%s)\n", m_layerSelection.FmtHex().c_str() ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_disableapertmacros ), - m_gerberDisableApertMacros ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(disableapertmacros %s)\n", + printBool( m_gerberDisableApertMacros ) ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ), - m_useGerberProtelExtensions ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(usegerberextensions %s)\n", + printBool( m_useGerberProtelExtensions) ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ), - GetUseGerberX2format() ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(usegerberattributes %s)\n", + printBool( GetUseGerberX2format()) ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberadvancedattributes ), - GetIncludeGerberNetlistInfo() ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(usegerberadvancedattributes %s)\n", + printBool( GetIncludeGerberNetlistInfo()) ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_creategerberjobfile ), - GetCreateGerberJobFile() ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(creategerberjobfile %s)\n", + printBool( GetCreateGerberJobFile()) ); // save this option only if it is not the default value, // to avoid incompatibility with older Pcbnew version if( m_gerberPrecision != gbrDefaultPrecision ) - aFormatter->Print( aNestLevel+1, "(%s %d)\n", - getTokenName( T_gerberprecision ), m_gerberPrecision ); + aFormatter->Print( aNestLevel+1, "(gerberprecision %d)\n", m_gerberPrecision ); + + aFormatter->Print( aNestLevel+1, "(dashed_line_dash_ratio %f)\n", GetDashedLineDashRatio() ); + aFormatter->Print( aNestLevel+1, "(dashed_line_gap_ratio %f)\n", GetDashedLineGapRatio() ); // SVG options - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_svguseinch ), - m_svgUseInch ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_svgprecision ), - m_svgPrecision ); - - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ), - m_excludeEdgeLayer ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ), - m_plotFrameRef ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ), - m_plotViaOnMaskLayer ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ), - GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ), - m_useAuxOrigin ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(svguseinch %s)\n", printBool( m_svgUseInch ) ); + aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision ); + + aFormatter->Print( aNestLevel+1, "(excludeedgelayer %s)\n", printBool( m_excludeEdgeLayer ) ); + aFormatter->Print( aNestLevel+1, "(plotframeref %s)\n", printBool( m_plotFrameRef ) ); + aFormatter->Print( aNestLevel+1, "(viasonmask %s)\n", printBool( m_plotViaOnMaskLayer ) ); + aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 ); + aFormatter->Print( aNestLevel+1, "(useauxorigin %s)\n", printBool( m_useAuxOrigin ) ); // HPGL options - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ), - m_HPGLPenNum ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ), - m_HPGLPenSpeed ); - aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_hpglpendiameter ), - m_HPGLPenDiam ); + aFormatter->Print( aNestLevel+1, "(hpglpennumber %d)\n", m_HPGLPenNum ); + aFormatter->Print( aNestLevel+1, "(hpglpenspeed %d)\n", m_HPGLPenSpeed ); + aFormatter->Print( aNestLevel+1, "(hpglpendiameter %f)\n", m_HPGLPenDiam ); // DXF options aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfpolygonmode ), - m_DXFplotPolygonMode ? trueStr : falseStr ); + printBool( m_DXFplotPolygonMode ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfimperialunits ), - m_DXFplotUnits == DXF_UNITS::INCHES ? trueStr : falseStr ); + printBool( m_DXFplotUnits == DXF_UNITS::INCHES ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfusepcbnewfont ), - m_textMode == PLOT_TEXT_MODE::NATIVE ? falseStr : trueStr ); + printBool( m_textMode != PLOT_TEXT_MODE::NATIVE ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ), - m_negative ? trueStr : falseStr ); + printBool( m_negative ) ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ), - m_A4Output ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ), - m_plotReference ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ), - m_plotValue ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotinvisibletext ), - m_plotInvisibleText ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_sketchpadsonfab ), - m_sketchPadsOnFabLayers ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_subtractmaskfromsilk ), - m_subtractMaskFromSilk ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_outputformat ), - static_cast( m_format ) ); - aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_mirror ), - m_mirror ? trueStr : falseStr ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_drillshape ), - m_drillMarks ); - aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_scaleselection ), - m_scaleSelection ); - aFormatter->Print( aNestLevel+1, "(%s \"%s\")", getTokenName( T_outputdirectory ), + printBool( m_A4Output ) ); + aFormatter->Print( aNestLevel+1, "(plotreference %s)\n", printBool( m_plotReference ) ); + aFormatter->Print( aNestLevel+1, "(plotvalue %s)\n", printBool( m_plotValue ) ); + aFormatter->Print( aNestLevel+1, "(plotinvisibletext %s)\n", printBool( m_plotInvisibleText ) ); + aFormatter->Print( aNestLevel+1, "(sketchpadsonfab %s)\n", + printBool( m_sketchPadsOnFabLayers ) ); + aFormatter->Print( aNestLevel+1, "(subtractmaskfromsilk %s)\n", + printBool( m_subtractMaskFromSilk ) ); + aFormatter->Print( aNestLevel+1, "(outputformat %d)\n", static_cast( m_format ) ); + aFormatter->Print( aNestLevel+1, "(mirror %s)\n", printBool( m_mirror ) ); + aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", m_drillMarks ); + aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection ); + aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")", (const char*) m_outputDirectory.utf8_str() ); aFormatter->Print( 0, "\n" ); aFormatter->Print( aNestLevel, ")\n" ); @@ -286,6 +276,12 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision ) return false; + if( m_dashedLineDashRatio != aPcbPlotParams.m_dashedLineDashRatio ) + return false; + + if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio ) + return false; + if( m_excludeEdgeLayer != aPcbPlotParams.m_excludeEdgeLayer ) return false; @@ -475,6 +471,14 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) gbrDefaultPrecision); break; + case T_dashed_line_dash_ratio: + aPcbPlotParams->m_dashedLineDashRatio = parseDouble(); + break; + + case T_dashed_line_gap_ratio: + aPcbPlotParams->m_dashedLineGapRatio = parseDouble(); + break; + case T_svgprecision: aPcbPlotParams->m_svgPrecision = parseInt( SVG_PRECISION_MIN, SVG_PRECISION_MAX ); break; diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index cf1aa4f74e..2364685059 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -195,6 +195,12 @@ public: void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; } int GetHPGLPenNum() const { return m_HPGLPenNum; } + void SetDashedLineDashRatio( double aVal ) { m_dashedLineDashRatio = aVal; } + double GetDashedLineDashRatio() const { return m_dashedLineDashRatio; } + + void SetDashedLineGapRatio( double aVal ) { m_dashedLineGapRatio = aVal; } + double GetDashedLineGapRatio() const { return m_dashedLineGapRatio; } + private: friend class PCB_PLOT_PARAMS_PARSER; @@ -337,6 +343,9 @@ private: double m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas ///< However, it is in mm in hpgl files. + double m_dashedLineDashRatio; + double m_dashedLineGapRatio; + /// Pointer to active color settings to be used for plotting COLOR_SETTINGS* m_colors; diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index bd50532ea1..0c258826ea 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -253,18 +253,5 @@ static struct PCB_SHAPE_DESC propMgr.AddTypeCast( new TYPE_CAST ); propMgr.InheritsAfter( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( BOARD_ITEM ) ); propMgr.InheritsAfter( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ) ); - - // JEY TODO: - //propMgr.AddProperty( new PROPERTY( _HKI( "Thickness" ), - // &EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::DISTANCE ) ); - // TODO show certain properties depending on the shape - //propMgr.AddProperty( new PROPERTY( _HKI( "Angle" ), - // &PCB_SHAPE::SetArcAngle, &PCB_SHAPE::GetAngle, PROPERTY_DISPLAY::DECIDEGREE ) ); - // TODO or may have different names (arcs) - // TODO type? - propMgr.AddProperty( new PROPERTY( _HKI( "End X" ), - &EDA_SHAPE::SetEndX, &EDA_SHAPE::GetEndX, PROPERTY_DISPLAY::DISTANCE ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "End Y" ), - &EDA_SHAPE::SetEndY, &EDA_SHAPE::GetEndY, PROPERTY_DISPLAY::DISTANCE ) ); } } _PCB_SHAPE_DESC; diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index d6824e1ae8..519af563ec 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -566,139 +566,160 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape ) gbr_metadata.SetCopper( true ); } - int radius; // Circle/arc radius. + int radius; // Circle/arc radius. + PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle(); - switch( aShape->GetShape() ) + if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE ) { - case SHAPE_T::SEGMENT: - m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(), - &gbr_metadata ); - break; - - case SHAPE_T::RECT: - { - std::vector pts = aShape->GetRectCorners(); - - if( sketch || thickness > 0 ) + switch( aShape->GetShape() ) { - m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata ); - } + case SHAPE_T::SEGMENT: + m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(), + &gbr_metadata ); + break; - if( !sketch && aShape->IsFilled() ) + case SHAPE_T::RECT: { - SHAPE_LINE_CHAIN poly; + std::vector pts = aShape->GetRectCorners(); - for( const wxPoint& pt : pts ) - poly.Append( pt ); + if( sketch || thickness > 0 ) + { + m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata ); + } - m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); - } - } - break; + if( !sketch && aShape->IsFilled() ) + { + SHAPE_LINE_CHAIN poly; - case SHAPE_T::CIRCLE: - radius = KiROUND( GetLineLength( aShape->GetStart(), aShape->GetEnd() ) ); + for( const wxPoint& pt : pts ) + poly.Append( pt ); - if( aShape->IsFilled() ) - { - m_plotter->FilledCircle( aShape->GetStart(), radius * 2 + thickness, GetPlotMode(), - &gbr_metadata ); - } - else - { - m_plotter->ThickCircle( aShape->GetStart(), radius * 2, thickness, GetPlotMode(), - &gbr_metadata ); + m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); + } } + break; - break; + case SHAPE_T::CIRCLE: + radius = KiROUND( GetLineLength( aShape->GetStart(), aShape->GetEnd() ) ); - case SHAPE_T::ARC: - { - radius = KiROUND( GetLineLength( aShape->GetCenter(), aShape->GetStart() ) ); - double startAngle = ArcTangente( aShape->GetStart().y - aShape->GetCenter().y, - aShape->GetStart().x - aShape->GetCenter().x ); - double endAngle = startAngle + aShape->GetArcAngle(); + if( aShape->IsFilled() ) + { + m_plotter->FilledCircle( aShape->GetStart(), radius * 2 + thickness, GetPlotMode(), + &gbr_metadata ); + } + else + { + m_plotter->ThickCircle( aShape->GetStart(), radius * 2, thickness, GetPlotMode(), + &gbr_metadata ); + } - // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg - if( std::abs( aShape->GetArcAngle() ) == 3600.0 ) - { - m_plotter->ThickCircle( aShape->GetCenter(), radius * 2, thickness, GetPlotMode(), - &gbr_metadata ); - } - else - { - m_plotter->ThickArc( aShape->GetCenter(), -endAngle, -startAngle, radius, thickness, - GetPlotMode(), &gbr_metadata ); - } - } - break; + break; - case SHAPE_T::POLY: - if( aShape->IsPolyShapeValid() ) + case SHAPE_T::ARC: { - std::vector cornerList; - aShape->DupPolyPointsList( cornerList ); + radius = KiROUND( GetLineLength( aShape->GetCenter(), aShape->GetStart() ) ); + double startAngle = ArcTangente( aShape->GetStart().y - aShape->GetCenter().y, + aShape->GetStart().x - aShape->GetCenter().x ); + double endAngle = startAngle + aShape->GetArcAngle(); - // We must compute board coordinates from m_PolyList which are relative to the parent - // position at orientation 0 - const FOOTPRINT *parentFootprint = aShape->GetParentFootprint(); - - if( parentFootprint ) + // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg + if( std::abs( aShape->GetArcAngle() ) == 3600.0 ) { - for( unsigned ii = 0; ii < cornerList.size(); ++ii ) - { - wxPoint* corner = &cornerList[ii]; - RotatePoint( corner, parentFootprint->GetOrientation() ); - *corner += parentFootprint->GetPosition(); - } + m_plotter->ThickCircle( aShape->GetCenter(), radius * 2, thickness, GetPlotMode(), + &gbr_metadata ); + } + else + { + m_plotter->ThickArc( aShape->GetCenter(), -endAngle, -startAngle, radius, thickness, + GetPlotMode(), &gbr_metadata ); } + } + break; - if( sketch || thickness > 0 ) + case SHAPE_T::POLY: + if( aShape->IsPolyShapeValid() ) { - for( size_t i = 1; i < cornerList.size(); i++ ) + std::vector cornerList; + aShape->DupPolyPointsList( cornerList ); + + // We must compute board coordinates from m_PolyList which are relative to the parent + // position at orientation 0 + const FOOTPRINT *parentFootprint = aShape->GetParentFootprint(); + + if( parentFootprint ) { - m_plotter->ThickSegment( cornerList[i - 1], cornerList[i], thickness, - GetPlotMode(), &gbr_metadata ); + for( unsigned ii = 0; ii < cornerList.size(); ++ii ) + { + wxPoint* corner = &cornerList[ii]; + RotatePoint( corner, parentFootprint->GetOrientation() ); + *corner += parentFootprint->GetPosition(); + } } - m_plotter->ThickSegment( cornerList.back(), cornerList.front(), thickness, - GetPlotMode(), &gbr_metadata ); + if( sketch || thickness > 0 ) + { + for( size_t i = 1; i < cornerList.size(); i++ ) + { + m_plotter->ThickSegment( cornerList[i - 1], cornerList[i], thickness, + GetPlotMode(), &gbr_metadata ); + } - } + m_plotter->ThickSegment( cornerList.back(), cornerList.front(), thickness, + GetPlotMode(), &gbr_metadata ); - if( !sketch && aShape->IsFilled() ) - { - // This must be simplified and fractured to prevent overlapping polygons - // from generating invalid Gerber files + } - SHAPE_LINE_CHAIN line( cornerList ); - SHAPE_POLY_SET tmpPoly; + if( !sketch && aShape->IsFilled() ) + { + // This must be simplified and fractured to prevent overlapping polygons + // from generating invalid Gerber files - line.SetClosed( true ); - tmpPoly.AddOutline( line ); - tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST ); + SHAPE_LINE_CHAIN line( cornerList ); + SHAPE_POLY_SET tmpPoly; - for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) - { - SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj ); - m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, thickness, &gbr_metadata ); + line.SetClosed( true ); + tmpPoly.AddOutline( line ); + tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST ); + + for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) + { + SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj ); + m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, thickness, &gbr_metadata ); + } } } - } - break; + break; - case SHAPE_T::BEZIER: - m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(), - aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness ); - break; + case SHAPE_T::BEZIER: + m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(), + aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness ); + break; - default: - wxASSERT_MSG( false, "Unhandled FP_SHAPE shape" ); - break; + default: + wxASSERT_MSG( false, "Unhandled FP_SHAPE shape" ); + break; + } + } + else + { + std::vector shapes = aShape->MakeEffectiveShapes( true ); + + for( SHAPE* shape : shapes ) + { + STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(), + [&]( const wxPoint& a, const wxPoint& b ) + { + m_plotter->ThickSegment( a, b, thickness, GetPlotMode(), + &gbr_metadata ); + } ); + } + + for( SHAPE* shape : shapes ) + delete shape; } } @@ -876,8 +897,9 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) if( !m_layerMask[aShape->GetLayer()] ) return; - bool sketch = GetPlotMode() == SKETCH; - int thickness = aShape->GetWidth(); + bool sketch = GetPlotMode() == SKETCH; + int thickness = aShape->GetWidth(); + PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle(); m_plotter->SetColor( getColor( aShape->GetLayer() ) ); @@ -892,113 +914,135 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) // supported in Pcbnew gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR ); - switch( aShape->GetShape() ) + if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE ) { - case SHAPE_T::SEGMENT: - m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(), - &gbr_metadata ); - break; - - case SHAPE_T::CIRCLE: - if( aShape->IsFilled() ) - { - m_plotter->FilledCircle( aShape->GetStart(), aShape->GetRadius() * 2 + thickness, - GetPlotMode(), &gbr_metadata ); - } - else + switch( aShape->GetShape() ) { - m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness, - GetPlotMode(), &gbr_metadata ); - } + case SHAPE_T::SEGMENT: + m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(), + &gbr_metadata ); + break; - break; + case SHAPE_T::CIRCLE: + if( aShape->IsFilled() ) + { + m_plotter->FilledCircle( aShape->GetStart(), aShape->GetRadius() * 2 + thickness, + GetPlotMode(), &gbr_metadata ); + } + else + { + m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness, + GetPlotMode(), &gbr_metadata ); + } - case SHAPE_T::ARC: - { - double startAngle = ArcTangente( aShape->GetStart().y - aShape->GetCenter().y, - aShape->GetStart().x - aShape->GetCenter().x ); - double endAngle = startAngle + aShape->GetArcAngle(); + break; - // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg - if( std::abs( aShape->GetArcAngle() ) == 3600.0 ) - { - m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness, - GetPlotMode(), &gbr_metadata ); - } - else + case SHAPE_T::ARC: { - m_plotter->ThickArc( aShape->GetCenter(), -endAngle, -startAngle, aShape->GetRadius(), - thickness, GetPlotMode(), &gbr_metadata ); + double startAngle = ArcTangente( aShape->GetStart().y - aShape->GetCenter().y, + aShape->GetStart().x - aShape->GetCenter().x ); + double endAngle = startAngle + aShape->GetArcAngle(); + + // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg + if( std::abs( aShape->GetArcAngle() ) == 3600.0 ) + { + m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness, + GetPlotMode(), &gbr_metadata ); + } + else + { + m_plotter->ThickArc( aShape->GetCenter(), -endAngle, -startAngle, + aShape->GetRadius(), thickness, GetPlotMode(), &gbr_metadata ); + } + + break; } - } - break; - case SHAPE_T::BEZIER: - m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(), - aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness ); - break; + case SHAPE_T::BEZIER: + m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(), + aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness ); + break; - case SHAPE_T::POLY: - if( aShape->IsPolyShapeValid() ) - { - if( sketch || thickness > 0 ) + case SHAPE_T::POLY: + if( aShape->IsPolyShapeValid() ) { - for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ ) + if( sketch || thickness > 0 ) { - auto seg = it.Get(); - m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ), - thickness, GetPlotMode(), &gbr_metadata ); + for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ ) + { + auto seg = it.Get(); + m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ), + thickness, GetPlotMode(), &gbr_metadata ); + } } - } - if( !sketch && aShape->IsFilled() ) - { - m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata ); + if( !sketch && aShape->IsFilled() ) + { + m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata ); - // Draw the polygon: only one polygon is expected - // However we provide a multi polygon shape drawing - // ( for the future or to show a non expected shape ) - // This must be simplified and fractured to prevent overlapping polygons - // from generating invalid Gerber files - auto tmpPoly = SHAPE_POLY_SET( aShape->GetPolyShape() ); - tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST ); + // Draw the polygon: only one polygon is expected + // However we provide a multi polygon shape drawing + // ( for the future or to show a non expected shape ) + // This must be simplified and fractured to prevent overlapping polygons + // from generating invalid Gerber files + auto tmpPoly = SHAPE_POLY_SET( aShape->GetPolyShape() ); + tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST ); - for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) - { - SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj ); - m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, thickness, &gbr_metadata ); + for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj ) + { + SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj ); + m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, thickness, &gbr_metadata ); + } } } - } - break; - case SHAPE_T::RECT: - { - std::vector pts = aShape->GetRectCorners(); + break; - if( sketch || thickness > 0 ) + case SHAPE_T::RECT: { - m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata ); - m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata ); - } + std::vector pts = aShape->GetRectCorners(); - if( !sketch && aShape->IsFilled() ) - { - SHAPE_LINE_CHAIN poly; + if( sketch || thickness > 0 ) + { + m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata ); + m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata ); + } + + if( !sketch && aShape->IsFilled() ) + { + SHAPE_LINE_CHAIN poly; - for( const wxPoint& pt : pts ) - poly.Append( pt ); + for( const wxPoint& pt : pts ) + poly.Append( pt ); - m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); + m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); + } + + break; } - break; + default: + UNIMPLEMENTED_FOR( aShape->SHAPE_T_asString() ); + } } + else + { + std::vector shapes = aShape->MakeEffectiveShapes( true ); - default: - UNIMPLEMENTED_FOR( aShape->SHAPE_T_asString() ); + for( SHAPE* shape : shapes ) + { + STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(), + [&]( const wxPoint& a, const wxPoint& b ) + { + m_plotter->ThickSegment( a, b, thickness, GetPlotMode(), + &gbr_metadata ); + } ); + } + + for( SHAPE* shape : shapes ) + delete shape; } } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index de4b494f97..2845565109 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -114,7 +114,7 @@ void PCB_PARSER::checkpoint() if( m_progressReporter ) { TIME_PT curTime = CLOCK::now(); - unsigned curLine = m_lineReader->LineNumber(); + unsigned curLine = reader->LineNumber(); auto delta = std::chrono::duration_cast( curTime - m_lastProgressTime ); if( delta > std::chrono::milliseconds( 100 ) ) @@ -2639,11 +2639,21 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE() NeedRIGHT(); break; - case T_width: + case T_width: // legacy token stroke.SetWidth( parseBoardUnits( T_width ) ); NeedRIGHT(); break; + case T_stroke: + { + STROKE_PARAMS_PARSER strokeParser( reader, IU_PER_MM ); + strokeParser.SyncLineReaderWith( *this ); + + strokeParser.ParseStroke( stroke ); + SyncLineReaderWith( strokeParser ); + break; + } + case T_tstamp: NextTok(); const_cast( shape->m_Uuid ) = CurStrToKIID(); @@ -3936,11 +3946,21 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE() NeedRIGHT(); break; - case T_width: + case T_width: // legacy token stroke.SetWidth( parseBoardUnits( T_width ) ); NeedRIGHT(); break; + case T_stroke: + { + STROKE_PARAMS_PARSER strokeParser( reader, IU_PER_MM ); + strokeParser.SyncLineReaderWith( *this ); + + strokeParser.ParseStroke( stroke ); + SyncLineReaderWith( strokeParser ); + break; + } + case T_tstamp: NextTok(); const_cast( shape->m_Uuid ) = CurStrToKIID(); diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index c4b16ba3b6..4b13096411 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -77,7 +77,6 @@ public: m_board( nullptr ), m_resetKIIDs( false ), m_progressReporter( nullptr ), - m_lineReader( nullptr ), m_lastProgressTime( std::chrono::steady_clock::now() ), m_lineCount( 0 ) { @@ -108,11 +107,9 @@ public: m_resetKIIDs = true; } - void SetProgressReporter( PROGRESS_REPORTER* aProgressReporter, const LINE_READER* aLineReader, - unsigned aLineCount ) + void SetProgressReporter( PROGRESS_REPORTER* aProgressReporter, unsigned aLineCount ) { m_progressReporter = aProgressReporter; - m_lineReader = aLineReader; m_lastProgressTime = std::chrono::steady_clock::now(); m_lineCount = aLineCount; } @@ -389,7 +386,6 @@ private: bool m_showLegacyZoneWarning; PROGRESS_REPORTER* m_progressReporter; ///< optional; may be nullptr - const LINE_READER* m_lineReader; ///< for progress reporting TIME_PT m_lastProgressTime; ///< for progress reporting unsigned m_lineCount; ///< for progress reporting diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index f9c5c89b09..2aac0b9046 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -925,9 +925,9 @@ void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const return; }; - formatLayer( aShape ); + m_out->Print( 0, "\n" ); - m_out->Print( 0, " (width %s)", FormatInternalUnits( aShape->GetWidth() ).c_str() ); + aShape->GetStroke().Format( m_out, aNestLevel + 1 ); // The filled flag represents if a solid fill is present on circles, rectangles and polygons if( ( aShape->GetShape() == SHAPE_T::POLY ) @@ -940,6 +940,8 @@ void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const m_out->Print( 0, " (fill none)" ); } + formatLayer( aShape ); + m_out->Print( 0, " (tstamp %s)", TO_UTF8( aShape->m_Uuid.AsString() ) ); m_out->Print( 0, ")\n" ); @@ -1058,9 +1060,9 @@ void PCB_PLUGIN::format( const FP_SHAPE* aFPShape, int aNestLevel ) const return; }; - formatLayer( aFPShape ); + m_out->Print( 0, "\n" ); - m_out->Print( 0, " (width %s)", FormatInternalUnits( aFPShape->GetWidth() ).c_str() ); + aFPShape->GetStroke().Format( m_out, aNestLevel + 1 ); // The filled flag represents if a solid fill is present on circles, rectangles and polygons if( ( aFPShape->GetShape() == SHAPE_T::POLY ) @@ -1073,6 +1075,8 @@ void PCB_PLUGIN::format( const FP_SHAPE* aFPShape, int aNestLevel ) const m_out->Print( 0, " (fill none)" ); } + formatLayer( aFPShape ); + m_out->Print( 0, " (tstamp %s)", TO_UTF8( aFPShape->m_Uuid.AsString() ) ); m_out->Print( 0, ")\n" ); @@ -2334,7 +2338,7 @@ BOARD* PCB_PLUGIN::DoLoad( LINE_READER& aReader, BOARD* aAppendToMe, const PROPE m_parser->SetLineReader( &aReader ); m_parser->SetBoard( aAppendToMe ); - m_parser->SetProgressReporter( aProgressReporter, &aReader, aLineCount ); + m_parser->SetProgressReporter( aProgressReporter, aLineCount ); BOARD* board; diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index ff2f782858..5658a45b1f 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -105,7 +105,8 @@ class PCB_TEXT; //#define SEXPR_BOARD_FILE_VERSION 20211014 // Arc formatting //#define SEXPR_BOARD_FILE_VERSION 20211226 // Add radial dimension //#define SEXPR_BOARD_FILE_VERSION 20211227 // Add thermal relief spoke angle overrides -#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute +//#define SEXPR_BOARD_FILE_VERSION 20211228 // Add allow_soldermask_bridges footprint attribute +#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag #define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting