KiCad PCB EDA Suite
CVPCB_MAINFRAME Class Reference

The CvPcb application main window. More...

#include <cvpcb_mainframe.h>

Inheritance diagram for CVPCB_MAINFRAME:
KIWAY_PLAYER EDA_BASE_FRAME KIWAY_HOLDER

Public Member Functions

 ~CVPCB_MAINFRAME ()
 
bool OpenProjectFiles (const std::vector< wxString > &aFileSet, int aCtl=0) override
 
void KiwayMailIn (KIWAY_EXPRESS &aEvent) override
 Function KiwayMailIn receives KIWAY_EXPRESS messages from other players. More...
 
DISPLAY_FOOTPRINTS_FRAMEGetFootprintViewerFrame ()
 
void OnSelectComponent (wxListEvent &event)
 Function OnSelectComponent Called when clicking on a component in component list window. More...
 
void OnEditFootprintLibraryTable (wxCommandEvent &event)
 Function OnEditFootprintLibraryTable displays the footprint library table editing dialog and updates the global and local footprint tables accordingly. More...
 
void OnCancel (wxCommandEvent &aEvent)
 
void OnOK (wxCommandEvent &aEvent)
 
void OnSaveAndContinue (wxCommandEvent &aEvent)
 
void OnQuit (wxCommandEvent &event)
 
void OnCloseWindow (wxCloseEvent &Event)
 
void OnSize (wxSizeEvent &SizeEvent)
 
void OnKeyDown (wxKeyEvent &aEvent)
 
void ReCreateHToolbar ()
 
virtual void ReCreateMenuBar () override
 (Re)Create the menubar for the CvPcb mainframe More...
 
void ShowChangedLanguage () override
 Function ShowChangedLanguage redraws the menus and what not in current language. More...
 
void ChangeFocus (bool aMoveRight)
 
void ToFirstNA (wxCommandEvent &event)
 
void ToPreviousNA (wxCommandEvent &event)
 
void DelAssociations (wxCommandEvent &event)
 Function DelAssociations removes all component footprint associations already made. More...
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnEditEquFilesList (wxCommandEvent &aEvent)
 Function OnEditEquFilesList envokes the equ files list edit dialog. More...
 
void DisplayModule (wxCommandEvent &event)
 
void AutomaticFootprintMatching (wxCommandEvent &event)
 Called by the automatic association button Read *.equ files to try to find corresponding footprint for each component that is not already linked to a footprint ( a "free" component ) format of a line: 'cmp_ref' 'footprint_name'. More...
 
void OnSelectFilteringFootprint (wxCommandEvent &event)
 Function OnSelectFilteringFootprint is the command event handler for enabling and disabling footprint filtering. More...
 
void OnEnterFilteringText (wxCommandEvent &event)
 Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed. More...
 
void SetNewPkg (const wxString &aFootprintName)
 Function SetNewPkg set the footprint name for all selected components in component list and selects the next component. More...
 
void SetNewPkg (const wxString &aFootprintName, int aIndex)
 Function SetNewPkg Set the footprint name for the component of position aIndex in the component list. More...
 
void BuildCmpListBox ()
 
void BuildFOOTPRINTS_LISTBOX ()
 
void BuildLIBRARY_LISTBOX ()
 
void CreateScreenCmp ()
 Create or Update the frame showing the current highlighted footprint and (if showed) the 3D display frame. More...
 
void SaveFootprintAssociation (bool doSaveSchematic)
 Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eeschema via the kiway. More...
 
bool ReadNetListAndFpFiles (const std::string &aNetlist)
 Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables. More...
 
int ReadSchematicNetlist (const std::string &aNetlist)
 Function ReadSchematicNetlist read the netlist (.net) file built on the fly by Eeschema. More...
 
void LoadProjectFile ()
 Function LoadProjectFile reads the CvPcb configuration parameter from the project (.pro) file aFileName. More...
 
void SaveProjectFile ()
 Function SaveProjectFile Saves the CvPcb configuration parameter from the project (.pro) file aFileName. More...
 
void LoadSettings (wxConfigBase *aCfg) override
 Function LoadSettings loads common frame parameters from a configuration file. More...
 
void SaveSettings (wxConfigBase *aCfg) override
 Function SaveSettings saves common frame parameters to a configuration data file. More...
 
void DisplayStatus ()
 Function DisplayStatus updates the information displayed on the status bar at bottom of the main frame. More...
 
bool LoadFootprintFiles ()
 Function LoadFootprintFiles reads the list of footprint (*.mod files) and generate the list of footprints. More...
 
PARAM_CFG_ARRAYGetProjectFileParameters (void)
 Function GetProjectFileParameters return project file parameter list for CvPcb. More...
 
void SendMessageToEESCHEMA ()
 Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "reference" put cursor on component anchor. More...
 
COMPONENTGetSelectedComponent ()
 
wxString GetSelectedFootprint ()
 
void SetStatusText (const wxString &aText, int aNumber=0) override
 
VTBL_ENTRY bool ShowModal (wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
 Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal(). More...
 
bool Destroy () override
 Our version of Destroy() which is virtual from wxWidgets. More...
 
bool ProcessEvent (wxEvent &aEvent) override
 Function ProcessEvent overrides the default process event handler to implement the auto save feature. More...
 
void SetAutoSaveInterval (int aInterval)
 
int GetAutoSaveInterval () const
 
bool IsType (FRAME_T aType) const
 
void GetKicadHelp (wxCommandEvent &event)
 
void GetKicadContribute (wxCommandEvent &event)
 
void GetKicadAbout (wxCommandEvent &event)
 
void PrintMsg (const wxString &text)
 
wxString ConfigBaseName ()
 Function ConfigBaseName. More...
 
virtual void SaveProjectSettings (bool aAskForSave)
 Function SaveProjectSettings saves changes to the project settings to the project (.pro) file. More...
 
virtual void OnSelectPreferredEditor (wxCommandEvent &event)
 Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ... More...
 
int ReadHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys. More...
 
virtual int WriteHotkeyConfig (struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
 Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mechanism or a file. More...
 
int ReadHotkeyConfigFile (const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
 Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys. More...
 
void ImportHotkeyConfigFromFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it. More...
 
void ExportHotkeyConfigToFile (EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
 Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it. More...
 
wxString GetFileFromHistory (int cmdId, const wxString &type, wxFileHistory *aFileHistory=NULL)
 Function GetFileFromHistory fetches the file name from the file history list. More...
 
void UpdateFileHistory (const wxString &FullFileName, wxFileHistory *aFileHistory=NULL)
 Function UpdateFileHistory Updates the list of recently opened files. More...
 
void SetMruPath (const wxString &aPath)
 
wxString GetMruPath () const
 
bool IsWritable (const wxFileName &aFileName)
 Function IsWritable checks if aFileName can be written. More...
 
void CheckForAutoSaveFile (const wxFileName &aFileName, const wxString &aBackupFileExtension)
 Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input. More...
 
virtual void ShowChangedIcons ()
 Function ShowChangedIcons redraws items menus after a icon was changed option. More...
 
void AddMenuIconsOptions (wxMenu *MasterMenu)
 Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu. More...
 
bool PostCommandMenuEvent (int evt_type)
 Function PostCommandMenuEvent. More...
 
virtual int GetIconScale ()
 Function GetIconScale. More...
 
virtual void SetIconScale (int aScale)
 Function SetIconScale. More...
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Public Attributes

wxArrayString m_ModuleLibNames
 
wxArrayString m_EquFilesNames
 
FOOTPRINT_LISTm_FootprintsList
 

Protected Member Functions

 CVPCB_MAINFRAME (KIWAY *aKiway, wxWindow *aParent)
 
bool IsModal ()
 
void SetModal (bool aIsModal)
 
bool IsDismissed ()
 Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal(). More...
 
void DismissModal (bool aRetVal, const wxString &aResult=wxEmptyString)
 
void kiway_express (KIWAY_EXPRESS &aEvent)
 event handler, routes to derivative specific virtual KiwayMailIn() More...
 
void language_change (wxCommandEvent &event)
 Function language_change is an event handler called on a language menu selection. More...
 
void OnChangeIconsOptions (wxCommandEvent &event) override
 Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection. More...
 
void onAutoSaveTimer (wxTimerEvent &aEvent)
 Function onAutoSaveTimer handles the auto save timer event. More...
 
virtual bool isAutoSaveRequired () const
 Function autoSaveRequired returns the auto save status of the application. More...
 
virtual bool doAutoSave ()
 Function doAutoSave should be overridden by the derived class to handle the auto save feature. More...
 
virtual wxConfigBase * config ()
 Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual const SEARCH_STACKsys_search ()
 Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME. More...
 
virtual wxString help_name ()
 

Protected Attributes

bool m_modified
 
bool m_skipComponentSelect
 
PARAM_CFG_ARRAY m_projectFileParams
 
bool m_initialized
 
bool m_modal
 
WX_EVENT_LOOPm_modal_loop
 
wxWindow * m_modal_resultant_parent
 
wxString m_modal_string
 
bool m_modal_ret_val
 
FRAME_T m_Ident
 Id Type (pcb, schematic, library..) More...
 
wxPoint m_FramePos
 
wxSize m_FrameSize
 
wxString m_configFrameName
 prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used More...
 
wxString m_AboutTitle
 Name of program displayed in About. More...
 
wxAuiManager m_auimgr
 
bool m_hasAutoSave
 Flag to indicate if this frame supports auto save. More...
 
bool m_autoSaveState
 Flag to indicate the last auto save state. More...
 
int m_autoSaveInterval
 The auto save interval time in seconds. More...
 
wxTimer * m_autoSaveTimer
 The timer used to implement the auto save feature;. More...
 
wxString m_perspective
 wxAuiManager perspective. More...
 
wxString m_mruPath
 Most recently used path. More...
 

Static Protected Attributes

static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND
 

Default style flags used for wxAUI toolbars

More...
 

Private Member Functions

void OnFilterFPbyKeywords (wxUpdateUIEvent &event)
 
void OnFilterFPbyPinCount (wxUpdateUIEvent &event)
 
void OnFilterFPbyLibrary (wxUpdateUIEvent &event)
 
void OnFilterFPbyKeyName (wxUpdateUIEvent &event)
 
int buildEquivalenceList (FOOTPRINT_EQUIVALENCE_LIST &aList, wxString *aErrorMessages=NULL)
 read the .equ files and populate the list of equvalents More...
 
void refreshAfterComponentSearch (COMPONENT *component)
 

Private Attributes

wxString m_currentSearchPattern
 
NETLIST m_netlist
 
int m_filteringOptions
 
wxAuiToolBar * m_mainToolBar
 
FOOTPRINTS_LISTBOXm_footprintListBox
 
LIBRARY_LISTBOXm_libListBox
 
COMPONENTS_LISTBOXm_compListBox
 
wxTextCtrl * m_tcFilterString
 
wxStaticText * m_statusLine1
 
wxStaticText * m_statusLine2
 
wxButton * m_saveAndContinue
 

Friends

struct CV::IFACE
 

Detailed Description

The CvPcb application main window.

Definition at line 57 of file cvpcb_mainframe.h.

Constructor & Destructor Documentation

CVPCB_MAINFRAME::CVPCB_MAINFRAME ( KIWAY aKiway,
wxWindow *  aParent 
)
protected

Definition at line 108 of file cvpcb_mainframe.cpp.

References BuildCmpListBox(), BuildFOOTPRINTS_LISTBOX(), BuildLIBRARY_LISTBOX(), EDA_BASE_FRAME::config(), FRAME_MIN_SIZE_DU(), FOOTPRINT_LIST::GetInstance(), EDA_PANEINFO::HorizontalToolbarPane(), EDA_PANEINFO::InfoToolbarPane(), KiBitmap(), KIWAY_HOLDER::Kiway(), PCAD2KICAD::Left, LoadSettings(), EDA_BASE_FRAME::m_auimgr, m_compListBox, m_filteringOptions, m_footprintListBox, m_FootprintsList, EDA_BASE_FRAME::m_FramePos, EDA_BASE_FRAME::m_FrameSize, m_initialized, m_libListBox, m_mainToolBar, m_modified, m_saveAndContinue, m_skipComponentSelect, m_statusLine1, m_statusLine2, m_tcFilterString, OnSaveAndContinue(), ReCreateHToolbar(), ReCreateMenuBar(), PCAD2KICAD::Right, wxPoint::x, and wxPoint::y.

108  :
109  KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
111 {
112  m_compListBox = NULL;
113  m_footprintListBox = NULL;
114  m_libListBox = NULL;
115  m_mainToolBar = NULL;
116  m_modified = false;
117  m_skipComponentSelect = false;
118  m_filteringOptions = 0;
119  m_tcFilterString = NULL;
121  m_initialized = false;
122 
123  // Give an icon
124  wxIcon icon;
125  icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
126  SetIcon( icon );
127 
128  SetAutoLayout( true );
129 
130  LoadSettings( config() );
131 
132  wxSize const frame_min( ConvertDialogToPixels( FRAME_MIN_SIZE_DU ) );
133 
134  SetSizeHints( frame_min );
135 
136  // Frame size and position
137  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
138 
139  ReCreateMenuBar();
141 
142  // Create list of available modules and components of the schematic
143  BuildCmpListBox();
146 
147  m_auimgr.SetManagedWindow( this );
148 
149  EDA_PANEINFO horiz;
150  horiz.HorizontalToolbarPane();
151 
152  EDA_PANEINFO info;
153  info.InfoToolbarPane();
154 
155  if( m_mainToolBar )
156  m_auimgr.AddPane( m_mainToolBar,
157  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
158 
159  if( m_compListBox )
160  m_auimgr.AddPane( m_compListBox,
161  wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
162 
163  if( m_libListBox)
164  m_auimgr.AddPane( m_libListBox,
165  wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
166  Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
167 
168  if( m_footprintListBox )
169  m_auimgr.AddPane( m_footprintListBox,
170  wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
171  Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
172 
173  // Build the bottom panel, to display 2 status texts and the buttons:
174  auto bottomPanel = new wxPanel( this );
175  auto panelSizer = new wxBoxSizer( wxVERTICAL );
176  wxFont statusFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
177  statusFont.SetSymbolicSize( wxFONTSIZE_SMALL );
178 
179  m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
180  m_statusLine1->SetFont( statusFont );
181  panelSizer->Add( m_statusLine1, 0, wxTOP, 4 );
182 
183  m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
184  m_statusLine2->SetFont( statusFont );
185  panelSizer->Add( m_statusLine2, 0, 0, 4 );
186 
187  // Add buttons:
188  auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
189  auto sdbSizer = new wxStdDialogButtonSizer();
190 
191  m_saveAndContinue = new wxButton( bottomPanel, wxID_SAVE,
192  _( "Apply, Save Schematic && Continue" ) );
193  buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_BOTTOM | wxBOTTOM | wxRIGHT, 10 );
194 
195  auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
196  sdbSizer->AddButton( sdbSizerOK );
197  auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
198  sdbSizer->AddButton( sdbSizerCancel );
199  sdbSizer->Realize();
200 
201  buttonsSizer->Add( sdbSizer, 0, 0, 5 );
202  panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT, 5 );
203 
204  bottomPanel->SetSizer( panelSizer );
205  bottomPanel->Fit();
206 
207  sdbSizerOK->SetDefault();
208 
209  m_auimgr.AddPane( bottomPanel, wxAuiPaneInfo( horiz ).Name( wxT( "buttons" ) ).Bottom() );
210 
211  m_auimgr.Update();
212  m_initialized = true;
213 
214  // Connect Events
215  m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
216 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
FOOTPRINT_LIST * m_FootprintsList
COMPONENTS_LISTBOX * m_compListBox
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aWdoName=wxFrameNameStr)
#define CVPCB_MAINFRAME_NAME
void ReCreateHToolbar()
Definition: tool_cvpcb.cpp:35
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
wxAuiManager m_auimgr
wxSize const FRAME_MIN_SIZE_DU(350, 250)
Specialization of the wxAuiPaneInfo class for KiCad panels.
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
wxTextCtrl * m_tcFilterString
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
wxAuiToolBar * m_mainToolBar
#define KICAD_DEFAULT_DRAWFRAME_STYLE
virtual void ReCreateMenuBar() override
(Re)Create the menubar for the CvPcb mainframe
void BuildFOOTPRINTS_LISTBOX()
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
LIBRARY_LISTBOX * m_libListBox
wxStaticText * m_statusLine2
FOOTPRINTS_LISTBOX * m_footprintListBox
void OnSaveAndContinue(wxCommandEvent &aEvent)
wxButton * m_saveAndContinue
wxStaticText * m_statusLine1
CVPCB_MAINFRAME::~CVPCB_MAINFRAME ( )

Definition at line 219 of file cvpcb_mainframe.cpp.

References EDA_BASE_FRAME::m_auimgr, m_saveAndContinue, and OnSaveAndContinue().

220 {
221  // Disconnect Events
222  m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
223 
224  m_auimgr.UnInit();
225 }
wxAuiManager m_auimgr
void OnSaveAndContinue(wxCommandEvent &aEvent)
wxButton * m_saveAndContinue

Member Function Documentation

void EDA_BASE_FRAME::AddMenuIconsOptions ( wxMenu *  MasterMenu)
inherited

Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice, and add it as submenu to MasterMenu.

Parameters
MasterMenuThe main menu. The sub menu list will be accessible from the menu item with id ID_KICAD_SELECT_ICONS_OPTIONS

Definition at line 693 of file eda_base_frame.cpp.

References AddMenuItem(), ID_KICAD_SELECT_ICONS_IN_MENUS, ID_KICAD_SELECT_ICONS_OPTIONS, KiBitmap(), and Pgm().

Referenced by EDA_BASE_FRAME::GetMruPath(), preparePreferencesMenu(), PL_EDITOR_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), and GERBVIEW_FRAME::ReCreateMenuBar().

694 {
695  wxMenu* menu = NULL;
696  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
697 
698  if( item ) // This menu exists, do nothing
699  return;
700 
701  menu = new wxMenu;
702 
703  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
704  _( "Icons in Menus" ), wxEmptyString,
705  wxITEM_CHECK ) );
706  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
707 
708  AddMenuItem( MasterMenu, menu,
710  _( "Icons Options" ),
711  _( "Select show icons in menus and icons sizes" ),
712  KiBitmap( icon_xpm ) );
713 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void CVPCB_MAINFRAME::AutomaticFootprintMatching ( wxCommandEvent &  event)

Called by the automatic association button Read *.equ files to try to find corresponding footprint for each component that is not already linked to a footprint ( a "free" component ) format of a line: 'cmp_ref' 'footprint_name'.

Definition at line 170 of file auto_associate.cpp.

References buildEquivalenceList(), LIB_ID::empty(), GetChars(), NETLIST::GetComponent(), NETLIST::GetCount(), COMPONENT::GetFootprintFilters(), FOOTPRINT_INFO::GetFootprintName(), COMPONENT::GetFPID(), FOOTPRINT_LIST::GetModuleInfo(), COMPONENT::GetReference(), COMPONENT::GetValue(), NETLIST::IsEmpty(), m_compListBox, FOOTPRINT_EQUIVALENCE::m_ComponentValue, FOOTPRINT_EQUIVALENCE::m_FootprintFPID, m_FootprintsList, m_netlist, m_skipComponentSelect, next(), SetNewPkg(), SetStatusText(), and sortListbyCmpValue().

171 {
172  FOOTPRINT_EQUIVALENCE_LIST equiv_List;
173  wxString msg, error_msg;
174 
175  if( m_netlist.IsEmpty() )
176  return;
177 
178  if( buildEquivalenceList( equiv_List, &error_msg ) )
179  wxMessageBox( error_msg, _( "Equivalence File Load Error" ), wxOK | wxICON_WARNING, this );
180 
181  // Sort the association list by component value.
182  // When sorted, find duplicate definitions (i.e. 2 or more items
183  // having the same component value) is more easy.
184  std::sort( equiv_List.begin(), equiv_List.end(), sortListbyCmpValue );
185 
186  // Display the number of footprint/component equivalences.
187  msg.Printf( _( "%lu footprint/cmp equivalences found." ), (unsigned long)equiv_List.size() );
188  SetStatusText( msg, 0 );
189 
190  // Now, associate each free component with a footprint, when the association
191  // is found in list
192  m_skipComponentSelect = true;
193  error_msg.Empty();
194 
195  for( unsigned kk = 0; kk < m_netlist.GetCount(); kk++ )
196  {
197  COMPONENT* component = m_netlist.GetComponent( kk );
198 
199  bool found = false;
200 
201  if( !component->GetFPID().empty() ) // the component has already a footprint
202  continue;
203 
204  // Here a first attempt is made. We can have multiple equivItem of the same value.
205  // When happens, using the footprint filter of components can remove the ambiguity by
206  // filtering equivItem so one can use multiple equiv_List (for polar and
207  // non-polar caps for example)
208  wxString fpid_candidate;
209 
210  for( unsigned idx = 0; idx < equiv_List.size(); idx++ )
211  {
212  FOOTPRINT_EQUIVALENCE& equivItem = equiv_List[idx];
213 
214  if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
215  continue;
216 
217  const FOOTPRINT_INFO *module = m_FootprintsList->GetModuleInfo( equivItem.m_FootprintFPID );
218 
219  bool equ_is_unique = true;
220  unsigned next = idx+1;
221  int previous = idx-1;
222 
223  if( next < equiv_List.size() &&
224  equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue )
225  equ_is_unique = false;
226 
227  if( previous >= 0 &&
228  equivItem.m_ComponentValue == equiv_List[previous].m_ComponentValue )
229  equ_is_unique = false;
230 
231  // If the equivalence is unique, no ambiguity: use the association
232  if( module && equ_is_unique )
233  {
234  SetNewPkg( equivItem.m_FootprintFPID, kk );
235  found = true;
236  break;
237  }
238 
239  // Store the first candidate found in list, when equivalence is not unique
240  // We use it later.
241  if( module && fpid_candidate.IsEmpty() )
242  fpid_candidate = equivItem.m_FootprintFPID;
243 
244  // The equivalence is not unique: use the footprint filter to try to remove
245  // ambiguity
246  // if the footprint filter does not remove ambiguity, we will use fpid_candidate
247  if( module )
248  {
249  size_t filtercount = component->GetFootprintFilters().GetCount();
250  found = ( 0 == filtercount ); // if no entries, do not filter
251 
252  for( size_t jj = 0; jj < filtercount && !found; jj++ )
253  {
254  found = module->GetFootprintName().Matches( component->GetFootprintFilters()[jj] );
255  }
256  }
257  else
258  {
259  msg.Printf( _( "Component %s: footprint %s not found in any of the project "
260  "footprint libraries." ),
261  GetChars( component->GetReference() ),
262  GetChars( equivItem.m_FootprintFPID ) );
263 
264  if( ! error_msg.IsEmpty() )
265  error_msg << wxT("\n\n");
266 
267  error_msg += msg;
268  }
269 
270  if( found )
271  {
272  SetNewPkg( equivItem.m_FootprintFPID, kk );
273  break;
274  }
275  }
276 
277  if( found )
278  continue;
279  else if( !fpid_candidate.IsEmpty() )
280  {
281  SetNewPkg( fpid_candidate, kk );
282  continue;
283  }
284 
285  // obviously the last chance: there's only one filter matching one footprint
286  if( 1 == component->GetFootprintFilters().GetCount() )
287  {
288  // we do not need to analyze wildcards: single footprint do not
289  // contain them and if there are wildcards it just will not match any
290  const FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( component->GetFootprintFilters()[0] );
291 
292  if( module )
293  {
294  SetNewPkg( component->GetFootprintFilters()[0], kk );
295  }
296  }
297  }
298 
299  if( !error_msg.IsEmpty() )
300  wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this );
301 
302  m_skipComponentSelect = false;
303  m_compListBox->Refresh();
304 }
CITER next(CITER it)
Definition: ptree.cpp:130
bool empty() const
Definition: lib_id.h:173
const wxString & GetFootprintName() const
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
FOOTPRINT_LIST * m_FootprintsList
COMPONENTS_LISTBOX * m_compListBox
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:177
bool sortListbyCmpValue(const FOOTPRINT_EQUIVALENCE &ref, const FOOTPRINT_EQUIVALENCE &test)
void SetNewPkg(const wxString &aFootprintName)
Function SetNewPkg set the footprint name for all selected components in component list and selects t...
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const wxString & GetValue() const
Definition: pcb_netlist.h:153
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintName)
Get info for a module by name.
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
void SetStatusText(const wxString &aText, int aNumber=0) override
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
int buildEquivalenceList(FOOTPRINT_EQUIVALENCE_LIST &aList, wxString *aErrorMessages=NULL)
read the .equ files and populate the list of equvalents
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
void CVPCB_MAINFRAME::BuildCmpListBox ( )

Definition at line 860 of file cvpcb_mainframe.cpp.

References UTF8::c_str(), CMP_FORMAT, LIB_ID::Format(), FROM_UTF8(), GetChars(), NETLIST::GetComponent(), COMPONENTS_LISTBOX::GetCount(), NETLIST::GetCount(), COMPONENT::GetFPID(), COMPONENT::GetReference(), COMPONENT::GetValue(), i, ID_CVPCB_COMPONENT_LIST, m_compListBox, COMPONENTS_LISTBOX::m_ComponentList, m_netlist, COMPONENTS_LISTBOX::SetSelection(), and ITEMS_LISTBOX_BASE::UpdateWidth().

Referenced by CVPCB_MAINFRAME().

861 {
862  wxString msg;
863  COMPONENT* component;
864  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
865 
866  if( m_compListBox == NULL )
867  {
869  wxDefaultPosition, wxDefaultSize );
870  m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
871  wxFONTFAMILY_MODERN,
872  wxFONTSTYLE_NORMAL,
873  wxFONTWEIGHT_NORMAL ) );
874  }
875 
877 
878  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
879  {
880  component = m_netlist.GetComponent( i );
881 
882  msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
883  GetChars( component->GetReference() ),
884  GetChars( component->GetValue() ),
885  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
886  m_compListBox->m_ComponentList.Add( msg );
887  }
888 
889  if( m_compListBox->m_ComponentList.Count() )
890  {
891  m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
892  m_compListBox->SetSelection( 0, true );
893  m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
895  }
896 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
COMPONENTS_LISTBOX * m_compListBox
void SetSelection(int index, bool State=true)
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const wxString & GetValue() const
Definition: pcb_netlist.h:153
void UpdateWidth(int aLine=-1)
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
#define CMP_FORMAT
Definition: cvpcb.h:30
wxArrayString m_ComponentList
Definition: listboxes.h:199
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const char * c_str() const
Definition: utf8.h:107
size_t i
Definition: json11.cpp:597
UTF8 Format() const
Definition: lib_id.cpp:263
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
int CVPCB_MAINFRAME::buildEquivalenceList ( FOOTPRINT_EQUIVALENCE_LIST aList,
wxString *  aErrorMessages = NULL 
)
private

