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 OnQuit (wxCommandEvent &event)
 
void OnCloseWindow (wxCloseEvent &Event)
 
void OnSize (wxSizeEvent &SizeEvent)
 
void ReCreateHToolbar ()
 
virtual void ReCreateMenuBar () override
 (Re)Create the menubar for the CvPcb mainframe 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 SaveQuitCvpcb (wxCommandEvent &event)
 
void OnConfigurePaths (wxCommandEvent &aEvent)
 
void OnEditEquFilesList (wxCommandEvent &aEvent)
 Function OnEditEquFilesList envokes the equ files list edit dialog. More...
 
void OnKeepOpenOnSave (wxCommandEvent &event)
 
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 DisplayDocFile (wxCommandEvent &event)
 
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 ()
 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 UpdateTitle ()
 Function UpdateTitle sets the main window title bar text. 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 ()
 
const wxString GetSelectedFootprint ()
 
VTBL_ENTRY bool ImportFile (const wxString &aFileName, int aFileType)
 Function ImportFile load the given filename but sets the path to the current project path. More...
 
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 ShowChangedLanguage ()
 Function ShowChangedLanguage redraws the menus and what not in current language. 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
 
std::unique_ptr< 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

int m_undefinedComponentCnt
 
bool m_modified
 
bool m_skipComponentSelect
 
PARAM_CFG_ARRAY m_projectFileParams
 
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 OnUpdateKeepOpenOnSave (wxUpdateUIEvent &event)
 
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

wxArrayString m_footprintListEntries
 
wxString m_currentSearchPattern
 
bool m_keepCvpcbOpen
 
NETLIST m_netlist
 
int m_filteringOptions
 
wxAuiToolBar * m_mainToolBar
 
FOOTPRINTS_LISTBOXm_footprintListBox
 
LIBRARY_LISTBOXm_libListBox
 
COMPONENTS_LISTBOXm_compListBox
 
wxTextCtrl * m_tcFilterString
 

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 114 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_keepCvpcbOpen, m_libListBox, m_mainToolBar, m_modified, m_skipComponentSelect, m_tcFilterString, m_undefinedComponentCnt, ReCreateHToolbar(), ReCreateMenuBar(), PCAD2KICAD::Right, UpdateTitle(), wxPoint::x, and wxPoint::y.

114  :
115  KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
117 {
118  m_compListBox = NULL;
119  m_footprintListBox = NULL;
120  m_libListBox = NULL;
121  m_mainToolBar = NULL;
122  m_modified = false;
123  m_keepCvpcbOpen = false;
125  m_skipComponentSelect = false;
126  m_filteringOptions = 0;
127  m_tcFilterString = NULL;
129 
130  // Give an icon
131  wxIcon icon;
132  icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
133  SetIcon( icon );
134 
135  SetAutoLayout( true );
136 
137  LoadSettings( config() );
138 
139  wxSize const frame_min( ConvertDialogToPixels( FRAME_MIN_SIZE_DU ) );
140 
141  SetSizeHints( frame_min );
142 
143  // Frame size and position
144  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
145 
146  // create the status bar
147  static const int dims[3] = { -1, -1, 250 };
148 
149  CreateStatusBar( 3 );
150  SetStatusWidths( 3, dims );
151 
152  ReCreateMenuBar();
154 
155  // Create list of available modules and components of the schematic
156  BuildCmpListBox();
159 
160  m_auimgr.SetManagedWindow( this );
161 
162  UpdateTitle();
163 
164  EDA_PANEINFO horiz;
165  horiz.HorizontalToolbarPane();
166 
167  EDA_PANEINFO info;
168  info.InfoToolbarPane();
169 
170 
171  if( m_mainToolBar )
172  m_auimgr.AddPane( m_mainToolBar,
173  wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
174 
175  if( m_compListBox )
176  m_auimgr.AddPane( m_compListBox,
177  wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
178 
179  if( m_libListBox)
180  m_auimgr.AddPane( m_libListBox,
181  wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
182  Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
183 
184  if( m_footprintListBox )
185  m_auimgr.AddPane( m_footprintListBox,
186  wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
187  Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
188 
189  m_auimgr.Update();
190 }
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
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 UpdateTitle()
Function UpdateTitle sets the main window title bar text.
void ReCreateHToolbar()
Definition: tool_cvpcb.cpp:38
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)
static std::unique_ptr< FOOTPRINT_LIST > GetInstance(KIWAY &aKiway)
Factory function to return a new FOOTPRINT_LIST via Kiway.
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
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
FOOTPRINTS_LISTBOX * m_footprintListBox
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
CVPCB_MAINFRAME::~CVPCB_MAINFRAME ( )

Definition at line 193 of file cvpcb_mainframe.cpp.

References EDA_BASE_FRAME::m_auimgr.

194 {
195  m_auimgr.UnInit();
196 }
wxAuiManager m_auimgr

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 677 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().

678 {
679  wxMenu* menu = NULL;
680  wxMenuItem* item = MasterMenu->FindItem( ID_KICAD_SELECT_ICONS_OPTIONS );
681 
682  if( item ) // This menu exists, do nothing
683  return;
684 
685  menu = new wxMenu;
686 
687  menu->Append( new wxMenuItem( menu, ID_KICAD_SELECT_ICONS_IN_MENUS,
688  _( "Icons in Menus" ), wxEmptyString,
689  wxITEM_CHECK ) );
690  menu->Check( ID_KICAD_SELECT_ICONS_IN_MENUS, Pgm().GetUseIconsInMenus() );
691 
692  AddMenuItem( MasterMenu, menu,
694  _( "Icons Options" ),
695  _( "Select show icons in menus and icons sizes" ),
696  KiBitmap( icon_xpm ) );
697 }
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(), COMPONENT::GetReference(), COMPONENT::GetValue(), NETLIST::IsEmpty(), m_compListBox, FOOTPRINT_EQUIVALENCE::m_ComponentValue, FOOTPRINT_EQUIVALENCE::m_FootprintFPID, m_FootprintsList, m_netlist, m_skipComponentSelect, next(), SetNewPkg(), 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:170
const wxString & GetFootprintName() const
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
COMPONENTS_LISTBOX * m_compListBox
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:175
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:235
const wxString & GetReference() const
Definition: pcb_netlist.h:149
const wxString & GetValue() const
Definition: pcb_netlist.h:151
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
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:256
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:247
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
void CVPCB_MAINFRAME::BuildCmpListBox ( )

Definition at line 858 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(), ID_CVPCB_COMPONENT_LIST, m_compListBox, COMPONENTS_LISTBOX::m_ComponentList, m_netlist, COMPONENTS_LISTBOX::SetSelection(), and ITEMS_LISTBOX_BASE::UpdateWidth().

Referenced by CVPCB_MAINFRAME().

859 {
860  wxString msg;
861  COMPONENT* component;
862  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
863 
864  if( m_compListBox == NULL )
865  {
867  wxDefaultPosition, wxDefaultSize );
868  m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
869  wxFONTFAMILY_MODERN,
870  wxFONTSTYLE_NORMAL,
871  wxFONTWEIGHT_NORMAL ) );
872  }
873 
875 
876  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
877  {
878  component = m_netlist.GetComponent( i );
879 
880  msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
881  GetChars( component->GetReference() ),
882  GetChars( component->GetValue() ),
883  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
884  m_compListBox->m_ComponentList.Add( msg );
885  }
886 
887  if( m_compListBox->m_ComponentList.Count() )
888  {
889  m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
890  m_compListBox->SetSelection( 0, true );
891  m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
893  }
894 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
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:149
const wxString & GetValue() const
Definition: pcb_netlist.h:151
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:256
#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
UTF8 Format() const
Definition: lib_id.cpp:263
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
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 838 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().

839 {
840  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
841 
842  if( m_footprintListBox == NULL )
843  {
845  wxDefaultPosition, wxDefaultSize );
846  m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
847  wxFONTFAMILY_MODERN,
848  wxFONTSTYLE_NORMAL,
849  wxFONTWEIGHT_NORMAL ) );
850  }
851 
852  m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL,
854  DisplayStatus();
855 }
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...
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX ( )

