Example #1
0
 public Window(Gwen.Controls.ControlBase ctrl, string title = "") : base(ctrl, title)
 {
     Container        = new ControlBase(m_InnerPanel);
     Container.Margin = new Margin(0, 20, 0, 10);
     Container.Dock   = Pos.Top;
     Container.Height = 25;
 }
 /// <summary>
 /// Disables tooltip display for the specified control.
 /// </summary>
 /// <param name="control">Target control.</param>
 public static void Disable(Controls.ControlBase control)
 {
     if (g_ToolTip == control)
     {
         g_ToolTip = null;
     }
 }
        /// <summary>
        /// Enables tooltip display for the specified control.
        /// </summary>
        /// <param name="control">Target control.</param>
        public static void Enable(Controls.ControlBase control)
        {
            if (null == control.Tooltip)
            {
                return;
            }

            g_ToolTip = control;
        }
Example #4
0
        /// <summary>
        /// Centers the control vertically inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterVertically(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }

            control.SetPosition(control.X + control.Margin.Left, ((parent.Height - control.Height) / 2) + control.Margin.Top);
        }
Example #5
0
        /// <summary>
        /// Moves the control to the bottom of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignBottom(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }

            control.SetPosition(control.X, (parent.Height - control.Height) - (control.Margin.Bottom + parent.Padding.Bottom));
        }
Example #6
0
 /// <summary>
 /// Stretches the control inside it's parent
 /// </summary>
 public static void StretchHorizontally(Controls.ControlBase control)
 {
     Controls.ControlBase parent = control.Parent;
     if (parent == null)
     {
         return;
     }
     control.SetPosition(control.Margin.Left + parent.Padding.Left, control.Y);
     control.Width = parent.Width - parent.Padding.Right;
 }
Example #7
0
        /// <summary>
        /// Moves the control to the left of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignLeft(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }

            control.SetPosition(parent.Padding.Left + control.Margin.Left, control.Y);
        }
Example #8
0
        /// <summary>
        /// Moves the control to the top of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignTop(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }

            control.SetPosition(control.X, control.Margin.Top + parent.Padding.Top);
        }
Example #9
0
 /// <summary>
 /// Centers the control inside its parent.
 /// </summary>
 /// <param name="control">Control to center.</param>
 public static void Center(Controls.ControlBase control)
 {
     Controls.ControlBase parent = control.Parent;
     if (parent == null)
     {
         return;
     }
     control.SetPosition(
         parent.Padding.Left + control.Margin.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2),
         control.Margin.Top + (parent.Height - control.Height) / 2);
 }
Example #10
0
        /// <summary>
        /// Centers the control horizontally inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterHorizontally(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }


            control.SetPosition(parent.Padding.Left + control.Margin.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2), control.Y + control.Margin.Top);
        }
Example #11
0
        /// <summary>
        /// Moves the control to the right of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignRight(Controls.ControlBase control)
        {
            Controls.ControlBase parent = control.Parent;
            if (null == parent)
            {
                return;
            }


            control.SetPosition(parent.Width - control.Width - parent.Padding.Right - control.Margin.Right, control.Y);
        }
        public PreferencesWindow(Gwen.Controls.ControlBase parent, MainWindow pgame) : base(parent, "Preferences")
        {
            game   = pgame;
            Width  = 400;
            Height = 420;//blaze it---*shot*
            MakeModal(true);
            DisableResizing();
            ///controls
            TabControl tcontainer = new TabControl(this);

            CreateBasicTab(tcontainer);
            //CreateAdvancedTab(tcontainer); //todo
            CreateRecordingTab(tcontainer);
            CreateAboutTab(tcontainer);
        }
Example #13
0
        public SaveWindow(Gwen.Controls.ControlBase parent, GLWindow game) : base(parent, "Save Track")
        {
            game.Track.Stop();
            MakeModal(true);

            var bottom = new PropertyBase(this)
            {
                Name = "bottom", Margin = new Margin(0, 10, 0, 5), Height = 30
            };
            var cb = new ComboBox(this);

            cb.ItemSelected += (o, e) => {
                var snd = ((ComboBox)o);
                var txt = snd.SelectedItem.Text;
                this.UserData = txt;
            };
            var tb = new TextBox(bottom)
            {
                Name = "tb"
            };

            tb.Dock     = Pos.Left;
            bottom.Dock = Pos.Bottom;
            cb.Dock     = Pos.Bottom;
            cb.Margin   = new Margin(0, 0, 0, 0);
            this.Width  = 200;
            this.Height = 100;
            var dir = Program.CurrentDirectory + "Tracks";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            var folders = Directory.GetDirectories(Program.CurrentDirectory + "Tracks");

            cb.AddItem("<create new track>"); //< used as it cant be used as a file character
            cb.SelectByText("<create new track>");
            foreach (var folder in folders)
            {
                var trackname = Path.GetFileName(folder);
                cb.AddItem(trackname);
            }
            cb.SelectByText(game.Track.Name);
            game.Cursor = MouseCursor.Default;
        }
