public JazzGraphContainer(int index, string name, Control view) { this.Index = index; this.mName = name ?? ""; this.UndoRedo = new UndoManager(); this.SaveState = JazzSaveState.Dirty; ulong iid = 0; if (!this.mName.StartsWith("0x") || !ulong.TryParse(this.mName.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out iid)) { iid = FNVHash.HashString64(this.mName); } this.Key = new RK(GlobalManager.kJazzTID, 0, iid); this.Comp = true; this.JP = null; this.RIE = null; StateMachine sm = new StateMachine(name); this.Scene = new StateMachineScene(sm, view, this); KKLayoutAlgorithm <StateNode, StateEdge> layout = new KKLayoutAlgorithm <StateNode, StateEdge>( this.Scene.StateGraph, this.Scene); layout.LengthFactor = 1.25f; this.Scene.Layout = layout; layout.ShuffleNodes(); this.Scene.LayoutPaused = true; this.Scene.StartLayout(); }
public JazzGraphContainer(int index, StateMachine sm, Control view, TabPage page) { this.Index = index; this.mName = sm.Name; this.UndoRedo = new UndoManager(); this.SaveState = JazzSaveState.Dirty; this.Key = new RK(GlobalManager.kJazzTID, 0, FNVHash.HashString64(this.mName)); this.Comp = true; this.JP = null; this.RIE = null; this.Scene = new StateMachineScene(sm, view, this); KKLayoutAlgorithm <StateNode, StateEdge> layout = new KKLayoutAlgorithm <StateNode, StateEdge>( this.Scene.StateGraph, this.Scene); layout.LengthFactor = 1.25f; this.Scene.Layout = layout; layout.ShuffleNodes(); this.Scene.LayoutPaused = true; this.Scene.StartLayout(); this.mPage = page; this.mPage.Controls.Add(view); this.mPage.Text = this.mName + " *"; this.mPage.SizeChanged += new EventHandler(this.OnTabSizeChanged); }
public JazzGraphContainer(int index, JazzPackage jp, IResourceIndexEntry rie, Control view, TabPage page) { this.Index = index; this.UndoRedo = new UndoManager(); this.SaveState = JazzSaveState.Saved; this.Key = new RK(rie); this.Comp = rie.Compressed == 0xFFFF; this.JP = jp; this.RIE = rie; IResource res = null; GenericRCOLResource rcol = null; try { res = WrapperDealer.GetResource(0, jp.Package, rie); } catch (Exception ex) { MainForm.ShowException(ex, "Could not load JAZZ resource: " + this.Key + "\n", MainForm.kName + ": Unable to load JAZZ resource"); } if (res != null) { rcol = res as GenericRCOLResource; if (rcol != null) { this.Scene = new StateMachineScene( new StateMachine(rcol), view, this); KKLayoutAlgorithm <StateNode, StateEdge> layout = new KKLayoutAlgorithm <StateNode, StateEdge>( this.Scene.StateGraph, this.Scene); layout.LengthFactor = 1.25f; this.Scene.Layout = layout; layout.ShuffleNodes(); this.Scene.LayoutPaused = true; this.Scene.StartLayout(); } else { this.Scene = null; } } if (!KeyNameReg.TryFindName(rie.Instance, out this.mName)) { this.mName = "0x" + rie.Instance.ToString("X16"); } if (this.Scene != null) { this.mPage = page; this.mPage.Controls.Add(view); this.mPage.Text = this.mName; this.mPage.SizeChanged += new EventHandler(this.OnTabSizeChanged); } }