Commit Graph

212 Commits

Author SHA1 Message Date
Jeff Young 7a28f3d4cf Implement undo/redo for origins in legacy
PICKED_ITEMS_LIST knows the architecture of the undo commands so
that it can delete those ITEMs which it owns.  This represents poor
encapsulation so instead of adding yet another case, I added a
UR_TRANSIENT item flag which is set by callers whenever they create
new objects to “give to” the undo/redo stack.  This allowed some
cleanup of other code, but cleaning up UR_DELETE and UR_WIRE_IMAGE
will be a bigger task and have to wait for another day.

Fixes: lp:1542018
* https://bugs.launchpad.net/kicad/+bug/1542018
2018-01-27 19:51:44 -05:00
Jeff Young 4784ee7fe4 Implement undo/redo for drill and grid origins.
The undo/redo operations are essentially the same as for
UR_CHANGED: we store both the origin marker item and a copy
of it and flip back and forth between the two.  This also
required the implementation of clone() for the markers.

The ORIGIN_VIEWMARKER is moved from being a subclass of
EDA_ITEM to BOARD_ITEM to facilitate the use of a UR_CHANGE-
like implementation without having to know the internals
of the ORIGIN_VIEWMARKER.

In the command processors, the setting of the origins is
broken into two parts: one for UI-level access which includes
setting up undo, and one for low-level access which does not.
The undo/redo code itself of course uses the lower level.

Fixes: lp:1542018
* https://bugs.launchpad.net/kicad/+bug/1542018
2018-01-27 19:40:51 -05:00
Tomasz Włostowski b76a6210c5 pcbnew: fixed stuck cursor when ForceCursorPosition() is active and cursor is moved by keyboard arrows
Fixes: lp:1729301
* https://bugs.launchpad.net/kicad/+bug/1729301
2017-11-16 00:43:23 +01:00
Tomasz Włostowski 00ad8f24a0 pcbnew: Minor changes in CONNECTIVITY_DATA interface:
- renamed connectivity.[h|cpp] to connectivity_data [.h|.cpp] so that the file name matches the main class name.
- GetNetItems() now returns a vector instead of a list
2017-11-15 18:34:08 +01:00
jean-pierre charras 661bab7220 Fix crash when appending a board in pcbnew.
Fixes: lp:1731539
https://bugs.launchpad.net/kicad/+bug/1731539
2017-11-11 09:09:24 +01:00
Tomasz Włostowski 8a09a1d329 refactoring: derive PCB-specific PCB_VIEW from VIEW with the intention of moving PCB_EDIT_FRAME entries used by the tools (e.g. GetActiveLayer) there 2017-11-03 20:02:06 +01:00
Tomasz Włostowski 81d1e17f02 refactoring: renamed pcbstruct.h to pcb_display_options.h, DISPLAY_OPTIONS->PCB_DISPLAY_OPTIONS 2017-11-03 20:02:06 +01:00
Tomasz Włostowski c6a0ad895b pcbnew: code formatting, removed previous module editor copy/paste functions 2017-09-30 14:28:54 +02:00
Tomasz Włostowski 5731000135 pcbnew/copy&paste: multiple improvements:
- fixed netcode propagation bug
- factored out EDIT_TOOL::m_offset, now selection offset is stored in SELECTION class
- added VECTOR2I-based Move/Flip/Rotate methods in BOARD_ITEM
2017-09-30 14:28:54 +02:00
Tomasz Włostowski f573a2e685 wip 2017-09-30 14:28:54 +02:00
Tomasz Włostowski 3fb926a8f2 Fix snapping to anchors in PICKER_TOOL & highlighting of pasted items 2017-09-30 14:28:54 +02:00
Tomasz Włostowski 931a1ccaff Improved copy/paste functionality by Kristoffer:
- added selection of reference point
- added snapping when pasting
- some minor code refactoring
- disabled pasting between footprint and pcb editors due to model incompatibility
2017-09-30 14:28:54 +02:00
Kristoffer Ödmark 4ce38abce2 renamed copypasta functions, fixed a paste_module error 2017-09-30 14:28:53 +02:00
Kristoffer Ödmark b4879d061c Fixed menu items, moved the copy and cut to the EDIT_TOOL, Fixed rendering when copying a module 2017-09-30 14:28:53 +02:00
Kristoffer Ödmark bd8980596f Some code cleanup to follow kicad style better 2017-09-30 14:28:53 +02:00
Kristoffer Ödmark 84b803042c Improvements to copy-paste
-Can paste items from board to module-editor (only module parts)
-Can paste entire modules just as copy
-Can copy items inside module-editor

