void MouseEnter(object obj, EnterNotifyEventArgs args) { if (leftPopup != null) { leftPopup.Destroy(); } if (lline != null) { lline.Destroy(); } if (rightPopup != null) { rightPopup.Destroy(); } if (rline != null) { rline.Destroy(); } if (node.Parent == map.stage) { map.stage.Remove(node); } GdkWindow.GetOrigin(out int x, out int y); Vector2 nodeFixedPosition = scaledPosition + lineOffset; Vector2 nodeScreenPosition = new Vector2(x + Allocation.Left, y + Allocation.Top) + lineOffset - offset; //This is the screen coordinates of the point defined by lineOffset — where the line(s) begin and the node sits. leftPopup = GenerateLeftPopup(); if (leftPopup != null) { lline = new HSeparator(); lline.SetSizeRequest(popupDistance, 4); map.stage.Put(lline, (int)nodeFixedPosition.x - popupDistance, (int)nodeFixedPosition.y - 2); lline.ShowAll(); Graphics.SetAllocTrigger(leftPopup, delegate { leftPopup.GetSize(out int width, out int height); Vector2 truePosition = nodeScreenPosition + new Vector2(-popupDistance - width, -height / 4); leftPopup.Move((int)truePosition.x, (int)truePosition.y); });
private void ObjectToControls() { IgnoreComponentChange = true; checkbuttonEnabled.Active = Notification.Enabled; entryName.Text = Notification.Name; if (Notification is PatternNotification && (Notification as PatternNotification).PatterConfigurable) { LoadPatterns((Notification as PatternNotification).Pattern); } else { table2.Remove(labelPattern); table2.Remove(comboboxPattern); table2.Remove(buttonEditPatterns); if (Notification is DeviceNotification) { table2.NRows -= 1; } } if (Notification is DeviceNotification) { if (((DeviceNotification)Notification).BlinkStickSerial == "" || ((DeviceNotification)Notification).BlinkStickSerial == null) { if (this.DataModel.Devices.Count == 1) { deviceComboboxWidget.SelectBySerial(this.DataModel.Devices[0].Serial); } } else { deviceComboboxWidget.SelectBySerial(((DeviceNotification)Notification).BlinkStickSerial); } spinbuttonLedsFrom.Value = ((DeviceNotification)Notification).LedFirstIndex; spinbuttonLedsTo.Value = ((DeviceNotification)Notification).LedLastIndex; comboboxChannel.Active = ((DeviceNotification)Notification).LedChannel; } else { table2.Remove(labelBlinkStick); table2.Remove(deviceComboboxWidget); table2.Remove(labelLeds); table2.Remove(hboxLedConfiguration); table2.Remove(labelChannel); table2.Remove(hboxChannel); table2.NRows -= 4; } HSeparator hseparator; Type editorType = NotificationRegistry.FindEditorType(Notification.GetType()); object editorWidgetObject = null; if (editorType != null) { editorWidgetObject = Activator.CreateInstance(editorType); } if (editorWidgetObject != null && editorWidgetObject is Widget) { Widget editorWidget = (Widget)editorWidgetObject; hseparator = new HSeparator(); vbox3.PackEnd(hseparator); hseparator.ShowAll(); if (editorWidget is IEditorInterface) { editorInterface = (editorWidget as IEditorInterface); editorInterface.SetNotification(Notification); } vbox3.PackEnd(editorWidget, true, true, 0); editorWidget.SizeAllocated += (o, args) => { int x, y, w, h, myw, myh; ParentForm.GetPosition(out x, out y); ParentForm.GetSize(out w, out h); GetSize(out myw, out myh); this.GdkWindow.Move(x + (w - myw) / 2, y + (h - myh) / 2); }; editorWidget.ShowAll(); } OnDeviceComboboxWidgetDeviceChanged(null, null); hseparator = new HSeparator(); vbox3.PackEnd(hseparator); hseparator.ShowAll(); deviceComboboxWidget.Sensitive = this.ApplicationSettings.AllowModeChange; IgnoreComponentChange = false; }