- popup dialog 1

This commit is contained in:
Tanasart 2024-09-11 16:56:41 +07:00
parent ba29167abf
commit 56e4982590
18 changed files with 171 additions and 107 deletions

View File

@ -681,7 +681,6 @@
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/Welcome files/Templates","name":"Canvas.pxc","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":"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",},
{"$GMIncludedFile":"","%Name":"winwin.html","CopyToMask":-1,"filePath":"datafiles","name":"winwin.html","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
], ],
"isEcma":false, "isEcma":false,
"LibraryEmitters":[], "LibraryEmitters":[],

Binary file not shown.

View File

@ -4,8 +4,8 @@
#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_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_PREDRAW if(window != noone) { winwin_draw_begin(window); WINDOW_ACTIVE = window; } #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; } #macro DIALOG_POSTDRAW if(window != noone) { winwin_draw_end(); WINDOW_ACTIVE = noone; window_drawing = false; }
#region data #region data
on_top = false; on_top = false;
@ -27,6 +27,7 @@
title = "dialog"; title = "dialog";
window = noone; window = noone;
window_drawing = false;
title_height = 64; title_height = 64;
padding = 20; padding = 20;
@ -72,11 +73,10 @@
var _wx = window_get_x(); var _wx = window_get_x();
var _wy = window_get_y(); 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_x = clamp(_dx, ui(16) - dialog_w, WIN_W - ui(16)); dialog_y = clamp(_dy, ui(16) - dialog_h, WIN_H - ui(16));
dialog_y = clamp(_dy, ui(16) - dialog_h, WIN_H - ui(16));
} else if(PREFERENCES.multi_window) { if(PREFERENCES.multi_window && !point_in_rectangle(mouse_raw_x, mouse_raw_y, _wx, _wy, _wx + WIN_W, _wy + WIN_H)) {
o_main.dialog_popup_to = 1; o_main.dialog_popup_to = 1;
o_main.dialog_popup_x = mouse_mx; o_main.dialog_popup_x = mouse_mx;
o_main.dialog_popup_y = mouse_my; o_main.dialog_popup_y = mouse_my;
@ -117,7 +117,7 @@
var _dx = dialog_drag_sx + mouse_raw_x - dialog_drag_mx; var _dx = dialog_drag_sx + mouse_raw_x - dialog_drag_mx;
var _dy = dialog_drag_sy + mouse_raw_y - dialog_drag_my; var _dy = dialog_drag_sy + mouse_raw_y - dialog_drag_my;
winwin_set_position(window, _dx, _dy); winwin_set_position_safe(window, _dx, _dy);
if(mouse_release(mb_left)) if(mouse_release(mb_left))
dialog_dragging = false; dialog_dragging = false;
@ -129,8 +129,8 @@
if(mouse_press(mb_left, sFOCUS)) { if(mouse_press(mb_left, sFOCUS)) {
dialog_dragging = true; dialog_dragging = true;
dialog_drag_sx = winwin_get_x(window); dialog_drag_sx = winwin_get_x_safe(window);
dialog_drag_sy = winwin_get_y(window); dialog_drag_sy = winwin_get_y_safe(window);
dialog_drag_mx = mouse_raw_x; dialog_drag_mx = mouse_raw_x;
dialog_drag_my = mouse_raw_y; dialog_drag_my = mouse_raw_y;
} }
@ -215,7 +215,7 @@
} }
if(dialog_resizing != 0) { if(dialog_resizing != 0) {
winwin_set_size(window, ww, hh); winwin_set_size_safe(window, ww, hh);
if(mouse_release(mb_left)) dialog_resizing = 0; if(mouse_release(mb_left)) dialog_resizing = 0;
} }
@ -255,9 +255,12 @@
#endregion #endregion
#region focus #region focus
function point_in(mx, my) { function point_in(raw_x, raw_y) {
INLINE INLINE
var mx = raw_x - winwin_get_x_safe(window);
var my = raw_y - winwin_get_y_safe(window);
var _r = dialog_resizable * 6; var _r = dialog_resizable * 6;
var x0 = dialog_x - _r; var x0 = dialog_x - _r;
var x1 = dialog_x + dialog_w + _r; var x1 = dialog_x + dialog_w + _r;
@ -272,8 +275,8 @@
WINDOW_ACTIVE = window; WINDOW_ACTIVE = window;
if(window == noone) { if(window == noone) {
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx; var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_raw_x;
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my; var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_raw_y;
if(point_in(_mx, _my)) { if(point_in(_mx, _my)) {
if(depth < DIALOG_DEPTH_HOVER) { if(depth < DIALOG_DEPTH_HOVER) {
@ -281,8 +284,8 @@
HOVER = self.id; HOVER = self.id;
} }
} }
} else { } else if (winwin_exists(window)) {
if(winwin_mouse_is_over(window)) if(winwin_mouse_is_over_safe(window))
HOVER = self.id; HOVER = self.id;
} }
@ -340,7 +343,7 @@
for( var i = 0, n = array_length(children); i < n; i++ ) for( var i = 0, n = array_length(children); i < n; i++ )
if(instance_exists(children[i])) return; if(instance_exists(children[i])) return;
if(checkClosable() && destroy_on_click_out && !point_in(mouse_mx, mouse_my)) { if(checkClosable() && destroy_on_click_out && !point_in(mouse_raw_x, mouse_raw_y)) {
instance_destroy(self); instance_destroy(self);
onDestroy(); onDestroy();
DIALOG_CLICK = false; DIALOG_CLICK = false;

View File

@ -9,4 +9,5 @@ if(parent) array_remove(parent.children, id);
if(!passthrough) MOUSE_BLOCK = true; if(!passthrough) MOUSE_BLOCK = true;
if(window != noone) winwin_destroy(window); if(window != noone && winwin_exists(window))
winwin_destroy(window);

View File

@ -14,8 +14,8 @@ if !active exit;
#region resize #region resize
if(window != noone) { if(window != noone) {
dialog_w = winwin_get_width(window); dialog_w = winwin_get_width_safe(window);
dialog_h = winwin_get_height(window); dialog_h = winwin_get_height_safe(window);
} }
if(_dialog_h != dialog_h || _dialog_w != dialog_w) { if(_dialog_h != dialog_h || _dialog_w != dialog_w) {

View File

@ -16,13 +16,14 @@ event_inherited();
tooltips = []; tooltips = [];
show_icon = false; show_icon = false;
context = noone; context = noone;
submenu = noone;
_hovering_ch = true; _hovering_ch = true;
init_pressing = false; init_pressing = false;
setFocus(self.id); setFocus(self.id);
item_selecting = noone; item_sel_submenu = noone;
remove_parents = true; remove_parents = true;
selecting_menu = noone; selecting_menu = noone;
hk_editing = noone; hk_editing = noone;
@ -38,9 +39,8 @@ event_inherited();
dialog_w = 0; dialog_w = 0;
dialog_h = 0; dialog_h = 0;
for( var i = 0, n = array_length(children); i < n; i++ ) if(submenu != noone) instance_destroy(submenu);
instance_destroy(children[i]); submenu = noone;
children = [];
tooltips = []; tooltips = [];
draw_set_text(font, fa_center, fa_center, COLORS._main_text); draw_set_text(font, fa_center, fa_center, COLORS._main_text);
@ -84,15 +84,41 @@ event_inherited();
if(show_icon) if(show_icon)
dialog_w += ui(32); dialog_w += ui(32);
dialog_y = min(dialog_y, WIN_H - dialog_h - 2); var _mon = winMan_getData();
dialog_y = min(dialog_y, _mon[7] - WIN_Y - dialog_h - 2);
switch(align) { switch(align) {
case fa_left: dialog_x = round(min(dialog_x, WIN_W - dialog_w - 2)); break; case fa_left: dialog_x = round(min(dialog_x, _mon[6] - WIN_X - dialog_w - 2)); break;
case fa_center: dialog_x = round(min(dialog_x - dialog_w / 2, WIN_W - dialog_w - 2)); break; case fa_center: dialog_x = round(min(dialog_x - dialog_w / 2, _mon[6] - WIN_X - dialog_w - 2)); break;
case fa_right: dialog_x = round(max(dialog_x - dialog_w, 2)); break; case fa_right: dialog_x = round(max(dialog_x - dialog_w, 2)); break;
} }
mouse_init_inside = point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h); mouse_init_inside = point_in_rectangle(mouse_mx, mouse_my, dialog_x, dialog_y, dialog_x + dialog_w, dialog_y + dialog_h);
ready = true; ready = true;
if(PREFERENCES.multi_window) {
var _wx = winwin_get_x_safe(WINDOW_ACTIVE) + dialog_x;
var _wy = winwin_get_y_safe(WINDOW_ACTIVE) + dialog_y;
if(window == noone) {
var _wconfig = new winwin_config();
_wconfig.kind = winwin_kind_borderless;
_wconfig.caption = "";
_wconfig.topmost = true;
_wconfig.per_pixel_alpha = true;
_wconfig.resize = false;
_wconfig.owner = winwin_main;
_wconfig.taskbar_button = false;
_wconfig.close_button = false;
window = winwin_create(_wx, _wy, dialog_w, dialog_h, _wconfig);
} else {
winwin_set_position_safe(window, _wx, _wy);
winwin_set_size_safe(window, dialog_w, dialog_h);
}
dialog_x = 0;
dialog_y = 0;
}
} }
#endregion #endregion

View File

@ -1,6 +1,5 @@
event_inherited(); event_inherited();
for( var i = 0, n = array_length(children); i < n; i++ ) if(submenu) instance_destroy(submenu);
instance_destroy(children[i]);
if(FOCUS == noone && instance_number(o_dialog_menubox) == 1) FOCUS = FOCUS_BEFORE; if(FOCUS == noone && instance_number(o_dialog_menubox) == 1) FOCUS = FOCUS_BEFORE;

View File

@ -1,13 +1,16 @@
/// @description init /// @description init
if(!ready) exit; if(!ready) exit;
DIALOG_PREDRAW
winwin_draw_clear(COLORS.panel_bg_clear, 1);
#region draw #region draw
var yy = dialog_y; var yy = dialog_y;
var _lclick = sFOCUS && (!mouse_init_inside && mouse_release(mb_left)) || (keyboard_check_pressed(vk_enter) && hk_editing == noone); 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); var _rclick = sFOCUS && !mouse_init_inside && !mouse_init_r_pressed && mouse_release(mb_right);
if(!mouse_init_inside && mouse_press(mb_right) && item_selecting) { if(!mouse_init_inside && mouse_press(mb_right) && item_sel_submenu) {
instance_destroy(item_selecting); instance_destroy(item_sel_submenu);
item_selecting = noone; item_sel_submenu = noone;
} }
draw_sprite_stretched(THEME.s_box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h); draw_sprite_stretched(THEME.s_box_r2_clr, 0, dialog_x, dialog_y, dialog_w, dialog_h);
@ -52,7 +55,7 @@ if(!ready) exit;
var _hc = cc == c_white? COLORS.dialog_menubox_highlight : cc; var _hc = cc == c_white? COLORS.dialog_menubox_highlight : cc;
var _ha = cc == c_white? 0.75 : 0.8; var _ha = cc == c_white? 0.75 : 0.8;
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc, _ha); draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, _hc);
if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) { if(_hovering_ch && is_instanceof(_menuItem, MenuItem)) {
if(_menuItem.active && _lclick) { if(_menuItem.active && _lclick) {
@ -71,18 +74,24 @@ if(!ready) exit;
if(_menuItem.isShelf) { if(_menuItem.isShelf) {
var _res = _menuItem.func(_dat); var _res = _menuItem.func(_dat);
array_push(children, _res.id); // open child if(submenu) instance_destroy(submenu);
submenu = _res;
} else if(remove_parents) { } else if(remove_parents) {
if(_par == noone) _menuItem.func(); if(_par == noone) _menuItem.func();
else _menuItem.func(_par); else _menuItem.func(_par);
DIALOG_POSTDRAW
instance_destroy(o_dialog_menubox); // close all instance_destroy(o_dialog_menubox); // close all
exit;
} else { } else {
if(_par == noone) _menuItem.func(); if(_par == noone) _menuItem.func();
else _menuItem.func(_par); else _menuItem.func(_par);
instance_destroy(); // close self
DIALOG_POSTDRAW
instance_destroy();
exit;
} }
} }
} }
@ -108,14 +117,13 @@ if(!ready) exit;
menuItem(__txt("Edit hotkey"), function() /*=>*/ { hk_editing = selecting_menu; keyboard_lastchar = hk_editing.hoykeyObject.key; }), menuItem(__txt("Edit hotkey"), function() /*=>*/ { hk_editing = selecting_menu; keyboard_lastchar = hk_editing.hoykeyObject.key; }),
]; ];
item_selecting = submenuCall(_dat, context_menu_settings); item_sel_submenu = submenuCall(_dat, context_menu_settings);
item_selecting.remove_parents = false; item_sel_submenu.remove_parents = false;
array_push(children, item_selecting.id);
} }
} }
} else if(cc != c_white) } else if(cc != c_white)
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.5); draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc);
var _hx = dialog_x + dialog_w - ui(16); var _hx = dialog_x + dialog_w - ui(16);
var _hy = yy + hght / 2 + ui(2); var _hy = yy + hght / 2 + ui(2);
@ -170,7 +178,10 @@ if(!ready) exit;
if(mouse_press(mb_left, sFOCUS)) { if(mouse_press(mb_left, sFOCUS)) {
_submenu[1](_dat); _submenu[1](_dat);
DIALOG_POSTDRAW
instance_destroy(o_dialog_menubox); instance_destroy(o_dialog_menubox);
exit;
} }
} }
@ -252,8 +263,11 @@ if(!ready) exit;
if(keyboard_check_pressed(vk_down)) if(keyboard_check_pressed(vk_down))
selecting = safe_mod(selecting + 1, array_length(menu)); selecting = safe_mod(selecting + 1, array_length(menu));
if(keyboard_check_pressed(vk_escape)) if(keyboard_check_pressed(vk_escape)) {
DIALOG_POSTDRAW
instance_destroy(); instance_destroy();
exit;
}
} }
draw_sprite_stretched(THEME.s_box_r2_clr, 1, dialog_x, dialog_y, dialog_w, dialog_h); draw_sprite_stretched(THEME.s_box_r2_clr, 1, dialog_x, dialog_y, dialog_w, dialog_h);
@ -270,4 +284,6 @@ if(!ready) exit;
draw_set_text(f_p0, fa_left, fa_bottom); draw_set_text(f_p0, fa_left, fa_bottom);
draw_text(dialog_x, dialog_y - ui(2), menu_id); draw_text(dialog_x, dialog_y - ui(2), menu_id);
} }
#endregion #endregion
DIALOG_POSTDRAW

