public void GetRelatedObjects(IEnumerable <uint> ids, HashSet <uint> alreadyDiscovered) { List <Bond> externalBonds = new List <Bond>(); DesignTimeline designStage = MainForm.CurrentStage.CurrentEditItem; alreadyDiscovered.UnionWith(ids); List <uint> newlyDiscovered = new List <uint>(); foreach (uint id in ids) { if (bonds.ContainsKey(id)) { foreach (Bond b in bonds[id]) { if (b.Next != null && !b.Next.SourceAttachment.IsGuide() && alreadyDiscovered.Add(b.Next.SourceInstanceId)) { newlyDiscovered.Add(b.Next.SourceInstanceId); } if (b.Previous != null && !b.Previous.SourceAttachment.IsGuide() && alreadyDiscovered.Add(b.Previous.SourceInstanceId)) { newlyDiscovered.Add(b.Previous.SourceInstanceId); } } } } if (newlyDiscovered.Count > 0) { GetRelatedObjects(newlyDiscovered, alreadyDiscovered); } }
protected override void SetUp() { base.SetUp(); lis = PopulateLibrary(); commandStack = MainForm.CurrentStage.CommandStack; dl = MainForm.CurrentStage.Root; }
public BondStore(DesignTimeline timeline) { this.timeline = timeline; this.bonds = new Dictionary <uint, List <Bond> >(); this.handles = new Dictionary <uint, BondType[]>(); this.guideAttachments = new Dictionary <uint, List <Bond> >(); }
private void GetRelatedObjectTransformsRec(IEnumerable <uint> ids, Dictionary <uint, Vex.Rectangle> alreadyDiscovered, Vex.Point offset, HashSet <Bond> starts) { List <Bond> externalBonds = new List <Bond>(); DesignTimeline designStage = MainForm.CurrentStage.CurrentEditItem; //alreadyDiscovered.UnionWith(ids); //foreach (uint id in ids) //{ // alreadyDiscovered.Add(id, designStage[id].StrokeBounds.TranslatedRectangle(tx, ty)); //} List <Bond> guideBonds = new List <Bond>(); HashSet <uint> joinedIds = new HashSet <uint>(); designStage.BondStore.AppendJoinedRelations(ids, joinedIds, alreadyDiscovered.Keys, guideBonds); foreach (Bond b in guideBonds) { if (b.Next.SourceAttachment.IsGuide()) { bool guideMoved = b.Next.GuideMoved; Vex.Point guideOffset = b.Next.GuideMoved ? offset : Vex.Point.Zero; offset.X = b.Next.SourceAttachment.IsVGuide() ? guideOffset.X : offset.X; offset.Y = b.Next.SourceAttachment.IsHGuide() ? guideOffset.Y : offset.Y; } } foreach (uint id in joinedIds) { if (!alreadyDiscovered.ContainsKey(id)) { alreadyDiscovered.Add(id, designStage[id].StrokeBounds.TranslatedRectangle(offset.X, offset.Y)); } externalBonds.AddRange(designStage.BondStore.GetExternalBondIds(alreadyDiscovered.Keys, id, starts)); } foreach (Bond b in externalBonds) { // todo: this algorithm ignores multiple chains on an object. // probably need to keep track of 'join islands' and their outward chains if (!alreadyDiscovered.ContainsKey(b.SourceInstanceId)) { float newTx = offset.X; float newTy = offset.Y; if (offset.X != 0 || offset.Y != 0) { designStage.BondStore.GetFinalOffset(b, ref newTx, ref newTy); } GetRelatedObjectTransformsRec(new uint[] { b.SourceInstanceId }, alreadyDiscovered, new Vex.Point(newTx, newTy), starts); } } }
private static bool CanBreakApart(DesignInstance di) { bool result = false; if (di is DesignTimeline) { DesignTimeline dt = (DesignTimeline)di; if (dt.Count > 1 || (dt.Count == 1 && MainForm.CurrentInstanceManager[dt.InstanceIds[0]].Definition is Vex.Timeline)) { result = true; } } return(result); }
public Guidelines(DesignTimeline timeline) { this.timeline = timeline; this.guides = new Dictionary <uint, Guide>(); //AddGuide(new Guide(new Vex.Rectangle(200, 0, 0, 400))); //AddGuide(new Guide(new Vex.Rectangle(0, 150, 550, 0))); //AddGuide(new Guide(new Vex.Rectangle(55, 88, 122, 99))); guidePen.DashStyle = DashStyle.Dash; guidePen.DashPattern = new float[] { 2f, 3f }; guidePenError.DashStyle = DashStyle.Dash; guidePenError.DashPattern = new float[] { 2f, 3f }; guidePenLight.DashStyle = DashStyle.Dash; guidePenLight.DashPattern = new float[] { 2f, 3f }; }
// edit stack private void OnNestedEditChanged(Object sender, EventArgs e) { finishEditInPlaceToolStripMenuItem.Enabled = currentStage.CanFinishEditInPlace(1); levelBar.Items.Clear(); int editLayers = currentStage.EditStack.Count; for (int i = 0; i < editLayers; i++) { DesignTimeline dt = currentStage.EditStack.ElementAt(editLayers - 1 - i); string name = (i == 0) ? currentStage.Name : dt.LibraryItem.Name; int imageIndex = LibraryView.Instance.GetImageIndex(dt.LibraryItem); ToolStripButton bt = new ToolStripButton(name, elementIcons.Images[imageIndex]); bt.Enabled = (i < editLayers - 1); levelBar.Items.Insert(i, bt); } }
public SnapStore(DesignTimeline timeline) { this.timeline = timeline; xStops = new SortedList <float, List <ICrossPoint> >(); yStops = new SortedList <float, List <ICrossPoint> >(); }
public UsageIdentifier(DesignTimeline parent, DesignInstance instance, int depth) { Parent = parent; Instance = instance; Depth = depth; }