Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -111,7 +111,7 @@ void Box::_resizeImplementation(point_type w, point_type h) {
|
||||
widget->setOrigin(xoff, 0.0f);
|
||||
|
||||
// Immediately reset our xoff for the next iteration.
|
||||
if(_uniform) {
|
||||
if(_uniform) {
|
||||
_positionWidget(widget, maxWidth, maxHeight);
|
||||
|
||||
xadd = maxWidth;
|
||||
@@ -178,7 +178,7 @@ Window::Sizes Box::_getHeightImplementation() const {
|
||||
_getMaxWidgetHeightTotal() * size(),
|
||||
_getMaxWidgetMinHeightTotal() * size()
|
||||
);
|
||||
|
||||
|
||||
else return Sizes(
|
||||
_accumulate<Plus>(&Widget::getHeightTotal),
|
||||
_accumulate<Plus>(&Widget::getMinHeightTotal)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ Browser::Browser(const std::string& url, const GeometryHints& hints)
|
||||
bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints)
|
||||
{
|
||||
if (!browserImage) return false;
|
||||
|
||||
|
||||
_browserImage = browserImage;
|
||||
|
||||
bool flip = _browserImage->getOrigin()==osg::Image::TOP_LEFT;
|
||||
@@ -66,7 +66,7 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints)
|
||||
|
||||
osg::Vec3 widthVec(hints.widthVec);
|
||||
osg::Vec3 heightVec(hints.heightVec);
|
||||
|
||||
|
||||
switch(hints.aspectRatioPolicy)
|
||||
{
|
||||
case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO):
|
||||
@@ -79,7 +79,7 @@ bool Browser::assign(BrowserImage* browserImage, const GeometryHints& hints)
|
||||
// no need to adjust aspect ratio
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec,
|
||||
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ bool Canvas::addWidget(Widget* widget, point_type x, point_type y) {
|
||||
if(!widget) return false;
|
||||
|
||||
widget->setOrigin(x, y);
|
||||
|
||||
|
||||
return Window::addWidget(widget);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ bool Frame::Corner::mouseDrag(double x, double y, const WindowManager* wm)
|
||||
}
|
||||
|
||||
parent->update();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ _border (border)
|
||||
|
||||
Frame::Border::Border(const Border& border, const osg::CopyOp& co):
|
||||
Widget (border, co),
|
||||
_border (border._border)
|
||||
_border (border._border)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ void Frame::Border::positioned()
|
||||
point_type h = getHeight();
|
||||
|
||||
if(_border == BORDER_LEFT) setTexCoordRegion(w * 3, 0.0f, w, h);
|
||||
|
||||
|
||||
else if(_border == BORDER_RIGHT) setTexCoordRegion(w * 4, 0.0f, w, h);
|
||||
|
||||
else if(_border == BORDER_TOP) {
|
||||
@@ -140,7 +140,7 @@ void Frame::Border::positioned()
|
||||
bool Frame::Border::mouseDrag(double x, double y, const WindowManager* wm)
|
||||
{
|
||||
Frame* parent = dynamic_cast<Frame*>(getParent());
|
||||
|
||||
|
||||
if(!parent) return false;
|
||||
|
||||
if(_border == BORDER_TOP && parent->canMove()) parent->addOrigin(x, y);
|
||||
@@ -209,13 +209,13 @@ Frame* Frame::createSimpleFrame(
|
||||
Frame* exFrame
|
||||
) {
|
||||
Frame* frame = 0;
|
||||
|
||||
|
||||
// Use an "existing frame" if we have it (for example, if you've in inherited from
|
||||
// Frame and want to use this stuff.
|
||||
if(!exFrame) frame = new Frame(name, flags);
|
||||
|
||||
else frame = exFrame;
|
||||
|
||||
|
||||
frame->addWidget(new Corner(CORNER_LOWER_LEFT, cw, ch), 0, 0);
|
||||
frame->addWidget(new Border(BORDER_BOTTOM, w, ch), 0, 1);
|
||||
frame->addWidget(new Corner(CORNER_LOWER_RIGHT, cw, ch), 0, 2);
|
||||
@@ -320,7 +320,7 @@ Frame* Frame::createSimpleFrameWithSingleTexture(
|
||||
|
||||
// frame->getEmbeddedWindow()->setTexCoordRegion(cw, ch, tw - (cw * 2.0f), th - (ch * 2.0f));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
OSG_WARN << "createSimpleFrameWithSingleTexture with a null image, the frame " << name << " will be use texture" << std::endl;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ bool Frame::resizeFrame(point_type w, point_type h) {
|
||||
return resize(
|
||||
left->getWidth() + right->getWidth() + w,
|
||||
top->getHeight() + bottom->getHeight() + h
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ Frame* Frame::createSimpleFrameFromTheme(
|
||||
|
||||
frame = createSimpleFrameWithSingleTexture(name, natifImage.get(), width, height, flags, exFrame);
|
||||
|
||||
if (frame && image && natifImage.valid())
|
||||
if (frame && image && natifImage.valid())
|
||||
{
|
||||
const unsigned int bpps = image->getPixelSizeInBits() / 8;
|
||||
const unsigned int one_third_s = image->s()/3;
|
||||
@@ -388,10 +388,10 @@ template<typename T>
|
||||
void copyDataImpl(const osg::Image* source,
|
||||
const unsigned int x1, const unsigned int y1,
|
||||
const unsigned int x2, const unsigned int y2,
|
||||
osg::Image* destination,
|
||||
osg::Image* destination,
|
||||
const unsigned int xd = 0, const unsigned int yd = 0)
|
||||
{
|
||||
if ((unsigned int)destination->s() >= xd + (x2 - x1) &&
|
||||
if ((unsigned int)destination->s() >= xd + (x2 - x1) &&
|
||||
(unsigned int)destination->t() >= yd + (y2 - y1))
|
||||
{
|
||||
const unsigned int bpps = source->getPixelSizeInBits() / (8 * sizeof(T));
|
||||
@@ -403,7 +403,7 @@ void copyDataImpl(const osg::Image* source,
|
||||
{
|
||||
for (unsigned int x = 0; x < x2 - x1; ++x)
|
||||
{
|
||||
for (unsigned int d = 0; d < bpps; d++)
|
||||
for (unsigned int d = 0; d < bpps; d++)
|
||||
{
|
||||
T v = srcdata[(y + y1) * source->s() * bpps + (x + x1) * bpps + d];
|
||||
dstdata[(yd + y) * destination->s() * bpps + (xd + x) * bpps + d] = v;
|
||||
@@ -415,21 +415,21 @@ void copyDataImpl(const osg::Image* source,
|
||||
assert(false && "copyDataImpl: Incorrect image dimensions.");
|
||||
}
|
||||
|
||||
/** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into
|
||||
/** Copies a rectangle of corners (x1, y1), (x2, y2) from an image into
|
||||
another image starting at position (xd, yd). No scaling is done, the
|
||||
pixels are just copied, so the destination image must be at least
|
||||
pixels are just copied, so the destination image must be at least
|
||||
(xd + (x2 - x1)) by (yd + (y2 - y1)) pixels. */
|
||||
void copyData(const osg::Image* source,
|
||||
const unsigned int x1, const unsigned int y1,
|
||||
const unsigned int x1, const unsigned int y1,
|
||||
const unsigned int x2, const unsigned int y2,
|
||||
osg::Image* destination,
|
||||
osg::Image* destination,
|
||||
const unsigned int xd, const unsigned int yd)
|
||||
{
|
||||
if (source->getDataType() == destination->getDataType())
|
||||
{
|
||||
if (source->getDataType() == GL_UNSIGNED_BYTE)
|
||||
{
|
||||
copyDataImpl<unsigned char>(source, x1, y1, x2, y2,
|
||||
copyDataImpl<unsigned char>(source, x1, y1, x2, y2,
|
||||
destination, xd, yd);
|
||||
}
|
||||
else
|
||||
@@ -541,7 +541,7 @@ osg::Image* createNatifEdgeImageFromTheme(osg::Image* theme)
|
||||
OSG_WARN << "width and height are different, bad format theme image " << theme->getFileName() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// check size
|
||||
int ceilvalue = static_cast<int>(ceil(s * 1.0 / 3));
|
||||
int intvalue = s/3;
|
||||
|
||||
@@ -103,7 +103,7 @@ void Input::_calculateCursorOffsets() {
|
||||
_offsets.resize(_text->getText().size()+1, 0.0f);
|
||||
_widths.resize(_text->getText().size()+1, 1.0f);
|
||||
|
||||
if (_text->getText().size()==0)
|
||||
if (_text->getText().size()==0)
|
||||
{
|
||||
_offsets[0] = 0;
|
||||
_widths[0] = 1.f;
|
||||
@@ -128,7 +128,7 @@ void Input::_calculateCursorOffsets() {
|
||||
glyphs.push_back(gq.getGlyphs().at(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::list<unsigned int> keys;
|
||||
for (unsigned int i=0; i<_text->getText().size(); ++i)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void Input::positioned()
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're at the end of the string, perhaps the string is empty,
|
||||
// We're at the end of the string, perhaps the string is empty,
|
||||
// so get the advance for any character, perhaps a large one, I chose 'A'.
|
||||
osgText::Glyph* glyph = const_cast<osgText::Font*>(_text->getFont())->getGlyph(osgText::FontResolution(_text->getFontWidth(), _text->getFontHeight()), 'A');
|
||||
_cursor->setSize(glyph->getHorizontalAdvance(), getHeight());
|
||||
@@ -297,7 +297,7 @@ bool Input::mouseDrag (double x, double y, const WindowManager*)
|
||||
if ((x >= offset1 && x <= offset2) ||
|
||||
i == _offsets.size() - 1) // If we're at the last one, obviously it will be there.
|
||||
{
|
||||
_selectionEndIndex = _index = i;
|
||||
_selectionEndIndex = _index = i;
|
||||
positioned();
|
||||
break;
|
||||
}
|
||||
@@ -310,9 +310,9 @@ bool Input::mousePush (double x, double y, const WindowManager* wm)
|
||||
{
|
||||
double offset = getOrigin().x();
|
||||
Window* window = getParent();
|
||||
if (window)
|
||||
{
|
||||
offset += window->getOrigin().x();
|
||||
if (window)
|
||||
{
|
||||
offset += window->getOrigin().x();
|
||||
}
|
||||
|
||||
x -= offset;
|
||||
@@ -325,7 +325,7 @@ bool Input::mousePush (double x, double y, const WindowManager* wm)
|
||||
if ((x >= offset1 && x <= offset2) ||
|
||||
i == _offsets.size() - 1) // If we're at the last one, obviously it will be there.
|
||||
{
|
||||
_selectionStartIndex = _selectionEndIndex = _index = i;
|
||||
_selectionStartIndex = _selectionEndIndex = _index = i;
|
||||
positioned();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ int newWindow(lua_State* L) {
|
||||
|
||||
int newWidget(lua_State* L) {
|
||||
osg::ref_ptr<Widget> w = new Widget("testLUA", 0.0f, 0.0f);
|
||||
|
||||
|
||||
lua_pushstring(L, w->getName().c_str());
|
||||
|
||||
return 1;
|
||||
@@ -94,7 +94,7 @@ bool LuaEngine::initialize() {
|
||||
_data->lua = lua_open();
|
||||
|
||||
luaL_openlibs(_data->lua);
|
||||
|
||||
|
||||
static const struct luaL_reg library[] = {
|
||||
{"newWindow", lua::newWindow},
|
||||
{"newWidget", lua::newWidget},
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ PdfReader::PdfReader(const std::string& filename, const GeometryHints& hints)
|
||||
{
|
||||
open(filename, hints);
|
||||
}
|
||||
|
||||
|
||||
bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints)
|
||||
{
|
||||
if (!pdfImage) return false;
|
||||
@@ -39,7 +39,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints)
|
||||
|
||||
osg::Vec3 widthVec(hints.widthVec);
|
||||
osg::Vec3 heightVec(hints.heightVec);
|
||||
|
||||
|
||||
switch(hints.aspectRatioPolicy)
|
||||
{
|
||||
case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO):
|
||||
@@ -52,7 +52,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints)
|
||||
// no need to adjust aspect ratio
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec,
|
||||
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
|
||||
|
||||
@@ -69,7 +69,7 @@ bool PdfReader::assign(PdfImage* pdfImage, const GeometryHints& hints)
|
||||
pictureQuad->setEventCallback(new osgViewer::InteractiveImageHandler(_pdfImage.get()));
|
||||
|
||||
addDrawable(pictureQuad);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -82,20 +82,20 @@ bool PdfReader::open(const std::string& filename, const GeometryHints& hints)
|
||||
bool PdfReader::page(int pageNum)
|
||||
{
|
||||
if (!_pdfImage) return false;
|
||||
|
||||
|
||||
return _pdfImage->page(pageNum);
|
||||
}
|
||||
|
||||
bool PdfReader::previous()
|
||||
{
|
||||
if (!_pdfImage) return false;
|
||||
|
||||
|
||||
return _pdfImage->previous();
|
||||
}
|
||||
|
||||
bool PdfReader::next()
|
||||
{
|
||||
if (!_pdfImage) return false;
|
||||
|
||||
|
||||
return _pdfImage->next();
|
||||
}
|
||||
|
||||
@@ -25,100 +25,100 @@ bool Style::applyStyle(Widget* widget, Reader r) {
|
||||
|
||||
if(_match("pos %i %i", r) || _match("pos %f %f", r)) {
|
||||
r.readSequence(vec2);
|
||||
|
||||
|
||||
widget->setOrigin(vec2);
|
||||
}
|
||||
|
||||
else if(_match("pos-x %i", r) || _match("pos-x %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setX(f);
|
||||
}
|
||||
|
||||
else if(_match("pos-y %i", r) || _match("pos-y %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setY(f);
|
||||
}
|
||||
|
||||
else if(_match("size %i %i", r) || _match("size %f %f", r)) {
|
||||
r.readSequence(vec2);
|
||||
|
||||
|
||||
widget->setSize(vec2);
|
||||
}
|
||||
|
||||
else if(_match("width %i", r) || _match("width %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setWidth(f);
|
||||
}
|
||||
|
||||
else if(_match("height %i", r) || _match("height %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setHeight(f);
|
||||
}
|
||||
|
||||
// Color using 4x 0-255 integers.
|
||||
else if(_match("color %i %i %i %i", r)) {
|
||||
r.readSequence(vec4);
|
||||
|
||||
|
||||
widget->setColor(vec4 / 255.0f);
|
||||
}
|
||||
|
||||
// Color using 3x 0-255 integers with a default alpha of 255.
|
||||
else if(_match("color %i %i %i", r)) {
|
||||
r.readSequence(vec3);
|
||||
|
||||
|
||||
widget->setColor(osg::Vec4(vec3[0], vec3[1], vec3[2], 255.0f) / 255.0f);
|
||||
}
|
||||
|
||||
|
||||
// Color using 4x 0.0f-1.0f floats.
|
||||
else if(_match("color %f %f %f %f", r)) {
|
||||
r.readSequence(vec4);
|
||||
|
||||
|
||||
widget->setColor(vec4);
|
||||
}
|
||||
|
||||
// Color using 3x 0.0f-1.0f floats with a default alpha of 1.0f.
|
||||
else if(_match("color %f %f %f", r)) {
|
||||
r.readSequence(vec3);
|
||||
|
||||
|
||||
widget->setColor(osg::Vec4(vec3[0], vec3[1], vec3[2], 1.0f));
|
||||
}
|
||||
|
||||
// Set padding uniformly.
|
||||
else if(_match("padding %i", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setPadding(f);
|
||||
}
|
||||
|
||||
// Set left padding.
|
||||
else if(_match("padding-left %i", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setPadLeft(f);
|
||||
}
|
||||
|
||||
// Set right padding.
|
||||
else if(_match("padding-right %i", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setPadRight(f);
|
||||
}
|
||||
|
||||
// Set top padding.
|
||||
else if(_match("padding-top %i", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setPadTop(f);
|
||||
}
|
||||
|
||||
// Set bottom padding.
|
||||
else if(_match("padding-bottom %i", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
widget->setPadBottom(f);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ bool Style::applyStyle(Widget* widget, Reader r) {
|
||||
|
||||
else if(_match("halign %w", r)) {
|
||||
r.readSequence(str);
|
||||
|
||||
|
||||
widget->setAlignHorizontal(strToHAlign(str));
|
||||
}
|
||||
|
||||
@@ -178,19 +178,19 @@ bool Style::applyStyle(Window* window, Reader r) {
|
||||
|
||||
if(_match("pos %i %i", r) || _match("pos %f %f", r)) {
|
||||
r.readSequence(vec2);
|
||||
|
||||
|
||||
window->setOrigin(vec2.x(), vec2.y());
|
||||
}
|
||||
|
||||
else if(_match("pos-x %i", r) || _match("pos-x %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
window->setX(f);
|
||||
}
|
||||
|
||||
else if(_match("pos-y %i", r) || _match("pos-y %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
window->setY(f);
|
||||
}
|
||||
|
||||
@@ -202,13 +202,13 @@ bool Style::applyStyle(Window* window, Reader r) {
|
||||
|
||||
else if(_match("width %i", r) || _match("width %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
window->resize(f);
|
||||
}
|
||||
|
||||
else if(_match("height %i", r) || _match("height %f", r)) {
|
||||
r.readSequence(f);
|
||||
|
||||
|
||||
window->resize(0.0f, f);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ Widget::Layer Style::strToLayer(const std::string& layer)
|
||||
else if(l == "middle") return Widget::LAYER_MIDDLE;
|
||||
|
||||
else if(l == "low") return Widget::LAYER_LOW;
|
||||
|
||||
|
||||
else if(l == "bg") return Widget::LAYER_BG;
|
||||
|
||||
else {
|
||||
@@ -312,7 +312,7 @@ Widget::CoordinateMode Style::strToCoordMode(const std::string& coordmode) {
|
||||
|
||||
bool Style::strToFill(const std::string& fill) {
|
||||
std::string cm = lowerCase(fill);
|
||||
|
||||
|
||||
if(cm == "true") return true;
|
||||
|
||||
else if(cm == "false") return false;
|
||||
|
||||
@@ -81,7 +81,7 @@ void Table::_resizeImplementation(point_type width, point_type height) {
|
||||
|
||||
for(unsigned int row = 0; row < _rows; row++) {
|
||||
point_type h = height / numRowFills;
|
||||
|
||||
|
||||
if(cur >= _lastRowAdd && hrem) {
|
||||
_lastRowAdd++;
|
||||
h++;
|
||||
@@ -147,7 +147,7 @@ Window::Sizes Table::_getWidthImplementation() const {
|
||||
|
||||
getColumnWidths(cols);
|
||||
getColumnMinWidths(minCols);
|
||||
|
||||
|
||||
return Sizes(
|
||||
std::accumulate(cols.begin(), cols.end(), 0.0f, Plus()),
|
||||
std::accumulate(minCols.begin(), minCols.end(), 0.0f, Plus())
|
||||
|
||||
@@ -19,7 +19,7 @@ std::string getFilePath(const std::string& filename) {
|
||||
osgDB::FilePathList path;
|
||||
|
||||
char* fp = getenv("OSGWIDGET_FILE_PATH");
|
||||
|
||||
|
||||
osgDB::convertStringPathIntoFilePathList(fp ? fp : ".", path);
|
||||
|
||||
return osgDB::findFileInPath(filename, path);
|
||||
@@ -27,11 +27,11 @@ std::string getFilePath(const std::string& filename) {
|
||||
|
||||
std::string generateRandomName(const std::string& base) {
|
||||
static unsigned int count = 0;
|
||||
|
||||
|
||||
std::stringstream ss;
|
||||
|
||||
ss << base << "_" << count;
|
||||
|
||||
|
||||
count++;
|
||||
|
||||
return ss.str();
|
||||
@@ -50,7 +50,7 @@ osg::Camera* createOrthoCamera(matrix_type width, matrix_type height) {
|
||||
camera->setViewMatrix(osg::Matrix::identity());
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
camera->setRenderOrder(osg::Camera::POST_RENDER);
|
||||
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ bool MouseHandler::handle(
|
||||
|
||||
return (this->*ma)(gea.getX(), gea.getY(), gea.getButton());
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,23 +93,23 @@ MouseHandler::MouseAction MouseHandler::_isMouseEvent(
|
||||
if(ev == osgGA::GUIEventAdapter::PUSH) return
|
||||
&MouseHandler::_handleMousePush
|
||||
;
|
||||
|
||||
|
||||
else if(ev == osgGA::GUIEventAdapter::RELEASE) return
|
||||
&MouseHandler::_handleMouseRelease
|
||||
;
|
||||
|
||||
|
||||
else if(ev == osgGA::GUIEventAdapter::DOUBLECLICK) return
|
||||
&MouseHandler::_handleMouseDoubleClick
|
||||
;
|
||||
|
||||
|
||||
else if(ev == osgGA::GUIEventAdapter::DRAG) return
|
||||
&MouseHandler::_handleMouseDrag
|
||||
;
|
||||
|
||||
|
||||
else if(ev == osgGA::GUIEventAdapter::MOVE) return
|
||||
&MouseHandler::_handleMouseMove
|
||||
;
|
||||
|
||||
|
||||
else if(ev == osgGA::GUIEventAdapter::SCROLL) return
|
||||
&MouseHandler::_handleMouseScroll
|
||||
;
|
||||
@@ -179,7 +179,7 @@ bool ResizeHandler::handle(
|
||||
|
||||
_wm->setSize(w, h);
|
||||
}
|
||||
|
||||
|
||||
_wm->setWindowSize(w, h);
|
||||
_wm->resizeAllWindows();
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ VncClient::VncClient(const std::string& hostname, const GeometryHints& hints)
|
||||
bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints)
|
||||
{
|
||||
if (!vncImage) return false;
|
||||
|
||||
|
||||
_vncImage = vncImage;
|
||||
|
||||
bool flip = _vncImage->getOrigin()==osg::Image::TOP_LEFT;
|
||||
@@ -34,7 +34,7 @@ bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints)
|
||||
|
||||
osg::Vec3 widthVec(hints.widthVec);
|
||||
osg::Vec3 heightVec(hints.heightVec);
|
||||
|
||||
|
||||
switch(hints.aspectRatioPolicy)
|
||||
{
|
||||
case(GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO):
|
||||
@@ -47,7 +47,7 @@ bool VncClient::assign(VncImage* vncImage, const GeometryHints& hints)
|
||||
// no need to adjust aspect ratio
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(hints.position, widthVec, heightVec,
|
||||
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
|
||||
|
||||
@@ -77,6 +77,6 @@ bool VncClient::connect(const std::string& hostname, const GeometryHints& hints)
|
||||
void VncClient::close()
|
||||
{
|
||||
if (!_vncImage) return;
|
||||
|
||||
|
||||
_vncImage->close();
|
||||
}
|
||||
|
||||
@@ -160,12 +160,12 @@ void Widget::setDimensions(point_type x, point_type y, point_type w, point_type
|
||||
// valid, however.
|
||||
if(_coordMode == CM_RELATIVE) {
|
||||
XYCoord size;
|
||||
|
||||
|
||||
if(_parent) size = _parent->getSize();
|
||||
|
||||
if(x >= 0.0f && x <= 1.0f) {
|
||||
_relCoords[0] = x;
|
||||
|
||||
|
||||
x = size.x() * x;
|
||||
}
|
||||
|
||||
@@ -174,16 +174,16 @@ void Widget::setDimensions(point_type x, point_type y, point_type w, point_type
|
||||
|
||||
y = size.y() * y;
|
||||
}
|
||||
|
||||
|
||||
if(w >= 0.0f && w <= 1.0f) {
|
||||
_relCoords[2] = w;
|
||||
|
||||
|
||||
w = size.x() * w;
|
||||
}
|
||||
|
||||
|
||||
if(h >= 0.0f && h <= 1.0f) {
|
||||
_relCoords[3] = h;
|
||||
|
||||
|
||||
h = size.y() * h;
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ void Widget::setColor(color_type r, color_type g, color_type b, color_type a, Co
|
||||
|
||||
void Widget::addColor(color_type r, color_type g, color_type b, color_type a, Corner p) {
|
||||
ColorArray* cols = _cols();
|
||||
|
||||
|
||||
if(p == ALL_CORNERS) {
|
||||
(*cols)[LL] += Color(r, g, b, a);
|
||||
(*cols)[LR] += Color(r, g, b, a);
|
||||
@@ -263,7 +263,7 @@ void Widget::setTexCoordRegion(point_type x, point_type y, point_type w, point_t
|
||||
XYCoord t(x / tw, y / tw);
|
||||
|
||||
(*texs)[LL] = t;
|
||||
|
||||
|
||||
// Set the LOWER_RIGHT point.
|
||||
t += XYCoord(w / tw, 0.0f);
|
||||
|
||||
@@ -297,7 +297,7 @@ void Widget::setTexCoordWrapVertical() {
|
||||
osg::Texture* texture = _texture();
|
||||
|
||||
if(!image || !texture || image->t() == 0.0f) return;
|
||||
|
||||
|
||||
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||
|
||||
setTexCoord(0.0f, getHeight() / image->t(), UPPER_LEFT);
|
||||
@@ -318,11 +318,11 @@ bool Widget::setImage(osg::Image* image, bool setTexCoords, bool useTextRect) {
|
||||
}
|
||||
|
||||
osg::Texture* texture = 0;
|
||||
|
||||
|
||||
if(useTextRect) texture = new osg::TextureRectangle();
|
||||
|
||||
|
||||
else texture = new osg::Texture2D();
|
||||
|
||||
|
||||
if(!texture) return false;
|
||||
|
||||
texture->setImage(0, image);
|
||||
@@ -431,19 +431,19 @@ void Widget::addSize(point_type w, point_type h) {
|
||||
MACRO_WIDGET_H(verts) + h
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
else setDimensions(-1.0f, -1.0f, _relCoords[2] + w, _relCoords[3] + h);
|
||||
}
|
||||
|
||||
point_type Widget::getWidth() const {
|
||||
const PointArray* verts = _verts();
|
||||
|
||||
|
||||
return MACRO_WIDGET_W(verts);
|
||||
}
|
||||
|
||||
point_type Widget::getHeight() const {
|
||||
const PointArray* verts = _verts();
|
||||
|
||||
|
||||
return MACRO_WIDGET_H(verts);
|
||||
}
|
||||
|
||||
@@ -512,14 +512,14 @@ Color Widget::getImageColorAtXY(point_type x, point_type y) const {
|
||||
|
||||
point_type X = ((x / getWidth()) * width) + (*texs)[LL].x();
|
||||
point_type Y = (((getHeight() - y) / getHeight()) * height) + (*texs)[UR].y();
|
||||
|
||||
|
||||
return image->getColor(TexCoord(X, Y));
|
||||
}
|
||||
|
||||
bool Widget::isPaddingUniform() const {
|
||||
return
|
||||
_padLeft == _padRight &&
|
||||
_padLeft == _padTop &&
|
||||
_padLeft == _padTop &&
|
||||
_padLeft == _padBottom
|
||||
;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ bool callbackWindowMove(Event& ev) {
|
||||
|
||||
ev.getWindow()->addOrigin(ev.x, ev.y);
|
||||
ev.getWindow()->update();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ bool callbackWindowRotate(Event& ev) {
|
||||
|
||||
ev.getWindow()->addRotate(ev.y);
|
||||
ev.getWindow()->update();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ bool callbackWindowScale(Event& ev) {
|
||||
|
||||
ev.getWindow()->addScale(ev.y);
|
||||
ev.getWindow()->update();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool callbackWindowTabFocus(Event& ev) {
|
||||
if(!ev.getWindow() || ev.key != osgGA::GUIEventAdapter::KEY_Tab) return false;
|
||||
|
||||
|
||||
return ev.getWindow()->setNextFocusable();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void Window::EmbeddedWindow::parented(Window* parent) {
|
||||
else warn()
|
||||
<< "EmbeddedWindow Widget [" << _name
|
||||
<< "] cannot embed itself in Window [" << _window->getName()
|
||||
<< "], since it is already a child of [" << _window->_parent->getName()
|
||||
<< "], since it is already a child of [" << _window->_parent->getName()
|
||||
<< "]" << std::endl
|
||||
;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ bool Window::resizePercent(point_type width, point_type height) {
|
||||
_wm->getWidth() * (width / 100.0f),
|
||||
_wm->getHeight() * (height / 100.0f)
|
||||
);
|
||||
|
||||
|
||||
else return resize(
|
||||
_parent->getWidth() * (width / 100.0f),
|
||||
_parent->getHeight() * (height / 100.0f)
|
||||
@@ -332,7 +332,7 @@ void Window::update() {
|
||||
|
||||
xy.set(x, y);
|
||||
}
|
||||
|
||||
|
||||
matrix_type z = _z;
|
||||
|
||||
// We can't do proper scissoring until we have access to our parent WindowManager, and
|
||||
@@ -412,11 +412,11 @@ void Window::_setWidthAndHeight() {
|
||||
if(_height.minimum < 0.0f) _setWidthAndHeightUnknownSizeError("minimum height", _height.minimum);
|
||||
|
||||
if(hasDecimal(_width.current)) _setWidthAndHeightNotPAError("current width", _width.current);
|
||||
|
||||
|
||||
if(hasDecimal(_width.minimum)) _setWidthAndHeightNotPAError("minimum width", _width.minimum);
|
||||
|
||||
|
||||
if(hasDecimal(_height.current)) _setWidthAndHeightNotPAError("current height", _height.current);
|
||||
|
||||
|
||||
if(hasDecimal(_height.minimum)) _setWidthAndHeightNotPAError("minimum height", _height.minimum);
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ void Window::_removeFromGeode(Widget* widget) {
|
||||
bool Window::_setWidget(Widget* widget, int index) {
|
||||
if(!widget) {
|
||||
warn() << "Window [" << _name << "] called addWidget with NULL." << std::endl;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ bool Window::_setWidget(Widget* widget, int index) {
|
||||
widget->_index = geode->getNumDrawables();
|
||||
|
||||
geode->addDrawable(widget);
|
||||
|
||||
|
||||
_setParented(widget);
|
||||
_setManaged(widget);
|
||||
_setStyled(widget);
|
||||
@@ -531,7 +531,7 @@ void Window::_setStyled(Widget* widget) {
|
||||
|
||||
void Window::_setParented(Widget* widget, bool setUnparented) {
|
||||
if(!widget) return;
|
||||
|
||||
|
||||
if(!setUnparented) {
|
||||
widget->_parent = this;
|
||||
|
||||
@@ -547,7 +547,7 @@ void Window::_setParented(Widget* widget, bool setUnparented) {
|
||||
|
||||
void Window::_setManaged(Widget* widget, bool setUnmanaged) {
|
||||
if(!widget || !_wm) return;
|
||||
|
||||
|
||||
// Tell the widget it's managed if it isn't already...
|
||||
if(!setUnmanaged) {
|
||||
if(widget->_isManaged) return;
|
||||
@@ -675,7 +675,7 @@ bool Window::setFocused(const Widget* widget) {
|
||||
|
||||
for(WindowList::iterator w = wl.begin(); w != wl.end(); w++) {
|
||||
ConstIterator ii = std::find(w->get()->begin(), w->get()->end(), widget);
|
||||
|
||||
|
||||
if(ii != w->get()->end()) {
|
||||
found = true;
|
||||
i = ii;
|
||||
@@ -736,7 +736,7 @@ bool Window::setFocused(const std::string& name) {
|
||||
}
|
||||
|
||||
_setFocused(w1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ point_type Window::_getNumFill(int begin, int end, int add) const {
|
||||
|
||||
Window::Sizes Window::_getWidthImplementation() const {
|
||||
osg::BoundingBox bb = getGeode()->getBoundingBox();
|
||||
|
||||
|
||||
point_type w = osg::round(bb.xMax() - bb.xMin());
|
||||
|
||||
return Sizes(w, 0.0f);
|
||||
|
||||
@@ -59,7 +59,7 @@ _styleManager (new StyleManager()) {
|
||||
// Setup our picking debug (is debug the right word here?) Window...
|
||||
if(_flags & WM_PICK_DEBUG) {
|
||||
_pickWindow = new Box("PickWindow", Box::VERTICAL);
|
||||
|
||||
|
||||
Label* label = new Label("PickLabel");
|
||||
|
||||
label->setFontSize(13);
|
||||
@@ -113,7 +113,7 @@ WindowManager::WindowManager(const WindowManager& wm, const osg::CopyOp& co):
|
||||
WindowManager::~WindowManager()
|
||||
{
|
||||
if(_flags & WM_USE_LUA) _lua->close();
|
||||
|
||||
|
||||
if(_flags & WM_USE_PYTHON) _python->close();
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ bool WindowManager::_handleMousePushed(float x, float y, bool& down) {
|
||||
Window* topmostWindow = ev._window->getTopmostParent();
|
||||
|
||||
setFocused(topmostWindow);
|
||||
|
||||
|
||||
if(ev._widget) topmostWindow->setFocused(ev._widget);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void WindowManager::childInserted(unsigned int i) {
|
||||
|
||||
_styleManager->applyStyles(window);
|
||||
}
|
||||
|
||||
|
||||
void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
|
||||
for (unsigned int i = start; i < start+numChildren; i++)
|
||||
{
|
||||
@@ -280,7 +280,7 @@ void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
|
||||
if(!window) continue;
|
||||
|
||||
if(_remove(window)) {
|
||||
|
||||
|
||||
window->_index = 0;
|
||||
window->unmanaged(this);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) {
|
||||
}
|
||||
|
||||
if(_flags & WM_PICK_DEBUG) _updatePickWindow(0, x, y);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) {
|
||||
for(WindowVector::iterator i = windows.begin(); i != windows.end(); i++) {
|
||||
warn() << "- " << i->get()->getName() << " " << i->get()->getOrCreateStateSet()->getBinNumber() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
warn() << std::endl;
|
||||
|
||||
return false;
|
||||
@@ -394,7 +394,7 @@ bool WindowManager::setFocused(Window* window) {
|
||||
Event ev(this);
|
||||
|
||||
ev._window = window;
|
||||
|
||||
|
||||
// Inform the previously focused Window that it is going to be unfocused.
|
||||
if(_focused.valid()) _focused->callMethodAndCallbacks(ev.makeType(EVENT_UNFOCUS));
|
||||
|
||||
@@ -414,7 +414,7 @@ bool WindowManager::setFocused(Window* window) {
|
||||
if(w->getStrata() == Window::STRATA_FOREGROUND) fg.push_back(w);
|
||||
|
||||
else if(w->getStrata() == Window::STRATA_BACKGROUND) bg.push_back(w);
|
||||
|
||||
|
||||
else focusable.push_back(w);
|
||||
}
|
||||
|
||||
@@ -450,14 +450,14 @@ bool WindowManager::setFocused(Window* window) {
|
||||
|
||||
// Handled our special BACKGROUND Windows.
|
||||
for(Iterator w = bg.begin(); w != bg.end(); w++) w->get()->_z = -zRange * i;
|
||||
|
||||
|
||||
// Handle our special FOREGOUND Windows.
|
||||
for(Iterator w = fg.begin(); w != fg.end(); w++) w->get()->_z = -zRange;
|
||||
|
||||
|
||||
// Update every window, regardless.
|
||||
for(Iterator w = begin(); w != end(); w++) {
|
||||
Window* win = w->get();
|
||||
|
||||
|
||||
win->_zRange = zRange;
|
||||
|
||||
win->update();
|
||||
@@ -477,7 +477,7 @@ void WindowManager::setPointerXY(float x, float y) {
|
||||
// If ydiff isn't NEAR 0 (floating point booleans aren't 100% reliable, but that
|
||||
// doesn't matter in our case), assume we have either up or down movement.
|
||||
if(ydiff != 0.0f) _lastVertical = ydiff > 0.0f ? PD_UP : PD_DOWN;
|
||||
|
||||
|
||||
else _lastVertical = PD_NONE;
|
||||
|
||||
// If xdiff isn't 0, assume we have either left or right movement.
|
||||
@@ -508,7 +508,7 @@ void WindowManager::setStyleManager(StyleManager* sm) {
|
||||
void WindowManager::resizeAllWindows(bool visible) {
|
||||
for(Iterator i = begin(); i != end(); i++) if(i->valid()) {
|
||||
if(visible && !getValue(i->get()->_index)) continue;
|
||||
|
||||
|
||||
i->get()->resize();
|
||||
}
|
||||
}
|
||||
@@ -556,7 +556,7 @@ bool WindowManager::pointerMove(float x, float y) {
|
||||
Event evLeave(this);
|
||||
|
||||
evLeave.makeMouse(x, y, EVENT_MOUSE_LEAVE);
|
||||
|
||||
|
||||
setEventFromInterface(evLeave, _lastEvent);
|
||||
|
||||
_lastEvent->callMethodAndCallbacks(evLeave);
|
||||
|
||||
Reference in New Issue
Block a user