static void CreateControl(object sender, EventArgs e) { TreeView t = (TreeView)sender; Derma.New(t.SelectedNode.Text.ToString()); Derma.Repaint(); }
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(); }
private void menuItem40_Click(object sender, EventArgs e) { if (Derma.GetSelected() && Derma.GetSelected().hasParent&& Derma.GetSelected().parent) { Derma.GetSelected().UnParent(); } Derma.Repaint(); }
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(); }
public void Remove() { foreach (Panel p in children) { p.Remove(); } if (ResizeGrip.host == this) { ResizeGrip.host = null; } Derma.GetPanels().Remove(this); Derma.Repaint(); }
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"); }
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(); }
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"); }
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; } }
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(); } }
public void SetPos(int newx, int newy, bool snap) { if (GUI.Grid.DrawGrid && snap) { newx = (int)Math.Round((double)newx / GUI.Grid.GridSize, 1) * GUI.Grid.GridSize; newy = (int)Math.Round((double)newy / GUI.Grid.GridSize, 1) * GUI.Grid.GridSize; } foreach (Panel p in children) { p.ModifyPos(newx - this.x, newy - this.y); } this.x = newx; this.y = newy; if (LastX != newx || LastY != newy) { Derma.Repaint(); } LastX = newx; LastY = newy; }
private void menuItem25_Click(object sender, EventArgs e) { Main.ActiveForm.Size = new Size(1920, 1080); Derma.Repaint(); }
private void menuItem22_Click(object sender, EventArgs e) { Main.ActiveForm.Size = new Size(1280, 768); Derma.Repaint(); }
private void menuItem16_Click(object sender, EventArgs e) { Main.ActiveForm.Size = new Size(800, 600); Derma.Repaint(); }
public static void Resize_MouseMove(object sender, MouseEventArgs e) { if (resizing && resizinga) { Point newsize; if (host.centered) { newsize = new Point((e.X - mouseOrigin.X) * 2, (e.Y - mouseOrigin.Y) * 2); } else { newsize = new Point(e.X - mouseOrigin.X, e.Y - mouseOrigin.Y); } if (host.PreResize(host.width + newsize.X, host.height + newsize.Y) && host.width + newsize.X > 10 && host.height + newsize.Y > 10) { if (GUI.Grid.DrawGrid && Math.Abs(mouseOrigin.X - e.X) > GUI.Grid.GridSize || Math.Abs(mouseOrigin.Y - e.Y) > GUI.Grid.GridSize) { host.ModifySize(newsize.X, newsize.Y, true); mouseOrigin.X = e.X; mouseOrigin.Y = e.Y; } else if (!GUI.Grid.DrawGrid) { host.ModifySize(newsize.X, newsize.Y, true); mouseOrigin.X = e.X; mouseOrigin.Y = e.Y; } host.PostResize(); Derma.RefreshProperties(); Derma.Repaint(); } } else if (resizing && resizingx) { Point newsize; if (host.centered) { newsize = new Point((e.X - mouseOrigin.X) * 2, (mouseOrigin.Y) * 2); } else { newsize = new Point(e.X - mouseOrigin.X, mouseOrigin.Y); } if (host.PreResize(host.width + newsize.X, host.height + newsize.Y) && host.width + newsize.X > 10 && host.height + newsize.Y > 10) { if (GUI.Grid.DrawGrid && Math.Abs(mouseOrigin.X - e.X) >= GUI.Grid.GridSize) { host.ModifySize(newsize.X, 0, true); mouseOrigin.X = e.X; } else if (!GUI.Grid.DrawGrid) { host.ModifySize(newsize.X, 0, true); mouseOrigin.X = e.X; } host.PostResize(); Derma.RefreshProperties(); Derma.Repaint(); } } else if (resizing && resizingy) { Point newsize; if (host.centered) { newsize = new Point((mouseOrigin.X) * 2, (e.Y - mouseOrigin.Y) * 2); } else { newsize = new Point(mouseOrigin.X, e.Y - mouseOrigin.Y); } if (host.PreResize(host.width + newsize.X, host.height + newsize.Y) && host.width + newsize.X > 10 && host.height + newsize.Y > 10) { if (GUI.Grid.DrawGrid && Math.Abs(mouseOrigin.Y - e.Y) >= GUI.Grid.GridSize) { host.ModifySize(0, newsize.Y, true); mouseOrigin.Y = e.Y; } else if (!GUI.Grid.DrawGrid) { host.ModifySize(0, newsize.Y, true); mouseOrigin.Y = e.Y; } host.PostResize(); Derma.RefreshProperties(); Derma.Repaint(); } } }
private void menuItem33_Click(object sender, EventArgs e) { GUI.Grid.DrawGrid = false; Derma.Repaint(); }
private void menuItem38_Click(object sender, EventArgs e) { GUI.Grid.DrawGrid = true; GUI.Grid.GridSize = 100; Derma.Repaint(); }
private void Form1_ResizeEnd(object sender, EventArgs e) { Derma.Repaint(); }