37#include <wx/filedlg.h>
58 m_frame->LoadAutodetectedFiles( wxEmptyString );
66 m_frame->LoadGerberFiles( wxEmptyString );
74 m_frame->LoadExcellonFiles( wxEmptyString );
82 m_frame->LoadGerberJobFile( wxEmptyString );
91 m_frame->LoadZipArchiveFile( wxEmptyString );
119 if( layercount == 0 )
128 wxFileDialog filedlg(
m_frame,
_(
"Export as KiCad Board File" ),
path, fileDialogName,
133 if( filedlg.ShowModal() == wxID_CANCEL )
143 m_frame->SetMruPath( fileName.GetPath() );
159 if( selection.Size() == 1 )
166 m_frame->m_SelComponentBox->SetSelection( 0 );
167 m_frame->m_SelNetnameBox->SetSelection( 0 );
168 m_frame->m_SelAperAttributesBox->SetSelection( 0 );
170 settings->ClearHighlightSelections();
180 settings->m_netHighlightString = net_name;
186 settings->m_componentHighlightString = net_attr;
187 m_frame->m_SelComponentBox->SetStringSelection( net_attr );
196 settings->m_attributeHighlightString = ap_name;
197 m_frame->m_SelAperAttributesBox->SetStringSelection( ap_name );
206 int dcodeSelected = -1;
212 if( dcodeSelected > 0 )
214 settings->m_dcodeHighlightValue = dcodeSelected;
216 m_frame->syncLayerBox(
false );
362 if( contrastModeChanged )
380 m_frame->ApplyDisplaySettingsToGAL();
382 if( contrastModeChanged )
390 m_frame->GetCanvas()->Refresh();
398 int layer =
m_frame->GetActiveLayer();
401 m_frame->SetActiveLayer( layer + 1,
true );
409 int layer =
m_frame->GetActiveLayer();
412 m_frame->SetActiveLayer( layer - 1,
true );
420 int layer =
m_frame->GetActiveLayer();
423 if( layer > 0 && list.GetGbrImage( layer ) && list.GetGbrImage( layer - 1 ) )
425 m_frame->RemapLayers( list.SwapImages( layer, layer - 1 ) );
426 m_frame->SetActiveLayer( layer - 1 );
435 int layer =
m_frame->GetActiveLayer();
438 if( layer < ( (
int) list.GetLoadedImageCount() - 1 )
439 && list.GetGbrImage( layer ) && list.GetGbrImage( layer + 1 ) )
441 m_frame->RemapLayers( list.SwapImages( layer, layer + 1 ) );
442 m_frame->SetActiveLayer( layer + 1 );
451 m_frame->Erase_Current_DrawLayer(
true );
460 m_frame->Clear_DrawLayers(
false );
479 wxString archiveFileName;
483 bool restored =
false;
487 wxArrayString listOfGerberFiles;
489 wxArrayString archiveFiles;
490 std::vector<wxArrayString> archiveMembers;
491 std::vector<SAVED_LAYER> savedLayers;
495 for(
unsigned i = 0; i < list->ImagesMaxCount(); i++ )
502 savedLayers.push_back( {
image->m_FileName,
image->m_ArchiveFileName,
image->m_DisplayOffset,
503 image->m_DisplayRotation, oldVisibility[i] } );
505 if( !
image->m_ArchiveFileName.IsEmpty() )
507 int archiveIndex = archiveFiles.Index(
image->m_ArchiveFileName );
509 if( archiveIndex == wxNOT_FOUND )
511 archiveIndex = archiveFiles.GetCount();
512 archiveFiles.Add(
image->m_ArchiveFileName );
513 archiveMembers.emplace_back();
516 archiveMembers[archiveIndex].Add(
image->m_FileName );
527 listOfGerberFiles.Add(
image->m_FileName );
531 m_frame->Clear_DrawLayers(
false );
536 if( !listOfGerberFiles.IsEmpty() )
537 m_frame->LoadListOfGerberAndDrillFiles( wxEmptyString, listOfGerberFiles, &
fileType );
539 for(
unsigned i = 0; i < archiveFiles.GetCount(); i++ )
540 m_frame->LoadZipArchiveFile( archiveFiles[i], &archiveMembers[i] );
543 LSET restoredVisibility =
m_frame->GetVisibleLayers();
545 for(
unsigned i = 0; i < list->ImagesMaxCount(); i++ )
552 for( SAVED_LAYER& saved : savedLayers )
554 if( saved.restored || saved.fileName !=
image->m_FileName
555 || saved.archiveFileName !=
image->m_ArchiveFileName )
562 saved.displayRotation );
563 restoredVisibility[i] = saved.visible;
564 saved.restored =
true;
569 m_frame->SetVisibleLayers( restoredVisibility );
587 if( selection.GetSize() == 1 )
591 std::vector<MSG_PANEL_ITEM> msgItems;
593 m_frame->SetMsgPanel( msgItems );
617 wxString files = *aEvent.
Parameter<wxString*>();
620 std::vector<wxString> aFileNameList;
623 files = files.AfterFirst(
'"' );
627 while( !files.empty() )
629 wxString fileName = files.BeforeFirst(
'"' );
631 if( wxFileName( fileName ).Exists() )
632 aFileNameList.push_back( fileName );
633 files = files.AfterFirst(
'"' );
634 files = files.AfterFirst(
'"' );
637 if( !aFileNameList.empty() )
constexpr EDA_IU_SCALE gerbIUScale
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 KIGFX::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)
GBR_INACTIVE_LAYER_MODE m_InactiveLayerMode
How inactive layers are displayed.
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 showInactiveLayers
static TOOL_ACTION layerNext
static TOOL_ACTION flipGerberView
static TOOL_ACTION openAutodetected
static TOOL_ACTION reloadAllLayers
static TOOL_ACTION toggleForceOpacityMode
static TOOL_ACTION dimInactiveLayers
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 hideInactiveLayers
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
Set up handlers for various 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)
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 RecacheAllItems()
Rebuild GAL display lists.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
void MarkDirty()
Force redraw of view on the next rendering.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
LSET is a set of PCB_LAYER_IDs.
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.
@ ALL
All except INITIAL_ADD.
#define NAMELESS_PROJECT
default name for nameless projects
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
wxString UnescapeString(const wxString &aSource)
bool show_negative_objects
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
Definition of file extensions used in Kicad.