Beispiel #1
0
 private void comment_OnDeleteComment(KnowledgeMapComment comment)
 {
     this._c_FakeAdornerLayer.Children.Remove(comment.StartHandleRectangle);
     this._c_FakeAdornerLayer.Children.Remove(comment.EndHandleRectangle);
     this._c_FakeAdornerLayer.Children.Remove(comment);
     this._comments.Remove(comment);
 }
        private void BuildComment(string authorName, Guid authorId, List <EjpLib.BaseClasses.ejpCACommentMessage> messages, Guid commentId)
        {
            TextRange range = new TextRange(this._commentedSelectionStart, this._commentedSelectionEnd);

            this._comment = new KnowledgeMapComment()
            {
                OriginalAuthorId   = authorId,
                OriginalAuthorName = authorName,
                CurrentAuthorId    = authorId,
                CurrentAuthorName  = authorName,
                CommentId          = Guid.NewGuid(),
                Width  = 200,
                Height = 300,
                CommentTextInDocument = range.Text
            };

            if (messages != null) //== empty comment box..
            {
                foreach (EjpLib.BaseClasses.ejpCACommentMessage message in messages)
                {
                    this._comment.Messages.Add(
                        new CommentMessage()
                    {
                        Date     = message.Date,
                        AuthorId = message.AuthorId,
                        Author   = message.Author,
                        Message  = message.Message
                    }
                        );
                }
            }

            this._comment.OnDeleteComment += new DeleteKnowledgeMapComment(_comment_OnDeleteComment);
            //this._comment.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(_comment_OnMaximizeComment);
            //this._comment.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(_comment_OnMinimizeComment);
            //this._comment._r_PushPin.MouseLeftButtonDown += new MouseButtonEventHandler(CommentBgMouseDown);
            //this._comment._r_PushPin.MouseLeftButtonUp += new MouseButtonEventHandler(CommentBgMouseUp);
            //this._comment._r_PushPin.StylusDown += new StylusDownEventHandler(CommentBgStylusDown);
            //this._comment._r_PushPin.StylusUp += new StylusEventHandler(CommentStylusUp);
            //Enable to drag comments...
            //this._comment._r_PushPin.MouseMove += new MouseEventHandler(CommentMouseMove);
            //this._comment._r_PushPin.StylusMove += new StylusEventHandler(CommentStylusMove);
            this._visualChildren.Add(this._comment);

            //build the resize grip
            //if (this._resizeGrip != null)
            // return;

            //this._resizeGrip = new Thumb();
            //this._comment.BorderThickness = new Thickness(0);
            //this._resizeGrip.Height = this._resizeGrip.Width = 17;
            //this._resizeGrip.Opacity = 0.4;
            //this._resizeGrip.Background = this._comment.Resources["ResizeHandleBrush"] as DrawingBrush;
            //this._visualChildren.Add(this._resizeGrip);
        }
Beispiel #3
0
        private void comment_OnMaximizeComment(KnowledgeMapComment comment)
        {
            double newLeft = Canvas.GetLeft(comment);

            if ((newLeft + 178 + 200) < this._c_FakeAdornerLayer.ActualWidth)
            {
                Canvas.SetLeft(comment, newLeft + 178);
            }

            double newTop = Canvas.GetTop(comment);

            if ((newTop + 300) > this._c_FakeAdornerLayer.ActualHeight)
            {
                Canvas.SetTop(comment, newTop - 300);
            }

            this._c_FakeAdornerLayer.InvalidateVisual();
        }
 private void _comment_OnDeleteComment(KnowledgeMapComment comment)
 {
     this.PropagateCommentDeleted();
 }
 private void _comment_OnMaximizeComment(KnowledgeMapComment comment)
 {
     //this._resizeGrip.Visibility = Visibility.Visible;
 }
 private void _comment_OnMinimizeComment(KnowledgeMapComment comment)
 {
     //this._resizeGrip.Visibility = Visibility.Collapsed;
 }
