Commit Graph

293 Commits

Author SHA1 Message Date
Marek Roszko df590b1109 Reduce the "default" maximum scale factor down a magnitude.
Testing reveals 25000 is absolute overkill. A 4mil trace at 2000 is already an entire GAL canvas on 1080p.

Eeschema already uses its own setting of 1000 max.
2020-10-19 19:06:09 -04:00
Marek Roszko c372a77d6c Fix focus theft, Windows sends mouse events to windows regardless of focus.
We need to check if the window is foreground before fight over focus which will make the window foreground if it wasn't.

Fixes #4099
Fixes #5958
2020-10-16 23:25:01 -04:00
Marek Roszko b2e9f6987d Split base_struct into eda_item and eda_rect 2020-10-13 21:24:50 -04:00
Tomasz Wlostowski 30f8cc1346 VIEW_OVERLAY: added Cross() method 2020-10-07 16:36:37 +02:00
Jeff Young ba26e056ec Implement groups for modedit.
This uncovered a memory corruption bug in MODULE's move operator,
several bugs in MODULE's move and copy constructors, and a bug in
BOARD's GetItem() call.

It also bumps the file format for saving/restoring groups inside
footprints.
2020-10-03 12:19:50 +01:00
PJM d1322e7d1d Refactor GetDocumentExtents()
CHANGED: GetDocumentExtents() in 'eda_draw_frame.h' now has a bool
parameter "aIncludeAllVisible" with a default value "true" which makes
it behave as it did before adding parameter.  If "aIncludeAllVisible"
is false, the returned bbox ignores some items depending on which
program it is running in.

CHANGED: Made "Zoom to Objects" use only PCB edge in Pcbnew.  This
allows text, notes, etc outside the PCB edge to be excluded in the
zoom calculation.

CHANGED: Added "Zoom to Objects" to Pcbnew main menu, and to RMB context
menus for Eeschema and Pcbnew.

Fixes https://gitlab.com/kicad/code/kicad/issues/5787
2020-09-25 00:31:56 -07:00
PJM abdd1906c2 Change 'Zoom to Fit' margins and add 'Zoom to Objects'
CHANGED: The margin used in 'Zoom to Fit' is now 2% instead of 10%.

ADDED: Added 'Zoom to Objects' to Eeschema which does not include
the page and border in the bbox calculations.

CHANGED: Removed pre-existing code that tweaked the center to account
for the scrollbars.  It actually made the view off center.  Removing it
results in perfectly centered zooms.

Fixes https://gitlab.com/kicad/code/kicad/issues/5145
2020-09-16 00:53:39 +00:00
Seth Hillbrand f493e270ea ADDED: Menu option to enable/disable snap to grid
You can now enable and disable snap to grid when drawing/editing across
all apps.  You can also tie snap to grid to the visibility of the grid
to allow rapid enable/disable via grid display.
2020-09-10 20:09:30 -07:00
Seth Hillbrand 173b4ff588 Add snapping to eeschema
This generalizes both the SetPosition() function and ORIGIN_VIEWITEM
class away from the pcbnew-centric.
2020-09-09 10:18:15 -07:00
Tomasz Wlostowski a31c9ae7af VIEW_OVERLAY: implement Line() method 2020-09-08 01:31:42 +02:00
Jeff Young 57c3d8e8d8 Make sure preview group gets added to view after a clear. 2020-08-15 21:13:44 +01:00
Jeff Young 9716c62e32 Performance enhancements for PCBNew scrolling and zooming.
Fixes https://gitlab.com/kicad/code/kicad/issues/5136
2020-08-10 23:43:24 +01:00
Jeff Young d586495c0a Preview fp edges & text while dragging in router.
Fixes https://gitlab.com/kicad/code/kicad/issues/5037
2020-08-01 15:40:34 +01:00
Jon Evans 711fc999f2 Coverity fixes 2020-05-25 19:29:41 -04:00
Jon Evans a52435bbb0 ADDED: New mouse settings panel, expanded mouse settings
You can now choose the behavior of dragging with the
middle and right mouse buttons.

You can also choose which modifier keys to use for
panning and zooming with the scroll wheel or trackpad.

You can also customize the zoom speed, which makes
it possible to have a good zoom experience on a wider
range of input devices.

