2
* @file pagelayout_editor/onrightclick.cpp
3
* @brief functions called on rigth click mouse event
7
* This program source code file is part of KiCad, a free EDA CAD application.
9
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
10
* Copyright (C) 2013 CERN
11
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
13
* This program is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU General Public License
15
* as published by the Free Software Foundation; either version 2
16
* of the License, or (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program; if not, you may find one here:
25
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
26
* or you may search the http://www.gnu.org website for the version 2 license,
27
* or you may write to the Free Software Foundation, Inc.,
28
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
32
#include <class_drawpanel.h>
33
#include <pl_editor_id.h>
35
#include <pl_editor_frame.h>
36
#include <design_tree_frame.h>
37
#include <properties_frame.h>
38
#include <menus_helpers.h>
39
#include <worksheet_shape_builder.h>
40
#include <class_worksheet_dataitem.h>
44
/* Prepare the right-click pullup menu.
45
* The menu already has a list of zoom commands.
47
bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
49
bool busy = GetScreen()->GetCurItem() != NULL;
52
if( ! busy ) // No item currently edited
54
WORKSHEET_DATAITEM* old_item = m_treePagelayout->GetPageLayoutSelectedItem();
55
WORKSHEET_DATAITEM* item = Locate( aPosition );
57
if( item && old_item != item )
59
m_treePagelayout->SelectCell( item );
63
// Add menus to edit and delete the item
66
if( (item->GetFlags() & LOCATE_STARTPOINT) )
68
msg = AddHotkeyName( _( "Move Start Point" ), s_PlEditor_Hokeys_Descr,
69
HK_MOVE_START_POINT );
70
AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_START_POINT, msg,
71
KiBitmap( move_xpm ) );
74
if( (item->GetFlags() & LOCATE_ENDPOINT ) )
76
msg = AddHotkeyName( _( "Move End Point" ), s_PlEditor_Hokeys_Descr,
78
AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE_END_POINT, msg,
79
KiBitmap( move_xpm ) );
82
msg = AddHotkeyName( _( "Move Item" ), s_PlEditor_Hokeys_Descr,
84
AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, msg,
85
KiBitmap( move_xpm ) );
86
aPopMenu->AppendSeparator();
88
msg = AddHotkeyName( _( "Delete" ), s_PlEditor_Hokeys_Descr,
90
AddMenuItem( aPopMenu, ID_POPUP_ITEM_DELETE, msg, KiBitmap( delete_xpm ) );
91
aPopMenu->AppendSeparator();
94
else // An item is currently in edit
96
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, _( "Place" ),
97
KiBitmap( move_xpm ) );
98
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE_CANCEL, _( "Cancel" ),
99
KiBitmap( cancel_xpm ) );
100
aPopMenu->AppendSeparator();
105
AddMenuItem( aPopMenu, ID_POPUP_ITEM_ADD_LINE, _( "Add line" ),
106
KiBitmap( add_dashed_line_xpm ) );
107
AddMenuItem( aPopMenu, ID_POPUP_ITEM_ADD_RECT, _( "Add rect" ),
108
KiBitmap( add_rectangle_xpm ) );
109
AddMenuItem( aPopMenu, ID_POPUP_ITEM_ADD_TEXT, _( "Add text" ),
110
KiBitmap( add_text_xpm ) );
111
AddMenuItem( aPopMenu, ID_POPUP_ITEM_ADD_POLY, _( "Import poly descr file" ),
112
KiBitmap( add_polygon_xpm ) );
114
aPopMenu->AppendSeparator();