read the .equ files and populate the list of equvalents

Parameters
aListthe list to populate
aErrorMessagesis a pointer to a wxString to store error messages (can be NULL)
Returns
the error count ( 0 = no error)

Definition at line 83 of file auto_associate.cpp.

References SEARCH_STACK::FindValidPath(), FROM_UTF8(), GetChars(), GetLine(), GetQuotedText(), Kiface(), KIFACE_I::KifaceSearch(), FOOTPRINT_EQUIVALENCE::m_ComponentValue, m_EquFilesNames, and FOOTPRINT_EQUIVALENCE::m_FootprintFPID.

Referenced by AutomaticFootprintMatching().

84 {
85  char line[1024];
86  int error_count = 0;
87  FILE* file;
88  wxFileName fn;
89  wxString tmp, error_msg;
90 
91  SEARCH_STACK& search = Kiface().KifaceSearch();
92 
93  // Find equivalences in all available files, and populates the
94  // equiv_List with all equivalences found in .equ files
95  for( unsigned ii = 0; ii < m_EquFilesNames.GetCount(); ii++ )
96  {
97  fn = wxExpandEnvVars( m_EquFilesNames[ii] );
98 
99  tmp = search.FindValidPath( fn.GetFullPath() );
100 
101  if( !tmp )
102  {
103  error_count++;
104 
105  if( aErrorMessages )
106  {
107  error_msg.Printf( _( "Equivalence file \"%s\" could not be found in the "
108  "default search paths." ),
109  GetChars( fn.GetFullName() ) );
110 
111  if( ! aErrorMessages->IsEmpty() )
112  *aErrorMessages << wxT("\n\n");
113 
114  *aErrorMessages += error_msg;
115  }
116 
117  continue;
118  }
119 
120  file = wxFopen( tmp, wxT( "rt" ) );
121 
122  if( file == NULL )
123  {
124  error_count++;
125 
126  if( aErrorMessages )
127  {
128  error_msg.Printf( _( "Error opening equivalence file \"%s\"." ), GetChars( tmp ) );
129 
130  if( ! aErrorMessages->IsEmpty() )
131  *aErrorMessages << wxT("\n\n");
132 
133  *aErrorMessages += error_msg;
134  }
135 
136  continue;
137  }
138 
139  while( GetLine( file, line, NULL, sizeof( line ) ) != NULL )
140  {
141  if( *line == 0 )
142  continue;
143 
144  wxString wtext = FROM_UTF8( line );
145  wxString value = GetQuotedText( wtext );
146 
147  if( value.IsEmpty() )
148  continue;
149 
150  wxString footprint = GetQuotedText( wtext );
151 
152  if( footprint.IsEmpty() )
153  continue;
154 
155  value.Replace( wxT( " " ), wxT( "_" ) );
156 
157  FOOTPRINT_EQUIVALENCE* equivItem = new FOOTPRINT_EQUIVALENCE();
158  equivItem->m_ComponentValue = value;
159  equivItem->m_FootprintFPID = footprint;
160  aList.push_back( equivItem );
161  }
162 
163  fclose( file );
164  }
165 
166  return error_count;
167 }
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
wxString GetQuotedText(wxString &text)
wxArrayString m_EquFilesNames
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
SEARCH_STACK & KifaceSearch()
Only for DSO specific &#39;non-library&#39; files.
Definition: kiface_i.h:127
char * GetLine(FILE *File, char *Line, int *LineNum, int SizeLine)
Function GetLine reads one line line from aFile.
Definition: string.cpp:213
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
wxString FindValidPath(const wxString &aFileName) const
Definition: search_stack.h:71
void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX ( )

Definition at line 840 of file cvpcb_mainframe.cpp.

References DisplayStatus(), ID_CVPCB_FOOTPRINT_LIST, m_footprintListBox, m_FootprintsList, FOOTPRINTS_LISTBOX::SetFootprints(), and FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST.

Referenced by CVPCB_MAINFRAME(), and ReadNetListAndFpFiles().

841 {
842  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
843 
844  if( m_footprintListBox == NULL )
845  {
847  wxDefaultPosition, wxDefaultSize );
848  m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
849  wxFONTFAMILY_MODERN,
850  wxFONTSTYLE_NORMAL,
851  wxFONTWEIGHT_NORMAL ) );
852  }
853 
854  m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL,
856  DisplayStatus();
857 }
FOOTPRINT_LIST * m_FootprintsList
FOOTPRINTS_LISTBOX * m_footprintListBox
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Function SetFootprints populates the wxListCtrl with the footprints from aList that meet the filter c...
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX ( )

Definition at line 899 of file cvpcb_mainframe.cpp.

References LIB_TABLE::GetLogicalLibs(), ID_CVPCB_LIBRARY_LIST, KIWAY_HOLDER::Kiway(), m_libListBox, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), and LIBRARY_LISTBOX::SetLibraryList().

Referenced by CVPCB_MAINFRAME(), OnEditFootprintLibraryTable(), and ReadNetListAndFpFiles().

900 {
901  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
902 
903  if( m_libListBox == NULL )
904  {
906  wxDefaultPosition, wxDefaultSize );
907  m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
908  wxFONTFAMILY_MODERN,
909  wxFONTSTYLE_NORMAL,
910  wxFONTWEIGHT_NORMAL ) );
911  }
912 
913  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
914 
915  if( tbl )
916  {
917  wxArrayString libNames;
918 
919  std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
920 
921  for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
922  libNames.Add( libNickNames[ii] );
923 
924  m_libListBox->SetLibraryList( libNames );
925  }
926 }
void SetLibraryList(const wxArrayString &aList)
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
LIBRARY_LISTBOX * m_libListBox
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
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 CVPCB_MAINFRAME::ChangeFocus ( bool  aMoveRight)

Definition at line 287 of file cvpcb_mainframe.cpp.

References m_compListBox, m_footprintListBox, and m_libListBox.

Referenced by FOOTPRINTS_LISTBOX::OnChar(), LIBRARY_LISTBOX::OnChar(), and COMPONENTS_LISTBOX::OnChar().

288 {
289  wxWindow* hasFocus = wxWindow::FindFocus();
290 
291  if( aMoveRight )
292  {
293  if( hasFocus == m_libListBox )
294  m_compListBox->SetFocus();
295  else if( hasFocus == m_compListBox )
296  m_footprintListBox->SetFocus();
297  else if( hasFocus == m_footprintListBox )
298  m_libListBox->SetFocus();
299  }
300  else
301  {
302  if( hasFocus == m_libListBox )
303  m_footprintListBox->SetFocus();
304  else if( hasFocus == m_compListBox )
305  m_libListBox->SetFocus();
306  else if( hasFocus == m_footprintListBox )
307  m_compListBox->SetFocus();
308  }
309 }
COMPONENTS_LISTBOX * m_compListBox
LIBRARY_LISTBOX * m_libListBox
FOOTPRINTS_LISTBOX * m_footprintListBox
void EDA_BASE_FRAME::CheckForAutoSaveFile ( const wxFileName &  aFileName,
const wxString &  aBackupFileExtension 
)
inherited

Function CheckForAutoSaveFile checks if an auto save file exists for aFileName and takes the appropriate action depending on the user input.

If an auto save file exists for aFileName, the user is prompted if they wish to replace file aFileName with the auto saved file. If the user chooses to replace the file, the backup file of aFileName is removed, aFileName is renamed to the backup file name, and the auto save file is renamed to aFileName. If user chooses to keep the existing version of aFileName, the auto save file is removed.

Parameters
aFileNameA wxFileName object containing the file name to check.
aBackupFileExtensionA wxString object containing the backup file extension used to create the backup file name.

Definition at line 598 of file eda_base_frame.cpp.

References AUTOSAVE_PREFIX_FILENAME, Format(), GetChars(), Pgm(), and traceAutoSave.

Referenced by EDA_BASE_FRAME::GetMruPath(), and PCB_EDIT_FRAME::OpenProjectFiles().

