void DigitizeStateSelect::handleContextMenuEventAxis34 (CmdMediator *cmdMediator, const QString &pointIdentifier) { LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateSelect::handleContextMenuEventAxis34"; QPointF posScreen = cmdMediator->document().positionScreen (pointIdentifier); QPointF posGraphBefore = cmdMediator->document().positionGraph (pointIdentifier); bool isXOnly = cmdMediator->document().isXOnly (pointIdentifier); // Ask user for coordinates double x = posGraphBefore.x(); double y = posGraphBefore.y(); DlgEditPointAxis *dlg = new DlgEditPointAxis (context().mainWindow(), cmdMediator->document().modelCoords(), cmdMediator->document().modelGeneral(), context().mainWindow().modelMainWindow(), context().mainWindow().transformation(), cmdMediator->document().documentAxesPointsRequired(), isXOnly, &x, &y); int rtn = dlg->exec (); QPointF posGraphAfter = dlg->posGraph (isXOnly); // This call returns new values for isXOnly and the graph position delete dlg; if (rtn == QDialog::Accepted) { // User wants to edit this axis point, but let's perform sanity checks first bool isError; QString errorMessage; context().mainWindow().cmdMediator()->document().checkEditPointAxis(pointIdentifier, posScreen, posGraphAfter, isError, errorMessage); if (isError) { QMessageBox::warning (0, engaugeWindowTitle(), errorMessage); } else { // Create a command to edit the point CmdEditPointAxis *cmd = new CmdEditPointAxis (context().mainWindow(), cmdMediator->document(), pointIdentifier, posGraphBefore, posGraphAfter, isXOnly); context().appendNewCmd(cmdMediator, cmd); } } }
void DigitizeStateAxis::handleMouseRelease (CmdMediator *cmdMediator, QPointF posScreen) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateAxis::handleMouseRelease"; if (context().mainWindow().transformIsDefined()) { QMessageBox::warning (nullptr, QObject::tr ("Engauge Digitizer"), QObject::tr ("Three axis points have been defined, and no more are needed or allowed.")); } else { createTemporaryPoint (cmdMediator, posScreen); // Ask user for coordinates DlgEditPointAxis *dlg = new DlgEditPointAxis (context ().mainWindow (), cmdMediator->document().modelCoords(), cmdMediator->document().modelGeneral(), context().mainWindow().modelMainWindow(), context().mainWindow().transformation(), cmdMediator->document().documentAxesPointsRequired()); int rtn = dlg->exec (); bool isXOnly; QPointF posGraph = dlg->posGraph (isXOnly); delete dlg; // Remove temporary point context().mainWindow().scene().removePoint(Point::temporaryPointIdentifier ()); if (rtn == QDialog::Accepted) { // User wants to add this axis point, but let's perform sanity checks first bool isError; QString errorMessage; int nextOrdinal = cmdMediator->document().nextOrdinalForCurve(AXIS_CURVE_NAME); cmdMediator->document().checkAddPointAxis(posScreen, posGraph, isError, errorMessage, isXOnly); if (isError) { QMessageBox::warning (nullptr, QObject::tr ("Engauge Digitizer"), errorMessage); } else { // Create command to add point Document &document = cmdMediator->document (); QUndoCommand *cmd = new CmdAddPointAxis (context ().mainWindow(), document, posScreen, posGraph, nextOrdinal, isXOnly); context().appendNewCmd(cmdMediator, cmd); } } } }