コード例 #1
0
ファイル: Panel.cs プロジェクト: meharryp/dermadesignerb
        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);
        }
コード例 #2
0
ファイル: Toolbox.cs プロジェクト: meharryp/dermadesignerb
 private void Toolbox_Move(object sender, EventArgs e)
 {
     if (this.snapToWorkspace)
     {
         this.Location = new System.Drawing.Point(Derma.GetWorkspace().Location.X - Derma.toolbox.ClientSize.Width - 20, Derma.GetWorkspace().Location.Y);
     }
 }
コード例 #3
0
 private void FindPanelByVar_Load(object sender, EventArgs e)
 {
     foreach (Panel p in Derma.GetPanels())
     {
         this.PanelList.Items.Add(p.varname);
     }
 }
コード例 #4
0
ファイル: Derma.cs プロジェクト: meharryp/dermadesignerb
        private static void MouseUp(object sender, MouseEventArgs e)
        {
            bool doneAlready = false;

            foreach (Panel p in panels)
            {
                if (Derma.MouseIsOverPanel(p) && !doneAlready && p.MouseUpHandler != null)
                {
                    p.MouseUpHandler(p, e);
                    doneAlready = true;
                }

                if (p.dragging)
                {
                    p.dragging = false;
                    Panel h = GetHighlightedPanel();

                    if (h)
                    {
                        p.SetParent(h);
                        p.z = nextz;
                        nextz++;
                        ResortPanelsByZ();
                        RefreshProperties();
                        h.highlighted = false;
                    }
                }
            }
        }
コード例 #5
0
        public static bool Resize_MouseDown(object sender, MouseEventArgs e)
        {
            if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizablex && Derma.IsMouseOverArea(host.x + host.width - halfSize - 2, host.y + host.height / 2 - halfSize, 16, 16))
            {
                resizing      = true;
                resizingx     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }
            else if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizabley && Derma.IsMouseOverArea(host.x + host.width / 2 - halfSize, host.y + host.height - halfSize - 2, 16, 16))
            {
                resizing      = true;
                resizingy     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }
            else if (host != null && Derma.GetSelected() == host && !host.locked && host.sizable && host.sizablex && host.sizabley && Derma.IsMouseOverArea(host.x + host.width - twoThirdsSize, host.y + host.height - twoThirdsSize, 16, 16))
            {
                resizing      = true;
                resizinga     = true;
                mouseOrigin.X = e.X;
                mouseOrigin.Y = e.Y;
                return(true);
            }

            return(false);
        }
