Naming updates.

This commit is contained in:
Jeff Young 2020-10-15 00:37:26 +01:00
parent 858718b949
commit 92d84b0d67
39 changed files with 583 additions and 587 deletions

View File

@ -288,7 +288,7 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
// Update the dummy module for the preview
UpdateDummyModule( false );
UpdateDummyFootprint( false );
}
}
@ -303,7 +303,7 @@ void PANEL_PREV_3D::onOpacitySlider( wxCommandEvent& event )
modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
// Update the dummy module for the preview
UpdateDummyModule( false );
UpdateDummyFootprint( false );
}
}
@ -449,7 +449,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
}
void PANEL_PREV_3D::UpdateDummyModule( bool aReloadRequired )
void PANEL_PREV_3D::UpdateDummyFootprint( bool aReloadRequired )
{
m_dummyModule->Models().clear();

View File

@ -210,7 +210,7 @@ public:
* @brief UpdateModelInfoList - copy shapes from the current shape list which are flagged
* for preview to the copy of module that is on the preview dummy board
*/
void UpdateDummyModule( bool aRelaodRequired = true );
void UpdateDummyFootprint( bool aRelaodRequired = true );
};
#endif // PANEL_PREV_MODEL_H

View File

@ -311,7 +311,7 @@ public:
*/
void PlaceModule( MODULE* aModule, bool aRecreateRatsnest = true );
void InstallPadOptionsFrame( D_PAD* pad );
void ShowPadPropertiesDialog( D_PAD* aPad );
/**
* Function SelectFootprintFromLibTree

View File

@ -71,8 +71,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_dimension_properties_base.cpp
dialogs/dialog_drc.cpp
dialogs/dialog_drc_base.cpp
dialogs/dialog_edit_footprint_for_BoardEditor.cpp
dialogs/dialog_edit_footprint_for_BoardEditor_base.cpp
dialogs/dialog_footprint_properties.cpp
dialogs/dialog_footprint_properties_base.cpp
dialogs/dialog_edit_footprint_for_fp_editor.cpp
dialogs/dialog_edit_footprint_for_fp_editor_base.cpp
dialogs/dialog_enum_pads.cpp

View File

@ -503,15 +503,15 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
{
case LAYER_RATSNEST:
{
// because we have a tool to show/hide ratsnest relative to a pad or a module
// because we have a tool to show/hide ratsnest relative to a pad or a footprint
// so the hide/show option is a per item selection
for( TRACK* track : Tracks() )
track->SetLocalRatsnestVisible( isEnabled );
for( MODULE* mod : Modules() )
for( MODULE* footprint : Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : footprint->Pads() )
pad->SetLocalRatsnestVisible( isEnabled );
}
@ -763,36 +763,36 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID ) const
return track;
}
for( MODULE* module : Modules() )
for( MODULE* footprint : Modules() )
{
if( module->m_Uuid == aID )
return module;
if( footprint->m_Uuid == aID )
return footprint;
for( D_PAD* pad : module->Pads() )
for( D_PAD* pad : footprint->Pads() )
{
if( pad->m_Uuid == aID )
return pad;
}
if( module->Reference().m_Uuid == aID )
return &module->Reference();
if( footprint->Reference().m_Uuid == aID )
return &footprint->Reference();
if( module->Value().m_Uuid == aID )
return &module->Value();
if( footprint->Value().m_Uuid == aID )
return &footprint->Value();
for( BOARD_ITEM* drawing : module->GraphicalItems() )
for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
{
if( drawing->m_Uuid == aID )
return drawing;
}
for( BOARD_ITEM* zone : module->Zones() )
for( BOARD_ITEM* zone : footprint->Zones() )
{
if( zone->m_Uuid == aID )
return zone;
}
for( PCB_GROUP* group : module->Groups() )
for( PCB_GROUP* group : footprint->Groups() )
{
if( group->m_Uuid == aID )
return group;
@ -839,17 +839,17 @@ void BOARD::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
for( TRACK* track : Tracks() )
aMap[ track->m_Uuid ] = track;
for( MODULE* module : Modules() )
for( MODULE* footprint : Modules() )
{
aMap[ module->m_Uuid ] = module;
aMap[ footprint->m_Uuid ] = footprint;
for( D_PAD* pad : module->Pads() )
for( D_PAD* pad : footprint->Pads() )
aMap[ pad->m_Uuid ] = pad;
aMap[ module->Reference().m_Uuid ] = &module->Reference();
aMap[ module->Value().m_Uuid ] = &module->Value();
aMap[ footprint->Reference().m_Uuid ] = &footprint->Reference();
aMap[ footprint->Value().m_Uuid ] = &footprint->Value();
for( BOARD_ITEM* drawing : module->GraphicalItems() )
for( BOARD_ITEM* drawing : footprint->GraphicalItems() )
aMap[ drawing->m_Uuid ] = drawing;
}
@ -895,14 +895,14 @@ wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource )
wxString remainder;
wxString ref = token.BeforeFirst( ':', &remainder );
for( MODULE* mod : Modules() )
for( MODULE* footprint : Modules() )
{
if( mod->GetReference().CmpNoCase( ref ) == 0 )
if( footprint->GetReference().CmpNoCase( ref ) == 0 )
{
wxString test( remainder );
if( mod->ResolveTextVar( &test ) )
token = mod->m_Uuid.AsString() + ":" + remainder;
if( footprint->ResolveTextVar( &test ) )
token = footprint->m_Uuid.AsString() + ":" + remainder;
break;
}
@ -970,9 +970,9 @@ unsigned BOARD::GetNodesCount( int aNet )
{
unsigned retval = 0;
for( MODULE* mod : Modules() )
for( MODULE* footprint : Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : footprint->Pads() )
{
if( ( aNet == -1 && pad->GetNetCode() > 0 ) || aNet == pad->GetNetCode() )
retval++;
@ -1006,15 +1006,15 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
area.Merge( item->GetBoundingBox() );
}
// Check modules
for( MODULE* module : m_modules )
// Check footprints
for( MODULE* footprint : m_modules )
{
if( !( module->GetLayerSet() & visible ).any() )
if( !( footprint->GetLayerSet() & visible ).any() )
continue;
if( aBoardEdgesOnly )
{
for( const BOARD_ITEM* edge : module->GraphicalItems() )
for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
{
if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
area.Merge( edge->GetBoundingBox() );
@ -1022,7 +1022,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
}
else
{
area.Merge( module->GetBoundingBox( showInvisibleText ) );
area.Merge( footprint->GetBoundingBox( showInvisibleText ) );
}
}
@ -1249,10 +1249,10 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
{
for( MODULE* module : m_modules )
for( MODULE* footprint : m_modules )
{
if( aReference == module->GetReference() )
return module;
if( aReference == footprint->GetReference() )
return footprint;
}
return nullptr;
@ -1261,10 +1261,10 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
MODULE* BOARD::FindModuleByPath( const KIID_PATH& aPath ) const
{
for( MODULE* module : m_modules )
for( MODULE* footprint : m_modules )
{
if( module->GetPath() == aPath )
return module;
if( footprint->GetPath() == aPath )
return footprint;
}
return nullptr;
@ -1310,7 +1310,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
for( NETINFO_ITEM* net : m_NetInfo )
{
auto netcode = net->GetNet();
int netcode = net->GetNet();
if( netcode > 0 && net->IsCurrent() )
{
@ -1443,12 +1443,12 @@ D_PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet )
if( !aLayerSet.any() )
aLayerSet = LSET::AllCuMask();
for( auto module : m_modules )
for( MODULE* footprint : m_modules )
{
D_PAD* pad = NULL;
if( module->HitTest( aPosition ) )
pad = module->GetPad( aPosition, aLayerSet );
if( footprint->HitTest( aPosition ) )
pad = footprint->GetPad( aPosition, aLayerSet );
if( pad )
return pad;
@ -1470,9 +1470,9 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet )
{
for( auto mod : Modules() )
for( MODULE* footprint : Modules() )
{
for ( auto pad : mod->Pads() )
for( D_PAD* pad : footprint->Pads() )
{
if( pad->GetPosition() != aPosition )
continue;
@ -1596,14 +1596,12 @@ bool sortPadsByXthenYCoord( D_PAD* const & ref, D_PAD* const & comp )
void BOARD::GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNetCode )
{
for ( auto mod : Modules() )
for( MODULE* footprint : Modules() )
{
for ( auto pad : mod->Pads( ) )
for( D_PAD* pad : footprint->Pads( ) )
{
if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
{
aVector.push_back( pad );
}
}
}
@ -1630,18 +1628,18 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, PCB_PAD_T, EOT };
auto connectivity = GetBoard()->GetConnectivity();
for( auto item : connectivity->GetConnectedItems(
for( BOARD_CONNECTED_ITEM* item : connectivity->GetConnectedItems(
static_cast<const BOARD_CONNECTED_ITEM*>( &aTrack ), types ) )
{
count++;
if( auto track = dyn_cast<TRACK*>( item ) )
if( TRACK* track = dyn_cast<TRACK*>( item ) )
{
bool inPad = false;
for( auto pad_it : connectivity->GetConnectedPads( item ) )
{
auto pad = static_cast<D_PAD*>( pad_it );
D_PAD* pad = static_cast<D_PAD*>( pad_it );
if( pad->HitTest( track->GetStart(), track->GetWidth() / 2 )
&& pad->HitTest( track->GetEnd(), track->GetWidth() / 2 ) )
@ -1654,8 +1652,10 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
if( !inPad )
length += track->GetLength();
}
else if( auto pad = dyn_cast<D_PAD*>( item ) )
else if( D_PAD* pad = dyn_cast<D_PAD*>( item ) )
{
package_length += pad->GetPadToDieLength();
}
}
return std::make_tuple( count, length, package_length );
@ -1665,28 +1665,28 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked )
{
MODULE* module = NULL;
MODULE* alt_module = NULL;
int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF;
MODULE* footprint = NULL;
MODULE* alt_footprint = NULL;
int min_dim = 0x7FFFFFFF;
int alt_min_dim = 0x7FFFFFFF;
bool current_layer_back = IsBackLayer( aActiveLayer );
for( auto pt_module : m_modules )
for( MODULE* candidate : m_modules )
{
// is the ref point within the module's bounds?
if( !pt_module->HitTest( aPosition ) )
// is the ref point within the footprint's bounds?
if( !candidate->HitTest( aPosition ) )
continue;
// if caller wants to ignore locked modules, and this one is locked, skip it.
if( aIgnoreLocked && pt_module->IsLocked() )
// if caller wants to ignore locked footprints, and this one is locked, skip it.
if( aIgnoreLocked && candidate->IsLocked() )
continue;
PCB_LAYER_ID layer = pt_module->GetLayer();
PCB_LAYER_ID layer = candidate->GetLayer();
// Filter non visible modules if requested
// Filter non visible footprints if requested
if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
{
EDA_RECT bb = pt_module->GetFootprintRect();
EDA_RECT bb = candidate->GetFootprintRect();
int offx = bb.GetX() + bb.GetWidth() / 2;
int offy = bb.GetY() + bb.GetHeight() / 2;
@ -1700,7 +1700,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
if( dist <= min_dim )
{
// better footprint shown on the active side
module = pt_module;
footprint = candidate;
min_dim = dist;
}
}
@ -1709,22 +1709,18 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
if( dist <= alt_min_dim )
{
// better footprint shown on the other side
alt_module = pt_module;
alt_footprint = candidate;
alt_min_dim = dist;
}
}
}
}
if( module )
{
return module;
}
if( footprint )
return footprint;
if( alt_module)
{
return alt_module;
}
if( alt_footprint)
return alt_footprint;
return NULL;
}
@ -1739,9 +1735,9 @@ std::list<ZONE_CONTAINER*> BOARD::GetZoneList( bool aIncludeZonesInFootprints )
if( aIncludeZonesInFootprints )
{
for( MODULE* mod : m_modules )
for( MODULE* footprint : m_modules )
{
for( MODULE_ZONE_CONTAINER* zone : mod->Zones() )
for( MODULE_ZONE_CONTAINER* zone : footprint->Zones() )
zones.push_back( zone );
}
}
@ -1869,9 +1865,9 @@ const std::vector<D_PAD*> BOARD::GetPads()
{
std::vector<D_PAD*> allPads;
for( MODULE* mod : Modules() )
for( MODULE* footprint : Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : footprint->Pads() )
allPads.push_back( pad );
}
@ -1883,8 +1879,8 @@ unsigned BOARD::GetPadCount()
{
unsigned retval = 0;
for( MODULE* mod : Modules() )
retval += mod->Pads().size();
for( MODULE* footprint : Modules() )
retval += footprint->Pads().size();
return retval;
}
@ -1897,9 +1893,9 @@ const std::vector<BOARD_CONNECTED_ITEM*> BOARD::AllConnectedItems()
for( TRACK* track : Tracks() )
items.push_back( track );
for( MODULE* mod : Modules() )
for( MODULE* footprint : Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : footprint->Pads() )
items.push_back( pad );
}

View File

@ -63,39 +63,39 @@ MODULE::MODULE( BOARD* parent ) :
}
MODULE::MODULE( const MODULE& aModule ) :
BOARD_ITEM_CONTAINER( aModule )
MODULE::MODULE( const MODULE& aFootprint ) :
BOARD_ITEM_CONTAINER( aFootprint )
{
m_Pos = aModule.m_Pos;
m_fpid = aModule.m_fpid;
m_Attributs = aModule.m_Attributs;
m_ModuleStatus = aModule.m_ModuleStatus;
m_Orient = aModule.m_Orient;
m_BoundaryBox = aModule.m_BoundaryBox;
m_CntRot90 = aModule.m_CntRot90;
m_CntRot180 = aModule.m_CntRot180;
m_LastEditTime = aModule.m_LastEditTime;
m_Link = aModule.m_Link;
m_Path = aModule.m_Path;
m_Pos = aFootprint.m_Pos;
m_fpid = aFootprint.m_fpid;
m_Attributs = aFootprint.m_Attributs;
m_ModuleStatus = aFootprint.m_ModuleStatus;
m_Orient = aFootprint.m_Orient;
m_BoundaryBox = aFootprint.m_BoundaryBox;
m_CntRot90 = aFootprint.m_CntRot90;
m_CntRot180 = aFootprint.m_CntRot180;
m_LastEditTime = aFootprint.m_LastEditTime;
m_Link = aFootprint.m_Link;
m_Path = aFootprint.m_Path;
m_LocalClearance = aModule.m_LocalClearance;
m_LocalSolderMaskMargin = aModule.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aModule.m_ZoneConnection;
m_ThermalWidth = aModule.m_ThermalWidth;
m_ThermalGap = aModule.m_ThermalGap;
m_LocalClearance = aFootprint.m_LocalClearance;
m_LocalSolderMaskMargin = aFootprint.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aFootprint.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aFootprint.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aFootprint.m_ZoneConnection;
m_ThermalWidth = aFootprint.m_ThermalWidth;
m_ThermalGap = aFootprint.m_ThermalGap;
// Copy reference and value.
m_Reference = new FP_TEXT( *aModule.m_Reference );
m_Reference = new FP_TEXT( *aFootprint.m_Reference );
m_Reference->SetParent( this );
m_Value = new FP_TEXT( *aModule.m_Value );
m_Value = new FP_TEXT( *aFootprint.m_Value );
m_Value->SetParent( this );
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
// Copy pads
for( D_PAD* pad : aModule.Pads() )
for( D_PAD* pad : aFootprint.Pads() )
{
D_PAD* newPad = static_cast<D_PAD*>( pad->Clone() );
ptrMap[ pad ] = newPad;
@ -103,7 +103,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Copy zones
for( MODULE_ZONE_CONTAINER* zone : aModule.Zones() )
for( MODULE_ZONE_CONTAINER* zone : aFootprint.Zones() )
{
MODULE_ZONE_CONTAINER* newZone = static_cast<MODULE_ZONE_CONTAINER*>( zone->Clone() );
ptrMap[ zone ] = newZone;
@ -117,7 +117,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Copy drawings
for( BOARD_ITEM* item : aModule.GraphicalItems() )
for( BOARD_ITEM* item : aFootprint.GraphicalItems() )
{
BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
ptrMap[ item ] = newItem;
@ -125,7 +125,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Copy groups
for( PCB_GROUP* group : aModule.Groups() )
for( PCB_GROUP* group : aFootprint.Groups() )
{
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
ptrMap[ group ] = newGroup;
@ -133,7 +133,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Rebuild groups
for( PCB_GROUP* group : aModule.Groups() )
for( PCB_GROUP* group : aFootprint.Groups() )
{
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
@ -144,26 +144,26 @@ MODULE::MODULE( const MODULE& aModule ) :
}
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings = aModule.m_3D_Drawings;
m_3D_Drawings = aFootprint.m_3D_Drawings;
m_Doc = aModule.m_Doc;
m_KeyWord = aModule.m_KeyWord;
m_properties = aModule.m_properties;
m_Doc = aFootprint.m_Doc;
m_KeyWord = aFootprint.m_KeyWord;
m_properties = aFootprint.m_properties;
m_arflag = 0;
// Ensure auxiliary data is up to date
CalculateBoundingBox();
m_initial_comments = aModule.m_initial_comments ?
new wxArrayString( *aModule.m_initial_comments ) : nullptr;
m_initial_comments = aFootprint.m_initial_comments ?
new wxArrayString( *aFootprint.m_initial_comments ) : nullptr;
}
MODULE::MODULE( MODULE&& aModule ) :
BOARD_ITEM_CONTAINER( aModule )
MODULE::MODULE( MODULE&& aFootprint ) :
BOARD_ITEM_CONTAINER( aFootprint )
{
*this = std::move( aModule );
*this = std::move( aFootprint );
}
@ -429,7 +429,7 @@ void MODULE::ClearAllNets()
{
// Force the ORPHANED dummy net info for all pads.
// ORPHANED dummy net does not depend on a board
for( auto pad : m_pads )
for( D_PAD* pad : m_pads )
pad->SetNetCode( NETINFO_LIST::ORPHANED );
}
@ -606,13 +606,14 @@ EDA_RECT MODULE::GetFpPadsLocalBbox() const
MODULE dummy( *this );
dummy.SetPosition( wxPoint( 0, 0 ) );
if( dummy.IsFlipped() )
dummy.Flip( wxPoint( 0, 0 ) , false );
if( dummy.GetOrientation() )
dummy.SetOrientation( 0 );
for( auto pad : dummy.Pads() )
for( D_PAD* pad : dummy.Pads() )
area.Merge( pad->GetBoundingBox() );
return area;
@ -744,12 +745,12 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
}
auto addToken = []( wxString* aStr, const wxString& aAttr )
{
if( !aStr->IsEmpty() )
*aStr += wxT( ", " );
{
if( !aStr->IsEmpty() )
*aStr += wxT( ", " );
*aStr += aAttr;
};
*aStr += aAttr;
};
wxString status;
wxString attrs;
@ -1120,7 +1121,8 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
switch( m_Layer )
{
default:
wxASSERT_MSG( false, "Illegal layer" ); // do you really have modules placed on other layers?
wxASSERT_MSG( false, "Illegal layer" ); // do you really have footprints placed on
// other layers?
KI_FALLTHROUGH;
case F_Cu:
@ -1136,7 +1138,7 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
// layer as well so that the component can be edited with the silkscreen layer
bool f_silk = false, b_silk = false, non_silk = false;
for( auto item : m_drawings )
for( BOARD_ITEM* item : m_drawings )
{
if( item->GetLayer() == F_SilkS )
f_silk = true;
@ -1250,7 +1252,7 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
// Move module to its final position:
// Move footprint to its final position:
wxPoint finalPos = m_Pos;
// Now Flip the footprint.
@ -1276,11 +1278,11 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
NORMALIZE_ANGLE_180( m_Orient );
// Mirror pads to other side of board.
for( auto pad : m_pads )
for( D_PAD* pad : m_pads )
pad->Flip( m_Pos, false );
// Mirror zones to other side of board.
for( auto zone : m_fp_zones )
for( ZONE_CONTAINER* zone : m_fp_zones )
zone->Flip( m_Pos, aFlipLeftRight );
// Mirror reference and value.
@ -1288,7 +1290,7 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
m_Value->Flip( m_Pos, false );
// Reverse mirror module graphics and texts.
for( auto item : m_drawings )
for( BOARD_ITEM* item : m_drawings )
{
switch( item->Type() )
{
@ -1323,15 +1325,13 @@ void MODULE::SetPosition( const wxPoint& aPos )
m_Reference->EDA_TEXT::Offset( delta );
m_Value->EDA_TEXT::Offset( delta );
for( auto pad : m_pads )
{
for( D_PAD* pad : m_pads )
pad->SetPosition( pad->GetPosition() + delta );
}
for( auto zone : m_fp_zones )
for( ZONE_CONTAINER* zone : m_fp_zones )
zone->Move( delta );
for( auto item : m_drawings )
for( BOARD_ITEM* item : m_drawings )
{
switch( item->Type() )
{
@ -1540,7 +1540,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
break;
case PCB_MODULE_T:
// Ignore the module itself
// Ignore the footprint itself
break;
default:
@ -1573,9 +1573,11 @@ wxString MODULE::GetNextPadName( const wxString& aLastPadName ) const
void MODULE::IncrementReference( int aDelta )
{
const auto& refdes = GetReference();
SetReference( wxString::Format( wxT( "%s%i" ), UTIL::GetReferencePrefix( refdes ),
GetTrailingInt( refdes ) + aDelta ) );
const wxString& refdes = GetReference();
SetReference( wxString::Format( wxT( "%s%i" ),
UTIL::GetReferencePrefix( refdes ),
GetTrailingInt( refdes ) + aDelta ) );
}
@ -1584,6 +1586,7 @@ void MODULE::IncrementReference( int aDelta )
static double polygonArea( SHAPE_POLY_SET& aPolySet )
{
double area = 0.0;
for( int ii = 0; ii < aPolySet.OutlineCount(); ii++ )
{
SHAPE_LINE_CHAIN& outline = aPolySet.Outline( ii );
@ -1609,14 +1612,14 @@ static void addRect( SHAPE_POLY_SET& aPolySet, wxRect aRect )
double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
{
double moduleArea = GetFootprintRect().GetArea();
double fpArea = GetFootprintRect().GetArea();
SHAPE_POLY_SET coveredRegion;
addRect( coveredRegion, GetFootprintRect() );
// build list of holes (covered areas not available for selection)
SHAPE_POLY_SET holes;
for( auto pad : m_pads )
for( D_PAD* pad : m_pads )
addRect( holes, pad->GetBoundingBox() );
addRect( holes, m_Reference->GetBoundingBox() );
@ -1655,8 +1658,8 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
}
double uncoveredRegionArea = polygonArea( uncoveredRegion );
double coveredArea = moduleArea - uncoveredRegionArea;
double ratio = ( coveredArea / moduleArea );
double coveredArea = fpArea - uncoveredRegionArea;
double ratio = ( coveredArea / fpArea );
return std::min( ratio, 1.0 );
}
@ -1664,7 +1667,8 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
// see convert_drawsegment_list_to_polygon.cpp:
extern bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET& aPolygons,
wxString* aErrorText, unsigned int aTolerance, wxPoint* aErrorLocation = nullptr );
wxString* aErrorText, unsigned int aTolerance,
wxPoint* aErrorLocation = nullptr );
std::shared_ptr<SHAPE> MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const

View File

@ -109,10 +109,10 @@ class MODULE : public BOARD_ITEM_CONTAINER
public:
MODULE( BOARD* parent );
MODULE( const MODULE& aModule );
MODULE( const MODULE& aFootprint );
// Move constructor and operator needed due to std containers inside the module
MODULE( MODULE&& aModule );
MODULE( MODULE&& aFootprint );
~MODULE();

View File

@ -37,8 +37,8 @@
#include <settings/settings_manager.h>
#include <trigo.h>
ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule )
: BOARD_CONNECTED_ITEM( aParent, aInModule ? PCB_FP_ZONE_AREA_T : PCB_ZONE_AREA_T ),
ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInFP )
: BOARD_CONNECTED_ITEM( aParent, aInFP ? PCB_FP_ZONE_AREA_T : PCB_ZONE_AREA_T ),
m_area( 0.0 )
{
m_CornerSelection = nullptr; // no corner is selected
@ -57,17 +57,17 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule )
m_hatchBorderAlgorithm = 1; // 0 = use zone min thickness; 1 = use hatch width
m_priority = 0;
m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
SetIsRuleArea( aInModule ? true : false ); // Zones living in modules have the rule area option
SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
SetIsRuleArea( aInFP ); // Zones living in footprints have the rule area option
SetDoNotAllowCopperPour( false ); // has meaning only if m_isRuleArea == true
SetDoNotAllowVias( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowTracks( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowPads( true ); // has meaning only if m_isRuleArea == true
SetDoNotAllowFootprints( false ); // has meaning only if m_isRuleArea == true
m_cornerRadius = 0;
SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
m_Poly = new SHAPE_POLY_SET(); // Outlines
m_fillVersion = 5; // set the "old" way to build filled polygon areas (before 6.0.x)
m_islandRemovalMode = ISLAND_REMOVAL_MODE::ALWAYS;
SetLocalFlags( 0 ); // flags tempoarry used in zone calculations
m_Poly = new SHAPE_POLY_SET(); // Outlines
m_fillVersion = 5; // set the "old" way to build filled polygon areas (< 6.0.x)
m_islandRemovalMode = ISLAND_REMOVAL_MODE::ALWAYS;
aParent->GetZoneSettings().ExportSetting( *this );
m_needRefill = false; // True only after some edition.
@ -1395,8 +1395,8 @@ static struct ZONE_CONTAINER_DESC
&ZONE_CONTAINER::SetThermalReliefGap, &ZONE_CONTAINER::GetThermalReliefGap,
PROPERTY_DISPLAY::DISTANCE ) );
propMgr.AddProperty( new PROPERTY<ZONE_CONTAINER, int>( _( "Thermal Spoke Width" ),
&ZONE_CONTAINER::SetThermalReliefSpokeWidth, &ZONE_CONTAINER::GetThermalReliefSpokeWidth,
PROPERTY_DISPLAY::DISTANCE ) );
&ZONE_CONTAINER::SetThermalReliefSpokeWidth, &ZONE_CONTAINER::GetThermalReliefSpokeWidth,
PROPERTY_DISPLAY::DISTANCE ) );
}
} _ZONE_CONTAINER_DESC;

View File

@ -65,12 +65,12 @@ public:
/**
* The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER
* requirement.
* if aInModule is true, a MODULE_ZONE_CONTAINER is actually built
* if aInFP is true, a MODULE_ZONE_CONTAINER is actually built
* (same item, but with a specific type id:
* The type is PCB_ZONE_AREA_T for a ZONE_CONTAINER
* The type is PCB_FP_ZONE_AREA_T for a MODULE_ZONE_CONTAINER
*/
ZONE_CONTAINER( BOARD_ITEM_CONTAINER* parent, bool aInModule = false );
ZONE_CONTAINER( BOARD_ITEM_CONTAINER* parent, bool aInFP = false );
ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );

