From 3d5788a6c26591dcc06e585e9276ced153b0ff29 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 17 Mar 2015 15:52:44 +0100 Subject: [PATCH] Add context menu actions for objects and empty space --- Printer.qml | 24 ++++++++++++++++++- PrinterActions.qml | 57 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/Printer.qml b/Printer.qml index 26639f27da..5bf07f3d4c 100644 --- a/Printer.qml +++ b/Printer.qml @@ -226,10 +226,29 @@ UM.MainWindow { settings.onTriggered: { preferences.visible = true; preferences.setPage(1); } } + Menu { + id: objectContextMenu; + + property variant id: -1; + + MenuItem { action: actions.centerObject; } + MenuItem { action: actions.deleteObject; } + MenuItem { action: actions.multiplyObject; } + MenuItem { action: actions.splitObject; } + MenuSeparator { } + MenuItem { action: actions.deleteAll; } + MenuItem { action: actions.reloadAll; } + MenuItem { action: actions.resetAllTranslation; } + MenuItem { action: actions.resetAll; } + } + Menu { id: contextMenu; - MenuItem { action: actions.deleteSelection; } + MenuItem { action: actions.deleteAll; } + MenuItem { action: actions.reloadAll; } + MenuItem { action: actions.resetAllTranslation; } + MenuItem { action: actions.resetAll; } } Connections { @@ -237,6 +256,9 @@ UM.MainWindow { onContextMenuRequested: { if(id == 0) { contextMenu.popup(); + } else { + objectContextMenu.id = id; + objectContextMenu.popup(); } } } diff --git a/PrinterActions.qml b/PrinterActions.qml index dd247527bd..019a796d18 100644 --- a/PrinterActions.qml +++ b/PrinterActions.qml @@ -9,8 +9,17 @@ Item { property alias undo: undoAction; property alias redo: redoAction; - property alias deleteSelection: deleteAction; + property alias deleteSelection: deleteSelectionAction; + + property alias deleteObject: deleteObjectAction; + property alias centerObject: centerObjectAction; + property alias multiplyObject: multiplyObjectAction; + property alias splitObject: splitObjectAction; + property alias deleteAll: deleteAllAction; + property alias reloadAll: reloadAllAction; + property alias resetAllTranslation: resetAllTranslationAction; + property alias resetAll: resetAllAction; property alias addMachine: addMachineAction; property alias settings: settingsAction; @@ -79,13 +88,39 @@ Item { } Action { - id: deleteAction; + id: deleteSelectionAction; //: Delete selection action text: qsTr("Delete Selection"); iconName: "edit-delete"; shortcut: StandardKey.Delete; } + Action { + id: deleteObjectAction; + //: Delete object action + text: qsTr("Delete Object"); + iconName: "edit-delete"; + } + + Action { + id: centerObjectAction; + //: Center object action + text: qsTr("Center Object on Platform"); + } + + Action { + id: multiplyObjectAction; + //: Duplicate object action + text: qsTr("Duplicate Object"); + } + + Action { + id: splitObjectAction; + //: Split object action + text: qsTr("Split Object into Parts"); + enabled: false; + } + Action { id: deleteAllAction; //: Clear build platform action @@ -93,6 +128,24 @@ Item { iconName: "edit-clear"; } + Action { + id: reloadAllAction; + //: Reload all objects action + text: qsTr("Reload All Objects"); + } + + Action { + id: resetAllTranslationAction; + //: Reset all positions action + text: qsTr("Reset All Object Positions"); + } + + Action { + id: resetAllAction; + //: Reset all positions action + text: qsTr("Reset All Object Transformations"); + } + Action { id: openAction; //: Open file action