diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 6f782f5e6..758c36f4d 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -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":"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":[], diff --git a/datafiles/data/Theme.zip b/datafiles/data/Theme.zip index 05b32010d..cfe1f8dce 100644 Binary files a/datafiles/data/Theme.zip and b/datafiles/data/Theme.zip differ diff --git a/objects/_p_dialog/Create_0.gml b/objects/_p_dialog/Create_0.gml index 8ddedb928..e0326617d 100644 --- a/objects/_p_dialog/Create_0.gml +++ b/objects/_p_dialog/Create_0.gml @@ -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_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; } +#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; } #region data on_top = false; @@ -27,6 +27,7 @@ title = "dialog"; window = noone; + window_drawing = false; title_height = 64; padding = 20; @@ -72,11 +73,10 @@ 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)); + 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) { + 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_x = mouse_mx; o_main.dialog_popup_y = mouse_my; @@ -117,7 +117,7 @@ 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); + winwin_set_position_safe(window, _dx, _dy); if(mouse_release(mb_left)) dialog_dragging = false; @@ -129,8 +129,8 @@ 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_sx = winwin_get_x_safe(window); + dialog_drag_sy = winwin_get_y_safe(window); dialog_drag_mx = mouse_raw_x; dialog_drag_my = mouse_raw_y; } @@ -215,7 +215,7 @@ } 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; } @@ -255,9 +255,12 @@ #endregion #region focus - function point_in(mx, my) { + function point_in(raw_x, raw_y) { 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 x0 = dialog_x - _r; var x1 = dialog_x + dialog_w + _r; @@ -272,8 +275,8 @@ WINDOW_ACTIVE = window; if(window == noone) { - var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx; - var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my; + var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_raw_x; + var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_raw_y; if(point_in(_mx, _my)) { if(depth < DIALOG_DEPTH_HOVER) { @@ -281,8 +284,8 @@ HOVER = self.id; } } - } else { - if(winwin_mouse_is_over(window)) + } else if (winwin_exists(window)) { + if(winwin_mouse_is_over_safe(window)) HOVER = self.id; } @@ -340,7 +343,7 @@ for( var i = 0, n = array_length(children); i < n; i++ ) 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); onDestroy(); DIALOG_CLICK = false; diff --git a/objects/_p_dialog/Destroy_0.gml b/objects/_p_dialog/Destroy_0.gml index d9b5b6445..e223bdb1f 100644 --- a/objects/_p_dialog/Destroy_0.gml +++ b/objects/_p_dialog/Destroy_0.gml @@ -9,4 +9,5 @@ if(parent) array_remove(parent.children, id); if(!passthrough) MOUSE_BLOCK = true; -if(window != noone) winwin_destroy(window); \ No newline at end of file +if(window != noone && winwin_exists(window)) + winwin_destroy(window); \ No newline at end of file diff --git a/objects/_p_dialog/Step_1.gml b/objects/_p_dialog/Step_1.gml index c284313d3..386ac3c75 100644 --- a/objects/_p_dialog/Step_1.gml +++ b/objects/_p_dialog/Step_1.gml @@ -14,8 +14,8 @@ if !active exit; #region resize if(window != noone) { - dialog_w = winwin_get_width(window); - dialog_h = winwin_get_height(window); + dialog_w = winwin_get_width_safe(window); + dialog_h = winwin_get_height_safe(window); } if(_dialog_h != dialog_h || _dialog_w != dialog_w) { diff --git a/objects/o_dialog_menubox/Create_0.gml b/objects/o_dialog_menubox/Create_0.gml index 32ffcd49c..2b66b50ac 100644 --- a/objects/o_dialog_menubox/Create_0.gml +++ b/objects/o_dialog_menubox/Create_0.gml @@ -16,13 +16,14 @@ event_inherited(); tooltips = []; show_icon = false; context = noone; + submenu = noone; _hovering_ch = true; init_pressing = false; setFocus(self.id); - item_selecting = noone; + item_sel_submenu = noone; remove_parents = true; selecting_menu = noone; hk_editing = noone; @@ -38,9 +39,8 @@ event_inherited(); dialog_w = 0; dialog_h = 0; - for( var i = 0, n = array_length(children); i < n; i++ ) - instance_destroy(children[i]); - children = []; + if(submenu != noone) instance_destroy(submenu); + submenu = noone; tooltips = []; draw_set_text(font, fa_center, fa_center, COLORS._main_text); @@ -84,15 +84,41 @@ event_inherited(); if(show_icon) 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) { - case fa_left: dialog_x = round(min(dialog_x, WIN_W - dialog_w - 2)); break; - case fa_center: dialog_x = round(min(dialog_x - dialog_w / 2, 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, _mon[6] - WIN_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); 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 \ No newline at end of file diff --git a/objects/o_dialog_menubox/Destroy_0.gml b/objects/o_dialog_menubox/Destroy_0.gml index 2c7950c51..cd275adc1 100644 --- a/objects/o_dialog_menubox/Destroy_0.gml +++ b/objects/o_dialog_menubox/Destroy_0.gml @@ -1,6 +1,5 @@ event_inherited(); -for( var i = 0, n = array_length(children); i < n; i++ ) - instance_destroy(children[i]); +if(submenu) instance_destroy(submenu); if(FOCUS == noone && instance_number(o_dialog_menubox) == 1) FOCUS = FOCUS_BEFORE; \ No newline at end of file diff --git a/objects/o_dialog_menubox/Draw_64.gml b/objects/o_dialog_menubox/Draw_64.gml index 9b4a98a45..989249ef0 100644 --- a/objects/o_dialog_menubox/Draw_64.gml +++ b/objects/o_dialog_menubox/Draw_64.gml @@ -1,13 +1,16 @@ /// @description init if(!ready) exit; +DIALOG_PREDRAW +winwin_draw_clear(COLORS.panel_bg_clear, 1); + #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_selecting) { - instance_destroy(item_selecting); - item_selecting = noone; + if(!mouse_init_inside && mouse_press(mb_right) && item_sel_submenu) { + instance_destroy(item_sel_submenu); + item_sel_submenu = noone; } 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 _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(_menuItem.active && _lclick) { @@ -71,18 +74,24 @@ if(!ready) exit; if(_menuItem.isShelf) { var _res = _menuItem.func(_dat); - array_push(children, _res.id); // open child + if(submenu) instance_destroy(submenu); + submenu = _res; } else if(remove_parents) { if(_par == noone) _menuItem.func(); else _menuItem.func(_par); + + DIALOG_POSTDRAW instance_destroy(o_dialog_menubox); // close all + exit; } else { if(_par == noone) _menuItem.func(); 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; }), ]; - item_selecting = submenuCall(_dat, context_menu_settings); - item_selecting.remove_parents = false; - array_push(children, item_selecting.id); + item_sel_submenu = submenuCall(_dat, context_menu_settings); + item_sel_submenu.remove_parents = false; } } } 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 _hy = yy + hght / 2 + ui(2); @@ -170,7 +178,10 @@ if(!ready) exit; if(mouse_press(mb_left, sFOCUS)) { _submenu[1](_dat); + + DIALOG_POSTDRAW instance_destroy(o_dialog_menubox); + exit; } } @@ -252,8 +263,11 @@ if(!ready) exit; if(keyboard_check_pressed(vk_down)) selecting = safe_mod(selecting + 1, array_length(menu)); - if(keyboard_check_pressed(vk_escape)) + if(keyboard_check_pressed(vk_escape)) { + DIALOG_POSTDRAW instance_destroy(); + exit; + } } 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_text(dialog_x, dialog_y - ui(2), menu_id); } -#endregion \ No newline at end of file +#endregion + +DIALOG_POSTDRAW \ No newline at end of file diff --git a/objects/o_dialog_menubox/Step_1.gml b/objects/o_dialog_menubox/Step_1.gml index fb4773559..b6ee0faf7 100644 --- a/objects/o_dialog_menubox/Step_1.gml +++ b/objects/o_dialog_menubox/Step_1.gml @@ -1,12 +1,14 @@ /// @description Insert description here event_inherited(); -var hov = point_in(mouse_mx, mouse_my); - -for( var i = 0, n = array_length(children); i < n; i++ ) { - if(!instance_exists(children[i])) continue; - hov |= children[i].point_in(mouse_mx, mouse_my); +if(item_sel_submenu) { + if(!instance_exists(item_sel_submenu)) + item_sel_submenu = noone; + exit; } + +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; if(!hov && mouse_press(mb_left)) instance_destroy(); \ No newline at end of file diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index aa76e2757..9edab624b 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -10,6 +10,8 @@ event_inherited(); destroy_on_escape = false; should_restart = false; + + font = f_p2; #endregion #region size @@ -592,9 +594,9 @@ event_inherited(); sb_theme.align = fa_left; 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 th = line_get_height(f_p0); + var th = line_get_height(font); var x1 = sp_colors.surface_w; var yy = _y + ui(8); var padd = ui(6); @@ -623,7 +625,7 @@ event_inherited(); category = cat; 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); array_push(sect, [ _sect, sp_colors, hh + ui(12) ]); @@ -642,7 +644,7 @@ event_inherited(); keyStr = string_replace(keyStr, cat + " ", ""); 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); 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); } - yy += th + padd + ui(8); - hh += th + padd + ui(8); + yy += th + padd + ui(6); + hh += th + padd + ui(6); ind++; } @@ -739,7 +741,7 @@ event_inherited(); hk_scroll.align = fa_left; 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); var padd = ui(6); @@ -852,9 +854,9 @@ event_inherited(); current_list = pref_global; 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 th = TEXTBOX_HEIGHT; + var th = line_get_height(font, 6); var x1 = sp_pref.surface_w; var yy = _y + ui(8); var padd = ui(6); @@ -875,10 +877,9 @@ event_inherited(); for(var i = 0; i < ds_list_size(current_list); i++) { var _pref = current_list[| i]; - var th = TEXTBOX_HEIGHT; 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); 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); - 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); if(_pref.is_patreon) { @@ -930,18 +931,19 @@ event_inherited(); if(_pref.getDefault != noone) widget_w -= ui(32 + 8); - var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, data, {}, _m, _r[0], _r[1]); - params.s = ui(30); + var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, data, {}, _m, _r[0], _r[1]); + params.s = th; + params.font = font; 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.getDefault != noone) { var _defVal = is_method(_pref.getDefault)? _pref.getDefault() : _pref.getDefault; var _bs = ui(32); var _bx = x1 - ui(4) - _bs; - var _by = yy + th / 2 - _bs / 2; + var _by = yy + wdh / 2 - _bs / 2; if(isEqual(data, _defVal)) 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); - hh += th + padd + ui(8); + yy += wdh + padd + ui(6); + hh += wdh + padd + ui(6); ind++; } diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index e26ec1b08..98d4f0427 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -42,7 +42,7 @@ event_inherited(); var y1 = dialog_y + dialog_h - ui(16); 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 ww = ui(264); var hh = ui(8); diff --git a/scripts/contextMenu_controller/contextMenu_controller.gml b/scripts/contextMenu_controller/contextMenu_controller.gml index 90c78e5e5..5ceb83cca 100644 --- a/scripts/contextMenu_controller/contextMenu_controller.gml +++ b/scripts/contextMenu_controller/contextMenu_controller.gml @@ -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); - // 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]; diff --git a/scripts/draw_UI_scale/draw_UI_scale.gml b/scripts/draw_UI_scale/draw_UI_scale.gml index 9ff15ee68..6996b872f 100644 --- a/scripts/draw_UI_scale/draw_UI_scale.gml +++ b/scripts/draw_UI_scale/draw_UI_scale.gml @@ -21,7 +21,7 @@ function line_get_width(txt, font = noone, offset = 0) { } #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) function ui(val) { diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 59fb2855f..db77610c4 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -41,7 +41,7 @@ LATEST_VERSION = 1_17_00; VERSION = 1_17_12_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; HOTKEYS = ds_map_create(); @@ -87,6 +87,8 @@ #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_H window_get_height() @@ -95,8 +97,8 @@ #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_my (PEN_USE? PEN_Y : (WINDOW_ACTIVE == noone? device_mouse_y_to_gui(0) : winwin_mouse_get_y(WINDOW_ACTIVE))) + #macro mouse_mx (PEN_USE? PEN_X : winwin_mouse_get_x_safe(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_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 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 diff --git a/scripts/mouse_input/mouse_input.gml b/scripts/mouse_input/mouse_input.gml index a848d451b..53dde9e00 100644 --- a/scripts/mouse_input/mouse_input.gml +++ b/scripts/mouse_input/mouse_input.gml @@ -30,7 +30,7 @@ function mouse_click(mouse, focus = true) { 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) { @@ -41,9 +41,9 @@ function mouse_press(mouse, focus = true) { if(PEN_RIGHT_PRESS) return mouse == mb_right; 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) { @@ -52,7 +52,7 @@ function mouse_release(mouse, focus = true) { 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); } @@ -62,7 +62,7 @@ function mouse_lclick(focus = true) { if(!focus) 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) { @@ -71,7 +71,7 @@ function mouse_lpress(focus = true) { if(!focus) 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) { @@ -80,7 +80,7 @@ function mouse_lrelease(focus = true) { if(PEN_RIGHT_RELEASE) return false; 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) { @@ -89,7 +89,7 @@ function mouse_rclick(focus = true) { if(!focus) return false; 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) { @@ -98,7 +98,7 @@ function mouse_rpress(focus = true) { if(!focus) return false; 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) { @@ -106,7 +106,7 @@ function mouse_rrelease(focus = true) { if(!focus) return false; 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) { @@ -119,5 +119,5 @@ function mouse_lock(mx = CURSOR_LOCK_X, my = 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_down_override() { return WINDOW_ACTIVE == noone? __mouse_wheel_down() : winwin_mouse_wheel_down(WINDOW_ACTIVE); } \ No newline at end of file +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 && winwin_exists(WINDOW_ACTIVE))? winwin_mouse_wheel_down(WINDOW_ACTIVE) : __mouse_wheel_down(); } \ No newline at end of file diff --git a/scripts/theme_definition/theme_definition.gml b/scripts/theme_definition/theme_definition.gml index a61ba317a..3421c461c 100644 --- a/scripts/theme_definition/theme_definition.gml +++ b/scripts/theme_definition/theme_definition.gml @@ -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 = CDEF.main_dkblack; - panel_bg_clear_inner = CDEF.main_dkblack; + panel_bg_clear_inner = CDEF.main_mdblack; panel_bg_clear = CDEF.main_black; panel_frame = CDEF.main_dkgrey; panel_prop_bg = CDEF.main_ltgrey; diff --git a/scripts/windowManager/windowManager.gml b/scripts/windowManager/windowManager.gml index e8b81693e..635b62db4 100644 --- a/scripts/windowManager/windowManager.gml +++ b/scripts/windowManager/windowManager.gml @@ -27,7 +27,7 @@ function winManInit() { #region window_preminimize_rect = [ 0, 0, 1, 1 ]; } #endregion -function winMan_getData(curr = true) { #region +function winMan_getData(curr = true) { INLINE var _monitors = display_measure_all(); if(!is_array(_monitors) || array_empty(_monitors)) @@ -52,23 +52,23 @@ function winMan_getData(curr = true) { #region } return _monitors[0]; -} #endregion +} -function winMan_setRect(_x, _y, _w, _h) { #region +function winMan_setRect(_x, _y, _w, _h) { INLINE _w = max(window_min_w, _w); _h = max(window_min_h, _h); window_set_rectangle(_x, _y, _w, _h); -} #endregion +} -function winMan_isMinimized() { #region +function winMan_isMinimized() { INLINE if(OS == os_macosx) return false; return gameframe_is_natively_minimized(); -} #endregion +} -function winMan_Maximize() { #region +function winMan_Maximize() { INLINE if(gameframe_is_natively_minimized()) return; window_is_maximized = true; @@ -76,9 +76,9 @@ function winMan_Maximize() { #region var _mon = winMan_getData(); winMan_setRect(_mon[4], _mon[5], _mon[6], _mon[7]); gameframe_set_shadow(false); -} #endregion +} -function winMan_Unmaximize() { #region +function winMan_Unmaximize() { INLINE if(gameframe_is_natively_minimized()) return; window_is_maximized = false; @@ -92,15 +92,15 @@ function winMan_Unmaximize() { #region window_minimize_size[1] ); gameframe_set_shadow(true); -} #endregion +} -function winMan_Minimize() { #region +function winMan_Minimize() { INLINE if(gameframe_is_natively_minimized()) return; gameframe_syscommand(61472); -} #endregion +} -function winMan_initDrag(_index) { #region +function winMan_initDrag(_index) { window_drag_status = _index; window_drag_hold = 0; window_drag_mx = mouse_raw_x; @@ -109,9 +109,9 @@ function winMan_initDrag(_index) { #region window_drag_sy = window_get_y(); window_drag_sw = window_get_width(); window_drag_sh = window_get_height(); -} #endregion +} -function winMan_setFullscreen(full) { #region +function winMan_setFullscreen(full) { if(full == window_is_fullscreen) return; window_is_fullscreen = full; @@ -125,9 +125,9 @@ function winMan_setFullscreen(full) { #region } run_in(5, function() { DISPLAY_REFRESH }); -} #endregion +} -function winManStep() { #region +function winManStep() { if(OS == os_macosx) { if(__win_to_dock) { _window_set_showborder(window_handle(), true); @@ -214,9 +214,9 @@ function winManStep() { #region window_minimize_size = [ sw, sh ]; window_drag_status = 0; } -} #endregion +} -function winManDraw() { #region +function winManDraw() { if(window_is_maximized || window_is_fullscreen) return; var pd = window_resize_padding; @@ -269,4 +269,4 @@ function winManDraw() { #region if(hv > -1 && mouse_press(mb_left)) winMan_initDrag(hv); -} #endregion \ No newline at end of file +} \ No newline at end of file diff --git a/scripts/winwin_extras/winwin_extras.gml b/scripts/winwin_extras/winwin_extras.gml index 53d799f29..e6ac9b633 100644 --- a/scripts/winwin_extras/winwin_extras.gml +++ b/scripts/winwin_extras/winwin_extras.gml @@ -20,3 +20,21 @@ function winwin_config() constructor { 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); } \ No newline at end of file