Known limitations:

-Will crash if trying to paste a module containing module_text inside
the module editor ( dont know why, problem existed before )
-If copying things with strange layer names, the layer names will be
changed.
2017-09-30 14:28:53 +02:00
Kristoffer Ödmark c0981b8444 Added a new plugin that can save and load to clipboard, using ctrl+shift+c/v for copy pasting
Added the needed kicad_clipboard files and made copy pasted modules have no path
2017-09-30 14:28:53 +02:00
Jon Evans eec1366ead Move ZOOM_TOOL to common; add RMB-drag to zoom out 2017-08-31 10:04:00 +02:00
Maciej Suminski 31ef52a365 Fix fine-grid cursor movement using arrow keys
Fixes: lp:1497976
* https://bugs.launchpad.net/kicad/+bug/1497976
2017-08-22 15:14:33 +02:00
Maciej Suminski 76bd05a69b Prevent creating too many transitions by TOOL_MANAGER
- added TOOL_INTERACTIVE::resetTransitions()
- made protected and moved TOOL_BASE::setTransitions() to TOOL_INTERACTIVE
- TOOL_MANAGER calls TOOL_INTERACTIVE::resetTransitions() instead of
setTransitions()
2017-07-31 15:09:19 +02:00
Tomasz Włostowski 3b16d3cffe further DLIST/Iterators cleanup, some code formatting 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 63f4ab697b post-rebase fixes 2017-06-23 11:12:37 +02:00
Tomasz Włostowski 9ad886344b New connectivity algorithm. 2017-06-23 11:12:36 +02:00
Tomasz Włostowski 08314082db Hide DLISTs behind iterators, first step towards refactoring the storage model 2017-06-23 11:12:36 +02:00
jean-pierre charras fa66a5a8f3 Pcbnew: make hotkeys { and } used to control the layer transparency (alpha channel) in GAL visible (and editable) in hotkey list. 2017-06-17 18:11:40 +02:00
jean-pierre charras 1fab667cf7 2 Minor fixes in GAL mode: when switching from legacy to gal, use now the latest display options.
Use hotkey defined by user to reset local coordinates in GAL (instead of the hard coded space key)
2017-06-13 11:25:05 +02:00
jean-pierre charras 6ed4f9b208 Make EDA_DRAW_FRAME::SetToolID and mouse cursor shape setting working in GAL canvases, and uses same mouse cursor shapes in legacy and gal canvases.
Starting fixing incorrect UI behavior of Zoom to selection in Pcbnew.
2017-06-12 15:16:09 +02:00
jean-pierre charras 9e321a4722 Pcbnew: Apply a fix made in stable branch, in AppendBoard, to avoid potential crash. 2017-04-22 09:23:02 +02:00
jean-pierre charras a35a46804e Pcbnew fix: "create array" extremely slow in GAL mode, due to a useless call of a time consuming method for each new item created. 2017-04-19 14:15:11 +02:00
jean-pierre charras 01f5a129a3 Fixes: lp:1683147 (Board append command *extremely* slow)
https://bugs.launchpad.net/kicad/+bug/1683147
2017-04-18 20:10:34 +02:00
Jon Evans 3ec28e2acf Refactor layer enumerations to all live in the same place 2017-03-30 16:01:48 -04:00
John Beard b8edecc10f Move cursor shape flag into GAL settings
The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
2017-03-22 10:24:48 +01:00
Tomasz Włostowski 77c1b1b4ea Refresh vias geometry when switching via display mode
Fixes: lp:1674096
* https://bugs.launchpad.net/kicad/+bug/1674096
2017-03-20 12:06:56 +01:00
Maciej Suminski fe4f02f5b9 Coverity fixes
CIDs:
- 153097
- 157120
- 157119
- 155148
- 155146
- 153103
- 153099
- 153095
- 153087
- 153086
2017-03-11 22:20:08 +01:00
Jon Evans 88f7c55d95 Move ZoomFitScreen and ZoomPreset from PCBNEW_CONTROL to COMMON_TOOLS
BOARD::GetBoundingBox() now directly calls BOARD::ComputeBoundingBox()
and there is a new method BOARD::GetBoardEdgesBoundingBox() used for
call sites that needed to use ComputeBoundingBox( true ) in the past.

