"use strict"; //this function converts a window to a cascaded state //if it is not already cascaded. function cascade_window(win_id) { var orig_x = null; var orig_y = null; var orig_w = null; var orig_h = null; var win_state = null; var win = null; reset_css_pixel_ratio(); //IMPORTANT for resetting the pixel ratio. Sets the ratio of CSS and regular pixels to 1:1 win = document.getElementById(win_id); if (win != null) { //if we're cascading a thumbnail window, then exit function. if (win_id.indexOf("copied_node_") > -1.0) { return; } //2024-04-19: //Apply default CSS animation to element for //CSS properties: top, left, width, height, and box-shadow. //This CSS animation behaves the same way for all CSS properties //mentioned. remove any CSS animations from the window's interface //to prevent the window's tabble from lagging during move/resize, etc. //See file: 'window_2.js' ////set_animations_move_window(win_id); set_animations_default(win_id); remove_elem_animations(win_id + "_tbl_0000"); win_state = win.getAttribute("data-window_state"); //If the window is not Cascaded, then it is either //minimized, or maximized. Cascade the window. if (win_state !== "Cascade") { win.style.position = "absolute"; win.style.maxHeight = "unset"; win.style.minHeight = "unset"; win.style.maxWidth = "unset"; win.style.minWidth = "300px"; //get the saved window top, left, width, height //that were saved as attributes when the window //was cascaded orig_x = win.getAttribute("data-orig_x"); orig_y = win.getAttribute("data-orig_y"); orig_w = win.getAttribute("data-orig_w"); orig_h = win.getAttribute("data-orig_h"); //set the window's top, left, width, and height //properties to its previously Cascaded window //state. win.style.left = parseFloat(orig_x) + "px"; win.style.top = parseFloat(orig_y) + "px"; win.style.width = parseFloat(orig_w) + "px"; win.style.height = parseFloat(orig_h) + "px"; //set the window's table interface size and opacity to //match the size of the window, and set its opacity to fully //opaque win.childNodes[0].style.width = parseFloat(orig_w) + "px"; win.childNodes[0].style.height = parseFloat(orig_h) + "px"; win.childNodes[0].style.opacity = 1.0; //if the code editor is present in the window, //then show the code editor, and size the code //editor objects to fit the window's content //container. see file: 'code_editor_functions.js' if (is_code_editor_present(win_id) === true) { show_code_editor(win_id); resize_tabs_bar(win_id); on_cascade_resize_objects(win_id); } //set the new window state attributes to the Cascade configuration. win.setAttribute("data-is_minimized", "false"); win.setAttribute("data-is_maximized", "false"); win.setAttribute("data-window_state", "Cascade"); resize_contents_container(win_id); //resize the image that blocks unwanted user interaction resize_window_adjust_blocking_image(win_id); on_maximize_resize_code_window(win_id); //if the code editor is visible and present, resize it accordingly //update_window_details(win_id); //if window details are showing, update them //Set the web window's 3 upper right icons //that are used to change the web window's "state" (or display) //to match the state the web window is in: "cascade", "maximized", "minimized" set_window_state_icons(win_id); //if the web window is not maximized, enable the resize icon in case it's disabled enable_resize_icon(win_id); //2024-04-18: //the 'win_state' variable holds the state of the window when //before it was set to 'Cascade' window state. It does not hold the //current window state, just what window state it was before cascading. //call the 'minimize_window_main(win)' function to organize the windows //as a stack of minimized windows. //see file: 'minimize_window_scroll_box_1.js' if (win_state === "Minimize") { // || win_state === "Maximize") { minimize_window_main(win); } //this sets the web window's bg color to default on cascade. win.style.backgroundColor = global_window_bgColor; //Upon minimizing a window, its drop-shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. win.style.boxShadow = global_inactive_window_dropshadow; //2023-09-22: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only X resizing. //See file 'set_x_resize.js' set_size_resize_bar_x(win_id); //2023-09-23: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only Y resizing. //See file 'set_y_resize.js' set_size_resize_bar_y(win_id); //2024-03-13: //if any windows are displayed in tab mode, set the tabs //container to visible. show_tabs_container(); //2024-04-23: //see file: 'hide_show_stowed.js' //this function checks to see if any minimized windows are //stowed. if they are, then show the tuck/untuck stowed icon. if_minimized_windows_stowed_show_tuck_icon(); } //2024-05-13: //this function counts the minimized windows. if minimized windows //don't exist, then hide the stow minimized windows box/button. //it's currently being called in an event listener for the web //browser window element. see file: 'stow_minimized_windows.js' hide_stow_minimized_windows_box_if_no_minimized_exist(); //2024-05-14: //a function that takes a window, //and resets its parameters to be that of a window that's //created as a new window. see file: 'window_2.js' ////reset_cascaded_window(win_id); } //2024-05-18: //set all windows' zIndex property in order. tabbed windows are set //with the lowest zIndex. cascaded windows are set next. minimized //windows are set next. finally, the maximized window(s) are set. //see file: 'window_2.js' ////set_all_window_zIndexes(); } //this function may not show that it has any references. It is being //called from one of the main menu items. Don't delete it. function cascade_all() { var web_wins = null; var web_win = null; var wid = null; var i = null; var is_tabbed = null; var win_state = null; web_wins = document.getElementsByName("web_window"); if (web_wins !== null) { for (i = 0; i < web_wins.length; i++) { web_win = web_wins[i]; wid = web_win.getAttribute("id"); win_state = web_win.getAttribute("data-window_state"); if (win_state == "Minimize") { minimize_to_cascade(wid); //this function animates the window from minimized to cascade //Set the web window's 3 upper right icons //that are used to change the web window's "state" (or display) //to match the state the web window is in: "cascade", "maximized", "minimized" set_window_state_icons(wid); //Upon minimizing a window, its drop shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. web_win.style.boxShadow = global_inactive_window_dropshadow; //since all minimized windows will be set to //a cascaded state, there will be no more minimized //windows present. calling this function will hide the //stow minimized windows box/button. //see file: 'stow_minimized_windows.js' minimize_window_main(web_win); } else if (win_state === "Maximize") { //Upon minimizing a window, its drop shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. web_win.style.boxShadow = global_inactive_window_dropshadow; //keep maximized windows unchanged } else if (win_state === "Cascade") { is_tabbed = web_win.getAttribute("data-is_tabbed"); if (is_tabbed !== "true" && is_tabbed !== true) { save_window_params(wid); //window is already in a Cascaded state. save its top, left, width, and height. //Upon minimizing a window, its drop-shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. web_win.style.boxShadow = global_inactive_window_dropshadow; //if the 'stow minimized window' box already exists, reset its arrow icon, //and remove the innerHTML within the first table cell. The table cell is inside //the box, and inside that table's cell. See file: 'stow_minimized_windows.js'. reset_stow_minimized_window_box(); } } else { //do nothing. continue; } } } } function minimize_to_cascade(win_id) { var win = null; var win_state = null; var is_minimized = null; var orig_x = null; var orig_y = null; var orig_w = null; var orig_h = null; var table_id = null; var tbl = null; win = document.getElementById(win_id); //if window exists if (win !== null) { win_state = win.getAttribute("data-window_state"); is_minimized = win.getAttribute("data-is_minimized"); //if the window is minimized if (win_state === "Minimize" && is_minimized === "true") { win.style.position = "absolute"; win.style.overflow = "visible"; win.style.maxHeight = "unset"; win.style.minHeight = "unset"; win.style.maxWidth = "unset"; win.style.minWidth = "300px"; orig_x = win.getAttribute("data-orig_x"); orig_y = win.getAttribute("data-orig_y"); orig_w = win.getAttribute("data-orig_w"); orig_h = win.getAttribute("data-orig_h"); //orig_y = orig_y + offset_Y_maximized_window(); win.style.width = parseFloat(orig_w) + "px"; win.style.height = parseFloat(orig_h) + "px"; table_id = (win_id + "_tbl_0000"); tbl = document.getElementById(table_id); tbl.style.width = parseFloat(orig_w) + "px"; tbl.style.height = parseFloat(orig_h) + "px"; win.style.left = parseFloat(orig_x) + "px"; win.style.top = parseFloat(orig_y) + "px"; //if the code editor is present in the window, //then show the code editor, and size the code //editor objects to fit the window's content //container. see file: 'code_editor_functions.js' if (is_code_editor_present(win_id) === true) { show_code_editor(win_id); resize_tabs_bar(win_id); on_cascade_resize_objects(win_id); } win.setAttribute("data-window_state", "Cascade"); win.setAttribute("data-is_minimized", "false"); //Upon minimizing a window, its drop shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. win.style.boxShadow = global_inactive_window_dropshadow; //this function shows the scroll box and minimized window table/menu //if there is at least 1 window minimized minimize_window_main(win); } } } //2024-05-18: //this function returns an array of all non-tabbed cascaded //windows. function get_all_cascaded_windows() { var cascaded_wins = null; var cascaded_wins_length = null; var i = null; var is_tabbed = null; var win_state = null; var win = null; var cascaded_win_array = []; cascaded_wins = document.getElementsByName("web_window"); if (cascaded_wins !== null) { if (parseFloat(cascaded_wins.length) > 0) { cascaded_wins_length = parseFloat(cascaded_wins.length); for (i = 0; i < cascaded_wins_length; i++) { win = cascaded_wins[i]; if (win !== null) { if (win.hasAttribute("data-window_state") === true) { if (win.getAttribute("data-window_state") === "Cascade") { if (win.hasAttribute("data-is_tabbed") === true) { if (win.getAttribute("data-is_tabbed") !== true && win.getAttribute("data-is_tabbed") !== "true") { cascaded_win_array.push(win); } } } } } } } } return cascaded_win_array; }