36#include <wx/filedlg.h>
56 m_frame->LoadAutodetectedFiles( wxEmptyString );
64 m_frame->LoadGerberFiles( wxEmptyString );
72 m_frame->LoadExcellonFiles( wxEmptyString );
80 m_frame->LoadGerberJobFile( wxEmptyString );
89 m_frame->LoadZipArchiveFile( wxEmptyString );
117 if( layercount == 0 )
126 wxFileDialog filedlg(
m_frame,
_(
"Export as KiCad Board File" ),
path, fileDialogName,
129 if( filedlg.ShowModal() == wxID_CANCEL )
139 m_frame->SetMruPath( fileName.GetPath() );
155 if( selection.Size() == 1 )
162 m_frame->m_SelComponentBox->SetSelection( 0 );
163 m_frame->m_SelNetnameBox->SetSelection( 0 );
164 m_frame->m_SelAperAttributesBox->SetSelection( 0 );
166 settings->ClearHighlightSelections();
176 settings->m_netHighlightString = net_name;
182 settings->m_componentHighlightString = net_attr;
183 m_frame->m_SelComponentBox->SetStringSelection( net_attr );
192 settings->m_attributeHighlightString = ap_name;
193 m_frame->m_SelAperAttributesBox->SetStringSelection( ap_name );
202 int dcodeSelected = -1;
208 if( dcodeSelected > 0 )
210 settings->m_dcodeHighlightValue = dcodeSelected;
212 m_frame->syncLayerBox(
false );
322 m_frame->ApplyDisplaySettingsToGAL();
325 m_frame->GetCanvas()->Refresh();
333 int layer =
m_frame->GetActiveLayer();
336 m_frame->SetActiveLayer( layer + 1,
true );
344 int layer =
m_frame->GetActiveLayer();
347 m_frame->SetActiveLayer( layer - 1,
true );
355 int layer =
m_frame->GetActiveLayer();
361 m_frame->SetActiveLayer( layer - 1 );
370 int layer =
m_frame->GetActiveLayer();
373 if( layer < ( (
int) list.GetLoadedImageCount() - 1 ) )
375 m_frame->RemapLayers( list.SwapImages( layer, layer + 1 ) );
376 m_frame->SetActiveLayer( layer + 1 );
385 m_frame->Erase_Current_DrawLayer(
true );
394 m_frame->Clear_DrawLayers(
false );
411 wxArrayString listOfGerberFiles;
415 for(
unsigned i = 0; i < list->ImagesMaxCount(); i++ )
417 if( list->GetGbrImage( i ) ==
nullptr )
420 if( !list->GetGbrImage( i )->m_InUse )
430 listOfGerberFiles.Add( list->GetGbrImage( i )->m_FileName );
434 m_frame->Clear_DrawLayers(
false );
439 m_frame->LoadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &
fileType );
450 if( selection.GetSize() == 1 )
454 std::vector<MSG_PANEL_ITEM> msgItems;
456 m_frame->SetMsgPanel( msgItems );
480 wxString files = *aEvent.
Parameter<wxString*>();
483 std::vector<wxString> aFileNameList;
486 files = files.AfterFirst(
'"' );
490 while( !files.empty() )
492 wxString fileName = files.BeforeFirst(
'"' );
494 if( wxFileName( fileName ).Exists() )
495 aFileNameList.push_back( fileName );
496 files = files.AfterFirst(
'"' );
497 files = files.AfterFirst(
'"' );
500 if( !aFileNameList.empty() )
static TOOL_ACTION updateUnits
static TOOL_ACTION highContrastModeCycle
static TOOL_ACTION highContrastMode
static TOOL_ACTION zoomFitScreen
Show the Gerber files loaded and allow the user to choose between Gerber layers and pcb layers.
static int GetCopperLayersCount()
int * GetLayersLookUpTable()
A gerber DCODE (also called Aperture) definition.
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command).
int m_Num_Dcode
D code value ( >= 10 )
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
static const TOOL_EVENT ClearedEvent
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT UnselectedEvent
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
bool m_XORMode
Display layers in exclusive-or mode.
bool m_FlipGerberView
Display as a mirror image.
bool m_ForceOpacityMode
Display layers in transparency (alpha channel) forced mode.
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
A helper class to export a Gerber set of files to Pcbnew.
bool ExportPcb(const int *aLayerLookUpTable, int aCopperLayers)
Save a board from a set of Gerber images.
D_CODE * GetDcodeDescr() const
Return the GetDcodeDescr of this object, or NULL.
GBR_BASIC_SHAPE_TYPE m_ShapeType
const GBR_NETLIST_METADATA & GetNetAttributes() const
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
static GERBER_FILE_IMAGE_LIST & GetImagesList()
unsigned ImagesMaxCount()
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
Hold the image data and parameters for one gerber file and layer parameters.
static TOOL_ACTION dcodeDisplay
static TOOL_ACTION negativeObjectDisplay
static TOOL_ACTION flashedDisplayOutlines
static TOOL_ACTION highlightAttribute
static TOOL_ACTION exportToPcbnew
static TOOL_ACTION highlightNet
static TOOL_ACTION toggleXORMode
static TOOL_ACTION loadZipFile
static TOOL_ACTION toggleLayerManager
static TOOL_ACTION openGerber
static TOOL_ACTION clearAllLayers
static TOOL_ACTION layerNext
static TOOL_ACTION flipGerberView
static TOOL_ACTION openAutodetected
static TOOL_ACTION reloadAllLayers
static TOOL_ACTION toggleForceOpacityMode
static TOOL_ACTION linesDisplayOutlines
static TOOL_ACTION layerPrev
static TOOL_ACTION openDrillFile
static TOOL_ACTION polygonsDisplayOutlines
static TOOL_ACTION highlightComponent
static TOOL_ACTION openZipFile
static TOOL_ACTION highlightDCode
static TOOL_ACTION moveLayerUp
static TOOL_ACTION moveLayerDown
static TOOL_ACTION loadGerbFiles
static TOOL_ACTION openJobFile
static TOOL_ACTION clearLayer
static TOOL_ACTION highlightClear
EDA_DRAW_PANEL_GAL * canvas()
int OpenDrillFile(const TOOL_EVENT &aEvent)
int OpenAutodetected(const TOOL_EVENT &aEvent)
int LayerNext(const TOOL_EVENT &aEvent)
int HighlightControl(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int MoveLayerDown(const TOOL_EVENT &aEvent)
int ClearLayer(const TOOL_EVENT &aEvent)
int LayerPrev(const TOOL_EVENT &aEvent)
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int ReloadAllLayers(const TOOL_EVENT &aEvent)
int ToggleLayerManager(const TOOL_EVENT &aEvent)
int OpenJobFile(const TOOL_EVENT &aEvent)
int MoveLayerUp(const TOOL_EVENT &aEvent)
int ExportToPcbnew(const TOOL_EVENT &aEvent)
int OpenGerber(const TOOL_EVENT &aEvent)
int LoadGerbFiles(const TOOL_EVENT &aEvent)
Set up handlers for various events.
int ClearAllLayers(const TOOL_EVENT &aEvent)
int DisplayControl(const TOOL_EVENT &aEvent)
int LoadZipfile(const TOOL_EVENT &aEvent)
int OpenZipFile(const TOOL_EVENT &aEvent)
int UpdateMessagePanel(const TOOL_EVENT &aEvent)
int Print(const TOOL_EVENT &aEvent)
GBR_DISPLAY_OPTIONS m_Display
Methods for drawing GerbView specific items.
Store GerbView specific render settings.
void ClearHighlightSelections()
Clear all highlight selections (dcode, net, component, attribute selection)
An abstract base class for deriving all objects that can be added to a VIEW.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
void SetMirror(bool aMirrorX, bool aMirrorY)
Control the mirroring of the VIEW.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
This file is part of the common library.
static const std::string KiCadPcbFileExtension
static wxString PcbFileWildcard()
#define KICTL_CREATE
caller thinks requested project files may not exist.
@ COLOR
Color has changed.
@ REPAINT
Item needs to be redrawn.
#define NAMELESS_PROJECT
default name for nameless projects
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
wxString UnescapeString(const wxString &aSource)
bool show_negative_objects
Definition of file extensions used in Kicad.