KiCad PCB EDA Suite
panel_eeschema_color_settings.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) 2020 Jon Evans <[email protected]>
5  * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <regex>
22 
23 #include <bitmaps.h>
24 #include <eeschema_settings.h>
26 #include <layer_ids.h>
27 #include <lib_shape.h>
28 #include <page_info.h>
30 #include <pgm_base.h>
31 #include <sch_bus_entry.h>
32 #include <sch_junction.h>
33 #include <sch_line.h>
34 #include <sch_no_connect.h>
35 #include <sch_painter.h>
36 #include <sch_preview_panel.h>
37 #include <sch_sheet_pin.h>
38 #include <sch_text.h>
42 #include <title_block.h>
43 #include <view/view.h>
45 #include <sch_base_frame.h>
46 #include <widgets/color_swatch.h>
47 #include <wx/msgdlg.h>
48 
49 
50 std::set<int> g_excludedLayers =
51  {
53  };
54 
55 
57  wxWindow* aParent ) :
58  PANEL_COLOR_SETTINGS( aParent ),
59  m_frame( aFrame ),
60  m_preview( nullptr ),
61  m_page( nullptr ),
62  m_titleBlock( nullptr ),
63  m_drawingSheet( nullptr ),
64  m_previewItems()
65 {
66  m_colorNamespace = "schematic";
67 
68  SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
69 
70  mgr.ReloadColorSettings();
71 
72  COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings();
73  EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
74  COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
75 
76  // Saved theme doesn't exist? Reset to default
77  if( current->GetFilename() != app_settings->m_ColorTheme )
78  app_settings->m_ColorTheme = current->GetFilename();
79 
80  createThemeList( app_settings->m_ColorTheme );
81 
82  m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
83 
84  m_currentSettings = new COLOR_SETTINGS( *current );
85 
86  for( int id = SCH_LAYER_ID_START; id < SCH_LAYER_ID_END; id++ )
87  {
88  if( g_excludedLayers.count( id ) )
89  continue;
90 
91  m_validLayers.push_back( id );
92  }
93 
95 
97 
98  m_galDisplayOptions.ReadConfig( *common_settings, app_settings->m_Window, this );
100 
101  auto type = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( app_settings->m_Graphics.canvas_type );
102 
103  m_preview = new SCH_PREVIEW_PANEL( this, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
104  m_galDisplayOptions, type );
105  m_preview->SetStealsFocus( false );
106  m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
107  m_preview->GetGAL()->SetAxesEnabled( false );
108 
109  m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
110  m_colorsMainSizer->Add( m_preview, 1, wxALL | wxEXPAND, 5 );
111  m_colorsMainSizer->Add( 10, 0, 0, wxEXPAND, 5 );
112 
114  updatePreview();
115  zoomFitPreview();
116 }
117 
118 
120 {
121  delete m_page;
122  delete m_titleBlock;
123  delete m_drawingSheet;
124  delete m_currentSettings;
125 
126  for( EDA_ITEM* item : m_previewItems )
127  delete item;
128 }
129 
130 
132 {
134 
135  if( !saveCurrentTheme( true ) )
136  return false;
137 
139 
140  SETTINGS_MANAGER& settingsMgr = Pgm().GetSettingsManager();
141  EESCHEMA_SETTINGS* app_settings = settingsMgr.GetAppSettings<EESCHEMA_SETTINGS>();
142  app_settings->m_ColorTheme = m_currentSettings->GetFilename();
143 
144  return true;
145 }
146 
147 
149 {
150  zoomFitPreview();
151  return true;
152 }
153 
154 
156 {
158 
159  for( SCH_LAYER_ID layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; ++layer )
160  {
161  if( bgcolor == m_currentSettings->GetColor( layer )
162  && layer != LAYER_SCHEMATIC_BACKGROUND && layer != LAYER_SHEET_BACKGROUND )
163  {
164  wxString msg = _( "Some items have the same color as the background\n"
165  "and they will not be seen on the screen. Are you\n"
166  "sure you want to use these colors?" );
167 
168  if( wxMessageBox( msg, _( "Warning" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
169  return false;
170 
171  break;
172  }
173  }
174 
175  return true;
176 }
177 
178 
180 {
181  for( int layer : m_validLayers )
182  {
184 
185  // Do not allow non-background layers to be completely white.
186  // This ensures the BW printing recognizes that the colors should be printed black.
188  && layer != LAYER_SHEET_BACKGROUND )
189  {
190  color.Darken( 0.01 );
191  }
192 
193  m_currentSettings->SetColor( layer, color );
194  }
195 
196  return PANEL_COLOR_SETTINGS::saveCurrentTheme( aValidate );
197 }
198 
199 
201 {
202  std::vector<SCH_LAYER_ID> layers;
203 
205  {
206  if( g_excludedLayers.count( i ) )
207  continue;
208 
209  layers.push_back( i );
210  }
211 
212 
213  std::sort( layers.begin(), layers.end(),
214  []( SCH_LAYER_ID a, SCH_LAYER_ID b )
215  {
216  return LayerName( a ) < LayerName( b );
217  } );
218 
219  for( int layer : layers )
220  {
221  wxString name = LayerName( layer );
222 
223  if( layer == LAYER_SCHEMATIC_GRID_AXES )
224  name += wxS( " " ) + _( "(symbol editor only)" );
225 
226  createSwatch( layer, name );
227  }
228 
229  // Give a minimal width to m_colorsListWindow, in order to always having
230  // a full row shown
231  int min_width = m_colorsGridSizer->GetMinSize().x;
232  const int margin = 20; // A margin around the sizer
233  m_colorsListWindow->SetMinSize( wxSize( min_width + margin, -1 ) );
234 }
235 
236 
238 {
239  updatePreview();
240 }
241 
242 
244 {
245  KIGFX::VIEW* view = m_preview->GetView();
246 
247  std::vector<DANGLING_END_ITEM> endPoints;
248 
251  m_titleBlock->SetTitle( _( "Color Preview" ) );
252  m_titleBlock->SetDate( wxDateTime::Now().FormatDate() );
253 
254  m_page->SetHeightMils( 5000 );
255  m_page->SetWidthMils( 6000 );
256 
259  view->Add( m_drawingSheet );
260 
261  // TODO: It would be nice to parse a schematic file here.
262  // This is created from the color_settings.sch file in demos folder
263 
264  auto addItem = [&]( EDA_ITEM* aItem )
265  {
266  view->Add( aItem );
267  m_previewItems.push_back( aItem );
268  };
269 
270  std::vector<std::pair<SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>> lines = {
271  { LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } },
272  { LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } },
273  { LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } },
274  { LAYER_WIRE, { { 2150, 2000 }, { 2150, 1700 } } },
275  { LAYER_WIRE, { { 2925, 1600 }, { 3075, 1600 } } },
276  { LAYER_WIRE, { { 3075, 1600 }, { 3075, 2000 } } },
277  { LAYER_WIRE, { { 3075, 1600 }, { 3250, 1600 } } },
278  { LAYER_WIRE, { { 3075, 2000 }, { 2150, 2000 } } },
279  { LAYER_BUS, { { 1750, 1400 }, { 1850, 1400 } } },
280  { LAYER_BUS, { { 1850, 2500 }, { 1850, 1400 } } },
281  { LAYER_NOTES, { { 2350, 2125 }, { 2350, 2300 } } },
282  { LAYER_NOTES, { { 2350, 2125 }, { 2950, 2125 } } },
283  { LAYER_NOTES, { { 2950, 2125 }, { 2950, 2300 } } },
284  { LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } }
285  };
286 
287  for( const std::pair<SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>& line : lines )
288  {
289  SCH_LINE* wire = new SCH_LINE;
290  wire->SetLayer( line.first );
291  STROKE_PARAMS stroke = wire->GetStroke();
292  stroke.SetWidth( Mils2iu( 6 ) );
293 
294  if( line.first != LAYER_NOTES )
295  {
297 
298  if( line.first == LAYER_BUS )
299  stroke.SetWidth( Mils2iu( 12 ) );
300 
301  }
302 
303  wire->SetStroke( stroke );
304 
305  wire->SetStartPoint( wxPoint( Mils2iu( line.second.first.x ),
306  Mils2iu( line.second.first.y ) ) );
307  wire->SetEndPoint( wxPoint( Mils2iu( line.second.second.x ),
308  Mils2iu( line.second.second.y ) ) );
309  addItem( wire );
310  }
311 
312 #define MILS_POINT( x, y ) wxPoint( Mils2iu( x ), Mils2iu( y ) )
313 
314  SCH_NO_CONNECT* nc = new SCH_NO_CONNECT;
315  nc->SetPosition( MILS_POINT( 2525, 1300 ) );
316  addItem( nc );
317 
319  e1->SetPosition( MILS_POINT( 1850, 1400 ) );
320  addItem( e1 );
321 
323  e2->SetPosition( MILS_POINT( 1850, 2500 ) );
324  addItem( e2 );
325 
326  SCH_TEXT* t1 = new SCH_TEXT( MILS_POINT( 2850, 2250 ), wxT( "PLAIN TEXT" ) );
327  t1->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT );
328  addItem( t1 );
329 
330  SCH_LABEL* t2 = new SCH_LABEL( MILS_POINT( 1975, 1500 ), wxT( "LABEL_{0}" ) );
331  t2->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT );
332  t2->SetIsDangling( false );
333  addItem( t2 );
334 
335  SCH_LABEL* t3 = new SCH_LABEL( MILS_POINT( 1975, 2600 ), wxT( "LABEL_{1}" ) );
336  t3->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT );
337  t3->SetIsDangling( false );
338  addItem( t3 );
339 
340  SCH_GLOBALLABEL* t4 = new SCH_GLOBALLABEL( MILS_POINT( 1750, 1400 ), wxT( "GLOBAL[0..3]" ) );
341  t4->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT );
342  t4->SetIsDangling( false );
343  addItem( t4 );
344 
345  SCH_HIERLABEL* t5 = new SCH_HIERLABEL( MILS_POINT( 3250, 1600 ), wxT( "HIER_LABEL" ) );
346  t5->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT );
347  t5->SetIsDangling( false );
348  addItem( t5 );
349 
350  SCH_JUNCTION* j = new SCH_JUNCTION( MILS_POINT( 3075, 1600 ) );
351  addItem( j );
352 
353  t2->SetSelected();
354 
355  {
356  auto mapLibItemPosition =
357  []( const wxPoint& aLibPosition ) -> wxPoint
358  {
359  return wxPoint( aLibPosition.x, -aLibPosition.y );
360  };
361 
362  LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
363  wxPoint p( 2625, -1600 );
364 
365  LIB_FIELD& ref = symbol->GetReferenceField();
366 
367  ref.SetText( wxT( "U1" ) );
368  ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) );
370 
371  LIB_FIELD& value = symbol->GetValueField();
372 
373  value.SetText( wxT( "OPA604" ) );
374  value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) );
376 
377  symbol->SetShowPinNames( true );
378  symbol->SetShowPinNumbers( true );
379  symbol->SetPinNameOffset( 0 );
380 
381  LIB_SHAPE* comp_body = new LIB_SHAPE( symbol, SHAPE_T::POLY );
382 
383  comp_body->SetUnit( 0 );
384  comp_body->SetConvert( 0 );
385  comp_body->SetWidth( Mils2iu( 10 ) );
387  comp_body->AddPoint( MILS_POINT( p.x - 200, p.y + 200 ) );
388  comp_body->AddPoint( MILS_POINT( p.x + 200, p.y ) );
389  comp_body->AddPoint( MILS_POINT( p.x - 200, p.y - 200 ) );
390  comp_body->AddPoint( MILS_POINT( p.x - 200, p.y + 200 ) );
391 
392  addItem( comp_body );
393 
394  LIB_PIN* pin = new LIB_PIN( symbol );
395 
396  pin->SetPosition( MILS_POINT( p.x - 300, p.y + 100 ) );
397  pin->SetLength( Mils2iu( 100 ) );
398  pin->SetOrientation( PIN_RIGHT );
399  pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
400  pin->SetNumber( wxT( "1" ) );
401  pin->SetName( wxT( "-" ) );
402 
403  endPoints.emplace_back( PIN_END, pin, mapLibItemPosition( pin->GetPosition() ) );
404  symbol->AddDrawItem( pin );
405 
406  pin = new LIB_PIN( symbol );
407 
408  pin->SetPosition( MILS_POINT( p.x - 300, p.y - 100 ) );
409  pin->SetLength( Mils2iu( 100 ) );
410  pin->SetOrientation( PIN_RIGHT );
411  pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
412  pin->SetNumber( wxT( "2" ) );
413  pin->SetName( wxT( "+" ) );
414 
415  endPoints.emplace_back( PIN_END, pin, mapLibItemPosition( pin->GetPosition() ) );
416  symbol->AddDrawItem( pin );
417 
418  pin = new LIB_PIN( symbol );
419 
420  pin->SetPosition( MILS_POINT( p.x + 300, p.y ) );
421  pin->SetLength( Mils2iu( 100 ) );
422  pin->SetOrientation( PIN_LEFT );
424  pin->SetNumber( wxT( "3" ) );
425  pin->SetName( wxT( "OUT" ) );
426 
427  endPoints.emplace_back( PIN_END, pin, mapLibItemPosition( pin->GetPosition() ) );
428  symbol->AddDrawItem( pin );
429 
430  addItem( symbol );
431  }
432 
433  SCH_SHEET* s = new SCH_SHEET( nullptr, MILS_POINT( 4000, 1300 ) );
434  s->SetSize( wxSize( Mils2iu( 800 ), Mils2iu( 1300 ) ) );
435  s->GetFields().at( SHEETNAME ).SetText( wxT( "SHEET" ) );
436  s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) );
437  s->AutoplaceFields( nullptr, false );
438  addItem( s );
439 
440  SCH_SHEET_PIN* sp = new SCH_SHEET_PIN( s, MILS_POINT( 4500, 1500 ), wxT( "SHEET PIN" ) );
441  addItem( sp );
442 
443  for( EDA_ITEM* item : m_previewItems )
444  {
445  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
446 
447  if( sch_item && sch_item->IsConnectable() )
448  {
449  sch_item->AutoplaceFields( nullptr, false );
450  sch_item->GetEndPoints( endPoints );
451  }
452  }
453 
454  for( EDA_ITEM* item : m_previewItems )
455  {
456  SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
457 
458  if( sch_item && sch_item->IsConnectable() )
459  sch_item->UpdateDanglingState( endPoints, nullptr );
460  }
461 
462  zoomFitPreview();
463 }
464 
465 
467 {
468  updatePreview();
469 }
470 
471 
473 {
475  updatePreview();
476 }
477 
478 
480 {
481  if( !m_preview )
482  return;
483 
484  KIGFX::VIEW* view = m_preview->GetView();
485  auto settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
486  settings->LoadColors( m_currentSettings );
487 
488  m_preview->GetGAL()->SetClearColor( settings->GetBackgroundColor() );
489 
490  view->UpdateAllItems( KIGFX::COLOR );
491  auto rect = m_preview->GetScreenRect();
492  m_preview->Refresh( true, &rect );
493 }
494 
495 
497 {
498  KIGFX::VIEW* view = m_preview->GetView();
499 
500  view->SetScale( 1.0 );
501  VECTOR2D screenSize = view->ToWorld( m_preview->GetClientSize(), false );
502 
503  VECTOR2I psize( m_page->GetWidthIU(), m_page->GetHeightIU() );
504  double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
505  fabs( psize.y / screenSize.y ) );
506 
507  view->SetScale( scale * m_galDisplayOptions.m_scaleFactor * 0.8 /* margin */ );
508  view->SetCenter( m_drawingSheet->ViewBBox().Centre() );
510 }
511 
512 
513 void PANEL_EESCHEMA_COLOR_SETTINGS::OnSize( wxSizeEvent& aEvent )
514 {
515  zoomFitPreview();
516  aEvent.Skip();
517 }
518 
519 
521 {
523 
524  // If the theme is not overriding individual item colors then don't show them so that
525  // the user doesn't get seduced into thinking they'll have some effect.
528 
531 
532  m_colorsGridSizer->Layout();
533  m_colorsListWindow->Layout();
534 }
void ResetPanel() override
Reset the contents of this panel.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Definition: lib_symbol.h:571
void SetClearColor(const COLOR4D &aColor)
void AddPoint(const wxPoint &aPosition)
Definition: lib_shape.cpp:414
void SetWidth(int aWidth)
Definition: sch_item.h:153
virtual bool IsConnectable() const
Definition: sch_item.h:349
void ForceRefresh()
Force a redraw.
virtual bool saveCurrentTheme(bool aValidate)
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
virtual void ResetPanel() override
Reset the contents of this panel.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:449
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
Definition: sch_item.h:318
wxString GetFilename() const
Definition: json_settings.h:72
int color
Definition: DXF_plotter.cpp:57
Field object used in symbol libraries.
Definition: lib_field.h:59
std::map< int, wxStaticText * > m_labels
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1482
void SetPosition(const wxPoint &aPosition) override
void SetColor(int aLayer, const COLOR4D &aColor)
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
Definition: title_block.h:71
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
Definition: sch_item.h:156
static const wxChar Custom[]
"User" defined page type
Definition: page_info.h:77
std::map< int, COLOR_SWATCH * > m_swatches
LIB_FIELD & GetValueField()
Return reference to the value field.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
Color has changed.
Definition: view_item.h:48
void SetIsDangling(bool aIsDangling)
Definition: sch_text.h:231
void OnSize(wxSizeEvent &aEvent) override
bool validateSave(bool aQuiet=false) override
Performs a pre-save validation of the current color theme.
Define a library symbol object.
Definition: lib_symbol.h:96
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:40
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
void SetEndPoint(const wxPoint &aPosition)
Definition: sch_line.h:94
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
Definition: sch_item.h:336
bool saveCurrentTheme(bool aValidate) override
void onNewThemeSelected() override
Event fired when a new theme is selected that can be overridden in children.
std::vector< SCH_FIELD > & GetFields()
Definition: sch_sheet.h:90
#define MILS_POINT(x, y)
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
Definition: lib_symbol.h:579
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:578
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
void SetSelected()
Definition: eda_item.h:128
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:335
void onColorChanged() override
Event fired when the user changes any color.
void SetPosition(const wxPoint &aPosition) override
PANEL_EESCHEMA_COLOR_SETTINGS(SCH_BASE_FRAME *aFrame, wxWindow *aParent)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
void createThemeList(const wxString &aCurrent)
Builds the theme listbox and sets the selection to the current theme.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:442
COLOR_SETTINGS * m_currentSettings
void SetStartPoint(const wxPoint &aPosition)
Definition: sch_line.h:91
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
Definition: sch_item.h:266
void SetOverrideSchItemColors(bool aFlag)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:1564
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
#define _(s)
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition: layer_id.cpp:27
void SetWidth(int aWidth)
Definition: eda_shape.h:97
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Definition: lib_symbol.cpp:716
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
void SetTitle(const wxString &aTitle)
Definition: title_block.h:58
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetHeightMils(int aHeightInMils)
Definition: page_info.cpp:257
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
void SetSize(const wxSize &aSize)
Definition: sch_sheet.h:105
void SetConvert(int aConvert)
Definition: lib_item.h:268
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:552
void OnOverrideItemColorsClicked(wxCommandEvent &aEvent) override
Definition: color4d.h:48
std::set< int > g_excludedLayers
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void SetUnit(int aUnit)
Definition: lib_item.h:265
COLOR4D GetColor(int aLayer) const
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
void ReloadColorSettings()
Re-scans the color themes directory, reloading any changes it finds.
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_line.h:137
const int scale
see class PGM_BASE
const BOX2I ViewBBox() const override
Vec Centre() const
Definition: box2.h:63
const char * name
Definition: DXF_plotter.cpp:56
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:222
Simple container to manage line stroke parameters.
Definition: sch_item.h:140
usual pin input: must be connected
void SetWidthMils(int aWidthInMils)
Definition: page_info.cpp:243
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
#define IU_PER_MILS
Definition: plotter.cpp:130
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
Definition: lib_symbol.h:587
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
virtual STROKE_PARAMS GetStroke() const override
Definition: sch_line.h:136
Class for a wire to bus entry.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetPosition(const wxPoint &aPosition) override
Definition: lib_item.h:230
bool GetOverrideSchItemColors() const
void SetFillMode(FILL_T aFill)
Definition: eda_shape.h:87
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:1059
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_sheet.cpp:579
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
Definition: sch_text.cpp:330
void Refresh(bool aEraseBackground, const wxRect *aRect) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
double GetScale() const
Definition: view.h:264
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
void createSwatch(int aLayer, const wxString &aName)
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103