Esempio n. 1
0
        public RadioButtonTest(ControlBase parent)
            : base(parent)
        {
            VerticalLayout layout = new VerticalLayout(this);

            GroupBox group = new GroupBox(layout);

            group.Margin = Margin.Five;
            group.Text   = "Sample radio group";
            {
                RadioButtonGroup rbg = new RadioButtonGroup(group);

                rbg.AddOption("Option 1");
                rbg.AddOption("Option 2");
                rbg.AddOption("Option 3");
                rbg.AddOption("\u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631");

                rbg.SelectionChanged += OnChange;
            }

            {
                EnumRadioButtonGroup <Choices> erbg = new EnumRadioButtonGroup <Choices>(layout);
                erbg.Margin        = Margin.Five;
                erbg.SelectedValue = Choices.HallC;
            }
        }
Esempio n. 2
0
        private void OpenWindow(ControlBase control, EventArgs args)
        {
            Window window = new Window(this);

            window.Title   = String.Format("Window ({0})", ++m_WindowCount);
            window.Size    = new Size(m_Rand.Next(200, 400), m_Rand.Next(200, 400));
            window.Left    = m_Rand.Next(700);
            window.Top     = m_Rand.Next(400);
            window.Padding = new Padding(6, 3, 6, 6);

            RadioButtonGroup rbg = new RadioButtonGroup(window);

            rbg.Dock = Dock.Top;
            rbg.AddOption("Resize disabled", "None").Checked += (c, a) => window.Resizing = Resizing.None;
            rbg.AddOption("Resize width", "Width").Checked   += (c, a) => window.Resizing = Resizing.Width;
            rbg.AddOption("Resize height", "Height").Checked += (c, a) => window.Resizing = Resizing.Height;
            rbg.AddOption("Resize both", "Both").Checked     += (c, a) => window.Resizing = Resizing.Both;
            rbg.SetSelectionByName("Both");

            LabeledCheckBox dragging = new LabeledCheckBox(window);

            dragging.Dock          = Dock.Top;
            dragging.Text          = "Dragging";
            dragging.IsChecked     = true;
            dragging.CheckChanged += (c, a) => window.IsDraggingEnabled = dragging.IsChecked;
        }
Esempio n. 3
0
        private void PopulateCamera(ControlBase parent)
        {
            var camtype  = GwenHelper.CreateHeaderPanel(parent, "Camera Type");
            var camprops = GwenHelper.CreateHeaderPanel(parent, "Camera Properties");
            RadioButtonGroup rbcamera = new RadioButtonGroup(camtype)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false,
            };
            var soft       = rbcamera.AddOption("Soft Camera");
            var predictive = rbcamera.AddOption("Predictive Camera");
            var legacy     = rbcamera.AddOption("Legacy Camera");
            var round      = GwenHelper.AddCheckbox(camprops, "Round Legacy Camera", Settings.RoundLegacyCamera, (o, e) =>
            {
                Settings.RoundLegacyCamera = ((Checkbox)o).IsChecked;
                Settings.Save();
            });

            if (Settings.SmoothCamera)
            {
                if (Settings.PredictiveCamera)
                {
                    predictive.Select();
                }
                else
                {
                    soft.Select();
                }
            }
            else
            {
                legacy.Select();
            }
            soft.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = true;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            legacy.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = false;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Tooltip = "This is the camera that was added in 1.03\nIt moves relative to the future of the track";
        }
Esempio n. 4
0
        private void CreateCheckables()
        {
            var row = _layout.CreateRow();
            var box = new Checkbox(row.GetCell(0));

            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text      = "Checked",
                IsChecked = true
            };
            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text      = "Checkbox",
                IsChecked = false
            };
            row = _layout.CreateRow();
            box = new Checkbox(row.GetCell(0))
            {
                Text       = "Disabled",
                IsChecked  = false,
                IsDisabled = true,
            };
            box = new Checkbox(row.GetCell(1))
            {
                Text       = "Disabled",
                IsChecked  = true,
                IsDisabled = true,
            };
            row = _layout.CreateRow();
            var radiogroup = new RadioButtonGroup(row.GetCell(0));

            radiogroup.AddOption("Radio 1").Tooltip = "tooltip 1";
            radiogroup.AddOption("Radio 2").Tooltip = "tooltip 2";
            var dc = radiogroup.AddOption("disabledChecked");

            dc.IsChecked = true;
            dc.Disable();
            radiogroup.AddOption("disabled").Disable();

            row = _layout.CreateRow();
            var radio = new RadioButton(row.GetCell(0))
            {
                Text = "ungrouped 1",
                Dock = Dock.Top
            }; radio = new RadioButton(row.GetCell(0))

            {
                Text = "ungrouped 2",
                Dock = Dock.Top
            };
        }
Esempio n. 5
0
        public TabControlTest(ControlBase parent)
            : base(parent)
        {
            {
                m_DockControl        = new TabControl(this);
                m_DockControl.Margin = Margin.Zero;
                m_DockControl.Width  = 200;
                //m_DockControl.Height = 150;
                m_DockControl.Dock = Dock.Top;

                {
                    TabButton   button = m_DockControl.AddPage("Controls");
                    ControlBase page   = button.Page;

                    {
                        GroupBox group = new GroupBox(page);
                        group.Text = "Tab position";
                        RadioButtonGroup radio = new RadioButtonGroup(group);

                        radio.AddOption("Top").Select();
                        radio.AddOption("Bottom");
                        radio.AddOption("Left");
                        radio.AddOption("Right");

                        radio.SelectionChanged += OnDockChange;
                    }
                }

                m_DockControl.AddPage("Red");
                m_DockControl.AddPage("Green");
                m_DockControl.AddPage("Blue");
                m_DockControl.AddPage("Blue");
                m_DockControl.AddPage("Blue");
            }

            {
                TabControl dragMe = new TabControl(this);
                dragMe.Margin = Margin.Five;
                dragMe.Width  = 200;
                dragMe.Dock   = Dock.Top;

                dragMe.AddPage("You");
                dragMe.AddPage("Can");
                dragMe.AddPage("Reorder").SetImage("test16.png");
                dragMe.AddPage("These");
                dragMe.AddPage("Tabs");

                dragMe.AllowReorder = true;
            }
        }
        public Example_Bilinear_Perspective(Base parent)
            : base(parent)
        {
            m_DrawingPanel = new InteractiveGeometryContainer(this);
            m_DrawingPanel.DoubleBuffered  = true;
            m_DrawingPanel.ClientBackColor = Color.FromArgb(0, 128, 128, 128);
            m_DrawingPanel.Dock            = Pos.Fill;
            m_DrawingPanel.Paint          += new PaintEventHandler(DrawingPanel_Paint);
            m_DrawingPanel.Resize         += new EventHandler(DrawingPanel_Resize);


            //  Transformation Type
            groupBox_TransformationType          = new RadioButtonGroup(m_DrawingPanel, string.Empty);
            groupBox_TransformationType.Text     = "Type:";
            groupBox_TransformationType.Location = new PointI(10, 10);

            rbBilinear        = groupBox_TransformationType.AddOption("Bilinear");
            rbBilinear.Margin = new Margin(0, 5, 0, 0);
            //NoNeed	rbPerspective =
            groupBox_TransformationType.AddOption("Perspective");
        }
