From 3c35ef488b5f96ac38ff190cbe9df9cf00879242 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 5 Mar 2015 18:49:10 -0800 Subject: [PATCH] rm(workspace): Remove workspace, we don't need it. --- src/atom.coffee | 19 ++----- src/theme-manager.coffee | 8 +-- src/workspace-edgehill.coffee | 61 ---------------------- src/workspace-element-edgehill.coffee | 73 --------------------------- 4 files changed, 10 insertions(+), 151 deletions(-) delete mode 100644 src/workspace-edgehill.coffee delete mode 100644 src/workspace-element-edgehill.coffee diff --git a/src/atom.coffee b/src/atom.coffee index c21f44f28..f8e4783c2 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -210,6 +210,10 @@ class Atom extends Model @keymaps = new KeymapManager({configDirPath, resourcePath}) @keymaps.subscribeToFileReadFailure() + @keymaps.onDidMatchBinding (event) -> + if event.binding.command.indexOf('application:') is 0 and event.binding.selector is "body" + ipc.send('command', event.binding.command) + @tooltips = new TooltipManager @notifications = new NotificationManager @commands = new CommandRegistry @@ -596,13 +600,6 @@ class Atom extends Model @themes.loadBaseStylesheets() @keymaps.loadUserKeymap() - Workspace = require './workspace-edgehill' - Actions = require './flux/actions' - @workspace = new Workspace - - @item = document.createElement("atom-workspace") - document.querySelector(@workspaceViewParentSelector).appendChild(@item) - for pack in packages @packages.loadPackage(pack) @packages.activate() @@ -638,15 +635,12 @@ class Atom extends Model ipc.send('show-secondary-window', options) unloadEditorWindow: -> - @state.edgehillWorkspace = @workspace.serialize() @packages.deactivatePackages() @state.packageStates = @packages.packageStates @saveSync() @windowState = null removeEditorWindow: -> - @workspace?.destroy() - @workspace = null @windowEventHandler?.unsubscribe() ### @@ -727,11 +721,8 @@ class Atom extends Model ### deserializeWorkspaceView: -> - # Put state back into store startTime = Date.now() - Workspace = require './workspace-edgehill' - #@workspace = Workspace.deserialize(@state.edgehillWorkspace) ? new Workspace - @workspace = new Workspace + # Put state back into sheet-container? Restore app state here @deserializeTimings.workspace = Date.now() - startTime @item = document.createElement("atom-workspace") diff --git a/src/theme-manager.coffee b/src/theme-manager.coffee index 1f999492e..4389ab7b3 100644 --- a/src/theme-manager.coffee +++ b/src/theme-manager.coffee @@ -30,7 +30,7 @@ class ThemeManager stylesElement.onDidRemoveStyleElement @styleElementRemoved.bind(this) stylesElement.onDidUpdateStyleElement @styleElementUpdated.bind(this) - if atom.inDevMode() + if atom.inDevMode() and not atom.inSpecMode() console.log('In Dev Mode - Watching /static for LESS changes') watchStylesIn = (folder) => stylePaths = fs.listTreeSync(folder) @@ -370,13 +370,15 @@ class ThemeManager isInitialLoadComplete: -> @initialLoadComplete addActiveThemeClasses: -> - workspaceElement = atom.views.getView(atom.workspace) + workspaceElement = document.getElementsByTagName('atom-workspace')[0] + return unless workspaceElement for pack in @getActiveThemes() workspaceElement.classList.add("theme-#{pack.name}") return removeActiveThemeClasses: -> - workspaceElement = atom.views.getView(atom.workspace) + workspaceElement = document.getElementsByTagName('atom-workspace')[0] + return unless workspaceElement for pack in @getActiveThemes() workspaceElement.classList.remove("theme-#{pack.name}") return diff --git a/src/workspace-edgehill.coffee b/src/workspace-edgehill.coffee deleted file mode 100644 index 905066b48..000000000 --- a/src/workspace-edgehill.coffee +++ /dev/null @@ -1,61 +0,0 @@ -_ = require 'underscore-plus' -{Model} = require 'theorist' -Q = require 'q' -Serializable = require 'serializable' -{Emitter, Disposable, CompositeDisposable} = require 'event-kit' -WorkspaceElement = require './workspace-element-edgehill' - -# Essential: Represents the state of the user interface for the entire window. -# An instance of this class is available via the `atom.workspace` global. -# -# Interact with this object to open files, be notified of current and future -# editors, and manipulate panes. To add panels, you'll need to use the -# {WorkspaceView} class for now until we establish APIs at the model layer. -# -# * `editor` {TextEditor} the new editor -# -module.exports = -class Workspace extends Model - atom.deserializers.add(this) - Serializable.includeInto(this) - - @properties - fullScreen: false - - constructor: (params) -> - super - @emitter = new Emitter - - atom.views.addViewProvider - modelConstructor: Workspace - viewConstructor: WorkspaceElement - - # Called by the Serializable mixin during deserialization - deserializeParams: (params) -> - for packageName in params.packagesWithActiveGrammars ? [] - atom.packages.getLoadedPackage(packageName)?.loadGrammarsSync() - params - - # Called by the Serializable mixin during serialization. - serializeParams: -> - fullScreen: atom.isFullScreen() - - # Updates the application's title and proxy icon based on whichever file is - # open. - updateWindowTitle: -> - ## TODO we might want to put the unread count here in the future. - document.title = "Edgehill" - atom.setRepresentedFilename("Edgehill") - - confirmClose: -> - true - - # A no-op in Edgehill Workspace - open: -> - - # Appending Children to the Workspace - # ---- - - addColumnItem: (item, columnId="") -> - - addRow: (item) -> diff --git a/src/workspace-element-edgehill.coffee b/src/workspace-element-edgehill.coffee deleted file mode 100644 index 82cd4bac4..000000000 --- a/src/workspace-element-edgehill.coffee +++ /dev/null @@ -1,73 +0,0 @@ -ipc = require 'ipc' -path = require 'path' -{Disposable, CompositeDisposable} = require 'event-kit' -Grim = require 'grim' -scrollbarStyle = require 'scrollbar-style' -{callAttachHooks} = require 'space-pen' - -module.exports = -class WorkspaceElement extends HTMLElement - - createdCallback: -> - @subscriptions = new CompositeDisposable - @initializeContent() - @observeScrollbarStyle() - - attachedCallback: -> - callAttachHooks(this) - @focus() - - detachedCallback: -> - @subscriptions.dispose() - @model.destroy() - - initializeContent: -> - @classList.add 'workspace' - @setAttribute 'tabindex', -1 - - @horizontalAxis = document.createElement('atom-workspace-axis') - @horizontalAxis.classList.add('horizontal') - - @horizontalContainer = document.createElement('div') - @horizontalContainer.classList.add('atom-workspace-axis-container') - @horizontalContainer.appendChild(@horizontalAxis) - - @verticalAxis = document.createElement('atom-workspace-axis') - @verticalAxis.classList.add('vertical') - @verticalAxis.appendChild(@horizontalContainer) - - @appendChild(@verticalAxis) - - observeScrollbarStyle: -> - @subscriptions.add scrollbarStyle.onValue (style) => - switch style - when 'legacy' - @classList.remove('scrollbars-visible-when-scrolling') - @classList.add("scrollbars-visible-always") - when 'overlay' - @classList.remove('scrollbars-visible-always') - @classList.add("scrollbars-visible-when-scrolling") - - getModel: -> - @model - - setModel: (@model) -> - -atom.commands.add 'atom-workspace', - 'application:show-main-window': -> ipc.send('command', 'application:show-main-window') - 'application:new-message': -> ipc.send('command', 'application:new-message') - 'application:about': -> ipc.send('command', 'application:about') - 'application:run-all-specs': -> ipc.send('command', 'application:run-all-specs') - 'application:run-benchmarks': -> ipc.send('command', 'application:run-benchmarks') - 'application:show-settings': -> ipc.send('command', 'application:show-settings') - 'application:quit': -> ipc.send('command', 'application:quit') - 'application:hide': -> ipc.send('command', 'application:hide') - 'application:hide-other-applications': -> ipc.send('command', 'application:hide-other-applications') - 'application:install-update': -> ipc.send('command', 'application:install-update') - 'application:unhide-all-applications': -> ipc.send('command', 'application:unhide-all-applications') - 'application:minimize': -> ipc.send('command', 'application:minimize') - 'application:zoom': -> ipc.send('command', 'application:zoom') - 'application:bring-all-windows-to-front': -> ipc.send('command', 'application:bring-all-windows-to-front') - 'window:run-package-specs': -> ipc.send('run-package-specs', path.join(atom.project.getPath(), 'spec')) - -module.exports = WorkspaceElement = document.registerElement 'atom-workspace', prototype: WorkspaceElement.prototype