Minor changes

This commit is contained in:
wmayer 2013-04-26 17:16:01 +02:00
parent 60eeb81183
commit c7b0125769
10 changed files with 27 additions and 20 deletions

View File

@ -77,10 +77,7 @@ public:
/** @name Printing */
//@{
public Q_SLOTS:
virtual void setOverrideCursor(const QCursor&);
virtual void restoreOverrideCursor();
virtual void print(QPrinter* printer);
public:
/** Print content of view */
virtual void print();
@ -107,6 +104,10 @@ public:
virtual void setCurrentViewMode(ViewMode mode);
ViewMode currentViewMode() const { return currentMode; }
public Q_SLOTS:
virtual void setOverrideCursor(const QCursor&);
virtual void restoreOverrideCursor();
Q_SIGNALS:
void message(const QString&, int);

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2009 Juergen Riegel (FreeCAD@juergen-riegel.net) *
* Copyright (c) 2009 Juergen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *

View File

@ -26,6 +26,7 @@
#include <Inventor/nodekits/SoSubKit.h>
#include <Inventor/nodekits/SoBaseKit.h>
#include <Inventor/nodes/SoShape.h>
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFColor.h>
#include <Inventor/fields/SoSFString.h>

View File

@ -772,12 +772,9 @@ bool View3DInventor::hasClippingPlane() const
return _viewer->hasClippingPlane();
}
void View3DInventor::setOverlayWidget(GLOverlayWidget* widget)
void View3DInventor::setOverlayWidget(QWidget* widget)
{
removeOverlayWidget();
QGLWidget* w = static_cast<QGLWidget*>(_viewer->getGLWidget());
QImage img = w->grabFrameBuffer();
widget->setImage(img);
stack->addWidget(widget);
stack->setCurrentIndex(1);
}

View File

@ -100,7 +100,7 @@ public:
void toggleClippingPlane();
bool hasClippingPlane() const;
void setOverlayWidget(GLOverlayWidget*);
void setOverlayWidget(QWidget*);
void removeOverlayWidget();
View3DInventorViewer *getViewer(void) const {return _viewer;}

View File

@ -123,7 +123,7 @@ void ImageBase::clear()
_setColorFormat(IB_CF_GREY8, 8);
}
// Sets the color format and the dependant parameters
// Sets the color format and the dependent parameters
// Returns 0 for OK, -1 for invalid color format
int ImageBase::_setColorFormat(int format, unsigned short numSigBitsPerSample)
{
@ -235,7 +235,7 @@ int ImageBase::createCopy(void* pSrcPixelData, unsigned long width, unsigned lon
// Clear any existing data
clear();
// Set the color format and the dependant parameters
// Set the color format and the dependent parameters
if (_setColorFormat(format, numSigBitsPerSample) != 0)
return -1;
@ -273,7 +273,7 @@ int ImageBase::pointTo(void* pSrcPixelData, unsigned long width, unsigned long h
// Clear any existing data
clear();
// Set the color format and the dependant parameters
// Set the color format and the dependent parameters
if (_setColorFormat(format, numSigBitsPerSample) != 0)
return -1;
@ -324,15 +324,15 @@ int ImageBase::getSample(int x, int y, unsigned short sampleIndex, double &value
case IB_CF_RGBA64:
case IB_CF_BGRA64:
{
unsigned short* pPix16 = (unsigned short *)_pPixelData;
unsigned short* pSample = pPix16 + _numSamples * (y * _width + x) + sampleIndex;
uint16_t* pPix16 = (uint16_t *)_pPixelData;
uint16_t* pSample = pPix16 + _numSamples * (y * _width + x) + sampleIndex;
value = (double)(*pSample);
}
break;
case IB_CF_GREY32:
{
unsigned long* pPix32 = (unsigned long *)_pPixelData;
unsigned long* pSample = pPix32 + y * _width + x;
uint32_t* pPix32 = (uint32_t *)_pPixelData;
uint32_t* pSample = pPix32 + y * _width + x;
value = (double)(*pSample);
}
break;

View File

@ -71,7 +71,7 @@ protected:
int _format; // colour format of the pixel data
unsigned short _numSigBitsPerSample;// number of significant bits per sample (always <= _numBitsPerSample)
// Dependant parameters
// Dependent parameters
unsigned short _numSamples; // number of samples per pixel (e.g. 1 for grey, 3 for rgb, 4 for rgba)
unsigned short _numBitsPerSample; // number of bits per sample (e.g. 8 for Grey8)
unsigned short _numBytesPerPixel; // number of bytes per pixel (e.g. 1 for Grey8)

View File

@ -45,6 +45,8 @@ using namespace ImageGui;
#pragma warning(disable:4305) // init: truncation from const double to float
#endif
bool GLImageBox::haveMesa = false;
/* TRANSLATOR ImageGui::GLImageBox */
// Constructor
@ -81,7 +83,13 @@ GLImageBox::~GLImageBox()
// Set up the OpenGL rendering state
void GLImageBox::initializeGL()
{
qglClearColor( Qt::black ); // Let OpenGL clear to black
qglClearColor( Qt::black ); // Let OpenGL clear to black
static bool init = false;
if (!init) {
init = true;
std::string ver = (const char*)(glGetString(GL_VERSION));
haveMesa = (ver.find("Mesa") != std::string::npos);
}
}
@ -170,7 +178,7 @@ void GLImageBox::drawImage()
// Load the color map if present
if (_pColorMap != 0)
{
glPixelTransferf(GL_MAP_COLOR, 1.0);
if (!haveMesa) glPixelTransferf(GL_MAP_COLOR, 1.0);
glPixelMapfv(GL_PIXEL_MAP_R_TO_R, _numMapEntries, _pColorMap);
glPixelMapfv(GL_PIXEL_MAP_G_TO_G, _numMapEntries, _pColorMap + _numMapEntries);
glPixelMapfv(GL_PIXEL_MAP_B_TO_B, _numMapEntries, _pColorMap + _numMapEntries * 2);

View File

@ -105,6 +105,7 @@ private:
float* _pColorMap; // a RGBA color map (to alter the intensity or colors)
int _numMapEntries; // number of entries in color map
static bool haveMesa;
};

View File

@ -58,7 +58,6 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* Workbench::setupCommandBars() const
{
// Part tools
Gui::ToolBarItem* root = new Gui::ToolBarItem;
Gui::ToolBarItem* img = new Gui::ToolBarItem(root);
img->setCommand("Image");