change Rectangle property: Length to Height

This commit is contained in:
Josue 2023-06-26 17:10:40 -05:00 committed by Josue Huaroto
parent c3766bb250
commit 6429051750
6 changed files with 37 additions and 37 deletions

View File

@ -137,11 +137,11 @@ double EDA_SHAPE::GetLength() const
}
}
long long int EDA_SHAPE::GetRectangleLength() const
long long int EDA_SHAPE::GetRectangleHeight() const
{
switch( m_shape )
{
case SHAPE_T::RECT: return GetEndX() - GetStartX();
case SHAPE_T::RECT: return GetEndY() - GetStartY();
default: UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
@ -151,7 +151,7 @@ long long int EDA_SHAPE::GetRectangleWidth() const
{
switch( m_shape )
{
case SHAPE_T::RECT: return GetEndY() - GetStartY();
case SHAPE_T::RECT: return GetEndX() - GetStartX();
default: UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
@ -167,12 +167,12 @@ void EDA_SHAPE::SetLength( const double& aLength )
}
}
void EDA_SHAPE::SetRectangle(const long long int& aLength, const long long int& aWidth)
void EDA_SHAPE::SetRectangle(const long long int& aHeight, const long long int& aWidth)
{
switch ( m_shape )
{
case SHAPE_T::RECT:
m_rectangleLength = aLength;
m_rectangleHeight = aHeight;
m_rectangleWidth = aWidth;
break;

View File

@ -301,7 +301,7 @@ public:
void SetLength( const double& aLength );
void SetRectangle( const long long int& aLength, const long long int& aWidth );
void SetRectangle( const long long int& aHeight, const long long int& aWidth );
void SetAngle( const EDA_ANGLE& aLength );
@ -312,7 +312,7 @@ public:
*/
double GetLength() const;
long long int GetRectangleLength() const;
long long int GetRectangleHeight() const;
long long int GetRectangleWidth() const;
/**
@ -377,7 +377,7 @@ protected:
FILL_T m_fill;
COLOR4D m_fillColor;
long long int m_rectangleLength;
long long int m_rectangleHeight;
long long int m_rectangleWidth;
double m_segmentLength;

View File

@ -85,7 +85,7 @@ private:
UNIT_BINDER m_thickness;
UNIT_BINDER m_segmentLength;
UNIT_BINDER m_segmentAngle;
UNIT_BINDER m_rectangleLength;
UNIT_BINDER m_rectangleHeight;
UNIT_BINDER m_rectangleWidth;
UNIT_BINDER m_bezierCtrl1X, m_bezierCtrl1Y;
UNIT_BINDER m_bezierCtrl2X, m_bezierCtrl2Y;
@ -104,7 +104,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
m_rectangleLength( aParent, m_rectangleLengthLabel, m_rectangleLengthCtrl, m_rectangleLengthUnits ),
m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
@ -127,7 +127,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_segmentLength.SetUnits( EDA_UNITS::MILLIMETRES );
m_segmentAngle.SetUnits( EDA_UNITS::DEGREES );
m_rectangleLength.SetUnits( EDA_UNITS::MILLIMETRES );
m_rectangleHeight.SetUnits( EDA_UNITS::MILLIMETRES );
m_rectangleWidth.SetUnits( EDA_UNITS::MILLIMETRES );
m_angle.SetUnits( EDA_UNITS::DEGREES );
@ -244,7 +244,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
if( m_item->GetShape() != SHAPE_T::RECT )
{
m_rectangleLength.Show( false );
m_rectangleHeight.Show( false );
m_rectangleWidth.Show( false );
}
@ -297,7 +297,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
case SHAPE_T::RECTANGLE:
SetTitle( _( "Rectangle Properties" ) );
m_rectangleLength.SetValue( m_item->GetRectangleLength() );
m_rectangleHeight.SetValue( m_item->GetRectangleHeight() );
m_rectangleWidth.SetValue( m_item->GetRectangleWidth() );
m_filledCtrl->Show( true );
@ -392,7 +392,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
VECTOR2I end_point = m_item->GetEnd();
long long int segment_length = 0;
EDA_ANGLE segment_angle = EDA_ANGLE( 0, RADIANS_T );
long long int rectangle_length = 0;
long long int rectangle_height = 0;
long long int rectangle_width = 0;
BOARD_COMMIT commit( m_parent );
@ -407,7 +407,7 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
if( m_item->GetShape() == SHAPE_T::RECT )
{
rectangle_length = m_item->GetRectangleLength();
rectangle_height = m_item->GetRectangleHeight();
rectangle_width = m_item->GetRectangleWidth();
}
@ -490,31 +490,31 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
{
bool change_begin = ( begin_point != m_item->GetStart() );
bool change_end = ( end_point != m_item->GetEnd() );
bool change_length = ( rectangle_length != m_rectangleLength.GetValue() );
bool change_length = ( rectangle_height != m_rectangleHeight.GetValue() );
bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
if( !( change_begin && change_end ) )
{
rectangle_length = m_rectangleLength.GetValue();
rectangle_height = m_rectangleHeight.GetValue();
rectangle_width = m_rectangleWidth.GetValue();
if( change_length || change_width )
{
if( change_end )
{
m_item->SetStartX( m_item->GetEndX() - rectangle_length );
m_item->SetStartY( m_item->GetEndY() - rectangle_width );
m_item->SetStartX( m_item->GetEndX() - rectangle_width );
m_item->SetStartY( m_item->GetEndY() - rectangle_height );
}
else
{
m_item->SetEndX( m_item->GetStartX() + rectangle_length );
m_item->SetEndY( m_item->GetStartY() + rectangle_width );
m_item->SetEndX( m_item->GetStartX() + rectangle_width );
m_item->SetEndY( m_item->GetStartY() + rectangle_height );
}
}
}
m_item->SetRectangle( m_rectangleLength.GetValue(), m_rectangleWidth.GetValue() );
m_item->SetRectangle( m_rectangleHeight.GetValue(), m_rectangleWidth.GetValue() );
}

View File

@ -163,16 +163,16 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
m_segmentAngleUnits->Wrap( -1 );
gbSizer2->Add( m_segmentAngleUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rectangleLengthLabel = new wxStaticText( this, wxID_ANY, _("Length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rectangleLengthLabel->Wrap( -1 );
gbSizer2->Add( m_rectangleLengthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rectangleHeightLabel = new wxStaticText( this, wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rectangleHeightLabel->Wrap( -1 );
gbSizer2->Add( m_rectangleHeightLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rectangleLengthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_rectangleLengthCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
m_rectangleHeightCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_rectangleHeightCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
m_rectangleLengthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_rectangleLengthUnits->Wrap( -1 );
gbSizer2->Add( m_rectangleLengthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rectangleHeightUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_rectangleHeightUnits->Wrap( -1 );
gbSizer2->Add( m_rectangleHeightUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rectangleWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rectangleWidthLabel->Wrap( -1 );

View File

@ -2848,7 +2848,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Length:</property>
<property name="label">Height:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -2857,7 +2857,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rectangleLengthLabel</property>
<property name="name">m_rectangleHeightLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2920,7 +2920,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rectangleLengthCtrl</property>
<property name="name">m_rectangleHeightCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2988,7 +2988,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_rectangleLengthUnits</property>
<property name="name">m_rectangleHeightUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -74,9 +74,9 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_segmentAngleLabel;
wxTextCtrl* m_segmentAngleCtrl;
wxStaticText* m_segmentAngleUnits;
wxStaticText* m_rectangleLengthLabel;
wxTextCtrl* m_rectangleLengthCtrl;
wxStaticText* m_rectangleLengthUnits;
wxStaticText* m_rectangleHeightLabel;
wxTextCtrl* m_rectangleHeightCtrl;
wxStaticText* m_rectangleHeightUnits;
wxStaticText* m_rectangleWidthLabel;
wxTextCtrl* m_rectangleWidthCtrl;
wxStaticText* m_rectangleWidthUnits;