private void OnMoveLast(object sender, EventArgs e)
        {
            if ((_ribbonSeparator?.Ribbon != null) && _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
            {
                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupSeparator MoveLast");

                try
                {
                    // Get access to the Items property
                    MemberDescriptor propertyItems = TypeDescriptor.GetProperties(_ribbonSeparator.RibbonGroup)[@"Items"];

                    RaiseComponentChanging(propertyItems);

                    // Move position of the triple
                    KryptonRibbonGroup ribbonGroup = _ribbonSeparator.RibbonGroup;
                    ribbonGroup.Items.Remove(_ribbonSeparator);
                    ribbonGroup.Items.Insert(ribbonGroup.Items.Count, _ribbonSeparator);
                    UpdateVerbStatus();

                    RaiseComponentChanged(propertyItems, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    transaction?.Commit();
                }
            }
        }
Пример #2
0
        private void OnDialogBoxLauncherClick(object sender, EventArgs e)
        {
            KryptonRibbonGroup group = (KryptonRibbonGroup)sender;

            MessageBox.Show(this,
                            "You selected the '" + group.TextLine1 + "' group dialog box launcher.",
                            "Dialog Box Launcher");
        }
Пример #3
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonDesignGroup class.
 /// </summary>
 /// <param name="ribbon">Reference to owning ribbon control.</param>
 /// <param name="ribbonGroup">Associated ribbon group.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ViewDrawRibbonDesignGroupContainer(KryptonRibbon ribbon,
                                           KryptonRibbonGroup ribbonGroup,
                                           NeedPaintHandler needPaint)
     : base(ribbon, needPaint)
 {
     Debug.Assert(ribbonGroup != null);
     _ribbonGroup = ribbonGroup;
     _padding     = new Padding((int)(1 * FactorDpiX), 0, 0, 0);
 }
Пример #4
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutRibbonGroupButton class.
 /// </summary>
 /// <param name="ribbon">Owning control instance.</param>
 /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public ViewLayoutRibbonGroupButton(KryptonRibbon ribbon,
                                    KryptonRibbonGroup ribbonGroup,
                                    NeedPaintHandler needPaint)
 {
     _groupButton  = new ViewDrawRibbonGroupDialogButton(ribbon, ribbonGroup, needPaint);
     _centerButton = new ViewLayoutRibbonCenter
     {
         // Fill remainder with the actual button, but centered within space
         _groupButton
     };
     Add(_centerButton, ViewDockStyle.Fill);
 }
Пример #5
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupTitle class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        public ViewDrawRibbonGroupTitle(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupNormalTitle);
        }
Пример #6
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupText class.
        /// </summary>
        /// <param name="ribbon">Source ribbon control.</param>
        /// <param name="ribbonGroup">Ribbon group to display title for.</param>
        /// <param name="firstText">Should show the first group text.</param>
        public ViewDrawRibbonGroupText(KryptonRibbon ribbon,
                                       KryptonRibbonGroup ribbonGroup,
                                       bool firstText)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _firstText   = firstText;

            // Use a class to convert from ribbon group to content interface
            _contentProvider = new RibbonGroupTextToContent(ribbon.StateCommon.RibbonGeneral,
                                                            ribbon.StateNormal.RibbonGroupCollapsedText);
        }
        private void OnComponentRemoving(object sender, ComponentEventArgs e)
        {
            // If our tab is being removed
            if (e.Component == _ribbonTab)
            {
                // Need access to host in order to delete a component
                IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

                // We need to remove all the groups from the tab
                for (var i = _ribbonTab.Groups.Count - 1; i >= 0; i--)
                {
                    KryptonRibbonGroup group = _ribbonTab.Groups[i];
                    _ribbonTab.Groups.Remove(group);
                    host.DestroyComponent(group);
                }
            }
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupImage class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group definition.</param>
        /// <param name="viewGroup">Reference to top level group element.</param>
        public ViewDrawRibbonGroupImage(KryptonRibbon ribbon,
                                        KryptonRibbonGroup ribbonGroup,
                                        ViewDrawRibbonGroup viewGroup)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(viewGroup != null);

            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;
            _viewGroup = viewGroup;
            _viewSize_2007 = new Size((int)(30 * FactorDpiX), (int)(31 * FactorDpiY));
            _viewSize_2010 = new Size((int)(31 * FactorDpiX), (int)(31 * FactorDpiY));
            _imageSize = new Size((int)(16 * FactorDpiX), (int)(16 * FactorDpiY));
            IMAGE_OFFSET_X = (int)(7 * FactorDpiX);
            IMAGE_OFFSET_Y_2007 = (int)(4 * FactorDpiY);
            IMAGE_OFFSET_Y_2010 = (int)(7 * FactorDpiY);  
        }
