X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fapplicationwindow.cpp;h=96b13ca8b6a66964d8094784d17f062d96342ab2;hb=11802354d1ddc5bc571d83d8fc9b600618cb4372;hp=03f8cb5b167ef94c60c0c18d0b786032beb3e898;hpb=2af76acd67a2703859c11446be3be4d3ff8ff4b4;p=architektonas diff --git a/src/applicationwindow.cpp b/src/applicationwindow.cpp index 03f8cb5..96b13ca 100644 --- a/src/applicationwindow.cpp +++ b/src/applicationwindow.cpp @@ -469,6 +469,22 @@ void ApplicationWindow::HandleGridSizeInPixels(int size) } +void ApplicationWindow::HandleGridSizeInBaseUnits(QString text) +{ + // Parse the text... + bool ok; + double value = text.toDouble(&ok); + + // Nothing parsable to a double, so quit... + if (!ok) + return; + + drawing->gridSpacing = value; + Painter::zoom = drawing->gridPixels / drawing->gridSpacing; + drawing->update(); +} + + void ApplicationWindow::CreateActions(void) { exitAct = CreateAction(tr("&Quit"), tr("Quit"), tr("Exits the application."), @@ -630,8 +646,11 @@ void ApplicationWindow::CreateToolbars(void) toolbar->setObjectName("View"); toolbar->addAction(zoomInAct); toolbar->addAction(zoomOutAct); + QSpinBox * spinbox = new QSpinBox; toolbar->addWidget(spinbox); + QLineEdit * lineedit = new QLineEdit; + toolbar->addWidget(lineedit); toolbar = addToolBar(tr("Edit")); toolbar->setObjectName("Edit"); @@ -650,7 +669,9 @@ void ApplicationWindow::CreateToolbars(void) spinbox->setRange(4, 256); spinbox->setValue(12); + lineedit->setText("12"); connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(HandleGridSizeInPixels(int))); + connect(lineedit, SIGNAL(textChanged(QString)), this, SLOT(HandleGridSizeInBaseUnits(QString))); }