private void UpdateAGWs(bool left, bool right) { StandardLine.Ext newExt = (StandardLine.Ext)((left ? 1 : 0) + (right ? 2 : 0)); var multilines = GetMultiLines(false); using (var trk = _editor.CreateTrackWriter()) { trk.DisableExtensionUpdating(); StandardLine cpy = (StandardLine)_ownerline.Clone(); cpy.Extension = newExt; UpdateOwnerLine(trk, cpy); foreach (var line in multilines) { StandardLine copy = (StandardLine)line.Clone(); copy.Extension = newExt; UpdateLine(trk, line, copy); } } }
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); }; }