"use strict"; //this function minimizes a single window from a cascaded, tabbed, or maximized state. //if the window is currently in a minimized state, this function sets it to a cascaded //window state. function minimize_window(win_id) { var win = null; var win_state = null; var orig_x = null; var orig_y = null; var orig_h = null; var orig_w = null; var is_minimized = null; var is_maximized = null; var table_id = null; var tbl = null; //if the 'stow minimized window' box already exists, reset its arrow icon (up or down), //and remove the innerHTML within the corresponding table cell. //The table cell is inside the 'stow minimized window' box, and inside a table's cell. //See file: 'stow_minimized_windows.js'. reset_stow_minimized_window_box(); //IMPORTANT for resetting the pixel ratio. //Sets the ratio of CSS and regular pixels to 1:1. //the function gets the pixel ratio, sets the global pixel ratio variable, //gets the coordinates of the mouse (adjusted for any zoom discrepancy), //and applies the actual page zoom function. see file: 'zoom.js' reset_css_pixel_ratio(); //get the window that is to be minimized by its id. //get the window's current state (cascade, minimize, maximize, etc.) //get the window's maximized and minimized state which are //also stored as attributes within the window's html as attributes. win = document.getElementById(win_id); win_state = win.getAttribute("data-window_state"); is_minimized = win.getAttribute("data-is_minimized"); is_maximized = win.getAttribute("data-is_maximized"); //2024-1-18: //When you make temporary alterations to an element, //you'll need to revert those changes later on so that //you know how to undo what has been done. the following //functions being called convert a tabbed window into //a cascaded form. see file 'tab_windows.js' rebuild_cascading_window_from_tabbed(win); restore_stripped_window_element(win_id); //if the window's state is cascaded, //then save its top left width and height //parameters inside the window's html as //attributes. if (win_state == "Cascade") { save_window_params(win_id); } //2023-09-22: //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. See file: 'window_2.js' set_animations_default(win_id); //If the web window is in a cascaded state, or a tabbed state, //or another window state that has not yet been created. the //window being minimized is not in a minimized or maximized state. if (is_minimized === "false" && is_maximized === "false") { //if the code editor is currently present //in the window, then hide it. //see file: 'code_editor_functions.js' if (is_code_editor_present(win_id) === true) { hide_code_editor(win_id); } //2023-07-20: //this sets the web window's bg color to default on minimize. win.style.backgroundColor = global_window_bgColor; //if the web window is not maximized, enable the resize icon //(bottom right corner of each web window), in the case where //it's disabled enable_resize_icon(win_id); //set the overflow contents to hidden so that the minimized window will display //set the window to display as a minimized window win.style.height = "30px"; win.style.maxHeight = "30px"; win.style.minHeight = "30px"; win.style.width = "300px"; win.style.maxWidth = "300px"; win.style.minWidth = "300px"; //as minimized. win.style.overflow = "hidden"; //get the window's table interface, and set its width and height //to equal that of the minimized window. table_id = (win_id + "_tbl_0000"); tbl = document.getElementById(table_id); tbl.style.width = parseFloat(tbl.parentNode.style.width) + "px"; tbl.style.height = parseFloat(tbl.parentNode.style.height) + "px"; //the window's state is being set to Minimize, so update the html attributes //of the window to reflect accordingly. win.setAttribute("data-window_state", "Minimize"); win.setAttribute("data-is_minimized", "true"); //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" //see file: 'window_state_controls.js' set_window_state_icons(win_id); //remove the window's drop shadow because minimized windows //don't have a shadow. win.style.boxShadow = global_hide_window_dropshadow; //2024-03-13: //If any windows are in tabbed mode, make the tabs container //visible. see file: 'tabbed_windows.js' show_tabs_container(); //2024-04-22: //if a cascaded window is minimized, and //the 'stow minimized windows' box/button is tucked behind the extend/retract button/icon, //then extend the 'stow minimized windows' box/button to its untucked and default //width of 300 pixels, or whatever its default width may be. //see file: 'hide_show_stowed.js' untuck_stow_minimized_windows_box(); //2024-04-23: //this function hides the small icon that retracts the stowed minimized windows //and the box/button that stows minimized windows. //see file: 'hide_show_stowed.js' hide_tuck_stowed_minimized_window_icon(); //this function organizes the minimized window, //and all other minimized windows into a stacked formation //at the left side of the screen. the function is found in //file: 'minimize_window_scroll_box.js. //It controls the scroll box for minimized windows minimize_window_main(win); } //else if the web window is in a minimized state, not in a maximized state, //or a cascaded state, or a tabbed state, then configure it into a cascadeded window //state. else if (is_minimized === "true" && is_maximized === "false") { //in case the position isn't set to absolute, be sure that //it's set correctly. make the window's contents //visible in case they were previously hidden. win.style.position = "absolute"; win.style.overflow = "visible"; win.style.maxHeight = "unset"; win.style.minHeight = "unset"; win.style.maxWidth = "unset"; win.style.minWidth = "unset"; //get the cadcaded window parameters from inside the //window's html which are stored as attributes. 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"); //get the window's cascaded width and height //from html attributes stored in the window's html win.style.width = parseFloat(orig_w) + "px"; win.style.height = parseFloat(orig_h) + "px"; //get the window's table interface, and //set its width and height to equal that //of the window object. 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"; //set the top, and left coordinates to the window //so that it is positioned in the same location //that it was in while being displayed as cascaded win.style.left = parseFloat(orig_x) + "px"; win.style.top = parseFloat(orig_y) + "px"; //since the window is being set to a cascaded configuration, //it does not need to have its table interface hidden. set //the overlow content to visible. tbl.style.overflow = "visible"; //2023-07-20: Set the web window's bg color to default' //this sets the web window's bg color to default on minimize. win.style.backgroundColor = global_window_bgColor; //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 'window state' attributes inside the window's //html to reflect the new window state, which is 'cascaded', //and not minimized. the 'data-is_maximized' attribute //doesn't need to be changed. 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; //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-1-18: //When you make temporary alterations to an element, //you'll need to revert those changes. in this case, //if the window is in a tabbed configuration, then //reset it back to a cascaded window. //See file: 'tab_windows.js' rebuild_cascading_window_from_tabbed(win); cascade_tabbed_window_tab_box(win_id); restore_stripped_window_element(win_id); //2024-03-13: //When minimized, show any hidden tabbed windows. show_tabs_container(); //call the function that arranges minimized windows into a stack //display at the left of the screen minimize_window_main(win); } //else if the window is currently in a maximized state, and is //being configured to a minimized state. else if (is_maximized === "true" && is_minimized === "false") { //2024-1-18: //When you make temporary alterations to an element, //you'll need to revert those changes. these functions //restore a window to a cascaded state in case it was //in a tabbed window state. see file: 'tabbed_windows.js' rebuild_cascading_window_from_tabbed(win); cascade_tabbed_window_tab_box(win_id); //...And continue with the usual //odd looking bit of code below. //in this case, we want to configure the window //to be in a cascaded state, before it is minimized. cascade_window(win_id); minimize_window(win_id); //2023-07-20: Set the web window's bg color to default' //this sets the web window's bg color to default on minimize. win.style.backgroundColor = global_window_bgColor; //remove the drop-shadow if one exists. a window that //is minimized does not have a drop-shadow. win.style.boxShadow = global_hide_window_dropshadow; //2024-03-13: //if tabbed windows exist, display the tabs container. The container //is set to hidden upon maximizing a window. see file 'tabbed_windows.js' show_tabs_container(); //this function checks to see if any minimized windows are //stowed. if they are, then show the tuck/untuck stowed icon. //see file: 'retrack_extend_stowed_minimized_windows.js' //currently not in use, so it's commented out, but if the //function ever needs to be used here, uncomment it. ////if_minimized_windows_stowed_and_tucked_show_icon(); } //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(); //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); } //minimize all open windows at once. //this function may not have any references. It is used //by a main menu item to minimize all windows. //do not delete. function minimize_all() { var web_wins = null; var web_win = null; var is_minimized = null; var is_maximized = null; var wid = null; var is_tabbed = null; var win_count = null; var i = null; //the 'stow minimized windows' box/button needs to be created before //minimizing windows. See file: 'stow_minimized_windows.js' init_stow_minimized_windows(); //2024-05-17: //when the 'minimize_all()' function is called, the minimized //windows may be tucked out of sight. the following code is needed //so that upon minimizing all windows, the minimized windows display //in stack formation. //see files: 'hide_show_stowed.js', and 'stow_minimized_windows.js' if (get_are_minimized_windows_tucked_attribute() === true) { //expand the width of the stow minimized windows box/button //making it visible. reset_minimized_window_scroll_box_size(); ////scroll_box.setAttribute("data-minimize_window_scroll_box_is_tucked", "false"); //set an html attribute in the minimized windows' "scroll_box" element //to false. set_stowed_minimized_windows_tucked_false(); //show the contents within the stow minimized windows box/button. show_stow_minimized_windows_box_contents(); //display the minimized windows in a stacked formation toggle_stow_unstow_minimized_windows_by_function(); } //this comment marks the end of the code to display any tucked and stowed minimized windows. web_wins = document.getElementsByName("web_window"); if (web_wins !== null) { win_count = web_wins.length; for (i = 0; i < win_count; i++) { web_win = web_wins[i]; wid = web_win.getAttribute("id"); is_minimized = web_win.getAttribute("data-is_minimized"); is_maximized = web_win.getAttribute("data-is_maximized"); if (is_minimized !== "true" && is_maximized !== "true") { is_tabbed = web_win.getAttribute("data-is_tabbed"); if (is_tabbed !== "true") { //for testing. log the windows that are being minimized. ////console.log("Minimizing Window " + (i + 1) + " of " + win_count); ////setTimeout(function () { minimize_window(wid); ////}, ((i + 10) * 100)); } } } } } //returns an array of all MINIMIZED windows function get_all_minimized_windows() { var web_windows = null; var win = null; var i = null; var win_id = null; var num_min_windows = null; var is_minimized = null; var web_win_count = null; var n_windows = null; n_windows = []; web_windows = document.getElementsByName("web_window"); if (web_windows !== null) { web_win_count = web_windows.length; for (i = 0; i < web_win_count; i++) { win = web_windows[i]; if (win !== null) { win_id = win.getAttribute("id"); is_minimized = win.getAttribute("data-is_minimized"); if (is_minimized === "true" || is_minimized === true) { n_windows.push(win_id); } } } } return n_windows; } //returns an array of all OPEN windows function get_all_open_windows() { var web_windows = null; var win = null; var i = null; var win_id = null; n_windows = []; web_windows = document.getElementsByName("web_window"); for (i = 0; i < web_windows.length; i++) { win = web_windows[i]; win_id = win.getAttribute("id"); n_windows[n_windows.length] = win_id; } return n_windows; }