Esempio n. 7
0
        ControlBase CreateControls(ControlBase subject, Dock docking, string name, ControlBase container)
        {
            GroupBox gb = new GroupBox(container);

            gb.Text = name;
            {
                HorizontalLayout hlayout = new HorizontalLayout(gb);
                {
                    GroupBox dgb = new GroupBox(hlayout);
                    dgb.Text = "Dock";
                    {
                        RadioButtonGroup dock = new RadioButtonGroup(dgb);
                        dock.UserData = subject;
                        dock.AddOption("Left", null, Dock.Left);
                        dock.AddOption("Top", null, Dock.Top);
                        dock.AddOption("Right", null, Dock.Right);
                        dock.AddOption("Bottom", null, Dock.Bottom);
                        dock.AddOption("Fill", null, Dock.Fill);
                        dock.SelectByUserData(docking);
                        dock.SelectionChanged += DockChanged;
                    }

                    VerticalLayout vlayout = new VerticalLayout(hlayout);
                    {
                        HorizontalLayout hlayout2 = new HorizontalLayout(vlayout);
                        {
                            GroupBox hgb = new GroupBox(hlayout2);
                            hgb.Text = "H. Align";
                            {
                                RadioButtonGroup halign = new RadioButtonGroup(hgb);
                                halign.UserData = subject;
                                halign.AddOption("Left", null, HorizontalAlignment.Left);
                                halign.AddOption("Center", null, HorizontalAlignment.Center);
                                halign.AddOption("Right", null, HorizontalAlignment.Right);
                                halign.AddOption("Stretch", null, HorizontalAlignment.Stretch);
                                halign.SelectByUserData(subject.HorizontalAlignment);
                                halign.SelectionChanged += HAlignChanged;
                            }

                            GroupBox vgb = new GroupBox(hlayout2);
                            vgb.Text = "V. Align";
                            {
                                RadioButtonGroup valign = new RadioButtonGroup(vgb);
                                valign.UserData = subject;
                                valign.AddOption("Top", null, VerticalAlignment.Top);
                                valign.AddOption("Center", null, VerticalAlignment.Center);
                                valign.AddOption("Bottom", null, VerticalAlignment.Bottom);
                                valign.AddOption("Stretch", null, VerticalAlignment.Stretch);
                                valign.SelectByUserData(subject.VerticalAlignment);
                                valign.SelectionChanged += VAlignChanged;
                            }
                        }

                        GridLayout glayout = new GridLayout(vlayout);
                        glayout.SetColumnWidths(GridLayout.AutoSize, GridLayout.Fill);
                        {
                            Label l_width = new Label(glayout);
                            l_width.Text = "Width:";

                            HorizontalSlider width = new HorizontalSlider(glayout);
                            width.Name          = "Width";
                            width.UserData      = subject;
                            width.Min           = 50;
                            width.Max           = 350;
                            width.Value         = 100;
                            width.ValueChanged += WidthChanged;

                            Label l_height = new Label(glayout);
                            l_height.Text = "Height:";

                            HorizontalSlider height = new HorizontalSlider(glayout);
                            height.Name          = "Height";
                            height.UserData      = subject;
                            height.Min           = 50;
                            height.Max           = 350;
                            height.Value         = 100;
                            height.ValueChanged += HeightChanged;

                            Label l_margin = new Label(glayout);
                            l_margin.Text = "Margin:";

                            HorizontalSlider margin = new HorizontalSlider(glayout);
                            margin.Name          = "Margin";
                            margin.UserData      = subject;
                            margin.Min           = 0;
                            margin.Max           = 50;
                            margin.Value         = 0;
                            margin.ValueChanged += MarginChanged;
                        }
                    }
                }
            }

            return(gb);
        }
