public JumpToSectionPopup(PDFReadingControl pdf_reading_control, PDFRendererControl pdf_render_control, PDFRendererControlStats pdf_renderer_control_stats)
        {
            InitializeComponent();

            this.pdf_reading_control        = pdf_reading_control;
            this.pdf_render_control         = pdf_render_control;
            this.pdf_renderer_control_stats = pdf_renderer_control_stats;
            this.popup = new AugmentedPopup(this);

            // Add the bit explaining how to use bookmarks
            {
                TextBlock tb = new TextBlock();
                tb.FontWeight = FontWeights.Bold;
                tb.Text       = "Bookmarks:";
                this.Children.Add(tb);
            }

            {
                {
                    MenuItem mi = new MenuItem();
                    mi.Header =
                        ""
                        + "You can create up to 9 bookmarks while reading a PDF by\n"
                        + "holding down CTRL+SHIFT and pressing a number from 1 to 9.";
                    this.Children.Add(mi);
                }
                {
                    MenuItem mi = new MenuItem();
                    mi.Header =
                        ""
                        + "You can later jump to a remembered bookmark by\n"
                        + "holding down CTRL and pressing a number from 1 to 9.";
                    this.Children.Add(mi);
                }
            }

            this.Children.Add(new AugmentedSpacer());

            // Then add the sections
            {
                TextBlock tb = new TextBlock();
                tb.FontWeight = FontWeights.Bold;
                tb.Text       = "Sections:";
                this.Children.Add(tb);
            }

            // First try from the PDF
            {
                BuildPopupFromPDF build_popup_from_pdf = new BuildPopupFromPDF(this);
                build_popup_from_pdf.BuildMenu();
            }

            // If there are not enough bookmarks, go the OCR route
            if (pdf_renderer_control_stats.pdf_document.PDFRenderer.PageCount < 100)
            {
                BuildPopupFromOCR build_popup_from_ocr = new BuildPopupFromOCR(this);
                build_popup_from_ocr.BuildMenu();
            }
        }
예제 #2
0
        public JumpToSectionPopup(PDFReadingControl pdf_reading_control)
        {
            InitializeComponent();

            this.pdf_reading_control = pdf_reading_control;
            popup = new AugmentedPopup(this);

            // Add the bit explaining how to use bookmarks
            {
                TextBlock tb = new TextBlock();
                tb.FontWeight = FontWeights.Bold;
                tb.Text       = "Bookmarks:";
                Children.Add(tb);
            }

            {
                {
                    MenuItem mi = new MenuItem();
                    mi.Header =
                        ""
                        + "You can create up to 9 bookmarks while reading a PDF by\n"
                        + "holding down CTRL+SHIFT and pressing a number from 1 to 9.";
                    Children.Add(mi);
                }
                {
                    MenuItem mi = new MenuItem();
                    mi.Header =
                        ""
                        + "You can later jump to a remembered bookmark by\n"
                        + "holding down CTRL and pressing a number from 1 to 9.";
                    Children.Add(mi);
                }
            }

            Children.Add(new AugmentedSpacer());

            // Then add the sections
            {
                TextBlock tb = new TextBlock();
                tb.FontWeight = FontWeights.Bold;
                tb.Text       = "Sections:";
                Children.Add(tb);
            }

            // If there are not enough bookmarks, go the OCR route
            PDFDocument pdf_document = pdf_reading_control.GetPDFDocument();

            ASSERT.Test(pdf_document != null);

            // First try from the PDF
            if (pdf_document != null)
            {
                BuildPopupFromPDF build_popup_from_pdf = new BuildPopupFromPDF(this, pdf_document);
                build_popup_from_pdf.BuildMenu();
            }

            if (pdf_document != null /* && pdf_document.PDFRenderer.PageCount < 100  -- plenty thesis papers out there with more than 100 pages... removed this arbitrary heuristic */)
            {
                BuildPopupFromOCR build_popup_from_ocr = new BuildPopupFromOCR(this, pdf_document);
                build_popup_from_ocr.BuildMenu();
            }

            //Unloaded += JumpToSectionPopup_Unloaded;
            Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
        }