コード例 #1
0
 private void ButtonTextSentenceSelect_Click(object sender, RoutedEventArgs e)
 {
     pdf_renderer_control.ReconsiderOperationMode(PDFRendererControl.OperationMode.TextSentenceSelect);
 }
コード例 #2
0
        public PDFReadingControl(PDFDocument pdf_document)
        {
            InitializeComponent();

            pdf_renderer_control = new PDFRendererControl(pdf_document, true);
            pdf_renderer_control.OperationModeChanged += pdf_renderer_control_OperationModeChanged;
            pdf_renderer_control.ZoomTypeChanged      += pdf_renderer_control_ZoomTypeChanged;
            pdf_renderer_control.SelectedPageChanged  += pdf_renderer_control_SelectedPageChanged;

            pdf_renderer_control_stats = new PDFRendererControlStats(pdf_renderer_control, pdf_document);

            Utilities.GUI.Animation.Animations.EnableHoverFade(ObjToolbarGrid);

            // Add the renderer control to our grid
            PDFRendererControlArea.Children.Add(pdf_renderer_control);

            HighlightCanvasToolbar.PDFRendererControl = pdf_renderer_control;
            InkCanvasToolbar.PDFRendererControl       = pdf_renderer_control;
            TextCanvasToolbar.PDFRendererControl      = pdf_renderer_control;

            KeyUp += PDFReadingControl_KeyUp;

            ButtonHand.Icon    = Icons.GetAppIcon(Icons.Hand);
            ButtonHand.ToolTip = LocalisationManager.Get("PDF/TIP/MOVE_PAGE");
            ButtonHand.Click  += ButtonHand_Click;

            ButtonTextSentenceSelect.Icon    = Icons.GetAppIcon(Icons.TextSentenceSelect);
            ButtonTextSentenceSelect.ToolTip = LocalisationManager.Get("PDF/TIP/SELECT_TEXT");
            ButtonTextSentenceSelect.Click  += ButtonTextSentenceSelect_Click;

            ButtonAnnotation.Icon    = Icons.GetAppIcon(Icons.Annotation);
            ButtonAnnotation.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_ANNOTATION");
            ButtonAnnotation.Click  += ButtonAnnotation_Click;

            ButtonHighlighter.Icon    = Icons.GetAppIcon(Icons.Highlighter);
            ButtonHighlighter.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_HIGHLIGHT");
            ButtonHighlighter.Click  += ButtonHighlighter_Click;

            ButtonCamera.Icon    = Icons.GetAppIcon(Icons.Camera);
            ButtonCamera.ToolTip = LocalisationManager.Get("PDF/TIP/SNAPSHOT");
            ButtonCamera.Click  += ButtonCamera_Click;

            ButtonInk.Icon    = Icons.GetAppIcon(Icons.Ink);
            ButtonInk.ToolTip = LocalisationManager.Get("PDF/TIP/ADD_INK");
            ButtonInk.Click  += ButtonInk_Click;

            ButtonExplore.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonExplore.AttachPopup(ButtonExplorePopup);
            ButtonExplore.Icon    = Icons.GetAppIcon(Icons.Explore);
            ButtonExplore.ToolTip = LocalisationManager.Get("PDF/TIP/EXPLORE");

            ButtonExpedition.Icon    = Icons.GetAppIcon(Icons.ModuleExpedition);
            ButtonExpedition.Caption = LocalisationManager.Get("PDF/TIP/EXPEDITION");
            ButtonExpedition.Click  += ButtonExpedition_Click;

            ButtonExploreInBrainstorm.Icon    = Icons.GetAppIcon(Icons.ModuleBrainstorm);
            ButtonExploreInBrainstorm.Caption = LocalisationManager.Get("PDF/TIP/BRAINSTORM");
            ButtonExploreInBrainstorm.Click  += ButtonExploreInBrainstorm_Click;

            ButtonInCite.AttachPopup(ButtonInCitePopup);
            ButtonInCite.Icon    = Icons.GetAppIcon(Icons.ModuleInCite);
            ButtonInCite.ToolTip = LocalisationManager.Get("PDF/TIP/INCITE");

            ButtonInCite_Word.Icon    = Icons.GetAppIcon(Icons.InCiteNewCitation);
            ButtonInCite_Word.Caption = LocalisationManager.Get("PDF/CAP/CITE_WORD");
            ButtonInCite_Word.Click  += ButtonInCite_Word_Click;

            ButtonInCite_WordSeparate.Icon    = Icons.GetAppIcon(Icons.InCiteNewCitation);
            ButtonInCite_WordSeparate.Caption = LocalisationManager.Get("PDF/CAP/CITE_WORD_SEPARATE");
            ButtonInCite_WordSeparate.Click  += ButtonInCite_WordSeparate_Click;

            ButtonInCite_Snippet.Icon    = Icons.GetAppIcon(Icons.InCiteCitationSnippet);
            ButtonInCite_Snippet.Caption = LocalisationManager.Get("PDF/CAP/CITE_SNIPPET");
            ButtonInCite_Snippet.Click  += ButtonInCite_Snippet_Click;

            ButtonInCite_BibTeXKey.Icon    = Icons.GetAppIcon(Icons.ExportBibTex);
            ButtonInCite_BibTeXKey.Caption = LocalisationManager.Get("PDF/CAP/CITE_BIBTEX");
            ButtonInCite_BibTeXKey.Click  += ButtonInCite_BibTeXKey_Click;

            ButtonFullScreen.Icon    = Icons.GetAppIcon(Icons.DocumentFullScreen);
            ButtonFullScreen.ToolTip = LocalisationManager.Get("PDF/TIP/FULL_SCREEN");
            ButtonFullScreen.Click  += ButtonFullScreen_Click;

            ButtonZoom.AttachPopup(ButtonZoomPopup);
            ButtonZoom.Icon    = Icons.GetAppIcon(Icons.ZoomIn);
            ButtonZoom.ToolTip = LocalisationManager.Get("PDF/TIP/ZOOM");

            Button1Up.Icon    = Icons.GetAppIcon(Icons.Page1Up);
            Button1Up.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_1");
            Button1Up.Click  += Button1Up_Click;

            Button2Up.Icon    = Icons.GetAppIcon(Icons.Page2Up);
            Button2Up.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_2");
            Button2Up.Click  += Button2Up_Click;

            ButtonNUp.Icon    = Icons.GetAppIcon(Icons.PageNUp);
            ButtonNUp.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_N");
            ButtonNUp.Click  += ButtonNUp_Click;

            ButtonWholeUp.Icon    = Icons.GetAppIcon(Icons.PageWholeUp);
            ButtonWholeUp.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_WHOLE");
            ButtonWholeUp.Click  += ButtonWholeUp_Click;

            ButtonRotate.Icon    = Icons.GetAppIcon(Icons.PageRotate);
            ButtonRotate.Caption = LocalisationManager.Get("PDF/TIP/ROTATE");
            ButtonRotate.Click  += ButtonRotate_Click;

            ButtonRotateAll.Icon    = Icons.GetAppIcon(Icons.PageRotate);
            ButtonRotateAll.Caption = LocalisationManager.Get("PDF/TIP/ROTATE_ALL");
            ButtonRotateAll.Click  += ButtonRotateAll_Click;

            ButtonZoomIn.Icon    = Icons.GetAppIcon(Icons.ZoomIn);
            ButtonZoomIn.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_IN");
            ButtonZoomIn.Click  += ButtonZoomIn_Click;

            ButtonZoomOut.Icon    = Icons.GetAppIcon(Icons.ZoomOut);
            ButtonZoomOut.Caption = LocalisationManager.Get("PDF/TIP/ZOOM_OUT");
            ButtonZoomOut.Click  += ButtonZoomOut_Click;

            ButtonMisc.Visibility = ConfigurationManager.Instance.NoviceVisibility;
            ButtonMisc.AttachPopup(ButtonMiscPopup);
            ButtonMisc.Icon    = Icons.GetAppIcon(Icons.DocumentMisc);
            ButtonMisc.ToolTip = LocalisationManager.Get("PDF/TIP/MISC");

            ButtonDocumentSave.Icon    = Icons.GetAppIcon(Icons.DocumentSave);
            ButtonDocumentSave.Caption = LocalisationManager.Get("PDF/TIP/SAVE_COPY");
            ButtonDocumentSave.Click  += ButtonDocumentSave_Click;

            ButtonPrint.Icon    = Icons.GetAppIcon(Icons.Printer);
            ButtonPrint.Caption = LocalisationManager.Get("PDF/TIP/PRINT");
            ButtonPrint.Click  += ButtonPrint_Click;

            ButtonOpenLibrary.Icon    = Icons.GetAppIcon(Icons.ModuleDocumentLibrary);
            ButtonOpenLibrary.Caption = LocalisationManager.Get("PDF/TIP/OPEN_PARENT_LIBRARY");
            ButtonOpenLibrary.Click  += ButtonOpenLibrary_Click;

            ButtonExportToText.Icon    = Icons.GetAppIcon(Icons.ExportToText);
            ButtonExportToText.Caption = LocalisationManager.Get("PDF/TIP/CONVERT_TO_TEXT");
            ButtonExportToText.Click  += ButtonExportToText_Click;

            ButtonReadOutLoud.Icon    = Icons.GetAppIcon(Icons.ReadOutLoud);
            ButtonReadOutLoud.Caption = LocalisationManager.Get("PDF/TIP/READ_ALOUD");
            ButtonReadOutLoud.Click  += ButtonReadOutLoud_Click;

            ButtonSpeedRead.Icon    = Icons.GetAppIcon(Icons.SpeedRead);
            ButtonSpeedRead.Caption = LocalisationManager.Get("PDF/TIP/SPEED_READ");
            ButtonSpeedRead.Click  += ButtonSpeedRead_Click;

            ButtonInvertColours.Icon      = Icons.GetAppIcon(Icons.DocumentsInvertColours);
            ButtonInvertColours.Caption   = LocalisationManager.Get("PDF/TIP/NEGATIVE");
            ButtonInvertColours.IsChecked = false;
            ButtonInvertColours.Click    += ButtonInvertColours_Click;

            ButtonMoreMenus.Icon    = Icons.GetAppIcon(Icons.DocumentMisc);
            ButtonMoreMenus.Caption = LocalisationManager.Get("PDF/TIP/MORE_MENUS");
            ButtonMoreMenus.Click  += ButtonMoreMenus_Click;

            ButtonJumpToSection.Icon    = Icons.GetAppIcon(Icons.JumpToSection);
            ButtonJumpToSection.ToolTip = LocalisationManager.Get("PDF/TIP/BOOKMARKS");
            ButtonJumpToSection.Click  += ButtonJumpToSection_Click;

            ButtonPreviousPage.Icon    = Icons.GetAppIcon(Icons.Previous);
            ButtonPreviousPage.ToolTip = LocalisationManager.Get("PDF/TIP/PAGE_PREV");
            ButtonPreviousPage.Click  += ButtonPreviousPage_Click;

            ButtonNextPage.Icon    = Icons.GetAppIcon(Icons.Next);
            ButtonNextPage.ToolTip = LocalisationManager.Get("PDF/TIP/PAGE_NEXT");
            ButtonNextPage.Click  += ButtonNextPage_Click;

            TextBoxFind.ToolTip       = LocalisationManager.Get("PDF/TIP/SEARCH");
            TextBoxFind.OnHardSearch += TextBoxFind_OnHardSearch;

            Webcasts.FormatWebcastButton(ButtonWebcast, Webcasts.PDF_VIEWER);

            // Make some space
            ToolBar.SetOverflowMode(ButtonPrint, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonInvertColours, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonCamera, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonDocumentSave, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonExportToText, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonReadOutLoud, OverflowMode.Always);
            ToolBar.SetOverflowMode(ButtonMoreMenus, OverflowMode.Always);

            // Wizard
            WizardDPs.SetPointOfInterest(ButtonAnnotation, "PDFReadingAnnotationButton");

            ListSearchDetails.SearchSelectionChanged += ListSearchDetails_SearchSelectionChanged;
            ListSearchDetails.SearchClicked          += ListSearchDetails_SearchSelectionChanged;

            TagCloud.TagClick += TagCloud_TagClick;

            JumpToPageNumber.Text      = "" + 1;
            JumpToPageNumberMax.Text   = " of " + pdf_renderer_control_stats.pdf_document.PDFRenderer.PageCount;
            JumpToPageNumber.KeyDown  += JumpToPageNumber_KeyDown;
            JumpToPageNumber.KeyUp    += JumpToPageNumber_KeyUp;
            JumpToPageNumber.GotFocus += JumpToPageNumber_GotFocus;
            string tooltip = LocalisationManager.Get("PDF/TIP/PAGE_JUMP");

            JumpToPageNumberLabel.ToolTip = tooltip;
            JumpToPageNumber.ToolTip      = tooltip;

            // The search results are initially hidden
            GridBOTTOM.Visibility = Visibility.Collapsed;

            // Start in hand mode
            pdf_renderer_control.ReconsiderOperationMode(PDFRendererControl.OperationMode.Hand);

            ObjHyperlinkGuestPreviewMoveOther.Click     += ObjHyperlinkGuestPreviewMoveOther_Click;
            ObjHyperlinkGuestPreviewMoveDefault.Click   += ObjHyperlinkGuestPreviewMoveDefault_Click;
            ObjHyperlinkGuestPreviewVanillaAttach.Click += ObjHyperlinkGuestPreviewVanillaAttach_Click;

            ObjReadOnlyInfoBar.Visibility = pdf_document.Library.WebLibraryDetail.IsReadOnly ? Visibility.Visible : Visibility.Collapsed;

            DataContext = pdf_document.Bindable;

            ObjDocumentMetadataControlsPanel.SelectedPageChanged += ObjDocumentMetadataControlsPanel_ObjDocumentMetadataControlsPanel_SelectedPageChanged;

            // Kick off a thread that populates the interesting analysis
            SafeThreadPool.QueueUserWorkItem(o => PDFRendererControlInterestingAnalysis.DoInterestingAnalysis(this, pdf_renderer_control, pdf_renderer_control_stats));

            Loaded += PDFReadingControl_Loaded;
        }