コード例 #6
0
 private void PropertiesWindow_Move(object sender, EventArgs e)
 {
     if (this.snapToWorkspace)
     {
         this.Location = new System.Drawing.Point(Derma.GetWorkspace().Location.X + Derma.GetWorkspace().ClientSize.Width + 24, Derma.GetWorkspace().Location.Y);
     }
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: meharryp/dermadesignerb
        static void CreateControl(object sender, EventArgs e)
        {
            TreeView t = (TreeView)sender;

            Derma.New(t.SelectedNode.Text.ToString());
            Derma.Repaint();
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
        private void Form1_DragDrop(object sender, DragEventArgs e)
        {
            string pName  = (string)e.Data.GetData(typeof(string));
            Point  newPos = Derma.GetRelativeMousePos(e.X, e.Y);

            Derma.New(pName, newPos.X, newPos.Y);
            Derma.Repaint();
        }
コード例 #9
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
        private void menuItem44_Click(object sender, EventArgs e)
        {
            LargeTextBox l = new LargeTextBox();

            l.luaOutput.Text = Derma.GenerateLua();

            l.ShowDialog(this);
        }
コード例 #10
0
ファイル: Panel.cs プロジェクト: meharryp/dermadesignerb
 public bool IsCentered()
 {
     if (this.x == (Derma.GetWorkspace().Width / 2) - (this.width / 2) && this.y == (Derma.GetWorkspace().Width / 2) - (this.height / 2))
     {
         return(true);
     }
     return(false);
 }
コード例 #11
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
        private void menuItem40_Click(object sender, EventArgs e)
        {
            if (Derma.GetSelected() && Derma.GetSelected().hasParent&& Derma.GetSelected().parent)
            {
                Derma.GetSelected().UnParent();
            }

            Derma.Repaint();
        }
コード例 #12
0
ファイル: Derma.cs プロジェクト: meharryp/dermadesignerb
 private static void MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     foreach (Panel p in panels)
     {
         if (Derma.MouseIsOverPanel(p) && p.MouseDoubleClickHandler != null)
         {
             p.MouseDoubleClickHandler(p, e);
             break;
         }
     }
 }
コード例 #13
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
        private void menuItem29_Click(object sender, EventArgs e)
        {
            MenuItem t = (MenuItem)sender;

            t.Checked = !t.Checked;
            Derma.toolbox.snapToWorkspace = t.Checked;
            if (t.Checked)
            {
                Derma.toolbox.Location = new System.Drawing.Point(Derma.GetWorkspace().Location.X - Derma.toolbox.ClientSize.Width - 20, Derma.GetWorkspace().Location.Y);
            }
        }
コード例 #14
0
ファイル: Derma.cs プロジェクト: meharryp/dermadesignerb
 private static void MouseClick(object sender, MouseEventArgs e)
 {
     foreach (Panel p in panels)
     {
         if (Derma.MouseIsOverPanel(p) && p.MouseClickHandler != null && !p.hidden)
         {
             p.MouseClickHandler(p, e);
             break;
         }
     }
 }
コード例 #15
0
ファイル: Derma.cs プロジェクト: meharryp/dermadesignerb
 private static void MouseWheel(object sender, MouseEventArgs e)
 {
     foreach (Panel p in panels)
     {
         if (Derma.MouseIsOverPanel(p) && p.MouseWheelHandler != null)
         {
             p.MouseWheelHandler(p, e);
             break;
         }
     }
 }
コード例 #16
0
ファイル: Panel.cs プロジェクト: meharryp/dermadesignerb
 public void Center()
 {
     if (this.hasParent && this.parent)
     {
         this.SetPos(parent.x + (parent.width / 2) - (this.width / 2), parent.y + (parent.height / 2) - (this.height / 2));
     }
     else
     {
         this.SetPos((Derma.GetWorkspace().Width / 2) - (this.width / 2), (Derma.GetWorkspace().Height / 2) - (this.height / 2));
     }
 }
コード例 #17
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
        private void Form1_Move(object sender, EventArgs e)
        {
            if (Derma.toolbox != null && Derma.toolbox.snapToWorkspace)
            {
                Derma.toolbox.Location = new System.Drawing.Point(Derma.GetWorkspace().Location.X - Derma.toolbox.ClientSize.Width - 20, Derma.GetWorkspace().Location.Y);
            }

            if (Derma.prop != null && Derma.prop.snapToWorkspace)
            {
                Derma.prop.Location = new System.Drawing.Point(Derma.GetWorkspace().Location.X + Derma.GetWorkspace().ClientSize.Width + 24, Derma.GetWorkspace().Location.Y);
            }
        }
コード例 #18
0
ファイル: DFrame.cs プロジェクト: meharryp/dermadesignerb
        public DFrame(int xpos, int ypos) : base(xpos, ypos, 120, 60)
        {
            numOfThisType++;

            if (!this.SetVarName(type + numOfThisType.ToString()))
            {
                while (!this.SetVarName(type + numOfThisType.ToString() + Derma.RandomString(4, false)))
                {
                    continue;
                }
            }
        }
コード例 #19
0
ファイル: DTextEntry.cs プロジェクト: meharryp/dermadesignerb
        public DTextEntry(int x, int y) : base(x, y, 50, 20)
        {
            numOfThisType++;

            if (!this.SetVarName(type + numOfThisType.ToString()))
            {
                while (!this.SetVarName(type + numOfThisType.ToString() + Derma.RandomString(4, false)))
                {
                    continue;
                }
            }
        }
コード例 #20
0
        public SpawnIcon(int x, int y) : base(x, y, 61, 61)
        {
            numOfThisType++;

            if (!this.SetVarName(type + numOfThisType.ToString()))
            {
                while (!this.SetVarName(type + numOfThisType.ToString() + Derma.RandomString(4, false)))
                {
                    continue;
                }
            }
        }
コード例 #21
0
ファイル: DSave.cs プロジェクト: meharryp/dermadesignerb
 public static void Load(string filename)
 {
     try {
         Packer.ReadAllFromFile(filename);
     } catch (Exception e) {
         MessageBox.Show("Unable to load file\n" + e.Message, "Unable to load", MessageBoxButtons.OK,
                         MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         return;
     }
     SetEnvironment(filename);
     Derma.Repaint();
 }
コード例 #22
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);
                }
            }
        }
コード例 #23
0
ファイル: Panel.cs プロジェクト: meharryp/dermadesignerb
 public void Remove()
 {
     foreach (Panel p in children)
     {
         p.Remove();
     }
     if (ResizeGrip.host == this)
     {
         ResizeGrip.host = null;
     }
     Derma.GetPanels().Remove(this);
     Derma.Repaint();
 }
コード例 #24
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");
        }
コード例 #25
0
        public DNumSlider(int x, int y) : base(x, y, 154, 40)
        {
            numOfThisType++;

            this.text = "DNumSlider";

            if (!this.SetVarName(type + numOfThisType.ToString()))
            {
                while (!this.SetVarName(type + numOfThisType.ToString() + Derma.RandomString(4, false)))
                {
                    continue;
                }
            }
        }
コード例 #26
0
ファイル: Main.cs プロジェクト: meharryp/dermadesignerb
 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();
 }
コード例 #27
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();
        }
コード例 #28
0
        public DLabel(int xpos, int ypos) : base(xpos, ypos, 60, 20)
        {
            numOfThisType++;

            if (!this.SetVarName(type + numOfThisType.ToString()))
            {
                while (!this.SetVarName(type + numOfThisType.ToString() + Derma.RandomString(4, false)))
                {
                    continue;
                }
            }

            this.width  = (int)labelSize.Width;
            this.height = (int)labelSize.Height;
        }
コード例 #29
0
ファイル: Derma.cs プロジェクト: meharryp/dermadesignerb
 // to set the selected panel
 static void SelectedItem_MouseHandler(object sender, MouseEventArgs e)
 {
     if (e.Button != MouseButtons.Left)
     {
         return;
     }
     foreach (Panel p in panels)
     {
         if (Derma.MouseIsOverPanel(p))
         {
             SetSelected(p);
             Repaint();
             break;
         }
     }
 }
コード例 #30
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();
 }