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 ) {
PluginFunctions::setActiveExaminer(0);
break;
case 1:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::Grid);
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::DoubleView);
break;
case 2:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::Grid);
break;
case 3:
coreWidget_->baseLayout_->setMode (QtMultiViewLayout::HSplit);
break;
......@@ -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("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"),
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"),
QStringList(tr("enabled")), QStringList(tr("restriction switch")));
......
......@@ -455,11 +455,13 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
"Possible layouts are: "
"<ul> "
"<li>Single viewer</li>"
"<li>Double viewer</li>"
"<li>Multiple viewers (grid)</li>"
"<li>Multiple viewers (hsplit)</li>"
"</ul>"));
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()+"multiviewmode2.png"), "");
......@@ -884,17 +886,24 @@ void CoreWidget::nextViewerLayout() {
switch (baseLayout_->mode()) {
case QtMultiViewLayout::SingleView:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid);
baseLayout_->setMode(QtMultiViewLayout::DoubleView);
// Update combo box in the toolbar
viewerLayoutBox_->setCurrentIndex(1);
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:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit);
// Update combo box in the toolbar
viewerLayoutBox_->setCurrentIndex(2);
viewerLayoutBox_->setCurrentIndex(3);
break;
case QtMultiViewLayout::HSplit:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
......@@ -915,17 +924,21 @@ CoreWidget::setViewerLayout(int _idx) {
switch (_idx) {
case 0:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::SingleView);
break;
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::SingleView);
break;
case 1:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid);
break;
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::DoubleView);
break;
case 2:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit);
break;
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::Grid);
break;
case 3:
baseLayout_->setPrimary (PluginFunctions::activeExaminer ());
baseLayout_->setMode(QtMultiViewLayout::HSplit);
break;
}
viewerLayoutBox_->setCurrentIndex(_idx);
......
......@@ -519,9 +519,9 @@ void CoreWidget::viewerSnapshotDialog() {
QImage finalImage;
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage,
dialog.snapWidth->value(), dialog.snapHeight->value(),
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(),
dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1);
dialog.snapWidth->value(), dialog.snapHeight->value(),
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(),
dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1);
finalImage.save(newName);
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper 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 *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper 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 *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
......@@ -59,10 +59,10 @@
//== CLASS IMPLEMENTATION======================================================
QtMultiViewLayout::QtMultiViewLayout (QGraphicsLayoutItem * _parent) :
QGraphicsLayout (_parent),
mode_ (SingleView),
spacing_ (2),
primary_ (0)
QGraphicsLayout (_parent),
mode_ (SingleView),
spacing_ (2),
primary_ (0)
{
items_[0] = 0;
items_[1] = 0;
......@@ -166,9 +166,16 @@ void QtMultiViewLayout::reLayout ()
if (mode == SingleView)
{
for (int i = 0; i < 4; i++)
items_[i]->hide();
items_[i]->hide();
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++)
if (items_[i])
items_[i]->show();
......@@ -179,43 +186,52 @@ void QtMultiViewLayout::reLayout ()
case SingleView:
items_[primary_]->setGeometry (r);
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:
{
int width = (r.width() - spacing_) / 2;
int height = (r.height() - spacing_) / 2;
items_[0]->resize (width, height);
items_[1]->resize (r.width() - width - spacing_, height);
items_[2]->resize (width, r.height() - height - spacing_);
items_[3]->resize (r.width() - width - spacing_,
r.height() - height - spacing_);
items_[0]->setPos (r.topLeft());
items_[1]->setPos (r.x() + width + spacing_, r.y());
items_[2]->setPos (r.x(), r.y() + height + spacing_);
items_[3]->setPos (r.x() + width + spacing_,
r.y() + height + spacing_);
}
break;
{
int width = (r.width() - spacing_) / 2;
int height = (r.height() - spacing_) / 2;
items_[0]->resize (width, height);
items_[1]->resize (r.width() - width - spacing_, height);
items_[2]->resize (width, r.height() - height - spacing_);
items_[3]->resize (r.width() - width - spacing_,r.height() - height - spacing_);
items_[0]->setPos (r.topLeft());
items_[1]->setPos (r.x() + width + spacing_, r.y());
items_[2]->setPos (r.x(), r.y() + height + spacing_);
items_[3]->setPos (r.x() + width + spacing_, r.y() + height + spacing_);
}
break;
case HSplit:
{
int order[4];
order[0] = primary_;
for (unsigned int i = 0, j = 1; i < 4; i++)
if (i != primary_)
order[j++] = i;
int width = (r.width() - spacing_) * 3 / 4;
int ewidth = r.width() - spacing_ - width;
int eheight = (r.height() - (spacing_ * 2)) / 3;
items_[order[0]]->resize (width, r.height());
items_[order[1]]->resize (ewidth, eheight);
items_[order[2]]->resize (ewidth, eheight);
items_[order[3]]->resize (ewidth, r.height() - ((eheight + spacing_) * 2));
items_[order[0]]->setPos (r.topLeft());
items_[order[1]]->setPos (r.x() + width + spacing_, r.y());
items_[order[2]]->setPos (r.x() + width + spacing_, r.y() + eheight + spacing_);
items_[order[3]]->setPos (r.x() + width + spacing_,
r.y() + ((eheight + spacing_) * 2));
}
break;
{
int order[4];
order[0] = primary_;
for (unsigned int i = 0, j = 1; i < 4; i++)
if (i != primary_)
order[j++] = i;
int width = (r.width() - spacing_) * 3 / 4;
int ewidth = r.width() - spacing_ - width;
int eheight = (r.height() - (spacing_ * 2)) / 3;
items_[order[0]]->resize (width, r.height());
items_[order[1]]->resize (ewidth, eheight);
items_[order[2]]->resize (ewidth, eheight);
items_[order[3]]->resize (ewidth, r.height() - ((eheight + spacing_) * 2));
items_[order[0]]->setPos (r.topLeft());
items_[order[1]]->setPos (r.x() + width + spacing_, r.y());
items_[order[2]]->setPos (r.x() + width + spacing_, r.y() + eheight + spacing_);
items_[order[3]]->setPos (r.x() + width + spacing_,
r.y() + ((eheight + spacing_) * 2));
}
break;
}
}
......
......@@ -82,6 +82,16 @@ class DLLEXPORT QtMultiViewLayout : public QGraphicsLayout
SingleView,
/*
* #############
* # # #
* # # #
* # 1 # 2 #
* # # #
* # # #
* #############
*/
DoubleView,
/*
* #############
* # 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