HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured) { HelpInfo result = null; Point globalPos = this.PointToScreen(localPos); object hoveredObj = null; // Retrieve the currently hovered / active item from all child toolstrips ToolStripItem hoveredItem = this.GetHoveredToolStripItem(globalPos, out captured); hoveredObj = (hoveredItem != null) ? hoveredItem.Tag : null; // Determine resulting HelpInfo { if (hoveredObj is Type) { result = HelpInfo.FromMember((hoveredObj as Type).GetTypeInfo()); } else { result = hoveredObj as HelpInfo; } } return(result); }
HelpInfo IHelpProvider.ProvideHoverHelp(System.Drawing.Point localPos, ref bool captured) { PropertyEditor pickedEditor = this.PickEditorAt(this.Location.X + localPos.X, this.Location.Y + localPos.Y, true); if (this.showWorldSpace) { if (pickedEditor == this.editorPos) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalPos)); } else if (pickedEditor == this.editorScale) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalScale)); } else if (pickedEditor == this.editorAngle) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_LocalAngle)); } } else { if (pickedEditor == this.editorPos) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Pos)); } else if (pickedEditor == this.editorScale) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Scale)); } else if (pickedEditor == this.editorAngle) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Angle)); } } if (pickedEditor == this.editorShowWorldSpace) { return(HelpInfo.FromText("World Space Mode", "If true, Transform values will be displayed and edited in world space, " + "instead of the parent objects local space. This is an editor property " + "that does not affect object behaviour in any way.")); } else if (pickedEditor.EditedMember != null) { return(HelpInfo.FromMember(pickedEditor.EditedMember)); } else if (pickedEditor.EditedType != null) { return(HelpInfo.FromMember(pickedEditor.EditedType)); } return(null); }
HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured) { HelpInfo result = null; if (this.rectHeader.Contains(localPos)) { result = HelpInfo.FromSelection(new ObjectSelection(this.GetValue())); } else if (this.rectPrefab.Contains(localPos)) { result = HelpInfo.FromMember(typeof(Duality.Resources.PrefabLink)); } return(result); }
HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured) { Point globalPos = this.PointToScreen(localPos); Point treePos = this.objectTypeView.PointToClient(globalPos); TreeNodeAdv node = this.objectTypeView.GetNodeAt(treePos); if (node == null) { return(null); } TypeItem typeItem = node.Tag as TypeItem; if (typeItem == null) { return(null); } return(HelpInfo.FromMember(typeItem.TypeInfo)); }
HelpInfo IHelpProvider.ProvideHoverHelp(System.Drawing.Point localPos, ref bool captured) { PropertyEditor pickedEditor = this.PickEditorAt(localPos.X, localPos.Y, true); if (this.showRelative) { if (pickedEditor == this.editorPos) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativePos)); } else if (pickedEditor == this.editorVel) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeVel)); } else if (pickedEditor == this.editorScale) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeScale)); } else if (pickedEditor == this.editorAngle) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeAngle)); } else if (pickedEditor == this.editorAngleVel) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_RelativeAngleVel)); } } else { if (pickedEditor == this.editorPos) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Pos)); } else if (pickedEditor == this.editorVel) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Vel)); } else if (pickedEditor == this.editorScale) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Scale)); } else if (pickedEditor == this.editorAngle) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_Angle)); } else if (pickedEditor == this.editorAngleVel) { return(HelpInfo.FromMember(ReflectionInfo.Property_Transform_AngleVel)); } } if (pickedEditor == this.editorShowRelative) { return(HelpInfo.FromText("Show relative values?", "If true, the relative Transform values are displayed for editing. This is an editor property that does not affect object behaviour in any way.")); } else if (pickedEditor.EditedMember != null) { return(HelpInfo.FromMember(pickedEditor.EditedMember)); } else if (pickedEditor.EditedType != null) { return(HelpInfo.FromMember(pickedEditor.EditedType)); } return(null); }
HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured) { // A dropdown is opened. Provide dropdown help. IPopupControlHost dropdownEdit = this.FocusEditor as IPopupControlHost; if (dropdownEdit != null && dropdownEdit.IsDropDownOpened) { EnumPropertyEditor enumEdit = dropdownEdit as EnumPropertyEditor; FlaggedEnumPropertyEditor enumFlagEdit = dropdownEdit as FlaggedEnumPropertyEditor; ObjectSelectorPropertyEditor objectSelectorEdit = dropdownEdit as ObjectSelectorPropertyEditor; // Its able to provide help. Redirect. if (dropdownEdit is IHelpProvider) { captured = true; Point dropdownEditorPos = this.GetEditorLocation(dropdownEdit as PropertyEditor, true); return((dropdownEdit as IHelpProvider).ProvideHoverHelp(new Point(localPos.X - dropdownEditorPos.X, localPos.Y - dropdownEditorPos.Y), ref captured)); } // Special case: Its a known basic dropdown. else if (enumEdit != null) { captured = true; if (enumEdit.DropDownHoveredName != null) { return(HelpInfo.FromMember(enumEdit.EditedType.GetField(enumEdit.DropDownHoveredName, ReflectionHelper.BindAll))); } else { FieldInfo field = enumEdit.EditedType.GetField(enumEdit.DisplayedValue.ToString(), ReflectionHelper.BindAll); if (field != null) { return(HelpInfo.FromMember(field)); } } } else if (enumFlagEdit != null) { captured = true; if (enumFlagEdit.DropDownHoveredItem != null) { return(HelpInfo.FromMember(enumFlagEdit.EditedType.GetField(enumFlagEdit.DropDownHoveredItem.Caption, ReflectionHelper.BindAll))); } else { FieldInfo field = enumFlagEdit.EditedType.GetField(enumFlagEdit.DisplayedValue.ToString(), ReflectionHelper.BindAll); if (field != null) { return(HelpInfo.FromMember(field)); } } } else if (objectSelectorEdit != null) { captured = true; if (objectSelectorEdit.DropDownHoveredObject != null) { return(HelpInfo.FromObject(objectSelectorEdit.DropDownHoveredObject.Value)); } else { return(HelpInfo.FromObject(objectSelectorEdit.DisplayedValue)); } } // No help available. return(null); } captured = false; // Pick an editor and see if it has access to an actual IHelpProvider PropertyEditor pickedEditor = this.PickEditorAt(localPos.X, localPos.Y, true); PropertyEditor helpEditor = pickedEditor; while (helpEditor != null) { Point helpEditorPos = this.GetEditorLocation(helpEditor, true); if (helpEditor is IHelpProvider) { IHelpProvider localProvider = helpEditor as IHelpProvider; HelpInfo localHelp = localProvider.ProvideHoverHelp(new Point(localPos.X - helpEditorPos.X, localPos.Y - helpEditorPos.Y), ref captured); if (localHelp != null) { return(localHelp); } } helpEditor = helpEditor.ParentEditor; } // If not, default to member or type information if (pickedEditor != null) { if (!string.IsNullOrEmpty(pickedEditor.PropertyDesc)) { return(HelpInfo.FromText(pickedEditor.PropertyName, pickedEditor.PropertyDesc)); } else if (pickedEditor.EditedMember != null) { return(HelpInfo.FromMember(pickedEditor.EditedMember)); } else if (pickedEditor.EditedType != null) { return(HelpInfo.FromMember(pickedEditor.EditedType)); } } return(null); }
protected override void OnShown(EventArgs e) { base.OnShown(e); this.InitGLControl(); this.InitNativeCamera(); if (this.camSelector.Items.Count == 0) { this.InitCameraSelector(); } if (this.stateSelector.Items.Count == 0) { this.InitStateSelector(); } if (this.layerSelector.DropDownItems.Count == 0) { this.InitLayerSelector(); } this.SetCurrentCamera(null); // Initialize PerspectiveMode Selector foreach (string perspectiveName in Enum.GetNames(typeof(PerspectiveMode))) { ToolStripMenuItem perspectiveItem = new ToolStripMenuItem(perspectiveName); var perspectiveField = typeof(PerspectiveMode).GetField(perspectiveName, ReflectionHelper.BindAll); perspectiveItem.Tag = HelpInfo.FromMember(perspectiveField); this.perspectiveDropDown.DropDownItems.Add(perspectiveItem); } // Initialize from loaded state id, if not done yet manually if (this.activeState == null) { Type stateType = ReflectionHelper.ResolveType(this.loadTempState, false) ?? typeof(SceneEditorCamViewState); this.SetCurrentState(stateType); this.loadTempState = null; } else { // If we set the state explicitly before, we'll still need to fire its enter event. See SetCurrentState. this.activeState.OnEnterState(); } // Register DualityApp updater for camera steering behaviour FileEventManager.ResourceModified += this.FileEventManager_ResourceModified; DualityEditorApp.HighlightObject += this.DualityEditorApp_HighlightObject; DualityEditorApp.ObjectPropertyChanged += this.DualityEditorApp_ObjectPropertyChanged; DualityEditorApp.UpdatingEngine += this.DualityEditorApp_UpdatingEngine; Scene.Entered += this.Scene_Entered; Scene.Leaving += this.Scene_Leaving; Scene.GameObjectRemoved += this.Scene_GameObjectUnregistered; Scene.ComponentRemoving += this.Scene_ComponentRemoving; // Update Camera values according to GUI (which carries loaded or default settings) this.focusDist_ValueChanged(this.focusDist, null); SetCamCompClearColor(this.selectedColorDialogColor); if (this.loadTempPerspective != null) { foreach (var item in this.perspectiveDropDown.DropDownItems.OfType <ToolStripMenuItem>()) { if (item.Text == this.loadTempPerspective) { this.perspectiveDropDown_DropDownItemClicked(this.perspectiveDropDown, new ToolStripItemClickedEventArgs(item)); break; } } } // Update camera transform properties & GUI this.OnPerspectiveChanged(); this.OnCamTransformChanged(); }
/// <summary> /// Provides custom <see cref="HelpInfo"/> regarding <see cref="AssetInfo"/> data. /// </summary> /// <param name="localPos"></param> /// <param name="captured"></param> HelpInfo IHelpProvider.ProvideHoverHelp(Point localPos, ref bool captured) { return(HelpInfo.FromMember(typeof(AssetInfo))); }