diff --git a/VersionDetemplater.moon b/VersionDetemplater.moon index bb18305..3c4a175 100644 --- a/VersionDetemplater.moon +++ b/VersionDetemplater.moon @@ -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' diff --git a/src/LineCollection.moon b/src/LineCollection.moon index ec030df..35bc138 100644 --- a/src/LineCollection.moon +++ b/src/LineCollection.moon @@ -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! @@ -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 @@ -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!