section window int width 241 int height 233 import foo_looks_common.ski section globals bool enabled false string image "hand_orb.png" string fontname "tahoma" list rendermap int { render.text render.border } list statemap states.None //int borderwidth 1 //list bordercolor int { 255 255 0 0 } sprite background list statemap states.None list rect int { 0 0 241 233 } list srcoff int { 9 5 } list rendermap int { render.Erase render.Image render.Text} list scripts string { "draglook" } sprite artist list fontcolor int { 255 0 0 0 } list rect int { 25 50 140 20 } int fontsize 10 int trimming trimming.ellipsisPath string fspec "$if(%artist%,%artist%,$directory(%_path%,2))" sprite title string include artist int valign align.near list rect int { 20 69 150 80 } int trimming trimming.ellipsisPath string fspec "$if(%title%,%title%,%_filename%)" sprite overlay int layer 1 list srcoff int { 323 227 } list rect int { 27 20 165 109 } list rendermap int { render.image } sprite mask int layer 2 list srcoff int { 20 248 } list rect int { 8 8 176 175 } list rendermap int { render.image } sprite spectrum int layer 1 list srcoff int { 245 277 } list rect int { 41 113 112 56 } list lowcolor int { 200 50 50 100 } list highcolor int { 255 200 200 200 } list fillcolor int { 150 150 150 150 } int bands 16 int ticks 12 list statemap states.None list rendermap int { render.border } sprite knobbg string image "dial_new.png" list rect int { 169 134 60 60 } list rendermap int { render.image } list srcoff int { 100 0 } list statemap states.None sprite knob bool enabled true string image "dial_new.png" list rect int { 172 139 50 50 } list rendermap int { render.image } list srcoff int { 0 0 } list statemap states.None list scripts string { "knobControl[steps=30 sensitivity=3 onstate=true]" } lua knobControl onstate, moving = false steps, relativeStep = 0 currentStep = 0 offsetY = 0 minY, maxY = 0 sensitivity = 0 function constrain(tempInt,min,max) if (tempInt > max) then tempInt = max end if (tempInt < min) then tempInt = min end return tempInt end function stopMoving(this) moving = false currentStep = currentStep + relativeStep if (onstate == true) then look_setSrcX(this,0) end end function onleftbuttondown(this) moving = true local rect = look_getRect(this) offsetY = look_mouseY() - rect.y if (onstate == true) then look_setSrcX(this,rect.width) end end function onattach(this) local rect = look_getRect(this) local initSrcY = currentStep * rect.height look_setSrcY(this,initSrcY) minY = -steps maxY = steps - 1 end function onleftbuttonup(this) stopMoving(this) end function onleftbuttonupoutside(this) stopMoving(this) end function onupdate(this) if (moving == true) then local rect = look_getRect(this) relativeStep = -(ceil((look_mouseY() - offsetY - rect.y) / sensitivity)) currentStep = constrain(currentStep,0,maxY) relativeStep = constrain(relativeStep,minY,maxY) local newSrcY = constrain((currentStep + relativeStep),0,maxY) * rect.height look_setSrcY(this,newSrcY) end end endlua