Exemple #1
0
 private void FindPanelByVar_Load(object sender, EventArgs e)
 {
     foreach (Panel p in Derma.GetPanels())
     {
         this.PanelList.Items.Add(p.varname);
     }
 }
Exemple #2
0
        public bool SetVarName(string name)
        {
            System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9_\\.\\[\\]]");
            if (reg.IsMatch(name))
            {
                return(false);
            }

            if (name.IndexOfAny(new char[] { '.', '[', ']' }) != -1)
            {
                this.global = true;
            }

            foreach (Panel p in Derma.GetPanels())
            {
                if (p.varname == name)
                {
                    return(false);
                }
            }

            varname = name;
            Derma.RefreshProperties();

            return(true);
        }
Exemple #3
0
        private void RefreshListing()
        {
            this.PanelList.Items.Clear();

            foreach (Panel p in Derma.GetPanels())
            {
                if (p.varname.ToLower().Contains(this.TEntry.Text.ToLower()))
                {
                    this.PanelList.Items.Add(p.varname);
                }
            }
        }
Exemple #4
0
 public void Remove()
 {
     foreach (Panel p in children)
     {
         p.Remove();
     }
     if (ResizeGrip.host == this)
     {
         ResizeGrip.host = null;
     }
     Derma.GetPanels().Remove(this);
     Derma.Repaint();
 }
Exemple #5
0
        private void SelectBtn_Click(object sender, EventArgs e)
        {
            foreach (Panel p in Derma.GetPanels())
            {
                if (p.varname == this.TEntry.Text)
                {
                    Derma.SetSelected(p);
                    Derma.Repaint();
                    return;
                }
            }

            MessageBox.Show("No panel exists with the variable name '" + this.TEntry.Text + "'.", "Panel not found");
        }
Exemple #6
0
 private void menuItem5_Click(object sender, EventArgs e)
 {
     if (Derma.GetPanels().Count > 0)
     {
         DialogResult reply = MessageBox.Show("Are you sure you want to open a saved project?\nAny unsaved data in the current project will be lost.",
                                              "Open project", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
         if (reply != DialogResult.Yes)
         {
             return;
         }
     }
     DSave.SetDialogDefaults();
     Derma.prop.propertyGrid.SelectedObject = null;
     OpenDialog.ShowDialog();
 }
Exemple #7
0
        public void PackAllToFile(string filename)
        {
            List <Panel> panels = Derma.GetPanels();

            PanelData = new List <DPanelInfo>();
            foreach (Panel p in panels)
            {
                InsertPanelInfo(PanelToInfo(p));
            }
            FileStream Fstream = File.OpenWrite(filename);

            Byte[] Data = GetData();
            Fstream.Write(Data, 0, Data.Length);
            Fstream.Close();
        }
Exemple #8
0
 /// <summary>
 /// Must be called directly after any PanelFromPanelInfo calls
 /// </summary>
 public static void MatchParentsWithIdentitifiers()
 {
     foreach (Panel p in Derma.GetPanels())
     {
         if (p.parentIdentifier != null)
         {
             foreach (Panel p2 in Derma.GetPanels())
             {
                 if (p.parentIdentifier == p2.varname)
                 {
                     p.SetParent(p2);
                     p.parentIdentifier = null;
                 }
             }
         }
     }
     Derma.ResortPanelsByZ();
 }
Exemple #9
0
        public static void ClearAll()
        {
            SetEnvironment("Untitled.ddproj");
            List <Panel> PList = new List <Panel>();

            PList.Concat(Derma.GetPanels());
            foreach (Panel P in PList)
            {
                try {
                    P.Remove();
                } catch {
                    // We don't care if it doesn't want to remove, the panel list will get cleared anyways.
                }
            }
            Derma.GetPanels().Clear();
            ResizeGrip.host = null;
            Derma.Repaint();
        }
Exemple #10
0
        private void PanelList_DoubleClick(object sender, EventArgs e)
        {
            if (this.PanelList.SelectedItem == null)
            {
                return;
            }

            foreach (Panel p in Derma.GetPanels())
            {
                if (p.varname == this.PanelList.SelectedItem.ToString())
                {
                    Derma.SetSelected(p);
                    Derma.Repaint();
                    return;
                }
            }

            MessageBox.Show("No panel exists with the variable name '" + this.TEntry.Text + "'.", "Panel not found");
        }
Exemple #11
0
        private void TEntry_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((int)e.KeyChar == 13)
            {
                foreach (Panel p in Derma.GetPanels())
                {
                    if (p.varname == this.TEntry.Text)
                    {
                        Derma.SetSelected(p);
                        Derma.Repaint();
                        e.Handled = true;
                        return;
                    }
                }

                MessageBox.Show("No panel exists with the variable name '" + this.TEntry.Text + "'.", "Panel not found");
                return;
            }
        }
Exemple #12
0
 private void menuItem4_Click(object sender, EventArgs e)
 {
     if (Derma.GetPanels().Count > 0)
     {
         DialogResult reply = MessageBox.Show("Are you sure you want to start a new project?\nAny unsaved data will be lost.",
                                              "Really create a new project?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
         if (reply == DialogResult.Yes)
         {
             DSave.ClearAll();
             Derma.prop.propertyGrid.SelectedObject = null;
             Derma.Repaint();
         }
     }
     else
     {
         DSave.ClearAll();
         Derma.prop.propertyGrid.SelectedObject = null;
         Derma.Repaint();
     }
 }
Exemple #13
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Derma.GetPanels().Count > 0)
     {
         DialogResult reply = MessageBox.Show("Do you want to save your current project?",
                                              "Save project", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (reply == DialogResult.Yes)
         {
             if (DSave.GetEnvironment() == "Untitled.ddproj")
             {
                 SaveDialog.ShowDialog();
             }
             else
             {
                 DSave.Save();
             }
         }
         else if (reply == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
     }
 }