public override bool Apply(bool disposeController)
        {
            foreach (SelectableListNode node in _availableTransfoStyles)
            {
                if (node.IsSelected)
                {
                    _currentTransfoStyle             = (ICoordinateTransformingGroupStyle)node.Tag;
                    _doc.CoordinateTransformingStyle = _currentTransfoStyle;
                    break;
                }
            }

            _view.SynchronizeCurrentNormalGroupStyles(); // synchronize the checked state of the items
            foreach (CheckableSelectableListNode node in _currentNormalStyles)
            {
                IPlotGroupStyle style = _doc.GetPlotGroupStyle((Type)node.Tag);
                style.IsStepEnabled = node.IsChecked;
            }

            _view.QueryUpdateMode(out var inherit, out var distribute);
            _doc.InheritFromParentGroups = inherit;
            _doc.DistributeToChildGroups = distribute;
            foreach (SelectableListNode node in _availableUpdateModes)
            {
                if (node.IsSelected)
                {
                    _doc.PlotGroupStrictness = (PlotGroupStrictness)node.Tag;
                    break;
                }
            }

            return(ApplyEnd(true, disposeController));
        }
 public void EhView_CoordinateTransformingGroupStyleChanged()
 {
     foreach (SelectableListNode node in _availableTransfoStyles)
     {
         if (node.IsSelected)
         {
             _currentTransfoStyle = (ICoordinateTransformingGroupStyle)node.Tag;
             break;
         }
     }
 }
        public override void Dispose(bool isDisposing)
        {
            _parent = null;
            _availableTransfoStyles = null;
            _availableNormalStyles  = null;
            _currentNormalStyles    = null;
            _availableUpdateModes   = null;
            _currentTransfoStyle    = null;

            base.Dispose(isDisposing);
        }
        public override void CopyFrom(PlotGroupStyleCollectionBase fromb)
        {
            base.CopyFrom(fromb);

            if (fromb is PlotGroupStyleCollection)
            {
                PlotGroupStyleCollection from = (PlotGroupStyleCollection)fromb;

                _coordinateTransformingStyle = null == from._coordinateTransformingStyle ? null : (ICoordinateTransformingGroupStyle)from._coordinateTransformingStyle.Clone();
            }
        }
        public void EhView_CoordinateTransformingGroupStyleEdit()
        {
            // look wheter there is a appropriate edit dialog available for the group style
            foreach (SelectableListNode node in _availableTransfoStyles)
            {
                if (node.IsSelected)
                {
                    _currentTransfoStyle = (ICoordinateTransformingGroupStyle)node.Tag;
                    break;
                }
            }

            if (null != _currentTransfoStyle)
            {
                Current.Gui.ShowDialog(new object[] { _currentTransfoStyle }, "Edit transformation style");
            }
        }
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                // available Update modes
                _availableUpdateModes = new SelectableListNodeList();
                foreach (object obj in Enum.GetValues(typeof(PlotGroupStrictness)))
                {
                    _availableUpdateModes.Add(new SelectableListNode(obj.ToString(), obj, ((PlotGroupStrictness)obj) == PlotGroupStrictness.Normal));
                }

                Type[] types;
                // Transfo-Styles
                _currentTransfoStyle    = _doc.CoordinateTransformingStyle == null ? null : (ICoordinateTransformingGroupStyle)_doc.CoordinateTransformingStyle.Clone();
                _availableTransfoStyles = new SelectableListNodeList
                {
                    new SelectableListNode("None", null, null == _currentTransfoStyle)
                };
                types = ReflectionService.GetNonAbstractSubclassesOf(typeof(ICoordinateTransformingGroupStyle));
                foreach (Type t in types)
                {
                    Type currentStyleType = _currentTransfoStyle == null ? null : _currentTransfoStyle.GetType();
                    ICoordinateTransformingGroupStyle style;
                    if (t == currentStyleType)
                    {
                        style = _currentTransfoStyle;
                    }
                    else
                    {
                        style = (ICoordinateTransformingGroupStyle)Activator.CreateInstance(t);
                    }

                    _availableTransfoStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(t), style, t == currentStyleType));
                }

                // Normal Styles
                _availableNormalStyles = new SelectableListNodeList();
                if (_parent != null) // if possible, collect only those styles that are applicable
                {
                    var avstyles = new PlotGroupStyleCollection();
                    _parent.CollectStyles(avstyles);
                    foreach (IPlotGroupStyle style in avstyles)
                    {
                        if (!_doc.ContainsType(style.GetType()))
                        {
                            _availableNormalStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(style.GetType()), style.GetType(), false));
                        }
                    }
                }
                else // or else, find all available styles
                {
                    types = ReflectionService.GetNonAbstractSubclassesOf(typeof(IPlotGroupStyle));
                    foreach (Type t in types)
                    {
                        if (!_doc.ContainsType(t))
                        {
                            _availableNormalStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(t), t, false));
                        }
                    }
                }

                var list = _doc.GetOrderedListOfItems(ComparePlotGroupStyles);
                _currentNormalStyles = new CheckableSelectableListNodeList();
                _currentNoOfItemsThatCanHaveChilds = 0;
                foreach (var item in list)
                {
                    if (item.CanCarryOver)
                    {
                        ++_currentNoOfItemsThatCanHaveChilds;
                    }

                    var node = new MyListNode(Current.Gui.GetUserFriendlyClassName(item.GetType()), item.GetType(), false, item.IsStepEnabled, item.CanStep);

                    _currentNormalStyles.Add(node);
                }
                UpdateCurrentNormalIndentation();
            }

            if (_view != null)
            {
                _view.InitializeAvailableCoordinateTransformingGroupStyles(_availableTransfoStyles);
                _view.InitializeAvailableNormalGroupStyles(_availableNormalStyles);
                _view.InitializeCurrentNormalGroupStyles(_currentNormalStyles);
                _view.InitializeUpdateMode(_availableUpdateModes, _doc.InheritFromParentGroups, _doc.DistributeToChildGroups);
            }
        }
 public override void Clear()
 {
     base.Clear();
     _coordinateTransformingStyle = null;
 }