From 7873b46e459e1909c50ce7020e64952f6e15e1c7 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 4 Nov 2010 19:51:18 +0100 Subject: [PATCH] Gerbview: fix an issue with gerber files having a line comment starting by G04 and a command after this comment, on the same line. --- common/selcolor.cpp | 18 ++++++++++++++++-- gerbview/readgerb.cpp | 1 - gerbview/rs274d.cpp | 4 +++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common/selcolor.cpp b/common/selcolor.cpp index 8be6bd0e41..13238e2da7 100644 --- a/common/selcolor.cpp +++ b/common/selcolor.cpp @@ -74,13 +74,27 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent, GetSizer()->SetSizeHints( this ); // 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. - wxPoint endCornerPosition = GetPosition(); 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.y += GetSize().y + margin; - wxPoint windowPosition = GetPosition(); + windowPosition = GetPosition(); wxRect freeScreenArea( wxGetClientDisplayRect( ) ); if( freeScreenArea.GetRight() < endCornerPosition.x ) { diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index ff9de75fe8..8739ce8257 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -94,7 +94,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName, gerber->m_CommandState = CMD_IDLE; while( *text ) text++; - break; case 'G': /* Line type Gxx : command */ diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index cd42fe8a4d..6c442daeb8 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -455,7 +455,9 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_commande ) break; case GC_COMMENT: - text = NULL; + // Skip comment + while ( *text && (*text != '*') ) + text++; break; case GC_LINEAR_INTERPOL_10X: