]> Shamusworld >> Repos - architektonas/blobdiff - src/applicationwindow.cpp
Preliminary Delete Object tool implementation.
[architektonas] / src / applicationwindow.cpp
index 99092d1abd8664db7f374b44de961eca72741f99..b156d15fa90ab926f2ea92098b380b9beef57fa1 100644 (file)
@@ -35,61 +35,13 @@ ApplicationWindow::ApplicationWindow(): settings("Underground Software", "Archit
        setCentralWidget(drawing);
 
 //     ((TTEdit *)qApp)->charWnd = new CharWindow(this);
-//     editWnd = new EditWindow(this);
-//     setCentralWidget(editWnd);
+
        setWindowIcon(QIcon(":/res/atns-icon.png"));
        setWindowTitle("Architektonas");
 
        CreateActions();
        CreateMenus();
        CreateToolbars();
-#if 0
-//     createActions();
-       newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
-       newAct->setShortcuts(QKeySequence::New);
-       newAct->setStatusTip(tr("Create a new file"));
-       connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
-
-       openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
-       openAct->setShortcuts(QKeySequence::Open);
-       openAct->setStatusTip(tr("Open an existing file"));
-       connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
-
-       aboutQtAct = new QAction(tr("About &Qt"), this);
-       aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
-       connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-
-//     createMenus();
-       fileMenu = menuBar()->addMenu(tr("&File"));
-       fileMenu->addAction(newAct);
-       fileMenu->addAction(openAct);
-       fileMenu->addAction(saveAct);
-       fileMenu->addAction(saveAsAct);
-       fileMenu->addSeparator();
-       fileMenu->addAction(exitAct);
-
-       editMenu = menuBar()->addMenu(tr("&Edit"));
-       editMenu->addAction(cutAct);
-       editMenu->addAction(copyAct);
-       editMenu->addAction(pasteAct);
-
-       menuBar()->addSeparator();
-
-       helpMenu = menuBar()->addMenu(tr("&Help"));
-       helpMenu->addAction(aboutAct);
-       helpMenu->addAction(aboutQtAct);
-
-//     createToolBars();
-       fileToolBar = addToolBar(tr("File"));
-       fileToolBar->addAction(newAct);
-       fileToolBar->addAction(openAct);
-       fileToolBar->addAction(saveAct);
-
-       editToolBar = addToolBar(tr("Edit"));
-       editToolBar->addAction(cutAct);
-       editToolBar->addAction(copyAct);
-       editToolBar->addAction(pasteAct);
-#endif
 
        //      Create status bar
        statusBar()->showMessage(tr("Ready"));
@@ -127,6 +79,11 @@ void ApplicationWindow::FixLength(void)
        Object::SetFixedLength(fixLengthAct->isChecked());
 }
 
+void ApplicationWindow::DeleteTool(void)
+{
+       Object::SetDeleteActive(deleteAct->isChecked());
+}
+
 void ApplicationWindow::CreateActions(void)
 {
        exitAct = CreateAction(tr("&Quit"), tr("Quit"), tr("Exits the application."),
@@ -140,6 +97,17 @@ void ApplicationWindow::CreateActions(void)
        fixLengthAct = CreateAction(tr("Fix &Length"), tr("Fix Length"), tr("Fixes the length of an object."),
                QIcon(":/res/fix-length.png"), QKeySequence(tr("F,L")), true);
        connect(fixLengthAct, SIGNAL(triggered()), this, SLOT(FixLength()));
+
+       deleteAct = CreateAction(tr("&Delete"), tr("Delete Object"), tr("Deletes selected objects."), QIcon(":/res/generic-tool.png"), QKeySequence(), true);
+       connect(deleteAct, SIGNAL(triggered()), this, SLOT(DeleteTool()));
+
+       addDimensionAct = CreateAction(tr("Add &Dimension"), tr("Add Dimension"), tr("Adds a dimension to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence());
+
+       addLineAct = CreateAction(tr("Add &Line"), tr("Add Line"), tr("Adds a line to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence());
+
+       addCircleAct = CreateAction(tr("Add &Circle"), tr("Add Circle"), tr("Adds a circle to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence());
+
+       addArcAct = CreateAction(tr("Add &Arc"), tr("Add Arc"), tr("Adds an arc to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence());
 }
 
 //
@@ -189,6 +157,14 @@ void ApplicationWindow::CreateMenus(void)
        menu = menuBar()->addMenu(tr("&Edit"));
        menu->addAction(fixAngleAct);
        menu->addAction(fixLengthAct);
+       menu->addSeparator();
+       menu->addAction(deleteAct);
+       menu->addSeparator();
+       menu->addAction(addLineAct);
+       menu->addAction(addCircleAct);
+       menu->addAction(addArcAct);
+       menu->addAction(addDimensionAct);
+
 //     editMenu = menuBar()->addMenu(tr("&Edit"));
 //     editMenu->addAction(cutAct);
 //     editMenu->addAction(copyAct);
@@ -209,6 +185,11 @@ void ApplicationWindow::CreateToolbars(void)
        toolbar = addToolBar(tr("Edit"));
        toolbar->addAction(fixAngleAct);
        toolbar->addAction(fixLengthAct);
+       toolbar->addAction(deleteAct);
+       toolbar->addAction(addLineAct);
+       toolbar->addAction(addCircleAct);
+       toolbar->addAction(addArcAct);
+       toolbar->addAction(addDimensionAct);
 }
 
 void ApplicationWindow::ReadSettings(void)