Commit Graph
29 Commits
Author SHA1 Message Date
Thomas Geymayer 00a20409f7 Canvas: use weak pointer to protect parent element access.
Using a weak pointer is the best way to ensure no invalid
pointer is used. This also fixes a possible crash in
simgear::canvas::Element::getParentStyle on destructing
canvas elements.
2015-09-30 11:54:19 +02:00
Tim Moore 8b351520bd Off-by-one error in the OSG_VERSION_LESS_THAN macro
I was confused about when the version number gets bumped in OSG sources...
2015-04-21 00:06:22 +02:00
Tim Moore 51ff30f386 changes for OSG 3.3.4 and later
The public interfaces to osgText and osg::GLExtensions changed.
2015-04-19 22:45:59 +02:00
Thomas Geymayer 85090180d0 canvas::Text: fix global StateSet and line start cursor pos with empty line. 2014-08-31 19:24:58 +02:00
Thomas Geymayer 4f94c22241 Canvas: add method clearFocusElement. 2014-08-25 21:49:21 +02:00
Thomas Geymayer e1791b3006 canvas::Text: clean up and expose character/cursor positions. 2014-08-23 15:54:07 +02:00
Thomas Geymayer 791273c61d Update for OpenSceneGraph 3.3.2 API changes. 2014-08-09 18:13:45 +02:00
Thomas Geymayer 64ac22f50c Canvas: warn for missing tff and png plugins. 2014-07-27 12:11:09 +02:00
Thomas Geymayer 719ee36f5c Canvas: backdrop/stroke option for text (based on Gijs patch). 2014-07-27 11:05:49 +02:00
Thomas Geymayer 2c41c25fcd canvas::Text: get maximum width (if displayed on a single line). 2014-06-17 16:12:29 +02:00
Thomas Geymayer 36cb7a752b canvas::Text: add heightForWidth method. 2014-06-13 00:08:57 +02:00
Thomas Geymayer d332da0605 Canvas: do not write bounding box to property tree.
- Prevent writing to property tree in wrong thread.
 - Add Element::getBoundingBox and
   Element::getTightBoundingBox as uniform way to
   retrieve bounding boxes of all canvas elements.
 - Update path bounding boxe in update traversal.
2014-03-31 13:28:03 +02:00
Thomas Geymayer 7a220921f0 Canvas: one global SystemAdapter is enough.
This also fixes elements requiring a SystemAdapter without
being assigned to a Canvas (eg. because they are desktop
elements).
2013-12-09 23:07:17 +01:00
Thomas Geymayer b236821661 Canvas: Ensure all element types are initialized before first usage.
If setting properties on a group a check is performed if
this property exists on any possible child element, and
only if this is the case the property is stored in the
groups style.

Previously elements have been only initialized during
their first usage, leading to ignored styles if they
have been set on a parent element before instantiating
an instance of the actual element type.
2013-07-20 15:45:02 +02:00
Thomas Geymayer fc75b0bd21 Canvas::Text: add line-height property. 2013-07-19 23:38:08 +02:00
Thomas Geymayer 5320d0ecaa Fix render order of canvas elements 2013-07-12 16:13:06 +02:00
Thomas Geymayer d0ff144753 Canvas: Fix removing text elements.
Removing text elements failed due to prefering removing the
style property with the same name. Add a flag to each style
indicating whether it can be inherited. The text property
is only applicable to text elements and can not be inherited.
Now groups can not have a text property, avoiding the name
clash with the text element.
2013-07-04 14:11:54 +02:00
Thomas Geymayer 14eccc70da Restore compatibility with stable OSG (3.0.1) 2013-06-30 21:25:21 +02:00
Thomas Geymayer ece743342a canvas::Text: Make font resolution user configurable 2013-06-16 10:49:46 +02:00
Thomas Geymayer 02babbe340 canvas::Text: set font resolution to actual texel size. 2013-06-14 23:33:26 +02:00
Thomas Geymayer d24d3ce487 Canvas: More helper functions and cleanup. 2013-06-07 16:45:34 +02:00
Thomas Geymayer 2fe9ad595f Canvas: bug fixing and add some helpers. 2013-05-31 19:07:55 +02:00
Thomas Geymayer 1f43132363 Canvas: rework style setter system.
Style setters are now only setup once for each element type and
not for each element instance as before. A static map holds the
setters for each element type. Also an animation type is stored
which will later allow to animate properties of Canvas elements
without specifying and animation type.
2013-04-20 00:22:37 +02:00
Thomas Geymayer 632abdd87b Fix CanvasText horizontal alignment.
Don't reduce width of bounding box below character width
even if outline of rendered character is smaller. This
prevents trailing spaces from being ignored and also
fixes continuously chaging alignment (especially with
monospace fonts).
2013-02-09 12:17:45 +01:00
Thomas Geymayer fd39808ed8 Nasal cppbindings: automatic conversion of vec2 to/from Nasal 2012-12-17 00:29:14 +01:00
Thomas Geymayer 77946585b1 Canvas: Prepare for DOM Level 2 like event model. 2012-11-27 13:51:00 +01:00
Thomas Geymayer 34719da000 Clean up Canvas element creation 2012-11-06 18:48:00 +01:00
Thomas Geymayer 53dea9b069 Move parseColor to scene/util
parseColor is used to parse a CSS color string into an osg::Vec4
which is only available in SimGearScene. If someone needs the
function also in SimGear headless mode we have to think about
where to better place this function.
2012-11-05 17:58:24 +01:00
Thomas Geymayer b99f53fda3 Refactor Canvas and add some helpers.
- Refactor Canvas from FlightGear and fix lazy rendering with
   recursive canvases.
 - New classes PropertyBasedElement and PropertyBasedManager for
   creating subsystems controlled by the property tree.
 - New method parseColor to parse CSS 3 conformant color strings
   (only basic color schemes supported)
 - New Rect class representing a rectangle.
2012-11-04 14:12:05 +01:00