Definition at line 897 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().

898 {
899  wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
900 
901  if( m_libListBox == NULL )
902  {
904  wxDefaultPosition, wxDefaultSize );
905  m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
906  wxFONTFAMILY_MODERN,
907  wxFONTSTYLE_NORMAL,
908  wxFONTWEIGHT_NORMAL ) );
909  }
910 
911  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
912 
913  if( tbl )
914  {
915  wxArrayString libNames;
916 
917  std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
918 
919  for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
920  libNames.Add( libNickNames[ii] );
921 
922  m_libListBox->SetLibraryList( libNames );
923  }
924 }
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 267 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().

268 {
269  wxWindow* hasFocus = wxWindow::FindFocus();
270 
271  if( aMoveRight )
272  {
273  if( hasFocus == m_libListBox )
274  m_compListBox->SetFocus();
275  else if( hasFocus == m_compListBox )
276  m_footprintListBox->SetFocus();
277  else if( hasFocus == m_footprintListBox )
278  m_libListBox->SetFocus();
279  }
280  else
281  {
282  if( hasFocus == m_libListBox )
283  m_footprintListBox->SetFocus();
284  else if( hasFocus == m_compListBox )
285  m_libListBox->SetFocus();
286  else if( hasFocus == m_footprintListBox )
287  m_compListBox->SetFocus();
288  }
289 }
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 582 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().