View File

@ -1,12 +1,14 @@
/// @description Insert description here /// @description Insert description here
event_inherited(); event_inherited();
var hov = point_in(mouse_mx, mouse_my); if(item_sel_submenu) {
if(!instance_exists(item_sel_submenu))
for( var i = 0, n = array_length(children); i < n; i++ ) { item_sel_submenu = noone;
if(!instance_exists(children[i])) continue; exit;
hov |= children[i].point_in(mouse_mx, mouse_my);
} }
var hov = point_in(mouse_raw_x, mouse_raw_y);
if(submenu) hov |= submenu.point_in(mouse_raw_x, mouse_raw_y);
_hovering_ch = hov; _hovering_ch = hov;
if(!hov && mouse_press(mb_left)) instance_destroy(); if(!hov && mouse_press(mb_left)) instance_destroy();

View File

@ -10,6 +10,8 @@ event_inherited();
destroy_on_escape = false; destroy_on_escape = false;
should_restart = false; should_restart = false;
font = f_p2;
#endregion #endregion
#region size #region size
@ -592,9 +594,9 @@ event_inherited();
sb_theme.align = fa_left; sb_theme.align = fa_left;
sp_colors = new scrollPane(panel_width, panel_height - ui(40), function(_y, _m, _r) { sp_colors = new scrollPane(panel_width, panel_height - ui(40), function(_y, _m, _r) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
var hh = 0; var hh = 0;
var th = line_get_height(f_p0); var th = line_get_height(font);
var x1 = sp_colors.surface_w; var x1 = sp_colors.surface_w;
var yy = _y + ui(8); var yy = _y + ui(8);
var padd = ui(6); var padd = ui(6);
@ -623,7 +625,7 @@ event_inherited();
category = cat; category = cat;
var _sect = string_title(category); var _sect = string_title(category);
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(ui(8), yy - ui(4), _sect); draw_text_add(ui(8), yy - ui(4), _sect);
array_push(sect, [ _sect, sp_colors, hh + ui(12) ]); array_push(sect, [ _sect, sp_colors, hh + ui(12) ]);
@ -642,7 +644,7 @@ event_inherited();
keyStr = string_replace(keyStr, cat + " ", ""); keyStr = string_replace(keyStr, cat + " ", "");
keyStr = string_title(keyStr); keyStr = string_title(keyStr);
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_set_text(font, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(24), yy + th / 2, keyStr); draw_text_add(ui(24), yy + th / 2, keyStr);
var b = buttonInstant(THEME.button_def, cx, yy + cp, cw, ch, _m, sFOCUS, sHOVER && sp_colors.hover); var b = buttonInstant(THEME.button_def, cx, yy + cp, cw, ch, _m, sFOCUS, sHOVER && sp_colors.hover);
@ -663,8 +665,8 @@ event_inherited();
addChildren(dialog); addChildren(dialog);
} }
yy += th + padd + ui(8); yy += th + padd + ui(6);
hh += th + padd + ui(8); hh += th + padd + ui(6);
ind++; ind++;
} }
@ -739,7 +741,7 @@ event_inherited();
hk_scroll.align = fa_left; hk_scroll.align = fa_left;
sp_hotkey = new scrollPane(panel_width, hotkey_height, function(_y, _m) { sp_hotkey = new scrollPane(panel_width, hotkey_height, function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
draw_set_text(f_p2, fa_left, fa_top); draw_set_text(f_p2, fa_left, fa_top);
var padd = ui(6); var padd = ui(6);
@ -852,9 +854,9 @@ event_inherited();
current_list = pref_global; current_list = pref_global;
sp_pref = new scrollPane(panel_width, panel_height, function(_y, _m, _r) { sp_pref = new scrollPane(panel_width, panel_height, function(_y, _m, _r) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
var hh = 0; var hh = 0;
var th = TEXTBOX_HEIGHT; var th = line_get_height(font, 6);
var x1 = sp_pref.surface_w; var x1 = sp_pref.surface_w;
var yy = _y + ui(8); var yy = _y + ui(8);
var padd = ui(6); var padd = ui(6);
@ -875,10 +877,9 @@ event_inherited();
for(var i = 0; i < ds_list_size(current_list); i++) { for(var i = 0; i < ds_list_size(current_list); i++) {
var _pref = current_list[| i]; var _pref = current_list[| i];
var th = TEXTBOX_HEIGHT;
if(is_string(_pref)) { if(is_string(_pref)) {
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub); draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(ui(8), yy, _pref); draw_text_add(ui(8), yy, _pref);
array_push(sect, [ _pref, sp_pref, hh + ui(12) ]); array_push(sect, [ _pref, sp_pref, hh + ui(12) ]);
@ -900,7 +901,7 @@ event_inherited();
if(ind % 2 == 0) draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yy - padd, sp_pref.surface_w, max(_pref.editWidget.h, th) + padd * 2, COLORS.dialog_preference_prop_bg, 1); if(ind % 2 == 0) draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, yy - padd, sp_pref.surface_w, max(_pref.editWidget.h, th) + padd * 2, COLORS.dialog_preference_prop_bg, 1);
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_set_text(font, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(24), yy + th / 2, name); draw_text_add(ui(24), yy + th / 2, name);
if(_pref.is_patreon) { if(_pref.is_patreon) {
@ -930,18 +931,19 @@ event_inherited();
if(_pref.getDefault != noone) if(_pref.getDefault != noone)
widget_w -= ui(32 + 8); widget_w -= ui(32 + 8);
var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, data, {}, _m, _r[0], _r[1]); var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, data, {}, _m, _r[0], _r[1]);
params.s = ui(30); params.s = th;
params.font = font;
if(instanceof(_pref.editWidget) == "checkBox") params.halign = fa_center; if(instanceof(_pref.editWidget) == "checkBox") params.halign = fa_center;
var th = _pref.editWidget.drawParam(params) ?? 0; var wdh = _pref.editWidget.drawParam(params) ?? 0;
if(_pref.editWidget.inBBOX(_m)) sp_pref.hover_content = true; if(_pref.editWidget.inBBOX(_m)) sp_pref.hover_content = true;
if(_pref.getDefault != noone) { if(_pref.getDefault != noone) {
var _defVal = is_method(_pref.getDefault)? _pref.getDefault() : _pref.getDefault; var _defVal = is_method(_pref.getDefault)? _pref.getDefault() : _pref.getDefault;
var _bs = ui(32); var _bs = ui(32);
var _bx = x1 - ui(4) - _bs; var _bx = x1 - ui(4) - _bs;
var _by = yy + th / 2 - _bs / 2; var _by = yy + wdh / 2 - _bs / 2;
if(isEqual(data, _defVal)) if(isEqual(data, _defVal))
draw_sprite_ext(THEME.refresh_16, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark); draw_sprite_ext(THEME.refresh_16, 0, _bx + _bs / 2, _by + _bs / 2, 1, 1, 0, COLORS._main_icon_dark);
@ -951,8 +953,8 @@ event_inherited();
} }
} }
yy += th + padd + ui(8); yy += wdh + padd + ui(6);
hh += th + padd + ui(8); hh += wdh + padd + ui(6);
ind++; ind++;
} }

View File

@ -42,7 +42,7 @@ event_inherited();
var y1 = dialog_y + dialog_h - ui(16); var y1 = dialog_y + dialog_h - ui(16);
sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { #region sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { #region
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0); draw_clear_alpha(COLORS.panel_bg_clear, 1);
var expand = PREFERENCES.splash_expand_recent; var expand = PREFERENCES.splash_expand_recent;
var ww = ui(264); var ww = ui(264);
var hh = ui(8); var hh = ui(8);

View File

@ -15,10 +15,6 @@ function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, cont
var dia = dialogCall(o_dialog_menubox, _x, _y); 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)) { if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) {
var callbacks = CONTEXT_MENU_CALLBACK[? menu_id]; var callbacks = CONTEXT_MENU_CALLBACK[? menu_id];

View File

@ -21,7 +21,7 @@ function line_get_width(txt, font = noone, offset = 0) {
} }
#region global #region global
#macro TEXTBOX_HEIGHT line_get_height(f_p1, 8) #macro TEXTBOX_HEIGHT line_get_height(f_p1, 6)
#macro BUTTON_HEIGHT line_get_height(f_p1, 12) #macro BUTTON_HEIGHT line_get_height(f_p1, 12)
function ui(val) { function ui(val) {

View File

@ -41,7 +41,7 @@
LATEST_VERSION = 1_17_00; LATEST_VERSION = 1_17_00;
VERSION = 1_17_12_0; VERSION = 1_17_12_0;
SAVE_VERSION = 1_17_10_0; SAVE_VERSION = 1_17_10_0;
VERSION_STRING = MAC? "1.18.002m" : "1.18.rc1.003"; VERSION_STRING = MAC? "1.18.002m" : "1.18.rc1.004";
BUILD_NUMBER = 1_17_12_0; BUILD_NUMBER = 1_17_12_0;
HOTKEYS = ds_map_create(); HOTKEYS = ds_map_create();
@ -87,6 +87,8 @@
#macro NOT_LOAD !LOADING && !APPENDING #macro NOT_LOAD !LOADING && !APPENDING
#macro WIN_X window_get_x()
#macro WIN_Y window_get_y()
#macro WIN_W window_get_width() #macro WIN_W window_get_width()
#macro WIN_H window_get_height() #macro WIN_H window_get_height()
@ -95,8 +97,8 @@
#macro UI_SCALE PREFERENCES.display_scaling #macro UI_SCALE PREFERENCES.display_scaling
#macro mouse_mx (PEN_USE? PEN_X : (WINDOW_ACTIVE == noone? device_mouse_x_to_gui(0) : winwin_mouse_get_x(WINDOW_ACTIVE))) #macro mouse_mx (PEN_USE? PEN_X : winwin_mouse_get_x_safe(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_my (PEN_USE? PEN_Y : winwin_mouse_get_y_safe(WINDOW_ACTIVE))
#macro mouse_mxs (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx) #macro mouse_mxs (FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx)
#macro mouse_mys (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my) #macro mouse_mys (FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my)
@ -106,7 +108,7 @@
#macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)] #macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)]
#macro sFOCUS (FOCUS == self.id) #macro sFOCUS (FOCUS == self.id)
#macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over(WINDOW_ACTIVE)))) #macro sHOVER (!CURSOR_IS_LOCK && (HOVER == self.id || (WINDOW_ACTIVE != noone && winwin_mouse_is_over_safe(WINDOW_ACTIVE))))
#macro DELTA_TIME delta_time / 1_000_000 #macro DELTA_TIME delta_time / 1_000_000

View File

@ -30,7 +30,7 @@ function mouse_click(mouse, focus = true) {
if(PEN_RIGHT_CLICK) return mouse == mb_right; if(PEN_RIGHT_CLICK) return mouse == mb_right;
return WINDOW_ACTIVE == noone? mouse_check_button(mouse) : winwin_mouse_check_button(WINDOW_ACTIVE, mouse); return WINDOW_ACTIVE == noone? mouse_check_button(mouse) : winwin_mouse_check_button_safe(WINDOW_ACTIVE, mouse);
} }
function mouse_press(mouse, focus = true) { function mouse_press(mouse, focus = true) {
@ -41,9 +41,9 @@ function mouse_press(mouse, focus = true) {
if(PEN_RIGHT_PRESS) return mouse == mb_right; if(PEN_RIGHT_PRESS) return mouse == mb_right;
if(WINDOW_ACTIVE == noone) return mouse_check_button_pressed(mouse); if(WINDOW_ACTIVE == noone) return mouse_check_button_pressed(mouse);
if(mouse != mb_any) return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mouse); if(mouse != mb_any) return winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mouse);
return winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left) || winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right); return winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_left) || winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_right);
} }
function mouse_release(mouse, focus = true) { function mouse_release(mouse, focus = true) {
@ -52,7 +52,7 @@ function mouse_release(mouse, focus = true) {
if(PEN_RIGHT_RELEASE) return mouse == mb_right; if(PEN_RIGHT_RELEASE) return mouse == mb_right;
var rl = WINDOW_ACTIVE == noone? mouse_check_button_released(mouse) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mouse); var rl = WINDOW_ACTIVE == noone? mouse_check_button_released(mouse) : winwin_mouse_check_button_released_safe(WINDOW_ACTIVE, mouse);
return rl || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED); return rl || ((mouse == mb_left || mouse == mb_any) && PEN_RELEASED);
} }
@ -62,7 +62,7 @@ function mouse_lclick(focus = true) {
if(!focus) return false; if(!focus) return false;
if(PEN_RIGHT_CLICK || PEN_RIGHT_RELEASE) return false; if(PEN_RIGHT_CLICK || PEN_RIGHT_RELEASE) return false;
return WINDOW_ACTIVE == noone? mouse_check_button(mb_left) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_left); return WINDOW_ACTIVE == noone? mouse_check_button(mb_left) : winwin_mouse_check_button_safe(WINDOW_ACTIVE, mb_left);
} }
function mouse_lpress(focus = true) { function mouse_lpress(focus = true) {
@ -71,7 +71,7 @@ function mouse_lpress(focus = true) {
if(!focus) return false; if(!focus) return false;
if(PEN_RIGHT_PRESS) return false; if(PEN_RIGHT_PRESS) return false;
return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_left) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_left); return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_left) : winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_left);
} }
function mouse_lrelease(focus = true) { function mouse_lrelease(focus = true) {
@ -80,7 +80,7 @@ function mouse_lrelease(focus = true) {
if(PEN_RIGHT_RELEASE) return false; if(PEN_RIGHT_RELEASE) return false;
if(PEN_RELEASED) return true; if(PEN_RELEASED) return true;
return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_left) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_left); return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_left) : winwin_mouse_check_button_released_safe(WINDOW_ACTIVE, mb_left);
} }
function mouse_rclick(focus = true) { function mouse_rclick(focus = true) {
@ -89,7 +89,7 @@ function mouse_rclick(focus = true) {
if(!focus) return false; if(!focus) return false;
if(PEN_RIGHT_CLICK) return true; if(PEN_RIGHT_CLICK) return true;
return WINDOW_ACTIVE == noone? mouse_check_button(mb_right) : winwin_mouse_check_button(WINDOW_ACTIVE, mb_right); return WINDOW_ACTIVE == noone? mouse_check_button(mb_right) : winwin_mouse_check_button_safe(WINDOW_ACTIVE, mb_right);
} }
function mouse_rpress(focus = true) { function mouse_rpress(focus = true) {
@ -98,7 +98,7 @@ function mouse_rpress(focus = true) {
if(!focus) return false; if(!focus) return false;
if(PEN_RIGHT_PRESS) return true; if(PEN_RIGHT_PRESS) return true;
return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_right) : winwin_mouse_check_button_pressed(WINDOW_ACTIVE, mb_right); return WINDOW_ACTIVE == noone? mouse_check_button_pressed(mb_right) : winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_right);
} }
function mouse_rrelease(focus = true) { function mouse_rrelease(focus = true) {
@ -106,7 +106,7 @@ function mouse_rrelease(focus = true) {
if(!focus) return false; if(!focus) return false;
if(PEN_RIGHT_RELEASE) return true; if(PEN_RIGHT_RELEASE) return true;
return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_right) : winwin_mouse_check_button_released(WINDOW_ACTIVE, mb_right); return WINDOW_ACTIVE == noone? mouse_check_button_released(mb_right) : winwin_mouse_check_button_released_safe(WINDOW_ACTIVE, mb_right);
} }
function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) { function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) {
@ -119,5 +119,5 @@ function mouse_lock(mx = CURSOR_LOCK_X, my = CURSOR_LOCK_Y) {
window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y); window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y);
} }
function mouse_wheel_up_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_up() : winwin_mouse_wheel_up(WINDOW_ACTIVE); } function mouse_wheel_up_override() { return (WINDOW_ACTIVE != noone && winwin_exists(WINDOW_ACTIVE))? winwin_mouse_wheel_up(WINDOW_ACTIVE) : __mouse_wheel_up(); }
function mouse_wheel_down_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_down() : winwin_mouse_wheel_down(WINDOW_ACTIVE); } function mouse_wheel_down_override() { return (WINDOW_ACTIVE != noone && winwin_exists(WINDOW_ACTIVE))? winwin_mouse_wheel_down(WINDOW_ACTIVE) : __mouse_wheel_down(); }

View File

@ -513,7 +513,7 @@ function ThemeColor() constructor {
panel_animation_dope_blend_default = merge_color(CDEF.blue, CDEF.main_dkblack, 0.5); panel_animation_dope_blend_default = merge_color(CDEF.blue, CDEF.main_dkblack, 0.5);
panel_animation_dope_blend = CDEF.main_dkblack; panel_animation_dope_blend = CDEF.main_dkblack;
panel_bg_clear_inner = CDEF.main_dkblack; panel_bg_clear_inner = CDEF.main_mdblack;
panel_bg_clear = CDEF.main_black; panel_bg_clear = CDEF.main_black;
panel_frame = CDEF.main_dkgrey; panel_frame = CDEF.main_dkgrey;
panel_prop_bg = CDEF.main_ltgrey; panel_prop_bg = CDEF.main_ltgrey;

View File

@ -27,7 +27,7 @@ function winManInit() { #region
window_preminimize_rect = [ 0, 0, 1, 1 ]; window_preminimize_rect = [ 0, 0, 1, 1 ];
} #endregion } #endregion
function winMan_getData(curr = true) { #region function winMan_getData(curr = true) {
INLINE INLINE
var _monitors = display_measure_all(); var _monitors = display_measure_all();
if(!is_array(_monitors) || array_empty(_monitors)) if(!is_array(_monitors) || array_empty(_monitors))
@ -52,23 +52,23 @@ function winMan_getData(curr = true) { #region
} }
return _monitors[0]; return _monitors[0];
} #endregion }
function winMan_setRect(_x, _y, _w, _h) { #region function winMan_setRect(_x, _y, _w, _h) {
INLINE INLINE
_w = max(window_min_w, _w); _w = max(window_min_w, _w);
_h = max(window_min_h, _h); _h = max(window_min_h, _h);
window_set_rectangle(_x, _y, _w, _h); window_set_rectangle(_x, _y, _w, _h);
} #endregion }
function winMan_isMinimized() { #region function winMan_isMinimized() {
INLINE INLINE
if(OS == os_macosx) return false; if(OS == os_macosx) return false;
return gameframe_is_natively_minimized(); return gameframe_is_natively_minimized();
} #endregion }
function winMan_Maximize() { #region function winMan_Maximize() {
INLINE INLINE
if(gameframe_is_natively_minimized()) return; if(gameframe_is_natively_minimized()) return;
window_is_maximized = true; window_is_maximized = true;
@ -76,9 +76,9 @@ function winMan_Maximize() { #region
var _mon = winMan_getData(); var _mon = winMan_getData();
winMan_setRect(_mon[4], _mon[5], _mon[6], _mon[7]); winMan_setRect(_mon[4], _mon[5], _mon[6], _mon[7]);
gameframe_set_shadow(false); gameframe_set_shadow(false);
} #endregion }
function winMan_Unmaximize() { #region function winMan_Unmaximize() {
INLINE INLINE
if(gameframe_is_natively_minimized()) return; if(gameframe_is_natively_minimized()) return;
window_is_maximized = false; window_is_maximized = false;
@ -92,15 +92,15 @@ function winMan_Unmaximize() { #region
window_minimize_size[1] window_minimize_size[1]
); );
gameframe_set_shadow(true); gameframe_set_shadow(true);
} #endregion }
function winMan_Minimize() { #region function winMan_Minimize() {
INLINE INLINE
if(gameframe_is_natively_minimized()) return; if(gameframe_is_natively_minimized()) return;
gameframe_syscommand(61472); gameframe_syscommand(61472);
} #endregion }
function winMan_initDrag(_index) { #region function winMan_initDrag(_index) {
window_drag_status = _index; window_drag_status = _index;
window_drag_hold = 0; window_drag_hold = 0;
window_drag_mx = mouse_raw_x; window_drag_mx = mouse_raw_x;
@ -109,9 +109,9 @@ function winMan_initDrag(_index) { #region
window_drag_sy = window_get_y(); window_drag_sy = window_get_y();
window_drag_sw = window_get_width(); window_drag_sw = window_get_width();
window_drag_sh = window_get_height(); window_drag_sh = window_get_height();
} #endregion }
function winMan_setFullscreen(full) { #region function winMan_setFullscreen(full) {
if(full == window_is_fullscreen) return; if(full == window_is_fullscreen) return;
window_is_fullscreen = full; window_is_fullscreen = full;
@ -125,9 +125,9 @@ function winMan_setFullscreen(full) { #region
} }
run_in(5, function() { DISPLAY_REFRESH }); run_in(5, function() { DISPLAY_REFRESH });
} #endregion }
function winManStep() { #region function winManStep() {
if(OS == os_macosx) { if(OS == os_macosx) {
if(__win_to_dock) { if(__win_to_dock) {
_window_set_showborder(window_handle(), true); _window_set_showborder(window_handle(), true);
@ -214,9 +214,9 @@ function winManStep() { #region
window_minimize_size = [ sw, sh ]; window_minimize_size = [ sw, sh ];
window_drag_status = 0; window_drag_status = 0;
} }
} #endregion }
function winManDraw() { #region function winManDraw() {
if(window_is_maximized || window_is_fullscreen) return; if(window_is_maximized || window_is_fullscreen) return;
var pd = window_resize_padding; var pd = window_resize_padding;
@ -269,4 +269,4 @@ function winManDraw() { #region
if(hv > -1 && mouse_press(mb_left)) if(hv > -1 && mouse_press(mb_left))
winMan_initDrag(hv); winMan_initDrag(hv);
} #endregion }

View File

@ -20,3 +20,21 @@ function winwin_config() constructor {
static owner = undefined; static owner = undefined;
} }
#macro __ww_valid (ww != noone && winwin_exists(ww))
function winwin_get_x_safe(ww) { return __ww_valid? winwin_get_x(ww) : window_get_x(); }
function winwin_get_y_safe(ww) { return __ww_valid? winwin_get_y(ww) : window_get_y(); }
function winwin_get_width_safe(ww) { return __ww_valid? winwin_get_width(ww) : window_get_width(); }
function winwin_get_height_safe(ww) { return __ww_valid? winwin_get_height(ww) : window_get_height(); }
function winwin_set_position_safe(ww, _x, _y) { if(__ww_valid) winwin_set_position(ww, _x, _y); }
function winwin_set_size_safe(ww, _w, _h) { if(__ww_valid) winwin_set_size(ww, _w, _h); }
function winwin_mouse_get_x_safe(ww) { return __ww_valid? winwin_mouse_get_x(ww) : device_mouse_x_to_gui(0); }
function winwin_mouse_get_y_safe(ww) { return __ww_valid? winwin_mouse_get_y(ww) : device_mouse_y_to_gui(0); }
function winwin_mouse_is_over_safe(ww) { return __ww_valid? winwin_mouse_is_over(ww) : false; }
function winwin_mouse_check_button_safe(ww, bb) { return __ww_valid? winwin_mouse_check_button(ww, bb) : mouse_check_button(bb); }
function winwin_mouse_check_button_pressed_safe(ww, bb) { return __ww_valid? winwin_mouse_check_button_pressed(ww, bb) : mouse_check_button_pressed(bb); }
function winwin_mouse_check_button_released_safe(ww, bb) { return __ww_valid? winwin_mouse_check_button_released(ww, bb) : mouse_check_button_released(bb); }