View File

@ -405,7 +405,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT( "1" ) );
}
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
@ -422,7 +422,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnRemove3DModel( wxCommandEvent& )
m_modelsGrid->DeleteRows( idx );
select3DModel( idx ); // will clamp idx within bounds
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
}
@ -490,7 +490,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
select3DModel( idx );
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
@ -795,7 +795,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnDeleteField( wxCommandEvent& event )
void DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath( wxCommandEvent& event )
{
if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}

View File

@ -56,13 +56,14 @@ bool g_resetFabricationAttrs[2] = { false, true };
bool g_reset3DModels[2] = { false, true };
DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule,
DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
MODULE* aFootprint,
bool updateMode, bool selectedMode ) :
DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ),
m_commit( aParent ),
m_parent( aParent ),
m_currentModule( aModule ),
m_updateMode( updateMode )
DIALOG_EXCHANGE_FOOTPRINTS_BASE( aParent ),
m_commit( aParent ),
m_parent( aParent ),
m_currentFootprint( aFootprint ),
m_updateMode( updateMode )
{
wxString title = updateMode ? _( "Update Footprints from Library" ) : _( "Change Footprints" );
wxString verb = updateMode ? _( "Update" ) : _( "Change" );
@ -83,11 +84,11 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_newIDBrowseButton->SetBitmap( KiBitmap( small_library_xpm ) );
}
if( m_currentModule )
if( m_currentFootprint )
{
label.Printf( m_matchSelected->GetLabel(), verb );
m_matchSelected->SetLabel( label );
m_newID->AppendText( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
m_newID->AppendText( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) );
}
else
m_upperSizer->FindItem( m_matchSelected )->Show( false );
@ -96,20 +97,20 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_matchSpecifiedRef->SetLabel( label );
// Use ChangeValue() instead of SetValue() so we don't generate events.
if( m_currentModule )
m_specifiedRef->ChangeValue( m_currentModule->GetReference() );
if( m_currentFootprint )
m_specifiedRef->ChangeValue( m_currentFootprint->GetReference() );
label.Printf( m_matchSpecifiedValue->GetLabel(), verb );
m_matchSpecifiedValue->SetLabel( label );
if( m_currentModule )
m_specifiedValue->ChangeValue( m_currentModule->GetValue() );
if( m_currentFootprint )
m_specifiedValue->ChangeValue( m_currentFootprint->GetValue() );
label.Printf( m_matchSpecifiedID->GetLabel(), verb );
m_matchSpecifiedID->SetLabel( label );
if( m_currentModule )
m_specifiedID->ChangeValue( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
if( m_currentFootprint )
m_specifiedID->ChangeValue( FROM_UTF8( m_currentFootprint->GetFPID().Format().c_str() ) );
m_specifiedIDBrowseButton->SetBitmap( KiBitmap( small_library_xpm ) );
@ -181,7 +182,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::~DIALOG_EXCHANGE_FOOTPRINTS()
}
bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( MODULE* aModule )
bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( MODULE* aFootprint )
{
LIB_ID specifiedID;
@ -190,14 +191,14 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::isMatch( MODULE* aModule )
case ID_MATCH_FP_ALL:
return true;
case ID_MATCH_FP_SELECTED:
return aModule == m_currentModule;
return aFootprint == m_currentFootprint;
case ID_MATCH_FP_REF:
return WildCompareString( m_specifiedRef->GetValue(), aModule->GetReference(), false );
return WildCompareString( m_specifiedRef->GetValue(), aFootprint->GetReference(), false );
case ID_MATCH_FP_VAL:
return WildCompareString( m_specifiedValue->GetValue(), aModule->GetValue(), false );
return WildCompareString( m_specifiedValue->GetValue(), aFootprint->GetValue(), false );
case ID_MATCH_FP_ID:
specifiedID.Parse( m_specifiedID->GetValue(), LIB_ID::ID_PCB );
return aModule->GetFPID() == specifiedID;
return aFootprint->GetFPID() == specifiedID;
default:
return false; // just to quiet compiler warnings....
}
@ -307,7 +308,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
m_MessageWindow->Clear();
m_MessageWindow->Flush( false );
if( processMatchingModules() )
if( processMatchingFootprints() )
{
m_parent->Compile_Ratsnest( true );
m_parent->GetCanvas()->Refresh();
@ -319,7 +320,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
}
bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
{
bool change = false;
LIB_ID newFPID;
@ -336,8 +337,8 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
return false;
}
/* The change is done from the last module because processModule() modifies the last item
* in the list.
/* The change is done from the last footprint because processFootprint() modifies the last
* item in the list.
*/
for( auto it = m_parent->GetBoard()->Modules().rbegin();
it != m_parent->GetBoard()->Modules().rend(); it++ )
@ -349,12 +350,12 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
if( m_updateMode )
{
if( processModule( mod, mod->GetFPID() ) )
if( processFootprint( mod, mod->GetFPID()) )
change = true;
}
else
{
if( processModule( mod, newFPID ) )
if( processFootprint( mod, newFPID ) )
change = true;
}
}
@ -363,36 +364,36 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingModules()
}
bool DIALOG_EXCHANGE_FOOTPRINTS::processModule( MODULE* aModule, const LIB_ID& aNewFPID )
bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( MODULE* aFootprint, const LIB_ID& aNewFPID )
{
LIB_ID oldFPID = aModule->GetFPID();
LIB_ID oldFPID = aFootprint->GetFPID();
wxString msg;
// Load new module.
// Load new footprint.
msg.Printf( _( "%s footprint \"%s\" (from \"%s\") to \"%s\"" ),
m_updateMode ? _( "Update" ) : _( "Change" ),
aModule->GetReference(),
aFootprint->GetReference(),
oldFPID.Format().c_str(),
aNewFPID.Format().c_str() );
MODULE* newModule = m_parent->LoadFootprint( aNewFPID );
MODULE* newFootprint = m_parent->LoadFootprint( aNewFPID );
if( !newModule )
if( !newFootprint )
{
msg << ": " << _( "*** footprint not found ***" );
m_MessageWindow->Report( msg, RPT_SEVERITY_ERROR );
return false;
}
m_parent->Exchange_Module( aModule, newModule, m_commit,
m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue(),
m_resetFabricationAttrs->GetValue(),
m_reset3DModels->GetValue() );
m_parent->ExchangeFootprint( aFootprint, newFootprint, m_commit,
m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue(),
m_resetFabricationAttrs->GetValue(),
m_reset3DModels->GetValue());
if( aModule == m_currentModule )
m_currentModule = newModule;
if( aFootprint == m_currentFootprint )
m_currentFootprint = newFootprint;
msg += ": OK";
m_MessageWindow->Report( msg, RPT_SEVERITY_ACTION );
@ -423,11 +424,11 @@ void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
}
FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aModule )
FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aFootprint )
{
std::vector<FP_TEXT*> candidates;
for( BOARD_ITEM* item : aModule->GraphicalItems() )
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
@ -471,10 +472,10 @@ FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, MODULE* aModule )
}
void PCB_EDIT_FRAME::Exchange_Module( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit,
bool deleteExtraTexts, bool resetTextLayers,
bool resetTextEffects, bool resetFabricationAttrs,
bool reset3DModels )
void PCB_EDIT_FRAME::ExchangeFootprint( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit,
bool deleteExtraTexts, bool resetTextLayers,
bool resetTextEffects, bool resetFabricationAttrs,
bool reset3DModels )
{
PCB_GROUP* parentGroup = aExisting->GetParentGroup();
@ -488,7 +489,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aExisting, MODULE* aNew, BOARD_COM
PlaceModule( aNew, false );
// PlaceModule will move the module to the cursor position, which we don't want. Copy
// PlaceModule will move the footprint to the cursor position, which we don't want. Copy
// the original position across.
aNew->SetPosition( aExisting->GetPosition() );

View File

@ -38,12 +38,12 @@ class DIALOG_EXCHANGE_FOOTPRINTS : public DIALOG_EXCHANGE_FOOTPRINTS_BASE
private:
BOARD_COMMIT m_commit;
PCB_EDIT_FRAME* m_parent;
MODULE* m_currentModule;
MODULE* m_currentFootprint;
bool m_updateMode;
int* m_matchMode;
public:
DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aModule, bool updateMode,
DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent, MODULE* aFootprint, bool updateMode,
bool selectedMode );
~DIALOG_EXCHANGE_FOOTPRINTS() override;
@ -60,8 +60,8 @@ private:
wxRadioButton* getRadioButtonForMode();
bool isMatch( MODULE* );
bool processMatchingModules();
bool processModule( MODULE* aModule, const LIB_ID& aNewFPID );
bool processMatchingFootprints();
bool processFootprint( MODULE* aFootprint, const LIB_ID& aNewFPID );
};
#endif // DIALOG_EXCHANGE_FOOTPRINTS_H_

