예제 #1
0
Crystal::Crystal(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_molecule(NULL),
  m_unitCellDialog(NULL),
  m_importCrystalClipboardAction(new QAction(this)),
  m_editUnitCellAction(new QAction(this)),
  m_buildSupercellAction(new QAction(this)),
  m_niggliReduceAction(new QAction(this)),
  m_scaleVolumeAction(new QAction(this)),
  m_standardOrientationAction(new QAction(this)),
  m_toggleUnitCellAction(new QAction(this)),
  m_wrapAtomsToCellAction(new QAction(this))
{
  m_importCrystalClipboardAction->setText(tr("Import Crystal from Clipboard"));
  connect(m_importCrystalClipboardAction, SIGNAL(triggered()),
          SLOT(importCrystalClipboard()));
  m_actions.push_back(m_importCrystalClipboardAction);
  m_importCrystalClipboardAction->setProperty("menu priority", 220);

  // this will be changed when the molecule is set:
  m_toggleUnitCellAction->setText(tr("Toggle Unit Cell"));
  connect(m_toggleUnitCellAction, SIGNAL(triggered()), SLOT(toggleUnitCell()));
  m_actions.push_back(m_toggleUnitCellAction);
  m_toggleUnitCellAction->setProperty("menu priority", 210);

  m_editUnitCellAction->setText(tr("Edit Unit Cell..."));
  connect(m_editUnitCellAction, SIGNAL(triggered()), SLOT(editUnitCell()));
  m_actions.push_back(m_editUnitCellAction);
  m_editUnitCellAction->setProperty("menu priority", 190);

  m_wrapAtomsToCellAction->setText(tr("&Wrap Atoms to Unit Cell"));
  connect(m_wrapAtomsToCellAction, SIGNAL(triggered()),
          SLOT(wrapAtomsToCell()));
  m_actions.push_back(m_wrapAtomsToCellAction);
  m_wrapAtomsToCellAction->setProperty("menu priority", 180);

  m_standardOrientationAction->setText(tr("Rotate to Standard &Orientation"));
  connect(m_standardOrientationAction, SIGNAL(triggered()),
          SLOT(standardOrientation()));
  m_actions.push_back(m_standardOrientationAction);
  m_standardOrientationAction->setProperty("menu priority", 170);

  m_scaleVolumeAction->setText(tr("Scale Cell &Volume"));
  connect(m_scaleVolumeAction, SIGNAL(triggered()), SLOT(scaleVolume()));
  m_actions.push_back(m_scaleVolumeAction);
  m_scaleVolumeAction->setProperty("menu priority", 160);

  m_buildSupercellAction->setText(tr("Build &Supercell"));
  connect(m_buildSupercellAction, SIGNAL(triggered()), SLOT(buildSupercell()));
  m_actions.push_back(m_buildSupercellAction);
  m_buildSupercellAction->setProperty("menu priority", 150);

  m_niggliReduceAction->setText(tr("Reduce Cell (&Niggli)"));
  connect(m_niggliReduceAction, SIGNAL(triggered()), SLOT(niggliReduce()));
  m_actions.push_back(m_niggliReduceAction);
  m_niggliReduceAction->setProperty("menu priority", 140);

  updateActions();
}
예제 #2
0
Crystal::Crystal(QObject *parent_) :
  Avogadro::QtGui::ExtensionPlugin(parent_),
  m_molecule(NULL),
  m_unitCellDialog(NULL),
  m_editUnitCellAction(new QAction(this)),
  m_niggliReduceAction(new QAction(this)),
  m_scaleVolumeAction(new QAction(this)),
  m_standardOrientationAction(new QAction(this)),
  m_toggleUnitCellAction(new QAction(this)),
  m_wrapAtomsToCellAction(new QAction(this))
{
  // this will be changed when the molecule is set:
  m_toggleUnitCellAction->setText(tr("Toggle Unit Cell"));
  connect(m_toggleUnitCellAction, SIGNAL(triggered()), SLOT(toggleUnitCell()));
  m_actions.push_back(m_toggleUnitCellAction);
  m_toggleUnitCellAction->setProperty("menu priority", -1);

  m_editUnitCellAction->setText(tr("Edit Unit Cell..."));
  connect(m_editUnitCellAction, SIGNAL(triggered()), SLOT(editUnitCell()));
  m_actions.push_back(m_editUnitCellAction);
  m_editUnitCellAction->setProperty("menu priority", -50);

  m_wrapAtomsToCellAction->setText(tr("&Wrap Atoms to Unit Cell"));
  connect(m_wrapAtomsToCellAction, SIGNAL(triggered()),
          SLOT(wrapAtomsToCell()));
  m_actions.push_back(m_wrapAtomsToCellAction);
  m_wrapAtomsToCellAction->setProperty("menu priority", -200);

  m_standardOrientationAction->setText(tr("Rotate to Standard &Orientation"));
  connect(m_standardOrientationAction, SIGNAL(triggered()),
          SLOT(standardOrientation()));
  m_actions.push_back(m_standardOrientationAction);
  m_standardOrientationAction->setProperty("menu priority", -250);

  m_scaleVolumeAction->setText(tr("Scale Cell &Volume"));
  connect(m_scaleVolumeAction, SIGNAL(triggered()), SLOT(scaleVolume()));
  m_actions.push_back(m_scaleVolumeAction);
  m_scaleVolumeAction->setProperty("menu priority", -275);

  m_niggliReduceAction->setText(tr("Reduce Cell (&Niggli)"));
  connect(m_niggliReduceAction, SIGNAL(triggered()), SLOT(niggliReduce()));
  m_actions.push_back(m_niggliReduceAction);
  m_niggliReduceAction->setProperty("menu priority", -350);

  updateActions();
}