Browse Source
Feature: Exact item offset tool
Feature: Exact item offset tool
This is a little bit like the bounding hull tool, but the output is "exact" and it only supports the most common source items. By 'exact', this means that rounded corners are real arc segments rather than polygonal approximations. Obviously, this is rather tricky in the general case, and especially for any concave shape or anything with a bezier in it. Envisioned main uses: * Creating courtyard and silkscreen offsets in footprints * Making slots around line or arcs. The one thing that it does not currently do, but which it might plausibly do without reimplementing Clipper is convex polygons, which would bring trapezoidal pad outsets for free. But that is a stretch goal, and bounding hull can be used.jobs
23 changed files with 2913 additions and 31 deletions
-
1libs/kimath/CMakeLists.txt
-
84libs/kimath/include/geometry/roundrect.h
-
23libs/kimath/include/geometry/shape_rect.h
-
38libs/kimath/include/geometry/shape_utils.h
-
19libs/kimath/include/geometry/vector_utils.h
-
1libs/kimath/src/geometry/oval.cpp
-
162libs/kimath/src/geometry/roundrect.cpp
-
93libs/kimath/src/geometry/shape_utils.cpp
-
33libs/kimath/src/geometry/vector_utils.cpp
-
2pcbnew/CMakeLists.txt
-
196pcbnew/dialogs/dialog_outset_items.cpp
-
59pcbnew/dialogs/dialog_outset_items.h
-
142pcbnew/dialogs/dialog_outset_items_base.cpp
-
1403pcbnew/dialogs/dialog_outset_items_base.fbp
-
82pcbnew/dialogs/dialog_outset_items_base.h
-
141pcbnew/tools/convert_tool.cpp
-
9pcbnew/tools/convert_tool.h
-
26pcbnew/tools/edit_tool.cpp
-
5pcbnew/tools/edit_tool.h
-
362pcbnew/tools/item_modification_routine.cpp
-
55pcbnew/tools/item_modification_routine.h
-
6pcbnew/tools/pcb_actions.cpp
-
2pcbnew/tools/pcb_actions.h
@ -0,0 +1,84 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* 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 |
|||
*/ |
|||
|
|||
#pragma once |
|||
|
|||
#include <geometry/shape_rect.h> |
|||
|
|||
/** |
|||
* A round rectangle shape, based on a rectangle and a radius. |
|||
* |
|||
* For now, not an inheritor of SHAPE as that means implementing a |
|||
* lot of Collision logic. Then again, this is a common shape, could be more efficient |
|||
* to do the collision using arcs rather than Clipper'ing pad outsets. |
|||
*/ |
|||
class ROUNDRECT |
|||
{ |
|||
public: |
|||
ROUNDRECT() : m_rect(), m_radius( 0 ) {} |
|||
|
|||
ROUNDRECT( SHAPE_RECT aRect, int aRadius ); |
|||
|
|||
static ROUNDRECT OutsetFrom( const SHAPE_RECT& aRect, int aOutset ); |
|||
|
|||
int GetRoundRadius() const { return m_radius; } |
|||
|
|||
/** |
|||
* Get the basis rectangle of the roundrect. |
|||
* |
|||
* This is the rectangle without the rounded corners. |
|||
*/ |
|||
const SHAPE_RECT& GetRect() const { return m_rect; } |
|||
|
|||
/** |
|||
* Shortcut for common values |
|||
*/ |
|||
int GetWidth() const { return m_rect.GetWidth(); } |
|||
|
|||
int GetHeight() const { return m_rect.GetHeight(); } |
|||
|
|||
VECTOR2I GetPosition() const { return m_rect.GetPosition(); } |
|||
|
|||
/** |
|||
* Get the bounding box of the roundrect. |
|||
* |
|||
* (This is always the same as the basis rectangle's bounding box.) |
|||
*/ |
|||
BOX2I BBox() const { return m_rect.BBox(); } |
|||
|
|||
/** |
|||
* Get the roundrect with the size increased by aOutset in all directions. |
|||
* (the radius increases by aOutset as well). |
|||
*/ |
|||
ROUNDRECT GetInflated( int aOutset ) const; |
|||
|
|||
/** |
|||
* Get the polygonal representation of the roundrect. |
|||
*/ |
|||
void TransformToPolygon( SHAPE_POLY_SET& aBuffer, int aError, ERROR_LOC aErrorLoc ) const |
|||
/*override */; |
|||
|
|||
private: |
|||
SHAPE_RECT m_rect; |
|||
int m_radius; |
|||
}; |
@ -0,0 +1,162 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2017 CERN |
|||
* Copyright (C) 2019-2024 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> |
|||
* |
|||
* 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 |
|||
*/ |
|||
|
|||
#include "geometry/roundrect.h"
|
|||
|
|||
#include <stdexcept>
|
|||
|
|||
#include <geometry/shape_poly_set.h>
|
|||
#include <geometry/shape_utils.h>
|
|||
|
|||
|
|||
namespace |
|||
{ |
|||
|
|||
SHAPE_ARC MakeCornerArcCw90( const SHAPE_RECT& aRect, int aRadius, DIRECTION_45::Directions aDir ) |
|||
{ |
|||
const VECTOR2I center = KIGEOM::GetPoint( aRect, aDir ); |
|||
return KIGEOM::MakeArcCw90( center, aRadius, aDir ); |
|||
} |
|||
|
|||
|
|||
SHAPE_ARC MakeSideArcCw180( const SHAPE_RECT& aRect, int aRadius, DIRECTION_45::Directions aDir ) |
|||
{ |
|||
const VECTOR2I center = KIGEOM::GetPoint( aRect, aDir ); |
|||
return KIGEOM::MakeArcCw180( center, aRadius, aDir ); |
|||
} |
|||
|
|||
} // namespace
|
|||
|
|||
|
|||
ROUNDRECT::ROUNDRECT( SHAPE_RECT aRect, int aRadius ) : |
|||
m_rect( std::move( aRect ) ), m_radius( aRadius ) |
|||
{ |
|||
if( m_radius > m_rect.MajorDimension() ) |
|||
{ |
|||
throw std::invalid_argument( |
|||
"Roundrect radius is larger than the rectangle's major dimension" ); |
|||
} |
|||
|
|||
if( m_radius < 0 ) |
|||
{ |
|||
throw std::invalid_argument( "Roundrect radius must be non-negative" ); |
|||
} |
|||
} |
|||
|
|||
|
|||
ROUNDRECT ROUNDRECT::OutsetFrom( const SHAPE_RECT& aRect, int aOutset ) |
|||
{ |
|||
return ROUNDRECT( aRect.GetInflated( aOutset ), aOutset ); |
|||
} |
|||
|
|||
|
|||
ROUNDRECT ROUNDRECT::GetInflated( int aOutset ) const |
|||
{ |
|||
return ROUNDRECT( m_rect.GetInflated( aOutset ), m_radius + aOutset ); |
|||
} |
|||
|
|||
|
|||
void ROUNDRECT::TransformToPolygon( SHAPE_POLY_SET& aBuffer, int aError, ERROR_LOC aErrorLoc ) const |
|||
{ |
|||
const int idx = aBuffer.NewOutline(); |
|||
SHAPE_LINE_CHAIN& outline = aBuffer.Outline( idx ); |
|||
|
|||
const int w = m_rect.GetWidth(); |
|||
const int h = m_rect.GetHeight(); |
|||
const int x_edge = m_rect.GetWidth() - 2 * m_radius; |
|||
const int y_edge = m_rect.GetHeight() - 2 * m_radius; |
|||
|
|||
// This is a class invariant
|
|||
wxASSERT( x_edge >= 0 ); |
|||
wxASSERT( y_edge >= 0 ); |
|||
wxASSERT( m_radius >= 0 ); |
|||
|
|||
const VECTOR2I& m_p0 = m_rect.GetPosition(); |
|||
|
|||
if( m_radius == 0 ) |
|||
{ |
|||
// It's just a rectangle
|
|||
outline.Append( m_p0 ); |
|||
outline.Append( m_p0 + VECTOR2I( w, 0 ) ); |
|||
outline.Append( m_p0 + VECTOR2I( w, h ) ); |
|||
outline.Append( m_p0 + VECTOR2I( 0, h ) ); |
|||
} |
|||
else if( x_edge == 0 && y_edge == 0 ) |
|||
{ |
|||
// It's a circle
|
|||
outline.Append( SHAPE_ARC( m_p0 + VECTOR2I( m_radius, m_radius ), |
|||
m_p0 + VECTOR2I( -m_radius, 0 ), ANGLE_360 ) ); |
|||
} |
|||
else |
|||
{ |
|||
const SHAPE_RECT inner_rect{ m_p0 + VECTOR2I( m_radius, m_radius ), x_edge, y_edge }; |
|||
|
|||
if( x_edge > 0 ) |
|||
{ |
|||
// Either a normal roundrect or an oval with x_edge > 0
|
|||
|
|||
// Start to the right of the top left radius
|
|||
outline.Append( m_p0 + VECTOR2I( m_radius, 0 ) ); |
|||
|
|||
// Top side
|
|||
outline.Append( m_p0 + VECTOR2I( m_radius + x_edge, 0 ) ); |
|||
|
|||
if( y_edge > 0 ) |
|||
{ |
|||
outline.Append( MakeCornerArcCw90( inner_rect, m_radius, DIRECTION_45::NE ) ); |
|||
outline.Append( m_p0 + VECTOR2I( w, m_radius + y_edge ) ); |
|||
outline.Append( MakeCornerArcCw90( inner_rect, m_radius, DIRECTION_45::SE ) ); |
|||
} |
|||
else |
|||
{ |
|||
outline.Append( MakeSideArcCw180( inner_rect, m_radius, DIRECTION_45::E ) ); |
|||
} |
|||
|
|||
// Bottom side
|
|||
outline.Append( m_p0 + VECTOR2I( m_radius, h ) ); |
|||
|
|||
if( y_edge > 0 ) |
|||
{ |
|||
outline.Append( MakeCornerArcCw90( inner_rect, m_radius, DIRECTION_45::SW ) ); |
|||
outline.Append( m_p0 + VECTOR2I( 0, m_radius ) ); |
|||
outline.Append( MakeCornerArcCw90( inner_rect, m_radius, DIRECTION_45::NW ) ); |
|||
} |
|||
else |
|||
{ |
|||
outline.Append( MakeSideArcCw180( inner_rect, m_radius, DIRECTION_45::W ) ); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
// x_edge is 0 but y_edge is not, so it's an oval the other way up
|
|||
outline.Append( m_p0 + VECTOR2I( 0, m_radius ) ); |
|||
outline.Append( MakeSideArcCw180( inner_rect, m_radius, DIRECTION_45::N ) ); |
|||
outline.Append( m_p0 + VECTOR2I( w, m_radius + y_edge ) ); |
|||
outline.Append( MakeSideArcCw180( inner_rect, m_radius, DIRECTION_45::S ) ); |
|||
} |
|||
} |
|||
|
|||
outline.SetClosed( true ); |
|||
} |
@ -0,0 +1,196 @@ |
|||
|
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* 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 |
|||
*/ |
|||
|
|||
#include "dialogs/dialog_outset_items.h"
|
|||
|
|||
#include <board.h>
|
|||
#include <board_design_settings.h>
|
|||
#include <pcb_layer_box_selector.h>
|
|||
|
|||
/**
|
|||
* Some handy preset values for common outset distances. |
|||
*/ |
|||
static const std::vector<int> s_outsetPresetValue{ |
|||
// Outsetting a 0.1mm line to touch a 0.1mm line
|
|||
pcbIUScale.mmToIU( 0.1 ), |
|||
// 0.12mm line to touch a 0.1mm line
|
|||
pcbIUScale.mmToIU( 0.11 ), |
|||
// IPC dense courtyard
|
|||
pcbIUScale.mmToIU( 0.15 ), |
|||
// IPC normal courtyard
|
|||
pcbIUScale.mmToIU( 0.25 ), |
|||
// Keep 0.12mm silkscreen line 0.2mm from copper
|
|||
pcbIUScale.mmToIU( 0.26 ), |
|||
// IPC connector courtyard
|
|||
pcbIUScale.mmToIU( 0.5 ), |
|||
// Common router bits
|
|||
pcbIUScale.mmToIU( 1.0 ), |
|||
pcbIUScale.mmToIU( 2.0 ), |
|||
}; |
|||
|
|||
// Ther user can also get the current board design settings widths
|
|||
// with the "Layer Default" button.
|
|||
static const std::vector<int> s_presetLineWidths{ |
|||
// Courtyard
|
|||
pcbIUScale.mmToIU( 0.05 ), |
|||
pcbIUScale.mmToIU( 0.1 ), |
|||
// Silkscreen
|
|||
pcbIUScale.mmToIU( 0.12 ), |
|||
pcbIUScale.mmToIU( 0.15 ), |
|||
pcbIUScale.mmToIU( 0.2 ), |
|||
}; |
|||
|
|||
static const std::vector<int> s_presetGridRounding{ |
|||
// 0.01 is a common IPC grid round-off value
|
|||
pcbIUScale.mmToIU( 0.01 ), |
|||
}; |
|||
|
|||
static int s_gridRoundValuePersist = s_presetGridRounding[0]; |
|||
|
|||
static std::vector<int> s_outsetRecentValues; |
|||
static std::vector<int> s_lineWidthRecentValues; |
|||
static std::vector<int> s_gridRoundingRecentValues; |
|||
|
|||
DIALOG_OUTSET_ITEMS::DIALOG_OUTSET_ITEMS( PCB_BASE_FRAME& aParent, |
|||
OUTSET_ROUTINE::PARAMETERS& aParams ) : |
|||
DIALOG_OUTSET_ITEMS_BASE( &aParent ), m_parent( aParent ), m_params( aParams ), |
|||
m_outset( &aParent, m_outsetLabel, m_outsetEntry, m_outsetUnit ), |
|||
m_lineWidth( &aParent, m_lineWidthLabel, m_lineWidthEntry, m_lineWidthUnit ), |
|||
m_roundingGrid( &aParent, m_gridRoundingLabel, m_gridRoundingEntry, m_gridRoundingUnit ) |
|||
{ |
|||
m_LayerSelectionCtrl->ShowNonActivatedLayers( false ); |
|||
m_LayerSelectionCtrl->SetLayersHotkeys( false ); |
|||
m_LayerSelectionCtrl->SetBoardFrame( &aParent ); |
|||
m_LayerSelectionCtrl->Resync(); |
|||
|
|||
const auto fillOptionList = [&]( UNIT_BINDER& aCombo, const std::vector<int>& aPresets, |
|||
const std::vector<int>& aRecentPresets ) |
|||
{ |
|||
std::vector<long long int> optionList; |
|||
optionList.reserve( aPresets.size() + aRecentPresets.size() ); |
|||
|
|||
for( const int val : aPresets ) |
|||
optionList.push_back( val ); |
|||
|
|||
for( const int val : aRecentPresets ) |
|||
optionList.push_back( val ); |
|||
|
|||
// Sort the vector and remove duplicates
|
|||
std::sort( optionList.begin(), optionList.end() ); |
|||
optionList.erase( std::unique( optionList.begin(), optionList.end() ), optionList.end() ); |
|||
|
|||
aCombo.SetOptionsList( optionList ); |
|||
}; |
|||
|
|||
fillOptionList( m_outset, s_outsetPresetValue, s_outsetRecentValues ); |
|||
fillOptionList( m_lineWidth, s_presetLineWidths, s_lineWidthRecentValues ); |
|||
fillOptionList( m_roundingGrid, s_presetGridRounding, s_gridRoundingRecentValues ); |
|||
|
|||
SetupStandardButtons(); |
|||
finishDialogSettings(); |
|||
} |
|||
|
|||
DIALOG_OUTSET_ITEMS::~DIALOG_OUTSET_ITEMS() |
|||
{ |
|||
} |
|||
|
|||
void DIALOG_OUTSET_ITEMS::OnLayerDefaultClick( wxCommandEvent& event ) |
|||
{ |
|||
const BOARD_DESIGN_SETTINGS& settings = m_parent.GetBoard()->GetDesignSettings(); |
|||
|
|||
const PCB_LAYER_ID selLayer = ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ); |
|||
const int defaultWidth = settings.GetLineThickness( selLayer ); |
|||
|
|||
m_lineWidth.SetValue( defaultWidth ); |
|||
} |
|||
|
|||
void DIALOG_OUTSET_ITEMS::OnCopyLayersChecked( wxCommandEvent& event ) |
|||
{ |
|||
m_LayerSelectionCtrl->Enable( !m_copyLayers->GetValue() ); |
|||
} |
|||
|
|||
void DIALOG_OUTSET_ITEMS::OnRoundToGridChecked( wxCommandEvent& event ) |
|||
{ |
|||
m_gridRoundingEntry->Enable( m_roundToGrid->IsChecked() ); |
|||
} |
|||
|
|||
bool DIALOG_OUTSET_ITEMS::TransferDataToWindow() |
|||
{ |
|||
m_LayerSelectionCtrl->SetLayerSelection( m_params.layer ); |
|||
m_outset.SetValue( m_params.outsetDistance ); |
|||
m_roundCorners->SetValue( m_params.roundCorners ); |
|||
m_lineWidth.SetValue( m_params.lineWidth ); |
|||
|
|||
m_roundToGrid->SetValue( m_params.gridRounding.has_value() ); |
|||
|
|||
m_roundingGrid.SetValue( m_params.gridRounding.value_or( s_gridRoundValuePersist ) ); |
|||
|
|||
m_copyLayers->SetValue( m_params.useSourceLayers ); |
|||
m_copyWidths->SetValue( m_params.useSourceWidths ); |
|||
|
|||
m_gridRoundingEntry->Enable( m_roundToGrid->IsChecked() ); |
|||
m_LayerSelectionCtrl->Enable( !m_copyLayers->GetValue() ); |
|||
|
|||
m_deleteSourceItems->SetValue( m_params.deleteSourceItems ); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
bool DIALOG_OUTSET_ITEMS::TransferDataFromWindow() |
|||
{ |
|||
m_params.layer = ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ); |
|||
m_params.outsetDistance = m_outset.GetValue(); |
|||
m_params.roundCorners = m_roundCorners->GetValue(); |
|||
m_params.lineWidth = m_lineWidth.GetValue(); |
|||
|
|||
m_params.useSourceLayers = m_copyLayers->GetValue(); |
|||
m_params.useSourceWidths = m_copyWidths->GetValue(); |
|||
|
|||
if( m_roundToGrid->IsChecked() ) |
|||
m_params.gridRounding = m_roundingGrid.GetValue(); |
|||
else |
|||
m_params.gridRounding = std::nullopt; |
|||
|
|||
s_gridRoundValuePersist = m_roundingGrid.GetValue(); |
|||
|
|||
m_params.deleteSourceItems = m_deleteSourceItems->GetValue(); |
|||
|
|||
// Keep the recent values list up to date
|
|||
const auto saveRecentValue = []( std::vector<int>& aRecentValues, int aValue ) |
|||
{ |
|||
const auto it = std::find( aRecentValues.begin(), aRecentValues.end(), aValue ); |
|||
// Already have it
|
|||
if( it != aRecentValues.end() ) |
|||
return; |
|||
|
|||
aRecentValues.push_back( aValue ); |
|||
}; |
|||
|
|||
saveRecentValue( s_outsetRecentValues, m_params.outsetDistance ); |
|||
saveRecentValue( s_lineWidthRecentValues, m_params.lineWidth ); |
|||
if( m_params.gridRounding ) |
|||
saveRecentValue( s_gridRoundingRecentValues, m_params.gridRounding.value() ); |
|||
|
|||
return true; |
|||
} |
@ -0,0 +1,59 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors. |
|||
* |
|||
* 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 |
|||
*/ |
|||
|
|||
#pragma once |
|||
|
|||
#include <pcb_base_frame.h> |
|||
#include <dialogs/dialog_outset_items_base.h> |
|||
#include <widgets/text_ctrl_eval.h> |
|||
#include <widgets/unit_binder.h> |
|||
#include <tools/item_modification_routine.h> |
|||
|
|||
/** |
|||
* DIALOG_OUTSET_ITEMS, derived from DIALOG_OUTSET_ITEMS_BASE, |
|||
* created by wxFormBuilder |
|||
*/ |
|||
class DIALOG_OUTSET_ITEMS : public DIALOG_OUTSET_ITEMS_BASE |
|||
{ |
|||
public: |
|||
DIALOG_OUTSET_ITEMS( PCB_BASE_FRAME& aParent, OUTSET_ROUTINE::PARAMETERS& aParams ); |
|||
~DIALOG_OUTSET_ITEMS(); |
|||
|
|||
protected: |
|||
bool TransferDataToWindow() override; |
|||
bool TransferDataFromWindow() override; |
|||
|
|||
void OnLayerDefaultClick( wxCommandEvent& event ) override; |
|||
void OnCopyLayersChecked( wxCommandEvent& event ) override; |
|||
void OnRoundToGridChecked( wxCommandEvent& event ) override; |
|||
|
|||
private: |
|||
|
|||
PCB_BASE_FRAME& m_parent; |
|||
OUTSET_ROUTINE::PARAMETERS& m_params; |
|||
|
|||
UNIT_BINDER m_outset; |
|||
UNIT_BINDER m_lineWidth; |
|||
UNIT_BINDER m_roundingGrid; |
|||
}; |
|||
|
@ -0,0 +1,142 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "pcb_layer_box_selector.h"
|
|||
|
|||
#include "dialog_outset_items_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
DIALOG_OUTSET_ITEMS_BASE::DIALOG_OUTSET_ITEMS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) |
|||
{ |
|||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); |
|||
|
|||
wxBoxSizer* bMainSizer; |
|||
bMainSizer = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxGridBagSizer* gbSizer1; |
|||
gbSizer1 = new wxGridBagSizer( 0, 0 ); |
|||
gbSizer1->SetFlexibleDirection( wxBOTH ); |
|||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); |
|||
|
|||
m_outsetLabel = new wxStaticText( this, wxID_ANY, _("Outset:"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); |
|||
m_outsetLabel->Wrap( -1 ); |
|||
gbSizer1->Add( m_outsetLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); |
|||
|
|||
m_outsetEntry = new wxComboBox( this, wxID_ANY, _("0.1"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
|||
gbSizer1->Add( m_outsetEntry, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_outsetUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_outsetUnit->Wrap( -1 ); |
|||
gbSizer1->Add( m_outsetUnit, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_roundToGrid = new wxCheckBox( this, wxID_ANY, _("Round outwards to grid multiples (when possible)"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_roundToGrid->SetValue(true); |
|||
m_roundToGrid->SetToolTip( _("This is only possible for rectangular outsets.") ); |
|||
|
|||
gbSizer1->Add( m_roundToGrid, wxGBPosition( 2, 0 ), wxGBSpan( 1, 4 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_roundCorners = new wxCheckBox( this, wxID_ANY, _("Round corners (when possible)"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
gbSizer1->Add( m_roundCorners, wxGBPosition( 1, 0 ), wxGBSpan( 1, 4 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_gridRoundingLabel = new wxStaticText( this, wxID_ANY, _("Grid size:"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); |
|||
m_gridRoundingLabel->Wrap( -1 ); |
|||
gbSizer1->Add( m_gridRoundingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); |
|||
|
|||
m_gridRoundingEntry = new wxComboBox( this, wxID_ANY, _("0.01"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
|||
gbSizer1->Add( m_gridRoundingEntry, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_gridRoundingUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_gridRoundingUnit->Wrap( -1 ); |
|||
gbSizer1->Add( m_gridRoundingUnit, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); |
|||
gbSizer1->Add( m_staticline2, wxGBPosition( 4, 0 ), wxGBSpan( 1, 4 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_copyLayers = new wxCheckBox( this, wxID_ANY, _("Copy item layers"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
gbSizer1->Add( m_copyLayers, wxGBPosition( 5, 0 ), wxGBSpan( 1, 4 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_layerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); |
|||
m_layerLabel->Wrap( -1 ); |
|||
gbSizer1->Add( m_layerLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); |
|||
|
|||
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
|||
gbSizer1->Add( m_LayerSelectionCtrl, wxGBPosition( 6, 1 ), wxGBSpan( 1, 3 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_copyWidths = new wxCheckBox( this, wxID_ANY, _("Copy item widths (if possible)"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_copyWidths->SetToolTip( _("This is not possible for items like pads, which will still use the value below.") ); |
|||
|
|||
gbSizer1->Add( m_copyWidths, wxGBPosition( 7, 0 ), wxGBSpan( 1, 4 ), wxALL, 5 ); |
|||
|
|||
m_lineWidthLabel = new wxStaticText( this, wxID_ANY, _("Line width:"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); |
|||
m_lineWidthLabel->Wrap( -1 ); |
|||
gbSizer1->Add( m_lineWidthLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); |
|||
|
|||
m_lineWidthEntry = new wxComboBox( this, wxID_ANY, _("0.1"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
|||
gbSizer1->Add( m_lineWidthEntry, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); |
|||
|
|||
m_lineWidthUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_lineWidthUnit->Wrap( -1 ); |
|||
gbSizer1->Add( m_lineWidthUnit, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); |
|||
|
|||
m_layerDefaultBtn = new wxButton( this, wxID_ANY, _("Layer default"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
gbSizer1->Add( m_layerDefaultBtn, wxGBPosition( 8, 3 ), wxGBSpan( 1, 1 ), wxALL, 5 ); |
|||
|
|||
m_staticline21 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); |
|||
gbSizer1->Add( m_staticline21, wxGBPosition( 9, 0 ), wxGBSpan( 1, 4 ), wxEXPAND | wxALL, 5 ); |
|||
|
|||
m_deleteSourceItems = new wxCheckBox( this, wxID_ANY, _("Delete source items after outset"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_deleteSourceItems->SetToolTip( _("This is not possible for items like pads, which will still use the value below.") ); |
|||
|
|||
gbSizer1->Add( m_deleteSourceItems, wxGBPosition( 10, 0 ), wxGBSpan( 1, 4 ), wxALL, 5 ); |
|||
|
|||
|
|||
gbSizer1->AddGrowableCol( 1 ); |
|||
|
|||
bMainSizer->Add( gbSizer1, 1, wxEXPAND, 5 ); |
|||
|
|||
wxBoxSizer* bSizerBottom; |
|||
bSizerBottom = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
|
|||
bSizerBottom->Add( 40, 0, 1, wxEXPAND, 5 ); |
|||
|
|||
m_stdButtons = new wxStdDialogButtonSizer(); |
|||
m_stdButtonsOK = new wxButton( this, wxID_OK ); |
|||
m_stdButtons->AddButton( m_stdButtonsOK ); |
|||
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL ); |
|||
m_stdButtons->AddButton( m_stdButtonsCancel ); |
|||
m_stdButtons->Realize(); |
|||
|
|||
bSizerBottom->Add( m_stdButtons, 0, wxBOTTOM|wxTOP, 5 ); |
|||
|
|||
|
|||
bMainSizer->Add( bSizerBottom, 0, wxEXPAND|wxTOP, 5 ); |
|||
|
|||
|
|||
this->SetSizer( bMainSizer ); |
|||
this->Layout(); |
|||
bMainSizer->Fit( this ); |
|||
|
|||
// Connect Events
|
|||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnClose ) ); |
|||
m_roundToGrid->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnRoundToGridChecked ), NULL, this ); |
|||
m_copyLayers->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnCopyLayersChecked ), NULL, this ); |
|||
m_layerDefaultBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnLayerDefaultClick ), NULL, this ); |
|||
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnOkClick ), NULL, this ); |
|||
} |
|||
|
|||
DIALOG_OUTSET_ITEMS_BASE::~DIALOG_OUTSET_ITEMS_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnClose ) ); |
|||
m_roundToGrid->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnRoundToGridChecked ), NULL, this ); |
|||
m_copyLayers->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnCopyLayersChecked ), NULL, this ); |
|||
m_layerDefaultBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnLayerDefaultClick ), NULL, this ); |
|||
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_OUTSET_ITEMS_BASE::OnOkClick ), NULL, this ); |
|||
|
|||
} |
1403
pcbnew/dialogs/dialog_outset_items_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,82 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) |
|||
// http://www.wxformbuilder.org/ |
|||
// |
|||
// PLEASE DO *NOT* EDIT THIS FILE! |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
#pragma once |
|||
|
|||
#include <wx/artprov.h> |
|||
#include <wx/xrc/xmlres.h> |
|||
#include <wx/intl.h> |
|||
class PCB_LAYER_BOX_SELECTOR; |
|||
|
|||
#include "dialog_shim.h" |
|||
#include <wx/string.h> |
|||
#include <wx/stattext.h> |
|||
#include <wx/gdicmn.h> |
|||
#include <wx/font.h> |
|||
#include <wx/colour.h> |
|||
#include <wx/settings.h> |
|||
#include <wx/combobox.h> |
|||
#include <wx/checkbox.h> |
|||
#include <wx/statline.h> |
|||
#include <wx/bmpcbox.h> |
|||
#include <wx/button.h> |
|||
#include <wx/bitmap.h> |
|||
#include <wx/image.h> |
|||
#include <wx/icon.h> |
|||
#include <wx/gbsizer.h> |
|||
#include <wx/sizer.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_OUTSET_ITEMS_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_OUTSET_ITEMS_BASE : public DIALOG_SHIM |
|||
{ |
|||
private: |
|||
|
|||
protected: |
|||
wxStaticText* m_outsetLabel; |
|||
wxComboBox* m_outsetEntry; |
|||
wxStaticText* m_outsetUnit; |
|||
wxCheckBox* m_roundToGrid; |
|||
wxCheckBox* m_roundCorners; |
|||
wxStaticText* m_gridRoundingLabel; |
|||
wxComboBox* m_gridRoundingEntry; |
|||
wxStaticText* m_gridRoundingUnit; |
|||
wxStaticLine* m_staticline2; |
|||
wxCheckBox* m_copyLayers; |
|||
wxStaticText* m_layerLabel; |
|||
PCB_LAYER_BOX_SELECTOR* m_LayerSelectionCtrl; |
|||
wxCheckBox* m_copyWidths; |
|||
wxStaticText* m_lineWidthLabel; |
|||
wxComboBox* m_lineWidthEntry; |
|||
wxStaticText* m_lineWidthUnit; |
|||
wxButton* m_layerDefaultBtn; |
|||
wxStaticLine* m_staticline21; |
|||
wxCheckBox* m_deleteSourceItems; |
|||
wxStdDialogButtonSizer* m_stdButtons; |
|||
wxButton* m_stdButtonsOK; |
|||
wxButton* m_stdButtonsCancel; |
|||
|
|||
// Virtual event handlers, override them in your derived class |
|||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } |
|||
virtual void OnRoundToGridChecked( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnCopyLayersChecked( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnLayerDefaultClick( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
|
|||
DIALOG_OUTSET_ITEMS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Outset Items"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); |
|||
|
|||
~DIALOG_OUTSET_ITEMS_BASE(); |
|||
|
|||
}; |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue