Exemplo n.º 1
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _availableColorModels = new SelectableListNodeList();

                var models = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(IColorModel));

                _currentColorModel = new ColorModelRGB();
                foreach (var modelType in models)
                {
                    _availableColorModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(modelType), modelType, modelType == _currentColorModel.GetType()));
                }

                // Text only color models
                _availableTextOnlyColorModels = new SelectableListNodeList();
                var textOnlyModels = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(ITextOnlyColorModel));

                _currentTextOnlyColorModel = new TextOnlyColorModelRGB();
                foreach (var modelType in textOnlyModels)
                {
                    _availableTextOnlyColorModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(modelType), modelType, modelType == _currentTextOnlyColorModel.GetType()));
                }
            }
            if (null != _view)
            {
                _view.InitializeAvailableColorModels(_availableColorModels);
                _view.InitializeAvailableTextOnlyColorModels(_availableTextOnlyColorModels);
                _view.InitializeColorModel(_currentColorModel, false);
                _view.InitializeTextOnlyColorModel(_currentTextOnlyColorModel, false);
                _view.InitializeCurrentColor(_doc);
            }
        }
Exemplo n.º 2
0
        public void InitializeTextOnlyColorModel(ITextOnlyColorModel colorModel, bool silentSet)
        {
            _altColorModel = colorModel;

            if (!silentSet)
            {
                // now update components
                var components = _altColorModel.GetComponentsForColor(_currentColor, Altaxo.Settings.GuiCulture.Instance);

                for (int i = 0; i < components.Length; ++i)
                {
                    _guiAltComponents[i].Text = components[i];
                }

                // update labels
                var labels = _altColorModel.GetNamesOfComponents();
                for (int i = 0; i < labels.Length; ++i)
                {
                    _guiLabelForAltComponents[i].Content = labels[i];
                }

                // update visibility
                for (int i = 0; i < 4; ++i)
                {
                    _guiLabelForAltComponents[i].Visibility = _guiAltComponents[i].Visibility = i < components.Length ? Visibility.Visible : Visibility.Hidden;
                }
            }
        }
Exemplo n.º 3
0
        public ColorModelControl()
        {
            InitializeComponent();

            _guiLabelForComponents[0] = _guiLabelForComponent0;
            _guiLabelForComponents[1] = _guiLabelForComponent1;
            _guiLabelForComponents[2] = _guiLabelForComponent2;
            _guiLabelForComponents[3] = _guiLabelForComponent3;

            _guiComponents[0] = _guiComponent0;
            _guiComponents[1] = _guiComponent1;
            _guiComponents[2] = _guiComponent2;
            _guiComponents[3] = _guiComponent3;

            _guiLabelForAltComponents[0] = _guiLabelForAltComponent0;
            _guiLabelForAltComponents[1] = _guiLabelForAltComponent1;
            _guiLabelForAltComponents[2] = _guiLabelForAltComponent2;
            _guiLabelForAltComponents[3] = _guiLabelForAltComponent3;

            _guiAltComponents[0] = _guiAltComponent0;
            _guiAltComponents[1] = _guiAltComponent1;
            _guiAltComponents[2] = _guiAltComponent2;
            _guiAltComponents[3] = _guiAltComponent3;

            _colorModel    = new ColorModelRGB();
            _altColorModel = new TextOnlyColorModelRGB();

            Loaded += EhLoaded;
        }
Exemplo n.º 4
0
        private void EhTextOnlyColorModelSelectionChanged()
        {
            var node = _availableTextOnlyColorModels.FirstSelectedNode;

            if (null != node && (Type)node.Tag != _currentTextOnlyColorModel.GetType())
            {
                var newTextOnlyColorModel = (ITextOnlyColorModel)Activator.CreateInstance((Type)node.Tag);
                _currentTextOnlyColorModel = newTextOnlyColorModel;
                _view.InitializeTextOnlyColorModel(_currentTextOnlyColorModel, false);
            }
        }
