Sfoglia il codice sorgente

More fields, options in config, fix tooltips

Scott Lahteine 10 anni fa
parent
commit
ec53c6309a

+ 4
- 2
Marlin/configurator/config/Configuration.h Vedi File

@@ -48,6 +48,7 @@ Here are some standard links for getting your machine calibrated:
48 48
 // SERIAL_PORT selects which serial port should be used for communication with the host.
49 49
 // This allows the connection of wireless adapters (for instance) to non-default port pins.
50 50
 // Serial port 0 is still used by the Arduino bootloader regardless of this setting.
51
+// :[0,1,2,3,4,5,6,7]
51 52
 #define SERIAL_PORT 0
52 53
 
53 54
 // This determines the communication speed of the printer
@@ -71,12 +72,13 @@ Here are some standard links for getting your machine calibrated:
71 72
 // #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
72 73
 
73 74
 // This defines the number of extruders
75
+// :[1,2,3,4]
74 76
 #define EXTRUDERS 1
75 77
 
76 78
 //// The following define selects which power supply you have. Please choose the one that matches your setup
77 79
 // 1 = ATX
78 80
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
79
-
81
+// :{1:'ATX',2:'X-Box 360'}
80 82
 #define POWER_SUPPLY 1
81 83
 
82 84
 // Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it.
@@ -119,7 +121,7 @@ Here are some standard links for getting your machine calibrated:
119 121
 // 1010 is Pt1000 with 1k pullup (non standard)
120 122
 // 147 is Pt100 with 4k7 pullup
121 123
 // 110 is Pt100 with 1k pullup (non standard)
122
-
124
+// :{ 0: "Not used", 4: "10k !! do not use for a hotend. Bad resolution at high temp. !!", 1: "100k / 4.7k - EPCOS", 51: "100k / 1k - EPCOS", 6: "100k / 4.7k EPCOS - Not as accurate as Table 1", 5: "100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", 7: "100k / 4.7k Honeywell 135-104LAG-J01", 71: "100k / 4.7k Honeywell 135-104LAF-J01", 8: "100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", 9: "100k / 4.7k GE Sensing AL03006-58.2K-97-G1", 10: "100k / 4.7k RS 198-961", 11: "100k / 4.7k beta 3950 1%", 12: "100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", 13: "100k Hisens 3950  1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", 60: "100k Maker's Tool Works Kapton Bed Thermistor beta=3950", 55: "100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", 2: "200k / 4.7k - ATC Semitec 204GT-2", 52: "200k / 1k - ATC Semitec 204GT-2", '-2': "Thermocouple + MAX6675 (only for sensor 0)", '-1': "Thermocouple + AD595", 3: "Mendel-parts / 4.7k", 1047: "Pt1000 / 4.7k", 1010: "Pt1000 / 1k (non standard)", 20: "PT100 (Ultimainboard V2.x)", 147: "Pt100 / 4.7k", 110: "Pt100 / 1k (non-standard)" }
123 125
 #define TEMP_SENSOR_0 -1
124 126
 #define TEMP_SENSOR_1 -1
125 127
 #define TEMP_SENSOR_2 0

+ 15
- 3
Marlin/configurator/css/configurator.css Vedi File

@@ -41,9 +41,10 @@ p.info span { color: #800; }
41 41
 
42 42
 #message { text-align: center; }
43 43
 #message { width: 80%; margin: 0 auto 0.25em; color: #FF0; }
44
-#message p { padding: 2px 0; }
45
-#message p.error, #message p.message { color: #F00; background: #FF4; font-weight: bold; border-radius: 0.8em; }
44
+#message p { padding: 2px 0; font-weight: bold; border-radius: 0.8em; }
46 45
 #message p.message { color: #080; background: #CFC; }
46
+#message p.error { color: #F00; background: #FF4; }
47
+#message p.warning { color: #FF0; background: #BA4; }
47 48
 #message p.message span {
48 49
 	color: #A00;
49 50
 	background: rgba(255, 255, 255, 1);
@@ -92,6 +93,17 @@ input[type="checkbox"], input[type="radio"].enabler { margin-left: 1em; }
92 93
 
93 94
 input:disabled { color: #BBB; }
94 95
 
96
+#more input[type="text"] { width: 20em; }
97
+
98
+#more label {
99
+	width: 240px; /* label area */
100
+	height: 1em;
101
+	padding: 10px 360px 10px 1em;
102
+	margin-right: -350px;
103
+	text-align: right;
104
+	}
105
+
106
+
95 107
 ul.tabs { padding: 0; list-style: none; }
96 108
 ul.tabs li { display: inline; }
97 109
 ul.tabs li a,
@@ -136,7 +148,7 @@ fieldset legend { display: none; }
136 148
 	}
