Esempio n. 1
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"
                  );
  }
Esempio n. 2
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"));
}
Esempio n. 3
0
ImodvImage::ImodvImage(QWidget *parent, bool fillBut, const char *name)
  : DialogFrame(parent, fillBut ? 3 : 2, 1, buttonLabels, buttonTips, true, 
                ImodPrefs->getRoundedStyle(), "3dmodv Image View", "", name)
{
  mCtrlPressed = false;

  // Make view checkboxes
  mViewXBox = diaCheckBox("View X image", this, mLayout);
  mViewXBox->setChecked(sFlags & IMODV_DRAW_CX);
  connect(mViewXBox, SIGNAL(toggled(bool)), this, SLOT(viewXToggled(bool)));
  mViewYBox = diaCheckBox("View Y image", this, mLayout);
  mViewYBox->setChecked(sFlags & IMODV_DRAW_CY);
  connect(mViewYBox, SIGNAL(toggled(bool)), this, SLOT(viewYToggled(bool)));
  mViewZBox = diaCheckBox("View Z image", this, mLayout);
  mViewZBox->setChecked(sFlags & IMODV_DRAW_CZ);
  connect(mViewZBox, SIGNAL(toggled(bool)), this, SLOT(viewZToggled(bool)));
  mViewXBox->setToolTip("Display YZ plane at current X");
  mViewYBox->setToolTip("Display XZ plane at current Y");
  mViewZBox->setToolTip("Display XY plane at current Z");

  // Make multisliders
  mSliders = new MultiSlider(this, 10, sliderLabels);

  mSliders->setRange(IIS_X_COORD, 1, Imodv->vi->xsize);
  mSliders->setRange(IIS_X_SIZE, 1, Imodv->vi->xsize);
  if (sLastYsize < 0) {
    sXdrawSize = Imodv->vi->xsize;
    sYdrawSize = Imodv->vi->ysize;
    sZdrawSize = Imodv->vi->zsize;
    sLastYsize = Imodv->vi->ysize;
  }
  updateCoords();
  mSliders->setValue(IIS_X_SIZE, sXdrawSize);
  mSliders->setValue(IIS_Y_SIZE, sYdrawSize);
  mSliders->setValue(IIS_Z_SIZE, sZdrawSize);
  mSliders->setRange(IIS_SLICES, 1, 64);
  mSliders->setValue(IIS_SLICES, sNumSlices);
  mSliders->setRange(IIS_TRANSPARENCY, 0, 100);
  mSliders->setValue(IIS_TRANSPARENCY, sImageTrans);
  mSliders->setValue(IIS_BLACK, sBlackLevel);
  mSliders->setValue(IIS_WHITE, sWhiteLevel);
  mLayout->addLayout(mSliders->getLayout());
  (mSliders->getLayout())->setSpacing(4);
  connect(mSliders, SIGNAL(sliderChanged(int, int, bool)), this, 
          SLOT(sliderMoved(int, int, bool)));
  mSliders->getSlider(IIS_X_COORD)->setToolTip("Set current image X coordinate");
  mSliders->getSlider(IIS_Y_COORD)->setToolTip("Set current image Y coordinate");
  mSliders->getSlider(IIS_Z_COORD)->setToolTip("Set current image Z coordinate");
  mSliders->getSlider(IIS_X_SIZE)->setToolTip("Set image size to display in X");
  mSliders->getSlider(IIS_Y_SIZE)->setToolTip("Set image size to display in Y");
  mSliders->getSlider(IIS_Z_SIZE)->setToolTip("Set image size to display in Z");
  mSliders->getSlider(IIS_SLICES)->setToolTip("Set number of slices to display");
  mSliders->getSlider(IIS_TRANSPARENCY)->setToolTip("Set percent transparency");
  mSliders->getSlider(IIS_BLACK)->setToolTip("Set minimum black level of contrast ramp");
  mSliders->getSlider(IIS_WHITE)->setToolTip("Set maximum white level of contrast ramp");

  QPushButton *copyBut = diaPushButton("Use 3dmod Black/White", this, mLayout);
  copyBut->setToolTip("Set black and white levels from sliders in 3dmod Info window");
  connect(copyBut, SIGNAL(clicked()), this, SLOT(copyBWclicked()));

  // Make false color checkbox
  mFalseBox = diaCheckBox("False color", this, mLayout);
  mFalseBox->setChecked(sFalsecolor);
  connect(mFalseBox, SIGNAL(toggled(bool)), this, SLOT(falseToggled(bool)));
  mFalseBox->setToolTip("Display image in false color");

  if (Imodv->vi->colormapImage) {
    mFalseBox->setEnabled(false);
    copyBut->setEnabled(false);
    mSliders->getSlider(IIS_SLICES)->setEnabled(false);
    mSliders->getSlider(IIS_BLACK)->setEnabled(false);
    mSliders->getSlider(IIS_WHITE)->setEnabled(false);
  }

  connect(this, SIGNAL(actionClicked(int)), this, SLOT(buttonPressed(int)));
}
Esempio n. 4
0
/*
 * Object list class constructor
 */
