31#include <wx/checkbox.h>
32#include <wx/splitter.h>
47#include "wx/display.h"
85#define MODAL_FRAME ( wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN \
86 | wxWANTS_CHARS | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT )
93 m_filterByPinCount( nullptr ),
94 m_filterByFPFilters( nullptr ),
96 m_currentCamera( m_trackBallCamera ),
99 m_firstPaintEvent( true )
106 wxBoxSizer* bottomSizer =
new wxBoxSizer( wxVERTICAL );
107 wxBoxSizer* frameSizer =
new wxBoxSizer( wxVERTICAL );
118 wxCommandEvent
dummy;
139 wxBoxSizer* buttonsSizer =
new wxBoxSizer( wxHORIZONTAL );
141 buttonsSizer->Add( 0, 0, 1, 0, 5 );
148 buttonsSizer->Add(
m_toggleDescription, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 1 );
152 buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
158 buttonsSizer->Add(
m_grButton3DView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
164 buttonsSizer->Add(
m_grButtonFpView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
168 buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
171 buttonsSizer->Add(
m_show3DViewer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 3 );
173 wxStdDialogButtonSizer* sdbSizer =
new wxStdDialogButtonSizer();
175 wxButton* cancelButton =
new wxButton(
m_bottomPanel, wxID_CANCEL );
177 sdbSizer->AddButton( okButton );
178 sdbSizer->AddButton( cancelButton );
181 buttonsSizer->Add( 20, 0, 0, 0, 5 );
182 buttonsSizer->Add( sdbSizer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
183 bottomSizer->Add( buttonsSizer, 0, wxEXPAND, 5 );
188 SetSizer( frameSizer );
190 SetTitle( GetTitle() + wxString::Format(
_(
" (%d items loaded)" ),
245 Connect( FP_SELECTION_EVENT,
284 Disconnect( FP_SELECTION_EVENT,
301 if( aEvent.IsChecked() )
312 viewer3D->Close(
true );
321 bool do_reload_board =
true;
326 do_reload_board =
false;
334 if( do_reload_board )
342 wxString footprintName;
345 footprintName << fpID.
Format();
347 wxString title =
_(
"3D Viewer" ) + wxT(
" \u2014 " ) + footprintName;
358 return cfg->m_FootprintChooser.filter_on_pin_count;
370 return cfg->m_FootprintChooser.use_fp_filters;
378 if( aNode.
m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
387 [](
LIB_ID& id, std::vector<std::unique_ptr<EDA_PATTERN_MATCH>>& filters ) ->
bool
392 for(
const std::unique_ptr<EDA_PATTERN_MATCH>&
filter : filters )
397 if(
filter->GetPattern().Contains( wxS(
":" ) ) )
398 name =
id.GetUniStringLibNickname().Lower() + wxS(
":" );
400 name +=
id.GetUniStringLibItemName().Lower();
439 wxCHECK_MSG( cfg,
nullptr, wxT(
"config not existing" ) );
457 const std::string& payload = mail.
GetPayload();
464 wxWindow* filtersWindow = filtersSizer->GetContainingWindow();
475 std::map<wxString, wxString> pinNames;
476 std::vector<std::string> strings =
split( payload,
"\r" );
478 if( strings.size() >= 1 && !strings[0].empty() )
480 for(
const wxString&
pin : wxSplit( strings[0],
'\t' ) )
481 pinNames[
pin.BeforeFirst(
' ' ) ] =
pin.AfterFirst(
' ' );
487 msg.Printf(
_(
"Filter by pin count (%d)" ),
m_pinCount );
491 [&]( wxCommandEvent& evt )
501 if( strings.size() >= 2 && !strings[1].empty() )
503 for(
const wxString&
filter : wxSplit( strings[1],
' ' ) )
505 m_fpFilters.push_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD_ANCHORED>() );
509 msg.Printf(
_(
"Apply footprint filters (%s)" ), strings[1] );
513 [&]( wxCommandEvent& evt )
532 s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
535 GetSizer()->SetSizeHints(
this );
553 if( aFootprint && !aFootprint->IsEmpty() )
557 fpid.
Parse( *aFootprint,
true );
569 PCB_BASE_FRAME::SetPosition( aNewPosition );
584 PCB_BASE_FRAME::Raise();
586 ret = PCB_BASE_FRAME::Show( show );
591 if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
593 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
594 std::max( wxWindow::GetSize().x, savedDialogRect.GetSize().x ),
595 std::max( wxWindow::GetSize().y, savedDialogRect.GetSize().y ),
602 if( wxDisplay::GetFromWindow(
this ) == wxNOT_FOUND )
607 s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
608 ret = PCB_BASE_FRAME::Show( show );
635 wxString footprint = fpID.
Format();
745 viewer3D->Close(
true );
814#define CHECK( x ) ACTION_CONDITIONS().Check( x )
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
static TOOL_ACTION toggleGrid
static TOOL_ACTION millimetersUnits
static TOOL_ACTION milsUnits
static TOOL_ACTION inchesUnits
static TOOL_ACTION toggleCursorStyle
static TOOL_ACTION measureTool
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
Container for design settings for a BOARD object.
void SetEnabledLayers(const LSET &aMask)
Change the bit-mask of enabled layers to aMask.
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
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...
Implement a canvas based on a wxGLCanvas.
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
void OnCloseWindow(wxCloseEvent &event)
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
EDA_MSG_PANEL * m_messagePanel
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
MAIL_T Command()
Returns the MAIL_T associated with this mail.
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
void SetModal(bool aIsModal)
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
bool IsValid() const
Check if this LID_ID is valid.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static const wxGLAttributes GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode, bool aAlpha=false)
Get a list of attributes to pass to wxGLCanvas.
WINDOW_SETTINGS m_FootprintViewer
Gather all the actions that are shared by tools.
static TOOL_ACTION toggleHV45Mode
static TOOL_ACTION padDisplayMode
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION showPadNumbers
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual PCB_VIEWERS_SETTINGS_BASE * GetViewerSettingsBase() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
EDA_3D_VIEWER_FRAME * CreateAndShow3D_Frame()
Show the 3D view frame.
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.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION Get45degMode()
Create a functor that tests whether only 45 degree lines should be allowed.
SELECTION_CONDITION PadNumbersDisplay()
Create a functor that tests if the pad numbers are displayed.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Declaration of the eda_3d_viewer class.
#define FOOTPRINT_CHOOSER_FRAME_NAME
@ FRAME_FOOTPRINT_CHOOSER
std::vector< FAB_LAYER_COLOR > dummy
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Split the input string into a vector of output strings.
constexpr int mmToIU(double mm) const
Store the common settings that are saved and loaded for each window / frame.