137 149
 
138 150
 #serial_stepper { padding-top: 0.75em; display: block; float: left; }
139
-#SERIAL_PORT { display: none; }
151
+/*#SERIAL_PORT { display: none; }*/
140 152
 
141 153
 /* Tooltips */
142 154
 

+ 144
- 80
Marlin/configurator/js/configurator.js Vedi File

@@ -165,7 +165,7 @@ var configuratorApp = (function(){
165 165
       this.makeTabsForFieldsets();
166 166
 
167 167
       // No selection on errors
168
-      $msgbox.noSelect();
168
+      // $msgbox.noSelect();
169 169
 
170 170
       // Make a droppable file uploader, if possible
171 171
       var $uploader = $('#file-upload');
@@ -231,30 +231,39 @@ var configuratorApp = (function(){
231 231
           },
232 232
           complete: function() {
233 233
             ajax_count++;
234
-            if (ajax_count >= 3) {
235
-              $.each(config_files, function(){ if (loaded_items[this]) loaded_items[this](); });
234
+            if (ajax_count >= config_files.length) {
235
+              // If not all files loaded set an error
236 236
               if (success_count < ajax_count)
237 237
                 self.setMessage('Unable to load configurations. Try the upload field.', 'error');
238
+
239
+              // Is the request near the rate limit? Set an error.
238 240
               var r;
239 241
               if (r = rateLimit) {
240 242
                 if (r.quota < 20) {
241 243
                   self.setMessage(
242 244
                     'Approaching request limit (' +
243 245
                     r.quota + ' remaining.' +
244
-                    ' Reset in ' + Math.floor(r.timeLeft/60) + ':' + (r.timeLeft%60+'').zeroPad(2) + ')'
246
+                    ' Reset in ' + Math.floor(r.timeLeft/60) + ':' + (r.timeLeft%60+'').zeroPad(2) + ')',
247
+                    'warning'
245 248
                   );
246 249
                 }
247 250
               }
251
+              // Post-process all the loaded files
252
+              $.each(config_files, function(){ if (loaded_items[this]) loaded_items[this](); });
248 253
             }
249 254
           }
250 255
         });
251 256
       });
252 257
     },
253 258
 
