Exemplo n.º 1
0
        /// <summary>
        /// Crop diagram to displayed time range, for performance, bigger zoom range
        /// </summary>
        private void OnCropDiagram(object sender, RoutedEventArgs e)
        {
            DiagramPara para = new DiagramPara();

            para.scrollOffset = m_scrollViewer.HorizontalOffset;
            para.zoom         = m_zoomSlider.Value;
            para.t0           = m_diagramT0;
            para.t1           = m_diagramT1;

            m_cropList.Push(para);

            if (m_cropList.Count == 1)
            {
                m_undoButton.IsEnabled = true;
            }

            m_diagramT0 = m_diagramHolder.GetValueX(para.scrollOffset);                                     // Real start time displayed
            m_diagramT1 = m_diagramHolder.GetValueX(para.scrollOffset + m_diagramHolder.Width / para.zoom); // Real end time displayed

            m_zoomSlider.Value = 1;                                                                         // Update zoom to 1

            m_scrollViewer.ScrollToHorizontalOffset(0);

            m_statusBar.Status = String.Format("CropTo({0:N3} .. {1:N3})", m_diagramT0, m_diagramT1);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Undo Crop
        /// </summary>
        private void OnUndoCrop(object sender, RoutedEventArgs e)
        {
            if (m_cropList.Count != 0)
            {
                DiagramPara para = m_cropList.Pop();

                m_diagramT0        = para.t0;
                m_diagramT1        = para.t1;
                m_zoomSlider.Value = para.zoom;
                m_scrollViewer.ScrollToHorizontalOffset(para.scrollOffset);
            }

            if (m_cropList.Count == 0)
            {
                m_undoButton.IsEnabled = false;
            }
        }