Example #1
0
 //Gradients
 private void gradientNameBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return)
     {
         if (!Document.ContainsGradient(gradientNameBox.Text))
         {
             PhotonGradient pg = new PhotonGradient(PhotonInterpolationMode.Linear);
             pg.Add(new Photon(0, 0, 0), 0);
             pg.Add(new Photon(1, 1, 1), 1);
             GradientDialog gd = new GradientDialog(pg);
             if (gd.ShowDialog() == DialogResult.OK)
             {
                 if (Document.SetGradient(gradientNameBox.Text, pg))
                 {
                     Document.SelectedGradientName = gradientNameBox.Text;
                 }
             }
         }
         else
         {
             Document.SelectedGradientName = gradientNameBox.Text;
         }
         e.SuppressKeyPress = true;
     }
 }
Example #2
0
        //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");
                }
            }
        }
Example #3
0
 private void editGradientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Document.ContainsGradient(gradientNameBox.Text))
     {
         PhotonGradient copy = Document.GetGradient(gradientNameBox.Text).MakeCopy();
         GradientDialog gd   = new GradientDialog(gradientNameBox.Text, this);
         gd.Show();
     }
 }
Example #4
0
 private void editGradientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Document.SelectedGradient != null)
     {
         GradientDialog gd = new GradientDialog(Document.SelectedGradient.MakeCopy());
         if (gd.ShowDialog() == DialogResult.OK)
         {
             Document.SetGradient(Document.SelectedGradientName, gd.Gradient);
         }
     }
 }
Example #5
0
 private void editGradientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Document.SelectedGradient != null)
     {
         PhotonGradient fallback = Document.SelectedGradient.MakeCopy();
         GradientDialog gd       = new GradientDialog(Document.SelectedGradientName, this);
         if (gd.ShowDialog() == DialogResult.OK && Document.SelectedRender != null)
         {
             Document.SelectedRender.UpdateAll(Document.SelectedGradient, Document.SelectedEffects);
             renderArea.Invalidate();
         }
         else
         {
             Document.SetGradient(Document.SelectedGradientName, fallback);
         }
     }
 }