public MainWindow(string filePath = null) { CenterToScreen(); InitializeComponent(); effectDialog = new EffectDialog(this); brushDialog = new BrushDialog(this); generatorDialog = new GeneratorDialog(this); renderArea.MouseWheel += renderArea_MouseWheel; Application.Idle += Application_Idle; Document.RenderSet += Document_RenderSet; Document.RenderRemoved += Document_RenderRemoved; Document.GradientSet += Document_GradientSet; Document.GradientRemoved += Document_GradientRemoved; Document.BrushSet += Document_BrushSet; Document.BrushRemoved += Document_BrushRemoved; Document.SelectedRenderChanged += Document_SelectedRenderChanged; Document.EffectSelected += Document_EffectSelected; Document.EffectDeselected += Document_EffectDeselected; Document.SelectedGradientChanged += Document_SelectedGradientChanged; Document.GeneratorSet += Document_GeneratorSet; Document.GeneratorRemoved += Document_GeneratorRemoved; if (filePath != null) { HandleFileLoad(filePath); } }
private void editBrushToolStripMenuItem_Click(object sender, EventArgs e) { if (Document.ContainsBrush(brushNameBox.Text)) { BrushDialog bd = new BrushDialog(brushNameBox.Text); bd.Show(); } }
//Brushes private void brushNameBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { if (!Document.ContainsBrush(brushNameBox.Text)) { if (Document.SetBrush(brushNameBox.Text, new HeightBrush(64, 64, 1, 8))) { BrushDialog bd = new BrushDialog(brushNameBox.Text); bd.Show(); } } e.SuppressKeyPress = true; } }
private void newBrushToolStripMenuItem_Click(object sender, EventArgs e) { if (!Document.ContainsBrush(brushNameBox.Text)) { if (Document.SetBrush(brushNameBox.Text, new HeightBrush(64, 64, 1, 8))) { BrushDialog bd = new BrushDialog(brushNameBox.Text, this); bd.Show(); } else { MessageBox.Show("Please enter a valid name for your brush in the box above.", "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.", brushNameBox.Text), "Naming Conflict"); } }