示例#1
0
// Set the time index value and maximum, or just disable and set to no time
void ContSurfPoint::setTimeIndex( int value, int maxVal )
{
  timeSpinBox->setEnabled(value >= 0 && maxVal > 0);
  if (!maxVal && value > 0)
    maxVal = value;
  if (value < 0) {
    timeSpinBox->setSpecialValueText(value < -1 ? "No Time" : "No Cont");
    timeSpinBox->setValue(0);
  } else {
    timeSpinBox->setSpecialValueText("");
    diaSetSpinMMVal(timeSpinBox, 0, maxVal, value);
  }
}
示例#2
0
// This provides update information when a new object is set
void imodvObjedForm::updateObject(int ob, int numObj, int drawType, int drawStyle, 
				  QColor color, char *name)
{
  updateColorBox(color);
  diaSetSpinMMVal(objectSpinBox, 1, numObj, ob);
  objectSpinBox->setEnabled(numObj > 1);
  objectSlider->setMaximum(numObj);
  diaSetSlider(objectSlider, ob);
  objectSlider->setEnabled(numObj > 1);
  dataTypeComboBox->setCurrentIndex(drawType);
  drawStyleComboBox->setCurrentIndex(drawStyle);
  QString str = name;
  diaSetEditText(nameLineEdit, str);
}
示例#3
0
void ContourCopy::update()
{
  int minVal, maxVal, curVal;
  ImodView *vw = sData.vw;

  // For each operation that uses spin box, set up min and max value
  // and adjust the current value if necessary
  switch(sData.copyOperation){
  case COPY_TO_OBJECT:
    minVal = 1;
    maxVal = vw->imod->objsize;
    sData.objectNumber = B3DMAX(1, B3DMIN(maxVal, sData.objectNumber));
    curVal = sData.objectNumber;
    break;

  case COPY_TO_SECTION:
    minVal = 1;
    maxVal = vw->zsize;
    sData.sectionNumber = B3DMAX(1, B3DMIN(maxVal, sData.sectionNumber));
    curVal = sData.sectionNumber;
    break;

  case COPY_TO_TIME:
    minVal = 1;
    maxVal = vw->numTimes;
    sData.timeIndex = B3DMAX(1, B3DMIN(maxVal, sData.timeIndex));
    curVal = sData.timeIndex;
    break;

  case COPY_TO_NEXT_SECTION:
  case COPY_TO_PREV_SECTION:
  case COPY_TO_CURRENT:
  default:
    minVal = 0;
    maxVal = 0;
    curVal = 0;
    break;
  }

  // Set up spin box limits and value and enable it if meaningful
  diaSetSpinMMVal(mToSpinBox, minVal, maxVal, curVal);
  mToSpinBox->setSpecialValueText(minVal ? "" : "   ");
  mToSpinBox->setEnabled(minVal > 0);
  mEllipseBox->setEnabled(sData.copyOperation == COPY_TO_OBJECT);

  // Enable the time radio button if appropriate
  if (vw->numTimes)
    mTimeRadio->setEnabled(sData.copyOperation == COPY_TO_TIME);

}
示例#4
0
// Set the surface number and maximum value
void ContSurfPoint::setSurface( int value, int maxVal )
{
  QString str;
  surfaceSpinBox->setEnabled(value >= 0 && maxVal > 0); 
  if (value < 0) {
    surfaceSpinBox->setSpecialValueText("--x--");
    diaSetSpinBox(surfaceSpinBox, 0);
  } else {
    surfaceSpinBox->setSpecialValueText("");
    diaSetSpinMMVal(surfaceSpinBox, 0, maxVal, value);
  }
  str.sprintf("/ %d", maxVal);
  surfaceLabel->setText(str);
}
示例#5
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();
}