Move to getters/setters for aux and grid origin
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8836
This commit is contained in:
parent
ee7e3fc171
commit
75d75799f7
|
@ -664,6 +664,12 @@ public:
|
|||
|
||||
int GetLayerClass( PCB_LAYER_ID aLayer ) const;
|
||||
|
||||
void SetAuxOrigin( const wxPoint& aOrigin ) { m_auxOrigin = aOrigin; }
|
||||
const wxPoint& GetAuxOrigin() { return m_auxOrigin; }
|
||||
|
||||
void SetGridOrigin( const wxPoint& aOrigin ) { m_gridOrigin = aOrigin; }
|
||||
const wxPoint& GetGridOrigin() { return m_gridOrigin; }
|
||||
|
||||
private:
|
||||
void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
|
||||
|
||||
|
@ -749,9 +755,6 @@ public:
|
|||
int m_DimensionExtensionOffset;
|
||||
|
||||
// Miscellaneous
|
||||
wxPoint m_AuxOrigin; ///< origin for plot exports
|
||||
wxPoint m_GridOrigin; ///< origin for grid offsets
|
||||
|
||||
std::unique_ptr<PAD> m_Pad_Master; // A dummy pad to store all default parameters
|
||||
// when importing values or creating a new pad
|
||||
|
||||
|
@ -764,6 +767,9 @@ public:
|
|||
bool m_UseHeightForLengthCalcs;
|
||||
|
||||
private:
|
||||
wxPoint m_auxOrigin; ///< origin for plot exports
|
||||
wxPoint m_gridOrigin; ///< origin for grid offsets
|
||||
|
||||
// Indices into the trackWidth, viaSizes and diffPairDimensions lists.
|
||||
// The 0 index is always the current netclass value(s)
|
||||
unsigned m_trackWidthIndex;
|
||||
|
|
|
@ -725,8 +725,8 @@ void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther )
|
|||
m_DimensionArrowLength = aOther.m_DimensionArrowLength;
|
||||
m_DimensionExtensionOffset = aOther.m_DimensionExtensionOffset;
|
||||
|
||||
m_AuxOrigin = aOther.m_AuxOrigin;
|
||||
m_GridOrigin = aOther.m_GridOrigin;
|
||||
m_auxOrigin = aOther.m_auxOrigin;
|
||||
m_gridOrigin = aOther.m_gridOrigin;
|
||||
m_HasStackup = aOther.m_HasStackup;
|
||||
m_UseHeightForLengthCalcs= aOther.m_UseHeightForLengthCalcs;
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
||||
|
||||
PAGE_INFO savedPageInfo = m_board->GetPageSettings();
|
||||
wxPoint savedAuxOrigin = m_board->GetDesignSettings().m_AuxOrigin;
|
||||
wxPoint savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
if( m_rbSvgPageSizeOpt->GetSelection() == 2 ) // Page is board boundary size
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
m_board->SetPageSettings( currpageInfo );
|
||||
plot_opts.SetUseAuxOrigin( true );
|
||||
wxPoint origin = bbox.GetOrigin();
|
||||
m_board->GetDesignSettings().m_AuxOrigin = origin;
|
||||
m_board->GetDesignSettings().SetAuxOrigin( origin );
|
||||
}
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
@ -360,7 +360,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
delete plotter;
|
||||
|
||||
// reset to the values saved earlier
|
||||
m_board->GetDesignSettings().m_AuxOrigin = savedAuxOrigin;
|
||||
m_board->GetDesignSettings().SetAuxOrigin( savedAuxOrigin );
|
||||
m_board->SetPageSettings( savedPageInfo );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -345,7 +345,7 @@ void DIALOG_GENDRILL::UpdateDrillParams()
|
|||
if( m_Choice_Drill_Offset->GetSelection() == 0 )
|
||||
m_DrillFileOffset = wxPoint( 0, 0 );
|
||||
else
|
||||
m_DrillFileOffset = m_board->GetDesignSettings().m_AuxOrigin;
|
||||
m_DrillFileOffset = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
if( m_UnitDrillIsInch )
|
||||
m_Precision = precisionListForInches;
|
||||
|
|
|
@ -236,7 +236,7 @@ void DIALOG_POSITION_RELATIVE::OnUseGridOriginClick( wxCommandEvent& event )
|
|||
{
|
||||
BOARD* board = (BOARD*) m_toolMgr->GetModel();
|
||||
|
||||
m_anchor_position = board->GetDesignSettings().m_GridOrigin;
|
||||
m_anchor_position = board->GetDesignSettings().GetGridOrigin();
|
||||
m_referenceInfo->SetLabel( _( "Reference location: grid origin" ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static int iu_to_d356(int iu, int clamp)
|
|||
/* Extract the D356 record from the footprints (pads) */
|
||||
static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecords )
|
||||
{
|
||||
wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin;
|
||||
wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
for( FOOTPRINT* footprint : aPcb->Footprints() )
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ 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 <D356_RECORD>& aRecords )
|
||||
{
|
||||
wxPoint origin = aPcb->GetDesignSettings().m_AuxOrigin;
|
||||
wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
// Enumerate all the track segments and keep the vias
|
||||
for( auto track : aPcb->Tracks() )
|
||||
|
|
|
@ -95,7 +95,7 @@ PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aOn
|
|||
m_formatCSV = aFormatCSV;
|
||||
|
||||
if( aUseAuxOrigin )
|
||||
m_place_Offset = m_board->GetDesignSettings().m_AuxOrigin;
|
||||
m_place_Offset = m_board->GetDesignSettings().GetAuxOrigin();
|
||||
else
|
||||
m_place_Offset = wxPoint( 0, 0 );
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
|||
GetBoard()->ComputeBoundingBox();
|
||||
|
||||
// Save the auxiliary origin for the rest of the footprint
|
||||
wxPoint auxOrigin = m_pcb->GetDesignSettings().m_AuxOrigin;
|
||||
wxPoint auxOrigin = m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
|
||||
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
|||
PCB_PLOT_PARAMS plotOpts = m_pcb->GetPlotOptions();
|
||||
|
||||
if( plotOpts.GetUseAuxOrigin() )
|
||||
m_offset = m_pcb->GetDesignSettings().m_AuxOrigin;
|
||||
m_offset = m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
// Collect footprints on the right layer
|
||||
std::vector<FOOTPRINT*> fp_list;
|
||||
|
|
|
@ -152,7 +152,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
||||
|
||||
GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().m_GridOrigin ) );
|
||||
GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().GetGridOrigin() ) );
|
||||
|
||||
if( new_board )
|
||||
{
|
||||
|
|
|
@ -380,19 +380,19 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
|||
|
||||
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
|
||||
{
|
||||
return m_pcb->GetDesignSettings().m_GridOrigin;
|
||||
return m_pcb->GetDesignSettings().GetGridOrigin();
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
|
||||
{
|
||||
m_pcb->GetDesignSettings().m_GridOrigin = aPoint;
|
||||
m_pcb->GetDesignSettings().SetGridOrigin( aPoint );
|
||||
}
|
||||
|
||||
|
||||
const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
|
||||
{
|
||||
return m_pcb->GetDesignSettings().m_AuxOrigin;
|
||||
return m_pcb->GetDesignSettings().GetAuxOrigin();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard, bool aUseX1Compa
|
|||
// 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->GetDesignSettings().m_AuxOrigin;
|
||||
wxPoint auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
|
||||
|
||||
if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y )
|
||||
registration_id.Printf( "PX%xPY%x", auxOrigin.x, auxOrigin.y );
|
||||
|
|
|
@ -1067,7 +1067,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
|||
else
|
||||
{
|
||||
if( aPlotOpts->GetUseAuxOrigin() )
|
||||
offset = aBoard->GetDesignSettings().m_AuxOrigin;
|
||||
offset = aBoard->GetDesignSettings().GetAuxOrigin();
|
||||
}
|
||||
|
||||
aPlotter->SetPageSettings( *sheet_info );
|
||||
|
|
|
@ -618,8 +618,10 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader,
|
|||
|
||||
wxPoint movementVector( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() );
|
||||
m_board->Move( movementVector );
|
||||
m_board->GetDesignSettings().m_AuxOrigin += movementVector;
|
||||
m_board->GetDesignSettings().m_GridOrigin += movementVector;
|
||||
|
||||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
||||
bds.SetAuxOrigin( bds.GetAuxOrigin() + movementVector );
|
||||
bds.SetGridOrigin( bds.GetGridOrigin() + movementVector );
|
||||
|
||||
m_board->SetModified();
|
||||
}
|
||||
|
@ -710,8 +712,8 @@ void ALTIUM_PCB::ParseBoard6Data( const CFB::CompoundFileReader& aReader,
|
|||
THROW_IO_ERROR( "Board6 stream is not fully parsed" );
|
||||
}
|
||||
|
||||
m_board->GetDesignSettings().m_AuxOrigin = elem.sheetpos;
|
||||
m_board->GetDesignSettings().m_GridOrigin = elem.sheetpos;
|
||||
m_board->GetDesignSettings().SetAuxOrigin( elem.sheetpos );
|
||||
m_board->GetDesignSettings().SetGridOrigin( elem.sheetpos );
|
||||
|
||||
// read layercount from stackup, because LAYERSETSCOUNT is not always correct?!
|
||||
size_t layercount = 0;
|
||||
|
|
|
@ -499,15 +499,23 @@ void PCB_IO::formatSetup( const BOARD* aBoard, int aNestLevel ) const
|
|||
m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n",
|
||||
Double2Str( dsnSettings.m_SolderPasteMarginRatio ).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() );
|
||||
wxPoint origin = dsnSettings.GetAuxOrigin();
|
||||
|
||||
if( dsnSettings.m_GridOrigin != wxPoint( 0, 0 ) )
|
||||
if( origin != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
|
||||
FormatInternalUnits( origin.x ).c_str(),
|
||||
FormatInternalUnits( origin.y ).c_str() );
|
||||
}
|
||||
|
||||
origin = dsnSettings.GetGridOrigin();
|
||||
|
||||
if( origin != wxPoint( 0, 0 ) )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
|
||||
FormatInternalUnits( dsnSettings.m_GridOrigin.x ).c_str(),
|
||||
FormatInternalUnits( dsnSettings.m_GridOrigin.y ).c_str() );
|
||||
FormatInternalUnits( origin.x ).c_str(),
|
||||
FormatInternalUnits( origin.y ).c_str() );
|
||||
}
|
||||
|
||||
aBoard->GetPlotOptions().Format( m_out, aNestLevel+1 );
|
||||
|
||||
|
|
|
@ -2047,7 +2047,7 @@ void PCB_PARSER::parseSetup()
|
|||
{
|
||||
int x = parseBoardUnits( "auxiliary origin X" );
|
||||
int y = parseBoardUnits( "auxiliary origin Y" );
|
||||
designSettings.m_AuxOrigin = wxPoint( x, y );
|
||||
designSettings.SetAuxOrigin( wxPoint( x, y ) );
|
||||
|
||||
// Aux origin still stored in board for the moment
|
||||
//m_board->m_LegacyDesignSettingsLoaded = true;
|
||||
|
@ -2059,7 +2059,7 @@ void PCB_PARSER::parseSetup()
|
|||
{
|
||||
int x = parseBoardUnits( "grid origin X" );
|
||||
int y = parseBoardUnits( "grid origin Y" );
|
||||
designSettings.m_GridOrigin = wxPoint( x, y );
|
||||
designSettings.SetGridOrigin( wxPoint( x, y ) );
|
||||
// Grid origin still stored in board for the moment
|
||||
//m_board->m_LegacyDesignSettingsLoaded = true;
|
||||
NeedRIGHT();
|
||||
|
|
|
@ -878,7 +878,7 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
|
||||
BIU gy = biuParse( data );
|
||||
|
||||
bds.m_AuxOrigin = wxPoint( gx, gy );
|
||||
bds.SetAuxOrigin( wxPoint( gx, gy ) );
|
||||
}
|
||||
else if( TESTSUBSTR( "Layer[" ) )
|
||||
{
|
||||
|
@ -1071,7 +1071,7 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
BIU x = biuParse( line + SZ( "GridOrigin" ), &data );
|
||||
BIU y = biuParse( data );
|
||||
|
||||
bds.m_GridOrigin = wxPoint( x, y );
|
||||
bds.SetGridOrigin( wxPoint( x, y ) );
|
||||
}
|
||||
else if( TESTLINE( "VisibleElements" ) )
|
||||
{
|
||||
|
|
|
@ -196,7 +196,7 @@ void BOARD_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
|||
|
||||
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
|
||||
{
|
||||
m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().m_AuxOrigin );
|
||||
m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
|
||||
getView()->Remove( m_placeOrigin.get() );
|
||||
getView()->Add( m_placeOrigin.get() );
|
||||
}
|
||||
|
@ -1491,7 +1491,7 @@ int BOARD_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
|
|||
void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
||||
EDA_ITEM* originViewItem, const VECTOR2D& aPosition )
|
||||
{
|
||||
aFrame->GetDesignSettings().m_AuxOrigin = (wxPoint) aPosition;
|
||||
aFrame->GetDesignSettings().SetAuxOrigin( wxPoint( aPosition ) );
|
||||
originViewItem->SetPosition( (wxPoint) aPosition );
|
||||
aView->MarkDirty();
|
||||
aFrame->OnModify();
|
||||
|
|
|
@ -2087,7 +2087,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
|
|||
item->Rotate( (wxPoint) frame()->GetScreen()->m_LocalOrigin, rotation );
|
||||
break;
|
||||
case ROTATE_AROUND_AUX_ORIGIN:
|
||||
item->Rotate( board()->GetDesignSettings().m_AuxOrigin, rotation );
|
||||
item->Rotate( board()->GetDesignSettings().GetAuxOrigin(), rotation );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void PCB_CONTROL::Reset( RESET_REASON aReason )
|
|||
|
||||
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
|
||||
{
|
||||
m_gridOrigin->SetPosition( board()->GetDesignSettings().m_GridOrigin );
|
||||
m_gridOrigin->SetPosition( board()->GetDesignSettings().GetGridOrigin() );
|
||||
m_gridOrigin->SetColor( m_frame->GetGridColor() );
|
||||
getView()->Remove( m_gridOrigin.get() );
|
||||
getView()->Add( m_gridOrigin.get() );
|
||||
|
@ -500,7 +500,7 @@ int PCB_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
|
|||
void PCB_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
||||
EDA_ITEM* originViewItem, const VECTOR2D& aPoint )
|
||||
{
|
||||
aFrame->GetDesignSettings().m_GridOrigin = (wxPoint) aPoint;
|
||||
aFrame->GetDesignSettings().SetGridOrigin( wxPoint( aPoint ) );
|
||||
aView->GetGAL()->SetGridOrigin( aPoint );
|
||||
originViewItem->SetPosition( (wxPoint) aPoint );
|
||||
aView->MarkDirty();
|
||||
|
|
Loading…
Reference in New Issue