KiCad PCB EDA Suite
events_functions.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) 2013 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
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 
31 #include <fctsys.h>
32 #include <wx/treectrl.h>
33 #include <pgm_base.h>
34 #include <class_drawpanel.h>
35 #include <common.h>
36 #include <macros.h>
37 
38 #include <pl_editor_frame.h>
39 #include <kicad_device_context.h>
40 #include <pl_editor_id.h>
41 #include <dialog_helpers.h>
42 #include <menus_helpers.h>
45 #include <design_tree_frame.h>
46 #include <properties_frame.h>
47 #include <dialog_page_settings.h>
49 
50 
51 BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
52  EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
53 
54  // Desing tree event:
55  EVT_TREE_SEL_CHANGED( ID_DESIGN_TREE_FRAME, PL_EDITOR_FRAME::OnTreeSelection )
56  EVT_TREE_ITEM_MIDDLE_CLICK( ID_DESIGN_TREE_FRAME, PL_EDITOR_FRAME::OnTreeMiddleClick )
57  EVT_TREE_ITEM_RIGHT_CLICK( ID_DESIGN_TREE_FRAME, PL_EDITOR_FRAME::OnTreeRightClick )
58 
59  // Menu Files:
60  EVT_MENU( wxID_NEW, PL_EDITOR_FRAME::Files_io )
61  EVT_MENU( wxID_OPEN, PL_EDITOR_FRAME::Files_io )
62  EVT_MENU( wxID_SAVE, PL_EDITOR_FRAME::Files_io )
63  EVT_MENU( wxID_SAVEAS, PL_EDITOR_FRAME::Files_io )
64  EVT_MENU( wxID_FILE, PL_EDITOR_FRAME::Files_io )
67 
68  EVT_MENU( ID_GEN_PLOT, PL_EDITOR_FRAME::ToPlotter )
69 
70  EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, PL_EDITOR_FRAME::OnFileHistory )
71 
72  EVT_MENU( wxID_EXIT, PL_EDITOR_FRAME::OnQuit )
73 
74  // menu Preferences
77  EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Config )
79  EVT_MENU( ID_MENU_GRID_ONOFF, PL_EDITOR_FRAME::Process_Config )
80 
81  // Menu Help
82  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
83  EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
84  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
85  EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
86 
87  EVT_TOOL( wxID_CUT, PL_EDITOR_FRAME::Process_Special_Functions )
88  EVT_TOOL( wxID_UNDO, PL_EDITOR_FRAME::GetLayoutFromUndoList )
89  EVT_TOOL( wxID_REDO, PL_EDITOR_FRAME::GetLayoutFromRedoList )
90  EVT_TOOL( wxID_PRINT, PL_EDITOR_FRAME::ToPrinter )
91  EVT_TOOL( wxID_PREVIEW, PL_EDITOR_FRAME::ToPrinter )
92  EVT_TOOL( ID_SHEET_SET, PL_EDITOR_FRAME::Process_Special_Functions )
93  EVT_TOOL( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
94  EVT_TOOL( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
95  EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
96  EVT_TOOL( ID_ZOOM_SELECTION, PL_EDITOR_FRAME::Process_Special_Functions )
97  EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
98  EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
99 
100  // Vertical toolbar:
101  EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
102 
104  PL_EDITOR_FRAME::Process_Special_Functions )
105 
106  EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::OnUpdateSelectTool )
107  EVT_UPDATE_UI( ID_ZOOM_SELECTION, PL_EDITOR_FRAME::OnUpdateSelectTool )
108  EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
109  EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode )
110 
111 END_EVENT_TABLE()
112 
113 
114 /* Handles the selection of tools, menu, and popup menu commands.
115  */
116 void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
117 {
118  int id = event.GetId();
119  int idx;
120  wxString msg;
122  WORKSHEET_DATAITEM* item = NULL;
123  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
124  cmd.SetEventObject( this );
125 
126  switch( id )
127  {
128  case ID_NO_TOOL_SELECTED:
129  SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
130  break;
131 
132  case ID_ZOOM_SELECTION:
133  SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
134  break;
135 
136  case ID_SELECT_PAGE_NUMBER:
137  m_canvas->Refresh();
138  break;
139 
140  case ID_SHEET_SET:
141  {
142  DIALOG_PAGES_SETTINGS dlg( this );
143  dlg.SetWksFileName( GetCurrFileName() );
144  dlg.EnableWksFileNamePicker( false );
145  dlg.ShowModal();
146 
147  cmd.SetId( ID_ZOOM_PAGE );
148  wxPostEvent( this, cmd );
149  }
150  break;
151 
153  break;
154 
157  case wxID_CUT:
158  // Delete item, and select the previous item
159  item = m_treePagelayout->GetPageLayoutSelectedItem();
160 
161  if( item == NULL )
162  break;
163 
164  SaveCopyInUndoList();
165  idx = pglayout.GetItemIndex( item );
166  pglayout.Remove( item );
167  RebuildDesignTree();
168 
170  {
171  item = pglayout.GetItem( (unsigned) (idx-1) );
172 
173  if( item )
174  m_treePagelayout->SelectCell( item );
175  }
176 
177  item = NULL;
178  OnModify();
179  m_canvas->Refresh();
180  break;
181 
183  SaveCopyInUndoList();
184  idx = m_treePagelayout->GetSelectedItemIndex();
185  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_SEGMENT, idx );
186 
187  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
188  {
189  RemoveLastCommandInUndoList();
190  pglayout.Remove( item );
191  RebuildDesignTree();
192  item = NULL;
193  }
194  else
195  {
196  // Put the new item in move mode, after putting the cursor
197  // on the start point:
198  wxPoint position = item->GetStartPosUi();
199  SetCrossHairPosition( position, false );
200  position = GetCrossHairPosition();
201 
202  if( m_canvas->IsPointOnDisplay( position ) )
203  m_canvas->MoveCursorToCrossHair();
204  else
205  RedrawScreen( position, true );
206 
207  item->SetFlags( NEW_ITEM );
208  MoveItem( item );
209  }
210  break;
211 
213  SaveCopyInUndoList();
214  idx = m_treePagelayout->GetSelectedItemIndex();
215  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_RECT, idx );
216 
217  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
218  {
219  RemoveLastCommandInUndoList();
220  pglayout.Remove( item );
221  RebuildDesignTree();
222  item = NULL;
223  }
224  else
225  {
226  // Put the new item in move mode, after putting the cursor
227  // on the start point:
228  wxPoint position = item->GetStartPosUi();
229  SetCrossHairPosition( position, false );
230  position = GetCrossHairPosition();
231 
232  if( m_canvas->IsPointOnDisplay( position ) )
233  m_canvas->MoveCursorToCrossHair();
234  else
235  RedrawScreen( position, true );
236 
237  item->SetFlags( NEW_ITEM );
238  MoveItem( item );
239  }
240  break;
241 
243  SaveCopyInUndoList();
244  idx = m_treePagelayout->GetSelectedItemIndex();
245  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_TEXT, idx );
246  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
247  {
248  RemoveLastCommandInUndoList();
249  pglayout.Remove( item );
250  RebuildDesignTree();
251  item = NULL;
252  }
253  else
254  {
255  // Put the new text in move mode:
257  MoveItem( item );
258  }
259  break;
260 
262  SaveCopyInUndoList();
263  idx = m_treePagelayout->GetSelectedItemIndex();
264  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_BITMAP, idx );
265  if( item && InvokeDialogNewItem( this, item ) == wxID_CANCEL )
266  {
267  RemoveLastCommandInUndoList();
268  pglayout.Remove( item );
269  RebuildDesignTree();
270  item = NULL;
271  }
272  if( item )
273  {
274  // Put the new text in move mode:
276  MoveItem( item );
277  }
278  break;
279 
281  cmd.SetId( ID_APPEND_DESCR_FILE );
282  wxPostEvent( this, cmd );
283  break;
284 
285  case ID_POPUP_ITEM_PLACE:
286  item = GetScreen()->GetCurItem();
287  PlaceItem( item );
288  break;
289 
291  if( m_canvas->IsMouseCaptured() )
292  m_canvas->EndMouseCapture();
293  break;
294 
296  item = m_treePagelayout->GetPageLayoutSelectedItem();
297  // Ensure flags are properly set
298  item->ClearFlags( LOCATE_ENDPOINT );
299  item->SetFlags( LOCATE_STARTPOINT );
300  MoveItem( item );
301  break;
302 
304  item = m_treePagelayout->GetPageLayoutSelectedItem();
305  // Ensure flags are properly set
306  item->ClearFlags( LOCATE_STARTPOINT );
307  item->SetFlags( LOCATE_ENDPOINT );
308  MoveItem( item );
309  break;
310 
311  case ID_POPUP_ITEM_MOVE:
312  item = m_treePagelayout->GetPageLayoutSelectedItem();
314  MoveItem( item );
315  break;
316 
317  default:
318  wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
319  break;
320  }
321 
322  if( item )
323  {
324  OnModify();
325  m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
326  m_treePagelayout->SelectCell( item );
327  }
328 
329 }
330 
331 
332 /*
333  * Function moveItem: called when the mouse cursor is moving
334  * moves the item currently selected (or the start point or the end point)
335  * to the cursor position
336  */
337 DPOINT initialPosition; // The initial position of the item to move, in mm
338 wxPoint initialPositionUi; // The initial position of the item to move, in Ui
339 wxPoint initialCursorPosition; // The initial position of the cursor
340 
341 static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
342 {
343  PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
344  WORKSHEET_DATAITEM *item = screen->GetCurItem();
345 
346  wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
347  wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
348  - ( initialCursorPosition - initialPositionUi );
349  wxPoint previous_position;
350 
351  if( (item->GetFlags() & LOCATE_STARTPOINT) )
352  {
353  previous_position = item->GetStartPosUi();
354  item->MoveStartPointToUi( position );
355  }
356  else if( (item->GetFlags() & LOCATE_ENDPOINT) )
357  {
358  previous_position = item->GetEndPosUi();
359  item->MoveEndPointToUi( position );
360  }
361  else
362  {
363  previous_position = item->GetStartPosUi();
364  item->MoveToUi( position );
365  }
366 
367  // Draw the item item at it's new position, if it is modified,
368  // (does not happen each time the mouse is moved, because the
369  // item is placed on grid)
370  // to avoid useless computation time.
371  if( previous_position != position )
372  aPanel->Refresh();
373 }
374 
375 
376 /*
377  * Function abortMoveItem: called when an item is currently moving,
378  * and when the user aborts the move command.
379  * Restores the initial position of the item
380  */
381 static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
382 {
383  PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
384  WORKSHEET_DATAITEM *item = screen->GetCurItem();
385 
386  if( item->GetFlags() & NEW_ITEM )
387  {
388  PL_EDITOR_FRAME* plframe = (PL_EDITOR_FRAME*) aPanel->GetParent();
389  plframe->RemoveLastCommandInUndoList();
391  pglayout.Remove( item );
392  plframe->RebuildDesignTree();
393  }
394  else
395  {
396  if( (item->GetFlags() & LOCATE_STARTPOINT) )
397  {
398  item->MoveStartPointTo( initialPosition );
399  }
400  else if( (item->GetFlags() & LOCATE_ENDPOINT) )
401  {
402  item->MoveEndPointTo( initialPosition );
403  }
404  else
405  item->MoveTo( initialPosition );
406  }
407 
408  aPanel->SetMouseCapture( NULL, NULL );
409  screen->SetCurItem( NULL );
410  aPanel->Refresh();
411 }
412 
413 
415 {
416  wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
417  initialPosition = aItem->GetStartPos();
418  initialPositionUi = aItem->GetStartPosUi();
419  initialCursorPosition = GetCrossHairPosition();
420 
421  if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
422  {
423  initialPosition = aItem->GetEndPos();
424  initialPositionUi = aItem->GetEndPosUi();
425  }
426 
427  if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
428  {
429  SetCrossHairPosition( initialPositionUi, false );
430  initialCursorPosition = GetCrossHairPosition();
431 
432  if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
433  {
435  m_canvas->Refresh();
436  }
437  else
438  {
439  RedrawScreen( initialCursorPosition, true );
440  }
441  }
442 
444  GetScreen()->SetCurItem( aItem );
445 }
446 
447 
453 {
454  DPOINT currStartPos = aItem->GetStartPos();
455  DPOINT currEndPos = aItem->GetEndPos();
456 
457  aItem->ClearFlags( NEW_ITEM );
458 
459  // Save the curren layout before changes
460  if( (aItem->GetFlags() & LOCATE_STARTPOINT) )
461  {
462  aItem->MoveStartPointTo( initialPosition );
463  }
464  else if( aItem->GetFlags() & LOCATE_ENDPOINT )
465  {
466  aItem->MoveEndPointTo( initialPosition );
467  }
468  else
469  aItem->MoveTo( initialPosition );
470 
472 
473  // Re-place the item
474  aItem->MoveStartPointTo( currStartPos );
475  aItem->MoveEndPointTo( currEndPos );
476 
477  m_canvas->SetMouseCapture( NULL, NULL );
478  GetScreen()->SetCurItem( NULL );
479 }
480 
481 
482 /* called when the user select one of the 4 page corner as corner
483  * reference (or the left top paper corner)
484  */
485 void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
486 {
487  m_originSelectChoice = m_originSelectBox->GetSelection();
488  UpdateStatusBar(); // Update grid origin
489  m_canvas->Refresh();
490 }
491 
492 
494 {
496  m_canvas->Refresh();
497 }
498 
499 
500 void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
501 {
502  Close( true );
503 }
504 
505 
506 void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
507 {
508  wxMessageBox( wxT( "Not yet available" ) );
509 }
510 
511 
512 void PL_EDITOR_FRAME::ToPrinter(wxCommandEvent& event)
513 {
514  // static print data and page setup data, to remember settings during the session
515  static wxPrintData* s_PrintData;
516  static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
517 
518  const PAGE_INFO& pageInfo = GetPageSettings();
519 
520  if( s_PrintData == NULL ) // First print
521  {
522  s_PrintData = new wxPrintData();
523  s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
524  }
525 
526  if( !s_PrintData->Ok() )
527  {
528  wxMessageBox( _( "Error Init Printer info" ) );
529  return;
530  }
531 
532  if( s_pageSetupData == NULL )
533  s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
534 
535  s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
536  s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
537 
538  if( pageInfo.IsCustom() )
539  {
540  if( pageInfo.IsPortrait() )
541  s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
542  Mils2mm( pageInfo.GetHeightMils() ) ) );
543  else
544  s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
545  Mils2mm( pageInfo.GetWidthMils() ) ) );
546  }
547 
548  *s_PrintData = s_pageSetupData->GetPrintData();
549 
550  if( event.GetId() == wxID_PREVIEW )
551  InvokeDialogPrintPreview( this, s_PrintData );
552  else
553  InvokeDialogPrint( this, s_PrintData, s_pageSetupData );
554 }
555 
556 
557 void PL_EDITOR_FRAME::OnTreeSelection( wxTreeEvent& event )
558 {
560 
561  if( item )
563 
564  m_canvas->Refresh();
565 }
566 
567 
568 void PL_EDITOR_FRAME::OnTreeMiddleClick( wxTreeEvent& event )
569 {
570 }
571 
572 
573 extern void AddNewItemsCommand( wxMenu* aMainMenu );
574 
575 
576 void PL_EDITOR_FRAME::OnTreeRightClick( wxTreeEvent& event )
577 {
578  m_treePagelayout->SelectCell( event.GetItem() );
579 
580  wxMenu popMenu;
581  AddNewItemsCommand( &popMenu );
582 
583  popMenu.AppendSeparator();
584  AddMenuItem( &popMenu, ID_POPUP_DESIGN_TREE_ITEM_DELETE, _( "Delete" ),
585  KiBitmap( delete_xpm ) );
586 
587  PopupMenu( &popMenu );
588 }
589 
590 
592 {
593  event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
594 }
595 
596 
598 {
599  event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
600 }
601 
602 
603 void PL_EDITOR_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
604 {
605  if( aEvent.GetEventObject() == m_mainToolBar )
606  aEvent.Check( GetToolId() == aEvent.GetId() );
607 }
static wxPrintData * s_PrintData
WORKSHEET_DATAITEM * GetCurItem() const
Function GetCurItem returns the currently selected WORKSHEET_DATAITEM, overriding BASE_SCREEN::GetCur...
EVT_MENU_RANGE(ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, PL_EDITOR_FRAME::Process_Special_Functions) void PL_EDITOR_FRAME
const PAGE_INFO & GetPageSettings() const override
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void RemoveLastCommandInUndoList()
Remove the last command in Undo List.
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:55
void CopyPrmsFromItemToPanel(WORKSHEET_DATAITEM *aItem)
const DPOINT GetStartPos(int ii=0) const
void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
void SetCurItem(WORKSHEET_DATAITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
void OnTreeMiddleClick(wxTreeEvent &event)
int InvokeDialogPrint(PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData, wxPageSetupDialogData *aPageSetupData)
Create and show a print dialog returns 1 if OK, 0 , there is a problem.
void SetWksFileName(const wxString &aFilename)
int InvokeDialogPrintPreview(PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData)
Create and show a print preview dialog returns 1 if OK, 0 , there is a problem.
description of graphic items and texts to build a title block
void MoveEndPointTo(DPOINT aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
void SelectCell(WORKSHEET_DATAITEM *aItem)
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
const wxPoint GetStartPosUi(int ii=0) const
int GetItemIndex(WORKSHEET_DATAITEM *aItem) const
static WORKSHEET_LAYOUT & GetTheInstance()
static function: returns the instance of WORKSHEET_LAYOUT used in the application ...
This file contains miscellaneous commonly used macros and functions.
EVT_MENU(ID_SELECT_PREFERED_PDF_BROWSER_NAME, KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser) EVT_MENU_RANGE(ID_PREFERENCES_HOTKEY_START
void MoveStartPointTo(DPOINT aPosition)
move the starting point of the item to a new position
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
bool IsPointOnDisplay(const wxPoint &aPosition)
Function IsPointOnDisplay.
Definition: draw_panel.cpp:288
void MoveToUi(wxPoint aPosition)
move item to a new position
bool IsPortrait() const
a helper to handle the real device context used in KiCad
WORKSHEET_DATAITEM * GetItem(unsigned aIdx) const
void EnableWksFileNamePicker(bool aEnable)
DPOINT initialPosition
static wxPageSetupDialogData * s_pageSetupData
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool Remove(unsigned aIdx)
Remove the item to the list of items at position aIdx.
void OnSelectCoordOriginCorner(wxCommandEvent &event)
called when the user select one of the 4 page corner as corner reference (or the left top paper corne...
wxPoint initialPositionUi
int Mils2mm(double x)
Convert mils to mm.
Definition: base_units.h:44
void OnUpdateTitleBlockDisplaySpecialMode(wxUpdateUIEvent &event)
void MoveTo(DPOINT aPosition)
move item to a new position
wxPoint initialCursorPosition
const wxPoint GetEndPosUi(int ii=0) const
ID_PREFERENCES_HOTKEY_END
Helper dialog and control classes.
PL_EDITOR_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void ToPrinter(wxCommandEvent &event)
Function ToPrinter Open a dialog frame to print layers.
void OnTreeRightClick(wxTreeEvent &event)
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
int GetWidthMils() const
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
Definition: wxstruct.h:135
WORKSHEET_LAYOUT handles the graphic items list to draw/plot the title block and other items (page re...
void ToPlotter(wxCommandEvent &event)
Function ToPlotter Open a dialog frame to create plot and drill files relative to the current board...
#define NEW_ITEM
#define LOCATE_STARTPOINT
void OnTreeSelection(wxTreeEvent &event)
const DPOINT GetEndPos(int ii=0) const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
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
bool IsCustom() const
Function IsCustom returns true if the type is Custom.
wxPaperSize GetPaperId() const
Function GetPaperId.
see class PGM_BASE
WORKSHEET_DATAITEM * GetSelectedItem()
Function GetSelectedItem.
void OnQuit(wxCommandEvent &event)
Function OnQuit called on request of application quit.
PROPERTIES_FRAME * m_propertiesPagelayout
int GetToolId() const
Definition: draw_frame.h:406
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Definition: wxstruct.h:112
void PlaceItem(WORKSHEET_DATAITEM *aItem)
Save in Undo list the layout, and place an item being moved.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
The common library.
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void RebuildDesignTree()
Function RebuildDesignTree Re creates the design graphic tree list items, and ensures each item has a...
Definition: id.h:96
void MoveItem(WORKSHEET_DATAITEM *aItem)
Initialize a move item command.
classes and function to generate graphics to plt or draw titles blocks and frame references ...
static void moveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
void MoveEndPointToUi(wxPoint aPosition)
move the ending point of the item to a new position has meaning only for items defined by 2 points (s...
void AddNewItemsCommand(wxMenu *aMainMenu)
int InvokeDialogNewItem(PL_EDITOR_FRAME *aCaller, WORKSHEET_DATAITEM *aItem)
Create and show DIALOG_NEW_DATAITEM and return whatever DIALOG_NEW_DATAITEM::ShowModal() returns...
wxPrintOrientation GetWxOrientation() const
Function GetWxOrientation.
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
#define LOCATE_ENDPOINT
void MoveStartPointToUi(wxPoint aPosition)
move the starting point of the item to a new position
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void OnUpdateTitleBlockDisplayNormalMode(wxUpdateUIEvent &event)
void OnSelectTitleBlockDisplayMode(wxCommandEvent &event)
Toggle the display mode between the normal mode and the editor mode: In normal mode, title block texts are shown like they will be shown in other kicad applications: the format symbols in texts are replaced by the actual text.
int GetHeightMils() const
wxChoice * m_originSelectBox
void OnUpdateSelectTool(wxUpdateUIEvent &aEvent)
static void abortMoveItem(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
DESIGN_TREE_FRAME * m_treePagelayout