Lines Matching defs:grid

4 //grid.js-module to insert a chord grid before or after a tune
5 abc2svg.grid={pl:'<path class="stroke" stroke-width="1" d="M',block_gen:function(of,s){if(s.subtype!="grid"){of(s)
7 var abc=this,img,cls,cfmt=abc.cfmt(),grid=cfmt.grid
8 function build_grid(chords,bars,font,wmx){var i,k,l,nr,bar,w,hr,x0,x,y,yl,lc='',cells=[],nc=grid.n
23 function build_cell(cell,x,y,yl,hr){if(cell.length>1){abc.out_svg(abc2svg.grid.pl)
27 if(cell[1]){abc.out_svg(abc2svg.grid.pl)
35 if(cell.length>=3){if(cell[3]){abc.out_svg(abc2svg.grid.pl)
42 abc.xy_str(x+wmx*.2,y-hr/4,cell[2])}}}else{abc.set_font('grid')
45 if(!grid.ls){cells=chords}else{bar=bars;bars=[]
46 for(i=0;i<grid.ls.length;i++){l=grid.ls[i]
69 for(i=0;i<cells.length;i++){if(i==0||(grid.repbrk&&(bars[i].slice(-1)==':'||bars[i][0]==':'))||k>=nc){y-=hr
96 if(i==0||(grid.repbrk&&(bars[i].slice(-1)==':'||bars[i][0]==':'))||k>=nc){y-=hr;x=x0
109 font=abc.get_font('grid')
125 abc.blk_flush()},output_music:function(of){var C=abc2svg.C,abc=this,tsfirst=abc.get_tsfirst(),voice_tb=abc.get_voice_tb(),grid=abc.cfmt().grid
146 case C.BAR:bt=grid.norep?'|':s.bar_type
171 if(grid){var C=abc2svg.C,tsfirst=this.get_tsfirst(),voice_tb=this.get_voice_tb(),p_v=voice_tb[this.get_top_v()],s={type:C.BLOCK,subtype:'grid',dur:0,time:0,p_v:p_v,v:p_v.v,st:p_v.st}
173 if(!s.chords){}else if(grid.nomusic){this.set_tsfirst(s)}else if(grid.n<0){for(var s2=tsfirst;s2.ts_next;s2=s2.ts_next);s.time=s2.time
189 of()},set_fmt:function(of,cmd,parm){if(cmd=="grid"){if(!parm)
191 var grid={n:Number(parm.shift())}
192 if(isNaN(grid.n)){if(parm.length){this.syntax(1,this.errs.bad_val,"%%grid")
194 grid.n=1}
197 grid.norep=true
199 grid.nomusic=true
201 grid.repbrk=true
203 grid.ls=item.slice(8).split(',')}
204 this.cfmt().grid=grid
206 of(cmd,parm)},set_hooks:function(abc){abc.block_gen=abc2svg.grid.block_gen.bind(abc,abc.block_gen)
207 abc.output_music=abc2svg.grid.output_music.bind(abc,abc.output_music);abc.set_format=abc2svg.grid.set_fmt.bind(abc,abc.set_format)}}
208 abc2svg.modules.hooks.push(abc2svg.grid.set_hooks);abc2svg.modules.grid.loaded=true