Skip to content

Commit

Permalink
LineCollection: add convenience initializer for choosing from all lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
torque committed Mar 22, 2016
1 parent 2b75c88 commit 74a8f84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VersionDetemplater.moon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ versions = {
'src/DataHandler': '1.0.5'
'src/DataWrapper': '1.0.2'
'src/Line': '1.5.2'
'src/LineCollection': '1.1.4'
'src/LineCollection': '1.2.0'
'src/Log': '1.0.0'
'src/Math': '1.0.0'
'src/MotionHandler': '1.1.7'
Expand Down
14 changes: 10 additions & 4 deletions src/LineCollection.moon
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ frameFromMs = aegisub.frame_from_ms
class LineCollection
@version: version

new: ( @sub, sel, validationCb, selectLines=true ) =>
@fromAllLines: ( sub, validationCb, selectLines ) =>
sel = { }
for i = 1, #@sub
table.insert( sel, i ) if @sub[i].class == "dialogue"
@ sub, sel, validationCb, selectLines

new: ( @sub, sel, validationCb, selectLines = true ) =>
@lines = { }
if sel and #sel > 0
if type( sel ) == "table" and #sel > 0
@collectLines sel, validationCb, selectLines
if frameFromMs 0
@getFrameInfo!
Expand All @@ -43,7 +49,7 @@ class LineCollection

-- This method should update various properties such as
-- (start|end)(Time|Frame).
addLine: ( line, validationCb = (-> return true), selectLine=true, index=false ) =>
addLine: ( line, validationCb = (-> return true), selectLine = true, index = false ) =>
if validationCb line
line.parentCollection = @
line.inserted = false
Expand Down Expand Up @@ -95,7 +101,7 @@ class LineCollection

@hasMetaStyles = true

collectLines: ( sel, validationCb = ( ( line ) -> return not line.comment), selectLines=true ) =>
collectLines: ( sel, validationCb = (( line ) -> return not line.comment), selectLines = true ) =>
unless @hasMetaStyles
@generateMetaAndStyles!

Expand Down

0 comments on commit 74a8f84

Please sign in to comment.