From 0746dabfa8bd0cf0472a468bfdc35dc771c52b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 15 Sep 2011 09:31:46 +0000 Subject: [PATCH] Introduced double viewer layout git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12361 383ad7c9-94d9-4d36-a494-682f7c89f535 --- Core/Core.cc | 7 +- Icons/doubleviewmode.png | Bin 0 -> 1151 bytes widgets/coreWidget/CoreWidget.cc | 35 ++++-- widgets/coreWidget/viewerControl.cc | 6 +- widgets/glWidget/QtMultiViewLayout.cc | 170 ++++++++++++++------------ widgets/glWidget/QtMultiViewLayout.hh | 10 ++ 6 files changed, 135 insertions(+), 93 deletions(-) create mode 100644 Icons/doubleviewmode.png diff --git a/Core/Core.cc b/Core/Core.cc index e89b3951..55e26eef 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -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"))); diff --git a/Icons/doubleviewmode.png b/Icons/doubleviewmode.png new file mode 100644 index 0000000000000000000000000000000000000000..69b97b1466ede38b81e037c88afcae5a8ebf63df GIT binary patch literal 1151 zcmV-_1c3XAP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2ipk` z2@(X67P~G000aL?L_t(o!^N1vl`Odp1T(V60huUoWSu;aCtC;|z?%Jc>OJ+br=x}i zCK5>||L+e;{`K$wKq<7)J_RUkp(!oUwse2?{ki?;KYlLppCt1R4T7OD7OWrd@0$;x{qX3q+)@LwfTjE>MPX?0Surgg@E$|o^n@9|$HVzX;RsZnGs1Sd~d z(x=T7n|hD`DzP=9cApYXC8-UQfUBS;v&}ZW$A6N{U$d)DsgBeRiFDh{GWJ;o8D+4c zxyQE#Ly~QuhL9xe+Qn9-+4m6teB3p@I`|7Ksg5$FQpVjpwQb%UZPO&u;VAJ6|HBj4 z#>~pP?lMbDMB4J+_svAFV@lOZS)QvZZ*qQL`6gleo?0u$fs%+f8#8(Gzn+ascgIP4*yBwUz0jd$tsp?*ag!K*WHt* zts0o1*2&{*A4zj|_Zt5@seXAzZAYF~U)#yHnXBabX0z`} zJD2#^jY`?0wPqD0)J%`NRj05=VtUf}HGXQ4oGXZ6oV3I*a{`h{dh*4TX7=~j`0>Pd zY=7rBv&}N3PD?{@cH*t`og>jbejI6!a6sd9O=H?_3spN!na#N6WWw(T;|5sOp zFUbeD$t4|63`conBUUrV53cZUI@3)L@eB5Ln`qrWDP+xr68Acy_xN$;*`CFBZyr2A z_Nt-0*=vWj-rsu=@A03#R#e~jr8G~RbJ)&a4xPhq`mEq9^L6?E1phyO{tMl*vmvj> Rv?Krk002ovPDHLkV1lk|K$idj literal 0 HcmV?d00001 diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc index b67fbeb2..c27574a2 100644 --- a/widgets/coreWidget/CoreWidget.cc +++ b/widgets/coreWidget/CoreWidget.cc @@ -455,11 +455,13 @@ CoreWidget( QVector& _viewModes, "Possible layouts are: " "
    " "
  • Single viewer
  • " + "
  • Double viewer
  • " "
  • Multiple viewers (grid)
  • " "
  • Multiple viewers (hsplit)
  • " "
")); 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); diff --git a/widgets/coreWidget/viewerControl.cc b/widgets/coreWidget/viewerControl.cc index 8ab4b364..1e4a8655 100644 --- a/widgets/coreWidget/viewerControl.cc +++ b/widgets/coreWidget/viewerControl.cc @@ -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); diff --git a/widgets/glWidget/QtMultiViewLayout.cc b/widgets/glWidget/QtMultiViewLayout.cc index ce372f31..ef33f375 100644 --- a/widgets/glWidget/QtMultiViewLayout.cc +++ b/widgets/glWidget/QtMultiViewLayout.cc @@ -1,43 +1,43 @@ /*===========================================================================*\ -* * -* 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 . * -* * + * * + * 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 . * + * * \*===========================================================================*/ /*===========================================================================*\ -* * -* $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; } } diff --git a/widgets/glWidget/QtMultiViewLayout.hh b/widgets/glWidget/QtMultiViewLayout.hh index b4734c81..1644c343 100644 --- a/widgets/glWidget/QtMultiViewLayout.hh +++ b/widgets/glWidget/QtMultiViewLayout.hh @@ -82,6 +82,16 @@ class DLLEXPORT QtMultiViewLayout : public QGraphicsLayout SingleView, /* * ############# + * # # # + * # # # + * # 1 # 2 # + * # # # + * # # # + * ############# + */ + DoubleView, + /* + * ############# * # 1 # 2 # * # # # * ############# -- GitLab