updating patch to master

This commit is contained in:
Kristoffer Ödmark 2017-09-17 14:04:57 +02:00 committed by Tomasz Włostowski
parent bd8980596f
commit 7ff096fbac
6 changed files with 27 additions and 44 deletions

View File

@ -92,7 +92,7 @@ void CLIPBOARD_IO::SaveSelection( SELECTION& aSelected )
{
// make the module safe to transfer to other pcbs
MODULE* mod = static_cast<MODULE*>( aSelected.Front() );
for( D_PAD* pad = mod->Pads().GetFirst(); pad; pad = pad->Next() )
for( D_PAD* pad = mod->PadsList().begin(); pad; pad = pad->Next() )
{
pad->SetNetCode( 0,0 );
}

View File

@ -44,7 +44,6 @@ public:
CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {};
MODULE* parseMODULE( wxArrayString* aInitialComments )
throw( IO_ERROR, PARSE_ERROR, FUTURE_FORMAT_ERROR ) override
{
MODULE* mod = PCB_PARSER::parseMODULE( aInitialComments );
@ -78,7 +77,6 @@ public:
void writeHeader( BOARD* aBoard );
STRING_FORMATTER* GetFormatter();
};

View File

@ -527,7 +527,7 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
m_out->Print( 0, " (layer %s)", m_out->Quotew( aItem->GetLayerName() ).c_str() );
}
void PCB_IO::formatSetup( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
void PCB_IO::formatSetup( BOARD* aBoard, int aNestLevel ) const
{
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
@ -609,7 +609,6 @@ void PCB_IO::formatSetup( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
m_out->Print( aNestLevel, ")\n\n" );
// Setup
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
m_out->Print( aNestLevel, "(setup\n" );
// Save current default track width, for compatibility with older Pcbnew version;
@ -722,24 +721,17 @@ void PCB_IO::formatSetup( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
m_out->Print( aNestLevel, ")\n\n" );
}
void PCB_IO::formatGeneral( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
void PCB_IO::formatGeneral( BOARD* aBoard, int aNestLevel ) const
{
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel, "(general\n" );
m_out->Print( aNestLevel+1, "(links %d)\n", aBoard->GetRatsnestsCount() );
m_out->Print( aNestLevel+1, "(no_connects %d)\n", aBoard->GetUnconnectedNetCount() );
// Write Bounding box info
EDA_RECT bbox = aBoard->GetBoundingBox();
m_out->Print( aNestLevel+1, "(area %s %s %s %s)\n",
FMTIU( bbox.GetX() ).c_str(), FMTIU( bbox.GetY() ).c_str(),
FMTIU( bbox.GetRight() ).c_str(), FMTIU( bbox.GetBottom() ).c_str() );
m_out->Print( aNestLevel+1, "(thickness %s)\n",
FMTIU( dsnSettings.GetBoardThickness() ).c_str() );
m_out->Print( aNestLevel+1, "(drawings %d)\n", aBoard->m_Drawings.GetCount() );
m_out->Print( aNestLevel+1, "(drawings %d)\n", aBoard->Drawings().Size() );
m_out->Print( aNestLevel+1, "(tracks %d)\n", aBoard->GetNumSegmTrack() );
m_out->Print( aNestLevel+1, "(zones %d)\n", aBoard->GetNumSegmZone() );
m_out->Print( aNestLevel+1, "(modules %d)\n", aBoard->m_Modules.GetCount() );
@ -750,7 +742,7 @@ void PCB_IO::formatGeneral( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR
aBoard->GetTitleBlock().Format( m_out, aNestLevel, m_ctl );
}
void PCB_IO::formatBoardLayers( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
void PCB_IO::formatBoardLayers( BOARD* aBoard, int aNestLevel ) const
{
m_out->Print( aNestLevel, "(layers\n" );
@ -810,7 +802,7 @@ void PCB_IO::formatBoardLayers( BOARD* aBoard, int aNestLevel ) const throw(IO_E
m_out->Print( aNestLevel, ")\n\n" );
}
void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const
{
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end();
@ -839,7 +831,7 @@ void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const throw(I
}
}
void PCB_IO::formatHeader( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
void PCB_IO::formatHeader( BOARD* aBoard, int aNestLevel ) const
{
formatGeneral(aBoard);
// Layers.
@ -851,7 +843,6 @@ void PCB_IO::formatHeader( BOARD* aBoard, int aNestLevel ) const throw(IO_ERROR)
}
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
throw( IO_ERROR )
{
formatHeader( aBoard );
@ -2132,7 +2123,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
if( !fn.IsOk() )
{
THROW_IO_ERROR( wxString::Format( _( "Footprint file name '%s' is not valid." ),
THROW_IO_ERROR( wxString::Format( _( "Footprint file name '%s' is not valid." ),
GetChars( fn.GetFullPath() ) ) );
}

View File

@ -189,24 +189,19 @@ protected:
void init( const PROPERTIES* aProperties );
/// formats the board setup information
void formatSetup( BOARD* aBoard, int aNestLevel = 0 ) const
throw( IO_ERROR );
void formatSetup( BOARD* aBoard, int aNestLevel = 0 ) const;
/// formats the General section of the file
void formatGeneral( BOARD* aBoard, int aNestLevel = 0 ) const
throw( IO_ERROR );
void formatGeneral( BOARD* aBoard, int aNestLevel = 0 ) const;
/// formats the board layer information
void formatBoardLayers( BOARD* aBoard, int aNestLevel = 0 ) const
throw( IO_ERROR );
void formatBoardLayers( BOARD* aBoard, int aNestLevel = 0 ) const;
/// formats the Nets and Netclasses
void formatNetInformation( BOARD* aBoard, int aNestLevel = 0 ) const
throw( IO_ERROR );
void formatNetInformation( BOARD* aBoard, int aNestLevel = 0 ) const;
/// writes everything that comes before the board_items, like settings and layers etc
void formatHeader( BOARD* aBoard, int aNestLevel = 0 ) const
throw( IO_ERROR );
void formatHeader( BOARD* aBoard, int aNestLevel = 0 ) const;
private:
void format( BOARD* aBoard, int aNestLevel = 0 ) const;

View File

@ -117,13 +117,6 @@ class PCB_PARSER : public PCB_LEXER
DRAWSEGMENT* parseDRAWSEGMENT();
TEXTE_PCB* parseTEXTE_PCB();
DIMENSION* parseDIMENSION();
/**
* Function parseMODULE
* @param aInitialComments may be a pointer to a heap allocated initial comment block
* or NULL. If not NULL, then caller has given ownership of a wxArrayString to
* this function and care must be taken to delete it even on exception.
*/
MODULE* parseMODULE( wxArrayString* aInitialComments = 0 );
/**
* Function parseMODULE_unchecked
@ -308,6 +301,13 @@ public:
}
BOARD_ITEM* Parse();
/**
* Function parseMODULE
* @param aInitialComments may be a pointer to a heap allocated initial comment block
* or NULL. If not NULL, then caller has given ownership of a wxArrayString to
* this function and care must be taken to delete it even on exception.
*/
MODULE* parseMODULE( wxArrayString* aInitialComments = 0 );
/**
* Return whether a version number, if any was parsed, was too recent

View File

@ -337,14 +337,13 @@ int MODULE_EDITOR_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
MODULE* pastedModule = aEvent.Parameter<MODULE*>();
for( BOARD_ITEM* item = pastedModule->GraphicalItems().GetFirst(); item;
item = item->Next() )
{
frame()->DisplayToolMsg( _( "Invalid clipboard contents" ) );
if( item->Type() == PCB_MODULE_TEXT_T )
std::cout << "Crashing on this" << std::endl;
return 0;
}
/* for( BOARD_ITEM* item = pastedModule->GraphicalItems().begin(); item; */
/* item = item->Next() ) */
/* { */
/* if( item->Type() == PCB_MODULE_TEXT_T ) */
/* std::cout << "Crashing on this" << std::endl; */
/* return 0; */
/* } */
// Placement tool part
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();