You can also now zoom by dragging with the right or
middle button if desired.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/3885
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4348
2020-05-24 14:38:28 -04:00
Jon Evans 92ce7caf9a Remove extra write to common view control settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4458
2020-05-15 21:37:17 -04:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Seth Hillbrand 2a780dba0e Initialize view variable
Sets known initialization value to the last keyboard command
2020-01-10 16:43:01 -08:00
Jeff Young c27e278e58 Fix uninitialized variable (from Coverity scan). 2020-01-10 22:32:50 +00:00
Jeff Young 65c88ba2c3 Reduce the auto-panning margin and implement acceleration. 2020-01-10 22:32:49 +00: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
Jeff Young 1f07505b27 Fix long-standing issue with arrow keys moving in both axes. 2019-12-15 14:29:47 +00:00
Mark Roszko ae785194ce Silence/fix double to float conversion warnings 2019-12-12 21:51:21 +00:00
Seth Hillbrand 5b8661f2ab view: Check for viewData in IsVisible()
viewData can be NULL, make sure we verify it before dereferencing.
2019-10-15 09:44:16 -07:00
Ian McInerney a37d8f2859 Remove unneeded wxWidgets version checks in the code
Now that the minimum version is 3.0.0, we don't need to actually
check if the version is greater than 3.0.0 inside the code.
2019-09-18 10:03:53 -04:00
Jeff Young de8f97be6b Don't apply GTK fix to OSX as it causes a hang.
Fixes: lp:1841379
* https://bugs.launchpad.net/kicad/+bug/1841379
2019-08-25 20:48:47 +01:00
Seth Hillbrand 85df994eda Handle wx scrollbar thumbs in system-independent way
The thumb size changes between system versions and (on GTK) render
managers, so hard-coded wasn't working.  This gets the actual value from
the system and uses to adjust the range.  Changes in the range can also
trigger the refresh.

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

Fixes: lp:1816749
* https://bugs.launchpad.net/kicad/+bug/1816749
2019-08-22 10:07:34 -07:00
Jeff Young 8db8119564 Redraw selection halos after zooming.
Fixes: lp:1838869
* https://bugs.launchpad.net/kicad/+bug/1838869
2019-08-08 13:51:23 +01:00
Seth Hillbrand 5151cd0bfe C++14: Remove unused make_unique.h
Also removes header references now that we are in C++14, this is
built-in to the std
2019-08-07 09:27:31 -07:00
Jeff Young 43be58a1ea Fix bug in occulted centering logic. 2019-07-19 19:06:09 -06:00
Jeff Young 666705c1f8 Fix compiler warning. 2019-06-17 14:44:38 +01:00
Jeff Young edc8438ef0 Start the process of removing the legacy draw panel. 2019-05-31 21:54:21 +01:00
John Beard e6fe220f84 All: fix horizontal touchpad panning
Commit e10c01aaf didn't work when touchpad panning was enabled.

This commit changes it to only discard horizontal wheel events
when in "scroll mode" rather than "pan mode".

Based on a patch by Adrian Scripcă <benishor@gmail.com>.

Follow-up to fix: lp:1828080
https://bugs.launchpad.net/kicad/+bug/1828080
2019-05-08 11:06:44 +01:00
Adrian Scripca e10c01aaff All: fix spurious wheel scroll events caused when using modern mice.
Modern mice feature horizontal scrolling capabilities and those end
up being treated by KiCad as regular scroll events causing confusion
among users.

The fix works by discarding the handling of wheel events other than
the ones for the vertical axis.

Fixes: lp:1828080
https://bugs.launchpad.net/kicad/+bug/1828080
2019-05-07 17:34:51 +01:00
Seth Hillbrand 69c1263c02 GTK3: Force scrollbars visible
GTK3 does a fade in/fade out routine for scrollbars by default.  This
was problematic as it caused a cascade of full-screen repaint events on
each mouse event.  Instead of disabling scrollbars (which only helped
the full canvas), we force the old scrollbar behavior is environmental
variables.

Revert "gtk3: Remove scrollbars"

This reverts commit db43bd82a7.
2019-02-19 10:52:39 -08:00
Seth Hillbrand 0f1a11ef38 pcbnew: Cut only copied objects
Fixes a bug where objects where accessed after being freed by the cut

Fixes: lp:1811456
* https://bugs.launchpad.net/kicad/+bug/1811456
2019-01-11 17:27:29 -08:00
Fabián Inostroza 7f6b35c6bc Don't start autopan if the cursor was warped
The application warps the cursor when initiating some actions (dragging,
selecting modules or Find and Move).  This warping should not also
trigger the autopan action.