600 {
601  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
602  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
603 
604  wxFileName autoSaveFileName = aFileName;
605 
606  // Check for auto save file.
607  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
608 
609  wxLogTrace( traceAutoSave,
610  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
611 
612  if( !autoSaveFileName.FileExists() )
613  return;
614 
615  wxString msg = wxString::Format( _(
616  "Well this is potentially embarrassing!\n"
617  "It appears that the last time you were editing the file\n"
618  "\"%s\"\n"
619  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
620  GetChars( aFileName.GetFullName() )
621  );
622 
623  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
624 
625  // Make a backup of the current file, delete the file, and rename the auto save file to
626  // the file name.
627  if( response == wxYES )
628  {
629  // Get the backup file name.
630  wxFileName backupFileName = aFileName;
631  backupFileName.SetExt( aBackupFileExtension );
632 
633  // If an old backup file exists, delete it. If an old copy of the file exists, rename
634  // it to the backup file name
635  if( aFileName.FileExists() )
636  {
637  // Remove the old file backup file.
638  if( backupFileName.FileExists() )
639  wxRemoveFile( backupFileName.GetFullPath() );
640 
641  // Rename the old file to the backup file name.
642  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
643  {
644  msg.Printf( _( "Could not create backup file \"%s\"" ),
645  GetChars( backupFileName.GetFullPath() ) );
646  wxMessageBox( msg );
647  }
648  }
649 
650  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
651  {
652  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
653  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
654  }
655  }
656  else
657  {
658  wxLogTrace( traceAutoSave,
659  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
660 
661  // Remove the auto save file when using the previous file as is.
662  wxRemoveFile( autoSaveFileName.GetFullPath() );
663  }
664 }
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
#define AUTOSAVE_PREFIX_FILENAME
Prefix to create filenames for schematic files or other difile when auto-saved to retrieve a crash...
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxConfigBase * EDA_BASE_FRAME::config ( )
protectedvirtualinherited
wxString EDA_BASE_FRAME::ConfigBaseName ( )
inlineinherited

Function ConfigBaseName.

Returns
a base name prefix used in Load/Save settings to build the full name of keys used in config. This is usually the name of the frame set by CTOR, unless m_configFrameName contains a base name. this is the case of frames which can be shown in normal or modal mode. This is needed because we want only one base name prefix, regardless the mode used.

Definition at line 260 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_configFrameName.

Referenced by EDA_BASE_FRAME::LoadSettings(), EDA_DRAW_FRAME::LoadSettings(), EDA_BASE_FRAME::SaveSettings(), and EDA_DRAW_FRAME::SaveSettings().

261  {
262  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
263  return baseCfgName;
264  }
wxString m_configFrameName
prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTO...
void CVPCB_MAINFRAME::CreateScreenCmp ( )

Create or Update the frame showing the current highlighted footprint and (if showed) the 3D display frame.

Definition at line 812 of file cvpcb_mainframe.cpp.

References GetFootprintViewerFrame(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), and KIWAY_HOLDER::Kiway().

Referenced by DisplayModule(), FOOTPRINTS_LISTBOX::OnLeftClick(), and refreshAfterComponentSearch().

813 {
815 
816  if( !fpframe )
817  {
818  fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
819  fpframe->Show( true );
820  }
821  else
822  {
823  if( fpframe->IsIconized() )
824  fpframe->Iconize( false );
825 
826  // The display footprint window might be buried under some other
827  // windows, so CreateScreenCmp() on an existing window would not
828  // show any difference, leaving the user confused.
829  // So we want to put it to front, second after our CVPCB_MAINFRAME.
830  // We do this by a little dance of bringing it to front then the main
831  // frame back.
832  fpframe->Raise(); // Make sure that is visible.
833  Raise(); // .. but still we want the focus.
834  }
835 
836  fpframe->InitDisplay();
837 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
void InitDisplay()
Function InitDisplay Refresh the full display for this frame: Set the title, the status line and redr...
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
void CVPCB_MAINFRAME::DelAssociations ( wxCommandEvent &  event)

Function DelAssociations removes all component footprint associations already made.

Definition at line 405 of file cvpcb_mainframe.cpp.

References ITEMS_LISTBOX_BASE::DeselectAll(), DisplayStatus(), NETLIST::GetComponent(), NETLIST::GetCount(), i, IsOK(), m_compListBox, m_netlist, m_skipComponentSelect, COMPONENT::SetFPID(), SetNewPkg(), and COMPONENTS_LISTBOX::SetSelection().

406 {
407  if( IsOK( this, _( "Delete selections" ) ) )
408  {
409  m_skipComponentSelect = true;
410 
411  // Remove all selections to avoid issues when setting the fpids
413 
414  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
415  {
416  LIB_ID fpid;
417 
418  m_netlist.GetComponent( i )->SetFPID( fpid );
419  SetNewPkg( wxEmptyString );
420  }
421 
422  // Remove all selections after setting the fpids
424 
425  m_skipComponentSelect = false;
427  }
428 
429  DisplayStatus();
430 }
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:155
COMPONENTS_LISTBOX * m_compListBox
void DeselectAll()
Removes all selection in lists which can have more than one item selected.
void SetSelection(int index, bool State=true)
void SetNewPkg(const wxString &aFootprintName)
Function SetNewPkg set the footprint name for all selected components in component list and selects t...
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
size_t i
Definition: json11.cpp:597
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void KIWAY_PLAYER::DismissModal ( bool  aRetVal,
const wxString &  aResult = wxEmptyString 
)
protectedinherited
void CVPCB_MAINFRAME::DisplayModule ( wxCommandEvent &  event)

Definition at line 493 of file cvpcb_mainframe.cpp.

References CreateScreenCmp(), GetFootprintViewerFrame(), and EDA_DRAW_FRAME::RedrawScreen().

494 {
495  CreateScreenCmp();
496  GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
497 }
void CreateScreenCmp()
Create or Update the frame showing the current highlighted footprint and (if showed) the 3D display f...
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
void CVPCB_MAINFRAME::DisplayStatus ( )

Function DisplayStatus updates the information displayed on the status bar at bottom of the main frame.

When the library or component list controls have the focus, the footprint assignment status of the components is displayed in the first status bar pane and the list of filters for the selected component is displayed in the second status bar pane. When the footprint list control has the focus, the description of the selected footprint is displayed in the first status bar pane and the key words for the selected footprint are displayed in the second status bar pane. The third status bar pane always displays the current footprint list filtering.

Definition at line 647 of file cvpcb_mainframe.cpp.

References FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD, FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY, FOOTPRINTS_LISTBOX::FILTERING_BY_NAME, FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT, Format(), GetChars(), FOOTPRINTS_LISTBOX::GetCount(), FOOTPRINT_INFO::GetDoc(), COMPONENT::GetFootprintFilters(), FOOTPRINT_INFO::GetKeywords(), FOOTPRINT_LIST::GetModuleInfo(), COMPONENT::GetPinCount(), GetSelectedComponent(), GetSelectedFootprint(), LIBRARY_LISTBOX::GetSelectedLibrary(), m_filteringOptions, m_footprintListBox, m_FootprintsList, m_initialized, m_libListBox, and SetStatusText().

Referenced by BuildFOOTPRINTS_LISTBOX(), DelAssociations(), FOOTPRINTS_LISTBOX::OnLeftClick(), ReadNetListAndFpFiles(), refreshAfterComponentSearch(), SetNewPkg(), and ShowChangedLanguage().

648 {
649  if( !m_initialized )
650  return;
651 
652  wxString filters, msg;
653  COMPONENT* component = GetSelectedComponent();
654 
656  {
657  msg.Empty();
658 
659  if( component )
660  {
661  for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
662  {
663  if( msg.IsEmpty() )
664  msg += component->GetFootprintFilters()[ii];
665  else
666  msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
667  }
668  }
669 
670  filters += _( "key words" ) + wxString::Format( wxT( " (%s)" ), msg );
671  }
672 
674  {
675  msg.Empty();
676 
677  if( component )
678  msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
679 
680  if( !filters.IsEmpty() )
681  filters += wxT( ", " );
682 
683  filters += _( "pin count" ) + wxString::Format( wxT( " (%s)" ), msg );
684  }
685 
687  {
689 
690  if( !filters.IsEmpty() )
691  filters += wxT( ", " );
692 
693  filters += _( "library" ) + wxString::Format( wxT( " (%s)" ), msg );
694  }
695 
697  {
698  if( !filters.IsEmpty() )
699  filters += wxT( ", " );
700 
701  filters += _( "search text" );
702  }
703 
704  if( filters.IsEmpty() )
705  msg = _( "No filtering" );
706  else
707  msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
708 
709  msg << wxT( ": " ) << m_footprintListBox->GetCount();
710 
711  SetStatusText( msg );
712 
713 
714  msg.Empty();
715  wxString footprintName = GetSelectedFootprint();
716 
717  FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
718 
719  if( module ) // can be NULL if no netlist loaded
720  {
721  msg = wxString::Format( _( "Description: %s; Key words: %s" ),
722  module->GetDoc(),
723  module->GetKeywords() );
724  }
725 
726  SetStatusText( msg, 1 );
727 }
FOOTPRINT_LIST * m_FootprintsList
int GetPinCount() const
Definition: pcb_netlist.h:184
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:177
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintName)
Get info for a module by name.
const wxString & GetDoc()
wxString GetSelectedLibrary()
void SetStatusText(const wxString &aText, int aNumber=0) override
const wxString & GetKeywords()
LIBRARY_LISTBOX * m_libListBox
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
wxString GetSelectedFootprint()
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
COMPONENT * GetSelectedComponent()
FOOTPRINTS_LISTBOX * m_footprintListBox
bool EDA_BASE_FRAME::doAutoSave ( )
protectedvirtualinherited

Function doAutoSave should be overridden by the derived class to handle the auto save feature.

Returns
true if the auto save was successful otherwise false.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 251 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), and EDA_BASE_FRAME::onAutoSaveTimer().

252 {
253  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
254 }
void EDA_BASE_FRAME::ExportHotkeyConfigToFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 757 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, EDA_FILE_SELECTOR(), and Prj().

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

759 {
760  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
761  wxString mask = wxT( "*." ) + ext;
762 
763 #if 0
764  wxString path = wxPathOnly( Prj().GetProjectFullName() );
765 #else
766  wxString path = GetMruPath();
767 #endif
768  wxFileName fn( aDefaultShortname );
769  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
770 
771  wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
772  path,
773  fn.GetFullPath(),
774  ext,
775  mask,
776  this,
777  wxFD_SAVE,
778  true );
779 
780  if( filename.IsEmpty() )
781  return;
782 
783  WriteHotkeyConfig( aDescList, &filename );
784  SetMruPath( wxFileName( filename ).GetPath() );
785 }
void SetMruPath(const wxString &aPath)
PROJECT & Prj()
Definition: kicad.cpp:270
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
int EDA_BASE_FRAME::GetAutoSaveInterval ( ) const
inlineinherited

Definition at line 219 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

Referenced by DIALOG_GENERALOPTIONS::init(), and SCH_EDIT_FRAME::OnPreferencesOptions().

219 { return m_autoSaveInterval; }
int m_autoSaveInterval
The auto save interval time in seconds.
wxString EDA_BASE_FRAME::GetFileFromHistory ( int  cmdId,
const wxString &  type,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function GetFileFromHistory fetches the file name from the file history list.

and removes the selected file, if this file does not exists Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

Parameters
cmdIdThe command ID associated with the aFileHistory object.
typePlease document me!
aFileHistoryThe wxFileHistory in use. If null, the main application file history is used
Returns
a wxString containing the selected filename

Definition at line 420 of file eda_base_frame.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), i, and Kiface().

Referenced by GERBVIEW_FRAME::OnDrlFileHistory(), KICAD_MANAGER_FRAME::OnFileHistory(), PL_EDITOR_FRAME::OnFileHistory(), PCB_EDIT_FRAME::OnFileHistory(), GERBVIEW_FRAME::OnGbrFileHistory(), GERBVIEW_FRAME::OnJobFileHistory(), GERBVIEW_FRAME::OnZipFileHistory(), and EDA_BASE_FRAME::SaveProjectSettings().

422 {
423  wxFileHistory* fileHistory = aFileHistory;
424 
425  if( !fileHistory )
426  fileHistory = &Kiface().GetFileHistory();
427 
428  int baseId = fileHistory->GetBaseId();
429 
430  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
431 
432  unsigned i = cmdId - baseId;
433 
434  if( i < fileHistory->GetCount() )
435  {
436  wxString fn = fileHistory->GetHistoryFile( i );
437 
438  if( wxFileName::FileExists( fn ) )
439  return fn;
440  else
441  {
442  wxString msg = wxString::Format(
443  _( "File \"%s\" was not found." ),
444  GetChars( fn ) );
445 
446  wxMessageBox( msg );
447 
448  fileHistory->RemoveFileFromHistory( i );
449  }
450  }
451 
452  return wxEmptyString;
453 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
size_t i
Definition: json11.cpp:597
DISPLAY_FOOTPRINTS_FRAME * CVPCB_MAINFRAME::GetFootprintViewerFrame ( )
Returns
a pointer on the Footprint Viewer frame, if exists, or NULL

Definition at line 940 of file cvpcb_mainframe.cpp.

References FOOTPRINTVIEWER_FRAME_NAME.

Referenced by CreateScreenCmp(), DisplayModule(), OnCloseWindow(), and refreshAfterComponentSearch().

941 {
942  // returns the Footprint Viewer frame, if exists, or NULL
943  return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>
944  ( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
945 }
#define FOOTPRINTVIEWER_FRAME_NAME
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
virtual int EDA_BASE_FRAME::GetIconScale ( )
inlinevirtualinherited

Function GetIconScale.

Return the desired scaling for toolbar/menubar icons in fourths (e.g. 4 is unity). A negative number indicates autoscale based on font size.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, LIB_EDIT_FRAME, and FOOTPRINT_EDIT_FRAME.

Definition at line 453 of file eda_base_frame.h.

Referenced by get_scale_factor(), and FOOTPRINT_EDIT_FRAME::GetIconScale().

453 { return -1; }
void EDA_BASE_FRAME::GetKicadAbout ( wxCommandEvent &  event)
inherited

Definition at line 547 of file eda_base_frame.cpp.

References ShowAboutDialog().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

548 {
549  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
550  ShowAboutDialog( this );
551 }
void ShowAboutDialog(EDA_BASE_FRAME *aParent)
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void EDA_BASE_FRAME::GetKicadContribute ( wxCommandEvent &  event)
inherited

Definition at line 534 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

535 {
536  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
537  {
538  wxString msg;
539  msg.Printf( _( "Could not launch the default browser.\n"
540  "For information on how to help the KiCad project, visit %s" ),
542  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
543  }
544 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 456 of file eda_base_frame.cpp.

References DIM, Format(), GetAssociatedDocument(), GetChars(), EDA_BASE_FRAME::help_name(), SearchHelpFileFullPath(), and EDA_BASE_FRAME::sys_search().

Referenced by add_search_paths(), and EDA_BASE_FRAME::IsType().

457 {
458  const SEARCH_STACK& search = sys_search();
459 
460  /* We have to get document for beginners,
461  * or the full specific doc
462  * if event id is wxID_INDEX, we want the document for beginners.
463  * else the specific doc file (its name is in Kiface().GetHelpFileName())
464  * The document for beginners is the same for all KiCad utilities
465  */
466  if( event.GetId() == wxID_INDEX )
467  {
468  // List of possible names for Getting Started in KiCad
469  const wxChar* names[2] = {
470  wxT( "getting_started_in_kicad" ),
471  wxT( "Getting_Started_in_KiCad" )
472  };
473 
474  wxString helpFile;
475  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
476  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
477  for( unsigned ii = 0; ii < DIM( names ); ii++ )
478  {
479  helpFile = SearchHelpFileFullPath( search, names[ii] );
480 
481  if( !helpFile.IsEmpty() )
482  break;
483  }
484 
485  if( !helpFile )
486  {
487  wxString msg = wxString::Format( _(
488  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
489  wxMessageBox( msg );
490  }
491  else
492  {
493  GetAssociatedDocument( this, helpFile );
494  }
495 
496  return;
497  }
498 
499  wxString base_name = help_name();
500  wxString helpFile = SearchHelpFileFullPath( search, base_name );
501 
502  if( !helpFile )
503  {
504  wxString msg = wxString::Format( _(
505  "Help file \"%s\" could not be found." ),
506  GetChars( base_name )
507  );
508  wxMessageBox( msg );
509  }
510  else
511  {
512  GetAssociatedDocument( this, helpFile );
513  }
514 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, const wxPathList *aPaths)
Function GetAssociatedDocument open a document (file) with the suitable browser.
Definition: eda_doc.cpp:87
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
virtual const SEARCH_STACK & sys_search()
Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_M...
wxString SearchHelpFileFullPath(const SEARCH_STACK &aSStack, const wxString &aBaseName)
Function SearchHelpFileFullPath returns the help file&#39;s full path.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual wxString help_name()
PARAM_CFG_ARRAY & CVPCB_MAINFRAME::GetProjectFileParameters ( void  )

Function GetProjectFileParameters return project file parameter list for CvPcb.

Populate the project file parameter array specific to CvPcb if it hasn't already been populated and return a reference to the array to the caller. Creating the parameter list at run time has the advantage of being able to define local variables. The old method of statically building the array at compile time requiring global variable definitions.

Returns
A reference to a PARAM_CFG_ARRAY contain the project settings for CvPcb.

Definition at line 45 of file cfg.cpp.

References GROUP_CVP_EQU, GROUP_PCB_LIBS, m_EquFilesNames, m_projectFileParams, and PARAM_COMMAND_ERASE.

Referenced by LoadProjectFile(), and SaveProjectFile().

46 {
47  if( !m_projectFileParams.empty() )
48  return m_projectFileParams;
49 
51 
53  wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
54 
55  return m_projectFileParams;
56 }
wxArrayString m_EquFilesNames
Class PARAM_CFG_BASE is a base class which establishes the interface functions ReadParam and SavePara...
Definition: config_params.h:94
PARAM_CFG_ARRAY m_projectFileParams
#define GROUP_CVP_EQU
Definition: config_params.h:53
#define GROUP_PCB_LIBS
(and few for component editor).
Definition: config_params.h:48
COMPONENT * CVPCB_MAINFRAME::GetSelectedComponent ( )

Definition at line 929 of file cvpcb_mainframe.cpp.

References NETLIST::GetComponent(), NETLIST::GetCount(), ITEMS_LISTBOX_BASE::GetSelection(), m_compListBox, and m_netlist.

Referenced by DisplayStatus(), and OnSelectComponent().

930 {
931  int selection = m_compListBox->GetSelection();
932 
933  if( selection >= 0 && selection < (int) m_netlist.GetCount() )
934  return m_netlist.GetComponent( selection );
935 
936  return NULL;
937 }
COMPONENTS_LISTBOX * m_compListBox
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
wxString CVPCB_MAINFRAME::GetSelectedFootprint ( )
Returns
the LIB_ID of the selected footprint in footprint listview or a empty string if no selection

Definition at line 948 of file cvpcb_mainframe.cpp.

References FOOTPRINTS_LISTBOX::GetSelectedFootprint(), and m_footprintListBox.

Referenced by DisplayStatus(), and DISPLAY_FOOTPRINTS_FRAME::InitDisplay().

949 {
950  // returns the LIB_ID of the selected footprint in footprint listview
951  // or a empty string
953 }
FOOTPRINTS_LISTBOX * m_footprintListBox
wxString EDA_BASE_FRAME::help_name ( )
protectedvirtualinherited

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 396 of file eda_base_frame.cpp.

References KIFACE_I::GetHelpFileName(), and Kiface().

Referenced by EDA_BASE_FRAME::GetKicadHelp(), and EDA_BASE_FRAME::isAutoSaveRequired().

397 {
398  return Kiface().GetHelpFileName();
399 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
const wxString & GetHelpFileName() const
Function GetHelpFileName returns just the basename portion of the current help file.
Definition: kiface_i.h:121
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile ( EDA_HOTKEY_CONFIG aDescList,
const wxString &  aDefaultShortname 
)
inherited

Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.

Parameters
aDescList= current hotkey list descr. to initialize.
aDefaultShortname= a default short name (extention not needed) like eechema, kicad...

Definition at line 728 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and EDA_FILE_SELECTOR().

Referenced by KICAD_MANAGER_FRAME::Process_Config(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PL_EDITOR_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), GERBVIEW_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), and EDA_BASE_FRAME::SaveProjectSettings().

730 {
731  wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
732  wxString mask = wxT( "*." ) + ext;
733 
734 
735  wxString path = GetMruPath();
736  wxFileName fn( aDefaultShortname );
737  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
738 
739  wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
740  path,
741  fn.GetFullPath(),
742  ext,
743  mask,
744  this,
745  wxFD_OPEN,
746  true );
747 
748  if( filename.IsEmpty() )
749  return;
750 
751  ReadHotkeyConfigFile( filename, aDescList );
752  WriteHotkeyConfig( aDescList );
753  SetMruPath( wxFileName( filename ).GetPath() );
754 }
void SetMruPath(const wxString &aPath)
int ReadHotkeyConfigFile(const wxString &aFilename, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current ho...
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
wxString GetMruPath() const
virtual bool EDA_BASE_FRAME::isAutoSaveRequired ( ) const
inlineprotectedvirtualinherited

Function autoSaveRequired returns the auto save status of the application.

Override this function if your derived frame supports automatic file saving.

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 175 of file eda_base_frame.h.

References EDA_BASE_FRAME::config(), EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::help_name(), EDA_BASE_FRAME::ProcessEvent(), EDA_BASE_FRAME::SetAutoSaveInterval(), EDA_BASE_FRAME::sys_search(), and EDA_BASE_FRAME::~EDA_BASE_FRAME().

Referenced by EDA_BASE_FRAME::ProcessEvent().

175 { return false; }
bool KIWAY_PLAYER::IsDismissed ( )
protectedinherited

Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been dismissed yet with DismissModal().

IOW, it will return true if the dialog is not modal or if it is modal and has been dismissed.

Definition at line 158 of file kiway_player.cpp.

References KIWAY_PLAYER::m_modal_loop.

Referenced by LIB_VIEW_FRAME::OnCloseWindow(), FOOTPRINT_VIEWER_FRAME::OnCloseWindow(), and FOOTPRINT_WIZARD_FRAME::OnCloseWindow().

159 {
160  return !m_modal_loop;
161 }
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
bool EDA_BASE_FRAME::IsWritable ( const wxFileName &  aFileName)
inherited

Function IsWritable checks if aFileName can be written.

The function performs a number of tests on aFileName to verify that it can be saved. If aFileName defines a path with no file name, them the path is tested for user write permission. If aFileName defines a file name that does not exist in the path, the path is tested for user write permission. If aFileName defines a file that already exits, the file name is tested for user write permissions.

Note
The file name path must be set or an assertion will be raised on debug builds and return false on release builds.
Parameters
aFileNameThe full path and/or file name of the file to test.
Returns
False if aFileName cannot be written.

Definition at line 554 of file eda_base_frame.cpp.

References GetChars().

Referenced by SCH_EDIT_FRAME::doAutoSave(), EDA_BASE_FRAME::GetMruPath(), SCH_EDIT_FRAME::SaveEEFile(), LIB_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), SaveProjectFile(), and SCH_EDIT_FRAME::SaveProjectSettings().

555 {
556  wxString msg;
557  wxFileName fn = aFileName;
558 
559  // Check for absence of a file path with a file name. Unfortunately KiCad
560  // uses paths relative to the current project path without the ./ part which
561  // confuses wxFileName. Making the file name path absolute may be less than
562  // elegant but it solves the problem.
563  if( fn.GetPath().IsEmpty() && fn.HasName() )
564  fn.MakeAbsolute();
565 
566  wxCHECK_MSG( fn.IsOk(), false,
567  wxT( "File name object is invalid. Bad programmer!" ) );
568  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
569  wxT( "File name object path <" ) + fn.GetFullPath() +
570  wxT( "> is not set. Bad programmer!" ) );
571 
572  if( fn.IsDir() && !fn.IsDirWritable() )
573  {
574  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
575  GetChars( fn.GetPath() ) );
576  }
577  else if( !fn.FileExists() && !fn.IsDirWritable() )
578  {
579  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
580  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
581  }
582  else if( fn.FileExists() && !fn.IsFileWritable() )
583  {
584  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
585  GetChars( fn.GetFullPath() ) );
586  }
587 
588  if( !msg.IsEmpty() )
589  {
590  wxMessageBox( msg );
591  return false;
592  }
593 
594  return true;
595 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), and KIWAY_HOLDER::SetKiway().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CreateScreenCmp(), CVPCB_MAINFRAME(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), FOOTPRINT_EDIT_FRAME::GetIconScale(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnIdle(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void KIWAY_PLAYER::kiway_express ( KIWAY_EXPRESS aEvent)
protectedinherited

event handler, routes to derivative specific virtual KiwayMailIn()

Definition at line 179 of file kiway_player.cpp.

References KIWAY_PLAYER::KiwayMailIn().

180 {
181  // logging support
182  KiwayMailIn( aEvent ); // call the virtual, override in derived.
183 }
virtual void KiwayMailIn(KIWAY_EXPRESS &aEvent)
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
void CVPCB_MAINFRAME::KiwayMailIn ( KIWAY_EXPRESS aEvent)
overridevirtual

Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.

Merely override it in derived classes.

Reimplemented from KIWAY_PLAYER.

Definition at line 981 of file cvpcb_mainframe.cpp.

References KIWAY_EXPRESS::Command(), DBG, KIWAY_EXPRESS::GetPayload(), MAIL_EESCHEMA_NETLIST, MAIL_STATUS, ReadNetListAndFpFiles(), and SetStatusText().

982 {
983  const std::string& payload = mail.GetPayload();
984 
985  DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
986 
987  switch( mail.Command() )
988  {
990  ReadNetListAndFpFiles( payload );
991  /* @todo
992  Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
993  */
994  break;
995 
996  case MAIL_STATUS:
997  SetStatusText( payload, 1 );
998  break;
999 
1000  default:
1001  ; // ignore most
1002  }
1003 }
void SetStatusText(const wxString &aText, int aNumber=0) override
bool ReadNetListAndFpFiles(const std::string &aNetlist)
Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprin...
#define DBG(x)
Definition: fctsys.h:33
SCH->CVPCB netlist immediately after launching CVPCB.
Definition: mail_type.h:42
void KIWAY_PLAYER::language_change ( wxCommandEvent &  event)
protectedinherited

Function language_change is an event handler called on a language menu selection.

Definition at line 186 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::SetLanguage().

187 {
188  int id = event.GetId();
189 
190  // tell all the KIWAY_PLAYERs about the language change.
191  Kiway().SetLanguage( id );
192 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY void SetLanguage(int aLanguage)
Function SetLanguage changes the language and then calls ShowChangedLanguage() on all KIWAY_PLAYERs...
Definition: kiway.cpp:395
bool CVPCB_MAINFRAME::LoadFootprintFiles ( )

Function LoadFootprintFiles reads the list of footprint (*.mod files) and generate the list of footprints.

for each module are stored the module name documentation string associated keywords m_ModuleLibNames is the list of library that must be read (loaded) fills m_footprints

Returns
true if libraries are found, false otherwise.

Definition at line 730 of file cvpcb_mainframe.cpp.

References FOOTPRINT_LIST::DisplayErrors(), FOOTPRINT_LIST::GetErrorCount(), LIB_TABLE::GetLogicalLibs(), KIWAY_HOLDER::Kiway(), m_FootprintsList, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), and FOOTPRINT_LIST::ReadFootprintFiles().

Referenced by ReadNetListAndFpFiles().

731 {
732  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
733 
734  // Check if there are footprint libraries in the footprint library table.
735  if( !fptbl || !fptbl->GetLogicalLibs().size() )
736  {
737  wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
738  "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
739  return false;
740  }
741 
742  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
743 
744  m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
745 
747  {
749  }
750 
751  return true;
752 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
FOOTPRINT_LIST * m_FootprintsList
void DisplayErrors(wxTopLevelWindow *aCaller=NULL)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)=0
Read all the footprints provided by the combination of aTable and aNickname.
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
unsigned GetErrorCount() const
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 CVPCB_MAINFRAME::LoadProjectFile ( )

Function LoadProjectFile reads the CvPcb configuration parameter from the project (.pro) file aFileName.

Definition at line 59 of file cfg.cpp.

References PROJECT::ConfigLoad(), GetProjectFileParameters(), GROUP_CVP, Kiface(), m_EquFilesNames, m_ModuleLibNames, and KIWAY_HOLDER::Prj().

Referenced by ReadNetListAndFpFiles().

60 {
61  PROJECT& prj = Prj();
62 
63  m_ModuleLibNames.Clear();
64  m_EquFilesNames.Clear();
65 
66  prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
67 }
Class PROJECT holds project specific data.
Definition: project.h:56
wxArrayString m_EquFilesNames
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxArrayString m_ModuleLibNames
#define GROUP_CVP
Definition: config_params.h:52
VTBL_ENTRY bool ConfigLoad(const SEARCH_STACK &aSearchS, const wxString &aGroupName, const PARAM_CFG_ARRAY &aParams, const wxString &aForeignConfigFileName=wxEmptyString)
Function ConfigLoad reads a subset of parameters from the "project" file.
Definition: project.cpp:351
PARAM_CFG_ARRAY & GetProjectFileParameters(void)
Function GetProjectFileParameters return project file parameter list for CvPcb.
Definition: cfg.cpp:45
void CVPCB_MAINFRAME::LoadSettings ( wxConfigBase *  aCfg)
overridevirtual

Function LoadSettings loads common frame parameters from a configuration file.

Don't forget to call the base method or your frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Definition at line 228 of file cvpcb_mainframe.cpp.

References FilterFootprintEntry, FRAME_DEFAULT_SIZE_DU(), EDA_BASE_FRAME::LoadSettings(), m_filteringOptions, EDA_BASE_FRAME::m_FrameSize, and FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST.

Referenced by CVPCB_MAINFRAME().

229 {
231 
232  wxSize const frame_default( ConvertDialogToPixels( FRAME_DEFAULT_SIZE_DU ) );
233 
234  if( m_FrameSize == wxDefaultSize )
235  m_FrameSize = frame_default;
236 
238 }
static const wxString FilterFootprintEntry
wxSize const FRAME_DEFAULT_SIZE_DU(450, 300)
virtual void LoadSettings(wxConfigBase *aCfg)
Function LoadSettings loads common frame parameters from a configuration file.
void EDA_BASE_FRAME::onAutoSaveTimer ( wxTimerEvent &  aEvent)
protectedinherited

Function onAutoSaveTimer handles the auto save timer event.

Definition at line 244 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::doAutoSave(), EDA_BASE_FRAME::m_autoSaveInterval, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

245 {
246  if( !doAutoSave() )
247  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
248 }
virtual bool doAutoSave()
Function doAutoSave should be overridden by the derived class to handle the auto save feature...
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.
void CVPCB_MAINFRAME::OnCancel ( wxCommandEvent &  aEvent)

Definition at line 390 of file cvpcb_mainframe.cpp.

References m_modified.

391 {
392  // Throw away modifications on a Cancel
393  m_modified = false;
394 
395  Close( false );
396 }
void KIWAY_PLAYER::OnChangeIconsOptions ( wxCommandEvent &  event)
overrideprotectedvirtualinherited

Function OnChangeIconsOptions is an event handler called on a icons options in menus or toolbars menu selection.

Reimplemented from EDA_BASE_FRAME.

Definition at line 195 of file kiway_player.cpp.

References KIWAY_HOLDER::Kiway(), EDA_BASE_FRAME::OnChangeIconsOptions(), and KIWAY::ShowChangedIcons().

196 {
199 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
virtual void OnChangeIconsOptions(wxCommandEvent &event)
Function OnChangeIconsOptions Selects the current icons options in menus (or toolbars) in Kicad (the ...
VTBL_ENTRY void ShowChangedIcons()
Function ShowChangedIcons Calls ShowChangedIcons() on all KIWAY_PLAYERs.
Definition: kiway.cpp:431
void CVPCB_MAINFRAME::OnCloseWindow ( wxCloseEvent &  Event)

Definition at line 255 of file cvpcb_mainframe.cpp.

References KIWAY_PLAYER::Destroy(), DisplayExitDialog(), GetFootprintViewerFrame(), m_modified, and SaveFootprintAssociation().

256 {
257  if( m_modified )
258  {
259  wxString msg = _( "Component to Footprint links modified.\nSave before exit?" );
260  int ii = DisplayExitDialog( this, msg );
261 
262  switch( ii )
263  {
264  case wxID_CANCEL:
265  Event.Veto();
266  return;
267 
268  case wxID_NO:
269  break;
270 
271  case wxID_YES:
272  SaveFootprintAssociation( false );
273  break;
274  }
275  }
276 
277  // Close module display frame
279  GetFootprintViewerFrame()->Close( true );
280 
281  m_modified = false;
282 
283  Destroy();
284 }
int DisplayExitDialog(wxWindow *parent, const wxString &aMessage)
Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save...
Definition: confirm.cpp:173
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void SaveFootprintAssociation(bool doSaveSchematic)
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
void CVPCB_MAINFRAME::OnConfigurePaths ( wxCommandEvent &  aEvent)

Definition at line 967 of file cvpcb_mainframe.cpp.

References PGM_BASE::ConfigurePaths(), and Pgm().

968 {
969  Pgm().ConfigurePaths( this );
970 }
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
VTBL_ENTRY void ConfigurePaths(wxWindow *aParent=NULL)
Function ConfigurePaths.
Definition: pgm_base.cpp:912
void CVPCB_MAINFRAME::OnEditEquFilesList ( wxCommandEvent &  aEvent)

Function OnEditEquFilesList envokes the equ files list edit dialog.

Definition at line 60 of file dialog_config_equfiles.cpp.

61 {
62  DIALOG_CONFIG_EQUFILES dlg( this );
63 
64  dlg.ShowModal();
65 }
void CVPCB_MAINFRAME::OnEditFootprintLibraryTable ( wxCommandEvent &  event)

Function OnEditFootprintLibraryTable displays the footprint library table editing dialog and updates the global and local footprint tables accordingly.

Definition at line 439 of file cvpcb_mainframe.cpp.

References BuildLIBRARY_LISTBOX(), dummy(), PROJECT::FootprintLibTblName(), Format(), GetChars(), FP_LIB_TABLE::GetGlobalTableFileName(), GFootprintTable, InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), m_FootprintsList, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), FOOTPRINT_LIST::ReadFootprintFiles(), LIB_TABLE::Save(), and IO_ERROR::What().

440 {
441  bool tableChanged = false;
442  int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs( Kiway() ) );
443 
444  if( r & 1 )
445  {
446  wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
447 
448  try
449  {
450  GFootprintTable.Save( fileName );
451  tableChanged = true;
452  }
453  catch( const IO_ERROR& ioe )
454  {
455  wxString msg = wxString::Format(
456  _( "Error occurred saving the global footprint library table:\n\"%s\"\n%s" ),
457  GetChars( fileName ),
458  GetChars( ioe.What() )
459  );
460  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
461  }
462  }
463 
464  if( r & 2 )
465  {
466  wxString fileName = Prj().FootprintLibTblName();
467 
468  try
469  {
470  Prj().PcbFootprintLibs( Kiway() )->Save( fileName );
471  tableChanged = true;
472  }
473  catch( const IO_ERROR& ioe )
474  {
475  wxString msg = wxString::Format(
476  _( "Error occurred saving the project footprint library table:\n\"%s\"\n%s" ),
477  GetChars( fileName ),
478  GetChars( ioe.What() )
479  );
480  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
481  }
482  }
483 
484  if( tableChanged )
485  {
486  wxBusyCursor dummy;
488  m_FootprintsList->ReadFootprintFiles( Prj().PcbFootprintLibs( Kiway() ) );
489  }
490 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
FOOTPRINT_LIST * m_FootprintsList
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:305
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)=0
Read all the footprints provided by the combination of aTable and aNickname.
int InvokePcbLibTableEditor(wxTopLevelWindow *aCaller, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib ...
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
VTBL_ENTRY const wxString FootprintLibTblName() const
Function FootprintLibTblName returns the path and filename of this project&#39;s fp-lib-table, i.e.
Definition: project.cpp:118
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.
void CVPCB_MAINFRAME::OnEnterFilteringText ( wxCommandEvent &  event)

Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed.

Definition at line 632 of file cvpcb_mainframe.cpp.

References FOOTPRINTS_LISTBOX::FILTERING_BY_NAME, m_currentSearchPattern, m_filteringOptions, m_tcFilterString, and OnSelectFilteringFootprint().

633 {
634  // Called when changing the filter string in main toolbar.
635  // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_NAME is set, update the list of
636  // available footprints which match the filter
637 
639 
641  return;
642 
643  OnSelectFilteringFootprint( aEvent );
644 }
void OnSelectFilteringFootprint(wxCommandEvent &event)
Function OnSelectFilteringFootprint is the command event handler for enabling and disabling footprint...
wxString m_currentSearchPattern
wxTextCtrl * m_tcFilterString
void CVPCB_MAINFRAME::OnFilterFPbyKeyName ( wxUpdateUIEvent &  event)
private
void CVPCB_MAINFRAME::OnFilterFPbyKeywords ( wxUpdateUIEvent &  event)
private
void CVPCB_MAINFRAME::OnFilterFPbyLibrary ( wxUpdateUIEvent &  event)
private
void CVPCB_MAINFRAME::OnFilterFPbyPinCount ( wxUpdateUIEvent &  event)
private
void CVPCB_MAINFRAME::OnKeyDown ( wxKeyEvent &  aEvent)
void CVPCB_MAINFRAME::OnOK ( wxCommandEvent &  aEvent)

Definition at line 372 of file cvpcb_mainframe.cpp.

References m_modified, and SaveFootprintAssociation().

373 {
374  SaveFootprintAssociation( false );
375 
376  m_modified = false;
377 
378  Close( true );
379 }
void SaveFootprintAssociation(bool doSaveSchematic)
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
void CVPCB_MAINFRAME::OnQuit ( wxCommandEvent &  event)

Definition at line 399 of file cvpcb_mainframe.cpp.

400 {
401  Close( false );
402 }
void CVPCB_MAINFRAME::OnSaveAndContinue ( wxCommandEvent &  aEvent)

Definition at line 382 of file cvpcb_mainframe.cpp.

References m_modified, and SaveFootprintAssociation().

Referenced by CVPCB_MAINFRAME(), and ~CVPCB_MAINFRAME().

383 {
384  SaveFootprintAssociation( true );
385 
386  m_modified = false;
387 }
void SaveFootprintAssociation(bool doSaveSchematic)
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
void CVPCB_MAINFRAME::OnSelectComponent ( wxListEvent &  event)

Function OnSelectComponent Called when clicking on a component in component list window.

  • Updates the filtered footprint list, if the filtered list option is selected
  • Updates the current selected footprint in footprint list
  • Updates the footprint shown in footprint display window (if opened)

Definition at line 500 of file cvpcb_mainframe.cpp.

References GetSelectedComponent(), LIBRARY_LISTBOX::GetSelectedLibrary(), m_currentSearchPattern, m_filteringOptions, m_footprintListBox, m_FootprintsList, m_libListBox, m_skipComponentSelect, refreshAfterComponentSearch(), and FOOTPRINTS_LISTBOX::SetFootprints().

Referenced by COMPONENTS_LISTBOX::OnSelectComponent(), OnSelectFilteringFootprint(), and LIBRARY_LISTBOX::OnSelectLibrary().

501 {
503  return;
504 
505  wxString libraryName;
506  COMPONENT* component = GetSelectedComponent();
507  libraryName = m_libListBox->GetSelectedLibrary();
508 
509  m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
511 
512  refreshAfterComponentSearch (component);
513 }
FOOTPRINT_LIST * m_FootprintsList
wxString m_currentSearchPattern
void refreshAfterComponentSearch(COMPONENT *component)
wxString GetSelectedLibrary()
LIBRARY_LISTBOX * m_libListBox
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetSelectedComponent()
FOOTPRINTS_LISTBOX * m_footprintListBox
void SetFootprints(FOOTPRINT_LIST &aList, const wxString &aLibName, COMPONENT *aComponent, const wxString &aFootPrintFilterPattern, int aFilterType)
Function SetFootprints populates the wxListCtrl with the footprints from aList that meet the filter c...
void CVPCB_MAINFRAME::OnSelectFilteringFootprint ( wxCommandEvent &  event)

Function OnSelectFilteringFootprint is the command event handler for enabling and disabling footprint filtering.

Definition at line 574 of file cvpcb_mainframe.cpp.

References FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD, FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY, FOOTPRINTS_LISTBOX::FILTERING_BY_NAME, FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT, m_currentSearchPattern, m_filteringOptions, m_tcFilterString, and OnSelectComponent().

Referenced by OnEnterFilteringText().

575 {
576  int option = 0;
577 
578  switch( event.GetId() )
579  {
582  break;
583 
586  break;
587 
590  break;
591 
595  break;
596  }
597 
598  if( event.IsChecked() )
599  m_filteringOptions |= option;
600  else
601  m_filteringOptions &= ~option;
602 
603  wxListEvent l_event;
604  OnSelectComponent( l_event );
605 }
wxString m_currentSearchPattern
wxTextCtrl * m_tcFilterString
void OnSelectComponent(wxListEvent &event)
Function OnSelectComponent Called when clicking on a component in component list window.
void EDA_BASE_FRAME::OnSelectPreferredEditor ( wxCommandEvent &  event)
virtualinherited

Function OnSelectPreferredEditor Open a dialog to select the editor that will used in KiCad to edit or display files (reports ...

) The full filename editor is saved in configuration (global params)

Definition at line 517 of file eda_base_frame.cpp.

References PGM_BASE::AskUserForPreferredEditor(), PGM_BASE::GetEditorName(), Pgm(), and PGM_BASE::SetEditorName().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

518 {
519  // Ask for the current editor and instruct GetEditorName() to not show
520  // unless we pass false as argument.
521  wxString editorname = Pgm().GetEditorName( false );
522 
523  // Ask the user to select a new editor, but suggest the current one as the default.
524  editorname = Pgm().AskUserForPreferredEditor( editorname );
525 
526  // If we have a new editor name request it to be copied to m_editor_name and saved
527  // to the preferences file. If the user cancelled the dialog then the previous
528  // value will be retained.
529  if( !editorname.IsEmpty() )
530  Pgm().SetEditorName( editorname );
531 }
VTBL_ENTRY void SetEditorName(const wxString &aFileName)
Definition: pgm_base.cpp:330
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
VTBL_ENTRY const wxString AskUserForPreferredEditor(const wxString &aDefaultEditor=wxEmptyString)
Shows a dialog that instructs the user to select a new preferred editor.
Definition: pgm_base.cpp:375
VTBL_ENTRY const wxString & GetEditorName(bool aCanShowFileChooser=true)
Return the preferred editor name.
Definition: pgm_base.cpp:338
void CVPCB_MAINFRAME::OnSize ( wxSizeEvent &  SizeEvent)

Definition at line 249 of file cvpcb_mainframe.cpp.

250 {
251  event.Skip();
252 }
bool CVPCB_MAINFRAME::OpenProjectFiles ( const std::vector< wxString > &  aFileSet,
int  aCtl = 0 
)
override

Definition at line 433 of file cvpcb_mainframe.cpp.

434 {
435  return true;
436 }
bool EDA_BASE_FRAME::PostCommandMenuEvent ( int  evt_type)
inherited

Function PostCommandMenuEvent.

Post a menu event to the frame, which can be used to trigger actions bound to menu items.

Definition at line 667 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::GetMruPath(), FOOTPRINT_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), and FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem().

668 {
669  if( evt_type != 0 )
670  {
671  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
672  evt.SetEventObject( this );
673  evt.SetId( evt_type );
674  wxPostEvent( this, evt );
675  return true;
676  }
677 
678  return false;
679 }
void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 402 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::IsType().

403 {
404  SetStatusText( text );
405 }
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_FOOTPRINT_FP_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkNewAlias(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_FOOTPRINT_FP_EDITOR::Edit3DShapeFileName(), DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), and DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
bool EDA_BASE_FRAME::ProcessEvent ( wxEvent &  aEvent)
overrideinherited

Function ProcessEvent overrides the default process event handler to implement the auto save feature.

Warning
If you override this function in a derived class, make sure you call down to this or the auto save feature will be disabled.

Definition at line 186 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::findQuasiModalDialog(), EDA_BASE_FRAME::isAutoSaveRequired(), EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, EDA_BASE_FRAME::m_autoSaveTimer, EDA_BASE_FRAME::m_hasAutoSave, and traceAutoSave.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), LIB_VIEW_FRAME::onSelectNextSymbol(), LIB_VIEW_FRAME::onSelectPreviousSymbol(), KIWAY::ProcessEvent(), LIB_VIEW_FRAME::ReCreateListCmp(), GERBVIEW_CONTROL::SwitchUnits(), and PCBNEW_CONTROL::SwitchUnits().

187 {
188 #ifdef __WXMAC__
189  // Apple in its infinite wisdom will raise a disabled window before even passing
190  // us the event, so we have no way to stop it. Instead, we have to catch an
191  // improperly ordered disabled window and quasi-modal dialog here and reorder
192  // them.
193  if( !IsEnabled() && IsActive() )
194  {
195  wxWindow* dlg = findQuasiModalDialog();
196  if( dlg )
197  dlg->Raise();
198  }
199 #endif
200 
201  if( !wxFrame::ProcessEvent( aEvent ) )
202  return false;
203 
204  if( IsShown() && m_hasAutoSave && IsActive() &&
206  {
207  if( !m_autoSaveState )
208  {
209  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
210  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
211  m_autoSaveState = true;
212  }
213  else if( m_autoSaveTimer->IsRunning() )
214  {
215  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
216  m_autoSaveTimer->Stop();
217  m_autoSaveState = false;
218  }
219  }
220 
221  return true;
222 }
bool m_autoSaveState
Flag to indicate the last auto save state.
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
wxWindow * findQuasiModalDialog()
virtual bool isAutoSaveRequired() const
Function autoSaveRequired returns the auto save status of the application.
bool m_hasAutoSave
Flag to indicate if this frame supports auto save.
int m_autoSaveInterval
The auto save interval time in seconds.
int EDA_BASE_FRAME::ReadHotkeyConfig ( struct EDA_HOTKEY_CONFIG aDescList)
inherited

Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys.

Parameters
aDescList= current hotkey list descr. to initialize.

Definition at line 649 of file hotkeys_basic.cpp.

References ReadHotkeyConfig().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

650 {
651  ::ReadHotkeyConfig( GetName(), aDescList );
652  return 1;
653 }
int ReadHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys...
int EDA_BASE_FRAME::ReadHotkeyConfigFile ( const wxString &  aFilename,
struct EDA_HOTKEY_CONFIG aDescList 
)
inherited

Function ReadHotkeyConfigFile Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list with hotkeys.

Parameters
aFilename= file name to read.
aDescList= current hotkey list descr. to initialize.

Definition at line 594 of file hotkeys_basic.cpp.

References DEFAULT_HOTKEY_FILENAME_EXT, and ParseHotkeyConfig().

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

596 {
597  wxFileName fn( aFilename );
598  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
599 
600  wxFile cfgfile( fn.GetFullPath() );
601 
602  if( !cfgfile.IsOpened() ) // There is a problem to open file
603  return 0;
604 
605  // get length
606  cfgfile.SeekEnd();
607  wxFileOffset size = cfgfile.Tell();
608  cfgfile.Seek( 0 );
609 
610  // read data
611  std::vector<char> buffer( size );
612  cfgfile.Read( buffer.data(), size );
613  wxString data( buffer.data(), wxConvUTF8 );
614 
615  // parse
616  ParseHotkeyConfig( data, aDescList );
617 
618  // cleanup
619  cfgfile.Close();
620  return 1;
621 }
void ParseHotkeyConfig(const wxString &data, struct EDA_HOTKEY_CONFIG *aDescList)
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34
bool CVPCB_MAINFRAME::ReadNetListAndFpFiles ( const std::string &  aNetlist)

Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprint libraries from fp lib tables.

Parameters
aNetlistis the netlist from eeschema in kicad s-expr format. (see CVPCB_MAINFRAME::KiwayMailIn() to know how to get this netlist)

Definition at line 168 of file readwrite_dlgs.cpp.

References DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add(), NETLIST::AnyFootprintsLinked(), COMPONENTS_LISTBOX::AppendLine(), BuildFOOTPRINTS_LISTBOX(), BuildLIBRARY_LISTBOX(), UTF8::c_str(), COMPONENTS_LISTBOX::Clear(), CMP_FORMAT, DBG, DisplayStatus(), LIB_ID::empty(), LIB_ID::Format(), Format(), FROM_UTF8(), COMPONENT::GetAltFPID(), GetChars(), NETLIST::GetComponent(), COMPONENTS_LISTBOX::GetCount(), NETLIST::GetCount(), COMPONENT::GetFPID(), LIB_ID::GetLibItemName(), COMPONENT::GetReference(), DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection(), COMPONENT::GetValue(), guessNickname(), i, NETLIST::IsEmpty(), LIB_ID::IsLegacy(), IsOK(), KIWAY_HOLDER::Kiway(), HTML_MESSAGE_BOX::ListSet(), LoadFootprintFiles(), LoadProjectFile(), m_compListBox, m_modified, m_netlist, HTML_MESSAGE_BOX::MessageSet(), PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), ReadSchematicNetlist(), COMPONENT::SetFPID(), COMPONENTS_LISTBOX::SetSelection(), DIALOG_SHIM::Show(), TO_UTF8, and IO_ERROR::What().

Referenced by KiwayMailIn().

169 {
170  wxString msg;
171  bool hasMissingNicks = false;
172 
173  ReadSchematicNetlist( aNetlist );
174 
175  if( m_compListBox == NULL )
176  return false;
177 
178  LoadProjectFile();
179 
180  wxSafeYield();
181 
183 
186 
187  m_compListBox->Clear();
188 
190  {
191  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
192  {
193  COMPONENT* component = m_netlist.GetComponent( i );
194 
195  if( component->GetFPID().empty() )
196  continue;
197 
198  if( component->GetFPID().IsLegacy() )
199  hasMissingNicks = true;
200  }
201  }
202 
203  // Check if footprint links were generated before the footprint library table was implemented.
204  if( hasMissingNicks )
205  {
206  msg = _(
207  "Some of the assigned footprints are legacy entries (are missing lib nicknames). "
208  "Would you like CvPcb to attempt to convert them to the new required LIB_ID format? "
209  "(If you answer no, then these assignments will be cleared out and you will "
210  "have to re-assign these footprints yourself.)"
211  );
212 
213  if( IsOK( this, msg ) )
214  {
215  msg.Clear();
216 
217  try
218  {
219  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
220  {
221  COMPONENT* component = m_netlist.GetComponent( i );
222 
223  if( component->GetFPID().IsLegacy() )
224  {
225  // get this first here, it's possibly obsoleted if we get it too soon.
226  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
227 
228  int guess = guessNickname( tbl, (LIB_ID*) &component->GetFPID() );
229 
230  switch( guess )
231  {
232  case 0:
233  DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
234  TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );)
235  m_modified = true;
236  break;
237 
238  case 1:
239  msg += wxString::Format( _(
240  "Component \"%s\" footprint \"%s\" was <b>not found</b> in any library.\n" ),
241  GetChars( component->GetReference() ),
242  GetChars( component->GetFPID().GetLibItemName() )
243  );
244  break;
245 
246  case 2:
247  msg += wxString::Format( _(
248  "Component \"%s\" footprint \"%s\" was found in <b>multiple</b> libraries.\n" ),
249  GetChars( component->GetReference() ),
250  GetChars( component->GetFPID().GetLibItemName() )
251  );
252  break;
253  }
254  }
255  }
256  }
257  catch( const IO_ERROR& ioe )
258  {
259  msg = ioe.What();
260  msg += wxT( "\n\n" );
261  msg += _( "First check your footprint library table entries." );
262 
263  wxMessageBox( msg, _( "Problematic Footprint Library Tables" ) );
264  return false;
265  }
266 
267  if( msg.size() )
268  {
269  HTML_MESSAGE_BOX dlg( this, wxEmptyString );
270 
271  dlg.MessageSet( _( "The following errors occurred attempting to convert the "
272  "footprint assignments:\n\n" ) );
273  dlg.ListSet( msg );
274  dlg.MessageSet( _( "\nYou will need to reassign them manually if you want them "
275  "to be updated correctly the next time you import the "
276  "netlist in Pcbnew." ) );
277 
278 #if 1
279  dlg.ShowModal();
280 #else
281  dlg.Fit();
282  dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working.
283 #endif
284  }
285  }
286  else
287  {
288  // Clear the legacy footprint assignments.
289  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
290  {
291  COMPONENT* component = m_netlist.GetComponent( i );
292 
293  if( component->GetFPID().IsLegacy() )
294  {
295  component->SetFPID( LIB_ID() /* empty */ );
296  m_modified = true;
297  }
298  }
299  }
300  }
301 
302 
303  // Display a dialog to select footprint selection, if the netlist
304  // and the .cmp file give 2 different valid footprints
305  std::vector <int > m_indexes; // indexes of footprints in netlist
306 
307  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
308  {
309  COMPONENT* component = m_netlist.GetComponent( ii );
310 
311  if( component->GetAltFPID().empty() )
312  continue;
313 
314  if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
315  continue;
316 
317  m_indexes.push_back( ii );
318  }
319 
320  // If a n assignment conflict is found,
321  // open a dialog to chose between schematic assignment
322  // and .cmp file assignment:
323  if( m_indexes.size() > 0 )
324  {
326 
327  for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
328  {
329  COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
330 
331  wxString cmpfpid = component->GetFPID().Format();
332  wxString schfpid = component->GetAltFPID().Format();
333 
334  dlg.Add( component->GetReference(), schfpid, cmpfpid );
335  }
336 
337  if( dlg.ShowModal() == wxID_OK )
338  {
339 
340  // Update the fp selection:
341  for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
342  {
343  COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
344 
345  int choice = dlg.GetSelection( component->GetReference() );
346 
347  if( choice == 0 ) // the schematic (alt fpid) is chosen:
348  component->SetFPID( component->GetAltFPID() );
349  }
350  }
351  }
352 
353  // Populates the component list box:
354  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
355  {
356  COMPONENT* component = m_netlist.GetComponent( i );
357 
358  msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
359  GetChars( component->GetReference() ),
360  GetChars( component->GetValue() ),
361  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
362 
363  m_compListBox->AppendLine( msg );
364  }
365 
366  if( !m_netlist.IsEmpty() )
367  m_compListBox->SetSelection( 0, true );
368 
369  DisplayStatus();
370 
371  return true;
372 }
bool empty() const
Definition: lib_id.h:173
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
bool AnyFootprintsLinked() const
Function AnyFootprintsLinked.
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:155
COMPONENTS_LISTBOX * m_compListBox
bool IsLegacy() const
Definition: lib_id.h:163
void SetSelection(int index, bool State=true)
int ReadSchematicNetlist(const std::string &aNetlist)
Function ReadSchematicNetlist read the netlist (.net) file built on the fly by Eeschema.
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool LoadFootprintFiles()
Function LoadFootprintFiles reads the list of footprint (*.mod files) and generate the list of footpr...
static int guessNickname(FP_LIB_TABLE *aTbl, LIB_ID *aFootprintId)
Return true if the resultant LIB_ID has a certain nickname.
void AppendLine(const wxString &text)
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const wxString & GetValue() const
Definition: pcb_netlist.h:153
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
void BuildFOOTPRINTS_LISTBOX()
Class HTML_MESSAGE_BOX.
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
#define CMP_FORMAT
Definition: cvpcb.h:30
const LIB_ID & GetAltFPID() const
Definition: pcb_netlist.h:168
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const char * c_str() const
Definition: utf8.h:107
size_t i
Definition: json11.cpp:597
UTF8 Format() const
Definition: lib_id.cpp:263
#define DBG(x)
Definition: fctsys.h:33
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void LoadProjectFile()
Function LoadProjectFile reads the CvPcb configuration parameter from the project (...
Definition: cfg.cpp:59
int CVPCB_MAINFRAME::ReadSchematicNetlist ( const std::string &  aNetlist)

Function ReadSchematicNetlist read the netlist (.net) file built on the fly by Eeschema.

Parameters
aNetlistis the netlist buffer filled by eeschema, in kicad s-expr format. It is the same netlist as the .net file created by Eeschema. (This method is called by ReadNetListAndFpFiles)

Definition at line 779 of file cvpcb_mainframe.cpp.

References NETLIST::Clear(), Format(), NETLIST::GetComponent(), NETLIST::GetCount(), COMPONENT::GetFPID(), LIB_ID::GetLibItemName(), KICAD_NETLIST_READER::LoadNetlist(), m_netlist, COMPONENT::SetFPID(), NETLIST::SortByReference(), and IO_ERROR::What().

Referenced by ReadNetListAndFpFiles().

780 {
781  STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
782  KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
783 
784  m_netlist.Clear();
785 
786  try
787  {
788  netrdr.LoadNetlist();
789  }
790  catch( const IO_ERROR& ioe )
791  {
792  wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ), ioe.What().GetData() );
793  wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
794  return 1;
795  }
796 
797  // We also remove footprint name if it is "$noname" because this is a dummy name,
798  // not the actual name of the footprint.
799  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
800  {
801  if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
802  m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
803  }
804 
805  // Sort components by reference:
807 
808  return 0;
809 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
Class KICAD_NETLIST_READER read the new s-expression based KiCad netlist format.
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:155
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void SortByReference()
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void Clear()
Function Clear removes all components from the netlist.
Definition: pcb_netlist.h:250
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
Class STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:254
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void CVPCB_MAINFRAME::ReCreateHToolbar ( void  )

Definition at line 35 of file tool_cvpcb.cpp.

References ID_CVPCB_AUTO_ASSOCIE, ID_CVPCB_CREATE_SCREENCMP, ID_CVPCB_DEL_ASSOCIATIONS, ID_CVPCB_FILTER_TEXT_EDIT, ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, ID_CVPCB_GOTO_FIRSTNA, ID_CVPCB_GOTO_PREVIOUSNA, ID_CVPCB_LIB_TABLE_EDIT, ID_H_TOOLBAR, EDA_BASE_FRAME::KICAD_AUI_TB_STYLE, KiScaledBitmap(), KiScaledSeparator(), m_mainToolBar, and m_tcFilterString.

Referenced by CVPCB_MAINFRAME(), and ShowChangedLanguage().

36 {
37  if( m_mainToolBar )
38  m_mainToolBar->Clear();
39  else
40  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
41  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
42 
43  m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
44  KiScaledBitmap( config_xpm, this ),
45  _( "Edit footprint library table" ) );
46 
48  m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
49  KiScaledBitmap( show_footprint_xpm, this ),
50  _( "View selected footprint" ) );
51 
53  m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
54  KiScaledBitmap( left_xpm, this ),
55  _( "Select previous unlinked symbol" ) );
56 
57  m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
58  KiScaledBitmap( right_xpm, this ),
59  _( "Select next unlinked symbol" ) );
60 
62  m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
63  KiScaledBitmap( auto_associe_xpm, this ),
64  _( "Perform automatic footprint association" ) );
65 
66  m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
67  KiScaledBitmap( delete_association_xpm, this ),
68  _( "Delete all footprint associations" ) );
69 
72  KiScaledBitmap( module_filtered_list_xpm, this ),
73  wxNullBitmap,
74  true, NULL,
75  _( "Filter footprint list by schematic symbol keywords" ),
76  wxEmptyString );
77 
79  KiScaledBitmap( module_pin_filtered_list_xpm, this ),
80  wxNullBitmap,
81  true, NULL,
82  _( "Filter footprint list by pin count" ),
83  wxEmptyString );
84 
86  KiScaledBitmap( module_library_list_xpm, this ),
87  wxNullBitmap, true, NULL,
88  _( "Filter footprint list by library" ),
89  wxEmptyString );
90 
93  KiScaledBitmap( module_name_filtered_list_xpm, this ),
94  wxNullBitmap, true, NULL,
95  _( "Filter footprint list using a partial name or a pattern" ),
96  wxEmptyString );
97 
99 
100  m_mainToolBar->AddControl( m_tcFilterString );
101 
102 
103  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
104  m_mainToolBar->Realize();
105 }
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, EDA_BASE_FRAME *aWindow)
Function KiScaledBitmap Constructs a wxBitmap from a memory record, scaling it if device DPI demands ...
Definition: bitmap.cpp:114
wxTextCtrl * m_tcFilterString
wxAuiToolBar * m_mainToolBar
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Function KiScaledSeparator Adds a separator to the given toolbar scaled the same way as KiScaledBitma...
Definition: bitmap.cpp:146
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
void CVPCB_MAINFRAME::ReCreateMenuBar ( void  )
overridevirtual