Example #14
0
        public SelectedLineWindow(Gwen.Controls.ControlBase parent, MainWindow glgame, GameLine line) : base(parent, DefaultTitle)
        {
            game       = glgame;
            _ownerline = line;
            this.MakeModal(true);
            this.Height = 190;
            this.Width  = 150;
            ControlBase container1 = new ControlBase(this);

            container1.Dock = Gwen.Pos.Fill;
            if (line.Type != LineType.Scenery)
            {
                var             stl = (StandardLine)line;
                LabeledCheckBox btn = new LabeledCheckBox(container1);
                btn.Dock          = Gwen.Pos.Top;
                btn.Text          = "Inverse";
                btn.IsChecked     = stl.inv;
                btn.CheckChanged += (o, e) =>
                {
                    using (var trk = game.Track.CreateTrackWriter())
                    {
                        LineChanging();
                        var copy   = (StandardLine)stl.Clone();
                        var caller = (LabeledCheckBox)o;
                        copy.inv = caller.IsChecked;
                        copy.CalculateConstants();
                        trk.ReplaceLine(stl, copy);
                        game.Track.NotifyTrackChanged();
                        game.Invalidate();
                    }
                };
                LineTrigger tr = (LineTrigger)stl.Trigger ?? new LineTrigger();

                var gb = new PropertyTree(container1);
                gb.Height = 110;
                gb.Dock   = Gwen.Pos.Top;

                PropertyTree table = new PropertyTree(gb);

                table.Name   = "triggers";
                table.Dock   = Gwen.Pos.Fill;
                table.Height = 100;

                var row     = table.Add("Zoom Trigger");
                var enabled = row.Add("Enabled", new Gwen.Controls.Property.Check(table));
                enabled.Value         = tr.Zoomtrigger ? "1" : "0";
                enabled.ValueChanged += (o, e) =>
                {
                    using (var trk = game.Track.CreateTrackWriter())
                    {
                        LineChanging();
                        trk.DisableExtensionUpdating();
                        var copy = (StandardLine)stl.Clone();
                        if (enabled.Value == "1")
                        {
                            tr.Zoomtrigger = true;
                            tr.ZoomTarget  = float.Parse(((PropertyRow)container1.FindChildByName("Zoom", true)).Value);
                            tr.ZoomFrames  = int.Parse(((PropertyRow)container1.FindChildByName("ZoomFrames", true)).Value);
                            copy.Trigger   = tr;
                        }
                        else
                        {
                            tr.Zoomtrigger = false;
                            if (!tr.Enabled)
                            {
                                copy.Trigger = null;
                            }
                        }
                        trk.ReplaceLine(stl, copy);
                        game.Track.NotifyTrackChanged();
                    }
                };
                var prop = row.Add("Zoom");
                prop.Name          = "Zoom";
                prop.Value         = (enabled.Value == "1" ? tr.ZoomTarget : 1).ToString();
                prop.ValueChanged += (o, e) =>
                {
                    var   caller = (PropertyRow)o;
                    float val    = 0;
                    if (float.TryParse(caller.Value, out val) && val >= 0.1 && val <= 24)
                    {
                        caller.LabelColor = System.Drawing.Color.Black;
                        tr.ZoomTarget     = val;
                    }
                    else
                    {
                        caller.LabelColor = System.Drawing.Color.Red;
                    }
                };
                prop               = row.Add("Frames");
                prop.Name          = "ZoomFrames";
                prop.Value         = (enabled.Value == "1" ? tr.ZoomFrames : 40).ToString();
                prop.ValueChanged += (o, e) =>
                {
                    var caller = (PropertyRow)o;
                    int val    = 0;
                    if (int.TryParse(caller.Value, out val) && val >= 1 && val < 10000)
                    {
                        caller.LabelColor = System.Drawing.Color.Black;
                        tr.ZoomFrames     = val;
                    }
                    else
                    {
                        caller.LabelColor = System.Drawing.Color.Red;
                    }
                };
            }

            if (line.Type == LineType.Red)
            {
                ControlBase optioncontainer = new ControlBase(container1);
                optioncontainer.Dock   = Pos.Top;
                optioncontainer.Height = 30;
                var redstl = (RedLine)line;
                Height += 30;
                NoDecimalNUD nud  = new NoDecimalNUD(optioncontainer);
                var          marg = nud.Margin;
                marg.Top          = 5;
                marg.Left         = marg.Right = 1;
                marg.Left         = 70;
                marg.Bottom       = 10;
                nud.Margin        = marg;
                nud.Dock          = Gwen.Pos.Top;
                nud.Min           = 1;
                nud.Max           = 3;
                nud.Value         = (line as RedLine).Multiplier;
                nud.ValueChanged += nud_redlinemultiplier_ValueChanged;
                nud.UserData      = line;
                Label l = new Label(optioncontainer);
                l.Y     = 5;
                l.Text  = "Multiplier";
                Height += 25;

                optioncontainer        = new ControlBase(container1);
                optioncontainer.Dock   = Pos.Top;
                optioncontainer.Height = 30;
                nud               = new NoDecimalNUD(optioncontainer);
                marg              = nud.Margin;
                marg.Top          = 5;
                marg.Left         = marg.Right = 1;
                marg.Left         = 70;
                marg.Bottom       = 10;
                nud.Margin        = marg;
                nud.Dock          = Gwen.Pos.Top;
                nud.Min           = 1;
                nud.Max           = 9999;
                nud.Value         = GetMultiLines(true).Count;
                nud.ValueChanged += (o, e) =>
                {
                    var val = (int)nud.Value;
                    if (val > 0)
                    {
                        Multiline(val);
                    }
                };
                nud.UserData = line;
                l            = new Label(optioncontainer);
                l.Y          = 5;
                l.Text       = "Multilines";
            }
            Button saveandquit = new Button(container1);

            saveandquit.Name = "saveandquit";
            saveandquit.Disable();
            saveandquit.Dock     = Pos.Bottom;
            saveandquit.Text     = "Save changes";
            saveandquit.Clicked += (o, e) =>
            {
                if (!saveandquit.IsDisabled)
                {
                    if (!_closing)
                    {
                        _closing = true;
                        if (_linechanged)
                        {
                            game.Track.UndoManager.EndAction();
                        }
                        if (!this.IsHidden)
                        {
                            Close();
                        }
                    }
                }
            };
            RecurseLayout(Skin);
            this.MinimumSize = new System.Drawing.Point(Width, Height);
            game.Cursor      = OpenTK.MouseCursor.Default;
        }
