Beispiel #1
0
 public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     SetupPanel();
     if (!panel.Visible)
     {
         panel.Show(GH_InstanceServer.DocumentEditor);
     }
     panel.UpdateComboBox();
     panel.HSCombo.SelectedItem = m_owner;
     return GH_ObjectResponse.Handled;
 }
        public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (ContentBox.Contains(e.CanvasLocation))
            {
                IfcOpenInRevit component = Owner as IfcOpenInRevit;
                System.Diagnostics.Debug.Write("double click called\n");

                // Force the re-culculation of the component
                component.ExpireSolution(true);
                return GH_ObjectResponse.Handled;
            }
            return GH_ObjectResponse.Ignore;
        }
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                System.Drawing.RectangleF rec = ButtonBounds;
                if (rec.Contains(e.CanvasLocation))
                {
                    MessageBox.Show("The button was clicked, and we want " + (base.Owner as VariableParameterTestComponent).outputparamno + " output params", "Button", MessageBoxButtons.OK);
                    (base.Owner as VariableParameterTestComponent).MatchParameterCount();

                    return GH_ObjectResponse.Handled;

                }
            }
            return base.RespondToMouseDown(sender, e);
        }
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                System.Drawing.RectangleF rec = ButtonBounds;
                if (rec.Contains(e.CanvasLocation))
                {
                    (base.Owner as HairwormComponent).InitCluster();

                    //MessageBox.Show("The button was clicked, and we want " + (base.Owner as HairwormComponent).clusterParamNumInput + " inputs and " + (base.Owner as HairwormComponent).clusterParamNumOutput + " output params", "Button", MessageBoxButtons.OK);

                    return GH_ObjectResponse.Handled;

                }
            }
            return base.RespondToMouseDown(sender, e);
        }
Beispiel #5
0
        public GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (_activeWidget != null)
            {
                return(_activeWidget.RespondToMouseDown(sender, e));
            }
            int count = _menus.Count;

            for (int i = 0; i < count; i++)
            {
                GH_ObjectResponse val = _menus[i].RespondToMouseDown(sender, e);
                if ((int)val != 0)
                {
                    return(val);
                }
            }
            return(0);
        }
Beispiel #6
0
        public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            GH_ObjectResponse val = composedCollection.RespondToMouseUp(sender, e);

            if ((int)val == 1)
            {
                this.ExpireLayout();
                ((Control)sender).Invalidate();
                return(val);
            }
            if ((int)val != 0)
            {
                this.ExpireLayout();
                ((Control)sender).Invalidate();
                return(GH_ObjectResponse.Release);
            }
            return(base.RespondToMouseUp(sender, e));
        }
Beispiel #7
0
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     try
     {
         GH_ObjectResponse val = _collection.RespondToMouseDown(sender, e);
         if ((int)val != 0)
         {
             this.ExpireLayout();
             ((Control)sender).Refresh();
             return(val);
         }
         return(this.RespondToMouseDown(sender, e));
     }
     catch (Exception)
     {
         return(this.RespondToMouseDown(sender, e));
     }
 }
