mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
Fix disabling auto update still make the node update in some case.
This commit is contained in:
parent
c26d7e14e2
commit
ba29167abf
33 changed files with 1599 additions and 265 deletions
|
@ -248,6 +248,7 @@
|
|||
{"name":"Spout","order":13,"path":"extensions/Spout/Spout.yy",},
|
||||
{"name":"Steamworks","order":2,"path":"extensions/Steamworks/Steamworks.yy",},
|
||||
{"name":"TabletStuff","order":15,"path":"extensions/TabletStuff/TabletStuff.yy",},
|
||||
{"name":"winwin","order":5,"path":"extensions/winwin/winwin.yy",},
|
||||
{"name":"YYFirebaseFirestore","order":1,"path":"extensions/YYFirebaseFirestore/YYFirebaseFirestore.yy",},
|
||||
{"name":"_f_code_s","order":18,"path":"fonts/_f_code_s/_f_code_s.yy",},
|
||||
{"name":"_f_code","order":9,"path":"fonts/_f_code/_f_code.yy",},
|
||||
|
@ -1377,6 +1378,7 @@
|
|||
{"name":"wav_file_object","order":2,"path":"scripts/wav_file_object/wav_file_object.yy",},
|
||||
{"name":"widget","order":5,"path":"scripts/widget/widget.yy",},
|
||||
{"name":"window_functions","order":2,"path":"scripts/window_functions/window_functions.yy",},
|
||||
{"name":"winwin_extras","order":6,"path":"scripts/winwin_extras/winwin_extras.yy",},
|
||||
{"name":"sh_2d_light","order":10,"path":"shaders/sh_2d_light/sh_2d_light.yy",},
|
||||
{"name":"sh_3d_depth","order":6,"path":"shaders/sh_3d_depth/sh_3d_depth.yy",},
|
||||
{"name":"sh_3d_extrude_corner","order":7,"path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},
|
||||
|
|
|
@ -680,6 +680,8 @@
|
|||
{"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"winwin.html","CopyToMask":-1,"filePath":"datafiles","name":"winwin.html","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"winwin.html","CopyToMask":-1,"filePath":"datafiles","name":"winwin.html","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
],
|
||||
"isEcma":false,
|
||||
"LibraryEmitters":[],
|
||||
|
@ -713,6 +715,7 @@
|
|||
{"id":{"name":"Spout","path":"extensions/Spout/Spout.yy",},},
|
||||
{"id":{"name":"Steamworks","path":"extensions/Steamworks/Steamworks.yy",},},
|
||||
{"id":{"name":"TabletStuff","path":"extensions/TabletStuff/TabletStuff.yy",},},
|
||||
{"id":{"name":"winwin","path":"extensions/winwin/winwin.yy",},},
|
||||
{"id":{"name":"YYFirebaseFirestore","path":"extensions/YYFirebaseFirestore/YYFirebaseFirestore.yy",},},
|
||||
{"id":{"name":"_f_code_s","path":"fonts/_f_code_s/_f_code_s.yy",},},
|
||||
{"id":{"name":"_f_code","path":"fonts/_f_code/_f_code.yy",},},
|
||||
|
@ -2025,6 +2028,7 @@
|
|||
{"id":{"name":"widget","path":"scripts/widget/widget.yy",},},
|
||||
{"id":{"name":"window_functions","path":"scripts/window_functions/window_functions.yy",},},
|
||||
{"id":{"name":"windowManager","path":"scripts/windowManager/windowManager.yy",},},
|
||||
{"id":{"name":"winwin_extras","path":"scripts/winwin_extras/winwin_extras.yy",},},
|
||||
{"id":{"name":"sh_2d_light","path":"shaders/sh_2d_light/sh_2d_light.yy",},},
|
||||
{"id":{"name":"sh_3d_depth","path":"shaders/sh_3d_depth/sh_3d_depth.yy",},},
|
||||
{"id":{"name":"sh_3d_extrude_corner","path":"shaders/sh_3d_extrude_corner/sh_3d_extrude_corner.yy",},},
|
||||
|
|
1049
datafiles/winwin.html
Normal file
1049
datafiles/winwin.html
Normal file
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,10 @@
|
|||
#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_PREDRAW if(window != noone) { winwin_draw_begin(window); WINDOW_ACTIVE = window; }
|
||||
#macro DIALOG_POSTDRAW if(window != noone) { winwin_draw_end(); WINDOW_ACTIVE = noone; }
|
||||
|
||||
#region data
|
||||
on_top = false;
|
||||
|
||||
|
@ -21,6 +25,9 @@
|
|||
dialog_x = 0;
|
||||
dialog_y = 0;
|
||||
|
||||
title = "dialog";
|
||||
window = noone;
|
||||
|
||||
title_height = 64;
|
||||
padding = 20;
|
||||
|
||||
|
@ -55,26 +62,83 @@
|
|||
mouse_active = true;
|
||||
if(!draggable) return;
|
||||
|
||||
if(dialog_dragging) {
|
||||
dialog_x = clamp(dialog_drag_sx + mouse_mx - dialog_drag_mx, ui(16) - dialog_w, WIN_W - ui(16));
|
||||
dialog_y = clamp(dialog_drag_sy + mouse_my - dialog_drag_my, ui(16) - dialog_h, WIN_H - ui(16));
|
||||
WINDOW_ACTIVE = window;
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
dialog_dragging = false;
|
||||
}
|
||||
|
||||
if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + ui(title_height))) {
|
||||
mouse_active = false;
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_dragging = true;
|
||||
dialog_drag_sx = dialog_x;
|
||||
dialog_drag_sy = dialog_y;
|
||||
dialog_drag_mx = mouse_mx;
|
||||
dialog_drag_my = mouse_my;
|
||||
if(window == noone) {
|
||||
if(dialog_dragging) {
|
||||
var _dx = dialog_drag_sx + mouse_mx - dialog_drag_mx;
|
||||
var _dy = dialog_drag_sy + mouse_my - dialog_drag_my;
|
||||
|
||||
var _wx = window_get_x();
|
||||
var _wy = window_get_y();
|
||||
|
||||
if(point_in_rectangle(mouse_raw_x, mouse_raw_y, _wx, _wy, _wx + WIN_W, _wy + WIN_H)) {
|
||||
dialog_x = clamp(_dx, ui(16) - dialog_w, WIN_W - ui(16));
|
||||
dialog_y = clamp(_dy, ui(16) - dialog_h, WIN_H - ui(16));
|
||||
|
||||
} else if(PREFERENCES.multi_window) {
|
||||
o_main.dialog_popup_to = 1;
|
||||
o_main.dialog_popup_x = mouse_mx;
|
||||
o_main.dialog_popup_y = mouse_my;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
var _wconfig = new winwin_config();
|
||||
_wconfig.kind = winwin_kind_borderless;
|
||||
_wconfig.caption = title;
|
||||
_wconfig.topmost = true;
|
||||
_wconfig.per_pixel_alpha = true;
|
||||
_wconfig.resize = true;
|
||||
_wconfig.owner = winwin_main;
|
||||
|
||||
window = winwin_create(_wx + _dx, _wy + _dy, dialog_w, dialog_h, _wconfig);
|
||||
dialog_x = 0;
|
||||
dialog_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
dialog_dragging = false;
|
||||
}
|
||||
|
||||
if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + title_height)) {
|
||||
mouse_active = false;
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_dragging = true;
|
||||
dialog_drag_sx = dialog_x;
|
||||
dialog_drag_sy = dialog_y;
|
||||
dialog_drag_mx = mouse_mx;
|
||||
dialog_drag_my = mouse_my;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(dialog_dragging) {
|
||||
var _dx = dialog_drag_sx + mouse_raw_x - dialog_drag_mx;
|
||||
var _dy = dialog_drag_sy + mouse_raw_y - dialog_drag_my;
|
||||
|
||||
winwin_set_position(window, _dx, _dy);
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
dialog_dragging = false;
|
||||
}
|
||||
|
||||
if(mouse_draggable && point_in_rectangle(mouse_mx, mouse_my, 0, 0, dialog_w, title_height)) {
|
||||
mouse_active = false;
|
||||
// print($"{mouse_mx}, {mouse_my} / {mouse_press(mb_left, sFOCUS)}");
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_dragging = true;
|
||||
dialog_drag_sx = winwin_get_x(window);
|
||||
dialog_drag_sy = winwin_get_y(window);
|
||||
dialog_drag_mx = mouse_raw_x;
|
||||
dialog_drag_my = mouse_raw_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mouse_draggable = true;
|
||||
WINDOW_ACTIVE = noone;
|
||||
}
|
||||
|
||||
dialog_resizable = false;
|
||||
|
@ -93,46 +157,99 @@
|
|||
if(!active) return;
|
||||
if(!dialog_resizable) return;
|
||||
|
||||
if(dialog_resizing & 1 << 0 != 0) {
|
||||
var ww = dialog_resiz_sw + (mouse_mx - dialog_resiz_mx);
|
||||
ww = clamp(ww, dialog_w_min, dialog_w_max);
|
||||
dialog_w = ww;
|
||||
}
|
||||
|
||||
if(dialog_resizing & 1 << 1 != 0) {
|
||||
var hh = dialog_resiz_sh + (mouse_my - dialog_resiz_my);
|
||||
hh = clamp(hh, dialog_h_min, dialog_h_max);
|
||||
dialog_h = hh;
|
||||
}
|
||||
|
||||
if(mouse_release(mb_left)) dialog_resizing = 0;
|
||||
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x + dialog_w, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h) < 12) {
|
||||
if(window == noone) {
|
||||
if(dialog_resizing & 1 << 0 != 0) {
|
||||
var ww = dialog_resiz_sw + (mouse_mx - dialog_resiz_mx);
|
||||
ww = clamp(ww, dialog_w_min, dialog_w_max);
|
||||
dialog_w = ww;
|
||||
}
|
||||
|
||||
mouse_active = false;
|
||||
CURSOR = cr_size_we;
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 0;
|
||||
dialog_resiz_sw = dialog_w;
|
||||
dialog_resiz_mx = mouse_mx;
|
||||
dialog_resiz_my = mouse_my;
|
||||
if(dialog_resizing & 1 << 1 != 0) {
|
||||
var hh = dialog_resiz_sh + (mouse_my - dialog_resiz_my);
|
||||
hh = clamp(hh, dialog_h_min, dialog_h_max);
|
||||
dialog_h = hh;
|
||||
}
|
||||
}
|
||||
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x, dialog_y + dialog_h, dialog_x + dialog_w, dialog_y + dialog_h) < 12) {
|
||||
if(mouse_release(mb_left)) dialog_resizing = 0;
|
||||
|
||||
mouse_active = false;
|
||||
if(CURSOR == cr_size_we)
|
||||
CURSOR = cr_size_nwse;
|
||||
else
|
||||
CURSOR = cr_size_ns;
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 1;
|
||||
dialog_resiz_sh = dialog_h;
|
||||
dialog_resiz_mx = mouse_mx;
|
||||
dialog_resiz_my = mouse_my;
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x + dialog_w, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h) < 12) {
|
||||
|
||||
mouse_active = false;
|
||||
CURSOR = cr_size_we;
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 0;
|
||||
dialog_resiz_sw = dialog_w;
|
||||
dialog_resiz_mx = mouse_mx;
|
||||
dialog_resiz_my = mouse_my;
|
||||
}
|
||||
}
|
||||
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_x, dialog_y + dialog_h, dialog_x + dialog_w, dialog_y + dialog_h) < 12) {
|
||||
|
||||
mouse_active = false;
|
||||
if(CURSOR == cr_size_we) CURSOR = cr_size_nwse;
|
||||
else CURSOR = cr_size_ns;
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 1;
|
||||
dialog_resiz_sh = dialog_h;
|
||||
dialog_resiz_mx = mouse_mx;
|
||||
dialog_resiz_my = mouse_my;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
WINDOW_ACTIVE = window;
|
||||
|
||||
var ww = dialog_resiz_sw;
|
||||
var hh = dialog_resiz_sh;
|
||||
|
||||
if(dialog_resizing & 1 << 0 != 0) {
|
||||
ww = dialog_resiz_sw + (mouse_raw_x - dialog_resiz_mx);
|
||||
ww = clamp(ww, dialog_w_min, dialog_w_max);
|
||||
}
|
||||
|
||||
if(dialog_resizing & 1 << 1 != 0) {
|
||||
hh = dialog_resiz_sh + (mouse_raw_y - dialog_resiz_my);
|
||||
hh = clamp(hh, dialog_h_min, dialog_h_max);
|
||||
}
|
||||
|
||||
if(dialog_resizing != 0) {
|
||||
winwin_set_size(window, ww, hh);
|
||||
if(mouse_release(mb_left)) dialog_resizing = 0;
|
||||
}
|
||||
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, dialog_w, 0, dialog_w, dialog_h) < 12) {
|
||||
|
||||
mouse_active = false;
|
||||
CURSOR = cr_size_we;
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 0;
|
||||
dialog_resiz_sw = dialog_w;
|
||||
dialog_resiz_sh = dialog_h;
|
||||
dialog_resiz_mx = mouse_raw_x;
|
||||
dialog_resiz_my = mouse_raw_y;
|
||||
}
|
||||
}
|
||||
|
||||
if(sHOVER && distance_to_line(mouse_mx, mouse_my, 0, dialog_h, dialog_w, dialog_h) < 12) {
|
||||
|
||||
mouse_active = false;
|
||||
if(CURSOR == cr_size_we) CURSOR = cr_size_nwse;
|
||||
else CURSOR = cr_size_ns;
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
dialog_resizing |= 1 << 1;
|
||||
dialog_resiz_sw = dialog_w;
|
||||
dialog_resiz_sh = dialog_h;
|
||||
dialog_resiz_mx = mouse_raw_x;
|
||||
dialog_resiz_my = mouse_raw_y;
|
||||
}
|
||||
}
|
||||
|
||||
winwin_set_cursor(window, CURSOR);
|
||||
WINDOW_ACTIVE = noone;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -152,27 +269,39 @@
|
|||
|
||||
function checkFocus() {
|
||||
if(!active) return;
|
||||
WINDOW_ACTIVE = window;
|
||||
|
||||
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx;
|
||||
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my;
|
||||
if(window == noone) {
|
||||
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx;
|
||||
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my;
|
||||
|
||||
if(point_in(_mx, _my)) {
|
||||
if(depth < DIALOG_DEPTH_HOVER) {
|
||||
DIALOG_DEPTH_HOVER = depth;
|
||||
HOVER = self.id;
|
||||
if(point_in(_mx, _my)) {
|
||||
if(depth < DIALOG_DEPTH_HOVER) {
|
||||
DIALOG_DEPTH_HOVER = depth;
|
||||
HOVER = self.id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(winwin_mouse_is_over(window))
|
||||
HOVER = self.id;
|
||||
}
|
||||
|
||||
WINDOW_ACTIVE = noone;
|
||||
}
|
||||
|
||||
function checkDepth() {
|
||||
if(!active) return;
|
||||
if(HOVER != self.id) return;
|
||||
|
||||
if(mouse_press(mb_any) && FOCUS != self.id) {
|
||||
WINDOW_ACTIVE = window;
|
||||
|
||||
if(mouse_press(mb_any)) {
|
||||
setFocus(self.id, "Dialog");
|
||||
|
||||
with(_p_dialog) other.depth = min(other.depth, depth - 1);
|
||||
}
|
||||
|
||||
WINDOW_ACTIVE = noone;
|
||||
}
|
||||
|
||||
function onFocusBegin() {}
|
||||
|
@ -203,6 +332,8 @@
|
|||
if(!active) return;
|
||||
if(!DIALOG_CLICK) return;
|
||||
|
||||
WINDOW_ACTIVE = window;
|
||||
|
||||
if(!init_pressing && mouse_press(mb_any)) {
|
||||
if(!isTop()) return;
|
||||
|
||||
|
|
|
@ -7,4 +7,6 @@ ds_list_remove(DIALOGS, self);
|
|||
|
||||
if(parent) array_remove(parent.children, id);
|
||||
|
||||
if(!passthrough) MOUSE_BLOCK = true;
|
||||
if(!passthrough) MOUSE_BLOCK = true;
|
||||
|
||||
if(window != noone) winwin_destroy(window);
|
3
objects/_p_dialog/Draw_73.gml
Normal file
3
objects/_p_dialog/Draw_73.gml
Normal file
|
@ -0,0 +1,3 @@
|
|||
if(window != noone) {
|
||||
winwin_draw_end();
|
||||
}
|
1
objects/_p_dialog/Draw_74.gml
Normal file
1
objects/_p_dialog/Draw_74.gml
Normal file
|
@ -0,0 +1 @@
|
|||
/// @description Insert description here
|
1
objects/_p_dialog/Draw_75.gml
Normal file
1
objects/_p_dialog/Draw_75.gml
Normal file
|
@ -0,0 +1 @@
|
|||
/// @description Insert description here
|
|
@ -13,10 +13,16 @@ if !active exit;
|
|||
#endregion
|
||||
|
||||
#region resize
|
||||
if(window != noone) {
|
||||
dialog_w = winwin_get_width(window);
|
||||
dialog_h = winwin_get_height(window);
|
||||
}
|
||||
|
||||
if(_dialog_h != dialog_h || _dialog_w != dialog_w) {
|
||||
_dialog_h = dialog_h;
|
||||
_dialog_w = dialog_w;
|
||||
|
||||
if(onResize != -1) onResize();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":74,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
],
|
||||
"managed":true,
|
||||
"name":"_p_dialog",
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
/// @description
|
||||
selector.colorPicker();
|
||||
|
||||
selector.colorPicker();
|
||||
event_inherited();
|
|
@ -1,2 +1,4 @@
|
|||
/// @description
|
||||
selector.colorPicker();
|
||||
|
||||
selector.colorPicker();
|
||||
event_inherited();
|
|
@ -1,2 +1,3 @@
|
|||
/// @description
|
||||
selector.colorPicker();
|
||||
selector.colorPicker();
|
||||
event_inherited();
|
|
@ -1,116 +1,125 @@
|
|||
/// @description
|
||||
if !ready exit;
|
||||
|
||||
#region base UI
|
||||
var p = ui(8);
|
||||
var m_in = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x + p, dialog_y + p, dialog_x + dialog_w - p, dialog_y + dialog_h - p);
|
||||
var m_ot = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h);
|
||||
|
||||
DIALOG_DRAW_BG
|
||||
#endregion
|
||||
DIALOG_PREDRAW
|
||||
DIALOG_WINCLEAR
|
||||
|
||||
#region content
|
||||
if(!is_undefined(content) && content != noone) {
|
||||
content.panel = self;
|
||||
|
||||
var cx = dialog_x + content.showHeader * padding;
|
||||
var cy = dialog_y + content.showHeader * (padding + title_height);
|
||||
content.x = cx;
|
||||
content.y = cy;
|
||||
content.onStepBegin();
|
||||
|
||||
content.pFOCUS = sFOCUS && m_in;
|
||||
content.pHOVER = sHOVER && m_in;
|
||||
|
||||
panel = surface_verify(panel, dialog_w - content.showHeader * padding * 2,
|
||||
dialog_h - content.showHeader * (padding * 2 + title_height));
|
||||
if(!is_surface(mask_surface))
|
||||
resetMask();
|
||||
|
||||
surface_set_target(panel);
|
||||
draw_clear(COLORS.panel_bg_clear);
|
||||
content.drawContent(panel);
|
||||
|
||||
gpu_set_blendmode(bm_subtract);
|
||||
draw_surface_safe(mask_surface);
|
||||
gpu_set_blendmode(bm_normal);
|
||||
surface_reset_target();
|
||||
|
||||
content.drawGUI();
|
||||
|
||||
draw_surface(panel, cx, cy);
|
||||
}
|
||||
#endregion
|
||||
title = content.title;
|
||||
var p = ui(8);
|
||||
var m_in = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x + p, dialog_y + p, dialog_x + dialog_w - p, dialog_y + dialog_h - p);
|
||||
var m_ot = point_in_rectangle(mouse_mxs, mouse_mys, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h);
|
||||
|
||||
#region overlay
|
||||
if(content.showHeader) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 3, dialog_x + 3, dialog_y + 3, dialog_w - 6, title_height + 2, COLORS._main_icon_light, 1);
|
||||
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_cut(dialog_x + ui(32), dialog_y + ui(8), content.title, dialog_w - ui(32 + 32));
|
||||
|
||||
var _bx = dialog_x + dialog_w - ui(28);
|
||||
var _by = dialog_y + ui(8);
|
||||
var _bs = ui(20);
|
||||
|
||||
if(instanceof(content) != "Panel_Menu")
|
||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, mouse_ui, sFOCUS, sHOVER, "", THEME.window_exit) == 2) {
|
||||
onDestroy();
|
||||
instance_destroy();
|
||||
}
|
||||
|
||||
_bx -= ui(8);
|
||||
// draw_set_color(COLORS.panel_toolbar_separator);
|
||||
// draw_line_width(_bx + ui(4), _by, _bx + ui(4), _by + _bs, 2);
|
||||
|
||||
for (var i = 0, n = array_length(content.title_actions); i < n; i++) {
|
||||
var _b = content.title_actions[i];
|
||||
|
||||
_bx -= _bs;
|
||||
_b.setFocusHover(sFOCUS, sHOVER);
|
||||
_b.draw(_bx, _by, _bs, _bs, mouse_ui, THEME.button_hide);
|
||||
_bs -= ui(4);
|
||||
}
|
||||
}
|
||||
DIALOG_DRAW_BG
|
||||
|
||||
if(!is_undefined(content) && content != noone) { // content
|
||||
content.panel = self;
|
||||
|
||||
var bx = content.showHeader? dialog_x + ui(8) : dialog_x + ui(24);
|
||||
var by = content.showHeader? dialog_y + ui(8) : dialog_y + ui(18);
|
||||
var txt = destroy_on_click_out? __txt("Pin") : __txt("Unpin");
|
||||
var cc = destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light;
|
||||
var ind = !destroy_on_click_out;
|
||||
var ss = content.showHeader? ui(20) : ui(28);
|
||||
var sc = content.showHeader? 0.75 : 1;
|
||||
var cx = dialog_x + content.showHeader * padding;
|
||||
var cy = dialog_y + content.showHeader * (padding + title_height);
|
||||
content.x = cx;
|
||||
content.y = cy;
|
||||
|
||||
content.onStepBegin();
|
||||
|
||||
content.pFOCUS = sFOCUS && m_in;
|
||||
content.pHOVER = sHOVER && m_in;
|
||||
|
||||
panel = surface_verify(panel, dialog_w - content.showHeader * padding * 2,
|
||||
dialog_h - content.showHeader * (padding * 2 + title_height));
|
||||
if(!is_surface(mask_surface))
|
||||
resetMask();
|
||||
|
||||
DIALOG_POSTDRAW
|
||||
surface_set_target(panel);
|
||||
draw_clear(COLORS.panel_bg_clear);
|
||||
|
||||
WINDOW_ACTIVE = window;
|
||||
content.drawContent(panel);
|
||||
WINDOW_ACTIVE = noone;
|
||||
|
||||
gpu_set_blendmode(bm_subtract);
|
||||
draw_surface_safe(mask_surface);
|
||||
gpu_set_blendmode(bm_normal);
|
||||
surface_reset_target();
|
||||
DIALOG_PREDRAW
|
||||
|
||||
content.drawGUI();
|
||||
draw_surface(panel, cx, cy);
|
||||
}
|
||||
|
||||
if(content.showHeader) {
|
||||
var _tx = window == noone? dialog_x + ui(32) : dialog_x + ui(10);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 3, dialog_x + 3, dialog_y + 3, dialog_w - 6, title_height + 2, COLORS._main_icon_light, 1);
|
||||
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_cut(_tx, dialog_y + ui(8), content.title, dialog_w - ui(32 + 32));
|
||||
|
||||
var _bx = dialog_x + dialog_w - ui(28);
|
||||
var _by = dialog_y + ui(8);
|
||||
var _bs = ui(20);
|
||||
|
||||
if(instanceof(content) != "Panel_Menu")
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ss, ss, mouse_ui, sFOCUS, sHOVER, txt, THEME.pin, ind, cc,, sc) == 2)
|
||||
destroy_on_click_out = !destroy_on_click_out;
|
||||
|
||||
if(sFOCUS) {
|
||||
DIALOG_DRAW_FOCUS
|
||||
|
||||
if(!m_in && m_ot) {
|
||||
var p = DIALOG_PAD;
|
||||
var p2 = DIALOG_PAD * 2;
|
||||
draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4);
|
||||
|
||||
if(DOUBLE_CLICK) {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
|
||||
instance_destroy();
|
||||
} else if(mouse_press(mb_right)) {
|
||||
menuCall("panel_window_menu", [
|
||||
menuItem(__txt("Move"), function() {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
panel_mouse = 1;
|
||||
|
||||
instance_destroy();
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, "", THEME.window_exit) == 2) {
|
||||
DIALOG_POSTDRAW
|
||||
onDestroy();
|
||||
instance_destroy();
|
||||
}
|
||||
#endregion
|
||||
|
||||
_bx -= ui(8);
|
||||
// draw_set_color(COLORS.panel_toolbar_separator);
|
||||
// draw_line_width(_bx + ui(4), _by, _bx + ui(4), _by + _bs, 2);
|
||||
|
||||
for (var i = 0, n = array_length(content.title_actions); i < n; i++) {
|
||||
var _b = content.title_actions[i];
|
||||
|
||||
_bx -= _bs;
|
||||
_b.setFocusHover(sFOCUS, sHOVER);
|
||||
_b.draw(_bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], THEME.button_hide);
|
||||
_bs -= ui(4);
|
||||
}
|
||||
}
|
||||
|
||||
var bx = content.showHeader? dialog_x + ui(8) : dialog_x + ui(24);
|
||||
var by = content.showHeader? dialog_y + ui(8) : dialog_y + ui(18);
|
||||
var txt = destroy_on_click_out? __txt("Pin") : __txt("Unpin");
|
||||
var cc = destroy_on_click_out? COLORS._main_icon : COLORS._main_icon_light;
|
||||
var ind = !destroy_on_click_out;
|
||||
var ss = content.showHeader? ui(20) : ui(28);
|
||||
var sc = content.showHeader? 0.75 : 1;
|
||||
|
||||
if(window == noone && instanceof(content) != "Panel_Menu") {
|
||||
var b = buttonInstant(THEME.button_hide, bx, by, ss, ss, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, txt, THEME.pin, ind, cc, 1, sc);
|
||||
if(b == 2) destroy_on_click_out = !destroy_on_click_out;
|
||||
}
|
||||
|
||||
if(sFOCUS) {
|
||||
DIALOG_DRAW_FOCUS
|
||||
|
||||
if(window == noone && !m_in && m_ot) {
|
||||
var p = DIALOG_PAD;
|
||||
var p2 = DIALOG_PAD * 2;
|
||||
draw_sprite_stretched_ext(THEME.dialog, 1, dialog_x - p, dialog_y - p, dialog_w + p2, dialog_h + p2, c_white, 0.4);
|
||||
|
||||
if(DOUBLE_CLICK) {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
|
||||
instance_destroy();
|
||||
} else if(mouse_press(mb_right)) {
|
||||
menuCall("panel_window_menu", [
|
||||
menuItem(__txt("Move"), function() {
|
||||
content.dragSurface = surface_clone(panel);
|
||||
o_main.panel_dragging = content;
|
||||
content.in_dialog = false;
|
||||
panel_mouse = 1;
|
||||
|
||||
instance_destroy();
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
DIALOG_POSTDRAW
|
|
@ -1,3 +1,5 @@
|
|||
/// @description
|
||||
if(!is_undefined(content) && content != noone)
|
||||
content.drawGUI();
|
||||
content.drawGUI();
|
||||
|
||||
event_inherited();
|
|
@ -211,6 +211,14 @@ event_inherited();
|
|||
"test_mode",
|
||||
new checkBox(function() /*=>*/ { PREFERENCES.test_mode = !PREFERENCES.test_mode; should_restart = true; PREF_SAVE(); })
|
||||
));
|
||||
|
||||
if(PREFERENCES.test_mode) {
|
||||
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
|
||||
__txtx("pref_exp_popup_dialog", "[Experimental] Pop-up Dialog"),
|
||||
"multi_window",
|
||||
new checkBox(function() /*=>*/ { PREFERENCES.multi_window = !PREFERENCES.multi_window; PREF_SAVE(); })
|
||||
));
|
||||
}
|
||||
|
||||
ds_list_add(pref_global, __txt("Paths"));
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ if(winMan_isMinimized()) exit;
|
|||
NODE_DROPPER_TARGET_CAN = false;
|
||||
|
||||
panelDisplayDraw();
|
||||
dialogGUIDraw();
|
||||
#endregion
|
||||
|
||||
#region debug
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/// @description init
|
||||
if(winMan_isMinimized()) exit;
|
||||
winManStep()
|
||||
winManStep();
|
||||
|
||||
//print("===== Step start =====");
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/// @description init
|
||||
if(PREFERENCES.multi_window) winwin_update();
|
||||
|
||||
global.__debug_runner++;
|
||||
global.cache_call = 0;
|
||||
global.cache_hit = 0;
|
||||
|
@ -22,7 +24,11 @@ _FILE_DROPPED = false;
|
|||
minimized = false;
|
||||
}
|
||||
|
||||
game_set_speed(window_has_focus() || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
|
||||
var foc = window_has_focus();
|
||||
if(HOVER && instance_exists(HOVER) && HOVER.window != noone) foc = true;
|
||||
|
||||
game_set_speed(foc || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
|
||||
WINDOW_ACTIVE = noone;
|
||||
#endregion
|
||||
|
||||
#region fpss
|
||||
|
@ -81,17 +87,17 @@ _FILE_DROPPED = false;
|
|||
if(mouse_release(mb_any)) DIALOG_CLICK = true;
|
||||
|
||||
HOVER = noone;
|
||||
with(_p_dialog) checkMouse();
|
||||
with(_p_dialog) checkMouse(); WINDOW_ACTIVE = noone;
|
||||
|
||||
if(PANEL_MAIN != 0) PANEL_MAIN.stepBegin();
|
||||
|
||||
DIALOG_DEPTH_HOVER = 0;
|
||||
|
||||
with(_p_dialog) checkFocus();
|
||||
with(_p_dialog) checkDepth();
|
||||
with(_p_dialog) checkFocus(); WINDOW_ACTIVE = noone;
|
||||
with(_p_dialog) checkDepth(); WINDOW_ACTIVE = noone;
|
||||
|
||||
with(_p_dialog) doDrag();
|
||||
with(_p_dialog) doResize();
|
||||
with(_p_dialog) doDrag(); WINDOW_ACTIVE = noone;
|
||||
with(_p_dialog) doResize(); WINDOW_ACTIVE = noone;
|
||||
#endregion
|
||||
|
||||
#region auto save
|
||||
|
@ -276,4 +282,4 @@ _FILE_DROPPED = false;
|
|||
#endregion
|
||||
|
||||
//if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)");
|
||||
//if(!is_struct(FOCUS)) print(FOCUS);
|
||||
// print($"{is_struct(HOVER)? instanceof(HOVER) : HOVER}, {is_struct(FOCUS)? instanceof(FOCUS) : FOCUS}");
|
|
@ -7,13 +7,18 @@
|
|||
|
||||
function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, context = noone) {
|
||||
if(array_empty(menu)) return noone;
|
||||
|
||||
FOCUS_BEFORE = FOCUS;
|
||||
|
||||
_x = _x == 0? mouse_mx + ui(4) : _x;
|
||||
_y = _y == 0? mouse_my + ui(4) : _y;
|
||||
|
||||
FOCUS_BEFORE = FOCUS;
|
||||
|
||||
var dia = dialogCall(o_dialog_menubox, _x, _y);
|
||||
|
||||
// if(WINDOW_ACTIVE != noone) {
|
||||
// dia.window = WINDOW_ACTIVE;
|
||||
// }
|
||||
|
||||
if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) {
|
||||
var callbacks = CONTEXT_MENU_CALLBACK[? menu_id];
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ function line_get_width(txt, font = noone, offset = 0) {
|
|||
#region global
|
||||
#macro TEXTBOX_HEIGHT line_get_height(f_p1, 8)
|
||||
#macro BUTTON_HEIGHT line_get_height(f_p1, 12)
|
||||
|
||||
|
||||
function ui(val) {
|
||||
INLINE
|
||||
return round(val * UI_SCALE);
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
globalvar FOCUS, FOCUS_STR, FOCUS_CONTENT, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
|
||||
globalvar DOUBLE_CLICK, DOUBLE_CLICK_POS;
|
||||
globalvar DIALOG_CLICK;
|
||||
globalvar WINDOW_ACTIVE;
|
||||
|
||||
DOUBLE_CLICK_POS = [ 0, 0 ];
|
||||
DOUBLE_CLICK = false;
|
||||
|
@ -78,6 +79,7 @@
|
|||
|
||||
ADD_NODE_PAGE = 0;
|
||||
ADD_NODE_SCROLL = 0;
|
||||
WINDOW_ACTIVE = noone;
|
||||
#endregion
|
||||
|
||||
#region macro
|
||||
|
@ -93,18 +95,18 @@
|
|||
|
||||
#macro UI_SCALE PREFERENCES.display_scaling
|
||||
|
||||
#macro mouse_mx (PEN_USE? PEN_X : device_mouse_x_to_gui(0))
|
||||
#macro mouse_my (PEN_USE? PEN_Y : device_mouse_y_to_gui(0))
|
||||
#macro mouse_mx (PEN_USE? PEN_X : (WINDOW_ACTIVE == noone? device_mouse_x_to_gui(0) : winwin_mouse_get_x(WINDOW_ACTIVE)))
|
||||
#macro mouse_my (PEN_USE? PEN_Y : (WINDOW_ACTIVE == noone? device_mouse_y_to_gui(0) : winwin_mouse_get_y(WINDOW_ACTIVE)))
|
||||
|
||||
#macro mouse_mxs (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx)
|
||||
#macro mouse_mys (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my)
|
||||
|
||||
#macro mouse_raw_x (device_mouse_raw_x(0) + window_get_x())
|
||||
#macro mouse_raw_y (device_mouse_raw_y(0) + window_get_y())
|
||||
#macro mouse_raw_x display_mouse_get_x()
|
||||
#macro mouse_raw_y display_mouse_get_y()
|
||||
#macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)]
|
||||
|
||||
#macro sFOCUS (FOCUS == self.id)
|
||||
#macro sHOVER (!CURSOR_IS_LOCK && HOVER == self.id)
|
||||
#macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over(WINDOW_ACTIVE))))
|
||||
|
||||
#macro DELTA_TIME delta_time / 1_000_000
|
||||
|
||||
|
|
|
@ -11,95 +11,105 @@
|
|||
#macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed
|
||||
#macro MOUSE_MOVED (window_mouse_get_delta_x() || window_mouse_get_delta_y())
|
||||
|
||||
#macro mouse_wheel_up mouse_wheel_up_override
|
||||
#macro __mouse_wheel_up mouse_wheel_up
|
||||
|
||||
#macro mouse_wheel_down mouse_wheel_down_override
|
||||
#macro __mouse_wheel_down mouse_wheel_down
|
||||
|
||||
function setMouseWrap() {
|
||||
INLINE
|
||||
MOUSE_WRAP = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
function mouse_click(mouse, focus = true) { #region
|
||||
function mouse_click(mouse, focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
|
||||
if(PEN_RIGHT_CLICK) return mouse == mb_right;
|
||||
|
||||
return mouse_check_button(mouse);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button(mouse) : winwin_mouse_check_button(WINDOW_ACTIVE, mouse);
|
||||
}
|
||||
|
||||
function mouse_press(mouse, focus = true) { #region
|
||||
function mouse_press(mouse, focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
|
||||
if(PEN_RIGHT_PRESS) return mouse == mb_right;
|
||||
|
||||
return mouse_check_button_pressed(mouse);
|
||||
} #endregion
|
||||
if(WINDOW_ACTIVE == noone) return mouse_check_button_pressed(mouse);
|
||||
if(mouse != mb_any) return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mouse);
|
||||
|
||||
return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left) || winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right);
|
||||
}
|
||||
|
||||
function mouse_release(mouse, focus = true) { #region
|
||||
function mouse_release(mouse, focus = true) {
|
||||
INLINE
|
||||
if(!focus) return false;
|
||||
|
||||
if(PEN_RIGHT_RELEASE) return mouse == mb_right;
|
||||
|
||||
return mouse_check_button_released(mouse) || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED);
|
||||
} #endregion
|
||||
var rl = WINDOW_ACTIVE == noone? mouse_check_button_released(mouse) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mouse);
|
||||
return rl || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED);
|
||||
}
|
||||
|
||||
function mouse_lclick(focus = true) { #region
|
||||
function mouse_lclick(focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_CLICK || PEN_RIGHT_RELEASE) return false;
|
||||
|
||||
return mouse_check_button(mb_left);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button(mb_left) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_left);
|
||||
}
|
||||
|
||||
function mouse_lpress(focus = true) { #region
|
||||
function mouse_lpress(focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_PRESS) return false;
|
||||
|
||||
return mouse_check_button_pressed(mb_left);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_left) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left);
|
||||
}
|
||||
|
||||
function mouse_lrelease(focus = true) { #region
|
||||
function mouse_lrelease(focus = true) {
|
||||
INLINE
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_RELEASE) return false;
|
||||
if(PEN_RELEASED) return true;
|
||||
|
||||
return mouse_check_button_released(mb_left);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_left) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_left);
|
||||
}
|
||||
|
||||
function mouse_rclick(focus = true) { #region
|
||||
function mouse_rclick(focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_CLICK) return true;
|
||||
|
||||
return mouse_check_button(mb_right);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button(mb_right) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_right);
|
||||
}
|
||||
|
||||
function mouse_rpress(focus = true) { #region
|
||||
function mouse_rpress(focus = true) {
|
||||
INLINE
|
||||
if(MOUSE_BLOCK) return false;
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_PRESS) return true;
|
||||
|
||||
return mouse_check_button_pressed(mb_right);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_right) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right);
|
||||
}
|
||||
|
||||
function mouse_rrelease(focus = true) { #region
|
||||
function mouse_rrelease(focus = true) {
|
||||
INLINE
|
||||
if(!focus) return false;
|
||||
if(PEN_RIGHT_RELEASE) return true;
|
||||
|
||||
return mouse_check_button_released(mb_right);
|
||||
} #endregion
|
||||
return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_right) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_right);
|
||||
}
|
||||
|
||||
function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { #region
|
||||
function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) {
|
||||
INLINE
|
||||
|
||||
CURSOR_LOCK = true;
|
||||
|
@ -107,4 +117,7 @@ function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { #region
|
|||
CURSOR_LOCK_Y = my;
|
||||
|
||||
window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function mouse_wheel_up_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_up() : winwin_mouse_wheel_up(WINDOW_ACTIVE); }
|
||||
function mouse_wheel_down_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_down() : winwin_mouse_wheel_down(WINDOW_ACTIVE); }
|
|
@ -864,7 +864,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
var sBase = surface_get_target();
|
||||
|
||||
try {
|
||||
update(frame);
|
||||
if(attributes.update_graph) update(frame);
|
||||
} catch(exception) {
|
||||
var sCurr = surface_get_target();
|
||||
while(surface_get_target() != sBase)
|
||||
|
|
|
@ -23,7 +23,10 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
json_save_struct(path, cont);
|
||||
}
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { writeFile(); }
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
writeFile();
|
||||
}
|
||||
|
||||
static onInspector1Update = function() { writeFile(); }
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
|
|
|
@ -401,10 +401,14 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
|
|||
|
||||
if(con && point_in_rectangle(_mx, _my, x + ui(2), y + ui(2), x + w - ui(4), y + h - ui(4))) {
|
||||
HOVER = self;
|
||||
// print($"Hovering {instanceof(con)} : {mouse_press(mb_any)} : {random(1)}")
|
||||
|
||||
if(mouse_press(mb_any))
|
||||
setFocus(self);
|
||||
|
||||
if(FOCUS == self && con)
|
||||
FOCUS_STR = con.context_str;
|
||||
|
||||
} else {
|
||||
for(var i = 0; i < array_length(childs); i++)
|
||||
childs[i].stepBegin();
|
||||
|
@ -905,6 +909,7 @@ function PanelContent() constructor {
|
|||
|
||||
dragSurface = surface_create(1, 1);
|
||||
showHeader = true;
|
||||
window = noone;
|
||||
|
||||
title_actions = [];
|
||||
|
||||
|
@ -942,6 +947,7 @@ function PanelContent() constructor {
|
|||
function onStepBegin() {
|
||||
mx = mouse_mx - x;
|
||||
my = mouse_my - y;
|
||||
window = WINDOW_ACTIVE;
|
||||
|
||||
stepBegin();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endregion
|
||||
|
||||
#region functions
|
||||
function clearPanel() { #region
|
||||
function clearPanel() {
|
||||
delete PANEL_MAIN;
|
||||
delete PANEL_MENU;
|
||||
delete PANEL_INSPECTOR;
|
||||
|
@ -45,9 +45,9 @@
|
|||
PANEL_COLLECTION = {};
|
||||
|
||||
PANEL_FILE = 0;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function getPanelFromName(name, create = false, focus = true) { #region
|
||||
function getPanelFromName(name, create = false, focus = true) {
|
||||
switch(name) {
|
||||
case "Panel_Menu" : var p = (create || findPanel(name))? new Panel_Menu() : PANEL_MENU; if(focus) { PANEL_MENU = p; } return p;
|
||||
case "Panel_Inspector" : var p = (create || findPanel(name))? new Panel_Inspector() : PANEL_INSPECTOR; if(focus) { PANEL_INSPECTOR = p; } return p;
|
||||
|
@ -75,14 +75,14 @@
|
|||
}
|
||||
|
||||
return noone;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function LoadPanelStruct(struct) {
|
||||
PANEL_MAIN = new Panel(noone, ui(2), ui(2), WIN_SW - ui(4), WIN_SH - ui(4));
|
||||
loadPanelStruct(PANEL_MAIN, struct);
|
||||
}
|
||||
|
||||
function loadPanelStruct(panel, str) { #region
|
||||
function loadPanelStruct(panel, str) {
|
||||
var cont = str.content;
|
||||
|
||||
if(variable_struct_exists(str, "split")) {
|
||||
|
@ -111,14 +111,14 @@
|
|||
_pnCont.deserialize(_content);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function loadPanel(path) {
|
||||
CURRENT_PANEL = json_load_struct(path);
|
||||
LoadPanelStruct(CURRENT_PANEL.panel);
|
||||
}
|
||||
|
||||
function checkPanelValid() { #region
|
||||
function checkPanelValid() {
|
||||
var val = true;
|
||||
var _mst = "";
|
||||
if(!is_instanceof(PANEL_GRAPH.panel, Panel)) { val = false; _mst += "Graph, " };
|
||||
|
@ -136,16 +136,16 @@
|
|||
}
|
||||
|
||||
return val;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function panelAdd(panel, create = false, focus = true) { #region
|
||||
function panelAdd(panel, create = false, focus = true) {
|
||||
var pan = getPanelFromName(panel, create, focus);
|
||||
if(pan == noone) return noone;
|
||||
|
||||
return dialogPanelCall(pan, noone, noone, { focus });
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function panelObjectInit() { #region
|
||||
function panelObjectInit() {
|
||||
PANEL_MAIN = new Panel(noone, ui(2), ui(2), WIN_SW - ui(4), WIN_SH - ui(4));
|
||||
PANEL_MENU = new Panel_Menu();
|
||||
PANEL_INSPECTOR = new Panel_Inspector();
|
||||
|
@ -153,18 +153,18 @@
|
|||
PANEL_PREVIEW = new Panel_Preview();
|
||||
PANEL_GRAPH = new Panel_Graph();
|
||||
PANEL_COLLECTION = new Panel_Collection();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function resetPanel(check = true) { #region
|
||||
function resetPanel(check = true) {
|
||||
clearPanel();
|
||||
panelObjectInit();
|
||||
loadPanelStruct(PANEL_MAIN, CURRENT_PANEL.panel);
|
||||
PANEL_MAIN.refresh();
|
||||
|
||||
if(check) checkPanelValid();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function __initPanel() { #region
|
||||
function __initPanel() {
|
||||
directory_verify($"{DIRECTORY}layouts");
|
||||
|
||||
if(check_version($"{DIRECTORY}layouts/version"))
|
||||
|
@ -174,9 +174,9 @@
|
|||
panelDisplayInit();
|
||||
|
||||
checkPanelValid();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function setPanel() { #region
|
||||
function setPanel() {
|
||||
globalvar CURRENT_PANEL;
|
||||
|
||||
panelObjectInit();
|
||||
|
@ -188,9 +188,9 @@
|
|||
|
||||
PANEL_MAIN.refresh();
|
||||
PANEL_MAIN.refreshSize();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function findPanel(_type, _pane = PANEL_MAIN) { #region
|
||||
function findPanel(_type, _pane = PANEL_MAIN) {
|
||||
var pan = _findPanel(_type, _pane);
|
||||
if(pan) return pan;
|
||||
|
||||
|
@ -200,9 +200,9 @@
|
|||
}
|
||||
|
||||
return noone;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function _findPanel(_type, _pane, _res = noone) { #region
|
||||
function _findPanel(_type, _pane, _res = noone) {
|
||||
if(instanceof(_pane) != "Panel")
|
||||
return _res;
|
||||
|
||||
|
@ -218,13 +218,13 @@
|
|||
}
|
||||
|
||||
return _res;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function findPanels(_type, _pane = PANEL_MAIN) { #region
|
||||
function findPanels(_type, _pane = PANEL_MAIN) {
|
||||
return _findPanels(_type, _pane, []);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function _findPanels(_type, _pane, _arr = []) { #region
|
||||
function _findPanels(_type, _pane, _arr = []) {
|
||||
if(!is_instanceof(_pane, Panel))
|
||||
return _arr;
|
||||
|
||||
|
@ -239,9 +239,9 @@
|
|||
_arr = _findPanels(_type, _pane.childs[i], _arr);
|
||||
|
||||
return _arr;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function panelInit() { #region
|
||||
function panelInit() {
|
||||
panel_dragging = noone;
|
||||
panel_hovering = noone;
|
||||
panel_split = 0;
|
||||
|
@ -254,9 +254,14 @@
|
|||
panel_draw_y1 = noone; panel_draw_y1_to = noone;
|
||||
|
||||
panel_draw_depth = 0;
|
||||
} #endregion
|
||||
|
||||
dialog_popup = 0;
|
||||
dialog_popup_to = 0;
|
||||
dialog_popup_x = 0;
|
||||
dialog_popup_y = 0;
|
||||
}
|
||||
|
||||
function panelDraw() { #region
|
||||
function panelDraw() {
|
||||
panel_draw_x0 = panel_draw_x0 == noone? panel_draw_x0_to : lerp_float(panel_draw_x0, panel_draw_x0_to, 3);
|
||||
panel_draw_y0 = panel_draw_y0 == noone? panel_draw_y0_to : lerp_float(panel_draw_y0, panel_draw_y0_to, 3);
|
||||
panel_draw_x1 = panel_draw_x1 == noone? panel_draw_x1_to : lerp_float(panel_draw_x1, panel_draw_x1_to, 3);
|
||||
|
@ -264,25 +269,28 @@
|
|||
|
||||
panel_draw_depth = lerp_float(panel_draw_depth, panel_split == 4, 3);
|
||||
|
||||
var _rr = THEME_VALUE.panel_corner_radius;
|
||||
|
||||
if(panel_draw_x0_to != noone) {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
|
||||
if(panel_split == 4) {
|
||||
var dist = ui(8) * panel_draw_depth;
|
||||
draw_set_alpha(.2);
|
||||
draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false);
|
||||
draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, _rr, _rr, false);
|
||||
draw_set_alpha(1.);
|
||||
draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true);
|
||||
draw_roundrect_ext(panel_draw_x0 - dist, panel_draw_y0 - dist, panel_draw_x1 - dist, panel_draw_y1 - dist, _rr, _rr, true);
|
||||
|
||||
draw_set_alpha(.2);
|
||||
draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false);
|
||||
draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, _rr, _rr, false);
|
||||
draw_set_alpha(1.);
|
||||
draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true);
|
||||
draw_roundrect_ext(panel_draw_x0 + dist, panel_draw_y0 + dist, panel_draw_x1 + dist, panel_draw_y1 + dist, _rr, _rr, true);
|
||||
|
||||
} else {
|
||||
draw_set_alpha(.4);
|
||||
draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, false);
|
||||
draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, _rr, _rr, false);
|
||||
draw_set_alpha(1.);
|
||||
draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, THEME_VALUE.panel_corner_radius, THEME_VALUE.panel_corner_radius, true);
|
||||
draw_roundrect_ext(panel_draw_x0, panel_draw_y0, panel_draw_x1, panel_draw_y1, _rr, _rr, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -340,13 +348,33 @@
|
|||
panel_draw_depth = 0;
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function panelSerialize(_content = false) { #region
|
||||
function dialogGUIDraw() {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
dialog_popup = lerp_float(dialog_popup, dialog_popup_to, 5);
|
||||
dialog_popup_to = 0;
|
||||
|
||||
if(dialog_popup > 0) {
|
||||
var _rr = THEME_VALUE.panel_corner_radius;
|
||||
var dpw = ui(24) * dialog_popup;
|
||||
var dph = ui(24) * dialog_popup;
|
||||
|
||||
var dpx = clamp(dialog_popup_x, 8 + dpw, WIN_W - 8 - dpw);
|
||||
var dpy = clamp(dialog_popup_y, 8 + dph, WIN_H - 8 - dph);
|
||||
|
||||
draw_set_alpha(.4);
|
||||
draw_roundrect_ext(dpx - dpw, dpy - dph, dpx + dpw, dpy + dph, _rr, _rr, false);
|
||||
draw_set_alpha(1.);
|
||||
draw_roundrect_ext(dpx - dpw, dpy - dph, dpx + dpw, dpy + dph, _rr, _rr, true);
|
||||
}
|
||||
}
|
||||
|
||||
function panelSerialize(_content = false) {
|
||||
return { panel : _panelSerialize(PANEL_MAIN, _content) };
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function _panelSerialize(_panel, _content = false) { #region
|
||||
function _panelSerialize(_panel, _content = false) {
|
||||
var cont = {};
|
||||
var ind = 0;
|
||||
|
||||
|
@ -372,13 +400,13 @@
|
|||
}
|
||||
|
||||
return cont;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function panelSerializeArray() { #region
|
||||
function panelSerializeArray() {
|
||||
return _panelSerializeArray(PANEL_MAIN);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function _panelSerializeArray(panel) { #region
|
||||
function _panelSerializeArray(panel) {
|
||||
var cont = [];
|
||||
|
||||
if(!array_empty(panel.childs)) {
|
||||
|
@ -391,7 +419,7 @@
|
|||
}
|
||||
|
||||
return cont;
|
||||
} #endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region fullscreen
|
||||
|
|
|
@ -658,7 +658,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text_add(ui(8), yy + hg / 2, edt[0]);
|
||||
draw_text_alpha(ui(8), yy + hg / 2, edt[0]);
|
||||
|
||||
var _param = new widgetParam(wx0, yy, ww, hg, val, {}, _m, x + contentPane.x, y + contentPane.y);
|
||||
_param.s = hg;
|
||||
|
|
|
@ -41,8 +41,8 @@ function Panel_Preview_Window() : PanelContent() constructor {
|
|||
|
||||
function reset() {
|
||||
scale = 0;
|
||||
panx = 0;
|
||||
pany = 0;
|
||||
panx = 0;
|
||||
pany = 0;
|
||||
}
|
||||
|
||||
function changeChannel(_index) {
|
||||
|
@ -115,7 +115,7 @@ function Panel_Preview_Window() : PanelContent() constructor {
|
|||
if(mouse_release(mb_middle))
|
||||
panning = false;
|
||||
}
|
||||
|
||||
|
||||
if(mouse_press(mb_middle, pFOCUS)) {
|
||||
panning = true;
|
||||
pan_mx = mouse_mx;
|
||||
|
@ -133,6 +133,8 @@ function Panel_Preview_Window() : PanelContent() constructor {
|
|||
else if(scale > 0.25) inc = 0.25;
|
||||
else inc = 0.05;
|
||||
|
||||
//if(WINDOW_ACTIVE != noone) print($"{winwin_mouse_wheel_down(WINDOW_ACTIVE)} : {winwin_mouse_wheel_up(WINDOW_ACTIVE)} : {random(1)}");
|
||||
|
||||
var s = scale;
|
||||
if(mouse_wheel_down()) {
|
||||
for( var i = 0, n = array_length(scale_levels) - 1; i < n; i++ ) {
|
||||
|
|
|
@ -171,6 +171,10 @@
|
|||
|
||||
#endregion
|
||||
|
||||
#region ////////////////////////////////////////////////////////////////////// EXPERIMENT ///////////////////////////////////////////////////////////////////////
|
||||
PREFERENCES.multi_window = false;
|
||||
#endregion
|
||||
|
||||
PREFERENCES_DEF = variable_clone(PREFERENCES);
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#macro surface_reset_target surface_reset_target_override
|
||||
#macro __surface_reset_target surface_reset_target
|
||||
function surface_reset_target_override() { __surface_reset_target(); winwin_draw_sync(); }
|
||||
|
||||
#region ==================================== DRAW ====================================
|
||||
|
||||
function draw_surface_safe(surface, _x = 0, _y = 0) { #region
|
||||
|
|
22
scripts/winwin_extras/winwin_extras.gml
Normal file
22
scripts/winwin_extras/winwin_extras.gml
Normal file
|
@ -0,0 +1,22 @@
|
|||
global.__winwin_map = ds_map_create();
|
||||
|
||||
function winwin(_ptr) constructor {
|
||||
__ptr__ = _ptr;
|
||||
}
|
||||
|
||||
function winwin_config() constructor {
|
||||
static caption = "Window";
|
||||
static kind = winwin_kind_normal;
|
||||
static resize = false;
|
||||
static show = true;
|
||||
static topmost = false;
|
||||
static taskbar_button = true; // can only disable for borderless!
|
||||
static clickthrough = false;
|
||||
static noactivate = false;
|
||||
static per_pixel_alpha = false;
|
||||
static thread = false;
|
||||
static vsync = 0;
|
||||
static close_button = 1;
|
||||
static owner = undefined;
|
||||
}
|
||||
|
13
scripts/winwin_extras/winwin_extras.yy
Normal file
13
scripts/winwin_extras/winwin_extras.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"winwin_extras",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"winwin_extras",
|
||||
"parent":{
|
||||
"name":"WinMan",
|
||||
"path":"folders/_extensions/WinMan.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
Loading…
Reference in a new issue