2013-11-18 17:52:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-01-19 11:35:35 +00:00
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras jp.charras at wanadoo.fr
|
2023-03-02 14:04:37 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-11-18 17:52:18 +00:00
|
|
|
*
|
2019-01-19 11:35:35 +00:00
|
|
|
* 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.
|
2013-11-18 17:52:18 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2018-06-11 15:03:16 +00:00
|
|
|
/*
|
2020-11-16 00:45:43 +00:00
|
|
|
* Edit properties of Lines, Circles, Arcs and Polygons for PCBNew and Footprint Editor
|
2013-11-19 18:58:12 +00:00
|
|
|
*/
|
|
|
|
|
2018-06-11 15:03:16 +00:00
|
|
|
#include <pcb_base_edit_frame.h>
|
2021-01-11 19:23:26 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2016-04-11 14:27:32 +00:00
|
|
|
#include <wx/valnum.h>
|
2016-06-20 13:46:58 +00:00
|
|
|
#include <board_commit.h>
|
2018-06-11 15:03:16 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2021-09-14 18:26:03 +00:00
|
|
|
#include <dialogs/html_message_box.h>
|
2021-05-25 17:12:49 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/actions.h>
|
2020-10-04 23:34:59 +00:00
|
|
|
#include <pcb_shape.h>
|
2021-03-20 15:35:37 +00:00
|
|
|
#include <macros.h>
|
2018-06-11 15:03:16 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
#include <dialog_shape_properties_base.h>
|
2021-10-22 16:00:55 +00:00
|
|
|
#include <tools/drawing_tool.h>
|
2013-11-19 18:58:12 +00:00
|
|
|
|
2023-03-02 14:04:37 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
class DIALOG_SHAPE_PROPERTIES : public DIALOG_SHAPE_PROPERTIES_BASE
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2023-09-19 10:23:35 +00:00
|
|
|
DIALOG_SHAPE_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_SHAPE* aShape );
|
|
|
|
~DIALOG_SHAPE_PROPERTIES() {};
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
private:
|
2016-09-24 18:53:15 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2016-07-18 16:28:02 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
void onFilledCheckbox( wxCommandEvent& event ) override;
|
|
|
|
|
2023-08-12 09:30:52 +00:00
|
|
|
void onLayerSelection( wxCommandEvent& event ) override;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Validate() override;
|
2023-03-02 14:04:37 +00:00
|
|
|
|
2023-08-12 09:30:52 +00:00
|
|
|
// Show/hide the widgets used in net selection (shown only for copper layers)
|
|
|
|
void showHideNetInfo()
|
|
|
|
{
|
|
|
|
m_netSelector->Show( m_item->IsOnCopperLayer() );
|
|
|
|
m_netLabel->Show( m_item->IsOnCopperLayer() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-02 14:04:37 +00:00
|
|
|
private:
|
|
|
|
PCB_BASE_EDIT_FRAME* m_parent;
|
|
|
|
PCB_SHAPE* m_item;
|
|
|
|
|
|
|
|
UNIT_BINDER m_startX, m_startY;
|
|
|
|
UNIT_BINDER m_endX, m_endY;
|
|
|
|
UNIT_BINDER m_thickness;
|
2023-06-24 11:30:17 +00:00
|
|
|
UNIT_BINDER m_segmentLength;
|
|
|
|
UNIT_BINDER m_segmentAngle;
|
2023-08-30 07:09:54 +00:00
|
|
|
UNIT_BINDER m_angle;
|
2023-06-26 22:10:40 +00:00
|
|
|
UNIT_BINDER m_rectangleHeight;
|
2023-06-25 09:55:50 +00:00
|
|
|
UNIT_BINDER m_rectangleWidth;
|
2023-03-02 14:04:37 +00:00
|
|
|
UNIT_BINDER m_bezierCtrl1X, m_bezierCtrl1Y;
|
|
|
|
UNIT_BINDER m_bezierCtrl2X, m_bezierCtrl2Y;
|
|
|
|
|
|
|
|
bool m_flipStartEnd;
|
2008-12-23 13:15:08 +00:00
|
|
|
};
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_SHAPE* aShape ):
|
|
|
|
DIALOG_SHAPE_PROPERTIES_BASE( aParent ),
|
2023-03-30 11:49:23 +00:00
|
|
|
m_parent( aParent ),
|
|
|
|
m_item( aShape ),
|
2018-06-11 15:03:16 +00:00
|
|
|
m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
|
|
|
|
m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
|
|
|
|
m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
|
|
|
|
m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
|
2023-08-30 07:09:54 +00:00
|
|
|
m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
|
2023-06-24 11:30:17 +00:00
|
|
|
m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
|
|
|
|
m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
|
2023-08-30 07:09:54 +00:00
|
|
|
m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
|
2023-06-26 22:10:40 +00:00
|
|
|
m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
|
2023-06-25 09:55:50 +00:00
|
|
|
m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
|
2018-07-22 12:50:35 +00:00
|
|
|
m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
|
|
|
|
m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
|
|
|
|
m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
|
|
|
|
m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
|
2022-01-16 21:15:20 +00:00
|
|
|
m_flipStartEnd( false )
|
2023-08-30 07:09:54 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
SetTitle( wxString::Format( GetTitle(), m_item->GetFriendlyName() ) );
|
|
|
|
m_hash_key = TO_UTF8( GetTitle() );
|
|
|
|
|
2020-07-06 14:41:29 +00:00
|
|
|
// Configure display origin transforms
|
|
|
|
m_startX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
|
|
|
|
m_startY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
|
|
|
m_endX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
|
|
|
|
m_endY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
|
|
|
m_bezierCtrl1X.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
|
|
|
|
m_bezierCtrl1Y.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
|
|
|
m_bezierCtrl2X.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
|
|
|
|
m_bezierCtrl2Y.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
|
|
|
|
2023-06-24 11:30:17 +00:00
|
|
|
m_segmentLength.SetUnits( EDA_UNITS::MILLIMETRES );
|
|
|
|
m_segmentAngle.SetUnits( EDA_UNITS::DEGREES );
|
2023-06-27 05:21:16 +00:00
|
|
|
m_segmentAngle.SetPrecision( 4 );
|
2023-06-25 09:55:50 +00:00
|
|
|
|
2023-06-26 22:10:40 +00:00
|
|
|
m_rectangleHeight.SetUnits( EDA_UNITS::MILLIMETRES );
|
2023-06-25 09:55:50 +00:00
|
|
|
m_rectangleWidth.SetUnits( EDA_UNITS::MILLIMETRES );
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
m_angle.SetUnits( EDA_UNITS::DEGREES );
|
2016-04-11 14:27:32 +00:00
|
|
|
|
2021-01-11 19:23:26 +00:00
|
|
|
// Do not allow locking items in the footprint editor
|
|
|
|
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
|
|
|
|
2018-08-27 13:52:46 +00:00
|
|
|
// Configure the layers list selector
|
2023-03-30 11:49:23 +00:00
|
|
|
if( m_parent->GetFrameType() == FRAME_FOOTPRINT_EDITOR )
|
2018-12-04 22:15:14 +00:00
|
|
|
{
|
|
|
|
LSET forbiddenLayers = LSET::ForbiddenFootprintLayers();
|
|
|
|
|
|
|
|
// If someone went to the trouble of setting the layer in a text editor, then there's
|
|
|
|
// very little sense in nagging them about it.
|
2023-03-30 11:49:23 +00:00
|
|
|
forbiddenLayers.set( m_item->GetLayer(), false );
|
2018-12-04 22:15:14 +00:00
|
|
|
|
|
|
|
m_LayerSelectionCtrl->SetNotAllowedLayerSet( forbiddenLayers );
|
|
|
|
}
|
2018-08-27 13:52:46 +00:00
|
|
|
|
2021-08-25 23:14:36 +00:00
|
|
|
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
|
|
|
|
m_lineStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
|
|
|
|
|
2022-03-11 23:13:05 +00:00
|
|
|
m_lineStyleCombo->Append( DEFAULT_STYLE );
|
|
|
|
|
2018-08-27 13:52:46 +00:00
|
|
|
m_LayerSelectionCtrl->SetLayersHotkeys( false );
|
|
|
|
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
|
|
|
|
m_LayerSelectionCtrl->Resync();
|
|
|
|
|
2023-07-30 19:39:07 +00:00
|
|
|
m_netSelector->SetBoard( aParent->GetBoard() );
|
|
|
|
m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
|
|
|
|
|
|
|
|
int net = aShape->GetNetCode();
|
|
|
|
|
|
|
|
if( net >= 0 )
|
|
|
|
{
|
|
|
|
m_netSelector->SetSelectedNetcode( net );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_netSelector->SetIndeterminateString( INDETERMINATE_STATE );
|
|
|
|
m_netSelector->SetIndeterminate();
|
|
|
|
}
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::POLY )
|
|
|
|
m_sizerStartEnd->Show( false );
|
|
|
|
|
|
|
|
// Only a Bezeier curve has control points. So do not show these parameters for other shapes
|
|
|
|
if( m_item->GetShape() != SHAPE_T::BEZIER )
|
|
|
|
m_sizerBezier->Show( false );
|
|
|
|
|
|
|
|
// Only a segment has this format
|
|
|
|
if( m_item->GetShape() != SHAPE_T::SEGMENT )
|
|
|
|
{
|
|
|
|
m_segmentLength.Show( false );
|
|
|
|
m_segmentAngle.Show( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_item->GetShape() != SHAPE_T::RECTANGLE )
|
|
|
|
{
|
|
|
|
m_rectangleHeight.Show( false );
|
|
|
|
m_rectangleWidth.Show( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only an arc has a angle parameter. So do not show this parameter for other shapes
|
|
|
|
if( m_item->GetShape() != SHAPE_T::ARC )
|
|
|
|
m_angle.Show( false );
|
|
|
|
|
|
|
|
if( m_item->GetShape() == SHAPE_T::ARC || m_item->GetShape() == SHAPE_T::SEGMENT )
|
|
|
|
m_filledCtrl->Show( false );
|
|
|
|
|
|
|
|
// Change texts for circles:
|
|
|
|
if( m_item->GetShape() == SHAPE_T::CIRCLE )
|
|
|
|
{
|
|
|
|
m_startPointLabel->SetLabel( _( "Center Point" ) );
|
|
|
|
m_endPointLabel->SetLabel( _( "Radius" ) );
|
|
|
|
|
|
|
|
m_endXLabel->Show( false );
|
|
|
|
m_endX.SetCoordType( ORIGIN_TRANSFORMS::NOT_A_COORD );
|
|
|
|
m_endY.Show( false );
|
|
|
|
}
|
|
|
|
|
2023-07-30 19:39:07 +00:00
|
|
|
showHideNetInfo();
|
|
|
|
|
2018-06-11 15:03:16 +00:00
|
|
|
SetInitialFocus( m_startXCtrl );
|
2016-04-11 14:27:32 +00:00
|
|
|
|
2021-11-16 19:39:58 +00:00
|
|
|
SetupStandardButtons();
|
2023-09-19 10:23:35 +00:00
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
finishDialogSettings();
|
|
|
|
Layout();
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape )
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
wxCHECK_RET( aShape, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
DIALOG_SHAPE_PROPERTIES dlg( this, aShape );
|
2021-10-22 16:00:55 +00:00
|
|
|
|
|
|
|
if( dlg.ShowQuasiModal() == wxID_OK )
|
|
|
|
{
|
2023-08-01 17:37:19 +00:00
|
|
|
if( aShape->IsOnLayer( GetActiveLayer() ) )
|
2021-10-22 16:00:55 +00:00
|
|
|
{
|
|
|
|
DRAWING_TOOL* drawingTool = m_toolManager->GetTool<DRAWING_TOOL>();
|
2023-03-30 11:49:23 +00:00
|
|
|
drawingTool->SetStroke( aShape->GetStroke(), GetActiveLayer() );
|
2021-10-22 16:00:55 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
void DIALOG_SHAPE_PROPERTIES::onLayerSelection( wxCommandEvent& event )
|
2023-08-12 09:30:52 +00:00
|
|
|
{
|
|
|
|
if( m_LayerSelectionCtrl->GetLayerSelection() >= 0 )
|
|
|
|
{
|
|
|
|
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
|
|
|
|
showHideNetInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
void DIALOG_SHAPE_PROPERTIES::onFilledCheckbox( wxCommandEvent& event )
|
2021-08-25 23:14:36 +00:00
|
|
|
{
|
|
|
|
if( m_filledCtrl->GetValue() )
|
|
|
|
{
|
|
|
|
m_lineStyleCombo->SetSelection( 0 );
|
|
|
|
m_lineStyleLabel->Enable( false );
|
|
|
|
m_lineStyleCombo->Enable( false );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-17 17:49:03 +00:00
|
|
|
PLOT_DASH_TYPE style = m_item->GetStroke().GetPlotStyle();
|
|
|
|
|
|
|
|
if( style == PLOT_DASH_TYPE::DEFAULT )
|
|
|
|
style = PLOT_DASH_TYPE::SOLID;
|
2021-08-25 23:14:36 +00:00
|
|
|
|
2022-02-17 17:49:03 +00:00
|
|
|
if( (int) style < (int) lineTypeNames.size() )
|
|
|
|
m_lineStyleCombo->SetSelection( (int) style );
|
2021-08-25 23:14:36 +00:00
|
|
|
|
|
|
|
m_lineStyleLabel->Enable( true );
|
|
|
|
m_lineStyleCombo->Enable( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2018-06-11 15:03:16 +00:00
|
|
|
if( !m_item )
|
|
|
|
return false;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::ARC )
|
2022-01-16 21:15:20 +00:00
|
|
|
m_angle.SetAngleValue( m_item->GetArcAngle() );
|
2020-11-14 01:16:02 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::RECTANGLE )
|
|
|
|
{
|
2023-06-26 22:10:40 +00:00
|
|
|
m_rectangleHeight.SetValue( m_item->GetRectangleHeight() );
|
2023-06-25 09:55:50 +00:00
|
|
|
m_rectangleWidth.SetValue( m_item->GetRectangleWidth() );
|
2023-09-19 10:23:35 +00:00
|
|
|
}
|
2023-06-25 09:55:50 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::SEGMENT )
|
|
|
|
{
|
2019-07-11 16:01:30 +00:00
|
|
|
if( m_item->GetStart().x == m_item->GetEnd().x )
|
|
|
|
m_flipStartEnd = m_item->GetStart().y > m_item->GetEnd().y;
|
|
|
|
else
|
|
|
|
m_flipStartEnd = m_item->GetStart().x > m_item->GetEnd().x;
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
m_segmentLength.SetValue( KiROUND( m_item->GetLength() ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
m_segmentAngle.SetAngleValue( m_item->GetSegmentAngle() );
|
2009-01-05 05:21:35 +00:00
|
|
|
}
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2021-07-17 19:56:18 +00:00
|
|
|
if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
|
2019-07-11 16:01:30 +00:00
|
|
|
{
|
|
|
|
m_startX.SetValue( m_item->GetEnd().x );
|
|
|
|
m_startY.SetValue( m_item->GetEnd().y );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_startX.SetValue( m_item->GetStart().x );
|
|
|
|
m_startY.SetValue( m_item->GetStart().y );
|
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::CIRCLE )
|
2018-04-27 16:09:05 +00:00
|
|
|
{
|
2018-06-11 15:03:16 +00:00
|
|
|
m_endX.SetValue( m_item->GetRadius() );
|
2018-04-27 16:09:05 +00:00
|
|
|
}
|
2021-07-17 19:56:18 +00:00
|
|
|
else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
|
2019-07-11 16:01:30 +00:00
|
|
|
{
|
|
|
|
m_endX.SetValue( m_item->GetStart().x );
|
|
|
|
m_endY.SetValue( m_item->GetStart().y );
|
|
|
|
}
|
2018-04-27 16:09:05 +00:00
|
|
|
else
|
|
|
|
{
|
2018-06-11 15:03:16 +00:00
|
|
|
m_endX.SetValue( m_item->GetEnd().x );
|
|
|
|
m_endY.SetValue( m_item->GetEnd().y );
|
2018-04-27 16:09:05 +00:00
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::BEZIER )
|
|
|
|
{
|
|
|
|
m_bezierCtrl1X.SetValue( m_item->GetBezierC1().x );
|
|
|
|
m_bezierCtrl1Y.SetValue( m_item->GetBezierC1().y );
|
|
|
|
m_bezierCtrl2X.SetValue( m_item->GetBezierC2().x );
|
|
|
|
m_bezierCtrl2Y.SetValue( m_item->GetBezierC2().y );
|
|
|
|
}
|
2018-07-22 12:50:35 +00:00
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
m_filledCtrl->SetValue( m_item->IsFilled() );
|
2021-01-07 17:35:27 +00:00
|
|
|
m_locked->SetValue( m_item->IsLocked() );
|
2021-08-25 23:14:36 +00:00
|
|
|
|
|
|
|
m_thickness.SetValue( m_item->GetStroke().GetWidth() );
|
|
|
|
|
|
|
|
int style = static_cast<int>( 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" );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2020-11-05 15:05:52 +00:00
|
|
|
m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() );
|
2016-04-11 14:27:32 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
|
2016-04-11 14:27:32 +00:00
|
|
|
return false;
|
2015-02-06 21:49:40 +00:00
|
|
|
|
2022-03-21 19:40:17 +00:00
|
|
|
if( !m_item )
|
|
|
|
return true;
|
2018-06-11 15:03:16 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
int layer = m_LayerSelectionCtrl->GetLayerSelection();
|
2023-06-24 11:30:17 +00:00
|
|
|
VECTOR2I begin_point = m_item->GetStart();
|
|
|
|
VECTOR2I end_point = m_item->GetEnd();
|
2023-09-19 10:23:35 +00:00
|
|
|
int segment_length = 0;
|
|
|
|
EDA_ANGLE segment_angle = EDA_ANGLE( 0, RADIANS_T );
|
|
|
|
int rectangle_height = 0;
|
|
|
|
int rectangle_width = 0;
|
2023-06-24 11:30:17 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
BOARD_COMMIT commit( m_parent );
|
2022-03-21 19:40:17 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
commit.Modify( m_item );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2023-06-25 09:55:50 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::SEGMENT )
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
segment_length = KiROUND( m_item->GetLength() );
|
2023-06-27 16:50:09 +00:00
|
|
|
segment_angle = m_item->GetSegmentAngle().Round( 3 );
|
2023-06-25 09:55:50 +00:00
|
|
|
}
|
|
|
|
|
2023-08-14 08:03:27 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::RECTANGLE )
|
2023-06-25 09:55:50 +00:00
|
|
|
{
|
2023-06-26 22:10:40 +00:00
|
|
|
rectangle_height = m_item->GetRectangleHeight();
|
2023-06-25 09:55:50 +00:00
|
|
|
rectangle_width = m_item->GetRectangleWidth();
|
|
|
|
}
|
|
|
|
|
2021-07-17 19:56:18 +00:00
|
|
|
if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
|
2019-07-11 16:01:30 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetEndX( m_startX.GetIntValue() );
|
|
|
|
m_item->SetEndY( m_startY.GetIntValue() );
|
2019-07-11 16:01:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetStartX( m_startX.GetIntValue() );
|
|
|
|
m_item->SetStartY( m_startY.GetIntValue() );
|
2019-07-11 16:01:30 +00:00
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::CIRCLE )
|
2018-04-27 16:09:05 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetEnd( m_item->GetStart() + VECTOR2I( m_endX.GetIntValue(), 0 ) );
|
2018-04-27 16:09:05 +00:00
|
|
|
}
|
2021-07-17 19:56:18 +00:00
|
|
|
else if( m_flipStartEnd && m_item->GetShape() != SHAPE_T::ARC )
|
2019-07-11 16:01:30 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetStartX( m_endX.GetIntValue() );
|
|
|
|
m_item->SetStartY( m_endY.GetIntValue() );
|
2019-07-11 16:01:30 +00:00
|
|
|
}
|
2018-04-27 16:09:05 +00:00
|
|
|
else
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetEndX( m_endX.GetIntValue() );
|
|
|
|
m_item->SetEndY( m_endY.GetIntValue() );
|
2018-04-27 16:09:05 +00:00
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::SEGMENT )
|
|
|
|
{
|
|
|
|
bool change_begin = ( begin_point != m_item->GetStart() );
|
|
|
|
bool change_end = ( end_point != m_item->GetEnd() );
|
|
|
|
bool change_length = ( segment_length != m_segmentLength.GetValue() );
|
2023-06-27 16:50:09 +00:00
|
|
|
EDA_ANGLE difference = std::abs( segment_angle - m_segmentAngle.GetAngleValue() );
|
2023-09-19 10:23:35 +00:00
|
|
|
bool change_angle = ( difference >= EDA_ANGLE( 0.00049, DEGREES_T ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
|
|
|
|
if( !( change_begin && change_end ) )
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
segment_length = m_segmentLength.GetIntValue();
|
2023-06-27 16:50:09 +00:00
|
|
|
segment_angle = m_segmentAngle.GetAngleValue().Round( 3 );
|
2023-06-24 11:30:17 +00:00
|
|
|
|
|
|
|
if( change_length || change_angle )
|
|
|
|
{
|
|
|
|
if( change_end )
|
|
|
|
{
|
|
|
|
m_item->SetStartX( m_item->GetEndX()
|
2023-09-19 10:23:35 +00:00
|
|
|
- KiROUND( segment_length * segment_angle.Cos() ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
m_item->SetStartY( m_item->GetEndY()
|
2023-09-19 10:23:35 +00:00
|
|
|
+ KiROUND( segment_length * segment_angle.Sin() ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_item->SetEndX( m_item->GetStartX()
|
2023-09-19 10:23:35 +00:00
|
|
|
+ KiROUND( segment_length * segment_angle.Cos() ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
m_item->SetEndY( m_item->GetStartY()
|
2023-09-19 10:23:35 +00:00
|
|
|
- KiROUND( segment_length * segment_angle.Sin() ) );
|
2023-08-30 07:09:54 +00:00
|
|
|
}
|
2023-06-24 11:30:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( change_length )
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetLength( m_segmentLength.GetIntValue() );
|
2023-06-24 11:30:17 +00:00
|
|
|
else
|
|
|
|
m_item->SetLength( m_item->GetLength() );
|
2023-08-30 07:09:54 +00:00
|
|
|
|
2023-06-24 11:30:17 +00:00
|
|
|
if( change_angle )
|
2023-08-14 08:03:27 +00:00
|
|
|
m_item->SetSegmentAngle( m_segmentAngle.GetAngleValue().Round( 3 ) );
|
2023-06-24 11:30:17 +00:00
|
|
|
else
|
2023-08-14 08:03:27 +00:00
|
|
|
m_item->SetSegmentAngle( m_item->GetSegmentAngle().Round( 3 ) );
|
2023-09-19 10:23:35 +00:00
|
|
|
}
|
2023-06-24 11:30:17 +00:00
|
|
|
|
2023-08-14 08:03:27 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::RECTANGLE )
|
2023-06-25 09:55:50 +00:00
|
|
|
{
|
|
|
|
bool change_begin = ( begin_point != m_item->GetStart() );
|
|
|
|
bool change_end = ( end_point != m_item->GetEnd() );
|
2023-06-27 16:09:23 +00:00
|
|
|
bool change_height = ( rectangle_height != m_rectangleHeight.GetValue() );
|
2023-06-25 09:55:50 +00:00
|
|
|
bool change_width = ( rectangle_width != m_rectangleWidth.GetValue() );
|
|
|
|
|
|
|
|
if( !( change_begin && change_end ) )
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
rectangle_height = m_rectangleHeight.GetIntValue();
|
|
|
|
rectangle_width = m_rectangleWidth.GetIntValue();
|
2023-07-03 17:43:22 +00:00
|
|
|
|
|
|
|
if( change_height || change_width )
|
|
|
|
{
|
|
|
|
if( change_end )
|
|
|
|
{
|
|
|
|
m_item->SetStartX( m_item->GetEndX() - rectangle_width );
|
|
|
|
m_item->SetStartY( m_item->GetEndY() - rectangle_height );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_item->SetEndX( m_item->GetStartX() + rectangle_width );
|
|
|
|
m_item->SetEndY( m_item->GetStartY() + rectangle_height );
|
|
|
|
}
|
|
|
|
}
|
2023-06-25 09:55:50 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 22:10:40 +00:00
|
|
|
m_item->SetRectangle( m_rectangleHeight.GetValue(), m_rectangleWidth.GetValue() );
|
2023-06-25 09:55:50 +00:00
|
|
|
}
|
|
|
|
|
2023-08-30 07:09:54 +00:00
|
|
|
|
2023-06-25 09:55:50 +00:00
|
|
|
// For Bezier curve: Set the two control points
|
2021-07-21 18:31:25 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::BEZIER )
|
2018-06-11 15:03:16 +00:00
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
m_item->SetBezierC1( VECTOR2I( m_bezierCtrl1X.GetIntValue(), m_bezierCtrl1Y.GetIntValue() ) );
|
|
|
|
m_item->SetBezierC2( VECTOR2I( m_bezierCtrl2X.GetIntValue(), m_bezierCtrl2Y.GetIntValue() ) );
|
2018-07-22 12:50:35 +00:00
|
|
|
}
|
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
if( m_item->GetShape() == SHAPE_T::ARC )
|
2022-01-16 21:15:20 +00:00
|
|
|
{
|
2022-03-21 19:40:17 +00:00
|
|
|
VECTOR2D c = CalcArcCenter( m_item->GetStart(), m_item->GetEnd(), m_angle.GetAngleValue() );
|
2020-12-17 15:32:10 +00:00
|
|
|
|
2022-03-21 19:40:17 +00:00
|
|
|
m_item->SetCenter( c );
|
2022-02-07 01:16:28 +00:00
|
|
|
}
|
2022-03-21 19:40:17 +00:00
|
|
|
|
2021-05-25 17:12:49 +00:00
|
|
|
bool wasLocked = m_item->IsLocked();
|
|
|
|
|
2020-11-14 01:16:02 +00:00
|
|
|
m_item->SetFilled( m_filledCtrl->GetValue() );
|
2021-01-07 17:35:27 +00:00
|
|
|
m_item->SetLocked( m_locked->GetValue() );
|
2021-07-17 19:56:18 +00:00
|
|
|
|
|
|
|
STROKE_PARAMS stroke = m_item->GetStroke();
|
2021-08-25 23:14:36 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
stroke.SetWidth( m_thickness.GetIntValue() );
|
2021-08-25 23:14:36 +00:00
|
|
|
|
|
|
|
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 );
|
|
|
|
|
2021-07-17 19:56:18 +00:00
|
|
|
m_item->SetStroke( stroke );
|
|
|
|
|
2018-06-11 15:03:16 +00:00
|
|
|
m_item->SetLayer( ToLAYER_ID( layer ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2018-07-22 12:50:35 +00:00
|
|
|
m_item->RebuildBezierToSegmentsPointsList( m_item->GetWidth() );
|
|
|
|
|
2023-07-30 19:39:07 +00:00
|
|
|
if( m_item->IsOnCopperLayer() )
|
|
|
|
m_item->SetNetCode( m_netSelector->GetSelectedNetcode() );
|
|
|
|
else
|
|
|
|
m_item->SetNetCode( -1 );
|
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
commit.Push( _( "Modify drawing properties" ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2021-05-25 17:12:49 +00:00
|
|
|
// Notify clients which treat locked and unlocked items differently (ie: POINT_EDITOR)
|
|
|
|
if( wasLocked != m_item->IsLocked() )
|
|
|
|
m_parent->GetToolManager()->PostEvent( EVENTS::SelectedEvent );
|
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
return true;
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
2015-02-06 21:49:40 +00:00
|
|
|
|
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
bool DIALOG_SHAPE_PROPERTIES::Validate()
|
2015-02-06 21:49:40 +00:00
|
|
|
{
|
2022-07-16 15:25:23 +00:00
|
|
|
wxArrayString errors;
|
2015-02-06 21:49:40 +00:00
|
|
|
|
2023-09-19 10:23:35 +00:00
|
|
|
if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
|
2016-04-11 14:27:32 +00:00
|
|
|
return false;
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
// Type specific checks.
|
|
|
|
switch( m_item->GetShape() )
|
|
|
|
{
|
2021-07-21 18:31:25 +00:00
|
|
|
case SHAPE_T::ARC:
|
2015-02-06 21:49:40 +00:00
|
|
|
// Check angle of arc.
|
2022-01-16 21:15:20 +00:00
|
|
|
if( m_angle.GetAngleValue() == ANGLE_0 )
|
2022-07-16 15:25:23 +00:00
|
|
|
errors.Add( _( "Arc angle cannot be zero." ) );
|
2020-06-19 20:46:43 +00:00
|
|
|
|
2022-02-03 22:30:44 +00:00
|
|
|
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
|
2022-02-07 01:16:28 +00:00
|
|
|
{
|
2022-07-16 15:25:23 +00:00
|
|
|
errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
|
|
|
|
0.0, m_angle.GetDoubleValue() ) );
|
2022-02-07 01:16:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-19 10:23:35 +00:00
|
|
|
VECTOR2D start( m_startX.GetIntValue(), m_startY.GetIntValue() );
|
|
|
|
VECTOR2D end( m_endX.GetIntValue(), m_endY.GetIntValue() );
|
2022-02-07 01:16:28 +00:00
|
|
|
VECTOR2D center = CalcArcCenter( start, end, m_angle.GetAngleValue() );
|
|
|
|
|
|
|
|
double radius = ( center - start ).EuclideanNorm();
|
|
|
|
double max_offset = std::max( std::abs( center.x ) + radius,
|
|
|
|
std::abs( center.y ) + radius );
|
|
|
|
|
2023-03-02 14:04:37 +00:00
|
|
|
if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
|
2022-02-07 01:16:28 +00:00
|
|
|
|| center == start || center == end )
|
|
|
|
{
|
2022-07-16 15:25:23 +00:00
|
|
|
errors.Add( wxString::Format( _( "Invalid Arc with radius %f and angle %f." ),
|
|
|
|
radius, m_angle.GetDoubleValue() ) );
|
2022-02-07 01:16:28 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-16 15:25:23 +00:00
|
|
|
|
|
|
|
if( m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero." ) );
|
|
|
|
|
2022-02-03 22:30:44 +00:00
|
|
|
break;
|
2022-07-16 15:25:23 +00:00
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
case SHAPE_T::CIRCLE:
|
2015-02-06 21:49:40 +00:00
|
|
|
// Check radius.
|
2022-07-16 15:25:23 +00:00
|
|
|
if( m_endX.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Radius must be greater than zero." ) );
|
|
|
|
|
|
|
|
if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero for an unfilled circle." ) );
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
break;
|
|
|
|
|
2023-07-24 16:07:56 +00:00
|
|
|
case SHAPE_T::RECTANGLE:
|
2020-06-19 20:46:43 +00:00
|
|
|
// Check for null rect.
|
|
|
|
if( m_startX.GetValue() == m_endX.GetValue() && m_startY.GetValue() == m_endY.GetValue() )
|
2022-07-16 15:25:23 +00:00
|
|
|
errors.Add( _( "Rectangle cannot be empty." ) );
|
|
|
|
|
|
|
|
if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero for an unfilled rectangle." ) );
|
|
|
|
|
2020-06-19 20:46:43 +00:00
|
|
|
break;
|
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
case SHAPE_T::POLY:
|
2022-07-16 15:25:23 +00:00
|
|
|
if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero for an unfilled polygon." ) );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
case SHAPE_T::SEGMENT:
|
2022-07-16 15:25:23 +00:00
|
|
|
if( m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero." ) );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2021-07-21 18:31:25 +00:00
|
|
|
case SHAPE_T::BEZIER:
|
2022-07-16 15:25:23 +00:00
|
|
|
if( !m_filledCtrl->GetValue() && m_thickness.GetValue() <= 0 )
|
|
|
|
errors.Add( _( "Line width must be greater than zero for an unfilled curve." ) );
|
|
|
|
|
2017-10-19 21:16:06 +00:00
|
|
|
break;
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
default:
|
2021-07-17 19:56:18 +00:00
|
|
|
UNIMPLEMENTED_FOR( m_item->SHAPE_T_asString() );
|
2015-02-06 21:49:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-07-16 15:25:23 +00:00
|
|
|
if( errors.GetCount() )
|
2015-02-06 21:49:40 +00:00
|
|
|
{
|
2015-09-11 13:08:53 +00:00
|
|
|
HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
|
2022-07-16 15:25:23 +00:00
|
|
|
dlg.ListSet( errors );
|
2015-02-06 21:49:40 +00:00
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
2022-07-16 15:25:23 +00:00
|
|
|
return errors.GetCount() == 0;
|
2015-02-06 21:49:40 +00:00
|
|
|
}
|