Beispiel #8
0
 public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (_activeControl != null)
     {
         GH_ObjectResponse val = _activeControl.RespondToMouseUp(sender, e);
         if ((int)val == 2)
         {
             _activeControl = null;
             return(val);
         }
         if ((int)val != 0)
         {
             return(val);
         }
         _activeControl = null;
     }
     return(0);
 }
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                ComponentWithDirectionLogic comp = Owner as ComponentWithDirectionLogic;

                if (DirectionX.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.X)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction X");
                    comp.Direction = FaceDirection.X;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }

                if (DirectionY.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.Y)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction Y");
                    comp.Direction = FaceDirection.Y;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }

                if (DirectionZ.Contains(e.CanvasLocation))
                {
                    if (comp.Direction == FaceDirection.Z)
                    {
                        return(GH_ObjectResponse.Handled);
                    }
                    comp.RecordUndoEvent("Direction Z");
                    comp.Direction = FaceDirection.Z;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
            }
            return(base.RespondToMouseDown(sender, e));
        }
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            GHCustomComponent owner = Owner as GHCustomComponent;

            if (Bounds.Contains(e.CanvasLocation))
            {
                // click is inside the component
                // check which control is clicked
                GHMouseEventResult result = GHMouseEventResult.None;
                foreach (GHControl control in owner.CustomControls.Values)
                {
                    if (control.Bounds.Contains(e.CanvasLocation))
                    {
                        // click happened in this control
                        if (e.Button == System.Windows.Forms.MouseButtons.Left)
                        {
                            control.MouseLeftClick(sender, owner, e, ref result);
                        }
                        else if (e.Button == System.Windows.Forms.MouseButtons.Right)
                        {
                            control.MouseRightClick(sender, owner, e, ref result);
                        }
                        if (control is GHParameter && !((GHParameter)control).UpdateSolution)
                        {
                            result &= ~GHMouseEventResult.UpdateSolution;
                        }
                    }
                }
                if (result.HasFlag(GHMouseEventResult.Invalidated))
                {
                    sender.Invalidate();
                }
                if (result.HasFlag(GHMouseEventResult.UpdateSolution))
                {
                    owner.ExpireSolution(true);
                }
                if (result.HasFlag(GHMouseEventResult.Handled))
                {
                    return(GH_ObjectResponse.Handled);
                }
            }

            return(base.RespondToMouseDown(sender, e));
        }
        protected override void RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (_isToggle)
                {
                    bool isNull;
                    bool value = !GetValue(out isNull);
                    SetValue(isNull ? true : value);
                }
                else
                {
                    SetValue(false);
                }
                Owner.ExpireSolution(true);
            }

            base.RespondToMouseUp(sender, e);
        }
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (unfolded)
     {
         if (e.Button == System.Windows.Forms.MouseButtons.Left)
         {
             System.Drawing.RectangleF rec = scrollBar;
             GH_Component comp             = Owner as GH_Component;
             if (rec.Contains(e.CanvasLocation))
             {
                 dragMouseStartY = e.CanvasLocation.Y;
                 drag            = true;
                 comp.ExpireSolution(true);
                 return(GH_ObjectResponse.Capture);
             }
         }
     }
     return(base.RespondToMouseDown(sender, e));
 }
Beispiel #13
0
        public override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (drag)
            {
                GH_Component comp = Owner as GH_Component;

                deltaY = e.CanvasLocation.Y - dragMouseStartY;

                comp.ExpireSolution(true);
                return(GH_ObjectResponse.Ignore);
            }

            if (taperBounds.Contains(e.CanvasLocation) |
                hollowBounds.Contains(e.CanvasLocation) |
                ellipBounds.Contains(e.CanvasLocation) |
                genBounds.Contains(e.CanvasLocation) |
                b2bBounds.Contains(e.CanvasLocation) |
                inclSsBounds.Contains(e.CanvasLocation))
            {
                mouseOver     = true;
                sender.Cursor = System.Windows.Forms.Cursors.Hand;
                return(GH_ObjectResponse.Capture);
            }
            for (int i = 0; i < ButtonBound.Count; i++)
            {
                if (ButtonBound[i].Contains(e.CanvasLocation))
                {
                    mouseOver     = true;
                    sender.Cursor = System.Windows.Forms.Cursors.Hand;
                    return(GH_ObjectResponse.Capture);
                }
            }

            if (mouseOver)
            {
                mouseOver = false;
                Grasshopper.Instances.CursorServer.ResetCursor(sender);
                return(GH_ObjectResponse.Release);
            }


            return(base.RespondToMouseMove(sender, e));
        }
Beispiel #14
0
            public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
            {
                Print comp = Owner as Print;

                if (e.Button == MouseButtons.Left)
                {
                    RectangleF rec = ButtonBounds;
                    if (rec.Contains(e.CanvasLocation))
                    {
                        comp.RecordUndoEvent("Toggled False");
                        comp.toggle = false;


                        comp.ExpireSolution(true);
                        return(GH_ObjectResponse.Handled);
                    }
                }
                return(base.RespondToMouseUp(sender, e));
            }
 /// <summary>
 ///  Event of Double Click for the left button
 /// </summary>
 /// <param name="sender"> GH_Canvas: is the control handles all mouse and paint event for a single loaded document.</param>
 /// <param name="e"> GH_CanvasMouseEvent: Class used in UI events.</param>
 /// <returns></returns>
 public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (e.Button == MouseButtons.Left)
     {
         try
         {
             if (((RhinoNest)Owner).IsWorking == false)
             {
                 ((RhinoNest)Owner)._mSolveme = true;
                 Owner.ExpireSolution(true);
             }
         }
         finally
         {
             ((RhinoNest)Owner)._mSolveme = false;
         }
     }
     return base.RespondToMouseDoubleClick(sender, e);
 }