584 {
585  wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
586  wxCHECK_RET( !aBackupFileExtension.IsEmpty(), wxT( "Invalid backup file extension!" ) );
587 
588  wxFileName autoSaveFileName = aFileName;
589 
590  // Check for auto save file.
591  autoSaveFileName.SetName( AUTOSAVE_PREFIX_FILENAME + aFileName.GetName() );
592 
593  wxLogTrace( traceAutoSave,
594  wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
595 
596  if( !autoSaveFileName.FileExists() )
597  return;
598 
599  wxString msg = wxString::Format( _(
600  "Well this is potentially embarrassing!\n"
601  "It appears that the last time you were editing the file\n"
602  "\"%s\"\n"
603  "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
604  GetChars( aFileName.GetFullName() )
605  );
606 
607  int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
608 
609  // Make a backup of the current file, delete the file, and rename the auto save file to
610  // the file name.
611  if( response == wxYES )
612  {
613  // Get the backup file name.
614  wxFileName backupFileName = aFileName;
615  backupFileName.SetExt( aBackupFileExtension );
616 
617  // If an old backup file exists, delete it. If an old copy of the file exists, rename
618  // it to the backup file name
619  if( aFileName.FileExists() )
620  {
621  // Remove the old file backup file.
622  if( backupFileName.FileExists() )
623  wxRemoveFile( backupFileName.GetFullPath() );
624 
625  // Rename the old file to the backup file name.
626  if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) )
627  {
628  msg.Printf( _( "Could not create backup file \"%s\"" ),
629  GetChars( backupFileName.GetFullPath() ) );
630  wxMessageBox( msg );
631  }
632  }
633 
634  if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
635  {
636  wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
637  Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
638  }
639  }
640  else
641  {
642  wxLogTrace( traceAutoSave,
643  wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
644 
645  // Remove the auto save file when using the previous file as is.
646  wxRemoveFile( autoSaveFileName.GetFullPath() );
647  }
648 }
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
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
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 266 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().

267  {
268  wxString baseCfgName = m_configFrameName.IsEmpty() ? GetName() : m_configFrameName;
269  return baseCfgName;
270  }
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 810 of file cvpcb_mainframe.cpp.

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

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

811 {
813 
814  if( !fpframe )
815  {
816  fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
817  fpframe->Show( true );
818  }
819  else
820  {
821  if( fpframe->IsIconized() )
822  fpframe->Iconize( false );
823 
824  // The display footprint window might be buried under some other
825  // windows, so CreateScreenCmp() on an existing window would not
826  // show any difference, leaving the user confused.
827  // So we want to put it to front, second after our CVPCB_MAINFRAME.
828  // We do this by a little dance of bringing it to front then the main
829  // frame back.
830  fpframe->Raise(); // Make sure that is visible.
831  Raise(); // .. but still we want the focus.
832  }
833 
834  fpframe->InitDisplay();
835 }
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 363 of file cvpcb_mainframe.cpp.

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

364 {
365  if( IsOK( this, _( "Delete selections" ) ) )
366  {
367  m_skipComponentSelect = true;
368 
369  // Remove all selections to avoid issues when setting the fpids
371 
372  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
373  {
374  LIB_ID fpid;
375 
376  m_netlist.GetComponent( i )->SetFPID( fpid );
377  SetNewPkg( wxEmptyString );
378  }
379 
380  // Remove all selections after setting the fpids
382 
383  m_skipComponentSelect = false;
386  }
387 
388  DisplayStatus();
389 }
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:153
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:256
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:289
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::DisplayDocFile ( wxCommandEvent &  event)
void CVPCB_MAINFRAME::DisplayModule ( wxCommandEvent &  event)

Definition at line 458 of file cvpcb_mainframe.cpp.

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

459 {
460  CreateScreenCmp();
461  GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
462 }
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 615 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, GetChars(), FOOTPRINTS_LISTBOX::GetCount(), NETLIST::GetCount(), FOOTPRINT_INFO::GetDoc(), COMPONENT::GetFootprintFilters(), FOOTPRINT_INFO::GetKeywords(), GetSelectedComponent(), GetSelectedFootprint(), m_compListBox, m_filteringOptions, m_footprintListBox, m_FootprintsList, m_libListBox, m_netlist, and m_undefinedComponentCnt.

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

616 {
617  wxString msg;
618  COMPONENT* component;
619 
620  if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
621  {
622  msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
624  SetStatusText( msg, 0 );
625 
626  msg.Empty();
627 
628  component = GetSelectedComponent();
629 
630  if( component )
631  {
632  for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
633  {
634  if( msg.IsEmpty() )
635  msg += component->GetFootprintFilters()[ii];
636  else
637  msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
638  }
639 
640  msg = _( "Filter list: " ) + msg;
641  }
642 
643  SetStatusText( msg, 1 );
644  }
645  else
646  {
647  wxString footprintName = GetSelectedFootprint();
648 
649  FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
650 
651  if( module ) // can be NULL if no netlist loaded
652  {
653  msg = _( "Description: " ) + module->GetDoc();
654  SetStatusText( msg, 0 );
655 
656  msg = _( "Key words: " ) + module->GetKeywords();
657  SetStatusText( msg, 1 );
658  }
659  }
660 
661  msg.Empty();
662  wxString filters;
663 
664  if( m_footprintListBox )
665  {
667  filters = _( "key words" );
668 
670  {
671  if( !filters.IsEmpty() )
672  filters += wxT( "+" );
673 
674  filters += _( "pin count" );
675  }
676 
678  {
679  if( !filters.IsEmpty() )
680  filters += wxT( "+" );
681 
682  filters += _( "library" );
683  }
684 
686  {
687  if( !filters.IsEmpty() )
688  filters += wxT( "+" );
689 
690  filters += _( "name" );
691  }
692 
693  if( filters.IsEmpty() )
694  msg = _( "No filtering" );
695  else
696  msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
697 
698  msg << wxT( ": " ) << m_footprintListBox->GetCount();
699 
700  SetStatusText( msg, 2 );
701  }
702 }
COMPONENTS_LISTBOX * m_compListBox
const wxArrayString & GetFootprintFilters() const
Definition: pcb_netlist.h:175
const wxString & GetDoc()
const wxString & GetKeywords()
const wxString GetSelectedFootprint()
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
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
COMPONENT * GetSelectedComponent()
FOOTPRINTS_LISTBOX * m_footprintListBox
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
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 235 of file eda_base_frame.cpp.

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

236 {
237  wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
238 }
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 225 of file eda_base_frame.h.

References EDA_BASE_FRAME::m_autoSaveInterval.

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

225 { 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 404 of file eda_base_frame.cpp.

References Format(), GetChars(), KIFACE_I::GetFileHistory(), 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().

406 {
407  wxFileHistory* fileHistory = aFileHistory;
408 
409  if( !fileHistory )
410  fileHistory = &Kiface().GetFileHistory();
411 
412  int baseId = fileHistory->GetBaseId();
413 
414  wxASSERT( cmdId >= baseId && cmdId < baseId + (int) fileHistory->GetCount() );
415 
416  unsigned i = cmdId - baseId;
417 
418  if( i < fileHistory->GetCount() )
419  {
420  wxString fn = fileHistory->GetHistoryFile( i );
421 
422  if( wxFileName::FileExists( fn ) )
423  return fn;
424  else
425  {
426  wxString msg = wxString::Format(
427  _( "File \"%s\" was not found." ),
428  GetChars( fn ) );
429 
430  wxMessageBox( msg );
431 
432  fileHistory->RemoveFileFromHistory( i );
433  }
434  }
435 
436  return wxEmptyString;
437 }
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
DISPLAY_FOOTPRINTS_FRAME * CVPCB_MAINFRAME::GetFootprintViewerFrame ( )
Returns
a pointer on the Footprint Viewer frame, if exists, or NULL

Definition at line 938 of file cvpcb_mainframe.cpp.

References FOOTPRINTVIEWER_FRAME_NAME.

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

939 {
940  // returns the Footprint Viewer frame, if exists, or NULL
941  return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>
942  ( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
943 }
#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 459 of file eda_base_frame.h.

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

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

Definition at line 531 of file eda_base_frame.cpp.

References ShowAboutDialog().

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

532 {
533  void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
534  ShowAboutDialog( this );
535 }
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 518 of file eda_base_frame.cpp.

References URL_GET_INVOLVED.

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

519 {
520  if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
521  {
522  wxString msg;
523  msg.Printf( _( "Could not launch the default browser.\n"
524  "For information on how to help the KiCad project, visit %s" ),
526  wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
527  }
528 }
#define URL_GET_INVOLVED
void EDA_BASE_FRAME::GetKicadHelp ( wxCommandEvent &  event)
inherited

Definition at line 440 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().

441 {
442  const SEARCH_STACK& search = sys_search();
443 
444  /* We have to get document for beginners,
445  * or the full specific doc
446  * if event id is wxID_INDEX, we want the document for beginners.
447  * else the specific doc file (its name is in Kiface().GetHelpFileName())
448  * The document for beginners is the same for all KiCad utilities
449  */
450  if( event.GetId() == wxID_INDEX )
451  {
452  // List of possible names for Getting Started in KiCad
453  const wxChar* names[2] = {
454  wxT( "getting_started_in_kicad" ),
455  wxT( "Getting_Started_in_KiCad" )
456  };
457 
458  wxString helpFile;
459  // Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
460  // or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
461  for( unsigned ii = 0; ii < DIM( names ); ii++ )
462  {
463  helpFile = SearchHelpFileFullPath( search, names[ii] );
464 
465  if( !helpFile.IsEmpty() )
466  break;
467  }
468 
469  if( !helpFile )
470  {
471  wxString msg = wxString::Format( _(
472  "Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
473  wxMessageBox( msg );
474  }
475  else
476  {
477  GetAssociatedDocument( this, helpFile );
478  }
479 
480  return;
481  }
482 
483  wxString base_name = help_name();
484  wxString helpFile = SearchHelpFileFullPath( search, base_name );
485 
486  if( !helpFile )
487  {
488  wxString msg = wxString::Format( _(
489  "Help file \"%s\" could not be found." ),
490  GetChars( base_name )
491  );
492  wxMessageBox( msg );
493  }
494  else
495  {
496  GetAssociatedDocument( this, helpFile );
497  }
498 }
#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:86
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 927 of file cvpcb_mainframe.cpp.

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

Referenced by DisplayStatus(), and OnSelectComponent().

928 {
929  int selection = m_compListBox->GetSelection();
930 
931  if( selection >= 0 && selection < (int) m_netlist.GetCount() )
932  return m_netlist.GetComponent( selection );
933 
934  return NULL;
935 }
COMPONENTS_LISTBOX * m_compListBox
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:256
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
const 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 945 of file cvpcb_mainframe.cpp.

References FOOTPRINTS_LISTBOX::GetSelectedFootprint(), and m_footprintListBox.

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

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

Reimplemented in KICAD_MANAGER_FRAME.

Definition at line 380 of file eda_base_frame.cpp.

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

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

381 {
382  return Kiface().GetHelpFileName();
383 }
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
VTBL_ENTRY bool KIWAY_PLAYER::ImportFile ( const wxString &  aFileName,
int  aFileType 
)
inlineinherited

Function ImportFile load the given filename but sets the path to the current project path.

Parameters
fullfilepath of file to be imported.
aFileTypeenum value for filetype

Definition at line 188 of file kiway_player.h.

References VTBL_ENTRY.

189  {
190  // overload me for your wxFrame type.
191 
192  return false;
193  }
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 181 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().

181 { 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:260
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 538 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().

539 {
540  wxString msg;
541  wxFileName fn = aFileName;
542 
543  // Check for absence of a file path with a file name. Unfortunately KiCad
544  // uses paths relative to the current project path without the ./ part which
545  // confuses wxFileName. Making the file name path absolute may be less than
546  // elegant but it solves the problem.
547  if( fn.GetPath().IsEmpty() && fn.HasName() )
548  fn.MakeAbsolute();
549 
550  wxCHECK_MSG( fn.IsOk(), false,
551  wxT( "File name object is invalid. Bad programmer!" ) );
552  wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
553  wxT( "File name object path <" ) + fn.GetFullPath() +
554  wxT( "> is not set. Bad programmer!" ) );
555 
556  if( fn.IsDir() && !fn.IsDirWritable() )
557  {
558  msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
559  GetChars( fn.GetPath() ) );
560  }
561  else if( !fn.FileExists() && !fn.IsDirWritable() )
562  {
563  msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
564  GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
565  }
566  else if( fn.FileExists() && !fn.IsFileWritable() )
567  {
568  msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
569  GetChars( fn.GetFullPath() ) );
570  }
571 
572  if( !msg.IsEmpty() )
573  {
574  wxMessageBox( msg );
575  return false;
576  }
577 
578  return true;
579 }
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_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(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), KIWAY_PLAYER::language_change(), LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), 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_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_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 959 of file cvpcb_mainframe.cpp.

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

960 {
961  const std::string& payload = mail.GetPayload();
962 
963  DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
964 
965  switch( mail.Command() )
966  {
968  ReadNetListAndFpFiles( payload );
969  /* @todo
970  Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
971  */
972  break;
973 
974  default:
975  ; // ignore most
976  }
977 }
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
EESCHEMA->CVPCB netlist immediately after launching CVPCB.
Definition: mail_type.h:41
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 705 of file cvpcb_mainframe.cpp.

References LIB_TABLE::GetLogicalLibs(), KIWAY_HOLDER::Kiway(), m_FootprintsList, PROJECT::PcbFootprintLibs(), and KIWAY_HOLDER::Prj().

Referenced by ReadNetListAndFpFiles().

706 {
707  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
708 
709  // Check if there are footprint libraries in the footprint library table.
710  if( !fptbl || !fptbl->GetLogicalLibs().size() )
711  {
712  wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
713  "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
714  return false;
715  }
716 
717  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
718 
719  m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
720 
721  if( m_FootprintsList->GetErrorCount() )
722  {
723  m_FootprintsList->DisplayErrors( this );
724  }
725 
726  return true;
727 }
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.
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...
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
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 199 of file cvpcb_mainframe.cpp.

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

Referenced by CVPCB_MAINFRAME().

200 {
202 
203  wxSize const frame_default( ConvertDialogToPixels( FRAME_DEFAULT_SIZE_DU ) );
204 
205  if( m_FrameSize == wxDefaultSize )
206  m_FrameSize = frame_default;
207 
208  aCfg->Read( KeepCvpcbOpenEntry, &m_keepCvpcbOpen, true );
210 }
static const wxString FilterFootprintEntry
wxSize const FRAME_DEFAULT_SIZE_DU(450, 300)
static const wxString KeepCvpcbOpenEntry
Nonzero if cvpcb should be kept open after saving association in schematic.
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 228 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().

229 {
230  if( !doAutoSave() )
231  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
232 }
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 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 234 of file cvpcb_mainframe.cpp.

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

235 {
236  if( m_modified )
237  {
238  wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
239  int ii = DisplayExitDialog( this, msg );
240 
241  switch( ii )
242  {
243  case wxID_CANCEL:
244  Event.Veto();
245  return;
246 
247  case wxID_NO:
248  break;
249 
250  case wxID_YES:
252  break;
253  }
254  }
255 
256  // Close module display frame
258  GetFootprintViewerFrame()->Close( true );
259 
260  m_modified = false;
261 
262  Destroy();
263  return;
264 }
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:229
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void SaveFootprintAssociation()
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 953 of file cvpcb_mainframe.cpp.

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

954 {
955  Pgm().ConfigurePaths( this );
956 }
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:905
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 398 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(), LIB_TABLE::Save(), and IO_ERROR::What().

399 {
400  bool tableChanged = false;
401  int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs( Kiway() ) );
402 
403  if( r & 1 )
404  {
405  wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
406 
407  try
408  {
409  GFootprintTable.Save( fileName );
410  tableChanged = true;
411  }
412  catch( const IO_ERROR& ioe )
413  {
414  wxString msg = wxString::Format(
415  _( "Error occurred saving the global footprint library table:\n\"%s\"\n%s" ),
416  GetChars( fileName ),
417  GetChars( ioe.What() )
418  );
419  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
420  }
421  }
422 
423  if( r & 2 )
424  {
425  wxString fileName = Prj().FootprintLibTblName();
426 
427  try
428  {
429  Prj().PcbFootprintLibs( Kiway() )->Save( fileName );
430  tableChanged = true;
431  }
432  catch( const IO_ERROR& ioe )
433  {
434  wxString msg = wxString::Format(
435  _( "Error occurred saving the project footprint library table:\n\"%s\"\n%s" ),
436  GetChars( fileName ),
437  GetChars( ioe.What() )
438  );
439  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
440  }
441  }
442 
443  if( tableChanged )
444  {
445  wxBusyCursor dummy;
447  m_FootprintsList->ReadFootprintFiles( Prj().PcbFootprintLibs( Kiway() ) );
448  }
449 }
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
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:312
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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.
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
void CVPCB_MAINFRAME::OnEnterFilteringText ( wxCommandEvent &  event)

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

Definition at line 600 of file cvpcb_mainframe.cpp.

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

601 {
602  // Called when changing the filter string in main toolbar.
603  // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_NAME is set, update the list of
604  // available footprints which match the filter
605 
607 
609  return;
610 
611  OnSelectFilteringFootprint( aEvent );
612 }
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::OnKeepOpenOnSave ( wxCommandEvent &  event)

Definition at line 452 of file cvpcb_mainframe.cpp.

References m_keepCvpcbOpen.

453 {
454  m_keepCvpcbOpen = event.IsChecked();
455 }
void CVPCB_MAINFRAME::OnQuit ( wxCommandEvent &  event)

Definition at line 228 of file cvpcb_mainframe.cpp.

229 {
230  Close( false );
231 }
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 465 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().

466 {
468  return;
469 
470  wxString libraryName;
471  COMPONENT* component = GetSelectedComponent();
472  libraryName = m_libListBox->GetSelectedLibrary();
473 
474  m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
476 
477  refreshAfterComponentSearch (component);
478 }
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...
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList
void CVPCB_MAINFRAME::OnSelectFilteringFootprint ( wxCommandEvent &  event)

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

Definition at line 536 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().

537 {
538  int option = 0;
539 
540  switch( event.GetId() )
541  {
544  break;
545 
548  break;
549 
552  break;
553 
557  break;
558  }
559 
560  if( event.IsChecked() )
561  m_filteringOptions |= option;
562  else
563  m_filteringOptions &= ~option;
564 
565  wxListEvent l_event;
566  OnSelectComponent( l_event );
567 }
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 501 of file eda_base_frame.cpp.

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

Referenced by EDA_BASE_FRAME::SaveProjectSettings().

502 {
503  // Ask for the current editor and instruct GetEditorName() to not show
504  // unless we pass false as argument.
505  wxString editorname = Pgm().GetEditorName( false );
506 
507  // Ask the user to select a new editor, but suggest the current one as the default.
508  editorname = Pgm().AskUserForPreferredEditor( editorname );
509 
510  // If we have a new editor name request it to be copied to m_editor_name and saved
511  // to the preferences file. If the user cancelled the dialog then the previous
512  // value will be retained.
513  if( !editorname.IsEmpty() )
514  Pgm().SetEditorName( editorname );
515 }
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 222 of file cvpcb_mainframe.cpp.

223 {
224  event.Skip();
225 }
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave ( wxUpdateUIEvent &  event)
private

Definition at line 570 of file cvpcb_mainframe.cpp.

References m_keepCvpcbOpen.

571 {
572  event.Check( m_keepCvpcbOpen );
573 }
bool CVPCB_MAINFRAME::OpenProjectFiles ( const std::vector< wxString > &  aFileSet,
int  aCtl = 0 
)
override

Definition at line 392 of file cvpcb_mainframe.cpp.

393 {
394  return true;
395 }
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 651 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().

652 {
653  if( evt_type != 0 )
654  {
655  wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
656  evt.SetEventObject( this );
657  evt.SetId( evt_type );
658  wxPostEvent( this, evt );
659  return true;
660  }
661 
662  return false;
663 }
void EDA_BASE_FRAME::PrintMsg ( const wxString &  text)
inherited

Definition at line 386 of file eda_base_frame.cpp.

Referenced by EDA_BASE_FRAME::IsType().

387 {
388  SetStatusText( text );
389 }
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(), SCH_EDIT_FRAME::ImportFile(), PCB_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(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), 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(), PCB_EDITOR_CONTROL::PlaceModule(), 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(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), 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(), 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 176 of file eda_base_frame.cpp.

References 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(), and PCBNEW_CONTROL::SwitchUnits().

177 {
178  if( !IsEnabled() && IsActive() )
179  {
180  DIALOG_SHIM* dlg = findQuasiModalDialog( GetChildren() );
181  if( dlg )
182  dlg->Raise();
183  }
184 
185  if( !wxFrame::ProcessEvent( aEvent ) )
186  return false;
187 
188  if( IsShown() && m_hasAutoSave && IsActive() &&
190  {
191  if( !m_autoSaveState )
192  {
193  wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
194  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
195  m_autoSaveState = true;
196  }
197  else if( m_autoSaveTimer->IsRunning() )
198  {
199  wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
200  m_autoSaveTimer->Stop();
201  m_autoSaveState = false;
202  }
203  }
204 
205  return true;
206 }
bool m_autoSaveState
Flag to indicate the last auto save state.
DIALOG_SHIM * findQuasiModalDialog(wxWindowList &aList)
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:70
wxTimer * m_autoSaveTimer
The timer used to implement the auto save feature;.
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.
const wxChar traceAutoSave[]
Flag to enable auto save feature debug tracing.
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 179 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(), NETLIST::IsEmpty(), LIB_ID::IsLegacy(), IsOK(), KIWAY_HOLDER::Kiway(), HTML_MESSAGE_BOX::ListSet(), LoadFootprintFiles(), LoadProjectFile(), m_compListBox, m_modified, m_netlist, m_undefinedComponentCnt, HTML_MESSAGE_BOX::MessageSet(), PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), ReadSchematicNetlist(), COMPONENT::SetFPID(), COMPONENTS_LISTBOX::SetSelection(), DIALOG_SHIM::Show(), TO_UTF8, UpdateTitle(), and IO_ERROR::What().

Referenced by KiwayMailIn().

180 {
181  wxString msg;
182  bool hasMissingNicks = false;
183 
184  ReadSchematicNetlist( aNetlist );
185 
186  if( m_compListBox == NULL )
187  return false;
188 
189  LoadProjectFile();
190 
191  wxSafeYield();
192 
194 
197 
198  m_compListBox->Clear();
200 
202  {
203  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
204  {
205  COMPONENT* component = m_netlist.GetComponent( i );
206 
207  if( component->GetFPID().empty() )
208  continue;
209 
210  if( component->GetFPID().IsLegacy() )
211  hasMissingNicks = true;
212  }
213  }
214 
215  // Check if footprint links were generated before the footprint library table was implemented.
216  if( hasMissingNicks )
217  {
218  msg = _(
219  "Some of the assigned footprints are legacy entries (are missing lib nicknames). "
220  "Would you like CvPcb to attempt to convert them to the new required LIB_ID format? "
221  "(If you answer no, then these assignments will be cleared out and you will "
222  "have to re-assign these footprints yourself.)"
223  );
224 
225  if( IsOK( this, msg ) )
226  {
227  msg.Clear();
228 
229  try
230  {
231  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
232  {
233  COMPONENT* component = m_netlist.GetComponent( i );
234 
235  if( component->GetFPID().IsLegacy() )
236  {
237  // get this first here, it's possibly obsoleted if we get it too soon.
238  FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
239 
240  int guess = guessNickname( tbl, (LIB_ID*) &component->GetFPID() );
241 
242  switch( guess )
243  {
244  case 0:
245  DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
246  TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );)
247  m_modified = true;
248  break;
249 
250  case 1:
251  msg += wxString::Format( _(
252  "Component \"%s\" footprint \"%s\" was <b>not found</b> in any library.\n" ),
253  GetChars( component->GetReference() ),
254  GetChars( component->GetFPID().GetLibItemName() )
255  );
256  break;
257 
258  case 2:
259  msg += wxString::Format( _(
260  "Component \"%s\" footprint \"%s\" was found in <b>multiple</b> libraries.\n" ),
261  GetChars( component->GetReference() ),
262  GetChars( component->GetFPID().GetLibItemName() )
263  );
264  break;
265  }
266  }
267  }
268  }
269  catch( const IO_ERROR& ioe )
270  {
271  msg = ioe.What();
272  msg += wxT( "\n\n" );
273  msg += _( "First check your footprint library table entries." );
274 
275  wxMessageBox( msg, _( "Problematic Footprint Library Tables" ) );
276  return false;
277  }
278 
279  if( msg.size() )
280  {
281  HTML_MESSAGE_BOX dlg( this, wxEmptyString );
282 
283  dlg.MessageSet( _( "The following errors occurred attempting to convert the "
284  "footprint assignments:\n\n" ) );
285  dlg.ListSet( msg );
286  dlg.MessageSet( _( "\nYou will need to reassign them manually if you want them "
287  "to be updated correctly the next time you import the "
288  "netlist in Pcbnew." ) );
289 
290 #if 1
291  dlg.ShowModal();
292 #else
293  dlg.Fit();
294  dlg.Show( true ); // modeless lets user watch while fixing the problems, but its not working.
295 #endif
296  }
297  }
298  else
299  {
300  // Clear the legacy footprint assignments.
301  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
302  {
303  COMPONENT* component = m_netlist.GetComponent( i );
304 
305  if( component->GetFPID().IsLegacy() )
306  {
307  component->SetFPID( LIB_ID() /* empty */ );
308  m_modified = true;
309  }
310  }
311  }
312  }
313 
314 
315  // Display a dialog to select footprint selection, if the netlist
316  // and the .cmp file give 2 different valid footprints
317  std::vector <int > m_indexes; // indexes of footprints in netlist
318 
319  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
320  {
321  COMPONENT* component = m_netlist.GetComponent( ii );
322 
323  if( component->GetAltFPID().empty() )
324  continue;
325 
326  if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
327  continue;
328 
329  m_indexes.push_back( ii );
330  }
331 
332  // If a n assignment conflict is found,
333  // open a dialog to chose between schematic assignment
334  // and .cmp file assignment:
335  if( m_indexes.size() > 0 )
336  {
338 
339  for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
340  {
341  COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
342 
343  wxString cmpfpid = component->GetFPID().Format();
344  wxString schfpid = component->GetAltFPID().Format();
345 
346  dlg.Add( component->GetReference(), schfpid, cmpfpid );
347  }
348 
349  if( dlg.ShowModal() == wxID_OK )
350  {
351 
352  // Update the fp selection:
353  for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
354  {
355  COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
356 
357  int choice = dlg.GetSelection( component->GetReference() );
358 
359  if( choice == 0 ) // the schematic (alt fpid) is chosen:
360  component->SetFPID( component->GetAltFPID() );
361  }
362  }
363  }
364 
365  // Populates the component list box:
366  for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
367  {
368  COMPONENT* component = m_netlist.GetComponent( i );
369 
370  msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
371  GetChars( component->GetReference() ),
372  GetChars( component->GetValue() ),
373  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
374 
375  m_compListBox->AppendLine( msg );
376 
377  if( component->GetFPID().empty() )
378  {
380  continue;
381  }
382  }
383 
384  if( !m_netlist.IsEmpty() )
385  m_compListBox->SetSelection( 0, true );
386 
387  DisplayStatus();
388 
389  UpdateTitle();
390  return true;
391 }
bool empty() const
Definition: lib_id.h:170
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:164
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:153
COMPONENTS_LISTBOX * m_compListBox
bool IsLegacy() const
Definition: lib_id.h:160
void SetSelection(int index, bool State=true)
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
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:235
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:149
const wxString & GetValue() 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
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:115
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:256
#define CMP_FORMAT
Definition: cvpcb.h:30
const LIB_ID & GetAltFPID() const
Definition: pcb_netlist.h:166
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
UTF8 Format() const
Definition: lib_id.cpp:263
#define DBG(x)
Definition: fctsys.h:33
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
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:289
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 777 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().

