Пример #1
0
        /// <summary>
        /// new Render in X-direchtion
        /// </summary>
        /// <param name="stackercontrol"></param>
        /// <param name="imageHeight">New image height in pixels (height is the time or x axis</param>
        public static void Drag(StackerControl stackercontrol, double imageHeight)
        {
            if (imageHeight < 20)
            {
                imageHeight = 20;
            }
            MaxBreite = imageHeight;
            for (int i = 0; i < stackercontrol.renderSliceLists.Count; i++)
            {
                RenderSlice rs = null;

                // modify all RenderSlice of the Renderers
                for (int j = 0; j < stackercontrol.renderSliceLists[i].Count; j++)
                {
                    // at adding a new RenderSlice in the rslist,
                    // the current RenderSlice is moved forward.
                    rs = stackercontrol.renderSliceLists[i][0];
                    int imageWidth = ((RasterRenderSlice)rs).ImageWidth;

                    Renderer_Update(rs, imageWidth, imageHeight);
                    RenderSlice_Update(rs, imageWidth, imageHeight);

                    // old RenderSlice replaced by new
                    Renderer r       = rs.Renderer;
                    XElement channel = rs.UnisensNode;
                    stackercontrol.MoveRenderSlice(rs, stackercontrol.renderSliceLists[i]);

                    // paint signal again
                    RendererManager.Render(r, channel);
                }
            }
        }
Пример #2
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);
        }
Пример #3
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);
            }
        }
Пример #4
0
        // wird vom stapel-kontextmenü ausgelöst
        private void ExecPlugin_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            ExecPluginCommandParameter exec = (ExecPluginCommandParameter)e.Parameter;

            IEnumerable <XElement> sev_entries = RendererManager.GetSevEntries(exec.Stack);

            IEnumerable <XElement> retsigs = this.ExecutePlugin(exec.Plugin, sev_entries, exec.TimeCursor, exec.Parameter);

            if (retsigs != null)
            {
                foreach (XElement xe in retsigs)
                {
                    if (StackerControl.IsSignalEventValueEntry(xe))
                    {
                        signalviewercontrol.stackercontrol.DropSignalEventValueEntry(xe, exec.Stack);
                    }
                }
            }
        }
Пример #5
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);
            }
        }
Пример #6
0
        /// <summary>
        /// Run a plug-in after pressing a hotkey.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">pressed key event</param>
        private void WindowMain_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            HoverStackEventArgs currentHoverStackEventArgs = this.hoverStackEventArgs;

            if (currentHoverStackEventArgs != null)
            {
                PluginHotkeyBinding hb = (PluginHotkeyBinding)this.hotkeys.Bindings[new HotkeyHashkey(e.Key, Keyboard.Modifiers)];

                if (hb != null)
                {
                    Keyboard.Focus(signalviewercontrol);
                    e.Handled = true;

                    Point  point                   = Mouse.GetPosition(currentHoverStackEventArgs.ItemsControl);
                    double time_cursor             = RendererManager.Time + (RendererManager.TimeStretch * point.X / currentHoverStackEventArgs.ItemsControl.ActualWidth);
                    IEnumerable <XElement> retsigs = null;

                    switch (hb.Signals)
                    {
                    case PluginHotkeyBinding.SelectedSignals.AllOpenFiles:
                        retsigs = this.ExecutePlugin(hb.Plugin, RendererManager.GetSevEntriesAllRenderers(), time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.StackFiles:
                        retsigs = this.ExecutePlugin(hb.Plugin, currentHoverStackEventArgs.StackSevEntries, time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.StackChannels:
                        retsigs = this.ExecutePlugin(hb.Plugin, currentHoverStackEventArgs.StackChannelEntries, time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.StackSelectedFiles:
                        retsigs = this.ExecutePlugin(hb.Plugin, currentHoverStackEventArgs.StackSelectionSevEntries, time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.StackSelectedChannels:
                        retsigs = this.ExecutePlugin(hb.Plugin, currentHoverStackEventArgs.StackSelectionChannelEntries, time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.AllSignalEntries:
                        retsigs = this.ExecutePlugin(hb.Plugin, UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}signalEntry"), time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.AllEventEntries:
                        retsigs = this.ExecutePlugin(hb.Plugin, UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}eventEntry"), time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.AllValuesEntries:
                        retsigs = this.ExecutePlugin(hb.Plugin, UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}valuesEntry"), time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.Dialog:
                        retsigs = this.ExecutePluginWithDialog(hb.Plugin, time_cursor, hb.Parameter);
                        break;

                    case PluginHotkeyBinding.SelectedSignals.All:     // TODO: All Entries from Unisens.xml
                        List <XElement> entryElements = new List <XElement>();
                        entryElements.AddRange(UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}signalEntry"));
                        entryElements.AddRange(UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}eventEntry"));
                        entryElements.AddRange(UnisensXmlFileManager.CurrentUnisensInstance.Xdocument.Root.Elements("{http://www.unisens.org/unisens2.0}valuesEntry"));

                        retsigs = this.ExecutePlugin(hb.Plugin, entryElements, time_cursor, hb.Parameter);
                        break;
                    }

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