Ejemplo n.º 1
0
        /// <summary>
        /// Fills in the defined color keys of the opened simulation
        /// </summary>
        public static void UpdateColorKeys(TextEdit textEdit, IProcessingData processingData)
        {
            textEdit.ClearColors();
            List <string> booleanInputKeys = processingData.InputRegisters.BooleanKeys;

            foreach (string key in booleanInputKeys)
            {
                textEdit.AddKeywordColor(key, BooleanInputColor);
            }
            foreach (string key in St.Boolean.Constant.Values)
            {
                textEdit.AddKeywordColor(key, BooleanInputColor);
            }
            List <string> booleanOutputKeys = processingData.OutputRegisters.BooleanKeys;

            foreach (string key in booleanOutputKeys)
            {
                textEdit.AddKeywordColor(key, BooleanOutputColor);
            }

            List <string> IntegerInputKeys = processingData.InputRegisters.IntegerKeys;

            foreach (string key in IntegerInputKeys)
            {
                textEdit.AddKeywordColor(key, IntegerInputColor);
            }
            // Godot already forces integer static inputs and colors them. (They can not be deleted so far)
            textEdit.AddColorOverride("number_color", IntegerInputColor);
            List <string> IntegerOutputKeys = processingData.OutputRegisters.IntegerKeys;

            foreach (string key in IntegerOutputKeys)
            {
                textEdit.AddKeywordColor(key, IntegerInputColor);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Called when the model has changed or is initialized.
 /// </summary>
 public void UpdateTransition(string transitionText, Sfc2dEditorControl contex)
 {
     if (_textEdit != null)
     {
         TransitionMaster.UpdateColorKeys(_textEdit, contex.Data);
         _textEdit.Text = transitionText;
         UpdateVisualRepresentation();
         if (!string.IsNullOrEmpty(transitionText))
         {
             BooleanExpression expression = TransitionMaster.InterpretTransitionText(transitionText, contex.Data);
             _textEdit.HintTooltip = expression == null ? "???" : expression.ToString();
             bool  validExpression = expression != null && expression.IsValid();
             Color background      = validExpression ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);
             _textEdit.AddColorOverride("background_color", background);
         }
     }
 }
        /// <summary>
        /// Displays the text as a multi line string in the editor if possible.
        /// </summary>
        public override void SetEditorText(string text, Sfc2dEditorControl context)
        {
            TextEdit node = GetNode <TextEdit>("StepNameEditor");

            node.Text = text;
            bool  validReference = context.Data.StepMaster.ContainsStep(text);
            Color background     = validReference ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);

            node.AddColorOverride("background_color", background);
        }
        /// <summary>
        /// Fills in the defined color keys of the opened simulation
        /// </summary>
        public static void UpdateColorKeys(TextEdit textEdit, IProcessingData data)
        {
            textEdit.ClearColors();
            List <string> booleanKeys = data.InputRegisters.BooleanKeys;

            foreach (string key in booleanKeys)
            {
                textEdit.AddKeywordColor(key, BooleanInputColor);
            }
            foreach (string key in St.Boolean.Constant.Values)
            {
                textEdit.AddKeywordColor(key, BooleanInputColor);
            }
            foreach (string key in St.Boolean.LogicalCombination.Values)
            {
                textEdit.AddKeywordColor(key, BooleanCommandColor);
            }
            foreach (string key in St.Boolean.LogicalInverter.Values)
            {
                textEdit.AddKeywordColor(key, BooleanCommandColor);
            }
            List <string> IntegerKeys = data.InputRegisters.IntegerKeys;

            foreach (string key in IntegerKeys)
            {
                textEdit.AddKeywordColor(key, IntegerInputColor);
            }
            // Godot already forces integer static inputs and colors them. (They can not be deleted so far)
            textEdit.AddColorOverride("number_color", IntegerInputColor);
            foreach (string key in St.Boolean.RelationalOperation.Values)
            {
                textEdit.AddKeywordColor(key, IntegerCommandColor);
            }

            // Godot forces member variable color according to member_variable_color
            // Godot also forces the "class" color and access without any known possibility to change or override them.
            textEdit.AddColorOverride("member_variable_color", IntegerInputColor);
            foreach (string key in data.IntVariables)
            {
                textEdit.AddKeywordColor(key, StepInputColor);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Called when the model has changed or is initialized.
        /// </summary>
        public void UpdateAction(ActionEntity action, IProcessingData context)
        {
            _selectedQualifier = action.Qualifier;
            SetQualifierText((int)_selectedQualifier);
            _actionDescriptionNode.Text = action.Action;
            _isRelevant = !string.IsNullOrEmpty(_actionDescriptionNode.Text);
            AssignmentExpression expression = ActionMaster.InterpretTransitionText(action.Action, context);

            _actionDescriptionNode.HintTooltip = expression == null ? "???" : expression.ToString();
            bool  validExpression = expression != null && expression.IsValid();
            Color background      = validExpression ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);

            _actionDescriptionNode.AddColorOverride("background_color", background);
        }