(Re)Create the menubar for the CvPcb mainframe

Reimplemented from EDA_BASE_FRAME.

Definition at line 43 of file cvpcb/menubar.cpp.

References AddMenuItem(), PGM_BASE::AddMenuLanguageList(), ID_CVPCB_EQUFILES_LIST_EDIT, ID_CVPCB_LIB_TABLE_EDIT, ID_PREFERENCES_CONFIGURE_PATHS, KiBitmap(), Pgm(), and SAVE_HLP_MSG.

Referenced by CVPCB_MAINFRAME().

44 {
45  // wxWidgets handles the Mac Application menu behind the scenes, but that means
46  // we always have to start from scratch with a new wxMenuBar.
47  wxMenuBar* oldMenuBar = GetMenuBar();
48  wxMenuBar* menuBar = new wxMenuBar();
49 
50  // Recreate all menus:
51 
52  // Menu File:
53  wxMenu* filesMenu = new wxMenu;
54 
55  // Save the footprints back into eeschema
56  AddMenuItem( filesMenu, wxID_SAVE,
57  _( "&Save Schematic\tCtrl+S" ),
59  KiBitmap( save_xpm ) );
60 
61  // Preferences Menu :
62  wxMenu* preferencesMenu = new wxMenu;
63 
64  AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
65  _( "Manage Footprint &Libraries..." ), _( "Manage footprint libraries" ),
66  KiBitmap( library_table_xpm ) );
67 
68  // Path configuration edit dialog.
69  AddMenuItem( preferencesMenu,
71  _( "Configure &Paths..." ),
72  _( "Edit path configuration environment variables" ),
73  KiBitmap( editor_xpm ) );
74 
75  preferencesMenu->AppendSeparator();
76  AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
77  _( "Footprint &Association Files..." ),
78  _( "Configure footprint association file (.equ) list."
79  "These files are used to automatically assign "
80  "the footprint name from the symbol value" ),
81  KiBitmap( library_table_xpm ) );
82  preferencesMenu->AppendSeparator();
83 
84  // Language submenu
85  Pgm().AddMenuLanguageList( preferencesMenu );
86 
87  // Menu Help:
88  wxMenu* helpMenu = new wxMenu;
89 
90  // Manual Contents
91  AddMenuItem( helpMenu, wxID_HELP, _( "CvPcb &Manual" ),
92  _( "Open CvPcb Manual" ),
93  KiBitmap( online_help_xpm ) );
94 
95  AddMenuItem( helpMenu,
96  wxID_INDEX,
97  _( "&Getting Started in KiCad" ),
98  _( "Open \"Getting Started in KiCad\" guide for beginners" ),
99  KiBitmap( help_xpm ) );
100 
101  // About CvPcb
102  AddMenuItem( helpMenu, wxID_ABOUT,
103  _( "&About KiCad" ),
104  _( "About KiCad" ),
105  KiBitmap( about_xpm ) );
106 
107  // Create the menubar and append all submenus
108  menuBar->Append( filesMenu, _( "&File" ) );
109  menuBar->Append( preferencesMenu, _( "&Preferences" ) );
110  menuBar->Append( helpMenu, _( "&Help" ) );
111 
112  SetMenuBar( menuBar );
113  delete oldMenuBar;
114 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
#define SAVE_HLP_MSG
VTBL_ENTRY void AddMenuLanguageList(wxMenu *MasterMenu)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
Definition: pgm_base.cpp:831
void CVPCB_MAINFRAME::refreshAfterComponentSearch ( COMPONENT component)
private

