GerbView: Add actions to reload files

NEW: Adds new items in File Menu and Toolbar to reload the Gerber files
for all layers.

Fixes: lp:1794004
* https://bugs.launchpad.net/kicad/+bug/1794004
This commit is contained in:
Nabeel Ahmad 2018-10-08 14:51:13 +05:00 committed by Maciej Suminski
parent d599a02a90
commit 664fb234ff
5 changed files with 39 additions and 0 deletions

View File

@ -57,6 +57,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_RELOAD_ALL, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_JOB_FILE, GERBVIEW_FRAME::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_JOB_FILE, GERBVIEW_FRAME::Files_io )

View File

@ -120,6 +120,32 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
ClearMsgPanel(); ClearMsgPanel();
break; break;
case ID_GERBVIEW_RELOAD_ALL:
{
// Store filenames
wxArrayString listOfFilenames;
listOfFilenames.Empty();
for( unsigned i = 0; i < GetImagesList()->ImagesMaxCount(); i++ )
{
if( GetImagesList()->GetGbrImage( i ) != nullptr )
{
if( GetImagesList()->GetGbrImage( i )->m_InUse == 1 )
listOfFilenames.Add( GetImagesList()->GetGbrImage( i )->m_FileName );
}
}
// Clear all layers
Clear_DrawLayers( false );
Zoom_Automatique( false );
m_canvas->Refresh();
ClearMsgPanel();
// Load the layers from stored paths
wxBusyCursor wait;
loadListOfGerberFiles( wxEmptyString, listOfFilenames );
}
break;
case ID_GERBVIEW_LOAD_DRILL_FILE: case ID_GERBVIEW_LOAD_DRILL_FILE:
LoadExcellonFiles( wxEmptyString ); LoadExcellonFiles( wxEmptyString );
m_canvas->Refresh(); m_canvas->Refresh();

View File

@ -45,6 +45,7 @@ enum gerbview_ids
ID_GERBVIEW_LOAD_JOB_FILE, ID_GERBVIEW_LOAD_JOB_FILE,
ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE,
ID_GERBVIEW_ERASE_ALL, ID_GERBVIEW_ERASE_ALL,
ID_GERBVIEW_RELOAD_ALL,
ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE,
ID_GERBVIEW_SHOW_SOURCE, ID_GERBVIEW_SHOW_SOURCE,
ID_GERBVIEW_EXPORT_TO_PCBNEW, ID_GERBVIEW_EXPORT_TO_PCBNEW,

View File

@ -145,6 +145,13 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
_( "Clear all layers. All data will be deleted" ), _( "Clear all layers. All data will be deleted" ),
KiBitmap( delete_gerber_xpm ) ); KiBitmap( delete_gerber_xpm ) );
// Reload all
AddMenuItem( fileMenu,
ID_GERBVIEW_RELOAD_ALL,
_( "Reload All Layers" ),
_( "Reload all layers. All data will be reloaded" ),
KiBitmap( reload2_xpm ) );
// Separator // Separator
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();

View File

@ -56,6 +56,10 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
KiScaledBitmap( delete_gerber_xpm, this ), KiScaledBitmap( delete_gerber_xpm, this ),
_( "Clear all layers" ) ); _( "Clear all layers" ) );
m_mainToolBar->AddTool( ID_GERBVIEW_RELOAD_ALL, wxEmptyString,
KiScaledBitmap( reload2_xpm, this ),
_( "Reload all layers" ) );
m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiScaledBitmap( load_gerber_xpm, this ), m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiScaledBitmap( load_gerber_xpm, this ),
_( "Open Gerber file(s) on the current layer. Previous data will be deleted" ) ); _( "Open Gerber file(s) on the current layer. Previous data will be deleted" ) );