예제 #1
0
        private void FileSaveAs()
        {
            CircuitView selected = null;

            if (tabControl.SelectedTab != null)
            {
                selected = tabControl.SelectedTab.Controls[0] as CircuitView;
            }
            if (selected == null)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "Circuits";
            sfd.Filter           = "Circuit files(*.circuit)|*.circuit";
            sfd.FilterIndex      = 1;
            sfd.RestoreDirectory = true;
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                selected.DumpToDisk(sfd.FileName);
                selected.FileName = sfd.FileName;

                tabControl.SelectedTab.Text =
                    Path.GetFileNameWithoutExtension(sfd.FileName);
            }
            sfd.Dispose();
        }
예제 #2
0
        private void CreateNewTabPage(String currentFileName)
        {
            if (!File.Exists(currentFileName))
            {
                MessageBox.Show("The file name received (" + currentFileName + ") points to an innexistent file",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            NoMousewheelTabPage t = new NoMousewheelTabPage(GetNewTabPageName());

            t.AutoScroll = true;
            t.BackColor  = Settings.Default.CircuitBackColor;
            t.Text       = Path.GetFileNameWithoutExtension(currentFileName);

            tabControl.TabPages.Add(t);
            CircuitView cv = new CircuitView(currentFileName);

            cv.OnGateSelected += new CircuitView.GateSelectedEvent(cv_OnGateSelected);
            cv.Location        = new Point(0, 0);

            cv.Dock = DockStyle.Fill;
            t.Controls.Add(cv);

            tabControl.SelectedTab = t;
        }
예제 #3
0
        //Verify the saved status for the current tab
        //returns false if the close tab event should be canceled
        private bool VerifySavedStatus()
        {
            CircuitView selected = null;

            if (tabControl.SelectedTab != null)
            {
                selected = tabControl.SelectedTab.Controls[0] as CircuitView;

                if (!selected.Saved)
                {
                    String text =
                        String.Format("The circuit '{0}' has not been saved. Do you want to save it?",
                                      tabControl.SelectedTab.Text);

                    DialogResult result =
                        MessageBox.Show(
                            text,
                            "Question",
                            MessageBoxButtons.YesNoCancel,
                            MessageBoxIcon.Question);

                    if (result == DialogResult.Yes)
                    {
                        FileSave();
                    }

                    if (result == DialogResult.Cancel)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #4
0
        private void FileSave()
        {
            CircuitView selected = null;

            if (tabControl.SelectedTab != null)
            {
                selected = tabControl.SelectedTab.Controls[0] as CircuitView;
                if (!String.IsNullOrEmpty(selected.FileName))
                {
                    selected.DumpToDisk(selected.FileName);
                }
                else
                {
                    FileSaveAs();
                }
            }
        }
예제 #5
0
        private void FileNew()
        {
            CircuitView         cv = new CircuitView();
            NoMousewheelTabPage tp = new NoMousewheelTabPage(GetNewTabPageName());

            tp.Size = tabControl.Size;
            cv.Size = tabControl.Size;

            tp.AutoScroll = true;
            tp.BackColor  = Settings.Default.CircuitBackColor;
            tp.Controls.Add(cv);
            cv.Dock            = DockStyle.Fill;
            cv.OnGateSelected += new CircuitView.GateSelectedEvent(cv_OnGateSelected);
            tabControl.TabPages.Add(tp);

            tabControl.SelectedTab = tp;
        }
예제 #6
0
 public Simulate(CircuitView cw)
     : this(cw.circuit, cw)
 {
 }
예제 #7
0
 public Simulate(Circuit c, CircuitView cw)
     : this(c)
 {
     this.cw = cw;
 }