KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
footprint_chooser_selection_tool.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21#include <tool/actions.h>
22#include <tool/tool_event.h>
23#include <tool/tool_manager.h>
24#include <tools/pcb_actions.h>
26
27
29 TOOL_INTERACTIVE( "footprintChooserDummySelectionTool" )
30{
31}
32
33
35{
37 CONDITIONAL_MENU& menu = viewerTools->GetToolMenu().GetMenu();
38
39 menu.AddSeparator( 1 );
42
43 menu.AddSeparator( 10 );
47
48 menu.AddSeparator( 20 );
53
54 return true;
55}
56
57
59{
60 ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
61 CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
62
63 if( conditionalMenu )
64 conditionalMenu->Evaluate( m_selection );
65
66 if( actionMenu )
67 actionMenu->UpdateAll();
68
69 return 0;
70}
71
72
74{
76}
static TOOL_ACTION toggleGrid
Definition: actions.h:198
static TOOL_ACTION millimetersUnits
Definition: actions.h:206
static TOOL_ACTION milsUnits
Definition: actions.h:205
static TOOL_ACTION inchesUnits
Definition: actions.h:204
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION updateMenu
Definition: actions.h:264
Define the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
void UpdateAll()
Run update handlers for the menu and its submenus.
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void Evaluate(const SELECTION &aSelection)
Update the contents of the menu based on the supplied conditions.
void setTransitions() override
Set up handlers for various events.
SELECTION m_selection
Current state of selection (not really used: no selection in display footprints frame).
int UpdateMenu(const TOOL_EVENT &aEvent)
Update the menu to reflect the current tool states.
bool Init() override
Init() is called once upon a registration of the tool.
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:317
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:494
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:497
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:324
Tool useful for viewing footprints.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
Generic, UI-independent tool event.
Definition: tool_event.h:168
T Parameter() const
Return a parameter assigned to the event.
Definition: tool_event.h:465
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
TOOL_MENU & GetToolMenu()
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44