Esempio n. 8
0
        Base CreateControls(Control.Base subject, int dock_idx, String name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";

            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name = "Width";
            width.UserData.Add("test", subject);
            width.Min   = 50;
            width.Max   = 350;
            width.Value = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name = "Height";
            height.UserData.Add("test", subject);
            height.Min   = 50;
            height.Max   = 350;
            height.Value = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb, "Dock");
            dock.UserData.Add("test", subject); // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name = "Margin";
            margin.UserData.Add("test", subject);
            margin.Min   = 0;
            margin.Max   = 50;
            margin.Value = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return(gb);
        }
        private void CreateBasicTab(TabControl tcontainer)
        {
            var container = tcontainer.AddPage("Basic").Page;

            tcontainer.Dock = Gwen.Pos.Fill;
            //modes
            GroupBox gb      = new GroupBox(container);
            var      modesgb = gb;

            gb.Text   = "Modes";
            gb.Width  = 180;
            gb.Height = 200;
            var marg = tcontainer.Margin;

            marg.Bottom       = 5;
            tcontainer.Margin = marg;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            RecurseLayout(Skin);
            Gwen.Align.AlignBottom(gb);
            Gwen.Align.AlignRight(gb);
            LabeledCheckBox lcb = new LabeledCheckBox(gb);

            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Recording Mode";
            lcb.Dock          = Pos.Top;
            lcb.IsChecked     = Settings.Local.RecordingMode;
            lcb.CheckChanged += (o, e) => { Settings.Local.RecordingMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"Disables many editor features
and changes the client so it can be 
recorded with a specific aesthetic");
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Color Playback";
            lcb.IsChecked     = Settings.Local.ColorPlayback;
            lcb.CheckChanged += (o, e) => { Settings.Local.ColorPlayback = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback the lines will no
longer turn black by default, and 
will stay as they are in editor mode");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Hit Test";
            lcb.IsChecked     = Settings.Local.HitTest;
            lcb.CheckChanged += (o, e) => { Settings.Local.HitTest = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback, hitting a line will turn it 
the color of the original line.");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Preview Mode";
            lcb.IsChecked     = Settings.Local.PreviewMode;
            lcb.CheckChanged += (o, e) => { Settings.Local.PreviewMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"The opposite of Color Playback. The editor will
show the lines as black instead");
            //

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Zero Start";
            lcb.IsChecked     = game.Track.ZeroStart;
            lcb.CheckChanged += (o, e) => { game.Track.ZeroStart = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"Starts the track with 0 momentum");

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Smooth Camera";
            lcb.IsChecked     = Settings.SmoothCamera;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.SmoothCamera = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Track.Stop();
                game.Track.InitCamera();
                var round = FindChildByName("roundlegacycamera", true);
                foreach (var c in round.Children)
                {
                    c.IsDisabled = Settings.SmoothCamera;
                }
            };
            lcb.Dock = Pos.Top;
            lcb.SetToolTipText("Enables a smooth predictive camera.\r\nExperimental and subject to change.");

            lcb               = new LabeledCheckBox(gb);
            lcb.Name          = "roundlegacycamera";
            lcb.Text          = "Round Legacy Camera";
            lcb.IsChecked     = Settings.RoundLegacyCamera;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.RoundLegacyCamera = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Track.Stop();
                game.Track.InitCamera();
            };
            lcb.Dock = Pos.Top;
            lcb.SetToolTipText("If the new camera is disabled\r\nmakes the camera bounds round\r\ninstead of rectangle");

            foreach (var c in lcb.Children)
            {
                c.IsDisabled = Settings.SmoothCamera;
            }
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Smooth Playback";
            lcb.IsChecked     = Settings.SmoothPlayback;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.SmoothPlayback = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
            };
            lcb.SetToolTipText("Interpolates frames for a smooth 60+ fps.");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Onion Skinning";
            lcb.IsChecked     = Settings.Local.OnionSkinning;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.Local.OnionSkinning = ((LabeledCheckBox)o).IsChecked;
                game.Invalidate();
            };
            lcb.Dock = Pos.Top;
            //
            gb          = new GroupBox(container);
            gb.Text     = "Editor View";
            gb.Width    = 180;
            gb.Height   = 100;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignRight(gb);
            Align.PlaceDownLeft(modesgb, gb);
            lcb               = new LabeledCheckBox(gb);
            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Contact Lines";
            lcb.IsChecked     = Settings.Local.DrawContactPoints;
            lcb.CheckChanged += (o, e) => { Settings.Local.DrawContactPoints = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Momentum Vectors";
            lcb.IsChecked     = Settings.Local.MomentumVectors;
            lcb.CheckChanged += (o, e) => { Settings.Local.MomentumVectors = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Gravity Wells";
            lcb.IsChecked     = Settings.Local.RenderGravityWells;
            lcb.CheckChanged += (o, e) => { Settings.Local.RenderGravityWells = ((LabeledCheckBox)o).IsChecked; game.Track.Invalidate(); };
            lcb.Dock          = Pos.Top;
            //playback
            gb          = new GroupBox(container);
            gb.Text     = "Playback";
            gb.Width    = 180;
            gb.Height   = 150;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignLeft(gb);
            RadioButtonGroup rbg = new RadioButtonGroup(gb);

            rbg.Text = "Playback Zoom";
            rbg.AddOption("Current Zoom");
            rbg.AddOption("Default Zoom");
            rbg.AddOption("Specific Zoom");
            rbg.SetSelection(Settings.PlaybackZoomType);
            rbg.SelectionChanged += (o, e) =>
            {
                Settings.PlaybackZoomType = ((RadioButtonGroup)o).SelectedIndex;
                Settings.Save();
            };
            rbg.Dock = Pos.Top;
            rbg.AutoSizeToContents = false;
            rbg.Height             = 90;
            var nud = new NumericUpDown(rbg);

            nud.Value         = Settings.PlaybackZoomValue;
            nud.Max           = 24;
            nud.Min           = 1;
            nud.Dock          = Pos.Bottom;
            nud.ValueChanged += (o, e) =>
            {
                Settings.PlaybackZoomValue = ((NumericUpDown)o).Value;
                Settings.Save();
            };
            var cbplayback = new ComboBox(gb);

            cbplayback.Dock = Pos.Top;
            for (var i = 0; i < Constants.MotionArray.Length; i++)
            {
                var f = (Constants.MotionArray[i] / (float)Constants.PhysicsRate);
                cbplayback.AddItem("Playback: " + f + "x", f.ToString(CultureInfo.InvariantCulture), f);
            }
            cbplayback.SelectByName(Settings.Local.DefaultPlayback.ToString(CultureInfo.InvariantCulture));
            cbplayback.ItemSelected += (o, e) =>
            {
                Settings.Local.DefaultPlayback = (float)e.SelectedItem.UserData;
            };
            var cbslowmo = new ComboBox(gb);

            cbslowmo.Dock = Pos.Top;
            var fpsarray = new[] { 1, 2, 5, 10, 20 };

            for (var i = 0; i < fpsarray.Length; i++)
            {
                cbslowmo.AddItem("Slowmo FPS: " + fpsarray[i], fpsarray[i].ToString(CultureInfo.InvariantCulture),
                                 fpsarray[i]);
            }
            cbslowmo.SelectByName(Settings.Local.SlowmoSpeed.ToString(CultureInfo.InvariantCulture));
            cbslowmo.ItemSelected += (o, e) =>
            {
                Settings.Local.SlowmoSpeed = (int)e.SelectedItem.UserData;
            };
            //editor
            var backup = gb;

            gb          = new GroupBox(container);
            gb.Text     = "Editor";
            gb.Width    = 180;
            gb.Height   = 170;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.PlaceDownLeft(gb, backup);
            //Gwen.Align.AlignRight(gb);
            lcb        = new LabeledCheckBox(gb);
            marg       = lcb.Margin;
            marg.Top  += 5;
            lcb.Margin = marg;
            lcb.Text   = "All Pink Lifelock";
            lcb.SetToolTipText(@"I hope you know where the manual is.");
            lcb.IsChecked     = Settings.PinkLifelock;
            lcb.CheckChanged += (o, e) => { Settings.PinkLifelock = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Disable Line Snap";
            lcb.IsChecked     = Settings.Local.DisableSnap;
            lcb.CheckChanged += (o, e) => { Settings.Local.DisableSnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Force XY Snap";
            lcb.IsChecked     = Settings.Local.ForceXySnap;
            lcb.CheckChanged += (o, e) => { Settings.Local.ForceXySnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Superzoom";
            lcb.IsChecked     = Settings.SuperZoom;
            lcb.CheckChanged += (o, e) => { Settings.SuperZoom = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "White BG";
            lcb.IsChecked     = Settings.WhiteBG;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.WhiteBG = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
            };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Night Mode";
            lcb.IsChecked     = Settings.NightMode;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.NightMode = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Invalidate();
                game.Canvas.ButtonsToggleNightmode();
            };
            lcb.Dock = Pos.Top;

            lcb               = new LabeledCheckBox(container);
            lcb.Text          = "Check for Updates";
            lcb.IsChecked     = Settings.CheckForUpdates;
            lcb.CheckChanged += (o, e) => { Settings.CheckForUpdates = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Bottom;
        }
        private void PopulateCircle()
        {
            CircleGenOptions = new ControlBase(null)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Top,
                AutoSizeToContents = true
            };
            //Panel configPanel = GwenHelper.CreateHeaderPanel(CircleGenOptions, "Configure Circle Properties");
            CircleRadius = new Spinner(null)
            {
                Min   = 0.0,
                Max   = 1.0e9,
                Value = gen_Circle.radius
            };
            CircleRadius.ValueChanged += (o, e) =>
            {
                gen_Circle.radius = CircleRadius.Value;
                gen_Circle.ReGenerate_Preview();
            };

            CircleLineCount = new Spinner(null)
            {
                Min   = 3.0,
                Max   = 1.0e7,
                Value = gen_Circle.lineCount
            };
            CircleLineCount.ValueChanged += (o, e) =>
            {
                gen_Circle.lineCount = (int)CircleLineCount.Value;
                gen_Circle.ReGenerate_Preview();
            };

            CircleOffsetX = new Spinner(null)
            {
                Min   = -30000000000,
                Max   = 30000000000,
                Value = gen_Circle.position.X
            };
            CircleOffsetX.ValueChanged += (o, e) =>
            {
                gen_Circle.position.X = CircleOffsetX.Value;
                gen_Circle.ReGenerate_Preview();
            };
            CircleOffsetY = new Spinner(null)
            {
                Min   = -30000000000,
                Max   = 30000000000,
                Value = gen_Circle.position.Y
            };
            CircleOffsetY.ValueChanged += (o, e) =>
            {
                gen_Circle.position.Y = CircleOffsetY.Value;
                gen_Circle.ReGenerate_Preview();
            };

            CircleMultiplier = new Spinner(null)
            {
                Min        = 0,
                Max        = 255,
                Value      = gen_Circle.multiplier,
                IsDisabled = true
            };
            CircleMultiplier.ValueChanged += (o, e) =>
            {
                gen_Circle.multiplier = (int)CircleMultiplier.Value;
                gen_Circle.ReGenerate_Preview();
            };

            CircleWidth = new Spinner(null)
            {
                Min           = 0.1,
                Max           = 25.5,
                Value         = gen_Circle.width,
                IncrementSize = 0.1,
                IsDisabled    = true
            };
            CircleWidth.ValueChanged += (o, e) =>
            {
                gen_Circle.width = (float)CircleWidth.Value;
                gen_Circle.ReGenerate_Preview();
            };

            GwenHelper.CreateLabeledControl(CircleGenOptions, "Radius", CircleRadius);
            GwenHelper.CreateLabeledControl(CircleGenOptions, "Line Count", CircleLineCount);
            GwenHelper.CreateLabeledControl(CircleGenOptions, "Centre X", CircleOffsetX);
            GwenHelper.CreateLabeledControl(CircleGenOptions, "Centre Y", CircleOffsetY);
            GwenHelper.CreateLabeledControl(CircleGenOptions, "Acceleration Multiplier", CircleMultiplier);
            GwenHelper.CreateLabeledControl(CircleGenOptions, "Scenery Width Multiplier", CircleWidth);

            var lineTypeRadioGroup = new RadioButtonGroup(CircleGenOptions)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false
            };
            var blueType  = lineTypeRadioGroup.AddOption("Blue");
            var redType   = lineTypeRadioGroup.AddOption("Red");
            var greenType = lineTypeRadioGroup.AddOption("Green");

            switch (gen_Circle.lineType)
            {
            case LineType.Blue:
                blueType.Select();
                break;

            case LineType.Red:
                redType.Select();
                break;

            case LineType.Scenery:
                greenType.Select();
                break;

            default:
                break;
            }
            blueType.CheckChanged += (o, e) =>
            {
                gen_Circle.lineType = LineType.Blue;
                gen_Circle.ReGenerate_Preview();
                CircleMultiplier.Disable();
                CircleWidth.Disable();
                CircleInverse.Enable();
                CircleReverse.Disable();
            };
            redType.CheckChanged += (o, e) =>
            {
                gen_Circle.lineType = LineType.Red;
                gen_Circle.ReGenerate_Preview();
                CircleMultiplier.Enable();
                CircleWidth.Disable();
                CircleInverse.Enable();
                CircleReverse.Enable();
            };
            greenType.CheckChanged += (o, e) =>
            {
                gen_Circle.lineType = LineType.Scenery;
                gen_Circle.ReGenerate_Preview();
                CircleMultiplier.Disable();
                CircleWidth.Enable();
                CircleInverse.Disable();
                CircleReverse.Disable();
            };

            CircleInverse = GwenHelper.AddCheckbox(CircleGenOptions, "Invert", gen_Circle.invert, (o, e) =>
            {
                gen_Circle.invert = ((Checkbox)o).IsChecked;
                gen_Circle.ReGenerate_Preview();
            });
            CircleReverse = GwenHelper.AddCheckbox(CircleGenOptions, "Reverse", gen_Circle.reverse, (o, e) =>
            {
                gen_Circle.reverse = ((Checkbox)o).IsChecked;
                gen_Circle.ReGenerate_Preview();
            });
        }
Esempio n. 11
0
        private void CreateBasicTab(TabControl tcontainer)
        {
            var container = tcontainer.AddPage("Basic").Page;

            tcontainer.Dock = Gwen.Pos.Fill;
            //modes
            GroupBox gb      = new GroupBox(container);
            var      modesgb = gb;

            gb.Text   = "Modes";
            gb.Width  = 180;
            gb.Height = 160;
            var marg = tcontainer.Margin;

            marg.Bottom       = 5;
            tcontainer.Margin = marg;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            RecurseLayout(Skin);
            Gwen.Align.AlignBottom(gb);
            Gwen.Align.AlignRight(gb);
            LabeledCheckBox lcb = new LabeledCheckBox(gb);

            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Recording Mode";
            lcb.Dock          = Pos.Top;
            lcb.IsChecked     = game.SettingRecordingMode;
            lcb.CheckChanged += (o, e) => { game.SettingRecordingMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"Disables many editor features
and changes the client so it can be 
recorded with a specific aesthetic");
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Color Playback";
            lcb.IsChecked     = game.SettingColorPlayback;
            lcb.CheckChanged += (o, e) => { game.SettingColorPlayback = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback the lines will no
longer turn black by default, and 
will stay as they are in editor mode");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Hit Test";
            lcb.IsChecked     = game.HitTest;
            lcb.CheckChanged += (o, e) => { game.HitTest = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback, hitting a line will turn it 
the color of the original line.");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Preview Mode";
            lcb.IsChecked     = game.SettingPreviewMode;
            lcb.CheckChanged += (o, e) => { game.SettingPreviewMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"The opposite of Color Playback. The editor will
shoe the lines as black instead");
            //

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Zero Start";
            lcb.IsChecked     = game.Track.ZeroStart;
            lcb.CheckChanged += (o, e) => { game.Track.ZeroStart = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"Starts the track with 0 momentum");

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Smooth Camera";
            lcb.IsChecked     = Settings.Default.SmoothCamera;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.Default.SmoothCamera = ((LabeledCheckBox)o).IsChecked;
                Settings.Default.Save();
            };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Onion Skinning";
            lcb.IsChecked     = game.SettingOnionSkinning;
            lcb.CheckChanged += (o, e) =>
            {
                game.SettingOnionSkinning = ((LabeledCheckBox)o).IsChecked;
                game.Invalidate();
            };
            lcb.Dock = Pos.Top;
            //
            gb          = new GroupBox(container);
            gb.Text     = "Editor View";
            gb.Width    = 180;
            gb.Height   = 100;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignRight(gb);
            Align.PlaceDownLeft(modesgb, gb);
            lcb               = new LabeledCheckBox(gb);
            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Contact Lines";
            lcb.IsChecked     = game.SettingDrawContactPoints;
            lcb.CheckChanged += (o, e) => { game.SettingDrawContactPoints = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Momentum Vectors";
            lcb.IsChecked     = game.SettingMomentumVectors;
            lcb.CheckChanged += (o, e) => { game.SettingMomentumVectors = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Gravity Wells";
            lcb.IsChecked     = game.SettingRenderGravityWells;
            lcb.CheckChanged += (o, e) => { game.SettingRenderGravityWells = ((LabeledCheckBox)o).IsChecked; game.InvalidateTrack(); };
            lcb.Dock          = Pos.Top;
            //playback
            gb          = new GroupBox(container);
            gb.Text     = "Playback";
            gb.Width    = 180;
            gb.Height   = 150;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignLeft(gb);
            RadioButtonGroup rbg = new RadioButtonGroup(gb);

            rbg.Text = "Playback Zoom";
            rbg.AddOption("Current Zoom");
            rbg.AddOption("Default Zoom");
            rbg.AddOption("Specific Zoom");
            rbg.SetSelection(Settings.Default.PlaybackZoom);
            rbg.SelectionChanged += (o, e) =>
            {
                Settings.Default.PlaybackZoom = ((RadioButtonGroup)o).SelectedIndex;
                Settings.Default.Save();
            };
            rbg.Dock = Pos.Top;
            rbg.AutoSizeToContents = false;
            rbg.Height             = 90;
            var nud = new NumericUpDown(rbg);

            nud.Value         = Settings.Default.PlaybackZoomSpecific;
            nud.Max           = 24;
            nud.Min           = 1;
            nud.Dock          = Pos.Bottom;
            nud.ValueChanged += (o, e) =>
            {
                Settings.Default.PlaybackZoomSpecific = ((NumericUpDown)o).Value;
                Settings.Default.Save();
            };
            var cbplayback = new ComboBox(gb);

            cbplayback.Dock = Pos.Top;
            for (var i = 0; i < GLWindow.MotionArray.Length; i++)
            {
                var f = (GLWindow.MotionArray[i] / 40f);
                cbplayback.AddItem("Playback: " + f + "x", f.ToString(CultureInfo.InvariantCulture), f);
            }
            cbplayback.SelectByName(game.SettingDefaultPlayback.ToString(CultureInfo.InvariantCulture));
            cbplayback.ItemSelected += (o, e) =>
            {
                game.SettingDefaultPlayback = (float)e.SelectedItem.UserData;
            };
            var cbslowmo = new ComboBox(gb);

            cbslowmo.Dock = Pos.Top;
            var fpsarray = new[] { 1, 2, 5, 10, 20 };

            for (var i = 0; i < fpsarray.Length; i++)
            {
                cbslowmo.AddItem("Slowmo FPS: " + fpsarray[i], fpsarray[i].ToString(CultureInfo.InvariantCulture),
                                 fpsarray[i]);
            }
            cbslowmo.SelectByName(game.SettingSlowmoSpeed.ToString(CultureInfo.InvariantCulture));
            cbslowmo.ItemSelected += (o, e) =>
            {
                game.SettingSlowmoSpeed = (int)e.SelectedItem.UserData;
            };
            //editor
            var backup = gb;

            gb          = new GroupBox(container);
            gb.Text     = "Editor";
            gb.Width    = 180;
            gb.Height   = 170;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.PlaceDownLeft(gb, backup);
            //Gwen.Align.AlignRight(gb);
            lcb               = new LabeledCheckBox(gb);
            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "All Pink Lifelock";
            lcb.IsChecked     = Settings.Default.PinkLifelock;
            lcb.CheckChanged += (o, e) => { Settings.Default.PinkLifelock = ((LabeledCheckBox)o).IsChecked; Settings.Default.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Disable Line Snap";
            lcb.IsChecked     = game.SettingDisableSnap;
            lcb.CheckChanged += (o, e) => { game.SettingDisableSnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Force XY Snap";
            lcb.IsChecked     = game.SettingForceXySnap;
            lcb.CheckChanged += (o, e) => { game.SettingForceXySnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Superzoom";
            lcb.IsChecked     = Settings.Default.SuperZoom;
            lcb.CheckChanged += (o, e) => { Settings.Default.SuperZoom = ((LabeledCheckBox)o).IsChecked; Settings.Default.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "White BG";
            lcb.SetToolTipText(@"For if you're a bad person");
            lcb.IsChecked     = Settings.Default.WhiteBG;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.Default.WhiteBG = ((LabeledCheckBox)o).IsChecked;
                Settings.Default.Save();
                if (!Settings.Default.NightMode)
                {
                    GL.ClearColor(Settings.Default.WhiteBG ? GLWindow.ColorWhite : GLWindow.ColorOffwhite);
                }
            };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Night Mode";
            lcb.IsChecked     = Settings.Default.NightMode;
            lcb.CheckChanged += (o, e) =>
            {
                if (((LabeledCheckBox)o).IsChecked)
                {
                    GL.ClearColor(new Color4(50, 50, 60, 255));
                }
                else
                {
                    GL.ClearColor(Settings.Default.WhiteBG ? GLWindow.ColorWhite : GLWindow.ColorOffwhite);
                }
                Settings.Default.NightMode = ((LabeledCheckBox)o).IsChecked;
                Settings.Default.Save();
                game.Canvas.ButtonsToggleNightmode();
                game.Track.RefreshTrack();
            };
            lcb.Dock = Pos.Top;
            lcb      = new LabeledCheckBox(gb);
            lcb.Text = "Live Line Editing";
            lcb.SetToolTipText("For the line adjust tool during playback\r\nEnable this if you have a slow PC");
            lcb.IsChecked     = Settings.Default.LiveAdjustment;
            lcb.CheckChanged += (o, e) => { Settings.Default.LiveAdjustment = ((LabeledCheckBox)o).IsChecked; Settings.Default.Save(); };
            lcb.Dock          = Pos.Top;
        }
Esempio n. 12
0
        private void PopulatePlayback(ControlBase parent)
        {
            var playbackzoom        = GwenHelper.CreateHeaderPanel(parent, "Playback Zoom");
            RadioButtonGroup pbzoom = new RadioButtonGroup(playbackzoom)
            {
                Dock = Dock.Left,
                ShouldDrawBackground = false,
            };

            pbzoom.AddOption("Default Zoom");
            pbzoom.AddOption("Current Zoom");
            pbzoom.AddOption("Specific Zoom");
            Spinner playbackspinner = new Spinner(pbzoom)
            {
                Dock = Dock.Bottom,
                Max  = 24,
                Min  = 1,
            };

            pbzoom.SelectionChanged += (o, e) =>
            {
                Settings.PlaybackZoomType = ((RadioButtonGroup)o).SelectedIndex;
                Settings.Save();
                playbackspinner.IsHidden = (((RadioButtonGroup)o).SelectedLabel != "Specific Zoom");
            };
            playbackspinner.ValueChanged += (o, e) =>
            {
                Settings.PlaybackZoomValue = (float)((Spinner)o).Value;
                Settings.Save();
            };
            pbzoom.SetSelection(Settings.PlaybackZoomType);
            playbackspinner.Value = Settings.PlaybackZoomValue;

            var playbackmode = GwenHelper.CreateHeaderPanel(parent, "Playback Color");

            GwenHelper.AddCheckbox(playbackmode, "Color Playback", Settings.ColorPlayback, (o, e) =>
            {
                Settings.ColorPlayback = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var preview = GwenHelper.AddCheckbox(playbackmode, "Preview Mode", Settings.PreviewMode, (o, e) =>
            {
                Settings.PreviewMode = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var recording = GwenHelper.AddCheckbox(playbackmode, "Recording Mode", Settings.Local.RecordingMode, (o, e) =>
            {
                Settings.Local.RecordingMode = ((Checkbox)o).IsChecked;
            });
            var framerate = GwenHelper.CreateHeaderPanel(parent, "Frame Control");
            var smooth    = GwenHelper.AddCheckbox(framerate, "Smooth Playback", Settings.SmoothPlayback, (o, e) =>
            {
                Settings.SmoothPlayback = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            ComboBox pbrate = GwenHelper.CreateLabeledCombobox(framerate, "Playback Rate:");

            for (var i = 0; i < Constants.MotionArray.Length; i++)
            {
                var f = (Constants.MotionArray[i] / (float)Constants.PhysicsRate);
                pbrate.AddItem(f + "x", f.ToString(CultureInfo.InvariantCulture), f);
            }
            pbrate.SelectByName(Settings.DefaultPlayback.ToString(CultureInfo.InvariantCulture));
            pbrate.ItemSelected += (o, e) =>
            {
                Settings.DefaultPlayback = (float)e.SelectedItem.UserData;
                Settings.Save();
            };
            var cbslowmo = GwenHelper.CreateLabeledCombobox(framerate, "Slowmo FPS:");
            var fpsarray = new[] { 1, 2, 5, 10, 20 };

            for (var i = 0; i < fpsarray.Length; i++)
            {
                cbslowmo.AddItem(fpsarray[i].ToString(), fpsarray[i].ToString(CultureInfo.InvariantCulture),
                                 fpsarray[i]);
            }
            cbslowmo.SelectByName(Settings.SlowmoSpeed.ToString(CultureInfo.InvariantCulture));
            cbslowmo.ItemSelected += (o, e) =>
            {
                Settings.SlowmoSpeed = (int)e.SelectedItem.UserData;
                Settings.Save();
            };
            smooth.Tooltip = "Interpolates frames from the base\nphysics rate of 40 frames/second\nup to 60 frames/second";
        }
Esempio n. 13
0
        public ExportVideoWindow(Gwen.Controls.ControlBase parent, GLWindow game) : base(parent, "Export Video")
        {
            game.Track.Stop();
            var openwindows = game.Canvas.GetOpenWindows();

            foreach (var v in openwindows)
            {
                if (v is WindowControl)
                {
                    ((WindowControl)v).Close();
                }
            }
            MakeModal(true);
            Width  = 400;
            Height = 280;
            ControlBase bottom = new ControlBase(this);

            bottom.Height = 150;
            bottom.Width  = 400 - 13;
            Align.AlignBottom(bottom);

            var buttonok = new Button(bottom);

            buttonok.Name   = "Okay";
            buttonok.Text   = "Record";
            buttonok.Height = 20;
            buttonok.Y      = 80;
            buttonok.Width  = 100;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                buttonok.IsHidden = true;
            }
            buttonok.Clicked += (o, e) =>
            {
                var wnd = ((WindowControl)o.Parent.Parent);
                wnd.Close();
                if (game.Track.GetFlag() == null)
                {
                    var pop = PopupWindow.Create(parent, game,
                                                 "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                                                 "Error", true, false);
                    pop.FindChildByName("Okay", true).Clicked +=
                        (o1, e1) => { pop.Close(); };
                }
                else
                {
                    var  radiogrp = (RadioButtonGroup)this.FindChildByName("qualityselector", true);
                    bool is1080p  = radiogrp.Selected.Text == "1080p";
                    TrackFiles.TrackRecorder.RecordTrack(game, is1080p);
                }
            };
            Align.AlignLeft(buttonok);
            var buttoncancel = new Button(bottom);

            buttoncancel.Name     = "Cancel";
            buttoncancel.Text     = "Cancel";
            buttoncancel.Height   = 20;
            buttoncancel.Y        = 80;
            buttoncancel.Width    = 100;
            buttoncancel.Clicked += (o, e) => { this.Close(); };
            Align.AlignRight(buttoncancel);
            var label = new RichLabel(this);

            label.Dock  = Pos.Top;
            label.Width = this.Width;
            if (Drawing.SafeFrameBuffer.CanRecord)
            {
                label.AddText("You are about to export your track as a video file. Make sure the end of the track is marked by a flag. It will be located in the same folder as linerider.exe. Please allow some minutes depending on your computer speed. The window will become unresponsive during this time." + Environment.NewLine + Environment.NewLine + "After recording, a console window will open to encode the video. Closing it will cancel the process and all progress will be lost.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            else
            {
                label.AddText("Video export is not supported on this machine." + Environment.NewLine + "Sorry.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            label.SizeToChildren(false, true);
            var radio = new RadioButtonGroup(bottom);

            radio.Name = "qualityselector";
            radio.AddOption("720p").Select();
            radio.AddOption("1080p");
            Align.AlignLeft(radio);
            radio.Y += 20;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            DisableResizing();
        }
        private void PopulateTools(ControlBase parent)
        {
            var bezier = GwenHelper.CreateHeaderPanel(parent, "Bezier Tool");

            var resolution = new Spinner(bezier)
            {
                Min           = 5,
                Max           = 100,
                Value         = Settings.Bezier.Resolution,
                IncrementSize = 1
            };

            resolution.ValueChanged += (o, e) =>
            {
                Settings.Bezier.Resolution = (int)((Spinner)o).Value;
                Settings.Save();
            };
            GwenHelper.CreateLabeledControl(bezier, "Resolution (Lines per 100 pixels)", resolution);

            var nodeSize = new Spinner(bezier)
            {
                Min           = 5,
                Max           = 100,
                Value         = Settings.Bezier.NodeSize,
                IncrementSize = 1
            };

            nodeSize.ValueChanged += (o, e) =>
            {
                Settings.Bezier.NodeSize = (int)((Spinner)o).Value;
                Settings.Save();
            };
            GwenHelper.CreateLabeledControl(bezier, "Size of the bezier curve nodes", nodeSize);

            var bezierModeSelector = new RadioButtonGroup(bezier)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false
            };
            var directType = bezierModeSelector.AddOption("Direct Visualization Mode");
            var traceType  = bezierModeSelector.AddOption("Trace Visualization Mode");

            switch ((Settings.BezierMode)Settings.Bezier.Mode)
            {
            case Settings.BezierMode.Direct:
                directType.Select();
                break;

            case Settings.BezierMode.Trace:
                traceType.Select();
                break;
            }
            directType.CheckChanged += (o, e) =>
            {
                Settings.Bezier.Mode = (int)Settings.BezierMode.Direct;
                Settings.Save();
            };
            traceType.CheckChanged += (o, e) =>
            {
                Settings.Bezier.Mode = (int)Settings.BezierMode.Trace;
                Settings.Save();
            };

            var select = GwenHelper.CreateHeaderPanel(parent, "Select Tool -- Line Info");
            var length = GwenHelper.AddCheckbox(select, "Show Length", Settings.Editor.ShowLineLength, (o, e) =>
            {
                Settings.Editor.ShowLineLength = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var angle = GwenHelper.AddCheckbox(select, "Show Angle", Settings.Editor.ShowLineAngle, (o, e) =>
            {
                Settings.Editor.ShowLineAngle = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var showid = GwenHelper.AddCheckbox(select, "Show ID", Settings.Editor.ShowLineID, (o, e) =>
            {
                Settings.Editor.ShowLineID = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            Panel panelSnap = GwenHelper.CreateHeaderPanel(parent, "Snapping");
            var   linesnap  = GwenHelper.AddCheckbox(panelSnap, "Snap New Lines", Settings.Editor.SnapNewLines, (o, e) =>
            {
                Settings.Editor.SnapNewLines = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var movelinesnap = GwenHelper.AddCheckbox(panelSnap, "Snap Line Movement", Settings.Editor.SnapMoveLine, (o, e) =>
            {
                Settings.Editor.SnapMoveLine = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var gridsnap = GwenHelper.AddCheckbox(panelSnap, "Snap to displayed grids", Settings.Editor.SnapToGrid, (o, e) =>
            {
                Settings.Editor.SnapToGrid = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var forcesnap = GwenHelper.AddCheckbox(panelSnap, "Force X/Y snap", Settings.Editor.ForceXySnap, (o, e) =>
            {
                Settings.Editor.ForceXySnap = ((Checkbox)o).IsChecked;
                Settings.Save();
            });
            var snapAngle = new Spinner(panelSnap)
            {
                Min           = 0,
                Max           = 180,
                Value         = Settings.Editor.XySnapDegrees,
                IncrementSize = 1
            };

            snapAngle.ValueChanged += (o, e) =>
            {
                Settings.Editor.XySnapDegrees = (float)Math.Round((float)((Spinner)o).Value, 2, MidpointRounding.AwayFromZero);
                ((Spinner)o).Value            = Settings.Editor.XySnapDegrees; // Re-display the rounded value
                Settings.Save();
            };
            GwenHelper.CreateLabeledControl(panelSnap, "X/Y snap degrees", snapAngle);
            forcesnap.Tooltip    = "Forces all lines drawn to\nsnap to multiples of a chosen angle";
            movelinesnap.Tooltip = "Snap to lines when using the\nselect tool to move a single line";
        }
Esempio n. 15
0
        private void PopulateCamera(ControlBase parent)
        {
            var camtype               = GwenHelper.CreateHeaderPanel(parent, "Camera Type");
            var camtracking           = GwenHelper.CreateHeaderPanel(parent, "Camera Tracking");
            var camprops              = GwenHelper.CreateHeaderPanel(parent, "Camera Properties");
            RadioButtonGroup rbcamera = new RadioButtonGroup(camtype)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false,
            };
            var soft       = rbcamera.AddOption("Soft Camera");
            var predictive = rbcamera.AddOption("Predictive Camera");
            var legacy     = rbcamera.AddOption("Legacy Camera");

            RadioButtonGroup xycamera = new RadioButtonGroup(camtracking)
            {
                Dock = Dock.Top,
                ShouldDrawBackground = false,
            };
            var horizontal         = xycamera.AddOption("Horizontal Tracking");
            var vertical           = xycamera.AddOption("Vertical Tracking");
            var horizontalvertical = xycamera.AddOption("Normal Tracking");

            var round = GwenHelper.AddCheckbox(camprops, "Round Legacy Camera", Settings.RoundLegacyCamera, (o, e) =>
            {
                Settings.RoundLegacyCamera = ((Checkbox)o).IsChecked;
                Settings.Save();
                _editor.InitCamera();
            });
            var offsledsled = GwenHelper.AddCheckbox(camprops, "Offsled Sled Camera", Settings.OffsledSledCam, (o, e) =>
            {
                Settings.OffsledSledCam = ((Checkbox)o).IsChecked;
                Settings.Save();
                _editor.InitCamera();
            });
            var offsledvar = GwenHelper.AddCheckbox(camprops, "Variable Contact Point Camera", Settings.OffsledVar, (o, e) =>
            {
                Settings.OffsledVar = ((Checkbox)o).IsChecked;
                Settings.Save();
                _editor.InitCamera();
            });
            var fixedcam = GwenHelper.AddCheckbox(camprops, "Fixed Camera", Settings.FixedCam, (o, e) =>
            {
                Settings.FixedCam = ((Checkbox)o).IsChecked;
                Settings.Save();
                _editor.InitCamera();
            });
            var     variables = GwenHelper.CreateHeaderPanel(parent, "Contact Point Settings");
            Spinner pointvar  = new Spinner(variables)
            {
                Dock  = Dock.Bottom,
                Max   = 29,
                Min   = 0,
                Value = Settings.PointVar,
            };

            pointvar.ValueChanged += (o, e) =>
            {
                Settings.PointVar = (int)pointvar.Value;
                Settings.Save();
            };
            var fixedpos = GwenHelper.CreateHeaderPanel(parent, "Fixed Camera X and Y Position");
            var xfixed   = new Spinner(null)
            {
                Dock  = Dock.Bottom,
                Max   = 2147483648,
                Min   = -2147483648,
                Value = Settings.XFixed
            };

            xfixed.ValueChanged += (o, e) =>
            {
                Settings.XFixed = (int)xfixed.Value;
                Settings.Save();
                _editor.InitCamera();
            };
            var yfixed = new Spinner(null)
            {
                Dock  = Dock.Bottom,
                Max   = 2147483648,
                Min   = -2147483648,
                Value = Settings.YFixed
            };

            yfixed.ValueChanged += (o, e) =>
            {
                Settings.YFixed = (int)yfixed.Value;
                Settings.Save();
                _editor.InitCamera();
            };
            GwenHelper.CreateLabeledControl(fixedpos, "X Location", xfixed);
            GwenHelper.CreateLabeledControl(fixedpos, "Y Location", yfixed);
            if (Settings.SmoothCamera)
            {
                if (Settings.PredictiveCamera)
                {
                    predictive.Select();
                }
                else
                {
                    soft.Select();
                }
            }
            else
            {
                legacy.Select();
            }

            if (Settings.HorizontalTracking)
            {
                horizontal.Select();
            }
            else if (Settings.VerticalTracking)
            {
                vertical.Select();
            }
            else
            {
                horizontalvertical.Select();
            }

            horizontal.Checked += (o, e) =>
            {
                Settings.HorizontalTracking = true;
                Settings.VerticalTracking   = false;
                Settings.Save();
                _editor.InitCamera();
            };
            vertical.Checked += (o, e) =>
            {
                Settings.HorizontalTracking = false;
                Settings.VerticalTracking   = true;
                Settings.Save();
                _editor.InitCamera();
            };
            horizontalvertical.Checked += (o, e) =>
            {
                Settings.HorizontalTracking = false;
                Settings.VerticalTracking   = false;
                Settings.Save();
                _editor.InitCamera();
            };

            soft.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = true;
                Settings.PredictiveCamera = true;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            legacy.Checked += (o, e) =>
            {
                Settings.SmoothCamera     = false;
                Settings.PredictiveCamera = false;
                Settings.Save();
                round.IsDisabled = Settings.SmoothCamera;
                _editor.InitCamera();
            };
            predictive.Tooltip = "This is the camera that was added in 1.03\nIt moves relative to the future of the track";
        }
        public static void Create(MainWindow game)
        {
            string howto = "You are about to export your track as a video file. Make sure the end of the track is marked by a flag. " +
                           "It will be located in your line rider user directory (Documents/LRA).\r\n" +
                           "Please allow some minutes depending on your computer speed. " +
                           "The window will become unresponsive during this time.\n\n" +
                           "After recording, a console window will open to encode the video. " +
                           "Closing it will cancel the process and all progress will be lost.";

            if (!SafeFrameBuffer.CanRecord)
            {
                howto = "Video export is not supported on this machine.\n\nSorry.";
            }
            var popup = PopupWindow.Create(howto, "Export Video", true, true);

            popup.Width = 350;

            popup.Container.Height += 50;
            var btn = popup.Container.FindChildByName("Okay");

            btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom);
            btn        = popup.Container.FindChildByName("Cancel");
            btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom);
            popup.Layout();
            var radio = new RadioButtonGroup(popup.Container);

            radio.Name = "qualityselector";

            if (Settings.Record108p)
            {
                radio.AddOption("720p");
                radio.AddOption("1080p").Select();
            }
            else
            {
                radio.AddOption("720p").Select();
                radio.AddOption("1080p");
            }

            if (!SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            LabeledCheckBox smooth = new LabeledCheckBox(popup.Container);

            smooth.Name      = "smooth";
            smooth.IsChecked = Settings.RecordSmooth;
            smooth.Text      = "Smooth Playback";
            Align.AlignBottom(smooth);

            LabeledCheckBox music = new LabeledCheckBox(popup.Container);

            music.Name      = "music";
            music.IsChecked = Settings.Local.EnableSong && Settings.RecordMusic;
            music.IsHidden  = !Settings.Local.EnableSong;
            music.Text      = "Include Music";
            if (Settings.Local.EnableSong)
            {
                popup.Container.Height += 20;
                Align.PlaceDownLeft(music, smooth);
            }
            popup.Layout();

            popup.SetPosition((game.RenderSize.Width / 2) - (popup.Width / 2), (game.RenderSize.Height / 2) - (popup.Height / 2));

            popup.Dismissed += (o, e) =>
            {
                if (popup.Result == System.Windows.Forms.DialogResult.OK)
                {
                    var  radiogrp = radio;
                    bool is1080p  = radiogrp.Selected.Text == "1080p";

                    Settings.Record108p   = is1080p;
                    Settings.RecordSmooth = smooth.IsChecked;
                    if (Settings.Local.EnableSong)
                    {
                        Settings.RecordMusic = music.IsChecked;
                    }
                    Settings.Save();

                    if (game.Track.GetFlag() == null)
                    {
                        var pop = PopupWindow.Create(
                            "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                            "Error", true, false);
                    }
                    else if (game.Track.Name == Utils.Constants.DefaultTrackName)
                    {
                        var pop = PopupWindow.Create(
                            "Please name your track before recording.",
                            "Error", true, false);
                    }
                    else
                    {
                        IO.TrackRecorder.RecordTrack(game, is1080p, smooth.IsChecked, music.IsChecked);
                    }
                }
            };
        }