]> Shamusworld >> Repos - architektonas/blobdiff - src/applicationwindow.cpp
GUI functionality fixes.
[architektonas] / src / applicationwindow.cpp
index cbb96362521aff7e37a2da3851551026eedde5a7..9064595a5f5feba189e0139ba5e8c18026b9a92e 100644 (file)
@@ -702,7 +702,7 @@ void ApplicationWindow::HandleGridSizeInBaseUnits(QString text)
 void ApplicationWindow::HandleDimensionSize(QString text)
 {
 /*
-This is the third input on the view toolbar; not sure what it was supposed to do...
+This is the third input on the view toolbar; not sure what it was supposed to do... (resize all dimensions in the drawing?)
 */
        // Parse the text...
        bool ok;
@@ -721,7 +721,7 @@ void ApplicationWindow::EditCopy(void)
        if (drawing->select.size() > 0)
        {
                DeleteContents(clipboard);
-               CopySelectedObjectsTo(clipboard, drawing->document.objects);
+               clipboard = CopySelectedObjects(drawing->document.objects);
        }
 }
 
@@ -731,7 +731,7 @@ void ApplicationWindow::EditCut(void)
        if (drawing->select.size() > 0)
        {
                DeleteContents(clipboard);
-               MoveSelectedObjectsTo(clipboard, drawing->document.objects);
+               clipboard = MoveSelectedObjectsFrom(drawing->document.objects);
                drawing->update();
        }
 }
@@ -742,14 +742,26 @@ void ApplicationWindow::EditPaste(void)
        if (clipboard.size() > 0)
        {
                // We want to maybe make it so that the pasted objects are being moved in a "mouse drag" state...
-               // This only moves the cut/copied from the clipboard to the drawing.
-//             AddObjectsTo(drawing->document.objects, clipboard);
-               CopyObjects(clipboard, drawing->document.objects);
+               ClearSelected(drawing->document.objects);
+               SelectAll(clipboard);
+               drawing->document.Add(CopyObjects(clipboard));
                drawing->update();
        }
 }
 
 
+//
+// Select all *visible* objects.  If an object is on a layer that is not
+// visible, skip it.
+//
+void ApplicationWindow::SelectAllObjects(void)
+{
+       // Set object's state & update the drawing
+       SelectAll(drawing->document.objects);
+       drawing->update();
+}
+
+
 void ApplicationWindow::CreateActions(void)
 {
        exitAct = CreateAction(tr("&Quit"), tr("Quit"), tr("Exits the application."),
@@ -844,6 +856,9 @@ void ApplicationWindow::CreateActions(void)
        editPasteAct = CreateAction(tr("&Paste Objects"), tr("Paste Objects"), tr("Paste objects from the clipboard to the drawing."), QIcon(":/res/editpaste2.png"), QKeySequence(tr("Ctrl+v")));
        connect(editPasteAct, SIGNAL(triggered()), this, SLOT(EditPaste()));
 
+       selectAllAct = CreateAction(tr("Select &All"), tr("Select All Objects"), tr("Select all objects in the drawing."), QIcon(), QKeySequence(tr("Ctrl+a")));
+       connect(selectAllAct, SIGNAL(triggered()), this, SLOT(SelectAllObjects()));
+
 //Hm. I think we'll have to have separate logic to do the "Radio Group Toolbar" thing...
 // Yup, in order to turn them off, we'd have to have an "OFF" toolbar button. Ick.
 /*     QActionGroup * group = new QActionGroup(this);
@@ -919,6 +934,7 @@ void ApplicationWindow::CreateMenus(void)
        menu->addAction(connectAct);
        menu->addAction(disconnectAct);
        menu->addSeparator();
+       menu->addAction(selectAllAct);
        menu->addAction(editCutAct);
        menu->addAction(editCopyAct);
        menu->addAction(editPasteAct);
@@ -999,6 +1015,7 @@ void ApplicationWindow::CreateToolbars(void)
        connect(pw, SIGNAL(WidthSelected(float)), drawing, SLOT(HandlePenWidth(float)));
        connect(pw, SIGNAL(StyleSelected(int)), drawing, SLOT(HandlePenStyle(int)));
        connect(pw, SIGNAL(ColorSelected(uint32_t)), drawing, SLOT(HandlePenColor(uint32_t)));
+       connect(pw, SIGNAL(StampSelected(void)), drawing, SLOT(HandlePenStamp(void)));
 }