common_actions.h 7.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2013 CERN
 * @author Maciej Suminski <maciej.suminski@cern.ch>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#include <tool/tool_action.h>
26 27 28
#include <boost/optional.hpp>

class TOOL_EVENT;
29 30 31 32

/**
 * Class COMMON_ACTIONS
 *
Maciej Suminski's avatar
Maciej Suminski committed
33 34
 * Gathers all the actions that are shared by tools. The instance of COMMON_ACTION is created
 * inside of ACTION_MANAGER object that registers the actions.
35 36 37 38
 */
class COMMON_ACTIONS
{
public:
39
    // Selection Tool
40 41 42
    /// Activation of the selection tool
    static TOOL_ACTION selectionActivate;

43
    /// Select a single item under the cursor position
44
    static TOOL_ACTION selectionCursor;
45 46 47 48

    /// Clears the current selection
    static TOOL_ACTION selectionClear;

49 50 51 52 53 54
    /// Selects an item (specified as the event parameter).
    static TOOL_ACTION selectItem;

    /// Unselects an item (specified as the event parameter).
    static TOOL_ACTION unselectItem;

55
    // Edit Tool
56 57 58
    /// Activation of the edit tool
    static TOOL_ACTION editActivate;

59 60 61 62 63
    /// Rotation of selected objects
    static TOOL_ACTION rotate;

    /// Flipping of selected objects
    static TOOL_ACTION flip;
64 65 66

    /// Activation of the edit tool
    static TOOL_ACTION properties;
67

68 69 70 71 72 73 74 75 76
    /// Activation of the exact move tool
    static TOOL_ACTION moveExact;

    /// Activation of the duplication tool
    static TOOL_ACTION duplicate;

    /// Activation of the duplication tool with incrementing (e.g. pad number)
    static TOOL_ACTION duplicateIncrement;

77 78
    /// Deleting a BOARD_ITEM
    static TOOL_ACTION remove;
79

80
    // Drawing Tool
81
    /// Activation of the drawing tool (line)
82 83 84 85
    static TOOL_ACTION drawLine;

    /// Activation of the drawing tool (circle)
    static TOOL_ACTION drawCircle;
86 87 88

    /// Activation of the drawing tool (arc)
    static TOOL_ACTION drawArc;
89 90

    /// Activation of the drawing tool (text)
91
    static TOOL_ACTION placeText;
92 93 94

    /// Activation of the drawing tool (dimension)
    static TOOL_ACTION drawDimension;
95

96 97 98
    /// Activation of the drawing tool (drawing a ZONE)
    static TOOL_ACTION drawZone;

99 100 101
    /// Activation of the drawing tool (drawing a keepout area)
    static TOOL_ACTION drawKeepout;

102 103
    /// Activation of the drawing tool (placing a TARGET)
    static TOOL_ACTION placeTarget;
104 105 106

    /// Activation of the drawing tool (placing a MODULE)
    static TOOL_ACTION placeModule;
107

108 109 110
    /// Activation of the drawing tool (placing a drawing from DXF file)
    static TOOL_ACTION placeDXF;

111 112 113
    /// Activation of the drawing tool (placing the footprint anchor)
    static TOOL_ACTION setAnchor;

114 115 116 117 118 119 120 121 122
    /// Increase width of currently drawn line
    static TOOL_ACTION incWidth;

    /// Decrease width of currently drawn line
    static TOOL_ACTION decWidth;

    /// Switch posture when drawing arc
    static TOOL_ACTION arcPosture;

123
    // Push and Shove Router Tool
124 125 126
    /// Activation of the Push and Shove router
    static TOOL_ACTION routerActivate;

127
    // Point Editor
128 129 130
    /// Update edit points
    static TOOL_ACTION pointEditorUpdate;

131 132 133
    /// Break outline (insert additional points to an edge)
    static TOOL_ACTION pointEditorBreakOutline;

134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
    // Placement tool
    /// Align items to the top edge of selection bounding box
    static TOOL_ACTION alignTop;

    /// Align items to the bottom edge of selection bounding box
    static TOOL_ACTION alignBottom;

    /// Align items to the left edge of selection bounding box
    static TOOL_ACTION alignLeft;

    /// Align items to the right edge of selection bounding box
    static TOOL_ACTION alignRight;

    /// Distributes items evenly along the horizontal axis
    static TOOL_ACTION distributeHorizontally;

