KiCad PCB EDA Suite
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-2015 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
5  * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2004-2016 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 
30 #include <fctsys.h>
31 #include <pgm_base.h>
32 #include <kiface_i.h>
33 #include <gr_basic.h>
34 #include <common.h>
35 #include <bitmaps.h>
36 #include <macros.h>
37 #include <id.h>
38 #include <class_drawpanel.h>
39 #include <class_draw_panel_gal.h>
40 #include <class_base_screen.h>
41 #include <msgpanel.h>
42 #include <draw_frame.h>
43 #include <confirm.h>
44 #include <kicad_device_context.h>
45 #include <dialog_helpers.h>
46 #include <base_units.h>
47 #include <math/box2.h>
48 #include <lockfile.h>
49 
50 #include <wx/fontdlg.h>
51 #include <wx/snglinst.h>
52 #include <view/view.h>
53 #include <view/view_controls.h>
56 #include <tool/tool_manager.h>
57 #include <tool/tool_dispatcher.h>
58 #include <tool/actions.h>
59 
64 static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
65 
66 
69 
71 static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
73 static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
75 static const wxString LastGridSizeIdKeyword( wxT( "_LastGridSize" ) );
77 static const wxString GalDisplayOptionsKeyword( wxT( "GalDisplayOptions" ) );
78 
80 
94 static const wxString MaxUndoItemsEntry(wxT( "DevelMaxUndoItems" ) );
95 
96 BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
97  EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
98  EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
99  EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
101 
103  EDA_DRAW_FRAME::OnZoom )
104 
106  EDA_DRAW_FRAME::OnSelectGrid )
107 
108  EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnToggleGridState )
110  EDA_DRAW_FRAME::OnSelectUnits )
111 
112  // Cursor shape cannot be implemented on OS X
113 #ifndef __APPLE__
115 #endif // !__APPLE__
116 
118  EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
119  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnUpdateGrid )
120  EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnUpdateCrossHairStyle )
121  EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
122  EDA_DRAW_FRAME::OnUpdateUnits )
123 END_EVENT_TABLE()
124 
125 
126 EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
127  FRAME_T aFrameType,
128  const wxString& aTitle,
129  const wxPoint& aPos, const wxSize& aSize,
130  long aStyle, const wxString & aFrameName ) :
131  KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
132  m_galDisplayOptions( std::make_unique<KIGFX::GAL_DISPLAY_OPTIONS>() )
133 {
134  m_drawToolBar = NULL;
135  m_optionsToolBar = NULL;
136  m_gridSelectBox = NULL;
137  m_zoomSelectBox = NULL;
138  m_hotkeysDescrList = NULL;
139 
140  m_canvas = NULL;
141  m_galCanvas = NULL;
142  m_galCanvasActive = false;
143  m_actions = NULL;
144  m_toolManager = NULL;
145  m_toolDispatcher = NULL;
146  m_messagePanel = NULL;
147  m_currentScreen = NULL;
148  m_toolId = ID_NO_TOOL_SELECTED;
149  m_lastDrawToolId = ID_NO_TOOL_SELECTED;
150  m_showAxis = false; // true to draw axis.
151  m_showBorderAndTitleBlock = false; // true to display reference sheet.
152  m_showGridAxis = false; // true to draw the grid axis
153  m_showOriginAxis = false; // true to draw the grid origin
154  m_LastGridSizeId = 0;
155  m_drawGrid = true; // hide/Show grid. default = show
156  m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
157  m_showPageLimits = false;
158  m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
159  // BLACK for Pcbnew, BLACK or WHITE for eeschema
160  m_snapToGrid = true;
161  m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
162  m_movingCursorWithKeyboard = false;
163  m_zoomLevelCoeff = 1.0;
164 
165  m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);
166 
167  CreateStatusBar( 6 );
168 
169  // set the size of the status bar subwindows:
170 
171  wxWindow* stsbar = GetStatusBar();
172 
173  int dims[] = {
174 
175  // remainder of status bar on far left is set to a default or whatever is left over.
176  -1,
177 
178  // When using GetTextSize() remember the width of character '1' is not the same
179  // as the width of '0' unless the font is fixed width, and it usually won't be.
180 
181  // zoom:
182  GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
183 
184  // cursor coords
185  GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
186 
187  // delta distances
188  GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
189 
190  // units display, Inches is bigger than mm
191  GetTextSize( _( "Inches" ), stsbar ).x + 10,
192 
193  // Size for the panel used as "Current tool in play": will take longest string from
194  // void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
195  GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
196  };
197 
198  SetStatusWidths( DIM( dims ), dims );
199 
200  // Create child subwindows.
201  GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
202  m_FramePos.x = m_FramePos.y = 0;
203  m_FrameSize.y -= m_MsgFrameHeight;
204 
205  m_canvas = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize );
206  m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
207  wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
208 
209  m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
210 }
211 
212 
214 {
215  delete m_actions;
216  delete m_toolManager;
217  delete m_toolDispatcher;
218  delete m_galCanvas;
219 
220  delete m_currentScreen;
221  m_currentScreen = NULL;
222 
223  m_auimgr.UnInit();
224 
225  ReleaseFile();
226 }
227 
228 
230 {
231  m_file_checker = nullptr;
232 }
233 
234 
235 bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
236 {
237  m_file_checker = ::LockFile( aFileName );
238 
239  return bool( m_file_checker );
240 }
241 
242 
244 {
245  UpdateStatusBar();
246  UpdateMsgPanel();
247 }
248 
249 
251 {
252  if( m_messagePanel )
254 }
255 
256 
257 void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
258 {
259  if( m_canvas )
260  m_canvas->SetCanStartBlock( -1 );
261 
262  event.Skip(); // required under wxMAC
263 }
264 
265 
266 void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
267 {
268  if( m_canvas )
269  m_canvas->SetCanStartBlock( -1 );
270 
271  event.Skip();
272 }
273 
274 
276 {
278 }
279 
280 
281 void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
282 {
284 
285  if( IsGalCanvasActive() )
286  {
289  }
290 
291  m_canvas->Refresh();
292 }
293 
294 
295 void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
296 {
297  if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && g_UserUnit != MILLIMETRES )
298  {
301  }
302  else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && g_UserUnit != INCHES )
303  {
304  g_UserUnit = INCHES;
306  }
307 }
308 
309 
310 void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
311 {
313  m_canvas->CrossHairOff( &dc );
314 
315  auto& galOpts = GetGalDisplayOptions();
316  galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
317  galOpts.NotifyChanged();
318 
319  m_canvas->CrossHairOn( &dc );
320 }
321 
322 
323 void EDA_DRAW_FRAME::OnUpdateUndo( wxUpdateUIEvent& aEvent )
324 {
325  if( GetScreen() )
326  aEvent.Enable( GetScreen()->GetUndoCommandCount() > 0 );
327 }
328 
329 
330 void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
331 {
332  if( GetScreen() )
333  aEvent.Enable( GetScreen()->GetRedoCommandCount() > 0 );
334 }
335 
336 
337 void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
338 {
339  bool enable;
340 
341  enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (g_UserUnit == MILLIMETRES))
342  || ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (g_UserUnit == INCHES)) );
343 
344  aEvent.Check( enable );
345  DisplayUnitsMsg();
346 }
347 
348 
349 void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
350 {
351  wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
352 
353  aEvent.Check( IsGridVisible() );
354  m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
355 }
356 
357 
358 void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
359 {
360  aEvent.Check( GetGalDisplayOptions().m_fullscreenCursor );
361 }
362 
363 
365 {
366 }
367 
368 
370 {
371 }
372 
373 
374 bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
375 {
376  return false;
377 }
378 
379 int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName )
380 {
381  int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
382 
383  if( IsGalCanvasActive() )
385 
386  return result;
387 }
388 
389 void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
390 {
391 }
392 
393 
394 void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
395 {
396  wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
397 }
398 
399 
400 void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
401 {
402  int* clientData;
403  int eventId = ID_POPUP_GRID_LEVEL_100;
404 
405  if( event.GetEventType() == wxEVT_CHOICE )
406  {
407  if( m_gridSelectBox == NULL ) // Should not happen
408  return;
409 
410  /*
411  * Don't use wxCommandEvent::GetClientData() here. It always
412  * returns NULL in GTK. This solution is not as elegant but
413  * it works.
414  */
415  int index = m_gridSelectBox->GetSelection();
416  wxASSERT( index != wxNOT_FOUND );
417  clientData = (int*) m_gridSelectBox->wxItemContainer::GetClientData( index );
418 
419  if( clientData != NULL )
420  eventId = *clientData;
421  }
422  else
423  {
424  eventId = event.GetId();
425  }
426 
427  int idx = eventId - ID_POPUP_GRID_LEVEL_1000;
428 
429  // Notify GAL
430  TOOL_MANAGER* mgr = GetToolManager();
431 
432  if( mgr && IsGalCanvasActive() )
433  {
434  mgr->RunAction( "common.Control.gridPreset", true, idx );
435  }
436  else
437  SetPresetGrid( idx );
438 
439  m_canvas->Refresh();
440 }
441 
442 
443 void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
444 {
445  if( m_zoomSelectBox == NULL )
446  return; // Should not happen!
447 
448  int id = m_zoomSelectBox->GetCurrentSelection();
449 
450  if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
451  return;
452 
453  if( id == 0 ) // Auto zoom (Fit in Page)
454  {
455  Zoom_Automatique( true );
456  }
457  else
458  {
459  id--;
460  double selectedZoom = GetScreen()->m_ZoomList[id];
461 
462  if( GetScreen()->GetZoom() == selectedZoom )
463  return;
464 
465  GetScreen()->SetZoom( selectedZoom );
467  }
468 
469  // Notify GAL
470  TOOL_MANAGER* mgr = GetToolManager();
471 
472  if( mgr && IsGalCanvasActive() )
473  {
474  mgr->RunAction( "common.Control.zoomPreset", true, id );
475  UpdateStatusBar();
476  }
477 }
478 
479 
481 {
482  return GetScreen()->GetZoom();
483 }
484 
485 
486 void EDA_DRAW_FRAME::OnMouseEvent( wxMouseEvent& event )
487 {
488  event.Skip();
489 }
490 
491 
492 void EDA_DRAW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
493 {
494 }
495 
496 
497 void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
498 {
499  SetStatusText( msg, 5 );
500 }
501 
502 
504 {
505  wxString msg;
506 
507  switch( g_UserUnit )
508  {
509  case INCHES:
510  msg = _( "Inches" );
511  break;
512 
513  case MILLIMETRES:
514  msg = _( "mm" );
515  break;
516 
517  default:
518  msg = _( "Units" );
519  break;
520  }
521 
522  SetStatusText( msg, 4 );
523 }
524 
525 
526 
527 void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
528 {
529  m_FrameSize = GetClientSize( );
530 
531  SizeEv.Skip();
532 }
533 
534 
535 void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
536 {
537  // Keep default cursor in toolbars
538  SetCursor( wxNullCursor );
539 
540  // Change m_canvas cursor if requested.
541  if( m_canvas && aCursor >= 0 )
542  m_canvas->SetCurrentCursor( aCursor );
543 
544  DisplayToolMsg( aToolMsg );
545 
546  if( aId < 0 )
547  return;
548 
549  wxCHECK2_MSG( aId >= ID_NO_TOOL_SELECTED, aId = ID_NO_TOOL_SELECTED,
550  wxString::Format( wxT( "Current tool ID cannot be set to %d." ), aId ) );
551 
552  m_toolId = aId;
553 }
554 
555 
557 {
558  wxPoint pos = aPosition;
559 
560  if( m_currentScreen != NULL && m_snapToGrid )
561  pos = GetNearestGridPosition( aPosition );
562 
563  return pos;
564 }
565 
566 
568 {
569  BASE_SCREEN * screen = GetScreen();
570 
571  int new_grid_cmd = screen->GetGridCmdId();
572 
573  // if the grid id is the not the last, increment it
574  if( screen->GridExists( new_grid_cmd + 1 ) )
575  new_grid_cmd += 1;
576 
577  SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
578 }
579 
580 
582 {
583  BASE_SCREEN * screen = GetScreen();
584 
585  int new_grid_cmd = screen->GetGridCmdId();
586 
587  // if the grid id is the not the first, increment it
588  if( screen->GridExists( new_grid_cmd - 1 ) )
589  new_grid_cmd -= 1;
590 
591  SetPresetGrid( new_grid_cmd - ID_POPUP_GRID_LEVEL_1000 );
592 }
593 
594 
596 {
597  BASE_SCREEN * screen = GetScreen();
598 
599  if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) )
600  aIndex = screen->GetGrids()[0].m_CmdId;
601 
602  // aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code.
603  // we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId):
604  int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId;
605 
606  if( m_gridSelectBox )
607  {
608  if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() )
609  {
610  wxASSERT_MSG( false, "Invalid grid index" );
611  return;
612  }
613 
614  m_gridSelectBox->SetSelection( glistIdx );
615  }
616 
617  // Be sure m_LastGridSizeId is up to date.
618  m_LastGridSizeId = aIndex;
619  GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 );
620 
621  // Put cursor on new grid
622  SetCrossHairPosition( RefPos( true ) );
623 }
624 
625 
627 {
628  return 0;
629 }
630 
631 
633 {
636 }
637 
638 
640 {
641 }
642 
643 
645 {
646  return false;
647 }
648 
649 
651 {
652  SetStatusText( GetZoomLevelIndicator(), 1 );
653 
654  // Absolute and relative cursor positions are handled by overloading this function and
655  // handling the internal to user units conversion at the appropriate level.
656 
657  // refresh units display
658  DisplayUnitsMsg();
659 }
660 
662 {
663  wxString Line;
664  double level = 0.0;
665 
666  if( IsGalCanvasActive() )
667  {
668  KIGFX::GAL* gal = m_galCanvas->GetGAL();
669  KIGFX::VIEW* view = m_galCanvas->GetView();
670  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
671  level = m_zoomLevelCoeff * zoomFactor * view->GetScale();
672  }
673  else if( BASE_SCREEN* screen = GetScreen() )
674  {
675  level = m_zoomLevelCoeff / (double) screen->GetZoom();
676  }
677 
678  // returns a human readable value which can be displayed as zoom
679  // level indicator in dialogs.
680  Line.Printf( wxT( "Z %.2f" ), level );
681 
682  return Line;
683 }
684 
685 
686 void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
687 {
689 
690  wxString baseCfgName = ConfigBaseName();
691 
692  bool btmp;
693  if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
694  SetGridVisibility( btmp );
695 
696  // Read grid color:
697  COLOR4D wtmp = COLOR4D::UNSPECIFIED;
698 
699  if( wtmp.SetFromWxString( aCfg->Read(
700  baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
701  SetGridColor( wtmp );
702 
703  aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
704 
705  // m_LastGridSizeId is an offset, expected to be >= 0
706  if( m_LastGridSizeId < 0 )
707  m_LastGridSizeId = 0;
708 
709  m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
710  long( DEFAULT_MAX_UNDO_ITEMS ) );
711 
712  m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
713 }
714 
715 
716 void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
717 {
719 
720  wxString baseCfgName = ConfigBaseName();
721 
722  aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
723  aCfg->Write( baseCfgName + GridColorEntryKeyword,
724  GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
725  aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
726 
727  if( GetScreen() )
728  aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
729 
730  m_galDisplayOptions->WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
731 }
732 
733 
734 void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
735  const wxString& textLower,
736  COLOR4D color, int pad )
737 {
738  if( m_messagePanel == NULL )
739  return;
740 
741  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
742 }
743 
744 
746 {
747  if( m_messagePanel == NULL )
748  return;
749 
751 }
752 
753 
755 {
756  if( m_messagePanel == NULL )
757  return;
758 
759  ClearMsgPanel();
760 
761  for( unsigned i = 0; i < aList.size(); i++ )
762  m_messagePanel->AppendMessage( aList[i] );
763 }
764 
765 
767 {
768  wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
769 
770  MSG_PANEL_ITEMS items;
771  aItem->GetMsgPanelInfo( items );
772  SetMsgPanel( items );
773 }
774 
775 
777 {
778  EDA_ITEM* item = GetScreen()->GetCurItem();
779 
780  if( item )
781  SetMsgPanel( item );
782 }
783 
784 // FIXME: There needs to be a better way for child windows to load preferences.
785 // This function pushes four preferences from a parent window to a child window
786 // i.e. from eeschema to the schematic symbol editor
788 {
790  m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
791 }
792 
793 wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) const
794 {
795  return ::CoordinateToString( aValue, aConvertToMils );
796 }
797 
798 wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils ) const
799 {
800  return ::LengthDoubleToString( aValue, aConvertToMils );
801 }
802 
803 
804 bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
805  int aExplicitCommand )
806 {
808 
809  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
810  return false;
811 
812  if( aExplicitCommand == 0 )
813  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
814  else
815  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
816 
817  if( block->GetCommand() == 0 )
818  return false;
819 
820  switch( block->GetCommand() )
821  {
822  case BLOCK_IDLE:
823  break;
824 
825  case BLOCK_MOVE: // Move
826  case BLOCK_DRAG: // Drag (block defined)
827  case BLOCK_DRAG_ITEM: // Drag from a drag item command
828  case BLOCK_COPY: // Copy
829  case BLOCK_COPY_AND_INCREMENT: // Copy and increment relevant references
830  case BLOCK_DELETE: // Delete
831  case BLOCK_SAVE: // Save
832  case BLOCK_ROTATE: // Rotate 90 deg
833  case BLOCK_FLIP: // Flip
834  case BLOCK_ZOOM: // Window Zoom
835  case BLOCK_MIRROR_X:
836  case BLOCK_MIRROR_Y: // mirror
837  case BLOCK_PRESELECT_MOVE: // Move with preselection list
838  block->InitData( m_canvas, aPosition );
839  break;
840 
841  case BLOCK_PASTE:
842  block->InitData( m_canvas, aPosition );
843  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
845 
846  if( block->GetCount() == 0 ) // No data to paste
847  {
848  DisplayError( this, wxT( "No block to paste" ), 20 );
851  return true;
852  }
853 
854  if( !m_canvas->IsMouseCaptured() )
855  {
856  block->ClearItemsList();
857  DisplayError( this,
858  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
859  return true;
860  }
861 
862  block->SetState( STATE_BLOCK_MOVE );
863  m_canvas->CallMouseCapture( aDC, aPosition, false );
864  break;
865 
866  default:
867  {
868  wxString msg;
869  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
870  block->GetCommand();
871  DisplayError( this, msg );
872  }
873  break;
874  }
875 
876  block->SetMessageBlock( this );
877  return true;
878 }
879 
880 
881 // I am not seeing a problem with this size yet:
882 static const double MAX_AXIS = INT_MAX - 100;
883 
884 #define VIRT_MIN (-MAX_AXIS/2.0)
885 #define VIRT_MAX (MAX_AXIS/2.0)
886 
887 
888 void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
889 {
890  BASE_SCREEN* screen = GetScreen();
891 
892  if( !screen || !m_canvas )
893  return;
894 
895  double scale = screen->GetScalingFactor();
896 
897  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
898  aCenterPositionIU.x, aCenterPositionIU.y, scale );
899 
900  // Calculate the portion of the drawing that can be displayed in the
901  // client area at the current zoom level.
902 
903  // visible viewport in device units ~ pixels
904  wxSize clientSizeDU = m_canvas->GetClientSize();
905 
906  // Size of the client window in IU
907  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
908 
909  // Full drawing or "page" rectangle in internal units
910  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
911 
912  // Account for scrollbars
913  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
914  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
915  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
916 
917  // The upper left corner of the client rectangle in internal units.
918  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
919  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
920 
921  // If drawn around the center, adjust the client rectangle accordingly.
922  if( screen->m_Center )
923  {
924  // half page offset.
925  xIU += pageRectIU.GetWidth() / 2.0;
926  yIU += pageRectIU.GetHeight() / 2.0;
927  }
928 
929  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
930  wxPoint centerPositionIU;
931 
932  // put "int" limits on the clientRect
933  if( clientRectIU.GetLeft() < VIRT_MIN )
934  clientRectIU.MoveLeftTo( VIRT_MIN );
935  if( clientRectIU.GetTop() < VIRT_MIN )
936  clientRectIU.MoveTopTo( VIRT_MIN );
937  if( clientRectIU.GetRight() > VIRT_MAX )
938  clientRectIU.MoveRightTo( VIRT_MAX );
939  if( clientRectIU.GetBottom() > VIRT_MAX )
940  clientRectIU.MoveBottomTo( VIRT_MAX );
941 
942  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
943  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
944 
945  if( screen->m_Center )
946  {
947  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
948  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
949  }
950 
951  DSIZE virtualSizeIU;
952 
953  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
954  {
955  virtualSizeIU.x = pageRectIU.GetSize().x;
956  }
957  else
958  {
959  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
960  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
961 
962  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
963  {
964  if( pageCenterX > clientCenterX )
965  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
966  else if( pageCenterX < clientCenterX )
967  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
968  else
969  virtualSizeIU.x = clientRectIU.GetWidth();
970  }
971  else
972  {
973  if( pageCenterX > clientCenterX )
974  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
975  else if( pageCenterX < clientCenterX )
976  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
977  else
978  virtualSizeIU.x = pageRectIU.GetWidth();
979  }
980  }
981 
982  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
983  {
984  virtualSizeIU.y = pageRectIU.GetSize().y;
985  }
986  else
987  {
988  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
989  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
990 
991  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
992  {
993  if( pageCenterY > clientCenterY )
994  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
995  else if( pageCenterY < clientCenterY )
996  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
997  else
998  virtualSizeIU.y = clientRectIU.GetHeight();
999  }
1000  else
1001  {
1002  if( pageCenterY > clientCenterY )
1003  virtualSizeIU.y = pageRectIU.GetHeight() +
1004  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1005  else if( pageCenterY < clientCenterY )
1006  virtualSizeIU.y = pageRectIU.GetHeight() +
1007  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1008  else
1009  virtualSizeIU.y = pageRectIU.GetHeight();
1010  }
1011  }
1012 
1013  // put "int" limits on the virtualSizeIU
1014  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1015  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1016 
1017  if( screen->m_Center )
1018  {
1019  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1020  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1021  }
1022  else
1023  {
1024  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1025  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1026  }
1027 
1028  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1029  * around cursor to jump around. This reported problem occurs when the
1030  * zoom point is not on a pixel per unit increment. If you set the
1031  * pixels per unit to 10, you have potential for the zoom point to
1032  * jump around +/-5 pixels from the nearest grid point.
1033  */
1034  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1035 
1036  // Number of scroll bar units for the given zoom level in device units.
1037  double unitsX = virtualSizeIU.x * scale;
1038  double unitsY = virtualSizeIU.y * scale;
1039 
1040  // Store the requested center position for later use
1041  SetScrollCenterPosition( aCenterPositionIU );
1042 
1043  // Calculate the scroll bar position in internal units to place the
1044  // center position at the center of client rectangle.
1045  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1046  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1047 
1048  // Convert scroll bar position to device units.
1049  posX = KiROUND( posX * scale );
1050  posY = KiROUND( posY * scale );
1051 
1052  if( posX < 0 )
1053  {
1054  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1055  posX = 0;
1056  }
1057 
1058  if( posX > unitsX )
1059  {
1060  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1061  posX = unitsX;
1062  }
1063 
1064  if( posY < 0 )
1065  {
1066  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1067  posY = 0;
1068  }
1069 
1070  if( posY > unitsY )
1071  {
1072  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1073  posY = unitsY;
1074  }
1075 
1076  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1077  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1078 
1079  wxLogTrace( traceScrollSettings,
1080  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1081  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1082  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1084  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1085  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1086 
1087  bool noRefresh = true;
1088 
1089  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1090  screen->m_ScrollPixelsPerUnitY,
1091  screen->m_ScrollbarNumber.x,
1092  screen->m_ScrollbarNumber.y,
1093  screen->m_ScrollbarPos.x,
1094  screen->m_ScrollbarPos.y, noRefresh );
1095 }
1096 
1097 
1098 void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
1099 {
1100  KIGFX::VIEW* view = GetGalCanvas()->GetView();
1101  KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
1102 
1103  // Display the same view after canvas switching
1104  if( aEnable )
1105  {
1106  // Switch to GAL renderer from legacy
1107  if( !m_galCanvasActive )
1108  {
1109  // Set up viewport
1110  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
1111  double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
1112  view->SetScale( zoom );
1114  }
1115 
1116  // Set up grid settings
1117  gal->SetGridVisibility( IsGridVisible() );
1118  gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
1119  gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
1120 
1121  // Transfer EDA_DRAW_PANEL settings
1124  }
1125  else if( m_galCanvasActive )
1126  {
1127  // Switch to legacy renderer from GAL
1128  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
1129  // TODO replace it with EDA_DRAW_PANEL_GAL::GetLegacyZoom
1130  m_canvas->SetZoom( 1.0 / ( zoomFactor * view->GetScale() ) );
1131  VECTOR2D center = view->GetCenter();
1132  AdjustScrollBars( wxPoint( center.x, center.y ) );
1133  }
1134 
1135  m_canvas->SetEvtHandlerEnabled( !aEnable );
1136  GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
1137 
1138  // Switch panes
1139  m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
1140  m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
1141  m_auimgr.Update();
1142 
1143  // Reset current tool on switch();
1144  SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
1145 
1146  m_galCanvasActive = aEnable;
1147 }
1148 
1149 //-----< BASE_SCREEN API moved here >--------------------------------------------
1150 
1152 {
1153  // subject to change, borrow from old BASE_SCREEN for now.
1154  if( IsGalCanvasActive() )
1155  {
1157 
1158  return wxPoint( cursor.x, cursor.y );
1159  }
1160  else
1161  {
1162  BASE_SCREEN* screen = GetScreen(); // virtual call
1163  return screen->getCrossHairPosition( aInvertY );
1164  }
1165 }
1166 
1167 
1168 void EDA_DRAW_FRAME::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
1169 {
1170  BASE_SCREEN* screen = GetScreen(); // virtual call
1171  screen->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
1172 }
1173 
1174 
1175 wxPoint EDA_DRAW_FRAME::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
1176 {
1177  BASE_SCREEN* screen = GetScreen(); // virtual call
1178  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1179 }
1180 
1181 
1182 wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) const
1183 {
1184  BASE_SCREEN* screen = GetScreen(); // virtual call
1185  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1186 }
1187 
1188 
1190 {
1191  BASE_SCREEN* screen = GetScreen(); // virtual call
1192  return screen->getCrossHairScreenPosition();
1193 }
1194 
1195 
1197 {
1198  BASE_SCREEN* screen = GetScreen(); // virtual call
1199  screen->setMousePosition( aPosition );
1200 }
1201 
1202 
1203 wxPoint EDA_DRAW_FRAME::RefPos( bool useMouse ) const
1204 {
1205  BASE_SCREEN* screen = GetScreen(); // virtual call
1206  return screen->refPos( useMouse );
1207 }
1208 
1209 
1211 {
1212  BASE_SCREEN* screen = GetScreen(); // virtual call
1213  return screen->getScrollCenterPosition();
1214 }
1215 
1216 
1218 {
1219  BASE_SCREEN* screen = GetScreen(); // virtual call
1220  screen->setScrollCenterPosition( aPoint );
1221 }
1222 
1223 //-----</BASE_SCREEN API moved here >--------------------------------------------
1224 
1226  const wxPoint &aEvtPos,
1227  wxDC* aDC )
1228 {
1229  wxPoint newpos = GetCrossHairPosition();
1230 
1231  // Redraw the crosshair if it moved
1232  if( aOldPos != newpos )
1233  {
1234  SetCrossHairPosition( aOldPos, false );
1235  m_canvas->CrossHairOff( aDC );
1236  SetCrossHairPosition( newpos, false );
1237  m_canvas->CrossHairOn( aDC );
1238 
1239  if( m_canvas->IsMouseCaptured() )
1240  {
1241 #ifdef USE_WX_OVERLAY
1242  wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
1243  oDC.Clear();
1244  m_canvas->CallMouseCapture( aDC, aEvtPos, false );
1245 #else
1246  m_canvas->CallMouseCapture( aDC, aEvtPos, true );
1247 #endif
1248  }
1249 #ifdef USE_WX_OVERLAY
1250  else
1251  {
1252  m_overlay.Reset();
1253  }
1254 #endif
1255  }
1256 }
1257 
1259  bool aSnapToGrid )
1260 {
1261 
1262  // If requested snap the current position to the grid
1263  if( aSnapToGrid )
1264  *aPos = GetNearestGridPosition( *aPos );
1265 
1266  switch( aHotKey )
1267  {
1268  // All these keys have almost the same treatment
1269  case GR_KB_CTRL | WXK_NUMPAD8:
1270  case GR_KB_CTRL | WXK_UP:
1271  case GR_KB_CTRL | WXK_NUMPAD2:
1272  case GR_KB_CTRL | WXK_DOWN:
1273  case GR_KB_CTRL | WXK_NUMPAD4:
1274  case GR_KB_CTRL | WXK_LEFT:
1275  case GR_KB_CTRL | WXK_NUMPAD6:
1276  case GR_KB_CTRL | WXK_RIGHT:
1277  case WXK_NUMPAD8:
1278  case WXK_UP:
1279  case WXK_NUMPAD2:
1280  case WXK_DOWN:
1281  case WXK_NUMPAD4:
1282  case WXK_LEFT:
1283  case WXK_NUMPAD6:
1284  case WXK_RIGHT:
1285  {
1286  /* Here's a tricky part: when doing cursor key movement, the
1287  * 'previous' point should be taken from memory, *not* from the
1288  * freshly computed position in the event. Otherwise you can't do
1289  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1290  * the automatic motion event generated by cursor warping */
1291  wxRealPoint gridSize = GetScreen()->GetGridSize();
1292  *aPos = GetCrossHairPosition();
1293 
1294  // Bonus: ^key moves faster (x10)
1295  switch( aHotKey )
1296  {
1297  case GR_KB_CTRL|WXK_NUMPAD8:
1298  case GR_KB_CTRL|WXK_UP:
1299  aPos->y -= KiROUND( 10 * gridSize.y );
1300  break;
1301 
1302  case GR_KB_CTRL|WXK_NUMPAD2:
1303  case GR_KB_CTRL|WXK_DOWN:
1304  aPos->y += KiROUND( 10 * gridSize.y );
1305  break;
1306 
1307  case GR_KB_CTRL|WXK_NUMPAD4:
1308  case GR_KB_CTRL|WXK_LEFT:
1309  aPos->x -= KiROUND( 10 * gridSize.x );
1310  break;
1311 
1312  case GR_KB_CTRL|WXK_NUMPAD6:
1313  case GR_KB_CTRL|WXK_RIGHT:
1314  aPos->x += KiROUND( 10 * gridSize.x );
1315  break;
1316 
1317  case WXK_NUMPAD8:
1318  case WXK_UP:
1319  aPos->y -= KiROUND( gridSize.y );
1320  break;
1321 
1322  case WXK_NUMPAD2:
1323  case WXK_DOWN:
1324  aPos->y += KiROUND( gridSize.y );
1325  break;
1326 
1327  case WXK_NUMPAD4:
1328  case WXK_LEFT:
1329  aPos->x -= KiROUND( gridSize.x );
1330  break;
1331 
1332  case WXK_NUMPAD6:
1333  case WXK_RIGHT:
1334  aPos->x += KiROUND( gridSize.x );
1335  break;
1336 
1337  default: /* Can't happen since we entered the statement */
1338  break;
1339  }
1340  m_canvas->MoveCursor( *aPos );
1342  }
1343  break;
1344 
1345  default:
1346  break;
1347  }
1348 }
1349 
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:94
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:117
virtual void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
Definition: draw_frame.cpp:369
#define DIM(x)
of elements in an array
Definition: macros.h:98
const VECTOR2D & GetCenter() const
Function GetCenter() Returns the center point of this VIEW (in world space coordinates) ...
Definition: view.h:316
coord_type GetY() const
Definition: box2.h:179
wxPoint getCursorPosition(bool aOnGrid, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getCursorPosition returns the current cursor position in logical (drawing) units...
double GetZoom()
Definition: draw_panel.cpp:270
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
wxPoint GetScreenCenterLogicalPosition()
Function GetScreenCenterLogicalPosition.
Definition: draw_panel.cpp:339
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_galDisplayOptions
Definition: draw_frame.h:70
void AdjustScrollBars(const wxPoint &aCenterPosition)
Definition: draw_frame.cpp:888
KICAD_MANAGER_FRAME::Process_Config KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser EVT_UPDATE_UI_RANGE(ID_TO_SCH, ID_TO_PCB_FP_EDITOR, KICAD_MANAGER_FRAME::OnUpdateRequiresProject) enum hotkey_id_commnand
void OnToggleCrossHairStyle(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:310
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:87
bool m_galCanvasActive
whether to use new GAL engine
Definition: draw_frame.h:65
void SetCurrentCursor(int aCursor)
Function SetCurrentCursor Set the current cursor shape for drawpanel.
static const wxString MaxUndoItemsEntry(wxT("DevelMaxUndoItems"))
Integer to set the maximum number of undo items on the stack.
wxSize m_ScrollbarNumber
Current virtual draw area size in scroll units.
#define VIRT_MAX
max X or Y coordinate in virtual space
Definition: draw_frame.cpp:885
int m_ScrollPixelsPerUnitY
Pixels per scroll unit in the vertical direction.
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Function GetGalDisplayOptions Returns a reference to the gal rendering options used by GAL for render...
Definition: draw_frame.h:824
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:56
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
virtual const wxString GetZoomLevelIndicator() const
Function GetZoomLevelIndicator returns a human readable value which can be displayed as zoom level in...
Definition: draw_frame.cpp:661
void setScrollCenterPosition(const wxPoint &aPoint)
EDA_ITEM * GetCurItem() const
virtual void HandleBlockPlace(wxDC *DC)
Function HandleBlockPlace( ) Called after HandleBlockEnd, when a block command needs to be executed a...
Definition: draw_frame.cpp:639
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
double GetScalingFactor() const
Function GetScalingFactor returns the inverse of the current scale used to draw items on screen...
Definition: base_screen.cpp:92
bool GetEnableAutoPan() const
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
wxPoint GetGridPosition(const wxPoint &aPosition) const
Function GetGridPosition returns the nearest grid position to aPosition if a screen is defined and sn...
Definition: draw_frame.cpp:556
virtual int BlockCommand(EDA_KEY aKey)
Function BlockCommand Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the...
Definition: draw_frame.cpp:626
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:95
void SetEnableZoomNoCenter(bool aEnable)
Definition: draw_panel.cpp:657
double GetWorldScale() const
Get the world scale.
#define DEFAULT_MAX_UNDO_ITEMS
Definition: draw_frame.h:45
int GetGridCmdId() const
Return the command ID of the currently selected grid.
VIEW_CONTROLS class definition.
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
#define VIRT_MIN
min X or Y coordinate in virtual space
Definition: draw_frame.cpp:884
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
void SetScrollCenterPosition(const wxPoint &aPoint)
wxPoint getCrossHairScreenPosition() const
Function getCursorScreenPosition returns the cross hair position in device (display) units...
void OnMouseEvent(wxMouseEvent &event)
Definition: draw_frame.cpp:486
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: basicframe.cpp:316
void MoveBottomTo(coord_type aBottom)
Definition: box2.h:194
void SetMessageBlock(EDA_DRAW_FRAME *frame)
Function SetMessageBlock Displays the type of block command in the status bar of the window...
virtual bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL)
Definition: draw_frame.cpp:374
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
wxString ConfigBaseName()
Function ConfigBaseName.
Definition: wxstruct.h:255
coord_type GetRight() const
Definition: box2.h:187
const GRIDS & GetGrids() const
Function GetGrids().
BLOCK_COMMAND_T
wxPoint GetCursorPosition(bool aOnGrid, wxRealPoint *aGridSize=NULL) const
Function GetCursorPosition returns the current cursor position in logical (drawing) units...
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
void SetCanStartBlock(int aStartBlock)
void ReleaseFile()
Function ReleaseFile Release the current file marked in use.
Definition: draw_frame.cpp:229
const wxPoint & GetScrollCenterPosition() const
virtual void ToolOnRightClick(wxCommandEvent &event)
Definition: draw_frame.cpp:389
wxAuiManager m_auimgr
Definition: wxstruct.h:139
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void OnMenuOpen(wxMenuEvent &event)
Definition: draw_frame.cpp:266
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:275
virtual void SetGridColor(COLOR4D aColor)
Function SetGridColor() , virtual.
Definition: draw_frame.h:444
EVT_MENU_RANGE(ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EDA_DRAW_FRAME::OnZoom) EVT_MENU_RANGE(ID_POPUP_GRID_LEVEL_1000
void MoveCursor(const wxPoint &aPosition)
Function MoveCursor moves the mouse pointer to aPosition in logical (drawing) units.
Definition: draw_panel.cpp:354
class EDA_MSG_PANEL is a panel to display various information messages.
Definition: msgpanel.h:111
virtual void SetPrevGrid()
Function SetPrevGrid() changes the grid size settings to the previous one available.
Definition: draw_frame.cpp:581
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void SetGridOrigin(const VECTOR2D &aGridOrigin)
Set the origin point for the grid.
void PushPreferences(const EDA_DRAW_PANEL *aParentCanvas)
Function PushPreferences Pushes a few preferences from a parent window to a child window...
Definition: draw_frame.cpp:787
const Vec & GetSize() const
Definition: box2.h:177
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:247
Class BOX2 handles a 2-D bounding box, built on top of an origin point and size vector, both of templated class Vec.
Definition: box2.h:41
wxChoice * m_gridSelectBox
Choice box to choose the grid size.
Definition: draw_frame.h:115
virtual void UseGalCanvas(bool aEnable)
Function UseGalCanvas used to switch between standard and GAL-based canvas.
std::unique_ptr< wxSingleInstanceChecker > m_file_checker
prevents opening same file multiple times.
Definition: draw_frame.h:74
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Definition: draw_frame.cpp:716
virtual void InitBlockPasteInfos()
Definition: draw_frame.cpp:632
coord_type GetTop() const
Definition: box2.h:192
virtual const wxSize GetPageSizeIU() const =0
Function GetPageSizeIU works off of GetPageSettings() to return the size of the paper page in the int...
wxPoint refPos(bool useMouse) const
Function RefPos Return the reference position, coming from either the mouse position or the cursor po...
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:416
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
Definition: draw_frame.cpp:121
Auxiliary rendering target (noncached)
Definition: definitions.h:42
This file contains miscellaneous commonly used macros and functions.
void ClearItemsList()
Function ClearItemsList clear only the list of EDA_ITEM pointers, it does NOT delete the EDA_ITEM obj...
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Function GetTextSize returns the size of aSingleLine of text when it is rendered in aWindow using wha...
Definition: common.cpp:93
void DisplayUnitsMsg()
Function DisplayUnitsMsg displays current unit pane on the status bar.
Definition: draw_frame.cpp:503
void OnUpdateUndo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:323
coord_type GetWidth() const
Definition: box2.h:185
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI(ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected) EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD
void SetState(BLOCK_STATE_T aState)
Class TOOL_MANAGER.
Definition: tool_manager.h:49
virtual bool HandleBlockBegin(wxDC *aDC, EDA_KEY aKey, const wxPoint &aPosition, int aExplicitCommand=0)
Function HandleBlockBegin initializes the block command including the command type, initial position, and other variables.
Definition: draw_frame.cpp:804
void EnableCursorWarping(bool aEnable)
Function EnableCursorWarping() Enables or disables warping the cursor.
void Zoom_Automatique(bool aWarpPointer)
Function Zoom_Automatique redraws the screen with best zoom level and the best centering that shows a...
Definition: zoom.cpp:77
void MoveLeftTo(coord_type aLeft)
Definition: box2.h:195
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
static const wxString GalDisplayOptionsKeyword(wxT("GalDisplayOptions"))
GAL Display Options.
virtual BASE_SCREEN * GetScreen() const
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: draw_frame.h:309
Class LSET is a set of PCB_LAYER_IDs.
a helper to handle the real device context used in KiCad
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:125
void SetCenter(const VECTOR2D &aCenter)
Function SetCenter() Sets the center point of the VIEW (i.e.
Definition: view.cpp:564
EDA_DRAW_FRAME::OnSelectGrid EVT_TOOL_RANGE(ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH, EDA_DRAW_FRAME::OnSelectUnits) EVT_UPDATE_UI_RANGE(ID_TB_OPTIONS_SELECT_UNIT_MM
void OnUpdateRedo(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:330
BASE_SCREEN * m_currentScreen
current used SCREEN
Definition: draw_frame.h:62
virtual void PrintPage(wxDC *aDC, LSET aPrintMask, bool aPrintMirrorMode, void *aData=NULL)
Function PrintPage used to print a page Print the page pointed by current screen, set by the calling ...
Definition: draw_frame.cpp:394
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
wxPoint getCrossHairPosition(bool aInvertY) const
Function getCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:754
void EraseMsgBox()
Definition: draw_frame.cpp:250
wxString LengthDoubleToString(double aValue, bool aConvertToMils=false) const
Function LengthDoubleToString is a helper to convert the double value aValue to a string in inches or...
Definition: draw_frame.cpp:798
wxPoint getNearestGridPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, wxRealPoint *aGridSize) const
Function getNearestGridPosition returns the nearest aGridSize location to aPosition.
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:575
bool m_Center
Center on screen.
bool IsMouseCaptured() const
EDA_MSG_PANEL * m_messagePanel
Panel used to display information at the bottom of the main window.
Definition: draw_frame.h:128
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Definition: common.h:145
wxChoice * m_zoomSelectBox
Choice box to choose the zoom value.
Definition: draw_frame.h:118
virtual void LoadSettings(wxConfigBase *aCfg)
Function LoadSettings loads common frame parameters from a configuration file.
Definition: basicframe.cpp:256
double GetZoom()
Function GetZoom.
Definition: draw_frame.cpp:480
bool GetEnableZoomNoCenter() const
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
coord_type GetBottom() const
Definition: box2.h:188
void SetZoom(double mode)
Definition: draw_panel.cpp:276
static const wxString ShowGridEntryKeyword(wxT("ShowGrid"))
Nonzero to show grid (suffix)
int m_ScrollPixelsPerUnitX
Pixels per scroll unit in the horizontal direction.
virtual void ReCreateAuxiliaryToolbar()
Definition: draw_frame.cpp:364
Helper dialog and control classes.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
uint32_t EDA_KEY
Definition: common.h:52
void OnUpdateUnits(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:337
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:122
void setMousePosition(const wxPoint &aPosition)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:795
virtual void OnSize(wxSizeEvent &event)
Function OnSize recalculates the size of toolbars and display panel when the frame size changes...
Definition: draw_frame.cpp:527
void OnToggleGridState(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:281
const wxPoint & getScrollCenterPosition() const
bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
void SetPresetGrid(int aIndex)
Function SetPresetGrid() changes the grid size to one of the preset values.
Definition: draw_frame.cpp:595
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
void EraseMsgBox()
Definition: msgpanel.cpp:215
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
Definition: draw_frame.cpp:535
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:105
virtual const wxPoint & GetGridOrigin() const =0
Function GetGridOrigin returns the absolute coordinates of the origin of the snap grid...
int m_LastGridSizeId
Definition: draw_frame.h:77
void SetMouseCaptureCallback(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback)
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
virtual void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: base_struct.h:277
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
Definition: solve.cpp:178
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Definition: draw_frame.cpp:686
wxPoint m_ScrollbarPos
Current scroll bar position in scroll units.
void AppendMessage(const wxString &aUpperText, const wxString &aLowerText, COLOR4D aColor, int aPad=6)
Function AppendMessage appends a message to the message panel.
Definition: msgpanel.cpp:110
virtual void SetNextGrid()
Function SetNextGrid() changes the grid size settings to the next one available.
Definition: draw_frame.cpp:567
EDA_DRAW_PANEL_GAL * m_galCanvas
GAL display options - this is the frame's interface to setting GAL display options.
Definition: draw_frame.h:67
static const wxString traceScrollSettings(wxT("KicadScrollSettings"))
Definition for enabling and disabling scroll bar setting trace output.
virtual bool HandleBlockEnd(wxDC *DC)
Function HandleBlockEnd( ) Handle the "end" of a block command, i.e.
Definition: draw_frame.cpp:644
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
static const wxString LastGridSizeIdKeyword(wxT("_LastGridSize"))
Most recently used grid size (suffix)
wxPoint RefPos(bool useMouse) const
Function RefPos Return the reference position, coming from either the mouse position or the cursor po...
coord_type GetHeight() const
Definition: box2.h:186
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:734
void OnUpdateCrossHairStyle(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:358
void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
Function RedrawScreen redraws the entire screen area by updating the scroll bars and mouse pointer in...
Definition: zoom.cpp:46
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:810
void setCrossHairPosition(const wxPoint &aPosition, const wxPoint &aGridOrigin, bool aSnapToGrid)
Function setCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
static const double MAX_AXIS
Definition: draw_frame.cpp:882
double m_zoomLevelCoeff
a suitable value to convert the internal zoom scaling factor
Definition: draw_frame.h:85
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
const int scale
void DisplayToolMsg(const wxString &msg)
Definition: draw_frame.cpp:497
bool GridExists(int aCommandId)
Function GridExists tests for grid command ID (not an index in grid list, but a wxID) exists in grid ...
see class PGM_BASE
virtual void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
Definition: draw_frame.cpp:400
BASE_SCREEN class implementation.
void OnUpdateGrid(wxUpdateUIEvent &aEvent)
Definition: draw_frame.cpp:349
void GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
void SetMousePosition(const wxPoint &aPosition)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
BLOCK_STATE_T GetState() const
bool GetEnableMousewheelPan() const
#define INSTALL_UNBUFFERED_DC(name, parent)
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
wxPoint m_DrawOrg
offsets for drawing the circuit on the screen
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
The common library.
double GetZoomFactor() const
Get the zoom factor.
virtual COLOR4D GetGridColor() const
Function GetGridColor() , virtual.
Definition: draw_frame.h:435
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
double GetScale() const
Function GetScale()
Definition: view.h:265
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL) override
>
Definition: draw_frame.cpp:379
BLOCK_COMMAND_T GetCommand() const
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:426
static const wxString GridColorEntryKeyword(wxT("GridColor"))
Grid color ID (suffix)
wxSize m_FrameSize
Definition: wxstruct.h:130
coord_type GetLeft() const
Definition: box2.h:191
Definition: colors.h:45
void InitData(EDA_DRAW_PANEL *Panel, const wxPoint &startpos)
Function InitData sets the initial values of a BLOCK_SELECTOR, before starting a block command...
void OnSelectUnits(wxCommandEvent &aEvent)
Definition: draw_frame.cpp:295
virtual void unitsChangeRefresh()
Function unitsChangeRefresh is called when when the units setting has changed to allow for any derive...
Definition: draw_frame.cpp:243
Class VIEW.
Definition: view.h:58
wxString CoordinateToString(int aValue, bool aConvertToMils=false) const
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: draw_frame.cpp:793
void MoveTopTo(coord_type aTop)
Definition: box2.h:193
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
int SetGrid(const wxRealPoint &size)
set the current grid size m_Grid.
coord_type GetX() const
Definition: box2.h:178
Message panel definition file.
wxPoint GetCrossHairScreenPosition() const
Function GetCursorScreenPosition returns the cross hair position in device (display) units...
void SetLastCursorPosition(const wxPoint &aPosition)
Function SetLastCursorPosition sets the last cursor position to aPosition.
ACTIONS * m_actions
Definition: draw_frame.h:96
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.cpp:492
#define GR_KB_CTRL
Definition: common.h:64
static int GetRequiredHeight()
Function GetRequiredHeight returns the required height (in pixels) of a EDA_MSG_PANEL.
Definition: msgpanel.cpp:71
void SetEnableAutoPan(bool aEnable)
virtual void UpdateStatusBar()
Function UpdateStatusBar updates the status bar information.
Definition: draw_frame.cpp:650
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
unsigned GetCount() const
virtual void OnActivate(wxActivateEvent &event)
Function OnActivate (virtual) is called when activating the frame.
Definition: draw_frame.cpp:257
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:138
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:745
void UpdateHotKeys()
>
virtual void OnSelectZoom(wxCommandEvent &event)
Functions OnSelectZoom sets the zoom factor when selected by the zoom list box in the main tool bar...
Definition: draw_frame.cpp:443
std::vector< double > m_ZoomList
standard zoom (i.e. scale) coefficients.
bool m_snapToGrid
Indicates if cursor should be snapped to grid.
Definition: draw_frame.h:64
bool LockFile(const wxString &aFileName)
Function LockFile marks a schematic file as being in use.
Definition: draw_frame.cpp:235
void SetCommand(BLOCK_COMMAND_T aCommand)
#define min(a, b)
Definition: auxiliary.h:85
Class GAL is the abstract interface for drawing on a 2D-surface.
virtual void UpdateMsgPanel()
Function UpdateMsgPanel redraws the message panel.
Definition: draw_frame.cpp:776
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void MoveRightTo(coord_type aRight)
Definition: box2.h:196
void SetIgnoreLeftButtonReleaseEvent(bool aIgnore)