Beispiel #16
0
        internal override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            var pt = e.CanvasLocation;

            if (OnButton(pt) && pressed)
            {
                pressed = false;
                OnClick();
                TriggerRedraw();
                return(GH_ObjectResponse.Release);
            }
            if (pressed) //mouse held down then moved off button
            {
                pressed = false;
                TriggerRedraw();
                return(GH_ObjectResponse.Release);
            }
            return(GH_ObjectResponse.Ignore);
        }
 /// <summary>
 /// change the right click.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected override void RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (e.Button == MouseButtons.Right && CreateMenu != null)
     {
         var menu = CreateMenu();
         if (UnableMenu)
         {
             foreach (var item in menu.Items)
             {
                 if (item is ToolStripItem)
                 {
                     ToolStripItem toolStrip = item as ToolStripItem;
                     toolStrip.Enabled = false;
                 }
             }
         }
         menu.Show(sender, e.ControlLocation);
     }
 }
Beispiel #18
0
            public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
            {
                this.Bounds = thisRect;

                if (ShootButtonRect.Contains(e.CanvasLocation) && e.Button == System.Windows.Forms.MouseButtons.Left && sender.Viewport.Zoom >= 0.5f)
                {
                    Owner.shoot = false;
                    Owner.Caputre("s");
                    Owner.ExpireSolution(true);
                    return(GH_ObjectResponse.Release);
                }
                else if (PlayButtonRect.Contains(e.CanvasLocation))
                {
                    Owner.Play = !Owner.Play;
                    Owner.ExpireSolution(true);
                    return(GH_ObjectResponse.Release);
                }


                for (int n = 0; n < GoButtons.Count; n++)
                {
                    if (GoButtons[n].Contains(e.CanvasLocation) && e.Button == System.Windows.Forms.MouseButtons.Left && sender.Viewport.Zoom >= 0.5f)
                    {
                        Owner.ClearComponent[n].GoComponent(Owner.ClearComponent[n]);
                    }
                    else
                    {
                        for (int m = 0; m < ToEventButton[n].Count; m++)
                        {
                            if (ToEventButton[n][m].Contains(e.CanvasLocation) && e.Button == System.Windows.Forms.MouseButtons.Left && sender.Viewport.Zoom >= 0.5f)
                            {
                                Owner.ClearComponent[n].GoComponent(Owner.ClearComponent[n].eventThing[m]);
                            }
                        }
                    }
                }

                this.Bounds = baseRect;
                GH_ObjectResponse result = base.RespondToMouseUp(sender, e);

                this.Bounds = thisRect;
                return(result);
            }
Beispiel #19
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (_headBounds.Contains(e.CanvasLocation))
            {
                if (Expanded)
                {
                    _activeControl = null;
                }
                _expanded = !_expanded;

                Layout();  //daq =)

                return(GH_ObjectResponse.Handled);
            }
            if (_expanded)
            {
                if (_contentBounds.Contains(e.CanvasLocation))
                {
                    for (int i = 0; i < inputs.Count; i++)
                    {
                        if (inputs[i].Parameter.Attributes.Bounds.Contains(e.CanvasLocation))
                        {
                            return(inputs[i].Parameter.Attributes.RespondToMouseDown(sender, e));
                        }
                    }
                    for (int j = 0; j < _controls.Count; j++)
                    {
                        if (_controls[j].Contains(e.CanvasLocation))
                        {
                            _activeControl = _controls[j];
                            return(_controls[j].RespondToMouseDown(sender, e));
                        }
                    }
                }
                else if (_activeControl != null)
                {
                    _activeControl.RespondToMouseDown(sender, e);
                    _activeControl = null;
                    return(GH_ObjectResponse.Handled);
                }
            }
            return(0);
        }
