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) 2017 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  // the ID_NO_TOOL_SELECTED id TOOL does not existing currently, but the right click
101  // popup menu can generate this event.
102  EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
103 
105  PL_EDITOR_FRAME::Process_Special_Functions )
106 
107  EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::OnUpdateSelectTool )
108 
109  EVT_UPDATE_UI( ID_ZOOM_SELECTION, PL_EDITOR_FRAME::OnUpdateSelectTool )
110  EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
111  EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode )
112 
113 END_EVENT_TABLE()
114 
115 
116 /* Handles the selection of tools, menu, and popup menu commands.
117  */
118 void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
119 {
120  int id = event.GetId();
121  int idx;
122  wxString msg;
124  WORKSHEET_DATAITEM* item = NULL;
125  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
126  cmd.SetEventObject( this );
127 
128  switch( id )
129  {
130  case ID_NO_TOOL_SELECTED:
131  SetNoToolSelected();
132  break;
133 
134  case ID_ZOOM_SELECTION:
135  // This tool is located on the main toolbar: switch it on or off on click
136  if( GetToolId() != ID_ZOOM_SELECTION )
137  SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
138  else
139  SetNoToolSelected();
140  break;
141 
142  case ID_SELECT_PAGE_NUMBER:
143  m_canvas->Refresh();
144  break;
145 
146  case ID_SHEET_SET:
147  {
148  DIALOG_PAGES_SETTINGS dlg( this );
149  dlg.SetWksFileName( GetCurrFileName() );
150  dlg.EnableWksFileNamePicker( false );
151  dlg.ShowModal();
152 
153  cmd.SetId( ID_ZOOM_PAGE );
154  wxPostEvent( this, cmd );
155  }
156  break;
157 
159  break;
160 
163  case wxID_CUT:
164  // Delete item, and select the previous item
165  item = m_treePagelayout->GetPageLayoutSelectedItem();
166 
167  if( item == NULL )
168  break;
169 
170  SaveCopyInUndoList();
171  idx = pglayout.GetItemIndex( item );
172  pglayout.Remove( item );
173  RebuildDesignTree();
174 
176  {
177  item = pglayout.GetItem( (unsigned) (idx-1) );
178 
179  if( item )
180  m_treePagelayout->SelectCell( item );
181  }
182 
183  item = NULL;
184  OnModify();
185  m_canvas->Refresh();
186  break;
187 
189  SaveCopyInUndoList();
190  idx = m_treePagelayout->GetSelectedItemIndex();
191  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_SEGMENT, idx );
192 
193  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
194  {
195  RemoveLastCommandInUndoList();
196  pglayout.Remove( item );
197  RebuildDesignTree();
198  item = NULL;
199  }
200  else
201  {
202  // Put the new item in move mode, after putting the cursor
203  // on the start point:
204  wxPoint position = item->GetStartPosUi();
205  SetCrossHairPosition( position, false );
206  position = GetCrossHairPosition();
207 
208  if( m_canvas->IsPointOnDisplay( position ) )
209  m_canvas->MoveCursorToCrossHair();
210  else
211  RedrawScreen( position, true );
212 
213  item->SetFlags( NEW_ITEM );
214  MoveItem( item );
215  }
216  break;
217 
219  SaveCopyInUndoList();
220  idx = m_treePagelayout->GetSelectedItemIndex();
221  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_RECT, idx );
222 
223  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
224  {
225  RemoveLastCommandInUndoList();
226  pglayout.Remove( item );
227  RebuildDesignTree();
228  item = NULL;
229  }
230  else
231  {
232  // Put the new item in move mode, after putting the cursor
233  // on the start point:
234  wxPoint position = item->GetStartPosUi();
235  SetCrossHairPosition( position, false );
236  position = GetCrossHairPosition();
237 
238  if( m_canvas->IsPointOnDisplay( position ) )
239  m_canvas->MoveCursorToCrossHair();
240  else
241  RedrawScreen( position, true );
242 
243  item->SetFlags( NEW_ITEM );
244  MoveItem( item );
245  }
246  break;
247 
249  SaveCopyInUndoList();
250  idx = m_treePagelayout->GetSelectedItemIndex();
251  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_TEXT, idx );
252  if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
253  {
254  RemoveLastCommandInUndoList();
255  pglayout.Remove( item );
256  RebuildDesignTree();
257  item = NULL;
258  }
259  else
260  {
261  // Put the new text in move mode:
263  MoveItem( item );
264  }
265  break;
266 
268  SaveCopyInUndoList();
269  idx = m_treePagelayout->GetSelectedItemIndex();
270  item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_BITMAP, idx );
271  if( item && InvokeDialogNewItem( this, item ) == wxID_CANCEL )
272  {
273  RemoveLastCommandInUndoList();
274  pglayout.Remove( item );
275  RebuildDesignTree();
276  item = NULL;
277  }
278  if( item )
279  {
280  // Put the new text in move mode:
282  MoveItem( item );
283  }
284  break;
285 
287  cmd.SetId( ID_APPEND_DESCR_FILE );
288  wxPostEvent( this, cmd );
289  break;
290 
291  case ID_POPUP_ITEM_PLACE:
292  item = GetScreen()->GetCurItem();
293  PlaceItem( item );
294  break;
295 
297  if( m_canvas->IsMouseCaptured() )
298  m_canvas->EndMouseCapture();
299  break;
300 
302  item = m_treePagelayout->GetPageLayoutSelectedItem();
303  // Ensure flags are properly set
304  item->ClearFlags( LOCATE_ENDPOINT );
305  item->SetFlags( LOCATE_STARTPOINT );
306  MoveItem( item );
307  break;
308 
310  item = m_treePagelayout->GetPageLayoutSelectedItem();
311  // Ensure flags are properly set
312  item->ClearFlags( LOCATE_STARTPOINT );
313  item->SetFlags( LOCATE_ENDPOINT );
314  MoveItem( item );
315  break;
316 
317  case ID_POPUP_ITEM_MOVE:
318  item = m_treePagelayout->GetPageLayoutSelectedItem();
320  MoveItem( item );
321  break;
322 
323  default:
324  wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
325  break;
326  }
327 
328  if( item )
329  {
330  OnModify();
331  m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
332  m_treePagelayout->SelectCell( item );
333  }
334 
335 }
336 
337 
338 /*
339  * Function moveItem: called when the mouse cursor is moving
340  * moves the item currently selected (or the start point or the end point)
341  * to the cursor position
342  */
343 DPOINT initialPosition; // The initial position of the item to move, in mm
344 wxPoint initialPositionUi; // The initial position of the item to move, in Ui
345 wxPoint initialCursorPosition; // The initial position of the cursor
346 
347 static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
348 {
349  PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
350  WORKSHEET_DATAITEM *item = screen->GetCurItem();
351 
352  wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
353  wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
354  - ( initialCursorPosition - initialPositionUi );
355  wxPoint previous_position;
356 
357  if( (item->GetFlags() & LOCATE_STARTPOINT) )
358  {
359  previous_position = item->GetStartPosUi();
360  item->MoveStartPointToUi( position );
361  }
362  else if( (item->GetFlags() & LOCATE_ENDPOINT) )
363  {
364  previous_position = item->GetEndPosUi();
365  item->MoveEndPointToUi( position );
366  }
367  else
368  {
369  previous_position = item->GetStartPosUi();
370  item->MoveToUi( position );
371  }
372 
373  // Draw the item item at it's new position, if it is modified,
374  // (does not happen each time the mouse is moved, because the
375  // item is placed on grid)
376  // to avoid useless computation time.
377  if( previous_position != position )
378  aPanel->Refresh();
379 }
380 
381 
382 /*
383  * Function abortMoveItem: called when an item is currently moving,
384  * and when the user aborts the move command.
385  * Restores the initial position of the item
386  */
387 static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
388 {
389  PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
390  WORKSHEET_DATAITEM *item = screen->GetCurItem();
391 
392  if( item->GetFlags() & NEW_ITEM )
393  {
394  PL_EDITOR_FRAME* plframe = (PL_EDITOR_FRAME*) aPanel->GetParent();
395  plframe->RemoveLastCommandInUndoList();
397  pglayout.Remove( item );
398  plframe->RebuildDesignTree();
399  }
400  else
401  {
402  if( (item->GetFlags() & LOCATE_STARTPOINT) )
403  {
404  item->MoveStartPointTo( initialPosition );
405  }
406  else if( (item->GetFlags() & LOCATE_ENDPOINT) )
407  {
408  item->MoveEndPointTo( initialPosition );
409  }
410  else
411  item->MoveTo( initialPosition );
412  }
413 
414  aPanel->SetMouseCapture( NULL, NULL );
415  screen->SetCurItem( NULL );
416  aPanel->Refresh();
417 }
418 
419 
421 {
422  wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
423  initialPosition = aItem->GetStartPos();
424  initialPositionUi = aItem->GetStartPosUi();
425  initialCursorPosition = GetCrossHairPosition();
426 
427  if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
428  {
429  initialPosition = aItem->GetEndPos();
430  initialPositionUi = aItem->GetEndPosUi();
431  }
432 
433  if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
434  {
435  SetCrossHairPosition( initialPositionUi, false );
436  initialCursorPosition = GetCrossHairPosition();
437 
438  if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
439  {
441  m_canvas->Refresh();
442  }
443  else
444  {
445  RedrawScreen( initialCursorPosition, true );
446  }
447  }
448 
450  GetScreen()->SetCurItem( aItem );
451 }
452 
453 
459 {
460  DPOINT currStartPos = aItem->GetStartPos();
461  DPOINT currEndPos = aItem->GetEndPos();
462 
463  aItem->ClearFlags( NEW_ITEM );
464 
465  // Save the curren layout before changes
466  if( (aItem->GetFlags() & LOCATE_STARTPOINT) )
467  {
468  aItem->MoveStartPointTo( initialPosition );
469  }
470  else if( aItem->GetFlags() & LOCATE_ENDPOINT )
471  {
472  aItem->MoveEndPointTo( initialPosition );
473  }
474  else
475  aItem->MoveTo( initialPosition );
476 
478 
479  // Re-place the item
480  aItem->MoveStartPointTo( currStartPos );
481  aItem->MoveEndPointTo( currEndPos );
482 
483  m_canvas->SetMouseCapture( NULL, NULL );
484  GetScreen()->SetCurItem( NULL );
485 }
486 
487 
488 /* called when the user select one of the 4 page corner as corner
489  * reference (or the left top paper corner)
490  */
491 void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
492 {
493  m_originSelectChoice = m_originSelectBox->GetSelection();
494  UpdateStatusBar(); // Update grid origin
495  m_canvas->Refresh();
496 }
497 
498 
500 {
502  m_canvas->Refresh();
503 }
504 
505 
506 void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
507 {
508  Close( true );
509 }
510 
511 
512 void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
513 {
514  wxMessageBox( wxT( "Not yet available" ) );
515 }
516 
517 
518 void PL_EDITOR_FRAME::ToPrinter(wxCommandEvent& event)
519 {
520  // static print data and page setup data, to remember settings during the session
521  static wxPrintData* s_PrintData;
522  static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
523 
524  const PAGE_INFO& pageInfo = GetPageSettings();
525 
526  if( s_PrintData == NULL ) // First print
527  {
528  s_PrintData = new wxPrintData();
529  s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
530  }
531 
532  if( !s_PrintData->Ok() )
533  {
534  wxMessageBox( _( "Error Init Printer info" ) );
535  return;
536  }
537 
538  if( s_pageSetupData == NULL )
539  s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
540 
541  s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
542  s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
543 
544  if( pageInfo.IsCustom() )
545  {
546  if( pageInfo.IsPortrait() )
547  s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
548  Mils2mm( pageInfo.GetHeightMils() ) ) );
549  else
550  s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
551  Mils2mm( pageInfo.GetWidthMils() ) ) );
552  }
553 
554  *s_PrintData = s_pageSetupData->GetPrintData();
555 
556  if( event.GetId() == wxID_PREVIEW )
557  InvokeDialogPrintPreview( this, s_PrintData );
558  else
559  InvokeDialogPrint( this, s_PrintData, s_pageSetupData );
560 }
561 
562 
563 void PL_EDITOR_FRAME::OnTreeSelection( wxTreeEvent& event )
564 {
566 
567  if( item )
569 
570  m_canvas->Refresh();
571 }
572 
573 
574 void PL_EDITOR_FRAME::OnTreeMiddleClick( wxTreeEvent& event )
575 {
576 }
577 
578 
579 extern void AddNewItemsCommand( wxMenu* aMainMenu );
580 
581 
582 void PL_EDITOR_FRAME::OnTreeRightClick( wxTreeEvent& event )
583 {
584  m_treePagelayout->SelectCell( event.GetItem() );
585 
586  wxMenu popMenu;
587  AddNewItemsCommand( &popMenu );
588 
589  popMenu.AppendSeparator();
590  AddMenuItem( &popMenu, ID_POPUP_DESIGN_TREE_ITEM_DELETE, _( "Delete" ),
591  KiBitmap( delete_xpm ) );
592 
593  PopupMenu( &popMenu );
594 }
595 
596 
598 {
599  event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
600 }
601 
602 
604 {
605  event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
606 }
607 
608 
609 void PL_EDITOR_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
610 {
611  aEvent.Check( GetToolId() == aEvent.GetId() );
612 }
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
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:419
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Definition: wxstruct.h:113
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