Changeset 14936


Ignore:
Timestamp:
Aug 11, 2011, 8:38:01 PM (9 years ago)
Author:
gz
Message:

limit the tags frame to 30% of window; add a "show tags" link to select the tags for each source form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/library/cover.lisp

    r14928 r14936  
    773773  sel.focus();
    774774  sel.onchange = tags_changed;
    775   sel.style.width = sel.offsetWidth + 'px';
    776775
    777776  var fs = top.document.getElementById('tagsframeset');
    778   fs.cols = (sel.offsetLeft + sel.offsetWidth) + 'px,*';
    779 
     777  fs.cols = Math.min(sel.offsetLeft + sel.offsetWidth, 0.3 * fs.scrollWidth) + 'px,*';
     778  resize_tags();
    780779}
     780
     781function select_tags (tags) {
     782  var sel = document.getElementById('tagsselect');
     783  for (var i = 0; i < sel.length; i++) sel[i].selected = false;
     784  var len = tags.length;
     785  for (var i = 0; i < len; i++) sel[tags[i]].selected = true;
     786}
     787
    781788</script></head><body onload='init_tags()' onresize='resize_tags()'>"
    782789                    *coverage-frame-name*)
     
    810817      var tags_frame = document.createElement('frame');
    811818      tags_frame.src = '~0@*~a';
     819      tags_frame.name = 'tagsframe';
    812820      file_frame = document.createElement('frame');
    813821      file_frame.name = 'T~1@*~a';
     
    12191227
    12201228}
     1229
     1230function show_tags (sn) {
     1231  tags_frame = top.frames.tagsframe;
     1232  if (tags_frame && tags_frame.select_tags) {
     1233    var tags = new Array();
     1234    var outer_notes = SourceCodeNotes[sn].slice(0);
     1235    var total = CodeTags.length - 1;
     1236    for (cn = total - 1; cn >= 0; cn--) {
     1237      if (is_member(CodeParents[cn], outer_notes)) {
     1238         outer_notes.push(cn);
     1239         var new_tags = CodeTags[cn];
     1240         var n = new_tags.length - 1;
     1241         for (i = 0; i < n; i++) {
     1242           var tag = new_tags[i];
     1243           if (!is_member(tag, tags)) tags.push(tag);
     1244         }
     1245      }
     1246    }
     1247    tags_frame.select_tags(tags);
     1248  }
     1249}
     1250
    12211251")
    12221252
     
    13801410        for start = 0 then end as (end . acodes) in queue
    13811411        do (output-coverage-html-source s start end)
    1382         do (format html-stream "<a href=javascript:swap('~at~d')><span class='toggle' id='p~2:*~at~d'>Show expansion</span></a>~%~
    1383                                         <div class='acode' id='a~2:*~at~d'><code>" prefix start)
     1412        do (format html-stream "<a href=javascript:swap('~at~d')><span class='toggle' id='p~2:*~at~d'>Show expansion</span></a>~%" prefix start)
     1413        do (when *coverage-tags*
     1414             (format html-stream "&nbsp;&nbsp;&nbsp;<a href=javascript:show_tags(~d)><span class='toggle'>Show tags</span></a>~%" start))
     1415        do (format html-stream "<div class='acode' id='a~at~d'><code>" prefix start)
    13841416        do (loop for (acode . notes) in acodes
    13851417                 do (with-input-from-vector (astream acode :external-format :utf-8)
Note: See TracChangeset for help on using the changeset viewer.