mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Internalize a bunch of methods
This commit is contained in:
@@ -5,6 +5,7 @@ _ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class CursorView extends View
|
||||
# Internal:
|
||||
@content: ->
|
||||
@pre class: 'cursor idle', => @raw ' '
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class DisplayBufferMarker
|
||||
tailScreenPosition: null
|
||||
valid: true
|
||||
|
||||
# Internal:
|
||||
constructor: ({@id, @displayBuffer}) ->
|
||||
@buffer = @displayBuffer.buffer
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class DisplayBuffer
|
||||
foldsById: null
|
||||
markers: null
|
||||
|
||||
# Internal:
|
||||
constructor: (@buffer, options={}) ->
|
||||
@id = @constructor.idCounter++
|
||||
@languageMode = options.languageMode
|
||||
|
||||
@@ -68,6 +68,8 @@ class EditSession
|
||||
|
||||
# Public: Retrieves the filename of the open file.
|
||||
#
|
||||
# This is `'untitled'` if the file is new and not saved to the disk.
|
||||
#
|
||||
# Returns a {String}.
|
||||
getTitle: ->
|
||||
if path = @getPath()
|
||||
|
||||
@@ -5,6 +5,8 @@ _ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class Gutter extends View
|
||||
|
||||
# Internal:
|
||||
@content: ->
|
||||
@div class: 'gutter', =>
|
||||
@div outlet: 'lineNumbers', class: 'line-numbers'
|
||||
@@ -22,9 +24,13 @@ class Gutter extends View
|
||||
@getEditor().on 'selection:changed', highlightLines
|
||||
@on 'mousedown', (e) => @handleMouseEvents(e)
|
||||
|
||||
# Public: Retrieves the containing {Editor}.
|
||||
#
|
||||
# Returns an {Editor}.
|
||||
getEditor: ->
|
||||
@parentView
|
||||
|
||||
# Internal:
|
||||
beforeRemove: ->
|
||||
$(document).off(".gutter-#{@getEditor().id}")
|
||||
|
||||
|
||||
@@ -5,6 +5,11 @@ module.exports=
|
||||
class ImageEditSession
|
||||
registerDeserializer(this)
|
||||
|
||||
# Public: Identifies if a path can be opened by the image viewer.
|
||||
#
|
||||
# path - The {String} name of the path to check
|
||||
#
|
||||
# Returns a {Boolean}.
|
||||
@canOpen: (path) ->
|
||||
_.indexOf([
|
||||
'.gif'
|
||||
@@ -23,13 +28,20 @@ class ImageEditSession
|
||||
# Internal: Establishes a new image viewer.
|
||||
constructor: (@path) ->
|
||||
|
||||
# Internal:
|
||||
serialize: ->
|
||||
deserializer: 'ImageEditSession'
|
||||
path: @path
|
||||
|
||||
# Internal:
|
||||
getViewClass: ->
|
||||
require 'image-view'
|
||||
|
||||
# Public: Retrieves the filename of the open file.
|
||||
#
|
||||
# This is `'untitled'` if the file is new and not saved to the disk.
|
||||
#
|
||||
# Returns a {String}.
|
||||
getTitle: ->
|
||||
if path = @getPath()
|
||||
fsUtils.base(path)
|
||||
|
||||
@@ -4,10 +4,13 @@ $ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class ImageView extends ScrollView
|
||||
|
||||
# Internal:
|
||||
@content: ->
|
||||
@div class: 'image-view', tabindex: -1, =>
|
||||
@img outlet: 'image'
|
||||
|
||||
# Internal:
|
||||
initialize: (imageEditSession) ->
|
||||
super
|
||||
|
||||
|
||||
@@ -4,9 +4,12 @@ PaneAxis = require 'pane-axis'
|
||||
|
||||
module.exports =
|
||||
class PaneColumn extends PaneAxis
|
||||
|
||||
# Internal:
|
||||
@content: ->
|
||||
@div class: 'column'
|
||||
|
||||
# Internal:
|
||||
className: ->
|
||||
"PaneColumn"
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ class PaneContainer extends View
|
||||
container.removeEmptyPanes()
|
||||
container
|
||||
|
||||
# Internal: The DOM of the pane container.
|
||||
@content: ->
|
||||
@div id: 'panes'
|
||||
|
||||
# Internal:
|
||||
initialize: ->
|
||||
@destroyedItemStates = []
|
||||
|
||||
# Internal:
|
||||
serialize: ->
|
||||
deserializer: 'PaneContainer'
|
||||
root: @getRoot()?.serialize()
|
||||
|
||||
@@ -6,10 +6,13 @@ PaneColumn = require 'pane-column'
|
||||
|
||||
module.exports =
|
||||
class Pane extends View
|
||||
|
||||
# Internal: Defines the pane's DOM.
|
||||
@content: (wrappedView) ->
|
||||
@div class: 'pane', =>
|
||||
@div class: 'item-views', outlet: 'itemViews'
|
||||
|
||||
# Internal:
|
||||
@deserialize: ({items, focused, activeItemUri}) ->
|
||||
deserializedItems = _.compact(items.map((item) -> deserialize(item)))
|
||||
pane = new Pane(deserializedItems...)
|
||||
|
||||
@@ -98,6 +98,15 @@ class Range
|
||||
add: (point) ->
|
||||
new Range(@start.add(point), @end.add(point))
|
||||
|
||||
# Public: Moves a `Range`.
|
||||
#
|
||||
# In other words, the starting and ending `row` values, and the starting and ending
|
||||
# `column` values, are added to each other.
|
||||
#
|
||||
# startPoint - The {Point} to move the `Range`s `start` by
|
||||
# endPoint - The {Point} to move the `Range`s `end` by
|
||||
#
|
||||
# Returns the new {Range}.
|
||||
translate: (startPoint, endPoint=startPoint) ->
|
||||
new Range(@start.translate(startPoint), @end.translate(endPoint))
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ fuzzyFilter = require 'fuzzy-filter'
|
||||
|
||||
module.exports =
|
||||
class SelectList extends View
|
||||
|
||||
# Internal: Establishes the DOM for the selection list.
|
||||
@content: ->
|
||||
@div class: @viewClass(), =>
|
||||
@subview 'miniEditor', new Editor(mini: true)
|
||||
|
||||
@@ -4,6 +4,8 @@ Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
class SelectionView extends View
|
||||
|
||||
# Internal: Establishes the DOM for the selection view.
|
||||
@content: ->
|
||||
@div class: 'selection'
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports =
|
||||
class Syntax
|
||||
registerDeserializer(this)
|
||||
|
||||
# Internal:
|
||||
@deserialize: ({grammarOverridesByPath}) ->
|
||||
syntax = new Syntax()
|
||||
syntax.grammarOverridesByPath = grammarOverridesByPath
|
||||
|
||||
@@ -156,6 +156,7 @@ class TokenizedBuffer
|
||||
token = @screenLines[position.row].tokenAtBufferColumn(position.column)
|
||||
token.scopes
|
||||
|
||||
# Internal:
|
||||
destroy: ->
|
||||
@buffer.off ".tokenized-buffer#{@id}"
|
||||
|
||||
@@ -219,14 +220,19 @@ class TokenizedBuffer
|
||||
stop()
|
||||
position
|
||||
|
||||
# Public: Gets the row number of the last line.
|
||||
#
|
||||
# Returns a {Number}.
|
||||
getLastRow: ->
|
||||
@buffer.getLastRow()
|
||||
|
||||
# Internal:
|
||||
logLines: (start=0, end=@buffer.getLastRow()) ->
|
||||
for row in [start..end]
|
||||
line = @lineForScreenRow(row).text
|
||||
console.log row, line, line.length
|
||||
|
||||
# Internal:
|
||||
getDebugSnapshot: ->
|
||||
lines = ["Tokenized Buffer:"]
|
||||
for screenLine, row in @linesForScreenRows(0, @getLastRow())
|
||||
|
||||
@@ -7,6 +7,7 @@ class UndoManager
|
||||
redoHistory: null
|
||||
currentTransaction: null
|
||||
|
||||
# Internal:
|
||||
constructor: ->
|
||||
@clear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user