示例#1
0
        private void PreviewMouseMove_scrollstretch(object sender, MouseEventArgs e)
        {
            Point  p      = e.GetPosition(axiscontrol_time);
            double deltax = p.X - this.dragpoint.X;
            double deltay = p.Y - this.dragpoint.Y;

            if (e.LeftButton == MouseButtonState.Pressed || e.MiddleButton == MouseButtonState.Pressed)
            {
                // erst stretchen, dann scrollen!
                ////RendererManager.Stretch(dragtimestretch - 0.05 * deltay);
                ////RendererManager.Stretch(dragtimestretch - deltay * 0.001 * RendererManager.TimeMax);
                RendererManager.Stretch(this.dragtimestretch - (deltay * 0.005 * this.dragtimestretch));

                RendererManager.Scroll(this.dragtime - (RendererManager.TimeStretch * p.X / axiscontrol_time.ActualWidth));
            }
            else
            {
                // nix mehr gedrückt, handler deinstallieren
                Mouse.Capture(null);
                this.PreviewMouseMove    -= this.PreviewMouseMove_scrollstretch;
                this.dragwatcherinstalled = false;
            }

            e.Handled = true;
        }
示例#2
0
        private void Execute_setMarker(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                double timeCursor;
                ObservableCollection <RenderSlice> selectedRsList;
                string markerSymbol = "M";
                if (e.Parameter != null && e.Parameter.Equals("ContextMenu"))
                {
                    // Informationen vom Contextmenu
                    timeCursor     = this.signalviewercontrol.stackercontrol.PluginContextMenuTimeCursor;
                    selectedRsList = this.signalviewercontrol.stackercontrol.PluginContextMenuSelectedRsList;
                }
                else
                {
                    // Informationen von der aktuellen Mausposition
                    HoverStackEventArgs currentHoverStackEventArgs = hoverStackEventArgs;
                    if (currentHoverStackEventArgs == null)
                    {
                        return;
                    }

                    Point point = Mouse.GetPosition(currentHoverStackEventArgs.ItemsControl);
                    timeCursor     = RendererManager.Time + (RendererManager.TimeStretch * point.X / currentHoverStackEventArgs.ItemsControl.ActualWidth);
                    markerSymbol   = (e.Parameter == null || e.Parameter.Equals(string.Empty)) ? "M" : e.Parameter.ToString();
                    selectedRsList = currentHoverStackEventArgs.Stack;
                }

                IEnumerable <XElement> retsigs = Marker.setMarker(RendererManager.GetSevEntries(selectedRsList), timeCursor, markerSymbol);

                // Neues signal hinzufuegen
                if (retsigs != null)
                {
                    foreach (XElement xe in retsigs)
                    {
                        if (StackerControl.IsSignalEventValueEntry(xe))
                        {
                            signalviewercontrol.stackercontrol.DropSignalEventValueEntry(xe, selectedRsList);
                        }
                    }
                }

                // Deselect all and Render again
                signalviewercontrol.Deselect();

                if (RendererManager.TimeMax < RendererManager.Time)
                {
                    RendererManager.Scroll(0.0);
                }
                else
                {
                    RendererManager.Render();
                }

                // Save Unisens file after Plugin execution
                Executed_Save(null, null);
            }
        }
示例#3
0
        private IEnumerable <XElement> ExecutePlugin(IDspPlugin1 p, IEnumerable <XElement> selectedsignals, double time_cursor, string parameter)
        {
            IEnumerable <XElement> retsigs = null;

            foreach (XElement xe in selectedsignals)
            {
                RendererManager.CloseRenderer(xe);
            }

            try
            {
                string path = Environment.CurrentDirectory + "\\" + "unisens.xml";
                retsigs = p.Main(UnisensXmlFileManager.CurrentUnisensInstance.Xdocument, selectedsignals, path, time_cursor, signalviewercontrol.SelectionStart, signalviewercontrol.SelectionEnd, parameter);
            }
            catch (Exception ex)
            {
                retsigs = null;
                MessageBox.Show("Exception im Plugin: " + ex.Message);
            }

            foreach (XElement xe in selectedsignals)
            {
                try
                {
                    RendererManager.ReOpenRenderer(xe);
                }
                catch
                {
                    RendererManager.KillRenderer(xe);
                }
            }

            if (retsigs != null)
            {
                foreach (XElement xe in retsigs)
                {
                    if (StackerControl.IsSignalEventValueEntry(xe))
                    {
                        signalviewercontrol.stackercontrol.DropSignalEventValueEntry(xe, null);
                    }
                }
            }

            signalviewercontrol.Deselect();
            if (RendererManager.TimeMax < RendererManager.Time)
            {
                RendererManager.Scroll(0.0);
            }
            else
            {
                RendererManager.Render();
            }

            // Save Unisens file after Plugin execution
            Executed_Save(null, null);

            return(retsigs);
        }
