Jeff Young 2024-03-11 22:57:02 +00:00
parent 865225fcca
commit d083593177
7 changed files with 103 additions and 34 deletions

View File

@ -2537,12 +2537,10 @@ void SCH_PAINTER::draw( const SCH_TABLE* aTable, int aLayer )
for( int row = 0; row < aTable->GetRowCount(); ++row ) for( int row = 0; row < aTable->GetRowCount(); ++row )
{ {
SCH_TABLECELL* cell = aTable->GetCell( row, col ); SCH_TABLECELL* cell = aTable->GetCell( row, col );
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ strokeLine( topRight, cell->GetEnd() );
strokeLine( VECTOR2I( cell->GetEndX(), cell->GetStartY() ),
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
}
} }
} }
} }
@ -2554,12 +2552,10 @@ void SCH_PAINTER::draw( const SCH_TABLE* aTable, int aLayer )
for( int col = 0; col < aTable->GetColCount(); ++col ) for( int col = 0; col < aTable->GetColCount(); ++col )
{ {
SCH_TABLECELL* cell = aTable->GetCell( row, col ); SCH_TABLECELL* cell = aTable->GetCell( row, col );
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ strokeLine( botLeft, cell->GetEnd() );
strokeLine( VECTOR2I( cell->GetStartX(), cell->GetEndY() ),
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
}
} }
} }
} }

View File

@ -32,6 +32,7 @@
#include <pcb_group.h> #include <pcb_group.h>
#include <pcb_marker.h> #include <pcb_marker.h>
#include <pcb_textbox.h> #include <pcb_textbox.h>
#include <pcb_table.h>
#include <pcb_shape.h> #include <pcb_shape.h>
#include <pad.h> #include <pad.h>
#include <zone.h> #include <zone.h>
@ -45,6 +46,7 @@
#include <pcb_dimension.h> #include <pcb_dimension.h>
#include <project_pcb.h> #include <project_pcb.h>
#include <dialogs/dialog_dimension_properties.h> #include <dialogs/dialog_dimension_properties.h>
#include <dialogs/dialog_table_properties.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -204,6 +206,15 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) ); ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
break; break;
case PCB_TABLE_T:
{
DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
//QuasiModal required for Scintilla auto-complete
dlg.ShowQuasiModal();
break;
}
case PCB_SHAPE_T : case PCB_SHAPE_T :
ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) ); ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
break; break;

View File

@ -2355,12 +2355,10 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
for( int row = 0; row < aTable->GetRowCount(); ++row ) for( int row = 0; row < aTable->GetRowCount(); ++row )
{ {
PCB_TABLECELL* cell = aTable->GetCell( row, col ); PCB_TABLECELL* cell = aTable->GetCell( row, col );
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ strokeLine( topRight, cell->GetEnd() );
strokeLine( VECTOR2I( cell->GetEndX(), cell->GetStartY() ),
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
}
} }
} }
} }
@ -2372,12 +2370,10 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer )
for( int col = 0; col < aTable->GetColCount(); ++col ) for( int col = 0; col < aTable->GetColCount(); ++col )
{ {
PCB_TABLECELL* cell = aTable->GetCell( row, col ); PCB_TABLECELL* cell = aTable->GetCell( row, col );
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 ) if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
{ strokeLine( botLeft, cell->GetEnd() );
strokeLine( VECTOR2I( cell->GetStartX(), cell->GetEndY() ),
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
}
} }
} }
} }

View File

