91 #define LIB_VIEW_NAME "ViewlibFrame" 92 #define LIB_VIEW_NAME_MODAL "ViewlibFrameModal" 94 #define LIB_VIEW_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE ) 95 #define LIB_VIEW_STYLE_MODAL ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ) 99 const wxString& aLibraryName ) :
100 SCH_BASE_FRAME( aKiway, aParent, aFrameType,
_(
"Symbol Library Browser" ),
101 wxDefaultPosition, wxDefaultSize,
104 m_unitChoice( nullptr ),
105 m_libList( nullptr ),
106 m_symbolList( nullptr ),
107 m_previewItem( nullptr )
155 0,
NULL, wxLB_HSCROLL | wxNO_BORDER );
158 0,
NULL, wxLB_HSCROLL | wxNO_BORDER );
160 if( aLibraryName.empty() )
183 .CaptionVisible(
false ).MinSize( 80, -1 ).BestSize(
m_libListWidth, -1 ) );
209 bbox.
SetOrigin( -max_size_x /2, -max_size_y/2 );
210 bbox.
SetSize( max_size_x, max_size_y );
263 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x ) 264 #define CHECK( x ) ACTION_CONDITIONS().Check( x ) 268 auto electricalTypesShownCondition =
282 auto demorganStandardCond =
285 return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
288 auto demorganAlternateCond =
291 return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
294 auto haveDatasheetCond =
317 m_unit = aUnit > 0 ? aUnit : 1;
318 m_convert = aConvert > 0 ? aConvert : LIB_ITEM::LIB_CONVERT::BASE;
361 parentName = parent->GetName();
375 if( aSymbol && !aSymbol->IsEmpty() )
381 libid.
Parse( *aSymbol,
true );
389 msg.Printf(
_(
"The current configuration does not include the library '%s'.\n" 390 "Use Manage Symbol Libraries to edit the configuration." ),
396 msg.Printf(
_(
"The library '%s' is not enabled in the current configuration.\n" 397 "Use Manage Symbol Libraries to edit the configuration." ),
458 for(
int ii = 0; ii < unit_count; ii++ )
478 std::vector< wxString > libs =
Prj().SchSymbolLibTable()->GetLogicalLibs();
483 for(
unsigned ii = 0; ii < libs.size(); )
486 libs.erase( libs.begin() + ii );
495 for(
unsigned ii = 0; ii < libs.size(); )
497 wxArrayString aliasNames;
499 Prj().SchSymbolLibTable()->EnumerateSymbolLib( libs[ii], aliasNames,
true );
501 if( aliasNames.IsEmpty() )
502 libs.erase( libs.begin() + ii );
511 wxArrayString libNames;
513 for(
const auto&
name : libs )
514 libNames.Add(
name );
521 if( index != wxNOT_FOUND )
548 wxArrayString aliasNames;
559 if( aliasNames.IsEmpty() )
571 bool changed =
false;
573 if( index == wxNOT_FOUND )
657 m_symbolList->SetStringSelection( aComponentName,
true );
721 auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
723 return &cfg->m_LibViewPanel.window;
734 if( aEnvVarsChanged )
741 if( event.GetActive() )
788 std::shared_ptr< LIB_PART > tmp;
816 if( !dialogLock.try_lock() )
824 static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapter.get() )->AddLibraries( libNicknames,
this );
833 adapter->SetPreselectNode(
id, unit );
836 wxString dialogTitle;
837 dialogTitle.Printf(
_(
"Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
861 if( ii != wxNOT_FOUND || ii != (
int)
m_symbolList->GetCount() - 1 )
875 if( ii != wxNOT_FOUND && ii != 0 )
902 wxString title =
wxString::Format( wxT(
"%s \u2014 " ) +
_(
"Symbol Library Browser" ),
903 row ? row->
GetFullURI() :
_(
"no library selected" ) );
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
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...
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void ReCreateMenuBar() override
Recreates the menu bar.
static TOOL_ACTION showDatasheet
Inspection and Editing.
const UTF8 & GetLibItemName() const
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
void ForceRefresh()
Force a redraw.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
LIB_ID GetLibId() const override
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
wxString GetName() const override
This file is part of the common library.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
virtual void SetScreen(BASE_SCREEN *aScreen)
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
void ClickOnCmpList(wxCommandEvent &event)
void SetSelectedComponent(const wxString &aComponentName)
Set the selected component.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxArrayString m_allowedLibs
static TOOL_ACTION zoomFitScreen
void SetSize(const Vec &size)
Symbol library viewer main window.
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
static wxString m_entryName
ACTION_TOOLBAR * m_mainToolBar
Manage TOOL_ACTION objects.
wxString GetKeyWords() const
A logical library item identifier and consists of various portions much like a URI.
The base class for create windows for drawing purpose.
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
bool IsValid() const
Check if this LID_ID is valid.
void onUpdateUnitChoice(wxUpdateUIEvent &aEvent)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static TOOL_ACTION showDeMorganAlternate
Class that groups generic conditions for editor states.
static std::mutex g_Mutex
Dialog class to select a symbol from the libraries.
void OnSelectSymbol(wxCommandEvent &aEvent)
bool m_axesEnabled
Fullscreen crosshair or small cross.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
void CloseLibraryViewer(wxCommandEvent &event)
void onSelectNextSymbol(wxCommandEvent &aEvent)
void onSelectPreviousSymbol(wxCommandEvent &aEvent)
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
void onSelectSymbolUnit(wxCommandEvent &aEvent)
Stores the common settings that are saved and loaded for each window / frame.
void ReCreateHToolbar() override
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
int GetUnitCount() const override
For items with units, return the number of units.
static TOOL_ACTION toggleGrid
bool m_Center
Center on screen.
void SyncView()
Mark all items for refresh.
EDA_MSG_PANEL * m_messagePanel
const wxPoint GetOrigin() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
Define a library symbol object.
Helper dialog and control classes.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
bool ReCreateLibList()
Creates or recreates a sorted list of currently loaded libraries.
wxString GetDescription() override
static TOOL_ACTION addSymbolToSchematic
void ReCreateVToolbar() override
Handle actions that are shared between different applications.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
COLOR_SETTINGS * GetColorSettings() const override
Returns a pointer to the active color theme settings.
bool GetFilterPowerParts() const
Specialization of the wxAuiPaneInfo class for KiCad panels.
#define DEFAULT_LINE_THICKNESS
The default wire width in mils. (can be changed in preference menu)
static TOOL_ACTION showDeMorganStandard
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...
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...
static TOOL_ACTION showElectricalTypes
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Gather all the actions that are shared by tools.
void updatePreviewSymbol()
COLOR_SETTINGS * m_colorSettings
The current canvas type.
void SetModal(bool aIsModal)
PANEL_LIB_VIEW m_LibViewPanel
LIB_PART * GetSelectedSymbol() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool m_selection_changed
Updated to true if a list rewrite on GUI activation resulted in the component selection changing,...
void LoadColors(const COLOR_SETTINGS *aSettings) override
COLOR4D GetColor(int aLayer) const
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
void SetFilter(const SCHLIB_FILTER *aFilter)
Set a filter to display only libraries and/or components which match the filter.
void OnActivate(wxActivateEvent &event)
Called when the frame is activated to reload the libraries and component lists that can be changed by...
void SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
const BITMAP_OPAQUE library_browser_xpm[1]
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void DClickOnCmpList(wxCommandEvent &event)
void setupUnits(APP_SETTINGS_BASE *aCfg)
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void SetOrigin(const Vec &pos)
Handle the component boundary box.
const wxArrayString & GetAllowedLibList() const
bool show_pin_electrical_type
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void ClickOnLibList(wxCommandEvent &event)
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
void OnGridSettings(wxCommandEvent &event)
#define LIB_VIEW_NAME_MODAL
bool ShowModal(wxString *aSymbol, wxWindow *aParent) override
Function ShowModal.
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
void doCloseWindow() override
Definition for part library class.
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
void SetDefaultPenWidth(int aWidth)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
Message panel definition file.
Handle actions for the various symbol editor and viewers.
static wxString m_libraryName
static constexpr int Millimeter2iu(double mm)
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
SYMBOL_VIEWER_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aLibraryName=wxEmptyString)
Constructor.
bool m_ShowPinsElectricalType
void FinishModal()
Send the selected symbol back to the caller.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString & GetText() const
Return the string associated with the text object.
bool ProcessEvent(wxEvent &aEvent) override
Override the default process event handler to implement the auto save feature.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
bool ReCreateSymbolList()
Create or recreate the list of components in the currently selected library.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.
#define LIB_VIEW_STYLE_MODAL
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.