KiCad PCB EDA Suite
eda_draw_frame.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) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <base_screen.h>
27 #include <bitmaps.h>
28 #include <confirm.h>
29 #include <core/arraydim.h>
30 #include <dialog_shim.h>
31 #include <eda_draw_frame.h>
32 #include <filehistory.h>
33 #include <id.h>
34 #include <kiface_i.h>
35 #include <lockfile.h>
36 #include <macros.h>
37 #include <page_info.h>
38 #include <pgm_base.h>
39 #include <render_settings.h>
40 #include <settings/app_settings.h>
44 #include <title_block.h>
45 #include <tool/actions.h>
46 #include <tool/common_tools.h>
47 #include <tool/grid_menu.h>
49 #include <tool/tool_dispatcher.h>
50 #include <tool/tool_manager.h>
51 #include <tool/tool_menu.h>
52 #include <tool/zoom_menu.h>
53 #include <trace_helpers.h>
54 #include <view/view.h>
56 #include <widgets/msgpanel.h>
57 #include <wx/snglinst.h>
59 #include <widgets/ui_common.h>
60 #include <zoom_defines.h>
61 
62 #define FR_HISTORY_LIST_CNT 10
63 
64 
65 BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
68 END_EVENT_TABLE()
69 
70 
71 EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
72  const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
73  long aStyle, const wxString & aFrameName ) :
74  KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
75 {
76  m_socketServer = nullptr;
77  m_mainToolBar = NULL;
78  m_drawToolBar = NULL;
79  m_optionsToolBar = NULL;
80  m_auxiliaryToolBar = NULL;
81  m_gridSelectBox = NULL;
82  m_zoomSelectBox = NULL;
83  m_firstRunDialogSetting = 0;
84  m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS;
85 
86  m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
87  m_canvas = NULL;
88  m_toolDispatcher = NULL;
89  m_messagePanel = NULL;
90  m_currentScreen = NULL;
91  m_showBorderAndTitleBlock = false; // true to display reference sheet.
92  m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
93  m_showPageLimits = false;
94  m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
95  // BLACK for Pcbnew, BLACK or WHITE for Eeschema
96  m_colorSettings = nullptr;
97  m_msgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
98  m_userUnits = EDA_UNITS::MILLIMETRES;
99  m_polarCoords = false;
100  m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
101 
102  m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
103 
104  CreateStatusBar( 7 );
105 
106  // set the size of the status bar subwindows:
107 
108  wxWindow* stsbar = GetStatusBar();
109 
110  int dims[] = {
111 
112  // remainder of status bar on far left is set to a default or whatever is left over.
113  -1,
114 
115  // When using GetTextSize() remember the width of character '1' is not the same
116  // as the width of '0' unless the font is fixed width, and it usually won't be.
117 
118  // zoom:
119  KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
120 
121  // cursor coords
122  KIUI::GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
123 
124  // delta distances
125  KIUI::GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
126 
127  // grid size
128  KIUI::GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
129 
130  // units display, Inches is bigger than mm
131  KIUI::GetTextSize( _( "Inches" ), stsbar ).x + 10,
132 
133  // Size for the "Current Tool" panel; longest string from SetTool()
134  KIUI::GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
135  };
136 
137  SetStatusWidths( arrayDim( dims ), dims );
138 
139  // Create child subwindows.
140  GetClientSize( &m_frameSize.x, &m_frameSize.y );
141  m_framePos.x = m_framePos.y = 0;
142  m_frameSize.y -= m_msgFrameHeight;
143 
144  m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_frameSize.y ),
145  wxSize( m_frameSize.x, m_msgFrameHeight ) );
146 
147  m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
148 }
149 
150 
152 {
153  delete m_socketServer;
154 
155  for( auto socket : m_sockets )
156  {
157  socket->Shutdown();
158  socket->Destroy();
159  }
160 
162 
163  delete m_actions;
164  delete m_toolManager;
165  delete m_toolDispatcher;
166  delete m_canvas;
167 
168  delete m_currentScreen;
170 
171  delete m_findReplaceData;
172 
173  m_auimgr.UnInit();
174 
175  ReleaseFile();
176 }
177 
178 
180 {
181  m_file_checker = nullptr;
182 }
183 
184 
185 bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
186 {
187  m_file_checker = ::LockFile( aFileName );
188 
189  return bool( m_file_checker );
190 }
191 
192 
194 {
195  // Notify all tools the units have changed
196  if( m_toolManager )
198 
199  UpdateStatusBar();
200  UpdateMsgPanel();
201 }
202 
203 
205 {
208 
209  wxCommandEvent e( UNITS_CHANGED );
210  ProcessEventLocally( e );
211 }
212 
213 
214 void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
215 {
216  EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
217 
218  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
219  KIGFX::VIEW_CONTROLS* viewControls = GetCanvas()->GetViewControls();
220 
222 
223  viewControls->LoadSettings();
224 
225  m_galDisplayOptions.ReadCommonConfig( *settings, this );
226 }
227 
228 
230 {
231  if( m_messagePanel )
233 }
234 
235 
237 {
238  UpdateStatusBar();
239  DisplayUnitsMsg();
240 
241  if( m_gridSelectBox == NULL )
242  return;
243 
244  // Update grid values with the current units setting.
245  m_gridSelectBox->Clear();
246  wxArrayString gridsList;
247 
248  GRID_MENU::BuildChoiceList( &gridsList, config(), this );
249 
250  for( const wxString& grid : gridsList )
251  m_gridSelectBox->Append( grid );
252 
253  m_gridSelectBox->Append( wxT( "---" ) );
254  m_gridSelectBox->Append( _( "Edit User Grid..." ) );
255 
256  m_gridSelectBox->SetSelection( config()->m_Window.grid.last_size_idx );
257 }
258 
259 
260 void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
261 {
262  // No need to update the grid select box if it doesn't exist or the grid setting change
263  // was made using the select box.
264  if( m_gridSelectBox == NULL )
265  return;
266 
267  int idx = config()->m_Window.grid.last_size_idx;
268  idx = std::max( 0, std::min( idx, (int) m_gridSelectBox->GetCount() - 1 ) );
269 
270  if( idx != m_gridSelectBox->GetSelection() )
271  m_gridSelectBox->SetSelection( idx );
272 }
273 
274 
276 {
277  wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
278 }
279 
280 
281 /*
282  * Respond to selections in the toolbar grid popup
283  */
284 void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
285 {
286  wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
287 
288  int idx = m_gridSelectBox->GetCurrentSelection();
289 
290  if( idx == int( m_gridSelectBox->GetCount() ) - 2 )
291  {
292  // wxWidgets will check the separator, which we don't want.
293  // Re-check the current grid.
294  wxUpdateUIEvent dummy;
296  }
297  else if( idx == int( m_gridSelectBox->GetCount() ) - 1 )
298  {
299  // wxWidgets will check the Grid Settings... entry, which we don't want.
300  // Re-check the current grid.
301  wxUpdateUIEvent dummy;
303  // Now run the Grid Settings... dialog
304  wxCommandEvent dummy2;
305  OnGridSettings( dummy2 );
306  }
307  else
308  {
310  }
311 
312  UpdateStatusBar();
313  m_canvas->Refresh();
314 }
315 
316 
317 void EDA_DRAW_FRAME::OnGridSettings( wxCommandEvent& aEvent )
318 {
319  DIALOG_GRID_SETTINGS dlg( this );
320 
321  if( dlg.ShowModal() == wxID_OK )
322  {
323  UpdateStatusBar();
324  GetCanvas()->Refresh();
325  }
326 }
327 
328 
330 {
331  return config()->m_Window.grid.show;
332 }
333 
334 
336 {
337  config()->m_Window.grid.show = aVisible;
338 
339  // Update the display with the new grid
340  if( GetCanvas() )
341  {
342  // Check to ensure these exist, since this function could be called before
343  // the GAL and View have been created
344  if( GetCanvas()->GetGAL() )
345  GetCanvas()->GetGAL()->SetGridVisibility( aVisible );
346 
347  if( GetCanvas()->GetView() )
349 
350  GetCanvas()->Refresh();
351  }
352 }
353 
354 
356 {
357  if( m_zoomSelectBox == NULL )
358  return;
359 
360  double zoom = m_canvas->GetGAL()->GetZoomFactor();
361 
362  m_zoomSelectBox->Clear();
363  m_zoomSelectBox->Append( _( "Zoom Auto" ) );
364  m_zoomSelectBox->SetSelection( 0 );
365 
366  for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); ++i )
367  {
368  double current = config()->m_Window.zoom_factors[i];
369 
370  m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
371 
372  if( zoom == current )
373  m_zoomSelectBox->SetSelection( i + 1 );
374  }
375 }
376 
377 
378 void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
379 {
380  if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
381  return;
382 
383  int current = 0; // display Auto if no match found
384 
385  // check for a match within 1%
386  double zoom = GetCanvas()->GetGAL()->GetZoomFactor();
387 
388  for( unsigned i = 0; i < config()->m_Window.zoom_factors.size(); i++ )
389  {
390  if( std::fabs( zoom - config()->m_Window.zoom_factors[i] ) < ( zoom / 100.0 ) )
391  {
392  current = i + 1;
393  break;
394  }
395  }
396 
397  if( current != m_zoomSelectBox->GetSelection() )
398  m_zoomSelectBox->SetSelection( current );
399 }
400 
401 
402 /*
403  * Respond to selections in the toolbar zoom popup
404  */
405 void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
406 {
407  wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
408 
409  int id = m_zoomSelectBox->GetCurrentSelection();
410 
411  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
412  return;
413 
414  m_toolManager->RunAction( "common.Control.zoomPreset", true, id );
415  UpdateStatusBar();
416  m_canvas->Refresh();
417 }
418 
419 
420 void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
421 {
422  // If the window is moved to a different display, the scaling factor may change
423  double oldFactor = m_galDisplayOptions.m_scaleFactor;
425 
426  if( oldFactor != m_galDisplayOptions.m_scaleFactor && m_canvas )
427  {
428  wxSize clientSize = GetClientSize();
429  GetCanvas()->GetGAL()->ResizeScreen( clientSize.x, clientSize.y );
430  GetCanvas()->GetView()->MarkDirty();
431  }
432 
433  aEvent.Skip();
434 }
435 
436 
438 {
439  COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
440  CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
441 
442  aMenu.AddSeparator( 1000 );
443 
444  auto zoomMenu = std::make_shared<ZOOM_MENU>( this );
445  zoomMenu->SetTool( commonTools );
446  aToolMenu.AddSubMenu( zoomMenu );
447 
448  auto gridMenu = std::make_shared<GRID_MENU>( this );
449  gridMenu->SetTool( commonTools );
450  aToolMenu.AddSubMenu( gridMenu );
451 
452  aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
453  aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
454 }
455 
456 
458 {
459  wxAcceleratorEntry entries[1];
460  entries[0].Set( wxACCEL_CTRL, int( 'Q' ), wxID_EXIT );
461  wxAcceleratorTable accel( 1, entries );
462  SetAcceleratorTable( accel );
463 }
464 
465 
466 void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
467 {
468  SetStatusText( msg, 6 );
469 }
470 
471 
473 {
474  wxString line;
475 
476  line.Printf( "grid %s",
477  MessageTextFromValue( GetUserUnits(), GetCanvas()->GetGAL()->GetGridSize().x, false ) );
478 
479  SetStatusText( line, 4 );
480 }
481 
482 
484 {
485  wxString msg;
486 
487  switch( m_userUnits )
488  {
489  case EDA_UNITS::INCHES: msg = _( "inches" ); break;
490  case EDA_UNITS::MILS: msg = _( "mils" ); break;
491  case EDA_UNITS::MILLIMETRES: msg = _( "mm" ); break;
492  default: msg = _( "Units" ); break;
493  }
494 
495  SetStatusText( msg, 5 );
496 }
497 
498 
499 void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
500 {
501  m_frameSize = GetClientSize( );
502 
503  SizeEv.Skip();
504 }
505 
506 
508 {
509  SetStatusText( GetZoomLevelIndicator(), 1 );
510 
511  // Absolute and relative cursor positions are handled by overloading this function and
512  // handling the internal to user units conversion at the appropriate level.
513 
514  // refresh units display
515  DisplayUnitsMsg();
516 }
517 
518 
520 {
521  // returns a human readable value which can be displayed as zoom
522  // level indicator in dialogs.
523  double zoom = m_canvas->GetGAL()->GetZoomFactor();
524  return wxString::Format( wxT( "Z %.2f" ), zoom );
525 }
526 
527 
529 {
531 
532  COMMON_SETTINGS* cmnCfg = Pgm().GetCommonSettings();
533  WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
534 
535  // Read units used in dialogs and toolbars
536  SetUserUnits( static_cast<EDA_UNITS>( aCfg->m_System.units ) );
537 
540 
541  m_galDisplayOptions.ReadConfig( *cmnCfg, *window, this );
542 
543  m_findReplaceData->SetFlags( aCfg->m_FindReplace.flags );
544  m_findReplaceData->SetFindString( aCfg->m_FindReplace.find_string );
545  m_findReplaceData->SetReplaceString( aCfg->m_FindReplace.replace_string );
546 
547  for( auto& s : aCfg->m_FindReplace.find_history )
548  m_findStringHistoryList.Add( s );
549 
550  for( auto& s : aCfg->m_FindReplace.replace_history )
552 }
553 
554 
556 {
558 
559  WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
560 
561  aCfg->m_System.units = static_cast<int>( m_userUnits );
564 
565  m_galDisplayOptions.WriteConfig( *window );
566 
567  aCfg->m_FindReplace.flags = m_findReplaceData->GetFlags();
568  aCfg->m_FindReplace.find_string = m_findReplaceData->GetFindString();
569  aCfg->m_FindReplace.replace_string = m_findReplaceData->GetReplaceString();
570 
571  aCfg->m_FindReplace.find_history.clear();
572  aCfg->m_FindReplace.replace_history.clear();
573 
574  for( size_t i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
575  {
576  aCfg->m_FindReplace.find_history.push_back( m_findStringHistoryList[ i ].ToStdString() );
577  }
578 
579  for( size_t i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
580  {
581  aCfg->m_FindReplace.replace_history.push_back(
582  m_replaceStringHistoryList[ i ].ToStdString() );
583  }
584 
585  // Save the units used in this frame
586  if( m_toolManager )
587  {
588  if( COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>() )
589  {
590  aCfg->m_System.last_imperial_units = static_cast<int>( cmnTool->GetLastImperialUnits() );
591  aCfg->m_System.last_metric_units = static_cast<int>( cmnTool->GetLastMetricUnits() );
592  }
593  }
594 }
595 
596 
597 void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower,
598  int aPadding )
599 {
600  if( m_messagePanel )
601  m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
602 }
603 
604 
606 {
607  if( m_messagePanel )
609 }
610 
611 
613 {
614  if( m_messagePanel )
615  {
617 
618  for( const MSG_PANEL_ITEM& item : aList )
619  m_messagePanel->AppendMessage( item );
620  }
621 }
622 
623 
625 {
626  wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
627 
628  MSG_PANEL_ITEMS items;
629  aItem->GetMsgPanelInfo( this, items );
630  SetMsgPanel( items );
631 }
632 
633 
635 {
637 }
638 
639 
641 {
642  GetCanvas()->SetEvtHandlerEnabled( true );
643  GetCanvas()->StartDrawing();
644 }
645 
646 
648 {
649  GetCanvas()->SwitchBackend( aCanvasType );
651 
653 }
654 
655 
657 {
658 #ifdef __WXMAC__
659  // Cairo renderer doesn't handle Retina displays so there's really only one game
660  // in town for Mac
662 #endif
663 
666 
667  if( cfg )
668  canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
669 
670  if( canvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
671  || canvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
672  {
673  wxASSERT( false );
675  }
676 
677  // Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
678  // the user will be prompted to switch to OpenGL
679  if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
681 
682  return canvasType;
683 }
684 
685 
687 {
688  // Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
689  // have a fixed type, or do not have a option to set the canvas type (they inherit from
690  // a parent frame)
691  FRAME_T allowed_frames[] =
692  {
693  FRAME_SCH,
695  FRAME_GERBER,
697  };
698 
699  bool allow_save = false;
700 
701  for( unsigned ii = 0; ii < arrayDim( allowed_frames ); ii++ )
702  {
703  if( m_ident == allowed_frames[ii] )
704  {
705  allow_save = true;
706  break;
707  }
708  }
709 
710  if( !allow_save )
711  return false;
712 
713  if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
714  || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
715  {
716  wxASSERT( false );
717  return false;
718  }
719 
721 
722  if( cfg )
723  cfg->m_Graphics.canvas_type = static_cast<int>( aCanvasType );
724 
725  return false;
726 }
727 
728 
729 wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
730 {
731  const wxPoint& gridOrigin = GetGridOrigin();
732  VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
733 
734  double xOffset = fmod( gridOrigin.x, gridSize.x );
735  int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
736  double yOffset = fmod( gridOrigin.y, gridSize.y );
737  int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
738 
739  return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
740 }
741 
742 
743 const BOX2I EDA_DRAW_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
744 {
745  return BOX2I();
746 }
747 
748 
750 {
751  // To be implemented by subclasses.
752 }
753 
754 
755 void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
756 {
758 }
759 
760 
761 // Find the first child dialog.
762 wxWindow* findDialog( wxWindowList& aList )
763 {
764  for( wxWindow* window : aList )
765  {
766  if( dynamic_cast<DIALOG_SHIM*>( window ) )
767  return window;
768  }
769  return NULL;
770 }
771 
772 
773 void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
774 {
775  bool centerView = false;
776  BOX2D r = GetCanvas()->GetView()->GetViewport();
777 
778  // Center if we're off the current view, or within 10% of its edge
779  r.Inflate( - (int) r.GetWidth() / 10 );
780 
781  if( !r.Contains( aPos ) )
782  centerView = true;
783 
784  // Center if we're behind an obscuring dialog, or within 10% of its edge
785  wxWindow* dialog = findDialog( GetChildren() );
786 
787  if( dialog )
788  {
789  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
790  dialog->GetSize() );
791  dialogRect.Inflate( dialogRect.GetWidth() / 10 );
792 
793  if( dialogRect.Contains( (wxPoint) GetCanvas()->GetView()->ToScreen( aPos ) ) )
794  centerView = true;
795  }
796 
797  if( centerView )
798  {
799  // If a dialog partly obscures the window, then center on the uncovered area.
800  if( dialog )
801  {
802  wxRect dialogRect( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ),
803  dialog->GetSize() );
804  GetCanvas()->GetView()->SetCenter( aPos, dialogRect );
805  }
806  else
807  GetCanvas()->GetView()->SetCenter( aPos );
808  }
809 
811 }
812 
813 
814 static const wxString productName = wxT( "KiCad E.D.A. " );
815 
816 void PrintPageLayout( RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
817  const wxString& aFullSheetName, const wxString& aFileName,
818  const TITLE_BLOCK& aTitleBlock, int aSheetCount, const wxString& aPageNumber,
819  double aMils2Iu, const PROJECT* aProject, const wxString& aSheetLayer,
820  bool aIsFirstPage )
821 {
822  WS_DRAW_ITEM_LIST drawList;
823 
824  drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
825  drawList.SetMilsToIUfactor( aMils2Iu );
826  drawList.SetPageNumber( aPageNumber );
827  drawList.SetSheetCount( aSheetCount );
828  drawList.SetFileName( aFileName );
829  drawList.SetSheetName( aFullSheetName );
830  drawList.SetSheetLayer( aSheetLayer );
831  drawList.SetProject( aProject );
832  drawList.SetIsFirstPage( aIsFirstPage );
833 
834  drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
835 
836  // Draw item list
837  drawList.Print( aSettings );
838 }
839 
840 
842  double aMils2Iu, const wxString &aFilename,
843  const wxString &aSheetLayer )
844 {
846  return;
847 
848  wxDC* DC = aSettings->GetPrintDC();
849  wxPoint origin = DC->GetDeviceOrigin();
850 
851  if( origin.y > 0 )
852  {
853  DC->SetDeviceOrigin( 0, 0 );
854  DC->SetAxisOrientation( true, false );
855  }
856 
857  PrintPageLayout( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
858  aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu, &Prj(),
859  aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );
860 
861  if( origin.y > 0 )
862  {
863  DC->SetDeviceOrigin( origin.x, origin.y );
864  DC->SetAxisOrientation( true, true );
865  }
866 }
867 
868 
870 {
871  // Virtual function. Base class implementation returns an empty string.
872  return wxEmptyString;
873 }
874 
875 
876 bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
877  const wxString& wildcard, const wxString& ext,
878  bool isDirectory )
879 {
880  wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
881  aFilename.SetExt( ext );
882 
883  if( isDirectory && doOpen )
884  {
885  wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
886  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
887 
888  if( dlg.ShowModal() == wxID_CANCEL )
889  return false;
890 
891  aFilename = dlg.GetPath();
892  aFilename.SetExt( ext );
893  }
894  else
895  {
896  // Ensure the file has a dummy name, otherwise GTK will display the regex from the filter
897  if( aFilename.GetName().empty() )
898  aFilename.SetName( "Library" );
899 
900  wxString dir = Prj().IsNullProject() ? aFilename.GetFullPath() : Prj().GetProjectPath();
901 
902  wxFileDialog dlg( this, prompt, dir, aFilename.GetFullName(),
903  wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
904  : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
905 
906  if( dlg.ShowModal() == wxID_CANCEL )
907  return false;
908 
909  aFilename = dlg.GetPath();
910  aFilename.SetExt( ext );
911  }
912 
913  return true;
914 }
915 
916 
918 {
919  // Rebuild all toolbars, and update the checked state of check tools
920  if( m_mainToolBar )
922 
923  if( m_drawToolBar ) // Drawing tools (typically on right edge of window)
925 
926  if( m_optionsToolBar ) // Options (typically on left edge of window)
928 
929  if( m_auxiliaryToolBar ) // Additional tools under main toolbar
931 }
932 
933 
935 {
936  if( !m_colorSettings )
937  m_colorSettings = Pgm().GetSettingsManager().GetColorSettings();
938 
939  return m_colorSettings;
940 }
941 
942 
944 {
946 
947  if( cmnTool )
948  {
949  // Tell the tool what the units used last session
950  cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_imperial_units ) );
951  cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_metric_units ) );
952  }
953 
954  // Tell the tool what units the frame is currently using
955  switch( static_cast<EDA_UNITS>( aCfg->m_System.units ) )
956  {
957  default:
961  }
962 }
963 
964 
965 void EDA_DRAW_FRAME::GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits )
966 {
968 
969  aPrimaryUnit = GetUserUnits();
970  aSecondaryUnits = EDA_UNITS::MILS;
971 
972  if( EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) )
973  {
974  if( cmnTool )
975  aSecondaryUnits = cmnTool->GetLastMetricUnits();
976  else
977  aSecondaryUnits = EDA_UNITS::MILLIMETRES;
978  }
979  else
980  {
981  if( cmnTool )
982  aSecondaryUnits = cmnTool->GetLastImperialUnits();
983  else
984  aSecondaryUnits = EDA_UNITS::MILS;
985  }
986 }
987 
988 
990 {
992 
993  // Nudge user to switch to OpenGL if they are on legacy or Cairo
994  if( m_firstRunDialogSetting < 1 )
995  {
997  {
998  wxString msg =
999  _( "KiCad can use your graphics card to give you a smoother "
1000  "and faster experience. This option is turned off by "
1001  "default since it is not compatible with all computers.\n\n"
1002  "Would you like to try enabling graphics acceleration?\n\n"
1003  "If you'd like to choose later, select Accelerated Graphics "
1004  "in the Preferences menu." );
1005 
1006  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
1007 
1008  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
1009 
1010  if( dlg.ShowModal() == wxID_YES )
1011  {
1012  // Save Cairo as default in case OpenGL crashes
1014 
1015  // Switch to OpenGL, which will save the new setting if successful
1017 
1018  // Switch back to Cairo if OpenGL is not supported
1019  if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
1021  }
1022  else
1023  {
1024  // If they were on legacy, switch to Cairo
1026  }
1027  }
1028 
1030  SaveSettings( config() );
1031  }
1032 }
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
virtual void ReCreateVToolbar()=0
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Definition: base_units.cpp:123
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:61
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
BOX2D GetViewport() const
Function GetViewport() Returns the current viewport visible area rectangle.
Definition: view.cpp:519
void SetDefaultPenSize(int aPenSize)
Definition: ws_draw_item.h:438
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
Definition: ws_draw_item.h:417
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
PROJECT holds project specific data.
Definition: project.h:63
EDA_UNITS GetLastMetricUnits()
Definition: common_tools.h:75
virtual const TITLE_BLOCK & GetTitleBlock() const =0
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
std::vector< wxString > find_history
Definition: app_settings.h:108
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Saves common frame parameters to a configuration data file.
ACTION_TOOLBAR * m_auxiliaryToolBar
This file is part of the common library.
void initExitKey()
Sets the common key-pair for exiting the application (Ctrl-Q) and ties it to the wxID_EXIT event id.
ACTION_TOOLBAR * m_optionsToolBar
virtual bool SwitchBackend(GAL_TYPE aGalType)
Function SwitchBackend Switches method of rendering graphics.
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MENU.
Definition: tool_menu.h:47
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void PrintPage(RENDER_SETTINGS *aSettings)
Print the page pointed by current screen, set by the calling print function.
int GetVirtualPageNumber() const
Definition: base_screen.h:140
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
Definition: ws_draw_item.h:433
static constexpr GAL_TYPE GAL_FALLBACK
void SetLastUnits(EDA_UNITS aUnit)
std::vector< wxSocketBase * > m_sockets
interprocess communication
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
Definition: ws_draw_item.h:425
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
void OnMove(wxMoveEvent &aEvent) override
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
int GetPageCount() const
Definition: base_screen.h:137
wxArrayString m_findStringHistoryList
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:141
void resolveCanvasType()
Determines the Canvas type to load (with prompt if required) and initializes m_canvasType.
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:103
static TOOL_ACTION standardGraphics
Definition: actions.h:169
void ReleaseFile()
Release the current file marked in use.
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void PrintWorkSheet(RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Prints the page layout with the frame and the basic inscriptions.
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_mainToolBar
Definition: color4d.h:45
wxPoint GetNearestGridPosition(const wxPoint &aPosition) const
Return the nearest aGridSize location to aPosition.
EDA_MSG_PANEL is a panel to display various information messages.
Definition: msgpanel.h:104
Sentinel, do not use as a parameter.
The base class for create windows for drawing purpose.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
Definition: ws_draw_item.h:457
#define DEFAULT_MAX_UNDO_ITEMS
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout,...
Definition: title_block.h:40
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:122
wxChoice * m_gridSelectBox
virtual void LoadSettings()
Load new settings from program common settings
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
std::vector< double > zoom_factors
Definition: app_settings.h:86
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:218
bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:26
Auxiliary rendering target (noncached)
Definition: definitions.h:49
This file contains miscellaneous commonly used macros and functions.
const wxString & GetPageNumber() const
Definition: base_screen.cpp:79
void DisplayUnitsMsg()
Display current unit pane in the status bar.
EDA_DRAW_PANEL_GAL * m_canvas
GAL display options - this is the frame's interface to setting GAL display options.
void SetMilsToIUfactor(double aMils2Iu)
Set the scalar to convert pages units (mils) to draw/plot units.
Definition: ws_draw_item.h:444
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
Definition: ws_draw_item.h:360
virtual const PAGE_INFO & GetPageSettings() const =0
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:585
void SetIsFirstPage(bool aIsFirstPage)
Set if the page is the first page.
Definition: ws_draw_item.h:465
BASE_SCREEN * m_currentScreen
current used SCREEN
static TOOL_ACTION gridPreset
Definition: actions.h:142
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
FIND_REPLACE m_FindReplace
Definition: app_settings.h:161
#define NULL
void BuildWorkSheetGraphicList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the page layout.
wxArrayString m_replaceStringHistoryList
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition: ui_common.cpp:58
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:571
bool IsGridVisible() const
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
Definition: ws_draw_item.h:470
void WriteConfig(WINDOW_SETTINGS &aCfg)
GRID_SETTINGS grid
Definition: app_settings.h:89
void PrintPageLayout(RENDER_SETTINGS *aSettings, const PAGE_INFO &aPageInfo, const wxString &aFullSheetName, const wxString &aFileName, const TITLE_BLOCK &aTitleBlock, int aSheetCount, const wxString &aPageNumber, double aMils2Iu, const PROJECT *aProject, const wxString &aSheetLayer, bool aIsFirstPage)
Print the border and title block.
EDA_MSG_PANEL * m_messagePanel
GAL not used (the legacy wxDC engine is used)
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid combobox.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
bool m_showBorderAndTitleBlock
static TOOL_ACTION inchesUnits
Definition: actions.h:147
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: eda_item.h:283
BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
coord_type GetWidth() const
Definition: box2.h:197
wxChoice * m_zoomSelectBox
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:151
std::vector< wxString > replace_history
Definition: app_settings.h:110
ACTIONS * m_actions
Definition: tools_holder.h:49
virtual WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg)
Returns a pointer to the window settings for this frame.
void ReadCommonConfig(COMMON_SETTINGS &aCommonSettings, wxWindow *aWindow)
Read GAL config options from the common config store.
Functions to provide common constants and other functions to assist in making a consistent UI.
wxWindow * findDialog(wxWindowList &aList)
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false)
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
EDA_UNITS GetLastImperialUnits()
Definition: common_tools.h:76
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
int GetMaxUndoItems() const
virtual KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
double GetZoomFactor() const
Get the zoom factor.
wxLogTrace helper definitions.
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
virtual const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const
Returns bbox of document with option to not include some items.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
void EraseMsgBox()
Definition: msgpanel.cpp:210
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
#define FR_HISTORY_LIST_CNT
Maximum size of the find/replace history stacks.
virtual const wxPoint & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
VTBL_ENTRY bool IsNullProject() const
Checks if this project is a null project (i.e.
Definition: project.cpp:134
virtual void ResizeScreen(int aWidth, int aHeight)
Resizes the canvas.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
virtual void ReCreateOptToolbar()=0
static TOOL_ACTION milsUnits
Definition: actions.h:148
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.
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...
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:50
COMMON_TOOLS.
Definition: common_tools.h:38
COLOR_SETTINGS * m_colorSettings
const wxString GetZoomLevelIndicator() const
Return a human readable value for display in dialogs.
void AddSeparator(int aOrder=ANY_ORDER)
Adds a separator to the menu.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxSocketServer * m_socketServer
EDA_UNITS
Definition: eda_units.h:38
const VECTOR2D & GetGridSize() const
Returns the grid size.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Returns the canvas type stored in the application settings.
WINDOW_SETTINGS m_Window
Definition: app_settings.h:173
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:302
void SetAutoSaveInterval(int aInterval)
void Print(RENDER_SETTINGS *aSettings)
Draws the item list created by BuildWorkSheetGraphicList.
static TOOL_ACTION updateUnits
Definition: actions.h:150
virtual void ReCreateHToolbar()=0
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
see class PGM_BASE
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
double m_scaleFactor
The pixel scale factor (>1 for hi-DPI scaled displays)
#define _(s)
Definition: 3d_actions.cpp:33
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
void setupUnits(APP_SETTINGS_BASE *aCfg)
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:168
static void BuildChoiceList(wxArrayString *aGridsList, APP_SETTINGS_BASE *aCfg, EDA_DRAW_FRAME *aParent)
Definition: grid_menu.cpp:79
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
EDA_UNITS m_userUnits
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
EDA_ITEM is a base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:148
virtual void ReCreateAuxiliaryToolbar()
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
virtual COLOR_SETTINGS * GetColorSettings()
Returns a pointer to the active color theme settings.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
wxFindReplaceData * m_findReplaceData
int GetDefaultPenWidth() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetUserUnits(EDA_UNITS aUnits)
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:76
void OnGridSettings(wxCommandEvent &event)
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
void UpdateStatusBar() override
Update the status bar information.
void OnUpdateSelectZoom(wxUpdateUIEvent &aEvent)
Update the checked item in the zoom combobox.
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:54
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, int aPadding=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:114
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Stores the canvas type in the application settings.
void SetProject(const PROJECT *aProject)
Definition: ws_draw_item.h:402
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
virtual void DisplayGridMsg()
Display current grid size in the status bar.
BASE_SCREEN class implementation.
Message panel definition file.
void FocusOnLocation(const wxPoint &aPos)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
void ToggleUserUnits() override
void PostEvent(const TOOL_EVENT &aEvent)
Puts an event to the event queue to be processed at the end of event processing cycle.
Definition: tool_manager.h:274
static int GetRequiredHeight()
Function GetRequiredHeight returns the required height (in pixels) of a EDA_MSG_PANEL.
Definition: msgpanel.cpp:75
virtual void SetGridVisibility(bool aVisible)
void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
Get the pair or units in current use.
long m_firstRunDialogSetting
void MarkDirty()
Function MarkDirty() Forces redraw of view on the next rendering.
Definition: view.h:596
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
void DisplayToolMsg(const wxString &msg) override
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
virtual void UpdateMsgPanel()
Redraw the message panel.
virtual wxString GetScreenDesc() const
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.
static const wxString productName
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100
ACTION_TOOLBAR * m_drawToolBar
File locking utilities.