From: Thomas Geymayer Date: Mon, 25 Feb 2013 14:30:01 +0000 (+0100) Subject: CanvasWidget: add auto-viewport property. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=045fc5b4aeacbaf2e613455b715f7e2a970df464;p=flightgear.git CanvasWidget: add auto-viewport property. The auto-viewport property allows to disable automatic update of the canvas viewport update upon resizing the PUI canvas widget. --- diff --git a/src/GUI/CanvasWidget.cxx b/src/GUI/CanvasWidget.cxx index b2aeb59c4..3c99f9091 100644 --- a/src/GUI/CanvasWidget.cxx +++ b/src/GUI/CanvasWidget.cxx @@ -29,7 +29,8 @@ CanvasWidget::CanvasWidget( int x, int y, puObject(x, y, width, height), _canvas_mgr( dynamic_cast(globals->get_subsystem("Canvas")) ), _last_x(0), - _last_y(0) + _last_y(0), + _auto_viewport( props->getBoolValue("auto-viewport", true) ) { if( !_canvas_mgr ) { @@ -185,8 +186,11 @@ void CanvasWidget::setSize(int w, int h) { puObject::setSize(w, h); - _canvas->getProps()->setIntValue("view[0]", w); - _canvas->getProps()->setIntValue("view[1]", h); + if( _auto_viewport ) + { + _canvas->getProps()->setIntValue("view[0]", w); + _canvas->getProps()->setIntValue("view[1]", h); + } } //------------------------------------------------------------------------------ diff --git a/src/GUI/CanvasWidget.hxx b/src/GUI/CanvasWidget.hxx index a91193814..8d4f60780 100644 --- a/src/GUI/CanvasWidget.hxx +++ b/src/GUI/CanvasWidget.hxx @@ -40,6 +40,9 @@ class CanvasWidget: float _last_x, _last_y; + bool _auto_viewport; //!< Set true to get the canvas view dimensions + // automatically resized if the size of the widget + // changes. static SGPropertyNode_ptr _time, _view_height;