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(); } }
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 SetupLineRightClickOptions(PropertyTree tree) { var vec = _ownerline.GetVector(); var len = vec.Length; var angle = Angle.FromVector(vec); angle.Degrees += 90; var lineProp = tree.Add("Line Properties", 120); if (_ownerline.Type != LineType.Scenery) { var id = new NumberProperty(lineProp) { Min = 0, Max = int.MaxValue - 1, NumberValue = _ownerline.ID, OnlyWholeNumbers = true, IsDisabled = true }; id.ValueChanged += (o, e) => { ChangeID((int)id.NumberValue); //TODO: Add the ability to change line IDs }; lineProp.Add("ID", id); } length = new NumberProperty(lineProp) { Min = 0.0000001, Max = double.MaxValue - 1, NumberValue = len, }; length.ValueChanged += (o, e) => { ChangeLength(length.NumberValue); }; lineProp.Add("Length", length); angleProp = new NumberProperty(lineProp) { Min = double.MinValue, Max = double.MaxValue, NumberValue = angle.Degrees, }; angleProp.ValueChanged += (o, e) => { ChangeAngle(angleProp.NumberValue); }; lineProp.Add("Angle", angleProp); if (_ownerline.Type != LineType.Scenery) { SetupBlueAndRedOptions(tree); } else { SetupSceneryOptions(tree, lineProp); } }
private void SetupRedOptions(PropertyTree tree) { if (_ownerline is RedLine red) { var table = tree.Add("Acceleration", 120); var multiplier = new NumberProperty(table) { Min = 1, Max = 255, NumberValue = red.Multiplier, OnlyWholeNumbers = true, }; multiplier.ValueChanged += (o, e) => { ChangeMultiplier((int)multiplier.NumberValue); }; table.Add("Multiplier", multiplier); var multilines = new NumberProperty(table) { Min = 1, Max = 9999, OnlyWholeNumbers = true, }; multilines.NumberValue = GetMultiLines(true).Count; multilines.ValueChanged += (o, e) => { Multiline((int)multilines.NumberValue); }; table.Add("Multilines", multilines); var accelinverse = GwenHelper.AddPropertyCheckbox( table, "Inverse", red.inv ); accelinverse.ValueChanged += (o, e) => { using (var trk = _editor.CreateTrackWriter()) { var multi = GetMultiLines(false); foreach (var l in multi) { var cpy = (StandardLine)l.Clone(); cpy.Position = l.Position2; cpy.Position2 = l.Position; cpy.inv = accelinverse.IsChecked; UpdateLine(trk, l, cpy); } var owner = (StandardLine)_ownerline.Clone(); owner.Position = _ownerline.Position2; owner.Position2 = _ownerline.Position; owner.inv = accelinverse.IsChecked; UpdateOwnerLine(trk, owner); } }; } }
public PropertyTest(ControlBase parent) : base(parent) { PropertyTable table = new PropertyTable(parent); table.AutoSizeToContents = true; table.Width = 100; table.Height = 100; InitTable(table); PropertyTree tree = new PropertyTree(parent); tree.DrawDebugOutlines = false; tree.Height = 100; tree.Width = 200; tree.Y = 205; var t = tree.Add("Tree Test"); InitTable(t); t = tree.Add("Tree Test 2"); InitTable(t); InitTable(t); }
public TransformControl(ControlBase parent = null) : base(parent) { var tree = new PropertyTree(this); tree.Dock = Dock.Top; tree.Width = 300; tree.AutoSizeToContent = true; var transform = tree.Add("Transform"); _position = AddControl(transform, "Translation", UpdateTranslation); _rotation = AddControl(transform, "Rotation", UpdateRotation); _scale = AddControl(transform, "Scale", UpdateScale); }
private void SetupRedOptions(PropertyTree tree) { var vec = _ownerline.GetVector(); var len = vec.Length; var angle = Angle.FromVector(vec); angle.Degrees += 90; var lineProp = tree.Add("Line Properties", 120); Console.WriteLine(_ownerline.GetType().ToString()); if (!(_ownerline is SceneryLine scenery)) { var id = new NumberProperty(lineProp) { Min = 0, Max = int.MaxValue - 1, NumberValue = _ownerline.ID, OnlyWholeNumbers = true, }; id.ValueChanged += (o, e) => { ChangeID((int)id.NumberValue); }; lineProp.Add("ID", id); } _length = new NumberProperty(lineProp) { Min = 0.0000001, Max = double.MaxValue - 1, NumberValue = len, }; _length.ValueChanged += (o, e) => { ChangeLength(_length.NumberValue); }; lineProp.Add("Length", _length); _angleProp = new NumberProperty(lineProp) { Min = 0, Max = 360, NumberValue = angle.Degrees, }; _angleProp.ValueChanged += (o, e) => { ChangeAngle(_angleProp.NumberValue); }; lineProp.Add("Angle", _angleProp); if (!(_ownerline is SceneryLine)) { var multilines = new NumberProperty(lineProp) { Min = 1, Max = int.MaxValue - 1, OnlyWholeNumbers = true, }; multilines.NumberValue = GetMultiLines(true).Count; multilines.ValueChanged += (o, e) => { Multiline((int)multilines.NumberValue); }; lineProp.Add("Multilines", multilines); } if (_ownerline is SceneryLine sceneryLine) { _width = new NumberProperty(lineProp) { Min = 0.1, Max = 25.5, NumberValue = _ownerline.Width, }; _width.ValueChanged += (o, e) => { ChangeWidth(_width.NumberValue); }; lineProp.Add("Width", _width); } if (_ownerline is RedLine red) { var acceleration = tree.Add("Acceleration", 120); var multiplier = new NumberProperty(acceleration) { Min = 1, Max = 255, NumberValue = red.Multiplier, OnlyWholeNumbers = true, }; multiplier.ValueChanged += (o, e) => { ChangeMultiplier((int)multiplier.NumberValue); }; acceleration.Add("Multiplier", multiplier); var accelinverse = GwenHelper.AddPropertyCheckbox( acceleration, "Inverse", red.inv ); accelinverse.ValueChanged += (o, e) => { using (var trk = _editor.CreateTrackWriter()) { var multi = GetMultiLines(false); foreach (var l in multi) { var cpy = (StandardLine)l.Clone(); cpy.Position = l.Position2; cpy.Position2 = l.Position; cpy.inv = accelinverse.IsChecked; UpdateLine(trk, l, cpy); } var owner = (StandardLine)_ownerline.Clone(); owner.Position = _ownerline.Position2; owner.Position2 = _ownerline.Position; owner.inv = accelinverse.IsChecked; UpdateOwnerLine(trk, owner); } }; } }
public void Select(StandardLine line, Vector2d position) { if (selectionwindow != null) { if (selectionwindow.UserData != line) { selectionwindow.Close(); selectionwindow = null; } } if (selectionwindow == null) { selectionwindow = new WindowControl(game.Canvas, "Line Settings", false); selectionwindow.MakeModal(true); selectionwindow.UserData = line; selectionwindow.DeleteOnClose = true; selectionwindow.DisableResizing(); selectionwindow.Height = 170; selectionwindow.Width = 150; ControlBase container1 = new ControlBase(selectionwindow); container1.Dock = Gwen.Pos.Fill; if (line.GetLineType() != LineType.Scenery) { LabeledCheckBox btn = new LabeledCheckBox(container1); btn.Dock = Gwen.Pos.Top; btn.Text = "Inverse"; btn.IsChecked = line.inv; btn.CheckChanged += (o, e) => { var caller = (LabeledCheckBox)o; line.inv = caller.IsChecked; line.CalculateConstants(); game.Track.TrackUpdated(); game.Invalidate(); }; LineTrigger tr = (LineTrigger)line.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) => { 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); line.Trigger = tr; } else { tr.Zoomtrigger = false; if (!tr.Enabled) { line.Trigger = null; } } game.Track.LineChanged(line); }; 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.GetLineType() == LineType.Red) { selectionwindow.Height += 30; NoDecimalNUD nud = new NoDecimalNUD(container1); 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(container1); l.Y = 137; l.Text = "Multiplier"; selectionwindow.Height += 25; nud = new NoDecimalNUD(container1); 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; var lines = game.Track.GetLinesInRect(new FloatRect((Vector2)line.Position, new Vector2(1, 1)), false); List <Line> redlines = new List <Line>(); foreach (var red in lines) { if (red.Position == line.Position && red.Position2 == line.Position2) { redlines.Add(red); } } nud.Min = 1; nud.Max = 50; redlines.Sort(new Track.Linecomparer()); nud.Value = redlines.Count; nud.ValueChanged += (o, e) => { var diff = nud.Value - redlines.Count; if (diff < 0) { for (int i = 0; i > diff; i--) { game.Track.RemoveLine(redlines[(int)((redlines.Count - 1))]); redlines.RemoveAt(redlines.Count - 1); } } else { for (int i = 0; i < diff; i++) { var red = new RedLine(line.Position, line.Position2, line.inv) { Multiplier = ((RedLine)line).Multiplier }; game.Track.AddLine(red); redlines.Add(red); } } game.Track.TrackUpdated(); }; nud.UserData = line; l = new Label(container1); l.Y = 137 + 35; l.Text = "Multilines"; } selectionwindow.IsHiddenChanged += Selectionwindow_IsHiddenChanged; selectionwindow.Show(); selectionwindow.X = (int)position.X; selectionwindow.Y = (int)position.Y; game.Cursor = MouseCursor.Default; } }
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); 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(); }; }
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; }
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 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() { 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 SetupTriggers(PropertyTree tree) { if (_ownerline is StandardLine physline) { var table = tree.Add("Triggers", 120); var currenttrigger = physline.Trigger; var triggerenabled = GwenHelper.AddPropertyCheckbox( table, "Enabled", currenttrigger != null); var zoom = new NumberProperty(table) { Min = Constants.MinimumZoom, Max = Constants.MaxZoom, NumberValue = 4 }; table.Add("Target Zoom", zoom); var frames = new NumberProperty(table) { Min = 0, Max = 40 * 60 * 2,//2 minutes is enough for a zoom trigger, you crazy nuts. NumberValue = 40, OnlyWholeNumbers = true, }; if (currenttrigger != null) { zoom.NumberValue = currenttrigger.ZoomTarget; frames.NumberValue = currenttrigger.ZoomFrames; } table.Add("Frames", frames); zoom.ValueChanged += (o, e) => { using (var trk = _editor.CreateTrackWriter()) { trk.DisableExtensionUpdating(); if (triggerenabled.IsChecked) { var cpy = (StandardLine)_ownerline.Clone(); cpy.Trigger.ZoomTarget = (float)zoom.NumberValue; UpdateOwnerLine(trk, cpy); } } }; frames.ValueChanged += (o, e) => { using (var trk = _editor.CreateTrackWriter()) { trk.DisableExtensionUpdating(); if (triggerenabled.IsChecked) { var cpy = (StandardLine)_ownerline.Clone(); cpy.Trigger.ZoomFrames = (int)frames.NumberValue; UpdateOwnerLine(trk, cpy); } } }; triggerenabled.ValueChanged += (o, e) => { using (var trk = _editor.CreateTrackWriter()) { trk.DisableExtensionUpdating(); var cpy = (StandardLine)_ownerline.Clone(); if (triggerenabled.IsChecked) { cpy.Trigger = new LineTrigger() { ZoomTrigger = true, ZoomFrames = (int)frames.NumberValue, ZoomTarget = (float)zoom.NumberValue }; UpdateOwnerLine(trk, cpy); } else { cpy.Trigger = null; UpdateOwnerLine(trk, cpy); } } }; } }
private void SetupBlueAndRedOptions(PropertyTree tree) { int currentMultiplier = 0; bool inv = false; StandardLine.Ext lineEXT = ((StandardLine)_ownerline).Extension; bool leftEXT = ((StandardLine)_ownerline).Extension == StandardLine.Ext.Both || ((StandardLine)_ownerline).Extension == StandardLine.Ext.Left; bool rightEXT = ((StandardLine)_ownerline).Extension == StandardLine.Ext.Both || ((StandardLine)_ownerline).Extension == StandardLine.Ext.Right; if (_ownerline is RedLine red) { currentMultiplier = red.Multiplier; inv = red.inv; } var table = tree.Add("Acceleration", 120); multiplier = new NumberProperty(table) { Min = -255, Max = 255, NumberValue = (inv ? -currentMultiplier : currentMultiplier), OnlyWholeNumbers = true, }; multiplier.ValueChanged += (o, e) => { if (multiplier.NumberValue < 0) { accelinverse.IsChecked = true; } else { accelinverse.IsChecked = false; } ChangeMultiplier((int)Math.Abs(multiplier.NumberValue)); }; table.Add("Multiplier", multiplier); multilines = new NumberProperty(table) { Min = 1, Max = 9999, OnlyWholeNumbers = true, }; multilines.NumberValue = GetMultiLines(true).Count; multilines.ValueChanged += (o, e) => { Multiline((int)multilines.NumberValue); }; table.Add("Multilines", multilines); accelinverse = GwenHelper.AddPropertyCheckbox( table, "Inverse", inv ); accelinverse.ValueChanged += (o, e) => { if (accelinverse.IsChecked) { if (multiplier.NumberValue > 0) { multiplier.NumberValue = -multiplier.NumberValue; } } else { multiplier.NumberValue = Math.Abs(multiplier.NumberValue); } using (var trk = _editor.CreateTrackWriter()) { var multi = GetMultiLines(false); foreach (var l in multi) { var cpy = (StandardLine)l.Clone(); cpy.Position = l.Position2; cpy.Position2 = l.Position; cpy.inv = accelinverse.IsChecked; UpdateLine(trk, l, cpy); } var owner = (StandardLine)_ownerline.Clone(); owner.Position = _ownerline.Position2; owner.Position2 = _ownerline.Position; owner.inv = accelinverse.IsChecked; UpdateOwnerLine(trk, owner); } var vec = _ownerline.GetVector(); var angle = Angle.FromVector(vec); angle.Degrees += 90; angleProp.NumberValue = angle.Degrees; }; multiplier.ValueChanged += (o, e) => { int val = (int)multiplier.NumberValue; if (val == 0) { accelinverse.Disable(); } else { accelinverse.Enable(); } }; if ((int)multiplier.NumberValue == 0) { accelinverse.Disable(); } table = tree.Add("Line Extensions (AGWs)", 120); leftAGW = GwenHelper.AddPropertyCheckbox(table, "Starting Extension", leftEXT); leftAGW.ValueChanged += (o, e) => { UpdateAGWs(leftAGW.IsChecked, rightAGW.IsChecked); }; rightAGW = GwenHelper.AddPropertyCheckbox(table, "Ending Extension", rightEXT); rightAGW.ValueChanged += (o, e) => { UpdateAGWs(leftAGW.IsChecked, rightAGW.IsChecked); }; }