Beispiel #20
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                System.Drawing.RectangleF rec = BorderBound;
                GH_Component comp             = Owner as GH_Component;
                if (rec.Contains(e.CanvasLocation))
                {
                    unfolded = !unfolded;
                    comp.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }

                if (unfolded)
                {
                    System.Drawing.RectangleF rec2 = dropdownBound;
                    if (rec2.Contains(e.CanvasLocation))
                    {
                        for (int i = 0; i < dropdownlist.Count; i++)
                        {
                            System.Drawing.RectangleF rec3 = dropdownBounds[i];
                            if (rec3.Contains(e.CanvasLocation))
                            {
                                comp.RecordUndoEvent("Selected " + dropdownlist[i]);
                                displayText = dropdownlist[i]; //change what user sees to selected item
                                action(dropdownlist[i]);       // send selected item back to component
                                unfolded = !unfolded;          // close dropdown
                                comp.ExpireSolution(true);
                                return(GH_ObjectResponse.Handled);
                            }
                        }
                    }
                    else
                    {
                        unfolded = !unfolded;
                        comp.ExpireSolution(true);
                        return(GH_ObjectResponse.Handled);
                    }
                }
            }
            return(base.RespondToMouseDown(sender, e));
        }
        public override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (Button1Bounds.Contains(e.CanvasLocation))
            {
                mouseOver1 = true;
                mouseOver2 = false;
                mouseOver3 = false;
                Owner.OnDisplayExpired(false);
                sender.Cursor = System.Windows.Forms.Cursors.Hand;
                return(GH_ObjectResponse.Capture);
            }
            if (Button2Bounds.Contains(e.CanvasLocation))
            {
                mouseOver2 = true;
                mouseOver1 = false;
                mouseOver3 = false;
                Owner.OnDisplayExpired(false);
                sender.Cursor = System.Windows.Forms.Cursors.Hand;
                return(GH_ObjectResponse.Capture);
            }
            if (Button3Bounds.Contains(e.CanvasLocation))
            {
                mouseOver3 = true;
                mouseOver1 = false;
                mouseOver2 = false;
                Owner.OnDisplayExpired(false);
                sender.Cursor = System.Windows.Forms.Cursors.Hand;
                return(GH_ObjectResponse.Capture);
            }

            if (mouseOver1 | mouseOver2 | mouseOver3)
            {
                mouseOver1 = false;
                mouseOver2 = false;
                mouseOver3 = false;
                Owner.OnDisplayExpired(false);
                Grasshopper.Instances.CursorServer.ResetCursor(sender);
                return(GH_ObjectResponse.Release);
            }

            return(base.RespondToMouseMove(sender, e));
        }
        public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                System.Drawing.RectangleF rec = ButtonBounds;
                if (rec.Contains(e.CanvasLocation))
                {
                    if (mouseDown)
                    {
                        mouseDown = false;
                        mouseOver = false;
                        Owner.OnDisplayExpired(false);
                        action();
//                        Owner.ExpireSolution(true);
                        return(GH_ObjectResponse.Release);
                    }
                }
            }
            return(base.RespondToMouseUp(sender, e));
        }
        public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (_mouseDownElement != null)
                {
                    var pt = new Point((int)e.CanvasLocation.X, (int)e.CanvasLocation.Y);
                    if (_mouseDownElement.Bounds.Contains(pt))
                    {
                        _mouseDownElement.InvokeAction();
                    }
                    _mouseDownElement.OnMouseUp();
                    _mouseDownElement = null;
                    Owner.OnDisplayExpired(true);
                    return(GH_ObjectResponse.Release);
                }
            }

            return(base.RespondToMouseUp(sender, e));
        }
Beispiel #24
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                var component = Owner as Generator;

                if (((System.Drawing.RectangleF)CapsuleBounds[1]).Contains(e.CanvasLocation))
                {
                    component.PrintLabel  = !component.PrintLabel;
                    component.ForceRecalc = true;
                    component.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
                else if (((System.Drawing.RectangleF)CapsuleBounds[2]).Contains(e.CanvasLocation))
                {
                    component.Collision = !component.Collision;
                    component.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
                else if (((System.Drawing.RectangleF)CapsuleBounds[4]).Contains(e.CanvasLocation))
                {
                    component.AnnotateRods = !component.AnnotateRods;
                    component.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
                else if (((System.Drawing.RectangleF)CapsuleBounds[5]).Contains(e.CanvasLocation))
                {
                    component.AnnotateJoints = !component.AnnotateJoints;
                    component.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
                else if (((System.Drawing.RectangleF)CapsuleBounds[6]).Contains(e.CanvasLocation))
                {
                    component.AnnotateJointArms = !component.AnnotateJointArms;
                    component.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
            }

            return(base.RespondToMouseDown(sender, e));
        }
 public override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     System.Drawing.PointF canvasPivot = base.CanvasPivot;
     if (e.CanvasLocation.X < canvasPivot.X + 5f)
     {
         currentValue = minValue;
     }
     else if (e.CanvasLocation.X > canvasPivot.X + 5f + _sliderWidth)
     {
         currentValue = maxValue;
     }
     else
     {
         double num  = (double)(e.CanvasLocation.X - (canvasPivot.X + 5f)) / (double)_sliderWidth;
         double num2 = (maxValue - minValue) * num;
         currentValue = num2 + minValue;
     }
     Layout();
     FireChangedEvent();
     return((GH_ObjectResponse)1);
 }
        /// <summary>
        /// This method subscribes to mouse moves inside the general boundary of the component area.
        /// This is used in the render function to determinate if the button should be highlighted.
        /// </summary>
        public override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button != MouseButtons.None)
            {
                return(GH_ObjectResponse.Ignore);
            }
            var isInside = _buttonRectangleF.Contains(GH_Convert.ToPoint(e.CanvasLocation));

            if (_mouseHoverInside != isInside)
            {
                sender.Invalidate();
            }
            _mouseHoverInside = isInside;

            if (_mouseHoverInside)
            {
                return(GH_ObjectResponse.Capture);
            }

            return(GH_ObjectResponse.Release);
        }
