/// <summary> /// Shows the component info pad. /// </summary> /// <param name="component">Component.</param> /// <param name="defaultLocationX">Default location x for the floating window</param> /// <param name="defaultLocationY">Default location y for the floating window</param> /// <param name="onVisibleChanged">The action that is executed when visibility of window changes.</param> internal void ShowComponentInfoPad(BasicNodeControl component, int defaultLocationX, int defaultLocationY, System.Action <Boolean> onVisibleChanged) { DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID); if (infoDockItem == null) { infoDockItem = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID); infoDockItem.Content = CreateInfoWidget(component); infoDockItem.Label = component.ExperimentNode.Data.Metadata.Label; infoDockItem.DefaultHeight = 150; infoDockItem.DefaultWidth = 200; infoDockItem.DefaultLocation = GetLocation(); infoDockItem.Visible = true; //attach action on visible changed, so that if window is closed then it toggles off the info icon infoDockItem.VisibleChanged += (object sender, EventArgs e) => { bool isVisible = ((DockItem)sender).Visible; onVisibleChanged(isVisible); }; AttachMouseOverHighlightHandlers(component, infoDockItem); infoPads.AddLast(infoDockItem); //Float window //this line allows setting window as floating automatically, to consider in future m_mainWindowDockFrame.SetStatus(infoDockItem, DockItemStatus.Floating); Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition; floatRectangle.Width = 350; floatRectangle.Height = 180; //location of info box next to the component node just sligthly below cursor click floatRectangle.X = defaultLocationX; floatRectangle.Y = defaultLocationY + 20; infoDockItem.SetFloatMode(floatRectangle); } else { //if already exists just set it visible infoDockItem.Visible = true; } }
internal void ShowComponentInfoPad(BasicNodeControl component) { DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID); if (infoDockItem == null) { infoDockItem = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID); infoDockItem.Content = CreateInfoWidget(component); } infoDockItem.Label = component.ExperimentNode.Data.Metadata.Label; infoDockItem.DefaultHeight = 150; infoDockItem.DefaultWidth = 200; infoDockItem.DefaultLocation = GetLocation(); m_mainWindowDockFrame.SetVisible(infoDockItem, true); infoPads.AddLast(infoDockItem); //TODO: floating info panels //there is still problem with below solution - if user resizes the window it frequently crashes (not always though) //however it crashes only when running from MONO Develop with attached debugger // //this line allows setting window as floating automatically, to consider in future // m_dockFrame.SetStatus(infoDockItem, DockItemStatus.Floating); // Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition; // floatRectangle.Width = 350; // floatRectangle.Height = 180; // // // TODO set location of info box next to the component node // // to do this probably some translation will be needed of componentControl.DisplayBox on experiment canvas // // to absolute x and y in relation to window // floatRectangle.X = 600; // floatRectangle.Y = 600; // infoDockItem.SetFloatMode(floatRectangle); }
/// <summary> /// Shows the component info pad. /// </summary> /// <param name="component">Component.</param> /// <param name="defaultLocationX">Default location x for the floating window</param> /// <param name="defaultLocationY">Default location y for the floating window</param> /// <param name="onVisibleChanged">The action that is executed when visibility of window changes.</param> internal void ShowComponentInfoPad(BasicNodeControl component, int defaultLocationX, int defaultLocationY, System.Action <Boolean> onVisibleChanged) { DockItem infoDockItem = m_mainWindowDockFrame.GetItem(component.ExperimentNode.ID); if (infoDockItem == null) { infoDockItem = m_mainWindowDockFrame.AddItem(component.ExperimentNode.ID); infoDockItem.Content = CreateInfoWidget(component); if (component is DecisionNodeControl) { // string m = component.ExperimentNode.ID; // if (m. ID.Equals (DecisionMetadataDefinition.GotoDecisionGuid)) { if (component.ExperimentNode.Data.Metadata.Label.Equals("Goto Decision")) { infoDockItem.Label = GOTO_INFO_PANEL_TITLE_LABEL; } else { infoDockItem.Label = DECISION_INFO_PANEL_TITLE_LABEL; } } else if (component is LoopNodeControl) { infoDockItem.Label = LOOP_INFO_PANEL_TITLE_LABEL; } else { infoDockItem.Label = component.ExperimentNode.Data.Metadata.Label; } infoDockItem.DefaultHeight = 150; //infoDockItem.DefaultWidth = 200; // HERZUM SPRINT 4.2: TLAB-226 infoDockItem.DefaultHeight = 100; if (component is ScopeNodeControl || component is CommentNodeControl) { infoDockItem.DefaultHeight = 50; } // END HERZUM SPRINT 4.2: TLAB-226 infoDockItem.DefaultLocation = GetLocation(); infoDockItem.Visible = true; //attach action on visible changed, so that if window is closed then it toggles off the info icon infoDockItem.VisibleChanged += (object sender, EventArgs e) => { bool isVisible = ((DockItem)sender).Visible; onVisibleChanged(isVisible); }; AttachMouseOverHighlightHandlers(component, infoDockItem); infoPads.AddLast(infoDockItem); //Float window //this line allows setting window as floating automatically, to consider in future m_mainWindowDockFrame.SetStatus(infoDockItem, DockItemStatus.Floating); Gdk.Rectangle floatRectangle = infoDockItem.FloatingPosition; floatRectangle.Width = 350; //floatRectangle.Height = 180; // HERZUM SPRINT 4.2: TLAB-225 floatRectangle.Height = 100; if (component is ScopeNodeControl || component is CommentNodeControl) { floatRectangle.Height = 50; } // END HERZUM SPRINT 4.2: TLAB-225 //location of info box next to the component node just sligthly below cursor click floatRectangle.X = defaultLocationX; floatRectangle.Y = defaultLocationY + 20; infoDockItem.SetFloatMode(floatRectangle); } else { //if already exists just set it visible infoDockItem.Visible = true; } }