From 24d3f1daeb0c2d332bd24f768351973ae2b8e317 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 13 Dec 2013 09:50:57 -0800 Subject: [PATCH] Reduce diff size by restoring old method order where possible --- src/atom.coffee | 192 ++++++++++++++++++++++++------------------------ 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 3c99098a6..c1f1e80e0 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -165,101 +165,10 @@ class Atom extends Model @windowEventHandler = new WindowEventHandler - # Deprecated: Just access the loadSettings property directly. Eventually I want - # both to go away and just store the relevant info on the atom global itself. - getLoadSettings: -> - @loadSettings - - # Private: Call this method when establishing a real application window. - startEditorWindow: -> - if process.platform is 'darwin' - CommandInstaller = require './command-installer' - CommandInstaller.installAtomCommand() - CommandInstaller.installApmCommand() - - @restoreWindowDimensions() - @config.load() - @config.setDefaults('core', require('./workspace-view').configDefaults) - @config.setDefaults('editor', require('./editor-view').configDefaults) - @keymap.loadBundledKeymaps() - @themes.loadBaseStylesheets() - @packages.loadPackages() - @deserializeEditorWindow() - @packages.activate() - @keymap.loadUserKeymap() - @requireUserInitScript() - @menu.update() - - $(window).on 'unload', => - $(document.body).css('visibility', 'hidden') - @unloadEditorWindow() - false - - @displayWindow() - - # Private: - saveSync: -> - if statePath = @constructor.getStatePath(@mode) - super(statePath) - else - @getCurrentWindow().loadSettings.windowState = JSON.stringify(@serializeForPersistence()) - # Private: setBodyPlatformClass: -> document.body.classList.add("platform-#{process.platform}") - # Private: - deserializeProject: -> - Project = require './project' - @project ?= new Project(path: @loadSettings.initialPath) - - # Private: - deserializeWorkspaceView: -> - WorkspaceView = require './workspace-view' - @workspaceView = @deserializers.deserialize(@state.get('workspaceView')) - unless @workspaceView? - @workspaceView = new WorkspaceView() - @state.set('workspaceView', @workspaceView.getState()) - $(@workspaceViewParentSelector).append(@workspaceView) - - # Private: - deserializePackageStates: -> - @packages.packageStates = @state.getObject('packageStates') ? {} - @state.remove('packageStates') - - # Private: - deserializeEditorWindow: -> - @deserializePackageStates() - @deserializeProject() - @deserializeWorkspaceView() - - # Private: - unloadEditorWindow: -> - return if not @project and not @workspaceView - - @state.set('syntax', @syntax.serialize()) - @state.set('workspaceView', @workspaceView.serialize()) - @packages.deactivatePackages() - @state.set('packageStates', @packages.packageStates) - @saveSync() - @workspaceView.remove() - @workspaceView = null - @project.destroy() - @windowEventHandler?.unsubscribe() - @windowState = null - - # Private: - loadThemes: -> - @themes.load() - - # Private: - watchThemes: -> - @themes.on 'reloaded', => - # Only reload stylesheets from non-theme packages - for pack in @packages.getActivePackages() when pack.getType() isnt 'theme' - pack.reloadStylesheets?() - null - # Public: getCurrentWindow: -> @constructor.getCurrentWindow() @@ -293,10 +202,6 @@ class Atom extends Model else browserWindow.center() - # Private: - storeWindowDimensions: -> - @state.set('windowDimensions', @getWindowDimensions()) - # Private: restoreWindowDimensions: -> windowDimensions = @state.getObject('windowDimensions') ? {} @@ -305,6 +210,94 @@ class Atom extends Model windowDimensions.width ?= initialSize?.width ? Math.min(global.screen.availWidth, 1024) @setWindowDimensions(windowDimensions) + # Private: + storeWindowDimensions: -> + @state.set('windowDimensions', @getWindowDimensions()) + + # Deprecated: Just access the loadSettings property directly. Eventually I want + # both to go away and just store the relevant info on the atom global itself. + getLoadSettings: -> + @loadSettings + + # Private: + deserializeProject: -> + Project = require './project' + @project ?= new Project(path: @loadSettings.initialPath) + + # Private: + deserializeWorkspaceView: -> + WorkspaceView = require './workspace-view' + @workspaceView = @deserializers.deserialize(@state.get('workspaceView')) + unless @workspaceView? + @workspaceView = new WorkspaceView() + @state.set('workspaceView', @workspaceView.getState()) + $(@workspaceViewParentSelector).append(@workspaceView) + + # Private: + deserializePackageStates: -> + @packages.packageStates = @state.getObject('packageStates') ? {} + @state.remove('packageStates') + + # Private: + deserializeEditorWindow: -> + @deserializePackageStates() + @deserializeProject() + @deserializeWorkspaceView() + + # Private: Call this method when establishing a real application window. + startEditorWindow: -> + if process.platform is 'darwin' + CommandInstaller = require './command-installer' + CommandInstaller.installAtomCommand() + CommandInstaller.installApmCommand() + + @restoreWindowDimensions() + @config.load() + @config.setDefaults('core', require('./workspace-view').configDefaults) + @config.setDefaults('editor', require('./editor-view').configDefaults) + @keymap.loadBundledKeymaps() + @themes.loadBaseStylesheets() + @packages.loadPackages() + @deserializeEditorWindow() + @packages.activate() + @keymap.loadUserKeymap() + @requireUserInitScript() + @menu.update() + + $(window).on 'unload', => + $(document.body).css('visibility', 'hidden') + @unloadEditorWindow() + false + + @displayWindow() + + # Private: + unloadEditorWindow: -> + return if not @project and not @workspaceView + + @state.set('syntax', @syntax.serialize()) + @state.set('workspaceView', @workspaceView.serialize()) + @packages.deactivatePackages() + @state.set('packageStates', @packages.packageStates) + @saveSync() + @workspaceView.remove() + @workspaceView = null + @project.destroy() + @windowEventHandler?.unsubscribe() + @windowState = null + + # Private: + loadThemes: -> + @themes.load() + + # Private: + watchThemes: -> + @themes.on 'reloaded', => + # Only reload stylesheets from non-theme packages + for pack in @packages.getActivePackages() when pack.getType() isnt 'theme' + pack.reloadStylesheets?() + null + # Public: Open a new Atom window using the given options. # # Calling this method without an options parameter will open a prompt to pick @@ -450,7 +443,14 @@ class Atom extends Model # Returns the absolute path to ~/.atom getConfigDirPath: -> @constructor.getConfigDirPath() - @configDirPath ?= fs.absolute('~/.atom') + + # Private: + saveSync: -> + if statePath = @constructor.getStatePath(@mode) + super(statePath) + else + @getCurrentWindow().loadSettings.windowState = JSON.stringify(@serializeForPersistence()) + # Public: Get the time taken to completely load the current window. #