X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fapplicationwindow.cpp;h=38f0d7038a13b7d759c08aff28276ed3200ac329;hb=a14390c31519388a3e4f01bc53c0e4572708940c;hp=99092d1abd8664db7f374b44de961eca72741f99;hpb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;p=architektonas diff --git a/src/applicationwindow.cpp b/src/applicationwindow.cpp index 99092d1..38f0d70 100644 --- a/src/applicationwindow.cpp +++ b/src/applicationwindow.cpp @@ -26,70 +26,26 @@ #include "applicationwindow.h" +#include "about.h" #include "drawingview.h" ApplicationWindow::ApplicationWindow(): settings("Underground Software", "Architektonas") { drawing = new DrawingView(this); + drawing->setMouseTracking(true); // We want *all* mouse events...! setCentralWidget(drawing); + aboutWin = new AboutWindow(this); + // ((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 +83,21 @@ void ApplicationWindow::FixLength(void) Object::SetFixedLength(fixLengthAct->isChecked()); } +void ApplicationWindow::DeleteTool(void) +{ + Object::SetDeleteActive(deleteAct->isChecked()); +} + +void ApplicationWindow::DimensionTool(void) +{ + Object::SetDimensionActive(addDimensionAct->isChecked()); +} + +void ApplicationWindow::HelpAbout(void) +{ + aboutWin->show(); +} + void ApplicationWindow::CreateActions(void) { exitAct = CreateAction(tr("&Quit"), tr("Quit"), tr("Exits the application."), @@ -140,6 +111,29 @@ 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/dimension-tool.png"), QKeySequence("D, I"), true); + connect(addDimensionAct, SIGNAL(triggered()), this, SLOT(DimensionTool())); + + addLineAct = CreateAction(tr("Add &Line"), tr("Add Line"), tr("Adds a line to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence(), true); + + addCircleAct = CreateAction(tr("Add &Circle"), tr("Add Circle"), tr("Adds a circle to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence(), true); + + addArcAct = CreateAction(tr("Add &Arc"), tr("Add Arc"), tr("Adds an arc to the drawing."), QIcon(":/res/generic-tool.png"), QKeySequence(), true); + + aboutAct = CreateAction(tr("About &Architektonas"), tr("About Architektonas"), tr("Gives information about this program."), QIcon(":/res/generic-tool.png"), QKeySequence()); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(HelpAbout())); + + //Hm. +/* QActionGroup * group = new QActionGroup(this); + group->addAction(deleteAct); + group->addAction(addDimensionAct); + group->addAction(addLineAct); + group->addAction(addCircleAct); + group->addAction(addArcAct);//*/ } // @@ -189,6 +183,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); @@ -196,8 +198,8 @@ void ApplicationWindow::CreateMenus(void) // menuBar()->addSeparator(); -// helpMenu = menuBar()->addMenu(tr("&Help")); -// helpMenu->addAction(aboutAct); + menu = menuBar()->addMenu(tr("&Help")); + menu->addAction(aboutAct); // helpMenu->addAction(aboutQtAct); } @@ -209,6 +211,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)