Commit 0746dabf authored by Jan Möbius's avatar Jan Möbius

Introduced double viewer layout

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12361 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 61a3e30c
...@@ -989,9 +989,12 @@ void Core::multiViewMode( int _mode ) { ...@@ -989,9 +989,12 @@ void Core::multiViewMode( int _mode ) {
PluginFunctions::setActiveExaminer(0); PluginFunctions::setActiveExaminer(0);
break; break;
case 1: case 1:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::Grid); coreWidget_->baseLayout_->setMode (QtMultiViewLayout::DoubleView);
break; break;
case 2: case 2:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::Grid);
break;
case 3:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::HSplit); coreWidget_->baseLayout_->setMode (QtMultiViewLayout::HSplit);
break; break;
...@@ -1411,7 +1414,7 @@ void Core::setDescriptions(){ ...@@ -1411,7 +1414,7 @@ void Core::setDescriptions(){
emit setSlotDescription("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList()); emit setSlotDescription("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList());
emit setSlotDescription("showStatusBar(bool)", tr("Show or hide status bar"), QStringList(tr("Show or hide the status bar")), QStringList()); emit setSlotDescription("showStatusBar(bool)", tr("Show or hide status bar"), QStringList(tr("Show or hide the status bar")), QStringList());
emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"), emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"),
QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n 1: Grid \n 2: Horizontal split"))); QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n1: Double Viewer\n2: Grid \n3: Horizontal split ")));
emit setSlotDescription("restrictFrameRate(bool)", tr("Restrict FrameRate to MaxFrameRate"), emit setSlotDescription("restrictFrameRate(bool)", tr("Restrict FrameRate to MaxFrameRate"),
QStringList(tr("enabled")), QStringList(tr("restriction switch"))); QStringList(tr("enabled")), QStringList(tr("restriction switch")));
......
...@@ -455,11 +455,13 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -455,11 +455,13 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
"Possible layouts are: " "Possible layouts are: "
"<ul> " "<ul> "
"<li>Single viewer</li>" "<li>Single viewer</li>"
"<li>Double viewer</li>"
"<li>Multiple viewers (grid)</li>" "<li>Multiple viewers (grid)</li>"
"<li>Multiple viewers (hsplit)</li>" "<li>Multiple viewers (hsplit)</li>"
"</ul>")); "</ul>"));
viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"singleviewmode.png"), ""); viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"singleviewmode.png"), "");
viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"doubleviewmode.png"), "");
viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode1.png"), ""); viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode1.png"), "");
viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode2.png"), ""); viewerLayoutBox_->addItem(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"multiviewmode2.png"), "");
...@@ -884,17 +886,24 @@ void CoreWidget::nextViewerLayout() { ...@@ -884,17 +886,24 @@ void CoreWidget::nextViewerLayout() {
switch (baseLayout_->mode()) { switch (baseLayout_->mode()) {
case QtMultiViewLayout::SingleView: case QtMultiViewLayout::SingleView:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid); baseLayout_->setMode(QtMultiViewLayout::DoubleView);
// Update combo box in the toolbar // Update combo box in the toolbar
viewerLayoutBox_->setCurrentIndex(1); viewerLayoutBox_->setCurrentIndex(1);
break; break;
case QtMultiViewLayout::DoubleView:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid);
// Update combo box in the toolbar
viewerLayoutBox_->setCurrentIndex(2);
break;
case QtMultiViewLayout::Grid: case QtMultiViewLayout::Grid:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit); baseLayout_->setMode(QtMultiViewLayout::HSplit);
// Update combo box in the toolbar // Update combo box in the toolbar
viewerLayoutBox_->setCurrentIndex(2); viewerLayoutBox_->setCurrentIndex(3);
break; break;
case QtMultiViewLayout::HSplit: case QtMultiViewLayout::HSplit:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
...@@ -915,17 +924,21 @@ CoreWidget::setViewerLayout(int _idx) { ...@@ -915,17 +924,21 @@ CoreWidget::setViewerLayout(int _idx) {
switch (_idx) { switch (_idx) {
case 0: case 0:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::SingleView); baseLayout_->setMode(QtMultiViewLayout::SingleView);
break; break;
case 1: case 1:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid); baseLayout_->setMode(QtMultiViewLayout::DoubleView);
break; break;
case 2: case 2:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ()); baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit); baseLayout_->setMode(QtMultiViewLayout::Grid);
break; break;
case 3:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit);
break;
} }
viewerLayoutBox_->setCurrentIndex(_idx); viewerLayoutBox_->setCurrentIndex(_idx);
......
...@@ -519,9 +519,9 @@ void CoreWidget::viewerSnapshotDialog() { ...@@ -519,9 +519,9 @@ void CoreWidget::viewerSnapshotDialog() {
QImage finalImage; QImage finalImage;
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage, examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage,
dialog.snapWidth->value(), dialog.snapHeight->value(), dialog.snapWidth->value(), dialog.snapHeight->value(),
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(), dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(),
dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1); dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1);
finalImage.save(newName); finalImage.save(newName);
......
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenFlipper * * OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen * * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org * * www.openflipper.org *
* * * *
*--------------------------------------------------------------------------- * *--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. * * This file is part of OpenFlipper. *
* * * *
* OpenFlipper is free software: you can redistribute it and/or modify * * OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of * * published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the * * the License, or (at your option) any later version with the *
* following exceptions: * * following exceptions: *
* * * *
* If other files instantiate templates or use macros * * If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and * * or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does * * link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the * * not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however * * GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be * * invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. * * covered by the GNU Lesser General Public License. *
* * * *
* OpenFlipper is distributed in the hope that it will be useful, * * OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * 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 *
* GNU Lesser General Public License for more details. * * GNU Lesser General Public License for more details. *
* * * *
* You should have received a copy of the GNU LesserGeneral Public * * You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, * * License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. * * see <http://www.gnu.org/licenses/>. *
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\ /*===========================================================================*\
* * * *
* $Revision$ * * $Revision$ *
* $LastChangedBy$ * * $LastChangedBy$ *
* $Date$ * * $Date$ *
* * * *
\*===========================================================================*/ \*===========================================================================*/
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
//== CLASS IMPLEMENTATION====================================================== //== CLASS IMPLEMENTATION======================================================
QtMultiViewLayout::QtMultiViewLayout (QGraphicsLayoutItem * _parent) : QtMultiViewLayout::QtMultiViewLayout (QGraphicsLayoutItem * _parent) :
QGraphicsLayout (_parent), QGraphicsLayout (_parent),
mode_ (SingleView), mode_ (SingleView),
spacing_ (2), spacing_ (2),
primary_ (0) primary_ (0)
{ {
items_[0] = 0; items_[0] = 0;
items_[1] = 0; items_[1] = 0;
...@@ -166,9 +166,16 @@ void QtMultiViewLayout::reLayout () ...@@ -166,9 +166,16 @@ void QtMultiViewLayout::reLayout ()
if (mode == SingleView) if (mode == SingleView)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
items_[i]->hide(); items_[i]->hide();
items_[primary_]->show (); items_[primary_]->show ();
} else { } else if ( mode == DoubleView) {
for (int i = 0; i < 2; i++)
if (items_[i])
items_[i]->show();
for (int i = 2; i < 4; i++)
if (items_[i])
items_[i]->hide();
}else {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
if (items_[i]) if (items_[i])
items_[i]->show(); items_[i]->show();
...@@ -179,43 +186,52 @@ void QtMultiViewLayout::reLayout () ...@@ -179,43 +186,52 @@ void QtMultiViewLayout::reLayout ()
case SingleView: case SingleView:
items_[primary_]->setGeometry (r); items_[primary_]->setGeometry (r);
break; break;
case DoubleView:
{
int width = (r.width() - spacing_) / 2;
int height = r.height();
items_[0]->resize (width, height);
items_[1]->resize (width, height);
items_[0]->setPos(r.topLeft());
items_[1]->setPos(r.x() + width + spacing_, r.y());
}
break;
case Grid: case Grid:
{ {
int width = (r.width() - spacing_) / 2; int width = (r.width() - spacing_) / 2;
int height = (r.height() - spacing_) / 2; int height = (r.height() - spacing_) / 2;
items_[0]->resize (width, height); items_[0]->resize (width, height);
items_[1]->resize (r.width() - width - spacing_, height); items_[1]->resize (r.width() - width - spacing_, height);
items_[2]->resize (width, r.height() - height - spacing_); items_[2]->resize (width, r.height() - height - spacing_);
items_[3]->resize (r.width() - width - spacing_, items_[3]->resize (r.width() - width - spacing_,r.height() - height - spacing_);
r.height() - height - spacing_); items_[0]->setPos (r.topLeft());
items_[0]->setPos (r.topLeft()); items_[1]->setPos (r.x() + width + spacing_, r.y());
items_[1]->setPos (r.x() + width + spacing_, r.y()); items_[2]->setPos (r.x(), r.y() + height + spacing_);
items_[2]->setPos (r.x(), r.y() + height + spacing_); items_[3]->setPos (r.x() + width + spacing_, r.y() + height + spacing_);
items_[3]->setPos (r.x() + width + spacing_, }
r.y() + height + spacing_); break;
}
break;
case HSplit: case HSplit:
{ {
int order[4]; int order[4];
order[0] = primary_; order[0] = primary_;
for (unsigned int i = 0, j = 1; i < 4; i++) for (unsigned int i = 0, j = 1; i < 4; i++)
if (i != primary_) if (i != primary_)
order[j++] = i; order[j++] = i;
int width = (r.width() - spacing_) * 3 / 4; int width = (r.width() - spacing_) * 3 / 4;
int ewidth = r.width() - spacing_ - width; int ewidth = r.width() - spacing_ - width;
int eheight = (r.height() - (spacing_ * 2)) / 3; int eheight = (r.height() - (spacing_ * 2)) / 3;
items_[order[0]]->resize (width, r.height()); items_[order[0]]->resize (width, r.height());
items_[order[1]]->resize (ewidth, eheight); items_[order[1]]->resize (ewidth, eheight);
items_[order[2]]->resize (ewidth, eheight); items_[order[2]]->resize (ewidth, eheight);
items_[order[3]]->resize (ewidth, r.height() - ((eheight + spacing_) * 2)); items_[order[3]]->resize (ewidth, r.height() - ((eheight + spacing_) * 2));
items_[order[0]]->setPos (r.topLeft()); items_[order[0]]->setPos (r.topLeft());
items_[order[1]]->setPos (r.x() + width + spacing_, r.y()); items_[order[1]]->setPos (r.x() + width + spacing_, r.y());
items_[order[2]]->setPos (r.x() + width + spacing_, r.y() + eheight + spacing_); items_[order[2]]->setPos (r.x() + width + spacing_, r.y() + eheight + spacing_);
items_[order[3]]->setPos (r.x() + width + spacing_, items_[order[3]]->setPos (r.x() + width + spacing_,
r.y() + ((eheight + spacing_) * 2)); r.y() + ((eheight + spacing_) * 2));
} }
break; break;
} }
} }
......
...@@ -82,6 +82,16 @@ class DLLEXPORT QtMultiViewLayout : public QGraphicsLayout ...@@ -82,6 +82,16 @@ class DLLEXPORT QtMultiViewLayout : public QGraphicsLayout
SingleView, SingleView,
/* /*
* ############# * #############
* # # #
* # # #
* # 1 # 2 #
* # # #
* # # #
* #############
*/
DoubleView,
/*
* #############
* # 1 # 2 # * # 1 # 2 #
* # # # * # # #
* ############# * #############
......
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