Line | |
---|
1 |
|
---|
2 | namespace Netron.Diagramming.Core {
|
---|
3 | // ----------------------------------------------------------------------
|
---|
4 | /// <summary>
|
---|
5 | /// The tool that performs the "cut" operation.
|
---|
6 | /// </summary>
|
---|
7 | // ----------------------------------------------------------------------
|
---|
8 | public class CutTool : AbstractTool {
|
---|
9 | // ------------------------------------------------------------------
|
---|
10 | /// <summary>
|
---|
11 | /// Constructor.
|
---|
12 | /// </summary>
|
---|
13 | /// <param name="toolName">string: The name of this tool.</param>
|
---|
14 | // ------------------------------------------------------------------
|
---|
15 | public CutTool(string toolName)
|
---|
16 | : base(toolName) {
|
---|
17 | }
|
---|
18 |
|
---|
19 | // ------------------------------------------------------------------
|
---|
20 | /// <summary>
|
---|
21 | /// Called when the tool is activated.
|
---|
22 | /// </summary>
|
---|
23 | // ------------------------------------------------------------------
|
---|
24 | protected override void OnActivateTool() {
|
---|
25 | if (this.Controller.Model.Selection.SelectedItems.Count == 0)
|
---|
26 | return;
|
---|
27 |
|
---|
28 | // How about for the cut, if we use two existing tools. First,
|
---|
29 | // activate the copy tool, then activate the delete tool. That's
|
---|
30 | // essentially a cut operation, right?
|
---|
31 | Controller.ActivateTool(ControllerBase.CopyToolName);
|
---|
32 | Controller.ActivateTool(ControllerBase.DeleteToolName);
|
---|
33 | }
|
---|
34 | }
|
---|
35 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.