40#include <wx/listbox.h>
41#include <wx/statline.h>
43#include <nlohmann/json.hpp>
44#include <wx/tokenzr.h>
45#include <wx/numformatter.h>
46#include <wx/wupdlock.h>
86 wxDefaultPosition, wxDefaultSize,
90 m_wizardListShown( false )
102 m_wizardName.Empty();
108 GetGalDisplayOptions(),
110 SetCanvas( gal_drawPanel );
112 SetBoard(
new BOARD() );
116 SetScreen(
new PCB_SCREEN( GetPageSizeIU() ) );
117 GetScreen()->m_Center =
true;
121 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
152 m_toolManager->InitTools();
155 m_toolManager->InvokeTool(
"common.InteractiveSelection" );
163 m_parametersPanel =
new wxPanel(
this, wxID_ANY );
166 wxDefaultPosition, wxDefaultSize, 0,
nullptr,
167 wxLB_HSCROLL | wxNO_BORDER );
169 auto divider =
new wxStaticLine( m_parametersPanel, wxID_ANY,
170 wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
174 m_parameterGrid->PushEventHandler(
new GRID_TRICKS( m_parameterGrid ) );
178 wxBoxSizer* parametersSizer =
new wxBoxSizer( wxHORIZONTAL );
179 parametersSizer->Add( m_pageList, 0, wxEXPAND, 5 );
180 parametersSizer->Add( divider, 0, wxEXPAND, 5 );
181 parametersSizer->Add( m_parameterGrid, 1, wxEXPAND, 5 );
182 m_parametersPanel->SetSizer( parametersSizer );
183 m_parametersPanel->Layout();
186 m_buildMessageBox =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
187 wxDefaultPosition, wxDefaultSize,
188 wxTE_MULTILINE | wxTE_READONLY | wxNO_BORDER );
190 DisplayWizardInfos();
192 m_auimgr.SetManagedWindow(
this );
194 m_auimgr.AddPane( m_tbTopMain,
EDA_PANE().HToolbar().Name(
"TopMainToolbar" ).Top().Layer(6) );
195 m_auimgr.AddPane( m_messagePanel,
EDA_PANE().Messages().Name(
"MsgPanel" ).Bottom().Layer(6)
196 .BestSize( -1, m_msgFrameHeight ) );
198 m_auimgr.AddPane( m_parametersPanel,
EDA_PANE().Palette().Name(
"Params" ).Left().Position(0)
199 .Caption(
_(
"Parameters" ) ).MinSize( 360, 180 ) );
200 m_auimgr.AddPane( m_buildMessageBox,
EDA_PANE().Palette().Name(
"Output" ).Left().Position(1)
201 .CaptionVisible(
false ).MinSize( 360, -1 ) );
203 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name(
"DrawFrame" ).CentrePane() );
205 auto& galOpts = GetGalDisplayOptions();
207 galOpts.m_forceDisplayCursor =
true;
208 galOpts.m_axesEnabled =
true;
212 GetCanvas()->SwitchBackend( m_canvasType );
217 SetActiveLayer(
F_Cu );
236 GetCanvas()->SetEvtHandlerEnabled(
false );
313 std::vector<MSG_PANEL_ITEM> items;
360 if( !footprintWizard )
366 for(
int i = 0; i < max_page; i++ )
388 if( footprintWizard ==
nullptr )
410 wxString designator,
name, value, units, hint;
412 for(
unsigned int i = 0; i < namesList.size(); i++ )
414 designator = designatorsList[i];
416 value = valuesList[i];
417 units = typesList[i];
434 else if( units.Contains(
"," ) )
436 wxStringTokenizer tokenizer( units,
"," );
437 wxArrayString options;
439 while( tokenizer.HasMoreTokens() )
440 options.Add( tokenizer.GetNextToken() );
461 value.Replace(
",", wxNumberFormatter::GetDecimalSeparator() );
462 value.Replace(
".", wxNumberFormatter::GetDecimalSeparator() );
528#if wxCHECK_VERSION( 3, 3, 0 )
531 nlohmann::json state = serializer.
Serialize();
533 if( state.is_null() || state.empty() )
550 return &cfg->m_FootprintWizard;
552 wxFAIL_MSG( wxT(
"FOOTPRINT_CHOOSER not running with PCBNEW_SETTINGS" ) );
560 if( !event.GetActive() )
572 bool footprintWizardsChanged =
false;
574 if( footprintWizardsChanged )
587 frm3Dtitle.Printf(
_(
"ModView: 3D Viewer [%s]" ),
m_wizardName );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
static TOOL_ACTION pluginsReload
static TOOL_ACTION zoomFitScreen
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
std::shared_ptr< NET_SETTINGS > m_NetSettings
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
Handle actions that are shared between different applications.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void ReCreateHToolbar()
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
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.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
void SetClearance(int aClearance)
std::shared_ptr< NETCLASS > GetDefaultNetclass()
Gets the default netclass for the project.
WINDOW_SETTINGS m_FootprintViewer
Gather all the actions that are shared by tools.
Common, abstract interface for edit frames.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
The main frame for Pcbnew.
EDA_UNITS GetUserUnits() const
nlohmann::json Serialize() const
Declaration of the eda_3d_viewer class.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_WIZARD_FRAME_NAME
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Message panel definition file.
@ ID_FOOTPRINT_WIZARD_DONE
@ ID_FOOTPRINT_WIZARD_SELECT_WIZARD
@ ID_FOOTPRINT_WIZARD_PARAMETER_LIST
@ ID_FOOTPRINT_WIZARD_PAGE_LIST
T * GetToolbarSettings(const wxString &aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
Store the common settings that are saved and loaded for each window / frame.