private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { PrototypeContext = m_contextRegistry.GetMostRecentContext <IPrototypingContext>(); TreeControl.Text = (PrototypeContext != null) ? "Copy items from the document and paste them here to create prototypes that can be dragged and dropped onto a canvas.".Localize() : null; }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { if (m_eventSequenceContext != null) { m_listViewSettings = m_eventSequenceContext.ListViewAdapter.Settings; } m_eventSequenceContext = m_contextRegistry.GetMostRecentContext <EventSequenceContext>(); if (m_eventSequenceContext != null) { m_eventSequenceContext.ListViewAdapter.Settings = m_listViewSettings; } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { LayeringContext = m_contextRegistry.GetMostRecentContext <ILayeringContext>(); if (LayeringContext != null) { TreeControl.Text = "Copy items from the document and paste them here to create layers whose visibility can be controlled by clicking on a check box.".Localize(); } else { TreeControl.Text = null; } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { // make sure we're always tracking the most recently active EventSequenceContext StoryContext context = m_contextRegistry.GetMostRecentContext <StoryContext>(); if (m_storyContext != context) { m_storyContext = context; Story story = m_storyContext.Cast <Story>(); if (story.Settings == null) { //DomNode node = new DomNode(Schema.settingsType.Type, Schema.storyType.settingsChild); //story.Cast<DomNode>().SetChild(Schema.storyType.settingsChild, node); story.Settings = Settings.New(Schema.storyType.settingsChild); } m_CharacterSettingsContext = story.Settings.Cast <CharacterSettingsContext>(); m_characteListViewAdapter.ListView = m_CharacterSettingsContext; } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { // make sure we're always tracking the most recently active EventSequenceContext EventSequenceContext context = m_contextRegistry.GetMostRecentContext <EventSequenceContext>(); if (m_eventSequenceContext != context) { if (m_eventSequenceContext != null) { m_eventSequenceContext.SelectionChanged -= eventSequenceContext_SelectionChanged; } m_eventSequenceContext = context; if (m_eventSequenceContext != null) { // track the most recently active EventSequenceContext's selection to get the most recently // selected event. m_eventSequenceContext.SelectionChanged += eventSequenceContext_SelectionChanged; } UpdateEvent(); } }
private void control_DoubleClick(object sender, EventArgs e) { AdaptableControl d2dHoverControl = (AdaptableControl)sender; Point clientPoint = d2dHoverControl.PointToClient(Control.MousePosition); D2dGraphAdapter <Module, Connection, ICircuitPin> graphAdapter = d2dHoverControl.As <D2dGraphAdapter <Module, Connection, ICircuitPin> >(); GraphHitRecord <Module, Connection, ICircuitPin> hitRecord = graphAdapter.Pick(clientPoint); Group subGraph = null; var subGraphReference = hitRecord.Node.As <GroupReference>(); if (subGraphReference != null) { var templatingContext = m_contextRegistry.GetMostRecentContext <TemplatingContext>(); if (templatingContext != null && templatingContext.IsExternalTemplate(subGraphReference.Template)) { return; // templates should only be editable in the document that owns the template } DialogResult checkResult = DialogResult.No; //direct editing if (checkResult == DialogResult.No) { subGraph = subGraphReference.Group.As <Group>(); var graphValidator = subGraphReference.DomNode.GetRoot().Cast <CircuitValidator>(); graphValidator.UpdateTemplateInfo(subGraph); } } else { subGraph = hitRecord.Node.As <Group>(); } if (subGraph != null) { var viewingContext = subGraph.Cast <ViewingContext>(); if (viewingContext.Control != null) { // sub-graph is already open, just show control m_controlHostService.Show(viewingContext.Control); } else { // create new circuit editing control for sub-circuit AdaptableControl subCircuitControl = CreateCircuitControl(subGraph.DomNode); viewingContext.Control = subCircuitControl; // use group’s hierarchy as control name string name = string.Empty; bool first = true; foreach (var domNode in subGraph.DomNode.GetPath()) { if (domNode.Is <Group>()) { if (first) { name = domNode.Cast <Group>().Name; first = false; } else { name += "/" + domNode.Cast <Group>().Name; } } } string description = name; var editingContext = subGraph.DomNode.Cast <CircuitEditingContext>(); editingContext.GetLocalBound = GetLocalBound; editingContext.GetWorldOffset = GetWorldOffset; editingContext.GetTitleHeight = GetTitleHeight; editingContext.GetLabelHeight = GetLabelHeight; editingContext.GetSubContentOffset = GetSubContentOffset; subCircuitControl.Context = editingContext; editingContext.SchemaLoader = m_schemaLoader; // schema needed for cut and paste between applications ControlInfo controlInfo = new ControlInfo(name, description, StandardControlGroup.Center); //controlInfo.Docking = new ControlInfo.DockingInfo() // smart docking behavior //{ // GroupTag = subGraph.DomNode.Lineage.AsIEnumerable<Group>().Last(),// use the top-level parent group // Order = subGraph.Level //}; m_circuitControlRegistry.RegisterControl(subGraph.DomNode, subCircuitControl, controlInfo, this); var enumerableContext = subGraph.DomNode.Cast <CircuitEditingContext>().Cast <IEnumerableContext>(); var items = (enumerableContext != null) ? enumerableContext.Items : null; subCircuitControl.As <IViewingContext>().Frame(items); } } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { TemplateContext = m_contextRegistry.GetMostRecentContext <ITemplatingContext>(); }