View File

@ -44,15 +44,15 @@
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include "3d_cache/dialogs/panel_prev_3d.h"
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialog_footprint_properties.h>
int DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0; // remember the last open page during session
int DIALOG_FOOTPRINT_PROPERTIES::m_page = 0; // remember the last open page during session
DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent,
MODULE* aModule ) :
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( aParent ),
DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent,
MODULE* aFootprint ) :
DIALOG_FOOTPRINT_PROPERTIES_BASE( aParent ),
m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ),
m_OrientValidator( 1, &m_OrientValue ),
@ -63,7 +63,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
m_inSelect( false )
{
m_frame = aParent;
m_footprint = aModule;
m_footprint = aFootprint;
// Configure display origin transforms
m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
@ -176,7 +176,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
}
DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES()
{
m_frame->GetPcbNewSettings()->m_FootprintTextShownColumns =
m_itemsGrid->GetShownColumns().ToStdString();
@ -200,31 +200,31 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::EditFootprint( wxCommandEvent& )
{
EndModal( PRM_EDITOR_EDIT_BOARD_FOOTPRINT );
EndModal( FP_PROPS_EDIT_BOARD_FP );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::EditLibraryFootprint( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::EditLibraryFootprint( wxCommandEvent& )
{
EndModal( PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT );
EndModal( FP_PROPS_EDIT_LIBRARY_FP );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::UpdateModule( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::UpdateFootprint( wxCommandEvent& )
{
EndModal( PRM_EDITOR_WANT_UPDATE_FP );
EndModal( FP_PROPS_UPDATE_FP );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::ExchangeModule( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::ChangeFootprint( wxCommandEvent& )
{
EndModal( PRM_EDITOR_WANT_EXCHANGE_FP );
EndModal( FP_PROPS_CHANGE_FP );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::ModuleOrientEvent( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::FootprintOrientEvent( wxCommandEvent& )
{
if( m_Orient0->GetValue() )
m_OrientValue = 0.0;
@ -239,7 +239,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::ModuleOrientEvent( wxCommandEvent& )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnOtherOrientation( wxCommandEvent& aEvent )
void DIALOG_FOOTPRINT_PROPERTIES::OnOtherOrientation( wxCommandEvent& aEvent )
{
m_OrientOther->SetValue( true );
@ -247,7 +247,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnOtherOrientation( wxCommandEvent& aEvent )
}
bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
@ -258,7 +258,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
if( !m_Panel3D->TransferDataToWindow() )
return false;
// Module Texts
// Footprint Texts
m_texts->push_back( m_footprint->Reference() );
m_texts->push_back( m_footprint->Value() );
@ -275,7 +275,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
wxGridTableMessage tmsg( m_texts, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_texts->GetNumberRows() );
m_itemsGrid->ProcessTableMessage( tmsg );
// Module Properties
// Footprint Properties
m_posX.SetValue( m_footprint->GetPosition().x );
m_posY.SetValue( m_footprint->GetPosition().y );
@ -379,7 +379,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
}
select3DModel( 0 ); // will clamp idx within bounds
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
// Show the footprint's FPID.
m_tcLibraryID->SetValue( m_footprint->GetFPID().Format() );
@ -409,7 +409,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::select3DModel( int aModelIdx )
void DIALOG_FOOTPRINT_PROPERTIES::select3DModel( int aModelIdx )
{
m_inSelect = true;
@ -428,14 +428,14 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::select3DModel( int aModelIdx )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelSelected( wxGridEvent& aEvent )
void DIALOG_FOOTPRINT_PROPERTIES::On3DModelSelected( wxGridEvent& aEvent )
{
if( !m_inSelect )
select3DModel( aEvent.GetRow() );
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
void DIALOG_FOOTPRINT_PROPERTIES::On3DModelCellChanged( wxGridEvent& aEvent )
{
if( aEvent.GetCol() == 0 )
{
@ -475,11 +475,11 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged( wxGridEvent& aEvent )
m_shapes3D_list[ aEvent.GetRow() ].m_Show = ( showValue == wxT( "1" ) );
}
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnRemove3DModel( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnRemove3DModel( wxCommandEvent& )
{
m_modelsGrid->CommitPendingChanges( true /* quiet mode */ );
@ -491,12 +491,12 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnRemove3DModel( wxCommandEvent& )
m_modelsGrid->DeleteRows( idx, 1 );
select3DModel( idx ); // will clamp idx within bounds
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
@ -559,11 +559,11 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel( wxCommandEvent& )
m_modelsGrid->SetCellValue( idx, 1, wxT( "1" ) );
select3DModel( idx );
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DRow( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DRow( wxCommandEvent& )
{
if( !m_modelsGrid->CommitPendingChanges() )
return;
@ -588,7 +588,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DRow( wxCommandEvent& )
}
bool DIALOG_FOOTPRINT_BOARD_EDITOR::Validate()
bool DIALOG_FOOTPRINT_PROPERTIES::Validate()
{
if( !m_itemsGrid->CommitPendingChanges() )
return false;
@ -622,7 +622,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::Validate()
}
bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
{
if( !Validate() )
return false;
@ -696,9 +696,9 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break;
}
// Set Module Position
wxPoint modpos( m_posX.GetValue(), m_posY.GetValue() );
m_footprint->SetPosition( modpos );
// Set Footprint Position
wxPoint pos( m_posX.GetValue(), m_posY.GetValue() );
m_footprint->SetPosition( pos );
m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
m_footprint->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
@ -755,14 +755,14 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
// This is a simple edit, we must create an undo entry
if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
commit.Push( _( "Modify module properties" ) );
commit.Push( _( "Modify footprint properties" ) );
SetReturnCode( PRM_EDITOR_EDIT_OK );
SetReturnCode( FP_PROPS_OK );
return true;
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnAddField( wxCommandEvent& )
{
if( !m_itemsGrid->CommitPendingChanges() )
return;
@ -797,7 +797,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField( wxCommandEvent& )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnDeleteField( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnDeleteField( wxCommandEvent& )
{
m_itemsGrid->CommitPendingChanges( true /* quiet mode */ );
@ -825,14 +825,14 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnDeleteField( wxCommandEvent& )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath( wxCommandEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::Cfg3DPath( wxCommandEvent& )
{
if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
m_PreviewPane->UpdateDummyModule();
m_PreviewPane->UpdateDummyFootprint();
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::adjustGridColumns( int aWidth )
void DIALOG_FOOTPRINT_PROPERTIES::adjustGridColumns( int aWidth )
{
// Account for scroll bars
int itemsWidth = aWidth - ( m_itemsGrid->GetSize().x - m_itemsGrid->GetClientSize().x );
@ -853,7 +853,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::adjustGridColumns( int aWidth )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI( wxUpdateUIEvent& )
void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& )
{
if( !m_itemsGrid->IsCellEditControlShown() && !m_modelsGrid->IsCellEditControlShown() )
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
@ -910,7 +910,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnUpdateUI( wxUpdateUIEvent& )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnGridSize( wxSizeEvent& aEvent )
void DIALOG_FOOTPRINT_PROPERTIES::OnGridSize( wxSizeEvent& aEvent )
{
adjustGridColumns( aEvent.GetSize().GetX());
@ -918,7 +918,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnGridSize( wxSizeEvent& aEvent )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnPageChange( wxNotebookEvent& aEvent )
void DIALOG_FOOTPRINT_PROPERTIES::OnPageChange( wxNotebookEvent& aEvent )
{
int page = aEvent.GetSelection();
@ -941,7 +941,7 @@ void DIALOG_FOOTPRINT_BOARD_EDITOR::OnPageChange( wxNotebookEvent& aEvent )
}
void DIALOG_FOOTPRINT_BOARD_EDITOR::updateOrientationControl()
void DIALOG_FOOTPRINT_PROPERTIES::updateOrientationControl()
{
KIUI::ValidatorTransferToWindowWithoutEvents( m_OrientValidator );
}

View File

@ -23,11 +23,11 @@
*/
#ifndef DIALOG_EDIT_FOOTPRINT_FOR_BOARDEDITOR_H
#define DIALOG_EDIT_FOOTPRINT_FOR_BOARDEDITOR_H
#ifndef DIALOG_FOOTPRINT_PROPERTIES_H
#define DIALOG_FOOTPRINT_PROPERTIES_H
#include <dialog_edit_footprint_for_BoardEditor_base.h>
#include <dialog_footprint_properties_base.h>
#include <wx/valnum.h>
#include <text_mod_grid_table.h>
#include <class_module.h>
@ -38,7 +38,7 @@ class PCB_EDIT_FRAME;
class PANEL_PREV_3D;
class DIALOG_FOOTPRINT_BOARD_EDITOR: public DIALOG_FOOTPRINT_BOARD_EDITOR_BASE
class DIALOG_FOOTPRINT_PROPERTIES: public DIALOG_FOOTPRINT_PROPERTIES_BASE
{
private:
PCB_EDIT_FRAME* m_frame;
@ -70,19 +70,19 @@ private:
public:
// The dialog can be closed for several reasons.
enum FP_PRM_EDITOR_RETVALUE
enum FP_PROPS_RETVALUE
{
PRM_EDITOR_WANT_UPDATE_FP,
PRM_EDITOR_WANT_EXCHANGE_FP,
PRM_EDITOR_EDIT_OK,
PRM_EDITOR_EDIT_BOARD_FOOTPRINT,
PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT
FP_PROPS_UPDATE_FP,
FP_PROPS_CHANGE_FP,
FP_PROPS_OK,
FP_PROPS_EDIT_BOARD_FP,
FP_PROPS_EDIT_LIBRARY_FP
};
public:
// Constructor and destructor
DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule );
~DIALOG_FOOTPRINT_BOARD_EDITOR() override;
DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent, MODULE* aFootprint );
~DIALOG_FOOTPRINT_PROPERTIES() override;
bool Validate() override;
@ -98,9 +98,9 @@ private:
void OnAdd3DRow( wxCommandEvent& ) override;
void EditFootprint( wxCommandEvent& ) override;
void EditLibraryFootprint( wxCommandEvent& ) override;
void UpdateModule( wxCommandEvent& ) override;
void ExchangeModule( wxCommandEvent& ) override;
void ModuleOrientEvent( wxCommandEvent& ) override;
void UpdateFootprint( wxCommandEvent& ) override;
void ChangeFootprint( wxCommandEvent& ) override;
void FootprintOrientEvent( wxCommandEvent& ) override;
void OnOtherOrientation( wxCommandEvent& aEvent ) override;
void Cfg3DPath( wxCommandEvent& ) override;
void OnGridSize( wxSizeEvent& aEvent ) override;
@ -121,4 +121,4 @@ private:
};
#endif // DIALOG_EDIT_FOOTPRINT_FOR_BOARDEDITOR_H
#endif // DIALOG_FOOTPRINT_PROPERTIES_H

View File

@ -8,11 +8,11 @@
#include "widgets/text_ctrl_eval.h"
#include "widgets/wx_grid.h"
#include "dialog_edit_footprint_for_BoardEditor_base.h"
#include "dialog_footprint_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_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( wxDefaultSize, wxDefaultSize );
@ -554,54 +554,54 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_GeneralBoxSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnInitDlg ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnUpdateUI ) );
m_NoteBook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnPageChange ), NULL, this );
m_itemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnGridSize ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnDeleteField ), NULL, this );
m_Orient0->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient90->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient270->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient180->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_OrientOther->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_OrientValueCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditFootprint ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::Cfg3DPath ), NULL, this );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnInitDlg ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnUpdateUI ) );
m_NoteBook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnPageChange ), NULL, this );
m_itemsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ModuleOrientEvent ), NULL, this );
m_Orient90->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientOther->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientValueCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::UpdateFootprint ), NULL, this );
m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::Cfg3DPath ), NULL, this );
}
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::~DIALOG_FOOTPRINT_BOARD_EDITOR_BASE()
DIALOG_FOOTPRINT_PROPERTIES_BASE::~DIALOG_FOOTPRINT_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnInitDlg ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnUpdateUI ) );
m_NoteBook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnPageChange ), NULL, this );
m_itemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnGridSize ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnDeleteField ), NULL, this );
m_Orient0->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient90->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient270->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_Orient180->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_OrientOther->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ModuleOrientEvent ), NULL, this );
m_OrientValueCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::UpdateModule ), NULL, this );
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditFootprint ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::Cfg3DPath ), NULL, this );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnInitDlg ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnUpdateUI ) );
m_NoteBook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnPageChange ), NULL, this );
m_itemsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnGridSize ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnDeleteField ), NULL, this );
m_Orient0->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ModuleOrientEvent ), NULL, this );
m_Orient90->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient270->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_Orient180->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientOther->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::FootprintOrientEvent ), NULL, this );
m_OrientValueCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnOtherOrientation ), NULL, this );
m_buttonUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::UpdateFootprint ), NULL, this );
m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::ChangeFootprint ), NULL, this );
m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditFootprint ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::EditLibraryFootprint ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelCellChanged ), NULL, this );
m_modelsGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::On3DModelSelected ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DRow ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnAdd3DModel ), NULL, this );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::OnRemove3DModel ), NULL, this );
m_buttonCfgPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINT_PROPERTIES_BASE::Cfg3DPath ), NULL, this );
}