ImodvOlist::ImodvOlist(QWidget *parent, Qt::WFlags fl)
  : QWidget(parent, fl)
{
  int nPerCol, olistNcol, ob, i;
  QString qstr;
  QLabel *label;
  const char *labels[] = {"New", "Delete", "Clear", "Add All", "Swap", "ON", "OFF",
                    "On", "Off"};
  const char *tips[] = {"Start a new object group, copied from current group",
                  "Remove the current object group from list of groups",
                  "Remove all objects from the current group",
                  "Add all objects to the current group",
                  "Remove current members and add all non-members",
                  "Turn ON all objects in the current group",
                  "Turn OFF all objects in the current group",
                  "Turn ON objects NOT in the current group",
                  "Turn OFF objects NOT in the current group"};
  
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);
  QVBoxLayout *layout = new QVBoxLayout(this);
  layout->setContentsMargins(5, 5, 5, 5);
  layout->setSpacing(6);

  QGroupBox *grpbox = new QGroupBox("Object Group Selection");
  layout->addWidget(grpbox);
  QVBoxLayout *gblay = new QVBoxLayout(grpbox);
  gblay->setContentsMargins(6, 3, 6, 6);
  gblay->setSpacing(6);
  QHBoxLayout *hbox = diaHBoxLayout(gblay); 
  
  mGroupSpin = (QSpinBox *)diaLabeledSpin(0, 0., 0., 1., "Group", grpbox,hbox);
  mGroupSpin->setSpecialValueText("None");
  connect(mGroupSpin, SIGNAL(valueChanged(int)), this, 
          SLOT(curGroupChanged(int)));
  mGroupSpin->setToolTip("Select the current object group or turn off "
                "selection");

  mNumberLabel = diaLabel("/99", grpbox, hbox);
  mNameEdit = new QLineEdit(grpbox);
  hbox->addWidget(mNameEdit);
  mNameEdit->setMaxLength(OBJGRP_STRSIZE - 1);
  mNameEdit->setFocusPolicy(Qt::ClickFocus);
  connect(mNameEdit, SIGNAL(returnPressed()), this,
          SLOT(returnPressed()));
  connect(mNameEdit, SIGNAL(textChanged(const QString&)), this,
          SLOT(nameChanged(const QString&)));
  mNameEdit->setToolTip("Enter a name for the current group");

  QSignalMapper *clickMapper = new QSignalMapper(this);
  connect(clickMapper, SIGNAL(mapped(int)), this,
          SLOT(actionButtonClicked(int)));

  // Make the buttons and put in hbox
  for (i = 0; i < OBJLIST_NUMBUTTONS; i++) {

    if (i == 0 || i == 5)
      hbox = diaHBoxLayout(gblay);
    if (i == 7) {
      label = diaLabel("Others:", grpbox, hbox);
      label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    }

    qstr = labels[i];
    mButtons[i] = diaPushButton(LATIN1(qstr), grpbox, hbox);
    clickMapper->setMapping(mButtons[i], i);
    connect(mButtons[i], SIGNAL(clicked()), clickMapper, SLOT(map()));
    mButtons[i]->setToolTip(tips[i]);
  }

  mScroll = new QScrollArea(this);
  layout->addWidget(mScroll);
  mFrame = new QFrame();
  mScroll->setAutoFillBackground(true);
  QPalette palette = mFrame->palette();
  QColor bkg = palette.color(mFrame->backgroundRole());
  diaSetWidgetColor(mScroll->viewport(), bkg);
  mGrid = new QGridLayout(mFrame);
  mGrid->setSpacing(2);
  olistNcol = (numOolistButtons + MAX_LIST_IN_COL - 1) / MAX_LIST_IN_COL;
  nPerCol = (numOolistButtons + olistNcol - 1) / olistNcol;

  // Get a signal mapper, connect to the slot for these buttons
  QSignalMapper *mapper = new QSignalMapper(this);
  connect(mapper, SIGNAL(mapped(int)), this, SLOT(toggleListSlot(int)));
  QSignalMapper *gmapper = new QSignalMapper(this);
  connect(gmapper, SIGNAL(mapped(int)), this, SLOT(toggleGroupSlot(int)));
  
  // Make the buttons, set properties and map them
  for (ob = 0; ob < numOolistButtons; ob++) {
    QHBoxLayout *hLayout = new QHBoxLayout();
    mGrid->addLayout(hLayout, ob % nPerCol, ob / nPerCol);
    groupButtons[ob] = diaCheckBox("", mFrame, hLayout);
    qstr.sprintf("%d: ",ob + 1);
    OolistButtons[ob] = diaCheckBox(LATIN1(qstr), mFrame, hLayout);
    OolistButtons[ob]->setAutoFillBackground(true);
    mapper->setMapping(OolistButtons[ob], ob);
    connect(OolistButtons[ob], SIGNAL(toggled(bool)), mapper, SLOT(map()));
    gmapper->setMapping(groupButtons[ob], ob);
    connect(groupButtons[ob], SIGNAL(toggled(bool)), gmapper, SLOT(map()));
    hLayout->setStretchFactor(OolistButtons[ob], 100);

    // Hide the buttons later after window size is set
    grouping = true;
  }
  mScroll->setWidget(mFrame);

  // Make a line
  QFrame *line = new QFrame(this);
  line->setFrameShape( QFrame::HLine );
  line->setFrameShadow( QFrame::Sunken );
  layout->addWidget(line);

  QHBoxLayout *box = diaHBoxLayout(layout);
  mDoneButton = diaPushButton("Done", this, box);
  connect(mDoneButton, SIGNAL(clicked()), this, SLOT(donePressed()));
  mHelpButton = diaPushButton("Help", this, box);
  connect(mHelpButton, SIGNAL(clicked()), this, SLOT(helpPressed()));
  setFontDependentWidths();
}