this.addAction('save', function() { ui.saveFile(false); }, null, null, Editor.ctrlKey + '+S').isEnabled = isGraphEnabled;
this.addAction('saveAs...', function() { ui.saveFile(true); }, null, null, Editor.ctrlKey + '+Shift+S').isEnabled = isGraphEnabled;
this.addAction('export...', function() { ui.showDialog(new ExportDialog(ui).container, 300, 296, true, true); });
this.addAction('editDiagram...', function()
{
var dlg = new EditDiagramDialog(ui);
ui.showDialog(dlg.container, 620, 420, true, false);
dlg.init();
});
this.addAction('pageSetup...', function() { ui.showDialog(new PageSetupDialog(ui).container, 320, 220, true, true); }).isEnabled = isGraphEnabled;
this.addAction('print...', function() { ui.showDialog(new PrintDialog(ui).container, 300, 180, true, true); }, null, 'sprite-print', Editor.ctrlKey + '+P');
this.addAction('preview', function() { mxUtils.show(graph, null, 10, 10); });
// Edit actions
this.addAction('undo', function() { ui.undo(); }, null, 'sprite-undo', Editor.ctrlKey + '+Z');
this.addAction('redo', function() { ui.redo(); }, null, 'sprite-redo', (!mxClient.IS_WIN) ? Editor.ctrlKey + '+Shift+Z' : Editor.ctrlKey + '+Y');
this.addAction('cut', function() { mxClipboard.cut(graph); }, null, 'sprite-cut', Editor.ctrlKey + '+X');
this.addAction('copy', function() { mxClipboard.copy(graph); }, null, 'sprite-copy', Editor.ctrlKey + '+C');
this.addAction('paste', function()
{
if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
{
mxClipboard.paste(graph);
}
}, false, 'sprite-paste', Editor.ctrlKey + '+V');
this.addAction('pasteHere', function(evt)
{
if (graph.isEnabled() && !graph.isCellLocked(graph.getDefaultParent()))
{
graph.getModel().beginUpdate();
try
{
var cells = mxClipboard.paste(graph);
if (cells != null)
{
var includeEdges = true;
for (var i = 0; i < cells.length && includeEdges; i++)
{
includeEdges = includeEdges && graph.model.isEdge(cells[i]);
}
var t = graph.view.translate;
var s = graph.view.scale;
var dx = t.x;
var dy = t.y;
var bb = null;
if (cells.length == 1 && includeEdges)
{
var geo = graph.getCellGeometry(cells[0]);
if (geo != null)
{
bb = geo.getTerminalPoint(true);
}
}
bb = (bb != null) ? bb : graph.getBoundingBoxFromGeometry(cells, includeEdges);
if (bb != null)
{
var x = Math.round(graph.snap(graph.popupMenuHandler.triggerX / s - dx));
var y = Math.round(graph.snap(graph.popupMenuHandler.triggerY / s - dy));
graph.cellsMoved(cells, x - bb.x, y - bb.y);
}
}
}
finally
{
graph.getModel().endUpdate();
}
}
});