@ -23,7 +23,9 @@
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <pcb_table.h> #include <pcb_table.h>
#include <geometry/shape_simple.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_compound.h>
PCB_TABLE::PCB_TABLE( BOARD_ITEM* aParent, int aLineWidth ) : PCB_TABLE::PCB_TABLE( BOARD_ITEM* aParent, int aLineWidth ) :
@ -224,12 +226,83 @@ const BOX2I PCB_TABLE::GetBoundingBox() const
} }
std::shared_ptr<SHAPE> PCB_TABLE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
{
VECTOR2I origin = GetPosition();
VECTOR2I end = GetEnd();
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
std::vector<VECTOR2I> pts;
pts.emplace_back( origin );
pts.emplace_back( end.x, origin.y );
pts.emplace_back( end );
pts.emplace_back( origin.x, end.y );
shape->AddShape( new SHAPE_SIMPLE( pts ) );
auto addSeg =
[&shape]( const VECTOR2I& ptA, const VECTOR2I& ptB, int width )
{
shape->AddShape( new SHAPE_SEGMENT( ptA, ptB, width ) );
};
if( StrokeColumns() && GetSeparatorsStroke().GetWidth() >= 0)
{
for( int col = 0; col < GetColCount() - 1; ++col )
{
for( int row = 0; row < GetRowCount(); ++row )
{
PCB_TABLECELL* cell = GetCell( row, col );
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
addSeg( topRight, cell->GetEnd(), GetSeparatorsStroke().GetWidth() );
}
}
}
if( StrokeRows() && GetSeparatorsStroke().GetWidth() >= 0 )
{
for( int row = 0; row < GetRowCount() - 1; ++row )
{
for( int col = 0; col < GetColCount(); ++col )
{
PCB_TABLECELL* cell = GetCell( row, col );
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
addSeg( botLeft, cell->GetEnd(), GetSeparatorsStroke().GetWidth() );
}
}
}
if( StrokeExternal() && GetBorderStroke().GetWidth() >= 0 )
{
addSeg( pts[0], pts[1], GetBorderStroke().GetWidth() );
addSeg( pts[1], pts[2], GetBorderStroke().GetWidth() );
addSeg( pts[2], pts[3], GetBorderStroke().GetWidth() );
addSeg( pts[3], pts[0], GetBorderStroke().GetWidth() );
}
return shape;
}
void PCB_TABLE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, void PCB_TABLE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
int aClearance, int aMaxError, ERROR_LOC aErrorLoc, int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const bool aIgnoreLineWidth ) const
{ {
int gap = aClearance;
if( StrokeColumns() || StrokeRows() )
gap = std::max( gap, aClearance + GetSeparatorsStroke().GetWidth() / 2 );
if( StrokeExternal() || StrokeHeader() )
gap = std::max( gap, aClearance + GetBorderStroke().GetWidth() / 2 );
for( PCB_TABLECELL* cell : m_cells ) for( PCB_TABLECELL* cell : m_cells )
cell->TransformShapeToPolygon( aBuffer, aLayer, aClearance, aMaxError, aErrorLoc, false ); cell->TransformShapeToPolygon( aBuffer, aLayer, gap, aMaxError, aErrorLoc, false );
} }

View File

@ -191,6 +191,10 @@ public:
const BOX2I GetBoundingBox() const override; const BOX2I GetBoundingBox() const override;
// @copydoc BOARD_ITEM::GetEffectiveShape
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING aFlash = FLASHING::DEFAULT ) const override;
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance, void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc, int aMaxError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override; bool aIgnoreLineWidth = false ) const override;

View File

@ -136,9 +136,8 @@ public:
bool aIgnoreLineWidth = false ) const override; bool aIgnoreLineWidth = false ) const override;
// @copydoc BOARD_ITEM::GetEffectiveShape // @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER, FLASHING aFlash = FLASHING::DEFAULT ) const override;
FLASHING aFlash = FLASHING::DEFAULT ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;

View File

@ -35,6 +35,9 @@
#include <pcb_track.h> #include <pcb_track.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <pcb_textbox.h> #include <pcb_textbox.h>
#include <pcb_tablecell.h>
#include <pcb_table.h>
#include <pcb_dimension.h>
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <board_commit.h> #include <board_commit.h>
@ -46,7 +49,6 @@
#include <core/thread_pool.h> #include <core/thread_pool.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include "zone_filler.h" #include "zone_filler.h"
#include "pcb_dimension.h"
ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) : ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
@ -828,19 +830,7 @@ void ZONE_FILLER::addKnockout( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer, int aGap,
} }
case PCB_TEXTBOX_T: case PCB_TEXTBOX_T:
{
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( aItem );
if( textbox->IsVisible() )
textbox->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE );
break;
}
case PCB_TABLE_T: case PCB_TABLE_T:
// JEY TODO: tables
break;
case PCB_SHAPE_T: case PCB_SHAPE_T:
case PCB_TARGET_T: case PCB_TARGET_T:
aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE, aItem->TransformShapeToPolygon( aHoles, aLayer, aGap, m_maxError, ERROR_OUTSIDE,