public PDFHighlightLayer(PDFDocument pdf_document, int page)
        {
            WPFDoEvents.AssertThisCodeIsRunningInTheUIThread();

            this.pdf_document = pdf_document;
            this.page         = page;

            InitializeComponent();

            Background = Brushes.Transparent;

            Cursor = Cursors.Pen;

            drag_area_tracker = new DragAreaTracker(this, false);
            drag_area_tracker.OnDragStarted    += drag_area_tracker_OnDragStarted;
            drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress;
            drag_area_tracker.OnDragComplete   += drag_area_tracker_OnDragComplete;

            text_selection_manager = new TextSelectionManager();

            SizeChanged += PDFHighlightLayer_SizeChanged;

            SetLeft(ObjHighlightRenderer, 0);
            SetTop(ObjHighlightRenderer, 0);

            text_layer_selection_mode = TextLayerSelectionMode.Sentence;
            CurrentColourNumber       = 0;

            Loaded += PDFHighlightLayer_Loaded;
            //Unloaded += PDFHighlightLayer_Unloaded;
            Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
        }
示例#2
0
        public PDFHighlightLayer(PDFRendererControlStats pdf_renderer_control_stats, int page)
        {
            this.pdf_renderer_control_stats = pdf_renderer_control_stats;
            this.page = page;

            InitializeComponent();

            this.Background = Brushes.Transparent;

            this.Cursor = Cursors.Pen;

            drag_area_tracker = new DragAreaTracker(this, false);
            drag_area_tracker.OnDragStarted    += drag_area_tracker_OnDragStarted;
            drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress;
            drag_area_tracker.OnDragComplete   += drag_area_tracker_OnDragComplete;

            text_selection_manager = new TextSelectionManager();

            this.SizeChanged += PDFHighlightLayer_SizeChanged;

            SetLeft(ObjHighlightRenderer, 0);
            SetTop(ObjHighlightRenderer, 0);

            this.text_layer_selection_mode = TextLayerSelectionMode.Sentence;
            this.CurrentColourNumber       = 0;

            this.Loaded += PDFHighlightLayer_Loaded;
        }
 internal void RaiseTextSelectModeChange(TextLayerSelectionMode textLayerSelectionMode)
 {
     foreach (PDFRendererPageControl page_control in ObjPagesPanel.Children.OfType <PDFRendererPageControl>())
     {
         page_control.RaiseTextSelectModeChange(textLayerSelectionMode);
     }
 }
示例#4
0
        public PDFTextSentenceLayer(PDFRendererControlStats pdf_renderer_control_stats, int page)
        {
            this.pdf_renderer_control_stats = pdf_renderer_control_stats;
            this.page = page;

            InitializeComponent();

            Focusable = true;
            KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Once);

            Background = Brushes.Transparent;
            Cursor     = Cursors.IBeam;

            SizeChanged += PDFTextSentenceLayer_SizeChanged;

            drag_area_tracker = new DragAreaTracker(this, false);
            drag_area_tracker.OnDragStarted    += drag_area_tracker_OnDragStarted;
            drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress;
            drag_area_tracker.OnDragComplete   += drag_area_tracker_OnDragComplete;

            text_selection_manager = new TextSelectionManager();

            PreviewMouseDown     += PDFTextSentenceLayer_PreviewMouseDown;
            PreviewKeyDown       += PDFTextLayer_PreviewKeyDown;
            RequestBringIntoView += PDFTextSentenceLayer_RequestBringIntoView;

            text_layer_selection_mode = TextLayerSelectionMode.Sentence;
        }
        public void OnDragStarted(TextLayerSelectionMode text_layer_selection_mode, WordList words, double actual_width, double actual_height, bool button_left_pressed, bool button_right_pressed, Point mouse_down_point)
        {
            this.text_layer_selection_mode = text_layer_selection_mode;
            this.words         = words;
            this.actual_width  = actual_width;
            this.actual_height = actual_height;

            if (null == words)
            {
                Logging.Info("OCR has not been done so no text to select");
                return;
            }

            if (button_left_pressed)
            {
                last_selected_words = WORDS_EMPTY;
                WordList selected_words = new WordList();

                // Find any clicked word
                double mouse_down_left = mouse_down_point.X / actual_width;
                double mouse_down_top  = mouse_down_point.Y / actual_height;

                foreach (Word word in words)
                {
                    if (word.Contains(mouse_down_left, mouse_down_top))
                    {
                        selected_words.Add(word);
                    }
                }
            }
        }
        public PDFTextSentenceLayer(PDFRendererControl pdf_renderer_control, int page)
        {
            WPFDoEvents.AssertThisCodeIsRunningInTheUIThread();

            this.pdf_renderer_control = new WeakReference <PDFRendererControl>(pdf_renderer_control);
            this.page = page;

            InitializeComponent();

            Focusable = true;
            KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Once);

            Background = Brushes.Transparent;
            Cursor     = Cursors.IBeam;

            SizeChanged += PDFTextSentenceLayer_SizeChanged;

            drag_area_tracker = new DragAreaTracker(this, false);
            drag_area_tracker.OnDragStarted    += drag_area_tracker_OnDragStarted;
            drag_area_tracker.OnDragInProgress += drag_area_tracker_OnDragInProgress;
            drag_area_tracker.OnDragComplete   += drag_area_tracker_OnDragComplete;

            text_selection_manager = new TextSelectionManager();

            PreviewMouseDown     += PDFTextSentenceLayer_PreviewMouseDown;
            PreviewKeyDown       += PDFTextLayer_PreviewKeyDown;
            RequestBringIntoView += PDFTextSentenceLayer_RequestBringIntoView;

            text_layer_selection_mode = TextLayerSelectionMode.Sentence;

            //Unloaded += PDFTextSentenceLayer_Unloaded;
            Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
        }
示例#7
0
 internal void RaiseTextSelectModeChange(TextLayerSelectionMode textLayerSelectionMode)
 {
     this.CanvasTextSentence.RaiseTextSelectModeChange(textLayerSelectionMode);
 }
示例#8
0
 internal void RaiseTextSelectModeChange(TextLayerSelectionMode textLayerSelectionMode)
 {
     text_layer_selection_mode = textLayerSelectionMode;
 }
 private void RaiseTextSelectModeChange(TextLayerSelectionMode textLayerSelectionMode)
 {
     PDFRendererControl.RaiseTextSelectModeChange(textLayerSelectionMode);
 }
 private void RaiseTextSelectModeChange(TextLayerSelectionMode textLayerSelectionMode)
 {
     pdf_renderer_control.RaiseTextSelectModeChange(textLayerSelectionMode);
 }