Commit Graph

786 Commits

Author SHA1 Message Date
Ian McInerney f896043067 Fix comments for switch statement fall throughs
This cleans up all GCC warnings (-Wimplicit-fallthrough=2) about
implicitly falling through switch cases.
2020-01-11 19:16:32 +00:00
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Ian McInerney 25a302758e Fix macos plist version string generation
Generate these resource files similar to how it is done one Linux.

Fixes mac-builder issue https://gitlab.com/kicad/packaging/kicad-mac-builder/issues/275
2019-12-26 12:42:25 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Ian McInerney 4f7430f476 Add save item to cvpcb toolbar and make it conditional
ADD: Save icon to cvpcb toolbar and make it conditional
2019-12-19 15:35:11 +00:00
Ian McInerney b9d8849b28 Unify unsaved changes detection logic in all frames
Create an IsContentModified() function in each frame
that provides if the content has been modified, and
use that instead of always copying the checks.
2019-12-19 15:34:01 +00:00
Mark Roszko 686b768a3d Add shutdown blocking on Windows for pcbnew, eeschema and pleditor
ADDED: Block shutdown/logoff on Windows when contents have been modified
2019-12-19 14:11:11 +00:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Ian McInerney e82795ba58 Fix grid settings in pcbnew/modedit/cvpcb
* Make the grid display settings separate from the board object
* Ensure that the grid is initialized on creation in all the frames

Fixes: lp:1843169
* https://bugs.launchpad.net/kicad/+bug/1843169
2019-11-23 23:35:21 +00:00
jean-pierre charras 6f2cbe5982 Pcbnew: housekeeping: move netlist code to netlist_reader sub directory. 2019-11-17 13:58:38 +01:00
Seth Hillbrand 6625d0721e Implement Get/Set display options
The pointer passing for display options is deprecated.  This removes the
excess casting as the EDA_FRAME didn't need the base call with no value.
All requests for display options are now returned const and are updated
with a Set() routine after modification.

In Gerbview, this resolves an issue where the display options were not
stored because it was receiving the NULL from EDA_FRAME.
2019-11-07 08:26:44 -08:00
Ian McInerney a1d3f3486e cvpcb: Fix some issues
* ESC no longer closed the window since it didn't properly generate
  the close event
* Copy/Cut from a context menu did not work due to a focus-loss issue
* Add better error handling for the copy/cut/paste actions to prevent
  text that isn't an FPID from being inserted
2019-10-06 17:53:35 +01:00
jean-pierre charras 0a829c328e Python scripting: fix a crash with some pythons scripts calling BOARD::ComputeBoundingBox()
This function calls Pgm(), but when running from a script (not from kicad) Pgm() uses a nullptr reference.
The nullptr reference is now tested in ComputeBoundingBox()
2019-10-05 10:39:33 +02:00
jean-pierre charras 16f4958430 Pcbnew: avoid crash when closing pcbnew if the DRC dialog is open.
Cvpcb: change from commit 9ceca583:
the root class close event that save settings is now seeing the close event.
2019-09-19 09:16:12 +02:00
Ian McInerney 9e555cb422 cvpcb: Run save association action immediately
(this is a complement of commit 9ceca583)
2019-09-18 10:35:37 +02:00
jean-pierre charras 9ceca583b1 Cvpcb: fix minor issues:
- Config not saved
- Confirmation dialog show after clicking on the OK button.

