Improved the selection dragging on the tree view. The selection moves now only when the dragging starts on the tree view. With the old implementation, double-clicking the gadget would change the selection, because the mouse is still pressed when the main window is shown.
1.1 --- a/GUI/MainForm.Designer.cs Sun May 15 20:48:52 2011 +0000
1.2 +++ b/GUI/MainForm.Designer.cs Sun May 15 21:43:40 2011 +0000
1.3 @@ -463,7 +463,9 @@
1.4 this.treeView.UseColumns = true;
1.5 this.treeView.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(this.treeView_NodeMouseDoubleClick);
1.6 this.treeView.Click += new System.EventHandler(this.treeView_Click);
1.7 + this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown);
1.8 this.treeView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseMove);
1.9 + this.treeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseUp);
1.10 //
1.11 // plotPanel
1.12 //
2.1 --- a/GUI/MainForm.cs Sun May 15 20:48:52 2011 +0000
2.2 +++ b/GUI/MainForm.cs Sun May 15 21:43:40 2011 +0000
2.3 @@ -76,6 +76,8 @@
2.4
2.5 private WmiProvider wmiProvider;
2.6
2.7 + private bool selectionDragging = false;
2.8 +
2.9 public MainForm() {
2.10 InitializeComponent();
2.11
2.12 @@ -629,9 +631,19 @@
2.13 }
2.14
2.15 private void treeView_MouseMove(object sender, MouseEventArgs e) {
2.16 - if ((e.Button & (MouseButtons.Left | MouseButtons.Right)) > 0) {
2.17 - treeView.SelectedNode = treeView.GetNodeAt(e.Location);
2.18 - }
2.19 + selectionDragging = selectionDragging &
2.20 + (e.Button & (MouseButtons.Left | MouseButtons.Right)) > 0;
2.21 +
2.22 + if (selectionDragging)
2.23 + treeView.SelectedNode = treeView.GetNodeAt(e.Location);
2.24 + }
2.25 +
2.26 + private void treeView_MouseDown(object sender, MouseEventArgs e) {
2.27 + selectionDragging = true;
2.28 + }
2.29 +
2.30 + private void treeView_MouseUp(object sender, MouseEventArgs e) {
2.31 + selectionDragging = false;
2.32 }
2.33 }
2.34 }