Esempio n. 1
0
        private void UpdateGraph(bool checkData)
        {
            // Only worry about updates, if the graph is visible
            // And make sure it is not disposed, since rendering happens on a timer
            if (!Visible || IsDisposed)
            {
                return;
            }

            // Avoid updating when document container and state provider are out of sync
            if (!ReferenceEquals(DocumentUIContainer.Document, StateProvider.SelectionDocument))
            {
                return;
            }

            // CONSIDER: Need a better guarantee that this ratio index matches the
            //           one in the sequence tree, but at least this will keep the UI
            //           from crashing with IndexOutOfBoundsException.
            var mods = DocumentUIContainer.DocumentUI.Settings.PeptideSettings.Modifications;

            _ratioIndex = Math.Min(_ratioIndex, mods.RatioInternalStandardTypes.Count - 1);

            // Only show ratios if document changes to have valid ratios
            if (AreaGraphController.AreaView == AreaNormalizeToView.area_ratio_view && !mods.HasHeavyModifications)
            {
                AreaGraphController.AreaView = AreaNormalizeToView.none;
            }

            var graphPanesCurrent = GraphPanes.ToArray();

            _controller.OnUpdateGraph();
            var graphPanes = GraphPanes.ToArray();

            if (!graphPanesCurrent.SequenceEqual(graphPanes))
            {
                foreach (var pane in graphPanesCurrent)
                {
                    // Release any necessary resources from the old pane
                    var disposable = pane as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                // Layout the new pane
                using (Graphics g = CreateGraphics())
                {
                    graphControl.MasterPane.SetLayout(g, PaneLayout.SingleColumn);
                }
            }

            foreach (var pane in graphPanes)
            {
                pane.UpdateGraph(checkData);
                GraphHelper.FormatGraphPane(pane);
                GraphHelper.FormatFontSize(pane, Settings.Default.AreaFontSize);
            }
            graphControl.Invalidate();
        }
Esempio n. 2
0
        private void UpdateGraph(bool selectionChanged)
        {
            // Only worry about updates, if the graph is visible
            // And make sure it is not disposed, since rendering happens on a timer
            if (!Visible || IsDisposed)
            {
                return;
            }

            // Avoid updating when document container and state provider are out of sync
            if (!ReferenceEquals(DocumentUIContainer.Document, StateProvider.SelectionDocument))
            {
                return;
            }

            var graphPanesCurrent = GraphPanes.ToArray();

            _controller.OnUpdateGraph();
            var graphPanes = GraphPanes.ToArray();

            if (!graphPanesCurrent.SequenceEqual(graphPanes))
            {
                foreach (var pane in graphPanesCurrent)
                {
                    // Release any necessary resources from the old pane
                    var disposable = pane as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

                // Layout the new pane
                using (Graphics g = CreateGraphics())
                {
                    graphControl.MasterPane.SetLayout(g, PaneLayout.SingleColumn);
                }
            }

            foreach (var pane in graphPanes)
            {
                pane.UpdateGraph(selectionChanged);
                GraphHelper.FormatGraphPane(pane);
                GraphHelper.FormatFontSize(pane, Settings.Default.AreaFontSize);
            }
            graphControl.Invalidate();
        }