This allows COMMON_TOOLS to implement ZoomFitScreen without knowledge
of the BOARD class.
2017-03-03 13:28:19 +01:00
Maciej Suminski 906ee77dbf Fixed VIEW_ITEM memory leaks 2017-03-02 23:57:13 +01:00
Jon Evans fd4e2b042c Refactor SELECTION, SELECTION_CONDITIONS, and context menus to common
SELECTION now holds EDA_ITEMs not BOARD_ITEMs so various places had to
change to casting the selected items to BOARD_ITEMs.

Fixed compilation warnings on clang (Tom)
2017-02-28 14:47:20 +01:00
Jon Evans 4c83b0a94d Move TOOL_ACTIONs to their corresponding tools; create COMMON_TOOLS
Some grid/zoom tools are left in PCBNEW_CONTROL because they currently
depend on Pcbnew-specific class members.  Once refactoring is done to
make it possible to use all zoom and grid controls outside of pcbnew,
these last tools can be moved to common to match their ACTIONs.
2017-02-22 10:32:48 +01:00
Jon Evans 167f45ca2b Refactor COMMON_ACTIONS into a base and derived class
New virtual class ACTIONS is added as a member to EDA_DRAW_FRAME so
that the TOOL_DISPATCHER can have access to the appropriate derived
version of TranslateLegacyId()
2017-02-22 10:32:48 +01:00
Maciej Suminski c8676db84e Fixed panning & cursor control with arrow keys in flipped view 2016-12-12 16:45:52 +01:00
Maciej Suminski 89055c4425 Code formatting 2016-12-12 16:45:52 +01:00
Tomasz Włostowski 1c1f4e9a50 Refactoring of VIEW/VIEW_ITEM classes:
- Remove dependency of EDA_ITEM on VIEW
- VIEW_ITEM is now a pure virtual interface
2016-12-12 16:45:52 +01:00
Tomasz Włostowski 27a10e8597 Multiple simplifications to GAL tools in PCBNew:
- Finalize transition to BOARD_COMMIT (removed all remaining uses of PICKED_ITEMS_LIST) and implicit view/ratsnest updates
- Simplified SELECTION class, it now can be directly added to a VIEW
- Removed unnecesary casts and templates
- Introduced C++11 features (range based for, lambdas) where they improve code readability
- Added non-undoable COMMITs, which can be used to propagate change notifications to interested listeners (e.g. ratsnest/view)
2016-12-12 16:45:52 +01:00
Gustav Bergquist 061a7b8450 Cast TOOL_EVENT parameter type to intptr_t 2016-09-21 21:22:19 +02:00
Dick Hollenbeck 9ad49dc2d1 Split IO_ERROR out of richio.* and store Problem() and Where() separately 2016-09-20 11:56:18 -04:00
Maciej Suminski edf64afa3e Fixed freezes after appending a board. 2016-09-12 13:45:57 +02:00
Maciej Suminski 5a1f52bf30 Modified tools to use BOARD_COMMIT. 2016-09-12 13:45:57 +02:00
Maciej Suminski ff6bdeee4b Removed a number 'if(m_editModules)' sections from pcbnew tools. 2016-09-12 11:50:06 +02:00
Wayne Stambaugh 4ed346ea64 Eeschema: initial schematic I/O plugin.
* Factor out PROPERTIES object from the PCB plugin code and move it into
  common so it can be used by both the Pcbnew and Eeschema plugins.

