public void DrawWorkspacesList(IPlatformDrawer platform, Rect bounds, List<WorkspacesListItem> items) { platform.DrawStretchBox(bounds, CachedStyles.WizardSubBoxStyle, 13); var scrollBounds = bounds.Translate(15, 0).Pad(0, 0, 15, 0); bounds = bounds.PadSides(15); var headerRect = bounds.WithHeight(40); platform.DrawLabel(headerRect, "Workspaces", CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.TopCenter); var unpaddedItemRect = bounds.Below(headerRect).WithHeight(100); var workspaces = items.ToArray(); var position = scrollBounds.Below(headerRect).Clip(scrollBounds).Pad(0, 0, 0, 55); var usedRect = position.Pad(0, 0, 15, 0).WithHeight((unpaddedItemRect.height + 1) * workspaces.Length); _scrollPos = GUI.BeginScrollView(position, _scrollPos, usedRect); foreach (var db in workspaces) { var workspace = db; platform.DrawStretchBox(unpaddedItemRect, CachedStyles.WizardListItemBoxStyle, 2); var itemRect = unpaddedItemRect.PadSides(15); var titleRect = itemRect.WithHeight(40); platform.DrawLabel(titleRect, db.Workspace.Title, CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.TopLeft); var infoRect = itemRect.Below(titleRect).WithHeight(30); //(platform as UnityDrawer).DrawInfo(infoRect, string.Format("Namespace: {0}\nPath: {1}", db.GraphConfiguration.Namespace ?? "-", db.GraphConfiguration.FullPath)); var openButton = new Rect().WithSize(80, 25).InnerAlignWithBottomRight(itemRect); var configButton = openButton.LeftOf(openButton).Translate(-2, 0); var deleteButton = configButton.LeftOf(configButton).Translate(-2, 0); platform.DoButton(openButton, "Open", ElementDesignerStyles.DarkButtonStyle, () => { Execute(new OpenWorkspaceCommand() { Workspace = workspace.Workspace }); EnableWizard = false; }); var db1 = db; platform.DoButton(configButton, "Config", ElementDesignerStyles.DarkButtonStyle, () => InvokeConfigFor(db1)); platform.DoButton(deleteButton, "Remove", ElementDesignerStyles.DarkButtonStyle, () => { Execute(new RemoveWorkspaceCommand() { Workspace = workspace.Workspace }); }); //platform.DoButton(showButton, "Show In Explorer", ElementDesignerStyles.ButtonStyle, () => { }); unpaddedItemRect = unpaddedItemRect.Below(unpaddedItemRect).Translate(0, 1); } GUI.EndScrollView(true); }
public void DrawGraphsList(Rect bounds, List<IGraphData> items) { PlatformDrawer.DrawStretchBox(bounds, CachedStyles.WizardSubBoxStyle, 13); var scrollBounds = bounds.Translate(15,0).Pad(0,0,15,0); bounds = bounds.PadSides(15); var headerRect = bounds.WithHeight(40); PlatformDrawer.DrawLabel(headerRect, string.Format("{0} Graphs", WorkspaceService.CurrentWorkspace.Title), CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.TopCenter); var unpaddedItemRect = bounds.Below(headerRect).WithHeight(50); var databasesListItems = items.ToArray(); var position = scrollBounds.Below(headerRect).Clip(scrollBounds).Pad(0, 0, 0, 55); var usedRect = position.Pad(0, 0, 15, 0).WithHeight((unpaddedItemRect.height + 1)*databasesListItems.Length); _scrollPos = GUI.BeginScrollView(position, _scrollPos, usedRect); foreach (var db in databasesListItems) { var db1 = db; var isGraphInWorkspace = WorkspaceService.CurrentWorkspace != null && WorkspaceService.CurrentWorkspace.Graphs.Contains(db1); var cColor = GUI.color; var mColor = new Color(cColor.r, cColor.g, cColor.b, 0.3f); if (!isGraphInWorkspace) GUI.color = mColor; PlatformDrawer.DrawStretchBox(unpaddedItemRect,CachedStyles.WizardListItemBoxStyle,2); if(isGraphInWorkspace) PlatformDrawer.DoButton(unpaddedItemRect.TopHalf(),"",CachedStyles.ClearItemStyle, () => { Execute(new LambdaCommand("Open Graph", () => { WorkspaceService.CurrentWorkspace.AddGraph(db1); WorkspaceService.CurrentWorkspace.CurrentGraphId = db1.Identifier; EnableGraphManagementhWizard = false; })); }); var itemRect = unpaddedItemRect.PadSides(15); var titleRect = itemRect.WithHeight(40); PlatformDrawer.DrawLabel(titleRect,db.Title,CachedStyles.WizardSubBoxTitleStyle,DrawingAlignment.TopLeft); var infoRect = itemRect.Below(titleRect).WithHeight(38); //(PlatformDrawer as UnityDrawer).DrawInfo(infoRect, string.Format("Namespace: {0}\nPath: {1}", db.GraphConfiguration.Namespace ?? "-", db.GraphConfiguration.FullPath)); var openButton = new Rect().WithSize(80,25).InnerAlignWithBottomRight(itemRect).AlignHorisonallyByCenter(itemRect); var configButton = openButton.LeftOf(openButton).Translate(-2,0); var exportButton = openButton.LeftOf(configButton).Translate(-2, 0); var deleteButton = openButton.LeftOf(exportButton).Translate(-2, 0); GUI.color = cColor; PlatformDrawer.DoButton(openButton, isGraphInWorkspace ? "Open" : "Import", ElementDesignerStyles.DarkButtonStyle, () => { /* OPEN DATABASE */ Execute(new LambdaCommand("Open Graph", () => { WorkspaceService.CurrentWorkspace.AddGraph(db1); WorkspaceService.CurrentWorkspace.CurrentGraphId = db1.Identifier; EnableGraphManagementhWizard = false; })); //DatabaseListWindow.Init(new Vector2(Screen.currentResolution.width / 2 - 200, Screen.currentResolution.height/2- 300)); }); //PlatformDrawer.DoButton(configButton, "Config", ElementDesignerStyles.ButtonStyle, () => { /* CONFIG DATABASE */ }); //PlatformDrawer.DoButton(deleteButton, "Delete", ElementDesignerStyles.ButtonStyle, () => { /* SHOW DATABASE IN EXPLORER */ }); //PlatformDrawer.DoButton(exportButton, "Export", ElementDesignerStyles.ButtonStyle, () => { /* SHOW DATABASE IN EXPLORER */ }); unpaddedItemRect = unpaddedItemRect.Below(unpaddedItemRect).Translate(0,1); } GUI.EndScrollView(true); }
public void DrawDatabasesList(IPlatformDrawer Drawer, Rect bounds, List<DatabasesListItem> items) { Drawer.DrawStretchBox(bounds, CachedStyles.WizardSubBoxStyle, 13); var scrollBounds = bounds.Translate(15,0).Pad(0,0,15,0); bounds = bounds.PadSides(15); var headerRect = bounds.WithHeight(40); Drawer.DrawLabel(headerRect, "Databases", CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.TopCenter); var unpaddedItemRect = bounds.Below(headerRect).WithHeight(150); var databasesListItems = items.ToArray(); var position = scrollBounds.Below(headerRect).Clip(scrollBounds).Pad(0, 0, 0, 55); var usedRect = position.Pad(0, 0, 15, 0).WithHeight((unpaddedItemRect.height + 1)*databasesListItems.Length); _scrollPos = GUI.BeginScrollView(position, _scrollPos, usedRect); foreach (var db in databasesListItems) { Drawer.DrawStretchBox(unpaddedItemRect,CachedStyles.WizardListItemBoxStyle,2); var itemRect = unpaddedItemRect.PadSides(15); var titleRect = itemRect.WithHeight(40); Drawer.DrawLabel(titleRect,db.GraphConfiguration.Title,CachedStyles.WizardSubBoxTitleStyle,DrawingAlignment.TopLeft); var infoRect = itemRect.Below(titleRect).WithHeight(50); (Drawer as UnityDrawer).DrawInfo(infoRect,string.Format("Namespace: {0}\nPath: {1}",db.GraphConfiguration.Namespace ?? "-",db.GraphConfiguration.FullPath)); var openButton = new Rect().WithSize(80,25).InnerAlignWithBottomRight(itemRect); var configButton = openButton.LeftOf(openButton).Translate(-2,0); var showButton = configButton.WithWidth(120).InnerAlignWithBottomLeft(itemRect); Drawer.DoButton(openButton, "Open", ElementDesignerStyles.DarkButtonStyle, () => { Signal<IChangeDatabase>(_=>_.ChangeDatabase(db.GraphConfiguration)); }); Drawer.SetTooltipForRect(openButton,"Open this database."); var db1 = db; Drawer.DoButton(configButton, "Config", ElementDesignerStyles.DarkButtonStyle, () => { SelectedItem = new ActionItem() { Command = new EditDatabaseCommand() { Namespace = db1.GraphConfiguration.Namespace, CodePath = db1.GraphConfiguration.CodeOutputPath, Configuration = db1.GraphConfiguration as uFrameDatabaseConfig }, Description = "Configuration", Title = string.Format("Configure {0}", db1.GraphConfiguration.Title), Verb = "Apply" }; }); Drawer.DoButton(showButton, "Show In Explorer", ElementDesignerStyles.DarkButtonStyle, () => { EditorUtility.RevealInFinder(db1.GraphConfiguration.FullPath); }); unpaddedItemRect = unpaddedItemRect.Below(unpaddedItemRect).Translate(0,1); } GUI.EndScrollView(true); }