View File

@ -11,12 +11,12 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_edit_footprint_for_BoardEditor_base</property>
<property name="file">dialog_footprint_properties_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">dialog_edit_footprint_for_BoardEditor_base</property>
<property name="name">dialog_footprint_properties_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -43,7 +43,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_FOOTPRINT_BOARD_EDITOR_BASE</property>
<property name="name">DIALOG_FOOTPRINT_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
@ -1165,7 +1165,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">ModuleOrientEvent</event>
<event name="OnRadioButton">FootprintOrientEvent</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@ -1233,7 +1233,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">ModuleOrientEvent</event>
<event name="OnRadioButton">FootprintOrientEvent</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@ -1301,7 +1301,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">ModuleOrientEvent</event>
<event name="OnRadioButton">FootprintOrientEvent</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@ -1369,7 +1369,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnRadioButton">ModuleOrientEvent</event>
<event name="OnRadioButton">FootprintOrientEvent</event>
</object>
</object>
<object class="gbsizeritem" expanded="0">
@ -1919,7 +1919,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">UpdateModule</event>
<event name="OnButtonClick">UpdateFootprint</event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -1992,7 +1992,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">ExchangeModule</event>
<event name="OnButtonClick">ChangeFootprint</event>
</object>
</object>
<object class="sizeritem" expanded="0">

