Ejemplo n.º 1
0
// Set the state of all ghost-related controls and save flags for passing with actions
void ContSurfPoint::setGhostState( int interval, int ghostmode)
{
  diaSetSpinBox(ghostSpinBox, interval);
  diaSetChecked(downGhostBox, ghostmode & IMOD_GHOST_PREVSEC);
  diaSetChecked(upGhostBox, ghostmode & IMOD_GHOST_NEXTSEC);
  diaSetChecked(surfGhostBox, ghostmode & IMOD_GHOST_SURFACE);
  diaSetChecked(lighterGhostBox, ghostmode & IMOD_GHOST_LIGHTER);
  diaSetChecked(allObjGhostBox, ghostmode & IMOD_GHOST_ALLOBJ);
}
Ejemplo n.º 2
0
// Set On/Off state for one object
void imodvOlistSetChecked(ImodvApp *a, int ob, bool state)
{
  if (!Oolist_dialog)
    return;
  if (ob < numOolistButtons && ob < a->imod->objsize)
    diaSetChecked(OolistButtons[ob], state);
}
Ejemplo n.º 3
0
/*
 * The class constructor
 */
PixelView::PixelView(QWidget *parent, const char *name, Qt::WindowFlags fl)
  : QWidget(parent, fl)
{
  int i, j, iz = B3DNINT(App->cvi->zmouse);
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);
  QVBoxLayout *vBox = new QVBoxLayout(this);
  vBox->setSpacing(3);

  // Make the mouse report box
  QHBoxLayout *hBox = diaHBoxLayout(vBox);
  mMouseLabel = diaLabel(" ", this, hBox);
  hBox->addStretch();
  hBox->setSpacing(5);

  mFileValBox = diaCheckBox("File value", this, hBox);
  diaSetChecked(mFileValBox, fromFile);
  connect(mFileValBox, SIGNAL(toggled(bool)), this, 
          SLOT(fromFileToggled(bool)));
  mFileValBox->setToolTip("Show value from file, not byte value from memory"
                ", at mouse position");
  mFileValBox->setEnabled(fileReadable(App->cvi, iz));

  QCheckBox *gbox = diaCheckBox("Grid", this, hBox);
  diaSetChecked(gbox, showButs);
  connect(gbox, SIGNAL(toggled(bool)), this, SLOT(showButsToggled(bool)));
  gbox->setToolTip("Show buttons with values from file or memory)");

  hBox = diaHBoxLayout(vBox);
  mGridValBox = diaCheckBox("Grid value from file", this, hBox);
  diaSetChecked(mGridValBox, gridFromFile);
  connect(mGridValBox, SIGNAL(toggled(bool)), this, 
          SLOT(gridFileToggled(bool)));
  mGridValBox->setToolTip("Show value from file, not byte value from memory"
                ", in each button");
  mGridValBox->setEnabled(fileReadable(App->cvi, iz));

  mConvertBox = NULL;
  if (App->cvi->rgbStore) {
    mConvertBox = diaCheckBox("Convert RGB to gray scale", this, hBox);
    diaSetChecked(mConvertBox, convertRGB);
    connect(mConvertBox, SIGNAL(toggled(bool)), this, 
            SLOT(convertToggled(bool)));
    mConvertBox->setToolTip("Show luminance values instead of RGB triplets"
                  );
  }