示例#4
0
        private void ThumbEnd_DragDelta(object sender, DragDeltaEventArgs e)
        {
            Point p = Mouse.GetPosition(this.AdornedElement);

            if (p.X < 0.0)
            {
                RendererManager.Scroll(RendererManager.Time - (RendererManager.TimeStretch * 0.05));
            }
            else if (p.X > this.AdornedElement.RenderSize.Width)
            {
                RendererManager.Scroll(RendererManager.Time + (RendererManager.TimeStretch * 0.05));
            }

            double t = this.Time + (this.TimeStretch * p.X / this.AdornedElement.RenderSize.Width);

            this.SelectionEnd = t >= 0.0 ? t : 0.0;
        }
示例#5
0
        private void PreviewMouseMove_selection(object sender, MouseEventArgs e)
        {
            Point p = e.GetPosition(axiscontrol_time);

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (p.X < 0.0)
                {
                    RendererManager.Scroll(RendererManager.Time - (RendererManager.TimeStretch * 0.05));
                }
                else if (p.X > axiscontrol_time.RenderSize.Width)
                {
                    RendererManager.Scroll(RendererManager.Time + (RendererManager.TimeStretch * 0.05));
                }

                double t = RendererManager.Time + (RendererManager.TimeStretch * p.X / axiscontrol_time.ActualWidth);
                if (t < 0.0)
                {
                    t = 0.0;
                }

                if (this.dragtime <= t)
                {
                    this.SelectionStart = this.dragtime;
                    this.SelectionEnd   = t;
                }
                else
                {
                    this.SelectionStart = t;
                    this.SelectionEnd   = this.dragtime;
                }
            }
            else
            {
                this.selectionmarkeradorner.Visibility = this.SelectionStart < this.SelectionEnd ? Visibility.Visible : Visibility.Hidden;

                // nix mehr gedrückt, handler deinstallieren
                Mouse.Capture(null);
                this.PreviewMouseMove    -= this.PreviewMouseMove_selection;
                this.dragwatcherinstalled = false;
            }

            e.Handled = true;
        }
示例#6
0
        private void Execute_truncateMarker(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                double timeCursor;
                ObservableCollection <RenderSlice> selectedRsList;
                if (e.Parameter != null && e.Parameter.Equals("ContextMenu"))
                {
                    // Informationen vom Contextmenu
                    timeCursor     = this.signalviewercontrol.stackercontrol.PluginContextMenuTimeCursor;
                    selectedRsList = this.signalviewercontrol.stackercontrol.PluginContextMenuSelectedRsList;
                }
                else
                {
                    // Informationen von der aktuellen Mausposition
                    HoverStackEventArgs currentHoverStackEventArgs = hoverStackEventArgs;
                    if (currentHoverStackEventArgs == null)
                    {
                        return;
                    }

                    Point point = Mouse.GetPosition(currentHoverStackEventArgs.ItemsControl);
                    timeCursor     = RendererManager.Time + (RendererManager.TimeStretch * point.X / currentHoverStackEventArgs.ItemsControl.ActualWidth);
                    selectedRsList = currentHoverStackEventArgs.Stack;
                }

                Marker.truncateMarker(RendererManager.GetSevEntries(selectedRsList), timeCursor);

                // Deselect all and Render again
                signalviewercontrol.Deselect();

                if (RendererManager.TimeMax < RendererManager.Time)
                {
                    RendererManager.Scroll(0.0);
                }
                else
                {
                    RendererManager.Render();
                }

                // Save Unisens file after Plugin execution
                Executed_Save(null, null);
            }
        }