778 {
779  STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
780  KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
781 
782  m_netlist.Clear();
783 
784  try
785  {
786  netrdr.LoadNetlist();
787  }
788  catch( const IO_ERROR& ioe )
789  {
790  wxString msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.What().GetData() );
791  wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
792  return 1;
793  }
794 
795  // We also remove footprint name if it is "$noname" because this is a dummy name,
796  // not the actual name of the footprint.
797  for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
798  {
799  if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
800  m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
801  }
802 
803  // Sort components by reference:
805 
806  return 0;
807 }
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
Class KICAD_NETLIST_READER read the new s-expression based KiCad netlist format.
void SetFPID(const LIB_ID &aFPID)
Definition: pcb_netlist.h:153
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:115
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:256
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:241
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:247
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 38 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, m_tcFilterString, and SAVE_HLP_MSG.

Referenced by CVPCB_MAINFRAME().

39 {
40  if( m_mainToolBar )
41  m_mainToolBar->Clear();
42  else
43  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
44  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
45 
46  m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_xpm, this ), SAVE_HLP_MSG );
47 
49  m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
50  KiScaledBitmap( config_xpm, this ),
51  _( "Edit footprint library table" ) );
52 
54  m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
55  KiScaledBitmap( show_footprint_xpm, this ),
56  _( "View selected footprint" ) );
57 
59  m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
60  KiScaledBitmap( left_xpm, this ),
61  _( "Select previous unlinked symbol" ) );
62 
63  m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
64  KiScaledBitmap( right_xpm, this ),
65  _( "Select next unlinked symbol" ) );
66 
68  m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
69  KiScaledBitmap( auto_associe_xpm, this ),
70  _( "Perform automatic footprint association" ) );
71 
72  m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
73  KiScaledBitmap( delete_association_xpm, this ),
74  _( "Delete all footprint associations" ) );
75 
78  KiScaledBitmap( module_filtered_list_xpm, this ),
79  wxNullBitmap,
80  true, NULL,
81  _( "Filter footprint list by schematic symbol keywords" ),
82  wxEmptyString );
83 
85  KiScaledBitmap( module_pin_filtered_list_xpm, this ),
86  wxNullBitmap,
87  true, NULL,
88  _( "Filter footprint list by pin count" ),
89  wxEmptyString );
90 
92  KiScaledBitmap( module_library_list_xpm, this ),
93  wxNullBitmap, true, NULL,
94  _( "Filter footprint list by library" ),
95  wxEmptyString );
96 
99  KiScaledBitmap( module_name_filtered_list_xpm, this ),
100  wxNullBitmap, true, NULL,
101  _( "Filter footprint list using a partial name or a pattern" ),
102  wxEmptyString );
103 
105 
106  m_mainToolBar->AddControl( m_tcFilterString );
107 
108 
109  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
110  m_mainToolBar->Realize();
111 }
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
#define SAVE_HLP_MSG
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_CONFIG_KEEP_OPEN_ON_SAVE, 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  // Create the current menubar if it does not yet exist
46  wxMenuBar* menuBar = GetMenuBar();
47 
48  if( ! menuBar ) // Delete all menus
49  menuBar = new wxMenuBar();
50 
51  // Delete all existing menus so they can be rebuilt.
52  // This allows language changes of the menu text on the fly.
53  menuBar->Freeze();
54 
55  while( menuBar->GetMenuCount() )
56  delete menuBar->Remove( 0 );
57 
58  // Recreate all menus:
59 
60  // Menu File:
61  wxMenu* filesMenu = new wxMenu;
62 
63  // Save the footprints back into eeschema
64  AddMenuItem( filesMenu, wxID_SAVE,
65  _( "&Save Footprint Associations\tCtrl+S" ),
67  KiBitmap( save_xpm ) );
68 
69  // Separator
70  filesMenu->AppendSeparator();
71 
72  // Quit
73  AddMenuItem( filesMenu, wxID_EXIT,
74  _( "&Close" ), _( "Close CvPcb" ),
75  KiBitmap( exit_xpm ) );
76 
77  // Preferences Menu :
78  wxMenu* preferencesMenu = new wxMenu;
79 
80  AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
81  _( "Manage Footprint &Libraries..." ), _( "Manage footprint libraries" ),
82  KiBitmap( library_table_xpm ) );
83 
84  // Path configuration edit dialog.
85  AddMenuItem( preferencesMenu,
87  _( "Configure &Paths..." ),
88  _( "Edit path configuration environment variables" ),
89  KiBitmap( editor_xpm ) );
90 
91  preferencesMenu->AppendSeparator();
92  AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
93  _( "Footprint &Association Files..." ),
94  _( "Configure footprint association file (.equ) list."
95  "These files are used to automatically assign "
96  "the footprint name from the symbol value" ),
97  KiBitmap( library_table_xpm ) );
98  preferencesMenu->AppendSeparator();
99 
100  // Language submenu
101  Pgm().AddMenuLanguageList( preferencesMenu );
102 
103  // Keep open on save data
104  preferencesMenu->AppendSeparator();
106  _( "&Keep Open On Save" ),
107  _( "Prevent CvPcb from exiting after saving netlist file" ),
108  KiBitmap( exit_xpm ),
109  wxITEM_CHECK );
110 
111  // Menu Help:
112  wxMenu* helpMenu = new wxMenu;
113 
114  // Manual Contents
115  AddMenuItem( helpMenu, wxID_HELP, _( "CvPcb &Manual" ),
116  _( "Open CvPcb Manual" ),
117  KiBitmap( online_help_xpm ) );
118 
119  AddMenuItem( helpMenu,
120  wxID_INDEX,
121  _( "&Getting Started in KiCad" ),
122  _( "Open \"Getting Started in KiCad\" guide for beginners" ),
123  KiBitmap( help_xpm ) );
124 
125  // About CvPcb
126  AddMenuItem( helpMenu, wxID_ABOUT,
127  _( "&About Kicad" ),
128  _( "About KiCad" ),
129  KiBitmap( about_xpm ) );
130 
131  // Create the menubar and append all submenus
132  menuBar->Append( filesMenu, _( "&Save" ) );
133  menuBar->Append( preferencesMenu, _( "&Preferences" ) );
134  menuBar->Append( helpMenu, _( "&Help" ) );
135 
136  menuBar->Thaw();
137 
138  // Associate the menu bar with the frame, if no previous menubar
139  if( GetMenuBar() == NULL )
140  SetMenuBar( menuBar );
141  else
142  menuBar->Refresh();
143 }
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:824
void CVPCB_MAINFRAME::refreshAfterComponentSearch ( COMPONENT component)
private