Example #15
0
 /// <summary>
 /// Handles the splitter moved event.
 /// </summary>
 /// <param name="control">Event source.</param>
 protected virtual void OnSplitterMoved(ControlBase control, EventArgs args)
 {
     InvalidateChildren();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TabStrip"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public TabStrip(ControlBase parent)
     : base(parent)
 {
     m_AllowReorder = false;
 }
        public SongWindow(Gwen.Controls.ControlBase parent, MainWindow glgame) : base(parent, "Song Sync")
        {
            game = glgame;
            this.MakeModal(true);

            this.MinimumSize = new System.Drawing.Point(220, 240);

            this.Width  = 260;
            this.Height = 240;
            //wc.DisableResizing();
            var enablesongcb = new LabeledCheckBox(this);

            enablesongcb.CheckChanged += (o, e) => { Settings.Local.EnableSong = enablesongcb.IsChecked; };
            enablesongcb.IsChecked     = Settings.Local.EnableSong;
            enablesongcb.Text          = "Enable Song";
            enablesongcb.Dock          = Pos.Top;
            var gb = new GroupBox(this);

            gb.Text = "Song Selection";
            gb.Dock = Pos.Fill;
            var Songs = new TreeControl(gb);

            Songs.Height = 100;
            Songs.Margin = new Margin()
            {
                Bottom = 10
            };
            Songs.Dock = Pos.Fill;
            Songs.Name = "songtv";

            var filedir = Program.UserDirectory + "Songs";

            if (Directory.Exists(filedir))
            {
                var      songfiles          = Directory.GetFiles(filedir, "*.*");
                var      supportedfiles     = new List <string>();
                string[] supportedfiletypes = new string[]
                {
                    ".mp3", ".wav", ".wave", ".ogg", ".wma", ".m4a", ".aac"
                };

                foreach (var file in songfiles)
                {
                    var lower = file.ToLower(Program.Culture);
                    foreach (var type in supportedfiletypes)
                    {
                        if (lower.EndsWith(type, StringComparison.OrdinalIgnoreCase))
                        {
                            supportedfiles.Add(file);
                            break;
                        }
                    }
                }

                foreach (var sf in supportedfiles)
                {
                    var name     = Path.GetFileName(sf);
                    var nodename = name.ToLower().Contains(".ogg") ? name : "[convert] " + name;
                    var node     = Songs.AddNode(nodename);
                    node.UserData = name;
                    if (name == Settings.Local.CurrentSong?.Location)
                    {
                        node.IsSelected = true;
                    }
                }
            }
            Songs.SelectionChanged += (snd, ev) =>
            {
                var tc   = (TreeControl)this.FindChildByName("songtv", true);
                var list = (List <TreeNode>)tc.SelectedChildren;
                if (list.Count == 1)
                {
                    Settings.Local.CurrentSong.Location = (string)list[0].UserData;
                }
            };
            this.IsHiddenChanged += (o, e) =>
            {
                if (!this.IsHidden)
                {
                    return;
                }
                if (Settings.Local.EnableSong)
                {
                    var fn = Program.UserDirectory + "Songs" +
                             Path.DirectorySeparatorChar +
                             Settings.Local.CurrentSong.Location;
                    if (File.Exists(fn))
                    {
                        game.Loading = true;
                        AudioService.LoadFile(ref fn);
                        game.Loading = false;
                    }
                }
                try
                {
                    var svolume =
                        (HorizontalSlider)this.FindChildByName("volume", true);
                    Settings.Volume = svolume.Value;
                    Settings.Save();
                }
                catch
                {
                    // ignored
                }
            };
            var container = new ControlBase(gb);

            container.Dock   = Pos.Bottom;
            container.Height = 20;
            var offset = new NumericUpDown(container);

            offset.ValueChanged += (snd, ev) => { Settings.Local.CurrentSong.Offset = offset.Value; };
            offset.Min           = 0;
            offset.Max           = 10000;
            offset.Value         = Settings.Local.CurrentSong.Offset;
            offset.Dock          = Pos.Right;
            var label = new Label(container);

            label.Dock = Pos.Left;
            label.Text = "Offset (secs)";
            gb.Height  = 150;
            var container2 = new ControlBase(this);

            container2.Dock   = Pos.Bottom;
            container2.Height = 40;
            label             = new Label(container2);
            label.Margin      = new Margin()
            {
                Top = 13
            };
            label.Dock = Pos.Left;
            label.Text = "Volume:";
            var volume = new HorizontalSlider(container2);

            volume.Min = 0;
            volume.Max = 100;
            if (Settings.Volume > 100)
            {
                Settings.Volume = 100;
            }
            if (Settings.Volume < 0)
            {
                Settings.Volume = 0;
            }
            volume.Value                = Settings.Volume;
            volume.Name                 = "volume";
            volume.SnapToNotches        = false;
            volume.KeyboardInputEnabled = false;
            volume.Width                = 150;
            volume.Dock                 = Pos.Right;
            Label l = new Label(this);

            l.Dock      = Pos.Bottom;
            l.Margin    = new Margin(0, 10, 0, 0);
            l.Text      = "Files in Documents/LRA/Songs";
            game.Cursor = game.Cursors["default"];
        }
Example #18
0
 /// <summary>
 /// Places the control to the right of other control (bottom aligned), taking margins into account.
 /// </summary>
 /// <param name="control">Control to place.</param>
 /// <param name="anchor">Anchor control.</param>
 /// <param name="spacing">Optional spacing.</param>
 public static void PlaceRightBottom(Controls.ControlBase control, Controls.ControlBase anchor, int spacing = 0)
 {
     control.SetPosition(anchor.Right + anchor.Margin.Right + spacing + control.Margin.Right, anchor.Y - control.Height + anchor.Height + control.Margin.Top);
 }
Example #19
0
 /// <summary>
 /// Places the control below other control (left aligned), taking margins into account.
 /// </summary>
 /// <param name="control">Control to place.</param>
 /// <param name="anchor">Anchor control.</param>
 /// <param name="spacing">Optional spacing.</param>
 public static void PlaceDownLeft(Controls.ControlBase control, Controls.ControlBase anchor, int spacing = 0)
 {
     control.SetPosition(anchor.X + control.Margin.Left, anchor.Bottom + anchor.Margin.Bottom + spacing + control.Margin.Top);
 }
 /// <summary>
 /// Disables tooltip display for the specified control.
 /// </summary>
 /// <param name="control">Target control.</param>
 public static void ControlDeleted(Controls.ControlBase control)
 {
     Disable(control);
 }
Example #21
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();
        }
