Commit e1cad012 authored by Jan Möbius's avatar Jan Möbius
Browse files

Made Paste View backward compatible

Fixed nasty resize bug, computing the wrong size for the splitter.

closes #981

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14912 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 18b5048f
......@@ -844,19 +844,20 @@ void CoreWidget::slotPasteViewAndWindow()
//resize the toolbox and splitter
if (splitterWidth != -1)
{
QList<int> sizes = toolSplitter_->sizes();
unsigned sum_size = sizes[0]+sizes[1];
QList<int> sizes;
bool onRight = OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight").toBool();
//std::cerr << "Sizes : " << size[0] << " " << size[1] << " " << sum_size << std::endl;
bool onRight = OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight",true).toBool();
if (onRight)
{
sizes[1] = splitterWidth;
sizes[0] = sum_size - splitterWidth;
sizes.push_back(size.width() - splitterWidth);
sizes.push_back(splitterWidth);
}
else
{
sizes[0] = splitterWidth;
sizes[1] = sum_size - splitterWidth;
sizes.push_back(splitterWidth);
sizes.push_back(size.width() - splitterWidth);
}
toolSplitter_->setSizes(sizes);
......@@ -885,7 +886,7 @@ void CoreWidget::slotCopyView( ) {
size = QSize (width(),height());
int splitter_size = 0;
if (OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight").toBool())
if (OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight",true).toBool())
splitter_size = toolSplitter_->sizes()[1];
else
splitter_size = toolSplitter_->sizes()[0];
......
......@@ -1048,40 +1048,92 @@ bool glViewer::decodeView(const QString& _view, QSize *_windowSize /*= NULL*/, i
ACG::GLMatrixd m, p;
int pMode;
// Check if the number of components matches the expected size
if ( split.size() != 37 ) {
std::cerr << "Unable to paste view ... wrong parameter count!! is" << split.size() << std::endl;
return false;
}
//////////////////
// Parse the components
// first, get the projection and the modelview matrices
for (std::size_t i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 4; ++j)
// New version
if ( split.size() == 37 ) {
//*********************************************************
// Parse the components
// first, get the projection and the modelview matrices
//*********************************************************
for (std::size_t i = 0; i < 4; ++i)
{
m(i,j) = split[i*4 + j].toDouble();
p(i,j) = split[i*4 + j +16].toDouble();
for (std::size_t j = 0; j < 4; ++j)
{
m(i,j) = split[i*4 + j].toDouble();
p(i,j) = split[i*4 + j +16].toDouble();
}
}
}
//parse the window size if requested
if (_windowSize)
{
//restore the old window size
int w = split[32].toInt();
int h = split[33].toInt();
*_windowSize = QSize(w,h);
}
//parse the splitter width if requested
if (_splitterWidth)
{
*_splitterWidth = split[34].toInt();
}
//*********************************************************
//parse the window size if requested
//*********************************************************
if (_windowSize)
{
//restore the old window size
int w = split[32].toInt();
int h = split[33].toInt();
*_windowSize = QSize(w,h);
}
//*********************************************************
//parse the splitter width for the toolboxes if requested
//*********************************************************
if (_splitterWidth )
{
*_splitterWidth = split[34].toInt();
} else {
*_splitterWidth = -1;
}
pMode = split[35].toInt();
properties_.orthoWidth( split[36].toDouble() );
//*********************************************************
// Projection mode and orthogonal width
//*********************************************************
pMode = split[35].toInt();
properties_.orthoWidth( split[36].toDouble() );
} else if ( split.size() == 36 ) { // Old Version
//*********************************************************
// Parse the components
// first, get the projection and the modelview matrices
//*********************************************************
for (std::size_t i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 4; ++j)
{
m(i,j) = split[i*4 + j].toDouble();
p(i,j) = split[i*4 + j +16].toDouble();
}
}
//*********************************************************
//parse the window size if requested
//*********************************************************
if (_windowSize)
{
//restore the old window size
int w = split[32].toInt();
int h = split[33].toInt();
*_windowSize = QSize(w,h);
}
//*********************************************************
// Return -1 to inform, that the value is unknown
//*********************************************************
*_splitterWidth = -1;
//*********************************************************
// Projection mode and orthogonal width
//*********************************************************
pMode = split[34].toInt();
properties_.orthoWidth( split[35].toDouble() );
} else { // Garbage ?!
std::cerr << "Unable to paste view ... wrong parameter count!! is" << split.size() << std::endl;
return false;
}
// Switch to our gl context
makeCurrent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment