mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
Convert preference to use struct.
This commit is contained in:
parent
fe2339b674
commit
8bbec3933c
41 changed files with 274 additions and 313 deletions
|
@ -71,7 +71,7 @@
|
|||
var dch = 8;
|
||||
var dcx = mxs - 72;
|
||||
var dcy = mys - 96 - 8 - dch;
|
||||
var _dcw = dcw * clamp(o_main.dc_check / PREF_MAP[? "double_click_delay"], 0., 1.);
|
||||
var _dcw = dcw * clamp(o_main.dc_check / PREFERENCES.double_click_delay, 0., 1.);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, dcx, dcy, dcw, dch, COLORS._main_icon_dark, 0.5);
|
||||
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, dcx, dcy, _dcw, dch, COLORS._main_icon_light, 1.0);
|
||||
|
|
|
@ -9,8 +9,8 @@ event_inherited();
|
|||
node_called = noone;
|
||||
junction_hovering = noone;
|
||||
|
||||
dialog_w = PREF_MAP[? "dialog_add_node_w"];
|
||||
dialog_h = PREF_MAP[? "dialog_add_node_h"];
|
||||
dialog_w = PREFERENCES.dialog_add_node_w;
|
||||
dialog_h = PREFERENCES.dialog_add_node_h;
|
||||
|
||||
destroy_on_click_out = true;
|
||||
|
||||
|
@ -382,7 +382,7 @@ event_inherited();
|
|||
//}
|
||||
var group_labels = [];
|
||||
|
||||
if(PREF_MAP[? "dialog_add_node_view"] == 0) { //grid
|
||||
if(PREFERENCES.dialog_add_node_view == 0) { //grid
|
||||
var grid_size = ui(64);
|
||||
var grid_width = ui(80);
|
||||
var grid_space = ui(12);
|
||||
|
@ -400,7 +400,7 @@ event_inherited();
|
|||
if(is_undefined(_node)) continue;
|
||||
|
||||
if(is_string(_node)) {
|
||||
if(!PREF_MAP[? "dialog_add_node_grouping"])
|
||||
if(!PREFERENCES.dialog_add_node_grouping)
|
||||
continue;
|
||||
hh += curr_height;
|
||||
yy += curr_height;
|
||||
|
@ -514,7 +514,7 @@ event_inherited();
|
|||
|
||||
hh += curr_height;
|
||||
yy += curr_height;
|
||||
} else if(PREF_MAP[? "dialog_add_node_view"] == 1) { //list
|
||||
} else if(PREFERENCES.dialog_add_node_view == 1) { //list
|
||||
var list_width = content_pane.surface_w;
|
||||
var list_height = ui(28);
|
||||
var yy = _y + list_height / 2;
|
||||
|
@ -526,7 +526,7 @@ event_inherited();
|
|||
if(is_undefined(_node)) continue;
|
||||
|
||||
if(is_string(_node)) {
|
||||
if(!PREF_MAP[? "dialog_add_node_grouping"])
|
||||
if(!PREFERENCES.dialog_add_node_grouping)
|
||||
continue;
|
||||
|
||||
hh += ui(8);
|
||||
|
@ -642,8 +642,8 @@ event_inherited();
|
|||
content_pane.resize(dialog_w - category_width - ui(8), dialog_h - ui(66));
|
||||
search_pane.resize(dialog_w - ui(36), dialog_h - ui(66));
|
||||
|
||||
PREF_MAP[? "dialog_add_node_w"] = dialog_w;
|
||||
PREF_MAP[? "dialog_add_node_h"] = dialog_h;
|
||||
PREFERENCES.dialog_add_node_w = dialog_w;
|
||||
PREFERENCES.dialog_add_node_h = dialog_h;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -742,7 +742,7 @@ event_inherited();
|
|||
return hh;
|
||||
}
|
||||
|
||||
if(PREF_MAP[? "dialog_add_node_view"] == 0) { //grid view
|
||||
if(PREFERENCES.dialog_add_node_view == 0) { //grid view
|
||||
var col = floor(search_pane.surface_w / (grid_width + grid_space));
|
||||
var yy = _y + grid_space;
|
||||
var index = 0;
|
||||
|
@ -776,7 +776,7 @@ event_inherited();
|
|||
|
||||
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
|
||||
if(sprite_exists(_node.spr)) {
|
||||
var _si = current_time * PREF_MAP[? "collection_preview_speed"] / 3000;
|
||||
var _si = current_time * PREFERENCES.collection_preview_speed / 3000;
|
||||
var _sw = sprite_get_width(_node.spr);
|
||||
var _sh = sprite_get_height(_node.spr);
|
||||
var _ss = ui(32) / max(_sw, _sh);
|
||||
|
@ -839,7 +839,7 @@ event_inherited();
|
|||
yy += hght;
|
||||
}
|
||||
}
|
||||
} else if(PREF_MAP[? "dialog_add_node_view"] == 1) { //list view
|
||||
} else if(PREFERENCES.dialog_add_node_view == 1) { //list view
|
||||
var list_width = search_pane.surface_w;
|
||||
var list_height = ui(28);
|
||||
var yy = _y + list_height / 2;
|
||||
|
@ -862,7 +862,7 @@ event_inherited();
|
|||
|
||||
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
|
||||
if(sprite_exists(_node.spr)) {
|
||||
var _si = current_time * PREF_MAP[? "collection_preview_speed"] / 3000;
|
||||
var _si = current_time * PREFERENCES.collection_preview_speed / 3000;
|
||||
var _sw = sprite_get_width(_node.spr);
|
||||
var _sh = sprite_get_height(_node.spr);
|
||||
var _ss = (list_height - ui(8)) / max(_sw, _sh);
|
||||
|
|
|
@ -38,17 +38,17 @@ if !ready exit;
|
|||
var bx = dialog_x + dialog_w - ui(44);
|
||||
var by = dialog_y + ui(16);
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER,
|
||||
PREF_MAP[? "dialog_add_node_view"]? __txtx("view_list", "List view") : __txtx("view_grid", "Grid view"),
|
||||
THEME.view_mode, PREF_MAP[? "dialog_add_node_view"], COLORS._main_icon);
|
||||
PREFERENCES.dialog_add_node_view? __txtx("view_list", "List view") : __txtx("view_grid", "Grid view"),
|
||||
THEME.view_mode, PREFERENCES.dialog_add_node_view, COLORS._main_icon);
|
||||
if(b == 2)
|
||||
PREF_MAP[? "dialog_add_node_view"] = !PREF_MAP[? "dialog_add_node_view"];
|
||||
PREFERENCES.dialog_add_node_view = !PREFERENCES.dialog_add_node_view;
|
||||
|
||||
bx -= ui(32);
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER,
|
||||
PREF_MAP[? "dialog_add_node_grouping"]? __txtx("add_node_group_enabled", "Group enabled") : __txtx("add_node_group_disabled", "Group disabled"),
|
||||
THEME.view_group, PREF_MAP[? "dialog_add_node_grouping"], COLORS._main_icon);
|
||||
PREFERENCES.dialog_add_node_grouping? __txtx("add_node_group_enabled", "Group enabled") : __txtx("add_node_group_disabled", "Group disabled"),
|
||||
THEME.view_group, PREFERENCES.dialog_add_node_grouping, COLORS._main_icon);
|
||||
if(b == 2)
|
||||
PREF_MAP[? "dialog_add_node_grouping"] = !PREF_MAP[? "dialog_add_node_grouping"];
|
||||
PREFERENCES.dialog_add_node_grouping = !PREFERENCES.dialog_add_node_grouping;
|
||||
|
||||
if(node_called != noone || junction_hovering != noone) {
|
||||
var txt = node_show_connectable? __txtx("add_node_show_connect", "Showing connectable") : __txtx("add_node_show_all", "Showing all");
|
||||
|
|
|
@ -82,8 +82,8 @@ event_inherited();
|
|||
|
||||
var contents = context.content;
|
||||
var amo = ds_list_size(contents);
|
||||
var hh = 0;
|
||||
var frame = current_time * PREF_MAP[? "collection_preview_speed"] / 8000;
|
||||
var hh = 0;
|
||||
var frame = current_time * PREFERENCES.collection_preview_speed / 8000;
|
||||
|
||||
var grid_size = ui(64);
|
||||
var img_size = grid_size - ui(16);
|
||||
|
|
|
@ -115,24 +115,24 @@ event_inherited();
|
|||
__txtx("pref_show_welcome_screen", "Show welcome screen"),
|
||||
"show_splash",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"];
|
||||
PREFERENCES.show_splash = !PREFERENCES.show_splash;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
||||
PREF_MAP[? "_display_scaling"] = PREF_MAP[? "display_scaling"];
|
||||
PREFERENCES._display_scaling = PREFERENCES.display_scaling;
|
||||
ds_list_add(pref_global, [
|
||||
__txtx("pref_gui_scaling", "GUI scaling"),
|
||||
"_display_scaling",
|
||||
new slider(0.5, 2, 0.01, function(val) {
|
||||
PREF_MAP[? "_display_scaling"] = val;
|
||||
PREFERENCES._display_scaling = val;
|
||||
PREF_SAVE();
|
||||
}, function() {
|
||||
PREF_MAP[? "_display_scaling"] = clamp(PREF_MAP[? "_display_scaling"], 0.5, 2);
|
||||
if(PREF_MAP[? "display_scaling"] == PREF_MAP[? "_display_scaling"])
|
||||
PREFERENCES._display_scaling = clamp(PREFERENCES._display_scaling, 0.5, 2);
|
||||
if(PREFERENCES.display_scaling == PREFERENCES._display_scaling)
|
||||
return;
|
||||
|
||||
PREF_MAP[? "display_scaling"] = PREF_MAP[? "_display_scaling"];
|
||||
PREFERENCES.display_scaling = PREFERENCES._display_scaling;
|
||||
resetPanel();
|
||||
loadFonts();
|
||||
|
||||
|
@ -144,7 +144,7 @@ event_inherited();
|
|||
__txtx("pref_auto_save_time", "Autosave delay (-1 to disable)"),
|
||||
"auto_save_time",
|
||||
new textBox(TEXTBOX_INPUT.number, function(val) {
|
||||
PREF_MAP[? "auto_save_time"] = val;
|
||||
PREFERENCES.auto_save_time = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -153,7 +153,7 @@ event_inherited();
|
|||
__txtx("pref_double_click_delay", "Double click delay"),
|
||||
"double_click_delay",
|
||||
new slider(0, 1, 0.01, function(val) {
|
||||
PREF_MAP[? "double_click_delay"] = val;
|
||||
PREFERENCES.double_click_delay = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -162,7 +162,7 @@ event_inherited();
|
|||
__txtx("pref_mouse_wheel_speed", "Scroll speed"),
|
||||
"mouse_wheel_speed",
|
||||
new textBox(TEXTBOX_INPUT.number, function(val) {
|
||||
PREF_MAP[? "mouse_wheel_speed"] = val;
|
||||
PREFERENCES.mouse_wheel_speed = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -171,7 +171,7 @@ event_inherited();
|
|||
__txtx("pref_keyboard_hold_start", "Keyboard hold start"),
|
||||
"keyboard_repeat_start",
|
||||
new slider(0, 1, 0.01, function(val) {
|
||||
PREF_MAP[? "keyboard_repeat_start"] = val;
|
||||
PREFERENCES.keyboard_repeat_start = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -180,7 +180,7 @@ event_inherited();
|
|||
__txtx("pref_keyboard_repeat_delay", "Keyboard repeat delay"),
|
||||
"keyboard_repeat_speed",
|
||||
new slider(0, 1, 0.01, function(val) {
|
||||
PREF_MAP[? "keyboard_repeat_speed"] = val;
|
||||
PREFERENCES.keyboard_repeat_speed = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -189,8 +189,8 @@ event_inherited();
|
|||
__txtx("pref_ui_frame_rate", "UI frame rate"),
|
||||
"ui_framerate",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "ui_framerate"] = max(15, round(real(str)));
|
||||
game_set_speed(PREF_MAP[? "ui_framerate"], gamespeed_fps);
|
||||
PREFERENCES.ui_framerate = max(15, round(real(str)));
|
||||
game_set_speed(PREFERENCES.ui_framerate, gamespeed_fps);
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -199,7 +199,7 @@ event_inherited();
|
|||
__txtx("pref_default_surface_size", "Default surface size"),
|
||||
"default_surface_side",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "default_surface_side"] = max(1, round(real(str)));
|
||||
PREFERENCES.default_surface_side = max(1, round(real(str)));
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -208,7 +208,7 @@ event_inherited();
|
|||
__txtx("pref_collection_preview_speed", "Collection preview speed"),
|
||||
"collection_preview_speed",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "collection_preview_speed"] = max(1, round(real(str)));
|
||||
PREFERENCES.collection_preview_speed = max(1, round(real(str)));
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -218,7 +218,7 @@ event_inherited();
|
|||
__txtx("pref_inspector_line_break_width", "Inspector line break width"),
|
||||
"inspector_line_break_width",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "inspector_line_break_width"] = max(1, round(real(str)));
|
||||
PREFERENCES.inspector_line_break_width = max(1, round(real(str)));
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -227,7 +227,7 @@ event_inherited();
|
|||
__txtx("pref_expand_hovering_panel", "Expand hovering panel"),
|
||||
"expand_hover",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "expand_hover"] = !PREF_MAP[? "expand_hover"];
|
||||
PREFERENCES.expand_hover = !PREFERENCES.expand_hover;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -236,7 +236,7 @@ event_inherited();
|
|||
__txtx("pref_graph_zoom_smoothing", "Graph zoom smoothing"),
|
||||
"graph_zoom_smoooth",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "graph_zoom_smoooth"] = max(1, round(real(str)));
|
||||
PREFERENCES.graph_zoom_smoooth = max(1, round(real(str)));
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -245,7 +245,7 @@ event_inherited();
|
|||
__txtx("pref_warning_notification_time", "Warning notification time"),
|
||||
"notification_time",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "notification_time"] = max(0, round(real(str)));
|
||||
PREFERENCES.notification_time = max(0, round(real(str)));
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -254,7 +254,7 @@ event_inherited();
|
|||
__txtx("pref_save_file_minify", "Minify save file"),
|
||||
"save_file_minify",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "save_file_minify"] = !PREF_MAP[? "save_file_minify"];
|
||||
PREFERENCES.save_file_minify = !PREFERENCES.save_file_minify;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -263,7 +263,7 @@ event_inherited();
|
|||
__txtx("pref_enable_test_mode", "Enable developer mode (require restart)"),
|
||||
"test_mode",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "test_mode"] = !PREF_MAP[? "test_mode"];
|
||||
PREFERENCES.test_mode = !PREFERENCES.test_mode;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -272,7 +272,7 @@ event_inherited();
|
|||
__txtx("pref_legacy_exception", "Use legacy exception handler"),
|
||||
"use_legacy_exception",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "use_legacy_exception"] = !PREF_MAP[? "use_legacy_exception"];
|
||||
PREFERENCES.use_legacy_exception = !PREFERENCES.use_legacy_exception;
|
||||
PREF_APPLY();
|
||||
PREF_SAVE();
|
||||
})
|
||||
|
@ -282,7 +282,7 @@ event_inherited();
|
|||
__txtx("pref_crash_dialog", "Show dialog after crash"),
|
||||
"show_crash_dialog",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "show_crash_dialog"] = !PREF_MAP[? "show_crash_dialog"];
|
||||
PREFERENCES.show_crash_dialog = !PREFERENCES.show_crash_dialog;
|
||||
PREF_APPLY();
|
||||
PREF_SAVE();
|
||||
})
|
||||
|
@ -292,7 +292,7 @@ event_inherited();
|
|||
__txtx("pref_clear_temp", "Clear temp file on close."),
|
||||
"clear_temp_on_close",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "clear_temp_on_close"] = !PREF_MAP[? "clear_temp_on_close"];
|
||||
PREFERENCES.clear_temp_on_close = !PREFERENCES.clear_temp_on_close;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -316,7 +316,7 @@ event_inherited();
|
|||
"local",
|
||||
new scrollBox(locals, function(str) {
|
||||
if(str < 0) return;
|
||||
PREF_MAP[? "local"] = locals[str];
|
||||
PREFERENCES.local = locals[str];
|
||||
PREF_SAVE();
|
||||
}, false)
|
||||
]);
|
||||
|
@ -328,7 +328,7 @@ event_inherited();
|
|||
"curve_connection_line",
|
||||
new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
|
||||
function(val) {
|
||||
PREF_MAP[? "curve_connection_line"] = val;
|
||||
PREFERENCES.curve_connection_line = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -337,7 +337,7 @@ event_inherited();
|
|||
__txtx("pref_connection_thickness", "Connection thickness"),
|
||||
"connection_line_width",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_width"] = real(str);
|
||||
PREFERENCES.connection_line_width = real(str);
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -346,7 +346,7 @@ event_inherited();
|
|||
__txtx("pref_connection_curve_smoothness", "Connection curve smoothness"),
|
||||
"connection_line_sample",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_sample"] = real(str);
|
||||
PREFERENCES.connection_line_sample = real(str);
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -355,7 +355,7 @@ event_inherited();
|
|||
__txtx("pref_connection_aa", "Connection anti aliasing"),
|
||||
"connection_line_aa",
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_aa"] = max(1, real(str));
|
||||
PREFERENCES.connection_line_aa = max(1, real(str));
|
||||
PREF_SAVE();
|
||||
})
|
||||
])
|
||||
|
@ -364,8 +364,7 @@ event_inherited();
|
|||
__txtx("pref_connection_anim", "Connection line animation"),
|
||||
"connection_line_transition",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "connection_line_transition"] =
|
||||
!PREF_MAP[? "connection_line_transition"];
|
||||
PREFERENCES.connection_line_transition = !PREFERENCES.connection_line_transition;
|
||||
PREF_SAVE();
|
||||
})
|
||||
])
|
||||
|
@ -374,7 +373,7 @@ event_inherited();
|
|||
__txtx("pref_windows_control", "Use Windows style window control."),
|
||||
"panel_menu_right_control",
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "panel_menu_right_control"] = !PREF_MAP[? "panel_menu_right_control"];
|
||||
PREFERENCES.panel_menu_right_control = !PREFERENCES.panel_menu_right_control;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -410,8 +409,9 @@ event_inherited();
|
|||
|
||||
sb_theme = new scrollBox(themes, function(index) {
|
||||
var thm = themes[index].data;
|
||||
if(PREF_MAP[? "theme"] == thm) return;
|
||||
PREF_MAP[? "theme"] = thm;
|
||||
if(PREFERENCES.theme == thm) return;
|
||||
|
||||
PREFERENCES.theme = thm;
|
||||
PREF_SAVE();
|
||||
|
||||
loadGraphic(thm);
|
||||
|
@ -501,7 +501,7 @@ event_inherited();
|
|||
});
|
||||
|
||||
function overrideColor() {
|
||||
var path = DIRECTORY + "themes/" + PREF_MAP[? "theme"] + "/override.json";
|
||||
var path = $"{DIRECTORY}themes{PREFERENCES.theme}/override.json";
|
||||
json_save_struct(path, COLORS, true);
|
||||
}
|
||||
#endregion
|
||||
|
@ -512,16 +512,16 @@ event_inherited();
|
|||
__txtx("pref_use_alt", "Use ALT for"),
|
||||
"alt_picker",
|
||||
new buttonGroup([ "Pan", "Color Picker" ], function(val) {
|
||||
PREF_MAP[? "alt_picker"] = val;
|
||||
PREFERENCES.alt_picker = val;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
||||
ds_list_add(pref_hot, [
|
||||
__txtx("pref_pan_key", "Panning key"),
|
||||
function() { return PREF_MAP[? "pan_mouse_key"] - 3; },
|
||||
function() { return PREFERENCES.pan_mouse_key - 3; },
|
||||
new scrollBox([ "Middle Mouse", "Mouse 4", "Mouse 5" ], function(val) {
|
||||
PREF_MAP[? "pan_mouse_key"] = val + 3;
|
||||
PREFERENCES.pan_mouse_key = val + 3;
|
||||
PREF_SAVE();
|
||||
})
|
||||
]);
|
||||
|
@ -555,7 +555,7 @@ event_inherited();
|
|||
|
||||
var name = _pref[0];
|
||||
var val = _pref[1];
|
||||
val = is_method(val)? val() : PREF_MAP[? val];
|
||||
val = is_method(val)? val() : PREFERENCES[$ val];
|
||||
|
||||
if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0)
|
||||
continue;
|
||||
|
@ -839,10 +839,7 @@ event_inherited();
|
|||
|
||||
var name = _pref[0];
|
||||
var txt = _pref[1];
|
||||
if(is_method(txt))
|
||||
txt = txt();
|
||||
else
|
||||
txt = PREF_MAP[? txt];
|
||||
txt = is_method(txt)? txt() : PREFERENCES[$ txt];
|
||||
|
||||
if(search_text != "" && string_pos(string_lower(search_text), string_lower(name)) == 0)
|
||||
continue;
|
||||
|
|
|
@ -55,9 +55,9 @@ if !ready exit;
|
|||
var _txt = __txtx("pref_reset_color", "Reset colors");
|
||||
var b = buttonInstant(THEME.button_hide, bx, py, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.refresh);
|
||||
if(b == 2) {
|
||||
var path = DIRECTORY + "themes/" + PREF_MAP[? "theme"] + "/override.json";
|
||||
var path = $"{DIRECTORY}themes/{PREFERENCES.theme}/override.json";
|
||||
if(file_exists(path)) file_delete(path);
|
||||
loadColor(PREF_MAP[? "theme"]);
|
||||
loadColor(PREFERENCES.theme);
|
||||
}
|
||||
|
||||
var x1 = dialog_x + ui(padding + page_width);
|
||||
|
@ -66,7 +66,7 @@ if !ready exit;
|
|||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(x1 + ui(8), py + _h / 2, __txt("Theme"));
|
||||
sb_theme.setFocusHover(sFOCUS, sHOVER);
|
||||
sb_theme.draw(x2 - ui(24) - _w, py, _w, _h, PREF_MAP[? "theme"]);
|
||||
sb_theme.draw(x2 - ui(24) - _w, py, _w, _h, PREFERENCES.theme);
|
||||
|
||||
sp_colors.setFocusHover(sFOCUS, sHOVER);
|
||||
sp_colors.draw(px, py + ui(40));
|
||||
|
|
|
@ -16,7 +16,7 @@ event_inherited();
|
|||
recent_thumbnail = false;
|
||||
show_autosaves = false;
|
||||
|
||||
recent_width = PREF_MAP[? "splash_expand_recent"]? ui(576) : ui(288);
|
||||
recent_width = PREFERENCES.splash_expand_recent? ui(576) : ui(288);
|
||||
#endregion
|
||||
|
||||
#region content
|
||||
|
@ -42,7 +42,7 @@ event_inherited();
|
|||
|
||||
sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
||||
var expand = PREF_MAP[? "splash_expand_recent"];
|
||||
var expand = PREFERENCES.splash_expand_recent;
|
||||
var ww = ui(264);
|
||||
var hh = 0;
|
||||
var pad = ui(8);
|
||||
|
|
|
@ -30,8 +30,8 @@ if !ready exit;
|
|||
}
|
||||
|
||||
bx -= ui(40);
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(36), ui(36), mouse_ui, sFOCUS, sHOVER, __txt("Show on startup"), THEME.icon_splash_show_on_start, PREF_MAP[? "show_splash"]) == 2) {
|
||||
PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"];
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(36), ui(36), mouse_ui, sFOCUS, sHOVER, __txt("Show on startup"), THEME.icon_splash_show_on_start, PREFERENCES.show_splash) == 2) {
|
||||
PREFERENCES.show_splash = !PREFERENCES.show_splash;
|
||||
PREF_SAVE();
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,13 @@ if !ready exit;
|
|||
}
|
||||
|
||||
var expandAction = false;
|
||||
var expand = PREF_MAP[? "splash_expand_recent"];
|
||||
var expand = PREFERENCES.splash_expand_recent;
|
||||
|
||||
switch(pages[project_page]) {
|
||||
case "Sample projects" :
|
||||
case "Workshop" :
|
||||
if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sFOCUS, sHOVER,, THEME.arrow, expand? 2 : 0) == 2) {
|
||||
PREF_MAP[? "splash_expand_recent"] = !PREF_MAP[? "splash_expand_recent"];
|
||||
PREFERENCES.splash_expand_recent = !PREFERENCES.splash_expand_recent;
|
||||
expandAction = true;
|
||||
}
|
||||
break;
|
||||
|
@ -112,8 +112,8 @@ if !ready exit;
|
|||
if(mouse_click(mb_left, sFOCUS)) {
|
||||
project_page = i;
|
||||
|
||||
if(txt == "Contests" && PREF_MAP[? "splash_expand_recent"]) {
|
||||
PREF_MAP[? "splash_expand_recent"] = false;
|
||||
if(txt == "Contests" && PREFERENCES.splash_expand_recent) {
|
||||
PREFERENCES.splash_expand_recent = false;
|
||||
expandAction = true;
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ if !ready exit;
|
|||
}
|
||||
|
||||
if(expandAction) {
|
||||
recent_width = PREF_MAP[? "splash_expand_recent"]? ui(564) : ui(288);
|
||||
recent_width = PREFERENCES.splash_expand_recent? ui(564) : ui(288);
|
||||
resize();
|
||||
}
|
||||
#endregion
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
__migration_check();
|
||||
|
||||
if(!file_exists(file_open_parameter) && PREF_MAP[? "show_splash"])
|
||||
if(!file_exists(file_open_parameter) && PREFERENCES.show_splash)
|
||||
dialogCall(o_dialog_splash);
|
||||
#endregion
|
|
@ -87,7 +87,7 @@
|
|||
addHotkey("", "Close program", vk_f4, MOD_KEY.alt, window_close);
|
||||
|
||||
addHotkey("", "Reload theme", vk_f10, MOD_KEY.ctrl | MOD_KEY.shift, function() {
|
||||
loadGraphic(PREF_MAP[? "theme"]);
|
||||
loadGraphic(PREFERENCES.theme);
|
||||
resetPanel();
|
||||
} );
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ var trigger = false;
|
|||
|
||||
KEYBOARD_PRESSED = vk_nokey;
|
||||
kb_time += DELTA_TIME;
|
||||
if(kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_speed"]) {
|
||||
if(kb_hold && kb_time >= PREFERENCES.keyboard_repeat_speed) {
|
||||
trigger = true;
|
||||
kb_time = 0;
|
||||
} else if(!kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_start"]) {
|
||||
} else if(!kb_hold && kb_time >= PREFERENCES.keyboard_repeat_start) {
|
||||
trigger = true;
|
||||
kb_time = 0;
|
||||
kb_hold = true;
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
if(parameter_count() > 1) {
|
||||
var path = parameter_string(1);
|
||||
if(path == "--crashed") {
|
||||
if(PREF_MAP[? "show_crash_dialog"])
|
||||
if(PREFERENCES.show_crash_dialog)
|
||||
dialogCall(o_dialog_crashed);
|
||||
} else {
|
||||
path = string_replace_all(path, "\n", "");
|
||||
|
|
|
@ -14,7 +14,7 @@ _HOVERING_ELEMENT = noone;
|
|||
}
|
||||
|
||||
if(minimized) {
|
||||
game_set_speed(PREF_MAP[? "ui_framerate"], gamespeed_fps);
|
||||
game_set_speed(PREFERENCES.ui_framerate, gamespeed_fps);
|
||||
minimized = false;
|
||||
}
|
||||
#endregion
|
||||
|
@ -57,7 +57,7 @@ _HOVERING_ELEMENT = noone;
|
|||
#region auto save
|
||||
AUTO_SAVE_TIMER += delta_time / 1_000_000;
|
||||
|
||||
if(PROJECT.modified && PREF_MAP[? "auto_save_time"] > 0 && AUTO_SAVE_TIMER > PREF_MAP[? "auto_save_time"]) {
|
||||
if(PROJECT.modified && PREFERENCES.auto_save_time > 0 && AUTO_SAVE_TIMER > PREFERENCES.auto_save_time) {
|
||||
AUTO_SAVE_TIMER = 0;
|
||||
var loc = DIRECTORY + "Autosave/";
|
||||
if(!directory_exists(loc))
|
||||
|
@ -124,7 +124,7 @@ _HOVERING_ELEMENT = noone;
|
|||
DOUBLE_CLICK = true;
|
||||
dc_check = 0;
|
||||
} else {
|
||||
dc_check = PREF_MAP[? "double_click_delay"];
|
||||
dc_check = PREFERENCES.double_click_delay;
|
||||
DOUBLE_CLICK_POS = [ mouse_mx, mouse_my ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
function apply(value) {
|
||||
if(!interactable) return;
|
||||
current_value = value;
|
||||
triggered = true;
|
||||
triggered = true;
|
||||
onApply(value);
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,13 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
|||
dialog.interactable = interactable;
|
||||
dialog.drop_target = self;
|
||||
|
||||
if(parentDialog)
|
||||
parentDialog.addChildren(dialog);
|
||||
if(parentDialog) {
|
||||
if(is_instanceof(parentDialog, PanelContent)) {
|
||||
if(parentDialog.panel)
|
||||
parentDialog.panel.addChildren(dialog);
|
||||
} else
|
||||
parentDialog.addChildren(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
static drawParam = function(params) {
|
||||
|
|
|
@ -25,7 +25,7 @@ function point_project_line(px, py, l0x, l0y, l1x, l1y) {
|
|||
|
||||
function point_project_curve(mx, my, x0, y0, x1, y1) {
|
||||
var xc = (x0 + x1) / 2;
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 16 * PREF_MAP[? "connection_line_sample"]);
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 16 * PREFERENCES.connection_line_sample);
|
||||
sample = clamp(sample, 8, 128);
|
||||
|
||||
var dist = 999999;
|
||||
|
|
|
@ -39,7 +39,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t
|
|||
if(xc == noone) xc = (x0 + x1) / 2;
|
||||
if(yc == noone) yc = (y0 + y1) / 2;
|
||||
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREF_MAP[? "connection_line_sample"]);
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
|
||||
sample = clamp(sample, 2, 128);
|
||||
|
||||
var x2 = lerp(x0, x1, 0. - sign(x1 - x0) * 0.2) - abs(y1 - y0) * 0.1;
|
||||
|
@ -92,7 +92,7 @@ function draw_line_curve_color(x0, y0, x1, y1, xc = noone, yc = noone, _s = 1, t
|
|||
}
|
||||
|
||||
function draw_line_curve_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_white, col2 = c_white) {
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREF_MAP[? "connection_line_sample"]);
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
|
||||
sample = clamp(sample, 2, 128);
|
||||
|
||||
var x2 = lerp(x0, x1, 0.9);
|
||||
|
@ -128,7 +128,7 @@ function draw_line_curve_corner(x0, y0, x1, y1, _s = 1, thick = 1, col1 = c_whit
|
|||
}
|
||||
|
||||
function distance_to_curve(mx, my, x0, y0, x1, y1, xc, yc, _s) {
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREF_MAP[? "connection_line_sample"]);
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
|
||||
sample = clamp(sample, 2, 128);
|
||||
|
||||
var dist = 999999;
|
||||
|
@ -166,7 +166,7 @@ function distance_to_curve(mx, my, x0, y0, x1, y1, xc, yc, _s) {
|
|||
}
|
||||
|
||||
function distance_to_curve_corner(mx, my, x0, y0, x1, y1, _s) {
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREF_MAP[? "connection_line_sample"]);
|
||||
var sample = ceil((abs(x0 - x1) + abs(y0 - y1)) / 32 * PREFERENCES.connection_line_sample);
|
||||
sample = clamp(sample, 2, 128);
|
||||
|
||||
var dist = 999999;
|
||||
|
|
|
@ -42,7 +42,7 @@ function exportPortable(project = PROJECT) {
|
|||
|
||||
var pro_path = DIRECTORY + "temp/" + raw_name + ".pxc";
|
||||
var file = file_text_open_write(pro_path);
|
||||
file_text_write_string(file, PREF_MAP[? "save_file_minify"]? json_stringify_minify(_proj) : json_stringify(_proj, true));
|
||||
file_text_write_string(file, PREFERENCES.save_file_minify? json_stringify_minify(_proj) : json_stringify(_proj, true));
|
||||
file_text_close(file);
|
||||
zip_add_file(zip, raw_name + ".pxc", pro_path);
|
||||
zip_save(zip, raw_path + ".zip");
|
||||
|
|
|
@ -33,7 +33,7 @@ function _font_add(path, size) {
|
|||
function _font_path(rel) {
|
||||
rel = string_replace_all(rel, "./", "");
|
||||
|
||||
var defPath = $"{DIRECTORY}themes/{PREF_MAP[? "theme"]}/fonts/{rel}";
|
||||
var defPath = $"{DIRECTORY}themes/{PREFERENCES.theme}/fonts/{rel}";
|
||||
|
||||
if(LOCALE.fontDir == noone)
|
||||
return defPath;
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#macro WIN_SW window_get_width()
|
||||
#macro WIN_SH window_get_height()
|
||||
|
||||
#macro UI_SCALE PREF_MAP[? "display_scaling"]
|
||||
#macro UI_SCALE PREFERENCES.display_scaling
|
||||
|
||||
#macro mouse_mx device_mouse_x_to_gui(0)
|
||||
#macro mouse_my device_mouse_y_to_gui(0)
|
||||
|
|
|
@ -73,17 +73,12 @@
|
|||
dModi = _mod;
|
||||
|
||||
static serialize = function() {
|
||||
var ll = ds_list_create();
|
||||
ll[| 0] = context;
|
||||
ll[| 1] = name;
|
||||
ll[| 2] = key;
|
||||
ll[| 3] = modi;
|
||||
return ll;
|
||||
return { context, name, key, modi };
|
||||
}
|
||||
|
||||
static deserialize = function(ll) {
|
||||
key = ll[| 2];
|
||||
modi = ll[| 3];
|
||||
key = is_struct(ll)? ll.key : ll[2];
|
||||
modi = is_struct(ll)? ll.modi : ll[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,10 +105,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(_context == "")
|
||||
ds_list_insert(HOTKEYS[? _context], 0, key);
|
||||
else
|
||||
ds_list_add(HOTKEYS[? _context], key);
|
||||
if(_context == "") ds_list_insert(HOTKEYS[? _context], 0, key);
|
||||
else ds_list_add(HOTKEYS[? _context], key);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
|
||||
function __locale_file(file) {
|
||||
var dirr = $"{DIRECTORY}Locale/{PREF_MAP[? "local"]}";
|
||||
var dirr = $"{DIRECTORY}Locale/{PREFERENCES.local}";
|
||||
if(!directory_exists(dirr) || !file_exists(dirr + file))
|
||||
dirr = $"{DIRECTORY}Locale/en";
|
||||
return dirr + file;
|
||||
|
@ -28,7 +28,7 @@
|
|||
LOCALE.node = json_load_struct(__locale_file("/nodes.json"));
|
||||
LOCALE.config = json_load_struct(__locale_file("/config.json"));
|
||||
|
||||
var fontDir = $"{DIRECTORY}Locale/{PREF_MAP[? "local"]}/fonts/";
|
||||
var fontDir = $"{DIRECTORY}Locale/{PREFERENCES.local}/fonts/";
|
||||
LOCALE.fontDir = directory_exists(fontDir)? fontDir : noone;
|
||||
|
||||
print("FONT DIR: " + fontDir);
|
||||
|
|
|
@ -16,7 +16,7 @@ function mouse_release(mouse, focus = true) {
|
|||
MOUSE_WRAP = false;
|
||||
MOUSE_WRAPPING = false;
|
||||
|
||||
#macro SCROLL_SPEED PREF_MAP[? "mouse_wheel_speed"]
|
||||
#macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed
|
||||
|
||||
function setMouseWrap() {
|
||||
MOUSE_WRAP = true;
|
||||
|
|
|
@ -633,7 +633,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
return true;
|
||||
} #endregion
|
||||
|
||||
static isRenderActive = function() { return renderActive || (PREF_MAP[? "render_all_export"] && PROJECT.animator.rendering); }
|
||||
static isRenderActive = function() { return renderActive || (PREFERENCES.render_all_export && PROJECT.animator.rendering); }
|
||||
|
||||
static isRenderable = function(log = false) { #region //Check if every input is ready (updated)
|
||||
if(!active) return false;
|
||||
|
@ -849,7 +849,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
draw_sprite_stretched_ext(THEME.node_bg_name, 0, xx, yy, w * _s, ui(20), cc, aa);
|
||||
|
||||
var cc = COLORS._main_text;
|
||||
if(PREF_MAP[? "node_show_render_status"] && !rendered)
|
||||
if(PREFERENCES.node_show_render_status && !rendered)
|
||||
cc = isRenderable()? COLORS._main_value_positive : COLORS._main_value_negative;
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, cc);
|
||||
|
@ -1226,7 +1226,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
static drawActive = function(_x, _y, _s, ind = 0) { #region
|
||||
active_draw_index = ind;
|
||||
|
||||
if(PREF_MAP[? "connection_line_highlight_all"]) drawBranch();
|
||||
if(PREFERENCES.connection_line_highlight_all) drawBranch();
|
||||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {}
|
||||
|
|
|
@ -122,7 +122,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var sample = PREF_MAP[? "path_resolution"];
|
||||
var sample = PREFERENCES.path_resolution;
|
||||
var loop = getInputData(1);
|
||||
var ansize = ds_list_size(inputs) - input_fix_len;
|
||||
var _edited = false;
|
||||
|
@ -830,7 +830,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
anchors = [];
|
||||
return;
|
||||
}
|
||||
var sample = PREF_MAP[? "path_resolution"];
|
||||
var sample = PREFERENCES.path_resolution;
|
||||
|
||||
var con = loop? ansize : ansize - 1;
|
||||
lengths = [];
|
||||
|
|
|
@ -2099,13 +2099,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var cy = round((fry + jy) / 2 + shy);
|
||||
|
||||
var hover = false;
|
||||
var th = max(1, PREF_MAP[? "connection_line_width"] * _s);
|
||||
var th = max(1, PREFERENCES.connection_line_width * _s);
|
||||
draw_line_shift_hover = false;
|
||||
|
||||
var downDirection = type == VALUE_TYPE.action || value_from.type == VALUE_TYPE.action;
|
||||
|
||||
if(PANEL_GRAPH.pHOVER)
|
||||
switch(PREF_MAP[? "curve_connection_line"]) {
|
||||
switch(PREFERENCES.curve_connection_line) {
|
||||
case 0 :
|
||||
hover = distance_to_line(mx, my, jx, jy, frx, fry) < max(th * 2, 6);
|
||||
break;
|
||||
|
@ -2148,7 +2148,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
th *= thicken? 2 : 1;
|
||||
|
||||
var corner = PREF_MAP[? "connection_line_corner"] * _s;
|
||||
var corner = PREFERENCES.connection_line_corner * _s;
|
||||
var ty = LINE_STYLE.solid;
|
||||
if(type == VALUE_TYPE.node)
|
||||
ty = LINE_STYLE.dashed;
|
||||
|
@ -2157,7 +2157,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _selc = node.active_draw_index == 0 || value_from.node.active_draw_index == 0 || node.branch_drawing;
|
||||
|
||||
if(!thicken && (high == 1 && key_mod_press(ALT) || high == 2)) {
|
||||
var _fade = PREF_MAP[? "connection_line_highlight_fade"];
|
||||
var _fade = PREFERENCES.connection_line_highlight_fade;
|
||||
var _colr = _selc? 1 : _fade;
|
||||
|
||||
c0 = merge_color(bg, value_from.color_display, _colr);
|
||||
|
@ -2183,7 +2183,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var fromIndex = value_from.drawLineIndex;
|
||||
var toIndex = drawLineIndex;
|
||||
|
||||
switch(PREF_MAP[? "curve_connection_line"]) {
|
||||
switch(PREFERENCES.curve_connection_line) {
|
||||
case 0 :
|
||||
if(ty == LINE_STYLE.solid) draw_line_width_color(jx, jy, frx, fry, th, c1, c0);
|
||||
else draw_line_dashed_color(jx, jy, frx, fry, th, c1, c0, 12 * ss);
|
||||
|
@ -2213,8 +2213,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(target != noone)
|
||||
drawCorner |= target.type == VALUE_TYPE.action;
|
||||
|
||||
var corner = PREF_MAP[? "connection_line_corner"] * ss;
|
||||
var th = max(1, PREF_MAP[? "connection_line_width"] * ss);
|
||||
var corner = PREFERENCES.connection_line_corner * ss;
|
||||
var th = max(1, PREFERENCES.connection_line_width * ss);
|
||||
|
||||
var sx = x;
|
||||
var sy = y;
|
||||
|
@ -2233,7 +2233,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _action = type == VALUE_TYPE.action;
|
||||
var _output = connect_type == JUNCTION_CONNECT.output;
|
||||
|
||||
switch(PREF_MAP[? "curve_connection_line"]) {
|
||||
switch(PREFERENCES.curve_connection_line) {
|
||||
case 0 : draw_line_width(sx, sy, _mx, _my, th); break;
|
||||
case 1 :
|
||||
if(drawCorner) {
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
return STATUSES[| ds_list_size(STATUSES) - 1];
|
||||
}
|
||||
|
||||
var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREF_MAP[? "notification_time"]);
|
||||
var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREFERENCES.notification_time);
|
||||
ds_list_add(STATUSES, noti);
|
||||
ds_list_add(WARNING, noti);
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ function Panel_Collection() : PanelContent() constructor {
|
|||
var node_list = ds_list_size(nodes);
|
||||
var node_count = node_list + array_length(steamNode);
|
||||
var hh = 0;
|
||||
var frame = current_time * PREF_MAP[? "collection_preview_speed"] / 3000;
|
||||
var frame = current_time * PREFERENCES.collection_preview_speed / 3000;
|
||||
var _cw = contentPane.surface_w;
|
||||
var _hover = pHOVER && contentPane.hover;
|
||||
|
||||
|
|
|
@ -854,7 +854,7 @@ function PanelContent() constructor {
|
|||
pFOCUS = false;
|
||||
pHOVER = false;
|
||||
|
||||
in_dialog = false;
|
||||
in_dialog = false;
|
||||
|
||||
dragSurface = surface_create(1, 1);
|
||||
showHeader = true;
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
//if(!directory_exists(DIRECTORY + "layouts"))
|
||||
zip_unzip("data/Layouts.zip", DIRECTORY);
|
||||
|
||||
var file = DIRECTORY + "layouts/" + PREF_MAP[? "panel_layout_file"] + ".json";
|
||||
var file = $"{DIRECTORY}layouts/{PREFERENCES.panel_layout_file}.json";
|
||||
if(!file_exists(file))
|
||||
file = DIRECTORY + "layouts/Horizontal.json";
|
||||
loadPanel(file, PANEL_MAIN);
|
||||
|
@ -354,7 +354,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var panel = PREF_MAP[? "expand_hover"]? HOVER : FOCUS;
|
||||
var panel = PREFERENCES.expand_hover? HOVER : FOCUS;
|
||||
|
||||
if(panel == noone) return;
|
||||
if(!is_struct(panel)) return;
|
||||
|
|
|
@ -46,7 +46,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
graph_zoom_m = 0;
|
||||
graph_zoom_s = 0;
|
||||
|
||||
drag_key = PREF_MAP[? "pan_mouse_key"];
|
||||
drag_key = PREFERENCES.pan_mouse_key;
|
||||
drag_locking = false;
|
||||
#endregion
|
||||
|
||||
|
@ -185,7 +185,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
],
|
||||
[
|
||||
THEME.icon_curve_connection,
|
||||
function() { return PREF_MAP[? "curve_connection_line"]; },
|
||||
function() { return PREFERENCES.curve_connection_line; },
|
||||
function() { return __txtx("panel_graph_connection_line", "Connection render settings"); },
|
||||
function(param) {
|
||||
dialogPanelCall(new Panel_Graph_Connection_Setting(), param.x, param.y, { anchor: ANCHOR.bottom | ANCHOR.left });
|
||||
|
@ -259,11 +259,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
addHotkey("Graph", "Paste", "V", MOD_KEY.ctrl, function() { PANEL_GRAPH.doPaste(); });
|
||||
|
||||
addHotkey("Graph", "Pan", "", MOD_KEY.alt, function() {
|
||||
if(PREF_MAP[? "alt_picker"]) return;
|
||||
if(PREFERENCES.alt_picker) return;
|
||||
PANEL_GRAPH.graph_dragging_key = true;
|
||||
});
|
||||
addHotkey("Graph", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, function() {
|
||||
if(PREF_MAP[? "alt_picker"]) return;
|
||||
if(PREFERENCES.alt_picker) return;
|
||||
PANEL_GRAPH.graph_zooming_key = true;
|
||||
});
|
||||
#endregion
|
||||
|
@ -633,9 +633,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var _doDragging = false;
|
||||
var _doZooming = false;
|
||||
|
||||
if(mouse_press(PREF_MAP[? "pan_mouse_key"])) {
|
||||
if(mouse_press(PREFERENCES.pan_mouse_key)) {
|
||||
_doDragging = true;
|
||||
drag_key = PREF_MAP[? "pan_mouse_key"];
|
||||
drag_key = PREFERENCES.pan_mouse_key;
|
||||
} else if(mouse_press(mb_left) && graph_dragging_key) {
|
||||
_doDragging = true;
|
||||
drag_key = mb_left;
|
||||
|
@ -680,7 +680,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
graph_s = lerp_float(graph_s, graph_s_to, PREF_MAP[? "graph_zoom_smoooth"]);
|
||||
graph_s = lerp_float(graph_s, graph_s_to, PREFERENCES.graph_zoom_smoooth);
|
||||
|
||||
if(_s != graph_s) {
|
||||
var mb_x = (mx - graph_x * _s) / _s;
|
||||
|
@ -740,7 +740,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
function drawNodes() { #region
|
||||
if(selection_block-- > 0) return;
|
||||
//print("==== DRAW NODES ====");
|
||||
display_parameter.highlight = (!ds_list_empty(nodes_select_list) || node_focus != noone) * PREF_MAP[? "connection_line_highlight"];
|
||||
display_parameter.highlight = (!ds_list_empty(nodes_select_list) || node_focus != noone) * PREFERENCES.connection_line_highlight;
|
||||
|
||||
var gr_x = graph_x * graph_s;
|
||||
var gr_y = graph_y * graph_s;
|
||||
|
@ -909,7 +909,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
#endregion
|
||||
printIf(log, "Draw active: " + string(current_time - t)); t = current_time;
|
||||
|
||||
var aa = PREF_MAP[? "connection_line_aa"];
|
||||
var aa = min(8192 / w, 8192 / h, PREFERENCES.connection_line_aa);
|
||||
connection_surface = surface_verify(connection_surface, w * aa, h * aa);
|
||||
connection_surface_aa = surface_verify(connection_surface_aa, w, h);
|
||||
surface_set_target(connection_surface);
|
||||
|
|
|
@ -7,51 +7,51 @@ function Panel_Graph_Connection_Setting() : Panel_Linear_Setting() constructor {
|
|||
properties = [
|
||||
[
|
||||
new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
|
||||
function(val) { PREF_MAP[? "curve_connection_line"] = val; }),
|
||||
function(val) { PREFERENCES.curve_connection_line = val; }),
|
||||
__txt("Type"),
|
||||
function() { return PREF_MAP[? "curve_connection_line"]; }
|
||||
function() { return PREFERENCES.curve_connection_line; }
|
||||
],
|
||||
[
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_width"] = max(0.5, real(str));
|
||||
PREFERENCES.connection_line_width = max(0.5, real(str));
|
||||
}),
|
||||
__txtx("dialog_connection_thickness", "Line thickness"),
|
||||
function() { return PREF_MAP[? "connection_line_width"]; }
|
||||
function() { return PREFERENCES.connection_line_width; }
|
||||
],
|
||||
[
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_corner"] = max(0, real(str));
|
||||
PREFERENCES.connection_line_corner = max(0, real(str));
|
||||
}).setSlidable(),
|
||||
__txtx("dialog_connection_radius", "Corner radius"),
|
||||
function() { return PREF_MAP[? "connection_line_corner"]; }
|
||||
function() { return PREFERENCES.connection_line_corner; }
|
||||
],
|
||||
[
|
||||
new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PREF_MAP[? "connection_line_aa"] = max(1, real(str));
|
||||
PREFERENCES.connection_line_aa = clamp(real(str), 1, 4);
|
||||
}),
|
||||
__txtx("pref_connection_quality", "Render quality"),
|
||||
function() { return PREF_MAP[? "connection_line_aa"]; }
|
||||
function() { return PREFERENCES.connection_line_aa; }
|
||||
],
|
||||
[
|
||||
new buttonGroup([ "None", "ALT", "Always" ], function(val) {
|
||||
PREF_MAP[? "connection_line_highlight"] = val;
|
||||
PREFERENCES.connection_line_highlight = val;
|
||||
}),
|
||||
__txtx("pref_connection_highlight", "Highlight connection"),
|
||||
function() { return PREF_MAP[? "connection_line_highlight"]; }
|
||||
function() { return PREFERENCES.connection_line_highlight; }
|
||||
],
|
||||
[
|
||||
new slider(0, 1, 0.05, function(val) {
|
||||
PREF_MAP[? "connection_line_highlight_fade"] = val;
|
||||
PREFERENCES.connection_line_highlight_fade = val;
|
||||
}),
|
||||
__txtx("pref_connection_highlight_fade", "Fade connection"),
|
||||
function() { return PREF_MAP[? "connection_line_highlight_fade"] },
|
||||
function() { return PREFERENCES.connection_line_highlight_fade },
|
||||
],
|
||||
[
|
||||
new checkBox(function() {
|
||||
PREF_MAP[? "connection_line_highlight_all"] = !PREF_MAP[? "connection_line_highlight_all"];
|
||||
PREFERENCES.connection_line_highlight_all = !PREFERENCES.connection_line_highlight_all;
|
||||
}),
|
||||
__txtx("pref_connection_highlight_all", "Highlight all"),
|
||||
function() { return PREF_MAP[? "connection_line_highlight_all"] },
|
||||
function() { return PREFERENCES.connection_line_highlight_all },
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ function graph_export_image(allList, nodeList, settings = {}) {
|
|||
var bbox_w = bbox_x1 - bbox_x0;
|
||||
var bbox_h = bbox_y1 - bbox_y0;
|
||||
|
||||
var aa = PREF_MAP[? "connection_line_aa"];
|
||||
var aa = PREFERENCES.connection_line_aa;
|
||||
var s = surface_create(bbox_w, bbox_h);
|
||||
var cs = surface_create(bbox_w * aa, bbox_h * aa);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
addHotkey("Inspector", "Toggle animation", "I", MOD_KEY.none, function() { PANEL_INSPECTOR.anim_toggling = true; });
|
||||
|
||||
addHotkey("", "Color picker", "", MOD_KEY.alt, function() {
|
||||
if(!PREF_MAP[? "alt_picker"]) return;
|
||||
if(!PREFERENCES.alt_picker) return;
|
||||
PANEL_INSPECTOR.color_picking = true;
|
||||
});
|
||||
#endregion
|
||||
|
@ -773,7 +773,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
lineBreak = w < PREF_MAP[? "inspector_line_break_width"];
|
||||
lineBreak = w < PREFERENCES.inspector_line_break_width;
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), top_bar_h - ui(8), w - ui(16), h - top_bar_h);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
version_name_copy = 0;
|
||||
|
||||
if(PREF_MAP[? "panel_menu_right_control"])
|
||||
if(PREFERENCES.panel_menu_right_control)
|
||||
action_buttons = ["exit", "maximize", "minimize", "fullscreen"];
|
||||
else
|
||||
action_buttons = ["exit", "minimize", "maximize", "fullscreen"];
|
||||
|
@ -156,8 +156,8 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
}
|
||||
}),
|
||||
menuItem(__txtx("panel_menu_export_render_all", "Render disabled node when export"),
|
||||
function() { PREF_MAP[? "render_all_export"] = !PREF_MAP[? "render_all_export"]; },,,
|
||||
function() { return PREF_MAP[? "render_all_export"]; } ),
|
||||
function() { PREFERENCES.render_all_export = !PREFERENCES.render_all_export; },,,
|
||||
function() { return PREFERENCES.render_all_export; } ),
|
||||
]],
|
||||
[ __txt("Panels"), [
|
||||
menuItem(__txt("Workspace"), function(_dat) {
|
||||
|
@ -170,7 +170,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
array_push(arr, menuItem(__txtx("panel_menu_save_layout", "Save layout"), function() {
|
||||
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
|
||||
dia.name = PREF_MAP[? "panel_layout_file"];
|
||||
dia.name = PREFERENCES.panel_layout_file;
|
||||
dia.onModify = function(name) {
|
||||
var cont = panelSerialize();
|
||||
json_save_struct(DIRECTORY + "layouts/" + name + ".json", cont);
|
||||
|
@ -185,10 +185,10 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
for(var i = 0; i < array_length(lays); i++) {
|
||||
array_push(arr, menuItem(lays[i],
|
||||
function(_dat) {
|
||||
PREF_MAP[? "panel_layout_file"] = _dat.name;
|
||||
PREFERENCES.panel_layout_file = _dat.name;
|
||||
PREF_SAVE();
|
||||
setPanel();
|
||||
},,, function(item) { return item.name == PREF_MAP[? "panel_layout_file"]; } ));
|
||||
},,, function(item) { return item.name == PREFERENCES.panel_layout_file; } ));
|
||||
}
|
||||
|
||||
return submenuCall(_dat, arr);
|
||||
|
@ -315,7 +315,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
var yy = ui(8);
|
||||
|
||||
if(hori) {
|
||||
if(PREF_MAP[? "panel_menu_right_control"])
|
||||
if(PREFERENCES.panel_menu_right_control)
|
||||
xx = ui(24);
|
||||
else {
|
||||
xx = ui(140);
|
||||
|
@ -324,7 +324,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
var bx = xx;
|
||||
if(!PREF_MAP[? "panel_menu_right_control"])
|
||||
if(!PREFERENCES.panel_menu_right_control)
|
||||
bx = w - ui(24);
|
||||
|
||||
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white);
|
||||
|
@ -344,7 +344,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(hori) {
|
||||
if(PREF_MAP[? "panel_menu_right_control"])
|
||||
if(PREFERENCES.panel_menu_right_control)
|
||||
xx += ui(20);
|
||||
else
|
||||
xx += ui(8);
|
||||
|
@ -514,7 +514,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
#endregion
|
||||
|
||||
var x1 = w - ui(6);
|
||||
if(PREF_MAP[? "panel_menu_right_control"])
|
||||
if(PREFERENCES.panel_menu_right_control)
|
||||
x1 = w - ui(6);
|
||||
else
|
||||
x1 = ui(8 + 28);
|
||||
|
@ -580,14 +580,14 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
break;
|
||||
}
|
||||
|
||||
if(PREF_MAP[? "panel_menu_right_control"])
|
||||
if(PREFERENCES.panel_menu_right_control)
|
||||
x1 -= bs + ui(4);
|
||||
else
|
||||
x1 += bs + ui(4);
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(!PREF_MAP[? "panel_menu_right_control"]) x1 = w - ui(40);
|
||||
if(!PREFERENCES.panel_menu_right_control) x1 = w - ui(40);
|
||||
|
||||
#region version
|
||||
var txt = "v. " + string(VERSION_STRING);
|
||||
|
|
|
@ -274,11 +274,11 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, function() { PROJECT.previewGrid.show = !PROJECT.previewGrid.show; });
|
||||
|
||||
addHotkey("Preview", "Pan", "", MOD_KEY.alt, function() {
|
||||
if(PREF_MAP[? "alt_picker"]) return;
|
||||
if(PREFERENCES.alt_picker) return;
|
||||
PANEL_PREVIEW.canvas_dragging_key = true;
|
||||
});
|
||||
addHotkey("Preview", "Zoom", "", MOD_KEY.alt | MOD_KEY.ctrl, function() {
|
||||
if(PREF_MAP[? "alt_picker"]) return;
|
||||
if(PREFERENCES.alt_picker) return;
|
||||
PANEL_PREVIEW.canvas_zooming_key = true;
|
||||
});
|
||||
#endregion
|
||||
|
@ -386,9 +386,9 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
var _doDragging = false;
|
||||
var _doZooming = false;
|
||||
|
||||
if(mouse_press(PREF_MAP[? "pan_mouse_key"])) {
|
||||
if(mouse_press(PREFERENCES.pan_mouse_key)) {
|
||||
_doDragging = true;
|
||||
canvas_drag_key = PREF_MAP[? "pan_mouse_key"];
|
||||
canvas_drag_key = PREFERENCES.pan_mouse_key;
|
||||
} else if(mouse_press(mb_left) && canvas_dragging_key) {
|
||||
_doDragging = true;
|
||||
canvas_drag_key = mb_left;
|
||||
|
@ -470,9 +470,9 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
var _doDragging = false;
|
||||
var _doZooming = false;
|
||||
|
||||
if(mouse_press(PREF_MAP[? "pan_mouse_key"])) {
|
||||
if(mouse_press(PREFERENCES.pan_mouse_key)) {
|
||||
_doDragging = true;
|
||||
canvas_drag_key = PREF_MAP[? "pan_mouse_key"];
|
||||
canvas_drag_key = PREFERENCES.pan_mouse_key;
|
||||
} else if(mouse_press(mb_left) && canvas_dragging_key) {
|
||||
_doDragging = true;
|
||||
canvas_drag_key = mb_left;
|
||||
|
|
|
@ -53,17 +53,17 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
if(mouse_press(mb_left, pFOCUS)) {
|
||||
if(i == amo) {
|
||||
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
|
||||
dia.name = PREF_MAP[? "panel_layout_file"];
|
||||
dia.name = PREFERENCES.panel_layout_file;
|
||||
dia.onModify = function(name) {
|
||||
var cont = panelSerialize();
|
||||
json_save_struct(DIRECTORY + "layouts/" + name + ".json", cont);
|
||||
json_save_struct($"{DIRECTORY}layouts/{name}.json", cont);
|
||||
|
||||
PREF_MAP[? "panel_layout_file"] = name;
|
||||
PREFERENCES.panel_layout_file = name;
|
||||
PREF_SAVE();
|
||||
refreshContent();
|
||||
};
|
||||
} else {
|
||||
PREF_MAP[? "panel_layout_file"] = str;
|
||||
PREFERENCES.panel_layout_file = str;
|
||||
PREF_SAVE();
|
||||
setPanel();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
layout_selecting = str;
|
||||
menuCall("workspace_menu",,, [
|
||||
menuItem(__txt("Select"), function() {
|
||||
PREF_MAP[? "panel_layout_file"] = layout_selecting;
|
||||
PREFERENCES.panel_layout_file = layout_selecting;
|
||||
PREF_SAVE();
|
||||
setPanel();
|
||||
}),
|
||||
|
@ -90,7 +90,7 @@ function Panel_Workspace() : PanelContent() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
draw_set_color(PREF_MAP[? "panel_layout_file"] == str? COLORS._main_text : COLORS._main_text_sub)
|
||||
draw_set_color(PREFERENCES.panel_layout_file == str? COLORS._main_text : COLORS._main_text_sub)
|
||||
draw_text_add(hori? x0 + ui(8) : (x0 + x1) / 2, y0 + ui(4), str);
|
||||
|
||||
if(hori) {
|
||||
|
|
|
@ -1,82 +1,76 @@
|
|||
#region data
|
||||
globalvar PREF_MAP;
|
||||
PREF_MAP = ds_map_create();
|
||||
#endregion
|
||||
#region preference
|
||||
globalvar PREFERENCES;
|
||||
PREFERENCES = {};
|
||||
|
||||
#region pref map
|
||||
PREF_MAP[? "ui_framerate"] = 60;
|
||||
PREF_MAP[? "path_resolution"] = 32;
|
||||
PREFERENCES.ui_framerate = 60;
|
||||
PREFERENCES.path_resolution = 32;
|
||||
|
||||
PREF_MAP[? "double_click_delay"] = 0.25;
|
||||
PREF_MAP[? "mouse_wheel_speed"] = 1.00;
|
||||
PREFERENCES.double_click_delay = 0.25;
|
||||
PREFERENCES.mouse_wheel_speed = 1.00;
|
||||
|
||||
PREF_MAP[? "keyboard_repeat_start"] = 0.50;
|
||||
PREF_MAP[? "keyboard_repeat_speed"] = 0.10;
|
||||
PREFERENCES.keyboard_repeat_start = 0.50;
|
||||
PREFERENCES.keyboard_repeat_speed = 0.10;
|
||||
|
||||
PREF_MAP[? "show_splash"] = true;
|
||||
PREF_MAP[? "splash_expand_recent"] = false;
|
||||
PREF_MAP[? "notification_time"] = 180;
|
||||
PREFERENCES.show_splash = true;
|
||||
PREFERENCES.splash_expand_recent = false;
|
||||
PREFERENCES.notification_time = 180;
|
||||
|
||||
PREF_MAP[? "display_scaling"] = 1;
|
||||
PREFERENCES.display_scaling = 1;
|
||||
PREFERENCES.window_width = 1600;
|
||||
PREFERENCES.window_height = 800;
|
||||
PREFERENCES.window_maximize = false;
|
||||
|
||||
PREF_MAP[? "window_width"] = 1600;
|
||||
PREF_MAP[? "window_height"] = 800;
|
||||
PREF_MAP[? "window_maximize"] = false;
|
||||
PREFERENCES.connection_line_width = 2;
|
||||
PREFERENCES.connection_line_sample = 1;
|
||||
PREFERENCES.connection_line_corner = 8;
|
||||
PREFERENCES.connection_line_aa = 2;
|
||||
PREFERENCES.connection_line_transition = true;
|
||||
PREFERENCES.connection_line_highlight = 0;
|
||||
PREFERENCES.connection_line_highlight_fade = 0.75;
|
||||
PREFERENCES.connection_line_highlight_all = false;
|
||||
PREFERENCES.curve_connection_line = 1;
|
||||
|
||||
PREF_MAP[? "connection_line_width"] = 2;
|
||||
PREF_MAP[? "connection_line_sample"] = 1;
|
||||
PREF_MAP[? "connection_line_corner"] = 8;
|
||||
PREF_MAP[? "connection_line_aa"] = 2;
|
||||
PREF_MAP[? "connection_line_transition"] = true;
|
||||
PREF_MAP[? "connection_line_highlight"] = 0;
|
||||
PREF_MAP[? "connection_line_highlight_fade"] = 0.75;
|
||||
PREF_MAP[? "connection_line_highlight_all"] = false;
|
||||
PREF_MAP[? "curve_connection_line"] = 1;
|
||||
PREFERENCES.default_surface_side = 32;
|
||||
|
||||
PREF_MAP[? "default_surface_side"] = 32;
|
||||
PREFERENCES.panel_layout_file = "Vertical";
|
||||
PREFERENCES.panel_graph_dragging = MOD_KEY.alt;
|
||||
PREFERENCES.panel_preview_dragging = MOD_KEY.alt;
|
||||
|
||||
PREF_MAP[? "panel_layout_file"] = "Vertical";
|
||||
PREF_MAP[? "panel_graph_dragging"] = MOD_KEY.alt;
|
||||
PREF_MAP[? "panel_preview_dragging"] = MOD_KEY.alt;
|
||||
PREFERENCES.inspector_line_break_width = 500;
|
||||
|
||||
PREF_MAP[? "inspector_line_break_width"] = 500;
|
||||
PREFERENCES.node_show_render_status = false;
|
||||
PREFERENCES.node_show_time = true;
|
||||
|
||||
PREF_MAP[? "node_show_render_status"] = false;
|
||||
PREF_MAP[? "node_show_time"] = true;
|
||||
PREFERENCES.collection_preview_speed = 60;
|
||||
PREFERENCES.expand_hover = false;
|
||||
|
||||
PREF_MAP[? "collection_preview_speed"] = 60;
|
||||
PREF_MAP[? "expand_hover"] = false;
|
||||
PREFERENCES.graph_zoom_smoooth = 4;
|
||||
|
||||
PREF_MAP[? "graph_zoom_smoooth"] = 4;
|
||||
PREFERENCES.theme = "default";
|
||||
PREFERENCES.local = "en";
|
||||
|
||||
PREF_MAP[? "theme"] = "default";
|
||||
PREF_MAP[? "local"] = "en";
|
||||
PREFERENCES.dialog_add_node_grouping = true;
|
||||
PREFERENCES.dialog_add_node_view = 0;
|
||||
|
||||
PREF_MAP[? "dialog_add_node_grouping"] = true;
|
||||
PREF_MAP[? "dialog_add_node_view"] = 0;
|
||||
PREFERENCES.physics_gravity = [ 0, 10 ];
|
||||
|
||||
PREF_MAP[? "physics_gravity"] = [ 0, 10 ];
|
||||
PREFERENCES.test_mode = false;
|
||||
PREFERENCES.auto_save_time = 300;
|
||||
PREFERENCES.use_legacy_exception = false;
|
||||
|
||||
PREF_MAP[? "test_mode"] = false;
|
||||
PREFERENCES.dialog_add_node_w = 532;
|
||||
PREFERENCES.dialog_add_node_h = 400;
|
||||
|
||||
PREF_MAP[? "auto_save_time"] = 300;
|
||||
PREF_MAP[? "use_legacy_exception"] = false;
|
||||
PREFERENCES.panel_menu_resource_monitor = false;
|
||||
PREFERENCES.panel_menu_right_control = os_type == os_windows;
|
||||
|
||||
PREF_MAP[? "dialog_add_node_w"] = 532;
|
||||
PREF_MAP[? "dialog_add_node_h"] = 400;
|
||||
PREFERENCES.show_crash_dialog = false;
|
||||
PREFERENCES.save_file_minify = true;
|
||||
PREFERENCES.render_all_export = true;
|
||||
|
||||
PREF_MAP[? "panel_menu_resource_monitor"] = false;
|
||||
PREF_MAP[? "panel_menu_right_control"] = os_type == os_windows;
|
||||
|
||||
PREF_MAP[? "show_crash_dialog"] = false;
|
||||
|
||||
PREF_MAP[? "save_file_minify"] = true;
|
||||
|
||||
PREF_MAP[? "render_all_export"] = true;
|
||||
|
||||
PREF_MAP[? "alt_picker"] = true;
|
||||
PREF_MAP[? "clear_temp_on_close"] = true;
|
||||
PREF_MAP[? "pan_mouse_key"] = mb_middle;
|
||||
PREFERENCES.alt_picker = true;
|
||||
PREFERENCES.clear_temp_on_close = true;
|
||||
PREFERENCES.pan_mouse_key = mb_middle;
|
||||
#endregion
|
||||
|
||||
#region recent files
|
||||
|
@ -140,109 +134,81 @@
|
|||
|
||||
#region save load
|
||||
function PREF_SAVE() {
|
||||
var map = ds_map_create();
|
||||
var map = {};
|
||||
|
||||
var save_l = ds_list_create();
|
||||
var save_l = [];
|
||||
for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
|
||||
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];
|
||||
|
||||
for(var i = 0; i < ds_list_size(ll); i++) {
|
||||
ds_list_add(save_l, ll[| i].serialize());
|
||||
ds_list_mark_as_list(save_l, ds_list_size(save_l) - 1);
|
||||
}
|
||||
for(var i = 0; i < ds_list_size(ll); i++)
|
||||
array_push(save_l, ll[| i].serialize());
|
||||
}
|
||||
|
||||
ds_map_add_list(map, "key", save_l);
|
||||
map.key = save_l;
|
||||
|
||||
PREF_MAP[? "window_maximize"] = gameframe_is_maximized();
|
||||
PREF_MAP[? "window_width"] = WIN_W;
|
||||
PREF_MAP[? "window_height"] = WIN_H;
|
||||
PREFERENCES.window_maximize = gameframe_is_maximized();
|
||||
PREFERENCES.window_width = WIN_W;
|
||||
PREFERENCES.window_height = WIN_H;
|
||||
|
||||
var _pref = ds_map_create();
|
||||
ds_map_override(_pref, PREF_MAP);
|
||||
ds_map_arr_to_list(_pref);
|
||||
ds_map_add_map(map, "preferences", _pref);
|
||||
|
||||
var path = DIRECTORY + "keys.json";
|
||||
file_text_write_all(path, json_encode_minify(map));
|
||||
ds_map_destroy(map);
|
||||
map.preferences = PREFERENCES;
|
||||
|
||||
json_save_struct(DIRECTORY + "keys.json", map);
|
||||
json_save_struct(DIRECTORY + "Nodes/fav.json", global.FAV_NODES);
|
||||
json_save_struct(DIRECTORY + "Nodes/recent.json", global.RECENT_NODES);
|
||||
|
||||
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
||||
json_save_struct(DIRECTORY + "key_nodes.json", HOTKEYS_CUSTOM);
|
||||
}
|
||||
|
||||
function PREF_LOAD() {
|
||||
var path = DIRECTORY + "keys.json";
|
||||
if(!file_exists(path)) return;
|
||||
|
||||
var load_str = file_text_read_all(path);
|
||||
var map = json_decode(load_str);
|
||||
var map = json_load_struct(path);
|
||||
|
||||
if(ds_map_exists(map, "key")) {
|
||||
var key = map[? "key"];
|
||||
for(var i = 0; i < ds_list_size(key); i++) {
|
||||
var key_list = key[| i];
|
||||
var _context = key_list[| 0];
|
||||
var name = key_list[| 1];
|
||||
var key = map.key;
|
||||
for(var i = 0; i < array_length(key); i++) {
|
||||
var key_list = key[i];
|
||||
var _context = is_struct(key_list)? key_list.context : key_list[0];
|
||||
var name = is_struct(key_list)? key_list.name : key_list[1];
|
||||
|
||||
var _key = find_hotkey(_context, name);
|
||||
if(_key) _key.deserialize(key_list);
|
||||
}
|
||||
var _key = find_hotkey(_context, name);
|
||||
if(_key) _key.deserialize(key_list);
|
||||
}
|
||||
|
||||
if(ds_map_exists(map, "preferences")) {
|
||||
ds_map_list_to_arr(map[? "preferences"]);
|
||||
ds_map_override(PREF_MAP, map[? "preferences"]);
|
||||
}
|
||||
struct_override(PREFERENCES, map.preferences);
|
||||
|
||||
ds_map_destroy(map);
|
||||
|
||||
if(!directory_exists(DIRECTORY + "Themes/" + PREF_MAP[? "theme"]))
|
||||
PREF_MAP[? "theme"] = "default";
|
||||
if(!directory_exists($"{DIRECTORY}Themes/{PREFERENCES.theme}"))
|
||||
PREFERENCES.theme = "default";
|
||||
|
||||
var f = json_load_struct(DIRECTORY + "key_nodes.json");
|
||||
struct_override(HOTKEYS_CUSTOM, f);
|
||||
|
||||
LOCALE_USE_DEFAULT = PREF_MAP[? "local"] == "en";
|
||||
LOCALE_USE_DEFAULT = PREFERENCES.local == "en";
|
||||
}
|
||||
|
||||
function PREF_APPLY() {
|
||||
if(PREF_MAP[? "double_click_delay"] > 1)
|
||||
PREF_MAP[? "double_click_delay"] /= 60;
|
||||
if(PREFERENCES.double_click_delay > 1)
|
||||
PREFERENCES.double_click_delay /= 60;
|
||||
|
||||
if(ds_map_exists(PREF_MAP, "test_mode"))
|
||||
TESTING = PREF_MAP[? "test_mode"];
|
||||
TESTING = struct_try_get(PREFERENCES, "test_mode", false);
|
||||
|
||||
if(ds_map_exists(PREF_MAP, "use_legacy_exception")) {
|
||||
if(PREF_MAP[? "use_legacy_exception"])
|
||||
resetException();
|
||||
else
|
||||
setException();
|
||||
}
|
||||
if(PREFERENCES.use_legacy_exception) resetException();
|
||||
else setException();
|
||||
|
||||
if(OS != os_macosx && !LOADING) {
|
||||
if(PREF_MAP[? "window_maximize"]) {
|
||||
if(PREFERENCES.window_maximize) {
|
||||
gameframe_maximize();
|
||||
} else {
|
||||
var ww = PREF_MAP[? "window_width"];
|
||||
var hh = PREF_MAP[? "window_height"];
|
||||
var ww = PREFERENCES.window_width;
|
||||
var hh = PREFERENCES.window_height;
|
||||
|
||||
window_set_position(display_get_width() / 2 - ww / 2, display_get_height() / 2 - hh / 2);
|
||||
window_set_size(ww, hh);
|
||||
}
|
||||
}
|
||||
game_set_speed(PREF_MAP[? "ui_framerate"], gamespeed_fps);
|
||||
game_set_speed(PREFERENCES.ui_framerate, gamespeed_fps);
|
||||
|
||||
if(ds_map_exists(PREF_MAP, "physics_gravity")) {
|
||||
var grav = PREF_MAP[? "physics_gravity"];
|
||||
if(!is_array(grav)) {
|
||||
grav = [0, 10];
|
||||
PREF_MAP[? "physics_gravity"] = grav;
|
||||
}
|
||||
physics_world_gravity(array_safe_get(grav, 0, 0), array_safe_get(grav, 1, 10));
|
||||
}
|
||||
var grav = struct_try_get(PREFERENCES, "physics_gravity", [ 0, 10 ]);
|
||||
physics_world_gravity(array_safe_get(grav, 0, 0), array_safe_get(grav, 1, 10));
|
||||
}
|
||||
|
||||
function find_hotkey(_context, _name) {
|
||||
|
|
|
@ -50,13 +50,13 @@ function save_serialize(project = PROJECT, _outMap = false) {
|
|||
var _addon = {};
|
||||
with(_addon_custom) {
|
||||
var _ser = lua_call(thread, "serialize");
|
||||
_addon[$ name] = PREF_MAP[? "save_file_minify"]? json_stringify_minify(_ser) : json_stringify(_ser);
|
||||
_addon[$ name] = PREFERENCES.save_file_minify? json_stringify_minify(_ser) : json_stringify(_ser);
|
||||
}
|
||||
_map.addon = _addon;
|
||||
|
||||
if(_outMap) return _map;
|
||||
|
||||
return PREF_MAP[? "save_file_minify"]? json_stringify_minify(_map) : json_stringify(_map, true);
|
||||
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
|
||||
}
|
||||
|
||||
function SET_PATH(project, path) {
|
||||
|
@ -155,7 +155,7 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c
|
|||
SAVE_NODE(_nodes, _list[| i], cx, cy, true, context);
|
||||
_content.nodes = _nodes;
|
||||
|
||||
json_save_struct(_path, _content, !PREF_MAP[? "save_file_minify"]);
|
||||
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||
|
||||
if(metadata != noone) {
|
||||
var _meta = metadata.serialize();
|
||||
|
@ -189,7 +189,7 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co
|
|||
SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context);
|
||||
_content.nodes = _nodes;
|
||||
|
||||
json_save_struct(_path, _content, !PREF_MAP[? "save_file_minify"]);
|
||||
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||
|
||||
if(metadata != noone) {
|
||||
var _meta = metadata.serialize();
|
||||
|
|
|
@ -11,8 +11,8 @@ function __initTheme() {
|
|||
log_message("THEME", $"unzipping default theme to {root}.");
|
||||
zip_unzip("data/themes/default.zip", root);
|
||||
|
||||
loadGraphic(PREF_MAP[? "theme"]);
|
||||
loadColor(PREF_MAP[? "theme"]);
|
||||
loadGraphic(PREFERENCES.theme);
|
||||
loadColor(PREFERENCES.theme);
|
||||
}
|
||||
|
||||
function _sprite_path(rel, theme) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function close_program() {
|
||||
PREF_SAVE();
|
||||
if(PREF_MAP[? "clear_temp_on_close"]) directory_destroy(DIRECTORY + "temp");
|
||||
if(PREFERENCES.clear_temp_on_close) directory_destroy(DIRECTORY + "temp");
|
||||
game_end();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue