Пример #1
0
        /// <summary>
        /// Loads default cartoon style
        /// </summary>
        public void LoadCartoonDeafult()
        {
            using (Transaction action = new Transaction("Apply Default Cartoon Style"))
            {
                GeometryStyle.AtomSize = 0;
                GeometryStyle.BondSize = 0.01;
                GeometryStyle.AtomSizeStyle = AtomSizeStyle.Uniform;
                GeometryStyle.SheetHeight = 1;
                GeometryStyle.HelixHeight = 1;
                GeometryStyle.TurnHeight = 1;

                ColorStyle.ColorScheme.LoadCoreyPaulingKoltunScheme();

                action.Commit();
            }
        }
Пример #2
0
 void OnApply(string styleName)
 {
     using (Transaction action = new Transaction(
            String.Format("Apply Style \"{0}\"", styleName)))
     {
         Deserialize(styleName);
         action.Commit();
     }
 }
Пример #3
0
 void OnApply(string schemeName)
 {
     using (Transaction action = new Transaction(
            String.Format("Apply Color Scheme \"{0}\"", schemeName)))
     {
         Deserialize(schemeName);
         action.Commit();
     }
 }
Пример #4
0
        /// <summary>
        /// Loads default Ball-and-Stick style
        /// </summary>
        public void LoadBallAndStickDeafult()
        {
            using (Transaction action = new Transaction("Apply Default Ball-and-Stick Style"))
            {
                GeometryStyle.AtomSize = 1;
                GeometryStyle.BondSize = 0;
                GeometryStyle.AtomSizeStyle = AtomSizeStyle.VanderWaals;
                GeometryStyle.SheetHeight = 0;
                GeometryStyle.HelixHeight = 0;
                GeometryStyle.TurnHeight = 0;

                ColorStyle.ColorScheme.LoadCoreyPaulingKoltunScheme();

                action.Commit();
            }
        }
 private void SetSpecular()
 {
     if (!isSelectionChanged)
     {
         using (Transaction action = new Transaction("Change Specular Color"))
         {
             foreach (Tuple<Element, Material> element in elementsListBox.SelectedItems)
             {
                 colorScheme[element.Item1].Specular = Specular.Color;
             }
             action.Commit();
         }
         RaiseMaterialChanged();
     }
 }
 private void SetSpecularPower()
 {
     if (!isSelectionChanged)
     {
         using (Transaction action = new Transaction(String.Format("Change Specular Power to {0:0.#}%", SpecularPower * 100.0)))
         {
             foreach (Tuple<Element, Material> element in elementsListBox.SelectedItems)
             {
                 colorScheme[element.Item1].SpecularPower = SpecularPower;
             }
             action.Commit();
         }
         RaiseMaterialChanged();
     }
 }
 private void SetReflectionLevel()
 {
     if (!isSelectionChanged)
     {
         using (Transaction action = new Transaction(String.Format("Change Reflection Level to {0:0.#}%", ReflectionLevel * 100.0)))
         {
             foreach (Tuple<Element, Material> element in elementsListBox.SelectedItems)
             {
                 colorScheme[element.Item1].ReflectionLevel = ReflectionLevel;
             }
             action.Commit();
         }
         RaiseMaterialChanged();
     }
 }
 private void SetGlossiness()
 {
     if (!isSelectionChanged)
     {
         using (Transaction action = new Transaction(String.Format("Change Glossiness to {0:0.#}%", Glossiness * 100.0)))
         {
             foreach (Tuple<Element, Material> element in elementsListBox.SelectedItems)
             {
                 colorScheme[element.Item1].Glossiness = Glossiness;
             }
             action.Commit();
         }
         RaiseMaterialChanged();
     }
 }
 void OnUndo(Transaction transaction)
 {
     if (transaction==null) Undo();
     else Undo(transaction);
 }
 void OnRedo(Transaction transaction)
 {
     if (transaction == null) Redo();
     else Redo(transaction);
 }
 /// <summary>
 /// Undos transactions up to the given
 /// </summary>
 /// <param name="transaction"></param>
 public void Undo(Transaction transaction)
 {
     while (PerformedTransactions.Count > 0)
     {
         Transaction item = PerformedTransactions[0];
         item.Rollback();
         PerformedTransactions.RemoveAt(0);
         if (RollbackedTransactions.Count >= MaxHistoryLength)
             RollbackedTransactions.RemoveAt(RollbackedTransactions.Count - 1);
         RollbackedTransactions.Insert(0, item);
         if (item == transaction) return;
     }
 }