Definition at line 516 of file cvpcb_mainframe.cpp.

References UTF8::c_str(), CreateScreenCmp(), DisplayStatus(), LIB_ID::Format(), FROM_UTF8(), FOOTPRINTS_LISTBOX::GetCount(), GetFootprintViewerFrame(), COMPONENT::GetFPID(), ITEMS_LISTBOX_BASE::GetSelection(), EDA_BASE_FRAME::m_auimgr, m_compListBox, m_footprintListBox, m_libListBox, FOOTPRINTS_LISTBOX::OnGetItemText(), SendMessageToEESCHEMA(), and FOOTPRINTS_LISTBOX::SetSelection().

Referenced by OnSelectComponent().

517 {
518  // Tell AuiMgr that objects are changed !
519  if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
520  // (could be not the case when starting CvPcb
521  m_auimgr.Update();
522 
523  if( component == NULL )
524  {
525  DisplayStatus();
526  return;
527  }
528 
529  // Preview of the already assigned footprint.
530  // Find the footprint that was already chosen for this component and select it,
531  // but only if the selection is made from the component list or the library list.
532  // If the selection is made from the footprint list, do not change the current
533  // selected footprint.
534  if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
535  {
536  wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
537 
538  bool found = false;
539 
540  for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
541  {
542  wxString footprintName;
543  wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
544  msg.Trim( true );
545  msg.Trim( false );
546  footprintName = msg.AfterFirst( wxChar( ' ' ) );
547 
548  if( module.Cmp( footprintName ) == 0 )
549  {
550  m_footprintListBox->SetSelection( ii, true );
551  found = true;
552  break;
553  }
554  }
555 
556  if( !found )
557  {
558  int ii = m_footprintListBox->GetSelection();
559 
560  if ( ii >= 0 )
561  m_footprintListBox->SetSelection( ii, false );
562 
564  {
565  CreateScreenCmp();
566  }
567  }
568  }
569 
571  DisplayStatus();
572 }
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
COMPONENTS_LISTBOX * m_compListBox
wxAuiManager m_auimgr
void CreateScreenCmp()
Create or Update the frame showing the current highlighted footprint and (if showed) the 3D display f...
wxString OnGetItemText(long item, long column) const override
Function OnGetItemText this overloaded function MUST be provided for the wxLC_VIRTUAL mode because re...
LIBRARY_LISTBOX * m_libListBox
void SetSelection(int index, bool State=true)
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
const char * c_str() const
Definition: utf8.h:107
FOOTPRINTS_LISTBOX * m_footprintListBox
UTF8 Format() const
Definition: lib_id.cpp:263
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void CVPCB_MAINFRAME::SaveFootprintAssociation ( bool  doSaveSchematic)

Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eeschema via the kiway.

