kicad/include/tool/actions.h

286 lines
8.9 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2016 CERN
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
* Copyright (C) 2016-2024 KiCad Developers, see AUTHORS.txt for contributors.
* @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>
#include <tool/tool_event.h>
2019-06-09 21:57:23 +00:00
#define LEGACY_HK_NAME( x ) x
/**
2020-12-27 00:41:04 +00:00
* Gather all the actions that are shared by tools.
*
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.
*/
class ACTIONS
{
public:
virtual ~ACTIONS() {};
// Generic document actions
static TOOL_ACTION doNew; // sadly 'new' is a reserved word
static TOOL_ACTION newLibrary;
static TOOL_ACTION addLibrary;
static TOOL_ACTION open;
static TOOL_ACTION save;
static TOOL_ACTION saveAs;
static TOOL_ACTION saveCopy;
static TOOL_ACTION saveAll;
static TOOL_ACTION revert;
static TOOL_ACTION pageSettings;
static TOOL_ACTION print;
static TOOL_ACTION plot;
static TOOL_ACTION quit;
static TOOL_ACTION ddAddLibrary; // for drag and drop lib
// Generic edit actions
static TOOL_ACTION cancelInteractive;
static TOOL_ACTION finishInteractive;
static TOOL_ACTION showContextMenu;
static TOOL_ACTION undo;
static TOOL_ACTION redo;
static TOOL_ACTION cut;
static TOOL_ACTION copy;
static TOOL_ACTION paste;
static TOOL_ACTION pasteSpecial;
static TOOL_ACTION selectAll;
2023-09-06 23:44:39 +00:00
static TOOL_ACTION unselectAll;
static TOOL_ACTION duplicate;
static TOOL_ACTION doDelete; // sadly 'delete' is a reserved word
static TOOL_ACTION deleteTool;
static TOOL_ACTION leftJustify;
static TOOL_ACTION centerJustify;
static TOOL_ACTION rightJustify;
static TOOL_ACTION expandAll;
static TOOL_ACTION collapseAll;
2024-01-15 17:29:55 +00:00
// Tables
static TOOL_ACTION selectRows;
static TOOL_ACTION selectColumns;
static TOOL_ACTION selectTable;
static TOOL_ACTION addRowAbove;
static TOOL_ACTION addRowBelow;
static TOOL_ACTION addColBefore;
static TOOL_ACTION addColAfter;
static TOOL_ACTION deleteRows;
static TOOL_ACTION deleteColumns;
static TOOL_ACTION mergeCells;
static TOOL_ACTION unmergeCells;
static TOOL_ACTION editTable;
2024-01-15 17:29:55 +00:00
// Find and Replace
static TOOL_ACTION showSearch;
static TOOL_ACTION find;
static TOOL_ACTION findAndReplace;
static TOOL_ACTION findNext;
static TOOL_ACTION findPrevious;
static TOOL_ACTION findNextMarker;
static TOOL_ACTION replaceAndFindNext;
static TOOL_ACTION replaceAll;
static TOOL_ACTION updateFind;
// RC Lists
static TOOL_ACTION prevMarker;
static TOOL_ACTION nextMarker;
static TOOL_ACTION excludeMarker;
// View controls
static TOOL_ACTION zoomRedraw;
static TOOL_ACTION zoomIn;
static TOOL_ACTION zoomOut;
static TOOL_ACTION zoomInCenter;
static TOOL_ACTION zoomOutCenter;
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
static TOOL_ACTION zoomInHorizontally;
static TOOL_ACTION zoomOutHorizontally;
static TOOL_ACTION zoomInVertically;
static TOOL_ACTION zoomOutVertically;
static TOOL_ACTION zoomCenter;
static TOOL_ACTION zoomFitScreen;
static TOOL_ACTION zoomFitObjects; // Zooms to bbox of items on screen (except page border)
static TOOL_ACTION zoomPreset;
static TOOL_ACTION zoomTool;
static TOOL_ACTION zoomUndo;
static TOOL_ACTION zoomRedo;
static TOOL_ACTION centerContents;
static TOOL_ACTION toggleCursor;
static TOOL_ACTION toggleCursorStyle;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION highContrastModeCycle;
static TOOL_ACTION toggleBoundingBoxes;
static TOOL_ACTION refreshPreview; // Similar to a synthetic mouseMoved event, but also
// used after a rotate, mirror, etc.
static TOOL_ACTION pinLibrary;
static TOOL_ACTION unpinLibrary;
/// 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;
// Grid control
static TOOL_ACTION gridFast1;
static TOOL_ACTION gridFast2;
static TOOL_ACTION gridFastCycle;
static TOOL_ACTION gridNext;
static TOOL_ACTION gridPrev;
static TOOL_ACTION gridSetOrigin;
static TOOL_ACTION gridResetOrigin;
static TOOL_ACTION gridPreset;
static TOOL_ACTION toggleGrid;
static TOOL_ACTION toggleGridOverrides;
static TOOL_ACTION gridProperties;
static TOOL_ACTION gridOrigin;
// Units
static TOOL_ACTION inchesUnits;
static TOOL_ACTION milsUnits;
static TOOL_ACTION millimetersUnits;
static TOOL_ACTION updateUnits;
static TOOL_ACTION toggleUnits;
static TOOL_ACTION togglePolarCoords;
static TOOL_ACTION resetLocalCoords;
// Common Tools
static TOOL_ACTION selectionTool;
static TOOL_ACTION measureTool;
static TOOL_ACTION pickerTool;
static TOOL_ACTION pickerSubTool;
// Misc
static TOOL_ACTION showProjectManager;
static TOOL_ACTION show3DViewer;
2019-06-04 18:46:52 +00:00
static TOOL_ACTION showSymbolBrowser;
static TOOL_ACTION showSymbolEditor;
2019-06-04 18:46:52 +00:00
static TOOL_ACTION showFootprintBrowser;
static TOOL_ACTION showFootprintEditor;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION updateSchematicFromPcb;
static TOOL_ACTION showProperties;
2019-06-09 21:57:23 +00:00
// Internal
static TOOL_ACTION updateMenu;
static TOOL_ACTION activatePointEditor;
static TOOL_ACTION cycleArcEditMode;
static TOOL_ACTION updatePreferences;
2024-01-15 17:29:55 +00:00
static TOOL_ACTION selectLibTreeColumns;
2019-06-09 21:57:23 +00:00
// Suite
static TOOL_ACTION openPreferences;
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;
2023-10-04 19:42:35 +00:00
static TOOL_ACTION about;
2019-06-09 21:57:23 +00:00
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;
static TOOL_ACTION reportBug;
2020-12-27 00:41:04 +00:00
///< Cursor control event types
enum CURSOR_EVENT_TYPE
{
CURSOR_NONE = 0,
CURSOR_UP,
CURSOR_UP_FAST,
CURSOR_DOWN,
CURSOR_DOWN_FAST,
CURSOR_LEFT,
CURSOR_LEFT_FAST,
CURSOR_RIGHT,
CURSOR_RIGHT_FAST,
CURSOR_CLICK,
CURSOR_DBL_CLICK,
CURSOR_RIGHT_CLICK
};
2020-12-27 00:41:04 +00:00
///< Remove event modifier flags
enum class REMOVE_FLAGS
{
NORMAL = 0x00,
ALT = 0x01,
CUT = 0x02
};
};
/**
2020-12-27 00:41:04 +00:00
* Gather all the events that are shared by tools.
*/
class EVENTS
{
public:
const static TOOL_EVENT PointSelectedEvent;
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 ConnectivityChangedEvent;
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-12-27 00:41:04 +00:00
///< Selected items were moved, this can be very high frequency on the canvas, use with care
const static TOOL_EVENT SelectedItemsMoved;
2020-12-27 00:41:04 +00:00
///< Used to inform tools that the selection should temporarily be non-editable
const static TOOL_EVENT InhibitSelectionEditing;
const static TOOL_EVENT UninhibitSelectionEditing;
///< Used to inform tool that it should display the disambiguation menu
const static TOOL_EVENT DisambiguatePoint;
///< Used for hotkey feedback
const static TOOL_EVENT GridChangedByKeyEvent;
const static TOOL_EVENT ContrastModeChangedByKeyEvent;
const static TOOL_EVENT UndoRedoPreEvent;
const static TOOL_EVENT UndoRedoPostEvent;
};
#endif // __ACTIONS_H