示例#1
0
 public void UpdateCurrentElement()
 {
     RelativeMouseOffset      = new PointF();
     LocalRelativeMouseOffset = new PointF();
     CurrentElement           = null;
     RelativeMousePosStack.Clear();
     UpdateCurrentElementRecursive(Elements);
 }
        void JuliaSizeBoxDrag(GuiElement Sender, PointF MousePos, PointF StartPos, PointF DeltaPos, MouseButtons ButtonStatus)
        {
            float X = JuliaWindowSize - (JuliaSizeBox.Rect.X + MousePos.X);
            float Y = JuliaSizeBox.Rect.Y + +MousePos.Y;

            JuliaWindowSize = Math.Max((X + Y) / 2 + JuliaSizeBoxSize / 2 + 5, 200);
            JuliaWindow.Resize(JuliaWindowSize, JuliaWindowSize);
            JuliaWindow.Controller.Compute();
            RepositionJulia();
        }
示例#3
0
 void UpdateRecursive(GuiElement Element)
 {
     Element.Update();
     foreach (var Child in Element.ChildElements)
     {
         if (Child.Enabled)
         {
             UpdateRecursive(Child);
         }
     }
 }
示例#4
0
 void PrepareMatricies(Main M, GuiElement E, int Layer, Matrix4 matrix4)
 {
     Layer             += E.DrawingLayerOffset;
     matrix4.Row3      += new Vector4(2 * E.Rect.X / Main.Size.Width, -2 * E.Rect.Y / Main.Size.Height, 0, 0);
     E.TranslateVector  = matrix4.Row3;
     E.projectionMatrix = matrix4;
     foreach (var E2 in E.ChildElements)
     {
         PrepareRecursive(M, E2, Layer + 1, matrix4);
     }
 }
        void CursorDragged(GuiElement Sender, PointF MousePos, PointF StartPos, PointF DeltaPos, MouseButtons ButtonStatus)
        {
            CursorPosition = new Vector2(MousePos.X + CursorElement.Rect.X, MousePos.Y + CursorElement.Rect.Y);
            ClampCursor();
            CursorElement.Rect.X = ClampedCursorPosition.X - CursorElement.Rect.Width / 2;
            CursorElement.Rect.Y = ClampedCursorPosition.Y - CursorElement.Rect.Height / 2;
            //CursorElement.Rect.X += MousePos.X - CursorElement.Rect.Width / 2;
            //CursorElement.Rect.Y += MousePos.Y - CursorElement.Rect.Height / 2;

            UpdateButtonPositions();
            UpdateCursorWorldPos();
        }
 void JuliaOffsetClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     OffsetActive = juliaController.ButtonsActive[2];
     if (OffsetActive)
     {
         MainWindow.Controller.OffsetPos = juliaController.CursorWorldPosition;
     }
     else
     {
         MainWindow.Controller.OffsetPos = new Complex(0, 0);
     }
     MainWindow.Controller.Compute();
 }
        void ButtonClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
        {
            int a = 0;

            for (int i = 0; i < AllButtons.Length; i++)
            {
                if (Sender == AllButtons[i])
                {
                    a = i;
                }
            }
            ButtonsActive[a]  = !ButtonsActive[a];
            Sender.FrameColor = ButtonsActive[a] ? Color.Green : Color.Red;
        }
 void CursorClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     if (ButtonStatus == MouseButtons.Right)
     {
         if (MenuActive)
         {
             DisableMenu();
         }
         else
         {
             EnableMenu();
         }
     }
 }
示例#9
0
 void ShowRecursive(Main M, GuiElement E)
 {
     if (E.DrawFrame)
     {
         E.DrawFrameAndBackground();
     }
     E.Show(M);
     foreach (var E2 in E.ChildElements)
     {
         if (E2.Enabled)
         {
             ShowRecursive(M, E2);
         }
     }
 }
示例#10
0
 void JuliaResizeLateDraw(GuiElement sender, Main M)
 {
     GL.Color3(JuliaSizeBox.BackgroundColor);
     GL.Begin(PrimitiveType.Triangles);
     GL.Vertex2(0, 0);
     GL.Vertex2(0, JuliaSizeBoxSize);
     GL.Vertex2(JuliaSizeBoxSize, JuliaSizeBoxSize);
     GL.End();
     GL.LineWidth(2);
     GL.Color3(JuliaSizeBox.FrameColor);
     GL.Begin(PrimitiveType.LineLoop);
     GL.Vertex2(0, 0);
     GL.Vertex2(0, JuliaSizeBoxSize);
     GL.Vertex2(JuliaSizeBoxSize, JuliaSizeBoxSize);
     GL.End();
 }