Definition at line 481 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().

482 {
483  // Tell AuiMgr that objects are changed !
484  if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
485  // (could be not the case when starting CvPcb
486  m_auimgr.Update();
487 
488  if( component == NULL )
489  return;
490 
491  // Preview of the already assigned footprint.
492  // Find the footprint that was already chosen for this component and select it,
493  // but only if the selection is made from the component list or the library list.
494  // If the selection is made from the footprint list, do not change the current
495  // selected footprint.
496  if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
497  {
498  wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
499 
500  bool found = false;
501 
502  for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
503  {
504  wxString footprintName;
505  wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
506  msg.Trim( true );
507  msg.Trim( false );
508  footprintName = msg.AfterFirst( wxChar( ' ' ) );
509 
510  if( module.Cmp( footprintName ) == 0 )
511  {
512  m_footprintListBox->SetSelection( ii, true );
513  found = true;
514  break;
515  }
516  }
517 
518  if( !found )
519  {
520  int ii = m_footprintListBox->GetSelection();
521 
522  if ( ii >= 0 )
523  m_footprintListBox->SetSelection( ii, false );
524 
526  {
527  CreateScreenCmp();
528  }
529  }
530  }
531 
533  DisplayStatus();
534 }
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:164
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 ( )

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

Definition at line 394 of file readwrite_dlgs.cpp.

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

