public HorizontalGridSplitter(GnosisSplit _parent) : base() { parent = _parent; this.Height = 3; this.HorizontalAlignment = HorizontalAlignment.Stretch; this.VerticalAlignment = VerticalAlignment.Center; this.Background = Brushes.LightGray; this.DragCompleted += HorizontalGridSplitter_DragCompleted; }
internal static GnosisSplit CreateGnosisSplit(int order) { GnosisSplit split = new GnosisSplit(); split.ID = GlobalData.Singleton.GetNewControlID(); split.GnosisName = "Split" + split.ID.ToString(); split.Order = order; return(split); }
public GnosisSplitController( GnosisSplit split, // IGnosisSplitImplementation _splitImplementation, GnosisEntityController entityController, GnosisVisibleController _parent) : base(split, entityController, _parent) { //create split detail controller // SplitDetailController = new GnosisSplitDetailController(((GnosisSplit)ControlImplementation).GnosisSplitDetails[0]); //SplitDetailController.PropertyChanged += SplitDetailController_PropertyChanged; //register to listen for property changes //this.PropertyChanged += GnosisSplitController_PropertyChanged; ChildControllers = new List <GnosisContainerController>(); //Handlers split.SetSplitterMovedHandler(new Action <double>(SplitterMoved)); split.SetLoadedHandler(new Action <double>(SplitLoaded)); }
private void AssignNamesAndOrders(GnosisSplit newParentSplit, GnosisSplitDetail splitDetail, GnosisTileController currentTileController, GnosisTile newSibling, GnosisController.TilePosition newTilePosition) { GnosisController.TilePosition currentTilePosition = GetPosition(currentTileController.ControlImplementation.Order, ((GnosisSplitController)currentTileController.Parent).SplitDirection); newParentSplit.GnosisName = "Split" + newParentSplit.ID.ToString() + Enum.GetName(typeof(GnosisController.TilePosition), currentTilePosition); splitDetail.GnosisName = newParentSplit.GnosisName + "Detail"; if (newTilePosition == GnosisController.TilePosition.TOP) { newSibling.GnosisName = newParentSplit.GnosisName + "TopTile"; newSibling.Order = 1; currentTileController.ControlImplementation.GnosisName = newParentSplit.GnosisName + "BottomTile"; currentTileController.ControlImplementation.Order = 2; } else if (newTilePosition == GnosisController.TilePosition.BOTTOM) { newSibling.GnosisName = newParentSplit.GnosisName + "BottomTile"; newSibling.Order = 2; currentTileController.ControlImplementation.GnosisName = newParentSplit.GnosisName + "TopTile"; currentTileController.ControlImplementation.Order = 1; } else if (newTilePosition == GnosisController.TilePosition.LEFT) { newSibling.GnosisName = newParentSplit.GnosisName + "LeftTile"; newSibling.Order = 1; currentTileController.ControlImplementation.GnosisName = newParentSplit.GnosisName + "RightTile"; currentTileController.ControlImplementation.Order = 2; } else { newSibling.GnosisName = newParentSplit.GnosisName + "RightTile"; newSibling.Order = 2; currentTileController.ControlImplementation.GnosisName = newParentSplit.GnosisName + "LeftTile"; currentTileController.ControlImplementation.Order = 1; } }
public GnosisSplit FindParent(IGnosisContainerImplementation child, GnosisSplit currentNode) { GnosisSplit parent = null; if (currentNode.Splits != null) { while (parent == null) { foreach (GnosisSplit split in currentNode.Splits) { if (split == child) { parent = currentNode; } else { parent = FindParent(child, split); } } break; } } else { foreach (GnosisTile tile in currentNode.Tiles) { if (tile == child) { parent = currentNode; break; } } } return(parent); }
public void AddTile(GnosisTileController currentTileController, GnosisController.TilePosition newTilePosition) { //Create new sibling Tile and new parent Split //currentTile becomes a child of the new parent //new parent split GnosisSplit newParentSplit = GnosisControlCreator.CreateGnosisSplit(currentTileController.ControlImplementation.Order); GnosisSplitController newParentSplitController = new GnosisSplitController(newParentSplit, currentTileController.EntityController, currentTileController.Parent); //new split detail GnosisSplitDetail splitDetail = new GnosisSplitDetail(); splitDetail.ID = GlobalData.Singleton.GetNewControlID(); splitDetail.Order = 0; splitDetail._GnosisOrientation = GnosisController.OrientationType.LANDSCAPE; splitDetail.SplitPercentage = 50; if (newTilePosition == GnosisController.TilePosition.TOP || newTilePosition == GnosisController.TilePosition.BOTTOM) { splitDetail._SplitDirection = GnosisController.DirectionType.HORIZONTAL; } else { splitDetail._SplitDirection = GnosisController.DirectionType.VERTICAL; } newParentSplit.SplitDetails = new List <GnosisSplitDetail>(); newParentSplit.SplitDetails.Add(splitDetail); //newParentSplit.GnosisSplitDetails = new GnosisSplitDetail[2]; //newParentSplit.GnosisSplitDetails[0] = splitDetail; //new sibling tile GnosisTile newSiblingTile = new GnosisTile(); newSiblingTile.ID = GlobalData.Singleton.GetNewControlID(); AssignNamesAndOrders(newParentSplit, splitDetail, currentTileController, newSiblingTile, newTilePosition); //store old parent GnosisSplitController oldParent = (GnosisSplitController)currentTileController.Parent; //remove current tile from old parent oldParent.RemoveChild(currentTileController); //add current tile and new sibling to new parent newParentSplitController.AddChildModel(newSiblingTile); newParentSplitController.AddChildController(currentTileController); newParentSplitController.BuildContent(); //add new parent to old parent oldParent.AddChildController(newParentSplitController); oldParent.BuildContent(); //GnosisParentWindow parentWindow = (GnosisParentWindow)GlobalData.Singleton.ParentWindowController.ControlImplementation; //GnosisXMLHelper.SaveParentWindow(parentWindow); //newParentSplit.GnosisTiles = new GnosisTile[2]; //if (currentTileController.ControlImplementation.Order == 1) //{ // newParentSplit.GnosisTiles[0] = (GnosisTile)currentTileController.ControlImplementation; // newParentSplit.GnosisTiles[1] = newSiblingTile; //} //else //{ // newParentSplit.GnosisTiles[0] = newSiblingTile; // newParentSplit.GnosisTiles[1] = (GnosisTile)currentTileController.ControlImplementation; //} ////remove current tile from old parent and replace it with new split //GnosisSplit oldParent = (GnosisSplit)currentTileController.ParentSplitController.ControlImplementation; //oldParent.RemoveTile((GnosisTile)currentTileController.ControlImplementation); //oldParent.AddSplit(newParentSplit); //currentTileController.ParentSplitController.ReplaceChild(currentTileController, newParentSplitController); //notify listeners //currentParent.Altered = true; }