-- GlobModParms.og -- Version 1.1 --[[---------------------------------------------------------------- This script is only used for drawing the 'GlobModParms.og' user object. You shouldn't create one via 'Insert/User Object...' Creation is done by the user tool 'GlobMod.og' : after specifying the parameters for a global modification, you have the possibility to store them in a user object. The same user tool can then be used to process the user object, avoiding the need to enter again the parameters. The description text can be moved up or down with the + and - key. Please press the 'Cancel' button to exit. --]]---------------------------------------------------------------- local userObjTypeName = ... local obj_spec = { {id='Creator',type='text',default='GlobModParms.og'}, {id='Description',label='Description', type='text', default=' '}, {id='Type',label='Type', type='text', default=' '}, {id='SubType',label='SubType', type='text', default=nil}, {id='Condition1',label='Condition 1',type='text', default=' '}, {id='Condition2',abel='Condition 2',type='text', default=' '}, {id='Condition3',label='Condition 3',type='text', default=' '}, {id='Condition4',label='Condition 4',type='text', default=' '}, {id='Condition5',label='Condition 5',type='text', default=' '}, {id='Condition6',label='Condition 6',type='text', default=' '}, {id='Action',label='Action',tyoe='text',default=' '}, {id='Modification1',label='Modification 1',type='text', default=' '}, {id='Modification2',label='Modification 2',type='text', default=' '}, {id='Modification3',label='Modification 3',type='text', default=' '}, {id='Modification4',label='Modification 4',type='text', default=' '}, {id='Modification5',label='Modification 5',type='text', default=' '}, {id='Modification6',label='Modification 6',type='text', default=' '}, } -------------------------------------------------------------------- local function do_spin(t,d) t.despos = t.despos or 1 t.despos = math.max(t.despos + d, 1) t.despos = math.min(t.despos, 20) end--do_spin local drawpos = nwcdraw.user local dr = nwcdraw local objidx = nwc.ntnidx local function do_draw(t) if t.Visible == 'N' then return end--if local w, h, width local showInTargets = {edit=1,selector=1} -- local media = nwcdraw.getTarget() if showInTargets[media] and not dr.isAutoInsert() then local txt1 = 'GlobModParms ' local txt2 = t.Description dr.setFont('Tahoma',4,'r') local xyar = dr.getAspectRatio() local h1,w1 = dr.calcTextSize(txt1) local w2,h2 = dr.calcTextSize(txt2) local hd = t.despos or 1 w1 = w1 or 0 w2 = w2 or 0 h1 = h1 or 0 h2 = h2 or 0 w = w1 / xyar h = h1*xyar if not dr.isDrawing() then return w end local rx,ry = 0.5 * w, 0.5 * h + w/2 dr.moveTo(-rx,0) dr.beginPath() dr.roundRect(rx,ry,0.1 * w1) dr.endPath('stroke') dr.setPen('solid', 150) dr.alignText("bottom","center") dr.moveTo(0,0) dr.text(txt1,90) rx, ry = -w1/2, w1 + 3*h2/2 + 2 + hd, dr.alignText("bottom","left") dr.moveTo(rx,ry) dr.text(txt2) end--if return w end ------------------------------------------------------------------- -- all object plug-ins must return the methods that they support in a -- standard method table return { spec = obj_spec, draw = do_draw, width = do_draw, spin = do_spin }