Пример #1
0
        public EditorViewModel(GameViewModel owner)
        {
            _owner = owner;

            Style.SetCustomColor((int)ExpressionType.Comment, Colors.DarkCyan);
            Style.SetCustomColor((int)ExpressionType.IntegerConstant, Colors.DarkGray);
            Style.SetCustomColor((int)ExpressionType.FunctionDefinition, Colors.DarkViolet);
            Style.SetCustomColor((int)ExpressionType.FunctionCall, Colors.DarkViolet);
            Style.SetCustomColor((int)ExpressionType.Variable, Colors.Violet);
            Style.SetCustomColor((int)ExpressionType.StringConstant, Colors.DarkSeaGreen);
            Style.SetCustomColor((int)ExpressionType.Keyword, Colors.DarkGoldenrod);
            Style.SetCustomColor((int)ExpressionType.ParseError, Colors.Red);

            Braces['('] = ')';
            Braces['['] = ']';
            Braces['{'] = '}';
            Braces['"'] = '"';

            ErrorsToolWindow = new ErrorsToolWindowViewModel(this);

            GotoDefinitionCommand = new DelegateCommand(GotoDefinitionAtCursor);
        }
Пример #2
0
        public EditorViewModel(GameViewModel owner)
        {
            _owner = owner;

            if (_themeColors == null)
            {
                _themeColors = new Dictionary <Theme.Color, ExpressionType>();
                _themeColors[Theme.Color.EditorKeyword]            = ExpressionType.Keyword;
                _themeColors[Theme.Color.EditorComment]            = ExpressionType.Comment;
                _themeColors[Theme.Color.EditorIntegerConstant]    = ExpressionType.IntegerConstant;
                _themeColors[Theme.Color.EditorStringConstant]     = ExpressionType.StringConstant;
                _themeColors[Theme.Color.EditorVariable]           = ExpressionType.Variable;
                _themeColors[Theme.Color.EditorFunctionDefinition] = ExpressionType.FunctionDefinition;
                _themeColors[Theme.Color.EditorFunctionCall]       = ExpressionType.FunctionCall;
            }

            Theme.ColorChanged += Theme_ColorChanged;

            foreach (var kvp in _themeColors)
            {
                Style.SetCustomColor((int)kvp.Value, Theme.GetColor(kvp.Key));
            }
            Style.SetCustomColor((int)ExpressionType.BooleanConstant, Theme.GetColor(Theme.Color.EditorIntegerConstant));
            Style.SetCustomColor((int)ExpressionType.Array, Theme.GetColor(Theme.Color.Foreground));
            Style.SetCustomColor((int)ExpressionType.Dictionary, Theme.GetColor(Theme.Color.Foreground));
            Style.Background = Theme.GetColor(Theme.Color.Background);
            Style.Foreground = Theme.GetColor(Theme.Color.Foreground);
            Style.Selection  = Theme.GetColor(Theme.Color.EditorSelection);
            Style.LineNumber = Theme.GetColor(Theme.Color.EditorLineNumbers);

            Braces['('] = ')';
            Braces['['] = ']';
            Braces['{'] = '}';
            Braces['"'] = '"';

            ErrorsToolWindow = new ErrorsToolWindowViewModel(this);

            GotoDefinitionCommand = new DelegateCommand(GotoDefinitionAtCursor);
        }