Add default units and precision for new dimension objects.
Fixes: lp:1846376 * https://bugs.launchpad.net/kicad/+bug/1846376
This commit is contained in:
parent
a6a4973324
commit
1c153c55c0
|
@ -228,6 +228,9 @@ public:
|
|||
bool m_TextItalic[ LAYER_CLASS_COUNT ];
|
||||
bool m_TextUpright[ LAYER_CLASS_COUNT ];
|
||||
|
||||
int m_DimensionUnits;
|
||||
int m_DimensionPrecision;
|
||||
|
||||
// Variables used in footprint editing (default value in item/footprint creation)
|
||||
|
||||
wxString m_RefDefaultText; ///< Default ref text on fp creation
|
||||
|
|
|
@ -479,6 +479,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
|
||||
m_TextUpright[ LAYER_CLASS_OTHERS ] = false;
|
||||
|
||||
m_DimensionUnits = 0; // Inches
|
||||
m_DimensionPrecision = 1; // 0.001mm / 0.1 mil
|
||||
|
||||
m_useCustomTrackVia = false;
|
||||
m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
|
||||
m_customViaSize.m_Diameter = Millimeter2iu( DEFAULT_VIASMINSIZE );
|
||||
|
@ -673,6 +676,11 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( BOARD* aBoard, PARAM_CFG_ARRAY* aResu
|
|||
aResult->push_back( new PARAM_CFG_BOOL( wxT( "OthersTextUpright" ),
|
||||
&m_TextUpright[ LAYER_CLASS_OTHERS ], true ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionUnits" ),
|
||||
&m_DimensionUnits, 0, 0, 2 ) );
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "DimensionPrecision" ),
|
||||
&m_DimensionPrecision, 1, 0, 2 ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "SolderMaskClearance" ),
|
||||
&m_SolderMaskMargin,
|
||||
Millimeter2iu( DEFAULT_SOLDERMASK_CLEARANCE ), Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ),
|
||||
|
@ -987,3 +995,5 @@ bool BOARD_DESIGN_SETTINGS::GetTextUpright( PCB_LAYER_ID aLayer ) const
|
|||
{
|
||||
return m_TextUpright[ GetLayerClass( aLayer ) ];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -191,27 +191,27 @@ void DIMENSION::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
|
|||
}
|
||||
|
||||
|
||||
void DIMENSION::SetOrigin( const wxPoint& aOrigin )
|
||||
void DIMENSION::SetOrigin( const wxPoint& aOrigin, int aPrecision )
|
||||
{
|
||||
m_featureLineGO = aOrigin;
|
||||
|
||||
AdjustDimensionDetails();
|
||||
AdjustDimensionDetails( aPrecision );
|
||||
}
|
||||
|
||||
|
||||
void DIMENSION::SetEnd( const wxPoint& aEnd )
|
||||
void DIMENSION::SetEnd( const wxPoint& aEnd, int aPrecision )
|
||||
{
|
||||
m_featureLineDO = aEnd;
|
||||
|
||||
AdjustDimensionDetails();
|
||||
AdjustDimensionDetails( aPrecision );
|
||||
}
|
||||
|
||||
|
||||
void DIMENSION::SetHeight( int aHeight )
|
||||
void DIMENSION::SetHeight( int aHeight, int aPrecision )
|
||||
{
|
||||
m_Height = aHeight;
|
||||
|
||||
AdjustDimensionDetails();
|
||||
AdjustDimensionDetails( aPrecision );
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,7 +227,7 @@ void DIMENSION::UpdateHeight()
|
|||
}
|
||||
|
||||
|
||||
void DIMENSION::AdjustDimensionDetails()
|
||||
void DIMENSION::AdjustDimensionDetails( int aPrecision )
|
||||
{
|
||||
const int arrowz = Mils2iu( 50 ); // size of arrows
|
||||
int ii;
|
||||
|
@ -335,7 +335,20 @@ void DIMENSION::AdjustDimensionDetails()
|
|||
m_Text.SetTextAngle( newAngle );
|
||||
|
||||
m_Value = measure;
|
||||
SetText( MessageTextFromValue( m_Unit, m_Value, m_UseMils ) );
|
||||
|
||||
if( m_Unit == MILLIMETRES )
|
||||
aPrecision += 2;
|
||||
else if( !m_UseMils )
|
||||
aPrecision += 3;
|
||||
|
||||
wxString text;
|
||||
wxString format = wxT( "%." ) + wxString::Format( "%i", aPrecision ) + wxT( "f" );
|
||||
|
||||
text.Printf( format, To_User_Unit( m_Unit, m_Value, m_UseMils ) );
|
||||
text += " ";
|
||||
text += GetAbbreviatedUnitsLabel( m_Unit, m_UseMils );
|
||||
|
||||
SetText( text );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -113,8 +113,9 @@ public:
|
|||
* Function SetOrigin
|
||||
* Sets a new origin of the crossbar line. All remaining lines are adjusted after that.
|
||||
* @param aOrigin is the new point to be used as the new origin of the crossbar line.
|
||||
* @param aPrecision number of decimal places for mils (scaled appropriately for other units).
|
||||
*/
|
||||
void SetOrigin( const wxPoint& aOrigin );
|
||||
void SetOrigin( const wxPoint& aOrigin, int aPrecision );
|
||||
|
||||
/**
|
||||
* Function GetOrigin
|
||||
|
@ -129,8 +130,9 @@ public:
|
|||
* Function SetEnd
|
||||
* Sets a new end of the crossbar line. All remaining lines are adjusted after that.
|
||||
* @param aEnd is the new point to be used as the new end of the crossbar line.
|
||||
* @param aPrecision number of decimal places for mils (scaled appropriately for other units).
|
||||
*/
|
||||
void SetEnd( const wxPoint& aEnd );
|
||||
void SetEnd( const wxPoint& aEnd, int aPrecision );
|
||||
|
||||
/**
|
||||
* Function GetEnd
|
||||
|
@ -145,8 +147,9 @@ public:
|
|||
* Function SetHeight
|
||||
* Sets the length of feature lines.
|
||||
* @param aHeight is the new height.
|
||||
* @param aPrecision number of decimal places for mils (scaled appropriately for other units).
|
||||
*/
|
||||
void SetHeight( int aHeight );
|
||||
void SetHeight( int aHeight, int aPrecision );
|
||||
|
||||
/**
|
||||
* Function GetHeight
|
||||
|
@ -178,8 +181,9 @@ public:
|
|||
/**
|
||||
* Function AdjustDimensionDetails
|
||||
* Calculate coordinates of segments used to draw the dimension.
|
||||
* @param aPrecision number of decimal places for mils (scaled appropriately for other units).
|
||||
*/
|
||||
void AdjustDimensionDetails();
|
||||
void AdjustDimensionDetails( int aPrecision );
|
||||
|
||||
void GetUnits( EDA_UNITS_T& aUnits, bool& aUseMils ) const
|
||||
{
|
||||
|
|
|
@ -131,6 +131,9 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
|||
|
||||
Layout();
|
||||
|
||||
m_dimensionUnits->SetSelection( m_BrdSettings->m_DimensionUnits );
|
||||
m_dimensionPrecision->SetSelection( m_BrdSettings->m_DimensionPrecision );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -186,6 +189,9 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) );
|
||||
}
|
||||
|
||||
m_BrdSettings->m_DimensionUnits = m_dimensionUnits->GetSelection();
|
||||
m_BrdSettings->m_DimensionPrecision = m_dimensionPrecision->GetSelection();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -11,26 +11,26 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* mainSizer;
|
||||
mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_gridSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
m_gridSizer->Add( m_staticText1, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
|
||||
|
||||
// Grid
|
||||
m_grid->CreateGrid( 5, 6 );
|
||||
m_grid->EnableEditing( true );
|
||||
m_grid->EnableGridLines( true );
|
||||
m_grid->EnableDragGridSize( false );
|
||||
m_grid->SetMargins( 0, 0 );
|
||||
|
||||
|
||||
// Columns
|
||||
m_grid->SetColSize( 0, 140 );
|
||||
m_grid->SetColSize( 1, 140 );
|
||||
|
@ -47,8 +47,8 @@ PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow
|
|||
m_grid->SetColLabelValue( 3, _("Text Thickness") );
|
||||
m_grid->SetColLabelValue( 4, _("Italic") );
|
||||
m_grid->SetColLabelValue( 5, _("Keep Upright") );
|
||||
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||
|
||||
m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||
|
||||
// Rows
|
||||
m_grid->EnableDragRowSize( false );
|
||||
m_grid->SetRowLabelSize( 132 );
|
||||
|
@ -57,20 +57,55 @@ PANEL_SETUP_TEXT_AND_GRAPHICS_BASE::PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow
|
|||
m_grid->SetRowLabelValue( 2, _("Edge Cuts") );
|
||||
m_grid->SetRowLabelValue( 3, _("Courtyards") );
|
||||
m_grid->SetRowLabelValue( 4, _("Other Layers") );
|
||||
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
||||
|
||||
m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||
|
||||
// Label Appearance
|
||||
|
||||
|
||||
// Cell Defaults
|
||||
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
||||
m_grid->SetToolTip( _("Net Class parameters") );
|
||||
|
||||
|
||||
m_gridSizer->Add( m_grid, 0, wxBOTTOM|wxLEFT, 20 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_gridSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Default properties for new dimension objects:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
m_gridSizer->Add( m_staticText2, 0, wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_dimensionUnitsLabel = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_dimensionUnitsLabel->Wrap( -1 );
|
||||
fgSizer1->Add( m_dimensionUnitsLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_dimensionUnitsChoices[] = { _("Inches"), _("Mils"), _("Millimeters") };
|
||||
int m_dimensionUnitsNChoices = sizeof( m_dimensionUnitsChoices ) / sizeof( wxString );
|
||||
m_dimensionUnits = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_dimensionUnitsNChoices, m_dimensionUnitsChoices, 0 );
|
||||
m_dimensionUnits->SetSelection( 0 );
|
||||
fgSizer1->Add( m_dimensionUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_dimensionPrecisionLabel = new wxStaticText( this, wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_dimensionPrecisionLabel->Wrap( -1 );
|
||||
fgSizer1->Add( m_dimensionPrecisionLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_dimensionPrecisionChoices[] = { _("0.01 mm / 1 mil"), _("0.001 mm / 0.1 mil"), _("0.0001mm / 0.01 mil") };
|
||||
int m_dimensionPrecisionNChoices = sizeof( m_dimensionPrecisionChoices ) / sizeof( wxString );
|
||||
m_dimensionPrecision = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_dimensionPrecisionNChoices, m_dimensionPrecisionChoices, 0 );
|
||||
m_dimensionPrecision->SetSelection( 0 );
|
||||
fgSizer1->Add( m_dimensionPrecision, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_gridSizer->Add( fgSizer1, 1, wxEXPAND|wxBOTTOM|wxLEFT, 20 );
|
||||
|
||||
|
||||
mainSizer->Add( m_gridSizer, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( mainSizer );
|
||||
this->Layout();
|
||||
mainSizer->Fit( this );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<FileVersion major="1" minor="15" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<property name="file">panel_setup_text_and_graphics_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">panel_setup_text_and_graphics_base</property>
|
||||
<property name="namespace"></property>
|
||||
|
@ -48,36 +49,6 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">mainSizer</property>
|
||||
|
@ -125,6 +96,7 @@
|
|||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default properties for new graphic items:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -150,29 +122,6 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
|
@ -201,10 +150,10 @@
|
|||
<property name="cell_vert_alignment">wxALIGN_TOP</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
|
||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
||||
<property name="col_label_size">24</property>
|
||||
<property name="col_label_values">"Line Thickness" "Text Width" "Text Height" "Text Thickness" "Italic" "Keep Upright"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="cols">6</property>
|
||||
<property name="column_sizes">140,140,140,140,80,120</property>
|
||||
<property name="context_help"></property>
|
||||
|
@ -250,7 +199,7 @@
|
|||
<property name="row_label_horiz_alignment">wxALIGN_LEFT</property>
|
||||
<property name="row_label_size">132</property>
|
||||
<property name="row_label_values">"Silk Layers" "Copper Layers" "Edge Cuts" "Courtyards" "Other Layers"</property>
|
||||
<property name="row_label_vert_alignment">wxALIGN_CENTRE</property>
|
||||
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
|
||||
<property name="row_sizes"></property>
|
||||
<property name="rows">5</property>
|
||||
<property name="show">1</property>
|
||||
|
@ -261,61 +210,345 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnGridCellChange"></event>
|
||||
<event name="OnGridCellLeftClick"></event>
|
||||
<event name="OnGridCellLeftDClick"></event>
|
||||
<event name="OnGridCellRightClick"></event>
|
||||
<event name="OnGridCellRightDClick"></event>
|
||||
<event name="OnGridCmdCellChange"></event>
|
||||
<event name="OnGridCmdCellLeftClick"></event>
|
||||
<event name="OnGridCmdCellLeftDClick"></event>
|
||||
<event name="OnGridCmdCellRightClick"></event>
|
||||
<event name="OnGridCmdCellRightDClick"></event>
|
||||
<event name="OnGridCmdColSize"></event>
|
||||
<event name="OnGridCmdEditorCreated"></event>
|
||||
<event name="OnGridCmdEditorHidden"></event>
|
||||
<event name="OnGridCmdEditorShown"></event>
|
||||
<event name="OnGridCmdLabelLeftClick"></event>
|
||||
<event name="OnGridCmdLabelLeftDClick"></event>
|
||||
<event name="OnGridCmdLabelRightClick"></event>
|
||||
<event name="OnGridCmdLabelRightDClick"></event>
|
||||
<event name="OnGridCmdRangeSelect"></event>
|
||||
<event name="OnGridCmdRowSize"></event>
|
||||
<event name="OnGridCmdSelectCell"></event>
|
||||
<event name="OnGridColSize"></event>
|
||||
<event name="OnGridEditorCreated"></event>
|
||||
<event name="OnGridEditorHidden"></event>
|
||||
<event name="OnGridEditorShown"></event>
|
||||
<event name="OnGridLabelLeftClick"></event>
|
||||
<event name="OnGridLabelLeftDClick"></event>
|
||||
<event name="OnGridLabelRightClick"></event>
|
||||
<event name="OnGridLabelRightDClick"></event>
|
||||
<event name="OnGridRangeSelect"></event>
|
||||
<event name="OnGridRowSize"></event>
|
||||
<event name="OnGridSelectCell"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default properties for new dimension objects:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText2</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">20</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">fgSizer1</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Units:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dimensionUnitsLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Inches" "Mils" "Millimeters"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dimensionUnits</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Precision:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dimensionPrecisionLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"0.01 mm / 1 mil" "0.001 mm / 0.1 mil" "0.0001mm / 0.01 mil"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_dimensionPrecision</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__
|
||||
#define __PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
|
@ -20,6 +19,7 @@ class WX_GRID;
|
|||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
|
@ -28,20 +28,24 @@ class WX_GRID;
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE : public wxPanel
|
||||
class PANEL_SETUP_TEXT_AND_GRAPHICS_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxBoxSizer* m_gridSizer;
|
||||
wxStaticText* m_staticText1;
|
||||
WX_GRID* m_grid;
|
||||
|
||||
wxStaticText* m_staticText2;
|
||||
wxStaticText* m_dimensionUnitsLabel;
|
||||
wxChoice* m_dimensionUnits;
|
||||
wxStaticText* m_dimensionPrecisionLabel;
|
||||
wxChoice* m_dimensionPrecision;
|
||||
|
||||
public:
|
||||
|
||||
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
|
||||
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
~PANEL_SETUP_TEXT_AND_GRAPHICS_BASE();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__PANEL_SETUP_TEXT_AND_GRAPHICS_BASE_H__
|
||||
|
|
|
@ -467,6 +467,8 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
|||
}
|
||||
|
||||
|
||||
#define DIMENSION_PRECISION 1 // 0.001 mm
|
||||
|
||||
void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
||||
{
|
||||
if( !aGraphics )
|
||||
|
@ -758,8 +760,10 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
|
||||
dimension->SetLayer( layer );
|
||||
// The origin and end are assumed to always be in this order from eagle
|
||||
dimension->SetOrigin( wxPoint( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
|
||||
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
|
||||
dimension->SetOrigin( wxPoint( kicad_x( d.x1 ), kicad_y( d.y1 ) ),
|
||||
DIMENSION_PRECISION );
|
||||
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ),
|
||||
DIMENSION_PRECISION );
|
||||
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
|
||||
dimension->Text().SetThickness( designSettings.GetTextThickness( layer ) );
|
||||
dimension->SetWidth( designSettings.GetLineThickness( layer ) );
|
||||
|
@ -770,11 +774,11 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
// Note the check is just if two axes are close enough to each other
|
||||
// Eagle appears to have some rounding errors
|
||||
if( abs( ( d.x1 - d.x2 ).ToPcbUnits() ) < 50000 ) // 50000 nm = 0.05 mm
|
||||
dimension->SetHeight( kicad_x( d.x3 - d.x1 ) );
|
||||
dimension->SetHeight( kicad_x( d.x3 - d.x1 ), DIMENSION_PRECISION );
|
||||
else
|
||||
dimension->SetHeight( kicad_y( d.y3 - d.y1 ) );
|
||||
dimension->SetHeight( kicad_y( d.y3 - d.y1 ), DIMENSION_PRECISION );
|
||||
|
||||
dimension->AdjustDimensionDetails();
|
||||
dimension->AdjustDimensionDetails( DIMENSION_PRECISION );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -446,12 +446,12 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_TOOL::constrainDimension( DIMENSION* dimension )
|
||||
void DRAWING_TOOL::constrainDimension( DIMENSION* aDim )
|
||||
{
|
||||
const VECTOR2I lineVector{ dimension->GetEnd() - dimension->GetOrigin() };
|
||||
const VECTOR2I lineVector{ aDim->GetEnd() - aDim->GetOrigin() };
|
||||
|
||||
dimension->SetEnd( wxPoint(
|
||||
VECTOR2I( dimension->GetOrigin() ) + GetVectorSnapped45( lineVector ) ) );
|
||||
aDim->SetEnd( wxPoint( VECTOR2I( aDim->GetOrigin() ) + GetVectorSnapped45( lineVector ) ),
|
||||
board()->GetDesignSettings().m_DimensionPrecision );
|
||||
}
|
||||
|
||||
|
||||
|
@ -463,7 +463,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
POINT_EDITOR* pointEditor = m_toolMgr->GetTool<POINT_EDITOR>();
|
||||
DIMENSION* dimension = NULL;
|
||||
BOARD_COMMIT commit( m_frame );
|
||||
GRID_HELPER grid( m_frame );
|
||||
GRID_HELPER grid( m_frame );
|
||||
|
||||
const BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings();
|
||||
|
||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||
PCBNEW_SELECTION preview;
|
||||
|
@ -582,7 +584,6 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
PCB_LAYER_ID layer = getDrawingLayer();
|
||||
const BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings();
|
||||
|
||||
if( layer == Edge_Cuts ) // dimensions are not allowed on EdgeCuts
|
||||
layer = Dwgs_User;
|
||||
|
@ -590,14 +591,15 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
// Init the new item attributes
|
||||
dimension = new DIMENSION( m_board );
|
||||
dimension->SetLayer( layer );
|
||||
dimension->SetOrigin( (wxPoint) cursorPos );
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->SetOrigin( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
|
||||
dimension->SetEnd( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
|
||||
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
|
||||
dimension->Text().SetThickness( boardSettings.GetTextThickness( layer ) );
|
||||
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
|
||||
dimension->SetWidth( boardSettings.GetLineThickness( layer ) );
|
||||
dimension->SetUnits( m_frame->GetUserUnits(), false );
|
||||
dimension->AdjustDimensionDetails();
|
||||
dimension->SetUnits( boardSettings.m_DimensionUnits == 2 ? MILLIMETRES : INCHES,
|
||||
boardSettings.m_DimensionUnits == 1 );
|
||||
dimension->AdjustDimensionDetails( boardSettings.m_DimensionPrecision );
|
||||
|
||||
preview.Add( dimension );
|
||||
frame()->SetMsgPanel( dimension );
|
||||
|
@ -608,7 +610,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
|
||||
case SET_END:
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->SetEnd( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
|
||||
|
||||
if( !!evt->Modifier( MD_CTRL ) )
|
||||
constrainDimension( dimension );
|
||||
|
@ -649,7 +651,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
switch( step )
|
||||
{
|
||||
case SET_END:
|
||||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->SetEnd( (wxPoint) cursorPos, boardSettings.m_DimensionPrecision );
|
||||
|
||||
if( !!evt->Modifier( MD_CTRL ) )
|
||||
constrainDimension( dimension );
|
||||
|
@ -663,7 +665,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
|
||||
wxPoint delta( (wxPoint) cursorPos - dimension->m_featureLineDO );
|
||||
double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
|
||||
dimension->SetHeight( height );
|
||||
dimension->SetHeight( height, boardSettings.m_DimensionPrecision );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ private:
|
|||
* Forces the dimension lime to be drawn on multiple of 45 degrees
|
||||
* @param aDimension is the dimension element currently being drawn
|
||||
*/
|
||||
void constrainDimension( DIMENSION* dimension );
|
||||
void constrainDimension( DIMENSION* aDim );
|
||||
|
||||
///> Returns the appropriate width for a segment depending on the settings.
|
||||
int getSegmentWidth( PCB_LAYER_ID aLayer ) const;
|
||||
|
|
|
@ -416,6 +416,8 @@ void POINT_EDITOR::updateItem() const
|
|||
{
|
||||
EDA_ITEM* item = m_editPoints->GetParent();
|
||||
|
||||
const BOARD_DESIGN_SETTINGS& boardSettings = board()->GetDesignSettings();
|
||||
|
||||
if( !item )
|
||||
return;
|
||||
|
||||
|
@ -571,9 +573,9 @@ void POINT_EDITOR::updateItem() const
|
|||
VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
|
||||
|
||||
if( featureLine.Cross( crossBar ) > 0 )
|
||||
dimension->SetHeight( -featureLine.EuclideanNorm() );
|
||||
dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
|
||||
else
|
||||
dimension->SetHeight( featureLine.EuclideanNorm() );
|
||||
dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
|
||||
}
|
||||
|
||||
else if( isModified( m_editPoints->Point( DIM_CROSSBARF ) ) )
|
||||
|
@ -582,14 +584,15 @@ void POINT_EDITOR::updateItem() const
|
|||
VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
|
||||
|
||||
if( featureLine.Cross( crossBar ) > 0 )
|
||||
dimension->SetHeight( -featureLine.EuclideanNorm() );
|
||||
dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
|
||||
else
|
||||
dimension->SetHeight( featureLine.EuclideanNorm() );
|
||||
dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
|
||||
}
|
||||
|
||||
else if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
|
||||
{
|
||||
dimension->SetOrigin( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) );
|
||||
dimension->SetOrigin( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ),
|
||||
boardSettings.m_DimensionPrecision );
|
||||
m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
|
||||
m_editPoints->Point( DIM_FEATUREGO ) ) );
|
||||
m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
|
||||
|
@ -598,7 +601,8 @@ void POINT_EDITOR::updateItem() const
|
|||
|
||||
else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
|
||||
{
|
||||
dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) );
|
||||
dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) ,
|
||||
boardSettings.m_DimensionPrecision );
|
||||
m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
|
||||
m_editPoints->Point( DIM_FEATUREGO ) ) );
|
||||
m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
|
||||
|
|
Loading…
Reference in New Issue