-- ConnectBarLines2 - derived from Lloyd's ConnectBarLines -- Version 0.1 --[[-------------------------------------------------------------------------- This plugin will connect barlines with the staff below. You must specify if the current staff is Upper, Middle or Lower staff in order to draw connections correctly. --]]-------------------------------------------------------------------------- local userObjTypeName = ... local nextBar = nwc.drawpos.new() local afterBar = nwc.drawpos.new() local drawpos = nwcdraw.user local object_spec = { { id='System', label='Staff Location', type='enum', default='Top Staff', list={'Top Staff', 'Middle Staff', 'Bottom Staff'}}, } local function do_create(t) t.Class = 'StaffSig' end local function do_draw(t) local w = nwc.toolbox.drawStaffSigLabel('BarLines') if not nwcdraw.isDrawing() then return w end if drawpos:isHidden() then return end local yPosTop = nwcdraw.getStaffProp('BoundaryTop') local yPosBottom = nwcdraw.getStaffProp('BoundaryBottom') local found = nextBar:find('last', 'bar') found = nextBar:find('next', 'bar') if found then local x,y = nextBar:xyAnchor() local barType = nextBar:objProp('Style') if t.System == 'Top Staff' then nwcdraw.moveTo(x,y) nwcdraw.barSegment(barType,y-4,y-yPosBottom) elseif t.System == 'Middle Staff' then nwcdraw.moveTo(x,y) nwcdraw.barSegment(barType,y+4,y+yPosTop) nwcdraw.moveTo(x,y) nwcdraw.barSegment(barType,y-4,y-yPosBottom) elseif t.System == 'Bottom Staff' then nwcdraw.moveTo(x,y) nwcdraw.barSegment(barType,y+4,y+yPosTop) end end end return { spec = object_spec, create = do_create, width = do_draw, draw = do_draw, }