  uses controls

  ===================
  class ControlPanelA
  ===================
  float  x,y,z
  int    id
  float  xx,yy,zz
  float  dx,dy,dz
  float  sc
  int    lock
  int    t1,t2
  int    f1,f2
  =================
  sliders      c[4]
  lightbuttons l[4]

  method act(optional int n)
  indexbase 1
  if id=0
    f1=0 'cube
    f2=0 'pent
    --------------------------------------------------------------------------
    'ctrl   x    y   z     sc    shm shb tex id  lk  lbl
    --------------------------------------------------------------------------
    c[1]=>-.40,-.00, .00,  0.10, f1, 00, t1, 10, 1, "slider"
    c[2]=>-.30,-.00, .00 , 0.10, f2, 00, t1, 20, 1, "slider"
    c[3]=>-.20,-.00, .00 , 0.10, f2, 00, t1, 30, 1, "slider"
    c[4]=>-.10,-.00, .00 , 0.10, f2, 00, t1, 40, 1, "slider"
    -------------------------------------------------------------------------
    l[1]=>-.40, .15, .00,  0.02, f1, 00, t1, 50, 1, "light button"
    l[2]=>-.30, .15, .00 , 0.02, f2, 00, t1, 60, 1, "light button"
    l[3]=>-.20, .15, .00 , 0.02, f2, 00, t1, 70, 1, "light button"
    l[4]=>-.10, .15, .00 , 0.02, f2, 00, t1, 80, 1, "light button"
    --------------------------------------------------------------------------
    id=1+n
    int i
    for i=1 to 4
      c[i].id+=n
      l[i].id+=n
    next
  end if
  '
  glpushmatrix
  gltranslatef  x,y,z
  '
  gltranslatef -.25,.0,-.0005
  if sc then glscalef sc,sc,1.0
  if pick
    PickLabel id
  else
    QuadShadow .20,.20,.005,.5
    glcolor3f     .60,.50,.60 'fix alpha bug
    glcolor4f     .60,.50,.60,0.50 'box
  endif
  QuadTex       .20,.20,.0.01
  gltranslatef  .25,.0,-.0
  '
  if bleft
    if picked=id
      if not lock
        drag(dx,dy,1.0/sc)
        x=xx+dx : y=yy+dy
      end if
    end if
  else
    xx=x : yy=y : zz=z 'ANCHOR
  end if
  '
  'render
  '
  int i,oi1,oi2
  for i=1 to 4
    c[i].act(sc,i,oi1)
    l[i].act(sc,i,oi2)
  next
  glpopmatrix
  '
  'show data
  '
  'glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  glPushMatrix
  glLoadIdentity
  if pick
    PickLabel 0
  endif
  gltranslatef -.5,.35,-1.0
  float w,h
  glscalef     .05,.05,.01
  GetWordArea  "Control:",w,h
  if pick
    PutBoxArea   w,h
  else
    glColor3f    .99,.99,.00
    gprint       "Control: "
    glColor3f    .99,.99,.99
    gprint    str(picked)
    if oi1+oi2
      gprint "   "
      if oi1 then gprint str((1.0+c[oi1].vy)*50 , 0)
      if oi2 then gprint str (l[oi2].lit)
    end if
  end if
  glPopMatrix
  end method
  '
  method destructor()
  ===================
  'del this.label
  'sliders      c[4]
  'lightbuttons l[4]
  int i
  for i=1 to 4
    c[i].destructor
  next
  for i=1 to 4
    l[i].destructor
  next
  end method
  '
  end class

'putfile "t.txt",recordof controlpanela
'#recordof sliders
'#recordof controlboxA '68/0x44

