|
@@ -47,7 +47,9 @@ function removeGlobal (global_var, global_container) {
|
|
|
if (index > -1) {
|
|
|
window.program_obj.globals.splice(index, 1);
|
|
|
}
|
|
|
- $(global_container).remove();
|
|
|
+ global_container.children().off();
|
|
|
+ global_container.off();
|
|
|
+ global_container.remove();
|
|
|
}
|
|
|
|
|
|
function updateInitialValues (global_var) {
|
|
@@ -103,12 +105,12 @@ function updateInitialValues (global_var) {
|
|
|
|
|
|
function alternateBooleanGlobalValue (global_var, value_container) {
|
|
|
global_var.value = !global_var.value;
|
|
|
- $(value_container).find('.span_value_variable').text(global_var.value);
|
|
|
+ $(value_container).find('.span_value_variable').text(LocalizedStrings.getUI(global_var.value));
|
|
|
}
|
|
|
|
|
|
function alternateBooleanGlobalVectorValue (global_var, index, value_container) {
|
|
|
global_var.value[index] = !global_var.value[index];
|
|
|
- $(value_container).find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ $(value_container).find('.span_value_variable').text(LocalizedStrings.getUI(global_var.value[index]));
|
|
|
}
|
|
|
|
|
|
function removeGlobalColumnVector (global_var) {
|
|
@@ -220,7 +222,7 @@ function addLineGlobalMatrix (global_var) {
|
|
|
|
|
|
function alternateBooleanGlobalMatrixValue (global_var, row, index, value_container) {
|
|
|
global_var.value[row][index] = !global_var.value[row][index];
|
|
|
- $(value_container).find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ $(value_container).find('.span_value_variable').text(LocalizedStrings.getUI(global_var.value[row][index]));
|
|
|
}
|
|
|
|
|
|
function renderValues (global_var, global_container) {
|
|
@@ -230,12 +232,12 @@ function renderValues (global_var, global_container) {
|
|
|
|
|
|
if (global_var.dimensions == 0) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+global_var.value.toFixed(1)+'</span> <i class="icon small pencil alternate enable_edit_name_function simple_var"></i></div> ';
|
|
|
+ ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+global_var.value.toFixed(1)+'</span> </div> ';
|
|
|
} else {
|
|
|
if (global_var.type == Types.BOOLEAN) {
|
|
|
- ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">'+global_var.value+'</span> <i class="icon small pencil alternate enable_edit_name_function boolean_simple_type"></i></div> ';
|
|
|
+ ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">'+LocalizedStrings.getUI(global_var.value)+'</span> </div> ';
|
|
|
} else {
|
|
|
- ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+global_var.value+'</span> <i class="icon small pencil alternate enable_edit_name_function simple_var"></i></div> ';
|
|
|
+ ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">'+global_var.value+'</span> </div> ';
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -250,7 +252,7 @@ function renderValues (global_var, global_container) {
|
|
|
} else {
|
|
|
for (var k = 0; k < global_var.columns; k++) {
|
|
|
if (global_var.type == Types.BOOLEAN) {
|
|
|
- ret += '<td><span class="span_value_variable boolean_vector_var" data-index="'+k+'">'+global_var.value[k]+'</span></td>';
|
|
|
+ ret += '<td><span class="span_value_variable boolean_vector_var" data-index="'+k+'">'+LocalizedStrings.getUI(global_var.value[k])+'</span></td>';
|
|
|
} else {
|
|
|
ret += '<td><span class="span_value_variable vector_var" data-index="'+k+'">'+global_var.value[k]+'</span>'+'</td>';
|
|
|
}
|
|
@@ -278,7 +280,7 @@ function renderValues (global_var, global_container) {
|
|
|
ret += '<tr>';
|
|
|
for (var k = 0; k < global_var.columns; k++) {
|
|
|
if (global_var.type == Types.BOOLEAN) {
|
|
|
- ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="'+k+'" data-row="'+l+'">'+global_var.value[l][k]+'</span></td>';
|
|
|
+ ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="'+k+'" data-row="'+l+'">'+LocalizedStrings.getUI(global_var.value[l][k])+'</span></td>';
|
|
|
} else {
|
|
|
ret += '<td><span class="span_value_variable matrix_var" data-index="'+k+'" data-row="'+l+'">'+global_var.value[l][k]+'</span></td>';
|
|
|
}
|
|
@@ -299,69 +301,72 @@ function renderValues (global_var, global_container) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
|
|
|
ret = $(ret);
|
|
|
|
|
|
- $(ret).find('.span_value_variable').data('associatedOject', global_var);
|
|
|
+ ret.find('.span_value_variable').data('associatedOject', global_var);
|
|
|
|
|
|
- $( ret ).find( ".boolean_simple_type" ).on('click', function(e){
|
|
|
+ ret.find( ".boolean_simple_type" ).on('click', function(e){
|
|
|
alternateBooleanGlobalValue(global_var, this.parentNode);
|
|
|
});
|
|
|
- $( ret ).find( ".simple_var" ).on('click', function(e){
|
|
|
+ ret.find( ".simple_var" ).on('click', function(e){
|
|
|
enableGlobalValueUpdate(global_var, this.parentNode);
|
|
|
});
|
|
|
|
|
|
- $( ret ).find( ".boolean_vector_var" ).on('click', function(e){
|
|
|
+ ret.find( ".boolean_vector_var" ).on('click', function(e){
|
|
|
alternateBooleanGlobalVectorValue(global_var, $(this).data('index'), this.parentNode);
|
|
|
});
|
|
|
- $( ret ).find( ".vector_var" ).on('click', function(e){
|
|
|
+ ret.find( ".vector_var" ).on('click', function(e){
|
|
|
enableGlobalVectorValueUpdate(global_var, $(this).data('index'), this.parentNode);
|
|
|
});
|
|
|
- $( ret ).find( ".remove_global_vector_column" ).on('click', function(e){
|
|
|
+ ret.find( ".remove_global_vector_column" ).on('click', function(e){
|
|
|
removeGlobalColumnVector(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".add_global_vector_column" ).on('click', function(e){
|
|
|
+ ret.find( ".add_global_vector_column" ).on('click', function(e){
|
|
|
addGlobalColumnVector(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".remove_global_matrix_column" ).on('click', function(e){
|
|
|
+ ret.find( ".remove_global_matrix_column" ).on('click', function(e){
|
|
|
removeColumnGlobalMatrix(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".add_global_matrix_column" ).on('click', function(e){
|
|
|
+ ret.find( ".add_global_matrix_column" ).on('click', function(e){
|
|
|
addColumnGlobalMatrix(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".remove_global_matrix_line" ).on('click', function(e){
|
|
|
+ ret.find( ".remove_global_matrix_line" ).on('click', function(e){
|
|
|
removeLineGlobalMatrix(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".add_global_matrix_line" ).on('click', function(e){
|
|
|
+ ret.find( ".add_global_matrix_line" ).on('click', function(e){
|
|
|
addLineGlobalMatrix(global_var);
|
|
|
- $( global_container ).find( ".div_valor_var" ).html('');
|
|
|
+ global_container.find( ".div_valor_var" ).html('');
|
|
|
renderValues(global_var, global_container);
|
|
|
});
|
|
|
- $( ret ).find( ".boolean_matrix_var" ).on('click', function(e){
|
|
|
+ ret.find( ".boolean_matrix_var" ).on('click', function(e){
|
|
|
alternateBooleanGlobalMatrixValue(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
|
|
|
});
|
|
|
- $( ret ).find( ".matrix_var" ).on('click', function(e){
|
|
|
+ ret.find( ".matrix_var" ).on('click', function(e){
|
|
|
enableGlobalMatrixValueUpdate(global_var, $(this).data('row'), $(this).data('index'), this.parentNode);
|
|
|
});
|
|
|
- $( global_container ).find( ".div_valor_var" ).append(ret);
|
|
|
+ global_container.find( ".div_valor_var" ).append(ret);
|
|
|
+
|
|
|
+
|
|
|
+ updateColumnsAndRowsText(global_container, global_var);
|
|
|
|
|
|
}
|
|
|
|
|
|
function addHandlers (global_container) {
|
|
|
- var global_var = $(global_container).data('associatedOject');
|
|
|
+ var global_var = global_container.data('associatedOject');
|
|
|
|
|
|
- $( global_container ).find( ".alternate_constant" ).on('click', function(e){
|
|
|
+ global_container.find( ".alternate_constant" ).on('click', function(e){
|
|
|
toggleConstant(global_var);
|
|
|
|
|
|
$( this ).removeClass( "on off" );
|
|
@@ -373,48 +378,63 @@ function addHandlers (global_container) {
|
|
|
});
|
|
|
|
|
|
|
|
|
- $( global_container ).find( ".enable_edit_name_parameter" ).on('click', function(e){
|
|
|
+ global_container.find( ".enable_edit_name_parameter" ).on('click', function(e){
|
|
|
enableNameUpdate(global_container);
|
|
|
});
|
|
|
|
|
|
|
|
|
- $( global_container ).find('.ui.dropdown.global_type').dropdown({
|
|
|
+ global_container.find('.ui.dropdown.global_type').dropdown({
|
|
|
onChange: function(value, text, $selectedItem) {
|
|
|
- if ($($selectedItem).data('dimensions')) {
|
|
|
- updateType(global_var, Types[$($selectedItem).data('type')], $($selectedItem).data('dimensions'));
|
|
|
+ if ($selectedItem.data('dimensions')) {
|
|
|
+ updateType(global_var, Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
|
|
|
} else {
|
|
|
- updateType(global_var, Types[$($selectedItem).data('type')]);
|
|
|
+ updateType(global_var, Types[$selectedItem.data('type')]);
|
|
|
}
|
|
|
|
|
|
renderValues(global_var, global_container);
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
- $( global_container ).find( ".remove_global" ).on('click', function(e){
|
|
|
+ global_container.find( ".remove_global" ).on('click', function(e){
|
|
|
removeGlobal(global_var, global_container);
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
-function renderGlobal (global_var) {
|
|
|
+function updateColumnsAndRowsText (global_container, global_var) {
|
|
|
+ var prev = global_container.find('.text').text().split('[');
|
|
|
+ if (prev.length == 2) {
|
|
|
+ var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
|
|
|
+ global_container.find('.text').empty();
|
|
|
+ global_container.find('.text').text(ff);
|
|
|
+ }
|
|
|
+ if (prev.length == 3) {
|
|
|
+ var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
|
|
|
+ global_container.find('.text').empty();
|
|
|
+ global_container.find('.text').text(ff);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export function renderGlobal (global_var) {
|
|
|
|
|
|
var element = '<div class="ui label global_container"><div class="global_const">const: ';
|
|
|
|
|
|
- element += '<i class="ui icon toggle '+(global_var.is_constant?"on":"off")+' alternate_constant"></i></div><span class="span_name_variable enable_edit_name_parameter">'+global_var.name+'</span> <i class="icon small pencil alternate enable_edit_name_parameter"></i>';
|
|
|
+ element += '<i class="ui icon toggle '+(global_var.is_constant?"on":"off")+' alternate_constant"></i></div>';
|
|
|
|
|
|
element += '<div class="ui dropdown global_type">';
|
|
|
|
|
|
if (global_var.dimensions > 0) {
|
|
|
element += '<div class="text">'+ i18n('ui:vector') + ':' + LocalizedStrings.getUI(global_var.type);
|
|
|
for (var i = 0; i < global_var.dimensions; i ++) {
|
|
|
- element += ' [ ] ';
|
|
|
+ element += ' [ <span class="dimensions_'+i+'"></span> ] ';
|
|
|
}
|
|
|
element += '</div>';
|
|
|
} else {
|
|
|
element += '<div class="text">' + LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
|
|
|
}
|
|
|
- element += '<i class="dropdown icon"></i><div class="menu">';
|
|
|
+ element += '<div class="menu">';
|
|
|
|
|
|
for (var tm in Types) {
|
|
|
if (tm == Types.VOID.toUpperCase()) {
|
|
@@ -437,7 +457,7 @@ function renderGlobal (global_var) {
|
|
|
+ '</div>';
|
|
|
}
|
|
|
|
|
|
- element += '</div></div> = ';
|
|
|
+ element += '</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">'+global_var.name+'</span> </div> <span class="character_equals"> = </span> ';
|
|
|
|
|
|
element += '<div class="ui div_valor_var">'+global_var.value+'</div>';
|
|
|
|
|
@@ -445,89 +465,124 @@ function renderGlobal (global_var) {
|
|
|
|
|
|
var complete_element = $(element);
|
|
|
|
|
|
- $(complete_element).data('associatedOject', global_var);
|
|
|
+ complete_element.data('associatedOject', global_var);
|
|
|
|
|
|
$('.list_globals').append(complete_element);
|
|
|
|
|
|
addHandlers(complete_element);
|
|
|
|
|
|
renderValues(global_var, complete_element);
|
|
|
+
|
|
|
+ if (global_var.dimensions == 1) {
|
|
|
+ complete_element.find('.dimensions_0').text(global_var.columns);
|
|
|
+ }
|
|
|
+ if (global_var.dimensions == 2) {
|
|
|
+ complete_element.find('.dimensions_0').text(global_var.columns);
|
|
|
+ complete_element.find('.dimensions_1').text(global_var.rows);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
var opened_name_value_matrix_global_v = false;
|
|
|
var opened_input_value_matrix_global_v = null;
|
|
|
function enableGlobalMatrixValueUpdate (global_var, row, index, parent_node) {
|
|
|
if (opened_name_value_matrix_global_v) {
|
|
|
- $(opened_input_value_matrix_global_v).focus();
|
|
|
+ opened_input_value_matrix_global_v.focus();
|
|
|
return;
|
|
|
}
|
|
|
+ parent_node = $(parent_node);
|
|
|
opened_name_value_matrix_global_v = true;
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text('');
|
|
|
+ parent_node.find('.span_value_variable').text('');
|
|
|
+
|
|
|
+ var input_field;
|
|
|
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value[row][index].toFixed(1) + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value[row][index].toFixed(1) + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
} else {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value[row][index] + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value[row][index] + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
}
|
|
|
|
|
|
- $('.width-dynamic').on('input', function() {
|
|
|
- var inputWidth = $(this).textWidth()+10;
|
|
|
- opened_input_value_matrix_global_v = this;
|
|
|
- $(this).focus();
|
|
|
+ input_field.on('input', function() {
|
|
|
+ var inputWidth = input_field.textWidth()+10;
|
|
|
+ opened_input_value_matrix_global_v = input_field;
|
|
|
+ input_field.focus();
|
|
|
|
|
|
- var tmpStr = $(this).val();
|
|
|
- $(this).val('');
|
|
|
- $(this).val(tmpStr);
|
|
|
+ var tmpStr = input_field.val();
|
|
|
+ input_field.val('');
|
|
|
+ input_field.val(tmpStr);
|
|
|
|
|
|
- $(this).css({
|
|
|
+ input_field.css({
|
|
|
width: inputWidth
|
|
|
})
|
|
|
}).trigger('input');
|
|
|
|
|
|
- $('.width-dynamic').focusout(function() {
|
|
|
+ input_field.focusout(function() {
|
|
|
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value[row][index] = parseFloat($(this).val().trim());
|
|
|
+ global_var.value[row][index] = parseFloat(input_field.val().trim());
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
} else {
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value[row][index] = parseInt($(this).val().trim());
|
|
|
+ global_var.value[row][index] = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value[row][index] = $(this).val().trim();
|
|
|
+ global_var.value[row][index] = input_field.val().trim();
|
|
|
}
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
}
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value[row][index] = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ }
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_matrix_global_v = false;
|
|
|
opened_input_value_matrix_global_v = false;
|
|
|
});
|
|
|
|
|
|
- $('.width-dynamic').on('keydown', function(e) {
|
|
|
+ input_field.on('keydown', function(e) {
|
|
|
var code = e.keyCode || e.which;
|
|
|
if(code == 13) {
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value[row][index] = parseFloat($(this).val().trim());
|
|
|
+ global_var.value[row][index] = parseFloat(input_field.val().trim());
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
} else {
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value[row][index] = parseInt($(this).val().trim());
|
|
|
+ global_var.value[row][index] = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value[row][index] = $(this).val().trim();
|
|
|
+ global_var.value[row][index] = input_field.val().trim();
|
|
|
}
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value[row][index] = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_matrix_global_v = false;
|
|
@@ -535,69 +590,87 @@ function enableGlobalMatrixValueUpdate (global_var, row, index, parent_node) {
|
|
|
}
|
|
|
if(code == 27) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
|
|
|
} else {
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[row][index]);
|
|
|
}
|
|
|
-
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_matrix_global_v = false;
|
|
|
opened_input_value_matrix_global_v = false;
|
|
|
}
|
|
|
});
|
|
|
+ input_field.select();
|
|
|
}
|
|
|
|
|
|
var opened_name_value_global_var = false;
|
|
|
var opened_input_value_global_ar = null;
|
|
|
function enableGlobalValueUpdate (global_var, parent_node) {
|
|
|
if (opened_name_value_global_var) {
|
|
|
- $(opened_input_value_global_ar).focus();
|
|
|
+ opened_input_value_global_ar.focus();
|
|
|
return;
|
|
|
}
|
|
|
+ parent_node = $(parent_node);
|
|
|
opened_name_value_global_var = true;
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text('');
|
|
|
+ parent_node.find('.span_value_variable').text('');
|
|
|
+
|
|
|
+ var input_field;
|
|
|
+
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value.toFixed(1) + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value.toFixed(1) + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
} else {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
}
|
|
|
|
|
|
- $('.width-dynamic').on('input', function() {
|
|
|
- var inputWidth = $(this).textWidth()+10;
|
|
|
- opened_input_value_global_ar = this;
|
|
|
- $(this).focus();
|
|
|
+ input_field.on('input', function() {
|
|
|
+ var inputWidth = input_field.textWidth()+10;
|
|
|
+ opened_input_value_global_ar = input_field;
|
|
|
+ input_field.focus();
|
|
|
|
|
|
- var tmpStr = $(this).val();
|
|
|
- $(this).val('');
|
|
|
- $(this).val(tmpStr);
|
|
|
+ var tmpStr = input_field.val();
|
|
|
+ input_field.val('');
|
|
|
+ input_field.val(tmpStr);
|
|
|
|
|
|
- $(this).css({
|
|
|
+ input_field.css({
|
|
|
width: inputWidth
|
|
|
})
|
|
|
}).trigger('input');
|
|
|
|
|
|
- $('.width-dynamic').focusout(function() {
|
|
|
+ input_field.focusout(function() {
|
|
|
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value = parseFloat($(this).val().trim());
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
+ global_var.value = parseFloat(input_field.val().trim());
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
} else{
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value = parseInt($(this).val().trim());
|
|
|
+ global_var.value = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value = $(this).val().trim();
|
|
|
+ global_var.value = input_field.val().trim();
|
|
|
}
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
+ }
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
+ }
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_global_var = false;
|
|
@@ -605,23 +678,34 @@ function enableGlobalValueUpdate (global_var, parent_node) {
|
|
|
|
|
|
});
|
|
|
|
|
|
- $('.width-dynamic').on('keydown', function(e) {
|
|
|
+ input_field.on('keydown', function(e) {
|
|
|
var code = e.keyCode || e.which;
|
|
|
if(code == 13) {
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value = parseFloat($(this).val().trim());
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
- } else{
|
|
|
+ global_var.value = parseFloat(input_field.val().trim());
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
+ } else {
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value = parseInt($(this).val().trim());
|
|
|
+ global_var.value = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value = $(this).val().trim();
|
|
|
+ global_var.value = input_field.val().trim();
|
|
|
}
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_global_var = false;
|
|
@@ -630,18 +714,20 @@ function enableGlobalValueUpdate (global_var, parent_node) {
|
|
|
}
|
|
|
if(code == 27) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
|
|
|
} else{
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value);
|
|
|
}
|
|
|
-
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_global_var = false;
|
|
|
opened_input_value_global_ar = false;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ input_field.select();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -649,52 +735,55 @@ var opened_name_global = false;
|
|
|
var opened_input_global = null;
|
|
|
function enableNameUpdate (global_container) {
|
|
|
|
|
|
- var global_var = $(global_container).data('associatedOject');
|
|
|
+ var global_var = global_container.data('associatedOject');
|
|
|
|
|
|
if (opened_name_global) {
|
|
|
- $(opened_input_global).focus();
|
|
|
+ opened_input_global.focus();
|
|
|
return;
|
|
|
}
|
|
|
opened_name_global = true;
|
|
|
|
|
|
- $( global_container ).find('.span_name_variable').text('');
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+global_var.name+"' />" ).insertBefore($(global_container).find('.span_name_variable'));
|
|
|
+ global_container.find('.span_name_variable').text('');
|
|
|
+ var input_name = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+global_var.name+"' />" );
|
|
|
+ input_name.insertBefore(global_container.find('.span_name_variable'));
|
|
|
|
|
|
- $('.width-dynamic').on('input', function() {
|
|
|
- var inputWidth = $(this).textWidth()+10;
|
|
|
- opened_input_global = this;
|
|
|
- $(this).focus();
|
|
|
+ input_name.on('input', function() {
|
|
|
+ var inputWidth = input_name.textWidth()+10;
|
|
|
+ opened_input_global = input_name;
|
|
|
+ opened_input_global.focus();
|
|
|
|
|
|
- var tmpStr = $(this).val();
|
|
|
- $(this).val('');
|
|
|
- $(this).val(tmpStr);
|
|
|
-
|
|
|
- $(this).css({
|
|
|
+ opened_input_global.css({
|
|
|
width: inputWidth
|
|
|
})
|
|
|
}).trigger('input');
|
|
|
|
|
|
- $('.width-dynamic').focusout(function() {
|
|
|
+ input_name.focusout(function() {
|
|
|
|
|
|
- if ($(this).val().trim()) {
|
|
|
- updateName(global_var, $(this).val().trim());
|
|
|
- $(global_container).find('.span_name_variable').text(global_var.name);
|
|
|
+ if (input_name.val().trim().length > 0) {
|
|
|
+ updateName(global_var, input_name.val().trim());
|
|
|
+ global_container.find('.span_name_variable').text(global_var.name);
|
|
|
+ } else {
|
|
|
+ global_container.find('.span_name_variable').text(global_var.name);
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ input_name.off();
|
|
|
+ input_name.remove();
|
|
|
|
|
|
|
|
|
opened_name_global = false;
|
|
|
opened_input_global = false;
|
|
|
});
|
|
|
|
|
|
- $('.width-dynamic').on('keydown', function(e) {
|
|
|
+ input_name.on('keydown', function(e) {
|
|
|
var code = e.keyCode || e.which;
|
|
|
if(code == 13) {
|
|
|
- if ($(this).val().trim()) {
|
|
|
- updateName(global_var, $(this).val().trim());
|
|
|
- $(global_container).find('.span_name_variable').text(global_var.name);
|
|
|
+ if (input_name.val().trim()) {
|
|
|
+ updateName(global_var, input_name.val().trim());
|
|
|
+ global_container.find('.span_name_variable').text(global_var.name);
|
|
|
+ } else {
|
|
|
+ global_container.find('.span_name_variable').text(global_var.name);
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ input_name.off();
|
|
|
+ input_name.remove();
|
|
|
|
|
|
|
|
|
opened_name_global = false;
|
|
@@ -702,15 +791,17 @@ function enableNameUpdate (global_container) {
|
|
|
}
|
|
|
if(code == 27) {
|
|
|
|
|
|
- $(global_container).find('.span_name_variable').text(global_var.name);
|
|
|
-
|
|
|
- $(this).remove();
|
|
|
+ global_container.find('.span_name_variable').text(global_var.name);
|
|
|
+ input_name.off();
|
|
|
+ input_name.remove();
|
|
|
|
|
|
|
|
|
opened_name_global = false;
|
|
|
opened_input_global = false;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ input_name.select();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -719,82 +810,109 @@ var opened_name_value_vector_global_ = false;
|
|
|
var opened_input_value_vector_global_ = null;
|
|
|
function enableGlobalVectorValueUpdate (global_var, index, parent_node) {
|
|
|
if (opened_name_value_vector_global_) {
|
|
|
- $(opened_input_value_vector_global_).focus();
|
|
|
+ opened_input_value_vector_global_.focus();
|
|
|
return;
|
|
|
}
|
|
|
+ parent_node = $(parent_node);
|
|
|
opened_name_value_vector_global_ = true;
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text('');
|
|
|
+ parent_node.find('.span_value_variable').text('');
|
|
|
+
|
|
|
+ var input_field;
|
|
|
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value[index].toFixed(1) + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value[index].toFixed(1) + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
} else {
|
|
|
- $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
- + global_var.value[index] + "' />" ).insertBefore($(parent_node).find('.span_value_variable'));
|
|
|
+ input_field = $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"
|
|
|
+ + global_var.value[index] + "' />" );
|
|
|
+ input_field.insertBefore(parent_node.find('.span_value_variable'));
|
|
|
}
|
|
|
|
|
|
- $('.width-dynamic').on('input', function() {
|
|
|
- var inputWidth = $(this).textWidth()+10;
|
|
|
- opened_input_value_vector_global_ = this;
|
|
|
- $(this).focus();
|
|
|
+ input_field.on('input', function() {
|
|
|
+ var inputWidth = input_field.textWidth()+10;
|
|
|
+ opened_input_value_vector_global_ = input_field;
|
|
|
+ input_field.focus();
|
|
|
|
|
|
- var tmpStr = $(this).val();
|
|
|
- $(this).val('');
|
|
|
- $(this).val(tmpStr);
|
|
|
+ var tmpStr = input_field.val();
|
|
|
+ input_field.val('');
|
|
|
+ input_field.val(tmpStr);
|
|
|
|
|
|
- $(this).css({
|
|
|
+ input_field.css({
|
|
|
width: inputWidth
|
|
|
})
|
|
|
}).trigger('input');
|
|
|
|
|
|
- $('.width-dynamic').focusout(function() {
|
|
|
+ input_field.focusout(function() {
|
|
|
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value[index] = parseFloat($(this).val().trim());
|
|
|
+ global_var.value[index] = parseFloat(input_field.val().trim());
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
} else {
|
|
|
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value[index] = parseInt($(this).val().trim());
|
|
|
+ global_var.value[index] = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value[index] = $(this).val().trim();
|
|
|
+ global_var.value[index] = input_field.val().trim();
|
|
|
}
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value[index] = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_vector_global_ = false;
|
|
|
opened_input_value_vector_global_ = false;
|
|
|
});
|
|
|
|
|
|
- $('.width-dynamic').on('keydown', function(e) {
|
|
|
+ input_field.on('keydown', function(e) {
|
|
|
var code = e.keyCode || e.which;
|
|
|
if(code == 13) {
|
|
|
- if ($(this).val().trim()) {
|
|
|
+ if (input_field.val().trim()) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- global_var.value[index] = parseFloat($(this).val().trim());
|
|
|
+ global_var.value[index] = parseFloat(input_field.val().trim());
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
} else {
|
|
|
|
|
|
if (global_var.type == Types.INTEGER) {
|
|
|
- global_var.value[index] = parseInt($(this).val().trim());
|
|
|
+ global_var.value[index] = parseInt(input_field.val().trim());
|
|
|
} else {
|
|
|
- global_var.value[index] = $(this).val().trim();
|
|
|
+ global_var.value[index] = input_field.val().trim();
|
|
|
}
|
|
|
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
|
|
|
}
|
|
|
+ } else {
|
|
|
+ if (global_var.type == Types.REAL) {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
+ } else {
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ }
|
|
|
}
|
|
|
- $(this).remove();
|
|
|
+ if (global_var.type == Types.TEXT) {
|
|
|
+ global_var.value[index] = input_field.val();
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ }
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_vector_global_ = false;
|
|
@@ -802,18 +920,20 @@ function enableGlobalVectorValueUpdate (global_var, index, parent_node) {
|
|
|
}
|
|
|
if(code == 27) {
|
|
|
if (global_var.type == Types.REAL) {
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
|
|
|
} else {
|
|
|
- $(parent_node).find('.span_value_variable').text(global_var.value[index]);
|
|
|
+ parent_node.find('.span_value_variable').text(global_var.value[index]);
|
|
|
}
|
|
|
-
|
|
|
- $(this).remove();
|
|
|
+ input_field.off();
|
|
|
+ input_field.remove();
|
|
|
|
|
|
|
|
|
opened_name_value_vector_global_ = false;
|
|
|
opened_input_value_vector_global_ = false;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ input_field.select();
|
|
|
}
|
|
|
|
|
|
|