Пример #9
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroup(KryptonRibbon ribbon,
                                   KryptonRibbonGroup ribbonGroup,
                                   NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);
            Debug.Assert(needPaint != null);

            // Cache source of state specific settings
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;
            _needPaint   = needPaint;

            // Associate this view with the source component (required for design time selection)
            Component = _ribbonGroup;

            CreateNormalView();
            CreateCollapsedView();

            // We are always created in the normal state
            Add(_layoutNormalMain);

            // Set back reference to the actual group definition
            _ribbonGroup.GroupView = this;

            // Hook into changes in the ribbon button definition
            _ribbonGroup.PropertyChanged += OnGroupPropertyChanged;
            MINIMUM_GROUP_WIDTH           = (int)(32 * FactorDpiX);
            NORMAL_BORDER_TOPLEFT2007     = (int)(2 * FactorDpiY);
            NORMAL_BORDER_RIGHT2007       = (int)(4 * FactorDpiX);
            NORMAL_BORDER_TOP2010         = (int)(3 * FactorDpiY);
            NORMAL_BORDER_LEFT2010        = (int)(3 * FactorDpiX);
            NORMAL_BORDER_RIGHT2010       = (int)(6 * FactorDpiX);
            TOTAL_LEFT_RIGHT_BORDERS_2007 = (int)(7 * FactorDpiX);
            TOTAL_LEFT_RIGHT_BORDERS_2010 = (int)(10 * FactorDpiX);
            VERT_OFFSET_2007             = (int)(0 * FactorDpiY);
            VERT_OFFSET_2010             = (int)(2 * FactorDpiY);
            COLLAPSED_PADDING            = new Padding((int)(2 * FactorDpiX), (int)(2 * FactorDpiY), (int)(2 * FactorDpiX), (int)(2 * FactorDpiY));
            COLLAPSED_IMAGE_PADDING_2007 = new Padding((int)(3 * FactorDpiX), (int)(3 * FactorDpiY), (int)(3 * FactorDpiX), (int)(4 * FactorDpiY));
            COLLAPSED_IMAGE_PADDING_2010 = new Padding((int)(3 * FactorDpiX), (int)(1 * FactorDpiY), (int)(5 * FactorDpiX), (int)(5 * FactorDpiY));
        }
        private void OnMoveToGroup(object sender, EventArgs e)
        {
            if ((_ribbonSeparator?.Ribbon != null) && _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator))
            {
                // Cast to correct type
                ToolStripMenuItem groupMenuItem = (ToolStripMenuItem)sender;

                // Get access to the destination tab
                KryptonRibbonGroup destination = (KryptonRibbonGroup)groupMenuItem.Tag;

                // Use a transaction to support undo/redo actions
                DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupSeparator MoveSeparatorToGroup");

                try
                {
                    // Get access to the Groups property
                    MemberDescriptor oldItems = TypeDescriptor.GetProperties(_ribbonSeparator.RibbonGroup)[@"Items"];
                    MemberDescriptor newItems = TypeDescriptor.GetProperties(destination)[@"Items"];

                    // Remove the ribbon tab from the ribbon
                    RaiseComponentChanging(null);
                    RaiseComponentChanging(oldItems);
                    RaiseComponentChanging(newItems);

                    // Remove group from current group
                    _ribbonSeparator.RibbonGroup.Items.Remove(_ribbonSeparator);

                    // Append to the new destination group
                    destination.Items.Add(_ribbonSeparator);

                    RaiseComponentChanged(newItems, null, null);
                    RaiseComponentChanged(oldItems, null, null);
                    RaiseComponentChanged(null, null, null);
                }
                finally
                {
                    // If we managed to create the transaction, then do it
                    transaction?.Commit();
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupDialogButton class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group this represents.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupDialogButton(KryptonRibbon ribbon,
                                               KryptonRibbonGroup ribbonGroup,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember incoming references
            _ribbon      = ribbon;
            _ribbonGroup = ribbonGroup;

            // Attach a controller to this element for the pressing of the button
            DialogLauncherButtonController controller = new(ribbon, this, needPaint);

            controller.Click += OnClick;
            MouseController   = controller;
            SourceController  = controller;
            KeyController     = controller;
            // Button is 8 for context image, 4 for context padding and 2 for border drawing
            _viewSize = new Size((int)(14 * FactorDpiX), (int)(14 * FactorDpiY));
            // Inflate size to convert from view size to content size
            _contentSize = new Size((int)(-3 * FactorDpiX), (int)(-3 * FactorDpiY));
        }
Пример #12
0
        /// <summary>
        /// Function to unmerge the groups for a tab from an existing tab in the target ribbon tab.
        /// </summary>
        /// <param name="sourceGroups">The source groups to unmerge.</param>
        /// <param name="targetGroups">The destination groups to unmerge.</param>
        private void UnmergeGroups(KryptonRibbonGroupCollection sourceGroups, KryptonRibbonGroupCollection targetGroups)
        {
            IEnumerable <KryptonRibbonGroup> groups = targetGroups.ToArray();

            foreach (KryptonRibbonGroup grp in groups)
            {
                if (!_mergedItems.Contains(grp))
                {
                    KryptonRibbonGroup existingGroup = sourceGroups.FirstOrDefault(item => (string.Equals(item.TextLine1, grp.TextLine1, StringComparison.CurrentCulture)) &&
                                                                                   (string.Equals(item.TextLine2, grp.TextLine2, StringComparison.CurrentCulture)));

                    if (existingGroup != null)
                    {
                        UnmergeGroupItems(existingGroup.Items, grp.Items);
                    }

                    continue;
                }

                _mergedItems.Remove(grp);
                targetGroups.Remove(grp);
                sourceGroups.Add(grp);
            }
        }
Пример #13
0
        public void InitializeRibbonTools(KryptonRibbon ribbon)
        {
            ribbon.RibbonTabs.Clear();
            var tools = extensionManager.GetExtensions <Tool>().ToList();
            var toolsGroupedByTabs = from tool in tools
                                     group tool by tool.ToolTab into toolTabGroup
                                     orderby toolTabGroup.Key.OrderingIndex
                                     select toolTabGroup;

            foreach (var toolGroupingTabDefinition in toolsGroupedByTabs)
            {
                var ribbonTab = new KryptonRibbonTab
                {
                    Text   = toolGroupingTabDefinition.Key.Name,
                    KeyTip = toolGroupingTabDefinition.Key.KeyTip
                };

                ribbon.RibbonTabs.Add(ribbonTab);

                var toolsGroupedByGroup = from tool in toolGroupingTabDefinition
                                          group tool by tool.ToolGroup into toolGroup
                                          orderby toolGroup.Key.OrderingIndex
                                          select toolGroup;

                foreach (var toolGroupingDefinition in toolsGroupedByGroup)
                {
                    var ribbonGroup = new KryptonRibbonGroup
                    {
                        TextLine1 = toolGroupingDefinition.Key.Name
                    };

                    var toolContainerTriple = new KryptonRibbonGroupTriple();
                    var toolContainerLines  = new KryptonRibbonGroupLines {
                        MaximumSize = GroupItemSize.Large
                    };

                    foreach (var tool in toolGroupingDefinition.OrderBy(t => t.OrderingIndex))
                    {
                        switch (tool)
                        {
                        case ButtonTool buttonTool:
                            var button = new KryptonRibbonGroupButton
                            {
                                TextLine1    = buttonTool.ToolName,
                                ImageSmall   = buttonTool.ToolIconSmall,
                                ImageLarge   = buttonTool.ToolIconLarge,
                                ToolTipStyle = LabelStyle.ToolTip,
                                ToolTipTitle = buttonTool.ToolTip,
                                Tag          = buttonTool
                            };

                            button.Click += Button_Click;

                            if (buttonTool.IsFocusedTool)
                            {
                                var splittedTexts = buttonTool.ToolName.Split(' ', '-');
                                if (splittedTexts.Length == 2)
                                {
                                    button.TextLine1 = splittedTexts[0];
                                    button.TextLine2 = splittedTexts[1];
                                }
                                else
                                {
                                    button.TextLine1 = buttonTool.ToolName;
                                }

                                toolContainerTriple.Items.Add(button);
                            }
                            else
                            {
                                toolContainerLines.Items.Add(button);
                            }

                            toolStrips.Add(button);

                            break;

                        case DropdownTool dropDownTool:
                            var dropDown = new KryptonRibbonGroupComboBox();
                            toolContainerLines.Items.Add(dropDown);
                            break;
                        }
                    }

                    if (toolContainerTriple.Items.Any())
                    {
                        ribbonGroup.Items.Add(toolContainerTriple);
                    }

                    if (toolContainerLines.Items.Any())
                    {
                        ribbonGroup.Items.Add(toolContainerLines);
                    }

                    ribbonTab.Groups.Add(ribbonGroup);
                }
            }
        }
Пример #14
0
        void RibbonButtonsCheckForRecreate()
        {
            var config = ProjectSettings.Get.RibbonAndToolbarActions;

            if (ribbonUpdatedForConfiguration == null || !config.Equals(ribbonUpdatedForConfiguration) || needRecreatedRibbonButtons)
            {
                ribbonUpdatedForConfiguration = config.Clone();
                needRecreatedRibbonButtons    = false;

                ribbonLastSelectedTabTypeByUser_DisableUpdate = true;

                kryptonRibbon.RibbonTabs.Clear();

                foreach (var tabSettings in ProjectSettings.Get.RibbonAndToolbarActions.RibbonTabs)
                {
                    if (!tabSettings.Enabled)
                    {
                        continue;
                    }

                    //can be null
                    EditorRibbonDefaultConfiguration.Tab tab = null;
                    if (tabSettings.Type == Component_ProjectSettings.RibbonAndToolbarActionsClass.TabItem.TypeEnum.Basic)
                    {
                        tab = EditorRibbonDefaultConfiguration.GetTab(tabSettings.Name);
                    }

                    var ribbonTab = new KryptonRibbonTab();
                    ribbonTab.Tag = tab;

                    if (tabSettings.Type == Component_ProjectSettings.RibbonAndToolbarActionsClass.TabItem.TypeEnum.Basic)
                    {
                        ribbonTab.Text = EditorLocalization.Translate("Ribbon.Tab", tabSettings.Name);
                    }
                    else
                    {
                        ribbonTab.Text = tabSettings.Name;
                    }

                    ribbonTab.KeyTip = GetTabKeyTip(tabSettings.Name);

                    kryptonRibbon.RibbonTabs.Add(ribbonTab);

                    var usedKeyTips = new ESet <string>();

                    string GetKeyTip(string name)
                    {
                        foreach (var c in name + alphabetNumbers)
                        {
                            var s = c.ToString().ToUpper();
                            if (s != " " && !usedKeyTips.Contains(s))
                            {
                                usedKeyTips.AddWithCheckAlreadyContained(s);
                                return(s);
                            }
                        }
                        return("");
                    }

                    foreach (var groupSettings in tabSettings.Groups)
                    {
                        if (!groupSettings.Enabled)
                        {
                            continue;
                        }

                        var ribbonGroup = new KryptonRibbonGroup();

                        if (groupSettings.Type == Component_ProjectSettings.RibbonAndToolbarActionsClass.GroupItem.TypeEnum.Basic)
                        {
                            ribbonGroup.TextLine1 = EditorLocalization.Translate("Ribbon.Group", groupSettings.Name);
                        }
                        else
                        {
                            ribbonGroup.TextLine1 = groupSettings.Name;
                        }

                        ribbonGroup.DialogBoxLauncher = false;                        //!!!!для группы Transform можно было бы в настройки снеппинга переходить
                        //ribbonTab.Groups.Add( ribbonGroup );

                        foreach (var groupSettingsChild in groupSettings.Actions)
                        {
                            if (!groupSettingsChild.Enabled)
                            {
                                continue;
                            }

                            //sub group
                            if (groupSettingsChild.Type == Component_ProjectSettings.RibbonAndToolbarActionsClass.ActionItem.TypeEnum.SubGroupOfActions)
                            {
                                EditorRibbonDefaultConfiguration.Group subGroup = null;
                                if (tab != null)
                                {
                                    var group = tab.Groups.Find(g => g.Name == groupSettings.Name);
                                    if (group != null)
                                    {
                                        foreach (var child in group.Children)
                                        {
                                            var g = child as EditorRibbonDefaultConfiguration.Group;
                                            if (g != null && g.Name == groupSettingsChild.Name)
                                            {
                                                subGroup = g;
                                                break;
                                            }
                                        }
                                    }
                                }

                                if (subGroup != null)
                                {
                                    var tripple = new KryptonRibbonGroupTriple();
                                    ribbonGroup.Items.Add(tripple);

                                    var button = new KryptonRibbonGroupButton();
                                    button.Tag = "SubGroup";
                                    //button.Tag = action;

                                    var str = subGroup.DropDownGroupText.Item1;
                                    if (subGroup.DropDownGroupText.Item2 != "")
                                    {
                                        str += "\n" + subGroup.DropDownGroupText.Item2;
                                    }

                                    var str2 = EditorLocalization.Translate("Ribbon.Action", str);
                                    var strs = str2.Split(new char[] { '\n' });

                                    button.TextLine1 = strs[0];
                                    if (strs.Length > 1)
                                    {
                                        button.TextLine2 = strs[1];
                                    }

                                    //button.TextLine1 = subGroup.DropDownGroupText.Item1;
                                    //button.TextLine2 = subGroup.DropDownGroupText.Item2;

                                    if (subGroup.DropDownGroupImageSmall != null)
                                    {
                                        button.ImageSmall = subGroup.DropDownGroupImageSmall;
                                    }
                                    else if (subGroup.DropDownGroupImageLarge != null)
                                    {
                                        button.ImageSmall = EditorAction.ResizeImage(subGroup.DropDownGroupImageLarge, 16, 16);
                                    }
                                    button.ImageLarge = subGroup.DropDownGroupImageLarge;

                                    //EditorLocalization.Translate( "EditorAction.Description",

                                    if (!string.IsNullOrEmpty(subGroup.DropDownGroupDescription))
                                    {
                                        button.ToolTipBody = EditorLocalization.Translate("EditorAction.Description", subGroup.DropDownGroupDescription);
                                    }
                                    else
                                    {
                                        button.ToolTipBody = subGroup.Name;
                                    }

                                    button.ButtonType = GroupButtonType.DropDown;
                                    button.ShowArrow  = subGroup.ShowArrow;

                                    button.KryptonContextMenu = new KryptonContextMenu();
                                    RibbonSubGroupAddItemsRecursive(subGroup, button.KryptonContextMenu.Items);

                                    tripple.Items.Add(button);
                                }
                            }

                            //action
                            if (groupSettingsChild.Type == Component_ProjectSettings.RibbonAndToolbarActionsClass.ActionItem.TypeEnum.Action)
                            {
                                var action = EditorActions.GetByName(groupSettingsChild.Name);

                                if (action != null && !action.CompletelyDisabled)
                                {
                                    if (action.ActionType == EditorAction.ActionTypeEnum.Button || action.ActionType == EditorAction.ActionTypeEnum.DropDown)
                                    {
                                        //Button, DropDown

                                        var tripple = new KryptonRibbonGroupTriple();
                                        ribbonGroup.Items.Add(tripple);

                                        var control = new KryptonRibbonGroupButton();

                                        //!!!!
                                        //control.ImageSmall = NeoAxis.Properties.Resources.Android_16;

                                        control.Tag = action;

                                        var str = action.RibbonText.Item1;
                                        if (action.RibbonText.Item2 != "")
                                        {
                                            str += "\n" + action.RibbonText.Item2;
                                        }

                                        var str2 = EditorLocalization.Translate("Ribbon.Action", str);
                                        var strs = str2.Split(new char[] { '\n' });

                                        control.TextLine1 = strs[0];
                                        if (strs.Length > 1)
                                        {
                                            control.TextLine2 = strs[1];
                                        }

                                        //control.TextLine1 = action.RibbonText.Item1;
                                        //control.TextLine2 = action.RibbonText.Item2;

                                        control.ImageSmall  = action.GetImageSmall();
                                        control.ImageLarge  = action.GetImageBig();
                                        control.ToolTipBody = action.ToolTip;
                                        control.KeyTip      = GetKeyTip(action.Name);

                                        //_buttonType = GroupButtonType.Push;
                                        //_toolTipImageTransparentColor = Color.Empty;
                                        //_toolTipTitle = string.Empty;
                                        //_toolTipBody = string.Empty;
                                        //_toolTipStyle = LabelStyle.SuperTip;

                                        if (action.ActionType == EditorAction.ActionTypeEnum.DropDown)
                                        {
                                            control.ButtonType         = GroupButtonType.DropDown;
                                            control.KryptonContextMenu = action.DropDownContextMenu;
                                        }

                                        control.Click += Button_Click;

                                        tripple.Items.Add(control);
                                    }
                                    else if (action.ActionType == EditorAction.ActionTypeEnum.Slider)
                                    {
                                        //Slider

                                        var tripple = new KryptonRibbonGroupTriple();
                                        ribbonGroup.Items.Add(tripple);

                                        var control = new KryptonRibbonGroupSlider();
                                        control.Tag         = action;
                                        control.ToolTipBody = action.ToolTip;

                                        control.Control.Size = new System.Drawing.Size((int)((float)control.Control.Size.Width * EditorAPI.DPIScale), control.Control.Size.Height);
                                        control.Control.kryptonSplitContainer2.Size             = new System.Drawing.Size((int)((float)control.Control.kryptonSplitContainer2.Size.Width * EditorAPI.DPIScale), control.Control.Size.Height);
                                        control.Control.kryptonSplitContainer2.Panel1MinSize    = (int)((float)control.Control.kryptonSplitContainer2.Panel1MinSize * EditorAPI.DPIScale);
                                        control.Control.kryptonSplitContainer1.Panel2MinSize    = (int)((float)control.Control.kryptonSplitContainer1.Panel2MinSize * EditorAPI.DPIScale);
                                        control.Control.kryptonSplitContainer1.SplitterDistance = 10000;

                                        control.Control.kryptonLabel1.Text = EditorLocalization.Translate("Ribbon.Action", action.RibbonText.Item1);
                                        control.Control.Init(action.Slider.Minimum, action.Slider.Maximum, action.Slider.ExponentialPower);
                                        control.Control.SetValue(action.Slider.Value);

                                        control.Control.Tag           = action;
                                        control.Control.ValueChanged += Slider_ValueChanged;

                                        tripple.Items.Add(control);
                                    }
                                    //else if( action.ActionType == EditorAction.ActionTypeEnum.ComboBox )
                                    //{
                                    //	//ComboBox

                                    //	var tripple = new KryptonRibbonGroupTriple();
                                    //	ribbonGroup.Items.Add( tripple );

                                    //	var control = new KryptonRibbonGroupComboBox();
                                    //	control.Tag = action;

                                    //	control.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
                                    //	foreach( var item in action.ComboBox.Items )
                                    //		control.Items.Add( item );

                                    //	if( control.Items.Count != 0 )
                                    //		control.SelectedIndex = 0;

                                    //	//control.MinimumLength = action.Slider.Length;
                                    //	//control.MaximumLength = action.Slider.Length;

                                    //	control.SelectedIndexChanged += ComboBox_SelectedIndexChanged;

                                    //	tripple.Items.Add( control );
                                    //}
                                    else if (action.ActionType == EditorAction.ActionTypeEnum.ListBox)
                                    {
                                        //ListBox

                                        var tripple = new KryptonRibbonGroupTriple();
                                        ribbonGroup.Items.Add(tripple);

                                        var control = new KryptonRibbonGroupListBox();
                                        control.Tag         = action;
                                        control.ToolTipBody = action.ToolTip;

                                        control.Control.Size = new System.Drawing.Size((int)((float)action.ListBox.Length * EditorAPI.DPIScale), control.Control.Size.Height);
                                        control.Control.kryptonSplitContainer1.Size             = new System.Drawing.Size((int)((float)action.ListBox.Length * EditorAPI.DPIScale), control.Control.Size.Height);
                                        control.Control.kryptonSplitContainer1.Panel2MinSize    = (int)((float)control.Control.kryptonSplitContainer1.Panel2MinSize * EditorAPI.DPIScale);
                                        control.Control.kryptonSplitContainer1.SplitterDistance = 10000;
                                        //if( action.ListBox.Length != 172 )
                                        //	control.Control.Size = new System.Drawing.Size( action.ListBox.Length, control.Control.Size.Height );

                                        control.Control.kryptonLabel1.Text = EditorLocalization.Translate("Ribbon.Action", action.RibbonText.Item1);

                                        var browser = control.Control.contentBrowser1;

                                        if (action.ListBox.Mode == EditorAction.ListBoxSettings.ModeEnum.Tiles)
                                        {
                                            browser.ListViewModeOverride             = new ContentBrowserListModeTilesRibbon(browser);
                                            browser.Options.PanelMode                = ContentBrowser.PanelModeEnum.List;
                                            browser.Options.ListMode                 = ContentBrowser.ListModeEnum.Tiles;
                                            browser.UseSelectedTreeNodeAsRootForList = false;
                                            browser.Options.Breadcrumb               = false;
                                            browser.ListViewBorderDraw               = BorderSides.Left | BorderSides.Right | BorderSides.Bottom;
                                            browser.Options.TileImageSize            = 22;
                                        }
                                        else
                                        {
                                            browser.RemoveTreeViewIconsColumn();
                                            browser.TreeView.RowHeight -= 2;
                                        }

                                        browser.Tag = action;

                                        //update items
                                        control.SetItems(action.ListBox.Items);

                                        browser.ItemAfterSelect += ListBrowser_ItemAfterSelect;

                                        if (browser.Items.Count != 0)
                                        {
                                            browser.SelectItems(new ContentBrowser.Item[] { browser.Items.ToArray()[0] });
                                        }

                                        //browser.ItemAfterSelect += ListBrowser_ItemAfterSelect;

                                        tripple.Items.Add(control);
                                    }
                                }
                            }
                        }

                        if (ribbonGroup.Items.Count != 0)
                        {
                            ribbonTab.Groups.Add(ribbonGroup);
                        }
                    }

                    //select
                    var tabType = "";
                    if (tab != null)
                    {
                        tabType = tab.Type;
                    }
                    if (ribbonLastSelectedTabTypeByUser != "" && tabType == ribbonLastSelectedTabTypeByUser)
                    {
                        kryptonRibbon.SelectedTab = ribbonTab;
                    }
                }

                ribbonLastSelectedTabTypeByUser_DisableUpdate = false;
            }
        }