示例#11
0
 void OrbitClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     OrbitActive = mainController.ButtonsActive[0];
     if (!OrbitActive)
     {
         MainWindow.Controller.PeriodHighlight  = 0;
         JuliaWindow.Controller.PeriodHighlight = 0;
     }
     else
     {
         MainWindow.Controller.PeriodHighlight  = 1;
         JuliaWindow.Controller.PeriodHighlight = 1;
     }
     MainWindow.OrbitActive   = OrbitActive;
     MainWindow.OrbitPosition = mainController.CursorWorldPosition;
     //UpdatePeriod();
 }
        public void CursorLateDraw(GuiElement sender, Main M)
        {
            GL.LineWidth(3);
            GL.Color3(0.5, 0.8, 1);
            Vector2 Center = new Vector2(CursorSize) / 2;

            GL.Translate(Center.X, Center.Y, 0);
            if ((ClampedCursorPosition - CursorPosition).LengthSquared < 1)
            {
                float Offset1 = CursorSize / 2;
                float Offset2 = Offset1 * 1.5f;
                GL.Begin(PrimitiveType.LineLoop);
                GL.Vertex2(Offset1, 0);
                GL.Vertex2(0, Offset1);
                GL.Vertex2(-Offset1, 0);
                GL.Vertex2(0, -Offset1);
                GL.End();
                GL.Begin(PrimitiveType.Lines);
                GL.Vertex2(Offset1, 0); GL.Vertex2(Offset2, 0);
                GL.Vertex2(0, Offset1); GL.Vertex2(0, Offset2);
                GL.Vertex2(-Offset1, 0); GL.Vertex2(-Offset2, 0);
                GL.Vertex2(0, -Offset1); GL.Vertex2(0, -Offset2);
                GL.End();
            }
            else
            {
                float   s    = CursorSize / 2;
                Vector2 Diff = CursorPosition - ClampedCursorPosition;
                Diff.Normalize();
                Diff *= s;
                Vector2 Tangent = new Vector2(Diff.Y, -Diff.X);
                GL.Begin(PrimitiveType.Lines);
                GL.Vertex2(Diff);
                GL.Vertex2(-Diff + Tangent);
                GL.Vertex2(Diff);
                GL.Vertex2(-Diff - Tangent);
                GL.End();
            }
        }
示例#13
0
        void PrepareRecursive(Main M, GuiElement E, int Layer, Matrix4 matrix4)
        {
            Layer += E.DrawingLayerOffset;
            //Matrix Mat = M.G.Transform;
            //M.G.TranslateTransform(E.Rect.X, E.Rect.Y);
            matrix4.Row3      += new Vector4(2 * E.Rect.X / Main.Size.Width, -2 * E.Rect.Y / Main.Size.Height, 0, 0);
            E.TranslateVector  = matrix4.Row3;
            E.projectionMatrix = matrix4;

            while (ElementDrawList.Count <= Layer)
            {
                ElementDrawList.Add(new List <ElementDrawStruct>());
            }
            ElementDrawList[Layer].Add(new ElementDrawStruct(E, null, matrix4));

            foreach (var E2 in E.ChildElements)
            {
                if (E2.Enabled)
                {
                    PrepareRecursive(M, E2, Layer + 1, matrix4);
                }
            }
            //M.G.Transform = Mat;
        }
示例#14
0
 public ElementDrawStruct(GuiElement element, Matrix mat, Matrix4 mat2)
 {
     Element = element;
     Mat     = mat;
     Mat2    = mat2;
 }
示例#15
0
        public void UpdateMouse(PointF MousePos, MouseButtons ButtonStatus)
        {
            this.MousePos = MousePos;
            if (ButtonStatus != MouseButtons.None)
            {
                if (PrevButton == MouseButtons.None)
                {
                    MouseDown(ButtonStatus);
                }
                if (MousePos.X != MousePosPrev.X || MousePos.Y != MousePosPrev.Y)
                {
                    if (!IsDragging)
                    {
                        StartMousePos = MousePos;
                    }

                    IsDragging = true;
                    MouseDrag(StartMousePos, new PointF(MousePosPrev.X - MousePos.X, MousePosPrev.Y - MousePos.Y), ButtonStatus);
                }
            }
            else
            {
                if (PrevButton != MouseButtons.None)
                {
                    MouseUp(PrevButton);
                    if (!IsDragging)
                    {
                        MouseClick(PrevButton);
                    }
                    IsDragging = false;
                }
            }
            if (CurrentElement != null && !IsMouseInsideRectangle(GetRelativeMousePos(MousePos), new RectangleF(new PointF(), CurrentElement.Rect.Size)))
            {
                CurrentElement = null;
            }
            if (CurrentElement != null && CurrentElement.HoverEvent != null)
            {
                CurrentElement.HoverEvent.Invoke(CurrentElement, GetRelativeMousePos(MousePos), ButtonStatus);
            }

            if (PreviousElement != null && PreviousElement != CurrentElement && PreviousElement.HoverEndEvent != null)
            {
                PreviousElement.HoverEndEvent.Invoke(PreviousElement, GetRelativeMousePos(MousePos), ButtonStatus);
            }
            PreviousElement = CurrentElement;
            MousePosPrev    = MousePos;
            PrevButton      = ButtonStatus;
            if (CurrentElement != null && CurrentElement.ShowHoverCursor)
            {
                cursorType = CursorTypes.Hand;
            }
            if (!cursorChanged)
            {
                cursorType = CursorTypes.Default;
            }
            if (cursorTypeOld != cursorType)
            {
                formCursor    = GetCussorType(cursorType);
                cursorTypeOld = cursorType;
            }
            cursorChanged = false;
        }
示例#16
0
 void JuliaClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     JuliaActive         = mainController.ButtonsActive[2];
     JuliaWindow.Enabled = JuliaActive;
     UpdateJulia();
 }
示例#17
0
 void SoundButtonClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     SoundActive = mainController.ButtonsActive[1];
 }
示例#18
0
 void JuliaPeriodClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     FinalDotUpdate();
 }
示例#19
0
 public Camera3d(Vector3 cameraVector, RectangleF R, GuiElement Parent)
 {
     this.Parent  = Parent;
     Rect         = R;
     CameraVector = cameraVector;
 }
示例#20
0
 void JuliaOrbitClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     JuliaOrbitActive          = juliaController.ButtonsActive[0];
     JuliaWindow.OrbitActive   = JuliaOrbitActive;
     JuliaWindow.OrbitPosition = juliaController.CursorWorldPosition;
 }