height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() * scale : aFontMetrics.height();
}
- return GLViewer_Rect( 0, width, height, 0 );
+ return GLViewer_Rect( 0, width, 0, height );
}
/*!
class GLVIEWER_API GLViewer_Rect
{
public:
- GLViewer_Rect(): myLeft(0.0), myRight(0.0), myTop(0.0), myBottom(0.0){}
- GLViewer_Rect( float theLeft, float theRight, float theTop, float theBottom )
- : myLeft(theLeft), myRight(theRight), myTop(theTop), myBottom(theBottom) {}
+ GLViewer_Rect(): myLeft(0.0), myRight(0.0), myBottom(0.0), myTop(0.0) {}
+ GLViewer_Rect( float theLeft, float theRight, float theBottom, float theTop )
+ : myLeft(theLeft), myRight(theRight), myBottom(theBottom), myTop(theTop) {}
GLViewer_Rect( QRect theRect ) {
myLeft = ( float )theRect.left(); myRight = ( float )theRect.right();
- myTop = ( float )theRect.top(); myBottom = ( float )theRect.bottom(); }
+ myBottom = ( float )theRect.bottom(); myTop = ( float )theRect.top(); }
GLViewer_Rect( QRectF theRect ) {
myLeft = theRect.left(); myRight = theRect.right();
- myTop = theRect.top(); myBottom = theRect.bottom(); }
+ myBottom = theRect.bottom(); myTop = theRect.top(); }
float left() const { return myLeft; }
float right() const { return myRight; }
- float top() const { return myTop; }
float bottom() const { return myBottom; }
+ float top() const { return myTop; }
float width() const { return fabs( myRight - myLeft ); }
float height() const { return fabs( myTop - myBottom ); }
void setLeft( float theLeft ) { myLeft = theLeft; }
void setRight( float theRight ) { myRight = theRight; }
- void setTop( float theTop ) { myTop = theTop; }
void setBottom( float theBottom ) { myBottom = theBottom; }
+ void setTop( float theTop ) { myTop = theTop; }
void setCoords( float theLeft, float theRight, float theBottom, float theTop )
{ myLeft = theLeft; myRight = theRight; myBottom = theBottom; myTop = theTop; }
protected:
float myLeft;
float myRight;
- float myTop;
float myBottom;
+ float myTop;
bool myIsEmpty;
};
*aPointer = theArray[i];
//myRect = new QRect( aLeft, aTop, aRight - aLeft, aBottom - aTop );
- myRect = new GLViewer_Rect( aLeft, aRight, aTop, aBottom );
+ myRect = new GLViewer_Rect( aLeft, aRight, aBottom, aTop );
aPointer = (char*)&myXScale;
for( ; i < 5*aFSize; i++, aPointer++ )
virtual bool isPulling() { return false; }
//!\warning It is for ouv
virtual GLViewer_Rect getPullingRect() const { return GLViewer_Rect(
- myRect->left(), myRect->right(), myRect->top(), myRect->bottom() ); }
+ myRect->left(), myRect->right(), myRect->bottom(), myRect->top() ); }
//! Installs object rectangle
virtual void setRect( GLViewer_Rect* rect) { myRect = rect; }
myGLWidget->setForegroundColor( theColor );
}
+/*!
+ Gets foreground color
+ \return foreground color
+*/
+QColor GLViewer_ViewPort2d::foregroundColor() const
+{
+ return myGLWidget->foregroundColor();
+}
+
/*!
Sets foreground frame color
\param theColor - foreground frame color
//! Sets foreground color
void setForegroundColor( const QColor& theColor );
+ //! Gets foreground color
+ QColor foregroundColor() const;
+
//! Sets foreground frame color
void setForegroundFrameColor( const QColor& theColor );
return;
GLViewer_ViewPort2d* vp = ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() );
- QColor selColor = QColorDialog::getColor( vp->backgroundColor(), vp );
+ QColor selColor = vp->isForegroundEnabled() ? vp->foregroundColor() : vp->backgroundColor();
+ selColor = QColorDialog::getColor( selColor, vp );
if ( selColor.isValid() ) {
if( vp->isForegroundEnabled() )
vp->setForegroundColor( selColor );
myForegroundColor = theColor;
}
+/*!
+ Gets foreground color
+ \return foreground color
+*/
+QColor GLViewer_Widget::foregroundColor() const
+{
+ return myForegroundColor;
+}
+
/*!
Sets foreground frame color
\param theColor - foreground frame color
//! Sets foreground color
void setForegroundColor( const QColor& theColor );
+ //! Gets foreground color
+ QColor foregroundColor() const;
+
//! Sets foreground frame color
void setForegroundFrameColor( const QColor& theColor );