CEMatrixEditor::CEMatrixEditor(CrystallographyExtension *ext, QMainWindow *w) : CEAbstractEditor(ext, w) { ui.setupUi(this); // Emit editStarted connect(ui.edit_matrix, SIGNAL(textChanged()), this, SIGNAL(editStarted())); // Apply button connections connect(ui.push_matrix_apply, SIGNAL(clicked()), this, SIGNAL(editAccepted())); connect(ui.push_matrix_apply, SIGNAL(clicked()), this, SLOT(setMatrix())); // Reset button connections connect(ui.push_matrix_reset, SIGNAL(clicked()), this, SIGNAL(editRejected())); connect(ui.push_matrix_reset, SIGNAL(clicked()), this, SLOT(refreshEditor())); // Validation connect(ui.edit_matrix, SIGNAL(textChanged()), this, SLOT(validateEditor())); // Apply/reset enable connect(ui.edit_matrix, SIGNAL(textChanged()), this, SLOT(enableButtons())); ui.edit_matrix->setCurrentFont(QFont("Monospace", CE_FONTSIZE)); m_charFormat = ui.edit_matrix->textCursor().charFormat(); }
void CEParameterEditor::setParameters() { CEUnitCellParameters p = validateEditor(); CEUndoState before (m_ext); m_ext->setCurrentCellParameters(p); CEUndoState after (m_ext); m_ext->pushUndo(new CEUndoCommand (before, after, tr("Set Unit Cell Params"))); }
void CEMatrixEditor::setMatrix() { Eigen::Matrix3d mat = validateEditor(); if (mat.isZero()) { return; } CEUndoState before (m_ext); m_ext->setCurrentCellMatrix(mat); CEUndoState after (m_ext); m_ext->pushUndo(new CEUndoCommand (before, after, tr("Set Unit Cell Matrix"))); }