private void editAddressBar_SelectionChange(object sender, NodeChangedArgs e) { if (_layersRoot.UniqueID.Equals(e.OUniqueID)) { SetPropertyGridObject(_room); SelectLayer(null); return; } RoomEditNode node = _layersRoot.GetChild(e.OUniqueID, true) as RoomEditNode; if (node == null) { SelectLayer(null); return; } RoomEditNode layerNode = node; while (layerNode != null && layerNode.Layer == null) { layerNode = layerNode.Parent as RoomEditNode; } if (layerNode == null) { SelectLayer(null); return; } layerNode.IsVisible = true; SelectLayer(layerNode.Layer); layerNode.Layer.SelectItem(node == layerNode ? null : node.RoomItemID); }
private void editAddressBar_SelectionChange(object sender, NodeChangedArgs e) { if (_layersRoot.UniqueID.Equals(e.OUniqueID)) { Factory.GUIController.SetPropertyGridObject(_room); return; } RoomEditNode node = _layersRoot.GetChild(e.OUniqueID, true) as RoomEditNode; if (node == null) { return; } RoomEditNode layerNode = node; while (layerNode != null && layerNode.Layer == null) { layerNode = layerNode.Parent as RoomEditNode; } if (layerNode == null) { return; } layerNode.IsVisible = true; SelectLayer(layerNode.Layer); // only select the item if the room editor is the active tab; this could // be a refresh from another tab e.g. changing a character's starting room if (Factory.GUIController.ActivePane.Control == this) { layerNode.Layer.SelectItem(node == layerNode ? null : node.RoomItemID); } }
private bool IsVisible(IRoomEditorFilter layer) { RoomEditNode node = _editAddressBar.RootNode.GetChild(layer.DisplayName, true) as RoomEditNode; if (node == null) { return(true); } return(node.IsVisible); }
private bool IsLocked(IRoomEditorFilter layer) { RoomEditNode node = _editAddressBar.RootNode.GetChild(layer.DisplayName, true) as RoomEditNode; if (node == null) { return(false); } if (!node.IsVisible) { return(true); } if (_layer != null && !_layer.AllowClicksInterception() && _layer != layer) { return(true); } return(node.IsLocked); }
/// <summary> /// Update the breadcrumb navigation bar, make all nodes correspond to the design-time state /// of the room layers and items. /// </summary> /// TODO: currently this is the only way to sync navbar with the design-time properties. /// find a better solution, perhaps tie each DesignTimeProperties object to a bar node. public void RefreshLayersTree() { IAddressNode currentNode = _editAddressBar.CurrentNode; IAddressNode[] layers = new IAddressNode[_layers.Count]; VisibleLayerRadioGroup visibleLayerRadioGroup = new VisibleLayerRadioGroup(); for (int layerIndex = 0; layerIndex < layers.Length; layerIndex++) { IRoomEditorFilter layer = _layers[layerIndex]; IAddressNode[] children = new IAddressNode[layer.DesignItems.Count]; int index = 0; foreach (var item in layer.DesignItems) { string id = item.Key; string name = layer.GetItemName(id); children[index++] = new RoomEditNode(GetLayerItemUniqueID(layer, name), name, id, new IAddressNode[0], item.Value.Visible, item.Value.Locked, false); } RoomEditNode node = new RoomEditNode(layer.DisplayName, children, layer.Visible, layer.Locked); node.Layer = layer; if (layer is BaseAreasEditorFilter) { node.VisibleGroup = visibleLayerRadioGroup; } foreach (IAddressNode child in children) { child.Parent = node; } layers[layerIndex] = node; } _layersRoot = new RoomEditNode("Room", layers, true, false); foreach (IAddressNode layer in layers) { layer.Parent = _layersRoot; } _editAddressBar.InitializeRoot(_layersRoot); SelectOldNode(currentNode); }
private void RefreshLayersTree() { IAddressNode currentNode = _editAddressBar.CurrentNode; IAddressNode[] layers = new IAddressNode[_layers.Count]; VisibleLayerRadioGroup visibleLayerRadioGroup = new VisibleLayerRadioGroup(); for (int layerIndex = 0; layerIndex < layers.Length; layerIndex++) { IRoomEditorFilter layer = _layers[layerIndex]; List <string> names = layer.GetItemsNames(); IAddressNode[] children = new IAddressNode[names.Count]; for (int index = 0; index < names.Count; index++) { string name = names[index]; children[index] = new RoomEditNode(GetLayerItemUniqueID(layer, name), name, new IAddressNode[0], true, false) { }; } RoomEditNode node = new RoomEditNode(layer.DisplayName, children, layer.VisibleByDefault); node.Layer = layer; if (layer is BaseAreasEditorFilter) { node.VisibleGroup = visibleLayerRadioGroup; } foreach (IAddressNode child in children) { child.Parent = node; } layers[layerIndex] = node; } _layersRoot = new RoomEditNode("Room", layers, true); foreach (IAddressNode layer in layers) { layer.Parent = _layersRoot; } _editAddressBar.InitializeRoot(_layersRoot); SelectOldNode(currentNode); }