/// <summary> /// Plot common columns in two or more tables. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void PlotCommonColumns(this ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems(); var command = new Altaxo.Worksheet.Commands.PlotCommonColumnsCommand(); foreach (object item in list) { if (item is DataTable) { command.Tables.Add((DataTable)item); } } if (command.Tables.Count == 0) { return; } var commonColumnNames = command.GetCommonColumnNamesUnordered(); if (0 == commonColumnNames.Count) { Current.Gui.InfoMessageBox("The selected tables do not seem to have common columns", "Please note"); return; } if (true == Current.Gui.ShowDialog(ref command, "Plot common columns", false)) { command.Execute(); } }
/// <summary> /// Moves the selected list items to a folder that is asked for by a dialog. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void CopySelectedListItemsToMultipleFolders(this ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems(); bool areDocumentsFromOneFolder = ctrl.IsProjectFolderSelected(out var originalFolderName); var dlgDoc = new Altaxo.Gui.ProjectBrowser.CopyItemsToMultipleFolderData { RelocateReferences = true }; if (!Current.Gui.ShowDialog(ref dlgDoc, "Select folders to copy to", false)) { return; } foreach (var newFolderName in dlgDoc.FoldersToCopyTo) { DocNodePathReplacementOptions relocateOptions = null; if (true == dlgDoc.RelocateReferences) { relocateOptions = new DocNodePathReplacementOptions(); relocateOptions.AddPathReplacementsForAllProjectItemTypes(originalFolderName, newFolderName); } Current.Project.Folders.CopyItemsToFolder(list, newFolderName, null != relocateOptions ? relocateOptions.Visit : (DocNodeProxyReporter)null, dlgDoc.OverwriteExistingItems); } }
protected override void Run(ProjectBrowseController ctrl) { _lastKnownValue = ViewOnSelect.Off; Ctrl.ViewOnSelectTreeNode = _lastKnownValue; if (null != IsCheckedChanged) IsCheckedChanged(this, EventArgs.Empty); }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType <Altaxo.Graph.GraphDocumentBase>(); int count = list.Count(); if (count == 0) { Current.Gui.ErrorMessageBox("There were no graph documents selected for rescaling!", "No graph documents selected"); return; } else { foreach (var graph in list) { if (graph is Altaxo.Graph.Gdi.GraphDocument gdiDoc) { RescaleAllLayers(gdiDoc); } else if (graph is Altaxo.Graph.Graph3D.GraphDocument graph3DDoc) { RescaleAllLayers(graph3DDoc); } else { throw new NotImplementedException("This type of graph document is not known here."); } } Current.Gui.InfoMessageBox(string.Format("Axes of {0} graph document(s) rescaled.", list.Count()), "Success"); } }
/// <summary> /// Moves the selected list items to a folder that is asked for by a dialog. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void CopySelectedListItemsToFolder(this ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems(); bool areDocumentsFromOneFolder = ctrl.IsProjectFolderSelected(out var originalFolderName); CopyDocuments(list, areDocumentsFromOneFolder, originalFolderName); }
/// <summary> /// Creates a new empty graph in the current project folder, and shows it in the document area. /// </summary> /// <param name="ctrl">Project browse controller.</param> /// <returns>The graph controller used to show the newly created graph.</returns> public static Altaxo.Gui.Graph.Gdi.Viewing.IGraphController CreateNewGraph(this ProjectBrowseController ctrl) { if (!ctrl.IsProjectFolderSelected(out var folderName)) { folderName = ProjectFolder.RootFolderName; } return(Current.ProjectService.CreateNewGraphInFolder(folderName)); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.ViewOnSelectListNodeOn = true; if (null != IsCheckedChanged) { IsCheckedChanged(this, EventArgs.Empty); } }
public void SilentSelectTreeNode(Collections.NGTreeNode node) { // Trick to silently select the node: disable the controller temporarily var helper = _controller; _controller = null; node.IsSelected = true; _controller = helper; }
/// <summary> /// Rename the project folder, if a project folder is selected in the tree view. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void RenameTreeNode(this ProjectBrowseController ctrl) { if (!ctrl.IsProjectFolderSelected(out var folderName)) { return; } ctrl.Project.Folders.ShowFolderRenameDialog(folderName); }
public static void PasteItemsFromClipboard(this ProjectBrowseController ctrl) { if (!ctrl.IsProjectFolderSelected(out var folderName)) { folderName = string.Empty; } Altaxo.Main.Commands.ProjectItemCommands.PasteItemsFromClipboard(folderName); }
/// <summary> /// Hide the selected list items, so that they are not shown in the document area. /// </summary> /// <param name="ctrl"></param> public static void HideSelectedListItems(this ProjectBrowseController ctrl) { var selItems = ctrl.GetSelectedListItems(); foreach (object item in Current.Project.Folders.GetExpandedProjectItemSet(selItems)) { Current.IProjectService.CloseDocumentViews(item); } }
/// <summary> /// Show the items currently selected in the document area. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void ShowSelectedListItem(this ProjectBrowseController ctrl) { var list = Current.Project.Folders.GetExpandedProjectItemSet(ctrl.GetSelectedListItems()); foreach (object item in list) { Current.IProjectService.ShowDocumentView(item); } }
protected override void Run(ProjectBrowseController ctrl) { _lastKnownValue = ViewOnSelect.Off; Ctrl.ViewOnSelectTreeNode = _lastKnownValue; if (null != IsCheckedChanged) { IsCheckedChanged(this, EventArgs.Empty); } }
protected override void Run(ProjectBrowseController ctrl) { var list = Current.Project.Folders.GetExpandedProjectItemSet(ctrl.GetAllListItems()); foreach (var item in list) { Current.IProjectService.CloseDocumentViews(item); } }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetAllListItems(); foreach (var item in list) { Current.IProjectService.CloseDocumentViews(item); } }
/// <summary> /// Creates a new text document in the current project folder, and shows it in the document area. /// </summary> /// <param name="ctrl">Project browse controller.</param> /// <returns>The text controller used to show the newly created notes document.</returns> public static void CreateNewTextDocument(this ProjectBrowseController ctrl) { if (!ctrl.IsProjectFolderSelected(out string folderName)) { folderName = ProjectFolder.RootFolderName; } var doc = Current.ProjectService.CreateDocument <Altaxo.Text.TextDocument>(folderName); Current.ProjectService.OpenOrCreateViewContentForDocument(doc); }
/// <summary> /// Moves the selected list items to a folder that is asked for by a dialog. /// </summary> /// <param name="ctrl">Project browse controller.</param> public static void CopySelectedListItemsToClipboard(this ProjectBrowseController ctrl) { var selItems = ctrl.GetSelectedListItems(); // if the items are from the same folder, but are selected from the AllItems, AllWorksheet or AllGraphs nodes, we invalidate the folderName (because then we consider the items to be rooted) if (!ctrl.IsProjectFolderSelected(out var folderName)) { folderName = null; } var list = Current.Project.Folders.GetExpandedProjectItemSet(selItems); // Expand the list to get rid of the ProjectFolder items Altaxo.Main.Commands.ProjectItemCommands.CopyItemsToClipboard(list, folderName); }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType <Altaxo.Graph.Gdi.GraphDocument>(); int count = list.Count(); if (count == 0) { return; } else { Altaxo.Graph.Gdi.GraphDocumentOtherActions.ShowExchangeTablesOfPlotItemsDialog(list); } }
public ProjectBrowseControl() { InitializeComponent(); _controller = new ProjectBrowseController(); ContextMenu mnu1 = MenuService.CreateContextMenu(this._controller, "/Altaxo/Pads/ProjectBrowser/ItemList/ContextMenu"); _listView.ContextMenu = mnu1; ContextMenu mnu2 = MenuService.CreateContextMenu(this._controller, "/Altaxo/Pads/ProjectBrowser/TreeView/ContextMenu"); _treeView.ContextMenu = mnu2; _treeNodeContextMenu = MenuService.CreateContextMenu(this._controller, "/Altaxo/Pads/ProjectBrowser/TreeNode/ContextMenu"); _controller.ViewObject = this; }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType <Altaxo.Graph.GraphDocumentBase>(); int count = list.Count(); if (count == 0) { return; } if (count == 1) { Altaxo.Graph.GraphDocumentBaseExportActions.ShowFileExportSpecificDialog(list.First()); } else { Altaxo.Graph.GraphDocumentBaseExportActions.ShowExportMultipleGraphsDialogAndExportOptions(list); } }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType <Altaxo.Graph.Gdi.GraphDocument>(); int count = list.Count(); if (count == 0) { Current.Gui.ErrorMessageBox("There were no graph documents selected for resizing!", "No graph documents selected"); return; } else { if (Altaxo.Gui.Graph.Graph2D.ResizeGraphController.ShowResizeGraphDialog(list)) { Current.Gui.InfoMessageBox(string.Format("{0} graph(s) resized.", list.Count()), "Success"); } } }
public static void RenameSelectedListItem(this ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems(); if (list.Count != 1) { return; } var obj = list[0]; if (obj is IProjectItem) { Altaxo.Main.Commands.ProjectItemCommands.ShowRenameDialog((IProjectItem)obj); } else if (obj is ProjectFolder) { ctrl.Project.Folders.ShowFolderRenameDialog((ProjectFolder)obj); } }
/// <summary> /// Creates a new folder text document in the current project folder (i.e. a text document which has the same name as the folder), and shows it in the document area. /// </summary> /// <param name="ctrl">Project browse controller.</param> /// <returns>The text controller used to show the newly created text document.</returns> public static void CreateNewFolderTextDocument(this ProjectBrowseController ctrl) { if (!ctrl.IsProjectFolderSelected(out string folderName)) { folderName = ProjectFolder.RootFolderName; } if (!Current.Project.TextDocumentCollection.Contains(folderName)) { var doc = new Altaxo.Text.TextDocument() { Name = folderName }; Current.Project.TextDocumentCollection.Add(doc); Current.ProjectService.OpenOrCreateViewContentForDocument(doc); } else { Current.Gui.ErrorMessageBox(string.Format("Sorry, this project already contains a text document named '{0}'!", folderName), "TextDocument already exists"); } }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetAllListItems(); foreach (var item in list) Current.ProjectService.CloseDocumentViews(item); }
protected override void Run(ProjectBrowseController ctrl) { ProjectBrowserExtensions.ShowDocumentsExclusively(ctrl.GetAllListItems()); }
protected override void Run(ProjectBrowseController ctrl) { var items = Current.Project.Folders.GetExpandedProjectItemSet(ctrl.GetAllListItems()); Altaxo.Main.ProjectFolders.DeleteDocuments(items); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CopySelectedListItemsToMultipleFolders(); }
protected abstract void Run(ProjectBrowseController ctrl);
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType<Altaxo.Graph.Gdi.GraphDocument>(); int count = list.Count(); if (count == 0) { Current.Gui.ErrorMessageBox("There were no graph documents selected for rescaling!", "No graph documents selected"); return; } else { Altaxo.Graph.Gdi.GraphDocumentExportActions.ShowExportMultipleGraphsDialogAndExportOptions(list); Current.Gui.InfoMessageBox(string.Format("Axes of {0} graph document(s) rescaled.", "Success")); } }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems(); Altaxo.Main.Commands.MultiRenameDocuments.ShowRenameDocumentsDialog(list); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.PlotCommonColumns(); }
public override void Execute(object parameter) { _controller = parameter as ProjectBrowseController; Run((ProjectBrowseController)parameter); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CreateNewFolderTextDocument(); }
public override bool CanExecute(object parameter) { _controller = parameter as ProjectBrowseController; return(base.CanExecute(parameter)); }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType<Altaxo.Graph.Gdi.GraphDocument>(); int count = list.Count(); if (count == 0) return; if (count == 1) Altaxo.Graph.Gdi.GraphDocumentExportActions.ShowFileExportSpecificDialog(list.First()); else Altaxo.Graph.Gdi.GraphDocumentExportActions.ShowExportMultipleGraphsDialogAndExportOptions(list); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.MoveSelectedListItems(); }
protected override void Run(ProjectBrowseController ctrl) { var list = ctrl.GetSelectedListItems().OfType<Altaxo.Graph.Gdi.GraphDocument>(); int count = list.Count(); if (count == 0) { return; } else { Altaxo.Graph.Gdi.GraphDocumentOtherActions.ShowExchangeTablesOfPlotItemsDialog(list); } }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CopySelectedListItemsToFolder(); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.ViewOnSelectListNodeOn = true; if (null != IsCheckedChanged) IsCheckedChanged(this, EventArgs.Empty); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CopySelectedListItemsToClipboard(); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CreateNewStandardWorksheet(); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.RenameTreeNode(); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CreateNewGraph(); }
protected override void Run(ProjectBrowseController ctrl) { ProjectBrowserExtensions.ShowDocumentsExclusively(Current.Project.Folders.GetExpandedProjectItemSet(ctrl.GetAllListItems())); }
protected override void Run(ProjectBrowseController ctrl) { ctrl.CreateNewPropertyBag(); }
protected override void Run(ProjectBrowseController ctrl) { var list = Current.Project.Folders.GetExpandedProjectItemSet(ctrl.GetAllListItems()); foreach (var item in list) Current.ProjectService.CloseDocumentViews(item); }