2022-11-14 03:16:15 +01:00
|
|
|
function Panel_Menu() : PanelContent() constructor {
|
2023-09-08 12:27:22 +02:00
|
|
|
title = __txt("Menu");
|
|
|
|
auto_pin = true;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-09-08 12:27:22 +02:00
|
|
|
noti_flash = 0;
|
2022-12-10 05:06:01 +01:00
|
|
|
noti_flash_color = COLORS._main_accent;
|
2023-09-08 12:27:22 +02:00
|
|
|
noti_icon = noone;
|
|
|
|
noti_icon_show = 0;
|
|
|
|
noti_icon_time = 0;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
vertical_break = ui(240);
|
2023-08-16 20:16:31 +02:00
|
|
|
version_name_copy = 0;
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var _right = PREFERENCES.panel_menu_right_control;
|
|
|
|
if(_right) action_buttons = ["exit", "maximize", "minimize", "fullscreen"];
|
|
|
|
else action_buttons = ["exit", "minimize", "maximize", "fullscreen"];
|
2023-03-08 12:14:01 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
#region file
|
2023-09-26 14:35:25 +02:00
|
|
|
menu_file_nondemo = [
|
2023-06-05 18:27:53 +02:00
|
|
|
menuItem(__txt("New"), function() { NEW(); }, THEME.new_file, ["", "New file"]),
|
2023-11-01 08:10:25 +01:00
|
|
|
menuItem(__txt("Open") + "...", function() { LOAD(); }, THEME.noti_icon_file_load, ["", "Open"])
|
|
|
|
.setShiftMenu(menuItem(__txt("Open in safe mode") + "...", function() { LOAD(true); }, THEME.noti_icon_file_load)),
|
2023-06-05 18:27:53 +02:00
|
|
|
menuItem(__txt("Save"), function() { SAVE(); }, THEME.save, ["", "Save"]),
|
|
|
|
menuItem(__txt("Save as") + "...", function() { SAVE_AS(); }, THEME.save, ["", "Save as"]),
|
2023-07-06 19:49:16 +02:00
|
|
|
menuItem(__txt("Save all"), function() { SAVE_ALL(); }, THEME.icon_save_all, ["", "Save all"]),
|
2023-06-05 18:27:53 +02:00
|
|
|
menuItem(__txt("Recent files"), function(_dat) {
|
2023-02-14 02:51:14 +01:00
|
|
|
var arr = [];
|
|
|
|
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) {
|
|
|
|
var _rec = RECENT_FILES[| i];
|
2023-05-04 20:00:56 +02:00
|
|
|
array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2023-02-19 02:13:19 +01:00
|
|
|
|
2023-05-04 20:00:56 +02:00
|
|
|
return submenuCall(_dat, arr);
|
2023-02-19 02:13:19 +01:00
|
|
|
}).setIsShelf(),
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_auto_save_folder", "Open autosave folder"), function() { shellOpenExplorer(DIRECTORY + "autosave"); }, THEME.save_auto, ["", "Autosave folder"]),
|
2023-11-23 02:32:26 +01:00
|
|
|
menuItem(__txt("Import"), function(_dat) {
|
|
|
|
var arr = [
|
|
|
|
menuItem(__txt("Portable project (.zip)") + "...", function() { __IMPORT_ZIP(); }),
|
|
|
|
];
|
|
|
|
|
|
|
|
return submenuCall(_dat, arr);
|
|
|
|
}).setIsShelf(),
|
2023-09-26 14:35:25 +02:00
|
|
|
menuItem(__txt("Export"), function(_dat) {
|
|
|
|
var arr = [
|
2023-09-26 14:45:15 +02:00
|
|
|
menuItem(__txt("Portable project (.zip)") + "...", function() { exportPortable(PROJECT); }),
|
2023-09-26 14:35:25 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
return submenuCall(_dat, arr);
|
|
|
|
}).setIsShelf(),
|
2023-02-14 02:51:14 +01:00
|
|
|
-1,
|
2023-09-26 14:35:25 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
menu_file = [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Preferences") + "...", function() { dialogCall(o_dialog_preference); }, THEME.gear, ["", "Preference"]),
|
|
|
|
menuItem(__txt("Splash screen"), function() { dialogCall(o_dialog_splash); }, noone, ["", "Splash Screen"]),
|
2023-02-14 02:51:14 +01:00
|
|
|
-1,
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txt("Addons"), function(_dat) {
|
2023-04-22 16:23:51 +02:00
|
|
|
var arr = [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Addons") + "...", function() { dialogPanelCall(new Panel_Addon()); }, noone, ["", "Addons"]),
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_addons_key", "Key displayer"), function() {
|
2023-02-19 02:13:19 +01:00
|
|
|
if(instance_exists(addon_key_displayer)) {
|
|
|
|
instance_destroy(addon_key_displayer);
|
|
|
|
return;
|
|
|
|
}
|
2023-07-07 09:25:53 +02:00
|
|
|
|
2023-02-19 02:13:19 +01:00
|
|
|
instance_create_depth(0, 0, 0, addon_key_displayer);
|
2023-03-02 07:59:14 +01:00
|
|
|
}),
|
2023-04-22 16:23:51 +02:00
|
|
|
-1
|
|
|
|
];
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(ADDONS); i < n; i++ ) {
|
2023-05-03 21:42:17 +02:00
|
|
|
var _dir = ADDONS[i].name;
|
2023-05-04 20:00:56 +02:00
|
|
|
array_push(arr, menuItem(_dir, function(_dat) { addonTrigger(_dat.name); } ));
|
2023-04-22 16:23:51 +02:00
|
|
|
}
|
|
|
|
|
2023-05-04 20:00:56 +02:00
|
|
|
return submenuCall(_dat, arr);
|
2023-07-05 15:09:52 +02:00
|
|
|
}, THEME.addon_icon ).setIsShelf(),
|
2023-02-23 07:02:19 +01:00
|
|
|
-1,
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Fullscreen"), function() { winMan_setFullscreen(!window_is_fullscreen); }, noone, ["", "Fullscreen"]),
|
|
|
|
menuItem(__txt("Close current project"), function() { PANEL_GRAPH.close(); }, noone, [ "", "Close file" ]),
|
|
|
|
menuItem(__txt("Close all projects"), function() { for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); }, noone, [ "", "Close all" ]),
|
|
|
|
menuItem(__txt("Close program"), function() { window_close(); }, noone, [ "", "Close program" ]),
|
2023-11-24 10:41:53 +01:00
|
|
|
];
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-09-26 14:35:25 +02:00
|
|
|
if(!DEMO) menu_file = array_append(menu_file_nondemo, menu_file);
|
2023-11-24 10:41:53 +01:00
|
|
|
#endregion
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
#region help
|
|
|
|
menu_help = [
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_help_video", "Tutorial videos"), function() {
|
2023-02-17 11:31:33 +01:00
|
|
|
url_open("https://www.youtube.com/@makhamdev");
|
2023-02-19 02:13:19 +01:00
|
|
|
}, THEME.youtube),
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_help_wiki", "Community Wiki"), function() {
|
2023-02-17 11:31:33 +01:00
|
|
|
url_open("https://pixel-composer.fandom.com/wiki/Pixel_Composer_Wiki");
|
2023-02-19 02:13:19 +01:00
|
|
|
}, THEME.wiki),
|
2023-02-17 11:31:33 +01:00
|
|
|
-1,
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_local_directory", "Open local directory"), function() {
|
2023-02-17 11:31:33 +01:00
|
|
|
shellOpenExplorer(DIRECTORY);
|
2023-02-19 02:13:19 +01:00
|
|
|
}, THEME.folder),
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_autosave_directory", "Open autosave directory"), function() {
|
2023-03-08 12:14:01 +01:00
|
|
|
shellOpenExplorer(DIRECTORY + "autosave/");
|
2023-02-19 02:13:19 +01:00
|
|
|
}, THEME.folder),
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_reset_default", "Reset default collection, assets"), function() {
|
2023-02-17 11:31:33 +01:00
|
|
|
zip_unzip("data/Collections.zip", DIRECTORY + "Collections");
|
|
|
|
zip_unzip("data/Assets.zip", DIRECTORY + "Assets");
|
2023-02-19 02:13:19 +01:00
|
|
|
}),
|
2023-11-14 14:29:11 +01:00
|
|
|
-1,
|
|
|
|
menuItem(__txtx("panel_menu_connect_patreon", "Connect to Patreon"), function() {
|
|
|
|
dialogPanelCall(new Panel_Patreon());
|
|
|
|
}, THEME.patreon),
|
2023-02-19 02:13:19 +01:00
|
|
|
];
|
2023-11-24 10:41:53 +01:00
|
|
|
#endregion
|
2023-02-17 11:31:33 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
#region //////// MENU ////////
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem_undo = menuItem(__txt("Undo"), function() { UNDO(); }, THEME.undo, ["", "Undo"]);
|
|
|
|
menuItem_redo = menuItem(__txt("Redo"), function() { REDO(); }, THEME.redo, ["", "Redo"]);
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
menus = [
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("File"), menu_file ],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("Edit"), [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem_undo,
|
|
|
|
menuItem_redo,
|
|
|
|
menuItem(__txt("History"), function() { dialogPanelCall(new Panel_History()); }, noone, ["", "History"]),
|
2022-01-13 05:24:03 +01:00
|
|
|
]],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
[ __txt("Preview"), [
|
|
|
|
menuItem(__txtx("panel_menu_center_preview", "Center preview"), function() { PANEL_PREVIEW.do_fullView = true; }, THEME.icon_center_canvas, ["Preview", "Focus content"]),
|
|
|
|
menuItem(__txtx("panel_menu_save_current_preview_as", "Save current preview as..."), function() { PANEL_PREVIEW.saveCurrentFrame(); }, noone, ["Preview", "Save current frame"]),
|
|
|
|
menuItemGroup(__txtx("panel_menu_preview_background", "Preview background"), [
|
2022-01-13 05:24:03 +01:00
|
|
|
[ s_menu_transparent, function() { PANEL_PREVIEW.canvas_bg = -1; } ],
|
|
|
|
[ s_menu_white, function() { PANEL_PREVIEW.canvas_bg = c_white; } ],
|
|
|
|
[ s_menu_black, function() { PANEL_PREVIEW.canvas_bg = c_black; } ],
|
2023-08-01 19:21:51 +02:00
|
|
|
]),
|
2022-01-13 05:24:03 +01:00
|
|
|
]],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("Animation"), [
|
2023-12-24 12:06:44 +01:00
|
|
|
menuItem(__txtx("panel_menu_animation_setting", "Animation Settings..."), function() {
|
2023-11-06 13:09:13 +01:00
|
|
|
var dia = dialogPanelCall(new Panel_Animation_Setting());
|
2022-01-13 05:24:03 +01:00
|
|
|
dia.anchor = ANCHOR.none;
|
2024-05-03 09:02:18 +02:00
|
|
|
}, THEME.animation_setting, ["Animation", "Settings"]),
|
2022-01-13 05:24:03 +01:00
|
|
|
-1,
|
2023-12-24 12:06:44 +01:00
|
|
|
menuItem(__txtx("panel_menu_animation_scaler", "Animation Scaler..."), function() {
|
2023-11-06 13:09:13 +01:00
|
|
|
dialogPanelCall(new Panel_Animation_Scaler());
|
2023-02-19 02:13:19 +01:00
|
|
|
}, THEME.animation_timing),
|
2022-01-13 05:24:03 +01:00
|
|
|
]],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("Rendering"), [
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_render_all_nodes", "Render all nodes"), function() {
|
2023-10-02 10:45:30 +02:00
|
|
|
RENDER_ALL_REORDER
|
2023-02-19 02:13:19 +01:00
|
|
|
}, [ THEME.sequence_control, 1 ], ["", "Render all"]),
|
2024-05-26 04:51:14 +02:00
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txtx("panel_menu_execute_exports", "Execute all export nodes"), function() {
|
2024-06-08 13:31:27 +02:00
|
|
|
for (var i = 0, n = array_length(PROJECT.allNodes); i < n; i++) {
|
|
|
|
var node = PROJECT.allNodes[i];
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
if(!node.active) continue;
|
|
|
|
if(instanceof(node) != "Node_Export") continue;
|
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
node.doInspectorAction();
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2023-02-19 02:13:19 +01:00
|
|
|
}),
|
2023-06-17 14:30:49 +02:00
|
|
|
menuItem(__txtx("panel_menu_export_render_all", "Render disabled node when export"),
|
2023-10-31 05:30:42 +01:00
|
|
|
function() { PREFERENCES.render_all_export = !PREFERENCES.render_all_export; },,,
|
|
|
|
function() { return PREFERENCES.render_all_export; } ),
|
2022-01-13 05:24:03 +01:00
|
|
|
]],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("Panels"), [
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txt("Workspace"), function(_dat) {
|
2023-03-11 01:40:17 +01:00
|
|
|
var arr = [], lays = [];
|
2023-05-04 20:00:56 +02:00
|
|
|
var f = file_find_first(DIRECTORY + "layouts/*", 0);
|
2023-03-11 01:40:17 +01:00
|
|
|
while(f != "") {
|
|
|
|
array_push(lays, filename_name_only(f));
|
|
|
|
f = file_find_next();
|
|
|
|
}
|
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
array_push(arr, menuItem(__txtx("panel_menu_save_layout", "Save layout"), function() {
|
2023-03-11 06:40:34 +01:00
|
|
|
var dia = dialogCall(o_dialog_file_name, mouse_mx + ui(8), mouse_my + ui(8));
|
2023-10-31 05:30:42 +01:00
|
|
|
dia.name = PREFERENCES.panel_layout_file;
|
2023-03-11 06:40:34 +01:00
|
|
|
dia.onModify = function(name) {
|
|
|
|
var cont = panelSerialize();
|
2023-05-04 20:00:56 +02:00
|
|
|
json_save_struct(DIRECTORY + "layouts/" + name + ".json", cont);
|
2023-03-11 06:40:34 +01:00
|
|
|
};
|
|
|
|
}));
|
2023-10-18 14:58:55 +02:00
|
|
|
|
|
|
|
array_push(arr, menuItem(__txtx("panel_menu_reset_layout", "Reset layout"), function() {
|
|
|
|
resetPanel();
|
|
|
|
},, [ "", "Reset layout" ]));
|
2023-03-11 06:40:34 +01:00
|
|
|
array_push(arr, -1);
|
|
|
|
|
2023-03-11 01:40:17 +01:00
|
|
|
for(var i = 0; i < array_length(lays); i++) {
|
|
|
|
array_push(arr, menuItem(lays[i],
|
2023-05-04 20:00:56 +02:00
|
|
|
function(_dat) {
|
2023-10-31 05:30:42 +01:00
|
|
|
PREFERENCES.panel_layout_file = _dat.name;
|
2023-03-11 01:40:17 +01:00
|
|
|
PREF_SAVE();
|
|
|
|
setPanel();
|
2023-10-31 05:30:42 +01:00
|
|
|
},,, function(item) { return item.name == PREFERENCES.panel_layout_file; } ));
|
2023-03-11 01:40:17 +01:00
|
|
|
}
|
|
|
|
|
2023-05-04 20:00:56 +02:00
|
|
|
return submenuCall(_dat, arr);
|
2023-03-11 01:40:17 +01:00
|
|
|
}).setIsShelf(),
|
2022-01-13 05:24:03 +01:00
|
|
|
-1,
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Collections"), function() { panelAdd("Panel_Collection", true) }, noone, ["", "Collections Panel"], function() { return findPanel("Panel_Collection") != noone; } ),
|
|
|
|
menuItem(__txt("Graph"), function() { panelAdd("Panel_Graph", true) }, noone, ["", "Graph Panel"], function() { return findPanel("Panel_Graph") != noone; } ),
|
|
|
|
menuItem(__txt("Preview"), function() { panelAdd("Panel_Preview", true) }, noone, ["", "Preview Panel"], function() { return findPanel("Panel_Preview") != noone; } ),
|
|
|
|
menuItem(__txt("Inspector"), function() { panelAdd("Panel_Inspector", true) }, noone, ["", "Inspector Panel"], function() { return findPanel("Panel_Inspector") != noone; } ),
|
|
|
|
menuItem(__txt("Workspace"), function() { panelAdd("Panel_Workspace", true) }, noone, ["", "Workspace Panel"], function() { return findPanel("Panel_Workspace") != noone; } ),
|
|
|
|
menuItem(__txt("Animation"), function() { panelAdd("Panel_Animation", true) }, noone, ["", "Animation Panel"], function() { return findPanel("Panel_Animation") != noone; } ),
|
|
|
|
menuItem(__txt("Notifications"), function() { panelAdd("Panel_Notification", true) }, noone, ["", "Notification Panel"], function() { return findPanel("Panel_Notification") != noone; } ),
|
2024-05-16 09:42:34 +02:00
|
|
|
menuItem(__txt("Global Variables"), function() { panelAdd("Panel_Globalvar", true) }, noone, noone, function() { return findPanel("Panel_Globalvar") != noone; } ),
|
|
|
|
menuItem(__txt("File Explorer"), function() { panelAdd("Panel_File_Explorer", true) },noone, noone, function() { return findPanel("Panel_File_Explorer") != noone; } ),
|
2023-03-25 12:27:04 +01:00
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txt("Nodes"), function(_dat) {
|
2023-05-04 20:00:56 +02:00
|
|
|
return submenuCall(_dat, [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Align"), function() { panelAdd("Panel_Node_Align", true) }, noone, ["", "Align Panel"], function() { return findPanel("Panel_Node_Align") != noone; } ),
|
|
|
|
menuItem(__txt("Nodes"), function() { panelAdd("Panel_Nodes", true) }, noone, ["", "Nodes Panel"], function() { return findPanel("Panel_Nodes") != noone; } ),
|
|
|
|
menuItem(__txt("Tunnels"), function() { panelAdd("Panel_Tunnels", true) }, noone, ["", "Tunnels Panel"], function() { return findPanel("Panel_Tunnels") != noone; } ),
|
2023-03-25 12:27:04 +01:00
|
|
|
]);
|
|
|
|
} ).setIsShelf(),
|
|
|
|
|
2023-06-04 18:28:29 +02:00
|
|
|
menuItem(__txt("Color"), function(_dat) {
|
2023-05-04 20:00:56 +02:00
|
|
|
return submenuCall(_dat, [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txt("Color"), function() { panelAdd("Panel_Color", true) }, noone, ["", "Color Panel"], function() { return findPanel("Panel_Color") != noone; } ),
|
|
|
|
menuItem(__txt("Palettes"), function() { panelAdd("Panel_Palette", true) }, noone, ["", "Palettes Panel"], function() { return findPanel("Panel_Palette") != noone; } ),
|
|
|
|
menuItem(__txt("Gradients"), function() { panelAdd("Panel_Gradient", true) }, noone, ["", "Gradients Panel"], function() { return findPanel("Panel_Gradient") != noone; } ),
|
2024-05-19 15:11:45 +02:00
|
|
|
-1,
|
|
|
|
menuItem(__txt("Palette Mixer"), function() { panelAdd("Panel_Palette_Mixer", true) }, noone, ["", "Palette Mixer Panel"], function() { return findPanel("Panel_Palette_Mixer") != noone; } ),
|
2023-03-25 12:27:04 +01:00
|
|
|
]);
|
|
|
|
} ).setIsShelf(),
|
2024-05-22 04:46:29 +02:00
|
|
|
|
|
|
|
menuItem(__txt("Histogram"), function() { panelAdd("Panel_Preview_Histogram", true) }, noone, noone, function() { return findPanel("Panel_Preview_Histogram") != noone; } ),
|
2022-01-13 05:24:03 +01:00
|
|
|
]],
|
2024-04-08 07:13:46 +02:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
[ __txt("Help"), menu_help ],
|
2023-11-24 10:41:53 +01:00
|
|
|
];
|
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if(TESTING) { #region
|
2023-06-05 18:27:53 +02:00
|
|
|
array_push(menus, [ __txt("Dev"), [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_debug_console", "Console"), function() /*=>*/ { panelAdd("Panel_Console", true) }, noone, ["", "Console Panel"]),
|
|
|
|
menuItem(__txtx("panel_debug_overlay", "Debug overlay"), function() /*=>*/ { show_debug_overlay(true); }),
|
|
|
|
menuItem(__txtx("panel_menu_tester", "Tester"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Test()); dia.destroy_on_click_out = false; }),
|
2023-05-08 19:14:30 +02:00
|
|
|
-1,
|
|
|
|
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_test_load_all", "Load all current collections"), function() /*=>*/ { __test_load_current_collections(); }),
|
|
|
|
menuItem(__txtx("panel_menu_test_update_all", "Update all current collections"), function() /*=>*/ { __test_update_current_collections(); }),
|
|
|
|
menuItem(__txtx("panel_menu_test_add_meta", "Add metadata to current collections"), function() /*=>*/ { __test_metadata_current_collections(); }),
|
|
|
|
menuItem(__txtx("panel_menu_test_update_sam", "Update sample projects"), function() /*=>*/ { __test_update_sample_projects(); }),
|
2023-02-14 02:51:14 +01:00
|
|
|
-1,
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_test_load_nodes", "Load all nodes"), function() /*=>*/ { __test_load_all_nodes(); }),
|
|
|
|
menuItem(__txtx("panel_menu_test_gen_guide", "Generate node guide"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Data_Gen()); dia.destroy_on_click_out = false; }),
|
|
|
|
menuItem(__txtx("panel_menu_test_gen_theme", "Generate theme object"), function() /*=>*/ { __test_generate_theme(); }),
|
2023-02-14 02:51:14 +01:00
|
|
|
-1,
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_test_warning", "Display Warning"), function() /*=>*/ { noti_warning("Error message") }),
|
|
|
|
menuItem(__txtx("panel_menu_test_error", "Display Error"), function() /*=>*/ { noti_error("Error message") }),
|
|
|
|
menuItem(__txtx("panel_menu_test_crash", "Force crash"), function() /*=>*/ { print(1 + "a"); }),
|
2023-09-13 15:48:00 +02:00
|
|
|
-1,
|
|
|
|
menuItem(__txt("Misc."), function(_dat) {
|
|
|
|
return submenuCall(_dat, [
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_node_credit", "Node credit dialog"), function() /*=>*/ { var dia = dialogPanelCall(new Panel_Node_Cost()); }),
|
2023-09-13 15:48:00 +02:00
|
|
|
]);
|
|
|
|
} ).setIsShelf(),
|
2023-01-01 02:06:02 +01:00
|
|
|
]]);
|
2023-11-24 10:41:53 +01:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
menu_help_steam = array_clone(menu_help);
|
|
|
|
array_push(menu_help_steam, -1,
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem(__txtx("panel_menu_steam_workshop", "Steam Workshop"), function() /*=>*/ { steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/"); }, THEME.steam) );
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-03-13 10:45:56 +01:00
|
|
|
function onFocusBegin() { PANEL_MENU = self; }
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
function setNotiIcon(icon) { #region
|
2022-12-10 05:06:01 +01:00
|
|
|
noti_icon = icon;
|
|
|
|
noti_icon_time = 90;
|
2023-11-24 10:41:53 +01:00
|
|
|
} #endregion
|
2022-12-10 05:06:01 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
function undoUpdate() { #region
|
2022-11-22 14:25:39 +01:00
|
|
|
var txt;
|
|
|
|
|
|
|
|
if(ds_stack_empty(UNDO_STACK)) {
|
2023-06-05 18:27:53 +02:00
|
|
|
txt = __txt("Undo");
|
2022-11-22 14:25:39 +01:00
|
|
|
} else {
|
|
|
|
var act = ds_stack_top(UNDO_STACK);
|
|
|
|
if(array_length(act) > 1)
|
2023-10-04 11:28:13 +02:00
|
|
|
txt = $"{__txt("Undo")} {array_length(act)} {__txt("Actions")}";
|
2022-11-22 14:25:39 +01:00
|
|
|
else
|
2023-10-04 11:28:13 +02:00
|
|
|
txt = $"{__txt("Undo")} {act[0]}";
|
2022-11-22 14:25:39 +01:00
|
|
|
}
|
|
|
|
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem_undo.active = !ds_stack_empty(UNDO_STACK);
|
|
|
|
menuItem_undo.name = txt;
|
2022-11-22 14:25:39 +01:00
|
|
|
|
|
|
|
if(ds_stack_empty(REDO_STACK)) {
|
2023-06-05 18:27:53 +02:00
|
|
|
txt = __txt("Redo");
|
2022-11-22 14:25:39 +01:00
|
|
|
} else {
|
|
|
|
var act = ds_stack_top(REDO_STACK);
|
|
|
|
if(array_length(act) > 1)
|
2023-10-04 11:28:13 +02:00
|
|
|
txt = $"{__txt("Redo")} {array_length(act)} {__txt("Actions")}";
|
2022-11-22 14:25:39 +01:00
|
|
|
else
|
2023-10-04 11:28:13 +02:00
|
|
|
txt = $"{__txt("Redo")} {act[0]}";
|
2022-11-22 14:25:39 +01:00
|
|
|
}
|
|
|
|
|
2024-05-03 09:02:18 +02:00
|
|
|
menuItem_redo.active = !ds_stack_empty(REDO_STACK);
|
|
|
|
menuItem_redo.name = txt;
|
2023-11-24 10:41:53 +01:00
|
|
|
} #endregion
|
2022-11-22 14:25:39 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
function drawContent(panel) { #region
|
2023-11-28 06:50:54 +01:00
|
|
|
var _right = PREFERENCES.panel_menu_right_control;
|
|
|
|
var _draggable = pFOCUS;
|
2023-11-24 10:41:53 +01:00
|
|
|
|
2023-11-14 14:29:11 +01:00
|
|
|
draw_clear_alpha(COLORS.panel_bg_clear, 1);
|
2023-02-19 02:13:19 +01:00
|
|
|
menus[6][1] = STEAM_ENABLED? menu_help_steam : menu_help;
|
2023-03-11 06:40:34 +01:00
|
|
|
var hori = w > h;
|
2023-02-17 11:31:33 +01:00
|
|
|
|
2023-03-07 14:29:47 +01:00
|
|
|
var xx = ui(40);
|
2023-03-11 06:40:34 +01:00
|
|
|
var yy = ui(8);
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
#region about icon
|
|
|
|
if(hori) {
|
|
|
|
if(PREFERENCES.panel_menu_right_control)
|
|
|
|
xx = ui(24);
|
|
|
|
else {
|
|
|
|
xx = ui(140);
|
|
|
|
draw_set_color(COLORS._main_icon_dark);
|
|
|
|
draw_line_round(xx, ui(8), xx, h - ui(8), 3);
|
|
|
|
}
|
2023-03-07 14:29:47 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var bx = xx;
|
|
|
|
if(!PREFERENCES.panel_menu_right_control)
|
|
|
|
bx = w - ui(24);
|
2023-11-28 06:50:54 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white);
|
|
|
|
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), 0, bx + ui(16), ui(32))) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-11-24 10:41:53 +01:00
|
|
|
if(mouse_press(mb_left, pFOCUS))
|
|
|
|
dialogCall(o_dialog_about);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var bx = ui(20);
|
|
|
|
var by = h - ui(20);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, by, 1, c_white);
|
|
|
|
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-11-24 10:41:53 +01:00
|
|
|
if(mouse_press(mb_left, pFOCUS))
|
|
|
|
dialogCall(o_dialog_about);
|
|
|
|
}
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
2023-11-24 10:41:53 +01:00
|
|
|
#endregion
|
2023-03-08 12:14:01 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
#region menu
|
|
|
|
if(hori) {
|
|
|
|
if(PREFERENCES.panel_menu_right_control)
|
|
|
|
xx += ui(20);
|
|
|
|
else
|
|
|
|
xx += ui(8);
|
|
|
|
yy = 0;
|
|
|
|
} else {
|
|
|
|
xx = ui(8);
|
|
|
|
yy = w < vertical_break? ui(72) : ui(40);
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var sx = xx;
|
|
|
|
var xc, x0, x1, yc, y0, y1, _mx = xx;
|
|
|
|
var row = 1, maxRow = ceil(h / ui(40));
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var _ww = 0;
|
|
|
|
for(var i = 0; i < array_length(menus) - 1; i++) {
|
|
|
|
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
|
|
|
|
var ww = string_width(menus[i][0]) + ui(16 + 8);
|
|
|
|
_ww += ww;
|
|
|
|
if(_ww > w * 0.4 - sx) {
|
|
|
|
row++;
|
|
|
|
_ww = 0;
|
|
|
|
}
|
|
|
|
}
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
row = min(row, maxRow);
|
|
|
|
var _curRow = 0, currY;
|
|
|
|
var _rowH = (h - ui(12)) / row;
|
|
|
|
var _ww = 0;
|
2023-03-07 14:29:47 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
for(var i = 0; i < array_length(menus); i++) {
|
2024-05-03 09:02:18 +02:00
|
|
|
var _menu = menus[i];
|
|
|
|
var _name = _menu[0];
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
|
2024-05-03 09:02:18 +02:00
|
|
|
var ww = string_width(_name) + ui(16);
|
2023-11-24 10:41:53 +01:00
|
|
|
var hh = line_get_height() + ui(8);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if(hori) {
|
|
|
|
xc = xx + ww / 2;
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
x0 = xx;
|
|
|
|
x1 = xx + ww;
|
|
|
|
y0 = ui(6) + _rowH * _curRow;
|
|
|
|
y1 = y0 + _rowH;
|
2023-03-12 02:28:21 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
yc = (y0 + y1) / 2;
|
|
|
|
currY = yc;
|
|
|
|
} else {
|
|
|
|
xc = w / 2;
|
|
|
|
yc = yy + hh / 2;
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
x0 = ui(6);
|
|
|
|
x1 = w - ui(6);
|
|
|
|
y0 = yy;
|
|
|
|
y1 = yy + hh;
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if(pHOVER && point_in_rectangle(mx, my, x0, y0, x1, y1)) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_sprite_stretched(THEME.menu_button, 0, x0, y0, x1 - x0, y1 - y0);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if((mouse_press(mb_left, pFOCUS)) || instance_exists(o_dialog_menubox)) {
|
2024-05-03 09:02:18 +02:00
|
|
|
if(hori) menuCall($"main_{_name}_menu", x + x0, y + y1, _menu[1]);
|
|
|
|
else menuCall($"main_{_name}_menu", x + x1, y + y0, _menu[1]);
|
2023-11-24 10:41:53 +01:00
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
|
2024-05-03 09:02:18 +02:00
|
|
|
draw_text_add(xc, yc, _name);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if(hori) {
|
|
|
|
xx += ww + 8;
|
|
|
|
_mx = max(_mx, xx);
|
|
|
|
_ww += ww + 8;
|
2023-12-15 12:56:36 +01:00
|
|
|
if(_ww > w * 0.6 - sx) {
|
2023-11-24 10:41:53 +01:00
|
|
|
_curRow++;
|
|
|
|
_ww = 0;
|
|
|
|
xx = sx;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
yy += hh + 8;
|
|
|
|
}
|
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-11-03 11:44:49 +01:00
|
|
|
#region notification
|
2023-12-10 02:48:10 +01:00
|
|
|
var warning_amo = ds_list_size(WARNING);
|
|
|
|
var error_amo = ds_list_size(ERRORS);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) {
|
2023-03-12 02:28:21 +01:00
|
|
|
var nx0 = _mx + ui(24);
|
2023-03-11 06:40:34 +01:00
|
|
|
var ny0 = h / 2;
|
|
|
|
} else {
|
|
|
|
var nx0 = ui(8);
|
|
|
|
var ny0 = yy + ui(16);
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_set_text(f_p0, fa_left, fa_center);
|
2022-11-03 11:44:49 +01:00
|
|
|
var wr_w = ui(20) + ui(8) + string_width(string(warning_amo));
|
|
|
|
var er_w = ui(20) + ui(8) + string_width(string(error_amo));
|
|
|
|
|
2022-12-10 05:06:01 +01:00
|
|
|
if(noti_icon_time > 0) {
|
|
|
|
noti_icon_show = lerp_float(noti_icon_show, 1, 4);
|
|
|
|
noti_icon_time--;
|
|
|
|
} else
|
|
|
|
noti_icon_show = lerp_float(noti_icon_show, 0, 4);
|
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
var nw = hori? ui(16) + wr_w + ui(16) + er_w + noti_icon_show * ui(32) : w - ui(16);
|
2022-11-03 11:44:49 +01:00
|
|
|
var nh = ui(32);
|
|
|
|
|
|
|
|
noti_flash = lerp_linear(noti_flash, 0, 0.02);
|
|
|
|
var ev = animation_curve_eval(ac_flash, noti_flash);
|
2022-12-10 05:06:01 +01:00
|
|
|
var cc = merge_color(c_white, noti_flash_color, ev);
|
2022-11-03 11:44:49 +01:00
|
|
|
|
2022-12-10 05:06:01 +01:00
|
|
|
if(pHOVER && point_in_rectangle(mx, my, nx0, ny0 - nh / 2, nx0 + nw, ny0 + nh / 2)) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_sprite_stretched_ext(THEME.menu_button, 0, nx0, ny0 - nh / 2, nw, nh, cc, 1);
|
2022-12-10 05:06:01 +01:00
|
|
|
if(mouse_press(mb_left, pFOCUS)) {
|
2023-03-12 02:28:21 +01:00
|
|
|
var dia = dialogPanelCall(new Panel_Notification(), nx0, ny0 + nh / 2 + ui(4));
|
2022-11-03 11:44:49 +01:00
|
|
|
dia.anchor = ANCHOR.left | ANCHOR.top;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2022-11-03 11:44:49 +01:00
|
|
|
|
2023-06-05 18:27:53 +02:00
|
|
|
TOOLTIP = $"{warning_amo} {__txt("Warnings")} {error_amo} {__txt("Errors")}";
|
2022-11-03 11:44:49 +01:00
|
|
|
} else
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, nx0, ny0 - nh / 2, nw, nh, cc, 1);
|
2022-11-03 11:44:49 +01:00
|
|
|
|
|
|
|
gpu_set_blendmode(bm_add);
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_sprite_stretched_ext(THEME.menu_button_mask, 0, nx0, ny0 - nh / 2, nw, nh, cc, ev / 2);
|
2022-11-03 11:44:49 +01:00
|
|
|
gpu_set_blendmode(bm_normal);
|
|
|
|
|
2022-12-10 05:06:01 +01:00
|
|
|
if(noti_icon_show > 0)
|
|
|
|
draw_sprite_ui(noti_icon, 0, nx0 + nw - ui(16), ny0,,,,, noti_icon_show);
|
2023-06-10 13:59:45 +02:00
|
|
|
|
|
|
|
draw_set_color(COLORS._main_text_inner);
|
2023-03-11 06:40:34 +01:00
|
|
|
var wr_x = hori? nx0 + ui(8) : w / 2 - (wr_w + er_w + ui(16)) / 2;
|
2022-11-18 03:20:31 +01:00
|
|
|
draw_sprite_ui_uniform(THEME.noti_icon_warning, warning_amo? 1 : 0, wr_x + ui(10), ny0);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(wr_x + ui(28), ny0, warning_amo);
|
2022-11-03 11:44:49 +01:00
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
wr_x += wr_w + ui(16);
|
|
|
|
draw_sprite_ui_uniform(THEME.noti_icon_error, error_amo? 1 : 0, wr_x + ui(10), ny0);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(wr_x + ui(28), ny0, error_amo);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) nx0 += nw + ui(8);
|
|
|
|
else ny0 += nh + ui(8);
|
2023-01-09 03:14:20 +01:00
|
|
|
#endregion
|
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
#region addons
|
2023-01-09 03:14:20 +01:00
|
|
|
var wh = ui(32);
|
2023-03-11 06:40:34 +01:00
|
|
|
if(!hori) nx0 = ui(8);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
if(instance_exists(addon)) {
|
|
|
|
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
|
|
|
|
|
|
|
var name = string(instance_number(addon)) + " ";
|
|
|
|
var ww = hori? string_width(name) + ui(40) : w - ui(16);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
if(pHOVER && point_in_rectangle(mx, my, nx0, ny0 - wh / 2, nx0 + ww, ny0 + wh / 2)) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-06-04 18:28:29 +02:00
|
|
|
TOOLTIP = __txt("Addons");
|
2023-03-02 07:59:14 +01:00
|
|
|
draw_sprite_stretched(THEME.menu_button, 1, nx0, ny0 - wh / 2, ww, wh);
|
2023-05-03 21:42:17 +02:00
|
|
|
if(mouse_press(mb_left, pFOCUS))
|
|
|
|
dialogPanelCall(new Panel_Addon());
|
2023-01-09 03:14:20 +01:00
|
|
|
} else
|
2023-03-02 07:59:14 +01:00
|
|
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, nx0, ny0 - wh / 2, ww, wh);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(nx0 + ui(8), ny0, name);
|
2023-07-05 15:09:52 +02:00
|
|
|
draw_sprite_ui(THEME.addon_icon, 0, nx0 + ui(20) + string_width(name), ny0 + ui(1),,,, COLORS._main_icon);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) nx0 += ww + ui(4);
|
|
|
|
else ny0 += hh + ui(4);
|
2023-01-09 03:14:20 +01:00
|
|
|
}
|
2022-11-03 11:44:49 +01:00
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var x1 = _right? w - ui(6) : ui(8 + 28);
|
2023-02-21 07:38:25 +01:00
|
|
|
|
|
|
|
#region actions
|
|
|
|
var bs = ui(28);
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(action_buttons); i < n; i++ ) {
|
2023-03-08 12:14:01 +01:00
|
|
|
var action = action_buttons[i];
|
|
|
|
|
|
|
|
switch(action) {
|
|
|
|
case "exit":
|
2024-05-03 09:02:18 +02:00
|
|
|
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_exit, 0, COLORS._main_accent);
|
2023-11-28 06:50:54 +01:00
|
|
|
if(b) _draggable = false;
|
|
|
|
if(b == 2) window_close();
|
2023-03-08 12:14:01 +01:00
|
|
|
break;
|
|
|
|
case "maximize":
|
2023-11-28 06:50:54 +01:00
|
|
|
var win_max = window_is_maximized || window_is_fullscreen;
|
2023-03-08 12:14:01 +01:00
|
|
|
if(OS == os_macosx)
|
|
|
|
win_max = __win_is_maximized;
|
|
|
|
|
2024-05-03 09:02:18 +02:00
|
|
|
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_maximize, win_max, [ COLORS._main_icon, CDEF.lime ]);
|
2023-11-28 06:50:54 +01:00
|
|
|
if(b) _draggable = false;
|
|
|
|
if(b == 2) {
|
2023-03-08 12:14:01 +01:00
|
|
|
if(OS == os_windows) {
|
2023-11-28 06:50:54 +01:00
|
|
|
if(window_is_fullscreen) {
|
|
|
|
winMan_setFullscreen(false);
|
|
|
|
winMan_Unmaximize();
|
|
|
|
} else if(window_is_maximized) {
|
|
|
|
winMan_Unmaximize();
|
|
|
|
DISPLAY_REFRESH
|
|
|
|
} else {
|
|
|
|
winMan_Maximize();
|
|
|
|
DISPLAY_REFRESH
|
|
|
|
}
|
2023-03-08 12:14:01 +01:00
|
|
|
} else if(OS == os_macosx) {
|
|
|
|
if(__win_is_maximized) mac_window_minimize();
|
|
|
|
else mac_window_maximize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "minimize":
|
2024-05-03 09:02:18 +02:00
|
|
|
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]);
|
2023-12-12 06:40:29 +01:00
|
|
|
if(b) _draggable = false;
|
|
|
|
if(b == -2) {
|
|
|
|
if(OS == os_windows)
|
|
|
|
winMan_Minimize();
|
|
|
|
else if(OS == os_macosx)
|
|
|
|
mac_window_dock();
|
2023-03-08 12:14:01 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "fullscreen":
|
2023-11-28 06:50:54 +01:00
|
|
|
var win_full = window_is_fullscreen;
|
2024-05-03 09:02:18 +02:00
|
|
|
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], true, pHOVER,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]);
|
2023-11-28 06:50:54 +01:00
|
|
|
if(b) _draggable = false;
|
|
|
|
if(b == 2) {
|
2023-03-08 12:14:01 +01:00
|
|
|
if(OS == os_windows)
|
2023-11-28 06:50:54 +01:00
|
|
|
winMan_setFullscreen(!win_full);
|
2023-03-08 12:14:01 +01:00
|
|
|
else if(OS == os_macosx) {
|
2023-11-28 06:50:54 +01:00
|
|
|
if(win_full) {
|
|
|
|
winMan_setFullscreen(false);
|
2023-03-08 12:14:01 +01:00
|
|
|
mac_window_minimize();
|
|
|
|
} else
|
2023-11-28 06:50:54 +01:00
|
|
|
winMan_setFullscreen(true);
|
2023-03-08 12:14:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
if(_right) x1 -= bs + ui(4);
|
|
|
|
else x1 += bs + ui(4);
|
2023-02-21 07:38:25 +01:00
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
#region version
|
2023-11-24 10:41:53 +01:00
|
|
|
var _xx1 = _right? x1 : w - ui(40);
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
var txt = "v. " + string(VERSION_STRING);
|
2023-02-28 09:43:01 +01:00
|
|
|
if(STEAM_ENABLED) txt += " Steam";
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-16 20:16:31 +02:00
|
|
|
version_name_copy = lerp_float(version_name_copy, 0, 10);
|
|
|
|
var tc = merge_color(COLORS._main_text_sub, COLORS._main_value_positive, min(1, version_name_copy));
|
|
|
|
var sc = merge_color(c_white, COLORS._main_value_positive, min(1, version_name_copy));
|
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) {
|
2023-08-16 20:16:31 +02:00
|
|
|
draw_set_text(f_p0, fa_center, fa_center, tc);
|
2023-11-24 10:41:53 +01:00
|
|
|
var ww = string_width(txt) + ui(12);
|
|
|
|
var _x0 = _xx1 - ww;
|
|
|
|
var _y0 = ui(6);
|
|
|
|
var _x1 = _xx1;
|
|
|
|
var _y1 = h - ui(6);
|
2023-03-12 02:28:21 +01:00
|
|
|
|
|
|
|
if(pHOVER && point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-08-16 20:16:31 +02:00
|
|
|
draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _x0, _y0, _x1 - _x0, _y1 - _y0, sc, 1);
|
2023-11-14 14:29:11 +01:00
|
|
|
|
2023-08-16 20:16:31 +02:00
|
|
|
if(mouse_press(mb_left, pFOCUS))
|
2023-03-11 06:40:34 +01:00
|
|
|
dialogCall(o_dialog_release_note);
|
2023-08-16 20:16:31 +02:00
|
|
|
if(mouse_press(mb_right, pFOCUS)) {
|
|
|
|
clipboard_set_text(VERSION_STRING);
|
|
|
|
version_name_copy = 3;
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2023-08-16 20:16:31 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
draw_text(round((_x0 + _x1) / 2), round((_y0 + _y1) / 2), txt);
|
|
|
|
_xx1 = _x0 - ui(8);
|
2023-03-11 06:40:34 +01:00
|
|
|
} else {
|
2023-11-24 10:41:53 +01:00
|
|
|
var _xx1 = ui(40);
|
2023-03-11 06:40:34 +01:00
|
|
|
var y1 = h - ui(20);
|
|
|
|
|
2023-08-16 20:16:31 +02:00
|
|
|
draw_set_text(f_p0, fa_left, fa_center, tc);
|
2023-03-11 06:40:34 +01:00
|
|
|
var ww = string_width(txt) + ui(12);
|
2023-11-24 10:41:53 +01:00
|
|
|
if(pHOVER && point_in_rectangle(mx, my, _xx1, y1 - ui(16), _xx1 + ww, y1 + ui(16))) {
|
2023-11-28 06:50:54 +01:00
|
|
|
_draggable = false;
|
2023-11-24 10:41:53 +01:00
|
|
|
draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _xx1, y1 - ui(16), ww, ui(32), sc, 1);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
if(mouse_press(mb_left, pFOCUS))
|
|
|
|
dialogCall(o_dialog_release_note);
|
2023-08-16 20:16:31 +02:00
|
|
|
if(mouse_press(mb_right, pFOCUS)) {
|
|
|
|
clipboard_set_text(VERSION_STRING);
|
|
|
|
version_name_copy = 3;
|
|
|
|
}
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
2023-08-16 20:16:31 +02:00
|
|
|
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(_xx1 + ui(6), y1, txt);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
#endregion
|
2023-02-23 07:02:19 +01:00
|
|
|
|
|
|
|
#region title
|
|
|
|
var txt = "";
|
2023-11-19 09:05:42 +01:00
|
|
|
if(PROJECT.safeMode) txt += $"[{__txt("SAFE MODE")}] ";
|
|
|
|
if(PROJECT.readonly) txt += $"[{__txt("READ ONLY")}] ";
|
2023-11-01 08:10:25 +01:00
|
|
|
|
2023-11-19 09:05:42 +01:00
|
|
|
txt += PROJECT.path == ""? __txt("Untitled") : filename_name(PROJECT.path);
|
2023-11-01 08:10:25 +01:00
|
|
|
if(PROJECT.modified) txt += "*";
|
2023-02-23 07:02:19 +01:00
|
|
|
txt += " - Pixel Composer";
|
2023-12-12 14:41:50 +01:00
|
|
|
if(DEMO) txt += " DEMO";
|
2023-02-23 07:02:19 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
var tx0, tx1, tcx;
|
2023-03-11 06:40:34 +01:00
|
|
|
var ty0, ty1;
|
|
|
|
var tbx0, tby0;
|
2023-11-24 10:41:53 +01:00
|
|
|
var maxW;
|
2023-03-11 06:40:34 +01:00
|
|
|
|
|
|
|
if(hori) {
|
2023-11-24 10:41:53 +01:00
|
|
|
tx0 = nx0;
|
2024-04-08 07:13:46 +02:00
|
|
|
tx1 = _xx1;
|
2023-11-24 10:41:53 +01:00
|
|
|
ty0 = 0;
|
|
|
|
ty1 = h;
|
2023-03-11 06:40:34 +01:00
|
|
|
tcx = (tx0 + tx1) / 2;
|
|
|
|
} else {
|
|
|
|
tx0 = ui(8);
|
2023-11-24 10:41:53 +01:00
|
|
|
tx1 = w < vertical_break? w - ui(16) : w - ui(144);
|
|
|
|
ty0 = w < vertical_break? ui(36) : ui(6);
|
2023-03-11 06:40:34 +01:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
tcx = tx0;
|
|
|
|
if(!_right && w >= vertical_break) {
|
|
|
|
tx0 = x1 - bs;
|
|
|
|
tx1 = w - ui(16);
|
|
|
|
}
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
maxW = abs(tx0 - tx1);
|
2023-02-23 07:02:19 +01:00
|
|
|
|
|
|
|
draw_set_font(f_p0b);
|
|
|
|
var tc = string_cut(txt, maxW);
|
|
|
|
var tw = string_width(tc) + ui(16);
|
2023-03-11 06:40:34 +01:00
|
|
|
var th = ui(28);
|
2023-02-23 07:02:19 +01:00
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) {
|
|
|
|
tbx0 = tcx - tw / 2;
|
|
|
|
tby0 = ty1 / 2 - ui(14);
|
|
|
|
} else {
|
|
|
|
tbx0 = tx0;
|
|
|
|
tby0 = ty0;
|
|
|
|
}
|
|
|
|
|
2023-11-15 02:35:30 +01:00
|
|
|
var _b = buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pFOCUS, pHOVER);
|
|
|
|
var _hov = _b > 0;
|
|
|
|
|
2023-11-28 06:50:54 +01:00
|
|
|
if(_b) _draggable = false;
|
2023-11-15 02:35:30 +01:00
|
|
|
if(_b == 2) {
|
|
|
|
_hov = true;
|
2023-02-23 07:02:19 +01:00
|
|
|
var arr = [];
|
2023-03-05 07:16:44 +01:00
|
|
|
var tip = [];
|
2023-02-23 07:02:19 +01:00
|
|
|
for(var i = 0; i < min(10, ds_list_size(RECENT_FILES)); i++) {
|
|
|
|
var _rec = RECENT_FILES[| i];
|
2023-03-05 07:16:44 +01:00
|
|
|
var _dat = RECENT_FILE_DATA[| i];
|
2023-05-04 20:00:56 +02:00
|
|
|
array_push(arr, menuItem(_rec, function(_dat) { LOAD_PATH(_dat.name); }));
|
2023-03-05 07:16:44 +01:00
|
|
|
array_push(tip, [ method(_dat, _dat.getThumbnail), VALUE_TYPE.surface ]);
|
2023-02-23 07:02:19 +01:00
|
|
|
}
|
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
var dia = hori? menuCall("title_recent_menu", x + tcx, y + h, arr, fa_center) : menuCall("title_recent_menu", x + w, y + tby0, arr);
|
2023-03-05 07:16:44 +01:00
|
|
|
dia.tooltips = tip;
|
2023-02-23 07:02:19 +01:00
|
|
|
}
|
|
|
|
|
2023-03-11 06:40:34 +01:00
|
|
|
if(hori) {
|
|
|
|
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text_sub);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(tcx, (ty0 + ty1) / 2, tc);
|
2023-03-11 06:40:34 +01:00
|
|
|
} else {
|
|
|
|
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(tx0 + ui(8), tby0 + th / 2, tc);
|
2023-03-11 06:40:34 +01:00
|
|
|
}
|
2023-11-15 02:35:30 +01:00
|
|
|
|
|
|
|
if(IS_PATREON && PREFERENCES.show_supporter_icon) {
|
|
|
|
var _tw = string_width(tc);
|
|
|
|
var _th = string_height(tc);
|
|
|
|
var _cx, _cy;
|
|
|
|
|
|
|
|
if(hori) {
|
|
|
|
_cx = tcx + _tw / 2;
|
|
|
|
_cy = (ty0 + ty1) / 2 - _th / 2;
|
|
|
|
} else {
|
|
|
|
_cx = tx0 + ui(8) + _tw;
|
|
|
|
_cy = tby0 + th / 2 - _th / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
_cx += ui(2);
|
|
|
|
_cy += ui(6);
|
|
|
|
|
|
|
|
var _ib = COLORS._main_text_sub;
|
|
|
|
|
|
|
|
if(pHOVER && point_in_rectangle(mx, my, _cx - 12, _cy - 12, _cx + 12, _cy + 12)) {
|
2023-11-19 09:05:42 +01:00
|
|
|
TOOLTIP = __txt("Supporter");
|
2023-11-15 02:35:30 +01:00
|
|
|
_ib = COLORS._main_accent;
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_sprite_ext(s_patreon_supporter, 0, _cx, _cy, 1, 1, 0, _hov? COLORS._main_icon_dark : COLORS.panel_bg_clear, 1);
|
|
|
|
draw_sprite_ext(s_patreon_supporter, 1, _cx, _cy, 1, 1, 0, _ib, 1);
|
|
|
|
}
|
2023-02-23 07:02:19 +01:00
|
|
|
#endregion
|
2023-11-28 06:50:54 +01:00
|
|
|
|
|
|
|
#region drag
|
|
|
|
if(mouse_press(mb_left, _draggable))
|
|
|
|
winMan_initDrag(0b10000);
|
|
|
|
#endregion
|
2023-11-24 10:41:53 +01:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|