1 #include "WindowTool.h"
8 #include <QMdiSubWindow>
15 #include "MdiCubeViewport.h"
16 #include "MainWindow.h"
17 #include "Workspace.h"
39 QString text =
"<b>Function: </b> Resize all linked viewports to the same \
40 size as the active viewport.";
64 icon.addPixmap(
toolIconDir() +
"/linked.png", QIcon::Normal, QIcon::On);
65 icon.addPixmap(
toolIconDir() +
"/unlinked.png", QIcon::Normal, QIcon::Off);
71 "<b>Function:</b> Used to link viewports. Some tools apply their \
72 functions to all linked viewports. For example, when the zoom tool \
73 is used on a linked viewport then all other linked viewports will zoom \
75 <p><b>Shortcut:</b> Ctrl+L</p> \
76 <p><b>Hint:</b> The icons <img src=\"" +
77 toolIconDir() +
"/linked.png\" width=22 height=22> and <img src=\"" +
78 toolIconDir() +
"/unlinked.png\" width=22 height=22> at the left edge \
79 of each viewport titlebar indicate the current link state</p> \
80 <p><b>Tools using Link:</b> Zoom, Pan, Blink, and Advanced Tracking </p>";
90 together. <p><b>Shortcut: </b> Ctrl+Shift+L");
99 <p><b>Shortcut: </b> Ctrl+Shift+U");
106 p_changeCursor->setWhatsThis(
"<b>Function: </b> Toggles the cursor shape between \
107 and arrow and crosshair cursor when cursor is over the \
127 connect(
p_prevWindow, SIGNAL(triggered()), ws->
mdiArea(), SLOT(activatePreviousSubWindow()));
144 int numViewports =
p_mdiArea->subWindowList().size();
149 double px = ceil(sqrt(numViewports*mdiWidth/mdiHeight));
151 if (floor(px*mdiHeight/mdiWidth)*px < numViewports) {
152 sx = mdiHeight/ceil(px*mdiHeight/mdiWidth);
158 double py = ceil(sqrt(numViewports * mdiHeight / mdiWidth));
159 if (floor(py*mdiWidth/mdiHeight)*py < numViewports) {
160 sy = mdiWidth/ceil(mdiWidth*py/mdiHeight);
166 return std::max(sx,sy);
178 QPoint position(0, 0);
182 for (
int i = windowList.size() - 1; i >= 0; i--) {
184 window->showNormal();
185 QRect rect(0, 0, vpSize, vpSize);
186 window->setGeometry(rect);
187 window->move(position);
189 position.setX(position.x() + window->width());
190 if (position.x() + window->width() >
p_mdiArea->width()) {
192 position.setY(position.y() + window->height());
221 menu->addSeparator();
224 menu->addSeparator();
230 menu->addSeparator();
247 connect(cvp, SIGNAL(linkChanging(
bool)),
p_linkWindow, SLOT(setChecked(
bool)));
260 disconnect(cvp, SIGNAL(linkChanging(
bool)),
p_linkWindow, SLOT(setChecked(
bool)));
312 cvp->viewport()->cursor().shape() != Qt::ArrowCursor) {
313 cvp->viewport()->setCursor(Qt::ArrowCursor);
316 cvp->viewport()->cursor().shape() != Qt::CrossCursor) {
317 cvp->viewport()->setCursor(Qt::CrossCursor);
333 if(d->
isLinked()) d->parentWidget()->parentWidget()->resize(size);