//private bool isSenderHighlight = false; private void cHighlights_MouseDown(object sender, MouseButtonEventArgs e) { if (Core.Device.State != StackingState.NotStacked) return; if (e.LeftButton == MouseButtonState.Pressed && e.RightButton == MouseButtonState.Released) { lastPosition = GetMousePositionInDocument(); if (sender == rHighlights) { if (CurrentTool != ActiveReadingTool.Highlighter) { //isSenderHighlight = false; //Hide pop-up stick notes isSomething2Hide = false; foreach (Note element in ActualDocument[ActualPage].Annotations) { if (element.Annotation.Visibility == Visibility.Visible) { isSomething2Hide = true; element.Annotation.Visibility = Visibility.Collapsed; } } return; } else if (CurrentTool == ActiveReadingTool.Highlighter) { isHighlighting = true; newHighlight = new Highlight(); newHighlight.Line = new Line { Stroke = Brushes.YellowGreen, Opacity = 0.5, StrokeThickness = 18 / Core.Profile.PixelsPerCm.Height }; newHighlight.Line.X1 = lastPosition.X; newHighlight.Line.Y1 = lastPosition.Y; newHighlight.Line.X2 = lastPosition.X; newHighlight.Line.Y2 = lastPosition.Y; AddHighlight(newHighlight.Line, cHighlights); } } else if (sender is Line) { Line line = (Line)sender; if (line.Tag != null && line.Tag is Figure) { isHighlighting = false; //to avoid highlighting in Figure-Mode ShowFigure((line.Tag as Figure)); } //else //{ // isSenderHighlight = true; // currentHighlight = line; //} } } }
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { //splash.LoadingProgress = e.ProgressPercentage; Object[] userState = (Object[])e.UserState; //This code is executed here because it needs to be on an UI thread Figure figure = (Figure)userState[0]; List<ContentLocation> linksForFigure = (List<ContentLocation>)userState[1]; foreach (ContentLocation figureLink in linksForFigure) { Highlight link = new Highlight(); link.Line = new Line() { Stroke = Brushes.Yellow, Opacity = 0.7, StrokeThickness = figureLink.ContentBounds.Height, Tag = figure }; link.Line.X1 = figureLink.ContentBounds.Left; link.Line.Y1 = figureLink.ContentBounds.Top + figureLink.ContentBounds.Height / 2; link.Line.X2 = figureLink.ContentBounds.Right; link.Line.Y2 = figureLink.ContentBounds.Top + figureLink.ContentBounds.Height / 2; document[figureLink.PageIndex].FigureLinks.Add(link); } }
private void Search(String word, int page) { ClearSearch(); List<ContentLocation> pageSearch = PdfHelper.ContentToPixel(word, page, ActualDocument.DocumentSize.Width, ActualDocument.DocumentSize.Height); foreach (ContentLocation content in pageSearch) { Highlight resultHL = new Highlight(); resultHL.Line = new Line() { Stroke = Brushes.Blue, Opacity = 0.5, StrokeThickness = content.ContentBounds.Height }; resultHL.Line.X1 = content.ContentBounds.Left; resultHL.Line.Y1 = content.ContentBounds.Top + content.ContentBounds.Height / 2; resultHL.Line.X2 = content.ContentBounds.Right; resultHL.Line.Y2 = content.ContentBounds.Top + content.ContentBounds.Height / 2; resultHL.Line.Tag = content.Content; if (content.PageIndex == ActualPage) AddHighlight(resultHL.Line, cSearchResults); ActualDocument[content.PageIndex].SearchResults.Add(resultHL); } }
public IActiveReaderMarker Clone() { Highlight clone = new Highlight(); clone.LineXAML = LineXAML; return clone; }