Browse Source

Continuando o visual

Igor 6 years ago
parent
commit
c0f288b630

File diff suppressed because it is too large
+ 46 - 46
build/ivprog.bundle.js


File diff suppressed because it is too large
+ 1 - 1
build/ivprog.bundle.js.map


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

@@ -766,4 +766,14 @@ div.function_name_div_updated:active,
 }
 .ui.label.function_name_parameter:hover > .ellipsis {
 	opacity: 1 !important;
+}
+
+.command_container {
+    background: #e9dede !important;
+	border: 2px solid #e76060 !important;
+    border-radius: 0.25em !important;
+}
+
+.command_drag {
+	cursor: move;
 }

+ 1 - 1
i18n/en/ui.json

@@ -14,7 +14,7 @@
   "integer": "integer",
   "real": "real",
   "program": "program",
-  "text": "text",
+  "text": "string",
   "text_start": "text",
   "boolean": "boolean",
   "true": "true",

+ 1 - 1
i18n/es/ui.json

@@ -14,7 +14,7 @@
   "integer": "integer",
   "real": "real",
   "program": "program",
-  "text": "text",
+  "text": "string",
   "text_start": "text",
   "boolean": "boolean",
   "true": "true",

+ 0 - 2
js/visualUI/code_generator.js

@@ -35,10 +35,8 @@ export function generate () {
 	} else {
 		return code;
 	}
-
 }
 
-
 function functionsCode (function_obj) {
 	var ret = '\n\t' + LocalizedStrings.getUI('function') + ' ';
 

+ 0 - 11
js/visualUI/commands.js

@@ -22,14 +22,6 @@ var has_element_created_draged = false;
 var which_element_is_draged = null;
 
 export function removeCommand (command, function_obj, dom_obj) {
-	console.log('debugging removeCommand');
-	console.log('command');
-	console.log(command);
-	console.log('function_obj');
-	console.log(function_obj);
-	console.log('dom_obj');
-	console.log(dom_obj);
-
 	if (function_obj.commands.indexOf(command) > -1) {
 		function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
 		return true;
@@ -54,9 +46,6 @@ export function removeCommand (command, function_obj, dom_obj) {
 		}
 	} catch (err) {}
 
-	console.log('veja: ');
-	console.log(dom_obj.parent());
-
 	if (dom_obj.parent().data('switchcase')) {
 		console.log("o que encontrei: ");
 		console.log(dom_obj.parent().data('switchcase'));

+ 1 - 1
js/visualUI/commands/attribution.js

@@ -419,7 +419,7 @@ function addHandlers (command, function_obj, attribution_dom) {
 
 	attribution_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
-			attribution_dom.remove();
+			attribution_dom.fadeOut();
 		}
 	});
 

+ 1 - 1
js/visualUI/commands/break.js

@@ -21,7 +21,7 @@ function addHandlers (command, function_obj, break_dom) {
 
 	break_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
-			break_dom.remove();
+			break_dom.fadeOut();
 		}
 	});
 }

+ 2 - 2
js/visualUI/commands/comment.js

@@ -12,7 +12,7 @@ export function createFloatingCommand () {
 }
 
 export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">'+'</div> </div>');
+	var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">'+'</div> </div>');
 	el.data('command', command);
 
 	addHandlers(command, function_obj, el);
@@ -30,7 +30,7 @@ function addHandlers (command, function_obj, comment_dom) {
 
 	comment_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
-			comment_dom.remove();
+			comment_dom.fadeOut();
 		}
 	});
 }

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

@@ -43,7 +43,7 @@ function addHandlers (command, function_obj, dowhiletrue_dom) {
 
 	dowhiletrue_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
-			dowhiletrue_dom.remove();
+			dowhiletrue_dom.fadeOut();
 		}
 	});
 }

+ 1 - 1
js/visualUI/commands/functioncall.js

@@ -26,7 +26,7 @@ function addHandlers (command, function_obj, functioncall_dom) {
 
 	functioncall_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
-			functioncall_dom.remove();
+			functioncall_dom.fadeOut();
 		}
 	});
 }

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

@@ -54,7 +54,7 @@ function addHandlers (command, function_obj, iftrue_dom) {
 
 	iftrue_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
-			iftrue_dom.remove();
+			iftrue_dom.fadeOut();
 		}
 	});
 }

+ 1 - 2
js/visualUI/commands/reader.js

@@ -25,10 +25,9 @@ export function renderCommand (command, function_obj) {
 }
 
 function addHandlers (command, function_obj, reader_dom) {
-
 	reader_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
-			reader_dom.remove();
+			reader_dom.fadeOut();
 		}
 	});
 }

+ 1 - 1
js/visualUI/commands/repeatNtimes.js

@@ -126,7 +126,7 @@ function addHandlers (command, function_obj, repeatNtimes_dom) {
 
 	repeatNtimes_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
-			repeatNtimes_dom.remove();
+			repeatNtimes_dom.fadeOut();
 		}
 	});
 }

+ 2 - 2
js/visualUI/commands/return.js