Referenced by OnCloseWindow(), and SaveQuitCvpcb().

395 {
396  STRING_FORMATTER sf;
397 
399 
401 
402  SetStatusText( _("Footprint association sent to Eeschema") );
403 }
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 at cvpcb termination.
Definition: mail_type.h:40
const std::string & GetString()
Definition: richio.h:475
void FormatBackAnnotation(OUTPUTFORMATTER *aOut)
Definition: pcb_netlist.h:346
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, const std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:386
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 280 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().

280 {};
void CVPCB_MAINFRAME::SaveQuitCvpcb ( wxCommandEvent &  event)

Definition at line 352 of file cvpcb_mainframe.cpp.

References m_keepCvpcbOpen, m_modified, and SaveFootprintAssociation().

353 {
355 
356  m_modified = false;
357 
358  if( !m_keepCvpcbOpen )
359  Close( true );
360 }
void SaveFootprintAssociation()
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
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 213 of file cvpcb_mainframe.cpp.

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

214 {
216 
217  aCfg->Write( KeepCvpcbOpenEntry, m_keepCvpcbOpen );
219 }
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
static const wxString FilterFootprintEntry
static const wxString KeepCvpcbOpenEntry
Nonzero if cvpcb should be kept open after saving association in schematic.
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 753 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().

