2013-11-18 17:52:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-18 08:31:56 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-11-18 17:52:18 +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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_graphic_item_properties.cpp
|
|
|
|
*/
|
|
|
|
|
2008-12-23 13:15:08 +00:00
|
|
|
/* Edit parameters values of graphic items type DRAWSEGMENTS:
|
|
|
|
* Lines
|
|
|
|
* Circles
|
|
|
|
* Arcs
|
2017-12-21 18:47:03 +00:00
|
|
|
* polygon (only layer and contour thickness)
|
2008-12-23 13:15:08 +00:00
|
|
|
* used as graphic elements found on non copper layers in boards
|
|
|
|
* items on edge layers are considered as graphic items
|
|
|
|
* Pcb texts are not always graphic items and are not handled here
|
|
|
|
*/
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <pcbnew.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.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>
|
2017-11-23 13:05:26 +00:00
|
|
|
#include <widgets/text_ctrl_eval.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_drawsegment.h>
|
|
|
|
|
|
|
|
#include <dialog_graphic_item_properties_base.h>
|
2018-01-31 08:23:20 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2015-02-06 21:49:40 +00:00
|
|
|
#include <html_messagebox.h>
|
2017-12-21 18:47:03 +00:00
|
|
|
#include <widgets/text_ctrl_eval.h>
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
|
|
|
private:
|
2015-02-06 21:49:40 +00:00
|
|
|
PCB_EDIT_FRAME* m_parent;
|
|
|
|
wxDC* m_DC;
|
|
|
|
DRAWSEGMENT* m_item;
|
|
|
|
BOARD_DESIGN_SETTINGS m_brdSettings;
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
wxFloatingPointValidator<double> m_AngleValidator;
|
|
|
|
double m_AngleValue;
|
|
|
|
|
2008-12-23 13:15:08 +00:00
|
|
|
public:
|
2015-02-06 21:49:40 +00:00
|
|
|
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent, DRAWSEGMENT* aItem, wxDC* aDC );
|
2012-02-12 19:39:37 +00:00
|
|
|
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
private:
|
2016-09-24 18:53:15 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2009-01-05 05:21:35 +00:00
|
|
|
void OnLayerChoice( wxCommandEvent& event );
|
2016-07-18 16:28:02 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
void OnInitDlg( wxInitDialogEvent& event ) override
|
2016-07-18 16:28:02 +00:00
|
|
|
{
|
|
|
|
// Call the default wxDialog handler of a wxInitDialogEvent
|
|
|
|
TransferDataToWindow();
|
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
FinishDialogSettings();
|
|
|
|
}
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Validate() override;
|
2008-12-23 13:15:08 +00:00
|
|
|
};
|
|
|
|
|
2012-02-12 19:39:37 +00:00
|
|
|
DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME* aParent,
|
2015-02-06 21:49:40 +00:00
|
|
|
DRAWSEGMENT* aItem, wxDC* aDC ):
|
2016-04-11 14:27:32 +00:00
|
|
|
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ),
|
|
|
|
m_AngleValidator( 1, &m_AngleValue ),
|
|
|
|
m_AngleValue( 0.0 )
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2012-02-12 19:39:37 +00:00
|
|
|
m_parent = aParent;
|
2009-01-05 05:21:35 +00:00
|
|
|
m_DC = aDC;
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item = aItem;
|
2012-02-12 19:39:37 +00:00
|
|
|
m_brdSettings = m_parent->GetDesignSettings();
|
2016-04-11 14:27:32 +00:00
|
|
|
|
|
|
|
m_AngleValidator.SetRange( -360.0, 360.0 );
|
|
|
|
m_AngleCtrl->SetValidator( m_AngleValidator );
|
|
|
|
m_AngleValidator.SetWindow( m_AngleCtrl );
|
|
|
|
|
|
|
|
m_StandardButtonsSizerOK->SetDefault();
|
|
|
|
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
void PCB_EDIT_FRAME::InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC )
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2015-02-06 21:49:40 +00:00
|
|
|
wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( true );
|
2013-11-18 17:52:18 +00:00
|
|
|
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem, aDC );
|
|
|
|
dlg.ShowModal();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2012-02-12 19:39:37 +00:00
|
|
|
// Set unit symbol
|
2015-02-06 21:49:40 +00:00
|
|
|
wxStaticText* texts_unit[] =
|
2012-02-12 19:39:37 +00:00
|
|
|
{
|
|
|
|
m_StartPointXUnit,
|
|
|
|
m_StartPointYUnit,
|
|
|
|
m_EndPointXUnit,
|
|
|
|
m_EndPointYUnit,
|
|
|
|
m_ThicknessTextUnit,
|
|
|
|
m_DefaulThicknessTextUnit,
|
|
|
|
};
|
|
|
|
|
2016-04-12 23:18:42 +00:00
|
|
|
for( size_t ii = 0; ii < DIM( texts_unit ); ii++ )
|
2012-02-12 19:39:37 +00:00
|
|
|
{
|
|
|
|
texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() );
|
|
|
|
}
|
2009-01-05 05:21:35 +00:00
|
|
|
|
2017-12-21 18:47:03 +00:00
|
|
|
// Only an arc has a angle parameter. So do not show this parameter for other shapes
|
|
|
|
if( m_item->GetShape() != S_ARC )
|
|
|
|
{
|
|
|
|
m_AngleText->Show( false );
|
|
|
|
m_AngleCtrl->Show( false );
|
|
|
|
m_AngleUnit->Show( false );
|
|
|
|
}
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
wxString msg;
|
++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
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
// Change texts according to the segment shape:
|
2015-02-06 21:49:40 +00:00
|
|
|
switch( m_item->GetShape() )
|
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
|
|
|
case S_CIRCLE:
|
2015-02-06 21:49:40 +00:00
|
|
|
SetTitle( _( "Circle Properties" ) );
|
2015-09-11 13:08:53 +00:00
|
|
|
m_StartPointXLabel->SetLabel( _( "Center X:" ) );
|
|
|
|
m_StartPointYLabel->SetLabel( _( "Center Y:" ) );
|
|
|
|
m_EndPointXLabel->SetLabel( _( "Point X:" ) );
|
|
|
|
m_EndPointYLabel->SetLabel( _( "Point Y:" ) );
|
++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
|
|
|
break;
|
|
|
|
|
|
|
|
case S_ARC:
|
2015-02-06 21:49:40 +00:00
|
|
|
SetTitle( _( "Arc Properties" ) );
|
2015-09-11 13:08:53 +00:00
|
|
|
m_StartPointXLabel->SetLabel( _( "Center X:" ) );
|
|
|
|
m_StartPointYLabel->SetLabel( _( "Center Y:" ) );
|
|
|
|
m_EndPointXLabel->SetLabel( _( "Start Point X:" ) );
|
|
|
|
m_EndPointYLabel->SetLabel( _( "Start Point Y:" ) );
|
2013-05-05 07:17:48 +00:00
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
m_AngleValue = m_item->GetAngle() / 10.0;
|
++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
|
|
|
break;
|
|
|
|
|
2017-12-21 18:47:03 +00:00
|
|
|
case S_POLYGON:
|
|
|
|
SetTitle( _( "Polygon Properties" ) );
|
|
|
|
m_fgUpperLeftGridSizer->Show( false );
|
|
|
|
break;
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
case S_SEGMENT:
|
|
|
|
SetTitle( _( "Line Segment Properties" ) );
|
2017-12-21 18:47:03 +00:00
|
|
|
break;
|
2015-02-06 21:49:40 +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
|
|
|
default:
|
|
|
|
break;
|
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
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
PutValueInLocalUnits( *m_Center_StartXCtrl, m_item->GetStart().x );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
PutValueInLocalUnits( *m_Center_StartYCtrl, m_item->GetStart().y );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_item->GetEnd().x );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
PutValueInLocalUnits( *m_EndY_Ctrl, m_item->GetEnd().y );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
PutValueInLocalUnits( *m_ThicknessCtrl, m_item->GetWidth() );
|
++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
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
int thickness;
|
++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
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
if( m_item->GetLayer() == Edge_Cuts )
|
|
|
|
thickness = m_brdSettings.m_EdgeSegmentWidth;
|
2008-12-23 13:15:08 +00:00
|
|
|
else
|
2015-02-06 21:49:40 +00:00
|
|
|
thickness = m_brdSettings.m_DrawSegmentWidth;
|
++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
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2013-09-03 12:48:38 +00:00
|
|
|
// Configure the layers list selector
|
|
|
|
m_LayerSelectionCtrl->SetLayersHotkeys( false );
|
2018-03-31 08:46:52 +00:00
|
|
|
m_LayerSelectionCtrl->SetNotAllowedLayerSet( LSET::AllCuMask() );
|
2013-09-03 12:48:38 +00:00
|
|
|
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
|
|
|
|
m_LayerSelectionCtrl->Resync();
|
2013-09-11 15:30:21 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2018-03-31 08:46:52 +00:00
|
|
|
wxMessageBox( _( "This item was on a not allowed or non existing layer.\n"
|
|
|
|
"It has been moved to the first allowed layer.\n\n"
|
|
|
|
"Please fix it." ) );
|
|
|
|
//m_LayerSelectionCtrl->SetLayerSelection( Dwgs_User );
|
|
|
|
m_LayerSelectionCtrl->SetSelection( 0 );
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
2016-04-11 14:27:32 +00:00
|
|
|
|
|
|
|
return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow();
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-12 19:39:37 +00:00
|
|
|
void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
int thickness;
|
++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
|
|
|
|
2014-06-24 16:17:18 +00:00
|
|
|
if( m_LayerSelectionCtrl->GetLayerSelection() == Edge_Cuts )
|
2015-02-06 21:49:40 +00:00
|
|
|
thickness = m_brdSettings.m_EdgeSegmentWidth;
|
2008-12-23 13:15:08 +00:00
|
|
|
else
|
2015-02-06 21:49:40 +00:00
|
|
|
thickness = m_brdSettings.m_DrawSegmentWidth;
|
++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
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness );
|
2008-12-23 13:15:08 +00:00
|
|
|
}
|
|
|
|
|
2013-11-19 18:58:12 +00:00
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
2008-12-23 13:15:08 +00:00
|
|
|
{
|
2016-04-11 14:27:32 +00:00
|
|
|
if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
|
|
|
|
return false;
|
2015-02-06 21:49:40 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
BOARD_COMMIT commit( m_parent );
|
|
|
|
commit.Modify( m_item );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
wxString msg;
|
2011-12-22 13:28:11 +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
|
|
|
if( m_DC )
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_Center_StartXCtrl->GetValue();
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetStartX( ValueFromString( g_UserUnit, msg ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_Center_StartYCtrl->GetValue();
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetStartY( ValueFromString( g_UserUnit, msg ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_EndX_Radius_Ctrl->GetValue();
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetEndX( ValueFromString( g_UserUnit, msg ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_EndY_Ctrl->GetValue();
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetEndY( ValueFromString( g_UserUnit, msg ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_ThicknessCtrl->GetValue();
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetWidth( ValueFromString( g_UserUnit, msg ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
|
|
|
msg = m_DefaultThicknessCtrl->GetValue();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int thickness = ValueFromString( g_UserUnit, msg );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
if( m_item->GetLayer() == Edge_Cuts )
|
|
|
|
m_brdSettings.m_EdgeSegmentWidth = thickness;
|
2008-12-23 13:15:08 +00:00
|
|
|
else
|
2015-02-06 21:49:40 +00:00
|
|
|
m_brdSettings.m_DrawSegmentWidth = thickness;
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
if( m_item->GetShape() == S_ARC )
|
2009-01-05 05:21:35 +00:00
|
|
|
{
|
2016-04-11 14:27:32 +00:00
|
|
|
m_item->SetAngle( m_AngleValue * 10.0 );
|
2009-01-05 05:21:35 +00:00
|
|
|
}
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
commit.Push( _( "Modify drawing properties" ) );
|
2011-12-22 13:28:11 +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
|
|
|
if( m_DC )
|
2015-02-06 21:49:40 +00:00
|
|
|
m_item->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
m_parent->SetMsgPanel( m_item );
|
2008-12-23 13:15:08 +00:00
|
|
|
|
2012-02-12 19:39:37 +00:00
|
|
|
m_parent->SetDesignSettings( m_brdSettings );
|
2018-01-01 20:42:54 +00:00
|
|
|
m_parent->OnModify();
|
++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
|
|
|
|
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
|
|
|
|
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
|
2015-02-06 21:49:40 +00:00
|
|
|
{
|
|
|
|
wxArrayString error_msgs;
|
|
|
|
|
2016-04-11 14:27:32 +00:00
|
|
|
if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::Validate() )
|
|
|
|
return false;
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
// Load the start and end points -- all types use these in the checks.
|
|
|
|
int startx = ValueFromString( g_UserUnit, m_Center_StartXCtrl->GetValue() );
|
|
|
|
int starty = ValueFromString( g_UserUnit, m_Center_StartYCtrl->GetValue() );
|
|
|
|
int endx = ValueFromString( g_UserUnit, m_EndX_Radius_Ctrl->GetValue() );
|
|
|
|
int endy = ValueFromString( g_UserUnit, m_EndY_Ctrl->GetValue() );
|
|
|
|
|
|
|
|
// Type specific checks.
|
|
|
|
switch( m_item->GetShape() )
|
|
|
|
{
|
|
|
|
case S_ARC:
|
|
|
|
// Check angle of arc.
|
2016-04-11 14:27:32 +00:00
|
|
|
if( m_AngleValue == 0.0 )
|
2015-02-06 21:49:40 +00:00
|
|
|
{
|
|
|
|
error_msgs.Add( _( "The arc angle must be greater than zero." ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fall through.
|
|
|
|
case S_CIRCLE:
|
|
|
|
// Check radius.
|
|
|
|
if( (startx == endx) && (starty == endy) )
|
|
|
|
{
|
|
|
|
error_msgs.Add( _( "The radius must be greater than zero." ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2017-10-19 21:16:06 +00:00
|
|
|
case S_POLYGON:
|
|
|
|
break;
|
|
|
|
|
2015-02-06 21:49:40 +00:00
|
|
|
default:
|
|
|
|
// Check start and end are not the same.
|
|
|
|
if( (startx == endx) && (starty == endy) )
|
|
|
|
{
|
|
|
|
error_msgs.Add( _( "The start and end points cannot be the same." ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-01-18 08:31:56 +00:00
|
|
|
// Check the item thickness. Note the polygon outline thickness is allowed
|
|
|
|
// to be set to 0, because if the shape is exactly the polygon, its outline
|
|
|
|
// thickness must be 0
|
2015-02-06 21:49:40 +00:00
|
|
|
int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() );
|
|
|
|
|
2018-01-18 08:31:56 +00:00
|
|
|
if( m_item->GetShape() == S_POLYGON )
|
|
|
|
{
|
|
|
|
if( thickness < 0 )
|
|
|
|
error_msgs.Add( _( "The polygon outline thickness must be >= 0." ) );
|
|
|
|
}
|
|
|
|
else if( thickness <= 0 )
|
2015-02-06 21:49:40 +00:00
|
|
|
error_msgs.Add( _( "The item thickness must be greater than zero." ) );
|
|
|
|
|
|
|
|
// And the default thickness.
|
|
|
|
thickness = ValueFromString( g_UserUnit, m_DefaultThicknessCtrl->GetValue() );
|
|
|
|
|
|
|
|
if( thickness <= 0 )
|
|
|
|
error_msgs.Add( _( "The default thickness must be greater than zero." ) );
|
|
|
|
|
|
|
|
if( error_msgs.GetCount() )
|
|
|
|
{
|
2015-09-11 13:08:53 +00:00
|
|
|
HTML_MESSAGE_BOX dlg( this, _( "Error List" ) );
|
2015-02-06 21:49:40 +00:00
|
|
|
dlg.ListSet( error_msgs );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
return error_msgs.GetCount() == 0;
|
|
|
|
}
|