Example #1
0
        private void editEntryMenu_Click(object sender, EventArgs e)
        {
            try
            {
                ListView.SelectedListViewItemCollection selectedMarkers = lstMarkers.SelectedItems;

                if (selectedMarkers.Count == 1)
                {
                    FrequencyMarker marker = (FrequencyMarker)selectedMarkers[0].Tag;

                    MarkerDetailsDialog dlg = new MarkerDetailsDialog(marker);

                    dlg.ShowDialog();
                }
            }
            catch (Exception)
            {
            }
            UpdateMarkerList();
        }
Example #2
0
        private void newEntryMenu_Click(object sender, EventArgs e)
        {
            long  freq  = 0;
            Tuner tuner = GetTuner();

            if (tuner != null)
            {
                freq = tuner.GetFrequency();
            }

            FrequencyMarker     marker = new FrequencyMarker(freq);
            MarkerDetailsDialog dlg    = new MarkerDetailsDialog("Add Marker...", marker);

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            MarkerList.Add(marker);
            UpdateMarkerList();
        }
Example #3
0
        void lstMarkers_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            try
            {
                switch (e.Button)
                {
                case MouseButtons.Right:
                    FrequencyMarker marker = GetSelected();
                    Tuner           tuner  = GetTuner();

                    if (marker != null)
                    {
                        ContextMenu contextMenu = new ContextMenu();
                        MenuItem    menuItem;
                        menuItem         = new MenuItem("Marker: " + marker.Label);
                        menuItem.Enabled = false;
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem         = new MenuItem("-");
                        menuItem.Enabled = false;
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem         = new MenuItem("Jump to");
                        menuItem.Enabled = (tuner == null);
                        menuItem.Click  += (object s, EventArgs a) =>
                        {
                            tuner.SetFrequency(marker.Frequency);
                        };
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem         = new MenuItem("-");
                        menuItem.Enabled = false;
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem        = new MenuItem("Edit...");
                        menuItem.Click += (object s, EventArgs a) =>
                        {
                            MarkerDetailsDialog dlg = new MarkerDetailsDialog(marker);
                            dlg.ShowDialog();
                            UpdateMarkerList();
                        };
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem        = new MenuItem("Delete");
                        menuItem.Click += (object s, EventArgs a) =>
                        {
                            MarkerList.Remove(marker);
                            UpdateMarkerList();
                        };
                        contextMenu.MenuItems.Add(menuItem);

                        menuItem         = new MenuItem("-");
                        menuItem.Enabled = false;
                        contextMenu.MenuItems.Add(menuItem);


                        bool              demodulation = MainScreen.MarkerDemodulators.ContainsKey(marker);
                        AudioDemodulator  Demod        = null;
                        DemodulationState DemodState   = null;

                        if (demodulation)
                        {
                            Demod      = MainScreen.MarkerDemodulators[marker];
                            DemodState = Demod.DemodState;

                            menuItem         = new MenuItem("Demodulate");
                            menuItem.Checked = true;
                            menuItem.Click  += (object s, EventArgs a) =>
                            {
                                if (DemodState.Dialog != null)
                                {
                                    DemodState.Dialog.Close();
                                    DemodState.Dialog = null;
                                }
                                Demod.Stop();
                                Demod.Close();

                                MainScreen.MarkerDemodulators.Remove(marker);
                            };
                            contextMenu.MenuItems.Add(menuItem);

                            menuItem         = new MenuItem("Demodulation Options...");
                            menuItem.Checked = (DemodState.Dialog != null);
                            menuItem.Click  += (object s, EventArgs a) =>
                            {
                                if (DemodState.Dialog != null)
                                {
                                    DemodState.Dialog.Close();
                                    DemodState.Dialog = null;
                                }
                                else
                                {
                                    DemodState.Dialog = new DemodulationDialog(DemodState);
                                    DemodState.Dialog.FrequencyFixed = true;
                                    DemodState.Dialog.Show();
                                }
                            };

                            contextMenu.MenuItems.Add(menuItem);
                        }
                        else
                        {
                            menuItem        = new MenuItem("Demodulate");
                            menuItem.Click += (object s, EventArgs a) =>
                            {
                                Demod      = new AudioDemodulator();
                                DemodState = Demod.DemodState;
                                DemodState.BaseFrequency = tuner.GetFrequency();
                                DemodState.DemodulationFrequencyMarker = marker.Frequency;
                                DemodState.Description = marker.Label;

                                MainScreen.MarkerDemodulators.Add(marker, Demod);

                                DemodState.Dialog = new DemodulationDialog(DemodState);
                                DemodState.Dialog.FrequencyFixed = true;
                                DemodState.Dialog.Show();
                                DemodState.Dialog.UpdateInformation();

                                Demod.Start(MainScreen.AudioShmem);
                            };

                            contextMenu.MenuItems.Add(menuItem);

                            menuItem         = new MenuItem("Demodulation Options...");
                            menuItem.Enabled = false;
                            contextMenu.MenuItems.Add(menuItem);
                        }

                        Point popupPos = this.PointToClient(MousePosition);

                        popupPos.X -= 20;
                        popupPos.Y -= 20;
                        contextMenu.Show(this, popupPos);
                    }
                    break;
                }
            }
            catch (Exception)
            {
            }
        }