KiCad PCB EDA Suite
pagelayout_editor/onleftclick.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2013 CERN
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 
31 #include <fctsys.h>
32 #include <class_drawpanel.h>
33 #include <common.h>
34 
35 #include <pl_editor_frame.h>
36 #include <pl_editor_id.h>
37 #include <design_tree_frame.h>
38 #include <properties_frame.h>
39 #include <dialog_helpers.h>
41 
42 /* Process the command triggered by the left button of the mouse when a tool
43  * is already selected.
44  */
45 void PL_EDITOR_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
46 {
48 
49  if( item ) // An item is currently in edit: place it
50  {
51  PlaceItem( item );
53  m_canvas->Refresh();
54  return;
55  }
56 
58  WORKSHEET_DATAITEM* newitem = Locate( aPosition );
59 
60  if( newitem == NULL )
61  return;
62 
63  if( newitem != item )
64  {
65  item = newitem;
67  m_canvas->Refresh();
68  }
69 }
70 
71 
72 /* Called on a double click of left mouse button.
73  */
74 void PL_EDITOR_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
75 {
76  // Currently: no nothing
77 }
WORKSHEET_DATAITEM * GetCurItem() const
Function GetCurItem returns the currently selected WORKSHEET_DATAITEM, overriding BASE_SCREEN::GetCur...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void CopyPrmsFromItemToPanel(WORKSHEET_DATAITEM *aItem)
description of graphic items and texts to build a title block
void SelectCell(WORKSHEET_DATAITEM *aItem)
void OnLeftDClick(wxDC *aDC, const wxPoint &aMousePos) override
WORKSHEET_DATAITEM * Locate(const wxPoint &aPosition)
Function Locate.
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 OnLeftClick(wxDC *aDC, const wxPoint &aMousePos) override
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
PROPERTIES_FRAME * m_propertiesPagelayout
void PlaceItem(WORKSHEET_DATAITEM *aItem)
Save in Undo list the layout, and place an item being moved.
The common library.
WORKSHEET_DATAITEM * GetPageLayoutSelectedItem() const
DESIGN_TREE_FRAME * m_treePagelayout