Browse Source

Working in progress

Igor 3 years ago
parent
commit
6d3ab2d324
2 changed files with 46 additions and 4 deletions
  1. 0 3
      css/ivprog-visual-1.0.css
  2. 46 1
      js/visualUI/commands/generic_expression.js

+ 0 - 3
css/ivprog-visual-1.0.css

@@ -1145,7 +1145,6 @@ i.button_alternate_expression {
 .button_write_expression {
 	cursor: pointer;
 	margin-left: 1rem !important;
-<<<<<<< HEAD
 }
 
 .input-expression-field {
@@ -1162,6 +1161,4 @@ i.button_alternate_expression {
 
 .expression-edit-cancel {
 	cursor: pointer;
-=======
->>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
 }

+ 46 - 1
js/visualUI/commands/generic_expression.js

@@ -1388,6 +1388,26 @@ function getVariable (function_obj, search) {
 
   if (search.instance == "expression" 
           && search.type == "const") {
+      if (search.value === true) {
+        var obj = new Models.VariableValueMenu(
+          VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
+          LocalizedStrings.getUI('logic_value_true'),
+          null,
+          null,
+          true
+        );
+        return obj;
+      }
+      if (search.value === false) {
+        var obj = new Models.VariableValueMenu(
+          VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
+          LocalizedStrings.getUI('logic_value_false'),
+          null,
+          null,
+          true
+        );
+        return obj;
+      }
       var obj = new Models.VariableValueMenu(
         VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
         search.value,
@@ -1484,6 +1504,19 @@ function getVariable (function_obj, search) {
         obj.function_called = program_obj.functions[i];
       }
     }
+
+    // Se ainda não foi encontrada, procurar na biblioteca do iVProg:
+    if (!obj.function_called) {
+      for (var i = 0; i < window.system_functions.length; i++) {
+        if (search.value.split(".")[1] && search.value.split(".")[1] 
+            == window.system_functions[i].identifier) {
+          obj.function_called = window.system_functions[i];
+        } else if (search.value == window.system_functions[i].identifier) {
+          obj.function_called = window.system_functions[i];
+        }
+      }
+    }
+
     obj.parameters_list = [];
 
     for (var i = 0; i < search.params.length; i++) {
@@ -1558,7 +1591,19 @@ export function expressionParserToVisual (text, function_obj, input_field) {
         if (program_obj.functions[j].name == parsed[i].value) {
           funcao = program_obj.functions[j];
         }
-    }
+      }
+
+      // Se ainda não encontrou, procurar na biblioteca do iVProg:
+      if (!funcao) {
+        for (var j = 0; j < window.system_functions.length; j++) {
+          if (parsed[i].value.split(".")[1] && parsed[i].value.split(".")[1] 
+              == window.system_functions[j].identifier) {
+            funcao = window.system_functions[j];
+          } else if (parsed[i].value == window.system_functions[j].identifier) {
+            funcao = window.system_functions[j];
+          }
+        }
+      }
 
     if (!funcao) {
       fun_not_found.push(parsed[i].value);