public override void OnHostingFormLoaded(MainForm mainForm) { if (mainForm.ReferenceEditorElectronicLocationsToolbarsManager?.Tools.Cast <ToolBase>().FirstOrDefault(tool => tool.Key.Equals("ReferenceEditorUriLocationsContextMenu")) is PopupMenuTool popupMenu) { _commandbarButton = CommandbarMenu.Create(popupMenu).InsertCommandbarButton(4, Key_Button_OpenWith, Properties.OpenWithAddonResources.MenuCaption); } base.OnHostingFormLoaded(mainForm); }
public override void OnHostingFormLoaded(MainForm mainForm) { if (!mainForm.IsPreviewFullScreenForm && mainForm.Project.ProjectType == SwissAcademic.Citavi.ProjectType.DesktopSQLite) { if (mainForm.ReferenceEditorElectronicLocationsToolbarsManager?.Tools.Cast <ToolBase>().FirstOrDefault(tool => tool.Key.Equals("ReferenceEditorUriLocationsContextMenu")) is PopupMenuTool popupMenu) { var menu = CommandbarMenu.Create(popupMenu); menu.InsertCommandbarButton(3, Keys_Button_ShowPdfSplitDialog, Properties.Resources.Addon_Command_Caption, image: Properties.Resources.CommandIcon); } } }
public override void OnLocalizing(MainForm mainForm) { if (mainForm.ReferenceEditorElectronicLocationsToolbarsManager?.Tools.Cast <ToolBase>().FirstOrDefault(tool => tool.Key.Equals("ReferenceEditorUriLocationsContextMenu")) is PopupMenuTool popupMenu) { var menu = CommandbarMenu.Create(popupMenu); if (menu.GetCommandbarButton(Keys_Button_ShowPdfSplitDialog) is CommandbarButton button) { button.Text = Properties.Resources.Addon_Command_Caption; } } }
public override void OnApplicationIdle(MainForm mainForm) { if (mainForm.ReferenceEditorElectronicLocationsToolbarsManager?.Tools.Cast <ToolBase>().FirstOrDefault(tool => tool.Key.Equals("ReferenceEditorUriLocationsContextMenu")) is PopupMenuTool popupMenu) { if (Application.OpenForms.OfType <GenericProgressDialog>().ToList() is List <GenericProgressDialog> dialogs && dialogs.Any()) { if (dialogs.Any(dialog => dialog.GetType().GetProperty("DialogOwner", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(dialog) == mainForm)) { return; } } var menu = CommandbarMenu.Create(popupMenu); if (menu.GetCommandbarButton(Keys_Button_ShowPdfSplitDialog) is CommandbarButton button) { var selectedElectronicLocations = mainForm.GetSelectedElectronicLocations(); var selectedReferences = mainForm.GetSelectedReferences(); var reference = mainForm.ActiveReference; if (selectedElectronicLocations.Count == 1 && selectedReferences.Count == 1 && reference != null) { var location = selectedElectronicLocations.FirstOrDefault(); if (location != null) { try { var path = location.Address.Resolve().GetLocalPathSafe(); if (!string.IsNullOrEmpty(path)) { button.Visible = path.EndsWith("pdf") && reference.ChildReferences.Count != 0; base.OnApplicationIdle(mainForm); return; } } catch (Exception ignored) { // fix issue if time zone corrective logic enabled } } } button.Visible = false; } } }
protected override void OnHostingFormLoaded(System.Windows.Forms.Form hostingForm) { MainForm mainForm = (MainForm)hostingForm; var referencesMenu = mainForm.GetMainCommandbarManager().GetReferenceEditorCommandbar(MainFormReferenceEditorCommandbarId.Menu).GetCommandbarMenu(MainFormReferenceEditorCommandbarMenuId.References); var commandbarButtonParallelReportersParse = referencesMenu.AddCommandbarButton("ParallelReportersParse", ReferencesToolboxLocalizations.ParallelReportersParse); commandbarButtonParallelReportersParse.Shortcut = ((Shortcut)(Keys.Control | Keys.Shift | Keys.P)); commandbarButtonParallelReportersParse.HasSeparator = true; referencesMenu.AddCommandbarButton("ShorthandChangeInParallelReporters", ReferencesToolboxLocalizations.ShorthandChangeInParallelReporters); referencesMenu.AddCommandbarButton("PageRangeAssign", ReferencesToolboxLocalizations.PageRangeAssign); // Reference Editor Attachment Pop-Up Menu var referenceEditorUriLocationsContextMenu = CommandbarMenu.Create(mainForm.GetReferenceEditorElectronicLocationsCommandbarManager().ToolbarsManager.Tools["ReferenceEditorUriLocationsContextMenu"] as PopupMenuTool); var commandBarButtonCopyLocationPathToClipboard = referenceEditorUriLocationsContextMenu.AddCommandbarButton("CopyLocationPathToClipboard", ReferencesToolboxLocalizations.CopyLocationPathToClipboard); // Fin base.OnHostingFormLoaded(hostingForm); }
// Methods public CommandbarMenu GetCommandbarMenu(MacroEditorFormCommandbarMenuId macroEditorFormCommandbarMenuId) { switch (macroEditorFormCommandbarMenuId) { case MacroEditorFormCommandbarMenuId.File: return(CommandbarMenu.Create(Toolbar.Tools["FileMenu"] as PopupMenuTool)); case MacroEditorFormCommandbarMenuId.Edit: return(CommandbarMenu.Create(Toolbar.Tools["EditMenu"] as PopupMenuTool)); case MacroEditorFormCommandbarMenuId.Build: return(CommandbarMenu.Create(Toolbar.Tools["BuildMenu"] as PopupMenuTool)); case MacroEditorFormCommandbarMenuId.Tools: return(CommandbarMenu.Create(Toolbar.Tools["ToolsMenu"] as PopupMenuTool)); case MacroEditorFormCommandbarMenuId.Help: return(CommandbarMenu.Create(Toolbar.Tools["HelpMenu"] as PopupMenuTool)); default: return(null); } }
protected override void OnHostingFormLoaded(Form hostingForm) { MainForm mainForm = (MainForm)hostingForm; mainForm.ActiveWorkspaceChanged += PrimaryMainForm_ActiveWorkspaceChanged; // Reference Editor Reference Menu var referencesMenu = mainForm.GetMainCommandbarManager().GetReferenceEditorCommandbar(MainFormReferenceEditorCommandbarId.Menu).GetCommandbarMenu(MainFormReferenceEditorCommandbarMenuId.References); var commandbarButtonMoveAttachment = referencesMenu.AddCommandbarButton("MoveAttachment", "Move local attachments of selected references to a different folder"); commandbarButtonMoveAttachment.HasSeparator = true; var commandbarButtonExportAnnotations = referencesMenu.AddCommandbarButton("ExportAnnotations", "Export quotations in selected references as PDF highlights"); commandbarButtonExportAnnotations.HasSeparator = true; var commandbarButtonExportBookmarks = referencesMenu.AddCommandbarButton("ExportBookmarks", "Export quick references in selected references as PDF bookmarks"); // Preview Tool Menu var previewCommandbarMenuTools = (mainForm.GetPreviewCommandbar(MainFormPreviewCommandbarId.Toolbar).GetCommandbarMenu(MainFormPreviewCommandbarMenuId.Tools)); var annotationsImportCommandbarMenu = previewCommandbarMenuTools.AddCommandbarMenu("AnnotationsImportCommandbarMenu", "Import annotations…", CommandbarItemStyle.Default); annotationsImportCommandbarMenu.HasSeparator = true; annotationsImportCommandbarMenu.AddCommandbarButton("ImportDirectQuotations", "Import direct quotations in active document"); annotationsImportCommandbarMenu.AddCommandbarButton("ImportIndirectQuotations", "Import indirect quotations in active document"); annotationsImportCommandbarMenu.AddCommandbarButton("ImportComments", "Import comments in active document"); annotationsImportCommandbarMenu.AddCommandbarButton("ImportQuickReferences", "Import quick references in active document"); annotationsImportCommandbarMenu.AddCommandbarButton("ImportSummaries", "Import summaries in active document"); var commandBarButtonMergeAnnotations = previewCommandbarMenuTools.AddCommandbarButton("MergeAnnotations", "Merge annotations", CommandbarItemStyle.Default); commandBarButtonMergeAnnotations.HasSeparator = true; var commandBarButtonRedrawAnnotations = previewCommandbarMenuTools.AddCommandbarButton("SimplifyAnnotations", "Redraw annotations", CommandbarItemStyle.Default); // Quotations Pop-Up Menu var referenceEditorQuotationsContextMenu = CommandbarMenu.Create(mainForm.GetReferenceEditorQuotationsCommandbarManager().ToolbarsManager.Tools["ReferenceEditorQuotationsContextMenu"] as PopupMenuTool); var positionContextMenu = referenceEditorQuotationsContextMenu.AddCommandbarMenu("PositionContextMenu", "Quotation Position", CommandbarItemStyle.Default); positionContextMenu.HasSeparator = true; var commandbarButtonKnowledgeItemsSortInReference = positionContextMenu.AddCommandbarButton("KnowledgeItemsSortInReference", "Sort selected quotations by position in PDF"); commandbarButtonKnowledgeItemsSortInReference.Shortcut = Shortcut.CtrlK; var commandbarButtonPageAssignFromPositionInPDF = positionContextMenu.AddCommandbarButton("PageAssignFromPositionInPDF", "Assign a page range to selected quote based on the PDF position"); commandbarButtonPageAssignFromPositionInPDF.HasSeparator = true; positionContextMenu.AddCommandbarButton("PageAssignFromPreviousQuotation", "Assign page range and numbering type from previous quote to selected quote"); var commandbarButtonShowQuotationAndSetPageRangeManually = positionContextMenu.AddCommandbarButton("ShowQuotationAndSetPageRangeManually", "Assign page range manually after showing selected quote in PDF"); commandbarButtonShowQuotationAndSetPageRangeManually.Shortcut = Shortcut.CtrlDel; var commentsContextMenu = referenceEditorQuotationsContextMenu.AddCommandbarMenu("CommentsContextMenu", "Comments", CommandbarItemStyle.Default); var commandbarButtonCommentAnnotation = commentsContextMenu.AddCommandbarButton("CommentAnnotation", "Link comment to same text in PDF as related quote"); commentsContextMenu.AddCommandbarButton("LinkQuotations", "Link selected quote and comment"); var commandbarButtonCreateCommentOnQuotation = commentsContextMenu.AddCommandbarButton("CreateCommentOnQuotation", "Create comment on selected quote"); commandbarButtonCreateCommentOnQuotation.Shortcut = Shortcut.CtrlShiftK; var commandbarButtonSelectLinkedKnowledgeItem = commentsContextMenu.AddCommandbarButton("SelectLinkedKnowledgeItem", "Jump to related quote or comment"); commandbarButtonSelectLinkedKnowledgeItem.Shortcut = Shortcut.AltRightArrow; var quickReferencesContextMenu = referenceEditorQuotationsContextMenu.AddCommandbarMenu("QuickReferencesContextMenu", "Quick References", CommandbarItemStyle.Default); quickReferencesContextMenu.AddCommandbarButton("QuickReferenceTitleCase", "Write core statement in title case in selected quick references"); var commandbarButtonConvertDirectQuoteToRedHighlight = quickReferencesContextMenu.AddCommandbarButton("ConvertDirectQuoteToRedHighlight", "Convert selected quotations to quick references"); var commandbarButtonCleanQuotationsText = referenceEditorQuotationsContextMenu.AddCommandbarButton("CleanQuotationsText", "Clean text of selected quotations"); commandbarButtonCleanQuotationsText.Shortcut = Shortcut.ShiftDel; var commandbarButtonQuotationsMerge = referenceEditorQuotationsContextMenu.AddCommandbarButton("QuotationsMerge", "Merge selected quotations"); var commandbarButtonCreateSummaryOnQuotations = referenceEditorQuotationsContextMenu.AddCommandbarButton("CreateSummaryOnQuotations", "Create summary of selected quotes"); // Reference Editor Attachment Pop-Up Menu var referenceEditorUriLocationsContextMenu = CommandbarMenu.Create(mainForm.GetReferenceEditorElectronicLocationsCommandbarManager().ToolbarsManager.Tools["ReferenceEditorUriLocationsContextMenu"] as PopupMenuTool); // Knowledge Item Pop-Up Menu var knowledgeOrganizerKnowledgeItemsContextMenu = CommandbarMenu.Create(mainForm.GetKnowledgeOrganizerKnowledgeItemsCommandbarManager().ToolbarsManager.Tools["KnowledgeOrganizerKnowledgeItemsContextMenu"] as PopupMenuTool); var commandBarButtonOpenKnowledgeItemAttachment = knowledgeOrganizerKnowledgeItemsContextMenu.AddCommandbarButton("OpenKnowledgeItemAttachment", "Open the attachment in new window"); commandBarButtonOpenKnowledgeItemAttachment.HasSeparator = true; knowledgeOrganizerKnowledgeItemsContextMenu.AddCommandbarButton("SelectLinkedKnowledgeItem", "Jump to the linked knowledge item"); var commandbarButtonKnowledgeItemsSortInCategory = knowledgeOrganizerKnowledgeItemsContextMenu.AddCommandbarButton("SortKnowledgeItemsInSelection", "Sort selected knowledge items in current category by reference and position"); // Knowledge Organizer Category Pop-Up Menu var knowledgeOrganizerCategoriesColumnContextMenu = CommandbarMenu.Create(mainForm.GetKnowledgeOrganizerCategoriesCommandbarManager().ToolbarsManager.Tools["KnowledgeOrganizerCategoriesColumnContextMenu"] as PopupMenuTool); var commandbarButtonSortKnowledgeItemsInCategory = knowledgeOrganizerCategoriesColumnContextMenu.AddCommandbarButton("SortKnowledgeItemsInCategory", "Sort all knowledge items in this category by reference and position"); commandbarButtonSortKnowledgeItemsInCategory.HasSeparator = true; // Fin base.OnHostingFormLoaded(hostingForm); }