Ejemplo n.º 1
0
        /// <summary>
        /// Create a new JointEditorPane and register actions for the right click menu
        /// </summary>
        public JointEditorPane()
        {
            InitializeComponent();

            RegisterContextAction("Edit Driver", editDriver_Internal);
            RegisterContextAction("Edit Sensors", listSensors_Internal);
            RegisterContextAction("Edit Limits", (List <RigidNode_Base> nodes) =>
            {
                if (nodes.Count != 1)
                {
                    return;
                }

                RigidNode_Base node = nodes[0];
                if (node != null && node.GetSkeletalJoint() != null)
                {
                    EditLimits limitEditor    = new EditLimits(node.GetSkeletalJoint());
                    limitEditor.StartPosition = FormStartPosition.Manual;
                    limitEditor.Location      = new System.Drawing.Point(Cursor.Position.X - 10, Cursor.Position.Y - 10);
                    limitEditor.ShowDialog(ParentForm);
                }
            });

            lstJoints.Activation    = ItemActivation.Standard;
            lstJoints.ItemActivate += (object sender, EventArgs e) =>
            {
                editDriver_Internal(getSelectedNodes());
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new JointEditorPane and register actions for the right click menu
        /// </summary>
        public JointEditorPane()
        {
            InitializeComponent();

            RegisterContextAction("Edit Driver", EditDriver_Internal);
            RegisterContextAction("Edit Sensors", ListSensors_Internal);
            RegisterContextAction("Edit Limits", (List <RigidNode_Base> nodes) =>
            {
                try    // prevent the user from just left clicking on the black joint pane and trying to edit nothing
                {
                    if (nodes.Count != 1)
                    {
                        return;
                    }

                    RigidNode_Base node = nodes[0];
                    if (node != null && node.GetSkeletalJoint() != null)                  // prevents the user from trying to edit a null joint
                    {
                        EditLimits limitEditor = new EditLimits(node.GetSkeletalJoint()); // show the limit editor form
                        limitEditor.ShowDialog(ParentForm);
                    }
                }
                catch (NullReferenceException)    //catch when the user clicks on the pane without a node selected
                {
                    MessageBox.Show("Please select a node!");
                }
            });

            lstJoints.Activation    = ItemActivation.Standard;
            lstJoints.ItemActivate += (object sender, EventArgs e) =>
            {
                EditDriver_Internal(GetSelectedNodes());
            };
        }