2022-01-19 04:16:28 +01:00
|
|
|
#region data
|
2024-05-16 15:28:45 +02:00
|
|
|
globalvar PANEL_MAIN, PANEL_MENU, PANEL_PREVIEW, PANEL_INSPECTOR, PANEL_GRAPH, PANEL_ANIMATION, PANEL_COLLECTION, PANEL_FILE;
|
2024-01-16 09:56:20 +01:00
|
|
|
globalvar FULL_SCREEN_PANEL, FULL_SCREEN_CONTENT, FULL_SCREEN_PARENT;
|
2022-11-14 03:16:15 +01:00
|
|
|
|
2022-01-19 04:16:28 +01:00
|
|
|
PANEL_MAIN = 0;
|
2023-12-23 09:39:55 +01:00
|
|
|
FULL_SCREEN_PANEL = noone;
|
2022-11-14 03:16:15 +01:00
|
|
|
FULL_SCREEN_CONTENT = noone;
|
2024-01-16 09:56:20 +01:00
|
|
|
FULL_SCREEN_PARENT = noone;
|
2022-01-19 04:16:28 +01:00
|
|
|
#endregion
|
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
#region panel class
|
|
|
|
enum PANEL_CONTENT {
|
|
|
|
empty,
|
|
|
|
splith,
|
|
|
|
splitv,
|
|
|
|
menu,
|
|
|
|
inspector,
|
|
|
|
animation,
|
|
|
|
preview,
|
|
|
|
graph,
|
|
|
|
collection
|
|
|
|
}
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
#macro PANEL_PADDING padding = in_dialog? ui(24) : ui(16); \
|
|
|
|
title_height = in_dialog? ui(64) : ui(56);
|
2023-03-19 09:17:39 +01:00
|
|
|
|
2023-06-10 13:59:45 +02:00
|
|
|
#macro PANEL_TITLE draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text); \
|
|
|
|
draw_text_add(in_dialog? ui(56) : ui(24), title_height / 2 - (!in_dialog) * ui(4), title);
|
2022-09-21 06:09:40 +02:00
|
|
|
#endregion
|
|
|
|
|
2022-01-19 04:16:28 +01:00
|
|
|
#region functions
|
2023-11-18 11:49:25 +01:00
|
|
|
function clearPanel() { #region
|
2022-01-19 04:16:28 +01:00
|
|
|
delete PANEL_MAIN;
|
|
|
|
delete PANEL_MENU;
|
|
|
|
delete PANEL_INSPECTOR;
|
|
|
|
delete PANEL_PREVIEW;
|
|
|
|
delete PANEL_GRAPH;
|
2022-12-10 05:06:01 +01:00
|
|
|
delete PANEL_COLLECTION;
|
2022-01-19 04:16:28 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
PANEL_MAIN = {};
|
|
|
|
PANEL_MENU = {};
|
|
|
|
PANEL_INSPECTOR = {};
|
|
|
|
PANEL_PREVIEW = {};
|
|
|
|
PANEL_GRAPH = {};
|
2023-10-03 04:29:58 +02:00
|
|
|
PANEL_COLLECTION = {};
|
2024-05-16 15:28:45 +02:00
|
|
|
|
|
|
|
PANEL_FILE = 0;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2022-01-19 04:16:28 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function getPanelFromName(name, create = false) { #region
|
2023-03-11 01:40:17 +01:00
|
|
|
switch(name) {
|
2024-04-30 10:49:12 +02:00
|
|
|
case "Panel_Menu" : var p = (create || findPanel(name))? new Panel_Menu() : PANEL_MENU; PANEL_MENU = p; return p;
|
|
|
|
case "Panel_Inspector" : var p = (create || findPanel(name))? new Panel_Inspector() : PANEL_INSPECTOR; PANEL_INSPECTOR = p; return p;
|
|
|
|
case "Panel_Animation" : var p = (create || findPanel(name))? new Panel_Animation() : PANEL_ANIMATION; PANEL_ANIMATION = p; return p;
|
|
|
|
case "Panel_Preview" : var p = (create || findPanel(name))? new Panel_Preview() : PANEL_PREVIEW; PANEL_PREVIEW = p; return p;
|
2024-05-16 15:28:45 +02:00
|
|
|
case "Panel_Graph" : var p = (create || findPanel(name))? new Panel_Graph() : PANEL_GRAPH; PANEL_GRAPH = p; return p;
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2023-03-13 10:45:56 +01:00
|
|
|
case "Panel_Collection" : return new Panel_Collection();
|
|
|
|
case "Panel_Workspace" : return new Panel_Workspace();
|
|
|
|
case "Panel_Tunnels" : return new Panel_Tunnels();
|
|
|
|
case "Panel_History" : return new Panel_History();
|
|
|
|
case "Panel_Notification" : return new Panel_Notification();
|
|
|
|
case "Panel_Nodes" : return new Panel_Nodes();
|
2023-03-19 09:17:39 +01:00
|
|
|
case "Panel_Globalvar" : return new Panel_Globalvar();
|
2023-05-08 19:14:30 +02:00
|
|
|
case "Panel_Node_Align" : return new Panel_Node_Align();
|
2024-05-16 15:28:45 +02:00
|
|
|
case "Panel_File_Explorer" : var p = (create || findPanel(name))? new Panel_File_Explorer() : PANEL_FILE; PANEL_FILE = p; return p;
|
2023-03-25 12:27:04 +01:00
|
|
|
|
2024-05-19 15:11:45 +02:00
|
|
|
case "Panel_Color" : return new Panel_Color();
|
|
|
|
case "Panel_Palette" : return new Panel_Palette();
|
|
|
|
case "Panel_Palette_Mixer" : return new Panel_Palette_Mixer();
|
|
|
|
case "Panel_Gradient" : return new Panel_Gradient();
|
|
|
|
case "Panel_Console" : return new Panel_Console();
|
2024-05-22 04:46:29 +02:00
|
|
|
|
|
|
|
case "Panel_Preview_Histogram" : return new Panel_Preview_Histogram();
|
2023-03-11 01:40:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return noone;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function loadPanelStruct(panel, str) { #region
|
2023-03-19 09:17:39 +01:00
|
|
|
var cont = str.content;
|
|
|
|
|
|
|
|
if(variable_struct_exists(str, "split")) {
|
2024-04-30 10:49:12 +02:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
var pan = panel;
|
|
|
|
if(str.split == "v")
|
|
|
|
pan = panel.split_v(ui(str.width));
|
|
|
|
else if(str.split == "h")
|
|
|
|
pan = panel.split_h(ui(str.width));
|
|
|
|
|
|
|
|
if(pan != noone) {
|
|
|
|
loadPanelStruct(pan[0], cont[0]);
|
|
|
|
loadPanelStruct(pan[1], cont[1]);
|
|
|
|
}
|
|
|
|
} else {
|
2024-04-30 10:49:12 +02:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
if(!is_array(cont)) cont = [ cont ];
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(cont); i < n; i++ ) {
|
2024-04-30 10:49:12 +02:00
|
|
|
var _content = cont[i];
|
|
|
|
var _key = is_struct(_content)? _content.name : _content;
|
|
|
|
|
|
|
|
var _pnCont = getPanelFromName(_key, true);
|
|
|
|
if(_pnCont == noone) continue;
|
|
|
|
|
|
|
|
panel.setContent(_pnCont);
|
|
|
|
if(is_struct(_content)) _pnCont.deserialize(_content);
|
2023-03-19 09:17:39 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-19 09:17:39 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function loadPanel(path, panel) { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
CURRENT_PANEL = json_load_struct(path);
|
|
|
|
loadPanelStruct(panel, CURRENT_PANEL.panel);
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2024-03-23 07:26:11 +01:00
|
|
|
function checkPanelValid() { #region
|
2024-06-09 06:27:50 +02:00
|
|
|
var val = true;
|
|
|
|
var _mst = "";
|
|
|
|
if(!is_instanceof(PANEL_GRAPH.panel, Panel)) { val = false; _mst += "Graph, " };
|
|
|
|
if(!is_instanceof(PANEL_PREVIEW.panel, Panel)) { val = false; _mst += "Preview, " };
|
|
|
|
if(!is_instanceof(PANEL_INSPECTOR.panel, Panel)) { val = false; _mst += "Inspector, " };
|
2024-03-23 07:26:11 +01:00
|
|
|
|
|
|
|
if(!val) {
|
2024-06-09 06:27:50 +02:00
|
|
|
noti_warning($"Invalid Panel Layout, missing {_mst} panel(s). Reset to the default layout and restart recommened.");
|
2024-03-23 07:26:11 +01:00
|
|
|
|
|
|
|
PREFERENCES.panel_layout_file = "Vertical";
|
|
|
|
PREFERENCES._display_scaling = 1;
|
|
|
|
PREFERENCES.display_scaling = 0;
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-03-23 07:26:11 +01:00
|
|
|
resetScale(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
} #endregion
|
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function panelAdd(panel, create = false) { #region
|
2023-03-13 10:45:56 +01:00
|
|
|
var pan = getPanelFromName(panel, create);
|
2023-03-21 03:01:53 +01:00
|
|
|
if(pan == noone) return noone;
|
|
|
|
|
|
|
|
return dialogPanelCall(pan);
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function panelObjectInit() { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
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();
|
|
|
|
PANEL_ANIMATION = new Panel_Animation();
|
|
|
|
PANEL_PREVIEW = new Panel_Preview();
|
|
|
|
PANEL_GRAPH = new Panel_Graph();
|
2022-11-14 03:16:15 +01:00
|
|
|
PANEL_COLLECTION = new Panel_Collection();
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2024-04-22 14:13:03 +02:00
|
|
|
function resetPanel(check = true) { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
clearPanel();
|
|
|
|
panelObjectInit();
|
|
|
|
loadPanelStruct(PANEL_MAIN, CURRENT_PANEL.panel);
|
|
|
|
PANEL_MAIN.refresh();
|
2024-03-23 07:26:11 +01:00
|
|
|
|
2024-04-22 14:13:03 +02:00
|
|
|
if(check) checkPanelValid();
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function __initPanel() { #region
|
|
|
|
directory_verify($"{DIRECTORY}layouts");
|
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
if(check_version($"{DIRECTORY}layouts/version"))
|
|
|
|
zip_unzip("data/Layouts.zip", DIRECTORY);
|
2023-11-18 11:49:25 +01:00
|
|
|
|
2023-11-18 03:47:11 +01:00
|
|
|
setPanel();
|
2023-11-25 08:54:35 +01:00
|
|
|
panelDisplayInit();
|
2024-03-23 07:26:11 +01:00
|
|
|
|
|
|
|
checkPanelValid();
|
2024-05-03 09:02:18 +02:00
|
|
|
__initPanelHotkeys();
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function setPanel() { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
globalvar CURRENT_PANEL;
|
|
|
|
|
|
|
|
panelObjectInit();
|
2023-11-18 03:47:11 +01:00
|
|
|
|
2023-10-31 05:30:42 +01:00
|
|
|
var file = $"{DIRECTORY}layouts/{PREFERENCES.panel_layout_file}.json";
|
2023-12-08 03:50:09 +01:00
|
|
|
if(!file_exists_empty(file))
|
2023-05-04 20:00:56 +02:00
|
|
|
file = DIRECTORY + "layouts/Horizontal.json";
|
2023-03-11 06:40:34 +01:00
|
|
|
loadPanel(file, PANEL_MAIN);
|
2022-01-19 04:16:28 +01:00
|
|
|
|
|
|
|
PANEL_MAIN.refresh();
|
2023-03-23 13:38:50 +01:00
|
|
|
PANEL_MAIN.refreshSize();
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2022-01-19 04:16:28 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function findPanel(_type, _pane = PANEL_MAIN) { #region
|
2023-03-12 02:28:21 +01:00
|
|
|
var pan = _findPanel(_type, _pane);
|
|
|
|
if(pan) return pan;
|
|
|
|
|
|
|
|
with(o_dialog_panel) {
|
2023-03-24 09:32:08 +01:00
|
|
|
if(instanceof(content) == _type)
|
|
|
|
return content;
|
2023-03-12 02:28:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return noone;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function _findPanel(_type, _pane, _res = noone) { #region
|
2023-02-14 02:51:14 +01:00
|
|
|
if(instanceof(_pane) != "Panel")
|
2022-01-19 04:16:28 +01:00
|
|
|
return _res;
|
|
|
|
if(!ds_exists(_pane.childs, ds_type_list))
|
|
|
|
return _res;
|
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
if(ds_list_size(_pane.childs) == 0) {
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(_pane.content); i < n; i++ )
|
2023-03-19 09:17:39 +01:00
|
|
|
if(instanceof(_pane.content[i]) == _type)
|
|
|
|
return _pane.content[i];
|
|
|
|
}
|
2022-01-19 04:16:28 +01:00
|
|
|
|
|
|
|
for(var i = 0; i < ds_list_size(_pane.childs); i++) {
|
2023-03-12 02:28:21 +01:00
|
|
|
var _re = _findPanel(_type, _pane.childs[| i], _res);
|
|
|
|
if(_re != noone) _res = _re;
|
2022-01-19 04:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return _res;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function findPanels(_type, _pane = PANEL_MAIN) { #region
|
2023-07-06 19:49:16 +02:00
|
|
|
return _findPanels(_type, _pane, []);
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-07-06 19:49:16 +02:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function _findPanels(_type, _pane, _arr = []) { #region
|
2023-07-23 21:15:45 +02:00
|
|
|
if(!is_instanceof(_pane, Panel))
|
|
|
|
return _arr;
|
2023-07-06 19:49:16 +02:00
|
|
|
if(!ds_exists(_pane.childs, ds_type_list))
|
2023-07-23 21:15:45 +02:00
|
|
|
return _arr;
|
2023-07-06 19:49:16 +02:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(_pane.content); i < n; i++ ) {
|
2023-07-23 21:15:45 +02:00
|
|
|
var _cnt = instanceof(_pane.content[i]);
|
|
|
|
//print($" - content {_cnt} \ {_cnt == _type}");
|
|
|
|
if(_cnt == _type)
|
|
|
|
array_push(_arr, _pane.content[i]);
|
2023-07-06 19:49:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for(var i = 0; i < ds_list_size(_pane.childs); i++)
|
|
|
|
_arr = _findPanels(_type, _pane.childs[| i], _arr);
|
|
|
|
|
|
|
|
return _arr;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-07-06 19:49:16 +02:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function panelInit() { #region
|
2023-03-11 01:40:17 +01:00
|
|
|
panel_dragging = noone;
|
|
|
|
panel_hovering = noone;
|
|
|
|
panel_split = 0;
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
panel_mouse = 0;
|
|
|
|
|
|
|
|
panel_draw_x0 = noone; panel_draw_x0_to = noone;
|
|
|
|
panel_draw_y0 = noone; panel_draw_y0_to = noone;
|
|
|
|
panel_draw_x1 = noone; panel_draw_x1_to = noone;
|
|
|
|
panel_draw_y1 = noone; panel_draw_y1_to = noone;
|
|
|
|
|
|
|
|
panel_draw_depth = 0;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function panelDraw() { #region
|
2023-03-12 02:28:21 +01:00
|
|
|
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);
|
|
|
|
panel_draw_y1 = panel_draw_y1 == noone? panel_draw_y1_to : lerp_float(panel_draw_y1, panel_draw_y1_to, 3);
|
|
|
|
|
|
|
|
panel_draw_depth = lerp_float(panel_draw_depth, panel_split == 4, 3);
|
|
|
|
|
|
|
|
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);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
draw_set_alpha(1.);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
draw_set_alpha(.2);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
draw_set_alpha(1.);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
} else {
|
|
|
|
draw_set_alpha(.4);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
draw_set_alpha(1.);
|
2023-04-08 20:06:27 +02:00
|
|
|
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);
|
2023-03-12 02:28:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-11 01:40:17 +01:00
|
|
|
if(panel_dragging) {
|
2023-09-09 13:52:16 +02:00
|
|
|
draw_surface_ext_safe(panel_dragging.dragSurface, mouse_mx + 8, mouse_my + 8, 0.5, 0.5, 0, c_white, 0.5);
|
2023-03-12 02:28:21 +01:00
|
|
|
if((panel_mouse == 0 && mouse_release(mb_left)) || (panel_mouse == 1 && mouse_press(mb_left))) {
|
2023-03-11 01:40:17 +01:00
|
|
|
var p = [];
|
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
if(panel_split == 4) {
|
|
|
|
if(panel_hovering == PANEL_MAIN) { //pop out
|
|
|
|
var panel = instanceof(panel_dragging) == "Panel"? panel_dragging.content : panel_dragging;
|
|
|
|
dialogPanelCall(panel);
|
|
|
|
} else
|
|
|
|
panel_hovering.setContent(panel_dragging, true);
|
2023-03-12 02:28:21 +01:00
|
|
|
} else if(panel_hovering == PANEL_MAIN) { //split main panel
|
2023-03-11 06:40:34 +01:00
|
|
|
var panel = new Panel(noone, ui(2), ui(2), WIN_SW - ui(4), WIN_SH - ui(4));
|
|
|
|
var main = PANEL_MAIN;
|
|
|
|
|
|
|
|
switch(panel_split) {
|
|
|
|
case 0 : p = panel.split_v( panel.h / 2); break;
|
|
|
|
case 1 : p = panel.split_h( panel.w / 2); break;
|
|
|
|
case 2 : p = panel.split_h( panel.w / 2); break;
|
|
|
|
case 3 : p = panel.split_v( panel.h / 2); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
panel.parent.childs[| (panel_split + 1) % 2] = main;
|
|
|
|
main.parent = panel.parent;
|
2023-03-19 09:17:39 +01:00
|
|
|
panel.parent.childs[| (panel_split + 0) % 2].setContent(panel_dragging);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
PANEL_MAIN.refreshSize();
|
|
|
|
} else {
|
|
|
|
var c = panel_hovering.content;
|
2023-03-19 09:17:39 +01:00
|
|
|
panel_hovering.content = [];
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
switch(panel_split) {
|
|
|
|
case 0 : p = panel_hovering.split_v( panel_hovering.h / 2); break;
|
|
|
|
case 1 : p = panel_hovering.split_h( panel_hovering.w / 2); break;
|
|
|
|
case 2 : p = panel_hovering.split_h( panel_hovering.w / 2); break;
|
|
|
|
case 3 : p = panel_hovering.split_v( panel_hovering.h / 2); break;
|
|
|
|
}
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
p[(panel_split + 1) % 2].setContent(c);
|
|
|
|
p[(panel_split + 0) % 2].setContent(panel_dragging);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
panel_hovering.refreshSize();
|
|
|
|
}
|
2023-03-11 01:40:17 +01:00
|
|
|
|
|
|
|
panel_hovering = noone;
|
|
|
|
panel_dragging = noone;
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
panel_draw_x0 = noone; panel_draw_x0_to = noone;
|
|
|
|
panel_draw_y0 = noone; panel_draw_y0_to = noone;
|
|
|
|
panel_draw_x1 = noone; panel_draw_x1_to = noone;
|
|
|
|
panel_draw_y1 = noone; panel_draw_y1_to = noone;
|
|
|
|
panel_draw_depth = 0;
|
2023-03-11 01:40:17 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2024-04-30 10:49:12 +02:00
|
|
|
function panelSerialize(_content = false) { #region
|
|
|
|
return { panel : _panelSerialize(PANEL_MAIN, _content) };
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2024-04-30 10:49:12 +02:00
|
|
|
function _panelSerialize(_panel, _content = false) { #region
|
2023-03-11 01:40:17 +01:00
|
|
|
var cont = {};
|
2023-03-11 06:40:34 +01:00
|
|
|
var ind = 0;
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
cont.content = [];
|
2024-04-30 10:49:12 +02:00
|
|
|
if(_panel.split != "" && ds_list_size(_panel.childs) == 2) {
|
|
|
|
cont.split = _panel.split;
|
|
|
|
if(_panel.split == "h") {
|
|
|
|
ind = _panel.childs[| 1].w < _panel.childs[| 0].w;
|
|
|
|
cont.width = _panel.childs[| ind].w * (_panel.childs[| ind].x == _panel.x? 1 : -1);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
} else {
|
2024-04-30 10:49:12 +02:00
|
|
|
ind = _panel.childs[| 1].h < _panel.childs[| 0].h;
|
|
|
|
cont.width = _panel.childs[| ind].h * (_panel.childs[| ind].y == _panel.y? 1 : -1);
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
|
|
|
|
2024-04-30 10:49:12 +02:00
|
|
|
ind = _panel.childs[| 1].x == _panel.x && _panel.childs[| 1].y == _panel.y;
|
|
|
|
for( var i = 0; i < ds_list_size(_panel.childs); i++ )
|
|
|
|
cont.content[i] = _panelSerialize(_panel.childs[| (ind + i) % 2], _content);
|
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
} else {
|
2024-04-30 10:49:12 +02:00
|
|
|
for( var i = 0, n = array_length(_panel.content); i < n; i++ )
|
|
|
|
cont.content[i] = _content? _panel.content[i].serialize() : instanceof(_panel.content[i]);
|
2023-03-19 09:17:39 +01:00
|
|
|
}
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
return cont;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function panelSerializeArray() { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
return _panelSerializeArray(PANEL_MAIN);
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-18 11:49:25 +01:00
|
|
|
function _panelSerializeArray(panel) { #region
|
2023-03-11 06:40:34 +01:00
|
|
|
var cont = [];
|
2023-03-11 01:40:17 +01:00
|
|
|
|
2023-03-19 09:17:39 +01:00
|
|
|
if(!ds_list_empty(panel.childs)) {
|
2023-03-11 06:40:34 +01:00
|
|
|
for( var i = 0; i < ds_list_size(panel.childs); i++ )
|
2023-06-17 14:30:49 +02:00
|
|
|
cont[i] = _panelSerializeArray(panel.childs[| i] );
|
2023-03-19 09:17:39 +01:00
|
|
|
} else {
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(panel.content); i < n; i++ )
|
2023-03-19 09:17:39 +01:00
|
|
|
cont[i] = instanceof(panel.content[i]);
|
|
|
|
}
|
2023-03-11 01:40:17 +01:00
|
|
|
|
|
|
|
return cont;
|
2023-11-18 11:49:25 +01:00
|
|
|
} #endregion
|
2022-11-14 03:16:15 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region fullscreen
|
|
|
|
function set_focus_fullscreen() {
|
2024-01-16 09:56:20 +01:00
|
|
|
if(FULL_SCREEN_PANEL == noone) {
|
|
|
|
var panel = PREFERENCES.expand_hover? HOVER : FOCUS;
|
|
|
|
|
|
|
|
if(panel == noone) return;
|
|
|
|
if(!is_struct(panel)) return;
|
|
|
|
if(instanceof(panel) != "Panel") return;
|
|
|
|
if(array_length(panel.content) == 0) return;
|
|
|
|
|
|
|
|
var content = panel.getContent();
|
|
|
|
if(!content.expandable) return;
|
|
|
|
|
|
|
|
PANEL_MAIN.childs[| 1].setContent(content);
|
|
|
|
|
|
|
|
FULL_SCREEN_PARENT = PANEL_MAIN.childs[| 1];
|
|
|
|
FULL_SCREEN_PANEL = panel;
|
|
|
|
FULL_SCREEN_CONTENT = content;
|
|
|
|
|
|
|
|
content.onFullScreen();
|
|
|
|
} else {
|
2023-03-19 09:17:39 +01:00
|
|
|
PANEL_MAIN.childs[| 1].content = [];
|
2022-12-27 04:00:50 +01:00
|
|
|
PANEL_MAIN.refreshSize();
|
2023-12-23 09:39:55 +01:00
|
|
|
|
|
|
|
FULL_SCREEN_CONTENT.onFullScreen();
|
|
|
|
|
2024-01-16 09:56:20 +01:00
|
|
|
FULL_SCREEN_PARENT = noone;
|
2023-12-23 09:39:55 +01:00
|
|
|
FULL_SCREEN_PANEL = noone;
|
|
|
|
FULL_SCREEN_CONTENT = noone;
|
2022-11-14 03:16:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2023-12-23 09:39:55 +01:00
|
|
|
#region focus hover
|
2022-11-14 03:16:15 +01:00
|
|
|
function panelHover(content) {
|
2023-03-19 09:17:39 +01:00
|
|
|
if(!HOVER) return false;
|
|
|
|
if(instanceof(HOVER) != "Panel") return false;
|
|
|
|
|
|
|
|
return instanceof(HOVER.getContent()) == instanceof(content);
|
2022-11-14 03:16:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function panelFocus(content) {
|
2023-03-19 09:17:39 +01:00
|
|
|
if(!FOCUS) return false;
|
|
|
|
if(instanceof(FOCUS) != "Panel") return false;
|
|
|
|
|
|
|
|
return instanceof(FOCUS.getContent()) == instanceof(content);
|
2022-11-14 03:16:15 +01:00
|
|
|
}
|
2024-05-03 09:02:18 +02:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region hotkey
|
|
|
|
function __initPanelHotkeys() {
|
|
|
|
addHotkey("", "Preference", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_preference)});
|
|
|
|
addHotkey("", "Splash screen", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_splash)});
|
|
|
|
addHotkey("", "Release note", "", MOD_KEY.none, function() /*=>*/ {return dialogCall(o_dialog_release_note)});
|
|
|
|
addHotkey("", "Autosave folder", "", MOD_KEY.none, function() /*=>*/ {return shellOpenExplorer(DIRECTORY + "autosave")});
|
|
|
|
|
|
|
|
addHotkey("", "Recent files", "R", MOD_KEY.ctrl | MOD_KEY.shift, function() /*=>*/ {
|
|
|
|
var arr = [];
|
|
|
|
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++)
|
|
|
|
array_push(arr, menuItem(RECENT_FILES[| i], function(_dat) { LOAD_PATH(_dat.name); }));
|
|
|
|
|
|
|
|
return menuCall("Recent files",,, arr);
|
|
|
|
});
|
|
|
|
|
|
|
|
addHotkey("", "Addons", "", MOD_KEY.none, function() /*=>*/ {return dialogPanelCall(new Panel_Addon())});
|
|
|
|
addHotkey("", "History", "", MOD_KEY.none, function() /*=>*/ {return dialogPanelCall(new Panel_History())});
|
|
|
|
|
|
|
|
addHotkey("", "Notification Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Notification", true)});
|
|
|
|
addHotkey("", "Collections Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Collection", true)});
|
|
|
|
addHotkey("", "Graph Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Graph", true)});
|
|
|
|
addHotkey("", "Preview Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Preview", true)});
|
|
|
|
addHotkey("", "Inspector Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Inspector", true)});
|
|
|
|
addHotkey("", "Workspace Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Workspace", true)});
|
|
|
|
addHotkey("", "Animation Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Animation", true)});
|
|
|
|
addHotkey("", "Align Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Node_Align", true)});
|
|
|
|
addHotkey("", "Nodes Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Nodes", true)});
|
|
|
|
addHotkey("", "Tunnels Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Tunnels", true)});
|
|
|
|
addHotkey("", "Color Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Color", true)});
|
|
|
|
addHotkey("", "Palettes Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Palette", true)});
|
|
|
|
addHotkey("", "Gradients Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Gradient", true)});
|
|
|
|
addHotkey("", "Console Panel", "", MOD_KEY.none, function() /*=>*/ {return panelAdd("Panel_Console", true)});
|
|
|
|
}
|
2022-01-19 04:16:28 +01:00
|
|
|
#endregion
|