Commit Graph

280 Commits

Author SHA1 Message Date
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
jean-pierre charras c539d6e0be fix incorrect initialization of VIEW::m_boundary.
This parameter defines the working area (full page) size.

The fix is not perfect, because it does not take in account the page size.
However it is similar to the "old" initialization, before Eeschema GAL.
In Eeschema, a reasonable boundary size is used.
2018-11-18 20:04:17 +01:00
Jeff Young fec8ab372e Don't set the viewport when switching screens.
That's the job of ZoomAutomatique().

Fixes: lp:1799436
* https://bugs.launchpad.net/kicad/+bug/1799436
2018-11-04 19:17:53 +00:00
Maciej Suminski 64da77538f Fix bitmap scale in printouts
Display GALs had an incorrect world unit value set. Now the world unit
value says how many internal units are in an inch, in accord with the comments
in the GAL header. Bitmap drawing code relied on the information about DPI,
so scaling worked differently for display and print GALs.
2018-10-31 19:17:30 +01:00
Maciej Suminski 1cce194c8a Handle layer settings in printouts 2018-10-31 19:17:30 +01:00
Maciej Suminski f948e46330 VIEW: changed wxASSERTs to wxCHECKs 2018-10-31 19:17:29 +01:00
Maciej Suminski 17205b4599 Added VIEW::DataReference() for sharing data with another VIEW instance 2018-10-31 19:17:29 +01:00
Jeff Young 16925cc74e Implement RAII locking for GAL updating.
Fixes a crash when typing fast in the place footprint filter box.

Also adds a bunch more checking to GAL locking, including making
sure the same person unlocks as locked, and preventing piece-meal
calls (the RAII objects must be used).
2018-10-26 23:02:05 +01:00
Seth Hillbrand a16e21665a view_layers: Initialize variables
Fixes a couple spots where uninitialized variables cause unknown results.
2018-10-11 14:08:35 -07:00
jean-pierre charras 37c2743fec Fix a minor compil warning. 2018-10-09 17:03:43 +02:00
John Beard c75d4b9ba1 Fix -Wreorder warning in common view-overlay.cpp
Simple fix - m_radius comes after m_{start,end}Angle in the class member list.
2018-10-09 11:08:56 +01: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
Tomasz Wlostowski 26177efba0 VIEW_GROUP: correctly calculate group extents 2018-10-09 11:08:52 +01:00