@@ -228,14 +228,21 @@ ExecutionVisualizer.prototype.render = function() {
228228 </table>\
229229 </div>' ;
230230
231+ var vizHeaderHTML =
232+ '<div id="vizHeader">\
233+ <textarea class="vizTitleText" id="vizTitleEditor" cols="60" rows="1"></textarea>\
234+ <div class="vizTitleText" id="vizTitleViewer"></div>\
235+ <textarea class="vizDescriptionText" id="vizDescriptionEditor" cols="75" rows="2"></textarea>\
236+ <div class="vizDescriptionText" id="vizDescriptionViewer"></div>\
237+ </div>' ;
231238
232239 if ( this . params . verticalStack ) {
233- this . domRoot . html ( '<table border="0" class="visualizer"><tr><td class="vizLayoutTd">' +
240+ this . domRoot . html ( vizHeaderHTML + '<table border="0" class="visualizer"><tr><td class="vizLayoutTd">' +
234241 codeDisplayHTML + '</td></tr><tr><td class="vizLayoutTd">' +
235242 codeVizHTML + '</td></tr></table>' ) ;
236243 }
237244 else {
238- this . domRoot . html ( '<table border="0" class="visualizer"><tr><td class="vizLayoutTd">' +
245+ this . domRoot . html ( vizHeaderHTML + '<table border="0" class="visualizer"><tr><td class="vizLayoutTd">' +
239246 codeDisplayHTML + '</td><td class="vizLayoutTd">' +
240247 codeVizHTML + '</td></tr></table>' ) ;
241248 }
@@ -277,7 +284,6 @@ ExecutionVisualizer.prototype.render = function() {
277284
278285 this . domRoot . find ( '#stepAnnotationEditor' ) . hide ( ) ;
279286
280-
281287 if ( this . params . embeddedMode ) {
282288 this . params . hideOutput = true ; // put this before hideOutput handler
283289
@@ -436,6 +442,35 @@ ExecutionVisualizer.prototype.render = function() {
436442}
437443
438444
445+ ExecutionVisualizer . prototype . showVizHeaderViewMode = function ( ) {
446+ var titleVal = this . domRoot . find ( '#vizTitleEditor' ) . val ( ) . trim ( ) ;
447+ var descVal = this . domRoot . find ( '#vizDescriptionEditor' ) . val ( ) . trim ( ) ;
448+
449+ this . domRoot . find ( '#vizTitleEditor,#vizDescriptionEditor' ) . hide ( ) ;
450+
451+ if ( ! titleVal && ! descVal ) {
452+ this . domRoot . find ( '#vizHeader' ) . hide ( ) ;
453+ }
454+ else {
455+ this . domRoot . find ( '#vizHeader,#vizTitleViewer,#vizDescriptionViewer' ) . show ( ) ;
456+ if ( titleVal ) {
457+ this . domRoot . find ( '#vizTitleViewer' ) . html ( htmlspecialchars ( titleVal ) ) ;
458+ }
459+
460+ if ( descVal ) {
461+ this . domRoot . find ( '#vizDescriptionViewer' ) . html ( htmlspecialchars ( descVal ) ) ;
462+ }
463+ }
464+ }
465+
466+ ExecutionVisualizer . prototype . showVizHeaderEditMode = function ( ) {
467+ this . domRoot . find ( '#vizHeader' ) . show ( ) ;
468+
469+ this . domRoot . find ( '#vizTitleViewer,#vizDescriptionViewer' ) . hide ( ) ;
470+ this . domRoot . find ( '#vizTitleEditor,#vizDescriptionEditor' ) . show ( ) ;
471+ }
472+
473+
439474ExecutionVisualizer . prototype . destroyAllAnnotationBubbles = function ( ) {
440475 var myViz = this ;
441476
@@ -562,6 +597,12 @@ ExecutionVisualizer.prototype.enterViewAnnotationsMode = function() {
562597 }
563598
564599 myViz . initStepAnnotation ( ) ;
600+
601+ myViz . showVizHeaderViewMode ( ) ;
602+
603+ // redraw all connectors and bubbles in new vertical position ..
604+ myViz . redrawConnectors ( ) ;
605+ myViz . redrawAllAnnotationBubbles ( ) ;
565606}
566607
567608ExecutionVisualizer . prototype . enterEditAnnotationsMode = function ( ) {
@@ -587,6 +628,22 @@ ExecutionVisualizer.prototype.enterEditAnnotationsMode = function() {
587628 else {
588629 myViz . domRoot . find ( "#stepAnnotationEditor" ) . val ( '' ) ;
589630 }
631+
632+
633+ myViz . showVizHeaderEditMode ( ) ;
634+
635+ // redraw all connectors and bubbles in new vertical position ..
636+ myViz . redrawConnectors ( ) ;
637+ myViz . redrawAllAnnotationBubbles ( ) ;
638+ }
639+
640+
641+ ExecutionVisualizer . prototype . redrawAllAnnotationBubbles = function ( ) {
642+ if ( this . allAnnotationBubbles ) {
643+ $ . each ( this . allAnnotationBubbles , function ( i , e ) {
644+ e . redrawBubble ( ) ;
645+ } ) ;
646+ }
590647}
591648
592649
@@ -2819,6 +2876,10 @@ AnnotationBubble.prototype.redrawCodelineBubble = function() {
28192876 }
28202877}
28212878
2879+ AnnotationBubble . prototype . redrawBubble = function ( ) {
2880+ $ ( this . hashID ) . qtip ( 'reposition' ) ;
2881+ }
2882+
28222883
28232884// NB: copy-and-paste from isOutputLineVisible with some minor tweaks
28242885function isOutputLineVisibleForBubbles ( lineDivID ) {
0 commit comments