Fixes: lp:1810787
* https://bugs.launchpad.net/kicad/+bug/1810787
2019-01-08 12:15:33 -08:00
Seth Hillbrand 30521f0c57 gal: Fix zoom extents for large screens
When at small zoom levels, the integer bbox can overflow, preventing
redraw.  We fix this by redrawing the full tree when this happens

Fixes: lp:1733067
* https://bugs.launchpad.net/kicad/+bug/1733067
2019-01-04 16:00:31 -08:00
jean-pierre charras 56e0031e03 Fix incorrect onScroll handler on GAL mode.
If a Scroll event is skipped, a default handler is fired by wxWidgets.
This default default handler fires 3 wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN events.

This is not wanted now in eeschema (and pcbnew) because they add extra (unwanted) scrolling.

Fixes: lp:1810403
https://bugs.launchpad.net/kicad/+bug/1810403
2019-01-04 13:10:34 +01:00
Seth Hillbrand 9f8f938660 view: Initialize keyboard local var 2019-01-02 19:45:09 -08:00
Tomasz Włostowski 029fdaccc0 gal: re-enable scrolbar arrow buttons
Fixes: lp:1690780
* https://bugs.launchpad.net/kicad/+bug/1690780
2018-12-24 15:35:25 +01:00
Tomasz Włostowski bebbe6ed22 pcbnew: disable autopanning when cursor entered auto-pan margin following a keyboard cursor move command
Fixes: lp:1803523
* https://bugs.launchpad.net/kicad/+bug/1803523
2018-12-23 18:58:12 +01:00
jean-pierre charras dde933ba08 When printing, pads are not always printed (especially on tech layers)
A printing mode is added, to force ViewGetLOD() to return 0 in printing mode (pads are always drawn)

Fixes: lp:1809528
https://bugs.launchpad.net/kicad/+bug/1809528
2018-12-22 13:44:49 +01:00
jean-pierre charras 253b14b871 VIEW_OVERLAY: add missing code and missing poly graphic overloaded primitives.
Some graphic primitives were already in VIEW_OVERLAY, without code.
A few graphic overloaded primitives (Polygon and Polyline) where missing.
2018-12-11 11:42:39 +01:00
Seth Hillbrand db43bd82a7 gtk3: Remove scrollbars
Under GTK3, the scrollbars fade in and out, causing a cascade of
re-paint events.  These cause KiCad to be unresponsive while the repaint
events occur.  By default this is 1s fade in 1s fade out but can be
configured by the user/wm.

Area mapping the repaint events to just scrollbar areas will be a good
solution but until/unless that happens the scrollbars in GTK3 are
problematic.
2018-12-06 13:46:52 -08:00
John Beard 4475c2008c Zooming: handle smaller, faster, events on GTK+3
On GTK+3, the zoom events are smaller and faster, so
the trigger the zoom acceleration.

A simple fix is to use the non-accelerated Mac-style
zooming and an appropriate constant. This can be tweaked
further as needed.

Fixes: lp:1786515
* https://bugs.launchpad.net/kicad/+bug/1786515
2018-12-06 13:46:52 -08:00
Seth Hillbrand 1f62a2d784 gtk3: prevent double scroll events
GTK3 smooth scrolling is enabled by wxWidgets but not to the exclusion
of normal scroll up/down events.  wxWidgets maps these both to the same
scroll handler and will fire them both if they are not handled before
being queued.  Testing timestamps allows us to mark and ignore the
dupes.

This is set to GTK3 only for now as it isn't listed as a problem for
other platforms.  But it shouldn't cause issues if it is enabled
elsewhere in the future.
2018-12-06 13:46:52 -08:00
jean-pierre charras 8cf9ab5a4c Fix a wxwidgets alert. 2018-11-27 16:45:46 +01:00
John Beard 1eb0f70de5 Zoom: Use std::chrono for the timestamping
The reduces a little bit of WX dependency, and makes
the timing code a bit more type-safe.

Also adds a more testable interface for the accelerated
zoom controller.
2018-11-26 14:40:23 -05:00
John Beard 5a0318968f Break zoom control into a self-contained controller
This is done to avoid a big chunk of conditionally-compiled code
in the middle of the event function.

Also separates the zoom logic from the WX_VIEW_CONTROLS object
and isolates it in a separate class behind a clearer interface.

Add some simple tests for sane steps on GTK+3-sized scroll
steps.
2018-11-26 14:40:09 -05:00