]> Shamusworld >> Repos - architektonas/blobdiff - src/applicationwindow.cpp
Added base units & display style to drawing.
[architektonas] / src / applicationwindow.cpp
index 8c114c8d045c43723dbdd81d7e492a4d89f770e3..8bbdbc1c5646c8c996fdf33244b0f0995f711fa7 100644 (file)
@@ -33,6 +33,7 @@
 #include "blockwidget.h"
 #include "commandprocessor.h"
 #include "consolewidget.h"
+#include "drawingsettingsdlg.h"
 #include "drawingview.h"
 #include "fileio.h"
 #include "generaltab.h"
@@ -596,7 +597,7 @@ void ApplicationWindow::SetInternalToolStates(void)
        else
                Global::tool = TTNone;
 
-       cw->SetToolPrompt();//cw->cmdline);
+       cw->SetToolPrompt();
        drawing->update();
 }
 
@@ -618,6 +619,25 @@ void ApplicationWindow::Settings(void)
        WriteSettings();
 }
 
+void ApplicationWindow::DrawingSettings(void)
+{
+       DrawingSettingsDlg dlg(this);
+       dlg.baseUnit->setCurrentIndex(drawing->document.baseUnit);
+       dlg.unitStyle->setCurrentIndex(drawing->document.unitStyle);
+       dlg.decimalPrecision->setCurrentIndex(drawing->document.decimalPrecision);
+       dlg.fractionalPrecision->setCurrentIndex(drawing->document.fractionalPrecision);
+
+       if (dlg.exec() == false)
+               return;
+
+       // Deal with stuff here (since user hit "OK" button...)
+       drawing->document.baseUnit = dlg.baseUnit->currentIndex();
+       drawing->document.unitStyle = dlg.unitStyle->currentIndex();
+       drawing->document.decimalPrecision= dlg.decimalPrecision->currentIndex();
+       drawing->document.fractionalPrecision = dlg.fractionalPrecision->currentIndex();
+       drawing->update();
+}
+
 //
 // Group a bunch of selected objects (which can include other groups) together
 // or ungroup a selected group.
@@ -904,6 +924,9 @@ void ApplicationWindow::CreateActions(void)
        settingsAct = CreateAction(tr("&Settings"), tr("Settings"), tr("Change certain defaults for Architektonas."), QIcon(":/res/settings.png"), QKeySequence());
        connect(settingsAct, SIGNAL(triggered()), this, SLOT(Settings()));
 
+       drawingSettingsAct = CreateAction(tr("&Drawing Settings"), tr("Drawing settings"), tr("Change certain defaults for the current drawing."), QIcon(":/res/settings.png"), QKeySequence());
+       connect(drawingSettingsAct, SIGNAL(triggered()), this, SLOT(DrawingSettings()));
+
        groupAct = CreateAction(tr("&Group"), tr("Group"), tr("Group/ungroup selected objects."), QIcon(":/res/group-tool.png"), QKeySequence("g"));
        connect(groupAct, SIGNAL(triggered()), this, SLOT(HandleGrouping()));
 
@@ -1044,6 +1067,7 @@ void ApplicationWindow::CreateMenus(void)
        menu->addAction(addSplineAct);
        menu->addAction(addDimensionAct);
        menu->addSeparator();
+       menu->addAction(drawingSettingsAct);
        menu->addAction(settingsAct);
 
        menu = menuBar()->addMenu(tr("&Help"));