예제 #1
0
        void DrawSelection(DirectX.DirectXCanvas canvas)
        {
            foreach (Selection selection in SelectionList)
            {
                if (selection.Frame != null && selection.Row != null)
                {
                    ThreadRow row = selection.Row;

                    IDurable intervalTime = selection.Focus == null ? selection.Frame.Header : selection.Focus;
                    Interval intervalPx   = Scroll.TimeToPixel(intervalTime);

                    Rect rect = new Rect(intervalPx.Left, row.Offset /*+ 2.0 * RenderParams.BaseMargin*/, intervalPx.Width, row.Height /*- 4.0 * RenderParams.BaseMargin*/);

                    for (int i = 0; i < SelectionBorderCount; ++i)
                    {
                        if (rect.IsEmpty)
                        {
                            break;
                        }
                        rect.Inflate(SelectionBorderStep, SelectionBorderStep);
                        SelectionMesh.AddRect(rect, FrameSelection.Color);
                    }
                }
            }

            SelectionMesh.Update(canvas.RenderDevice);
            canvas.Draw(SelectionMesh);
        }
예제 #2
0
        public Interval TimeToPixel(IDurable d)
        {
            Interval unit  = TimeToUnit(d);
            double   scale = Width * Zoom;

            return(new Interval((unit.Left - ViewUnit.Left) * scale, unit.Width * scale));
        }
예제 #3
0
 public FrameHeader(int threadIndex, int fiberIndex, IDurable duration)
 {
     ThreadIndex = threadIndex;
     FiberIndex  = fiberIndex;
     Start       = duration.Start;
     Finish      = duration.Finish;
 }
예제 #4
0
        public void Highlight(EventFrame frame, IDurable focus)
        {
            Group = frame.Group;
            ThreadRow row = null;

            id2row.TryGetValue(frame.Header.ThreadIndex, out row);
            Highlight(new ThreadViewControl.Selection[] { new ThreadViewControl.Selection()
                                                          {
                                                              Frame = frame, Focus = focus, Row = row
                                                          } });
        }
예제 #5
0
 public virtual void SetFrame(Data.Frame frame, IDurable node)
 {
     if (this.frame != frame)
     {
         this.frame       = frame;
         this.DataContext = frame;
     }
     else if (node != null)
     {
         FocusOnNode(node);
     }
 }
예제 #6
0
        public void InitRows(List <ThreadRow> rows, IDurable timeslice)
        {
            Rows = rows;

            if (rows.Count > 0)
            {
                Scroll.TimeSlice = new Durable(timeslice.Start, timeslice.Finish);
                Scroll.Width     = surface.ActualWidth * RenderSettings.dpiScaleX;
                rows.ForEach(row => row.BuildMesh(surface, Scroll));
                rows.ForEach(row => row.ExpandChanged     += Row_ExpandChanged);
                rows.ForEach(row => row.VisibilityChanged += Row_VisibilityChanged);
            }

            UpdateRows();
        }
예제 #7
0
        public override void SetFrame(Data.Frame frame, IDurable node)
        {
            if (frame is EventFrame)
            {
                if (SourceFrame == frame)
                {
                    return;
                }

                SourceFrame = frame;

                SamplingFrame samplingFrame = frame.Group.CreateSamplingFrame((frame as EventFrame).RootEntry.Description, CallstackType);
                base.SetFrame(samplingFrame, null);
            }
            else
            {
                base.SetFrame(frame, null);
            }
        }
예제 #8
0
 public FocusFrameEventArgs(RoutedEvent routedEvent, Data.Frame frame, IDurable focus = null) : base(routedEvent)
 {
     Frame = frame;
     Focus = focus;
 }
예제 #9
0
        public Interval TimeToUnit(IDurable d)
        {
            double durationTicks = TimeSlice.Finish - TimeSlice.Start;

            return(new Interval((d.Start - TimeSlice.Start) / durationTicks, (d.Finish - d.Start) / durationTicks));
        }
예제 #10
0
        public bool FocusOnNode(IDurable focusRange)
        {
            if (focusRange == null)
            {
                return(false);
            }

            if (EventTreeView == null)
            {
                return(false);
            }

            if (EventTreeView.ItemsSource == null)
            {
                return(false);
            }

            List <BaseTreeNode> treePath = new List <BaseTreeNode>();

            foreach (var node in EventTreeView.ItemsSource)
            {
                BaseTreeNode baseTreeNode = node as BaseTreeNode;
                if (baseTreeNode == null)
                {
                    continue;
                }

                baseTreeNode.ForEach((curNode, level) =>
                {
                    EventNode treeEventNode = curNode as EventNode;
                    if (treeEventNode == null)
                    {
                        return(true);
                    }

                    if (treeEventNode.Entry.Start > focusRange.Finish)
                    {
                        return(false);
                    }

                    if (treeEventNode.Entry.Contains(focusRange))
                    {
                        treePath.Add(curNode);

                        //find desired node in tree
                        if (treeEventNode.Entry.Start >= focusRange.Start && treeEventNode.Entry.Finish <= focusRange.Finish)
                        {
                            return(false);
                        }
                    }


                    return(true);
                });

                ItemsControl root = EventTreeView;

                int pathElementsCount = treePath.Count;
                if (pathElementsCount > 0)
                {
                    //expand path in tree
                    int index = 0;
                    for (index = 0; index < (pathElementsCount - 1); index++)
                    {
                        BaseTreeNode expandNode = treePath[index];

                        if (root != null)
                        {
                            root = root.ItemContainerGenerator.ContainerFromItem(expandNode) as ItemsControl;
                        }

                        treePath[index].IsExpanded = true;
                    }

                    BaseTreeNode finalNode = treePath[index];

                    // select target node
                    finalNode.IsExpanded = false;
                    finalNode.IsSelected = true;

                    // focus on finalNode
                    if (root != null)
                    {
                        root = root.ItemContainerGenerator.ContainerFromItem(finalNode) as ItemsControl;
                        if (root != null)
                        {
                            root.BringIntoView();
                        }
                    }

                    EventTreeView.InvalidateVisual();

                    return(true);
                }
            }

            return(false);
        }
예제 #11
0
 internal bool Contains(IDurable other)
 {
     return(Start <= other.Start && Finish >= other.Finish);
 }
예제 #12
0
 internal bool Intersect(IDurable other)
 {
     return(Start <= other.Finish && Finish >= other.Start);
 }
예제 #13
0
 internal bool Within(IDurable other)
 {
     return(Start >= other.Start && Finish <= other.Finish);
 }
예제 #14
0
 public void AddDurable(IDurable durable)
 {
     AddWhile(durable.Do);
 }
예제 #15
0
 public void SetFrame(Data.Frame frame, IDurable node)
 {
     this.frame = frame;
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { frame.Load(); this.DataContext = frame; FocusOnNode(node); }));
 }