254
-    createDownloadLink: function(adv) {
259
+    /**
260
+     * Make a download link visible and active
261
+     */
262
+    activateDownloadLink: function(adv) {
255 263
       var $c = adv ? $config_adv : $config, txt = $c.text();
256 264
       var filename = (adv ? config_adv_file : config_file);
257 265
       $c.prevAll('.download:first')
266
+        .unbind('mouseover click')
258 267
         .mouseover(function() {
259 268
           var d = new Date(), fn = d.fileStamp(filename);
260 269
           $(this).attr({ download:fn, href:'download:'+fn, title:'download:'+fn });
@@ -300,32 +309,41 @@ var configuratorApp = (function(){
300 309
      * Get all the unique define names
301 310
      */
302 311
     getDefinesFromText: function(txt) {
312
+      var leave_out_defines = ['CONFIGURATION_H', 'CONFIGURATION_ADV_H', 'STRING_VERSION', 'STRING_URL', 'STRING_VERSION_CONFIG_H', 'STRING_CONFIG_H_AUTHOR', 'STRING_SPLASH_LINE1', 'STRING_SPLASH_LINE2'];
303 313
       // Get all the unique #define's and save them in an array
304 314
       var r, define_obj = {}, findDef = new RegExp('#define[ \\t]+(\\w+)', 'gm');
305
-      var cnt = 0;
306 315
       while((r = findDef.exec(txt)) !== null) {
307
-        if (cnt++ && !(r[1] in define_obj)) define_obj[r[1]] = null;
316
+        if ($.inArray(r[1], leave_out_defines) < 0 && !(r[1] in define_obj))
317
+          define_obj[r[1]] = null;
308 318
       }
309 319
       this.log(Object.keys(define_obj), 2);
310 320
       return Object.keys(define_obj);
311 321
     },
312 322
 
313 323
     /**
314
-     * Create placeholder fields for defines, as needed
324
+     * Create fields for any defines that have none
315 325
      */
316 326
     createFieldsForDefines: function(adv) {
317 327
       var e = adv ? 1 : 0, n = 0;
318 328
       var fail_list = [];
319 329
       $.each(define_list[e], function(i,name) {
320 330
         if (!$('#'+name).length) {
321
-          var $ff = $('#more');
322
-          var inf = self.getDefineInfo(name, adv);
331
+          var $ff = $('#more'),
332
+              inf = self.getDefineInfo(name, adv);
323 333
           if (inf) {
324 334
             var $newlabel = $('<label>',{for:name}).text(name.toLabel());
325 335
             // if (!(++n % 3))
326 336
               $newlabel.addClass('newline');
327
-            var $newfield = inf.type == 'switch' ? $('<input>',{type:'checkbox'}) : $('<input>',{type:'text',size:10,maxlength:40});
337
+
338
+            var $newfield;
339
+            if (inf.options !== undefined) {
340
+              $newfield = $('<select>'); //.addOptions(inf.options);
341
+            }
342
+            else {
343
+              $newfield = inf.type == 'switch' ? $('<input>',{type:'checkbox'}) : $('<input>',{type:'text',size:10,maxlength:40});
344
+            }
328 345
             $newfield.attr({id:name,name:name}).prop({defineInfo:inf});
346
+            // Add the new field to the form
329 347
             $ff.append($newlabel, $newfield);
330 348
           }
331 349
           else
@@ -358,7 +376,7 @@ var configuratorApp = (function(){
358 376
      */
359 377
     fileLoaded: function(filename, txt) {
360 378
       this.log("fileLoaded:"+filename,4);
361
-      var err;
379
+      var err, init_index;
362 380
       switch(filename) {
363 381
         case boards_file:
364 382
           this.initBoardsFromText(txt);
@@ -369,13 +387,8 @@ var configuratorApp = (function(){
369 387
           if (has_boards) {
370 388
             $config.text(txt);
371 389
             total_config_lines = txt.lineCount();
372
-            this.initThermistorsFromText(txt);
373
-            this.purgeDefineInfo(false);
374
-            define_list[0] = this.getDefinesFromText(txt);
375
-            this.log(define_list[0], 2);
376
-            this.createFieldsForDefines(0);
377
-            this.refreshConfigForm();
378
-            this.createDownloadLink(false);
390
+            // this.initThermistorsFromText(txt);
391
+            init_index = 0;
379 392
             has_config = true;
380 393
           }
381 394
           else {
@@ -386,11 +399,7 @@ var configuratorApp = (function(){
386 399
           if (has_config) {
387 400
             $config_adv.text(txt);
388 401
             total_config_adv_lines = txt.lineCount();
389
-            this.purgeDefineInfo(true);
390
-            define_list[1] = this.getDefinesFromText(txt);
391
-            this.log(define_list[1], 2);
392
-            this.refreshConfigForm();
393
-            this.createDownloadLink(true);
402
+            init_index = 1;
394 403
             has_config_adv = true;
395 404
           }
396 405
           else {
@@ -398,6 +407,16 @@ var configuratorApp = (function(){
398 407
           }
399 408
           break;
400 409
       }
410
+      // When a config file loads defines might change
411
+      if (init_index != null) {
412
+        var adv = init_index == 1;
413
+        define_list[init_index] = this.getDefinesFromText(txt);
414
+        this.log(define_list[init_index], 2);
415
+        this.purgeDefineInfo(adv);
416
+        this.createFieldsForDefines(init_index);
417
+        this.refreshConfigForm(init_index);
418
+        this.activateDownloadLink(adv);
419
+      }
401 420
       this.setMessage(err
402 421
         ? 'Please upload a "' + boards_file + '" file first!'
403 422
         : '"' + filename + '" loaded successfully.', err ? 'error' : 'message'
@@ -405,7 +424,7 @@ var configuratorApp = (function(){
405 424
     },
406 425
 
407 426
     /**
408
-     * Add enhancements to the form
427
+     * Add initial enhancements to the existing form
409 428
      */
410 429
     initConfigForm: function() {
411 430
       // Modify form fields and make the form responsive.
@@ -436,12 +455,13 @@ var configuratorApp = (function(){
436 455
       });
437 456
 
438 457
       // Add options to the popup menus
439
-      $('#SERIAL_PORT').addOptions([0,1,2,3,4,5,6,7]);
440
-      $('#BAUDRATE').addOptions([2400,9600,19200,38400,57600,115200,250000]);
441
-      $('#EXTRUDERS').addOptions([1,2,3,4]);
442
-      $('#POWER_SUPPLY').addOptions({'1':'ATX','2':'Xbox 360'});
458
+      // $('#SERIAL_PORT').addOptions([0,1,2,3,4,5,6,7]);
459
+      // $('#BAUDRATE').addOptions([2400,9600,19200,38400,57600,115200,250000]);
460
+      // $('#EXTRUDERS').addOptions([1,2,3,4]);
461
+      // $('#POWER_SUPPLY').addOptions({'1':'ATX','2':'Xbox 360'});
443 462
 
444 463
       // Replace the Serial popup menu with a stepper control
464
+      /*
445 465
       $('#serial_stepper').jstepper({
446 466
         min: 0,
447 467
         max: 3,
@@ -455,6 +475,7 @@ var configuratorApp = (function(){
455 475
         textStyle: {width:'1.5em',fontSize:'120%',textAlign:'center'},
456 476
         onChange: function(v) { $('#SERIAL_PORT').val(v).trigger('change'); }
457 477
       });
478
+      */
458 479
     },
459 480
 
460 481
     /**
@@ -462,8 +483,9 @@ var configuratorApp = (function(){
462 483
      */
463 484
     makeTabsForFieldsets: function() {
464 485
       // Make tabs for the fieldsets
465
-      var $fset = $form.find('fieldset');
466
-      var $tabs = $('<ul>',{class:'tabs'}), ind = 1;
486
+      var $fset = $form.find('fieldset'),
487
+          $tabs = $('<ul>',{class:'tabs'}),
488
+          ind = 1;
467 489
       $fset.each(function(){
468 490
         var tabID = 'TAB'+ind;
469 491
         $(this).addClass(tabID);
@@ -489,7 +511,7 @@ var configuratorApp = (function(){
489 511
     /**
490 512
      * Update all fields on the form after loading a configuration
491 513
      */
492
-    refreshConfigForm: function() {
514
+    refreshConfigForm: function(init_index) {
493 515
 
494 516
       /**
495 517
        * Any manually-created form elements will remain
@@ -499,56 +521,72 @@ var configuratorApp = (function(){
499 521
        * Specific exceptions can be managed by applying
500 522
        * classes to the associated form fields.
501 523
        * Sorting and arrangement can come from an included
502
-       * js file that describes the configuration in JSON.
524
+       * Javascript file that describes the configuration
525
+       * in JSON, or using information added to the config
526
+       * files.
503 527
        *
504
-       * For now I'm trying to derive information
505
-       * about options directly from the config file.
506 528
        */
507 529
 
530
+      // Refresh the motherboard menu with new options
508 531
       $('#MOTHERBOARD').html('').addOptions(boards_list);
509 532
 
510
-      $('#TEMP_SENSOR_0, #TEMP_SENSOR_1, #TEMP_SENSOR_2, #TEMP_SENSOR_BED').html('').addOptions(therms_list);
511
-
512
-      $.each(define_list, function() { $.each(this, function() { if ($('#'+this).length) self.initField(this); }); });
533
+      // Init all existing fields, getting define info for any that need it
534
+      // refreshing the options and updating their current values
535
+      $.each(define_list[init_index], function() {
536
+        if ($('#'+this).length)
537
+          self.initField(this,init_index==1);
538
+        else
539
+          self.log(this + " is not on the page yet.", 2);
540
+      });
513 541
     },
514 542
 
515 543
     /**
516
-     * Make a field responsive and initialize its defineInfo
544
+     * Get the defineInfo for a field on the form
545
+     * Make it responsive, add a tooltip
517 546
      */
518 547
     initField: function(name, adv) {
519 548
       this.log("initField:"+name,4);
520
-      var $elm = $('#'+name), elm = $elm[0];
521
-      if (elm.defineInfo == null) {
522
-        var inf = elm.defineInfo = this.getDefineInfo(name, adv);
523
-        $elm.on($elm.attr('type') == 'text' ? 'input' : 'change', this.handleChange);
524
-
525
-        if (inf.tooltip) {
526
-          var $tipme = $elm.prev('label');
527
-          if ($tipme.length) {
528
-            $tipme.hover(
529
-              function() {
530
-                if ($('#tipson input').prop('checked')) {
531
-                  var pos = $tipme.position();
532
-                  $tooltip.html(inf.tooltip)
533
-                    .append('<span>')
534
-                    .css({bottom:($tooltip.parent().outerHeight()-pos.top)+'px',left:(pos.left+70)+'px'})
535
-                    .show();
536
-                  if (hover_timer) {
537
-                    clearTimeout(hover_timer);
538
-                    hover_timer = null;
539
-                  }
540
-                }
541
-              },
542
-              function() {
543
-                hover_timer = setTimeout(function(){
549
+      var $elm = $('#'+name), elm = $elm[0], inf = elm.defineInfo;
550
+      if (inf == null)
551
+        inf = elm.defineInfo = this.getDefineInfo(name, adv);
552
+
553
+      // Set options on the field if there are any
554
+      if (inf.options !== undefined)
555
+        $elm.html('').addOptions(inf.options);
556
+
557
+      // Create a tooltip if there is one
558
+      if (inf.tooltip) {
559
+        var $tipme = $elm.prev('label');
560
+        if ($tipme.length) {
561
+          $tipme.unbind('mouseenter mouseleave');
562
+          $tipme.hover(
563
+            function() {
564
+              if ($('#tipson input').prop('checked')) {
565
+                var pos = $tipme.position();
566
+                $tooltip.html(inf.tooltip)
567
+                  .append('<span>')
568
+                  .css({bottom:($tooltip.parent().outerHeight()-pos.top)+'px',left:(pos.left+70)+'px'})
569
+                  .show();
570
+                if (hover_timer) {
571
+                  clearTimeout(hover_timer);
544 572
                   hover_timer = null;
545
-                  $tooltip.fadeOut(400);
546
-                }, 400);
573
+                }
547 574
               }
548
-            );
549
-          }
575
+            },
576
+            function() {
577
+              hover_timer = setTimeout(function(){
578
+                hover_timer = null;
579
+                $tooltip.fadeOut(400);
580
+              }, 400);
581
+            }
582
+          );
550 583
         }
551 584
       }
585
+
586
+      $elm.unbind('input change');
587
+      $elm.on($elm.attr('type') == 'text' ? 'input' : 'change', this.handleChange);
588
+
589
+      // Set the field's initial value from the define
552 590
       this.setFieldFromDefine(name);
553 591
     },
554 592
 
@@ -733,6 +771,7 @@ var configuratorApp = (function(){
733 771
      *   - Store the existing #define line as a fast key to finding it later.
734 772
      *   - Determine the line number of the #define so it can be scrolled to.
735 773
      *   - Gather nearby comments to be used as tooltips.
774
+     *   - Look for JSON in nearby comments to use as select options.
736 775
      */
737 776
     getDefineInfo: function(name, adv) {
738 777
       if (adv === undefined) adv = false;
@@ -757,34 +796,50 @@ var configuratorApp = (function(){
757 796
         info.repl =  new RegExp('([ \\t]*)(\/\/)?([ \\t]*' + info.define.regEsc() + info.post.regEsc() + ')', 'm');
758 797
       }
759 798
       else {
760
-        // a define with quotes
761
-        findDef = new RegExp('^(.*//)?(.*#define[ \\t]+' + name + '[ \\t]+)("[^"]*")([ \\t]*/[*/].*)?$', 'm');
799
+        // a define with curly braces
800
+        findDef = new RegExp('^(.*//)?(.*#define[ \\t]+' + name + '[ \\t]+)(\{[^\}]*\})([ \\t]*/[*/].*)?$', 'm');
762 801
         result = findDef.exec(txt);
763 802
         if (result !== null) {
764 803
           $.extend(info, {
765
-            type:   'quoted',
804
+            type:   'list',
766 805
             line:   result[0],
767 806
             pre:    result[1] === undefined ? '' : result[1].replace('//',''),
768 807
             define: result[2],
769 808
             post:   result[4] === undefined ? '' : result[4]
770 809
           });
771
-          info.regex = new RegExp('([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '"([^"]*)"' + info.post.regEsc(), 'm');
772
-          info.repl  = new RegExp('(([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '")[^"]*("' + info.post.regEsc() + ')', 'm');
810
+          info.regex = new RegExp('([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '\{([^\}]*)\}' + info.post.regEsc(), 'm');
811
+          info.repl  = new RegExp('(([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '\{)[^\}]*(\}' + info.post.regEsc() + ')', 'm');
773 812
         }
774 813
         else {
775
-          // a define with no quotes
776
-          findDef = new RegExp('^([ \\t]*//)?([ \\t]*#define[ \\t]+' + name + '[ \\t]+)(\\S*)([ \\t]*/[*/].*)?$', 'm');
814
+          // a define with quotes
815
+          findDef = new RegExp('^(.*//)?(.*#define[ \\t]+' + name + '[ \\t]+)("[^"]*")([ \\t]*/[*/].*)?$', 'm');
777 816
           result = findDef.exec(txt);
778 817
           if (result !== null) {
779 818
             $.extend(info, {
780
-              type:   'plain',
819
+              type:   'quoted',
781 820
               line:   result[0],
782 821
               pre:    result[1] === undefined ? '' : result[1].replace('//',''),
783 822
               define: result[2],
784 823
               post:   result[4] === undefined ? '' : result[4]
785 824
             });
786
-            info.regex = new RegExp('([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '(\\S*)' + info.post.regEsc(), 'm');
787
-            info.repl  = new RegExp('(([ \\t]*//)?[ \\t]*' + info.define.regEsc() + ')\\S*(' + info.post.regEsc() + ')', 'm');
825
+            info.regex = new RegExp('([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '"([^"]*)"' + info.post.regEsc(), 'm');
826
+            info.repl  = new RegExp('(([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '")[^"]*("' + info.post.regEsc() + ')', 'm');
827
+          }
828
+          else {
829
+            // a define with no quotes
830
+            findDef = new RegExp('^([ \\t]*//)?([ \\t]*#define[ \\t]+' + name + '[ \\t]+)(\\S*)([ \\t]*/[*/].*)?$', 'm');
831
+            result = findDef.exec(txt);
832
+            if (result !== null) {
833
+              $.extend(info, {
834
+                type:   'plain',
835
+                line:   result[0],
836
+                pre:    result[1] === undefined ? '' : result[1].replace('//',''),
837
+                define: result[2],
838
+                post:   result[4] === undefined ? '' : result[4]
839
+              });
840
+              info.regex = new RegExp('([ \\t]*//)?[ \\t]*' + info.define.regEsc() + '(\\S*)' + info.post.regEsc(), 'm');
841
+              info.repl  = new RegExp('(([ \\t]*//)?[ \\t]*' + info.define.regEsc() + ')\\S*(' + info.post.regEsc() + ')', 'm');
842
+            }
788 843
           }
789 844
         }
790 845
       }
@@ -807,13 +862,22 @@ var configuratorApp = (function(){
807 862
               tooltip = '';
808 863
               break;
809 864
             }
810
-            tooltip += ' ' + s[1] + '\n';
865
+            // JSON data? Save as select options
866
+            if (s[1].match(/:[\[{]/) != null) {
867
+              // TODO
868
+              // :[1-6] = value limits
869
+              eval('info.options = ' + s[1].substr(1));
870
+            }
871
+            else {
872
+              // Other lines added to the tooltip
873
+              tooltip += ' ' + s[1] + '\n';
874
+            }
811 875
           }
812 876
         }
813 877
 
814
-        findDef = new RegExp('^[ \\t]*'+name); // To strip the name from the start
878
+        findDef = new RegExp('^'+name); // To strip the name from the start
815 879
         $.extend(info, {
816
-          tooltip: '<strong>'+name+'</strong> '+tooltip.replace(findDef,'').trim().toHTML(),
880
+          tooltip: '<strong>'+name+'</strong> '+tooltip.trim().replace(findDef,'').toHTML(),
817 881
           lineNum: this.getLineNumberOfText(info.line, txt)
818 882
         });
819 883
       }

Loading…
Annulla
Salva