KiCad PCB EDA Suite
eeschema_config.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <class_library.h>
25 #include <confirm.h>
32 #include <eeschema_config.h>
33 #include <eeschema_settings.h>
34 #include <fctsys.h>
35 #include <gestfich.h>
36 #include <gr_text.h>
37 #include <kiface_i.h>
38 #include <lib_edit_frame.h>
39 #include <panel_display_options.h>
40 #include <panel_hotkeys_editor.h>
41 #include <pgm_base.h>
42 #include <sch_edit_frame.h>
43 #include <sch_junction.h>
44 #include <sch_painter.h>
45 #include <settings/app_settings.h>
47 #include <symbol_lib_table.h>
48 #include <widgets/paged_dialog.h>
51 #include <ws_data_model.h>
52 #include <widgets/ui_common.h>
54 #include "erc.h"
55 
56 
59 static int s_defaultTextSize = Mils2iu( DEFAULT_SIZE_TEXT );
61 static double s_textOffsetRatio = 0.08;
62 static bool s_selectTextAsBox = false;
63 static bool s_selectDrawChildren = true;
64 static bool s_selectFillShapes = false;
66 
67 #define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
68 
69 
70 PARAM_CFG_FIELDNAMES::PARAM_CFG_FIELDNAMES( TEMPLATES * ptparam, const wxChar* group ) :
71  PARAM_CFG( wxEmptyString, PARAM_SEVERITIES, group )
72 {
73  m_Pt_param = ptparam;
74 }
75 
76 void PARAM_CFG_FIELDNAMES::ReadParam( wxConfigBase* aConfig ) const
77 {
78  if( !m_Pt_param || !aConfig )
79  return;
80 
81  wxString templateFieldNames = aConfig->Read( FieldNameTemplatesKey, wxEmptyString );
82 
83  if( !templateFieldNames.IsEmpty() )
84  {
85  TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
86 
87  try
88  {
89  m_Pt_param->Parse( &lexer, false );
90  }
91  catch( const IO_ERROR& DBG( e ) )
92  {
93  // @todo show error msg
94  DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
95  }
96  }
97 }
98 
99 void PARAM_CFG_FIELDNAMES::SaveParam( wxConfigBase* aConfig ) const
100 {
101  if( !m_Pt_param || !aConfig )
102  return;
103 
104  STRING_FORMATTER sf;
105  m_Pt_param->Format( &sf, 0, false );
106 
107  wxString record = FROM_UTF8( sf.GetString().c_str() );
108  record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
109  record.Replace( wxT(" "), wxT(" "), true ); // double space to single
110 
111  aConfig->Write( FieldNameTemplatesKey, record );
112 }
113 
114 
116 {
117 protected:
119 
120 public:
121  PARAM_CFG_SEVERITIES( ERC_SETTINGS* ptparam, const wxChar* group = nullptr ) :
122  PARAM_CFG( wxEmptyString, PARAM_SEVERITIES, group )
123  {
124  m_Pt_param = ptparam;
125  }
126 
127  void ReadParam( wxConfigBase* aConfig ) const override
128  {
129  if( !m_Pt_param || !aConfig )
130  return;
131 
132  wxString oldPath = aConfig->GetPath();
133 
134  // Read legacy settings first so that modern settings will overwrite them
135  bool flag;
136 
137  if( aConfig->Read( wxT( "ERC_TestSimilarLabels" ), &flag, true ) )
138  {
139  if( flag )
141  else
143  }
144 
145  if( aConfig->Read( wxT( "ERC_CheckUniqueGlobalLabels" ), &flag, true ) )
146  {
147  if( flag )
149  else
151  }
152 
153  if( aConfig->Read( wxT( "ERC_CheckBusDriverConflicts" ), &flag, true ) )
154  {
155  if( flag )
157  else
159  }
160 
161  if( aConfig->Read( wxT( "ERC_CheckBusEntryConflicts" ), &flag, true ) )
162  {
163  if( flag )
165  else
167  }
168 
169  if( aConfig->Read( wxT( "ERC_CheckBusToBusConflicts" ), &flag, true ) )
170  {
171  if( flag )
173  else
175  }
176 
177  if( aConfig->Read( wxT( "ERC_CheckBusToNetConflicts" ), &flag, true ) )
178  {
179  if( flag )
181  else
183  }
184 
185  // TO DO: figure out what we're going to use as keys here so we can read/write these....
186 
187  aConfig->SetPath( oldPath );
188  }
189 
190  void SaveParam( wxConfigBase* aConfig ) const override
191  {
192  if( !m_Pt_param || !aConfig )
193  return;
194 
195  wxString oldPath = aConfig->GetPath();
196 
197  // TO DO: figure out what we're going to use as keys here so we can read/write these....
198 
199  // TO DO: for now just write out the legacy ones so we don't lose them
200  // TO DO: remove this once the new scheme is in place
201  aConfig->Write( wxT( "ERC_TestSimilarLabels" ),
203  aConfig->Write( wxT( "ERC_CheckUniqueGlobalLabels" ),
205  aConfig->Write( wxT( "ERC_CheckBusDriverConflicts" ),
207  aConfig->Write( wxT( "ERC_CheckBusEntryConflicts" ),
209  aConfig->Write( wxT( "ERC_CheckBusToBusConflicts" ),
211  aConfig->Write( wxT( "ERC_CheckBusToNetConflicts" ),
213 
214  aConfig->SetPath( oldPath );
215  }
216 };
217 
218 
219 int GetSeverity( int aErrorCode )
220 {
221  return g_ErcSettings->m_Severities[ aErrorCode ];
222 }
223 
224 void SetSeverity( int aErrorCode, int aSeverity )
225 {
226  g_ErcSettings->m_Severities[ aErrorCode ] = aSeverity;
227 }
228 
229 
231 {
232  return s_defaultBusThickness;
233 }
234 
235 
236 void SetDefaultBusThickness( int aThickness )
237 {
238  s_defaultBusThickness = std::max( 1, aThickness );
239 }
240 
241 
243 {
244  return s_defaultWireThickness;
245 }
246 
247 
248 void SetDefaultWireThickness( int aThickness )
249 {
250  s_defaultWireThickness = std::max( 1, aThickness );
251 }
252 
253 
255 {
256  return s_defaultTextSize;
257 }
258 
259 
260 void SetDefaultTextSize( int aTextSize )
261 {
262  s_defaultTextSize = aTextSize;
263 }
264 
265 
267 {
269 }
270 
271 
272 void SetDefaultLineThickness( int aThickness )
273 {
274  s_drawDefaultLineThickness = std::max( 1, aThickness );
275 }
276 
277 
279 {
280  return s_textOffsetRatio;
281 }
282 
283 
284 void SetTextOffsetRatio( double aOffsetRatio )
285 {
286  s_textOffsetRatio = aOffsetRatio;
287 }
288 
289 
291 {
292  return s_selectTextAsBox;
293 }
294 
295 
296 void SetSelectionTextAsBox( bool aBool )
297 {
298  s_selectTextAsBox = aBool;
299 }
300 
301 
303 {
304  return s_selectDrawChildren;
305 }
306 
307 
308 void SetSelectionDrawChildItems( bool aBool )
309 {
310  s_selectDrawChildren = aBool;
311 }
312 
313 
315 {
316  return s_selectFillShapes;
317 }
318 
319 
320 void SetSelectionFillShapes( bool aBool )
321 {
322  s_selectFillShapes = aBool;
323 }
324 
325 
327 {
328  return s_selectThickness;
329 }
330 
331 
332 void SetSelectionThickness( int aThickness )
333 {
334  s_selectThickness = aThickness;
335 }
336 
337 
340 {
341  return Pgm().GetSettingsManager().GetColorSettings()->GetColor( aLayer );
342 }
343 
344 
345 // Color to draw items flagged invisible, in libedit (they are invisible in Eeschema)
347 {
348  return COLOR4D( DARKGRAY );
349 }
350 
351 
353  PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
354 {
355  wxTreebook* book = aParent->GetTreebook();
356 
357  book->AddPage( new wxPanel( book ), _( "Eeschema" ) );
358  book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
359  book->AddSubPage( new PANEL_EESCHEMA_SETTINGS( this, book ), _( "Editing Options" ) );
360  book->AddSubPage( new PANEL_EESCHEMA_COLOR_SETTINGS( this, book ), _( "Colors" ) );
361  book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book, true ),
362  _( "Field Name Templates" ) );
363 
364  aHotkeysPanel->AddHotKeys( GetToolManager() );
365 }
366 
367 
368 void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
369 {
370  EESCHEMA_SETTINGS* appSettings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
371 
372  params.push_back( new PARAM_CFG_INT( wxT( "SubpartIdSeparator" ),
373  LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
374  params.push_back( new PARAM_CFG_INT( wxT( "SubpartFirstId" ),
375  LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
376 
377  params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LabSize" ),
379  Mils2iu( DEFAULT_SIZE_TEXT ),
380  5, 1000, nullptr, 1 / IU_PER_MILS ) );
381  params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
383  (double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
384  -200.0, 200.0 ) );
385  params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
387  Mils2iu( appSettings->m_Drawing.default_line_thickness ),
388  5, 1000, nullptr, 1 / IU_PER_MILS ) );
389 
390  params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BusThickness" ),
392  Mils2iu( appSettings->m_Drawing.default_bus_thickness ),
393  5, 1000, nullptr, 1 / IU_PER_MILS ) );
394  params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "WireThickness" ),
396  Mils2iu( appSettings->m_Drawing.default_wire_thickness ),
397  5, 1000, nullptr, 1 / IU_PER_MILS ) );
398  params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "JunctionSize" ),
400  Mils2iu( appSettings->m_Drawing.default_junction_size ),
401  5, 1000, nullptr, 1 / IU_PER_MILS ) );
402 }
403 
404 
406 {
407  if( !m_projectFileParams.empty() )
408  return m_projectFileParams;
409 
410  std::vector<PARAM_CFG*>& params = m_projectFileParams;
411 
412  params.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
414  params.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), &m_plotDirectoryName ) );
415  params.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), &m_netListFormat) );
416  params.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ),
417  &m_spiceAjustPassiveValues, false ) );
418 
419  AddFormattingParameters( params );
420 
421  params.push_back( new PARAM_CFG_FIELDNAMES( &m_templateFieldNames ) );
422 
423  params.push_back( new PARAM_CFG_SEVERITIES( g_ErcSettings ) );
424 
425  return params;
426 }
427 
428 
429 std::vector<PARAM_CFG*> ERC_SETTINGS::GetProjectFileParameters()
430 {
431  std::vector<PARAM_CFG*> params;
432 
433  params.push_back( new PARAM_CFG_SEVERITIES( this ) );
434 
435  return params;
436 }
437 
438 
440 {
441  bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
443 
444  // Verify some values, because the config file can be edited by hand,
445  // and have bad values:
448 
449  // Load the page layout decr file, from the filename stored in
450  // BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
451  // If empty, or not existing, the default descr is loaded
454  Prj().GetProjectPath() );
455 
456  pglayout.SetPageLayout( filename );
457 
458  return ret;
459 }
460 
461 
462 void SCH_EDIT_FRAME::DoShowSchematicSetupDialog( const wxString& aInitialPage,
463  const wxString& aInitialParentPage )
464 {
465  DIALOG_SCHEMATIC_SETUP dlg( this );
466 
467  if( !aInitialPage.IsEmpty() )
468  dlg.SetInitialPage( aInitialPage, aInitialParentPage );
469 
470  if( dlg.ShowQuasiModal() == wxID_OK )
471  {
473 
474  GetCanvas()->Refresh();
475  OnModify();
476  }
477 }
478 
479 
481 {
482  PROJECT& prj = Prj();
483  wxFileName fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
484 
485  fn.SetExt( ProjectFileExtension );
486 
487  if( !IsWritable( fn ) )
488  return;
489 
490  wxString path = fn.GetFullPath();
491 
492  prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path );
493 }
494 
495 
497 {
499 
500  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
501 
502  m_repeatStep.x = Mils2iu( cfg->m_Drawing.default_repeat_offset_x );
503  m_repeatStep.y = Mils2iu( cfg->m_Drawing.default_repeat_offset_y );
504 
505  SetSelectionTextAsBox( cfg->m_Selection.text_as_box );
506  SetSelectionDrawChildItems( cfg->m_Selection.draw_selected_children );
507  SetSelectionFillShapes( cfg->m_Selection.fill_shapes );
508  SetSelectionThickness( Mils2iu( cfg->m_Selection.thickness ) );
509 
510  m_footprintPreview = cfg->m_Appearance.footprint_preview;
511  m_navigatorStaysOpen = cfg->m_Appearance.navigator_stays_open;
512  m_showAllPins = cfg->m_Appearance.show_hidden_pins;
513  m_autoplaceFields = cfg->m_AutoplaceFields.enable;
514  m_autoplaceAlign = cfg->m_AutoplaceFields.align_to_grid;
515  m_autoplaceJustify = cfg->m_AutoplaceFields.allow_rejustify;
516  m_forceHVLines = cfg->m_Drawing.hv_lines_only;
517  m_dragActionIsMove = cfg->m_Input.drag_is_move;
518  m_selectPinSelectSymbol = cfg->m_Selection.select_pin_selects_symbol;
519  m_repeatDeltaLabel = cfg->m_Drawing.repeat_label_increment;
520 
521  wxString templateFieldNames = cfg->m_Drawing.field_names;
522 
523  if( !templateFieldNames.IsEmpty() )
524  {
525  TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
526 
527  try
528  {
529  m_templateFieldNames.Parse( &lexer, true );
530  }
531  catch( const IO_ERROR& DBG( e ) )
532  {
533  // @todo show error msg
534  DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
535  }
536  }
537 
539  settings->m_ShowPinsElectricalType = false;
540  settings->m_ShowHiddenText = false;
541  settings->m_ShowHiddenPins = m_showAllPins;
542  settings->SetShowPageLimits( m_showPageLimits );
543  settings->m_ShowUmbilicals = true;
544 }
545 
546 
548 {
550 
551  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
552 
553  // TODO(JE) do most of these need to live as class members here, or can the sites that need
554  // the setting just grab a pointer to the EESCHEMA_SETTINGS and look them up directly?
555 
556  cfg->m_Appearance.footprint_preview = m_footprintPreview;
557  cfg->m_Appearance.navigator_stays_open = m_navigatorStaysOpen;
558  cfg->m_Appearance.print_sheet_reference = m_printSheetReference;
559  cfg->m_Appearance.show_hidden_pins = m_showAllPins;
560  cfg->m_Appearance.show_illegal_symbol_lib_dialog = m_showIllegalSymbolLibDialog;
561  cfg->m_Appearance.show_page_limits = m_showPageLimits;
562  cfg->m_Appearance.show_sheet_filename_case_sensitivity_dialog =
564 
565  cfg->m_AutoplaceFields.enable = m_autoplaceFields;
566  cfg->m_AutoplaceFields.allow_rejustify = m_autoplaceJustify;
567  cfg->m_AutoplaceFields.align_to_grid = m_autoplaceAlign;
568 
569  cfg->m_Drawing.default_repeat_offset_x = Iu2Mils( m_repeatStep.x );
570  cfg->m_Drawing.default_repeat_offset_y = Iu2Mils( m_repeatStep.y );
571  cfg->m_Drawing.hv_lines_only = GetForceHVLines();
572  cfg->m_Drawing.repeat_label_increment = m_repeatDeltaLabel;
573  cfg->m_Drawing.text_markup_flags = GetTextMarkupFlags();
574 
575  cfg->m_Input.drag_is_move = m_dragActionIsMove;
576 
577  cfg->m_Printing.monochrome = m_printMonochrome;
578 
579  cfg->m_Selection.thickness = Iu2Mils( GetSelectionThickness() );
580  cfg->m_Selection.draw_selected_children = GetSelectionDrawChildItems();
581  cfg->m_Selection.fill_shapes = GetSelectionFillShapes();
582  cfg->m_Selection.select_pin_selects_symbol = GetSelectPinSelectSymbol();
583  cfg->m_Selection.text_as_box = GetSelectionTextAsBox();
584 
585  cfg->m_System.units = static_cast<int>( m_userUnits );
586 
587  // Save template fieldnames
588  STRING_FORMATTER sf;
589  m_templateFieldNames.Format( &sf, 0, true );
590 
591  wxString record = FROM_UTF8( sf.GetString().c_str() );
592  record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
593  record.Replace( wxT(" "), wxT(" "), true ); // double space to single
594 
595  cfg->m_Drawing.field_names = record.ToStdString();
596 }
597 
598 
600  PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
601 {
602  wxTreebook* book = aParent->GetTreebook();
603 
604  book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
605  book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
606  book->AddSubPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Defaults" ) );
607  book->AddSubPage( new PANEL_LIBEDIT_COLOR_SETTINGS( this, book ), _( "Color Options" ) );
608 
609  aHotkeysPanel->AddHotKeys( GetToolManager() );
610 }
611 
612 
613 SYMBOL_LIB_TABLE* PROJECT::SchSymbolLibTable()
614 {
615  // This is a lazy loading function, it loads the project specific table when
616  // that table is asked for, not before.
618 
619  // its gotta be NULL or a SYMBOL_LIB_TABLE, or a bug.
620  wxASSERT( !tbl || tbl->Type() == SYMBOL_LIB_TABLE_T );
621 
622  if( !tbl )
623  {
624  // Stack the project specific SYMBOL_LIB_TABLE overlay on top of the global table.
625  // ~SYMBOL_LIB_TABLE() will not touch the fallback table, so multiple projects may
626  // stack this way, all using the same global fallback table.
628 
630 
631  wxString prjPath;
632 
633  wxGetEnv( PROJECT_VAR_NAME, &prjPath );
634 
635  if( !prjPath.IsEmpty() )
636  {
637  wxFileName fn( prjPath, SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
638 
639  try
640  {
641  tbl->Load( fn.GetFullPath() );
642  }
643  catch( const IO_ERROR& ioe )
644  {
645  wxString msg;
646  msg.Printf( _( "An error occurred loading the symbol library table \"%s\"." ),
647  fn.GetFullPath() );
648  DisplayErrorMessage( NULL, msg, ioe.What() );
649  }
650  }
651  }
652 
653  return tbl;
654 }
void Format(OUTPUTFORMATTER *out, int nestLevel, bool aGlobal) const
Function Format serializes this object out as text into the given OUTPUTFORMATTER.
static int s_defaultTextSize
WS_DATA_MODEL handles the graphic items list to draw/plot the frame and title block.
Definition: ws_data_model.h:39
int GetSeverity(int aErrorCode)
static const wxString & GetSymbolLibTableFileName()
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
bool GetSelectionTextAsBox()
Draw selected text items as box.
const wxString & GetFileName() const
Definition: sch_screen.h:157
#define DEFAULT_SIZE_TEXT
This is the "default-of-the-default" hardcoded text size; individual application define their own def...
Definition: eda_text.h:70
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
int GetDefaultWireThickness()
Default line thickness used to draw/plot wires.
void SetSelectionDrawChildItems(bool aBool)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
static int * SubpartFirstIdPtr()
return a reference to m_subpartFirstId, only for read/save setting functions
PROJECT holds project specific data.
Definition: project.h:59
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:62
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
void SetDefaultWireThickness(int aThickness)
This file is part of the common library TODO brief description.
void SaveProjectSettings() override
Save changes to the project settings to the project (.pro) file.
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allows Libedit to install its preferences panel into the preferences dialog.
void SetDefaultBusThickness(int aThickness)
This file is part of the common library.
const std::string ProjectFileExtension
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
bool IsTestEnabled(int aErrorCode) const
Definition: erc_settings.h:68
void Parse(TEMPLATE_FIELDNAMES_LEXER *in, bool aGlobal)
Function Parse fills this object from information in the input stream handled by TEMPLATE_FIELDNAMES_...
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:38
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
Configuration parameter - Double Precision Class.
static bool s_selectDrawChildren
void SetSelectionTextAsBox(bool aBool)
TEMPLATES m_templateFieldNames
wxPoint m_repeatStep
void AddFormattingParameters(std::vector< PARAM_CFG * > &params)
static int s_defaultBusThickness
std::vector< PARAM_CFG * > m_projectFileParams
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
void AddHotKeys(TOOL_MANAGER *aToolMgr)
void SetPageLayout(const wxString &aFullFileName=wxEmptyString, bool Append=false)
Populates the list with a custom layout, or the default layout, if no custom layout available.
static bool s_selectFillShapes
VTBL_ENTRY _ELEM * GetElem(ELEM_T aIndex)
Typically wrapped somewhere else in a more meaningful function wrapper.
Definition: project.cpp:232
bool IsWritable(const wxFileName &aFileName)
Checks if aFileName can be written.
bool m_autoplaceAlign
align autoplaced fields to the grid
std::vector< PARAM_CFG * > & GetProjectFileParameters()
Return the project file parameter list for Eeschema.
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:282
ERC_SETTINGS * m_Pt_param
Pointer to the parameter value.
Configuration parameter - Integer Class with unit conversion.
COLOR4D GetInvisibleItemColor()
bool m_selectPinSelectSymbol
bool m_showSheetFileNameCaseSensitivityDlg
Configuration parameter - PARAM_CFG_FILENAME Class Same as PARAM_CFG_WXSTRING, but stores "\" as "/".
double GetTextOffsetRatio()
Amount to offset text above/below wires & busses.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void SetDefaultLineThickness(int aThickness)
#define TXT_MARGIN
The thickness to draw busses that do not have a specific width (can be changed in preference menu)
Definition: general.h:51
VTBL_ENTRY void SetElem(ELEM_T aIndex, _ELEM *aElem)
Definition: project.cpp:244
VTBL_ENTRY bool ConfigLoad(const SEARCH_STACK &aSearchS, const wxString &aGroupName, const std::vector< PARAM_CFG * > &aParams, const wxString &aForeignConfigFileName=wxEmptyString)
Function ConfigLoad reads a subset of parameters from the "project" file.
Definition: project.cpp:385
static wxString m_PageLayoutDescrFileName
the name of the page layout descr file, or emty to used the default pagelayout
Definition: base_screen.h:109
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
ERC_SETTINGS * g_ErcSettings
This also wants to live in the eventual SCHEMATIC object.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
#define FieldNameTemplatesKey
PARAM_CFG_FIELDNAMES(TEMPLATES *ptparam, const wxChar *group=nullptr)
void SetDefaultTextSize(int aTextSize)
static int GetSubpartIdSeparator()
int GetTextMarkupFlags()
Definition: gr_text.cpp:55
bool m_forceHVLines
force H or V directions for wires, bus, line
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
static int g_SymbolSize
Definition: sch_junction.h:37
bool m_footprintPreview
whether to show footprint previews
static int s_drawDefaultLineThickness
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:75
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
KICAD_T Type() override
static int GetSubpartFirstId()
bool GetForceHVLines() const
void SetSelectionFillShapes(bool aBool)
int ShowQuasiModal()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
PARAM_CFG_SEVERITIES(ERC_SETTINGS *ptparam, const wxChar *group=nullptr)
Configuration parameter - Integer Class.
int GetSelectionThickness()
Selection highlight thickness.
#define DEFAULTSELECTIONTHICKNESS
Definition: general.h:71
Definition of file extensions used in Kicad.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Helper for all the old plotting/printing code while it still exists.
VTBL_ENTRY void ConfigSave(const SEARCH_STACK &aSList, const wxString &aGroupName, const std::vector< PARAM_CFG * > &aParams, const wxString &aFileName=wxEmptyString)
Function ConfigSave saves the current "project" parameters into the wxConfigBase* derivative.
Definition: project.cpp:350
Functions to provide common constants and other functions to assist in making a consistent UI.
#define GROUP_SCH_EDIT
Definition: config_params.h:42
void DoShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aInitialParentPage=wxEmptyString)
Configuration parameter - Boolean Class.
bool LoadProjectFile()
Loads the KiCad project file (*.pro) settings specific to Eeschema.
SCH_LAYER_ID
Eeschema drawing layers.
const std::string & GetString()
Definition: richio.h:475
std::map< int, int > m_Severities
Definition: erc_settings.h:75
Container for ERC settings.
Definition: erc_settings.h:37
bool m_printMonochrome
Print monochrome instead of grey scale.
static int s_defaultWireThickness
#define DEFAULTDRAWLINETHICKNESS
The default pin len value when creating pins(can be changed in preference menu)
Definition: general.h:59
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
#define DEFAULTBUSTHICKNESS
The thickness to draw lines that thickness is set to 0 (default thickness) (can be changed in prefere...
Definition: general.h:55
void SetTextOffsetRatio(double aOffsetRatio)
Configuration parameter - wxString Class.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetSelectionThickness(int aThickness)
std::vector< PARAM_CFG * > GetProjectFileParameters()
bool m_autoplaceFields
automatically place component fields
bool m_showIllegalSymbolLibDialog
bool GetSelectionFillShapes()
Draw selected shapes as filled or not.
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
bool m_printSheetReference
TEMPLATES * m_Pt_param
Pointer to the parameter value.
bool m_navigatorStaysOpen
whether to keep Navigator open
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
see class PGM_BASE
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allows Eeschema to install its preferences panels into the preferences dialog.
static const wxString MakeFullFileName(const wxString &aShortFileName, const wxString &aProjectPath)
Static function.
static double s_textOffsetRatio
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:98
wxString m_plotDirectoryName
#define _(s)
Definition: 3d_actions.cpp:33
bool GetSelectionDrawChildItems()
Draw selected child items or not.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or '.
bool m_autoplaceJustify
allow autoplace to change justification
void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
EDA_UNITS m_userUnits
#define IU_PER_MILS
Definition: plotter.cpp:137
void SetSeverity(int aErrorCode, int aSeverity)
static int * SubpartIdSeparatorPtr()
return a reference to m_subpartIdSeparator, only for read/save setting functions
SCH_RENDER_SETTINGS Stores schematic-specific render settings.
Definition: sch_painter.h:69
wxString m_netListFormat
static int s_selectThickness
#define DBG(x)
Definition: fctsys.h:33
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
SCH_SHEET * g_RootSheet
bool GetSelectPinSelectSymbol() const override
Allow some frames to select the parent symbol when trying to select a pin.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
Definition for part library class.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
static bool s_selectTextAsBox
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
bool m_spiceAjustPassiveValues
Use netcodes (net number) as net names when generating spice net lists.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
int GetDefaultBusThickness()
Default line thickness used to draw/plot busses.
void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
int GetDefaultTextSize()
Default size for text in general.
void SetShowPageLimits(bool aDraw)
Definition: painter.h:183
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40