Browse Source

Pcbnew: mid/endpoint was confusing

Technically, any endpoint is equivalent for the
geometry that you get out. But "endpoint" sounds like
it means the point that is not the start point.

So change the tool to explicitly take the start and
midpoint as inputs.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19221
pcb_db
John Beard 12 months ago
parent
commit
7e75fe19de
  1. 36
      pcbnew/dialogs/dialog_shape_properties.cpp
  2. 18
      pcbnew/dialogs/dialog_shape_properties_base.cpp
  3. 6
      pcbnew/dialogs/dialog_shape_properties_base.fbp
  4. 4
      pcbnew/dialogs/dialog_shape_properties_base.h

36
pcbnew/dialogs/dialog_shape_properties.cpp

@ -286,10 +286,10 @@ public:
LENGTH,
ANGLE,
MID_START_X,
MID_START_Y,
MID_X,
MID_Y,
MID_END_X,
MID_END_Y,
NUM_CTRLS,
};
@ -312,10 +312,10 @@ public:
OnPolarChange();
} );
BindCtrls( MID_X, MID_END_Y,
BindCtrls( MID_START_X, MID_Y,
[this]()
{
OnMidEndpointChange();
OnStartMidpointChange();
} );
}
@ -323,7 +323,7 @@ public:
{
updateEnds();
updatePolar();
updateMidEndpoint();
updateStartMidpoint();
}
void OnEndsChange()
@ -335,7 +335,7 @@ public:
GetShape().SetEnd( p1 );
updatePolar();
updateMidEndpoint();
updateStartMidpoint();
}
void updateEnds()
@ -361,7 +361,7 @@ public:
GetShape().SetEnd( polar );
updateEnds();
updateMidEndpoint();
updateStartMidpoint();
}
void updatePolar()
@ -375,27 +375,27 @@ public:
ChangeAngleValue( ANGLE, -EDA_ANGLE( p1 - p0 ) );
}
void OnMidEndpointChange()
void OnStartMidpointChange()
{
const VECTOR2I start{ GetIntValue( MID_START_X ), GetIntValue( MID_START_Y ) };
const VECTOR2I mid{ GetIntValue( MID_X ), GetIntValue( MID_Y ) };
const VECTOR2I end{ GetIntValue( MID_END_X ), GetIntValue( MID_END_Y ) };
GetShape().SetStart( mid - ( end - mid ) );
GetShape().SetEnd( mid + ( end - mid ) );
GetShape().SetStart( start );
GetShape().SetEnd( mid - ( start - mid ) );
updateEnds();
updatePolar();
}
void updateMidEndpoint()
void updateStartMidpoint()
{
const VECTOR2I s = GetShape().GetStart();
const VECTOR2I c = GetShape().GetCenter();
const VECTOR2I e = GetShape().GetStart();
ChangeValue( MID_X, c.x );
ChangeValue( MID_Y, c.y );
ChangeValue( MID_END_X, e.x );
ChangeValue( MID_END_Y, e.y );
ChangeValue( MID_START_X, s.x );
ChangeValue( MID_START_Y, s.y );
}
};
@ -901,14 +901,14 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
AddFieldToSizer( *aParent, *m_gbsLineByLengthAngle, 1, 3, _( "Length" ), ORIGIN_TRANSFORMS::NOT_A_COORD, false, m_boundCtrls );
AddFieldToSizer( *aParent, *m_gbsLineByLengthAngle, 2, 3, _( "Angle" ), ORIGIN_TRANSFORMS::NOT_A_COORD, true, m_boundCtrls );
AddXYPointToSizer( *aParent, *m_gbsLineByMidEnd, 0, 0, _( "Mid Point" ), false, m_boundCtrls );
AddXYPointToSizer( *aParent, *m_gbsLineByMidEnd, 0, 3, _( "End Point" ), false, m_boundCtrls );
AddXYPointToSizer( *aParent, *m_gbsLineByStartMid, 0, 0, _( "Start Point" ), false, m_boundCtrls );
AddXYPointToSizer( *aParent, *m_gbsLineByStartMid, 0, 3, _( "Mid Point" ), false, m_boundCtrls );
m_geomSync = std::make_unique<LINE_GEOM_SYNCER>( m_workingCopy, m_boundCtrls );
showPage( *m_gbsLineByEnds, true );
showPage( *m_gbsLineByLengthAngle );
showPage( *m_gbsLineByMidEnd );
showPage( *m_gbsLineByStartMid );
break;
case SHAPE_T::ARC:

18
pcbnew/dialogs/dialog_shape_properties_base.cpp

@ -99,22 +99,22 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx
m_lineByLengthAngle->Layout();
bSizer7->Fit( m_lineByLengthAngle );
m_notebookShapeDefs->AddPage( m_lineByLengthAngle, _("By Length and Angle"), false );
m_lineByMidEnd = new wxPanel( m_notebookShapeDefs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_lineByStartMid = new wxPanel( m_notebookShapeDefs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxVERTICAL );
m_gbsLineByMidEnd = new wxGridBagSizer( 0, 0 );
m_gbsLineByMidEnd->SetFlexibleDirection( wxBOTH );
m_gbsLineByMidEnd->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_gbsLineByStartMid = new wxGridBagSizer( 0, 0 );
m_gbsLineByStartMid->SetFlexibleDirection( wxBOTH );
m_gbsLineByStartMid->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
bSizer71->Add( m_gbsLineByMidEnd, 1, wxALL|wxEXPAND, 5 );
bSizer71->Add( m_gbsLineByStartMid, 1, wxALL|wxEXPAND, 5 );
m_lineByMidEnd->SetSizer( bSizer71 );
m_lineByMidEnd->Layout();
bSizer71->Fit( m_lineByMidEnd );
m_notebookShapeDefs->AddPage( m_lineByMidEnd, _("By Midpoint/Endpoint"), false );
m_lineByStartMid->SetSizer( bSizer71 );
m_lineByStartMid->Layout();
bSizer71->Fit( m_lineByStartMid );
m_notebookShapeDefs->AddPage( m_lineByStartMid, _("By Start/Midpoint"), false );
m_arcByCSA = new wxPanel( m_notebookShapeDefs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );

6
pcbnew/dialogs/dialog_shape_properties_base.fbp

@ -529,7 +529,7 @@
</object>
<object class="notebookpage" expanded="true">
<property name="bitmap"></property>
<property name="label">By Midpoint/Endpoint</property>
<property name="label">By Start/Midpoint</property>
<property name="select">0</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
@ -567,7 +567,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lineByMidEnd</property>
<property name="name">m_lineByStartMid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -599,7 +599,7 @@
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">m_gbsLineByMidEnd</property>
<property name="name">m_gbsLineByStartMid</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">protected</property>
<property name="vgap">0</property>

4
pcbnew/dialogs/dialog_shape_properties_base.h

@ -54,8 +54,8 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
wxGridBagSizer* m_gbsLineByEnds;
wxPanel* m_lineByLengthAngle;
wxGridBagSizer* m_gbsLineByLengthAngle;
wxPanel* m_lineByMidEnd;
wxGridBagSizer* m_gbsLineByMidEnd;
wxPanel* m_lineByStartMid;
wxGridBagSizer* m_gbsLineByStartMid;
wxPanel* m_arcByCSA;
wxGridBagSizer* m_gbsArcByCSA;
wxPanel* m_arcBySME;

Loading…
Cancel
Save