754 {
755  if( m_netlist.IsEmpty() )
756  return;
757 
758  int selection = m_compListBox->GetSelection();
759 
760  if ( selection < 0 )
761  selection = 0;
762 
763  if( m_netlist.GetComponent( selection ) == NULL )
764  return;
765 
766  COMPONENT* component = m_netlist.GetComponent( selection );
767 
768  std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
769 
770  if( Kiface().IsSingle() )
771  SendCommand( MSG_TO_SCH, packet.c_str() );
772  else
773  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
774 }
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:134
bool IsEmpty() const
Function IsEmpty()
Definition: pcb_netlist.h:235
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
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:149
#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:256
VTBL_ENTRY void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, const std::string &aPayload, wxWindow *aSource=NULL)
Function ExpressMail send aPayload to aDestination from aSource.
Definition: kiway.cpp:386
PCB<->SCH, CVPCB->SCH cross-probing.
Definition: mail_type.h:39
void EDA_BASE_FRAME::SetAutoSaveInterval ( int  aInterval)
inherited

Definition at line 209 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().

210 {
211  m_autoSaveInterval = aInterval;
212 
213  if( m_autoSaveTimer->IsRunning() )
214  {
215  if( m_autoSaveInterval > 0 )
216  {
217  m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
218  }
219  else
220  {
221  m_autoSaveTimer->Stop();
222  m_autoSaveState = false;
223  }
224  }
225 }
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 466 of file eda_base_frame.h.

466 {}
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 230 of file kiway_player.h.

Referenced by LIB_VIEW_FRAME::LIB_VIEW_FRAME().

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

Definition at line 367 of file eda_base_frame.h.

Referenced by KICAD_MANAGER_FRAME::LoadProject().