Optionally saves the schematic to disk as well.

Definition at line 375 of file readwrite_dlgs.cpp.

References KIWAY::ExpressMail(), NETLIST::FormatBackAnnotation(), FRAME_SCH, STRING_FORMATTER::GetString(), KIWAY_HOLDER::Kiway(), m_netlist, MAIL_BACKANNOTATE_FOOTPRINTS, and MAIL_SCH_SAVE.

Referenced by OnCloseWindow(), OnOK(), and OnSaveAndContinue().

376 {
377  STRING_FORMATTER sf;
378 
380 
382 
383  if( doSaveSchematic )
384  Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_SAVE, std::string( "" ) );
385 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
CVPCB->SCH footprint stuffing.
Definition: mail_type.h:40
CVPCB->SCH save the schematic.
Definition: mail_type.h:41
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:386
const std::string & GetString()
Definition: richio.h:475
void FormatBackAnnotation(OUTPUTFORMATTER *aOut)
Definition: pcb_netlist.h:355
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
void CVPCB_MAINFRAME::SaveProjectFile ( )

Function SaveProjectFile Saves the CvPcb configuration parameter from the project (.pro) file aFileName.

Definition at line 70 of file cfg.cpp.

References PROJECT::ConfigSave(), GetProjectFileParameters(), PROJECT::GetProjectFullName(), GROUP_CVP, EDA_BASE_FRAME::IsWritable(), Kiface(), and KIWAY_HOLDER::Prj().

Referenced by DIALOG_CONFIG_EQUFILES::OnOkClick().

71 {
72  PROJECT& prj = Prj();
73  wxFileName fn = prj.GetProjectFullName();
74 
75  if( !IsWritable( fn ) )
76  {
77  wxMessageBox( _( "Project file \"%s\" is not writable" ), fn.GetFullPath() );
78  return;
79  }
80 
81  wxString pro_name = fn.GetFullPath();
82 
83  prj.ConfigSave( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters(), pro_name );
84 }
VTBL_ENTRY void ConfigSave(const SEARCH_STACK &aSList, const wxString &aGroupName, const PARAM_CFG_ARRAY &aParams, const wxString &aFileName=wxEmptyString)
Function ConfigSave saves the current "project" parameters into the wxConfigBase* derivative...
Definition: project.cpp:316
Class PROJECT holds project specific data.
Definition: project.h:56
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:94
bool IsWritable(const wxFileName &aFileName)
Function IsWritable checks if aFileName can be written.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
#define GROUP_CVP
Definition: config_params.h:52
PARAM_CFG_ARRAY & GetProjectFileParameters(void)
Function GetProjectFileParameters return project file parameter list for CvPcb.
Definition: cfg.cpp:45
virtual void EDA_BASE_FRAME::SaveProjectSettings ( bool  aAskForSave)
inlinevirtualinherited

Function SaveProjectSettings saves changes to the project settings to the project (.pro) file.

The method is virtual so you can override it to call the suitable save method. The base method do nothing

Parameters
aAskForSave= true to open a dialog before saving the settings

Reimplemented in PCB_EDIT_FRAME, and SCH_EDIT_FRAME.

Definition at line 274 of file eda_base_frame.h.

References EDA_BASE_FRAME::ExportHotkeyConfigToFile(), EDA_BASE_FRAME::GetFileFromHistory(), EDA_BASE_FRAME::ImportHotkeyConfigFromFile(), EDA_BASE_FRAME::OnSelectPreferredEditor(), EDA_BASE_FRAME::ReadHotkeyConfig(), EDA_BASE_FRAME::ReadHotkeyConfigFile(), EDA_BASE_FRAME::UpdateFileHistory(), and EDA_BASE_FRAME::WriteHotkeyConfig().

Referenced by DIALOG_PAGES_SETTINGS::OnOkClick(), SCH_EDIT_FRAME::OnPreferencesOptions(), and SCH_EDIT_FRAME::Process_Config().

274 {};
void CVPCB_MAINFRAME::SaveSettings ( wxConfigBase *  aCfg)
overridevirtual

Function SaveSettings saves common frame parameters to a configuration data file.

Don't forget to call the base class's SaveSettings() from your derived SaveSettings() otherwise the frames won't remember their positions and sizes.

Reimplemented from EDA_BASE_FRAME.

Definition at line 241 of file cvpcb_mainframe.cpp.

References FilterFootprintEntry, m_filteringOptions, and EDA_BASE_FRAME::SaveSettings().

242 {
244 
246 }
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
static const wxString FilterFootprintEntry
void CVPCB_MAINFRAME::SendMessageToEESCHEMA ( )

Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "reference" put cursor on component anchor.

Definition at line 755 of file cvpcb_mainframe.cpp.

References KIWAY::ExpressMail(), FRAME_SCH, NETLIST::GetComponent(), COMPONENT::GetReference(), ITEMS_LISTBOX_BASE::GetSelection(), NETLIST::IsEmpty(), Kiface(), KIWAY_HOLDER::Kiway(), m_compListBox, m_netlist, MAIL_CROSS_PROBE, MSG_TO_SCH, SendCommand(), StrPrintf(), and TO_UTF8.

Referenced by refreshAfterComponentSearch(), ToFirstNA(), and ToPreviousNA().

