コード例 #1
0
        /// <summary>
        /// This updates the list, presuming that the number of items has not changed.
        /// </summary>
        void UpdateCurrentNormalOrder()
        {
            // if possible, we try to maintain the order in the list in which the items
            // appear

            if (0 == _currentStepItems)
            {
                return; // then there is nothing to do now
            }
            IPlotGroupStyle previousStyle = null;
            IPlotGroupStyle style         = null;

            for (int i = 0; i < _currentStepItems; i++, previousStyle = style)
            {
                CheckableSelectableListNode node = _currentNormalStyles[i];
                style = _doc.GetPlotGroupStyle((Type)node.Item);

                if (previousStyle != null)
                {
                    Type prevchildtype = _doc.GetChildTypeOf(previousStyle.GetType());
                    if (prevchildtype != null)
                    {
                        if (prevchildtype != style.GetType())
                        {
                            int pi = _currentNormalStyles.IndexOfObject(prevchildtype);
                            _currentNormalStyles.Exchange(i, pi);
                        }
                        continue;
                    }
                }

                Type parenttype = _doc.GetParentTypeOf(style.GetType());
                if (parenttype != null &&
                    (previousStyle == null || previousStyle.GetType() != parenttype))
                {
                    int pi = _currentNormalStyles.IndexOfObject(parenttype);
                    _currentNormalStyles.Exchange(i, pi);
                }
            }
            UpdateCurrentNormalIndentation();
        }