generic_expression.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. import { Types } from '../types';
  2. import * as Models from '../ivprog_elements';
  3. import { LocalizedStrings } from '../../services/localizedStringsService';
  4. import * as VariableValueMenuManagement from './variable_value_menu';
  5. import { registerUserEvent, ActionTypes } from "../../services/userLog";
  6. import WatchJS from 'melanke-watchjs';
  7. window.timer = false;
  8. export function renderExpression (command, function_obj, div_to_render, expression_array) {
  9. div_to_render.empty();
  10. WatchJS.unwatch(command, "expression");
  11. WatchJS.watch(command, "expression", function(){
  12. if (window.timer)
  13. return;
  14. var m = div_to_render.find('.single_element_expression').not('.mouse_distance').not('.add_parentheses');
  15. var s = "";
  16. m.each(function(e){
  17. if ($(this).hasClass('parentheses_in_expression')) {
  18. s += ($(this).text()) + " ";
  19. } else {
  20. s += ($(this).find('.text').text());
  21. s += ($(this).find('.var_name').text());
  22. s += ($(this).find('.parameters_function_called').text());
  23. s += ($(this).find('.value_rendered').text());
  24. s += " ";
  25. }
  26. });
  27. if (s) {
  28. window.timer = true;
  29. } else {
  30. return;
  31. }
  32. registerUserEvent(function_obj.name, ActionTypes.CHANGE_COMMAND_EXP, command.type, '/', s);
  33. setTimeout(function() {
  34. window.timer = false;
  35. }, 200);
  36. }, 20, true);
  37. if (command.type === Models.COMMAND_TYPES.attribution) {
  38. WatchJS.unwatch(command.variable);
  39. WatchJS.watch(command.variable, function(){
  40. renderExpression(command, function_obj, div_to_render, expression_array);
  41. }, 0);
  42. if (command.variable.content) {
  43. var types_included = [];
  44. if (command.variable.content.type == Types.INTEGER || command.variable.content.type == Types.REAL) {
  45. types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
  46. } else if (command.variable.content.type == Types.BOOLEAN) {
  47. types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
  48. types_included.push(Models.EXPRESSION_TYPES.exp_logic);
  49. types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
  50. } else if (command.variable.content.type == Types.TEXT) {
  51. types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
  52. types_included.push(Models.EXPRESSION_TYPES.exp_logic);
  53. types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
  54. } else {
  55. console.log('NÃO RECONHECI! VEJA: ', command.variable.content.type);
  56. }
  57. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  58. } else {
  59. div_to_render.text(LocalizedStrings.getUI('var_menu_select_var').toLowerCase());
  60. }
  61. } else {
  62. var types_included = [];
  63. types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
  64. types_included.push(Models.EXPRESSION_TYPES.exp_logic);
  65. types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
  66. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  67. }
  68. div_to_render.children('.mouse_distance').addClass('mouse_distance_hidden');
  69. div_to_render.children('.higher_element').on('mousemove', function(evt) {
  70. if (!window.open_or_close) {
  71. $(this).css('position', 'relative', '!important');
  72. $(this).children('.mouse_distance').css('opacity', '1');
  73. }
  74. });
  75. div_to_render.children('.higher_element').on('mouseout', function(evt) {
  76. if (!window.open_or_close) {
  77. $(this).css('position', 'absolute', '!important');
  78. $(this).children('.mouse_distance').css('opacity', '0');
  79. }
  80. });
  81. var lixeira = $('<div class="lixeira" draggable="true"></div>');
  82. div_to_render.find('.single_element_expression').on('mousedown', function (evt) {
  83. window.posX = evt.clientX;
  84. window.posY = evt.clientY;
  85. });
  86. Sortable.create(div_to_render[0], {
  87. animation: 100,
  88. ghostClass: 'ghost',
  89. group: {
  90. name: 'shared',
  91. put: false // Do not allow items to be put into this list
  92. },
  93. draggable: '.single_element_expression',
  94. handle: '.element_expression_handle',
  95. sort: false,
  96. filter: '.not_allowed',
  97. onStart: function() {
  98. $('body').append(lixeira);
  99. lixeira.css('display', 'block');
  100. lixeira.css('top', window.posY + 70, '!important');
  101. lixeira.css('left', window.posX - 20, '!important');
  102. },
  103. onMove: function() {
  104. lixeira.addClass('color_test');
  105. },
  106. onEnd: function() {
  107. lixeira.remove();
  108. div_to_render.find('.ghost').removeClass('ghost');
  109. }
  110. });
  111. new Sortable(lixeira[0], {
  112. group: 'shared',
  113. animation: 150,
  114. onAdd: function (evt) {
  115. lixeira.css('display', 'none');
  116. lixeira.find('.single_element_expression').remove();
  117. lixeira.css('background-color', '');
  118. lixeira.remove();
  119. removeElement(evt, expression_array);
  120. renderExpression(command, function_obj, div_to_render, expression_array);
  121. }
  122. });
  123. }
  124. function removeElement (event, expression_array) {
  125. var indice = $(event.item).data('index');
  126. var first = expression_array[0];
  127. console.log('indice: ', indice);
  128. if (expression_array[indice].type) {
  129. // if is alone in expression:
  130. if (expression_array.length == 1) {
  131. //function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  132. expression_array.splice(0, 1);
  133. } else if (expression_array.length > 1) {
  134. if (indice > 0 && expression_array[indice - 1].type_op) {
  135. if (indice < (expression_array.length)
  136. && expression_array[indice - 2] == '('
  137. && expression_array[indice + 1].type_op) {
  138. expression_array.splice(indice + 1, 1);
  139. }
  140. expression_array.splice(indice, 1);
  141. expression_array.splice(indice - 1, 1);
  142. if (indice - 2 < (expression_array.length)
  143. && expression_array[indice - 2] == '('
  144. && expression_array[indice - 1] == ')') {
  145. expression_array.splice(indice - 1, 1);
  146. expression_array.splice(indice - 2, 1);
  147. if (indice - 3 >= 0 && indice - 3 < expression_array.length
  148. && expression_array[indice - 3].type_op ) {
  149. expression_array.splice(indice - 3, 1);
  150. }
  151. }
  152. } else if (indice < (expression_array.length - 1) && expression_array[indice + 1].type_op) {
  153. expression_array.splice(indice + 1, 1);
  154. expression_array.splice(indice, 1);
  155. } else if (indice < (expression_array.length - 1) && indice > 0
  156. && expression_array[indice -1] == '(' && expression_array[indice +1] == ')') {
  157. if (indice > 1
  158. && expression_array[indice - 2].type_op) {
  159. expression_array.splice(indice + 1, 1);
  160. expression_array.splice(indice, 1);
  161. expression_array.splice(indice - 1, 1);
  162. expression_array.splice(indice - 2, 1);
  163. } else if (indice < (expression_array.length - 2)
  164. && expression_array[indice + 2].type_op) {
  165. expression_array.splice(indice + 1, 1);
  166. expression_array.splice(indice, 1);
  167. expression_array.splice(indice - 1, 1);
  168. } else {
  169. expression_array.splice(indice + 1, 1);
  170. expression_array.splice(indice, 1);
  171. expression_array.splice(indice - 1, 1);
  172. }
  173. }
  174. }
  175. } else if (expression_array[indice].type_op) {
  176. // iVProg doesn't support operator remove
  177. } else {
  178. var opening = -1;
  179. var closing = -1;
  180. if (expression_array[indice] == '(') {
  181. opening = indice;
  182. for (var i = indice + 1; i < expression_array.length; i++) {
  183. if (expression_array[i] == ')') {
  184. closing = i;
  185. break;
  186. }
  187. }
  188. } else {
  189. closing = indice;
  190. for (var i = indice - 1; i >= 0; i--) {
  191. if (expression_array[i] == '(') {
  192. opening = i;
  193. break;
  194. }
  195. }
  196. }
  197. if (expression_array[opening + 1].type_op) {
  198. expression_array.splice(closing, 1);
  199. expression_array.splice(opening + 1, 1);
  200. expression_array.splice(opening, 1);
  201. } else {
  202. expression_array.splice(closing, 1);
  203. expression_array.splice(opening, 1);
  204. }
  205. }
  206. // if expression is empty, add a new var value:
  207. if (expression_array.length == 0) {
  208. expression_array.push(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  209. }
  210. if (first != expression_array[0] && expression_array[0].type_op) {
  211. expression_array.splice(0, 1);
  212. }
  213. }
  214. function renderElements (command, function_obj, div_to_render, expression_array, types_included) {
  215. /*if (expression_array.length > 0) {
  216. if (!expression_array[0].type_op) {
  217. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  218. }
  219. }*/
  220. var i = 0;
  221. for (i = 0; i < expression_array.length; i++) {
  222. if (expression_array[i].type == "var_value") {
  223. var div_temp = $('<div class="single_element_expression" data-index="'+i+'"></div>');
  224. div_temp.append('<div class="element_expression_handle" style="display: inline; width: 2px solid red; width: 20px; height: 15px;"></div>');
  225. if (i == 0) {
  226. if (expression_array.length > 0 && !expression_array[0].type_op) {
  227. //renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  228. }
  229. }
  230. VariableValueMenuManagement.renderMenu(command, expression_array[i], div_temp, function_obj);
  231. div_to_render.append(div_temp);
  232. } else if (expression_array[i] == '(' || expression_array[i] == ')') {
  233. if (expression_array[i] == ')') {
  234. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  235. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  236. } else if (expression_array[i] == '(' && !expression_array[i + 1].type_op) {
  237. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  238. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
  239. } else {
  240. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  241. }
  242. } else {
  243. if (i == 0) {
  244. console.log("NEGAÇÃO NO PRIMEIRO ELEMENTO");
  245. } else if (expression_array[i - 1] == '(') {
  246. console.log("NEGAÇÃO APÓS O PARÊNTESES");
  247. }
  248. renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
  249. }
  250. }
  251. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i, true);
  252. renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
  253. }
  254. window.parentheses_activate = false;
  255. window.open_or_close = null;
  256. function renderAddParenthesis (command, function_obj, div_to_render, expression_array, types_included) {
  257. var addParentheses = $('<div class="single_element_expression add_parentheses not_allowed"><img style="width: 15px; position: relative; top: 3px; left: 1px; height: 15px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOgAAAEjCAYAAAA48U27AAAasXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZtZkhw5km3/sYpeAkYFsByMIm8Hvfw+Fx4kg6zM7HolHaykOz3MzWA63EFh5c5//7/r/osfK8m7XGqzbub5yT33OHjT/Ofn8xp8fn+/n/Pjd+H3z11MX28jr4nX9PmFna/jB5+XX1+o+evz+fvnrq7Pm9i+TvT1C078fpKurPf7a5FfJ0rx83n4+rfrX18Y9u12vv6L6+u0Xyf/89+5EoxdOF+KLp4Ukv/8/blSYhWpp8Grvb9L1CeJ9+n9HVL71/g5/Wutvw7gz3d/xM//WFn6FQ73iezXAfZHnL4+D+WPz9PPy8TfVhTizyvH7yuyEZr//vMtfvfudu/53N3I5giXfd3Uj1t57zhwEs70vmb8qfxXeF/fn86f5odfZG1zq9P5yT96iMT6hhx2GOGG815XWCwxxxM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f5r5vbOwbuV7KaerftPl3Uqad/DepALQulhENnAAAAABJRU5ErkJggg=="></div>');
  258. div_to_render.append(addParentheses);
  259. addParentheses.popup({
  260. content : "Adicionar parênteses",
  261. delay: {
  262. show: 750,
  263. hide: 0
  264. }
  265. });
  266. addParentheses.on('click', function(mouse_event) {
  267. // verificar se já está ativado
  268. if (window.parentheses_activate) {
  269. return;
  270. }
  271. div_to_render.find('.usepointer').off('click');
  272. window.parentheses_activate = true;
  273. window.open_or_close = "open";
  274. div_to_render.find('.dropdown').addClass('disabled');
  275. div_to_render.find('.ghost_element').addClass('temp_class');
  276. div_to_render.find('.ghost_element').removeClass('ghost_element');
  277. var floatingObject = $('<div class="floating_parenthesis"> ( </div>');
  278. floatingObject.draggable().appendTo("body");
  279. floatingObject.css("position", "absolute");
  280. mouse_event.type = "mousedown.draggable";
  281. mouse_event.target = floatingObject[0];
  282. floatingObject.css("left", mouse_event.pageX + 10);
  283. floatingObject.css("top", mouse_event.pageY + 10);
  284. floatingObject.trigger(mouse_event);
  285. div_to_render.on('mousemove', function(evt) {
  286. var actual_target = null;
  287. if ($(evt.target).hasClass('single_element_expression')) {
  288. actual_target = $(evt.target);
  289. } else {
  290. actual_target = $(evt.target).closest('.single_element_expression');
  291. }
  292. if ($(evt.target).hasClass('temp_class')
  293. || actual_target.length < 1
  294. || actual_target.hasClass('add_parentheses')
  295. || actual_target.hasClass('rendered_parentheses')
  296. || $(evt.target).hasClass('expression_elements')) {
  297. return;
  298. }
  299. renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
  300. });
  301. div_to_render.on('mouseleave', function() {
  302. /*window.open_parentheses.remove();
  303. window.close_parentheses.remove();*/
  304. });
  305. var floating;
  306. $('body').on('mouseup', function(evt) {
  307. if (window.open_or_close == "open") {
  308. window.open_or_close = "close";
  309. floatingObject.remove();
  310. var comando_que_esta = $(evt.target).closest('.command_container');
  311. var comando_certo = div_to_render.closest('.command_container');
  312. if (!comando_que_esta.is(comando_certo)) {
  313. window.parentheses_activate = false;
  314. div_to_render.find('.temp_class').addClass('ghost_element');
  315. div_to_render.find('.temp_class').removeClass('temp_class');
  316. div_to_render.off('mousemove');
  317. div_to_render.off('mouseleave');
  318. $('body').off('mouseup');
  319. window.open_parentheses.remove();
  320. window.close_parentheses.remove();
  321. window.inserir_open = -1;
  322. window.inserir_close = -1;
  323. window.open_or_close = null;
  324. renderExpression(command, function_obj, div_to_render, expression_array);
  325. return;
  326. }
  327. window.open_parentheses.addClass('parentheses_fixed');
  328. floating = $('<div class="floating_parenthesis"> ) </div>');
  329. floating.draggable().appendTo("body");
  330. floating.css("position", "absolute");
  331. floating.css("left", evt.pageX + 10);
  332. floating.css("top", evt.pageY + 10);
  333. $('body').on('mousemove', function(evts) {
  334. floating.css("left", evts.pageX + 10);
  335. floating.css("top", evts.pageY + 10);
  336. });
  337. } else {
  338. floating.remove();
  339. window.open_parentheses.removeClass('parentheses_fixed');
  340. div_to_render.off('mousemove');
  341. div_to_render.off('mouseleave');
  342. $('body').off('mouseup');
  343. setTimeout(function(){
  344. window.parentheses_activate = false;
  345. }, 50);
  346. var comando_que_esta = $(evt.target).closest('.command_container');
  347. var comando_certo = div_to_render.closest('.command_container');
  348. var is_correct = false;
  349. if (comando_que_esta.is(comando_certo)) {
  350. is_correct = true;
  351. }
  352. if (is_correct) {
  353. expression_array.splice(window.inserir_open, 0, '(');
  354. expression_array.splice(window.inserir_close, 0, ')');
  355. }
  356. window.inserir_open = -1;
  357. window.inserir_close = -1;
  358. window.open_or_close = null;
  359. renderExpression(command, function_obj, div_to_render, expression_array);
  360. }
  361. });
  362. });
  363. }
  364. window.open_parentheses = $('<div class="parentheses_ghost">(</div>');
  365. window.close_parentheses = $('<div class="parentheses_ghost">)</div>');
  366. window.inserir_open = -1;
  367. window.inserir_close = -1;
  368. function renderGhostParentheses (actual_target, command, function_obj, div_to_render, expression_array) {
  369. /*window.open_parentheses.remove();
  370. window.close_parentheses.remove();*/
  371. var index_in_array = actual_target.data('index');
  372. if ((expression_array[index_in_array] == '(') || (expression_array[index_in_array] == ')')) {
  373. return;
  374. }
  375. if (window.open_or_close == "close") {
  376. if (index_in_array < window.inserir_open) {
  377. return;
  378. }
  379. }
  380. // Tratando a situação quando é na primeira posição:
  381. if (index_in_array == 0) {
  382. if (expression_array[index_in_array].type == "var_value") {
  383. if (window.open_or_close == "open") {
  384. window.open_parentheses.insertBefore(actual_target);
  385. window.inserir_open = index_in_array;
  386. }
  387. /*if (expression_array.length == 1) {
  388. if (window.open_or_close == "close") {
  389. window.close_parentheses.insertAfter(actual_target);
  390. window.inserir_close = index_in_array + 2;
  391. }*/
  392. //} else {
  393. var count_opened = 0;
  394. var count_closed = 0;
  395. for (var i = 0; i < expression_array.length; i++) {
  396. if ((expression_array[i] == '(')) {
  397. count_opened ++;
  398. }
  399. if (expression_array[i] == ')') {
  400. count_closed ++;
  401. }
  402. if (count_opened != count_closed) {
  403. } else {
  404. if (count_opened > 0) {
  405. if (window.open_or_close == "close") {
  406. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
  407. window.inserir_close = i + 2;
  408. }
  409. break;
  410. } else {
  411. if (expression_array[i].type == "var_value") {
  412. if (window.open_or_close == "close") {
  413. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
  414. window.inserir_close = i + 2;
  415. }
  416. break;
  417. }
  418. }
  419. }
  420. }
  421. //}
  422. } else if (expression_array[index_in_array].type_op) {
  423. if (window.open_or_close == "open") {
  424. window.open_parentheses.insertBefore(actual_target);
  425. window.inserir_open = index_in_array;
  426. }
  427. var count_opened = 0;
  428. var count_closed = 0;
  429. for (var i = 1; i < expression_array.length; i++) {
  430. // $('.slide-link[data-slide="0"]')
  431. if ((expression_array[i] == '(')) {
  432. count_opened ++;
  433. }
  434. if (expression_array[i] == ')') {
  435. count_closed ++;
  436. }
  437. if (count_opened != count_closed) {
  438. } else {
  439. if (count_opened > 0) {
  440. if (expression_array[i].type == "var_value") {
  441. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
  442. window.inserir_close = i + 2;
  443. }
  444. break;
  445. } else {
  446. if (expression_array[i].type == "var_value") {
  447. if (expression_array[i].type == "var_value") {
  448. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
  449. window.inserir_close = i + 2;
  450. }
  451. break;
  452. }
  453. }
  454. }
  455. }
  456. }
  457. return;
  458. }
  459. // Tratando quando não é no índice 0:
  460. if (expression_array[index_in_array].type == "var_value") {
  461. if (window.open_or_close == "open") {
  462. window.open_parentheses.insertBefore(actual_target);
  463. window.inserir_open = index_in_array;
  464. }
  465. if (window.open_or_close == "close") {
  466. window.close_parentheses.insertAfter(actual_target);
  467. window.inserir_close = index_in_array + 2;
  468. }
  469. return;
  470. }
  471. if (expression_array[index_in_array].type_op) {
  472. // buscar para a esquerda primeiro:
  473. if (expression_array[index_in_array - 1] == '(') {
  474. if (window.open_or_close == "open") {
  475. window.open_parentheses.insertBefore(actual_target);
  476. window.inserir_open = index_in_array;
  477. }
  478. } else if (expression_array[index_in_array - 1] == ')') {
  479. // buscar a abertura
  480. var count_opened = 0;
  481. var count_closed = 0;
  482. for (var j = index_in_array - 1; j >= 0; j--) {
  483. if ((expression_array[j] == '(')) {
  484. count_opened ++;
  485. }
  486. if (expression_array[j] == ')') {
  487. count_closed ++;
  488. }
  489. if (count_opened != count_closed) {
  490. } else {
  491. if (count_closed > 0) {
  492. if (window.open_or_close == "open") {
  493. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="'+j+'"]'));
  494. window.inserir_open = j;
  495. }
  496. break;
  497. }
  498. }
  499. }
  500. } else if (expression_array[index_in_array - 1].type == "var_value") {
  501. if (window.open_or_close == "open") {
  502. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="'+(index_in_array - 1)+'"]'));
  503. window.inserir_open = index_in_array - 1;
  504. }
  505. }
  506. // buscar para a direita agora:
  507. if (expression_array[index_in_array + 1] == '(') {
  508. // buscar o fechamento:
  509. var count_opened = 0;
  510. var count_closed = 0;
  511. for (var j = index_in_array + 1; j < expression_array.length; j ++) {
  512. if ((expression_array[j] == '(')) {
  513. count_opened ++;
  514. }
  515. if (expression_array[j] == ')') {
  516. count_closed ++;
  517. }
  518. if (count_opened != count_closed) {
  519. } else {
  520. if (count_opened > 0) {
  521. if (window.open_or_close == "close") {
  522. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+j+'"]'));
  523. window.inserir_close = j + 2;
  524. }
  525. break;
  526. }
  527. }
  528. }
  529. } else if (expression_array[index_in_array + 1].type == "var_value") {
  530. if (window.open_or_close == "close") {
  531. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+(index_in_array + 1)+'"]'));
  532. window.inserir_close = index_in_array + 3;
  533. }
  534. }
  535. }
  536. }
  537. function renderParenthesis (div_to_render, expression_content, command, function_obj, position, expression_array) {
  538. var ghost_parenthesis = $('<div class="single_element_expression parentheses_in_expression" data-index="'+position+'">'+expression_content+'</div>');
  539. div_to_render.append(ghost_parenthesis);
  540. }
  541. function renderStartAddOperator (div_to_render, types_included, expression_array, command, function_obj, position) {
  542. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  543. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  544. if (types_included.length > 1) {
  545. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  546. menu_final += getArithmeticOperators();
  547. menu_final += '</div></div>';
  548. } else {
  549. menu_final += getArithmeticOperators();
  550. }
  551. }
  552. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
  553. if (types_included.length > 1) {
  554. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  555. menu_final += getLogicOperators();
  556. menu_final += '</div></div>';
  557. } else {
  558. menu_final += getLogicOperators();
  559. }
  560. }
  561. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
  562. if (types_included.length > 1) {
  563. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  564. menu_final += getRelationalOperators();
  565. menu_final += '</div></div>';
  566. } else {
  567. menu_final += getRelationalOperators();
  568. }
  569. }
  570. menu_final += '</div></div>';
  571. menu_final = $(menu_final);
  572. var div_temp = $('<div class="single_element_expression ghost_element mouse_distance"></div>');
  573. div_temp.append(menu_final);
  574. var div_higher = $('<div class="higher_element"></div>');
  575. div_higher.append(div_temp);
  576. div_to_render.append(div_higher);
  577. menu_final.dropdown('set selected', Models.ARITHMETIC_TYPES.minus);
  578. div_temp.on('click', function() {
  579. if (!window.open_or_close) {
  580. var sera = position;
  581. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  582. console.log('p1');
  583. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_arithmetic,Models.ARITHMETIC_TYPES.minus));
  584. } else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
  585. console.log('p2');
  586. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_logic,Models.LOGIC_COMPARISON.equals_to));
  587. } else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
  588. console.log('p3');
  589. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_conditional,Models.ARITHMETIC_COMPARISON.greater_than));
  590. }
  591. renderExpression(command, function_obj, div_to_render, expression_array);
  592. }
  593. });
  594. }
  595. function renderFinalAddElements (div_to_render, types_included, expression_array, command, function_obj, position, is_last = false) {
  596. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  597. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  598. if (types_included.length > 1) {
  599. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  600. menu_final += getArithmeticOperators();
  601. menu_final += '</div></div>';
  602. } else {
  603. menu_final += getArithmeticOperators();
  604. }
  605. }
  606. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
  607. if (types_included.length > 1) {
  608. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  609. menu_final += getLogicOperators();
  610. menu_final += '</div></div>';
  611. } else {
  612. menu_final += getLogicOperators();
  613. }
  614. }
  615. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
  616. if (types_included.length > 1) {
  617. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  618. menu_final += getRelationalOperators();
  619. menu_final += '</div></div>';
  620. } else {
  621. menu_final += getRelationalOperators();
  622. }
  623. }
  624. menu_final += '</div></div>';
  625. menu_final = $(menu_final);
  626. var div_temp = $('<div class="simple_add mouse_distance"></div>');
  627. var div_higher = $('<div class="higher_element"></div>');
  628. var button = $('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');
  629. div_temp.append(button);
  630. if (!is_last) {
  631. div_higher.append(div_temp);
  632. div_to_render.append(div_higher);
  633. //div_temp.append(menu_final);
  634. div_temp.css('opacity', '0', '!important');
  635. } else {
  636. div_temp.removeClass('mouse_distance');
  637. div_temp.css('opacity', '1', '!important');
  638. //div_temp.append(menu_final);
  639. div_to_render.append(div_temp);
  640. }
  641. menu_final.dropdown('set selected', Models.ARITHMETIC_TYPES.plus);
  642. div_temp.on('click', function() {
  643. var sera = position;
  644. if (expression_array[sera] == ')' && expression_array[sera - 1] == '(') {
  645. expression_array.splice(sera, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  646. renderExpression(command, function_obj, div_to_render, expression_array);
  647. return;
  648. }
  649. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  650. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_arithmetic,Models.ARITHMETIC_TYPES.plus));
  651. expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  652. } else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
  653. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_logic,Models.LOGIC_COMPARISON.equals_to));
  654. expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  655. } else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
  656. expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_conditional,Models.ARITHMETIC_COMPARISON.greater_than));
  657. expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  658. }
  659. renderExpression(command, function_obj, div_to_render, expression_array);
  660. });
  661. }
  662. function renderOperatorMenu (command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
  663. var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  664. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
  665. if (types_included.length > 1) {
  666. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  667. menu_final += getArithmeticOperators();
  668. menu_final += '</div></div>';
  669. } else {
  670. menu_final += getArithmeticOperators();
  671. }
  672. }
  673. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
  674. if (types_included.length > 1) {
  675. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  676. menu_final += getLogicOperators();
  677. menu_final += '</div></div>';
  678. } else {
  679. menu_final += getLogicOperators();
  680. }
  681. }
  682. if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
  683. if (types_included.length > 1) {
  684. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  685. menu_final += getRelationalOperators();
  686. menu_final += '</div></div>';
  687. } else {
  688. menu_final += getRelationalOperators();
  689. }
  690. }
  691. menu_final += '</div></div>';
  692. menu_final = $(menu_final);
  693. var div_temp = $('<div class="single_element_expression not_allowed" data-index="'+position+'"></div>');
  694. div_temp.append(menu_final);
  695. div_to_render.append(div_temp);
  696. menu_final.dropdown({
  697. onChange: function(value, text, $selectedItem) {
  698. expression_element.item = $selectedItem.data('value');
  699. expression_element.type_op = $selectedItem.data('type');
  700. }
  701. });
  702. menu_final.dropdown('set selected', expression_element.item);
  703. }
  704. function getArithmeticOperators () {
  705. var arithmetic_operators;
  706. arithmetic_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.plus+'">+</div>';
  707. arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.minus+'">-</div>';
  708. arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.multiplication+'">*</div>';
  709. arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.division+'">/</div>';
  710. arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.module+'">%</div>';
  711. return arithmetic_operators;
  712. }
  713. function getLogicOperators () {
  714. var logic_operators;
  715. logic_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.equals_to+'">==</div>';
  716. logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.not_equals_to+'">!=</div>';
  717. logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.and+'">'+LocalizedStrings.getUI('and')+'</div>';
  718. logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.or+'">'+LocalizedStrings.getUI('or')+'</div>';
  719. logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.not+'">'+LocalizedStrings.getUI('not')+'</div>';
  720. return logic_operators;
  721. }
  722. function getRelationalOperators () {
  723. var relational_operators;
  724. relational_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.greater_than+'">></div>';
  725. relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.less_than+'"><</div>';
  726. relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.equals_to+'">==</div>';
  727. relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.not_equals_to+'">!=</div>';
  728. relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to+'">>=</div>';
  729. relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.less_than_or_equals_to+'"><=</div>';
  730. return relational_operators;
  731. }