/// <summary> /// Constructor /// </summary> /// <param name="view"></param> /// <param name="control"></param> public DeleteControlCommand(GUIView view, GUIControl control) { mView = view; Controls.Add(control); mParent = Controls[0].Parent; mIndex = mView.Controls.IndexOf(Controls[0]); }
/// <summary> /// Adds a view at the specified index /// </summary> /// <param name="view"></param> /// <param name="atIndex"></param> public void AddView(GUIView view, int atIndex) { if (Views.Contains(view)) { return; } if (atIndex >= 0) { Views.Insert(atIndex, view); } else { Views.Add(view); } view.Scene = this; NotifyViewAdded(view); }
/// <summary> /// Called when the selected sceneView has been renamed /// </summary> /// <param name="sender"></param> /// <param name="sceneView"></param> void SceneHierarchyView_SelectedViewRenamed(object sender, GUIView view) { }
/// <summary> /// Called when the selected sceneView has changed /// </summary> /// <param name="sender"></param> /// <param name="sceneView"></param> void SceneHierarchyView_ViewChanged(object sender, GUIView view) { SceneView sceneView = mDockPanel.ActiveDocument as SceneView; if (sceneView != null && sceneView.Scene == Globals.SceneHierarchyView.Scene) { sceneView.ActiveView = Globals.SceneHierarchyView.View; sceneView.PrimaryControl = Globals.SceneHierarchyView.SelectedControls.Count > 0 ? Globals.SceneHierarchyView.SelectedControls[0] : null; } }
/// <summary> /// Selects a list of controls, and updates all views to reflect that selection /// </summary> /// <param name="control"></param> private void SelectControls(object source, GUIView view, List<GUIControl> controls) { mIgnoreSelectionChanges = true; { NotifyingList<GUIControl> selectedControls = new NotifyingList<GUIControl>(controls); // Set the current scene's selected control, as well as the properties and // the scene hierarchy SceneView sceneView = mDockPanel.ActiveDocument as SceneView; if (source != sceneView && sceneView != null && sceneView.ActiveView == view) { sceneView.SelectedControls = selectedControls; } if (source != Globals.TimelineView) Globals.TimelineView.SelectedControls = selectedControls; if (source != Globals.SceneHierarchyView) Globals.SceneHierarchyView.SelectedControls = selectedControls; if (source != Globals.PropertiesView) Globals.PropertiesView.PropertyGrid.SelectedObjects = selectedControls.ToArray(); } mIgnoreSelectionChanges = false; }
/// <summary> /// Selects a single control /// </summary> /// <param name="source"></param> /// <param name="view"></param> /// <param name="control"></param> private void SelectControl(object source, GUIView view, GUIControl control) { SelectControls(source, view, (control != null) ? new List<GUIControl>(new GUIControl[] { control }) : new List<GUIControl>()); }
/// <summary> /// Adds a sceneView node to the scene hierarchy at a specific index /// </summary> /// <param name="sceneView"></param> /// <returns></returns> private void AddViewNode(GUIView view, int atIndex) { SceneNode node = new SceneNode(view); if (atIndex >= 0) mTreeModel.Nodes.Insert(atIndex, node); else mTreeModel.Nodes.Add(node); AddControlNodes(node, view.Controls); }
/// <summary> /// Adds a sceneView node to the scene hierarchy /// </summary> /// <param name="sceneView"></param> /// <returns></returns> private void AddViewNode(GUIView view) { AddViewNode(view, -1); }
/// <summary> /// Constructor /// </summary> /// <param name="scene"></param> /// <param name="view"></param> public AddViewCommand(GUIScene scene, GUIView view) { mScene = scene; mView = view; }
/// <summary> /// Adds a new sceneView to the scene /// </summary> public void AddView() { string name = "New View "; int cnt = 1; while (mScene.GetView(name + cnt) != null) cnt++; GUIView view = new GUIView(name + cnt); mCommandManager.AddCommand(new AddViewCommand(mScene, view), true); View = view; }
/// <summary> /// Called when a sceneView has been removed from a scene /// </summary> /// <param name="sender"></param> /// <param name="sceneView"></param> void mScene_OnViewRemoved(object sender, GUIView view) { if (view == null) return; TreeNodeAdv node = FindNodeByTag(view, mSceneTreeView.AllNodes); if (node != null) { Node modelNode = node.Tag as Node; modelNode.Parent = null; } }
/// <summary> /// Called when a sceneView has been added to the scene /// </summary> /// <param name="sender"></param> /// <param name="sceneView"></param> void mScene_OnViewAdded(object sender, GUIView view) { if (view == null) return; GUIScene scene = sender as GUIScene; AddViewNode(view, scene.Views.IndexOf(view)); }
/// <summary> /// Adds a view to the scene /// </summary> /// <param name="view"></param> public void AddView(GUIView view) { AddView(view, -1); }
/// <summary> /// Notifies that the active sceneView has changed /// </summary> /// <param name="control"></param> private void NotifyActiveViewChanged(GUIView view) { if (ActiveViewChanged != null) ActiveViewChanged(this, view); }
/// <summary> /// Called when a scene's active sceneView has changed. /// </summary> /// <param name="sender"></param> /// <param name="sceneView"></param> void SceneView_ActiveViewChanged(object sender, GUIView view) { Globals.PropertiesView.PropertyGrid.SelectedObject = view; Globals.SceneHierarchyView.View = view; Globals.TimelineView.View = view; }
/// <summary> /// Changes to a different view /// </summary> public void ChangeSelectedView(GUIView view) { if (view == null) mSceneTreeView.SelectedNode = null; else mSceneTreeView.SelectedNode = FindNodeByTag(view, mSceneTreeView.AllNodes); }
/// <summary> /// Constructor /// </summary> /// <param name="view"></param> /// <param name="control"></param> public AddControlCommand(GUIView view, GUIControl parent, GUIControl control) { mView = view; mParent = parent; Controls.Add(control); }
/// <summary> /// Constructor /// </summary> /// <param name="scene"></param> /// <param name="view"></param> public DeleteViewCommand(GUIScene scene, GUIView view) { mScene = scene; mView = view; mIndex = mScene.Views.IndexOf(mView); }