Example #22
0
        public LoadWindow(Gwen.Controls.ControlBase parent, MainWindow glgame) : base(parent, DefaultTitle)
        {
            game = glgame;
            game.Track.Stop();
            MakeModal(true);
            var tv = new TreeControl(this);

            tv.Margin = Margin.One;
            tv.Name   = "loadtree";
            var files = Program.UserDirectory + "Tracks";

            if (Directory.Exists(files))
            {
                var solfiles = Directory.GetFiles(files, "*.*")
                               .Where(s => s != null && s.EndsWith(".sol", StringComparison.OrdinalIgnoreCase));
                foreach (var sol in solfiles)
                {
                    AddTrack(tv, sol, null);
                }
            }
            if (Directory.Exists(files))
            {
                var trkfiles = TrackIO.EnumerateTrackFiles(files);
                foreach (var trk in trkfiles)
                {
                    AddTrack(tv, trk, null);
                }

                var folders = Directory.GetDirectories(files);
                foreach (var folder in folders)
                {
                    var trackfiles = TrackIO.EnumerateTrackFiles(folder);

                    AddTrack(tv, folder, trackfiles);
                }
            }
            tv.SelectionChanged += treeview_SelectionChanged;
            var container = new ControlBase(this);

            container.Height = 30;
            container.Dock   = Pos.Bottom;

            this.Width       = 400;
            this.Height      = 400;
            this.MinimumSize = new System.Drawing.Point(this.Width, this.Height);

            //     wc.DisableResizing();
            tv.Dock = Pos.Fill;
            var btn = new Button(container);

            btn.Margin   = new Margin(0, 5, 0, 5);
            btn.Dock     = Pos.Left;
            btn.Height   = 20;
            btn.Width    = 150;
            btn.Text     = "Load";
            btn.Clicked += loadbtn_Clicked;
            var btndelete = new Button(container);

            btndelete.Margin   = btn.Margin;
            btndelete.Dock     = Pos.Right;
            btndelete.Height   = 20;
            btndelete.Width    = 50;
            btndelete.Text     = "Delete";
            btndelete.Clicked += btndelete_Clicked;

            game.Cursor = game.Cursors["default"];
        }
