Exemple #1
0
 // This binds all editing mode switch actions for the available modes only
 private void BindAvailableSwitchActions()
 {
     // In case of VisualMode, we only bind the switch action
     // of the VisualMode to switch back to the previous mode
     if (mode is VisualMode)
     {
         // Bind only the switch action for this mode
         EditModeInfo info = GetEditModeInfo(mode.GetType());
         info.BindSwitchAction();
     }
     else
     {
         // Bind all available mode swtich actions
         foreach (EditModeInfo emi in usedmodes)
         {
             emi.BindSwitchAction();
         }
     }
 }
Exemple #2
0
        // Constructor
        internal EditingManager()
        {
            // Initialize
            allmodes  = new List <EditModeInfo>();
            usedmodes = new List <EditModeInfo>();
            groups    = new List <string>();

            // Bind any methods
            General.Actions.BindMethods(this);

            // Make list of all editing modes we can find
            foreach (Plugin p in General.Plugins.Plugins)
            {
                // For all classes that inherit from EditMode
                Type[] editclasses = p.FindClasses(typeof(EditMode));
                foreach (Type t in editclasses)
                {
                    // For all defined EditMode attributes
                    EditModeAttribute[] emattrs = (EditModeAttribute[])t.GetCustomAttributes(typeof(EditModeAttribute), false);
                    foreach (EditModeAttribute a in emattrs)
                    {
                        // Make edit mode information
                        EditModeInfo modeinfo = new EditModeInfo(p, t, a);
                        allmodes.Add(modeinfo);

                        // Add group if not added yet
                        if (!groups.Contains(modeinfo.Attributes.ButtonGroup))
                        {
                            groups.Add(modeinfo.Attributes.ButtonGroup);
                        }
                    }
                }
            }

            // Sort the lists
            allmodes.Sort();
            groups.Sort();

            // Update modes
            UpdateCurrentEditModes();
        }