View File

@ -44,9 +44,9 @@ class WX_GRID;
#define ID_NOTEBOOK 1000
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE
/// Class DIALOG_FOOTPRINT_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
class DIALOG_FOOTPRINT_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
wxBoxSizer* m_GeneralBoxSizer;
@ -131,9 +131,10 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
virtual void OnAddField( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
virtual void ModuleOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void FootprintOrientEvent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOtherOrientation( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateModule( wxCommandEvent& event ) { event.Skip(); }
virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); }
virtual void UpdateFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void ChangeFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void EditLibraryFootprint( wxCommandEvent& event ) { event.Skip(); }
virtual void On3DModelCellChanged( wxGridEvent& event ) { event.Skip(); }
@ -146,8 +147,8 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
public:
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FOOTPRINT_BOARD_EDITOR_BASE();
DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FOOTPRINT_PROPERTIES_BASE();
};

View File

@ -269,9 +269,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
{
aCommit.Modify( aItem );
auto textItem = dynamic_cast<EDA_TEXT*>( aItem );
auto drawItem = dynamic_cast<PCB_SHAPE*>( aItem );
auto moduleTextItem = dyn_cast<FP_TEXT*>( aItem );
EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aItem );
PCB_SHAPE* drawItem = dynamic_cast<PCB_SHAPE*>( aItem );
FP_TEXT* fpTextItem = dynamic_cast<FP_TEXT*>( aItem );
if( m_setToSpecifiedValues->GetValue() )
{
@ -293,8 +293,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
if( m_Visible->Get3StateValue() != wxCHK_UNDETERMINED && textItem )
textItem->SetVisible( m_Visible->GetValue() );
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED && moduleTextItem )
moduleTextItem->SetKeepUpright( m_keepUpright->GetValue() );
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED && fpTextItem )
fpTextItem->SetKeepUpright( m_keepUpright->GetValue() );
if( !m_lineWidth.IsIndeterminate() && drawItem )
drawItem->SetWidth( m_lineWidth.GetValue() );
@ -310,8 +310,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
textItem->SetItalic( m_brdSettings->GetTextItalic( layer ) );
}
if( moduleTextItem )
moduleTextItem->SetKeepUpright( m_brdSettings->GetTextUpright( layer ) );
if( fpTextItem )
fpTextItem->SetKeepUpright( m_brdSettings->GetTextUpright( layer ) );
if( drawItem )
drawItem->SetWidth( m_brdSettings->GetLineThickness( layer ) );
@ -329,22 +329,22 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() )
{
MODULE* module = dynamic_cast<MODULE*>( aItem->GetParent() );
MODULE* fp = dynamic_cast<MODULE*>( aItem->GetParent() );
if( module )
if( fp )
{
if( !WildCompareString( m_referenceFilter->GetValue(), module->GetReference(), false ) )
if( !WildCompareString( m_referenceFilter->GetValue(), fp->GetReference(), false ) )
return;
}
}
if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() )
{
MODULE* module = dynamic_cast<MODULE*>( aItem->GetParent() );
MODULE* fp = dynamic_cast<MODULE*>( aItem->GetParent() );
if( module )
if( fp )
{
if( !WildCompareString( m_footprintFilter->GetValue(), module->GetFPID().Format(), false ) )
if( !WildCompareString( m_footprintFilter->GetValue(), fp->GetFPID().Format(), false ) )
return;
}
}
@ -363,17 +363,17 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
BOARD_COMMIT commit( m_parent );
// Go through the modules
for( MODULE* module : m_parent->GetBoard()->Modules() )
// Go through the footprints
for( MODULE* fp : m_parent->GetBoard()->Modules() )
{
if( m_references->GetValue() )
visitItem( commit, &module->Reference() );
visitItem( commit, &fp->Reference() );
if( m_values->GetValue() )
visitItem( commit, &module->Value() );
visitItem( commit, &fp->Value() );
// Go through all other module items
for( BOARD_ITEM* boardItem : module->GraphicalItems() )
// Go through all other footprint items
for( BOARD_ITEM* boardItem : fp->GraphicalItems() )
{
if( boardItem->Type() == PCB_FP_TEXT_T )
{

View File

@ -44,7 +44,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BAS
private:
PCB_BASE_EDIT_FRAME* m_parent;
PCB_SHAPE* m_item;
FP_SHAPE* m_moduleItem;
FP_SHAPE* m_fp_item;
UNIT_BINDER m_startX, m_startY;
UNIT_BINDER m_endX, m_endY;
@ -97,7 +97,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
{
m_parent = aParent;
m_item = dynamic_cast<PCB_SHAPE*>( aItem );
m_moduleItem = dynamic_cast<FP_SHAPE*>( aItem );
m_fp_item = dynamic_cast<FP_SHAPE*>( aItem );
// Configure display origin transforms
m_startX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
@ -115,13 +115,13 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_AngleValidator.SetWindow( m_angleCtrl );
// Configure the layers list selector
if( m_moduleItem )
if( m_fp_item )
{
LSET forbiddenLayers = LSET::ForbiddenFootprintLayers();
// If someone went to the trouble of setting the layer in a text editor, then there's
// very little sense in nagging them about it.
forbiddenLayers.set( m_moduleItem->GetLayer(), false );
forbiddenLayers.set( m_fp_item->GetLayer(), false );
m_LayerSelectionCtrl->SetNotAllowedLayerSet( forbiddenLayers );
}
@ -136,9 +136,9 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
}
void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem )
void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) );
wxCHECK_RET( aItem != NULL, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem );
dlg.ShowModal();
@ -312,16 +312,16 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
m_item->SetBezControl2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) );
}
if( m_moduleItem )
if( m_fp_item )
{
// We are editing a footprint; init the item coordinates relative to the footprint anchor.
m_moduleItem->SetStart0( m_moduleItem->GetStart() );
m_moduleItem->SetEnd0( m_moduleItem->GetEnd() );
m_fp_item->SetStart0( m_fp_item->GetStart() );
m_fp_item->SetEnd0( m_fp_item->GetEnd() );
if( m_moduleItem->GetShape() == S_CURVE )
if( m_fp_item->GetShape() == S_CURVE )
{
m_moduleItem->SetBezier0_C1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue() ) );
m_moduleItem->SetBezier0_C2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) );
m_fp_item->SetBezier0_C1( wxPoint( m_bezierCtrl1X.GetValue(), m_bezierCtrl1Y.GetValue() ) );
m_fp_item->SetBezier0_C2( wxPoint( m_bezierCtrl2X.GetValue(), m_bezierCtrl2Y.GetValue() ) );
}
}

