Browse Source

Working in progress

Igor 3 years ago
parent
commit
5c2ed29480

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

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

+ 3 - 0
i18n/ui.csv

@@ -11,7 +11,10 @@ btn_break,Pare,break,break
 btn_case,Caso,Case,Caso
 expression_invalid,Expressão inválida. Verifique a sintáxe antes de continuar.,Invalid expression. Check the syntax before proceeding.,Expresión no válida. Verifique la sintaxis antes de continuar.
 expression_undelcared_variable,Variáveis não declaradas:,Undeclared variables:,Variables no declaradas:
+<<<<<<< HEAD
 expression_undeclared_function,Funções não definidas:,Undefined functions:,Funcíon no declaradas:
+=======
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
 start,inicio,main,main
 type_void,vazio,void,void
 type_integer,inteiro,int,int

+ 31 - 0
js/visualUI/commands/attribution.js

@@ -443,6 +443,7 @@ function addHandlers (command, function_obj, attribution_dom) {
 
 		var text = "";
 		if (command.expression) {
+<<<<<<< HEAD
 			if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
 				text = "";
 			} else {
@@ -490,6 +491,36 @@ function addHandlers (command, function_obj, attribution_dom) {
 		input.focus();
 		cancel_button.insertAfter(input);
 		ok_button.insertAfter(input);
+=======
+			try {
+				text = CodeGenerator.elementExpressionCode(command.expression);
+			} catch(ex) {
+				text = "";
+			}
+		}
+
+		var input = $('<input type="text" value="'+text+'" spellcheck="false" autocomplete="off" >');
+		
+		input.keyup(function(evt) {
+			if (evt.keyCode == 27) { // esc
+				input.remove();
+				afterWhichElement.css('display', 'inline');
+				lockButton.css('display', 'inline');
+				editButton.css('display', 'inline');
+			} 
+			if (evt.keyCode == 13) { // enter
+				var parsed = null;
+				parsed = ExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
+				if (parsed) {
+					command.expression = parsed;
+					renderAlgorithm();
+				}
+			}
+		});
+
+		input.insertAfter(afterWhichElement);
+		input.focus();
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
 		var len = text.length; 
 		input[0].setSelectionRange(len, len); 
 

+ 35 - 0
js/visualUI/commands/generic_expression.js

@@ -1372,6 +1372,7 @@ function getVariable (function_obj, search) {
           break;
         }
       }
+<<<<<<< HEAD
     
     // 3. Procurar na lista de parâmetros: 
     if (!variavel)
@@ -1381,6 +1382,8 @@ function getVariable (function_obj, search) {
           break;
         }
       }
+=======
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
   }
 
   if (search.instance == "expression"
@@ -1400,6 +1403,7 @@ function getVariable (function_obj, search) {
   if (search.instance == "expression"
     && search.type == "var"
     && search.class == "vector") {
+<<<<<<< HEAD
       
     var obj = new Models.VariableValueMenu(
       VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
@@ -1429,10 +1433,24 @@ function getVariable (function_obj, search) {
     var obj = new Models.VariableValueMenu(
       VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
       null,
+=======
+    /*
+      variable_and_value = 7,
+      content = null,
+      row = null,
+      column = null,
+      include_constant = true,
+      dimensions = 0
+    */
+    var obj = new Models.VariableValueMenu(
+      VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all,
+      variavel,
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
       null,
       null,
       true
     );
+<<<<<<< HEAD
     // Procurar a função para referência:
     for (var i = 0; i < program_obj.functions.length; i++) {
       if (program_obj.functions[i].name == search.value) {
@@ -1445,10 +1463,14 @@ function getVariable (function_obj, search) {
       obj.parameters_list.push(getVariable(function_obj,search.params[i][0]));
     }
     return obj;
+=======
+    
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
   }
 }
 
 export function expressionParserToVisual (text, function_obj, input_field) {
+<<<<<<< HEAD
 
   if (text.trim().length == 0) {
     return [new Models.VariableValueMenu(
@@ -1462,6 +1484,9 @@ export function expressionParserToVisual (text, function_obj, input_field) {
 
   var var_not_found = [];
   var fun_not_found = [];
+=======
+  var var_not_found = [];
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
   var parsed;
   try {
     parsed = ivprogCore.parseExpression(text);
@@ -1482,7 +1507,11 @@ export function expressionParserToVisual (text, function_obj, input_field) {
         }
       }
 
+<<<<<<< HEAD
       // 2. Procurar a variável nas globais: 
+=======
+      // 2. Procurar a variável nas gloais: 
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
       if (!variavel)
         for (var j = 0; j < program_obj.globals.length; j++) {
           if (program_obj.globals[j].name == parsed[i].value) {
@@ -1490,6 +1519,7 @@ export function expressionParserToVisual (text, function_obj, input_field) {
             break;
           }
         }
+<<<<<<< HEAD
 
       // 3. Procurar a variável nos parâmetros:
       if (!variavel)
@@ -1499,10 +1529,13 @@ export function expressionParserToVisual (text, function_obj, input_field) {
             break;
           }
         }
+=======
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
       
       if (!variavel)
         var_not_found.push(parsed[i].value);
     }
+<<<<<<< HEAD
 
     var funcao;
     if (parsed[i].instance == "expression"
@@ -1525,6 +1558,8 @@ export function expressionParserToVisual (text, function_obj, input_field) {
     let uniqueWords = [...new Set(fun_not_found)];
     Utils.renderErrorMessage(input_field,  LocalizedStrings.getUI('expression_undeclared_function') + " " + uniqueWords.join(", "));
     return null;
+=======
+>>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
   }
 
   if (var_not_found.length > 0) {