/* * The resize tool */ void ImodvWindow::openResizeTool(ImodvApp *a) { if (mResizeTool) { mResizeTool->raise(); return; } mResizeTool = new ResizeTool(this, a->winx, a->winy, 10); connect(mResizeTool, SIGNAL(closing()), this, SLOT(resizerClosing())); connect(mResizeTool, SIGNAL(resize(int, int)), this, SLOT(newResizerSize(int, int))); connect(mResizeTool, SIGNAL(keyPress(QKeyEvent *)), this, SLOT(resizerKeyPress(QKeyEvent *))); connect(mResizeTool, SIGNAL(keyRelease(QKeyEvent *)), this, SLOT(rotationKeyRelease(QKeyEvent *))); imodvDialogManager.add((QWidget *)mResizeTool, IMODV_DIALOG); adjustGeometryAndShow((QWidget *)mResizeTool, IMODV_DIALOG); }
int openContourCopyDialog(ImodView *vw) { if (sData.dia){ sData.dia->raise(); return(0); } sData.vw = vw; sData.dia = new ContourCopy(imodDialogManager.parent(IMOD_DIALOG), "contour join"); if (!sData.dia) return(1); imodDialogManager.add((QWidget *)sData.dia, IMOD_DIALOG); adjustGeometryAndShow((QWidget *)sData.dia, IMOD_DIALOG); return(0); }
void imodvDepthCueEditDialog(ImodvApp *a, int state) { idcData.a = Imodv; if (!state){ if (idcData.dia) idcData.dia->close(); return; } if (idcData.dia){ idcData.dia->raise(); return; } idcData.dia = new imodvDepthcueForm(imodvDialogManager.parent(IMODV_DIALOG), Qt::Window); imodvDepthCueSetWidgets(); imodvDialogManager.add((QWidget *)idcData.dia, IMODV_DIALOG); adjustGeometryAndShow((QWidget *)idcData.dia, IMODV_DIALOG); }
// Open, close, or raise the dialog box void mvImageEditDialog(ImodvApp *a, int state) { if (!state){ if (sDia) sDia->close(); return; } if (sDia) { sDia->raise(); return; } sDia = new ImodvImage(imodvDialogManager.parent(IMODV_DIALOG), a->vi->pyrCache != NULL, "image view"); sA = a; makeColorMap(); imodvDialogManager.add((QWidget *)sDia, IMODV_DIALOG); adjustGeometryAndShow((QWidget *)sDia, IMODV_DIALOG); mvImageUpdate(a); }
/* * Open the dialog box */ void imodMovieConDialog(ImodView *vw) { if (dia){ dia->raise(); return; } view = vw; imcResetAll(view); dia = new MovieController(imodDialogManager.parent(IMOD_DIALOG), Qt::Window); dia->setWindowTitle(imodCaption("3dmod Movies")); imodDialogManager.add((QWidget *)dia, IMOD_DIALOG); axiscon = 2; set_sliders(); dia->setRateBox(realrate); dia->enableTime(vw->numTimes); adjustGeometryAndShow((QWidget *)dia, IMOD_DIALOG); }
// Background color class void ImodvBkgColor::openDialog() { mSelector = new ColorSelector(imodvDialogManager.parent(IMODV_DIALOG), "3dmodv background color.", Imodv->rbgcolor->red(), Imodv->rbgcolor->green(), Imodv->rbgcolor->blue(), hotSliderFlag(), hotSliderKey(), ImodPrefs->getRoundedStyle(), "selector"); connect(mSelector, SIGNAL(newColor(int, int, int)), this, SLOT(newColorSlot(int, int, int))); connect(mSelector, SIGNAL(done()), this, SLOT(doneSlot())); connect(mSelector, SIGNAL(closing()), this, SLOT(closingSlot())); connect(mSelector, SIGNAL(keyPress(QKeyEvent *)), this, SLOT(keyPressSlot(QKeyEvent *))); connect(mSelector, SIGNAL(keyRelease(QKeyEvent *)), this, SLOT(keyReleaseSlot(QKeyEvent *))); setModvDialogTitle(mSelector, "3dmodv: "); imodvDialogManager.add((QWidget *)mSelector, IMODV_DIALOG); adjustGeometryAndShow((QWidget *)mSelector, IMODV_DIALOG); }
/* * Open the pixel view window */ int open_pixelview(struct ViewInfo *vi) { if (PixelViewDialog){ PixelViewDialog->raise(); return(-1); } PixelViewDialog = new PixelView(imodDialogManager.parent(IMOD_IMAGE), "pixel view"); PixelViewDialog->setWindowTitle(imodCaption("3dmod Pixel View")); ctrl = ivwNewControl(vi, pviewDraw_cb, pviewClose_cb, NULL, (void *)0); imodDialogManager.add((QWidget *)PixelViewDialog, IMOD_IMAGE); // This takes care of showing/hiding. resizing, and updating PixelViewDialog->showButsToggled(showButs); adjustGeometryAndShow((QWidget *)PixelViewDialog, IMOD_IMAGE); pvNewMousePosition(vi, vi->xmouse, vi->ymouse, B3DNINT(vi->zmouse)); zapPixelViewState(true); xyzPixelViewState(true); slicerPixelViewState(true); return(0); }
/* * Create the object list dialog */ void imodvObjectListDialog(ImodvApp *a, int state) { int m; if (!state){ if (Oolist_dialog) Oolist_dialog->close(); return; } if (Oolist_dialog){ Oolist_dialog->raise(); return; } grouping = false; // Get number of buttons, number of columns and number per column // Make maximum number of buttons needed for all loaded models for (m = 0; m < a->numMods; m++) if (numOolistButtons < a->mod[m]->objsize) numOolistButtons = a->mod[m]->objsize; if (numOolistButtons > MAX_OOLIST_BUTTONS) numOolistButtons = MAX_OOLIST_BUTTONS; OolistButtons = (QCheckBox **)malloc(numOolistButtons * sizeof(QCheckBox *)); groupButtons = (QCheckBox **)malloc(numOolistButtons * sizeof(QCheckBox *)); if (!OolistButtons || !groupButtons) { if (OolistButtons) free(OolistButtons); if (groupButtons) free(groupButtons); numOolistButtons = 0; wprint("\aMemory error getting array for checkboxes\n"); return; } Oolist_dialog = new ImodvOlist(imodvDialogManager.parent(IMODV_DIALOG)); imodvOlistUpdateOnOffs(a); // Get sizes to adjust window size with QSize svSize = Oolist_dialog->mScroll->sizeHint(); QSize frameSize = Oolist_dialog->mFrame->sizeHint(); imod_info_input(); Oolist_dialog->adjustSize(); // 4 pixels added was enough to prevent scroll bars // If width is constrained, allow more height for horizontal scroll bar int newWidth = Oolist_dialog->width() + frameSize.width() - svSize.width() + 8; int newHeight = Oolist_dialog->height() + frameSize.height() - svSize.height() + 8; if (newWidth > MAX_OOLIST_WIDTH) { newWidth = MAX_OOLIST_WIDTH; newHeight += 20; } if (newHeight > QApplication::desktop()->height() - 100) newHeight = QApplication::desktop()->height() - 100; Oolist_dialog->resize(newWidth, newHeight); setModvDialogTitle(Oolist_dialog, "3dmodv Object List: "); imodvDialogManager.add((QWidget *)Oolist_dialog, IMODV_DIALOG); // After getting size with group buttons present, maybe hide them Oolist_dialog->updateGroups(a); adjustGeometryAndShow((QWidget *)Oolist_dialog, IMODV_DIALOG); Oolist_dialog->adjustFrameSize(); }