View File

@ -96,7 +96,7 @@ static const LSET std_pad_layers[] =
};
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad )
void PCB_BASE_FRAME::ShowPadPropertiesDialog( D_PAD* aPad )
{
DIALOG_PAD_PROPERTIES dlg( this, aPad );

View File

@ -171,7 +171,7 @@ DIALOG_TEXT_PROPERTIES::~DIALOG_TEXT_PROPERTIES()
/**
* Routine for main window class to launch text properties dialog.
*/
void PCB_BASE_EDIT_FRAME::InstallTextOptionsFrame( BOARD_ITEM* aText )
void PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog( BOARD_ITEM* aText )
{
DIALOG_TEXT_PROPERTIES dlg( this, aText );
dlg.ShowModal();

View File

@ -30,7 +30,6 @@
#include <gestfich.h>
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <footprint_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
@ -39,7 +38,6 @@
#include <class_dimension.h>
#include <pcb_layer_box_selector.h>
#include <dialog_drc.h>
#include <array_creator.h>
#include <connectivity/connectivity_data.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
@ -125,16 +123,15 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
{
switch( aItem->Type() )
{
case PCB_TEXT_T:
InstallTextOptionsFrame( aItem );
case PCB_TEXT_T:ShowTextPropertiesDialog( aItem );
break;
case PCB_PAD_T:
InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
ShowPadPropertiesDialog( static_cast<D_PAD*>( aItem ) );
break;
case PCB_MODULE_T:
InstallFootprintPropertiesDialog( static_cast<MODULE*>( aItem ) );
ShowFootprintPropertiesDialog( static_cast<MODULE*>( aItem ) );
break;
case PCB_TARGET_T:
@ -145,15 +142,14 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ) );
ShowDimensionPropertiesDialog( static_cast<DIMENSION*>( aItem ) );
break;
case PCB_FP_TEXT_T:
InstallTextOptionsFrame( aItem );
ShowTextPropertiesDialog( aItem );
break;
case PCB_SHAPE_T:
InstallGraphicItemPropertiesDialog( aItem );
case PCB_SHAPE_T:ShowGraphicItemPropertiesDialog( aItem );
break;
case PCB_ZONE_AREA_T:
@ -170,7 +166,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
}
void PCB_EDIT_FRAME::ShowDimensionPropertyDialog( DIMENSION* aDimension )
void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( DIMENSION* aDimension )
{
if( aDimension == NULL )
return;

View File

@ -357,10 +357,10 @@ LIB_ID FOOTPRINT_EDIT_FRAME::GetTargetFPID() const
LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const
{
MODULE* module = GetBoard()->GetFirstModule();
MODULE* footprint = GetBoard()->GetFirstModule();
if( module )
return LIB_ID( module->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
if( footprint )
return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
else
return LIB_ID();
}
@ -368,9 +368,9 @@ LIB_ID FOOTPRINT_EDIT_FRAME::GetLoadedFPID() const
bool FOOTPRINT_EDIT_FRAME::IsCurrentFPFromBoard() const
{
MODULE* module = GetBoard()->GetFirstModule();
MODULE* footprint = GetBoard()->GetFirstModule();
return ( module && module->GetLink() != niluuid );
return ( footprint && footprint->GetLink() != niluuid );
}
@ -397,10 +397,10 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
id.SetLibNickname( libNickname );
id.SetLibItemName( footprintName );
MODULE* module = loadFootprint( id );
MODULE* footprint = loadFootprint( id );
if( module )
AddModuleToBoard( module );
if( footprint )
AddModuleToBoard( footprint );
}
}
@ -516,15 +516,15 @@ MAGNETIC_SETTINGS* FOOTPRINT_EDIT_FRAME::GetMagneticItemsSettings()
const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
{
MODULE* module = GetBoard()->GetFirstModule();
MODULE* footprint = GetBoard()->GetFirstModule();
if( module )
if( footprint )
{
bool hasGraphicalItem = module->Pads().size() || module->Zones().size();
bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
if( !hasGraphicalItem )
{
for( const BOARD_ITEM* item : module->GraphicalItems() )
for( const BOARD_ITEM* item : footprint->GraphicalItems() )
{
if( item->Type() == PCB_FP_TEXT_T )
continue;
@ -536,13 +536,13 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible )
if( hasGraphicalItem )
{
return module->GetFootprintRect();
return footprint->GetFootprintRect();
}
else
{
BOX2I newModuleBB( { 0, 0 }, { 0, 0 } );
newModuleBB.Inflate( Millimeter2iu( 12 ) );
return newModuleBB;
BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
newFootprintBB.Inflate( Millimeter2iu( 12 ) );
return newFootprintBB;
}
}
@ -627,19 +627,19 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
MODULE* module_in_edit = GetBoard()->GetFirstModule();
bool canInsert = frame && module_in_edit && module_in_edit->GetLink() == niluuid;
MODULE* editorFootprint = GetBoard()->GetFirstModule();
bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
// If the source was deleted, the module can inserted but not updated in the board.
if( frame && module_in_edit && module_in_edit->GetLink() != niluuid ) // this is not a new module
// If the source was deleted, the footprint can inserted but not updated in the board.
if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
{
BOARD* mainpcb = frame->GetBoard();
canInsert = true;
// search if the source module was not deleted:
for( auto source_module : mainpcb->Modules() )
// search if the source footprint was not deleted:
for( MODULE* candidate : mainpcb->Modules() )
{
if( module_in_edit->GetLink() == source_module->m_Uuid )
if( editorFootprint->GetLink() == candidate->m_Uuid )
{
canInsert = false;
break;

View File

@ -362,8 +362,7 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
{
switch( aItem->Type() )
{
case PCB_PAD_T:
InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
case PCB_PAD_T:ShowPadPropertiesDialog( static_cast<D_PAD*>( aItem ));
break;
case PCB_MODULE_T:
@ -371,12 +370,10 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
GetCanvas()->Refresh();
break;
case PCB_FP_TEXT_T:
InstallTextOptionsFrame( aItem );
case PCB_FP_TEXT_T:ShowTextPropertiesDialog( aItem );
break;
case PCB_FP_SHAPE_T :
InstallGraphicItemPropertiesDialog( aItem );
case PCB_FP_SHAPE_T :ShowGraphicItemPropertiesDialog( aItem );
break;
case PCB_FP_ZONE_AREA_T:

View File

@ -814,7 +814,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
{
// In the main board the new module replaces the old module (pos, orient, ref, value,
// connections and properties are kept) and the source_module (old module) is deleted
pcbframe->Exchange_Module( source_module, newmodule, commit );
pcbframe->ExchangeFootprint( source_module, newmodule, commit );
const_cast<KIID&>( newmodule->m_Uuid ) = module_in_edit->GetLink();
commit.Push( wxT( "Update module" ) );
}

View File

@ -208,9 +208,9 @@ public:
try
{
aEntry.module.reset( fptbl->FootprintLoadWithOptionalNickname( aEntry.fpid ) );
aEntry.footprint.reset( fptbl->FootprintLoadWithOptionalNickname( aEntry.fpid ) );
if( !aEntry.module )
if( !aEntry.footprint )
aEntry.status = FPS_NOT_FOUND;
}
catch( const IO_ERROR& )
@ -253,7 +253,7 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aPare
: PCB_DRAW_PANEL_GAL( aParent, -1, wxPoint( 0, 0 ), wxSize( 200, 200 ), *aOpts, aGalType ),
KIWAY_HOLDER( aKiway, KIWAY_HOLDER::PANEL ),
m_displayOptions( std::move( aOpts ) ),
m_currentModule( nullptr ),
m_currentFootprint( nullptr ),
m_footprintDisplayed( true )
{
m_iface = std::make_shared<FP_THREAD_IFACE>();
@ -280,11 +280,11 @@ FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aPare
FOOTPRINT_PREVIEW_PANEL::~FOOTPRINT_PREVIEW_PANEL( )
{
if( m_currentModule )
if( m_currentFootprint )
{
GetView()->Remove( m_currentModule.get() );
GetView()->Remove( m_currentFootprint.get() );
GetView()->Clear();
m_currentModule->SetParent( nullptr );
m_currentFootprint->SetParent( nullptr );
}
m_iface->SetPanel( nullptr );
@ -327,33 +327,33 @@ void FOOTPRINT_PREVIEW_PANEL::CacheFootprint( const LIB_ID& aFPID )
}
void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<MODULE> aModule )
void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<MODULE> aFootprint )
{
if( m_currentModule )
if( m_currentFootprint )
{
GetView()->Remove( m_currentModule.get() );
GetView()->Remove( m_currentFootprint.get() );
GetView()->Clear();
m_currentModule->SetParent( nullptr );
m_currentFootprint->SetParent( nullptr );
}
aModule->SetParent( m_dummyBoard.get() );
aFootprint->SetParent( m_dummyBoard.get() );
// Ensure we are not using the high contrast mode to display the selected footprint
KIGFX::PAINTER* painter = GetView()->GetPainter();
auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
GetView()->Add( aModule.get() );
GetView()->SetVisible( aModule.get(), true );
GetView()->Update( aModule.get(), KIGFX::ALL );
GetView()->Add( aFootprint.get() );
GetView()->SetVisible( aFootprint.get(), true );
GetView()->Update( aFootprint.get(), KIGFX::ALL );
// Save a reference to the module's shared pointer to say we are using it in the
// Save a reference to the footprint's shared pointer to say we are using it in the
// preview panel
m_currentModule = aModule;
m_currentFootprint = aFootprint;
BOX2I bbox = aModule->ViewBBox();
bbox.Merge( aModule->Value().ViewBBox() );
bbox.Merge( aModule->Reference().ViewBBox() );
BOX2I bbox = aFootprint->ViewBBox();
bbox.Merge( aFootprint->Value().ViewBBox() );
bbox.Merge( aFootprint->Reference().ViewBBox() );
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{
@ -383,7 +383,7 @@ void FOOTPRINT_PREVIEW_PANEL::DisplayFootprint ( const LIB_ID& aFPID )
{
if( !m_footprintDisplayed )
{
renderFootprint( fpe.module );
renderFootprint( fpe.footprint );
m_footprintDisplayed = true;
Refresh();
}

View File

@ -77,7 +77,7 @@ private:
struct CACHE_ENTRY
{
LIB_ID fpid;
std::shared_ptr<MODULE> module;
std::shared_ptr<MODULE> footprint;
FOOTPRINT_STATUS status;
};
@ -98,7 +98,7 @@ private:
void OnLoaderThreadUpdate( wxCommandEvent& aEvent );
void renderFootprint( std::shared_ptr<MODULE> aModule );
void renderFootprint( std::shared_ptr<MODULE> aFootprint );
private:
FP_LOADER_THREAD* m_loader;
@ -108,7 +108,7 @@ private:
std::unique_ptr<BOARD> m_dummyBoard;
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> m_displayOptions;
std::shared_ptr<MODULE> m_currentModule;
std::shared_ptr<MODULE> m_currentFootprint;
LIB_ID m_currentFPID;
bool m_footprintDisplayed;
};

View File

@ -169,8 +169,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
// Create GAL canvas
m_canvasType = LoadCanvasTypeSetting();
auto drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), m_canvasType );
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), m_canvasType );
SetCanvas( drawPanel );
SetBoard( new BOARD() );
@ -732,32 +732,32 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
BOARD_COMMIT commit( pcbframe );
// Create the "new" module
MODULE* newmodule = (MODULE*) GetBoard()->GetFirstModule()->Duplicate();
newmodule->SetParent( pcbframe->GetBoard() );
newmodule->SetLink( 0 );
// Create the "new" footprint
MODULE* newFootprint = (MODULE*) GetBoard()->GetFirstModule()->Duplicate();
newFootprint->SetParent( pcbframe->GetBoard() );
newFootprint->SetLink( 0 );
KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls();
VECTOR2D cursorPos = viewControls->GetCursorPosition();
commit.Add( newmodule );
commit.Add( newFootprint );
viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
pcbframe->PlaceModule( newmodule );
newmodule->SetPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newFootprint );
newFootprint->SetPosition( wxPoint( 0, 0 ) );
viewControls->SetCrossHairCursorPosition( cursorPos, false );
commit.Push( wxT( "Insert module" ) );
commit.Push( wxT( "Insert footprint" ) );
pcbframe->Raise();
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newmodule );
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newFootprint );
newmodule->ClearFlags();
newFootprint->ClearFlags();
}
}
void FOOTPRINT_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxCHECK( cfg, /*void*/ );
// We don't allow people to change this right now, so make sure it's on
@ -774,7 +774,7 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxCHECK( cfg, /*void*/ );
// We don't want to store anything other than the window settings
@ -786,7 +786,7 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
WINDOW_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
{
auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
wxCHECK_MSG( cfg, nullptr, "config not existing" );
return &cfg->m_FootprintViewer;

View File

@ -51,9 +51,9 @@ FP_SHAPE::~FP_SHAPE()
void FP_SHAPE::SetLocalCoord()
{
MODULE* module = (MODULE*) m_Parent;
MODULE* fp = (MODULE*) m_Parent;
if( module == NULL )
if( fp == NULL )
{
m_Start0 = m_Start;
m_End0 = m_End;
@ -63,12 +63,12 @@ void FP_SHAPE::SetLocalCoord()
return;
}
m_Start0 = m_Start - module->GetPosition();
m_End0 = m_End - module->GetPosition();
m_ThirdPoint0 = m_ThirdPoint - module->GetPosition();
m_Bezier0_C1 = m_BezierC1 - module->GetPosition();
m_Bezier0_C2 = m_BezierC2 - module->GetPosition();
double angle = module->GetOrientation();
m_Start0 = m_Start - fp->GetPosition();
m_End0 = m_End - fp->GetPosition();
m_ThirdPoint0 = m_ThirdPoint - fp->GetPosition();
m_Bezier0_C1 = m_BezierC1 - fp->GetPosition();
m_Bezier0_C2 = m_BezierC2 - fp->GetPosition();
double angle = fp->GetOrientation();
RotatePoint( &m_Start0.x, &m_Start0.y, -angle );
RotatePoint( &m_End0.x, &m_End0.y, -angle );
RotatePoint( &m_ThirdPoint0.x, &m_ThirdPoint0.y, -angle );
@ -79,7 +79,7 @@ void FP_SHAPE::SetLocalCoord()
void FP_SHAPE::SetDrawCoord()
{
MODULE* module = (MODULE*) m_Parent;
MODULE* fp = (MODULE*) m_Parent;
m_Start = m_Start0;
m_End = m_End0;
@ -87,19 +87,19 @@ void FP_SHAPE::SetDrawCoord()
m_BezierC1 = m_Bezier0_C1;
m_BezierC2 = m_Bezier0_C2;
if( module )
if( fp )
{
RotatePoint( &m_Start.x, &m_Start.y, module->GetOrientation() );
RotatePoint( &m_End.x, &m_End.y, module->GetOrientation() );
RotatePoint( &m_ThirdPoint.x, &m_ThirdPoint.y, module->GetOrientation() );
RotatePoint( &m_BezierC1.x, &m_BezierC1.y, module->GetOrientation() );
RotatePoint( &m_BezierC2.x, &m_BezierC2.y, module->GetOrientation() );
RotatePoint( &m_Start.x, &m_Start.y, fp->GetOrientation() );
RotatePoint( &m_End.x, &m_End.y, fp->GetOrientation() );
RotatePoint( &m_ThirdPoint.x, &m_ThirdPoint.y, fp->GetOrientation() );
RotatePoint( &m_BezierC1.x, &m_BezierC1.y, fp->GetOrientation() );
RotatePoint( &m_BezierC2.x, &m_BezierC2.y, fp->GetOrientation() );
m_Start += module->GetPosition();
m_End += module->GetPosition();
m_ThirdPoint += module->GetPosition();
m_BezierC1 += module->GetPosition();
m_BezierC2 += module->GetPosition();
m_Start += fp->GetPosition();
m_End += fp->GetPosition();
m_ThirdPoint += fp->GetPosition();
m_BezierC1 += fp->GetPosition();
m_BezierC2 += fp->GetPosition();
}
RebuildBezierToSegmentsPointsList( m_Width );
@ -111,17 +111,17 @@ void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
{
wxString msg;
MODULE* module = (MODULE*) m_Parent;
MODULE* fp = (MODULE*) m_Parent;
if( !module )
if( !fp )
return;
BOARD* board = (BOARD*) module->GetParent();
BOARD* board = (BOARD*) fp->GetParent();
if( !board )
return;
aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
aList.emplace_back( _( "Footprint" ), fp->GetReference(), DARKCYAN );
// append the features shared with the base class
PCB_SHAPE::GetMsgPanelInfo( aFrame, aList );
@ -281,7 +281,8 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis )
void FP_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle )
{
// We should rotate the relative coordinates, but to avoid duplicate code do the base class
// rotation of draw coordinates, which is acceptable because in module editor, m_Pos0 = m_Pos
// rotation of draw coordinates, which is acceptable because in the footprint editor
// m_Pos0 = m_Pos
PCB_SHAPE::Rotate( aRotCentre, aAngle );
// and now update the relative coordinates, which are the reference in most transforms.
@ -335,12 +336,12 @@ double FP_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
}
static struct EDGE_MODULE_DESC
static struct FP_SHAPE_DESC
{
EDGE_MODULE_DESC()
FP_SHAPE_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( FP_SHAPE );
propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( PCB_SHAPE ) );
}
} _EDGE_MODULE_DESC;
} _FP_SHAPE_DESC;