Exemplo n.º 5
0
        public ColorCircleControl()
        {
            InitializeComponent();

            _guiLabelForComponents[0] = _guiLabelForComponent0;
            _guiLabelForComponents[1] = _guiLabelForComponent1;
            _guiLabelForComponents[2] = _guiLabelForComponent2;
            _guiLabelForComponents[3] = _guiLabelForComponent3;

            _guiComponents[0] = _guiComponent0;
            _guiComponents[1] = _guiComponent1;
            _guiComponents[2] = _guiComponent2;
            _guiComponents[3] = _guiComponent3;

            _guiLabelForAltComponents[0] = _guiLabelForAltComponent0;
            _guiLabelForAltComponents[1] = _guiLabelForAltComponent1;
            _guiLabelForAltComponents[2] = _guiLabelForAltComponent2;
            _guiLabelForAltComponents[3] = _guiLabelForAltComponent3;

            _guiAltComponents[0] = _guiAltComponent0;
            _guiAltComponents[1] = _guiAltComponent1;
            _guiAltComponents[2] = _guiAltComponent2;
            _guiAltComponents[3] = _guiAltComponent3;

            _guiShadesStackPanels    = new StackPanel[5];
            _guiShadesStackPanels[0] = _guiColorShades0;
            _guiShadesStackPanels[1] = _guiColorShades1;
            _guiShadesStackPanels[2] = _guiColorShades2;
            _guiShadesStackPanels[3] = _guiColorShades3;
            _guiShadesStackPanels[4] = _guiColorShades4;

            _colorModel    = new ColorModelRGB();
            _altColorModel = new TextOnlyColorModelRGB();

            _guiColorCircleSurface.HueValuesChanged += EhColorCircleSurface_HueValuesChanged;
        }
Exemplo n.º 6
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _availableColorModels = new SelectableListNodeList();

                var models = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(IColorModel));

                _currentColorModel = new ColorModelRGB();
                foreach (var modelType in models)
                {
                    _availableColorModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(modelType), modelType, modelType == _currentColorModel.GetType()));
                }

                // Text only color models
                _availableTextOnlyColorModels = new SelectableListNodeList();
                var textOnlyModels = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(ITextOnlyColorModel));

                _currentTextOnlyColorModel = new TextOnlyColorModelRGB();
                foreach (var modelType in textOnlyModels)
                {
                    _availableTextOnlyColorModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(modelType), modelType, modelType == _currentTextOnlyColorModel.GetType()));
                }

                // Color circle models
                _availableColorCircleModels = new SelectableListNodeList();
                var colorCircleModels = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(IColorCircleModel));

                _currentColorCircleModel = _currentColorCircleModel ?? new ColorCircleModelComplementary();
                foreach (var type in colorCircleModels)
                {
                    _availableColorCircleModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(type), type, type == _currentColorCircleModel.GetType()));
                }

                // Color variation models
                _availableColorVariationModels = new SelectableListNodeList();
                var colorVariationModels = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(IColorVariationModel));

                _currentColorVariationModel = _currentColorVariationModel ?? new ColorVariationModelDesaturate();
                foreach (var type in colorVariationModels)
                {
                    _availableColorVariationModels.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(type), type, type == _currentColorVariationModel.GetType()));
                }
            }
            if (null != _view)
            {
                _view.InitializeAvailableColorModels(_availableColorModels);
                _view.InitializeAvailableTextOnlyColorModels(_availableTextOnlyColorModels);
                _view.InitializeColorModel(_currentColorModel, false);
                _view.InitializeTextOnlyColorModel(_currentTextOnlyColorModel, false);

                _view.InitializeAvailableColorCircleModels(_availableColorCircleModels);
                _hueValues = _view.InitializeCurrentColorCircleModel(_currentColorCircleModel, false);

                _view.InitializeAvailableColorVariationModels(_availableColorVariationModels);
                _view.InitializeCurrentColorVariationModel(_currentColorVariationModel, false);
                _view.InitializeNumberOfColorShades(_numberOfColorShades);
                _view.InitializeCurrentColor(_doc);
                UpdateColorShades();
            }
        }