Gerbview: fix a crash when reading polygons with arcs.
Fix a very minor other issue (due to a minor bug in wx 3.1) Displays the full graphic layer name of the selected item in message panel (instead of just the graphic layer number)
This commit is contained in:
parent
cd976d36b7
commit
c8cf78398b
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_gerber_file_image.h>
|
||||
#include <class_gerber_file_image_list.h>
|
||||
|
||||
|
||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
||||
|
@ -52,6 +53,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
|||
m_mirrorB = false;
|
||||
m_drawScale.x = m_drawScale.y = 1.0;
|
||||
m_lyrRotation = 0;
|
||||
|
||||
if( m_GerberImageFile )
|
||||
SetLayerParameters();
|
||||
}
|
||||
|
@ -514,7 +516,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
|||
aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
|
||||
|
||||
// Display graphic layer number
|
||||
msg.Printf( wxT( "%d" ), GetLayer() + 1 );
|
||||
msg = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, BROWN ) );
|
||||
|
||||
// Display item rotation
|
||||
|
|
|
@ -120,7 +120,7 @@ void GERBER_FILE_IMAGE_LIST::DeleteImage( int aIdx )
|
|||
}
|
||||
|
||||
// Build a name for image aIdx which can be used in layers manager
|
||||
const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx )
|
||||
const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly )
|
||||
{
|
||||
wxString name;
|
||||
|
||||
|
@ -151,7 +151,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx )
|
|||
{
|
||||
if( gerber->m_FileFunction->IsCopper() )
|
||||
{
|
||||
name.Printf( "%d %s (%s, %s, %s)", aIdx + 1,
|
||||
name.Printf( "%s (%s, %s, %s)",
|
||||
filename.GetData(),
|
||||
GetChars( gerber->m_FileFunction->GetFileType() ),
|
||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
|
||||
|
@ -159,14 +159,23 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx )
|
|||
}
|
||||
else
|
||||
{
|
||||
name.Printf( "%d %s (%s, %s)", aIdx + 1,
|
||||
name.Printf( "%s (%s, %s)",
|
||||
filename.GetData(),
|
||||
GetChars( gerber->m_FileFunction->GetFileType() ),
|
||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
name.Printf( _( "%d %s" ), aIdx + 1, filename.GetData() );
|
||||
name = filename;
|
||||
|
||||
if( aNameOnly )
|
||||
return name;
|
||||
|
||||
wxString fullname;
|
||||
|
||||
fullname.Printf( "%d ", aIdx + 1 );
|
||||
fullname << name;
|
||||
return fullname;
|
||||
}
|
||||
else
|
||||
name.Printf( _( "Graphic layer %d" ), aIdx + 1 );
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
/**
|
||||
* @return a name for image aIdx which can be used in layers manager
|
||||
* and layer selector
|
||||
* and layer selector or in the status bar
|
||||
* if a file is loaded, the name is:
|
||||
* "<aIdx+1> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found"
|
||||
* or (if no FileFunction info)
|
||||
|
@ -105,8 +105,10 @@ public:
|
|||
* if no file loaded, the name is:
|
||||
* "Layer n" with n = aIdx+1
|
||||
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||
* @param aNameOnly = false (default) to add the layer number (for layers manager)
|
||||
* or true to return only the name without layer name (status bar)
|
||||
*/
|
||||
const wxString GetDisplayName( int aIdx );
|
||||
const wxString GetDisplayName( int aIdx, bool aNameOnly = false );
|
||||
|
||||
/**
|
||||
* Sort loaded images by Z order priority, if they have the X2 FileFormat info
|
||||
|
|
|
@ -111,7 +111,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
|||
* Because the first letter is usually g, we accept g* as extension
|
||||
* (Mainly internal copper layers do not have specific extension,
|
||||
* and filenames are like *.g1, *.g2 *.gb1 ...).
|
||||
* Now (2014) Ucamco (the company which manager the Gerber format) encourage
|
||||
* Now (2014) Ucamco (the company which manages the Gerber format) encourages
|
||||
* use of .gbr only and the Gerber X2 file format.
|
||||
*/
|
||||
filetypes = _( "Gerber files (.g* .lgr .pho)" );
|
||||
|
@ -133,17 +133,23 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
|||
filetypes += _( "Top Pad Master (*.GPT)|*.GPT;*.gpt|" );
|
||||
filetypes += _( "Bottom Pad Master (*.GPB)|*.GPB;*.gpb|" );
|
||||
|
||||
/* All filetypes */
|
||||
// All filetypes
|
||||
filetypes += AllFilesWildcard;
|
||||
|
||||
/* Use the current working directory if the file name path does not exist. */
|
||||
// Use the current working directory if the file name path does not exist.
|
||||
if( filename.DirExists() )
|
||||
currentPath = filename.GetPath();
|
||||
else
|
||||
{
|
||||
currentPath = m_mruPath;
|
||||
|
||||
wxFileDialog dlg( this,
|
||||
_( "Open Gerber File" ),
|
||||
// On wxWidgets 3.1 (bug?) the path in wxFileDialog is ignored when
|
||||
// finishing by the dir separator. Remove it if any:
|
||||
if( currentPath.EndsWith( '\\' ) || currentPath.EndsWith( '/' ) )
|
||||
currentPath.RemoveLast();
|
||||
}
|
||||
|
||||
wxFileDialog dlg( this, _( "Open Gerber File" ),
|
||||
currentPath,
|
||||
filename.GetFullName(),
|
||||
filetypes,
|
||||
|
|
|
@ -221,6 +221,7 @@ static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index,
|
|||
aGbrItem->m_Size = aPenSize;
|
||||
aGbrItem->m_Flashed = false;
|
||||
|
||||
if( aGbrItem->m_GerberImageFile )
|
||||
aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict );
|
||||
|
||||
if( aMultiquadrant )
|
||||
|
|
Loading…
Reference in New Issue