367 { 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 47 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().

48 {
49  COMPONENT* component;
50  int componentIndex;
51 
52  if( m_netlist.IsEmpty() )
53  return;
54 
55  // If no component is selected, select the first one
56  if( m_compListBox->GetFirstSelected() < 0 )
57  {
58  componentIndex = 0;
59  m_compListBox->SetSelection( componentIndex, true );
60  }
61 
62  // iterate over the selection
63  while( m_compListBox->GetFirstSelected() != -1 )
64  {
65  // Get the component for the current iteration
66  componentIndex = m_compListBox->GetFirstSelected();
67  component = m_netlist.GetComponent( componentIndex );
68 
69  if( component == NULL )
70  return;
71 
72  SetNewPkg( aFootprintName, componentIndex );
73 
74  m_compListBox->SetSelection( componentIndex, false );
75  }
76 
77  // select the next component, if there is one
78  if( componentIndex < (m_compListBox->GetCount() - 1) )
79  componentIndex++;
80 
81  m_compListBox->SetSelection( componentIndex, true );
82 
83  // update the statusbar
84  DisplayStatus();
85 }
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:235
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:256
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 88 of file readwrite_dlgs.cpp.

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

89 {
90  COMPONENT* component;
91 
92  if( m_netlist.IsEmpty() )
93  return;
94 
95  component = m_netlist.GetComponent( aIndex );
96 
97  if( component == NULL )
98  return;
99 
100  // Check to see if the component has already a footprint set.
101  bool hasFootprint = !component->GetFPID().empty();
102 
103  LIB_ID fpid;
104 
105  if( !aFootprintName.IsEmpty() )
106  {
107  wxCHECK_RET( fpid.Parse( aFootprintName ) < 0,
108  wxString::Format( wxT( "\"%s\" is not a valid LIB_ID." ),
109  GetChars( aFootprintName ) ) );
110  }
111 
112  component->SetFPID( fpid );
113 
114  // create the new component description
115  wxString description = wxString::Format( CMP_FORMAT, aIndex + 1,
116  GetChars( component->GetReference() ),
117  GetChars( component->GetValue() ),
118  GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
119 
120  // If the component hasn't had a footprint associated with it
121  // it now has, so we decrement the count of components without
122  // a footprint assigned.
123  if( !hasFootprint )
125 
126  // Set the new description and deselect the processed component
127  m_compListBox->SetString( aIndex, description );
128 
129  // Mark this "session" as modified
130  m_modified = true;
131 
132  // update the statusbar
133  DisplayStatus();
134 }
bool empty() const
Definition: lib_id.h:170
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
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:153
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:235
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:149
const wxString & GetValue() const
Definition: pcb_netlist.h:151
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:256
#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 EDA_BASE_FRAME::ShowChangedIcons ( )
virtualinherited

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

Definition at line 253 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

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

254 {
255  ReCreateMenuBar();
256  GetMenuBar()->Refresh();
257 }
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
void EDA_BASE_FRAME::ShowChangedLanguage ( )
virtualinherited

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

Reimplemented in PCB_EDIT_FRAME, and GERBVIEW_FRAME.

Definition at line 246 of file eda_base_frame.cpp.

References EDA_BASE_FRAME::ReCreateMenuBar().

Referenced by EDA_BASE_FRAME::GetMruPath(), KIWAY::SetLanguage(), GERBVIEW_FRAME::ShowChangedLanguage(), and PCB_EDIT_FRAME::ShowChangedLanguage().

247 {
248  ReCreateMenuBar();
249  GetMenuBar()->Refresh();
250 }
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
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(), PCB_BASE_FRAME::SelectFootprintFromLibBrowser(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), 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 an other 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:263
#define WX_EVENT_LOOP
Definition: kiway_player.h:91
wxWindow * m_modal_resultant_parent
Definition: kiway_player.h:261
wxString m_modal_string
Definition: kiway_player.h:262
bool IsModal()
Definition: kiway_player.h:229
WX_EVENT_LOOP * m_modal_loop
Definition: kiway_player.h:260
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 374 of file eda_base_frame.cpp.

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

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

375 {
376  return Kiface().KifaceSearch();
377 }
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 292 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().

293 {
294  if( m_netlist.IsEmpty() )
295  return;
296 
297  long first_selected = m_compListBox->GetFirstSelected();
298 
299  if( first_selected < 0 )
300  first_selected = -1; // We will start to 0 for the first search , if no item selected
301 
302  int candidate = -1;
303 
304  for( unsigned jj = first_selected+1; jj < m_netlist.GetCount(); jj++ )
305  {
306  if( m_netlist.GetComponent( jj )->GetFPID().empty() )
307  {
308  candidate = jj;
309  break;
310  }
311  }
312 
313  if( candidate >= 0 )
314  {
316  m_compListBox->SetSelection( candidate );
318  }
319 }
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
bool empty() const
Definition: lib_id.h:170
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
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:235
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:256
unsigned GetCount() const
Function GetCount.
Definition: pcb_netlist.h:247
void CVPCB_MAINFRAME::ToPreviousNA ( wxCommandEvent &  event)

Definition at line 322 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().

323 {
324  if( m_netlist.IsEmpty() )
325  return;
326 
327  int first_selected = m_compListBox->GetFirstSelected();
328 
329  if( first_selected < 0 )
330  first_selected = m_compListBox->GetCount();
331 
332  int candidate = -1;
333 
334  for( int jj = first_selected-1; jj >= 0; jj-- )
335  {
336  if( m_netlist.GetComponent( jj )->GetFPID().empty() )
337  {
338  candidate = jj;
339  break;
340  }
341  }
342 
343  if( candidate >= 0 )
344  {
346  m_compListBox->SetSelection( candidate );
348  }
349 }
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
bool empty() const
Definition: lib_id.h:170
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:164
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:235
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
Definition: pcb_netlist.h:256
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 392 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().

394 {
395  wxFileHistory* fileHistory = aFileHistory;
396 
397  if( !fileHistory )
398  fileHistory = &Kiface().GetFileHistory();
399 
400  fileHistory->AddFileToHistory( FullFileName );
401 }
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
void CVPCB_MAINFRAME::UpdateTitle ( )

Function UpdateTitle sets the main window title bar text.

If no current project open( eeschema run outside kicad manager with no schematic loaded), the title is set to the application name appended with "no project". Otherwise, the title shows the project name.

Definition at line 730 of file cvpcb_mainframe.cpp.

References PROJECT::GetProjectFullName(), and KIWAY_HOLDER::Prj().

Referenced by CVPCB_MAINFRAME(), and ReadNetListAndFpFiles().

731 {
732  wxString title;
733  PROJECT& prj = Prj();
734  wxFileName fn = prj.GetProjectFullName();
735 
736  if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
737  {
738  title.Printf( L"Cvpcb \u2014 %s%s",
739  fn.GetFullPath(),
740  fn.IsFileWritable()
741  ? wxString( wxEmptyString )
742  : _( " [Read Only]" ) );
743  }
744  else
745  {
746  title = "Cvpcb";
747  }
748 
749  SetTitle( title );
750 }
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
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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:205
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 147 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 142 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
wxArrayString CVPCB_MAINFRAME::m_footprintListEntries
private

Definition at line 61 of file cvpcb_mainframe.h.

bool EDA_BASE_FRAME::m_hasAutoSave
protectedinherited

Flag to indicate if this frame supports auto save.

Definition at line 152 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 138 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::EDA_BASE_FRAME().

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

Definition at line 66 of file cvpcb_mainframe.h.

Referenced by CVPCB_MAINFRAME(), and ReCreateHToolbar().

bool KIWAY_PLAYER::m_modal
protectedinherited

Definition at line 259 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 261 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 262 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 73 of file cvpcb_mainframe.h.

Referenced by LoadProjectFile().

wxString EDA_BASE_FRAME::m_perspective
protectedinherited

wxAuiManager perspective.

Definition at line 163 of file eda_base_frame.h.

Referenced by EDA_BASE_FRAME::LoadSettings().

PARAM_CFG_ARRAY CVPCB_MAINFRAME::m_projectFileParams
protected

Definition at line 82 of file cvpcb_mainframe.h.

Referenced by GetProjectFileParameters().

bool CVPCB_MAINFRAME::m_skipComponentSelect
protected
wxTextCtrl* CVPCB_MAINFRAME::m_tcFilterString
private
int CVPCB_MAINFRAME::m_undefinedComponentCnt
protected

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