View File

@ -461,9 +461,9 @@ std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
}
static struct TEXTE_MODULE_DESC
static struct FP_TEXT_DESC
{
TEXTE_MODULE_DESC()
FP_TEXT_DESC()
{
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( FP_TEXT );
@ -472,4 +472,4 @@ static struct TEXTE_MODULE_DESC
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( BOARD_ITEM ) );
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( EDA_TEXT ) );
}
} _TEXTE_MODULE_DESC;
} _FP_TEXT_DESC;

View File

@ -229,7 +229,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
if( !m_isDryRun )
{
m_frame->Exchange_Module( aPcbComponent, newFootprint, m_commit );
m_frame->ExchangeFootprint( aPcbComponent, newFootprint, m_commit );
return newFootprint;
}
else

View File

@ -180,8 +180,8 @@ public:
*/
void SetRotationAngle( int aRotationAngle );
void InstallTextOptionsFrame( BOARD_ITEM* aText );
void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
void ShowTextPropertiesDialog( BOARD_ITEM* aText );
void ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void ActivateGalCanvas() override;

View File

@ -33,7 +33,7 @@
#include <pcb_layer_box_selector.h>
#include <footprint_edit_frame.h>
#include <dialog_plot.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialog_footprint_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
@ -1538,63 +1538,63 @@ void PCB_EDIT_FRAME::PythonSyncProjectName()
}
void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module )
void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( MODULE* aFootprint )
{
if( Module == NULL )
if( aFootprint == NULL )
return;
DIALOG_FOOTPRINT_BOARD_EDITOR* dlg = new DIALOG_FOOTPRINT_BOARD_EDITOR( this, Module );
DIALOG_FOOTPRINT_PROPERTIES* dlg = new DIALOG_FOOTPRINT_PROPERTIES( this, aFootprint );
int retvalue = dlg->ShowModal();
/* retvalue =
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_UPDATE_FP if update footprint
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if change footprint
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command
* FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edit
* FP_PROPS_UPDATE_FP if update footprint
* FP_PROPS_CHANGE_FP if change footprint
* PRM_EDITOR_WANT_MODEDIT for a goto editor command
* FP_PROPS_OK for normal edit
*/
dlg->Close();
dlg->Destroy();
if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_OK )
if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_OK )
{
// If something edited, push a refresh request
GetCanvas()->Refresh();
}
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_BOARD_FOOTPRINT )
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_BOARD_FP )
{
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
editor->Load_Module_From_BOARD( Module );
editor->Load_Module_From_BOARD( aFootprint );
editor->Show( true );
editor->Raise(); // Iconize( false );
}
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_LIBRARY_FOOTPRINT )
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_EDIT_LIBRARY_FP )
{
auto editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
editor->LoadModuleFromLibrary( Module->GetFPID() );
editor->LoadModuleFromLibrary( aFootprint->GetFPID() );
editor->Show( true );
editor->Raise(); // Iconize( false );
}
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_UPDATE_FP )
{
InstallExchangeModuleFrame( Module, true, true );
ShowExchangeFootprintsDialog( aFootprint, true, true );
}
else if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
else if( retvalue == DIALOG_FOOTPRINT_PROPERTIES::FP_PROPS_CHANGE_FP )
{
InstallExchangeModuleFrame( Module, false, true );
ShowExchangeFootprintsDialog( aFootprint, false, true );
}
}
int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* aModule, bool updateMode,
bool selectedMode )
int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( MODULE* aModule, bool updateMode,
bool selectedMode )
{
DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aModule, updateMode, selectedMode );

