Beispiel #1
0
        public void ButtonPress(double x, double y, int clicks)
        {
            StartPressPoint = new Cairo.PointD(x / Zoom, y / Zoom);

            IsPressed = true;
            IsMoving  = false;

            if (!IsMoving)
            {
                PreviousMousePoint = StartPressPoint;
                DeltaPoint         = new PointD(0, 0);
                for (int i = 0; i < SectionViews.Count; i++)
                {
                    var sectionView = SectionViews [i];

                    if (sectionView.AbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y))
                    {
                        if (sectionView.HeaderAbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y))
                        {
                            SelectedControl = sectionView;
                            SelectedTool    = null;
                            continue;
                        }
                        else if (sectionView.GripperAbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y))
                        {
                            SelectedControl = sectionView;
                        }
                        else
                        {
                            if (SelectedTool != null && SelectedTool.CreateMode)
                            {
                                SelectedTool.CreateNewControl(sectionView);
                                SelectedTool.CreateMode = false;
                            }
                            else
                            {
                                SelectedControl = null;

                                for (int j = 0; j < sectionView.Controls.Count; j++)
                                {
                                    var controlView = sectionView.Controls [j];
                                    if (controlView.ContainsPoint(StartPressPoint.X, StartPressPoint.Y))
                                    {
                                        SelectedControl = controlView;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }


            if (SelectedTool != null)
            {
                if (clicks == 1)
                {
                    SelectedTool.OnMouseDown();
                }
                else
                {
                    SelectedTool.OnDoubleClick();
                }
            }

            WorkspaceService.InvalidateDesignArea();
        }