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  int itmp;
697  if( aCfg->Read( baseCfgName + GridColorEntryKeyword, &itmp ) )
698  SetGridColor( ColorFromInt( itmp ) );
699 
700  aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
701 
702  // m_LastGridSizeId is an offset, expected to be >= 0
703  if( m_LastGridSizeId < 0 )
704  m_LastGridSizeId = 0;
705 
706  m_UndoRedoCountMax = aCfg->Read( baseCfgName + MaxUndoItemsEntry,
707  long( DEFAULT_MAX_UNDO_ITEMS ) );
708 
709  m_galDisplayOptions->ReadConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
710 }
711 
712 
713 void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
714 {
716 
717  wxString baseCfgName = ConfigBaseName();
718 
719  aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
720  aCfg->Write( baseCfgName + GridColorEntryKeyword,
721  GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
722  aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
723 
724  if( GetScreen() )
725  aCfg->Write( baseCfgName + MaxUndoItemsEntry, long( GetScreen()->GetMaxUndoItems() ) );
726 
727  m_galDisplayOptions->WriteConfig( aCfg, baseCfgName + GalDisplayOptionsKeyword );
728 }
729 
730 
731 void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
732  const wxString& textLower,
733  COLOR4D color, int pad )
734 {
735  if( m_messagePanel == NULL )
736  return;
737 
738  m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
739 }
740 
741 
743 {
744  if( m_messagePanel == NULL )
745  return;
746 
748 }
749 
750 
752 {
753  if( m_messagePanel == NULL )
754  return;
755 
756  ClearMsgPanel();
757 
758  for( unsigned i = 0; i < aList.size(); i++ )
759  m_messagePanel->AppendMessage( aList[i] );
760 }
761 
762 
764 {
765  wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
766 
767  MSG_PANEL_ITEMS items;
768  aItem->GetMsgPanelInfo( items );
769  SetMsgPanel( items );
770 }
771 
772 
774 {
775  EDA_ITEM* item = GetScreen()->GetCurItem();
776 
777  if( item )
778  SetMsgPanel( item );
779 }
780 
781 // FIXME: There needs to be a better way for child windows to load preferences.
782 // This function pushes four preferences from a parent window to a child window
783 // i.e. from eeschema to the schematic symbol editor
785 {
787  m_canvas->SetEnableAutoPan( aParentCanvas->GetEnableAutoPan() );
788 }
789 
790 wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) const
791 {
792  return ::CoordinateToString( aValue, aConvertToMils );
793 }
794 
795 wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils ) const
796 {
797  return ::LengthDoubleToString( aValue, aConvertToMils );
798 }
799 
800 
801 bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition,
802  int aExplicitCommand )
803 {
805 
806  if( ( block->GetCommand() != BLOCK_IDLE ) || ( block->GetState() != STATE_NO_BLOCK ) )
807  return false;
808 
809  if( aExplicitCommand == 0 )
810  block->SetCommand( (BLOCK_COMMAND_T) BlockCommand( aKey ) );
811  else
812  block->SetCommand( (BLOCK_COMMAND_T) aExplicitCommand );
813 
814  if( block->GetCommand() == 0 )
815  return false;
816 
817  switch( block->GetCommand() )
818  {
819  case BLOCK_IDLE:
820  break;
821 
822  case BLOCK_MOVE: // Move
823  case BLOCK_DRAG: // Drag (block defined)
824  case BLOCK_DRAG_ITEM: // Drag from a drag item command
825  case BLOCK_COPY: // Copy
826  case BLOCK_COPY_AND_INCREMENT: // Copy and increment relevant references
827  case BLOCK_DELETE: // Delete
828  case BLOCK_SAVE: // Save
829  case BLOCK_ROTATE: // Rotate 90 deg
830  case BLOCK_FLIP: // Flip
831  case BLOCK_ZOOM: // Window Zoom
832  case BLOCK_MIRROR_X:
833  case BLOCK_MIRROR_Y: // mirror
834  case BLOCK_PRESELECT_MOVE: // Move with preselection list
835  block->InitData( m_canvas, aPosition );
836  break;
837 
838  case BLOCK_PASTE:
839  block->InitData( m_canvas, aPosition );
840  block->SetLastCursorPosition( wxPoint( 0, 0 ) );
842 
843  if( block->GetCount() == 0 ) // No data to paste
844  {
845  DisplayError( this, wxT( "No block to paste" ), 20 );
848  return true;
849  }
850 
851  if( !m_canvas->IsMouseCaptured() )
852  {
853  block->ClearItemsList();
854  DisplayError( this,
855  wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
856  return true;
857  }
858 
859  block->SetState( STATE_BLOCK_MOVE );
860  m_canvas->CallMouseCapture( aDC, aPosition, false );
861  break;
862 
863  default:
864  {
865  wxString msg;
866  msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
867  block->GetCommand();
868  DisplayError( this, msg );
869  }
870  break;
871  }
872 
873  block->SetMessageBlock( this );
874  return true;
875 }
876 
877 
878 // I am not seeing a problem with this size yet:
879 static const double MAX_AXIS = INT_MAX - 100;
880 
881 #define VIRT_MIN (-MAX_AXIS/2.0)
882 #define VIRT_MAX (MAX_AXIS/2.0)
883 
884 
885 void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
886 {
887  BASE_SCREEN* screen = GetScreen();
888 
889  if( !screen || !m_canvas )
890  return;
891 
892  double scale = screen->GetScalingFactor();
893 
894  wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
895  aCenterPositionIU.x, aCenterPositionIU.y, scale );
896 
897  // Calculate the portion of the drawing that can be displayed in the
898  // client area at the current zoom level.
899 
900  // visible viewport in device units ~ pixels
901  wxSize clientSizeDU = m_canvas->GetClientSize();
902 
903  // Size of the client window in IU
904  DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
905 
906  // Full drawing or "page" rectangle in internal units
907  DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
908 
909  // Account for scrollbars
910  wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
911  wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
912  wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
913 
914  // The upper left corner of the client rectangle in internal units.
915  double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
916  double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
917 
918  // If drawn around the center, adjust the client rectangle accordingly.
919  if( screen->m_Center )
920  {
921  // half page offset.
922  xIU += pageRectIU.GetWidth() / 2.0;
923  yIU += pageRectIU.GetHeight() / 2.0;
924  }
925 
926  DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
927  wxPoint centerPositionIU;
928 
929  // put "int" limits on the clientRect
930  if( clientRectIU.GetLeft() < VIRT_MIN )
931  clientRectIU.MoveLeftTo( VIRT_MIN );
932  if( clientRectIU.GetTop() < VIRT_MIN )
933  clientRectIU.MoveTopTo( VIRT_MIN );
934  if( clientRectIU.GetRight() > VIRT_MAX )
935  clientRectIU.MoveRightTo( VIRT_MAX );
936  if( clientRectIU.GetBottom() > VIRT_MAX )
937  clientRectIU.MoveBottomTo( VIRT_MAX );
938 
939  centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
940  centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
941 
942  if( screen->m_Center )
943  {
944  centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
945  centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
946  }
947 
948  DSIZE virtualSizeIU;
949 
950  if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
951  {
952  virtualSizeIU.x = pageRectIU.GetSize().x;
953  }
954  else
955  {
956  double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
957  double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
958 
959  if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
960  {
961  if( pageCenterX > clientCenterX )
962  virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
963  else if( pageCenterX < clientCenterX )
964  virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
965  else
966  virtualSizeIU.x = clientRectIU.GetWidth();
967  }
968  else
969  {
970  if( pageCenterX > clientCenterX )
971  virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
972  else if( pageCenterX < clientCenterX )
973  virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
974  else
975  virtualSizeIU.x = pageRectIU.GetWidth();
976  }
977  }
978 
979  if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
980  {
981  virtualSizeIU.y = pageRectIU.GetSize().y;
982  }
983  else
984  {
985  double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
986  double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
987 
988  if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
989  {
990  if( pageCenterY > clientCenterY )
991  virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
992  else if( pageCenterY < clientCenterY )
993  virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
994  else
995  virtualSizeIU.y = clientRectIU.GetHeight();
996  }
997  else
998  {
999  if( pageCenterY > clientCenterY )
1000  virtualSizeIU.y = pageRectIU.GetHeight() +
1001  ( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
1002  else if( pageCenterY < clientCenterY )
1003  virtualSizeIU.y = pageRectIU.GetHeight() +
1004  ( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
1005  else
1006  virtualSizeIU.y = pageRectIU.GetHeight();
1007  }
1008  }
1009 
1010  // put "int" limits on the virtualSizeIU
1011  virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
1012  virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
1013 
1014  if( screen->m_Center )
1015  {
1016  screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
1017  screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
1018  }
1019  else
1020  {
1021  screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
1022  screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
1023  }
1024 
1025  /* Always set scrollbar pixels per unit to 1 unless you want the zoom
1026  * around cursor to jump around. This reported problem occurs when the
1027  * zoom point is not on a pixel per unit increment. If you set the
1028  * pixels per unit to 10, you have potential for the zoom point to
1029  * jump around +/-5 pixels from the nearest grid point.
1030  */
1031  screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
1032 
1033  // Number of scroll bar units for the given zoom level in device units.
1034  double unitsX = virtualSizeIU.x * scale;
1035  double unitsY = virtualSizeIU.y * scale;
1036 
1037  // Store the requested center position for later use
1038  SetScrollCenterPosition( aCenterPositionIU );
1039 
1040  // Calculate the scroll bar position in internal units to place the
1041  // center position at the center of client rectangle.
1042  double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
1043  double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
1044 
1045  // Convert scroll bar position to device units.
1046  posX = KiROUND( posX * scale );
1047  posY = KiROUND( posY * scale );
1048 
1049  if( posX < 0 )
1050  {
1051  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1052  posX = 0;
1053  }
1054 
1055  if( posX > unitsX )
1056  {
1057  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
1058  posX = unitsX;
1059  }
1060 
1061  if( posY < 0 )
1062  {
1063  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1064  posY = 0;
1065  }
1066 
1067  if( posY > unitsY )
1068  {
1069  wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
1070  posY = unitsY;
1071  }
1072 
1073  screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
1074  screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
1075 
1076  wxLogTrace( traceScrollSettings,
1077  wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
1078  virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
1079  screen->m_DrawOrg.x, screen->m_DrawOrg.y,
1081  screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
1082  screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
1083 
1084  bool noRefresh = true;
1085 
1086  m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
1087  screen->m_ScrollPixelsPerUnitY,
1088  screen->m_ScrollbarNumber.x,
1089  screen->m_ScrollbarNumber.y,
1090  screen->m_ScrollbarPos.x,
1091  screen->m_ScrollbarPos.y, noRefresh );
1092 }
1093 
1094 
1095 void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
1096 {
1097  KIGFX::VIEW* view = GetGalCanvas()->GetView();
1098  KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
1099 
1100  // Display the same view after canvas switching
1101  if( aEnable )
1102  {
1103  // Switch to GAL renderer from legacy
1104  if( !m_galCanvasActive )
1105  {
1106  // Set up viewport
1107  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
1108  double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
1109  view->SetScale( zoom );
1111  }
1112 
1113  // Set up grid settings
1114  gal->SetGridVisibility( IsGridVisible() );
1115  gal->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) );
1116  gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
1117 
1118  // Transfer EDA_DRAW_PANEL settings
1121  }
1122  else if( m_galCanvasActive )
1123  {
1124  // Switch to legacy renderer from GAL
1125  double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
1126  // TODO replace it with EDA_DRAW_PANEL_GAL::GetLegacyZoom
1127  m_canvas->SetZoom( 1.0 / ( zoomFactor * view->GetScale() ) );
1128  VECTOR2D center = view->GetCenter();
1129  AdjustScrollBars( wxPoint( center.x, center.y ) );
1130  }
1131 
1132  m_canvas->SetEvtHandlerEnabled( !aEnable );
1133  GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
1134 
1135  // Switch panes
1136  m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
1137  m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
1138  m_auimgr.Update();
1139 
1140  // Reset current tool on switch();
1141  SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
1142 
1143  m_galCanvasActive = aEnable;
1144 }
1145 
1146 //-----< BASE_SCREEN API moved here >--------------------------------------------
1147 
1149 {
1150  // subject to change, borrow from old BASE_SCREEN for now.
1151  if( IsGalCanvasActive() )
1152  {
1154 
1155  return wxPoint( cursor.x, cursor.y );
1156  }
1157  else
1158  {
1159  BASE_SCREEN* screen = GetScreen(); // virtual call
1160  return screen->getCrossHairPosition( aInvertY );
1161  }
1162 }
1163 
1164 
1165 void EDA_DRAW_FRAME::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
1166 {
1167  BASE_SCREEN* screen = GetScreen(); // virtual call
1168  screen->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
1169 }
1170 
1171 
1172 wxPoint EDA_DRAW_FRAME::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
1173 {
1174  BASE_SCREEN* screen = GetScreen(); // virtual call
1175  return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
1176 }
1177 
1178 
1179 wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) const
1180 {
1181  BASE_SCREEN* screen = GetScreen(); // virtual call
1182  return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
1183 }
1184 
1185 
1187 {
1188  BASE_SCREEN* screen = GetScreen(); // virtual call
1189  return screen->getCrossHairScreenPosition();
1190 }
1191 
1192 
1194 {
1195  BASE_SCREEN* screen = GetScreen(); // virtual call
1196  screen->setMousePosition( aPosition );
1197 }
1198 
1199 
1200 wxPoint EDA_DRAW_FRAME::RefPos( bool useMouse ) const
1201 {
1202  BASE_SCREEN* screen = GetScreen(); // virtual call
1203  return screen->refPos( useMouse );
1204 }
1205 
1206 
1208 {
1209  BASE_SCREEN* screen = GetScreen(); // virtual call
1210  return screen->getScrollCenterPosition();
1211 }
1212 
1213 
1215 {
1216  BASE_SCREEN* screen = GetScreen(); // virtual call
1217  screen->setScrollCenterPosition( aPoint );
1218 }
1219 
1220 //-----</BASE_SCREEN API moved here >--------------------------------------------
1221 
1223  const wxPoint &aEvtPos,
1224  wxDC* aDC )
1225 {
1226  wxPoint newpos = GetCrossHairPosition();
1227 
1228  // Redraw the crosshair if it moved
1229  if( aOldPos != newpos )
1230  {
1231  SetCrossHairPosition( aOldPos, false );
1232  m_canvas->CrossHairOff( aDC );
1233  SetCrossHairPosition( newpos, false );
1234  m_canvas->CrossHairOn( aDC );
1235 
1236  if( m_canvas->IsMouseCaptured() )
1237  {
1238 #ifdef USE_WX_OVERLAY
1239  wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
1240  oDC.Clear();
1241  m_canvas->CallMouseCapture( aDC, aEvtPos, false );
1242 #else
1243  m_canvas->CallMouseCapture( aDC, aEvtPos, true );
1244 #endif
1245  }
1246 #ifdef USE_WX_OVERLAY
1247  else
1248  {
1249  m_overlay.Reset();
1250  }
1251 #endif
1252  }
1253 }
1254 
1256  bool aSnapToGrid )
1257 {
1258 
1259  // If requested snap the current position to the grid
1260  if( aSnapToGrid )
1261  *aPos = GetNearestGridPosition( *aPos );
1262 
1263  switch( aHotKey )
1264  {
1265  // All these keys have almost the same treatment
1266  case GR_KB_CTRL | WXK_NUMPAD8:
1267  case GR_KB_CTRL | WXK_UP:
1268  case GR_KB_CTRL | WXK_NUMPAD2:
1269  case GR_KB_CTRL | WXK_DOWN:
1270  case GR_KB_CTRL | WXK_NUMPAD4:
1271  case GR_KB_CTRL | WXK_LEFT:
1272  case GR_KB_CTRL | WXK_NUMPAD6:
1273  case GR_KB_CTRL | WXK_RIGHT:
1274  case WXK_NUMPAD8:
1275  case WXK_UP:
1276  case WXK_NUMPAD2:
1277  case WXK_DOWN:
1278  case WXK_NUMPAD4:
1279  case WXK_LEFT:
1280  case WXK_NUMPAD6:
1281  case WXK_RIGHT:
1282  {
1283  /* Here's a tricky part: when doing cursor key movement, the
1284  * 'previous' point should be taken from memory, *not* from the
1285  * freshly computed position in the event. Otherwise you can't do
1286  * sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
1287  * the automatic motion event generated by cursor warping */
1288  wxRealPoint gridSize = GetScreen()->GetGridSize();
1289  *aPos = GetCrossHairPosition();
1290 
1291  // Bonus: ^key moves faster (x10)
1292  switch( aHotKey )
1293  {
1294  case GR_KB_CTRL|WXK_NUMPAD8:
1295  case GR_KB_CTRL|WXK_UP:
1296  aPos->y -= KiROUND( 10 * gridSize.y );
1297  break;
1298 
1299  case GR_KB_CTRL|WXK_NUMPAD2:
1300  case GR_KB_CTRL|WXK_DOWN:
1301  aPos->y += KiROUND( 10 * gridSize.y );
1302  break;
1303 
1304  case GR_KB_CTRL|WXK_NUMPAD4:
1305  case GR_KB_CTRL|WXK_LEFT:
1306  aPos->x -= KiROUND( 10 * gridSize.x );
1307  break;
1308 
1309  case GR_KB_CTRL|WXK_NUMPAD6:
1310  case GR_KB_CTRL|WXK_RIGHT:
1311  aPos->x += KiROUND( 10 * gridSize.x );
1312  break;
1313 
1314  case WXK_NUMPAD8:
1315  case WXK_UP:
1316  aPos->y -= KiROUND( gridSize.y );
1317  break;
1318 
1319  case WXK_NUMPAD2:
1320  case WXK_DOWN:
1321  aPos->y += KiROUND( gridSize.y );
1322  break;
1323 
1324  case WXK_NUMPAD4:
1325  case WXK_LEFT:
1326  aPos->x -= KiROUND( gridSize.x );
1327  break;
1328 
1329  case WXK_NUMPAD6:
1330  case WXK_RIGHT:
1331  aPos->x += KiROUND( gridSize.x );
1332  break;
1333 
1334  default: /* Can't happen since we entered the statement */
1335  break;
1336  }
1337  m_canvas->MoveCursor( *aPos );
1339  }
1340  break;
1341 
1342  default:
1343  break;
1344  }
1345 }
1346 
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:885
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:882
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.
EDA_COLOR_T ColorFromInt(int aColor)
Checked cast. Use only when necessary (usually I/O)
Definition: colors.h:81
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:881
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:784
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:713
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:801
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 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:563
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:751
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:795
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:731
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:879
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:790
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:742
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:773
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)