Commit Graph

205 Commits

Author SHA1 Message Date
John Beard 01c733bdb5 Dim GAL cursor when forced but no interactive tool
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.
2017-03-22 10:24:48 +01:00
John Beard 78a5185857 Allow GAL cursor to be always displayed
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
2017-03-22 10:04:56 +01:00
Maciej Suminski 11f8e53e27 Smoother arc rendering in OpenGL GAL
Fixes: lp:1496114
* https://bugs.launchpad.net/kicad/+bug/1496114
2017-03-10 14:08:59 +01:00
Jon Evans 3208d24ad4 Add DrawArcSegment() GAL method, to support drawing outlined arcs 2017-03-10 14:08:59 +01:00
Maciej Suminski 62235348d1 Use GAL axes instead of a ORIGIN_VIEWITEM in module editor 2017-03-08 10:35:51 +01:00
Jon Evans 2513f0b002 Add setting to have GAL draw axes on the grid 2017-03-08 09:37:40 +01:00
John Beard e67882f0a3 Add WithAlpha method to COLOR4D
This is useful for taking a "base" color and making derived colours with
the given alpha, but the same RGB value.
2017-03-02 13:58:20 +01:00
jean-pierre charras 1cffcafe2d GAL mode: Add small cross option to grid style (now: options are Dots, Grid, Small cross) 2017-03-01 10:29:19 +01:00
Maciej Suminski 57050cdeb3 Introduced VIEW_CONTROLS::SETTINGS to keep settings
The new class facilitates saving and restoring VIEW_CONTROLS
settings such as cursor visibility, snapping, etc.
2017-02-24 13:33:17 +01:00
Maciej Suminski 0dc88bb4cf Changed COLOR4D defines to static consts 2017-02-22 17:35:00 +01:00
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
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.
2017-02-22 17:35:00 +01:00
John Beard 8766b475c6 Sanitise incoming GAL config options using mapping tables
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.
2017-02-20 10:52:34 +01:00
John Beard 1f5619f740 Add protected virtual dtor for GAL_DISPLAY_OPTIONS_OBSERVER
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.
2017-02-20 10:52:34 +01:00
John Beard 0bf3a19967 Add user control for grid minimum spacing in GAL
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.
2017-02-20 10:52:34 +01:00
John Beard 970e4f8eb4 Add grid line thickness control to Display Options Dialog
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
2017-02-20 10:52:34 +01:00
John Beard ff3bfaf82b Make KIGFX::GRID_STYLE an enum class
This provides stronger typing to these values.
2017-02-20 10:52:34 +01:00
John Beard 7ad30b7167 Move Grid style to Graphics Options dialog
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.
2017-02-20 10:52:34 +01:00
John Beard ddded86a06 Give all GAL canvases access to a GAL_DISPLAY_OPTIONS structure instance
Also loads the gal options when loading a canvas, as the canvas
otherwise might not register the initial settings.
2017-02-20 10:52:34 +01:00
Maciej Suminski 80956ef1e6 Added GAL::DrawPolygon(SHAPE_POLY_SET) & GAL::DrawPolyLine(SHAPE_LINE_CHAIN) 2017-01-27 19:08:32 +01:00
Maciej Suminski 88eb648cbb Alternative way of handling OpenGL initialization & errors
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
2017-01-13 16:50:36 +01:00
Maciej Suminski ca085de6aa Initialize fields in COMPOSITOR 2017-01-13 16:46:45 +01:00
Maciej Suminski e0577c0218 checkGlError() may throw exceptions or display an error message 2017-01-13 16:46:02 +01:00
Maciej Suminski 5a7604cbb4 More code formatting 2017-01-13 10:36:59 +01:00
Maciej Suminski 67b0a8c990 Fixed type casting in SHADER class 2017-01-11 17:37:10 +01:00
Maciej Suminski da00d64877 OpenGL antialising code clean up & formatting 2017-01-11 16:20:37 +01:00
decimad e71070fe1b final touch-ups (license information, includes) 2017-01-11 16:20:37 +01:00
decimad 77138e3702 Add UI control to set up gal opengl antialiasing and load/store the settings 2017-01-11 16:20:37 +01:00
decimad 2a8dd508c4 Add smaa (subsample morphological antialiasing) 2017-01-11 16:20:37 +01:00
decimad 02bb410cdb Refactor COMPOSITOR/OPENGL_COMPOSITOR to enable customization of scene rendering and presentation 2017-01-11 16:20:35 +01:00
decimad 77f9cd0cb0 remove custom shader header generation build-step in favor of c++11 raw string literals
rework shader loading code to handle an arbitrary amount of to-be-concatenated strings
2017-01-11 16:20:34 +01:00
decimad 047f52e7cb Move builtin font resources out of opengl_gal translation unit 2017-01-11 16:20:33 +01:00
Maciej Suminski 3ea8f12555 Handle flipped view text rendering for Cairo 2016-12-12 16:45:52 +01:00
Maciej Suminski a2a950fdae Reduced the Cairo command entry size 2016-12-12 16:45:52 +01:00
Maciej Suminski 660e4ca9d4 Cairo group arguments are stored in a union. 2016-12-12 16:45:52 +01:00
Maciej Suminski 89055c4425 Code formatting 2016-12-12 16:45:52 +01:00
Tomasz Włostowski da28e163d2 Optimizations/fixes to the VIEW/GAL classes:
- much faster Cairo rendering (outperforms legacy)
- improvements in VIEW update handling
- fixed issue with grid rendering in flip view mode
2016-12-12 16:45:52 +01:00
Tomasz Włostowski c661c30f68 pcbnew: added flip view mode 2016-12-12 16:45:52 +01:00
jean-pierre charras 30df041de6 fix shadowed local variables 2016-11-25 18:17:34 +01:00
decimad 402f53a302 update font code along with the changes done in the msdf atlas tool (use codepoint spans and refined char placement)
add font coordinate system clarification drawing (svg)
2016-10-20 14:31:09 +02:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Simon Richter da5699de0a Replace boost::shared_ptr with std::shared_ptr. 2016-06-29 11:09:55 -04:00
Maciej Suminski b7ec4ea160 Corrected the last instance check in OPENGL_GAL. 2016-06-10 17:07:12 +02:00
Simon Richter 5ce4abd0ac Use size_t for sizes and offsets. 2016-06-10 17:06:00 +02:00
Maciej Suminski 3fcae6b120 Fixes for OpenGL resources handling. 2016-06-07 14:42:42 +02:00
Maciej Suminski b4ad18a3ea Do not rebuild shaders on each OPENGL_GAL construction. 2016-06-03 15:46:13 +02:00
Maciej Suminski 68b6da57c0 Removed OPENGL_GAL::instanceCounter. 2016-06-03 15:46:12 +02:00
Maciej Suminski 01f32dd52c GL_CONTEXT_MANAGER class to avoid unexpected GL context switches. 2016-06-03 15:46:12 +02:00
jean-pierre charras 3e2cae946c Corrected wxDC objects used by EDA_DRAW_PANEL_GAL & OPENGL_GAL. 2016-06-03 15:46:11 +02:00
Maciej Suminski 3ca7026aa0 More robust checks for OpenGL canvas visibility. 2016-05-20 12:06:08 +02:00
Maciej Suminski 8d952f35c6 Fixed text vertical alignment for bitmap font (OpenGL). 2016-05-03 11:58:48 +02:00