Beispiel #7
0
        private bool ImportComment(EjpLib.BaseClasses.ejpCAComment comment)
        {
            TextPointer commentStart = this._textArea.Document.ContentStart.GetPositionAtOffset(Math.Abs((int)comment.OriginalPositionX));

            if (commentStart == null)
            {
                return(false);
            }
            TextPointer commentEnd = commentStart.GetPositionAtOffset(Math.Abs((int)comment.OriginalPositionY));

            if (commentEnd == null)
            {
                return(false);
            }
            Point commmentInsertPoint = commentStart.GetCharacterRect(LogicalDirection.Forward).TopLeft;

            KnowledgeMapComment commentToAdd = new KnowledgeMapComment()
            {
                OriginalAuthorId   = comment.AuthorId,
                OriginalAuthorName = comment.AuthorName,
                CurrentAuthorId    = this.CurrentOwnerId,
                CurrentAuthorName  = this.CurrentOwnerName,
                CommentId          = comment.CommentId,
                Width  = 200,
                Height = 300,
                CommentTextInDocument = comment.CommentedTextInDocument,
                OriginalCoordinates   = new Point(comment.OriginalPositionX, comment.OriginalPositionY),
                CommentedTextStart    = commentStart
            };

            commentToAdd.DisableReturnToOriginalPosition();

            foreach (EjpLib.BaseClasses.ejpCACommentMessage message in comment.Messages)
            {
                commentToAdd.Messages.Add(
                    new CommentMessage()
                {
                    Author   = message.Author,
                    AuthorId = message.AuthorId,
                    Date     = message.Date,
                    Message  = message.Message
                }
                    );
            }

            this._c_FakeAdornerLayer.Children.Add(commentToAdd);

            Point p =
                commentToAdd.CommentedTextStart.GetCharacterRect(
                    LogicalDirection.Forward).TopLeft;

            if (((p.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight)
            {
                Canvas.SetTop(commentToAdd, p.Y - 10);
            }
            else
            {
                Canvas.SetTop(commentToAdd, (p.Y - 10) - 300);
            }

            if ((p.X + 200) < this._c_FakeAdornerLayer.ActualWidth)
            {
                Canvas.SetLeft(commentToAdd, p.X);
            }
            else
            {
                Canvas.SetLeft(commentToAdd, p.X - 178);
            }

            commentToAdd.OnDeleteComment   += new DeleteKnowledgeMapComment(comment_OnDeleteComment);
            commentToAdd.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment);
            commentToAdd.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment);

            //this._comments.Add(commentToAdd);


            //090126
            Rect tStartRect = commentStart.GetCharacterRect(LogicalDirection.Forward);
            Rect tEndRect   = commentEnd.GetCharacterRect(LogicalDirection.Forward);

            DrawingBrush lineHandleSBrush = this.Resources["commentLineHandleS_default"] as DrawingBrush;
            DrawingBrush lineHandleEBrush = this.Resources["commentLineHandleE_default"] as DrawingBrush;

            commentToAdd.StartHandleRectangle = new Rectangle()
            {
                Fill = lineHandleSBrush
            };
            commentToAdd.StartHandleRectangle.Width  = 9;
            commentToAdd.StartHandleRectangle.Height = (tStartRect.Height < 5) ? 10 : tStartRect.Height;;
            commentToAdd.EndHandleRectangle          = new Rectangle()
            {
                Fill = lineHandleEBrush
            };
            commentToAdd.EndHandleRectangle.Width  = 9;
            commentToAdd.EndHandleRectangle.Height = (tEndRect.Height < 5) ? 10 : tEndRect.Height;
            commentToAdd.StartHandleRectangle.SetValue(Canvas.TopProperty, tStartRect.TopLeft.Y);
            commentToAdd.StartHandleRectangle.SetValue(Canvas.LeftProperty, tStartRect.TopLeft.X);
            commentToAdd.EndHandleRectangle.SetValue(Canvas.TopProperty, tEndRect.TopLeft.Y);
            commentToAdd.EndHandleRectangle.SetValue(Canvas.LeftProperty, tEndRect.TopLeft.X);

            this._c_FakeAdornerLayer.Children.Insert(0, commentToAdd.StartHandleRectangle);
            this._c_FakeAdornerLayer.Children.Insert(0, commentToAdd.EndHandleRectangle);

            this._comments.Add(commentToAdd);
            return(true);
        }
Beispiel #8
0
 private void comment_OnMinimizeComment(KnowledgeMapComment comment)
 {
     Canvas.SetLeft(comment, comment.CommentedTextStart.GetCharacterRect(LogicalDirection.Forward).TopLeft.X);
     Canvas.SetTop(comment, comment.CommentedTextStart.GetCharacterRect(LogicalDirection.Forward).TopLeft.Y - 10);
     this._c_FakeAdornerLayer.InvalidateVisual();
 }
