Exemple #1
0
        /// <summary>
        /// Creates an editor of the given type, or if one is already open, brings it to focus
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public virtual T OpenEditor <T>() where T : IEditor
        {
            Console.WriteLine("Opening a " + typeof(T).Name + " for document " + Name);
            T Editor = (T)AttachedEditors.FirstOrDefault(x => x.GetType() == typeof(T));

            if (Editor != null)
            {
                DockableForm form = Editor as DockableForm;
                if (form != null)
                {
                    //Bring this form to the forefront in the docking area it is already at.
                    form.Show(MainForm.PrimaryDockingPanel, form.DockState);
                }


                return(Editor);
            }

            //Create the new editor
            Editor = (T)typeof(T).GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
            Editor.ActiveDocument = this;

            OnDocumentEdited += Editor.NotifyDocumentModified;
            OnDocumentSaved  += Editor.NotifyDocumentSaved;

            AttachedEditors.Add(Editor);

            return(Editor);
        }
Exemple #2
0
        public MainForm()
        {
            InitializeComponent();

            // Set main form as MDI container to hold several forms
            this.IsMdiContainer = true;

            this.splitContainer1.SplitterDistance = this.Width / 2;

            // Create checking form
            mCheckingForm_O = new DockableForm(this);
            mCheckingForm_O.DockWindow();
            mCheckingForm_O.SetFrameTitle("Checking");
            this.splitContainer1.Panel1.Controls.Add(mCheckingForm_O);
            mCheckingForm_O.Show();

            // Create job form
            mJobForm_O = new DockableForm(this);
            mJobForm_O.DockWindow();
            mJobForm_O.SetFrameTitle("Jobs");
            this.splitContainer1.Panel2.Controls.Add(mJobForm_O);
            mJobForm_O.Show();

            // Set toolstrip renderer
            toolStrip1.Renderer = new BorderlessToolStripRenderer();
        }
Exemple #3
0
        private void setAutomaticScales()
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => setAutomaticScales()));
                return;
            }

            if (meanMzErrorGraphForm.IsHidden)
            {
                meanMzErrorGraphForm.Show(dockPanel, DockState.Document);
                percentTicGraphForm.Show(dockPanel, DockState.Document);
                percentPeakCountGraphForm.Show(dockPanel, DockState.Document);
                lastActiveGraphForm.Activate();
            }

            foreach (var graphControl in graphControls)
            {
                graphControl.MasterPane.AxisChange();
            }

            if (!lockZoomCheckBox.Checked)
            {
                for (int i = 0; i <= (int)IonSeries.Count; ++i)
                {
                    percentTicGraphControl.MasterPane.PaneList[i].YAxis.Scale.Max       = Math.Min(100, maxPercentTic + 3);
                    percentTicGraphControl.MasterPane.PaneList[i].YAxis.Scale.Min       = 0;
                    percentPeakCountGraphControl.MasterPane.PaneList[i].YAxis.Scale.Max = Math.Min(100, maxPercentPeakCount + 3);
                    percentPeakCountGraphControl.MasterPane.PaneList[i].YAxis.Scale.Min = 0;
                    meanMzErrorGraphControl.MasterPane.PaneList[i].YAxis.Scale.Max      = maxMeanMzError + maxMeanMzError * 0.05;
                    meanMzErrorGraphControl.MasterPane.PaneList[i].YAxis.Scale.Min      = -meanMzErrorGraphControl.MasterPane.PaneList[i].YAxis.Scale.Max;
                }
            }

            foreach (var graphControl in graphControls)
            {
                graphControl.Refresh();
            }
        }
Exemple #4
0
        void zedGraphControl_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
        {
            if (ShowDataTable == null)
            {
                return;
            }

            var e = new ShowDataTableEventArgs();

            ShowDataTable(this, e);

            int index = menuStrip.Items.Cast <ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count();

            menuStrip.Items.Insert(index,
                                   new ToolStripMenuItem("Show Data Table", null,
                                                         (x, y) =>
            {
                var tableForm = new DockableForm
                {
                    Text = this.Text + " Data Table",
                    Size = new Size(480, 600)
                };

                var dgv = new DataGridView
                {
                    Dock                  = DockStyle.Fill,
                    DataSource            = e.DataTable,
                    RowHeadersVisible     = false,
                    AllowUserToDeleteRows = false,
                    AllowUserToAddRows    = false,
                    ReadOnly              = true,
                    ClipboardCopyMode     = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
                };
                tableForm.Controls.Add(dgv);
                tableForm.Show(this);
            }));
        }
Exemple #5
0
        public void ShowResultsGrid(bool show)
        {
            if (show)
            {
                if (_resultsGridForm != null && !Program.SkylineOffscreen)
                {
                    _resultsGridForm.Activate();
                }
                else
                {
                    _resultsGridForm = _resultsGridForm ?? CreateResultsGrid();

                    var rectFloat = GetFloatingRectangleForNewWindow();
                    _resultsGridForm.Show(dockPanel, rectFloat);
                }
            }
            else
            {
                if (_resultsGridForm != null)
                {
                    _resultsGridForm.Hide();
                }
            }
        }
Exemple #6
0
 public void PushDockableWindow(DockableForm form, DockState state)
 {
     form.Show(dockPanel, state);
 }
        void zedGraphControl_ContextMenuBuilder (ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
        {
            if (ShowDataTable == null)
                return;

            var e = new ShowDataTableEventArgs();
            ShowDataTable(this, e);

            int index = menuStrip.Items.Cast<ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count();
            menuStrip.Items.Insert(index,
                new ToolStripMenuItem("Show Data Table", null,
                (x, y) =>
                {
                    var tableForm = new DockableForm
                    {
                        Text = this.Text + " Data Table",
                        Size = new Size(480, 600)
                    };

                    var dgv = new DataGridView
                    {
                        Dock = DockStyle.Fill,
                        DataSource = e.DataTable,
                        RowHeadersVisible = false,
                        AllowUserToDeleteRows = false,
                        AllowUserToAddRows = false,
                        ReadOnly = true,
                        ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
                    };
                    tableForm.Controls.Add(dgv);
                    tableForm.Show(this);
                }));
        }
Exemple #8
0
 public void PushDockableWindow(DockableForm form, DockState state)
 {
     form.Show(dockPanel, state);
 }