rm(workspace): Remove workspace, we don't need it.

This commit is contained in:
Ben Gotow 2015-03-05 18:49:10 -08:00
parent e5975b2acc
commit 3c35ef488b
4 changed files with 10 additions and 151 deletions

View file

@ -210,6 +210,10 @@ class Atom extends Model
@keymaps = new KeymapManager({configDirPath, resourcePath}) @keymaps = new KeymapManager({configDirPath, resourcePath})
@keymaps.subscribeToFileReadFailure() @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 @tooltips = new TooltipManager
@notifications = new NotificationManager @notifications = new NotificationManager
@commands = new CommandRegistry @commands = new CommandRegistry
@ -596,13 +600,6 @@ class Atom extends Model
@themes.loadBaseStylesheets() @themes.loadBaseStylesheets()
@keymaps.loadUserKeymap() @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 for pack in packages
@packages.loadPackage(pack) @packages.loadPackage(pack)
@packages.activate() @packages.activate()
@ -638,15 +635,12 @@ class Atom extends Model
ipc.send('show-secondary-window', options) ipc.send('show-secondary-window', options)
unloadEditorWindow: -> unloadEditorWindow: ->
@state.edgehillWorkspace = @workspace.serialize()
@packages.deactivatePackages() @packages.deactivatePackages()
@state.packageStates = @packages.packageStates @state.packageStates = @packages.packageStates
@saveSync() @saveSync()
@windowState = null @windowState = null
removeEditorWindow: -> removeEditorWindow: ->
@workspace?.destroy()
@workspace = null
@windowEventHandler?.unsubscribe() @windowEventHandler?.unsubscribe()
### ###
@ -727,11 +721,8 @@ class Atom extends Model
### ###
deserializeWorkspaceView: -> deserializeWorkspaceView: ->
# Put state back into store
startTime = Date.now() startTime = Date.now()
Workspace = require './workspace-edgehill' # Put state back into sheet-container? Restore app state here
#@workspace = Workspace.deserialize(@state.edgehillWorkspace) ? new Workspace
@workspace = new Workspace
@deserializeTimings.workspace = Date.now() - startTime @deserializeTimings.workspace = Date.now() - startTime
@item = document.createElement("atom-workspace") @item = document.createElement("atom-workspace")

View file

@ -30,7 +30,7 @@ class ThemeManager
stylesElement.onDidRemoveStyleElement @styleElementRemoved.bind(this) stylesElement.onDidRemoveStyleElement @styleElementRemoved.bind(this)
stylesElement.onDidUpdateStyleElement @styleElementUpdated.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') console.log('In Dev Mode - Watching /static for LESS changes')
watchStylesIn = (folder) => watchStylesIn = (folder) =>
stylePaths = fs.listTreeSync(folder) stylePaths = fs.listTreeSync(folder)
@ -370,13 +370,15 @@ class ThemeManager
isInitialLoadComplete: -> @initialLoadComplete isInitialLoadComplete: -> @initialLoadComplete
addActiveThemeClasses: -> addActiveThemeClasses: ->
workspaceElement = atom.views.getView(atom.workspace) workspaceElement = document.getElementsByTagName('atom-workspace')[0]
return unless workspaceElement
for pack in @getActiveThemes() for pack in @getActiveThemes()
workspaceElement.classList.add("theme-#{pack.name}") workspaceElement.classList.add("theme-#{pack.name}")
return return
removeActiveThemeClasses: -> removeActiveThemeClasses: ->
workspaceElement = atom.views.getView(atom.workspace) workspaceElement = document.getElementsByTagName('atom-workspace')[0]
return unless workspaceElement
for pack in @getActiveThemes() for pack in @getActiveThemes()
workspaceElement.classList.remove("theme-#{pack.name}") workspaceElement.classList.remove("theme-#{pack.name}")
return return

View file

@ -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) ->

View file

@ -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