756 {
757  if( m_netlist.IsEmpty() )
758  return;
759 
760  int selection = m_compListBox->GetSelection();
761 
762  if ( selection < 0 )
763  selection = 0;
764 
765  if( m_netlist.GetComponent( selection ) == NULL )
766  return;
767 
768  COMPONENT* component = m_netlist.GetComponent( selection );
769 
770  std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
771 
772  if( Kiface().IsSingle() )
773  SendCommand( MSG_TO_SCH, packet.c_str() );
774  else
775  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
776 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
COMPONENTS_LISTBOX * m_compListBox
#define MSG_TO_SCH
Definition: eda_dde.h:46
bool SendCommand(int service, const char *cmdline)
Definition: eda_dde.cpp:132
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:386
int StrPrintf(std::string *result, const char *format,...)
Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a char...
Definition: richio.cpp:74
const wxString & GetReference() const
Definition: pcb_netlist.h:151
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
PCB<->SCH, CVPCB->SCH cross-probing.
Definition: mail_type.h:39
void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 225 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::m_autoSaveInterval, EDA_BASE_FRAME::m_autoSaveState, and EDA_BASE_FRAME::m_autoSaveTimer.

Referenced by EDA_BASE_FRAME::isAutoSaveRequired(), DIALOG_GENERALOPTIONS::OnOkClick(), and SCH_EDIT_FRAME::OnPreferencesOptions().

226 {
227  m_autoSaveInterval = aInterval;
228 
229  if( m_autoSaveTimer->IsRunning() )
230  {
231  if( m_autoSaveInterval > 0 )
232  {
233  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
234  }
235  else
236  {
237  m_autoSaveTimer->Stop();
238  m_autoSaveState = false;
239  }
240  }
241 }
bool m_autoSaveState
Flag to indicate the last auto save state.
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
int m_autoSaveInterval
The auto save interval time in seconds.
virtual void EDA_BASE_FRAME::SetIconScale ( int  aScale)
inlinevirtualinherited

Function SetIconScale.

Modify the scale of icons in the window; should refresh them and save the setting.

Reimplemented in PCB_EDIT_FRAME, SCH_EDIT_FRAME, GERBVIEW_FRAME, and LIB_EDIT_FRAME.

Definition at line 460 of file eda_base_frame.h.

460 {}
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
Definition: DXF_plotter.cpp:61
void KIWAY_PLAYER::SetModal ( bool  aIsModal)
inlineprotectedinherited

Definition at line 218 of file kiway_player.h.

Referenced by LIB_VIEW_FRAME::LIB_VIEW_FRAME().

218 { m_modal = aIsModal; }
void EDA_BASE_FRAME::SetMruPath ( const wxString &  aPath)
inlineinherited

Definition at line 361 of file eda_base_frame.h.

Referenced by KICAD_MANAGER_FRAME::LoadProject().

361 { m_mruPath = aPath; }
wxString m_mruPath
Most recently used path.
void CVPCB_MAINFRAME::SetNewPkg ( const wxString &  aFootprintName)

Function SetNewPkg set the footprint name for all selected components in component list and selects the next component.

Parameters
aFootprintName= the new footprint name

Definition at line 45 of file readwrite_dlgs.cpp.

References DisplayStatus(), NETLIST::GetComponent(), COMPONENTS_LISTBOX::GetCount(), NETLIST::IsEmpty(), m_compListBox, m_netlist, and COMPONENTS_LISTBOX::SetSelection().

Referenced by AutomaticFootprintMatching(), DelAssociations(), and FOOTPRINTS_LISTBOX::OnLeftDClick().

46 {
47  COMPONENT* component;
48  int componentIndex;
49 
50  if( m_netlist.IsEmpty() )
51  return;
52 
53  // If no component is selected, select the first one
54  if( m_compListBox->GetFirstSelected() < 0 )
55  {
56  componentIndex = 0;
57  m_compListBox->SetSelection( componentIndex, true );
58  }
59 
60  // iterate over the selection
61  while( m_compListBox->GetFirstSelected() != -1 )
62  {
63  // Get the component for the current iteration
64  componentIndex = m_compListBox->GetFirstSelected();
65  component = m_netlist.GetComponent( componentIndex );
66 
67  if( component == NULL )
68  return;
69 
70  SetNewPkg( aFootprintName, componentIndex );
71 
72  m_compListBox->SetSelection( componentIndex, false );
73  }
74 
75  // select the next component, if there is one
76  if( componentIndex < (m_compListBox->GetCount() - 1) )
77  componentIndex++;
78 
79  m_compListBox->SetSelection( componentIndex, true );
80 
81  // update the statusbar
82  DisplayStatus();
83 }
COMPONENTS_LISTBOX * m_compListBox
void SetSelection(int index, bool State=true)
void SetNewPkg(const wxString &aFootprintName)
Function SetNewPkg set the footprint name for all selected components in component list and selects t...
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void CVPCB_MAINFRAME::SetNewPkg ( const wxString &  aFootprintName,
int  aIndex 
)

Function SetNewPkg Set the footprint name for the component of position aIndex in the component list.

Parameters
aFootprintName= the new footprint name
aIndex= the index of the component to modify in the component list

Definition at line 86 of file readwrite_dlgs.cpp.

References UTF8::c_str(), CMP_FORMAT, DisplayStatus(), LIB_ID::Format(), Format(), FROM_UTF8(), GetChars(), NETLIST::GetComponent(), COMPONENT::GetFPID(), COMPONENT::GetReference(), COMPONENT::GetValue(), NETLIST::IsEmpty(), m_compListBox, m_modified, m_netlist, LIB_ID::Parse(), COMPONENT::SetFPID(), and COMPONENTS_LISTBOX::SetString().

87 {
88  COMPONENT* component;
89 
90  if( m_netlist.IsEmpty() )
91  return;
92 
93  component = m_netlist.GetComponent( aIndex );
94 
95  if( component == NULL )
96  return;
97 
98  LIB_ID fpid;
99 
100  if( !aFootprintName.IsEmpty() )
101  {
102  wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
103  wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ),
104  GetChars( aFootprintName ) ) );
105  }
106 
107  component->SetFPID( fpid );
108 
109  // create the new component description
110  wxString description = wxString::Format( CMP_FORMAT, aIndex + 1,
111  GetChars( component->GetReference() ),
112  GetChars( component->GetValue() ),
113  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
114 
115  // Set the new description and deselect the processed component
116  m_compListBox->SetString( aIndex, description );
117 
118  // Mark this "session" as modified
119  m_modified = true;
120 
121  // update the statusbar
122  DisplayStatus();
123 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:155
COMPONENTS_LISTBOX * m_compListBox
int Parse(const UTF8 &aId)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const wxString & GetReference() const
Definition: pcb_netlist.h:151
const wxString & GetValue() const
Definition: pcb_netlist.h:153
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
#define CMP_FORMAT
Definition: cvpcb.h:30
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const char * c_str() const
Definition: utf8.h:107
void SetString(unsigned linecount, const wxString &text)
UTF8 Format() const
Definition: lib_id.cpp:263
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void CVPCB_MAINFRAME::SetStatusText ( const wxString &  aText,
int  aNumber = 0 
)
override

Definition at line 956 of file cvpcb_mainframe.cpp.

References m_statusLine1, and m_statusLine2.

Referenced by AutomaticFootprintMatching(), DisplayStatus(), and KiwayMailIn().

957 {
958  wxASSERT( aNumber < 2 );
959 
960  if( aNumber == 1 )
961  m_statusLine2->SetLabel( aText );
962  else
963  m_statusLine1->SetLabel( aText );
964 }
wxStaticText * m_statusLine2
wxStaticText * m_statusLine1
void EDA_BASE_FRAME::ShowChangedIcons ( )
virtualinherited

Function ShowChangedIcons redraws items menus after a icon was changed option.

Definition at line 269 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by EDA_BASE_FRAME::GetMruPath(), and KIWAY::ShowChangedIcons().

270 {
271  ReCreateMenuBar();
272  GetMenuBar()->Refresh();
273 }
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
void CVPCB_MAINFRAME::ShowChangedLanguage ( )
overridevirtual

Function ShowChangedLanguage redraws the menus and what not in current language.

Reimplemented from EDA_BASE_FRAME.

Definition at line 973 of file cvpcb_mainframe.cpp.

References DisplayStatus(), ReCreateHToolbar(), and EDA_BASE_FRAME::ShowChangedLanguage().

974 {
977  DisplayStatus();
978 }
void ReCreateHToolbar()
Definition: tool_cvpcb.cpp:35
virtual void ShowChangedLanguage()
Function ShowChangedLanguage redraws the menus and what not in current language.
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
bool KIWAY_PLAYER::ShowModal ( wxString *  aResult = NULL,
wxWindow *  aResultantFocusWindow = NULL 
)
inherited

Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until this KIWAY_PLAYER derivative calls DismissModal().

That is, behavior is similar to a modal dialog window. Not all KIWAY_PLAYERs use this interface, so don't call this unless the implementation knows how to call DismissModal() on a button click or double click or some special event which ends the modal behavior.

Parameters
aResultif not NULL, indicates a place to put a resultant string.
aResultantFocusWindowif not NULL, indicates what window to pass focus to on return.
Returns
bool - true if frame implementation called KIWAY_PLAYER::DismissModal() with aRetVal of true.

Definition at line 79 of file kiway_player.cpp.

References KIWAY_PLAYER::IsModal(), KIWAY_PLAYER::m_modal_loop, KIWAY_PLAYER::m_modal_resultant_parent, KIWAY_PLAYER::m_modal_ret_val, KIWAY_PLAYER::m_modal_string, and WX_EVENT_LOOP.

Referenced by DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), FOOTPRINT_VIEWER_FRAME::ShowModal(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

80 {
81  wxASSERT_MSG( IsModal(), wxT( "ShowModal() shouldn't be called on non-modal frame" ) );
82 
83  /*
84  This function has a nice interface but a necessarily unsightly implementation.
85  Now the implementation is encapsulated, localizing future changes.
86 
87  It works in tandem with DismissModal(). But only ShowModal() is in the
88  vtable and therefore cross-module capable.
89  */
90 
91  // This is an exception safe way to zero a pointer before returning.
92  // Yes, even though DismissModal() clears this first normally, this is
93  // here in case there's an exception before the dialog is dismissed.
94  struct NULLER
95  {
96  void*& m_what;
97  NULLER( void*& aPtr ) : m_what( aPtr ) {}
98  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
99  } clear_this( (void*&) m_modal_loop );
100 
101 
102  m_modal_resultant_parent = aResultantFocusWindow;
103 
104  Show( true );
105  Raise(); // Needed on some Window managers to always display the frame
106 
107  SetFocus();
108 
109  {
110  // We have to disable all frames but the the modal one.
111  // wxWindowDisabler does that, but it also disables all top level windows
112  // We do not want to disable top level windows which are child of the modal one,
113  // if they are enabled.
114  // An example is an aui toolbar which was moved
115  // or a dialog or another frame or miniframe opened by the modal one.
116  wxWindowList wlist = GetChildren();
117  std::vector<wxWindow*> enabledTopLevelWindows;
118 
119  for( unsigned ii = 0; ii < wlist.size(); ii++ )
120  if( wlist[ii]->IsTopLevel() && wlist[ii]->IsEnabled() )
121  enabledTopLevelWindows.push_back( wlist[ii] );
122 
123  // exception safe way to disable all top level windows except the modal one,
124  // re-enables only those that were disabled on exit
125  wxWindowDisabler toggle( this );
126 
127  for( unsigned ii = 0; ii < enabledTopLevelWindows.size(); ii++ )
128  enabledTopLevelWindows[ii]->Enable( true );
129 
130  WX_EVENT_LOOP event_loop;
131  m_modal_loop = &event_loop;
132  event_loop.Run();
133 
134  } // End of scope for some variables.
135  // End nesting before setting focus below.
136 
137  if( aResult )
138  *aResult = m_modal_string;
139 
140  if( aResultantFocusWindow )
141  {
142  aResultantFocusWindow->Raise();
143 
144  // have the final say, after wxWindowDisabler reenables my parent and
145  // the events settle down, set the focus
146  wxSafeYield();
147  aResultantFocusWindow->SetFocus();
148  }
149 
150  return m_modal_ret_val;
151 }
bool m_modal_ret_val
Definition: kiway_player.h:251
#define WX_EVENT_LOOP
Definition: kiway_player.h:91
wxWindow * m_modal_resultant_parent
Definition: kiway_player.h:249
wxString m_modal_string
Definition: kiway_player.h:250
bool IsModal()
Definition: kiway_player.h:217
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:248
const SEARCH_STACK & EDA_BASE_FRAME::sys_search ( )
protectedvirtualinherited

Function sys_search returns a SEARCH_STACK pertaining to entire program, and is overloaded in KICAD_MANAGER_FRAME.

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 390 of file eda_base_frame.cpp.

References Kiface(), and KIFACE_I::KifaceSearch().

Referenced by EDA_BASE_FRAME::GetKicadHelp(), and EDA_BASE_FRAME::isAutoSaveRequired().

391 {
392  return Kiface().KifaceSearch();
393 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
SEARCH_STACK & KifaceSearch()
Only for DSO specific &#39;non-library&#39; files.
Definition: kiface_i.h:127
void CVPCB_MAINFRAME::ToFirstNA ( wxCommandEvent &  event)

Definition at line 312 of file cvpcb_mainframe.cpp.

References ITEMS_LISTBOX_BASE::DeselectAll(), LIB_ID::empty(), NETLIST::GetComponent(), NETLIST::GetCount(), COMPONENT::GetFPID(), NETLIST::IsEmpty(), m_compListBox, m_netlist, SendMessageToEESCHEMA(), and COMPONENTS_LISTBOX::SetSelection().

313 {
314  if( m_netlist.IsEmpty() )
315  return;
316 
317  int first_selected = m_compListBox->GetFirstSelected();
318 
319  if( first_selected < 0 )
320  first_selected = -1; // We will start to 0 for the first search , if no item selected
321 
322  int candidate = -1;
323 
324  for( int jj = first_selected+1; jj < (int)m_netlist.GetCount(); jj++ )
325  {
326  if( m_netlist.GetComponent( jj )->GetFPID().empty() )
327  {
328  candidate = jj;
329  break;
330  }
331  }
332 
333  if( candidate >= 0 )
334  {
336  m_compListBox->SetSelection( candidate );
338  }
339 }
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
bool empty() const
Definition: lib_id.h:173
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
COMPONENTS_LISTBOX * m_compListBox
void DeselectAll()
Removes all selection in lists which can have more than one item selected.
void SetSelection(int index, bool State=true)
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:256
void CVPCB_MAINFRAME::ToPreviousNA ( wxCommandEvent &  event)

Definition at line 342 of file cvpcb_mainframe.cpp.

References ITEMS_LISTBOX_BASE::DeselectAll(), LIB_ID::empty(), NETLIST::GetComponent(), COMPONENTS_LISTBOX::GetCount(), COMPONENT::GetFPID(), NETLIST::IsEmpty(), m_compListBox, m_netlist, SendMessageToEESCHEMA(), and COMPONENTS_LISTBOX::SetSelection().

343 {
344  if( m_netlist.IsEmpty() )
345  return;
346 
347  int first_selected = m_compListBox->GetFirstSelected();
348 
349  if( first_selected < 0 )
350  first_selected = m_compListBox->GetCount();
351 
352  int candidate = -1;
353 
354  for( int jj = first_selected-1; jj >= 0; jj-- )
355  {
356  if( m_netlist.GetComponent( jj )->GetFPID().empty() )
357  {
358  candidate = jj;
359  break;
360  }
361  }
362 
363  if( candidate >= 0 )
364  {
366  m_compListBox->SetSelection( candidate );
368  }
369 }
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
bool empty() const
Definition: lib_id.h:173
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
COMPONENTS_LISTBOX * m_compListBox
void DeselectAll()
Removes all selection in lists which can have more than one item selected.
void SetSelection(int index, bool State=true)
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:244
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:265
void EDA_BASE_FRAME::UpdateFileHistory ( const wxString &  FullFileName,
wxFileHistory *  aFileHistory = NULL 
)
inherited

Function UpdateFileHistory Updates the list of recently opened files.

Note also the menu is updated, if wxFileHistory::UseMenu was called at init time

Parameters
FullFileNameThe full file name including the path.
aFileHistoryThe wxFileHistory in use. If NULL, the main application file history is used.

Definition at line 408 of file eda_base_frame.cpp.

References KIFACE_I::GetFileHistory(), and Kiface().

Referenced by SCH_EDIT_FRAME::importFile(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::loadListOfGerberFiles(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), KICAD_MANAGER_FRAME::LoadProject(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::SavePcbFile(), EDA_BASE_FRAME::SaveProjectSettings(), and GERBVIEW_FRAME::unarchiveFiles().

410 {
411  wxFileHistory* fileHistory = aFileHistory;
412 
413  if( !fileHistory )
414  fileHistory = &Kiface().GetFileHistory();
415 
416  fileHistory->AddFileToHistory( FullFileName );
417 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
int EDA_BASE_FRAME::WriteHotkeyConfig ( struct EDA_HOTKEY_CONFIG aDescList,
wxString *  aFullFileName = NULL 
)
virtualinherited

Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mechanism or a file.

Parameters
aDescList= pointer to the current hotkey list.
aFullFileName= a wxString pointer to a full file name. if NULL, use the standard wxConfig mechanism (default) the output format is: shortcut "key" "function" lines starting with # are comments

Reimplemented in EDA_DRAW_FRAME.

Definition at line 528 of file hotkeys_basic.cpp.

References AddDelimiterString(), DEFAULT_HOTKEY_FILENAME_EXT, GetChars(), GetNewConfig(), HOTKEYS_CONFIG_KEY, KeyNameFromKeyCode(), EDA_HOTKEY_CONFIG::m_HK_InfoList, EDA_HOTKEY::m_InfoMsg, EDA_HOTKEY::m_KeyCode, EDA_HOTKEY_CONFIG::m_SectionTag, EDA_HOTKEY_CONFIG::m_Title, and TO_UTF8.

Referenced by EDA_BASE_FRAME::SaveProjectSettings(), HOTKEYS_EDITOR_DIALOG::TransferDataFromWindow(), and EDA_DRAW_FRAME::WriteHotkeyConfig().

530 {
531  wxString msg;
532  wxString keyname, infokey;
533 
534  msg = wxT( "$hotkey list\n" );
535 
536  // Print the current hotkey list
537  EDA_HOTKEY** list;
538 
539  for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
540  {
541  if( aDescList->m_Title )
542  {
543  msg += wxT( "# " );
544  msg += *aDescList->m_Title;
545  msg += wxT( "\n" );
546  }
547 
548  msg += *aDescList->m_SectionTag;
549  msg += wxT( "\n" );
550 
551  list = aDescList->m_HK_InfoList;
552 
553  for( ; *list != nullptr; list++ )
554  {
555  EDA_HOTKEY* hk_decr = *list;
556  msg += wxT( "shortcut " );
557  keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
558  AddDelimiterString( keyname );
559  infokey = hk_decr->m_InfoMsg;
560  AddDelimiterString( infokey );
561  msg += keyname + wxT( ": " ) + infokey + wxT( "\n" );
562  }
563  }
564 
565  msg += wxT( "$Endlist\n" );
566 
567  if( aFullFileName )
568  {
569  FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
570 
571  if( file )
572  {
573  fputs( TO_UTF8( msg ), file );
574  fclose( file );
575  }
576  else
577  {
578  msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
579  return 0;
580  }
581  }
582  else
583  {
584  wxFileName fn( GetName() );
585  fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
586  std::unique_ptr<wxConfigBase> config( GetNewConfig( fn.GetFullPath() ) );
587  config->Write( HOTKEYS_CONFIG_KEY, msg );
588  }
589 
590  return 1;
591 }
EDA_HOTKEY ** m_HK_InfoList
Definition: hotkeys_basic.h:91
wxConfigBase * GetNewConfig(const wxString &aProgName)
Function GetNewConfig.
Definition: common.cpp:206
virtual wxConfigBase * config()
Function config returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_F...
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
#define HOTKEYS_CONFIG_KEY
void AddDelimiterString(wxString &string)
Function AddDelimiterString Add un " to the start and the end of string (if not already done)...
Definition: gestfich.cpp:44
wxString * m_SectionTag
Definition: hotkeys_basic.h:90
wxString m_InfoMsg
Definition: hotkeys_basic.h:64
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
wxString * m_Title
Definition: hotkeys_basic.h:92
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Function KeyNameFromKeyCode return the key name from the key code Only some wxWidgets key values are ...
#define DEFAULT_HOTKEY_FILENAME_EXT
Definition: hotkeys_basic.h:34

Friends And Related Function Documentation

friend struct CV::IFACE
friend

Definition at line 59 of file cvpcb_mainframe.h.

Member Data Documentation

wxString EDA_BASE_FRAME::m_AboutTitle
protectedinherited

Name of program displayed in About.

Definition at line 141 of file eda_base_frame.h.

bool EDA_BASE_FRAME::m_autoSaveState
protectedinherited
wxTimer* EDA_BASE_FRAME::m_autoSaveTimer
protectedinherited
wxString EDA_BASE_FRAME::m_configFrameName
protectedinherited

prefix used in config to identify some params (frame size...) if empty, the frame name defined in CTOR is used

Definition at line 136 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::ConfigBaseName(), and LIB_VIEW_FRAME::LIB_VIEW_FRAME().

wxString CVPCB_MAINFRAME::m_currentSearchPattern
private
wxArrayString CVPCB_MAINFRAME::m_EquFilesNames
bool EDA_BASE_FRAME::m_hasAutoSave
protectedinherited

Flag to indicate if this frame supports auto save.

Definition at line 146 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME(), EDA_BASE_FRAME::LoadSettings(), EDA_BASE_FRAME::ProcessEvent(), and EDA_BASE_FRAME::SaveSettings().

FRAME_T EDA_BASE_FRAME::m_Ident
protectedinherited

Id Type (pcb, schematic, library..)

Definition at line 132 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME(), and EDA_BASE_FRAME::findQuasiModalDialog().

bool CVPCB_MAINFRAME::m_initialized
protected

Definition at line 85 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and DisplayStatus().

LIBRARY_LISTBOX* CVPCB_MAINFRAME::m_libListBox
private
wxAuiToolBar* CVPCB_MAINFRAME::m_mainToolBar
private

Definition at line 64 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and ReCreateHToolbar().

bool KIWAY_PLAYER::m_modal
protectedinherited

Definition at line 247 of file kiway_player.h.

WX_EVENT_LOOP* KIWAY_PLAYER::m_modal_loop
protectedinherited
wxWindow* KIWAY_PLAYER::m_modal_resultant_parent
protectedinherited

Definition at line 249 of file kiway_player.h.

Referenced by KIWAY_PLAYER::ShowModal().

bool KIWAY_PLAYER::m_modal_ret_val
protectedinherited
wxString KIWAY_PLAYER::m_modal_string
protectedinherited

Definition at line 250 of file kiway_player.h.

Referenced by KIWAY_PLAYER::DismissModal(), and KIWAY_PLAYER::ShowModal().

bool CVPCB_MAINFRAME::m_modified
protected
wxArrayString CVPCB_MAINFRAME::m_ModuleLibNames

Definition at line 74 of file cvpcb_mainframe.h.

Referenced by LoadProjectFile().

wxString EDA_BASE_FRAME::m_perspective
protectedinherited

wxAuiManager perspective.

Definition at line 157 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::LoadSettings().

PARAM_CFG_ARRAY CVPCB_MAINFRAME::m_projectFileParams
protected

Definition at line 83 of file cvpcb_mainframe.h.

Referenced by GetProjectFileParameters().

wxButton* CVPCB_MAINFRAME::m_saveAndContinue
private

Definition at line 71 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and ~CVPCB_MAINFRAME().

bool CVPCB_MAINFRAME::m_skipComponentSelect
protected
wxStaticText* CVPCB_MAINFRAME::m_statusLine1
private

Definition at line 69 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and SetStatusText().

wxStaticText* CVPCB_MAINFRAME::m_statusLine2
private

Definition at line 70 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and SetStatusText().

wxTextCtrl* CVPCB_MAINFRAME::m_tcFilterString
private

The documentation for this class was generated from the following files: