[Preference] Add option to adjust file watcher delay.

This commit is contained in:
Tanasart 2024-09-13 15:09:19 +07:00
parent 34e70c96a0
commit 3859bb0c7d
8 changed files with 30 additions and 11 deletions

View File

@ -3,7 +3,8 @@
#macro DIALOG_DRAW_BG draw_sprite_stretched(THEME.dialog, 0, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16);
#macro DIALOG_DRAW_FOCUS draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - 8, dialog_y - 8, dialog_w + 16, dialog_h + 16, COLORS._main_accent, 1);
#macro DIALOG_WINCLEAR if(window != noone) { winwin_draw_clear(COLORS.panel_bg_clear, 0); }
#macro DIALOG_WINCLEAR if(window != noone) { winwin_draw_clear(COLORS.panel_bg_clear, 0); }
#macro DIALOG_WINCLEAR1 if(window != noone) { winwin_draw_clear(COLORS.panel_bg_clear, 1); }
#macro DIALOG_PREDRAW if(window != noone) { winwin_draw_begin(window); WINDOW_ACTIVE = window; window_drawing = true; }
#macro DIALOG_POSTDRAW if(window != noone) { winwin_draw_end(); WINDOW_ACTIVE = noone; window_drawing = false; }

View File

@ -8,7 +8,7 @@ if !active exit;
#region window control
if(sFOCUS) {
if(destroy_on_escape && keyboard_check_pressed(vk_escape) && checkClosable())
instance_destroy(self);
instance_destroy();
}
#endregion

View File

@ -1,5 +1,6 @@
event_inherited();
if(submenu) instance_destroy(submenu);
if(instance_exists(submenu))
instance_destroy(submenu);
if(FOCUS == noone && instance_number(o_dialog_menubox) == 1) FOCUS = FOCUS_BEFORE;

View File

@ -2,14 +2,15 @@
if(!ready) exit;
DIALOG_PREDRAW
winwin_draw_clear(COLORS.panel_bg_clear, 1);
DIALOG_WINCLEAR1
#region draw
var yy = dialog_y;
var _lclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_left)) || (keyboard_check_pressed(vk_enter) && hk_editing == noone);
var _rclick = sFOCUS && !mouse_init_inside && !mouse_init_r_pressed && mouse_release(mb_right);
if(!mouse_init_inside && mouse_press(mb_right) && item_sel_submenu) {
instance_destroy(item_sel_submenu);
if(instance_exists(item_sel_submenu))
instance_destroy(item_sel_submenu);
item_sel_submenu = noone;
}
@ -75,9 +76,19 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1);
if(_menuItem.isShelf) {
FOCUS_CONTENT = context;
if(instance_exists(submenu)) {
var _sfr = submenu.itemFrom;
instance_destroy(submenu);
if(_sfr == _menuItem) {
submenu = noone;
continue;
}
}
var _res = _menuItem.func(_dat);
if(submenu) instance_destroy(submenu);
submenu = _res;
submenu.itemFrom = _menuItem;
} else if(remove_parents) {
DIALOG_POSTDRAW

View File

@ -1,6 +1,4 @@
/// @description Insert description here
event_inherited();
if(item_sel_submenu) {
if(!instance_exists(item_sel_submenu))
item_sel_submenu = noone;
@ -14,7 +12,8 @@ if(init_press_l) {
}
var hov = point_in(mouse_raw_x, mouse_raw_y);
if(submenu) hov |= submenu.point_in(mouse_raw_x, mouse_raw_y);
if(instance_exists(submenu))
hov |= submenu.point_in(mouse_raw_x, mouse_raw_y);
_hovering_ch = hov;
if(!hov && MOUSE_POOL.lpress) instance_destroy();

View File

@ -552,6 +552,12 @@ event_inherited();
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.node_3d_preview_size = clamp(val, 16, 1024); PREF_SAVE(); })
));
ds_list_add(pref_node, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_file_watcher_delay", "File watcher delay (s)"),
"file_watcher_delay",
new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { PREFERENCES.file_watcher_delay = val; PREF_SAVE(); })
));
#endregion
#region theme

View File

@ -269,7 +269,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
var p_arr = [];
for( var k = 0; k < array_length(plt); k++ )
array_push(p_arr, make_color_rgb(plt[k][0], plt[k][1], plt[k][2]));
array_push(p_arr, make_color_rgba(plt[k][0], plt[k][1], plt[k][2], plt[k][3]));
outputs[3].setValue(p_arr);
break;
@ -325,7 +325,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
if(file_get_modify_s(path_current) > edit_time) {
edit_time = max(edit_time, file_get_modify_s(path_current));
run_in(5, function() /*=>*/ { updatePaths(); triggerRender(); });
run_in_s(PREFERENCES.file_watcher_delay, function() /*=>*/ { updatePaths(); triggerRender(); });
}
}

View File

@ -50,6 +50,7 @@
PREFERENCES.keyboard_repeat_speed = 0.10;
PREFERENCES.keyboard_double_delay = 0.25;
PREFERENCES.file_watcher_delay = 0.1;
#endregion
#region ///////////////////////////////////////////////////////////////////////// DIALOG ////////////////////////////////////////////////////////////////////////