2017-02-21 12:42:08 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2016 CERN
|
2021-05-29 16:09:49 +00:00
|
|
|
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-02-21 12:42:08 +00:00
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ACTIONS_H
|
|
|
|
#define __ACTIONS_H
|
|
|
|
|
|
|
|
#include <tool/tool_action.h>
|
2021-06-06 17:26:26 +00:00
|
|
|
#include <tool/tool_event.h>
|
2017-02-21 12:42:08 +00:00
|
|
|
|
2019-06-09 21:57:23 +00:00
|
|
|
#define LEGACY_HK_NAME( x ) x
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Gather all the actions that are shared by tools.
|
2017-02-21 12:42:08 +00:00
|
|
|
*
|
2020-12-27 00:41:04 +00:00
|
|
|
* The instance of a subclass of ACTIONS is created inside of #ACTION_MANAGER object that
|
|
|
|
* registers the actions.
|
2017-02-21 12:42:08 +00:00
|
|
|
*/
|
|
|
|
class ACTIONS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual ~ACTIONS() {};
|
|
|
|
|
2019-05-24 23:36:31 +00:00
|
|
|
// Generic document actions
|
|
|
|
static TOOL_ACTION doNew; // sadly 'new' is a reserved word
|
2019-05-28 13:51:47 +00:00
|
|
|
static TOOL_ACTION newLibrary;
|
2019-06-02 18:58:09 +00:00
|
|
|
static TOOL_ACTION addLibrary;
|
2019-05-24 23:36:31 +00:00
|
|
|
static TOOL_ACTION open;
|
|
|
|
static TOOL_ACTION save;
|
|
|
|
static TOOL_ACTION saveAs;
|
2022-04-24 16:38:34 +00:00
|
|
|
static TOOL_ACTION saveCopy;
|
2019-05-24 23:36:31 +00:00
|
|
|
static TOOL_ACTION saveAll;
|
2019-05-28 13:51:47 +00:00
|
|
|
static TOOL_ACTION revert;
|
2019-05-26 15:36:40 +00:00
|
|
|
static TOOL_ACTION pageSettings;
|
2019-05-24 23:36:31 +00:00
|
|
|
static TOOL_ACTION print;
|
|
|
|
static TOOL_ACTION plot;
|
|
|
|
static TOOL_ACTION quit;
|
|
|
|
|
|
|
|
// Generic edit actions
|
2017-02-06 16:00:51 +00:00
|
|
|
static TOOL_ACTION cancelInteractive;
|
2019-06-21 09:49:27 +00:00
|
|
|
static TOOL_ACTION showContextMenu;
|
2019-05-14 19:21:10 +00:00
|
|
|
static TOOL_ACTION undo;
|
|
|
|
static TOOL_ACTION redo;
|
|
|
|
static TOOL_ACTION cut;
|
|
|
|
static TOOL_ACTION copy;
|
|
|
|
static TOOL_ACTION paste;
|
2019-09-02 18:23:46 +00:00
|
|
|
static TOOL_ACTION pasteSpecial;
|
2020-08-19 22:15:44 +00:00
|
|
|
static TOOL_ACTION selectAll;
|
2019-05-24 23:36:31 +00:00
|
|
|
static TOOL_ACTION duplicate;
|
|
|
|
static TOOL_ACTION doDelete; // sadly 'delete' is a reserved word
|
2019-07-31 12:10:13 +00:00
|
|
|
static TOOL_ACTION deleteTool;
|
2019-05-19 21:04:04 +00:00
|
|
|
|
|
|
|
// Find and Replace
|
2019-05-15 22:49:48 +00:00
|
|
|
static TOOL_ACTION find;
|
2019-05-19 21:04:04 +00:00
|
|
|
static TOOL_ACTION findAndReplace;
|
|
|
|
static TOOL_ACTION findNext;
|
|
|
|
static TOOL_ACTION findNextMarker;
|
|
|
|
static TOOL_ACTION replaceAndFindNext;
|
|
|
|
static TOOL_ACTION replaceAll;
|
|
|
|
static TOOL_ACTION updateFind;
|
2017-02-06 16:00:51 +00:00
|
|
|
|
2020-12-01 22:35:11 +00:00
|
|
|
// RC Lists
|
|
|
|
static TOOL_ACTION prevMarker;
|
|
|
|
static TOOL_ACTION nextMarker;
|
|
|
|
static TOOL_ACTION excludeMarker;
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
// View controls
|
2019-04-11 01:23:34 +00:00
|
|
|
static TOOL_ACTION zoomRedraw;
|
2017-02-20 18:10:20 +00:00
|
|
|
static TOOL_ACTION zoomIn;
|
|
|
|
static TOOL_ACTION zoomOut;
|
|
|
|
static TOOL_ACTION zoomInCenter;
|
|
|
|
static TOOL_ACTION zoomOutCenter;
|
|
|
|
static TOOL_ACTION zoomCenter;
|
|
|
|
static TOOL_ACTION zoomFitScreen;
|
2020-09-11 07:51:00 +00:00
|
|
|
static TOOL_ACTION zoomFitObjects; // Zooms to bbox of items on screen (except page border)
|
2017-02-20 18:10:20 +00:00
|
|
|
static TOOL_ACTION zoomPreset;
|
2017-08-31 02:35:30 +00:00
|
|
|
static TOOL_ACTION zoomTool;
|
2018-09-11 15:28:57 +00:00
|
|
|
static TOOL_ACTION centerContents;
|
2019-05-13 20:42:40 +00:00
|
|
|
static TOOL_ACTION toggleCursor;
|
|
|
|
static TOOL_ACTION toggleCursorStyle;
|
2019-06-02 18:58:09 +00:00
|
|
|
static TOOL_ACTION highContrastMode;
|
2020-07-11 17:40:23 +00:00
|
|
|
static TOOL_ACTION highContrastModeCycle;
|
2022-01-17 11:55:55 +00:00
|
|
|
static TOOL_ACTION toggleBoundingBoxes;
|
2017-02-20 18:10:20 +00:00
|
|
|
|
2019-07-04 20:56:21 +00:00
|
|
|
static TOOL_ACTION refreshPreview; // Similar to a synthetic mouseMoved event, but also
|
|
|
|
// used after a rotate, mirror, etc.
|
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
static TOOL_ACTION pinLibrary;
|
|
|
|
static TOOL_ACTION unpinLibrary;
|
|
|
|
|
2018-10-03 16:26:33 +00:00
|
|
|
/// Cursor control with keyboard
|
|
|
|
static TOOL_ACTION cursorUp;
|
|
|
|
static TOOL_ACTION cursorDown;
|
|
|
|
static TOOL_ACTION cursorLeft;
|
|
|
|
static TOOL_ACTION cursorRight;
|
|
|
|
|
|
|
|
static TOOL_ACTION cursorUpFast;
|
|
|
|
static TOOL_ACTION cursorDownFast;
|
|
|
|
static TOOL_ACTION cursorLeftFast;
|
|
|
|
static TOOL_ACTION cursorRightFast;
|
|
|
|
|
|
|
|
static TOOL_ACTION cursorClick;
|
|
|
|
static TOOL_ACTION cursorDblClick;
|
|
|
|
|
|
|
|
// Panning with keyboard
|
|
|
|
static TOOL_ACTION panUp;
|
|
|
|
static TOOL_ACTION panDown;
|
|
|
|
static TOOL_ACTION panLeft;
|
|
|
|
static TOOL_ACTION panRight;
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
// Grid control
|
|
|
|
static TOOL_ACTION gridFast1;
|
|
|
|
static TOOL_ACTION gridFast2;
|
|
|
|
static TOOL_ACTION gridNext;
|
|
|
|
static TOOL_ACTION gridPrev;
|
|
|
|
static TOOL_ACTION gridSetOrigin;
|
|
|
|
static TOOL_ACTION gridResetOrigin;
|
|
|
|
static TOOL_ACTION gridPreset;
|
2019-05-13 20:42:40 +00:00
|
|
|
static TOOL_ACTION toggleGrid;
|
|
|
|
static TOOL_ACTION gridProperties;
|
|
|
|
|
|
|
|
// Units
|
2020-10-03 23:34:23 +00:00
|
|
|
static TOOL_ACTION inchesUnits;
|
|
|
|
static TOOL_ACTION milsUnits;
|
|
|
|
static TOOL_ACTION millimetersUnits;
|
2020-10-04 16:14:37 +00:00
|
|
|
static TOOL_ACTION updateUnits;
|
2019-05-13 20:42:40 +00:00
|
|
|
static TOOL_ACTION toggleUnits;
|
2019-05-17 11:52:38 +00:00
|
|
|
static TOOL_ACTION togglePolarCoords;
|
2019-05-28 14:39:14 +00:00
|
|
|
static TOOL_ACTION resetLocalCoords;
|
2017-02-20 18:10:20 +00:00
|
|
|
|
2019-06-03 01:46:08 +00:00
|
|
|
// Common Tools
|
|
|
|
static TOOL_ACTION selectionTool;
|
|
|
|
static TOOL_ACTION measureTool;
|
2019-07-15 23:44:01 +00:00
|
|
|
static TOOL_ACTION pickerTool;
|
2019-06-03 01:46:08 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
// Misc
|
2019-06-02 23:17:27 +00:00
|
|
|
static TOOL_ACTION show3DViewer;
|
2019-06-04 18:46:52 +00:00
|
|
|
static TOOL_ACTION showSymbolBrowser;
|
2019-06-06 11:45:28 +00:00
|
|
|
static TOOL_ACTION showSymbolEditor;
|
2019-06-04 18:46:52 +00:00
|
|
|
static TOOL_ACTION showFootprintBrowser;
|
2019-06-06 11:45:28 +00:00
|
|
|
static TOOL_ACTION showFootprintEditor;
|
2019-06-03 13:49:17 +00:00
|
|
|
static TOOL_ACTION updatePcbFromSchematic;
|
2020-01-29 16:33:57 +00:00
|
|
|
static TOOL_ACTION updateSchematicFromPcb;
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2019-06-21 09:49:27 +00:00
|
|
|
// Internal
|
|
|
|
static TOOL_ACTION updateMenu;
|
|
|
|
static TOOL_ACTION activatePointEditor;
|
2020-08-29 22:59:11 +00:00
|
|
|
static TOOL_ACTION changeEditMethod;
|
2021-11-23 20:51:37 +00:00
|
|
|
static TOOL_ACTION updatePreferences;
|
2019-06-21 09:49:27 +00:00
|
|
|
|
2019-06-09 21:57:23 +00:00
|
|
|
// Suite
|
2021-05-29 16:09:49 +00:00
|
|
|
static TOOL_ACTION openPreferences;
|
2019-06-02 23:17:27 +00:00
|
|
|
static TOOL_ACTION configurePaths;
|
|
|
|
static TOOL_ACTION showSymbolLibTable;
|
|
|
|
static TOOL_ACTION showFootprintLibTable;
|
2019-06-09 21:57:23 +00:00
|
|
|
static TOOL_ACTION gettingStarted;
|
|
|
|
static TOOL_ACTION help;
|
|
|
|
static TOOL_ACTION listHotKeys;
|
2021-04-08 17:21:44 +00:00
|
|
|
static TOOL_ACTION donate;
|
2019-06-09 21:57:23 +00:00
|
|
|
static TOOL_ACTION getInvolved;
|
2020-05-25 00:39:15 +00:00
|
|
|
static TOOL_ACTION reportBug;
|
2019-05-28 13:51:47 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Cursor control event types
|
2020-01-10 13:17:35 +00:00
|
|
|
enum CURSOR_EVENT_TYPE { CURSOR_NONE, CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
|
2019-06-21 09:49:27 +00:00
|
|
|
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_RIGHT_CLICK,
|
|
|
|
CURSOR_FAST_MOVE = 0x8000 };
|
2017-02-21 12:42:08 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Remove event modifier flags
|
2019-01-12 01:27:29 +00:00
|
|
|
enum class REMOVE_FLAGS { NORMAL = 0x00, ALT = 0x01, CUT = 0x02 };
|
2017-02-21 12:42:08 +00:00
|
|
|
};
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-27 00:41:04 +00:00
|
|
|
* Gather all the events that are shared by tools.
|
2019-04-21 23:45:34 +00:00
|
|
|
*/
|
|
|
|
class EVENTS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const static TOOL_EVENT SelectedEvent;
|
|
|
|
const static TOOL_EVENT UnselectedEvent;
|
|
|
|
const static TOOL_EVENT ClearedEvent;
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Selected item had a property changed (except movement)
|
2019-05-08 18:56:03 +00:00
|
|
|
const static TOOL_EVENT SelectedItemsModified;
|
2020-08-15 18:18:04 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Selected items were moved, this can be very high frequency on the canvas, use with care
|
2020-08-15 18:18:04 +00:00
|
|
|
const static TOOL_EVENT SelectedItemsMoved;
|
2020-10-25 16:13:25 +00:00
|
|
|
|
2020-12-27 00:41:04 +00:00
|
|
|
///< Used to inform tools that the selection should temporarily be non-editable
|
2020-10-25 16:13:25 +00:00
|
|
|
const static TOOL_EVENT InhibitSelectionEditing;
|
|
|
|
const static TOOL_EVENT UninhibitSelectionEditing;
|
2021-09-05 20:37:52 +00:00
|
|
|
|
|
|
|
///< Used to inform tool that it should display the disambiguation menu
|
|
|
|
const static TOOL_EVENT DisambiguatePoint;
|
2019-04-21 23:45:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __ACTIONS_H
|
|
|
|
|
|
|
|
|