예제 #1
0
 private void Generate(CMDPlacement placement)
 {
     textWriter.Write("  ");
     Generate(placement.Command);
     textWriter.Write(",");
     Generate(placement.Parent);
     textWriter.Write(",0x");
     textWriter.Write(placement.Priority.ToString("X4"));
     textWriter.WriteLine(";");
 }
예제 #2
0
        private void AddGroupPlacement(Button button, CommandID commandBar)
        {
            string key = button.Command.ToString() + commandBar.ToString();

            if (!placements.ContainsKey(key))
            {
                // Create or get the gruop associted with commandBar
                NewGroup     newGroup  = CreateNewGroup(commandBar.ToString(), button.Priority, commandBar);
                CMDPlacement placement = new CMDPlacement(button.Command, newGroup.Group, button.Priority);
                placements.Add(key, placement);
            }
        }
예제 #3
0
        public CTCFile Create()
        {
            #region Standard group Init
            // Make sure to initialize the default groups
            this.packageGroup = this.PackageGroup;
            #endregion

            #region New Menu creation
            // Create the new menus first before creating any command
            BuildMenuGroups();
            #endregion

            #region Command creation
            // Templates commands must be created first than recipe commands
            // becuase a template can steal the command bars from the recipe it is related to
            BuildTemplateCommands();
            // Build recipes commands
            BuiltRecipeCommands();
            #endregion

            #region Build CTC Tree
            NewGroup[] newGroupsArray = new NewGroup[newGroups.Values.Count];
            newGroups.Values.CopyTo(newGroupsArray, 0);
            MenuGroup[] menuGroupsArray = new MenuGroup[menus.Values.Count];
            menus.Values.CopyTo(menuGroupsArray, 0);
            CMDPlacement[] placementsArray = new CMDPlacement[placements.Count];
            placements.Values.CopyTo(placementsArray, 0);
            Button[] buttonsArray = new Button[buttons.Count];
            buttons.CopyTo(buttonsArray);
            Visibility[] visibiltiesArray = new Visibility[visibilities.Count];
            visibilities.CopyTo(visibiltiesArray);
            CTCFile ctcFile = new CTCFile(
                new CMDSSection(guidRecipeFrameworkPkg,
                                new MenusSubSection(menuGroupsArray),
                                new NewGroupsSubSection(newGroupsArray),
                                new ButtonsSubSection(buttonsArray),
                                new BitmapsSubSection(new CTCBitmap[] { ctcBitmap })),
                new CMDUsedSection(),
                new CMDPlacementSection(placementsArray),
                new VisibilitySection(visibiltiesArray),
                new KeybindingsSection());
            return(ctcFile);

            #endregion
        }