Example #23
0
 protected virtual void HBarMoved(ControlBase control, EventArgs args)
 {
     Invalidate();
 }
        public SaveWindow(Gwen.Controls.ControlBase parent, MainWindow glgame) : base(parent, "Save Track")
        {
            game = glgame;
            game.Track.Stop();
            MakeModal(true);
            Label l = new Label(this);

            l.Text = "Tracks are saved to\r\nDocuments/LRA/Tracks";

            var bottom = new PropertyBase(this)
            {
                Name = "bottom", Margin = new Margin(0, 10, 0, 5), Height = 30
            };
            var cb = new ComboBox(this);

            cb.ItemSelected += (o, e) =>
            {
                var snd = ((ComboBox)o);
                var txt = snd.SelectedItem.Text;
                this.UserData = txt;
            };
            var tb = new TextBox(bottom)
            {
                Name = "tb"
            };

            tb.Dock     = Pos.Left;
            bottom.Dock = Pos.Bottom;
            cb.Dock     = Pos.Bottom;
            cb.Margin   = new Margin(0, 0, 0, 0);
            this.Width  = 200;
            this.Height = 130;
            var dir = Program.UserDirectory + "Tracks";

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            var folders = Directory.GetDirectories(Program.UserDirectory + "Tracks");

            cb.AddItem("<create new track>"); //< used as it cant be used as a file character
            cb.SelectByText("<create new track>");
            foreach (var folder in folders)
            {
                var trackname = Path.GetFileName(folder);
                if (trackname != Utils.Constants.DefaultTrackName)
                {
                    cb.AddItem(trackname);
                }
            }
            cb.SelectByText(game.Track.Name);
            var btn = new Button(bottom)
            {
                Name = "savebtn"
            };

            btn.Width    = 50;
            btn.Text     = "Save";
            btn.Dock     = Pos.Right;
            btn.Clicked += savebtn_Clicked;
            DisableResizing();
            game.Cursor = game.Cursors["default"];
        }
Example #25
0
 public TabPage(ControlBase parent, TabButton button) : base(parent)
 {
     m_ParentButton = button;
 }