Beispiel #1
0
/*
 * Initialize
 */
void MovieSequenceForm::init()
{
  setAttribute(Qt::WA_DeleteOnClose);
  setAttribute(Qt::WA_AlwaysShowToolTips);
  mSegments = mvMovieSegmentArray();
  connect(doneButton, SIGNAL(clicked()), this, SLOT(close()));
  connect(addAfterButton, SIGNAL(clicked()), this, SLOT(addAfterClicked()));
  connect(addBeforeButton, SIGNAL(clicked()), this, SLOT(addBeforeClicked()));
  connect(replaceButton, SIGNAL(clicked()), this, SLOT(replaceClicked()));
  connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
  connect(setMovieButton, SIGNAL(clicked()), this, SLOT(setMovieClicked()));
  connect(setStartButton, SIGNAL(clicked()), this, SLOT(setStartClicked()));
  connect(setEndButton, SIGNAL(clicked()), this, SLOT(setEndClicked()));
  connect(runAllButton, SIGNAL(clicked()), this, SLOT(runAllClicked()));
  connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
  connect(loadButton, SIGNAL(clicked()), this, SLOT(loadClicked()));
  connect(helpButton, SIGNAL(clicked()), this, SLOT(helpClicked()));
  connect(table, SIGNAL(cellChanged(int, int)), this, SLOT(entryChanged(int,int)));
  setFontDependentWidths();
  mModified = false;

  // Change window size to give 4 rows plus header
  imod_info_input();
  adjustSize();
  QSize winSize = sizeHint();
  QSize tableSize = table->sizeHint();
  int desired = 5.6 * (table->fontMetrics().height() + 3);
  resize(winSize.width(), winSize.height() + (desired - tableSize.height()));
}
Beispiel #2
0
/*
 * Set a cursor based on movie/model mode or need for special drawing cursor; maintain
 * the last state set and mode for which is was set
 */
void utilSetCursor(int mode, bool setAnyway, bool needSpecial, bool needSizeAll,
                   int *dragging, bool needModel, int &mouseMode, int &lastShape, 
                   QGLWidget *GLw)
{
  Qt::CursorShape shape;

  // Set up a special cursor for the rubber band, lasso, etc
  if (needSpecial) {
    if (needSizeAll)
      shape = Qt::SizeAllCursor;
    else if ((dragging[0] && dragging[2]) || (dragging[1] && dragging[3]))
      shape = Qt::SizeFDiagCursor;
    else if ((dragging[1] && dragging[2]) || (dragging[0] && dragging[3]))
      shape = Qt::SizeBDiagCursor;
    else if (dragging[0] || dragging[1])
      shape = Qt::SizeHorCursor;
    else if (dragging[2] || dragging[3])
      shape = Qt::SizeVerCursor;
    if (shape != lastShape || setAnyway) {

      // This one makes the cursor show up a little better on starting/MAC
      imod_info_input();
      GLw->setCursor(QCursor(shape));
    }
    lastShape = shape;
    return;
  }

  // Or restore cursor from special state or change cursor due to mode change
  if (mouseMode != mode || lastShape >= 0 || setAnyway) {
    if (mode == IMOD_MMODEL || needModel) {
      GLw->setCursor(*App->modelCursor);
    } else {
      GLw->unsetCursor();
    }
    mouseMode = mode;
    lastShape = -1;
    imod_info_input();
  }
}
Beispiel #3
0
/*
 * Given the menu hit index, the specific table, and the number of specific entries,
 * look the action up in the specific or default table and return the key and modifiers
 */
int utilLookupPopupHit(int index, PopupEntry *specificTable, int numSpecific,
                       Qt::KeyboardModifiers &modifiers)
{
  PopupEntry *entry;
  if (numSpecific < 0)
    numSpecific = sNumSpecActions;
  imod_info_input();   // Should we do this?  There is a redisplay from menu dropping
  if (index < numSpecific)
    entry = &specificTable[index];
  else
    entry = &sDefaultActions[index - numSpecific];
  modifiers = (Qt::KeyboardModifiers)((entry->ctrl ? Qt::ControlModifier : 0) | 
                                      (entry->shift ? Qt::ShiftModifier : 0));
  return entry->key;
}
Beispiel #4
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();
}
Beispiel #5
0
void ImodvOlist::adjustFrameSize()
{
  imod_info_input();
  mFrame->adjustSize();
}