Igor 3 years ago
parent
commit
1f4a4a0a0a

+ 8 - 3
i18n/ui.csv

@@ -11,10 +11,7 @@ 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
@@ -36,6 +33,14 @@ new_global,global,global,global
 new_function,nova_funcao,new_function,nueva_función
 matrix,matriz,matrix,matriz
 vector,vetor,vector,vector
+text_lock_expression,Bloquear expressão,Block expression,Expresión de bloque 
+text_unlock_expression,Desbloquear expressão,Unlock expression,Desbloquear expresión 
+text_edit_expression,Editar expressão manualmente,Edit expression manually,Editar expresión manualmente 
+text_edit_expression_confirm,Confirmar edição,Confirm edition,Confirmar edición
+text_edit_expression_cancel,Cancelar edição,Cancel edition,Cancelar edición
+text_add_function,Adicionar uma nova função ao programa,Add a new function to the program,Agregar una nueva función al programa
+text_move_command,Mover comando,Move command,Mover comando
+text_add_parameters,Adicionar um novo parâmetro,Add a new parameter,Agregar un nuevo parámetro
 text_comment_start,Comentário inicial da função...,Function initial comment,Comentario inicial de la función
 text_comment_main,Esta é a função principal...,This is the main funcion,Esta es la función principal
 text_read_var,Entrada/Leitura de dados,Input/Read data,Entrada/Lectura de dados

+ 10 - 1
js/visualUI/algorithm.js

@@ -30,5 +30,14 @@ export function renderAlgorithm () {
 
 	if (settingsFilter && settingsFilter[0]) {
       blockAllEditingOptions();
-    } 
+		} 
+	
+	$('.command_drag').popup({
+    content : LocalizedStrings.getUI("text_move_command"),
+    delay: {
+      show: 1000,
+      hide: 0
+    }
+  });
+		
 }

+ 73 - 38
js/visualUI/commands/attribution.js

@@ -43,6 +43,29 @@ export function renderCommand (command, function_obj) {
 		}
 	}
 
+	el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.button_write_expression').popup({
+		content : LocalizedStrings.getUI("text_edit_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
+
 	return el;
 
 }
