//Gradients private void newGradientToolStripMenuItem_Click(object sender, EventArgs e) { TextEntryDialog ted = new TextEntryDialog("Gradient Name"); if (ted.ShowDialog() == DialogResult.OK) { if (!Document.ContainsGradient(ted.Entry)) { if (ted.Entry != null && ted.Entry.Length > 0) { GradientDialog gd = new GradientDialog(ted.Entry, this); if (gd.ShowDialog() != DialogResult.OK) { Document.RemoveGradient(ted.Entry); } } else { MessageBox.Show("Please enter a valid name for your gradient in the box above.", "Naming Error"); } } else { MessageBox.Show(string.Format("A gradient named {0} already exists. Type a new name in the box above, or remove the existing gradient.", ted.Entry), "Naming Conflict"); } } }
//Renders private void newRenderToolStripMenuItem_Click(object sender, EventArgs e) { TextEntryDialog ted = new TextEntryDialog("Render Name"); if (ted.ShowDialog() == DialogResult.OK) { if (!Document.ContainsRender(ted.Entry)) { if (Document.SetRender(ted.Entry, null)) { RenderDialog rd = new RenderDialog(ted.Entry, this); if (rd.ShowDialog() == DialogResult.OK) { Document.SetRender(ted.Entry, new HeightRender(rd.RenderWidth, rd.RenderHeight, rd.RenderClamp, rd.RenderClampMin, rd.RenderClampMax, rd.RenderWrapX, rd.RenderWrapY)); Document.SelectedRenderName = ted.Entry; } else { Document.RemoveRender(ted.Entry); } } else { MessageBox.Show("Please enter a valid name for your render in the box above.", "Naming Error"); } } else { MessageBox.Show(string.Format("A render named {0} already exists. Type a new name in the box above, or remove the existing render.", ted.Entry), "Naming Conflict"); } } }
//Generators private void newGeneratorToolStripMenuItem_Click(object sender, EventArgs e) { TextEntryDialog ted = new TextEntryDialog("Generator Name"); if (ted.ShowDialog() == DialogResult.OK) { if (!Document.ContainsGenerator(ted.Entry)) { if (Document.SetGenerator(ted.Entry, null)) { generatorDialog.GeneratorName = ted.Entry; generatorDialog.Show(); } else { MessageBox.Show("Please enter a valid name for your generator in the box above.", "Naming Error"); } } else { MessageBox.Show(string.Format("A generator named {0} already exists. Type a new name in the box above, or remove the existing generator.", ted.Entry), "Naming Conflict"); } } }
//Brushes private void newBrushToolStripMenuItem_Click(object sender, EventArgs e) { TextEntryDialog ted = new TextEntryDialog("Brush Name"); if (ted.ShowDialog() == DialogResult.OK) { if (!Document.ContainsBrush(ted.Entry)) { if (Document.SetBrush(ted.Entry, new HeightBrush(64, 64, 1, 8))) { brushDialog.BrushName = ted.Entry; brushDialog.Show(); } else { MessageBox.Show("A brush cannot have an empty name.", "Naming Error"); } } else { MessageBox.Show(string.Format("A brush named {0} already exists. Type a new name in the box above, or remove the existing brush.", ted.Entry), "Naming Conflict"); } } }
//Effects private void newEffectToolStripMenuItem_Click(object sender, EventArgs e) { TextEntryDialog ted = new TextEntryDialog("Effect Name"); if (ted.ShowDialog() == DialogResult.OK) { if (!Document.ContainsEffect(ted.Entry)) { if (Document.SetEffect(ted.Entry, null)) { effectDialog.EffectName = ted.Entry; effectDialog.Show(); } else { MessageBox.Show("Please enter a valid name for your effect in the box above.", "Naming Error"); } } else { MessageBox.Show(string.Format("An effect named {0} already exists. Type a new name in the box above, or remove the existing effect.", ted.Entry), "Naming Conflict"); } } }