Beispiel #9
0
        private void AddCommentToSelection()
        {
            try
            {
                if (this._textArea.Selection.IsEmpty)
                {
                    return;
                }

                //New comment system 081119
                Rect tStartRect =
                    this._textArea.Selection.Start.GetCharacterRect(LogicalDirection.Forward);
                Rect tEndRect =
                    this._textArea.Selection.End.GetCharacterRect(LogicalDirection.Forward);

                TextPointer tp1   = this._textArea.Selection.Start;
                TextPointer tp2   = this._textArea.Selection.End;
                TextRange   range = new TextRange(tp1, tp2);

                int cStartOffset = tp1.GetOffsetToPosition(this._textArea.Document.ContentStart);
                int cEndOffset   = tp2.GetOffsetToPosition(tp1);

                KnowledgeMapComment comment = new KnowledgeMapComment()
                {
                    OriginalAuthorId   = this.CurrentOwnerId,
                    OriginalAuthorName = this.CurrentOwnerName,
                    CurrentAuthorId    = this.CurrentOwnerId,
                    CurrentAuthorName  = this.CurrentOwnerName,
                    CommentId          = Guid.NewGuid(),
                    Width  = 200,
                    Height = 300,
                    CommentTextInDocument = range.Text,
                    OriginalCoordinates   = new Point(cStartOffset, cEndOffset),
                    CommentedTextStart    = tp1
                };

                comment.DisableReturnToOriginalPosition();

                this._c_FakeAdornerLayer.Children.Add(comment);

                if (((tStartRect.TopLeft.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight)
                {
                    Canvas.SetTop(comment, tStartRect.TopLeft.Y - 10);
                }
                else
                {
                    Canvas.SetTop(comment, (tStartRect.TopLeft.Y - 10) - 300);
                }

                if ((tStartRect.TopLeft.X + 200) < this._c_FakeAdornerLayer.ActualWidth)
                {
                    Canvas.SetLeft(comment, tStartRect.TopLeft.X);
                }
                else
                {
                    Canvas.SetLeft(comment, tStartRect.TopLeft.X - 178);
                }

                comment.OnDeleteComment += new
                                           DeleteKnowledgeMapComment(comment_OnDeleteComment);
                comment.OnMinimizeComment += new
                                             KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment);
                comment.OnMaximizeComment += new
                                             KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment);
                this._comments.Add(comment);

                //090126
                DrawingBrush lineHandleSBrush =
                    this.Resources["commentLineHandleS_default"] as DrawingBrush;
                DrawingBrush lineHandleEBrush =
                    this.Resources["commentLineHandleE_default"] as DrawingBrush;
                comment.StartHandleRectangle = new Rectangle()
                {
                    Fill
                        = lineHandleSBrush
                };
                comment.StartHandleRectangle.Width  = 9;
                comment.StartHandleRectangle.Height = (tStartRect.Height < 5) ? 10 : tStartRect.Height;;
                comment.EndHandleRectangle          = new Rectangle()
                {
                    Fill =
                        lineHandleEBrush
                };
                comment.EndHandleRectangle.Width  = 9;
                comment.EndHandleRectangle.Height = (tEndRect.Height < 5) ? 10 : tEndRect.Height;

                comment.StartHandleRectangle.SetValue(Canvas.TopProperty,
                                                      tStartRect.TopLeft.Y);

                comment.StartHandleRectangle.SetValue(Canvas.LeftProperty,
                                                      tStartRect.TopLeft.X);

                comment.EndHandleRectangle.SetValue(Canvas.TopProperty,
                                                    tEndRect.TopLeft.Y);

                comment.EndHandleRectangle.SetValue(Canvas.LeftProperty,
                                                    tEndRect.TopLeft.X);


                this._c_FakeAdornerLayer.Children.Insert(0, comment.StartHandleRectangle);
                this._c_FakeAdornerLayer.Children.Insert(0, comment.EndHandleRectangle);

                return;
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #10
0
        private void AddCommentToSelection()
        {
            try
            {
                if (this._textArea.Selection.IsEmpty)
                {
                    return;
                }

                //New comment system 081119
                Point p =
                    this._textArea.Selection.Start.GetCharacterRect(
                        LogicalDirection.Forward).TopLeft;

                TextPointer tp1   = this._textArea.Selection.Start;
                TextPointer tp2   = this._textArea.Selection.End;
                TextRange   range = new TextRange(tp1, tp2);

                KnowledgeMapComment comment = new KnowledgeMapComment()
                {
                    OriginalAuthorId   = this.CurrentOwnerId,
                    OriginalAuthorName = this.CurrentOwnerName,
                    CurrentAuthorId    = this.CurrentOwnerId,
                    CurrentAuthorName  = this.CurrentOwnerName,
                    CommentId          = Guid.NewGuid(),
                    Width  = 200,
                    Height = 300,
                    CommentTextInDocument = range.Text,
                    OriginalCoordinates   = p,
                    CommentedTextStart    = tp1
                };

                comment.DisableReturnToOriginalPosition();

                this._c_FakeAdornerLayer.Children.Add(comment);

                if (((p.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight)
                {
                    Canvas.SetTop(comment, p.Y - 10);
                }
                else
                {
                    Canvas.SetTop(comment, (p.Y - 10) - 300);
                }

                if ((p.X + 200) < this._c_FakeAdornerLayer.ActualWidth)
                {
                    Canvas.SetLeft(comment, p.X);
                }
                else
                {
                    Canvas.SetLeft(comment, p.X - 178);
                }

                comment.OnDeleteComment   += new DeleteKnowledgeMapComment(comment_OnDeleteComment);
                comment.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment);
                comment.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment);
                this._comments.Add(comment);

                return;
            }
            catch (Exception ex)
            {
                SiliconStudio.DebugManagers.DebugReporter.Report(
                    SiliconStudio.DebugManagers.MessageType.Error,
                    "EjpControls - Report Editor",
                    "Failed to Add Comment to Selection" +
                    "\nParent Study ID: " + this.ParentStudyId.ToString() +
                    "\nReport ID: " + this._reportObject.Id.ToString() +
                    "\nError: " + ex.Message);
                throw;
            }
        }
Beispiel #11
0
        private void ImportComment(EjpLib.BaseClasses.ejpCAComment comment)
        {
            TextPointer commentStart = this._textArea.GetPositionFromPoint(
                new Point(comment.OriginalPositionX, comment.OriginalPositionY), true);

            TextPointer commentEnd = commentStart.GetPositionAtOffset(comment.CommentedTextInDocument.Length);

            KnowledgeMapComment commentToAdd = new KnowledgeMapComment()
            {
                OriginalAuthorId   = comment.AuthorId,
                OriginalAuthorName = comment.AuthorName,
                CurrentAuthorId    = this.CurrentOwnerId,
                CurrentAuthorName  = this.CurrentOwnerName,
                CommentId          = comment.CommentId,
                Width  = 200,
                Height = 300,
                CommentTextInDocument = comment.CommentedTextInDocument,
                OriginalCoordinates   = new Point(comment.OriginalPositionX, comment.OriginalPositionY),
                CommentedTextStart    = commentStart
            };

            commentToAdd.DisableReturnToOriginalPosition();

            foreach (EjpLib.BaseClasses.ejpCACommentMessage message in comment.Messages)
            {
                commentToAdd.Messages.Add(
                    new CommentMessage()
                {
                    Author   = message.Author,
                    AuthorId = message.AuthorId,
                    Date     = message.Date,
                    Message  = message.Message
                }
                    );
            }

            this._c_FakeAdornerLayer.Children.Add(commentToAdd);

            Point p =
                commentToAdd.CommentedTextStart.GetCharacterRect(
                    LogicalDirection.Forward).TopLeft;

            if (((p.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight)
            {
                Canvas.SetTop(commentToAdd, p.Y - 10);
            }
            else
            {
                Canvas.SetTop(commentToAdd, (p.Y - 10) - 300);
            }

            if ((p.X + 200) < this._c_FakeAdornerLayer.ActualWidth)
            {
                Canvas.SetLeft(commentToAdd, p.X);
            }
            else
            {
                Canvas.SetLeft(commentToAdd, p.X - 178);
            }

            commentToAdd.OnDeleteComment   += new DeleteKnowledgeMapComment(comment_OnDeleteComment);
            commentToAdd.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment);
            commentToAdd.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment);

            this._comments.Add(commentToAdd);
        }
Beispiel #12
0
 private void comment_OnDeleteComment(KnowledgeMapComment comment)
 {
     this._c_FakeAdornerLayer.Children.Remove(comment);
     this._comments.Remove(comment);
 }