Ejemplo n.º 4
0
void ContSurfPoint::init()
{
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);
  mCtrlPressed = false;
  mSliderPressed = false;
  setFontDependentWidths();
  diaSetChecked(mouseSizeBox, iceGetWheelForSize() != 0);
  adjustSize();
}
Ejemplo n.º 5
0
// Update the dialog box (just the view flag for now)
void mvImageUpdate(ImodvApp *a)
{
  if (a->texMap && !sFlags) {
    sFlags |= IMODV_DRAW_CZ;
    if (sDia)
      diaSetChecked(sDia->mViewZBox, true);
  } else if (!a->texMap && sFlags) {
    sFlags = 0;
    mvImageCleanup();
    if (sDia) {
      diaSetChecked(sDia->mViewXBox, false);
      diaSetChecked(sDia->mViewYBox, false);
      diaSetChecked(sDia->mViewZBox, false);
    }
  }
  if (sDia) {
    sDia->mViewXBox->setEnabled(!(a->stereo && a->imageStereo));
    sDia->mViewYBox->setEnabled(!(a->stereo && a->imageStereo));
    sDia->mSliders->setEnabled(IIS_SLICES, !(a->stereo && a->imageStereo));
  }
}
Ejemplo n.º 6
0
void imodvOlistUpdateOnOffs(ImodvApp *a)
{
  int ob;
  bool state, nameChgd = false;
  QString qstr;
  char obname[MAX_LIST_NAME];
  int len;
  QColor bkgColor;
  QColor gray;
  if (!Oolist_dialog || !numOolistButtons)
    return;
  QPalette palette = Oolist_dialog->palette();
  gray = palette.color(Oolist_dialog->backgroundRole());

  // Hiding seems to help the updates some, especially if there are text 
  // changes or massive turning off of buttons, but processing events after
  // hiding doesn't help the time on Linux and leaves it gray (3/26/09)
  if (numOolistButtons > 256)
    Oolist_dialog->mFrame->hide();
  for (ob = 0; ob < numOolistButtons; ob++) {
    if (ob < a->imod->objsize) {
      // Get a truncated name
      // DMN 9/20/04: just truncate all columns a little bit now
      len = strlen(a->imod->obj[ob].name);
      if (len > MAX_LIST_NAME - 1)
        len = MAX_LIST_NAME - 1;
      strncpy(obname, a->imod->obj[ob].name, len);
      obname[len] = 0x00;
      qstr.sprintf("%d: %s",ob + 1, obname);
      state = !(a->imod->obj[ob].flags & IMOD_OBJFLAG_OFF);
      bkgColor.setRgb((int)(255. * a->imod->obj[ob].red),
                      (int)(255. * a->imod->obj[ob].green),
                      (int)(255. * a->imod->obj[ob].blue));
      if (OolistButtons[ob]->isHidden()) {
        OolistButtons[ob]->show();
        nameChgd = true;
      }
      if (qstr != OolistButtons[ob]->text()) {
        OolistButtons[ob]->setText(qstr);
        nameChgd = true;
      }
      diaSetWidgetColor(OolistButtons[ob], bkgColor);
      diaSetChecked(OolistButtons[ob], state);
    } else if (!OolistButtons[ob]->isHidden()) {
      OolistButtons[ob]->hide();
      nameChgd = true;
    }
  }
  if (numOolistButtons > 256)
    Oolist_dialog->mFrame->show();
  if (nameChgd) 
    Oolist_dialog->adjustFrameSize();
}
Ejemplo n.º 7
0
// Set ancillary parameters to the state for a movie segment
int mvImageSetMovieDrawState(MovieSegment &segment)
{
 if (!segment.imgAxisFlags) {

    // If there is no image drawing, turn off Imodv flag and then, if there is currently,
    // take the update route to updating this module
    Imodv->texMap = 0;
    if (sFlags) 
      mvImageUpdate(Imodv);
    return 1;
  }
  sFlags = segment.imgAxisFlags;
  Imodv->texMap = 1;
  sWhiteLevel = segment.imgWhiteLevel;
  sBlackLevel = segment.imgBlackLevel;
  sFalsecolor = segment.imgFalseColor;
  makeColorMap();
  sXdrawSize = B3DMIN(segment.imgXsize, Imodv->vi->xsize);
  sYdrawSize = B3DMIN(segment.imgYsize, Imodv->vi->ysize);
  sZdrawSize = B3DMIN(segment.imgZsize, Imodv->vi->zsize);

  // Update the dialog as needed
  if (sDia) {

    sDia->mSliders->setValue(IIS_X_SIZE, sXdrawSize);
    sDia->mSliders->setValue(IIS_Y_SIZE, sYdrawSize);
    sDia->mSliders->setValue(IIS_Z_SIZE, sZdrawSize);
    diaSetChecked(sDia->mViewXBox, (sFlags & IMODV_DRAW_CX) != 0);
    diaSetChecked(sDia->mViewYBox, (sFlags & IMODV_DRAW_CY) != 0);
    diaSetChecked(sDia->mViewZBox, (sFlags & IMODV_DRAW_CZ) != 0);
    sDia->mSliders->setValue(IIS_BLACK, sBlackLevel);
    sDia->mSliders->setValue(IIS_WHITE, sWhiteLevel);
    diaSetChecked(sDia->mFalseBox, sFalsecolor != 0);
  }
  return 0;
}
Ejemplo n.º 8
0
ContourCopy::ContourCopy(QWidget *parent, const char *name)
  : DialogFrame(parent, 3, 1, buttonLabels, buttonTips, true, 
                ImodPrefs->getRoundedStyle(), " ", "", name)
{
  QRadioButton *radio;
  QHBoxLayout *hBox = diaHBoxLayout(mLayout);
  
  mToCombo = new QComboBox(this);
  hBox->addWidget(mToCombo);
  mToCombo->addItem("Copy to Object #");
  mToCombo->addItem("Copy to Section #");
  mToCombo->addItem("Copy to Next Section");
  mToCombo->addItem("Copy to Prev Section");
  mToCombo->addItem("Duplicate");
  if (sData.vw->numTimes)
    mToCombo->addItem("Copy to Time Index #");
  mToCombo->setFocusPolicy(Qt::NoFocus);
  mToCombo->setCurrentIndex(sData.copyOperation);
  mToCombo->setToolTip("Select type of place to copy contours to");
  connect(mToCombo, SIGNAL(currentIndexChanged(int)), this,
          SLOT(placeSelected(int)));

  mToSpinBox = new QSpinBox(this);
  hBox->addWidget(mToSpinBox);
  mToSpinBox->setFocusPolicy(Qt::ClickFocus);
  mToSpinBox->setKeyboardTracking(false);
  mToSpinBox->setToolTip("Set object, section, or time");
  connect(mToSpinBox, SIGNAL(valueChanged(int)), this, 
          SLOT(toValueChanged(int)));
  
  QGroupBox *gbox = new QGroupBox("Copy", this);
  QVBoxLayout *gbLayout = new QVBoxLayout(gbox);
  mRadioGroup = new QButtonGroup(this);
  mLayout->addWidget(gbox);
  connect(mRadioGroup, SIGNAL(buttonClicked(int)), this, 
          SLOT(rangeSelected(int)));

  radio = diaRadioButton("Just the current contour(s)", gbox, mRadioGroup, gbLayout, 0,
                         "Copy only the selected contour(s) in the current object");
  radio = diaRadioButton
    ("All contours in surface", gbox, mRadioGroup, gbLayout, 1, 
     "Copy contours with same surface number as current one");
  radio = diaRadioButton("All contours in object", gbox, mRadioGroup, 
                         gbLayout, 2, "Copy all eligible contours in object");

  if (sData.vw->numTimes) {
    mTimeRadio = diaRadioButton
      ("All contours in all objects", gbox, mRadioGroup, 
       gbLayout, 3, "Copy all contours at this time to selected time");
  }

  // Figure out initial radio button settings, enforce flag settings and
  // set the button
  int radioVal = 0;
  if (sData.doSurface)
    radioVal = 1;
  if (sData.doAll)
    radioVal = 2;
  if (sData.vw->numTimes && sData.doAllObj)
    radioVal = 3;
  rangeSelected(radioVal);
  diaSetGroup(mRadioGroup, radioVal);

  mEllipseBox = diaCheckBox("Make equivalent ellipse", this, mLayout);
  connect(mEllipseBox, SIGNAL(toggled(bool)), this, SLOT(ellipseToggled(bool)));
  mEllipseBox->setToolTip("Make the copied contour be the equivalent ellipse (one with "
                          "the same second moments as the area)");
  diaSetChecked(mEllipseBox, sData.makeEllipse != 0);
  mEllipseBox->setEnabled(sData.copyOperation == COPY_TO_OBJECT);
  update();

  connect(this, SIGNAL(actionPressed(int)), this, SLOT(buttonPressed(int)));
  setWindowTitle(imodCaption("3dmod Copy Contours"));
}
Ejemplo n.º 9
0
void ImodvOlist::updateGroups(ImodvApp *a)
{
  IobjGroup *group;
  int i, ob, numGroups = ilistSize(a->imod->groupList);
  int curGrp = a->imod->curObjGroup;
  int *objs;
  bool *states;
  bool showChgd = false;
  QString str;
  diaSetSpinMMVal(mGroupSpin, 0, numGroups, curGrp + 1);
  str.sprintf("/%d", numGroups);
  mNumberLabel->setText(str);
  mNameEdit->setEnabled(curGrp >= 0);
  for (i = 1; i < OBJLIST_NUMBUTTONS; i++)
    mButtons[i]->setEnabled(curGrp >= 0);
  if (curGrp < 0) {
    if (grouping) {
      mFrame->hide();
      for (ob = 0; ob < numOolistButtons; ob++)
        groupButtons[ob]->hide();
      mFrame->show();
      adjustFrameSize();
    }
    grouping = false;
    return;
  }
  if (!grouping) {
    mFrame->hide();
    for (ob = 0; ob < numOolistButtons; ob++)
      groupButtons[ob]->show();
    mFrame->show();
    adjustFrameSize();
  }
  grouping = true;

  group = (IobjGroup *)ilistItem(a->imod->groupList, curGrp);
  if (!group)
    return;
  mNameEdit->setText(group->name);
  states = (bool *)malloc(sizeof(bool) * numOolistButtons);
  if (!states)
    return;
  for (ob = 0; ob < numOolistButtons; ob++)
    states[ob] = false;
  objs = (int *)ilistFirst(group->objList);
  if (objs) {
    for (i = 0; i < ilistSize(group->objList); i++)
      if (objs[i] >= 0 && objs[i] < numOolistButtons)
        states[objs[i]] = true;
  }
  for (ob = 0; ob < numOolistButtons; ob++) {
    if (ob < a->imod->objsize) {
      diaSetChecked(groupButtons[ob], states[ob]);
      if (groupButtons[ob]->isHidden()) {
        groupButtons[ob]->show();
        showChgd = true;
      }
    } else if (!groupButtons[ob]->isHidden()) {
      groupButtons[ob]->hide();
      showChgd = true;
    }
  }
  free(states);
  if (showChgd)
    adjustFrameSize();
}