We had been using each 4th column of spaces. But we needed an absolute
spacing rather than relative to the existing text to match spacing
between the input text box and our stroke font
On non-Unix, the platform selection is in platform.h, not on the command
line using the preprocessor macros from wx-config.
<wx/setup.h> relies on the platform being selected correctly, if it is
included directly, it cannot determine the correct configuration with
Visual Studio.
wxWidgets 3.1.5+ on Linux will compile with the Wayland EGL
canvas as the backend instead of the X11 backend. This requires a
version of GLEW compiled with the proper EGL defines and a different
header/code for certain parts that are X11 GLEW specific.
This introduces an in-tree version of GLEW that will be built with the
GLEW_EGL flag then statically linked into the KiCad executables when
EGL support is needed.
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.
The base GAL has the linewidth property already, and its
accessor will only return the base version. This was causing
problems with the Cairo printing GAL, since that setter wasn't
using the base class version. Also, this removes the print-specific
setter, since the actual setting of line width shouldn't be done
there and is instead done where the drawing happens.
Fixes https://gitlab.com/kicad/code/kicad/issues/5089
On platforms with limited framebuffer attachments, like GC7000L
driven by the open source etnaviv driver, we can still use
GPU acceleration by drawing directly to the main buffer.
EDA_DRAW_PANEL_GAL::onPaint checks if an overlay target is
available in the GAL, and if not, redraws the whole view if the
overlay target should be dirty.
Clearing of the overlay target is a no-op if there is no overlay
buffer.
Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
aGridSize.x or aGridSize.y can be null if the config file has stored
0 as size.
This is illegal and crashed Kicad.
The min legal value is 1.0 in internal units
- New public static function OPENGL_GAL::CheckFeatures() gets called in EDA_DRAW_PANEL_GAL::SwitchBackend() before switching to OPENGL_GAL
- Moved all OpenGL feature checks from OPENGL_GAL constructor to OPENGL_GAL::init()
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4714
Swap syncs can limit the redraw rate as the screen waits for previously
issued syncs. Setting this to -1 allows for adaptive swapping
(resorting to unsynced if it falls behind) if it is supported by the
card but will fall back to unsynced (0) if the adaptive is not
supported.
Fixes https://gitlab.com/kicad/code/kicad/issues/4226
The scaling factor stored inside the canvas is created by a DPI_SCALING
helper, which will call the platform-specific functions if no user scaling
is specified. This change only affects OSX and Retina displays, so this
now also allows custom scaling to be used on OSX if desired (although it
shouldn't be needed, since wx has detection for it in 3.0.4).
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.
Note that since the markup might exist for other reasons, it has
to be turned on with a preference setting. (It goes through a set
of bitflags so the same architecture can be used for other markup
structures that we might want to support in the future.)
Note also that this is more about engineering nomenclature than
visual formatting. In that respect it's more similar to overbar
than italic or bold.
deque structures have higher overhead than vectors. Not usually
problematic, but with hundreds of thousands of characters each with only
a few strokes, the overhead becomes dominant.
This mixes the de-emphasized layers into the background color rather
than merely a black color. This also keeps some of the original layer
color.
Fixes: lp:1831316
* https://bugs.launchpad.net/kicad/+bug/1831316
Move repeated GAL config reading routines into GAL_DISPLAY_OPTIONS.
THe app-level config is in here already, do the same for the
common config.
This means that the configs are loaded consistently, which fixes
the symbol-chooser preview window, which previously didn't use the
same config routine as other GAL canvases.
Future work could move these functions to free functions that
act on the public interface of GAL_DISPLAY_OPTIONS to avoid
GAL_DISPLAY_OPTIONS having to know about wxConfig and wxWindow.
Fixes: lp:1824524
* https://bugs.launchpad.net/kicad/+bug/1824524
First, add automatic detection of toolkit DPI scaling options. For now, this
is, in order,
* Check the GDK_SCALE option under GTK+ (users can set this to force the scaling)
* Check the value from WX's GetContentScalingFactor(). This will start to work
correctly from WX 3.1 and GTK+ 3.10.
Then, add a user-settable override in the main prefs panel, next to the icon
scaling. This is independent of the icon scaling options.
DPI handling is performed in a standalone class, so they can be shared between
the prefs UI and the OpenGL backend easily. Also means Cairo could use the same
interface in future.
Also adjust the OpenGL grid drawing code to use the computed scale factor,
which avoids over-thick grids in scaled environments (the user can manually
thicken the grid if wanted).
Fixes: lp:1797308
* https://bugs.launchpad.net/kicad/+bug/1797308
gal: pixel alignment for Cairo.
gal: pixel alignment for OpenGL
Cleanup of pixel alignment patches
gal/opengl: more pixel alignment patches:
- works on Retina displays now
- pixel alignment for circles
- correct 1-pixel strokes
- fixed unfinished 1-pixel line ends
GAL: Restore antialiasing options in Cairo
GAL: Fix arc drawing
Removes DrawArcSegment, which drew arcs whose edge was optionally
stroked (a feature that we did not use). Fixes Cairo arc drawing issue
where arcs were not visible in pcbnew.
gal: further cleanup
gal: removed unused shader parameter
When adding colors to length tuner, we depend on the window background
color, which can be set by the user, resulting in an unreadable text.
This uses the HSL conversion to detect which shade it should use for the
coloring.
Also adds test cases for round-trip HSL and HSV conversion
Fixes: lp:1814530
* https://bugs.launchpad.net/kicad/+bug/1814530
Cairo supports antialiasing when rendering but can be slow when set to
sub-pixel mode. This bumps the minimum version of Cairo to 1.12
(available in 14.04 LTS as well as mingw) to support three antialias
settings (fast, good, best) that offer speed/appearance tradeoffs.
This can provide a higher-quality eeschema render as it works on a
per-element basis as opposed to the OpenGL per-screen antialias.
Use TesselatePolygon() to draw polygons in Gerbview instead of GLU tesselation, much slower.
Add helper methods in GAL to know if the current GAL engine is Cairo, OpenGL or something else,
useful to optimize drawing code.
Due to the implicit floor of the cast from double to unsigned char,
there was a small rounding error in COLOUR4D's WX conversion function.
This fixes the failing tests.
Also make the cast to unsigned char explicit.
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.
CAIRO_PRINT_CTX provides a Cairo context created from wxPrintDC.
It allows one to prepare printouts using the Cairo library and
let wxWidgets handle the rest.
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).
This prevents deadlocks when exceptions are thrown and the context
ends up not getting unlocked.
It also removes an earlier hack to try and minimize this which
didn't work anyway.
Moved the code handling text overbars to a single function
(ProcessOverbars()) to replace similar pieces of code trying to do the
same thing.
Fixes: lp:1735906
* https://bugs.launchpad.net/kicad/+bug/1735906
Previous implementation uploaded only vertices with indices less
or equal to the number of stored vertices, which is invalid when
the container become fragmented.
Fixes: lp:1712887
* https://bugs.launchpad.net/kicad/+bug/1712887
- support for background color setting
- removed several global config settings (such as g_Drc_On)
- wrapped most of global config settings in PCB_GENERAL_SETTINGS class
- reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
- new GAL feature for legacy users: double-click (or E) to change track width available as an option.
Fixes: lp:1530543
* https://bugs.launchpad.net/kicad/+bug/1530543
Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
Independent drawing functions (that don't expect any particular state to
be set up fo them) on the GAL need to reset the GAL properties they
use. This adds GAL::ResetTextAttributes() to make this easier.
This is important, as failing to reset mirroring can cause asserts in
OpenGL.
This is used in the Ruler tool (which previously did it one attribute at
a time) and also the Arc layout assistant, which previously failed to
reset mirroring.
Also reset on GAL construction, as these members appear to be
uninitialised.
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).
This makes it clearer when a tool is active, otherwise interactive tool
effects like auto-pan can come as a surprise when the cursor is forced
to display all the time.
A new items is added to the GAL display options (and the dialog), and a
hotkey (Ctrl+Shift+x) is added to toggle it.
Fixes: lp:1673633
* https://bugs.launchpad.net/kicad/+bug/1673633
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas. When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
When reading config options from files, it's important to make sure the
value makes sense - the incoming data could be anything, and may have
incompatible values or be otherwise unreliable.
This introduces a simple way to define and use "mapping tables" which
can map between a "native" value, probably an enum (but not necessarily)
and some external value, for example the value written to file.
This provides a decoupling between the two values, as well as sanitising
inputs and outputs. This is important, as over time, if there isn't a
decoupled interface, changing options result in corrupt configs, or a
proliferation of obsolete enum values kept for compatibility.
GAL_DISPLAY_OPTIONS_OBSERVER aren't deleted by a base class pointer -
they are an "incidental" part of other classes. Add a virtual protected
destructor to make this explicit.
This allows the user to set a thicker grid line without causing the
grid lines to become over dense, or just make the grid denser according
to preference.
The term "density" is modified to "minimum grid spacing", which is
the pixel spacing between adjacent grid lines.
The spacing settings now comes in along, with other GAL display settings,
as part of GAL_DISPLAY_OPTIONS observer functionality. To this end, the
setter in GAL interface is removed, as an external user should be
setting this parameter via the GAL_DISPLAY_OPTIONS interface.
This adds a user-settable control for the grid line thickness on GAL
canvases to the display options dialog.
The thickness settings now comes in, along with other GAL display
settings, as part of GAL_DISPLAY_OPTIONS observer functionality. To this
end, the setter in GAL interface is removed, as an external user should
be setting this parameter via the GAL_DISPLAY_OPTIONS interface.
Fixes: lp:1662482
* https://bugs.launchpad.net/kicad/+bug/1662482
This puts the graphical/display options with the other similar options
in that dialog, rather than with the dimension options found in the Set
Grid dialog, which is in the Dimensions menu.
Also place the option itself in the GAL Display Options structure, so it
can be updated using the observer mechanism there.
The setter for the style in the GAL interface is removed, as the public
interface for setting this option is now to modify the
GAL_DISPLAY_OPTIONS structure and notify the GAL when done.
Some faults could result in a crash, as they were not properly
handled. Now the rendering loop is wrapped with try..catch block
which will revert to Cairo in case of an error and display an
error message.
Fixes: lp:1655766
* https://bugs.launchpad.net/kicad/+bug/1655766