Fixes: lp:1844457
https://bugs.launchpad.net/kicad/+bug/1844457
2019-09-18 09:57:26 +02:00
Jeff Young 2553dd2942 Bail on our custom dockart provider.
It appears that it was causing some crashes, and it was never clear
that it looked better anyway.
2019-09-06 23:38:20 +01:00
Jeff Young 3bd38ec245 Improve zoom-to-extents for footprints with long text.
Fixes: lp:1820540
* https://bugs.launchpad.net/kicad/+bug/1820540
2019-09-05 21:02:29 +01:00
Jeff Young d4aa502be1 Correct footprint filter tool name and tooltip.
Fixes: lp:1842477
* https://bugs.launchpad.net/kicad/+bug/1842477
2019-09-03 19:42:32 +01:00
Jeff Young 54255cffeb Cleanup to make implementation names consistent with what they now do.
Fixes: lp:1842477
* https://bugs.launchpad.net/kicad/+bug/1842477
2019-09-03 19:29:30 +01:00
Jeff Young e269b5d1b9 Workaround an issue where a throw terminates (even when there's a catch for it).
You can trigger it before this fix by running Cvpcb when a .kicad_mod file is
incorrectly set as "Legacy" in your footprint table.
2019-08-31 15:18:27 +01:00
Ian McInerney 8493daf9ff Unify menu item creation for closing a window
* Push a function into CONDITIONAL_MENU that adds the item
* Modify the tooltip for close and exit items to have the
  program name

Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
2019-08-14 09:35:15 +01:00
Ian McInerney 7bb046c0a5 cvpcb: Auto move to next NA after association
Also perform some cleanup of objects when windows close
2019-08-12 14:19:01 -04:00
Ian McInerney 36b430562d cvpcb: Refactor events and cleanup formatting 2019-08-12 14:19:01 -04:00
Ian McInerney c0204e90b1 cvpcb: Add library location to status information
Fixes: lp:1782805
* https://bugs.launchpad.net/kicad/+bug/1782805
2019-08-12 14:19:01 -04:00
Ian McInerney c3b2885f88 cvpcb: Split control tool in two and add cut/copy/paste 2019-08-12 14:19:01 -04:00
Ian McInerney 95430e131e cvpcb: cleanup include statements 2019-08-12 14:19:01 -04:00
Ian McInerney e022a2e4d1 cvpcb: Clean up compile dependencies 2019-08-12 14:19:01 -04:00
Ian McInerney 9fda86e261 cvpcb: Move file extension to common and deprecate a header 2019-08-12 14:19:01 -04:00
Ian McInerney 796d888f8f cvpcb: Add individual association deleting 2019-08-12 14:19:01 -04:00
Ian McInerney 2d27c10c63 cvpcb: Add processing of hotkeys to the main window
* Add a tool loop to handle ESC to close the window and
focus changing keys
* Make changing focus a tool
2019-08-12 14:19:01 -04:00
Ian McInerney d428d5fecf cvpcb: Move some more tasks to a tool 2019-08-12 14:19:01 -04:00
Ian McInerney 06abda254a cvpcb: Add undo/redo functionality to the associations 2019-08-12 14:19:01 -04:00
Ian McInerney 402031244d cvpcb: Replumb the footprint association system
This is in preparation for implementing more association actions
and an undo/redo system.
2019-08-12 14:19:01 -04:00
Ian McInerney 72120e0a96 Actionize cvpcb 2019-08-12 14:19:01 -04:00
Ian McInerney c0b80c67b9 Rename cvpcb footprint viewer tools
This is in preparation for the actionization of the main cvpcb window.
2019-08-12 14:19:01 -04:00
Jeff Young 77334628c4 Change default tool behaviour to skip unhandled events.
The problem is that wxEVT_CHAR_HOOK doesn’t do the key translation
properly.  wxEVT_CHAR does, but we only get to that if we skip the
event at the end of the tool’s event processing loop, which most tools
don’t do.  (Selection tools, point editors, pickers, and a couple of
others do skip, which is probably why this didn’t get reported earlier.)

I played around with a couple of ways to fix wxEVT_CHAR_HOOK.  Most of
them don’t work, and the few egregious hacks I tried weren't cross-
platform.

So I’m changing it so that most tools now skip at the end of their
event loops.  I left out a couple that I felt were high risk (length
tuning, for instance).  But there’s still enough risk that I’m 100%
sure it will break something, I just haven’t a clue what.

Fixes: lp:1836903
* https://bugs.launchpad.net/kicad/+bug/1836903
2019-07-26 12:21:24 -06:00
Jeff Young 58ca5b71a9 A more robust fix for 36f1d023f0.
This one also handles when the events get out-of-order due to them
starting out in the Simulation window and not getting dispatched until
the mouse goes over the Schematic window.

Fixes: lp:1835907
* https://bugs.launchpad.net/kicad/+bug/1835907

Fixes: lp:1836544
* https://bugs.launchpad.net/kicad/+bug/1836544
2019-07-15 14:15:24 +01:00
Jeff Young 2d17d2b91f Cleanup and commenting. 2019-07-14 10:36:48 +01:00
Jeff Young 9effd24f3a Allow move tool to run on top of other tools.
Fixes: lp:1784480
* https://bugs.launchpad.net/kicad/+bug/1784480
2019-07-01 22:15:25 +01:00
Jeff Young 981072598b Overhaul cursor code for new tool/action framework.
Includes the addition of an onSetCursor() handler which must be called
from both the GAL canvas AND the GAL backend (at least on OSX) to prevent
cursor flickering between (for instance) pencil and arrow.

Also includes new architecture for point editors which allows them to
coordiate cursors with the editing tools (so we can switch to an arrow
when over a point).
2019-06-27 22:37:11 +01:00
Jeff Young 2f23aa9556 Implement a more robust tool stacking architecture.
We were running into various corner conditions where a tool's event
loop would exit while the tool was still active, or the tool would
get popped while we were still in the event loop.  (A lot of these
had to do with the POINT_EDITOR's, but not all of them.)

The new architecture:
1) tools always do a Push()/Pop()
2) everyone is responsible for their own pops; no more stack-clearing
on a cancel
3) CancelInteractive events go to all tools to facilitate (2)
2019-06-27 17:01:31 +01:00
Jeff Young f9702aab87 Immediate actions for PlEditor, PcbNew, etc. 2019-06-25 11:34:28 +01:00
Jeff Young 4eab89d9ef Fix OSX button order issue in Unsaved Changes dialog.
Also changes the presentation of the string when the checkbox appears
so that the "Changes will be lost" warning isn't hidden by the turndown.
This last part may require conditional compilation as it's undocumented.