@@ -12,7 +12,7 @@ export function createFloatingCommand () {
 }
 
 export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui return command_container"> <i class="ui icon small reply"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> '+LocalizedStrings.getUI('text_return')+' </span>  <div class="var_value_menu_div"></div></div>');
+	var el = $('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> '+LocalizedStrings.getUI('text_return')+' </span>  <div class="var_value_menu_div"></div></div>');
 	el.data('command', command);
 
 	addHandlers(command, function_obj, el);
@@ -26,7 +26,7 @@ function addHandlers (command, function_obj, return_dom) {
 
 	return_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
-			return_dom.remove();
+			return_dom.fadeOut();
 		}
 	});
 }

+ 1 - 1
js/visualUI/commands/switch.js

@@ -69,7 +69,7 @@ function addHandlers (command, function_obj, switch_dom) {
 
 	switch_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
-			switch_dom.remove();
+			switch_dom.fadeOut();
 		}
 	});
 }

+ 0 - 9
js/visualUI/commands/variable_value_menu.js

@@ -12,15 +12,6 @@ export const VAR_OR_VALUE_TYPES = Object.freeze({only_variable: 1, only_value: 2
 	value_and_function: 6, all: 7});
 
 export function renderMenu (command, ref_object, dom_object, function_obj, size_field = 2, expression_element) {
-	console.log('\n\ndebugging: ');
-	console.log(command);
-	console.log(ref_object);
-	console.log(dom_object);
-	console.log(function_obj);
-	console.log(size_field);
-	console.log(expression_element);
-	console.log('fim\n\n');
-
 	// Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
 	// Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
 	if (ref_object.function_called) {

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

@@ -44,7 +44,7 @@ function addHandlers (command, function_obj, whiletrue_dom) {
 
 	whiletrue_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
-			whiletrue_dom.remove();
+			whiletrue_dom.fadeOut();
 		}
 	});
 }

+ 1 - 1
js/visualUI/commands/writer.js

@@ -34,7 +34,7 @@ function addHandlers (command, function_obj, writer_dom) {
 
 	writer_dom.find('.button_remove_command').on('click', function() {
 		if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
-			writer_dom.remove();
+			writer_dom.fadeOut();
 		}
 	});
 }

+ 29 - 7
js/visualUI/functions.js

@@ -122,7 +122,10 @@ function addFunctionHandler () {
 
 	counter_new_functions ++;
 
-  renderFunction(new_function);
+  var newe = renderFunction(new_function);
+
+  newe.css('display', 'none');
+  newe.fadeIn();
 }
 
 function addParameter (function_obj, function_container, is_from_click = false) {
@@ -147,7 +150,6 @@ function updateReturnType (function_obj, new_type, new_dimensions = 0) {
 }
 
 function removeFunction (function_obj) {
-  
   var index = program.functions.indexOf(function_obj);
   if (index > -1) {
     program.functions.splice(index, 1);
@@ -203,13 +205,22 @@ function addHandlers (function_obj, function_container) {
 
   function_container.find('.remove_function_button').on('click', function(e){
     removeFunction(function_obj);
-    function_container.slideUp(400);
+    function_container.fadeOut();
   });
 
   function_container.find('.minimize_function_button').on('click', function(e){
     minimizeFunction(function_obj);
-    function_container.find(".function_area").toggle();
-    function_container.find(".add_var_top_button").toggle();
+    if (function_obj.is_hidden) {
+      function_container.find(".add_var_button_function").toggle();
+      function_container.find(".inline_add_command").toggle();
+      function_container.find(".function_area").slideToggle();
+    } else {
+      function_container.find(".function_area").slideToggle(function(){
+        function_container.find(".add_var_button_function").toggle();
+        function_container.find(".inline_add_command").toggle();
+      });
+    }
+    
   });
 }
 
@@ -305,7 +316,7 @@ export function renderFunction (function_obj) {
         + '<a class="item" data-command="'+Models.COMMAND_TYPES.return+'"><i class="reply icon"></i> '+LocalizedStrings.getUI('text_btn_return')+'</a>'
         + '</div></div></div>';
 
-  appender += '<div class="ui bottom attached segment commands_list_div" id="function_drag_cmd_"></div>';
+  appender += '<div class="ui bottom attached segment commands_list_div"></div>';
 
   appender += '</div></div>';
 
@@ -351,7 +362,17 @@ export function renderFunction (function_obj) {
     }
   });
 
-  if (appender.find(".container_parameters_list")[0]) {
+  Sortable.create(appender.find(".commands_list_div")[0], {
+    handle: '.command_drag',
+    animation: 100,
+    ghostClass: 'ghost',
+    group: 'commands_drag_' + program.functions.indexOf(function_obj),
+    onEnd: function (evt) {
+       //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
+    }
+  });
+
+  if (!function_obj.is_main) {
     Sortable.create(appender.find(".container_parameters_list")[0], {
       handle: '.ellipsis',
       animation: 100,
@@ -362,6 +383,7 @@ export function renderFunction (function_obj) {
       }
     });
   }
+  return appender;
 }
 
 export function initVisualUI () {