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 // make the module safe to transfer to other pcbs
MODULE* mod = static_cast<MODULE*>( aSelected.Front() ); 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 ); pad->SetNetCode( 0,0 );
} }

View File

@ -44,7 +44,6 @@ public:
CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {}; CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {};
MODULE* parseMODULE( wxArrayString* aInitialComments ) MODULE* parseMODULE( wxArrayString* aInitialComments )
throw( IO_ERROR, PARSE_ERROR, FUTURE_FORMAT_ERROR ) override
{ {
MODULE* mod = PCB_PARSER::parseMODULE( aInitialComments ); MODULE* mod = PCB_PARSER::parseMODULE( aInitialComments );
@ -78,7 +77,6 @@ public:
void writeHeader( BOARD* aBoard ); void writeHeader( BOARD* aBoard );
STRING_FORMATTER* GetFormatter(); 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() ); 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(); 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" ); m_out->Print( aNestLevel, ")\n\n" );
// Setup // Setup
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
m_out->Print( aNestLevel, "(setup\n" ); m_out->Print( aNestLevel, "(setup\n" );
// Save current default track width, for compatibility with older Pcbnew version; // 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" ); 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(); const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
m_out->Print( 0, "\n" ); m_out->Print( 0, "\n" );
m_out->Print( aNestLevel, "(general\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 // 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", m_out->Print( aNestLevel+1, "(thickness %s)\n",
FMTIU( dsnSettings.GetBoardThickness() ).c_str() ); 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, "(tracks %d)\n", aBoard->GetNumSegmTrack() );
m_out->Print( aNestLevel+1, "(zones %d)\n", aBoard->GetNumSegmZone() ); m_out->Print( aNestLevel+1, "(zones %d)\n", aBoard->GetNumSegmZone() );
m_out->Print( aNestLevel+1, "(modules %d)\n", aBoard->m_Modules.GetCount() ); 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 ); 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" ); 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" ); 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(); const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end(); 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); formatGeneral(aBoard);
// Layers. // 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 void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
throw( IO_ERROR )
{ {
formatHeader( aBoard ); formatHeader( aBoard );

View File

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

View File

@ -117,13 +117,6 @@ class PCB_PARSER : public PCB_LEXER
DRAWSEGMENT* parseDRAWSEGMENT(); DRAWSEGMENT* parseDRAWSEGMENT();
TEXTE_PCB* parseTEXTE_PCB(); TEXTE_PCB* parseTEXTE_PCB();
DIMENSION* parseDIMENSION(); 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 * Function parseMODULE_unchecked
@ -308,6 +301,13 @@ public:
} }
BOARD_ITEM* Parse(); 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 * 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*>(); MODULE* pastedModule = aEvent.Parameter<MODULE*>();
for( BOARD_ITEM* item = pastedModule->GraphicalItems().GetFirst(); item; /* for( BOARD_ITEM* item = pastedModule->GraphicalItems().begin(); item; */
item = item->Next() ) /* item = item->Next() ) */
{ /* { */
frame()->DisplayToolMsg( _( "Invalid clipboard contents" ) ); /* if( item->Type() == PCB_MODULE_TEXT_T ) */
if( item->Type() == PCB_MODULE_TEXT_T ) /* std::cout << "Crashing on this" << std::endl; */
std::cout << "Crashing on this" << std::endl; /* return 0; */
return 0; /* } */
}
// Placement tool part // Placement tool part
VECTOR2I cursorPos = getViewControls()->GetCursorPosition(); VECTOR2I cursorPos = getViewControls()->GetCursorPosition();