@@ -431,6 +454,9 @@ function addHandlers (command, function_obj, attribution_dom) {
 
 	attribution_dom.find('.button_write_expression').on('click', function() {
 
+		window.expressionEdition = true;
+		window.inputExpression = null;
+		
 		var afterWhichElement;
 		var lockButton = $(attribution_dom.find('.button_alternate_expression')[0]);
 		var editButton = $(this);
@@ -443,7 +469,6 @@ 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 {
@@ -459,6 +484,13 @@ function addHandlers (command, function_obj, attribution_dom) {
 		var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
 		var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
 		input.val(text);
+
+		input.focusout(function(evt) {
+			console.log('focosout event!');
+			ok_button.click();
+			evt.preventDefault();
+			return true;
+		});
 		
 		input.keyup(function(evt) {
 			if (evt.keyCode == 27) { // esc
@@ -473,60 +505,46 @@ function addHandlers (command, function_obj, attribution_dom) {
 			var parsed = null;
 			parsed = ExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
 			if (parsed) {
+				window.expressionEdition = false;
 				command.expression = parsed;
 				renderAlgorithm();
 			}
 		});
 
-		cancel_button.click(function() {
-			input.remove();
-			cancel_button.remove();
-			ok_button.remove();
-			afterWhichElement.css('display', 'inline');
-			lockButton.css('display', 'inline');
-			editButton.css('display', 'inline');
+		cancel_button.mousedown(function(evt) {
+			var parsed = ExpressionManagement.expressionParserToVisual(text, function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
 		});
 
 		input.insertAfter(afterWhichElement);
 		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); 
 
 		afterWhichElement.css('display', 'none');
 		lockButton.css('display', 'none');
 		editButton.css('display', 'none');
+
+		ok_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_confirm"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+		cancel_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_cancel"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
 	});
 
 	$(attribution_dom.find('.textual_expression')[0]).toggle();
@@ -541,6 +559,23 @@ function addHandlers (command, function_obj, attribution_dom) {
 				$(this).toggleClass('unlock').toggleClass('lock');
 				command.lockexpression = !command.lockexpression;
 			}
+			if (command.lockexpression) {
+				attribution_dom.find('.lock').popup({
+					content : LocalizedStrings.getUI("text_unlock_expression"),
+					delay: {
+						show: 750,
+						hide: 0
+					}
+				});
+			} else {
+				attribution_dom.find('.unlock').popup({
+					content : LocalizedStrings.getUI("text_lock_expression"),
+					delay: {
+						show: 750,
+						hide: 0
+					}
+				});
+			}
 		}
 	});
 

+ 135 - 1
js/visualUI/commands/dowhiletrue.js

@@ -15,7 +15,7 @@ export function renderCommand (command, function_obj) {
 	ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
 	ret += '</div>';
 	ret += ' <span class="span_command_spec"> ' + LocalizedStrings.getUI('text_command_do_until') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
-	ret += ' <i class="ui icon unlock button_alternate_expression"></i> <div class="ui context_menu"></div> ';
+	ret += '  <i class="ui icon i cursor button_write_expression" style="display: inline !important;"></i> <i class="ui icon unlock button_alternate_expression" style="margin-left: 1rem !important;"></i> <div class="ui context_menu"></div> ';
 	ret += '</div>';
 
 	var el = $(ret);
@@ -54,12 +54,128 @@ export function renderCommand (command, function_obj) {
 		}
 	}
 
+	el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.button_write_expression').popup({
+		content : LocalizedStrings.getUI("text_edit_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
 	return el;
 }
 
 
 function addHandlers (command, function_obj, dowhiletrue_dom) {
 
+	dowhiletrue_dom.find('.button_write_expression').on('click', function() {
+
+		window.expressionEdition = true;
+		window.inputExpression = null;
+		
+		var afterWhichElement;
+		var lockButton = $(dowhiletrue_dom.find('.button_write_expression')[dowhiletrue_dom.find('.button_write_expression').length - 1]);
+		var editButton = $(this);
+
+		afterWhichElement = $(dowhiletrue_dom.find('.conditional_expression')[dowhiletrue_dom.find('.conditional_expression').length - 1]);
+
+		if (command.lockexpression) {
+			afterWhichElement = $(dowhiletrue_dom.find('.textual_expression')[dowhiletrue_dom.find('.textual_expression').length - 1]);
+		}
+
+		var text = "";
+		if (command.expression) {
+			if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
+				text = "";
+			} else {
+				try {
+					text = CodeGenerator.elementExpressionCode(command.expression);
+				} catch(ex) {
+					text = "";
+				}
+			}
+		}
+
+		var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
+		var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
+		var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
+		input.val(text);
+
+		input.focusout(function(evt) {
+			ok_button.click();
+			evt.preventDefault();
+			return true;
+		});
+		
+		input.keyup(function(evt) {
+			if (evt.keyCode == 27) { // esc
+				cancel_button.click();
+			} 
+			if (evt.keyCode == 13) { // enter
+				ok_button.click();
+			}
+		});
+
+		ok_button.click(function() {
+			var parsed = null;
+			parsed = GenericExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		cancel_button.mousedown(function(evt) {
+			var parsed = GenericExpressionManagement.expressionParserToVisual(text, function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		input.insertAfter(afterWhichElement);
+		input.focus();
+		cancel_button.insertAfter(input);
+		ok_button.insertAfter(input);
+		var len = text.length; 
+		input[0].setSelectionRange(len, len); 
+
+		afterWhichElement.css('display', 'none');
+		lockButton.css('display', 'none');
+		editButton.css('display', 'none');
+
+		ok_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_confirm"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+		cancel_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_cancel"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+	});
+
 	dowhiletrue_dom.find('.minimize_block_button').on('click', function(evt){
 		dowhiletrue_dom.children('.ui.block_commands').toggle();
 		command.collapsed = !command.collapsed;
@@ -79,6 +195,24 @@ function addHandlers (command, function_obj, dowhiletrue_dom) {
 				command.lockexpression = !command.lockexpression;
 			}
 		}
+
+		if (command.lockexpression) {
+			dowhiletrue_dom.find('.lock').popup({
+				content : LocalizedStrings.getUI("text_unlock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		} else {
+			dowhiletrue_dom.find('.unlock').popup({
+				content : LocalizedStrings.getUI("text_lock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		}
 	});
 
 	dowhiletrue_dom.find('.button_remove_command').on('click', function() {

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

@@ -1337,6 +1337,51 @@ function getVariable (function_obj, search) {
                   Models.EXPRESSION_TYPES.exp_arithmetic, 
                   Models.ARITHMETIC_TYPES.module); 
         break;
+      case '>':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_conditional, 
+                    Models.ARITHMETIC_COMPARISON.greater_than); 
+          break;
+      case '<':
+        obj = new Models.ExpressionOperator(
+                  Models.EXPRESSION_TYPES.exp_conditional, 
+                  Models.ARITHMETIC_COMPARISON.less_than); 
+        break;
+      case '>=':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_conditional, 
+                    Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to); 
+          break;
+      case '<=':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_conditional, 
+                    Models.ARITHMETIC_COMPARISON.less_than_or_equals_to); 
+          break;
+      case '==':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_conditional, 
+                    Models.ARITHMETIC_COMPARISON.equals_to); 
+          break;
+      case '!=':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_conditional, 
+                    Models.ARITHMETIC_COMPARISON.not_equals_to); 
+          break;
+      case 'and':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_logic, 
+                    Models.LOGIC_COMPARISON.and); 
+          break;
+      case 'or':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_logic, 
+                    Models.LOGIC_COMPARISON.or); 
+          break;
+      case 'not':
+          obj = new Models.ExpressionOperator(
+                    Models.EXPRESSION_TYPES.exp_logic, 
+                    Models.LOGIC_COMPARISON.not); 
+          break;
     }
     return obj;
   }
@@ -1372,7 +1417,6 @@ function getVariable (function_obj, search) {
           break;
         }
       }
-<<<<<<< HEAD
     
     // 3. Procurar na lista de parâmetros: 
     if (!variavel)
@@ -1382,8 +1426,6 @@ function getVariable (function_obj, search) {
           break;
         }
       }
-=======
->>>>>>> 4987846b7aa9a436f8051a02f172c75b5a6fafc0
   }
 
   if (search.instance == "expression"
@@ -1403,7 +1445,6 @@ 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,
@@ -1430,27 +1471,13 @@ function getVariable (function_obj, search) {
 
   if (search.instance == "expression"
     && search.type == "function") {
-    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) {
@@ -1463,14 +1490,10 @@ 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(
@@ -1484,9 +1507,6 @@ 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);
@@ -1507,11 +1527,7 @@ 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) {
@@ -1519,7 +1535,6 @@ export function expressionParserToVisual (text, function_obj, input_field) {
             break;
           }
         }
-<<<<<<< HEAD
 
       // 3. Procurar a variável nos parâmetros:
       if (!variavel)
@@ -1529,13 +1544,10 @@ 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"
@@ -1558,8 +1570,6 @@ 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) {

+ 135 - 1
js/visualUI/commands/iftrue.js

@@ -12,6 +12,7 @@ export function renderCommand (command, function_obj) {
 	ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true">  <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <button class="ui icon button minimize_block_button tiny"><i class="icon window minimize"></i></button>';
 	ret += '<span class="span_command_spec"> ' + LocalizedStrings.getUI('text_if') + '</span>';
 	ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span> ';
+	ret += '  <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i>  ';
 	ret += '<i class="ui icon unlock button_alternate_expression"></i>';
 	ret += '<span> </span> ';
 	ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
@@ -32,7 +33,6 @@ export function renderCommand (command, function_obj) {
 	addHandlers(command, function_obj, el);
 
 	//ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
-
 	GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
 
 	if (command.commands_block) {
@@ -67,12 +67,128 @@ export function renderCommand (command, function_obj) {
 		}
 	}
 
+	el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.button_write_expression').popup({
+		content : LocalizedStrings.getUI("text_edit_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
 	return el;
 }
 
 
 function addHandlers (command, function_obj, iftrue_dom) {
 
+	iftrue_dom.find('.button_write_expression').on('click', function() {
+
+		window.expressionEdition = true;
+		window.inputExpression = null;
+		
+		var afterWhichElement;
+		var lockButton = $(iftrue_dom.find('.button_alternate_expression')[0]);
+		var editButton = $(this);
+
+		afterWhichElement = $(iftrue_dom.find('.conditional_expression')[0]);
+
+		if (command.lockexpression) {
+			afterWhichElement = $(iftrue_dom.find('.textual_expression')[0]);
+		}
+
+		var text = "";
+		if (command.expression) {
+			if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
+				text = "";
+			} else {
+				try {
+					text = CodeGenerator.elementExpressionCode(command.expression);
+				} catch(ex) {
+					text = "";
+				}
+			}
+		}
+
+		var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
+		var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
+		var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
+		input.val(text);
+
+		input.focusout(function(evt) {
+			ok_button.click();
+			evt.preventDefault();
+			return true;
+		});
+		
+		input.keyup(function(evt) {
+			if (evt.keyCode == 27) { // esc
+				cancel_button.click();
+			} 
+			if (evt.keyCode == 13) { // enter
+				ok_button.click();
+			}
+		});
+
+		ok_button.click(function() {
+			var parsed = null;
+			parsed = GenericExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		cancel_button.mousedown(function(evt) {
+			var parsed = GenericExpressionManagement.expressionParserToVisual(text, function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		input.insertAfter(afterWhichElement);
+		input.focus();
+		cancel_button.insertAfter(input);
+		ok_button.insertAfter(input);
+		var len = text.length; 
+		input[0].setSelectionRange(len, len); 
+
+		afterWhichElement.css('display', 'none');
+		lockButton.css('display', 'none');
+		editButton.css('display', 'none');
+
+		ok_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_confirm"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+		cancel_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_cancel"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+	});
+
 	$(iftrue_dom.find('.textual_expression')[0]).toggle();
 	
 	iftrue_dom.find('.button_alternate_expression').on('click', function() {
@@ -86,6 +202,24 @@ function addHandlers (command, function_obj, iftrue_dom) {
 				command.lockexpression = !command.lockexpression;
 			}
 		}
+
+		if (command.lockexpression) {
+			iftrue_dom.find('.lock').popup({
+				content : LocalizedStrings.getUI("text_unlock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		} else {
+			iftrue_dom.find('.unlock').popup({
+				content : LocalizedStrings.getUI("text_lock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		}
 	});
 
 	iftrue_dom.find('.button_remove_command').on('click', function() {

+ 33 - 0
js/visualUI/commands/repeatNtimes.js

@@ -107,6 +107,21 @@ export function renderCommand (command, function_obj) {
 		}
 	}
 
+	el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
 	return el;
 }
 
@@ -218,6 +233,24 @@ function addHandlers (command, function_obj, repeatNtimes_dom) {
 
 			command.lockexpression = !command.lockexpression;
 		}
+
+		if (command.lockexpression) {
+			repeatNtimes_dom.find('.lock').popup({
+				content : LocalizedStrings.getUI("text_unlock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		} else {
+			repeatNtimes_dom.find('.unlock').popup({
+				content : LocalizedStrings.getUI("text_lock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		}
 	});
 
 	repeatNtimes_dom.find('.button_remove_command').on('click', function() {

+ 136 - 1
js/visualUI/commands/whiletrue.js

@@ -14,7 +14,7 @@ export function renderCommand (command, function_obj) {
 	ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i><button class="ui icon button minimize_block_button tiny"><i class="icon window minimize"></i></button> <span class="span_command_spec"> ' + LocalizedStrings.getUI('text_command_while') + ' </span>';
 	ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="textual_expression"></span> <span class="span_command_spec"> ) </span>';
 	ret += ' </span>';
-	ret += '<i class="ui icon unlock button_alternate_expression"></i> <div class="ui context_menu"></div>';
+	ret += ' <i class="ui icon i cursor button_write_expression" style="margin-right: 1rem !important;"></i>  <i class="ui icon unlock button_alternate_expression"></i> <div class="ui context_menu"></div>';
 	ret += '<div class="ui block_commands">';
 	ret += '</div>';
 	ret += '<span> </span>';
@@ -54,11 +54,128 @@ export function renderCommand (command, function_obj) {
 		}
 	}
 	
+	el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.button_write_expression').popup({
+		content : LocalizedStrings.getUI("text_edit_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
 	return el;
 }
 
 function addHandlers (command, function_obj, whiletrue_dom) {
 
+	whiletrue_dom.find('.button_write_expression').on('click', function() {
+
+		window.expressionEdition = true;
+		window.inputExpression = null;
+		
+		var afterWhichElement;
+		var lockButton = $(whiletrue_dom.find('.button_alternate_expression')[0]);
+		var editButton = $(this);
+
+		afterWhichElement = $(whiletrue_dom.find('.conditional_expression')[0]);
+
+		if (command.lockexpression) {
+			afterWhichElement = $(whiletrue_dom.find('.textual_expression')[0]);
+		}
+
+		var text = "";
+		if (command.expression) {
+			if (command.expression.length == 1 && command.expression[0].content == null && !command.expression[0].function_called) {
+				text = "";
+			} else {
+				try {
+					text = CodeGenerator.elementExpressionCode(command.expression);
+				} catch(ex) {
+					text = "";
+				}
+			}
+		}
+
+		var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
+		var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
+		var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
+		input.val(text);
+
+		input.focusout(function(evt) {
+			console.log('focosout event!');
+			ok_button.click();
+			evt.preventDefault();
+			return true;
+		});
+		
+		input.keyup(function(evt) {
+			if (evt.keyCode == 27) { // esc
+				cancel_button.click();
+			} 
+			if (evt.keyCode == 13) { // enter
+				ok_button.click();
+			}
+		});
+
+		ok_button.click(function() {
+			var parsed = null;
+			parsed = GenericExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		cancel_button.mousedown(function(evt) {
+			var parsed = GenericExpressionManagement.expressionParserToVisual(text, function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.expression = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		input.insertAfter(afterWhichElement);
+		input.focus();
+		cancel_button.insertAfter(input);
+		ok_button.insertAfter(input);
+		var len = text.length; 
+		input[0].setSelectionRange(len, len); 
+
+		afterWhichElement.css('display', 'none');
+		lockButton.css('display', 'none');
+		editButton.css('display', 'none');
+
+		ok_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_confirm"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+		cancel_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_cancel"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+	});
+
 	whiletrue_dom.find('.minimize_block_button').on('click', function(evt){
 		whiletrue_dom.children('.ui.block_commands').toggle();
 		command.collapsed = !command.collapsed;
@@ -77,6 +194,24 @@ function addHandlers (command, function_obj, whiletrue_dom) {
 				command.lockexpression = !command.lockexpression;
 			}
 		}
+
+		if (command.lockexpression) {
+			whiletrue_dom.find('.lock').popup({
+				content : LocalizedStrings.getUI("text_unlock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		} else {
+			whiletrue_dom.find('.unlock').popup({
+				content : LocalizedStrings.getUI("text_lock_expression"),
+				delay: {
+					show: 750,
+					hide: 0
+				}
+			});
+		}
 	});
 
 	whiletrue_dom.find('.button_remove_command').on('click', function() {

+ 136 - 0
js/visualUI/commands/writer.js

@@ -26,6 +26,7 @@ export function renderCommand (command, function_obj) {
     <img data-state="${command.newline ? "on" : "false"}" src="${
     command.newline ? "img/new_line.svg" : "img/no_new_line.svg"
   }" class="ivprog_newline_btn"/> 
+    <i class="ui icon i cursor button_write_expression" style="margin-left: 3rem !important; margin-right: -1.1rem !important;"></i> 
     <i class="ui icon unlock button_alternate_expression"></i>
     </div>`;
   const el = $(ret);
@@ -57,6 +58,28 @@ export function renderCommand (command, function_obj) {
     }
   }
 
+  el.find('.unlock').popup({
+		content : LocalizedStrings.getUI("text_lock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+	el.find('.lock').popup({
+		content : LocalizedStrings.getUI("text_unlock_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+  });
+  el.find('.button_write_expression').popup({
+		content : LocalizedStrings.getUI("text_edit_expression"),
+		delay: {
+			show: 750,
+			hide: 0
+		}
+	});
+
   return el;
 }
 
@@ -89,6 +112,101 @@ function addHandlersManager (
 function addHandlers (command, function_obj, writer_dom) {
 
   $(writer_dom.find('.textual_expression')[0]).toggle();
+
+  writer_dom.find('.button_write_expression').on('click', function() {
+
+		window.expressionEdition = true;
+		window.inputExpression = null;
+		
+		var afterWhichElement;
+		var lockButton = $(writer_dom.find('.button_alternate_expression')[0]);
+		var editButton = $(this);
+
+		afterWhichElement = writer_dom.find('.all_elements_write');
+
+		if (command.lockexpression) {
+			afterWhichElement = writer_dom.find('.textual_expression');
+		}
+
+		var text = "";
+		if (command.content) {
+			if (command.content.length == 1 && command.content[0].content == null && !command.content[0].function_called) {
+				text = "";
+			} else {
+				try {
+					text = CodeGenerator.elementExpressionCode(command.content);
+				} catch(ex) {
+					text = "";
+				}
+			}
+		}
+
+		var ok_button = $('<i class="ui icon check circle expression-edit-confirm"></i>');
+		var cancel_button = $('<i class="ui icon undo expression-edit-cancel"></i>');
+		var input = $('<input type="text" spellcheck="false" autocomplete="off" class="input-expression-field" >');
+		input.val(text);
+
+		input.focusout(function(evt) {
+			ok_button.click();
+			evt.preventDefault();
+			return true;
+		});
+		
+		input.keyup(function(evt) {
+			if (evt.keyCode == 27) { // esc
+				cancel_button.click();
+			} 
+			if (evt.keyCode == 13) { // enter
+				ok_button.click();
+			}
+		});
+
+		ok_button.click(function() {
+			var parsed = null;
+			parsed = GenericExpressionManagement.expressionParserToVisual(input.val(), function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.content = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		cancel_button.mousedown(function(evt) {
+			var parsed = GenericExpressionManagement.expressionParserToVisual(text, function_obj, input);
+			if (parsed) {
+				window.expressionEdition = false;
+				command.content = parsed;
+				renderAlgorithm();
+			}
+		});
+
+		input.insertAfter(afterWhichElement);
+		input.focus();
+		cancel_button.insertAfter(input);
+		ok_button.insertAfter(input);
+		var len = text.length; 
+		input[0].setSelectionRange(len, len); 
+
+		afterWhichElement.css('display', 'none');
+		lockButton.css('display', 'none');
+		editButton.css('display', 'none');
+
+		ok_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_confirm"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+		cancel_button.popup({
+			content : LocalizedStrings.getUI("text_edit_expression_cancel"),
+			delay: {
+				show: 750,
+				hide: 0
+			}
+		});
+	});
+
 	
 	writer_dom.find('.button_alternate_expression').on('click', function() {
 		if (command.content) {
@@ -99,6 +217,24 @@ function addHandlers (command, function_obj, writer_dom) {
 				$(writer_dom.find('.textual_expression')[0]).toggle();
 				$(this).toggleClass('unlock').toggleClass('lock');
 				command.lockexpression = !command.lockexpression;
+      }
+      
+      if (command.lockexpression) {
+				writer_dom.find('.lock').popup({
+					content : LocalizedStrings.getUI("text_unlock_expression"),
+					delay: {
+						show: 750,
+						hide: 0
+					}
+				});
+			} else {
+				writer_dom.find('.unlock').popup({
+					content : LocalizedStrings.getUI("text_lock_expression"),
+					delay: {
+						show: 750,
+						hide: 0
+					}
+				});
 			}
 		}
 	});

+ 14 - 0
js/visualUI/functions.js

@@ -462,6 +462,14 @@ export function renderFunction (function_obj) {
   
   cont ++;
 
+  appender.find('.add_parameter_button').popup({
+    content : LocalizedStrings.getUI("text_add_parameters"),
+    delay: {
+      show: 750,
+      hide: 0
+    }
+  });
+
   return appender;
 }
 
@@ -715,6 +723,12 @@ export function initVisualUI () {
   $(document.getElementById("ivprog-term-div")).draggable()
   $('.add_function_button').on('click', () => {
     addFunctionHandler();
+  }).popup({
+    content : LocalizedStrings.getUI("text_add_function"),
+    delay: {
+      show: 750,
+      hide: 0
+    }
   });
   $('.add_global_button').on('click', () => {
     window.insertContext = true;