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
|
2019-04-21 23:45:34 +00:00
|
|
|
* Copyright (C) 2016-2019 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>
|
2017-11-01 11:14:16 +00:00
|
|
|
#include <core/optional.h>
|
2017-02-21 12:42:08 +00:00
|
|
|
|
|
|
|
class TOOL_EVENT;
|
|
|
|
class TOOL_MANAGER;
|
|
|
|
|
2019-06-09 21:57:23 +00:00
|
|
|
#define LEGACY_HK_NAME( x ) x
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* ACTIONS
|
2017-02-21 12:42:08 +00:00
|
|
|
*
|
|
|
|
* Gathers all the actions that are shared by tools. The instance of a subclass of
|
|
|
|
* ACTIONS is created inside of ACTION_MANAGER object that registers the actions.
|
|
|
|
*/
|
|
|
|
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;
|
2019-05-26 15:36:40 +00:00
|
|
|
static TOOL_ACTION saveCopyAs;
|
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;
|
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
|
|
|
|
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;
|
|
|
|
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;
|
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
|
|
|
|
static TOOL_ACTION imperialUnits;
|
|
|
|
static TOOL_ACTION metricUnits;
|
|
|
|
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
|
|
|
static TOOL_ACTION acceleratedGraphics;
|
|
|
|
static TOOL_ACTION standardGraphics;
|
|
|
|
|
2019-06-21 09:49:27 +00:00
|
|
|
// Internal
|
|
|
|
static TOOL_ACTION updateMenu;
|
|
|
|
static TOOL_ACTION activatePointEditor;
|
|
|
|
|
2019-06-09 21:57:23 +00:00
|
|
|
// Suite
|
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;
|
|
|
|
static TOOL_ACTION getInvolved;
|
2020-05-25 00:39:15 +00:00
|
|
|
static TOOL_ACTION reportBug;
|
2019-05-28 13:51:47 +00:00
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2017-11-01 11:14:16 +00:00
|
|
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) = 0;
|
2017-02-21 12:42:08 +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
|
|
|
|
|
|
|
///> 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-01-10 14:31:00 +00:00
|
|
|
* EVENTS
|
2019-04-21 23:45:34 +00:00
|
|
|
*
|
|
|
|
* Gathers all the events that are shared by tools.
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
|
|
|
const static TOOL_EVENT SelectedItemsModified;
|
2019-04-21 23:45:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __ACTIONS_H
|
|
|
|
|
|
|
|
|