@@ -164,6 +164,25 @@ AnnotationBubble.prototype.showEditor = function() {
164164 this . state = 'edit' ;
165165}
166166
167+
168+ AnnotationBubble . prototype . bindViewerClickHandler = function ( ) {
169+ var myBubble = this ;
170+
171+ $ ( this . qTipID ( ) )
172+ . unbind ( 'click' ) // unbind all old handlers
173+ . click ( function ( ) {
174+ if ( globalAnnotationMode == 'edit' ) {
175+ myBubble . showEditor ( ) ;
176+ }
177+ else if ( globalAnnotationMode == 'view' ) {
178+ myBubble . minimizeViewer ( ) ;
179+ }
180+ else {
181+ assert ( false ) ;
182+ }
183+ } ) ;
184+ }
185+
167186AnnotationBubble . prototype . showViewer = function ( ) {
168187 assert ( this . state == 'edit' ) ;
169188 assert ( this . text ) ; // must be non-empty!
@@ -180,18 +199,32 @@ AnnotationBubble.prototype.showViewer = function() {
180199 }
181200 } ) ) ;
182201
202+ this . bindViewerClickHandler ( ) ;
183203 this . state = 'view' ;
184204}
185205
206+
186207AnnotationBubble . prototype . minimizeViewer = function ( ) {
187208 assert ( this . state == 'view' ) ;
188- $ ( this . hashID ) . qtip ( 'option' , 'content.text' , ' ' ) ;
209+
210+ var myBubble = this ;
211+
212+ $ ( this . hashID ) . qtip ( 'option' , 'content.text' , ' ' ) ; //hack to "minimize" its size
213+
214+ $ ( this . qTipID ( ) )
215+ . unbind ( 'click' ) // unbind all old handlers
216+ . click ( function ( ) {
217+ assert ( globalAnnotationMode == 'view' ) ;
218+ myBubble . restoreViewer ( ) ;
219+ } ) ;
220+
189221 this . state = 'minimized' ;
190222}
191223
192224AnnotationBubble . prototype . restoreViewer = function ( ) {
193225 assert ( this . state == 'minimized' ) ;
194226 $ ( this . hashID ) . qtip ( 'option' , 'content.text' , this . text ) ;
227+ this . bindViewerClickHandler ( ) ;
195228 this . state = 'view' ;
196229}
197230
@@ -201,6 +234,11 @@ AnnotationBubble.prototype.hide = function() {
201234 this . state = 'hidden' ;
202235}
203236
237+
238+ AnnotationBubble . prototype . destroyQTip = function ( ) {
239+ $ ( this . hashID ) . qtip ( 'destroy' ) ;
240+ }
241+
204242AnnotationBubble . prototype . qTipContentID = function ( ) {
205243 return '#ui-tooltip-' + this . domID + '-content' ;
206244}
@@ -209,9 +247,6 @@ AnnotationBubble.prototype.qTipID = function() {
209247 return '#ui-tooltip-' + this . domID ;
210248}
211249
212- AnnotationBubble . prototype . destroyQTip = function ( ) {
213- $ ( this . hashID ) . qtip ( 'destroy' ) ;
214- }
215250
216251AnnotationBubble . prototype . enterEditMode = function ( ) {
217252 assert ( globalAnnotationMode == 'edit' ) ;
@@ -291,7 +326,48 @@ $(document).ready(function() {
291326 inputTextarea, true);
292327 */
293328
329+
330+ allBubbles . push ( new AnnotationBubble ( 'frame' , 'v1__globals' ) ) ;
331+ allBubbles . push ( new AnnotationBubble ( 'frame' , 'v1__stack0' ) ) ;
332+ allBubbles . push ( new AnnotationBubble ( 'frame' , 'v1__stack1' ) ) ;
294333 allBubbles . push ( new AnnotationBubble ( 'frame' , 'v1__stack2' ) ) ;
334+ allBubbles . push ( new AnnotationBubble ( 'frame' , 'v1__stack3' ) ) ;
335+
336+ allBubbles . push ( new AnnotationBubble ( 'object' , 'v1__heap_object_1' ) ) ;
337+ allBubbles . push ( new AnnotationBubble ( 'object' , 'v1__heap_object_2' ) ) ;
338+ allBubbles . push ( new AnnotationBubble ( 'object' , 'v1__heap_object_3' ) ) ;
339+ allBubbles . push ( new AnnotationBubble ( 'object' , 'v1__heap_object_4' ) ) ;
340+
341+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod1' ) ) ;
342+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod2' ) ) ;
343+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod3' ) ) ;
344+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod4' ) ) ;
345+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod5' ) ) ;
346+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod6' ) ) ;
347+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod7' ) ) ;
348+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod8' ) ) ;
349+ allBubbles . push ( new AnnotationBubble ( 'codeline' , 'v1__cod9' ) ) ;
350+
351+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__globals__listSum' ) ) ;
352+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__globals__myList' ) ) ;
353+
354+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f1__numbers' ) ) ;
355+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f1__f' ) ) ;
356+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f1__rest' ) ) ;
357+
358+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f2__numbers' ) ) ;
359+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f2__f' ) ) ;
360+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f2__rest' ) ) ;
361+
362+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f3__numbers' ) ) ;
363+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f3__f' ) ) ;
364+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f3__rest' ) ) ;
365+
366+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f4__numbers' ) ) ;
367+ allBubbles . push ( new AnnotationBubble ( 'variable' , 'v1__listSum_f4____return__' ) ) ;
368+
369+
370+
295371
296372 $ ( '#modeToggleBtn' ) . click ( function ( ) {
297373 if ( globalAnnotationMode == 'view' ) {
0 commit comments