Commit Graph

109 Commits

Author SHA1 Message Date
jean-pierre charras d3d26f2892 Update the zoom level as soon as it is modified by the mouse wheel
The zoom level displayed on the bottom of the canvas was not immediately
displayed, only after a mouse move.

Fixes #6542
https://gitlab.com/kicad/code/kicad/issues/6542
2020-11-29 17:46:24 +01:00
Mark Roszko e7bf2b6256 Update comment 2020-11-11 13:45:46 +00:00
Marek Roszko 2a3e6ee1b5 Nix another easily triggered infinite event loop on Windows
This infinite loop was triggered on any dynamic scaling change with KiCad open.
Either local display scale change OR Remote Desktop.
2020-11-10 19:59:29 -05:00
Jeff Young 812b714ccd More Module -> Footprint and a bit of formatting cleanup. 2020-11-10 20:53:12 +00:00
Marek Roszko 262bb06d91 Avoid stealing focus from text controls when hovering over canvas
Fix #4879
Fix #4888
2020-11-04 22:22:45 -05: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
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
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
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
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 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
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
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
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
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
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
Jeff Young e2ea9b772a Fix offset issue when moving text. 2018-10-09 11:08:56 +01:00
Tomasz Wlostowski ef1f01a8bd VIEW: use BOX2D for view boundary 2018-10-09 11:08:52 +01:00
Maciej Suminski 44337dec56 pcbnew GAL: Fix bouncing zoom on mouse wheel scroll in Windows
Handling wxEVT_SCROLLWIN_LINE{UP,DOWN} executes the scroll event handler
too many times causing zoom bounces.

Fixes: lp:1562173
* https://bugs.launchpad.net/kicad/+bug/1562173
2018-06-20 16:55:14 +02:00
Seth Hillbrand 5de246c5be Add handlers for scrollbar events
Fixes: lp:1776120
* https://bugs.launchpad.net/kicad/+bug/1776120
2018-06-12 08:53:50 -07:00
Maciej Suminski 439cc6a967 Remove redundant window scroll event handlers in WX_VIEW_CONTROLS
The only required scroll event handler is wxEVT_SCROLLWIN_THUMBTRACK,
which is responsible for dragging the scrolling sliders. One of the
remaining ones is also called when mousewheel is scrolled (MSW only) and
due to that overrides the new view setting with view settings computed
from the sliders position.

Fixes: lp:1767604
* https://bugs.launchpad.net/kicad/+bug/1767604
2018-05-02 15:39:36 +02:00
Maciej Suminski 21a2c8d562 Fix cursor control with arrow keys
Fixes: lp:1749328
* https://bugs.launchpad.net/kicad/+bug/1749328
2018-02-14 09:23:44 +01:00
Maciej Suminski 365ab99a6a GAL: update cursor position on panning and scrolling
Fixes: lp:1749082
* https://bugs.launchpad.net/kicad/+bug/1749082
2018-02-13 09:45:06 +01:00
jean-pierre charras d00fafe2ab GAL mode: Ensure a minimal zoom level change on mouse wheel, especially when canvas redraw takes a long time (more than 100ms)
Previously, the zoom level change could be very small ( <= 1.05, that is a very small zoom level change), especially for large boards.
2018-02-02 13:19:59 +01:00
jean-pierre charras 47d392d83e Fix incorrect name (typo) of a method. 2018-01-18 10:11:45 +01:00
jean-pierre charras 6014307d06 Pcbnew, DRC dialog: Fix a few issues:
Gal mode: graphic cross-air cursor moved on items when clicking on & DRC error, like in legacy mode.
Make popup menu shown when right clicking on a DRC error item working.
2018-01-17 15:36:04 +01:00
Jon Evans 53ae5c36f4 Flip horizontal scrollbar behavior in flipped board view mode
Fixes: lp:1741327
* https://bugs.launchpad.net/kicad/+bug/1741327
2018-01-06 14:58:05 -05:00
Julius Schmidt 9df938484a support "disable autopan" with gal canvas
Fixes: lp:1670712
* https://bugs.launchpad.net/kicad/+bug/1670712
2017-11-24 12:20:15 +01: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
Maciej Suminski df472e6426 Added mouse position refresh event WX_VIEW_CONTROLS::WarpCursor() 2017-09-22 11:13:45 +02:00
Michael Geselbracht da037027fb Do not warp viewport when dragging FPs
Fixes: lp:1714611
* https://bugs.launchpad.net/kicad/+bug/1714611
2017-09-22 11:13:40 +02:00
Jon Evans d9396616ef Add support for panning with left and right mouse buttons 2017-09-15 13:35:52 +02:00
jean-pierre charras cf178fd20a add a wxASSERT just in case. 2017-09-15 11:29:49 +02:00
Jon Evans 5364cd9681 Improved zoom behavior on MacOS 2017-09-15 11:27:35 +02:00