Beispiel #27
0
 public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (!Owner.Locked && e.Button != System.Windows.Forms.MouseButtons.Right)
     {
         if (this.PressControl.IsPress)
         {
             this.PressControl.IsPress = false;
             this.PressControl.IsClick = !this.PressControl.IsClick;
             if (SecondCounter < 100)
             {
                 this.PressControl.On_Click(this.PressControl, e);
             }
             else
             {
                 this.PressControl.On_MouseUp(this.PressControl, e);
             }
             sender.Refresh();
         }
     }
     return(base.RespondToMouseUp(sender, e));
 }
Beispiel #28
0
 public override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (m_dragmode == 1)
         {
             Owner.TriggerAutoSave();
             Owner.RecordUndoEvent("Graph Change");
             m_dragmode = 2;
         }
         if (m_dragmode == 2 && base.Owner.Graph != null)
         {
             GH_ObjectResponse val = base.Owner.Container.RespondToMouseMove(sender, e);
             if ((int)val <= 1 || (int)val == 3)
             {
                 return((GH_ObjectResponse)3);
             }
         }
     }
     return(base.RespondToMouseMove(sender, e));
 }
Beispiel #29
0
        internal override GH_ObjectResponse RespondToMouseMove(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            var pt    = e.CanvasLocation;
            var onBtn = OnButton(pt);

            pressedOff = pressed && !onBtn;
            if (onBtn)
            {
                hover = true;
                TriggerRedraw();
                return(GH_ObjectResponse.Handled);
            }
            if (hover && !onBtn)
            {
                hover = false;
                TriggerRedraw();
                return(GH_ObjectResponse.Handled);
            }
            hover = false;
            return(GH_ObjectResponse.Ignore);
        }
Beispiel #30
0
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (e.Button == MouseButtons.Left)
     {
         RectangleF rec1 = radio_rec1_1;
         if (rec1.Contains(e.CanvasLocation))
         {
             if (c1 == Brushes.White)
             {
                 c1 = Brushes.Black; SetButton("1", 1);
             }
             else
             {
                 c1 = Brushes.White; SetButton("1", 0);
             }
             Owner.ExpireSolution(true);
             return(GH_ObjectResponse.Handled);
         }
     }
     return(base.RespondToMouseDown(sender, e));
 }
Beispiel #31
0
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (e.Button == MouseButtons.Left)
     {
         RectangleF rec = ButtonBounds;
         if (rec.Contains(e.CanvasLocation))
         {
             switchColor("Run");
             if (xColor == GH_Palette.Black)
             {
                 CalcComponent.setStart("Run", true); Owner.ExpireSolution(true);
             }
             if (xColor == GH_Palette.Grey)
             {
                 CalcComponent.setStart("Run", false);
             }
             sender.Refresh();
             return(GH_ObjectResponse.Handled);
         }
         //rec = ButtonBounds2;
         //if (rec.Contains(e.CanvasLocation))
         //{
         //    switchColor("Run Test");
         //    if (yColor == GH_Palette.Black) { CalcComponent.setStart("Run Test", true); Owner.ExpireSolution(true); }
         //    if (yColor == GH_Palette.Grey) { CalcComponent.setStart("Run Test", false); }
         //    sender.Refresh();
         //    return GH_ObjectResponse.Handled;
         //}
         //rec = ButtonBounds3;
         //if (rec.Contains(e.CanvasLocation))
         //{
         //    switchColor("AboveLimit");
         //    if (zColor == GH_Palette.Black) { CalcComponent.setStart("AboveLimit", true); Owner.ExpireSolution(true); }
         //    if (zColor == GH_Palette.Grey) { CalcComponent.setStart("AboveLimit", false); }
         //    sender.Refresh();
         //    return GH_ObjectResponse.Handled;
         //}
     }
     return(base.RespondToMouseDown(sender, e));
 }
