diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index dd974f9854..a17f632205 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -132,20 +132,6 @@ const wxSize SCH_BASE_FRAME::GetPageSizeIU() const } -const wxPoint& SCH_BASE_FRAME::GetAuxOrigin() const -{ - wxASSERT( GetScreen() ); - return GetScreen()->GetAuxOrigin(); -} - - -void SCH_BASE_FRAME::SetAuxOrigin( const wxPoint& aPosition ) -{ - wxASSERT( GetScreen() ); - GetScreen()->SetAuxOrigin( aPosition ); -} - - const TITLE_BLOCK& SCH_BASE_FRAME::GetTitleBlock() const { wxASSERT( GetScreen() ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 6e6bff2c97..f4d2b2a82a 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -134,9 +134,6 @@ public: const PAGE_INFO& GetPageSettings () const override; const wxSize GetPageSizeIU() const override; - const wxPoint& GetAuxOrigin() const override; - void SetAuxOrigin( const wxPoint& aPosition ) override; - const wxPoint& GetGridOrigin() const override { static wxPoint zero; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index a23f89299d..b4635026a5 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -958,20 +958,6 @@ void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) } -const wxPoint& GERBVIEW_FRAME::GetAuxOrigin() const -{ - wxASSERT( m_gerberLayout ); - return m_gerberLayout->GetAuxOrigin(); -} - - -void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition ) -{ - wxASSERT( m_gerberLayout ); - m_gerberLayout->SetAuxOrigin( aPosition ); -} - - void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor ) { GetCanvas()->GetGAL()->SetGridColor( aColor ); diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index e1815101d3..05b6de1ccb 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -107,9 +107,6 @@ public: const PAGE_INFO& GetPageSettings() const override; const wxSize GetPageSizeIU() const override; - const wxPoint& GetAuxOrigin() const override; - void SetAuxOrigin( const wxPoint& aPoint ) override; - const wxPoint& GetGridOrigin() const override { return m_grid_origin; } void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; } diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index ee76db8f13..ea5139d353 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -185,12 +185,6 @@ public: void ToggleUserUnits() override; - /** - * Return the origin of the axis used for plotting and various exports. - */ - virtual const wxPoint& GetAuxOrigin() const = 0; - virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0; - /** * Return the absolute coordinates of the origin of the snap grid. This is * treated as a relative offset, and snapping will occur at multiples of the grid diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 794688a3f1..78f8b04285 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -141,9 +141,6 @@ public: const PAGE_INFO& GetPageSettings() const override; const wxSize GetPageSizeIU() const override; - const wxPoint& GetAuxOrigin() const override; - void SetAuxOrigin( const wxPoint& aPoint ) override; - const wxPoint& GetGridOrigin() const override; void SetGridOrigin( const wxPoint& aPoint ) override; diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index 137d1c188b..5cd3c84137 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -129,13 +129,6 @@ public: return (PL_EDITOR_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } - const wxPoint& GetAuxOrigin() const override - { - static wxPoint dummy; // ( 0,0 ); - return dummy; - } - void SetAuxOrigin( const wxPoint& aPosition ) override {} - const wxPoint& GetGridOrigin() const override { return m_grid_origin; } void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; } diff --git a/pcbnew/altium2kicadpcb_plugin/altium_pcb.cpp b/pcbnew/altium2kicadpcb_plugin/altium_pcb.cpp index 1d41b0101e..72cde5b289 100644 --- a/pcbnew/altium2kicadpcb_plugin/altium_pcb.cpp +++ b/pcbnew/altium2kicadpcb_plugin/altium_pcb.cpp @@ -574,8 +574,8 @@ void ALTIUM_PCB::ParseBoard6Data( THROW_IO_ERROR( "Board6 stream is not fully parsed" ); } - m_board->SetAuxOrigin( elem.sheetpos ); - m_board->SetGridOrigin( elem.sheetpos ); + m_board->GetDesignSettings().m_AuxOrigin = elem.sheetpos; + m_board->GetDesignSettings().m_GridOrigin = elem.sheetpos; // read layercount from stackup, because LAYERSETSCOUNT is not always correct?! size_t layercount = 0; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 0b64b5987b..9e0eab725f 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -356,20 +356,6 @@ public: PROJECT* GetProject() const { return m_project; } void SetProject( PROJECT* aProject ) { m_project = aProject; } - /** - * Function SetAuxOrigin - * sets the origin point used for plotting. - */ - void SetAuxOrigin( const wxPoint& aPoint ) { m_designSettings.m_AuxOrigin = aPoint; } - const wxPoint& GetAuxOrigin() const { return m_designSettings.m_AuxOrigin; } - - /** - * Function SetGridOrigin - * sets the origin point of the grid. - */ - void SetGridOrigin( const wxPoint& aPoint ) { m_designSettings.m_GridOrigin = aPoint; } - const wxPoint& GetGridOrigin() const { return m_designSettings.m_GridOrigin; } - /** * Function ResetNetHighLight * Reset all high light data to the init state diff --git a/pcbnew/dialogs/dialog_export_svg.cpp b/pcbnew/dialogs/dialog_export_svg.cpp index 892f255b21..9591f84c34 100644 --- a/pcbnew/dialogs/dialog_export_svg.cpp +++ b/pcbnew/dialogs/dialog_export_svg.cpp @@ -294,8 +294,8 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName ) plot_opts.SetMirror( m_printMirror ); plot_opts.SetFormat( PLOT_FORMAT::SVG ); - PAGE_INFO pageInfo = m_board->GetPageSettings(); - wxPoint axisorigin = m_board->GetAuxOrigin(); + PAGE_INFO savedPageInfo = m_board->GetPageSettings(); + wxPoint savedAuxOrigin = m_board->GetDesignSettings().m_AuxOrigin; if( m_rbSvgPageSizeOpt->GetSelection() == 2 ) // Page is board boundary size { @@ -307,7 +307,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName ) m_board->SetPageSettings( currpageInfo ); plot_opts.SetUseAuxOrigin( true ); wxPoint origin = bbox.GetOrigin(); - m_board->SetAuxOrigin( origin ); + m_board->GetDesignSettings().m_AuxOrigin = origin; } SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); @@ -332,8 +332,9 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName ) delete plotter; - m_board->SetAuxOrigin( axisorigin ); // reset to the values saved earlier - m_board->SetPageSettings( pageInfo ); + // reset to the values saved earlier + m_board->GetDesignSettings().m_AuxOrigin = savedAuxOrigin; + m_board->SetPageSettings( savedPageInfo ); return true; } diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index bedba02770..12ab66903f 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -336,7 +336,7 @@ void DIALOG_GENDRILL::UpdateDrillParams() m_mapFileType = m_Choice_Drill_Map->GetSelection(); m_UnitDrillIsInch = (m_Choice_Unit->GetSelection() == 0) ? false : true; - m_MinimalHeader = m_Check_Minimal->IsChecked(); + m_MinimalHeader = m_Check_Minimal->IsChecked(); m_Mirror = m_Check_Mirror->IsChecked(); m_Merge_PTH_NPTH = m_Check_Merge_PTH_NPTH->IsChecked(); m_ZerosFormat = m_Choice_Zeros_Format->GetSelection(); @@ -345,7 +345,7 @@ void DIALOG_GENDRILL::UpdateDrillParams() if( m_Choice_Drill_Offset->GetSelection() == 0 ) m_FileDrillOffset = wxPoint( 0, 0 ); else - m_FileDrillOffset = m_pcbEditFrame->GetAuxOrigin(); + m_FileDrillOffset = m_board->GetDesignSettings().m_AuxOrigin; if( m_UnitDrillIsInch ) m_Precision = precisionListForInches; diff --git a/pcbnew/dialogs/dialog_move_exact.h b/pcbnew/dialogs/dialog_move_exact.h index a74e767abb..10333eec2c 100644 --- a/pcbnew/dialogs/dialog_move_exact.h +++ b/pcbnew/dialogs/dialog_move_exact.h @@ -65,9 +65,8 @@ private: public: // Constructor and destructor - DIALOG_MOVE_EXACT(PCB_BASE_FRAME *aParent, wxPoint& aTranslate, - double& aRotate, ROTATION_ANCHOR& aAnchor, - const EDA_RECT& aBbox); + DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTranslate, double& aRotate, + ROTATION_ANCHOR& aAnchor, const EDA_RECT& aBbox ); ~DIALOG_MOVE_EXACT() { }; private: diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp index cea5f9f512..d31f5d1c36 100644 --- a/pcbnew/dialogs/dialog_position_relative.cpp +++ b/pcbnew/dialogs/dialog_position_relative.cpp @@ -230,7 +230,7 @@ void DIALOG_POSITION_RELATIVE::OnUseGridOriginClick( wxCommandEvent& event ) { BOARD* board = (BOARD*) m_toolMgr->GetModel(); - m_anchor_position = board->GetGridOrigin(); + m_anchor_position = board->GetDesignSettings().m_GridOrigin; m_referenceInfo->SetLabel( _( "Reference location: grid origin" ) ); } diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 5a3493a39b..f4bb893ff8 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -91,10 +91,9 @@ static int iu_to_d356(int iu, int clamp) } /* Extract the D356 record from the modules (pads) */ -static void build_pad_testpoints( BOARD *aPcb, - std::vector & aRecords ) +static void build_pad_testpoints( BOARD *aPcb, std::vector & aRecords ) { - wxPoint origin = aPcb->GetAuxOrigin(); + wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin; for( auto module : aPcb->Modules() ) { @@ -165,10 +164,9 @@ static int via_access_code( BOARD *aPcb, int top_layer, int bottom_layer ) } /* Extract the D356 record from the vias */ -static void build_via_testpoints( BOARD *aPcb, - std::vector & aRecords ) +static void build_via_testpoints( BOARD *aPcb, std::vector & aRecords ) { - wxPoint origin = aPcb->GetAuxOrigin(); + wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin; // Enumerate all the track segments and keep the vias for( auto track : aPcb->Tracks() ) diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp index 2bd4be360a..de9d5ac787 100644 --- a/pcbnew/exporters/export_footprints_placefile.cpp +++ b/pcbnew/exporters/export_footprints_placefile.cpp @@ -103,7 +103,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData() int lenValText = 8; int lenPkgText = 16; - m_place_Offset = m_board->GetAuxOrigin(); + m_place_Offset = m_board->GetDesignSettings().m_AuxOrigin; // Calculating the number of useful footprints (CMS attribute, not VIRTUAL) m_fpCount = 0; diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 41f6a0e238..63e9a0cfc7 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -61,42 +61,6 @@ static void FootprintWriteShape( FILE* File, MODULE* module, const wxString& aSh // layer names for Gencad export -#if 0 // was: -static const wxString GenCADLayerName[] = -{ - wxT( "BOTTOM" ), wxT( "INNER1" ), wxT( "INNER2" ), - wxT( "INNER3" ), wxT( "INNER4" ), wxT( "INNER5" ), - wxT( "INNER6" ), wxT( "INNER7" ), wxT( "INNER8" ), - wxT( "INNER9" ), wxT( "INNER10" ), wxT( "INNER11" ), - wxT( "INNER12" ), wxT( "INNER13" ), wxT( "INNER14" ), - wxT( "TOP" ), wxT( "LAYER17" ), wxT( "LAYER18" ), - wxT( "SOLDERPASTE_BOTTOM" ), wxT( "SOLDERPASTE_TOP" ), - wxT( "SILKSCREEN_BOTTOM" ), wxT( "SILKSCREEN_TOP" ), - wxT( "SOLDERMASK_BOTTOM" ), wxT( "SOLDERMASK_TOP" ), wxT( "LAYER25" ), - wxT( "LAYER26" ), wxT( "LAYER27" ), wxT( "LAYER28" ), - wxT( "LAYER29" ), wxT( "LAYER30" ), wxT( "LAYER31" ), - wxT( "LAYER32" ) -}; - -// flipped layer name for Gencad export (to make CAM350 imports correct) -static const wxString GenCADLayerNameFlipped[32] = -{ - wxT( "TOP" ), wxT( "INNER14" ), wxT( "INNER13" ), - wxT( "INNER12" ), wxT( "INNER11" ), wxT( "INNER10" ), - wxT( "INNER9" ), wxT( "INNER8" ), wxT( "INNER7" ), - wxT( "INNER6" ), wxT( "INNER5" ), wxT( "INNER4" ), - wxT( "INNER3" ), wxT( "INNER2" ), wxT( "INNER1" ), - wxT( "BOTTOM" ), wxT( "LAYER17" ), wxT( "LAYER18" ), - wxT( "SOLDERPASTE_TOP" ), wxT( "SOLDERPASTE_BOTTOM" ), - wxT( "SILKSCREEN_TOP" ), wxT( "SILKSCREEN_BOTTOM" ), - wxT( "SOLDERMASK_TOP" ), wxT( "SOLDERMASK_BOTTOM" ), wxT( "LAYER25" ), - wxT( "LAYER26" ), wxT( "LAYER27" ), wxT( "LAYER28" ), - wxT( "LAYER29" ), wxT( "LAYER30" ), wxT( "LAYER31" ), - wxT( "LAYER32" ) -}; - -#else - static std::string GenCADLayerName( int aCuCount, PCB_LAYER_ID aId ) { if( IsCopperLayer( aId ) ) @@ -212,7 +176,6 @@ static wxString escapeString( const wxString& aString ) return copy; } -#endif static std::string fmt_mask( LSET aSet ) { @@ -312,8 +275,9 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) GetBoard()->ComputeBoundingBox(); // Save the auxiliary origin for the rest of the module - GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().x : 0; - GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? GetAuxOrigin().y : 0; + wxPoint auxOrigin = m_Pcb->GetDesignSettings().m_AuxOrigin; + GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0; + GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0; // No idea on *why* this should be needed... maybe to fix net names? Compile_Ratsnest( true ); diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index 6b096fe009..9d2f8bc848 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include @@ -42,7 +41,6 @@ #include #include #include -#include PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb ) @@ -57,16 +55,15 @@ PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb ) } -int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, - PCB_LAYER_ID aLayer, bool aIncludeBrdEdges -) +int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, + bool aIncludeBrdEdges ) { m_layer = aLayer; PCB_PLOT_PARAMS plotOpts = m_pcb->GetPlotOptions(); if( plotOpts.GetUseAuxOrigin() ) - m_offset = m_pcb->GetAuxOrigin(); + m_offset = m_pcb->GetDesignSettings().m_AuxOrigin; // Collect footprints on the right layer std::vector fp_list; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index b726e8164c..814c4a6432 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -582,14 +582,15 @@ void PCB_IO::formatSetup( BOARD* aBoard, int aNestLevel ) const m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n", Double2Str( dsnSettings.m_SolderPasteMarginRatio ).c_str() ); - m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n", - FormatInternalUnits( aBoard->GetAuxOrigin().x ).c_str(), - FormatInternalUnits( aBoard->GetAuxOrigin().y ).c_str() ); + if( dsnSettings.m_AuxOrigin != wxPoint( 0, 0 ) ) + m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n", + FormatInternalUnits( dsnSettings.m_AuxOrigin.x ).c_str(), + FormatInternalUnits( dsnSettings.m_AuxOrigin.y ).c_str() ); - if( aBoard->GetGridOrigin().x || aBoard->GetGridOrigin().y ) + if( dsnSettings.m_GridOrigin != wxPoint( 0, 0 ) ) m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n", - FormatInternalUnits( aBoard->GetGridOrigin().x ).c_str(), - FormatInternalUnits( aBoard->GetGridOrigin().y ).c_str() ); + FormatInternalUnits( dsnSettings.m_GridOrigin.x ).c_str(), + FormatInternalUnits( dsnSettings.m_GridOrigin.y ).c_str() ); m_out->Print( aNestLevel+1, "(visible_elements %X)\n", dsnSettings.GetVisibleElements() ); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index f6f741970a..ae126fbe5f 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -232,16 +232,17 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() placeMenu->AddItem( PCB_ACTIONS::placePad, haveFootprintCondition ); placeMenu->AddSeparator(); - placeMenu->AddItem( PCB_ACTIONS::placeText, haveFootprintCondition ); - placeMenu->AddItem( PCB_ACTIONS::drawArc, haveFootprintCondition ); - placeMenu->AddItem( PCB_ACTIONS::drawCircle, haveFootprintCondition ); - placeMenu->AddItem( PCB_ACTIONS::drawLine, haveFootprintCondition ); - placeMenu->AddItem( PCB_ACTIONS::drawPolygon, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::placeText, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::drawArc, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::drawRectangle, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::drawCircle, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::drawLine, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::drawPolygon, haveFootprintCondition ); placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, haveFootprintCondition ); placeMenu->AddSeparator(); - placeMenu->AddItem( PCB_ACTIONS::setAnchor, haveFootprintCondition ); - placeMenu->AddItem( ACTIONS::gridSetOrigin, haveFootprintCondition ); + placeMenu->AddItem( PCB_ACTIONS::setAnchor, haveFootprintCondition ); + placeMenu->AddItem( ACTIONS::gridSetOrigin, haveFootprintCondition ); placeMenu->Resolve(); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 957e551fcf..6939bb96fe 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -414,6 +414,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways ); + placeMenu->AddItem( PCB_ACTIONS::drawRectangle, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways ); placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways ); diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 38201e2b4f..84ccf5f054 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -97,7 +97,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard ) PCB_BASE_FRAME::SetBoard( aBoard ); - GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetGridOrigin() ) ); + GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().m_GridOrigin ) ); // update the tool manager with the new board and its view. if( m_toolManager ) diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 4e7307b533..1968987edf 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -242,31 +242,17 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const } -const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const -{ - wxASSERT( m_Pcb ); - return m_Pcb->GetAuxOrigin(); -} - - -void PCB_BASE_FRAME::SetAuxOrigin( const wxPoint& aPoint ) -{ - wxASSERT( m_Pcb ); - m_Pcb->SetAuxOrigin( aPoint ); -} - - const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const { wxASSERT( m_Pcb ); - return m_Pcb->GetGridOrigin(); + return m_Pcb->GetDesignSettings().m_GridOrigin; } void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint ) { wxASSERT( m_Pcb ); - m_Pcb->SetGridOrigin( aPoint ); + m_Pcb->GetDesignSettings().m_GridOrigin = aPoint; } diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 584e2fea55..240d1f1327 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -341,7 +341,7 @@ void AddGerberX2Header( PLOTTER * aPlotter, // Please, if absolute Pcbnew coordinates, one day, are set by user, change the way // the key is built to ensure file only using the *same* axis have the same key. wxString registration_id = "Original"; - wxPoint auxOrigin = aBoard->GetAuxOrigin(); + wxPoint auxOrigin = aBoard->GetDesignSettings().m_AuxOrigin; if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y ) registration_id.Printf( "PX%xPY%x", auxOrigin.x, auxOrigin.y ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 130cfb8165..92f4ee29de 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -30,8 +30,6 @@ #include -#include -#include #include #include #include @@ -1027,7 +1025,7 @@ static void initializePlotter( PLOTTER *aPlotter, BOARD * aBoard, else { if( aPlotOpts->GetUseAuxOrigin() ) - offset = aBoard->GetAuxOrigin(); + offset = aBoard->GetDesignSettings().m_AuxOrigin; } aPlotter->SetPageSettings( *sheet_info ); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 9508ce5654..91f15a54fd 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -371,6 +371,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->AddScaledSeparator( this ); m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); @@ -380,7 +381,8 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->AddScaledSeparator( this ); - m_drawToolBar->Add( PCB_ACTIONS::drillOrigin, ACTION_TOOLBAR::TOGGLE ); + // TODO: re-insert when we have a multi-select tool button + // m_drawToolBar->Add( PCB_ACTIONS::drillOrigin, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); @@ -747,6 +749,7 @@ void PCB_EDIT_FRAME::SyncToolbars() TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawZone ); TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawZoneKeepout ); TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawLine ); + TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawRectangle ); TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawCircle ); TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawArc ); TOGGLE_TOOL( m_drawToolBar, PCB_ACTIONS::drawPolygon ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 80af314571..d6b62b3bcd 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1090,7 +1090,6 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) if( selection.Empty() ) return 0; - PCB_BASE_FRAME* editFrame = getEditFrame(); wxPoint translation; double rotation; ROTATION_ANCHOR rotationAnchor = selection.Size() > 1 ? ROTATE_AROUND_SEL_CENTER @@ -1099,7 +1098,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) // TODO: Implement a visible bounding border at the edge auto sel_box = selection.GetBoundingBox(); - DIALOG_MOVE_EXACT dialog( editFrame, translation, rotation, rotationAnchor, sel_box ); + DIALOG_MOVE_EXACT dialog( frame(), translation, rotation, rotationAnchor, sel_box ); int ret = dialog.ShowModal(); if( ret == wxID_OK ) @@ -1132,10 +1131,10 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent ) item->Rotate( selCenter, rotation ); break; case ROTATE_AROUND_USER_ORIGIN: - item->Rotate( (wxPoint) editFrame->GetScreen()->m_LocalOrigin, rotation ); + item->Rotate( (wxPoint) frame()->GetScreen()->m_LocalOrigin, rotation ); break; case ROTATE_AROUND_AUX_ORIGIN: - item->Rotate( editFrame->GetAuxOrigin(), rotation ); + item->Rotate( board()->GetDesignSettings().m_AuxOrigin, rotation ); break; } diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 77b60e79b1..fe97a6682d 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -573,7 +573,8 @@ TOOL_ACTION PCB_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule", TOOL_ACTION PCB_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin", AS_GLOBAL, 0, "", - _( "Drill and Place Offset" ), _( "Place origin point for drill and place files" ), + _( "Drill/Place File Origin" ), + _( "Place origin point for drill files and footprint position files" ), pcb_offset_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock", diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index ab557e54e1..5395b0d124 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -408,6 +408,7 @@ public: static TOOL_ACTION highlightNetSelection; static TOOL_ACTION highlightItem; static TOOL_ACTION drillOrigin; + static TOOL_ACTION placeFileOrigin; static TOOL_ACTION appendBoard; static TOOL_ACTION showEeschema; static TOOL_ACTION boardStatistics; diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index e9f93df33a..cc08b8e953 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -164,7 +164,7 @@ void PCB_EDITOR_CONTROL::Reset( RESET_REASON aReason ) if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH ) { - m_placeOrigin->SetPosition( getModel()->GetAuxOrigin() ); + m_placeOrigin->SetPosition( getModel()->GetDesignSettings().m_AuxOrigin ); getView()->Remove( m_placeOrigin.get() ); getView()->Add( m_placeOrigin.get() ); } @@ -1160,8 +1160,8 @@ int PCB_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent ) void PCB_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, BOARD_ITEM* originViewItem, const VECTOR2D& aPosition ) { - aFrame->SetAuxOrigin( wxPoint( aPosition.x, aPosition.y ) ); - originViewItem->SetPosition( wxPoint( aPosition.x, aPosition.y ) ); + aFrame->GetDesignSettings().m_AuxOrigin = (wxPoint) aPosition; + originViewItem->SetPosition( (wxPoint) aPosition ); aView->MarkDirty(); aFrame->OnModify(); } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 1cdbfbd50f..db6773d376 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014-2016 CERN - * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -39,22 +39,16 @@ #include #include #include -#include -#include #include -#include #include #include #include -#include #include #include #include #include -#include #include #include -#include // for KiROUND using namespace std::placeholders; @@ -85,7 +79,7 @@ void PCBNEW_CONTROL::Reset( RESET_REASON aReason ) if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH ) { - m_gridOrigin->SetPosition( board()->GetGridOrigin() ); + m_gridOrigin->SetPosition( board()->GetDesignSettings().m_GridOrigin ); m_gridOrigin->SetColor( m_frame->GetGridColor() ); getView()->Remove( m_gridOrigin.get() ); getView()->Add( m_gridOrigin.get() ); @@ -368,9 +362,9 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent ) void PCBNEW_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, BOARD_ITEM* originViewItem, const VECTOR2D& aPoint ) { - aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) ); + aFrame->GetDesignSettings().m_GridOrigin = (wxPoint) aPoint; aView->GetGAL()->SetGridOrigin( aPoint ); - originViewItem->SetPosition( wxPoint( aPoint.x, aPoint.y ) ); + originViewItem->SetPosition( (wxPoint) aPoint ); aView->MarkDirty(); aFrame->OnModify(); }