31#include <wx/checkbox.h> 
   32#include <wx/splitter.h> 
   48#include "wx/display.h" 
   86#define PARENT_STYLE ( wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN \ 
   87                       | wxWANTS_CHARS | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT ) 
 
   88#define MODAL_STYLE  ( wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN \ 
   89                      | wxWANTS_CHARS | wxFRAME_NO_TASKBAR ) 
 
  109    wxBoxSizer* bottomSizer = 
new wxBoxSizer( wxVERTICAL );
 
  110    wxBoxSizer* frameSizer = 
new wxBoxSizer( wxVERTICAL );
 
  121                wxCommandEvent 
dummy;
 
  142    wxBoxSizer* buttonsSizer = 
new wxBoxSizer( wxHORIZONTAL );
 
  144    buttonsSizer->Add( 0, 0, 1, 0, 5 );     
 
  152    buttonsSizer->Add( 
m_toggleDescription, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 1 );
 
  156    buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
 
  163    buttonsSizer->Add( 
m_grButton3DView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
 
  170    buttonsSizer->Add( 
m_grButtonFpView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
 
  174    buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
 
  177    buttonsSizer->Add( 
m_show3DViewer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 3 );
 
  179    wxStdDialogButtonSizer* sdbSizer = 
new wxStdDialogButtonSizer();
 
  181    wxButton*               cancelButton = 
new wxButton( 
m_bottomPanel, wxID_CANCEL );
 
  183    sdbSizer->AddButton( okButton );
 
  184    sdbSizer->AddButton( cancelButton );
 
  187    buttonsSizer->Add( 20, 0, 0, 0, 5 );     
 
  188    buttonsSizer->Add( sdbSizer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
 
  189    bottomSizer->Add( buttonsSizer, 0, wxEXPAND, 5 );
 
  194    SetSizer( frameSizer );
 
  196    SetTitle( GetTitle() + wxString::Format( 
_( 
" (%d items loaded)" ),
 
  251    Connect( FP_SELECTION_EVENT,  
 
 
  290    Disconnect( FP_SELECTION_EVENT,
 
 
  307    if( aEvent.IsChecked() )
 
  318            viewer3D->Close( 
true );
 
 
  327    bool do_reload_board = 
true;    
 
  332        do_reload_board = 
false;
 
  340    if( do_reload_board )
 
 
  348    wxString footprintName;
 
  351        footprintName << fpID.
Format();
 
  353    wxString title = 
_( 
"3D Viewer" ) + wxT( 
" \u2014 " ) + footprintName;
 
 
  364        return cfg->m_FootprintChooser.filter_on_pin_count;
 
 
  376        return cfg->m_FootprintChooser.use_fp_filters;
 
 
  384    if( aNode.
m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
 
  393            []( 
LIB_ID& id, std::vector<std::unique_ptr<EDA_PATTERN_MATCH>>& filters ) -> 
bool 
  398                for( 
const std::unique_ptr<EDA_PATTERN_MATCH>& 
filter : filters )
 
  403                    if( 
filter->GetPattern().Contains( wxS( 
":" ) ) )
 
  404                        name = 
id.GetUniStringLibNickname().Lower() + wxS( 
":" );
 
  406                    name += 
id.GetUniStringLibItemName().Lower();
 
 
  445        return &pcb_cfg->m_FootprintViewer;
 
  447        return &cvpcb_cfg->m_FootprintViewer;
 
  449    wxFAIL_MSG( wxT( 
"FOOTPRINT_CHOOSER not running with PCBNEW_SETTINGS or CVPCB_SETTINGS" ) );
 
 
  466    const std::string& payload = mail.
GetPayload();
 
  472    wxLogTrace( 
"FOOTPRINT_CHOOSER", wxS( 
"MAIL_SYMBOL_NETLIST received: size=%zu" ),
 
  475        wxWindow* filtersWindow = filtersSizer->GetContainingWindow();
 
  486        std::map<wxString, wxString> pinNames;
 
  487        std::vector<std::string>     strings = 
split( payload, 
"\r" );
 
  489        if( strings.size() >= 1 && !strings[0].empty() )
 
  491            wxArrayString tokens = wxSplit( strings[0], 
'\t' );
 
  493            wxLogTrace( 
"FOOTPRINT_CHOOSER", wxS( 
"First line entries=%u" ), (
unsigned) tokens.size() );
 
  495            for( 
const wxString& 
pin : tokens )
 
  496                pinNames[ 
pin.BeforeFirst( 
' ' ) ] = 
pin.AfterFirst( 
' ' );
 
  501            for( 
const auto& 
kv : pinNames )
 
  503                if( !pinList.IsEmpty() )
 
  504                    pinList << wxS( 
"," );
 
  508            wxLogTrace( 
"FOOTPRINT_CHOOSER", wxS( 
"Parsed pins=%d -> [%s]" ), 
m_pinCount, pinList );
 
  511        if( strings.size() >= 2 && !strings[1].empty() )
 
  513            for( 
const wxString& 
filter : wxSplit( strings[1], 
' ' ) )
 
  515                m_fpFilters.push_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD_ANCHORED>() );
 
  522            msg.Printf( 
_( 
"Apply footprint filters (%s)" ), strings[1] );
 
  529                        [&]( wxCommandEvent& evt )
 
  550            msg.Printf( 
_( 
"Filter by pin count (%d)" ), 
m_pinCount );
 
  551            wxLogTrace( 
"FOOTPRINT_CHOOSER", wxS( 
"Pin-count label: %s" ), msg );
 
  558                        [&]( wxCommandEvent& evt )
 
  578    wxLogTrace( 
"FOOTPRINT_CHOOSER", wxS( 
"SetPinFunctions called with %zu entries" ),
 
  583            s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
 
  586        GetSizer()->SetSizeHints( 
this );
 
 
  604    if( aFootprint && !aFootprint->IsEmpty() )
 
  608        fpid.
Parse( *aFootprint, 
true );
 
 
  620    PCB_BASE_FRAME::SetPosition( aNewPosition );
 
 
  635        PCB_BASE_FRAME::Raise();  
 
  637        ret = PCB_BASE_FRAME::Show( show );
 
  642        if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
 
  644            SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
 
  645                     std::max( wxWindow::GetSize().x, savedDialogRect.GetSize().x ),
 
  646                     std::max( wxWindow::GetSize().y, savedDialogRect.GetSize().y ),
 
  653        if( wxDisplay::GetFromWindow( 
this ) == wxNOT_FOUND )
 
  658        s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
 
  659        ret = PCB_BASE_FRAME::Show( show );
 
 
  686        wxString footprint = fpID.
Format();
 
 
  750        m_chooserPanel->GetVerticalSpliter()->SetMinimumPaneSize( GetSize().GetHeight() );
 
  752                GetSize().GetHeight() + 
m_chooserPanel->GetDetailsPanel()->GetSize().GetHeight() );
 
 
  796                viewer3D->Close( 
true );
 
 
  865#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 cursorSmallCrosshairs
 
static TOOL_ACTION milsUnits
 
static TOOL_ACTION inchesUnits
 
static TOOL_ACTION measureTool
 
static TOOL_ACTION cursor45Crosshairs
 
static TOOL_ACTION cursorFullCrosshairs
 
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.
 
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.
 
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 CursorSmallCrosshairs()
Create a functor testing if the cursor is full screen in a frame.
 
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
 
SELECTION_CONDITION Cursor45Crosshairs()
 
SELECTION_CONDITION CursorFullCrosshairs()
 
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.
 
Gather all the actions that are shared by tools.
 
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.
 
PCB_BASE_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
 
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 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
 
T * GetAppSettings(const char *aFilename)
 
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.
 
Store the common settings that are saved and loaded for each window / frame.