* Add schematic I/O plugin manager for loading and saving schematic and
  component library files.

* Add initial attempt at a parser for current schematic file format.  This
  parser will be infinitely more strict than the current parser which is very
  forgiving in what it parses.

* Make minor changes to the base bitmap class to support the new parser.

* Add find root sheet support to sheet object to allow fetching the root
  sheet from any sheet in the stack.
2016-07-06 05:22:56 -04:00
Michael Steinberg fde12ebd25 Replace boost::function and boost::bind with their std:: counterparts 2016-06-29 12:23:11 +02:00
Maciej Suminski 06637a17d6 Added 'Reset Grid Origin' hot key (GAL). 2016-05-04 14:59:14 +02:00
Simon Richter ef582c07f3 Drop some debug output
This was apparently left in from debugging earlier, and should no longer be
needed. Since it uses a GCC extension, it makes compilation on others fail.
2016-01-17 10:59:17 -05:00
Simon Wells a88e61a6e0 Fix uninitialized variable in PCBNEW_CONTROL::CursorControl 2016-01-11 17:12:49 -05:00
Maciej Suminski 6e23979253 Removal tool asks for confirmation only for modules (GAL). 2015-09-08 11:17:30 +02:00
Maciej Suminski f43510739c Append board in GAL. 2015-08-07 18:24:42 +02:00
Maciej Suminski d010703eaf Fixed cursor freeze in pcbnew (GAL). 2015-07-24 10:58:47 +02:00
Maciej Suminski f7fa0852b5 Fixed screen scrolling on zooming in/out. 2015-07-24 09:42:45 +02:00
unknown 40ccc0bedf replace round() with KiROUND(), our function that is used almost everywhere for rounding, and detects int overflows in debug mode. 2015-07-17 10:26:48 +02:00
Maciej Suminski 27eafcb5c1 Fix erroneous cursor control with keys when grid size is less than one pixel with certain zoom levels. 2015-07-16 17:52:08 +02:00
Maciej Suminski 36d3d9f78e Cursor warps to the drag origin (GAL). 2015-07-15 17:32:30 +02:00
Maciej Suminski 825fe8e5de F4 panning (GAL). 2015-07-09 17:09:34 +02:00
Jon Neal fdf5b821f0 Add centering cursor on zoom to GAL. 2015-07-09 10:18:27 +02:00
Maciej Suminski 15e9e69ae0 Clicking with keyboard handles keyboard modifiers (GAL). 2015-07-07 18:36:52 +02:00
Maciej Suminski 453b05db09 One more zoom fit-to-screen fix (GAL). 2015-07-03 20:58:13 +02:00
Maciej Suminski 3cb095b7c2 GAL canvases update status bar, message panel & zoom widget. 2015-07-03 20:58:12 +02:00
Maciej Suminski 51c0ae3480 Fixed cursor offset in GAL. 2015-07-01 03:46:42 +02:00
Maciej Suminski b352ef9deb Panning with keyboard (GAL). 2015-06-30 14:08:29 +02:00
Maciej Suminski 30b679ae5e Cursor control with keyboard (GAL). 2015-06-30 14:08:24 +02:00
Maciej Suminski b5ef511063 Fixed alignment to grid when there is a grid offset (GAL). 2015-06-30 14:08:03 +02:00
Maciej Suminski 37db33cbca Update cross hairshape (GAL). 2015-06-26 17:30:41 +02:00
Maciej Suminski 28a270a328 Refactored grid origin point drawing (GAL). 2015-06-18 17:51:53 +02:00
Maciej Suminski 8964ff8922 Hotkey lists displayed after pressing the Help button (GAL). 2015-06-18 17:51:52 +02:00
Maciej Suminski f63170ca84 Tools available under toolbar buttons: delete items, highlight net, set drill/place origin (GAL). 2015-06-18 17:51:51 +02:00
Maciej Suminski 7c59d0dcc4 Layer toggling with 'Place Via' hot key when router is 2015-05-18 13:48:11 +02:00
Maciej Suminski 4f3337f5ed Fix hot keys for adjusting grid size (GAL). 2015-05-12 12:03:39 +02:00
jean-pierre charras d41bc31c49 Fix bug #1447905 (very minor bug, in fact). Fix a few minor coding style issues.
Fix 2 coverity warnings.
2015-05-03 08:31:14 +02:00
jean-pierre charras 5a02b91e5f Fix some issues created by rev 5632:
*  Use only double to store zoom levels in class BASE_SCREEN (int type is not working for eeschema or page layout editor) (this fix Bug #1450551, Assertion failed on wxRound() when zooming)
*  Fix crash in all apps but Pcbnew when a grid or a zoom was selected from the popup menu.
*  Modify default hotkeys for Next Grid and Previous Grid: the initial key was a dead key, not suitable as hotkey. the 'N' and Shift N keys are used instead (with a change for unfill zone hotkey)
*  Modify code in EDA_DRAW_FRAME::SetNextGrid() and EDA_DRAW_FRAME::SetPreviousGrid() to make them compatible with other editors than the board editor.
2015-05-01 11:31:23 +02:00
Maciej Suminski 787415c2aa Updating the user grid size on change in GAL. 2015-04-30 10:46:06 +02:00
Maciej Suminski 3e46f2233a Corrected "Zoom Auto" in GAL with empty board. 2015-04-30 10:46:06 +02:00
Maciej Suminski 025d4cf23a Alternative way of handling grid settings in GAL. 2015-04-30 10:46:04 +02:00
Maciej Suminski 946b9d1933 setTransitions() are called automatically for tools. 2015-04-30 10:46:03 +02:00
Maciej Suminski c4888afbcc Refactored the way GAL handles zoom settings. 2015-04-30 10:46:02 +02:00
Maciej Suminski 5c984aa069 Parametrized TOOL_ACTIONs. 2015-04-30 10:46:01 +02:00
Maciej Suminski b0ad779ee4 Calming down the Coverity report. 2015-02-15 23:21:52 +01:00
Maciej Suminski 902d0e3f1f Tools are processing const TOOL_EVENT& (Tool Framework). 2015-02-14 21:28:47 +01:00
jean-pierre charras 9cfb97d8b4 Add hight contrast option in Modedit. In hight contrast mode, solder masks and solder paste are shown.
this option was possible only by modifying the way display options are managed.
before these changes, display options were a global DISPLAY_OPTIONS class instance.
Now each EDA_DRAW_FRAME(and derivated classes)  includes its own DISPLAY_OPTIONS class instance.
As a consequence, some duplicate display option variables in these classes have been removed, because there were just duplicate variables of the  DISPLAY_OPTIONS class instance.
2015-01-10 11:27:49 +01:00
jean-pierre charras 5a38d2b657 Rework on env. variable KISYS3DMOD. Until now, was used in different files using different ways, so no consistency between files.
code cleanup.
2014-08-24 09:05:07 +02:00
Maciej Suminski 1d378cfcd1 View is automatically centered when a module editor or viewer are opened (GAL). 2014-07-23 12:06:24 +02:00
Maciej Suminski 78853febbe Zone fill/unfill actions in context menu (GAL). 2014-07-09 16:57:01 +02:00
Maciej Suminski 0163b589b4 Workarounded restoring focus to GAL canvas after layer switching. 2014-07-09 16:44:22 +02:00
Maciej Suminski db0d708300 Simplified code for switching layers in GAL view. Tools are notified of layer change event. 2014-07-09 16:25:50 +02:00
Maciej Suminski 65c116621d Added support for changing the cursor size. 2014-07-09 15:10:32 +02:00
Maciej Suminski 15f5c228cc Fixed autozooming with empty board/module. 2014-07-09 15:10:32 +02:00
Maciej Suminski 84fa537b22 Changes in display options are handled by PCBNEW_CONTROL (GAL). 2014-07-09 15:02:56 +02:00
Maciej Suminski d73ab976df Added support for placing the footprint anchor. 2014-07-09 14:01:06 +02:00
Maciej Suminski 26323007b5 Added a handler for not implemented toolbar buttons functionality in GAL. 2014-07-09 13:50:27 +02:00
Maciej Suminski eee2779f6b Moved some layout editor specific tool actions to another class (PCB_EDITOR_CONTROL). 2014-07-09 13:50:27 +02:00
Maciej Suminski 0306ec7efe {Set,Get}ActiveLayer moved from PCB_EDIT_FRAME to PCB_BASE_FRAME. 2014-07-09 11:50:27 +02:00
Maciej Suminski e46c5cb778 Fixed toolbar buttons for zooming in GAL canvas. 2014-07-09 11:22:42 +02:00
Maciej Suminski 9a47f4c645 Created a specialization of EDA_DRAW_PANEL_GAL: PCB_DRAW_PANEL_GAL.
Moved View related routines & fields from PCB_{BASE,EDIT}_FRAME & BOARD to PCB_DRAW_PANEL_GAL.
2014-07-09 10:57:32 +02:00
Dick Hollenbeck ad750defb6 LAYER_ID work 2014-06-29 08:05:51 -05:00
Dick Hollenbeck 4578ea8b9e 1) Add 32 Cu Layers.
2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
2014-06-24 11:17:18 -05:00
Maciej Suminski e7aa963011 Fixed layers switching in GAL. 2014-06-06 14:59:55 +02:00
Maciej Suminski f5de166a7e Removed an unused parameter from TOOL_BASE::getModel<T>() method. 2014-06-06 14:59:25 +02:00
Maciej Suminski 0d734e8841 Placing the grid origin is possible with GAL. 2014-06-04 17:46:43 +02:00
Maciej Suminski cd8aaee160 Moved most of the board design rules related fields & methods to BOARD_DESIGN_SETTINGS class. 2014-05-13 11:22:51 +02:00
Maciej Suminski 917e47397d Custom track/via size settings nicely cooperate with other options. 2014-05-13 11:22:51 +02:00
Maciej Suminski 2f5103bc67 Fixed jumpy zoom when hotkeys and scroll wheel were used alternatively. 2014-05-13 11:22:51 +02:00
Maciej Suminski ba275918e3 Renamed [class_]drawpanel_gal.[cpp|h] to [class_]draw_panel_gal.[cpp|h] to follow current naming scheme. 2014-04-04 11:56:04 +02:00
Maciej Suminski 39bca76df7 >Added handled hotkeys:
- resetting relative coordinates
- switching units
- not official: changing transparency for layers (works only for main layers, does not work on vias/pads/etc.)
2014-03-24 18:28:21 +01:00
Maciej Suminski 60e9546b62 PCB_EDIT_FRAME::SetHighContrastLayer() went public.
Refactored code that handled zooming events.
Added PCB_RENDER_SETTINGS::Get/SetSketchMode().
PCBNEW_CONTROL reacts to hot keys changing display modes (sketch via/tracks, high contrast).
2014-03-24 17:20:23 +01:00
Maciej Suminski dc9298730d Added PCBNEW_CONTROLS for handling miscellaneous hot keys (trying to be compatible with the default hot key settings). Currently there are a lot of stubs to be filled out (in pcbnew_controls.cpp).
Handled actions:
- switching layers
- switching grids
- changing track width & via size
2014-03-24 08:45:05 +01:00