Browse Source

protection against wrongly addressed write messages

main
TFLCL 3 months ago
parent
commit
b85e2ff66b
  1. 20
      code/tc.preset.js

20
code/tc.preset.js

@ -105,6 +105,7 @@ var shift_hold, option_hold = 0;
var is_interpolating = 0; var is_interpolating = 0;
var is_dragging = 0; // Drag flag var is_dragging = 0; // Drag flag
var drag_slot = -1; // Stores the slot that's being dragged var drag_slot = -1; // Stores the slot that's being dragged
var is_writing = 0;
// Keeping track of various variables for dealing with color modes // Keeping track of various variables for dealing with color modes
var requested_slot = -1; // Which slot we're waiting a value for (used in get_all_preset_colors) var requested_slot = -1; // Which slot we're waiting a value for (used in get_all_preset_colors)
@ -929,14 +930,20 @@ function lockedslots() {
} }
function write() { function write() {
var args = arrayfromargs(arguments); if (is_writing) {
var filename = args[0]; is_writing = 0;
var state = args[1]; var args = arrayfromargs(arguments);
if (state) { var filename = args[0];
post(pattrstorage_name + ' pattrstorage: ' + filename + ' updated\n'); var state = args[1];
if (state) {
post(pattrstorage_name + ' pattrstorage: ' + filename + ' updated\n');
} else {
error(pattrstorage_name + ': error while writing ' + filename + '\n');
}
} else { } else {
error(pattrstorage_name + ': error while writing ' + filename + '\n'); error("Send your write messages directly to the pattrstorage instead.\n");
} }
} }
function read() { function read() {
@ -1091,6 +1098,7 @@ function set_umenu(v) {
function trigger_writeagain() { function trigger_writeagain() {
if (auto_writeagain && !is_dragging) { if (auto_writeagain && !is_dragging) {
is_writing = 1;
to_pattrstorage("writeagain"); to_pattrstorage("writeagain");
} }

Loading…
Cancel
Save