public PdfDocumentView()
        {
            InitializeComponent();

            _foldingStrategy.FoldingTemplates = new List<FoldingTemplate>
            {
                new FoldingTemplate
                {
                    OpeningPhrase = "[^a-zA-Z0-9]stream[^a-zA-Z0-9]",
                    ClosingPhrase = "[^a-zA-Z0-9]endstream[^a-zA-Z0-9]",
                    IsDefaultFolded = true,
                    Name = "stream"
                }
            };

            Editor.DocumentChanged += (sender, args) =>
            {
                UpdateFoldings();
                _colorTransformer = new TextMarkerService(Editor.Document);
                Editor.TextArea.TextView.BackgroundRenderers.Add(_colorTransformer);
                Editor.TextArea.TextView.LineTransformers.Add(_colorTransformer);
            };

            //_timerOfUpdateFoldings = new Timer(1000) { AutoReset = false };
            //_timerOfUpdateFoldings.Elapsed += (sender, args) => UpdateFoldings();

            Editor.TextArea.TextEntered += TextAreaOnTextEntered;
            Editor.TextArea.PreviewMouseDown += TextAreaOnPreviewMouseDown;
            Editor.TextArea.MouseMove += TextAreaOnMouseMove;
            Editor.TextArea.MouseRightButtonDown += TextAreaOnMouseRightButtonDown;
            SearchPanel.Install(Editor);
        }
Exemple #2
0
 public TextMarker(TextMarkerService service, int startOffset, int length)
 {
     if (service == null)
         throw new ArgumentNullException("service");
     this.service = service;
     this.StartOffset = startOffset;
     this.Length = length;
     this.markerTypes = TextMarkerTypes.None;
 }