private void CreateAdvancedTab(TabControl tcontainer) { var container = tcontainer.AddPage("Advanced").Page; PropertyTree tree = new PropertyTree(container); var pt = tree.Add("Advanced"); tree.ExpandAll(); tree.Dock = Pos.Top; var zoom = CreateEditableNumber("Zoom", game.Track.Zoom.ToString(), pt); zoom.MinValue = 0.1; zoom.MaxValue = 200; zoom.ValueChanged += (o, e) => { if (!double.IsNaN(zoom.NumValue)) { game.Zoom((float)zoom.NumValue - game.Track.Zoom); } }; tree.Dock = Pos.Fill; var mar = tree.Margin; mar.Right = 100; tree.Margin = mar; pt.SplitWidth = 200; Button btn = new Button(container); btn.Width = 100; btn.Height = 20; Align.AlignBottom(btn); Align.AlignRight(btn); }
private void Setup() { Dictionary <string, bool> trackfeatures; using (var trk = _editor.CreateTrackReader()) { trackfeatures = trk.GetFeatures(); } TabControl tabs = new TabControl(this) { Dock = Dock.Fill }; var settings = tabs.AddPage("Settings"); var song = tabs.AddPage("Song"); _tree = new PropertyTree(settings) { Dock = Dock.Fill, }; var table = _tree.Add("Settings", 150); NumberProperty startzoom = new NumberProperty(null) { Min = 1, NumberValue = _editor.StartZoom, Max = Constants.MaxZoom, }; startzoom.ValueChanged += (o, e) => { _editor.StartZoom = (float)startzoom.NumberValue; }; table.Add("Start Zoom", startzoom); var zerostart = GwenHelper.AddPropertyCheckbox(table, "Zero Start", _editor.ZeroStart); zerostart.ValueChanged += (o, e) => { _editor.ZeroStart = zerostart.IsChecked; }; table = _tree.Add("Info", 150); // var trackname = table.AddLabel("Track Name", _editor.Name); var physics = table.AddLabel("Physics", CheckFeature(trackfeatures, TrackFeatures.six_one) ? "6.1" : "6.2"); table.AddLabel("Blue Lines", _editor.BlueLines.ToString()); table.AddLabel("Red Lines", _editor.RedLines.ToString()); table.AddLabel("Scenery Lines", _editor.GreenLines.ToString()); table = _tree.Add("Features Used", 150); AddFeature(table, trackfeatures, "Red Multiplier", TrackFeatures.redmultiplier); AddFeature(table, trackfeatures, "Scenery Width", TrackFeatures.scenerywidth); AddFeature(table, trackfeatures, "Line Triggers", TrackFeatures.ignorable_trigger); PopulateSong(song); _tree.ExpandAll(); // table.Add }
public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { var entity = (sender as Func <object>)() as Entity; if (entity != null) { var comps = entity.GetAllComponents(); ptree.RemoveAll(); var prop = ptree.Add("Transform"); prop.Add("Position:", new Gwen.Control.Property.Vector3(prop), entity.Position).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Position = tmpObj.Value; }; prop.Add("Rotation:", new Gwen.Control.Property.Vector3(prop), entity.Rotation).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Rotation = tmpObj.Value; }; prop.Add("Scale:", new Gwen.Control.Property.Vector3(prop), entity.Scale).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Scale = tmpObj.Value; }; foreach (var component in comps) { prop = ptree.Add(component.GetType().Name); var inspector = new DefaultInspector(); inspector.properties = prop; inspector.getTarget = () => component; inspector.OnInitializeGUI(); } ptree.Show(); ptree.SetBounds(0, 25, 200, 200); ptree.ExpandAll(); tagStrip.Show(); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); }; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); { Properties props = new Properties(this); props.ValueChanged += OnChanged; props.SetBounds(10, 10, 150, 300); { { //NoNeed PropertyRow pRow = props.Add("First Name"); } props.Add("Middle Name"); props.Add("Last Name"); } } { PropertyTree ptree = new PropertyTree(this); ptree.SetBounds(200, 10, 200, 200); { Properties props = ptree.Add("Item One"); props.ValueChanged += OnChanged; props.Add("Middle Name"); props.Add("Last Name"); props.Add("Four"); } { Properties props = ptree.Add("Item Two"); props.ValueChanged += OnChanged; props.Add("More Items"); props.Add("Bacon", new Alt.GUI.Temporary.Gwen.Control.Property.Check(props), "1"); props.Add("To Fill"); props.Add("Colour", new Alt.GUI.Temporary.Gwen.Control.Property.Color(props), "255 0 0"); props.Add("Out Here"); } ptree.ExpandAll(); } }
public PropertiesTest(ControlBase parent) : base(parent) { { Properties props = new Properties(this); props.Dock = Dock.Top; props.Width = 300; props.ValueChanged += OnChanged; { { PropertyRow pRow = props.Add("First Name"); } props.Add("Middle Name"); props.Add("Last Name"); } } { PropertyTree ptree = new PropertyTree(this); ptree.Dock = Dock.Top; ptree.Width = 300; ptree.AutoSizeToContent = true; { Properties props = ptree.Add("Item One"); props.ValueChanged += OnChanged; props.Add("Middle Name"); props.Add("Last Name"); props.Add("Four"); } { Properties props = ptree.Add("Item Two"); props.ValueChanged += OnChanged; props.Add("More Items"); props.Add("Bacon", new CheckProperty(props), "1"); props.Add("To Fill"); props.Add("Color", new ColorProperty(props), "255 0 0"); props.Add("Out Here"); } ptree.ExpandAll(); } }
public LineWindow(GameCanvas parent, Editor editor, GameLine line) : base(parent, editor) { _ownerline = line; _linecopy = _ownerline.Clone(); Title = "Line Properties"; Padding = new Padding(0, 0, 0, 0); AutoSizeToContents = true; _proptree = new PropertyTree(this) { Width = 220, Height = 200 }; _proptree.Dock = Dock.Top; MakeModal(true); Setup(); _proptree.ExpandAll(); }
public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { Console.WriteLine("SelectionChange"); ptree.RemoveAll(); if (sender is Entity entity) { RenderComponents(entity); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); tagStrip.Show(); ptree.Show(); ptree.SetBounds(0, 25, panel.Width, 200); ptree.ExpandAll(); }; Selection.OnSelectionDirty += (sender, args) => { if (sender is Entity entity) { RenderComponents(entity); } }; }
private void CreateAboutTab(TabControl tcontainer) { var container = tcontainer.AddPage("About").Page; PropertyTree tree = new PropertyTree(container); var pt = tree.Add("Keys (uneditable)"); tree.ExpandAll(); tree.Dock = Pos.Top; pt.Add("Pencil Tool", CreateUneditable(pt), "Q"); pt.Add("Line Tool", CreateUneditable(pt), "W"); pt.Add("Eraser Tool", CreateUneditable(pt), "E"); pt.Add("Line Adjust Tool", CreateUneditable(pt), "R"); pt.Add("Select Hand Tool", CreateUneditable(pt), "T"); pt.Add("Hand Tool", CreateUneditable(pt), "Space"); pt.Add("Move Rider", CreateUneditable(pt), "D").SetToolTipText("Hold D and click the rider to move him"); pt.Add("Start Track", CreateUneditable(pt), "Y"); pt.Add("Stop Track", CreateUneditable(pt), "U"); pt.Add("Play before flag (w/scrubbing)", CreateUneditable(pt), "Shift+I"); pt.Add("Play ignoring flag", CreateUneditable(pt), "ALT+Y"); pt.Add("Slowmo Playback", CreateUneditable(pt), "Shift+Y"); pt.Add("Open Preferences", CreateUneditable(pt), "ESC, CTRL+P"); pt.Add("Save Track", CreateUneditable(pt), "CTRL+S"); pt.Add("Load Track", CreateUneditable(pt), "O"); pt.Add("Blue Color", CreateUneditable(pt), "1").SetToolTipText("Set tool color to blue"); pt.Add("Red Color", CreateUneditable(pt), "2").SetToolTipText("Set tool color to red"); pt.Add("Green Color", CreateUneditable(pt), "3").SetToolTipText("Set tool color to green"); pt.Add("Disable Line Snap", CreateUneditable(pt), "S").SetToolTipText("Disables line snapping while pressed"); pt.Add("15° Line Snap", CreateUneditable(pt), "X").SetToolTipText("Snap lines to the nearest 15 degree angle"); pt.Add("Move to First Line", CreateUneditable(pt), "HOME"); pt.Add("Move to Last Line", CreateUneditable(pt), "END"); pt.Add("Toggle Tool Settings", CreateUneditable(pt), "TAB").SetToolTipText("Shift between current line settings, \r\nlike the red line multiplier if it's the selected line type."); pt.Add("(Line tool) Flip Line", CreateUneditable(pt), "Shift").SetToolTipText("Flips line while using the line tool"); pt.Add("(Adjust tool) Lock Angle", CreateUneditable(pt), "Shift").SetToolTipText("Locks the angle of the selected line\r\nwith the line adjust tool"); pt.Add("(Adjust tool) Move Whole Line", CreateUneditable(pt), "CTRL"); pt.Add("(Adjust tool) Move Line On Axis", CreateUneditable(pt), "(CTRL)+Shift"); pt.Add("(Adjust tool) Move Line Up/Down", CreateUneditable(pt), "(CTRL)+Shift+X"); pt.Add("(Adjust tool) Lock Length", CreateUneditable(pt), "L"); pt.Add("(Adjust tool) Lifelock", CreateUneditable(pt), "ALT").SetToolTipText("While pressed, move a line until \r\nit no longer kills bosh in that frame"); pt.Add("Focus Start Point", CreateUneditable(pt), "F1"); pt.Add("Focus on Flag", CreateUneditable(pt), "F2"); pt.Add("Calculate Flag", CreateUneditable(pt), "Right Click Flag Icon").SetToolTipText("Right click the flag icon to calculate the validity of a flag"); pt.Add("(playback) Pause/Resume", CreateUneditable(pt), "Space"); pt.Add("(playback) Flag", CreateUneditable(pt), "I"); pt.Add("(playback) Zoom In", CreateUneditable(pt), "Z"); pt.Add("(playback) Zoom Out", CreateUneditable(pt), "X"); pt.Add("(playback) Slow Playback", CreateUneditable(pt), "-"); pt.Add("(playback) Speed Playback", CreateUneditable(pt), "+"); pt.Add("(playback) Frame Left", CreateUneditable(pt), "Left"); pt.Add("(playback) Frame Right", CreateUneditable(pt), "Right"); pt.Add("(playback) (hold) Rewind", CreateUneditable(pt), "Shift+Left"); pt.Add("(playback) (hold) Playback", CreateUneditable(pt), "Shift+Right"); pt.Add("(playback) Iterations Left", CreateUneditable(pt), "Alt+Left"); pt.Add("(playback) Iterations Right", CreateUneditable(pt), "Alt+Right"); tree.Dock = Pos.Fill; pt.SplitWidth = 200; }
private void Setup() { var lines = _kbtree.Add("Lines", 150); AddBinding(lines, "Configurable Toggle", Hotkey.ToggleAll); AddBinding(lines, "Scenery Set x0.1", Hotkey.ScenerySetSmall); AddBinding(lines, "Scenery Increase x0.1", Hotkey.SceneryIncreaseBig); AddBinding(lines, "Scenery Decrease x0.1", Hotkey.SceneryDecreaseBig); AddBinding(lines, "Acceleration Set x1", Hotkey.AccelerationSetSmall); AddBinding(lines, "Acceleration Set x100", Hotkey.AccelerationSetMedium); AddBinding(lines, "Acceleration Set x200", Hotkey.AccelerationSetLarge); AddBinding(lines, "Acceleration Set x255", Hotkey.AccelerationSetMax); var editortable = _kbtree.Add("Editor", 150); AddBinding(editortable, "Pencil Tool", Hotkey.EditorPencilTool); AddBinding(editortable, "Line Tool", Hotkey.EditorLineTool); AddBinding(editortable, "Eraser", Hotkey.EditorEraserTool); AddBinding(editortable, "Select Tool", Hotkey.EditorSelectTool); AddBinding(editortable, "Hand Tool", Hotkey.EditorPanTool); AddBinding(editortable, "Quick Pan", Hotkey.EditorQuickPan); AddBinding(editortable, "Drag Canvas", Hotkey.EditorDragCanvas); AddBinding(editortable, "Move Start Point", Hotkey.EditorMoveStart, "Hold and click the rider to move him"); AddBinding(editortable, "Swatch Color Blue", Hotkey.EditorToolColor1); AddBinding(editortable, "Swatch Color Red", Hotkey.EditorToolColor2); AddBinding(editortable, "Swatch Color Green", Hotkey.EditorToolColor3); AddBinding(editortable, "Cycle Tool Setting", Hotkey.EditorCycleToolSetting); AddBinding(editortable, "Toggle Onion Skinning", Hotkey.PreferenceOnionSkinning); AddBinding(editortable, "Focus on Rider", Hotkey.EditorFocusRider); AddBinding(editortable, "Focus on Flag", Hotkey.EditorFocusFlag); AddBinding(editortable, "Focus First Line", Hotkey.EditorFocusStart); AddBinding(editortable, "Focus Last Line", Hotkey.EditorFocusLastLine); AddBinding(editortable, "Remove Newest Line", Hotkey.EditorRemoveLatestLine); AddBinding(editortable, "Toggle Track Overlay", Hotkey.ToolToggleOverlay); var tool = _kbtree.Add("Tool", 150); AddBinding(tool, "Toggle Configured", Hotkey.ToggleAll); AddBinding(tool, "15° Line Snap", Hotkey.ToolXYSnap); AddBinding(tool, "Toggle Line Snap", Hotkey.ToolToggleSnap); AddBinding(tool, "Flip Line", Hotkey.LineToolFlipLine, "Hold before drawing a new line"); var selecttool = _kbtree.Add("Select Tool", 150); AddBinding(selecttool, "Lock Angle", Hotkey.ToolAngleLock); AddBinding(selecttool, "Move Whole Line", Hotkey.ToolSelectBothJoints); AddBinding(selecttool, "Life Lock", Hotkey.ToolLifeLock, "While pressed moving the line will stop if the rider survives"); AddBinding(selecttool, "Move Along Axis", Hotkey.ToolAxisLock, "If you're moving a whole line,\nuse this to keep it on the same plane"); AddBinding(selecttool, "Move Along Right angle", Hotkey.ToolPerpendicularAxisLock, "If you're moving a whole line,\nuse this to keep perpendicular to its plane"); AddBinding(selecttool, "Lock Length", Hotkey.ToolLengthLock); AddBinding(selecttool, "Copy Selection", Hotkey.ToolCopy); AddBinding(selecttool, "Cut", Hotkey.ToolCut); AddBinding(selecttool, "Paste", Hotkey.ToolPaste); AddBinding(selecttool, "Delete Selection", Hotkey.ToolDelete); var pbtable = _kbtree.Add("Playback", 150); AddBinding(pbtable, "Toggle Flag", Hotkey.PlaybackFlag); AddBinding(pbtable, "Reset Camera", Hotkey.PlaybackResetCamera); AddBinding(pbtable, "Start Track", Hotkey.PlaybackStart); AddBinding(pbtable, "Start Track before Flag", Hotkey.PlaybackStartIgnoreFlag); AddBinding(pbtable, "Start Track in Slowmo", Hotkey.PlaybackStartSlowmo); AddBinding(pbtable, "Stop Track", Hotkey.PlaybackStop); AddBinding(pbtable, "Toggle Pause", Hotkey.PlaybackTogglePause); AddBinding(pbtable, "Frame Next", Hotkey.PlaybackFrameNext); AddBinding(pbtable, "Frame Previous", Hotkey.PlaybackFramePrev); AddBinding(pbtable, "Iteration Next", Hotkey.PlaybackIterationNext); AddBinding(pbtable, "Iteration Previous", Hotkey.PlaybackIterationPrev); AddBinding(pbtable, "Hold -- Forward", Hotkey.PlaybackForward); AddBinding(pbtable, "Hold -- Rewind", Hotkey.PlaybackBackward); AddBinding(pbtable, "Increase Playback Rate", Hotkey.PlaybackSpeedUp); AddBinding(pbtable, "Decrease Playback Rate", Hotkey.PlaybackSpeedDown); AddBinding(pbtable, "Toggle Slowmo", Hotkey.PlaybackSlowmo); AddBinding(pbtable, "Zoom In", Hotkey.PlaybackZoom); AddBinding(pbtable, "Zoom Out", Hotkey.PlaybackUnzoom); AddBinding(pbtable, "Play Button - Ignore Flag", Hotkey.PlayButtonIgnoreFlag); var misctable = _kbtree.Add("Misc", 150); AddBinding(misctable, "Quicksave", Hotkey.Quicksave); AddBinding(misctable, "Open Preferences", Hotkey.PreferencesWindow); AddBinding(misctable, "Open Game Menu", Hotkey.GameMenuWindow); AddBinding(misctable, "Open Track Properties", Hotkey.TrackPropertiesWindow); AddBinding(misctable, "Load Track", Hotkey.LoadWindow); _kbtree.ExpandAll(); }
private void Setup() { Dictionary <string, bool> trackfeatures; using (var trk = _editor.CreateTrackReader()) { trackfeatures = trk.GetFeatures(); } TabControl tabs = new TabControl(this) { Dock = Dock.Fill }; var settings = tabs.AddPage("Settings"); var song = tabs.AddPage("Song"); _tree = new PropertyTree(settings) { Dock = Dock.Fill, }; var table = _tree.Add("Settings", 150); NumberProperty startzoom = new NumberProperty(null) { Min = 1, NumberValue = _editor.StartZoom, Max = Constants.MaxZoom, }; startzoom.ValueChanged += (o, e) => { _editor.StartZoom = (float)startzoom.NumberValue; }; table.Add("Start Zoom", startzoom); var zerostart = GwenHelper.AddPropertyCheckbox(table, "Zero Start", _editor.ZeroStart); zerostart.ValueChanged += (o, e) => { _editor.ZeroStart = zerostart.IsChecked; }; NumberProperty ygravity = new NumberProperty(null) { Min = float.MinValue + 1, Max = float.MaxValue - 1, }; ygravity.Value = ((float)_editor.YGravity).ToString(); ygravity.ValueChanged += (o, e) => { _editor.YGravity = float.Parse(ygravity.Value); }; table.Add("Y Gravity Multiplier", ygravity); NumberProperty xgravity = new NumberProperty(null) { Min = float.MinValue + 1, Max = float.MaxValue - 1, }; xgravity.Value = ((float)_editor.XGravity).ToString(); xgravity.ValueChanged += (o, e) => { _editor.XGravity = float.Parse(xgravity.Value); }; table.Add("X Gravity Multiplier", xgravity); NumberProperty gravitywellsize = new NumberProperty(null) { Min = 0, Max = double.MaxValue - 1, }; gravitywellsize.Value = ((double)_editor.GravityWellSize).ToString(); gravitywellsize.ValueChanged += (o, e) => { _editor.GravityWellSize = double.Parse(gravitywellsize.Value); }; table.Add("Gravity Well Size", gravitywellsize); //BG COLORS table = _tree.Add("Starting Background Color", 150); NumberProperty startbgred = new NumberProperty(null) { Min = 0, Max = 255 }; startbgred.Value = _editor.StartingBGColorR.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startbgred.ValueChanged += (o, e) => { _editor.StartingBGColorR = int.Parse(startbgred.Value); }; table.Add("Background Red", startbgred); NumberProperty startbggreen = new NumberProperty(null) { Min = 0, Max = 255 }; startbggreen.Value = _editor.StartingBGColorG.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startbggreen.ValueChanged += (o, e) => { _editor.StartingBGColorG = int.Parse(startbggreen.Value); }; table.Add("Background Green", startbggreen); NumberProperty startbgblue = new NumberProperty(null) { Min = 0, Max = 255 }; startbgblue.Value = _editor.StartingBGColorB.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startbgblue.ValueChanged += (o, e) => { _editor.StartingBGColorB = int.Parse(startbgblue.Value); }; table.Add("Background Blue", startbgblue); //LINE COLORS table = _tree.Add("Starting Line Color", 150); NumberProperty startlinered = new NumberProperty(null) { Min = 0, Max = 255 }; startlinered.Value = _editor.StartingLineColorR.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startlinered.ValueChanged += (o, e) => { _editor.StartingLineColorR = int.Parse(startlinered.Value); }; table.Add("Line Red", startlinered); NumberProperty startlinegreen = new NumberProperty(null) { Min = 0, Max = 255 }; startlinegreen.Value = _editor.StartingLineColorG.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startlinegreen.ValueChanged += (o, e) => { _editor.StartingLineColorG = int.Parse(startlinegreen.Value); }; table.Add("Line Green", startlinegreen); NumberProperty startlineblue = new NumberProperty(null) { Min = 0, Max = 255 }; startlineblue.Value = _editor.StartingLineColorB.ToString(); //Put value out here because putting it in the number property makes it get set to 100 for some reason??? startlineblue.ValueChanged += (o, e) => { _editor.StartingLineColorB = int.Parse(startlineblue.Value); }; table.Add("Line Blue", startlineblue); table = _tree.Add("Info", 150); // var trackname = table.AddLabel("Track Name", _editor.Name); var physics = table.AddLabel("Physics", CheckFeature(trackfeatures, TrackFeatures.six_one) ? "6.1" : "6.2"); table.AddLabel("Blue Lines", _editor.BlueLines.ToString()); table.AddLabel("Red Lines", _editor.RedLines.ToString()); table.AddLabel("Scenery Lines", _editor.GreenLines.ToString()); table = _tree.Add("Features Used", 150); AddFeature(table, trackfeatures, "Red Multiplier", TrackFeatures.redmultiplier); AddFeature(table, trackfeatures, "Scenery Width", TrackFeatures.scenerywidth); AddFeature(table, trackfeatures, "Line Triggers", TrackFeatures.ignorable_trigger); table = _tree.Add("Physics Modifiers", 150); var remount = GwenHelper.AddPropertyCheckbox(table, "Remount", _editor.UseRemount); remount.ValueChanged += (o, e) => { _editor.UseRemount = remount.IsChecked; }; PopulateSong(song); _tree.ExpandAll(); // table.Add }
private void Setup() { Panel content = new Panel(this) { Dock = Dock.Fill, AutoSizeToContents = true, ShouldDrawBackground = false }; Panel bottomrow = new Panel(content) { Dock = Dock.Bottom, AutoSizeToContents = true, ShouldDrawBackground = false, }; PropertyTree proptree = new PropertyTree(content) { Dock = Dock.Top, AutoSizeToContents = true, Width = 200, Margin = new Margin(0, 0, 0, 10) }; var table = proptree.Add("Output Settings", 150); var qualitycb = new ComboBoxProperty(table); qualitycb.AddItem("720p"); qualitycb.AddItem("1080p"); table.Add("Quality", qualitycb); var smoothcheck = AddPropertyCheckbox( table, "Smooth Playback", Settings.RecordSmooth); var music = AddPropertyCheckbox( table, "Save Music", !Settings.MuteAudio && Settings.RecordMusic); if (Settings.MuteAudio) { music.Disable(); } table = proptree.Add("Overlay settings", 150); var ppf = AddPropertyCheckbox( table, "Show P/f", Settings.Recording.ShowPpf); var fps = AddPropertyCheckbox( table, "Show FPS", Settings.Recording.ShowFps); var tools = AddPropertyCheckbox( table, "Show Tools", Settings.Recording.ShowTools); proptree.ExpandAll(); Button Cancel = new Button(bottomrow) { Dock = Dock.Right, Text = "Cancel", Margin = new Margin(10, 0, 0, 0), }; Cancel.Clicked += (o, e) => { Close(); }; Button ok = new Button(bottomrow) { Dock = Dock.Right, Text = "Save" }; if (!SafeFrameBuffer.CanRecord || !CheckRecord()) { ok.Disable(); } ok.Clicked += (o, e) => { Close(); Settings.Recording.ShowPpf = ppf.IsChecked; Settings.Recording.ShowFps = fps.IsChecked; Settings.Recording.ShowTools = tools.IsChecked; Settings.Record1080p = qualitycb.SelectedItem.Text == "1080p"; Settings.RecordSmooth = smoothcheck.IsChecked; if (!music.IsDisabled) { Settings.RecordMusic = music.IsChecked; } Settings.Save(); Record(); }; }
private void Setup() { Panel content = new Panel(this) { Dock = Dock.Fill, AutoSizeToContents = true, ShouldDrawBackground = false }; Panel bottomrow = new Panel(content) { Dock = Dock.Bottom, AutoSizeToContents = true, ShouldDrawBackground = false, }; PropertyTree proptree = new PropertyTree(content) { Dock = Dock.Top, AutoSizeToContents = true, Width = 200, Margin = new Margin(0, 0, 0, 10) }; var table = proptree.Add("Output Settings", 150); var lockratiocheck = AddPropertyCheckbox( table, "Lock Aspect Ratio", lockRatio); lockratiocheck.ValueChanged += (o, e) => { lockRatio = lockratiocheck.IsChecked; if (lockRatio) { lockW = Settings.ScreenshotWidth; lockH = Settings.ScreenshotHeight; } }; var width = new NumberProperty(null) { Min = 1, Max = 50000, NumberValue = Settings.ScreenshotWidth, OnlyWholeNumbers = true }; var height = new NumberProperty(null) { Min = 1, Max = 50000, NumberValue = Settings.ScreenshotHeight, OnlyWholeNumbers = true }; table.Add("Width", width); table.Add("Height", height); width.ValueChanged += (o, e) => { Settings.ScreenshotWidth = (int)width.NumberValue; if (lockRatio) { lockRatio = false; //Setting this to false prevents the height value trying to update the width value again height.NumberValue = Settings.ScreenshotWidth * lockH / lockW; lockRatio = true; } }; height.ValueChanged += (o, e) => { Settings.ScreenshotHeight = (int)height.NumberValue; if (lockRatio) { lockRatio = false; width.NumberValue = Settings.ScreenshotHeight * lockW / lockH; lockRatio = true; } }; table = proptree.Add("Overlay settings", 150); var ppf = AddPropertyCheckbox( table, "Show P/f", Settings.Recording.ShowPpf); var fps = AddPropertyCheckbox( table, "Show FPS", Settings.Recording.ShowFps); var tools = AddPropertyCheckbox( table, "Show Tools", Settings.Recording.ShowTools); var hitTest = AddPropertyCheckbox( table, "Show Hit Test", Settings.Editor.HitTest); var resIndZoom = AddPropertyCheckbox( table, "Res-Independent Zoom", Settings.Recording.ResIndZoom); proptree.ExpandAll(); Button Cancel = new Button(bottomrow) { Dock = Dock.Right, Text = "Cancel", Margin = new Margin(10, 0, 0, 0), }; Cancel.Clicked += (o, e) => { Close(); }; Button ok = new Button(bottomrow) { Dock = Dock.Right, Text = "Export" }; ok.Clicked += (o, e) => { Close(); Settings.Recording.ShowPpf = ppf.IsChecked; Settings.Recording.ShowFps = fps.IsChecked; Settings.Recording.ShowTools = tools.IsChecked; Settings.Recording.ResIndZoom = resIndZoom.IsChecked; Settings.Recording.ShowHitTest = hitTest.IsChecked; Settings.Save(); Record(); }; }
private void Setup() { Panel content = new Panel(this) { Dock = Dock.Fill, AutoSizeToContents = true, ShouldDrawBackground = false }; Panel bottomrow = new Panel(content) { Dock = Dock.Bottom, AutoSizeToContents = true, ShouldDrawBackground = false, }; PropertyTree proptree = new PropertyTree(content) { Dock = Dock.Top, AutoSizeToContents = true, Width = 200, Margin = new Margin(0, 0, 0, 10) }; var table = proptree.Add("Output Settings", 150); var qualitycb = new ComboBoxProperty(table); foreach (var item in resolutions) { qualitycb.AddItem(item.Key); } table.Add("Quality", qualitycb); var smoothcheck = AddPropertyCheckbox( table, "Smooth Playback", Settings.RecordSmooth); var music = AddPropertyCheckbox( table, "Save Music", !Settings.MuteAudio && Settings.RecordMusic); if (Settings.MuteAudio) { music.Disable(); } table = proptree.Add("Overlay settings", 150); var ppf = AddPropertyCheckbox( table, "Show P/f", Settings.Recording.ShowPpf); var fps = AddPropertyCheckbox( table, "Show FPS", Settings.Recording.ShowFps); var tools = AddPropertyCheckbox( table, "Show Tools", Settings.Recording.ShowTools); var hitTest = AddPropertyCheckbox( table, "Show Hit Test", Settings.Editor.HitTest); var colorTriggers = AddPropertyCheckbox( table, "Enable Color Triggers", Settings.Recording.EnableColorTriggers); var resIndZoom = AddPropertyCheckbox( table, "Res-Independent Zoom", Settings.Recording.ResIndZoom); proptree.ExpandAll(); Button Cancel = new Button(bottomrow) { Dock = Dock.Right, Text = "Cancel", Margin = new Margin(10, 0, 0, 0), }; Cancel.Clicked += (o, e) => { Close(); }; Button ok = new Button(bottomrow) { Dock = Dock.Right, Text = "Export" }; if (!SafeFrameBuffer.CanRecord || !CheckRecord()) { ok.Disable(); } ok.Clicked += (o, e) => { Close(); Settings.Recording.ShowPpf = ppf.IsChecked; Settings.Recording.ShowFps = fps.IsChecked; Settings.Recording.ShowTools = tools.IsChecked; Settings.Recording.EnableColorTriggers = colorTriggers.IsChecked; Settings.Recording.ResIndZoom = resIndZoom.IsChecked; Settings.Recording.ShowHitTest = hitTest.IsChecked; Settings.RecordSmooth = smoothcheck.IsChecked; if (!music.IsDisabled) { Settings.RecordMusic = music.IsChecked; } try { var size = resolutions[qualitycb.SelectedItem.Text]; Settings.RecordingWidth = size.Width; Settings.RecordingHeight = size.Height; } catch (KeyNotFoundException) { throw new Exception("Invalid resolution: " + qualitycb.SelectedItem.Text); } Settings.Save(); Record(); }; }