Lastly, regularizes the Unsaved Changes strings between the apps.
2019-06-17 17:01:57 +01:00
Jeff Young 1f35ec5521 Beware of copying events and losing the m_passEvent flag.
Fixes: lp:1833031
* https://bugs.launchpad.net/kicad/+bug/1833031
2019-06-17 14:44:39 +01:00
Jeff Young e6d5110ccf Implement I18N for ACTIONs.
It's a bit of a hack because they're statically initialized and
so we can't make use of the _() macro.  We do still want it in the
code, however, because the string harvesting is based off of it.

Fixes: lp:1833000
* https://bugs.launchpad.net/kicad/+bug/1833000
2019-06-17 10:45:23 +01:00
jean-pierre charras 66d2060942 Partial fix for missing language selection menu.
The fix is partial because in the list of languages the menuitem corresponding to the selected language is not checked.
2019-06-16 20:35:57 +02:00
Wayne Stambaugh 77bf575742 CvPcb: fix save changes dialog layout issue.
DIALOG_EXIT was not being laid out correctly after setting the dialog
message.  Rather than fix our custom DIALOG_EXIT, wxMessageDialog and
wxRichMessageDialog were substituted as direct replacements for all
of the variants of DIALOG_EXIT.  This make message dialogs appear more
consistent because wxMessageDialog uses the default platform message
dialog and wxRichMessageDialog uses the default platform rich message
dialog on windows.

Remove DIALOG_EXIT_BASE as it is no longer required.

Fixes lp:1832899

https://bugs.launchpad.net/kicad/+bug/1832899
2019-06-16 12:10:24 -04:00
Jeff Young e4fbd003e0 Make m_passEvent event-specific rather than global.
If a tool called something like clearSelection while processing a
MOUSE_CLICK, the SELECTION_TOOL will pass the clearSelection
COMMAND_EVENT because it handles it as a transition, not as an
event. Because m_passEvent is effectively global, the tool manager
would then interpret that as passing the MOUSE_CLICK and we'd end
up processing the click by multiple tools.
2019-06-16 12:06:49 +01:00