diff --git a/common/hash_eda.cpp b/common/hash_eda.cpp index 8148df0737..31e4f4c904 100644 --- a/common/hash_eda.cpp +++ b/common/hash_eda.cpp @@ -39,7 +39,7 @@ static inline size_t hash_board_item( const BOARD_ITEM* aItem, int aFlags ) size_t ret = 0; if( aFlags & LAYER ) - ret ^= hash{}( aItem->GetLayerSet().to_ullong() ); + ret = hash{}( aItem->GetLayerSet().to_ullong() ); return ret; } @@ -55,57 +55,57 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags ) { const MODULE* module = static_cast( aItem ); - ret ^= hash_board_item( module, aFlags ); + ret += hash_board_item( module, aFlags ); if( aFlags & POSITION ) { - ret ^= hash{}( module->GetPosition().x ); - ret ^= hash{}( module->GetPosition().y ); + ret += hash{}( module->GetPosition().x ); + ret += hash{}( module->GetPosition().y ); } if( aFlags & ROTATION ) - ret ^= hash{}( module->GetOrientation() ); + ret += hash{}( module->GetOrientation() ); for( const BOARD_ITEM* i = module->GraphicalItemsList(); i; i = i->Next() ) - ret ^= hash_eda( i, aFlags ); + ret += hash_eda( i, aFlags ); for( const D_PAD* i = module->PadsList(); i; i = i->Next() ) - ret ^= hash_eda( i, aFlags ); + ret += hash_eda( i, aFlags ); } break; case PCB_PAD_T: { const D_PAD* pad = static_cast( aItem ); - ret ^= hash_board_item( pad, aFlags ); - ret ^= hash{}( pad->GetShape() << 16 ); - ret ^= hash{}( pad->GetDrillShape() << 18 ); - ret ^= hash{}( pad->GetSize().x << 8 ); - ret ^= hash{}( pad->GetSize().y << 9 ); - ret ^= hash{}( pad->GetOffset().x << 6 ); - ret ^= hash{}( pad->GetOffset().y << 7 ); - ret ^= hash{}( pad->GetDelta().x << 4 ); - ret ^= hash{}( pad->GetDelta().y << 5 ); + ret += hash_board_item( pad, aFlags ); + ret += hash{}( pad->GetShape() << 16 ); + ret += hash{}( pad->GetDrillShape() << 18 ); + ret += hash{}( pad->GetSize().x << 8 ); + ret += hash{}( pad->GetSize().y << 9 ); + ret += hash{}( pad->GetOffset().x << 6 ); + ret += hash{}( pad->GetOffset().y << 7 ); + ret += hash{}( pad->GetDelta().x << 4 ); + ret += hash{}( pad->GetDelta().y << 5 ); if( aFlags & POSITION ) { if( aFlags & REL_COORD ) { - ret ^= hash{}( pad->GetPos0().x ); - ret ^= hash{}( pad->GetPos0().y ); + ret += hash{}( pad->GetPos0().x ); + ret += hash{}( pad->GetPos0().y ); } else { - ret ^= hash{}( pad->GetPosition().x ); - ret ^= hash{}( pad->GetPosition().y ); + ret += hash{}( pad->GetPosition().x ); + ret += hash{}( pad->GetPosition().y ); } } if( aFlags & ROTATION ) - ret ^= hash{}( pad->GetOrientation() ); + ret += hash{}( pad->GetOrientation() ); if( aFlags & NET ) - ret ^= hash{}( pad->GetNetCode() << 6 ); + ret += hash{}( pad->GetNetCode() << 6 ); } break; @@ -119,64 +119,64 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags ) if( !( aFlags & VALUE ) && text->GetType() == TEXTE_MODULE::TEXT_is_VALUE ) break; - ret ^= hash_board_item( text, aFlags ); - ret ^= hash{}( text->GetText().ToStdString() ); - ret ^= hash{}( text->IsItalic() ); - ret ^= hash{}( text->IsBold() ); - ret ^= hash{}( text->IsMirrored() ); - ret ^= hash{}( text->GetTextWidth() ); - ret ^= hash{}( text->GetTextHeight() ); - ret ^= hash{}( text->GetHorizJustify() ); - ret ^= hash{}( text->GetVertJustify() ); + ret += hash_board_item( text, aFlags ); + ret += hash{}( text->GetText().ToStdString() ); + ret += hash{}( text->IsItalic() ); + ret += hash{}( text->IsBold() ); + ret += hash{}( text->IsMirrored() ); + ret += hash{}( text->GetTextWidth() ); + ret += hash{}( text->GetTextHeight() ); + ret += hash{}( text->GetHorizJustify() ); + ret += hash{}( text->GetVertJustify() ); if( aFlags & POSITION ) { if( aFlags & REL_COORD ) { - ret ^= hash{}( text->GetPos0().x ); - ret ^= hash{}( text->GetPos0().y ); + ret += hash{}( text->GetPos0().x ); + ret += hash{}( text->GetPos0().y ); } else { - ret ^= hash{}( text->GetPosition().x ); - ret ^= hash{}( text->GetPosition().y ); + ret += hash{}( text->GetPosition().x ); + ret += hash{}( text->GetPosition().y ); } } if( aFlags & ROTATION ) - ret ^= hash{}( text->GetTextAngle() ); + ret += hash{}( text->GetTextAngle() ); } break; case PCB_MODULE_EDGE_T: { const EDGE_MODULE* segment = static_cast( aItem ); - ret ^= hash_board_item( segment, aFlags ); - ret ^= hash{}( segment->GetType() ); - ret ^= hash{}( segment->GetShape() ); - ret ^= hash{}( segment->GetWidth() ); - ret ^= hash{}( segment->GetRadius() ); + ret += hash_board_item( segment, aFlags ); + ret += hash{}( segment->GetType() ); + ret += hash{}( segment->GetShape() ); + ret += hash{}( segment->GetWidth() ); + ret += hash{}( segment->GetRadius() ); if( aFlags & POSITION ) { if( aFlags & REL_COORD ) { - ret ^= hash{}( segment->GetStart0().x ); - ret ^= hash{}( segment->GetStart0().y ); - ret ^= hash{}( segment->GetEnd0().x ); - ret ^= hash{}( segment->GetEnd0().y ); + ret += hash{}( segment->GetStart0().x ); + ret += hash{}( segment->GetStart0().y ); + ret += hash{}( segment->GetEnd0().x ); + ret += hash{}( segment->GetEnd0().y ); } else { - ret ^= hash{}( segment->GetStart().x ); - ret ^= hash{}( segment->GetStart().y ); - ret ^= hash{}( segment->GetEnd().x ); - ret ^= hash{}( segment->GetEnd().y ); + ret += hash{}( segment->GetStart().x ); + ret += hash{}( segment->GetStart().y ); + ret += hash{}( segment->GetEnd().x ); + ret += hash{}( segment->GetEnd().y ); } } if( aFlags & ROTATION ) - ret ^= hash{}( segment->GetAngle() ); + ret += hash{}( segment->GetAngle() ); } break; diff --git a/include/hash_eda.h b/include/hash_eda.h index 2707039e74..5bc2290922 100644 --- a/include/hash_eda.h +++ b/include/hash_eda.h @@ -46,7 +46,7 @@ enum HASH_FLAGS ALL = 0xff }; -/* +/** * Calculates hash of an EDA_ITEM. * @param aItem is the item for which the hash will be computed. * @return Hash value. diff --git a/pcbnew/dialogs/dialog_gencad_export_options.cpp b/pcbnew/dialogs/dialog_gencad_export_options.cpp index af23b9f73b..f354d29c09 100644 --- a/pcbnew/dialogs/dialog_gencad_export_options.cpp +++ b/pcbnew/dialogs/dialog_gencad_export_options.cpp @@ -50,7 +50,7 @@ DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aPar wxBoxSizer* m_fileSizer = new wxBoxSizer( wxHORIZONTAL ); - m_filePath = new wxTextCtrl( this, wxID_ANY, fn.GetFullPath() ); + m_filePath = new wxTextCtrl( this, wxID_ANY ); m_fileSizer->Add( m_filePath, 1, wxEXPAND | wxRIGHT, 5 ); wxButton* m_browseBtn = new wxButton( this, wxID_ANY, _( "Browse" ) ); @@ -73,6 +73,10 @@ DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aPar Layout(); m_mainSizer->Fit( this ); + // Now the widgets sizes are fixed, we can initialize the m_filePath value. + // It will be correctly displayed + m_filePath->SetValue( fn.GetFullPath() ); + Centre( wxBOTH ); } diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 30f8d72ff0..2b4c6113c6 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -721,10 +721,10 @@ static size_t hashModule( const MODULE* aModule ) | HASH_FLAGS::ROTATION | HASH_FLAGS::LAYER; for( const BOARD_ITEM* i = aModule->GraphicalItemsList(); i; i = i->Next() ) - ret ^= hash_eda( i, flags ); + ret += hash_eda( i, flags ); for( const D_PAD* i = aModule->PadsList(); i; i = i->Next() ) - ret ^= hash_eda( i, flags ); + ret += hash_eda( i, flags ); return ret; }