Gerbview: fix an issue with gerber files having a line comment starting by G04 and a command after this comment, on the same line.

This commit is contained in:
jean-pierre charras 2010-11-04 19:51:18 +01:00
parent ec35a66ffb
commit 7873b46e45
3 changed files with 19 additions and 4 deletions

View File

@ -74,13 +74,27 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
// Ensure the whole frame is visible, whenever the asked position. // Ensure the whole frame is visible, whenever the asked position.
// Moreover with a work station having dual monitors, the asked position can be relative to a monitor
// and this frame can be displayed on the other monitor, with an "out of screen" position.
// Give also a small margin. // Give also a small margin.
wxPoint endCornerPosition = GetPosition();
int margin = 10; int margin = 10;
wxPoint windowPosition = GetPosition();
if( framepos != wxDefaultPosition )
{
if( windowPosition.x < margin )
windowPosition.x = margin;
// Under MACOS, a vertical margin >= 20 is needed by the system menubar
int v_margin = MAX(20, margin);
if( windowPosition.y < v_margin )
windowPosition.y = v_margin;
if( windowPosition != framepos )
SetPosition(windowPosition);
}
wxPoint endCornerPosition = GetPosition();
endCornerPosition.x += GetSize().x + margin; endCornerPosition.x += GetSize().x + margin;
endCornerPosition.y += GetSize().y + margin; endCornerPosition.y += GetSize().y + margin;
wxPoint windowPosition = GetPosition(); windowPosition = GetPosition();
wxRect freeScreenArea( wxGetClientDisplayRect( ) ); wxRect freeScreenArea( wxGetClientDisplayRect( ) );
if( freeScreenArea.GetRight() < endCornerPosition.x ) if( freeScreenArea.GetRight() < endCornerPosition.x )
{ {

View File

@ -94,7 +94,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
gerber->m_CommandState = CMD_IDLE; gerber->m_CommandState = CMD_IDLE;
while( *text ) while( *text )
text++; text++;
break; break;
case 'G': /* Line type Gxx : command */ case 'G': /* Line type Gxx : command */

View File

@ -455,7 +455,9 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_commande )
break; break;
case GC_COMMENT: case GC_COMMENT:
text = NULL; // Skip comment
while ( *text && (*text != '*') )
text++;
break; break;
case GC_LINEAR_INTERPOL_10X: case GC_LINEAR_INTERPOL_10X: