Ejemplo n.º 1
0
   protected override void OnClick( ToolStripMenuItem clickedItem
                                  , Outliner.Controls.Tree.TreeView treeView
                                  , Outliner.Controls.Tree.TreeNode clickedTn)
   {
      Throw.IfNull(treeView, "treeView");

      IEnumerable<IMaxNode> context = TreeMode.GetMaxNodes(treeView.SelectedNodes);
      Boolean newValue = !this.Checked(clickedItem, treeView, clickedTn);
      NodeProperty prop = NodeProperties.ToProperty(this.Property);
      SetNodePropertyCommand<Boolean> cmd = new SetNodePropertyCommand<Boolean>(context, prop, newValue);
      cmd.Execute(true);

      clickedItem.Checked = newValue;
   }
Ejemplo n.º 2
0
   public override void HandleMouseUp(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
   {
      if (this.Layout == null || this.Layout.TreeView == null)
         return;

      IMaxNode node = TreeMode.GetMaxNode(tn);
      if (node == null)
         return;

      Color wc = node.WireColor;
      IInterface ip = MaxInterfaces.Global.COREInterface;
      if (ip.NodeColorPicker(ip.MAXHWnd, ref wc))
      {
         TreeView tree = this.Layout.TreeView;
         IEnumerable<TreeNode> nodes = null;
         if (tn.IsSelected && !ControlHelpers.ControlPressed)
            nodes = tree.SelectedNodes;
         else
            nodes = new List<TreeNode>(1) { tn };

         IEnumerable<IMaxNode> maxNodes = TreeMode.GetMaxNodes(nodes);
         SetNodePropertyCommand<Color> cmd = new SetNodePropertyCommand<Color>(maxNodes, NodeProperty.WireColor, Colors.FromMaxColor(wc));
         cmd.Execute(true);

         if (tree.NodeSorter is NodePropertySorter &&
            ((NodePropertySorter)tree.NodeSorter).Property == this.Property)
         {
            tree.StartTimedSort(nodes);
         }
      }
   }