 selectGroup = (i, forceRefresh) ->
   if i != sel || forceRefresh
     h = model[i]; $('#col-group').val i
-    $('#col-fg-cb').prop 'checked', !!h.fg; $('#col-fg').val(h.fg).toggle !!h.fg
-    $('#col-bg-cb').prop 'checked', !!h.bg; $('#col-bg').val(h.bg).toggle !!h.bg
-    $('#col-lb-cb').prop 'checked', !!h.lb; $('#col-lb').val(h.lb).toggle !!h.lb
-    $('#col-B').prop 'checked', !!h.B
-    $('#col-I').prop 'checked', !!h.I
-    $('#col-U').prop 'checked', !!h.U
-    $('#col-lb-p').toggle !!G[i].showLB
+    qw('fg bg lb').forEach (p) -> $("#col-#{p}-cb").prop 'checked', !!h[p]; $("#col-#{p}").val(h[p]).toggle !!h[p]; return
+    qw('B I U').forEach (p) -> $("#col-#{p}").prop 'checked', !!h[p]; return
+    c = G[i].controls || {}
+    $('#col-fg-p' ).toggle !!(c.fg ? 1)
+    $('#col-bg-p' ).toggle !!(c.bg ? 1)
+    $('#col-BIU-p').toggle !!(c.BIU ? 1)
+    $('#col-lb-p' ).toggle !!c.lb
     sel = i
   return

  'mb':bg:'#ffff88'
  'sc':bg:'#ff8800'
  'mo':bg:'#eeeeee'

renderCSS = (v, rp = '') -> # v: style objects keyed by token type, rp: css rule prefix
  join G.map (g) ->

  {t:'⍝',  c:'.cm-apl-comment',             s:'comment'         }
  {t:'!',  c:'.cm-apl-err',                 s:'error'           }
  {t:'L',  c:'.CodeMirror-linenumber',      s:'line number'     }
  {t:'cu', c:'div.CodeMirror-cursor',       s:'cursor',           controls:{lb:1}}
  {t:'mb', c:'.CodeMirror-matchingbracket', s:'matching bracket'}
  {t:'sc', c:'.CodeMirror-search-match',    s:'search match'    }
  {t:'mo', c:'.modified',                   s:'modified (session)'}
  {t:'s1', c:'.CodeMirror-focused .CodeMirror-selected', s:'selected (focused)',    controls:{fg:0,BIU:0}}
  {t:'s0', c:'.CodeMirror-selected',                     s:'selected (no focus)',   controls:{fg:0,BIU:0}}
]
H = dict G.map (g, i) -> [g.t, i]

