You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB

  1. /**
  2. * @file pagelayout_editor/onleftclick.cpp
  3. * @brief functions called on left or double left click mouse event
  4. */
  5. /*
  6. * This program source code file is part of KiCad, a free EDA CAD application.
  7. *
  8. * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  9. * Copyright (C) 2013 CERN
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, you may find one here:
  23. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  24. * or you may search the http://www.gnu.org website for the version 2 license,
  25. * or you may write to the Free Software Foundation, Inc.,
  26. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  27. */
  28. #include <fctsys.h>
  29. #include <class_drawpanel.h>
  30. #include <common.h>
  31. #include <pl_editor_frame.h>
  32. #include <pl_editor_id.h>
  33. #include <design_tree_frame.h>
  34. #include <properties_frame.h>
  35. #include <dialog_helpers.h>
  36. #include <class_worksheet_dataitem.h>
  37. /* Process the command triggered by the left button of the mouse when a tool
  38. * is already selected.
  39. */
  40. void PL_EDITOR_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
  41. {
  42. WORKSHEET_DATAITEM* item = GetScreen()->GetCurItem();
  43. if( item ) // An item is currently in edit: place it
  44. {
  45. PlaceItem( item );
  46. m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
  47. m_canvas->Refresh();
  48. return;
  49. }
  50. item = m_treePagelayout->GetPageLayoutSelectedItem();
  51. WORKSHEET_DATAITEM* newitem = Locate( aPosition );
  52. if( newitem == NULL )
  53. return;
  54. if( newitem != item )
  55. {
  56. item = newitem;
  57. m_treePagelayout->SelectCell( item );
  58. m_canvas->Refresh();
  59. }
  60. }
  61. /* Called on a double click of left mouse button.
  62. */
  63. void PL_EDITOR_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
  64. {
  65. // Currently: no nothing
  66. }