X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fapplicationwindow.cpp;h=ef42ca24a6acc9fc2c00089965f7855ff5e13852;hb=f97fcdd0f5c95d15cc8f03a818ed8e90e76e8f5a;hp=a9108eb5f6d3d2b5d96b5280b99e13652013f6ed;hpb=ba6723b86d8dd67ebc7b11b245de3e7ff64f06b1;p=architektonas diff --git a/src/applicationwindow.cpp b/src/applicationwindow.cpp index a9108eb..ef42ca2 100644 --- a/src/applicationwindow.cpp +++ b/src/applicationwindow.cpp @@ -29,9 +29,11 @@ #include "applicationwindow.h" #include "about.h" +#include "blockwidget.h" #include "drawingview.h" #include "fileio.h" #include "generaltab.h" +#include "layerwidget.h" #include "painter.h" #include "settingsdialog.h" @@ -53,20 +55,23 @@ ApplicationWindow::ApplicationWindow(): settings("Underground Software", "Archit CreateMenus(); CreateToolbars(); + // Create Dock widgets + QDockWidget * dock1 = new QDockWidget(tr("Layers"), this); + LayerWidget * lw = new LayerWidget; + dock1->setWidget(lw); + addDockWidget(Qt::RightDockWidgetArea, dock1); + QDockWidget * dock2 = new QDockWidget(tr("Blocks"), this); +// BlockWidget * bw = new BlockWidget; +// dock2->setWidget(bw); + addDockWidget(Qt::RightDockWidgetArea, dock2); + // Create status bar zoomIndicator = new QLabel("Grid: 12.0\" Zoom: 12.5%"); statusBar()->addPermanentWidget(zoomIndicator); statusBar()->showMessage(tr("Ready")); ReadSettings(); - -// connect(textEdit->document(), SIGNAL(contentsChanged()), -// this, SLOT(documentWasModified())); - -// setCurrentFile(""); setUnifiedTitleAndToolBarOnMac(true); - -// ((TTEdit *)qApp)->charWnd->show();//eh? Object::SetFont(new QFont("Verdana", 15, QFont::Bold)); } @@ -197,7 +202,17 @@ void ApplicationWindow::FixLength(void) // We want certain tools to be exclusive, and this approach isn't working correctly... void ApplicationWindow::DeleteTool(void) { - + // For this tool, we check first to see if anything is selected. If so, we + // delete those and *don't* select the delete tool. + if (drawing->document.ItemsSelected() > 0) + { + drawing->document.DeleteSelectedItems(); + drawing->update(); + deleteAct->setChecked(false); + return; + } + + // Otherwise, toggle the state of the tool ClearUIToolStatesExcept(deleteAct); SetInternalToolStates(); } @@ -382,11 +397,16 @@ void ApplicationWindow::Settings(void) } +// +// Group a bunch of selected objects (which can include other groups) together +// or ungroup a selected group. +// void ApplicationWindow::HandleGrouping(void) { - // Group a bunch of selected objects together or ungroup a selected group. + int itemsSelected = drawing->document.ItemsSelected(); - if (drawing->document.ItemsSelected() == 0) + // If nothing selected, do nothing + if (itemsSelected == 0) { statusBar()->showMessage(tr("No objects selected to make a group from.")); return; @@ -394,7 +414,7 @@ void ApplicationWindow::HandleGrouping(void) // If it's a group that's selected, ungroup it and leave the objects in a // selected state - if (drawing->document.ItemsSelected() == 1) + if (itemsSelected == 1) { Object * object = drawing->document.SelectedItem(0); @@ -418,16 +438,18 @@ else ((Container *)object)->SelectAll(); ((Container *)object)->MoveContentsTo(&(drawing->document)); drawing->document.Delete(object); + statusBar()->showMessage(tr("Objects ungrouped.")); } // Otherwise, if it's a group of 2 or more objects (which can be groups too) // group them and select the group - else if (drawing->document.ItemsSelected() > 1) + else if (itemsSelected > 1) { Container * container = new Container(Vector(), &(drawing->document)); drawing->document.MoveSelectedContentsTo(container); drawing->document.Add(container); container->DeselectAll(); container->state = OSSelected; + statusBar()->showMessage(QString(tr("Grouped %1 objects.")).arg(itemsSelected)); } drawing->update(); @@ -440,7 +462,7 @@ void ApplicationWindow::CreateActions(void) QIcon(":/res/quit.png"), QKeySequence(tr("Ctrl+q"))); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - snapToGridAct = CreateAction(tr("Snap To &Grid"), tr("Snap To Grid"), tr("Snaps mouse cursor to the visible grid when moving/creating objects."), QIcon(":/res/generic-tool.png"), QKeySequence(tr("S")), true); + snapToGridAct = CreateAction(tr("Snap To &Grid"), tr("Snap To Grid"), tr("Snaps mouse cursor to the visible grid when moving/creating objects."), QIcon(":/res/snap-to-grid-tool.png"), QKeySequence(tr("S")), true); connect(snapToGridAct, SIGNAL(triggered()), this, SLOT(SnapToGridTool())); fixAngleAct = CreateAction(tr("Fix &Angle"), tr("Fix Angle"), tr("Fixes the angle of an object."), @@ -451,7 +473,7 @@ void ApplicationWindow::CreateActions(void) 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/delete-tool.png"), QKeySequence(), true); + deleteAct = CreateAction(tr("&Delete"), tr("Delete Object"), tr("Deletes selected objects."), QIcon(":/res/delete-tool.png"), QKeySequence(tr("Delete")), 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); @@ -498,7 +520,7 @@ void ApplicationWindow::CreateActions(void) settingsAct = CreateAction(tr("&Settings"), tr("Settings"), tr("Change certain defaults for Architektonas."), QIcon(":/res/generic-tool.png"), QKeySequence()); connect(settingsAct, SIGNAL(triggered()), this, SLOT(Settings())); - groupAct = CreateAction(tr("&Group"), tr("Group"), tr("Group/ungroup selected objects."), QIcon(":/res/generic-tool.png"), QKeySequence("g")); + 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())); //Hm. I think we'll have to have separate logic to do the "Radio Group Toolbar" thing...