diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index b17f987ce..c7417823e 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -15,6 +15,7 @@ {"name":"addons","order":142,"path":"folders/addons.yy",}, {"name":"animation_curve","order":143,"path":"folders/animation_curve.yy",}, {"name":"dialog","order":144,"path":"folders/dialog.yy",}, + {"name":"Extensions","order":157,"path":"folders/Extensions.yy",}, {"name":"font","order":145,"path":"folders/font.yy",}, {"name":"functions","order":146,"path":"folders/functions.yy",}, {"name":"camera","order":7,"path":"folders/functions/3d/camera.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 758c36f4d..a86f728cc 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -50,6 +50,7 @@ {"$GMFolder":"","%Name":"inspector","folderPath":"folders/dialog/inspector.yy","name":"inspector","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"menu","folderPath":"folders/dialog/menu.yy","name":"menu","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"widget","folderPath":"folders/dialog/widget.yy","name":"widget","resourceType":"GMFolder","resourceVersion":"2.0",}, + {"$GMFolder":"","%Name":"Extensions","folderPath":"folders/Extensions.yy","name":"Extensions","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"font","folderPath":"folders/font.yy","name":"font","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"functions","folderPath":"folders/functions.yy","name":"functions","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"3d","folderPath":"folders/functions/3d.yy","name":"3d","resourceType":"GMFolder","resourceVersion":"2.0",}, diff --git a/objects/_p_dialog/Create_0.gml b/objects/_p_dialog/Create_0.gml index e0326617d..596057359 100644 --- a/objects/_p_dialog/Create_0.gml +++ b/objects/_p_dialog/Create_0.gml @@ -24,6 +24,7 @@ _dialog_h = 320; dialog_x = 0; dialog_y = 0; + anchor = ANCHOR.none; title = "dialog"; window = noone; @@ -40,7 +41,6 @@ destroy_on_escape = true; destroy_on_click_out = false; - anchor = ANCHOR.none; init_pressing = mouse_click(mb_left); #endregion @@ -82,15 +82,8 @@ 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); + var _cfg = winwin_config_ext(title, winwin_kind_borderless, false, true); + window = winwin_create_ext(_wx + _dx, _wy + _dy, dialog_w, dialog_h, _cfg); dialog_x = 0; dialog_y = 0; } @@ -334,14 +327,16 @@ function checkMouse() { if(!active) return; if(!DIALOG_CLICK) return; + if(init_pressing) return; - WINDOW_ACTIVE = window; - - if(!init_pressing && mouse_press(mb_any)) { - if(!isTop()) return; + if(MOUSE_POOL.lpress || MOUSE_POOL.rpress) { //print($"Closing {title}"); + if(!isTop()) { + // print($" > Not close, not on top.") + return; + } 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_raw_x, mouse_raw_y)) { instance_destroy(self); diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 68f76ede7..cb749450c 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -4,6 +4,7 @@ event_inherited(); #region data draggable = false; + title = "Add node"; node_target_x = 0; node_target_y = 0; node_target_x_raw = 0; @@ -60,6 +61,8 @@ event_inherited(); category_width = maxLen + ui(56); #endregion + function isTop() { return true; } + function trigger_favourite() { if(node_menu_selecting == noone) return; @@ -81,7 +84,7 @@ event_inherited(); menuItem(fav? __txtx("add_node_remove_favourite", "Remove from favourite") : __txtx("add_node_add_favourite", "Add to favourite"), trigger_favourite, THEME.star) ]; - menuCall("add_node_window_manu", menu, 0, 0, fa_left, node_menu_selecting); + menuCall("add_node_window_menu", menu, 0, 0, fa_left); } function filtered(node) { diff --git a/objects/o_dialog_exit/Create_0.gml b/objects/o_dialog_exit/Create_0.gml index 4c123101a..350989fa4 100644 --- a/objects/o_dialog_exit/Create_0.gml +++ b/objects/o_dialog_exit/Create_0.gml @@ -6,4 +6,25 @@ event_inherited(); dialog_w = ui(440); dialog_h = ui(140); + + function resetPosition() { + if(!active) return; + dialog_x = xstart - dialog_w / 2; + dialog_y = ystart - dialog_h / 2; + + dialog_x = round(clamp(dialog_x, 2, WIN_SW - dialog_w - 2)); + dialog_y = round(clamp(dialog_y, 2, WIN_SH - dialog_h - 2)); + + if(PREFERENCES.multi_window) { + var _wx = WIN_X + dialog_x; + var _wy = WIN_Y + dialog_y; + + var _cfg = winwin_config_ext("Exit", winwin_kind_borderless, false, false); + window = winwin_create_ext(_wx, _wy, dialog_w, dialog_h, _cfg); + + dialog_x = 0; + dialog_y = 0; + } + } + #endregion \ No newline at end of file diff --git a/objects/o_dialog_exit/Destroy_0.gml b/objects/o_dialog_exit/Destroy_0.gml new file mode 100644 index 000000000..00866f91b --- /dev/null +++ b/objects/o_dialog_exit/Destroy_0.gml @@ -0,0 +1,2 @@ +/// @description Insert description here +event_inherited(); \ No newline at end of file diff --git a/objects/o_dialog_exit/Draw_64.gml b/objects/o_dialog_exit/Draw_64.gml index 05bb3927c..244301dd2 100644 --- a/objects/o_dialog_exit/Draw_64.gml +++ b/objects/o_dialog_exit/Draw_64.gml @@ -16,10 +16,12 @@ if !ready exit; } #endregion -#region base UI - DIALOG_DRAW_BG - if(sFOCUS) DIALOG_DRAW_FOCUS -#endregion +DIALOG_PREDRAW +DIALOG_WINCLEAR + +var _des = false; +DIALOG_DRAW_BG +if(sFOCUS) DIALOG_DRAW_FOCUS #region text var py = dialog_y + ui(16); @@ -33,7 +35,7 @@ if !ready exit; draw_text_ext(dialog_x + ui(24), py, txt, -1, dialog_w - ui(48)); _dialog_h = ui(118) + string_height_ext(txt, -1, dialog_w - ui(48)); - var bw = ui(96), bh = BUTTON_HEIGHT; + var bw = ui(96), bh = BUTTON_HEIGHT; var bx1 = dialog_x + dialog_w - ui(16); var by1 = dialog_y + dialog_h - ui(16); var bx0 = bx1 - bw; @@ -43,7 +45,7 @@ if !ready exit; var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel")); if(b == 2) - instance_destroy(); + _des = true; bx0 -= bw + ui(12); var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER); @@ -51,7 +53,7 @@ if !ready exit; if(b == 2) { if(instance_number(o_dialog_exit) == 1) close_program(); - instance_destroy(); + _des = true; } bx0 -= bw + ui(12); @@ -60,8 +62,12 @@ if !ready exit; if(b == 2 && SAVE(project)) { if(instance_number(o_dialog_exit) == 1) close_program(); - instance_destroy(); + _des = true; } dialog_h = _dialog_h; -#endregion \ No newline at end of file +#endregion + +DIALOG_POSTDRAW + +if(_des) instance_destroy(); \ No newline at end of file diff --git a/objects/o_dialog_exit/o_dialog_exit.yy b/objects/o_dialog_exit/o_dialog_exit.yy index a3e970bbe..8914aa4db 100644 --- a/objects/o_dialog_exit/o_dialog_exit.yy +++ b/objects/o_dialog_exit/o_dialog_exit.yy @@ -4,6 +4,7 @@ "eventList":[ {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, + {"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, ], "managed":true, "name":"o_dialog_exit", diff --git a/objects/o_dialog_menubox/Create_0.gml b/objects/o_dialog_menubox/Create_0.gml index ef200ee26..de0c8bbf9 100644 --- a/objects/o_dialog_menubox/Create_0.gml +++ b/objects/o_dialog_menubox/Create_0.gml @@ -11,15 +11,15 @@ event_inherited(); menu_id = ""; alarm[0] = -1; menu = 1; - font = f_p1; + font = f_p2; hght = line_get_height(font, 10); tooltips = []; show_icon = false; context = noone; submenu = noone; - _hovering_ch = true; - init_pressing = false; + _hovering_ch = true; + init_press_l = MOUSE_POOL.lpress; setFocus(self.id); @@ -31,7 +31,8 @@ event_inherited(); function setMenu(_menu, align = fa_left) { with(_p_dialog) { if(on_top) continue; other.depth = min(depth - 1, other.depth); } - menu = _menu; + title = menu_id; + menu = _menu; dialog_x = x; dialog_y = y; @@ -103,18 +104,10 @@ event_inherited(); 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; + if(window == noone || !winwin_exists(window)) { + var _cfg = winwin_config_ext("", winwin_kind_borderless, false, false); + window = winwin_create_ext(_wx, _wy, dialog_w, dialog_h, _cfg); - 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); @@ -122,9 +115,6 @@ event_inherited(); dialog_x = 0; dialog_y = 0; - - } else if(winwin_exists(window)) { - winwin_destroy(window); } } #endregion \ 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 989249ef0..53a1de383 100644 --- a/objects/o_dialog_menubox/Draw_64.gml +++ b/objects/o_dialog_menubox/Draw_64.gml @@ -73,23 +73,27 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1); }; if(_menuItem.isShelf) { + FOCUS_CONTENT = context; + var _res = _menuItem.func(_dat); if(submenu) instance_destroy(submenu); submenu = _res; } else if(remove_parents) { + DIALOG_POSTDRAW + FOCUS_CONTENT = context; + if(_par == noone) _menuItem.func(); else _menuItem.func(_par); - - DIALOG_POSTDRAW instance_destroy(o_dialog_menubox); // close all exit; } else { + DIALOG_POSTDRAW + FOCUS_CONTENT = context; + if(_par == noone) _menuItem.func(); else _menuItem.func(_par); - - DIALOG_POSTDRAW instance_destroy(); exit; } @@ -155,7 +159,7 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1); if(is_string(_sprs)) { _str = _sprs; - draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text); + draw_set_text(font, fa_center, fa_center, COLORS._main_text); _sw = string_width(_str) + ui(12); _sh = string_height(_str) + ui(8); @@ -177,9 +181,9 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1); draw_sprite_stretched_ext(THEME.textbox, 1, _bx - _sw / 2, _by - _sh / 2, _sw, _sh, COLORS.dialog_menubox_highlight, 1); if(mouse_press(mb_left, sFOCUS)) { - _submenu[1](_dat); - DIALOG_POSTDRAW + + _submenu[1](_dat); instance_destroy(o_dialog_menubox); exit; } @@ -232,11 +236,10 @@ winwin_draw_clear(COLORS.panel_bg_clear, 1); if(hk_editing == _menuItem) { draw_set_color(COLORS._main_accent); - // draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, COLORS._main_text_accent, .5); + if(_ktxt == "") _ktxt = "-"; } else if(_ktxt != "") { draw_set_color(COLORS._main_text_sub); - // draw_sprite_stretched_ext(THEME.ui_panel, 1, _bx, _by, _bw, _bh, CDEF.main_dkgrey, .5); } draw_text(_hx, _hy - ui(2), _ktxt); diff --git a/objects/o_dialog_menubox/Step_1.gml b/objects/o_dialog_menubox/Step_1.gml index b6ee0faf7..91834d31d 100644 --- a/objects/o_dialog_menubox/Step_1.gml +++ b/objects/o_dialog_menubox/Step_1.gml @@ -7,8 +7,14 @@ if(item_sel_submenu) { exit; } +if(init_press_l) { + if(MOUSE_POOL.lrelease) + init_press_l = false; + 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 +if(!hov && MOUSE_POOL.lpress) instance_destroy(); \ No newline at end of file diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 3a4d9baaa..91525bab0 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -47,6 +47,8 @@ _FILE_DROPPED = false; #region window & mouse //if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG; + global_mouse_pool_init(); + if(_cursor != CURSOR) { window_set_cursor(CURSOR); _cursor = CURSOR; diff --git a/scripts/contextMenu_controller/contextMenu_controller.gml b/scripts/contextMenu_controller/contextMenu_controller.gml index 5ceb83cca..8d2b78030 100644 --- a/scripts/contextMenu_controller/contextMenu_controller.gml +++ b/scripts/contextMenu_controller/contextMenu_controller.gml @@ -5,7 +5,7 @@ FOCUS_BEFORE = noone; #endregion -function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, context = noone) { +function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left) { if(array_empty(menu)) return noone; FOCUS_BEFORE = FOCUS; @@ -22,13 +22,13 @@ function menuCall(menu_id = "", menu = [], _x = 0, _y = 0, align = fa_left, cont array_append(menu, callbacks[i].populate()); } + dia.context = self; dia.menu_id = menu_id; - dia.context = context; dia.setMenu(menu, align); return dia; } -function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], context = noone) { +function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = []) { var dia = instance_create(_x, _y, o_pie_menu); if(menu_id != "" && ds_map_exists(CONTEXT_MENU_CALLBACK, menu_id)) { var callbacks = CONTEXT_MENU_CALLBACK[? menu_id]; @@ -37,8 +37,8 @@ function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], cont array_append(menu, callbacks[i].populate()); } + dia.context = self; dia.menu_id = menu_id; - dia.context = context; dia.setMenu(menu); return dia; } @@ -46,11 +46,12 @@ function pieMenuCall(menu_id = "", _x = mouse_mx, _y = mouse_my, menu = [], cont function submenuCall(_data = undefined, menu = []) { if(is_undefined(_data)) return menuCall("", menu); - var dia = instance_create_depth(_data.x - ui(4), _data.y, _data.depth - 1, o_dialog_menubox); - dia.context = _data.context; + var _xx = _data.x - 1; + var dia = instance_create_depth(_xx, _data.y, _data.depth - 1, o_dialog_menubox); + dia.context = _data.context; dia.setMenu(menu); - if(_data.x - ui(4) + dia.dialog_w > WIN_W - ui(2)) + if(_xx + dia.dialog_w > WIN_W - ui(2)) dia.dialog_x = _data._x - dia.dialog_w + ui(4); return dia; diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index db77610c4..b4d00fa11 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -97,6 +97,7 @@ #macro UI_SCALE PREFERENCES.display_scaling + #macro mouse_ui [mouse_mx, mouse_my] #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)) @@ -105,7 +106,6 @@ #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 || (WINDOW_ACTIVE != noone && winwin_mouse_is_over_safe(WINDOW_ACTIVE)))) diff --git a/scripts/mouse_input/mouse_input.gml b/scripts/mouse_input/mouse_input.gml index 53dde9e00..97145a4e3 100644 --- a/scripts/mouse_input/mouse_input.gml +++ b/scripts/mouse_input/mouse_input.gml @@ -1,12 +1,18 @@ #region mouse global globalvar CURSOR, CURSOR_LOCK, CURSOR_IS_LOCK, CURSOR_LOCK_X, CURSOR_LOCK_Y; globalvar MOUSE_WRAP, MOUSE_WRAPPING, MOUSE_BLOCK, _MOUSE_BLOCK; + globalvar MOUSE_POOL; MOUSE_WRAP = false; MOUSE_WRAPPING = false; MOUSE_BLOCK = false; _MOUSE_BLOCK = false; PEN_RELEASED = false; + MOUSE_POOL = { + lclick: false, lpress: false, lrelease: false, + rclick: false, rpress: false, rrelease: false, + mclick: false, mpress: false, mrelease: false, + } #macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed #macro MOUSE_MOVED (window_mouse_get_delta_x() || window_mouse_get_delta_y()) @@ -23,6 +29,37 @@ } #endregion +function global_mouse_pool_init() { + MOUSE_POOL.lclick = mouse_check_button(mb_left); + MOUSE_POOL.rclick = mouse_check_button(mb_right); + MOUSE_POOL.mclick = mouse_check_button(mb_middle); + + MOUSE_POOL.lpress = mouse_check_button_pressed(mb_left); + MOUSE_POOL.rpress = mouse_check_button_pressed(mb_right); + MOUSE_POOL.mpress = mouse_check_button_pressed(mb_middle); + + MOUSE_POOL.lrelease = mouse_check_button_released(mb_left); + MOUSE_POOL.rrelease = mouse_check_button_released(mb_right); + MOUSE_POOL.mrelease = mouse_check_button_released(mb_middle); + + for( var i = 0, n = array_length(global.winwin_all); i < n; i++ ) { + var ww = global.winwin_all[i]; + if(!__ww_valid) continue; + + MOUSE_POOL.lclick |= winwin_mouse_check_button(ww, mb_left); + MOUSE_POOL.rclick |= winwin_mouse_check_button(ww, mb_right); + MOUSE_POOL.mclick |= winwin_mouse_check_button(ww, mb_middle); + + MOUSE_POOL.lpress |= winwin_mouse_check_button_pressed(ww, mb_left); + MOUSE_POOL.rpress |= winwin_mouse_check_button_pressed(ww, mb_right); + MOUSE_POOL.mpress |= winwin_mouse_check_button_pressed(ww, mb_middle); + + MOUSE_POOL.lrelease |= winwin_mouse_check_button_released(ww, mb_left); + MOUSE_POOL.rrelease |= winwin_mouse_check_button_released(ww, mb_right); + MOUSE_POOL.mrelease |= winwin_mouse_check_button_released(ww, mb_middle); + } +} + function mouse_click(mouse, focus = true) { INLINE if(MOUSE_BLOCK) return false; diff --git a/scripts/node_functions/node_functions.gml b/scripts/node_functions/node_functions.gml index 830cb5217..85711e6a0 100644 --- a/scripts/node_functions/node_functions.gml +++ b/scripts/node_functions/node_functions.gml @@ -309,9 +309,11 @@ function create_preview_window(node) { if(node == noone) return; + var win = new Panel_Preview_Window(); win.node_target = node; win.preview_channel = node.preview_channel; + var dia = dialogPanelCall(win, mouse_mx, mouse_my); dia.destroy_on_click_out = false; } diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index 549958355..3f331cdfd 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -963,7 +963,6 @@ function PanelContent() constructor { if(pFOCUS) FOCUS_CONTENT = self; } - drawContent(panel); } diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 6edc15d7c..0660021b9 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -811,7 +811,7 @@ function Panel_Inspector() : PanelContent() constructor { if(mouse_press(mb_left, pFOCUS)) jun[@ 1] = !coll; if(mouse_press(mb_right, pFOCUS)) - menuCall("inspector_group_menu", group_menu, 0, 0, fa_left, _inspecting); + menuCall("inspector_group_menu", group_menu, 0, 0, fa_left); } else draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_bg, 1); diff --git a/scripts/panel_preview_window/panel_preview_window.gml b/scripts/panel_preview_window/panel_preview_window.gml index 8c20c4029..ef1b4bec7 100644 --- a/scripts/panel_preview_window/panel_preview_window.gml +++ b/scripts/panel_preview_window/panel_preview_window.gml @@ -170,7 +170,8 @@ function Panel_Preview_Window() : PanelContent() constructor { array_push(_menu, menuItem(o.name, function(_dat) { changeChannel(_dat.index); }, noone, noone, noone, { index: _chan })); _chan++; } - menuCall("preview_window_menu", _menu, 0, 0, fa_left, node_target); + + menuCall("preview_window_menu", _menu, 0, 0, fa_left); } } } \ No newline at end of file diff --git a/scripts/winwin_extras/winwin_extras.gml b/scripts/winwin_extras/winwin_extras.gml index e6ac9b633..01a2dae82 100644 --- a/scripts/winwin_extras/winwin_extras.gml +++ b/scripts/winwin_extras/winwin_extras.gml @@ -1,27 +1,53 @@ global.__winwin_map = ds_map_create(); +global.winwin_all = []; function winwin(_ptr) constructor { __ptr__ = _ptr; } +function winwin_config_ext(caption = "", kind = winwin_kind_normal, topmost = false, resize = false, owner = winwin_main) { + var cnf = new winwin_config(); + + cnf.caption = caption; + cnf.kind = kind; + cnf.topmost = topmost; + cnf.resize = resize; + cnf.owner = owner; + cnf.per_pixel_alpha = true; + + return cnf; +} + 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 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; + static thread = false; + static vsync = 0; + static close_button = 1; + static owner = undefined; } #macro __ww_valid (ww != noone && winwin_exists(ww)) +function winwin_create_ext(_x, _y, _w, _h, _conf) { + var window = winwin_create(_x, _y, _w, _h, _conf); + array_push(global.winwin_all, window); + + return window; +} + +function winwin_destroy_ext(ww) { + if(__ww_valid) winwin_destroy(_ww); + array_remove(global.winwin_all, window); +} + 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(); }