View File

@ -736,9 +736,9 @@ public:
bool ImportSpecctraSession( const wxString& aFullFilename );
// Footprint editing (see also PCB_BASE_FRAME)
void InstallFootprintPropertiesDialog( MODULE* Module );
void ShowFootprintPropertiesDialog( MODULE* aFootprint );
int InstallExchangeModuleFrame( MODULE* aModule, bool updateMode, bool selectedMode );
int ShowExchangeFootprintsDialog( MODULE* aModule, bool updateMode, bool selectedMode );
/**
* Function Exchange_Module
@ -749,10 +749,10 @@ public:
* @param aNew = footprint to put
* @param aCommit = commit that should store the changes
*/
void Exchange_Module( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit,
bool deleteExtraTexts = true, bool resetTextLayers = true,
bool resetTextEffects = true, bool resetFabricationAttrs = true,
bool reset3DModels = true );
void ExchangeFootprint( MODULE* aExisting, MODULE* aNew, BOARD_COMMIT& aCommit,
bool deleteExtraTexts = true, bool resetTextLayers = true,
bool resetTextEffects = true, bool resetFabricationAttrs = true,
bool reset3DModels = true );
// loading modules: see PCB_BASE_FRAME
@ -791,7 +791,7 @@ public:
// Properties dialogs
void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
void ShowDimensionPropertyDialog( DIMENSION* aDimension );
void ShowDimensionPropertiesDialog( DIMENSION* aDimension );
void ShowGroupPropertiesDialog( PCB_GROUP* aGroup );
void InstallNetlistFrame();

View File

@ -542,7 +542,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
RunMainStack( [&]()
{
m_frame->InstallTextOptionsFrame( pcbText );
m_frame->ShowTextPropertiesDialog( pcbText );
} );
if( pcbText->GetText().IsEmpty() )

View File

@ -299,7 +299,7 @@ int FOOTPRINT_EDITOR_TOOLS::Properties( const TOOL_EVENT& aEvent )
int FOOTPRINT_EDITOR_TOOLS::DefaultPadProperties( const TOOL_EVENT& aEvent )
{
getEditFrame<FOOTPRINT_EDIT_FRAME>()->InstallPadOptionsFrame( nullptr );
getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
return 0;
}

View File

@ -408,18 +408,18 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
}
};
// Module IDs are the most important, so give them the first crack at "owning" a particular
// KIID.
// Footprint IDs are the most important, so give them the first crack at "claiming" a
// particular KIID.
for( MODULE* module : board()->Modules() )
processItem( module );
for( MODULE* footprint : board()->Modules() )
processItem( footprint );
// After that the principal use is for DRC marker pointers, which are most likely to pads
// or tracks.
for( MODULE* module : board()->Modules() )
for( MODULE* footprint : board()->Modules() )
{
for( D_PAD* pad : module->Pads() )
for( D_PAD* pad : footprint->Pads() )
processItem( pad );
}
@ -428,18 +428,18 @@ int PCB_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
// From here out I don't think order matters much.
for( MODULE* module : board()->Modules() )
for( MODULE* footprint : board()->Modules() )
{
processItem( &module->Reference() );
processItem( &module->Value() );
processItem( &footprint->Reference() );
processItem( &footprint->Value() );
for( BOARD_ITEM* item : module->GraphicalItems() )
for( BOARD_ITEM* item : footprint->GraphicalItems() )
processItem( item );
for( ZONE_CONTAINER* zone : module->Zones() )
for( ZONE_CONTAINER* zone : footprint->Zones() )
processItem( zone );
for( PCB_GROUP* group : module->Groups() )
for( PCB_GROUP* group : footprint->Groups() )
processItem( group );
}
@ -758,7 +758,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
MODULE* module = aEvent.Parameter<MODULE*>();
MODULE* fp = aEvent.Parameter<MODULE*>();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
BOARD_COMMIT commit( m_frame );
BOARD* board = getModel<BOARD>();
@ -772,13 +772,13 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
VECTOR2I cursorPos = controls->GetCursorPosition();
bool reselect = false;
bool fromOtherCommand = module != nullptr;
bool fromOtherCommand = fp != nullptr;
// Prime the pump
if( module )
if( fp )
{
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module );
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp );
m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
else if( aEvent.HasPosition() )
@ -799,8 +799,8 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
setCursor();
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
if( reselect && module )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module );
if( reselect && fp )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp );
auto cleanup = [&] ()
{
@ -819,12 +819,12 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
}
}
module = NULL;
fp = NULL;
};
if( evt->IsCancelInteractive() )
{
if( module )
if( fp )
cleanup();
else
{
@ -835,7 +835,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
else if( evt->IsActivate() )
{
if( module )
if( fp )
cleanup();
if( evt->IsMoveTool() )
@ -852,38 +852,38 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_LEFT ) )
{
if( !module )
if( !fp )
{
// Pick the module to be placed
module = m_frame->SelectFootprintFromLibTree();
// Pick the footprint to be placed
fp = m_frame->SelectFootprintFromLibTree();
if( module == NULL )
if( fp == NULL )
continue;
module->SetLink( niluuid );
fp->SetLink( niluuid );
module->SetFlags( IS_NEW ); // whatever
fp->SetFlags(IS_NEW ); // whatever
// Set parent so that clearance can be loaded
module->SetParent( board );
fp->SetParent( board );
// Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board)
if( module->IsFlipped() )
module->Flip( module->GetPosition(), m_frame->Settings().m_FlipLeftRight );
if( fp->IsFlipped() )
fp->Flip( fp->GetPosition(), m_frame->Settings().m_FlipLeftRight );
module->SetOrientation( 0 );
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
fp->SetOrientation( 0 );
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
commit.Add( module );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, module );
commit.Add( fp );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp );
controls->SetCursorPosition( cursorPos, false );
}
else
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
commit.Push( _( "Place a module" ) );
module = NULL; // to indicate that there is no module that we currently modify
commit.Push( _( "Place a footprint" ) );
fp = NULL; // to indicate that there is no footprint that we currently modify
}
}
@ -892,14 +892,14 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( selection() );
}
else if( module && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
{
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
selection().SetReferencePoint( cursorPos );
getView()->Update( & selection() );
}
else if( module && evt->IsAction( &PCB_ACTIONS::properties ) )
else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
{
// Calling 'Properties' action clears the selection, so we need to restore it
reselect = true;
@ -908,9 +908,9 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
else
evt->SetPassEvent();
// Enable autopanning and cursor capture only when there is a module to be placed
controls->SetAutoPan( !!module );
controls->CaptureCursor( !!module );
// Enable autopanning and cursor capture only when there is a footprint to be placed
controls->SetAutoPan( !!fp );
controls->CaptureCursor( !!fp );
}
return 0;
@ -1251,16 +1251,16 @@ int PCB_EDITOR_CONTROL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
if( selection.Empty() )
return 0;
MODULE* mod = selection.FirstOfKind<MODULE>();
MODULE* fp = selection.FirstOfKind<MODULE>();
if( !mod )
if( !fp )
return 0;
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
auto editor = (FOOTPRINT_EDIT_FRAME*) editFrame->Kiway().Player( FRAME_FOOTPRINT_EDITOR, true );
editor->Load_Module_From_BOARD( mod );
editor->Load_Module_From_BOARD( fp );
editor->Show( true );
editor->Raise(); // Iconize( false );

View File

@ -760,28 +760,28 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
if( selection.Empty() )
{
// Clear the previous local ratsnest if we click off all items
for( MODULE* mod : board->Modules() )
for( MODULE* fp : board->Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : fp->Pads() )
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
}
}
else
{
for( auto item : selection )
for( EDA_ITEM* item : selection )
{
if( D_PAD* pad = dyn_cast<D_PAD*>(item) )
{
pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
}
else if( MODULE* mod = dyn_cast<MODULE*>(item) )
else if( MODULE* fp = dyn_cast<MODULE*>( item) )
{
if( !mod->Pads().empty() )
if( !fp->Pads().empty() )
{
bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
bool enable = !fp->Pads()[0]->GetLocalRatsnestVisible();
for( auto modpad : mod->Pads() )
modpad->SetLocalRatsnestVisible( enable );
for( D_PAD* childPad : fp->Pads() )
childPad->SetLocalRatsnestVisible( enable );
}
}
}
@ -797,9 +797,9 @@ int PCB_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{
if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
{
for( MODULE* mod : board->Modules() )
for( MODULE* fp : board->Modules() )
{
for( D_PAD* pad : mod->Pads() )
for( D_PAD* pad : fp->Pads() )
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
}
}

View File

@ -98,9 +98,9 @@ int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayPadNum );
frame()->SetDisplayOptions( opts );
for( auto module : board()->Modules() )
for( MODULE* fp : board()->Modules() )
{
for( auto pad : module->Pads() )
for( D_PAD* pad : fp->Pads() )
view()->Update( pad, KIGFX::GEOMETRY );
}
@ -117,9 +117,9 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayPadFill );
frame()->SetDisplayOptions( opts );
for( auto module : board()->Modules() )
for( MODULE* fp : board()->Modules() )
{
for( auto pad : module->Pads() )
for( D_PAD* pad : fp->Pads() )
view()->Update( pad, KIGFX::GEOMETRY );
}
@ -136,9 +136,9 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayGraphicsFill );
frame()->SetDisplayOptions( opts );
for( MODULE* module : board()->Modules() )
for( MODULE* fp : board()->Modules() )
{
for( BOARD_ITEM* item : module->GraphicalItems() )
for( BOARD_ITEM* item : fp->GraphicalItems() )
{
if( item->Type() == PCB_FP_SHAPE_T )
view()->Update( item, KIGFX::GEOMETRY );
@ -166,12 +166,12 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
Flip( opts.m_DisplayTextFill );
frame()->SetDisplayOptions( opts );
for( MODULE* module : board()->Modules() )
for( MODULE* fp : board()->Modules() )
{
view()->Update( &module->Reference(), KIGFX::GEOMETRY );
view()->Update( &module->Value(), KIGFX::GEOMETRY );
view()->Update( &fp->Reference(), KIGFX::GEOMETRY );
view()->Update( &fp->Value(), KIGFX::GEOMETRY );
for( BOARD_ITEM* item : module->GraphicalItems() )
for( BOARD_ITEM* item : fp->GraphicalItems() )
{
if( item->Type() == PCB_FP_TEXT_T )
view()->Update( item, KIGFX::GEOMETRY );