public GraphViewGroup(ViewGroupManager owner, EditorWindowConfigSource configSource, string stateConfigName, string containerConfigName, string dragId = null) : base(owner) { m_WindowConfig = configSource; if (m_WindowConfig != null) { if (m_WindowConfig.FindProperty(mainButtonOnConfigKey) != null) { m_IsMainButtonOn = m_WindowConfig.GetValue <bool>(mainButtonOnConfigKey); } if (configSource.FindProperty(stateConfigName) != null) { m_TreeViewState = configSource.GetValue <TreeViewState>(stateConfigName); } if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); if (configSource.FindProperty(stateConfigName) != null) { configSource.SetValue(stateConfigName, m_TreeViewState); } configSource.SetConfigDirty(); } m_TreeViewState.SetConfigSource(configSource); if (configSource.FindProperty(containerConfigName) != null) { m_TreeItemContainer = configSource.GetValue <TreeItemContainer>(containerConfigName); } if (m_TreeItemContainer == null) { m_TreeItemContainer = ScriptableObject.CreateInstance <TreeItemContainer>(); m_TreeItemContainer.ConfigSource = configSource; if (configSource.FindProperty(containerConfigName) != null) { configSource.SetValue(containerConfigName, m_TreeItemContainer); } configSource.SetConfigDirty(); } else { m_TreeItemContainer.ConfigSource = configSource; m_TreeItemContainer.UpdateItemsParent(); } } m_GraphView = new GraphView(owner, configSource); m_HorizontalSplitLine = new HorizontalSplitLine(m_SplitLineStartPosX, HorizontalSplitLineMinX); m_HorizontalSplitLine.ConfigSource = configSource; m_ObjectTreeViewGroup = new ObjectTreeViewGroup(owner, configSource, stateConfigName, containerConfigName, dragId); m_TreeView = m_ObjectTreeViewGroup.GetTreeView(); m_SearchBar = new SearchBar(owner); m_SearchBar.OnGUIAction += ShowBarGUI; }
public FolderTreeViewGroup(ViewGroupManager owner, EditorWindowConfigSource configSource, string stateConfigName, string containerConfigName, string dragId = null) : base(owner) { m_ConfigSource = configSource; if (configSource != null) { m_TreeViewState = configSource.GetValue <TreeViewState>(stateConfigName); if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); configSource.SetValue(stateConfigName, m_TreeViewState); configSource.SetConfigDirty(); } m_TreeViewState.SetConfigSource(configSource); m_TreeItemContainer = configSource.GetValue <FolderTreeItemContainer>(containerConfigName); if (m_TreeItemContainer == null) { m_TreeItemContainer = ScriptableObject.CreateInstance <FolderTreeItemContainer>(); m_TreeItemContainer.ConfigSource = configSource; configSource.SetValue(containerConfigName, m_TreeItemContainer); configSource.SetConfigDirty(); } else { m_TreeItemContainer.ConfigSource = configSource; m_TreeItemContainer.UpdateItemsParent(); } } if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); } m_TreeView = new TreeView(owner.WindowOwner, m_TreeViewState); m_DataSource = new FolderTreeViewDataSource(m_TreeView, m_TreeItemContainer, m_ConfigSource); m_TreeViewGUI = new FolderTreeViewGUI(m_TreeView, m_TreeItemContainer); m_TreeViewDragging = new FolderTreeViewDragging(m_TreeView, dragId != null ? dragId : m_TreeView.GetHashCode().ToString()); DeleteItemsAction += DeleteItems; DuplicateItemsAction += DuplicateItems; m_TreeViewGUI.RenameEndAction += RenameItem; m_TreeViewGUI.BeginRenameAction += () => { m_TreeView.state.renameOverlay.isRenamingFilename = true; }; m_TreeViewDragging.EndDragAction += (hasError) => { if (hasError) { m_TreeItemContainer.UpdateValidItems(); } m_TreeView.data.RefreshData(); m_ConfigSource.SetConfigDirty(); }; }
public FolderTreeViewDataSource(TreeView treeView, FolderTreeItemContainer dataContainer = null, EditorWindowConfigSource configSource = null) : base(treeView) { //showRootItem = false; //rootIsCollapsable = false; m_DataContainer = dataContainer; if (m_DataContainer == null) { m_DataContainer = new FolderTreeItemContainer(); } m_ConfigSource = configSource; }
public void LoadConfig(string configName, EditorWindowConfigSource configSource) { m_SearchTextConfigName = configName; m_WindowConfigSource = configSource; if (m_WindowConfigSource != null && !string.IsNullOrEmpty(m_SearchTextConfigName)) { var text = m_WindowConfigSource.GetValue <string>(m_SearchTextConfigName); if (!string.IsNullOrEmpty(text)) { SearchText = text; } } }
public void SetConfigSource(EditorWindowConfigSource configSource) { m_ConfigSource = configSource; if (m_ItemList == null) { m_ItemList = new List <GridItem>(); } else { foreach (var item in m_ItemList) { item.SetConfigSource(configSource); } } }
public virtual void ChangeWindowConfigSource(EditorWindowConfigSource configSource) { if (configSource != m_WindowConfigSource) { if (m_WindowConfigSource != null) { m_WindowConfigSource.SaveConfigLazily(); } m_WindowConfigSource = configSource; if (ConfigSourceChangedAction != null) { ConfigSourceChangedAction(); } } }
public void LoadConfig(string configName, EditorWindowConfigSource configSource) { if (configSource != null && !string.IsNullOrEmpty(configName)) { var viewConfig = configSource.GetValue <GridViewConfig>(configName); if (viewConfig != null) { viewConfig.SetConfigSource(configSource); m_ViewConfig = viewConfig; if (GridSizeChangedAction != null) { GridSizeChangedAction(m_ViewConfig.GridSize); } } else { viewConfig = new GridViewConfig(); viewConfig.SetConfigSource(configSource); configSource.SetValue(configName, viewConfig); } } }
public ObjectTreeViewGroup(ViewGroupManager owner, EditorWindowConfigSource configSource, string stateConfigName, string containerConfigName, string dragId = null) : base(owner) { m_ConfigSource = configSource; if (configSource != null) { if (configSource.FindProperty(stateConfigName) != null) { m_TreeViewState = configSource.GetValue <TreeViewState>(stateConfigName); } if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); if (configSource.FindProperty(stateConfigName) != null) { configSource.SetValue(stateConfigName, m_TreeViewState); } configSource.SetConfigDirty(); } m_TreeViewState.SetConfigSource(configSource); if (configSource.FindProperty(containerConfigName) != null) { m_TreeItemContainer = configSource.GetValue <TreeItemContainer>(containerConfigName); } if (m_TreeItemContainer == null) { m_TreeItemContainer = ScriptableObject.CreateInstance <TreeItemContainer>(); m_TreeItemContainer.ConfigSource = configSource; if (configSource.FindProperty(containerConfigName) != null) { configSource.SetValue(containerConfigName, m_TreeItemContainer); } configSource.SetConfigDirty(); } else { m_TreeItemContainer.ConfigSource = configSource; m_TreeItemContainer.UpdateItemsParent(); } } if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); } m_TreeView = new TreeView(owner.WindowOwner, m_TreeViewState); dataSource = new ObjectTreeViewDataSource(m_TreeView, m_TreeItemContainer, m_ConfigSource); m_TreeViewGUI = new ObjectTreeViewGUI(m_TreeView); m_TreeViewDragging = new ObjectTreeViewDragging(m_TreeView, dragId != null ? dragId : m_TreeView.GetHashCode().ToString()); DeleteItemsAction += DeleteItems; DuplicateItemsAction += DuplicateItems; m_TreeViewGUI.BeginRenameAction += () => { if (needUndo) { Undo.RegisterCompleteObjectUndo(m_TreeItemContainer, "Rename Item"); } }; m_TreeViewDragging.PrepareDoDrag += () => { if (needUndo) { Undo.RegisterCompleteObjectUndo(m_TreeItemContainer, "Reparent Item"); } }; }
public FolderGridViewGroup(ViewGroupManager owner, EditorWindowConfigSource configSource, string stateConfigName, string containerConfigName, string dragId = null) : base(owner) { m_ConfigSource = configSource; m_ItemDataSource = new ItemDataSource(); m_SearchBar = new SearchBar(owner); m_SearchBar.UpOrDownArrowPressedAction += SearchBarUpOrDownArrowPressedAction; m_SearchBar.OnTextChangedAction += (str) => UpdateItemsBySearchText(); dragId = dragId != null ? dragId : GetHashCode().ToString(); m_FolderTreeViewGroup = new FolderTreeViewGroup(owner, configSource, stateConfigName, containerConfigName, dragId); m_GridViewDataSource = new GridViewDataSource(); var layout = new GenericGridLayouter(m_GridViewDataSource); var viewHandler = new FolderGridViewHandler(layout.DataSource); viewHandler.TreeViewDragging = m_FolderTreeViewGroup.GetTreeViewDragging(); m_GridView = new GridView(owner, layout, viewHandler); m_GridView.KeyboardCallback += ListAreaKeyboardCallback; m_GridView.ItemExpandedAction += ItemExpandedAction; m_GridView.BeginRenameAction += ItemBeginRenameAction; m_GridView.RenameEndAction += ItemRenameEndAction; m_GridView.ItemDoubleClickAction += ItemDoubleClick; m_GridView.ItemSelectedAction += GridViewItemSelected; m_GridView.ViewHandler.GenericDragId = dragId; m_GridView.GridSizeChangedAction += (size) => { m_BottomBar.Value = size; }; m_BreadcrumbBar = new BreadcrumbBar(owner); m_BreadcrumbBar.ShowFolderContentsAction += (id) => { m_TreeView.SetSelection(new int[] { id }, false); UpdateBreadcrumbBarContents(); UpdateGridViewContent(); }; m_BottomBar = new BottomBar(owner); m_BottomBar.Value = m_GridView.GridSize; m_BottomBar.MinValue = m_GridView.ViewLayouter.LayoutParams.MinGridSize; m_BottomBar.MaxValue = m_GridView.ViewLayouter.LayoutParams.MaxGridSize; m_BottomBar.OnValueChangedAction += (size) => { m_GridView.GridSize = size; }; GridViewDeleteAction += DeleteGridItems; m_TreeView = m_FolderTreeViewGroup.GetTreeView(); m_BreadcrumbBar.FolderTreeView = m_TreeView; m_FolderTreeViewGroup.GetFolderTreeViewGUI().RenameEndAction += (item, name) => { UpdateBreadcrumbBarContents(); }; m_HorizontalSplitLine = new HorizontalSplitLine(m_SplitLineStartPosX, HorizontalSplitLineMinX); m_HorizontalSplitLine.PositionChangedAction += RefreshSplittedSelectedPath; m_HorizontalSplitLine.ConfigSource = configSource; m_ItemDataSource.SetConfigSource(configSource); m_TreeView.selectionChangedCallback += FolderTreeViewSelectionChanged; m_FolderTreeViewGroup.GetTreeViewDragging().EndDragAction += (hasError) => { UpdateGridViewContent(); }; m_FolderTreeViewGroup.DuplicateItemsDone += UpdateGridViewContent; GetDataContainer().UpdateItemChangedAction += () => { UpdateGridViewContent(); CheckBottomBarItemValidity(); UpdateBreadcrumbBarContents(); }; DuplicateItemsAction += DuplicateItemGridView; }
public void SetConfigSource(EditorWindowConfigSource config) { m_ConfigSource = config; }
public void SetConfigSource(EditorWindowConfigSource source) { m_ConfigSource = source; }
public GraphView(ViewGroupManager owner, EditorWindowConfigSource windowConfig) : base(owner) { m_WindowConfig = windowConfig; Undo.undoRedoPerformed += UndoRedoPerformedAction; }
public virtual void SetConfigSource(EditorWindowConfigSource configSource) { m_EditorWindowConfigSource = configSource; }