Beispiel #32
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                GH_ValueListItem item2 = this.Owner.FirstSelectedItem;
                if (item2 != null)
                {
                    if (item2.BoxRight.Contains(e.CanvasLocation))
                    {
                        System.Windows.Forms.ToolStripDropDownMenu menu = new System.Windows.Forms.ToolStripDropDownMenu();
                        GH_ValueListItem activeItem = this.Owner.FirstSelectedItem;
                        try
                        {
                            System.Collections.Generic.List <GH_ValueListItem> .Enumerator enumerator = this.Owner.ListItems.GetEnumerator();
                            while (enumerator.MoveNext())
                            {
                                GH_ValueListItem existingItem = enumerator.Current;
                                System.Windows.Forms.ToolStripMenuItem menuItem = new System.Windows.Forms.ToolStripMenuItem(existingItem.Name);
                                menuItem.Click += new System.EventHandler(this.ValueMenuItem_Click);
                                if (existingItem == activeItem)
                                {
                                    menuItem.Checked = true;
                                }
                                menuItem.Tag = existingItem;
                                menu.Items.Add(menuItem);
                            }
                        }
                        finally
                        {
                            System.Collections.Generic.List <GH_ValueListItem> .Enumerator enumerator = new List <GH_ValueListItem> .Enumerator();

                            ((System.IDisposable)enumerator).Dispose();
                        }
                        menu.Show(sender, e.ControlLocation);
                        return(GH_ObjectResponse.Handled);
                    }
                }
            }
            return(base.RespondToMouseDown(sender, e));
        }
Beispiel #33
0
        protected override void RespondToMouseUp(GH_Canvas canvas, GH_CanvasMouseEvent @event)
        {
            bool flag = true;
            ToolStripDropDownMenu obj = new ToolStripDropDownMenu
            {
                ShowCheckMargin = false,
                ShowImageMargin = false
            };

            bool  isNull;
            Color color = GetValue(out isNull);

            color = isNull ? Color.Transparent : color;
            GH_DocumentObject.Menu_AppendColourPicker(obj, color, ColourChanged);
            obj.Show(canvas, @event.ControlLocation);

            void ColourChanged(GH_ColourPicker sender, GH_ColourPickerEventArgs e)
            {
                SetValue(e.Colour, flag);
                flag = false;
            }
        }
Beispiel #34
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Grasshopper.Kernel.Special.GH_ValueListItem firstSelectedItem = this.Owner.FirstSelectedItem;
                if (firstSelectedItem.BoxRight.Contains(e.CanvasLocation))
                {
                    ToolStripDropDownMenu menu = new ToolStripDropDownMenu();
                    menu.AutoClose = true;

                    foreach (ToolStripMenuItem toolStripItem in this.collectionToolStripMenuItems)
                    {
                        menu.Items.Add(toolStripItem);
                    }

                    menu.Show(sender, e.ControlLocation);

                    return(GH_ObjectResponse.Handled);
                }
            }
            return(base.RespondToMouseDown(sender, e));
        }
Beispiel #35
0
    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
    {
        //On a double click we'll set the owner value.
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            for (int col = 0; col < 3; col++)
            {
                RectangleF button = Button(col);
                if (button.Contains(e.CanvasLocation))
                {
                    m_bits[col] = !m_bits[col];
                    int value = GetBitmask();
                    Owner.RecordUndoEvent("Bit Change");
                    Owner.Value = value;
                    Owner.ExpireSolution(true);
                    return(GH_ObjectResponse.Handled);
                }
            }
        }

        return(base.RespondToMouseDoubleClick(sender, e));
    }
 public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     OpenEditor();
       return base.RespondToMouseDoubleClick(sender, e);
 }
Beispiel #37
0
 public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     ((SettingsComponent)Owner).ShowSettingsGui();
                 return GH_ObjectResponse.Handled;
 }
 public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     for (int i = 0; i < _boundingBoxes.Count; i++)
     {
         if (_boundingBoxes[i].Contains(e.CanvasLocation))
         {
             BimVisualiserData.Instance.Selected = i;
             _component.setReturnValue(BimVisualiserData.Instance.Selected);
             _component.ExpirePreview(true);
             _component.ExpireSolution(true);
             return GH_ObjectResponse.Handled;
         }
     }
     BimVisualiserData.Instance.Selected = -1;
     return GH_ObjectResponse.Handled;
 }