@@ -8650,6 +8650,12 @@ define("command/Commands", function (require, exports, module) {
86508650 /** Toggles automatic working set sorting */
86518651 exports.CMD_WORKING_SORT_TOGGLE_AUTO = "cmd.sortWorkingSetToggleAuto"; // WorkingSetSort.js _handleToggleAutoSort()
86528652
8653+ /** Toggles working set visibility */
8654+ exports.CMD_TOGGLE_SHOW_WORKING_SET = "cmd.toggleShowWorkingSet"; // SidebarView.js _handleToggleWorkingSet()
8655+
8656+ /** Toggles file tabs visibility */
8657+ exports.CMD_TOGGLE_SHOW_FILE_TABS = "cmd.toggleShowFileTabs"; // SidebarView.js _handleToggleFileTabs()
8658+
86538659 /** Opens keyboard navigation UI overlay */
86548660 exports.CMD_KEYBOARD_NAV_UI_OVERLAY = "cmd.keyboardNavUI"; // WorkingSetSort.js _handleToggleAutoSort()
86558661
@@ -9133,6 +9139,9 @@ define("command/DefaultMenus", function (require, exports, module) {
91339139 splitview_menu.addMenuDivider();
91349140 splitview_menu.addMenuItem(Commands.CMD_WORKING_SORT_TOGGLE_AUTO);
91359141 splitview_menu.addMenuItem(Commands.FILE_SHOW_FOLDERS_FIRST);
9142+ splitview_menu.addMenuDivider();
9143+ splitview_menu.addMenuItem(Commands.CMD_TOGGLE_SHOW_WORKING_SET);
9144+ splitview_menu.addMenuItem(Commands.CMD_TOGGLE_SHOW_FILE_TABS);
91369145
91379146 var project_cmenu = Menus.registerContextMenu(Menus.ContextMenuIds.PROJECT_MENU);
91389147 project_cmenu.addMenuItem(Commands.FILE_NEW);
@@ -104143,6 +104152,9 @@ define("nls/root/strings", {
104143104152 "SPLITVIEW_MENU_TOOLTIP": "Split the editor vertically or horizontally",
104144104153 "GEAR_MENU_TOOLTIP": "Configure Working Set",
104145104154
104155+ "CMD_TOGGLE_SHOW_WORKING_SET": "Show Working Set",
104156+ "CMD_TOGGLE_SHOW_FILE_TABS": "Show File Tab Bar",
104157+
104146104158 "SPLITVIEW_INFO_TITLE": "Already Open",
104147104159 "SPLITVIEW_MULTIPANE_WARNING": "The file is already open in another pane. {APP_NAME} will soon support opening the same file in more than one pane. Until then, the file will be shown in the pane it's already open in.<br /><br />(You'll only see this message once.)",
104148104160
@@ -105094,6 +105106,9 @@ define("nls/root/strings", {
105094105106 // Emmet
105095105107 "DESCRIPTION_EMMET": "true to enable Emmet, else false.",
105096105108
105109+ // Hide/Show working set (that is displayed in the sidebar)
105110+ "DESCRIPTION_SHOW_WORKING_SET": "true to show the working set, false to hide it.",
105111+
105097105112 // Tabbar
105098105113 "DESCRIPTION_TABBAR": "Set the tab bar settings.",
105099105114 "DESCRIPTION_SHOW_TABBAR": "true to show the tab bar, else false.",
@@ -148187,15 +148202,16 @@ define("project/ProjectModel", function (require, exports, module) {
148187148202define("project/SidebarView", function (require, exports, module) {
148188148203
148189148204
148190- var AppInit = require("utils/AppInit"),
148191- ProjectManager = require("project/ProjectManager"),
148192- WorkingSetView = require("project/WorkingSetView"),
148193- MainViewManager = require("view/MainViewManager"),
148194- CommandManager = require("command/CommandManager"),
148195- Commands = require("command/Commands"),
148196- Strings = require("strings"),
148197- Resizer = require("utils/Resizer"),
148198- _ = require("thirdparty/lodash");
148205+ var AppInit = require("utils/AppInit"),
148206+ ProjectManager = require("project/ProjectManager"),
148207+ PreferencesManager = require("preferences/PreferencesManager"),
148208+ WorkingSetView = require("project/WorkingSetView"),
148209+ MainViewManager = require("view/MainViewManager"),
148210+ CommandManager = require("command/CommandManager"),
148211+ Commands = require("command/Commands"),
148212+ Strings = require("strings"),
148213+ Resizer = require("utils/Resizer"),
148214+ _ = require("thirdparty/lodash");
148199148215
148200148216 // These vars are initialized by the htmlReady handler
148201148217 // below since they refer to DOM elements
@@ -148207,7 +148223,9 @@ define("project/SidebarView", function (require, exports, module) {
148207148223
148208148224 var _cmdSplitNone,
148209148225 _cmdSplitVertical,
148210- _cmdSplitHorizontal;
148226+ _cmdSplitHorizontal,
148227+ _cmdToggleWorkingSet,
148228+ _cmdToggleFileTabs;
148211148229
148212148230 /**
148213148231 * @private
@@ -148327,6 +148345,30 @@ define("project/SidebarView", function (require, exports, module) {
148327148345 MainViewManager.setLayoutScheme(2, 1);
148328148346 }
148329148347
148348+ /**
148349+ * Handle Toggle Working Set Command
148350+ * @private
148351+ */
148352+ function _handleToggleWorkingSet() {
148353+ const isCurrentlyShown = PreferencesManager.get("showWorkingSet");
148354+ PreferencesManager.set("showWorkingSet", !isCurrentlyShown);
148355+ CommandManager.get(Commands.CMD_TOGGLE_SHOW_WORKING_SET).setChecked(!isCurrentlyShown);
148356+ }
148357+
148358+ /**
148359+ * Handle Toggle File Tabs Command
148360+ * @private
148361+ */
148362+ function _handleToggleFileTabs() {
148363+ const prefs = PreferencesManager.get("tabBar.options");
148364+ const willBeShown = !prefs.showTabBar;
148365+ PreferencesManager.set("tabBar.options", {
148366+ showTabBar: willBeShown,
148367+ numberOfTabs: prefs.numberOfTabs
148368+ });
148369+ CommandManager.get(Commands.CMD_TOGGLE_SHOW_FILE_TABS).setChecked(willBeShown);
148370+ }
148371+
148330148372 // Initialize items dependent on HTML DOM
148331148373 AppInit.htmlReady(function () {
148332148374 $sidebar = $("#sidebar");
@@ -148335,6 +148377,12 @@ define("project/SidebarView", function (require, exports, module) {
148335148377 $projectFilesContainer = $sidebar.find("#project-files-container");
148336148378 $workingSetViewsContainer = $sidebar.find("#working-set-list-container");
148337148379
148380+ // apply working set visibility immediately
148381+ // this is needed because otherwise when the working set is hidden there is a flashing issue
148382+ if (!PreferencesManager.get("showWorkingSet")) {
148383+ $workingSetViewsContainer.addClass("working-set-hidden");
148384+ }
148385+
148338148386 // init
148339148387 $sidebar.on("panelResizeStart", function (evt, width) {
148340148388 $sidebar.find(".sidebar-selection-extension").css("display", "none");
@@ -148393,6 +148441,37 @@ define("project/SidebarView", function (require, exports, module) {
148393148441
148394148442 // Tooltips
148395148443 $splitViewMenu.attr("title", Strings.GEAR_MENU_TOOLTIP);
148444+
148445+ _cmdToggleWorkingSet.setChecked(PreferencesManager.get("showWorkingSet"));
148446+ _cmdToggleFileTabs.setChecked(PreferencesManager.get("tabBar.options").showTabBar);
148447+
148448+ // to listen for tab bar preference changes from the preferences file
148449+ // because if user toggles the state of tab bar visibility either from the view menu or the preferences file
148450+ // we need to update the checked state here too
148451+ PreferencesManager.on("change", "tabBar.options", function () {
148452+ const prefs = PreferencesManager.get("tabBar.options");
148453+ _cmdToggleFileTabs.setChecked(prefs.showTabBar);
148454+ });
148455+
148456+ // Define the preference to decide whether to show the working set or not
148457+ PreferencesManager.definePreference("showWorkingSet", "boolean", true, {
148458+ description: Strings.DESCRIPTION_SHOW_WORKING_SET
148459+ })
148460+ .on("change", function () {
148461+ // 'working-set-list-container' is the id of the main working set element which we need to hide/show
148462+ const $workingSet = $(document.getElementById("working-set-list-container"));
148463+ const getPref = PreferencesManager.get("showWorkingSet");
148464+
148465+ if(getPref) {
148466+ // refer to brackets.less file for styles
148467+ $workingSet.removeClass("working-set-hidden");
148468+ } else {
148469+ $workingSet.addClass("working-set-hidden");
148470+ }
148471+
148472+ // update the menu item checked state to match the preference
148473+ _cmdToggleWorkingSet.setChecked(getPref);
148474+ });
148396148475 });
148397148476
148398148477 ProjectManager.on("projectOpen", _updateProjectTitle);
@@ -148404,6 +148483,8 @@ define("project/SidebarView", function (require, exports, module) {
148404148483 _cmdSplitNone = CommandManager.register(Strings.CMD_SPLITVIEW_NONE, Commands.CMD_SPLITVIEW_NONE, _handleSplitViewNone);
148405148484 _cmdSplitVertical = CommandManager.register(Strings.CMD_SPLITVIEW_VERTICAL, Commands.CMD_SPLITVIEW_VERTICAL, _handleSplitViewVertical);
148406148485 _cmdSplitHorizontal = CommandManager.register(Strings.CMD_SPLITVIEW_HORIZONTAL, Commands.CMD_SPLITVIEW_HORIZONTAL, _handleSplitViewHorizontal);
148486+ _cmdToggleWorkingSet = CommandManager.register(Strings.CMD_TOGGLE_SHOW_WORKING_SET, Commands.CMD_TOGGLE_SHOW_WORKING_SET, _handleToggleWorkingSet);
148487+ _cmdToggleFileTabs = CommandManager.register(Strings.CMD_TOGGLE_SHOW_FILE_TABS, Commands.CMD_TOGGLE_SHOW_FILE_TABS, _handleToggleFileTabs);
148407148488
148408148489 CommandManager.register(Strings.CMD_TOGGLE_SIDEBAR, Commands.VIEW_HIDE_SIDEBAR, toggle);
148409148490 CommandManager.register(Strings.CMD_SHOW_SIDEBAR, Commands.SHOW_SIDEBAR, show);
0 commit comments