示例#7
0
        private void Execute_setArtifacts(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                //ObservableCollection<RenderSlice> selectedRsList;
                string artifactSymbol_Start = "(artifact";
                string artifactSymbol_End   = "artifact)";

                IEnumerable <XElement> retsigs = Artifacts.setArtifact(signalviewercontrol.SelectionStart, signalviewercontrol.SelectionEnd, artifactSymbol_Start, artifactSymbol_End);

                // Neues signal hinzufuegen
                if (retsigs != null)
                {
                    ObservableCollection <RenderSlice> selectedRsList = this.signalviewercontrol.stackercontrol.PluginContextMenuSelectedRsList;
                    foreach (XElement xe in retsigs)
                    {
                        if (StackerControl.IsSignalEventValueEntry(xe))
                        {
                            signalviewercontrol.stackercontrol.DropSignalEventValueEntry(xe, selectedRsList);
                        }
                    }
                }

                // Deselect all and Render again
                signalviewercontrol.Deselect();

                if (RendererManager.TimeMax < RendererManager.Time)
                {
                    RendererManager.Scroll(0.0);
                }
                else
                {
                    RendererManager.Render();
                }

                // Save Unisens file after Plugin execution
                Executed_Save(null, null);
            }
        }
示例#8
0
        private void Execute_deleteMarker(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                ObservableCollection <RenderSlice> selectedRsList;
                if (e.Parameter != null && e.Parameter.Equals("ContextMenu"))
                {
                    // Informationen vom Contextmenu
                    selectedRsList = this.signalviewercontrol.stackercontrol.PluginContextMenuSelectedRsList;
                }
                else
                {
                    // Informationen von der aktuellen Mausposition
                    HoverStackEventArgs currentHoverStackEventArgs = hoverStackEventArgs;
                    if (currentHoverStackEventArgs == null)
                    {
                        return;
                    }

                    selectedRsList = currentHoverStackEventArgs.Stack;
                }
                Marker.deleteMarker(RendererManager.GetSevEntries(selectedRsList), signalviewercontrol.SelectionStart, signalviewercontrol.SelectionEnd);

                // Deselect all and Render again
                signalviewercontrol.Deselect();

                if (RendererManager.TimeMax < RendererManager.Time)
                {
                    RendererManager.Scroll(0.0);
                }
                else
                {
                    RendererManager.Render();
                }

                // Save Unisens file after Plugin execution
                Executed_Save(null, null);
            }
        }
示例#9
0
        private void Executed_CmdChangeTimeZoom(object sender, ExecutedRoutedEventArgs e)
        {
            string param = (string)e.Parameter;

            if (param.Equals("all"))
            {
                RendererManager.Scroll(0.0);
                RendererManager.Stretch(RendererManager.TimeMax);
            }
            else if (param.Equals("selection"))
            {
                if (this.SelectionStart != this.SelectionEnd)
                {
                    RendererManager.Scroll(this.SelectionStart);
                    RendererManager.Stretch(this.SelectionEnd - this.SelectionStart);
                }
            }
            else
            {
                // Parameter ist ein Zeitwert in Sekunden
                RendererManager.Stretch(double.Parse(param));
            }
        }
示例#10
0
        private void Execute_CropSelection(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                if (Crop.CropSelection(signalviewercontrol.SelectionStart, signalviewercontrol.SelectionEnd))
                {
                    // Deselect all and Render again
                    signalviewercontrol.Deselect();

                    if (RendererManager.TimeMax < RendererManager.Time)
                    {
                        RendererManager.Scroll(0.0);
                    }
                    else
                    {
                        RendererManager.Render();
                    }

                    // Save Unisens file after Plugin execution
                    Executed_Save(null, null);
                }
            }
        }
示例#11
0
        private void Execute_setMarkerList(object sender, ExecutedRoutedEventArgs e)
        {
            using (new WaitCursor())
            {
                string path = Environment.CurrentDirectory + "\\" + "unisens.xml";
                IEnumerable <XElement> retsigs = MarkerList.setMarkerList(path);

                // Deselect all and Render again
                signalviewercontrol.Deselect();

                if (RendererManager.TimeMax < RendererManager.Time)
                {
                    RendererManager.Scroll(0.0);
                }
                else
                {
                    RendererManager.Render();
                }

                // Save Unisens file after Plugin execution
                Executed_Save(null, null);
            }
        }
示例#12
0
 private void Scrollbar_Scroll(object sender, System.Windows.Controls.Primitives.ScrollEventArgs e)
 {
     ////if (e.ScrollEventType != System.Windows.Controls.Primitives.ScrollEventType.ThumbTrack)
     RendererManager.Scroll(e.NewValue);
 }
示例#13
0
 void timer_Tick(object sender, EventArgs e)
 {
     RendererManager.Scroll(startTime + (double)sw.ElapsedMilliseconds / 1000);
 }