gerbview: Move more items to actions
This commit is contained in:
parent
565bb268bb
commit
4215917834
|
@ -46,13 +46,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow )
|
||||
EVT_SIZE( GERBVIEW_FRAME::OnSize )
|
||||
|
||||
EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io )
|
||||
EVT_TOOL( ID_GERBVIEW_RELOAD_ALL, GERBVIEW_FRAME::Files_io )
|
||||
EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
||||
|
||||
// Menu Files:
|
||||
EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
||||
|
||||
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, GERBVIEW_FRAME::OnGbrFileHistory )
|
||||
EVT_MENU( ID_FILE_LIST_CLEAR, GERBVIEW_FRAME::OnClearGbrFileHistory )
|
||||
|
||||
|
@ -75,8 +69,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
|
||||
|
||||
// Option toolbar
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
GERBVIEW_FRAME::OnToggleShowLayerManager )
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
|
||||
GERBVIEW_FRAME::OnSelectDisplayMode )
|
||||
|
||||
|
@ -181,13 +173,3 @@ void GERBVIEW_FRAME::ShowChangedLanguage()
|
|||
|
||||
ReFillLayerWidget();
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::OnToggleShowLayerManager( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
||||
|
||||
// show/hide auxiliary Vertical layers and visibility manager toolbar
|
||||
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
|
|
@ -112,60 +112,6 @@ void GERBVIEW_FRAME::OnClearJobFileHistory( wxCommandEvent& aEvent )
|
|||
ClearFileHistory( &m_jobFileHistory );
|
||||
}
|
||||
|
||||
/* File commands. */
|
||||
void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
|
||||
{
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_GERBVIEW_ERASE_ALL:
|
||||
Clear_DrawLayers( false );
|
||||
Zoom_Automatique( false );
|
||||
GetCanvas()->Refresh();
|
||||
ClearMsgPanel();
|
||||
break;
|
||||
|
||||
case ID_GERBVIEW_RELOAD_ALL:
|
||||
{
|
||||
// Store filenames
|
||||
wxArrayString listOfGerberFiles;
|
||||
std::vector<int> fileType;
|
||||
|
||||
for( unsigned i = 0; i < GetImagesList()->ImagesMaxCount(); i++ )
|
||||
{
|
||||
if( GetImagesList()->GetGbrImage( i ) == nullptr )
|
||||
continue;
|
||||
|
||||
if( !GetImagesList()->GetGbrImage( i )->m_InUse )
|
||||
continue;
|
||||
|
||||
auto* drill_file = dynamic_cast<EXCELLON_IMAGE*>( GetImagesList()->GetGbrImage( i ) );
|
||||
|
||||
if( drill_file )
|
||||
fileType.push_back( 1 );
|
||||
else
|
||||
fileType.push_back( 0 );
|
||||
|
||||
listOfGerberFiles.Add( GetImagesList()->GetGbrImage( i )->m_FileName );
|
||||
}
|
||||
|
||||
// Clear all layers
|
||||
Clear_DrawLayers( false );
|
||||
Zoom_Automatique( false );
|
||||
GetCanvas()->Refresh();
|
||||
ClearMsgPanel();
|
||||
|
||||
// Load the layers from stored paths
|
||||
wxBusyCursor wait;
|
||||
loadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &fileType );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "File_io: unexpected command id" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||
{
|
||||
|
@ -245,11 +191,11 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
|||
// Set the busy cursor
|
||||
wxBusyCursor wait;
|
||||
|
||||
return loadListOfGerberAndDrillFiles( currentPath, filenamesList );
|
||||
return LoadListOfGerberAndDrillFiles( currentPath, filenamesList );
|
||||
}
|
||||
|
||||
|
||||
bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
|
||||
bool GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles( const wxString& aPath,
|
||||
const wxArrayString& aFilenameList,
|
||||
const std::vector<int>* aFileType )
|
||||
{
|
||||
|
|
|
@ -1146,6 +1146,12 @@ void GERBVIEW_FRAME::setupUIConditions()
|
|||
return m_DisplayOptions.m_FlipGerberView;
|
||||
};
|
||||
|
||||
auto layersManagerShownCondition =
|
||||
[this] ( const SELECTION& aSel )
|
||||
{
|
||||
return m_show_layer_manager_tools;
|
||||
};
|
||||
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines, CHECK( flashedDisplayOutlinesCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::linesDisplayOutlines, CHECK( linesFillCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::polygonsDisplayOutlines, CHECK( polygonsFilledCond ) );
|
||||
|
@ -1154,17 +1160,7 @@ void GERBVIEW_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( GERBVIEW_ACTIONS::toggleDiffMode, CHECK( diffModeCond ) );
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::flipGerberView, CHECK( flipGerberCond ) );
|
||||
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastModeCond ) );
|
||||
|
||||
|
||||
auto layersManagerShownCondition =
|
||||
[this] ( const SELECTION& aSel )
|
||||
{
|
||||
return m_show_layer_manager_tools;
|
||||
};
|
||||
|
||||
RegisterUIUpdateHandler( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
CHECK( layersManagerShownCondition ) );
|
||||
|
||||
mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager, CHECK( layersManagerShownCondition ) );
|
||||
|
||||
#undef CHECK
|
||||
#undef ENABLE
|
||||
|
@ -1185,3 +1181,13 @@ SELECTION& GERBVIEW_FRAME::GetCurrentSelection()
|
|||
{
|
||||
return m_toolManager->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::ToggleLayerManager()
|
||||
{
|
||||
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
||||
|
||||
// show/hide auxiliary Vertical layers and visibility manager toolbar
|
||||
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
|
|
@ -196,18 +196,6 @@ private:
|
|||
/// Updates the GAL with display settings changes
|
||||
void applyDisplaySettingsToGAL();
|
||||
|
||||
/**
|
||||
* Loads a list of Gerber and NC drill files and updates the view based on them
|
||||
* @param aPath is the base path for the filenames if they are relative
|
||||
* @param aFilenameList is a list of filenames to load
|
||||
* @param aFileType is a list of type of files to load (0 = Gerber, 1 = NC drill)
|
||||
* if nullptr, files are expected Gerber type.
|
||||
* @return true if every file loaded successfully
|
||||
*/
|
||||
bool loadListOfGerberAndDrillFiles( const wxString& aPath,
|
||||
const wxArrayString& aFilenameList,
|
||||
const std::vector<int>* aFileType = nullptr );
|
||||
|
||||
public:
|
||||
GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~GERBVIEW_FRAME();
|
||||
|
@ -216,6 +204,19 @@ public:
|
|||
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
|
||||
|
||||
/**
|
||||
* Loads a list of Gerber and NC drill files and updates the view based on them
|
||||
*
|
||||
* @param aPath is the base path for the filenames if they are relative
|
||||
* @param aFilenameList is a list of filenames to load
|
||||
* @param aFileType is a list of type of files to load (0 = Gerber, 1 = NC drill)
|
||||
* if nullptr, files are expected Gerber type.
|
||||
* @return true if every file loaded successfully
|
||||
*/
|
||||
bool LoadListOfGerberAndDrillFiles( const wxString& aPath,
|
||||
const wxArrayString& aFilenameList,
|
||||
const std::vector<int>* aFileType = nullptr );
|
||||
|
||||
// Virtual basic functions:
|
||||
void ReCreateHToolbar() override;
|
||||
void ReCreateAuxiliaryToolbar() override;
|
||||
|
@ -383,7 +384,7 @@ public:
|
|||
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
void OnToggleShowLayerManager( wxCommandEvent& aEvent );
|
||||
void ToggleLayerManager();
|
||||
|
||||
void ShowChangedLanguage() override;
|
||||
|
||||
|
@ -423,8 +424,6 @@ public:
|
|||
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
||||
|
||||
void Files_io( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnGbrFileHistory
|
||||
* deletes the current data and loads a Gerber file selected from history list on
|
||||
|
|
|
@ -38,8 +38,6 @@ enum gerbview_ids
|
|||
{
|
||||
ID_MAIN_MENUBAR = ID_END_LIST,
|
||||
|
||||
ID_GERBVIEW_ERASE_ALL,
|
||||
ID_GERBVIEW_RELOAD_ALL,
|
||||
ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE,
|
||||
|
||||
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,
|
||||
|
@ -47,7 +45,6 @@ enum gerbview_ids
|
|||
ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE,
|
||||
|
||||
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
|
||||
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
ID_TB_OPTIONS_SHOW_GBR_MODE_0,
|
||||
ID_TB_OPTIONS_SHOW_GBR_MODE_1,
|
||||
ID_TB_OPTIONS_SHOW_GBR_MODE_2,
|
||||
|
|
|
@ -222,7 +222,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName )
|
|||
|
||||
wxArrayString& gbrfiles = gbjReader.GetGerberFiles();
|
||||
|
||||
success = loadListOfGerberAndDrillFiles( currentPath, gbrfiles );
|
||||
success = LoadListOfGerberAndDrillFiles( currentPath, gbrfiles );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,15 +135,8 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
#undef FileHistoryCond
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Add( _( "Clear &All Layers" ),
|
||||
_( "Clear all layers. All data will be deleted" ),
|
||||
ID_GERBVIEW_ERASE_ALL,
|
||||
delete_gerber_xpm );
|
||||
|
||||
fileMenu->Add( _( "Reload All Layers" ),
|
||||
_( "Reload all layers. All data will be reloaded" ),
|
||||
ID_GERBVIEW_RELOAD_ALL,
|
||||
reload2_xpm );
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::clearAllLayers );
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::reloadAllLayers );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Add( GERBVIEW_ACTIONS::exportToPcbnew );
|
||||
|
@ -159,11 +152,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
|
||||
|
||||
// Hide layer manager
|
||||
viewMenu->Add( _( "Show &Layers Manager" ),
|
||||
_( "Show or hide the layer manager" ),
|
||||
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
layers_manager_xpm );
|
||||
viewMenu->Add( GERBVIEW_ACTIONS::toggleLayerManager, ACTION_MENU::CHECK );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->Add( ACTIONS::zoomInCenter );
|
||||
|
@ -213,7 +202,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
toolsMenu->Add( ACTIONS::measureTool );
|
||||
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->Add( GERBVIEW_ACTIONS::eraseLayer );
|
||||
toolsMenu->Add( GERBVIEW_ACTIONS::clearLayer );
|
||||
|
||||
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
|
|
|
@ -55,14 +55,8 @@ void GERBVIEW_FRAME::ReCreateHToolbar()
|
|||
}
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString,
|
||||
KiScaledBitmap( delete_gerber_xpm, this ),
|
||||
_( "Clear all layers" ) );
|
||||
|
||||
m_mainToolBar->AddTool( ID_GERBVIEW_RELOAD_ALL, wxEmptyString,
|
||||
KiScaledBitmap( reload2_xpm, this ),
|
||||
_( "Reload all layers" ) );
|
||||
|
||||
m_mainToolBar->Add( GERBVIEW_ACTIONS::clearAllLayers );
|
||||
m_mainToolBar->Add( GERBVIEW_ACTIONS::reloadAllLayers );
|
||||
m_mainToolBar->Add( GERBVIEW_ACTIONS::openGerber );
|
||||
m_mainToolBar->Add( GERBVIEW_ACTIONS::openDrillFile );
|
||||
|
||||
|
@ -264,13 +258,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
|
|||
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::flipGerberView, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
// Tools to show/hide toolbars:
|
||||
m_optionsToolBar->AddScaledSeparator( this );
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
wxEmptyString,
|
||||
KiScaledBitmap( layers_manager_xpm, this ),
|
||||
_( "Show/hide the layers manager toolbar" ),
|
||||
wxITEM_CHECK );
|
||||
m_optionsToolBar->Add( GERBVIEW_ACTIONS::toggleLayerManager, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_optionsToolBar->Realize();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,12 @@ TOOL_ACTION GERBVIEW_ACTIONS::openZipFile( "gerbview.Control.openZipFile",
|
|||
_( "Open a zipped archive (Gerber and Drill) file" ),
|
||||
zip_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::toggleLayerManager( "gerbview.Control.toggleLayerManager",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Show Layers Manager" ),
|
||||
_( "Show or hide the layer manager" ),
|
||||
layers_manager_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::showDCodes( "gerbview.Inspection.showDCodes",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "List DCodes..." ),
|
||||
|
@ -76,11 +82,23 @@ TOOL_ACTION GERBVIEW_ACTIONS::exportToPcbnew( "gerbview.Control.exportToPcbnew",
|
|||
_( "Export data in Pcbnew format" ),
|
||||
export_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::eraseLayer( "gerbview.Control.eraseLayer",
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::clearLayer( "gerbview.Control.clearLayer",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Clear Current Layer..." ), _( "Clear the selected graphic layer" ),
|
||||
delete_sheet_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::clearAllLayers( "gerbview.Control.clearAllLayers",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Clear All Layers" ),
|
||||
_( "Clear all layers. All data will be deleted" ),
|
||||
delete_gerber_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::reloadAllLayers( "gerbview.Control.reloadAllLayers",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Reload All Layers" ),
|
||||
_( "Reload all layers. All data will be reloaded" ),
|
||||
reload2_xpm );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged",
|
||||
AS_GLOBAL, 0, "", "", "",
|
||||
nullptr, AF_NOTIFY );
|
||||
|
|
|
@ -72,7 +72,9 @@ public:
|
|||
// Layer control
|
||||
static TOOL_ACTION layerPrev;
|
||||
static TOOL_ACTION layerNext;
|
||||
static TOOL_ACTION eraseLayer;
|
||||
static TOOL_ACTION clearLayer;
|
||||
static TOOL_ACTION clearAllLayers;
|
||||
static TOOL_ACTION reloadAllLayers;
|
||||
|
||||
static TOOL_ACTION layerChanged; // notification
|
||||
|
||||
|
@ -82,6 +84,9 @@ public:
|
|||
static TOOL_ACTION openJobFile;
|
||||
static TOOL_ACTION openZipFile;
|
||||
|
||||
// Open/close the layer manager
|
||||
static TOOL_ACTION toggleLayerManager;
|
||||
|
||||
// Highlighting
|
||||
static TOOL_ACTION highlightClear;
|
||||
static TOOL_ACTION highlightNet;
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
#include <confirm.h>
|
||||
#include <dialogs/dialog_layers_select_to_pcb.h>
|
||||
#include <export_to_pcbnew.h>
|
||||
#include <gerber_file_image.h>
|
||||
#include <gerber_file_image_list.h>
|
||||
#include <gerbview_painter.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <excellon_image.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <view/view.h>
|
||||
|
@ -57,7 +59,7 @@ int GERBVIEW_CONTROL::OpenGerber( const TOOL_EVENT& aEvent )
|
|||
int GERBVIEW_CONTROL::OpenDrillFile( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->LoadExcellonFiles( wxEmptyString );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
canvas()->Refresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -66,7 +68,7 @@ int GERBVIEW_CONTROL::OpenDrillFile( const TOOL_EVENT& aEvent )
|
|||
int GERBVIEW_CONTROL::OpenJobFile( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->LoadGerberJobFile( wxEmptyString );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
canvas()->Refresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,7 +77,15 @@ int GERBVIEW_CONTROL::OpenJobFile( const TOOL_EVENT& aEvent )
|
|||
int GERBVIEW_CONTROL::OpenZipFile( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->LoadZipArchiveFile( wxEmptyString );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
canvas()->Refresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::ToggleLayerManager( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->ToggleLayerManager();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -180,8 +190,8 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
canvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
|
||||
canvas()->Refresh();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -232,7 +242,7 @@ int GERBVIEW_CONTROL::DisplayControl( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
options.m_FlipGerberView = !options.m_FlipGerberView;
|
||||
|
||||
KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
|
||||
KIGFX::VIEW* view = canvas()->GetView();
|
||||
view->SetMirror( options.m_FlipGerberView, false );
|
||||
needs_refresh = true;
|
||||
}
|
||||
|
@ -266,7 +276,7 @@ int GERBVIEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::EraseLayer( const TOOL_EVENT& aEvent )
|
||||
int GERBVIEW_CONTROL::ClearLayer( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->Erase_Current_DrawLayer( true );
|
||||
m_frame->ClearMsgPanel();
|
||||
|
@ -275,6 +285,54 @@ int GERBVIEW_CONTROL::EraseLayer( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->Clear_DrawLayers( false );
|
||||
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
canvas()->Refresh();
|
||||
m_frame->ClearMsgPanel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::ReloadAllLayers( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Store filenames
|
||||
wxArrayString listOfGerberFiles;
|
||||
std::vector<int> fileType;
|
||||
|
||||
GERBER_FILE_IMAGE_LIST* list = m_frame->GetImagesList();
|
||||
|
||||
for( unsigned i = 0; i < list->ImagesMaxCount(); i++ )
|
||||
{
|
||||
if( list->GetGbrImage( i ) == nullptr )
|
||||
continue;
|
||||
|
||||
if( !list->GetGbrImage( i )->m_InUse )
|
||||
continue;
|
||||
|
||||
auto* drill_file = dynamic_cast<EXCELLON_IMAGE*>( list->GetGbrImage( i ) );
|
||||
|
||||
if( drill_file )
|
||||
fileType.push_back( 1 );
|
||||
else
|
||||
fileType.push_back( 0 );
|
||||
|
||||
listOfGerberFiles.Add( list->GetGbrImage( i )->m_FileName );
|
||||
}
|
||||
|
||||
// Clear all layers
|
||||
m_toolMgr->RunAction( GERBVIEW_ACTIONS::clearAllLayers, true );
|
||||
|
||||
// Load the layers from stored paths
|
||||
wxBusyCursor wait;
|
||||
m_frame->LoadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &fileType );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
GERBVIEW_SELECTION_TOOL* selTool = m_toolMgr->GetTool<GERBVIEW_SELECTION_TOOL>();
|
||||
|
@ -303,6 +361,7 @@ void GERBVIEW_CONTROL::setTransitions()
|
|||
Go( &GERBVIEW_CONTROL::OpenDrillFile, GERBVIEW_ACTIONS::openDrillFile.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::OpenJobFile, GERBVIEW_ACTIONS::openJobFile.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::OpenZipFile, GERBVIEW_ACTIONS::openZipFile.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ToggleLayerManager, GERBVIEW_ACTIONS::toggleLayerManager.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ExportToPcbnew, GERBVIEW_ACTIONS::exportToPcbnew.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::Print, ACTIONS::print.MakeEvent() );
|
||||
|
||||
|
@ -313,7 +372,9 @@ void GERBVIEW_CONTROL::setTransitions()
|
|||
|
||||
Go( &GERBVIEW_CONTROL::LayerNext, GERBVIEW_ACTIONS::layerNext.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::LayerPrev, GERBVIEW_ACTIONS::layerPrev.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::EraseLayer, GERBVIEW_ACTIONS::eraseLayer.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ClearLayer, GERBVIEW_ACTIONS::clearLayer.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ClearAllLayers, GERBVIEW_ACTIONS::clearAllLayers.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ReloadAllLayers, GERBVIEW_ACTIONS::reloadAllLayers.MakeEvent() );
|
||||
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::linesDisplayOutlines.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::flashedDisplayOutlines.MakeEvent() );
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <tool/tool_interactive.h>
|
||||
|
||||
class EDA_DRAW_PANEL_GAL;
|
||||
class GERBVIEW_FRAME;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +47,9 @@ public:
|
|||
// Layer control
|
||||
int LayerNext( const TOOL_EVENT& aEvent );
|
||||
int LayerPrev( const TOOL_EVENT& aEvent );
|
||||
int EraseLayer( const TOOL_EVENT& aEvent );
|
||||
int ClearLayer( const TOOL_EVENT& aEvent );
|
||||
int ClearAllLayers( const TOOL_EVENT& aEvent );
|
||||
int ReloadAllLayers( const TOOL_EVENT& aEvent );
|
||||
|
||||
// Files
|
||||
int OpenGerber( const TOOL_EVENT& aEvent );
|
||||
|
@ -54,6 +57,8 @@ public:
|
|||
int OpenJobFile( const TOOL_EVENT& aEvent );
|
||||
int OpenZipFile( const TOOL_EVENT& aEvent );
|
||||
|
||||
int ToggleLayerManager( const TOOL_EVENT& aEvent );
|
||||
|
||||
// Highlight control
|
||||
int HighlightControl( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
@ -65,6 +70,12 @@ public:
|
|||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
protected:
|
||||
EDA_DRAW_PANEL_GAL* canvas()
|
||||
{
|
||||
return m_frame->GetCanvas();
|
||||
}
|
||||
|
||||
private:
|
||||
GERBVIEW_FRAME* m_frame;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue