mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Drop out a basic workspace model
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
ipc = require 'ipc'
|
||||
path = require 'path'
|
||||
Q = require 'q'
|
||||
{$, $$, View} = require './space-pen-extensions'
|
||||
_ = require 'underscore-plus'
|
||||
Delegator = require 'delegato'
|
||||
{$, $$, View} = require './space-pen-extensions'
|
||||
fs = require 'fs-plus'
|
||||
Serializable = require 'serializable'
|
||||
Workspace = require './workspace'
|
||||
EditorView = require './editor-view'
|
||||
PaneView = require './pane-view'
|
||||
PaneColumnView = require './pane-column-view'
|
||||
@@ -38,10 +40,16 @@ Editor = require './editor'
|
||||
#
|
||||
module.exports =
|
||||
class WorkspaceView extends View
|
||||
Serializable.includeInto(this)
|
||||
atom.deserializers.add(this, PaneView, PaneRowView, PaneColumnView, EditorView)
|
||||
Serializable.includeInto(this)
|
||||
Delegator.includeInto(this)
|
||||
|
||||
@version: 3
|
||||
@delegatesProperty 'fullScreen', toProperty: 'model'
|
||||
|
||||
@version: 4
|
||||
|
||||
@deserialize: (state) ->
|
||||
new this(Workspace.deserialize(state.model))
|
||||
|
||||
@configDefaults:
|
||||
ignoredNames: [".git", ".svn", ".DS_Store"]
|
||||
@@ -59,8 +67,10 @@ class WorkspaceView extends View
|
||||
@div class: 'panes', outlet: 'panes'
|
||||
|
||||
# Private:
|
||||
initialize: ({panes, @fullScreen}={}) ->
|
||||
panes ?= new PaneContainerView
|
||||
initialize: (@model) ->
|
||||
@model ?= new Workspace
|
||||
|
||||
panes = new PaneContainerView(@model.paneContainer)
|
||||
@panes.replaceWith(panes)
|
||||
@panes = panes
|
||||
|
||||
@@ -116,15 +126,9 @@ class WorkspaceView extends View
|
||||
@command 'core:save', => @saveActivePaneItem()
|
||||
@command 'core:save-as', => @saveActivePaneItemAs()
|
||||
|
||||
# Private:
|
||||
deserializeParams: (params) ->
|
||||
params.panes = atom.deserializers.deserialize(params.panes)
|
||||
params
|
||||
|
||||
# Private:
|
||||
serializeParams: ->
|
||||
panes: @panes.serialize()
|
||||
fullScreen: atom.isFullScreen()
|
||||
model: @model.serialize()
|
||||
|
||||
# Private:
|
||||
handleFocus: (e) ->
|
||||
|
||||
20
src/workspace.coffee
Normal file
20
src/workspace.coffee
Normal file
@@ -0,0 +1,20 @@
|
||||
{Model} = require 'theorist'
|
||||
Serializable = require 'serializable'
|
||||
PaneContainer = require './pane-container'
|
||||
|
||||
module.exports =
|
||||
class Workspace extends Model
|
||||
atom.deserializers.add(this)
|
||||
Serializable.includeInto(this)
|
||||
|
||||
@properties
|
||||
paneContainer: -> new PaneContainer
|
||||
fullScreen: false
|
||||
|
||||
deserializeParams: (params) ->
|
||||
params.paneContainer = PaneContainer.deserialize(params.paneContainer)
|
||||
params
|
||||
|
||||
serializeParams: ->
|
||||
paneContainer: @paneContainer.serialize()
|
||||
fullScreen: atom.isFullScreen()
|
||||
Reference in New Issue
Block a user