'#recordof ControlPanelA



  ===================
  class ControlPanelB
  ===================
  has AdjustableControl
  lightbuttons l[12]
  sliders      c[8]
  joysticks    j[1]
  knobs        k[3]

  method act(optional int n)
  indexbase 1
  static int t1,t2,t3,t4
  static int f1,f2,f3,f4
  int i,oi1,oi2,oi3,oi4
  string lbl
  if id=0
    f1=0
    if not f2 then f2=MakePolygon 0,32,2
    if not f3 then f3=MakePolygon 22.5,8,2
    if not f4 then f4=MakePolygon 90,3,2
    ---------------------------------------------------------------------------
    'ctrl    x    y   z     sc    shm shb tex id  lk, lb
    ---------------------------------------------------------------------------
    c[1] => .00,-.00, .00,  0.10, f1, 00, t1, 110, 1, "Slider A"
    c[2] => .10,-.00, .00 , 0.10, f1, 00, t1, 120, 1, "Slider B"
    c[3] => .20,-.00, .00 , 0.10, f1, 00, t1, 130, 1, "Slider C"
    c[4] => .30,-.00, .00 , 0.10, f1, 00, t1, 140, 1, "Slider D"
    ---------------------------------------------------------------------------
    c[5] => .40,-.00, .00,  0.10, f3, 00, t1, 150, 1, "x rotate"
    c[6] => .50,-.00, .00 , 0.10, f3, 00, t1, 160, 1, "y rotate"
    c[7] => .60,-.00, .00 , 0.10, f3, 00, t1, 170, 1, "z rotate"
    c[8] => .70,-.00, .00 , 0.10, f3, 00, t1, 180, 1, "Lift"
    ---------------------------------------------------------------------------
    l[1] => .00, .15, .00,  0.02, f3, 00, t1, 210, 1, "Light Button A"
    l[2] => .10, .15, .00 , 0.02, f1, 00, t1, 220, 1, "Light Button B"
    l[3] => .20, .15, .00 , 0.02, f4, 00, t1, 230, 1, "Light Button C"
    l[4] => .30, .15, .00 , 0.02, f3, 00, t1, 240, 1, "Light Button D"
    ---------------------------------------------------------------------------
    l[5] => .40, .15, .00,  0.02, f3, 00, t1, 250, 1, "Light Button E"
    l[6] => .50, .15, .00 , 0.02, f1, 00, t1, 260, 1, "Light Button F"
    l[7] => .60, .15, .00 , 0.02, f4, 00, t1, 270, 1, "Light Button G"
    l[8] => .70, .15, .00 , 0.02, f3, 00, t1, 280, 1, "Light Button H"
    ---------------------------------------------------------------------------
    j[1] => .90,-.00, .00,  0.10, f2, 00, t1, 310, 1, "xz Joystick"
    ---------------------------------------------------------------------------
    k[1] =>-.10, .10, .00,  0.15, f2, 00, t1, 410, 1, "Knob A"
    k[2] =>-.10,-.00, .00,  0.15, f2, 00, t1, 420, 1, "Knob B"
    k[3] =>-.10,-.10, .00,  0.15, f2, 00, t1, 430, 1, "Knob C"
    ---------------------------------------------------------------------------
    l[9] => .85,-.15, .00,  0.020,f4, 00, t1, 510, 1, "joystick reset x"
    l[10]=> .90,-.15, .00,  0.025,f4, 00, t1, 520, 1, "joystick reset xy"
    l[11]=> .95,-.15, .00,  0.020,f4, 00, t1, 530, 1, "joystick reset y"
    l[12]=> .70,-.15, .00,  0.020,f4, 00, t1, 540, 1, "Slider reset y"
    ---------------------------------------------------------------------------
    id=n+1000
    if sc=0.0 then sc=1.0
    this.label="ControlBoxB"
  end if 'init
  '
  glDisable GL_LIGHTING
  glDisable GL_TEXTURE_2D
  glpushmatrix
  gltranslatef  x,y,z-.0005
  glScalef      sc,sc,1.0
  if pick
    PickLabel     id
  else
    QuadShadow    .60,.20,.005,.5
    glcolor3f     .60,.50,.60 'fix alpha bug
    glcolor4f     .60,.50,.60,0.50 'box
  endif
  QuadTex       .60,.20,.0
  gltranslatef -.45,.0,-.0
  '
  if bleft
    if picked=id
      if not lock
        drag(dx,dy,1.2)
        x=xx+dx : y=yy+dy
      end if
    end if
    select picked
    'RESET JOYSICK X Y POSITIONS
    case 511 : l[09].lit={1,0} : j[1].vx=0.0
    case 521 : l[10].lit={1,0} : j[1].vx={0.0,0.0}
    case 531 : l[11].lit={1,0} : j[1].vy=0.0
    case 541 : l[12].lit={1,0} : c[8].vy=0.0
    end select
  else
    xx=x : yy=y : zz=z 'ANCHOR
  end if
  '
  'render
  '
  int i
  for i=1 to 8
    c[i].act(sc,i,oi1)
  next
  for i=1 to 12
    l[i].act(sc,i,oi2)
  next
  for i=1 to 1
    j[i].act(sc,i,oi3)
  next
  for i=1 to 3
    k[i].act(sc,i,oi4)
  next
  lbl=""
  if picked=id then lbl=this.label
  if oi1 then lbl=c[oi1].label
  if oi2 then lbl=l[oi2].label
  if oi3 then lbl=j[oi3].label
  if oi4 then lbl=k[oi4].label
  '
  '
  'show data
  '
  glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  if pick
    PickLabel    0
  endif
  if bleft
    gltranslatef -.1,0.-0.18,0.0004
    float w,h
    glscalef     .05,.05,.01
    GetWordArea  "Control:",w,h
    if pick
      PutBoxArea   w,h
    else
      glColor3f    .99,.99,.99
      'if picked then gprint    str(picked+id)
      if picked then gprint    lbl
      if oi1+oi2+oi3+oi4
        'float cm=100.0,cn=50.0
        if oi1 then gprint "   " str(c[oi1].vy,2)
        if oi2 then gprint "   " str(l[oi2].lit,2)
        if oi3 then gprint "   " str(j[oi3].vx, 2) "  " str(j[oi3].vy ,2)
        if oi4 then gprint "   " str(k[oi4].vy, 2)
      end if
    end if
  end if
  glPopMatrix
  end method
  '
  method destructor()
  ===================
  del this.label
  int i
  for i=1 to 8
    c[i].destructor
  next
  for i=1 to 12
    l[i].destructor
  next
  for i=1 to 1
    j[i].destructor
  next
  for i=1 to 3
    k[i].destructor
  next
  end method
  '
  end class



  ===================
  class ControlPanelC
  ===================
  has AdjustableControl
  knobs        k[45]
  lightbuttons l[16]
  joysticks    j[1]

  method act(optional int n)
  indexbase 1
  static int t1,t2,t3,t4
  static int f1,f2,f3,f4
  int i,oi1,oi2,oi3,oi4,a
  static string lbl
  if id=0
    f1=0
    if not f2 then f2=MakePolygon 0,32,2
    if not f3 then f3=MakePolygon 22.5,8,2
    if not f4 then f4=MakePolygon 90,3,2
    scope
    int i,j,n,id
    float r,g,b,a,x,y,z
    float q3=.75
    y=.40
    id=100
    for i=1 to 9
      if i=9 then y-=.05
      x=0.10
      for j=1 to 5
        ---------------------------------------------------------------------------
        'ctrl    x    y   z     sc    shm shb tex id  lk, lb,               r,g,b,a
        ---------------------------------------------------------------------------
        n++
        id+=10
        r=0 : g=0 : b=0
        a=0 'for default knob color
        select j
        case 1 : r=1 : a=1
        case 2 : g=1 : a=1
        case 3 : b=1 : a=1
        case 5 : r=q3 : g=q3 : b=q3 : a=1
        end select
        k[n].label=""'+str(i)+str(j)
        k[n] =>  x,   y, .00,  0.15, f2, 00, t1,  id, 1
        k[n].r => r,g,b,a
        x+=.1
      next
      id+=10
      lbl="" 'str(i)
      l[ i].label=lbl
      l[ i] => .60,   y, .00,  .016, f1, 00, t1,  id, 1
      y-=.1
    next
    end scope
    id=n+1000
    if sc=0.0 then sc=1.0
    this.label="ControlBoxB"
  end if 'init
  '
  glDisable GL_LIGHTING
  glDisable GL_TEXTURE_2D
  '
  glpushmatrix
  gltranslatef  x,y+.2,z
  glScalef      sc,sc,1.0
  gltranslatef  0.,-.25,-.0005
  QuadShadow    .35,.45,.0005,.5
  glcolor3f     .60,.50,.60 'fix alpha bug
  glcolor4f     .70,.70,.50,0.20 'box
  if pick
    PickLabel   id
  endif
  QuadTex       .35,.50,.0
  gltranslatef -.35,-.05,-.0
  '
  if bleft
    if picked=id
      if not lock
        drag(dx,dy,1.2)
        x=xx+dx : y=yy+dy
      end if
    end if
  else
    xx=x : yy=y : zz=z 'ANCHOR
  end if
  '
  'render
  '
  int i
  for i=1 to 45
    k[i].act(sc,i,oi1)
  next
  for i=1 to 9
    l[i].act(sc,i,oi2)
  next
  'for i=1 to 1
  '  j[i].act(sc,i,oi3)
  'next
  '
  'lbl=""
  'if picked=id then lbl=this.label
  'if oi1 then lbl=k[oi1].label
  'if oi2 then lbl=l[oi2].label
  'if oi3 then lbl=j[oi3].label
  '
  'show data
  '
  glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  if pick
    PickLabel 0
  endif
/*
  if bleft
    gltranslatef -.1,0.-0.18,0.0004
    float w,h
    glscalef     .05,.05,.01
    GetWordArea  "Control:",w,h
    if pick
      PutBoxArea   w,h
    else
      glColor3f    .99,.99,.99
      'if picked then gprint    str(picked+id)
      if picked then gprint    lbl
      if oi1+oi2+oi3+oi4
        'float cm=100.0,cn=50.0
        'if oi1 then gprint "   " str(c[oi1].vy,2)
        if oi2 then gprint "   " str(l[oi2].lit,2)
        if oi3 then gprint "   " str(j[oi3].vx, 2) "  " str(j[oi3].vy ,2)
        if oi4 then gprint "   " str(k[oi4].vy, 2)
      end if
    end if
  end if
*/
  glPopMatrix
  end method
  '
  method destructor()
  ===================
  del this.label
  'knobs        k[45]
  'lightbuttons l[16]
  'joysticks    j[1]
  int i
  for i=1 to 16
    l[i].destructor
  next
  for i=1 to 1
    j[i].destructor
  next
  for i=1 to 45
    k[i].destructor
  next
  end method
  '
end class