    /// Distributes items evenly along the vertical axis
    static TOOL_ACTION distributeVertically;

153 154 155
    // View controls
    static TOOL_ACTION zoomIn;
    static TOOL_ACTION zoomOut;
156 157
    static TOOL_ACTION zoomInCenter;
    static TOOL_ACTION zoomOutCenter;
158 159 160 161 162 163 164
    static TOOL_ACTION zoomCenter;
    static TOOL_ACTION zoomFitScreen;

    // Display modes
    static TOOL_ACTION trackDisplayMode;
    static TOOL_ACTION padDisplayMode;
    static TOOL_ACTION viaDisplayMode;
165 166 167
    static TOOL_ACTION zoneDisplayEnable;
    static TOOL_ACTION zoneDisplayDisable;
    static TOOL_ACTION zoneDisplayOutlines;
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    static TOOL_ACTION highContrastMode;
    static TOOL_ACTION highContrastInc;
    static TOOL_ACTION highContrastDec;

    // Layer control
    static TOOL_ACTION layerTop;
    static TOOL_ACTION layerInner1;
    static TOOL_ACTION layerInner2;
    static TOOL_ACTION layerInner3;
    static TOOL_ACTION layerInner4;
    static TOOL_ACTION layerInner5;
    static TOOL_ACTION layerInner6;
    static TOOL_ACTION layerBottom;
    static TOOL_ACTION layerNext;
    static TOOL_ACTION layerPrev;
    static TOOL_ACTION layerAlphaInc;
    static TOOL_ACTION layerAlphaDec;

186 187
    static TOOL_ACTION layerChanged;        // notification

188 189 190 191 192
    // Grid control
    static TOOL_ACTION gridFast1;
    static TOOL_ACTION gridFast2;
    static TOOL_ACTION gridNext;
    static TOOL_ACTION gridPrev;
193
    static TOOL_ACTION gridSetOrigin;
194 195 196 197 198 199 200

    // Track & via size control
    static TOOL_ACTION trackWidthInc;
    static TOOL_ACTION trackWidthDec;
    static TOOL_ACTION viaSizeInc;
    static TOOL_ACTION viaSizeDec;

201 202
    static TOOL_ACTION trackViaSizeChanged;   // notification

203 204 205 206
    // Zone actions
    static TOOL_ACTION zoneFill;
    static TOOL_ACTION zoneFillAll;
    static TOOL_ACTION zoneUnfill;
207
    static TOOL_ACTION zoneUnfillAll;
208 209 210 211 212

    // Module editor tools
    /// Activation of the drawing tool (placing a PAD)
    static TOOL_ACTION placePad;

213 214 215
    /// Tool for quick pad enumeration
    static TOOL_ACTION enumeratePads;

John Beard's avatar
John Beard committed
216 217 218
    /// Tool for creating an array of objects
    static TOOL_ACTION createArray;

219 220 221 222 223 224
    /// Copying module items to clipboard
    static TOOL_ACTION copyItems;

    /// Pasting module items from clipboard
    static TOOL_ACTION pasteItems;

225 226 227 228 229 230
    /// Display module edges as outlines
    static TOOL_ACTION moduleEdgeOutlines;

    /// Display module texts as outlines
    static TOOL_ACTION moduleTextOutlines;

231
    // Miscellaneous
232
    static TOOL_ACTION selectionTool;
233
    static TOOL_ACTION resetCoords;
234
    static TOOL_ACTION switchCursor;
235 236
    static TOOL_ACTION switchUnits;
    static TOOL_ACTION showHelp;
237
    static TOOL_ACTION toBeDone;
238

239 240 241
    /// Find an item
    static TOOL_ACTION find;

242 243 244
    /// Find an item and start moving
    static TOOL_ACTION findMove;

245 246
    /// Blocks CTRL+F, it is handled by wxWidgets
    static TOOL_ACTION findDummy;
247 248 249 250 251 252 253
    /**
     * Function TranslateLegacyId()
     * Translates legacy tool ids to the corresponding TOOL_ACTION name.
     * @param aId is legacy tool id to be translated.
     * @return std::string is name of the corresponding TOOL_ACTION. It may be empty, if there is
     * no corresponding TOOL_ACTION.
     */
254
    static boost::optional<TOOL_EVENT> TranslateLegacyId( int aId );
255
};