Last change
on this file since 2861 was
2768,
checked in by mkommend, 15 years ago
|
added solution folders and sources for the netron library (ticket #867)
|
File size:
1.9 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Diagnostics;
|
---|
3 | using System.Collections;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Windows.Forms;
|
---|
6 | using System.Collections.Generic;
|
---|
7 | namespace Netron.Diagramming.Core
|
---|
8 | {
|
---|
9 | /// <summary>
|
---|
10 | /// Group tool
|
---|
11 | /// </summary>
|
---|
12 | class SendToFrontTool : AbstractTool
|
---|
13 | {
|
---|
14 |
|
---|
15 | #region Fields
|
---|
16 |
|
---|
17 | #endregion
|
---|
18 |
|
---|
19 | #region Constructor
|
---|
20 | /// <summary>
|
---|
21 | /// Initializes a new instance of the <see cref="T:SendToFrontTool"/> class.
|
---|
22 | /// </summary>
|
---|
23 | /// <param name="name">The name of the tool.</param>
|
---|
24 | public SendToFrontTool(string name)
|
---|
25 | : base(name)
|
---|
26 | {
|
---|
27 | }
|
---|
28 | #endregion
|
---|
29 |
|
---|
30 | #region Methods
|
---|
31 |
|
---|
32 | /// <summary>
|
---|
33 | /// Called when the tool is activated.
|
---|
34 | /// </summary>
|
---|
35 | protected override void OnActivateTool()
|
---|
36 | {
|
---|
37 | if(Selection.SelectedItems != null && Selection.SelectedItems.Count > 0)
|
---|
38 | {
|
---|
39 | #region Preparation of the ordering
|
---|
40 | //the items have to be moved in the order of the Paintables
|
---|
41 | //Usually this is a good moment to make a little drawing or example
|
---|
42 | //to see how things function.
|
---|
43 |
|
---|
44 | SortedList<int, IDiagramEntity> list = new SortedList<int, IDiagramEntity>();
|
---|
45 | foreach(IDiagramEntity entity in Selection.FlattenedSelectionItems)
|
---|
46 | {
|
---|
47 | //the addition will automatically put the item in increasing order
|
---|
48 | list.Add(this.Controller.Model.Paintables.IndexOf(entity), entity);
|
---|
49 | }
|
---|
50 | #endregion
|
---|
51 | //send them backwards
|
---|
52 | for(int k = 0; k < list.Count; k++)
|
---|
53 | {
|
---|
54 | this.Controller.Model.SendToFront(list.Values[k]);
|
---|
55 | }
|
---|
56 | }
|
---|
57 | DeactivateTool();
|
---|
58 | }
|
---|
59 |
|
---|
60 | #endregion
|
---|
61 |
|
---|
62 |
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.