home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 86 / PIWD86.iso / pc / contents / dreamweaver / software / dwmx2004.exe / Disk1 / data1.cab / Configuration_En / Commands / debugSyntaxResults.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  2.6 KB  |  104 lines

  1. // Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2. //*************** GLOBAL VARS  *****************
  3.  
  4.  
  5. //******************* API **********************
  6.  
  7.  
  8. function receiveArguments()
  9. {
  10.     // get the results win from the persistent global property
  11.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  12.     var cmd = arguments[0];
  13.     if ( cmd == "init" )
  14.     {
  15.         var title = arguments[1];
  16.         var buttonTitle = arguments[2];
  17.         var colHeaders = arguments[3];
  18.         var colWidths = arguments[4];
  19.  
  20.         if ( resultsWin ) {
  21.             resultsWin.close();
  22.             resultsWin = null;
  23.         }
  24.  
  25.         resultsWin = dw.createResultsWindow(title, colHeaders);
  26.         resultsWin.setColumnWidths(colWidths);
  27.         resultsWin.setButtons(this, new Array(buttonTitle, "goToLine()"));
  28.         
  29.         // save the results win in a persistent global property
  30.         dw.constructor.MM_debuggerSyntaxResults = resultsWin;
  31.         //alert(dw.constructor.MM_debuggerSyntaxResults);
  32.     }
  33.     else if ( cmd == "addItem" )
  34.     {
  35.         var desc = arguments[1];
  36.         var filePath = arguments[2];
  37.         var off1 = arguments[3];
  38.         var off2 = arguments[4];
  39.         var cols = arguments[5];
  40.  
  41.         if ( resultsWin ) {
  42.             resultsWin.addItem(this, "", desc, filePath, off1, off2, cols);
  43.  
  44.             if ( resultsWin.getItemCount() == 1 )
  45.                 resultsWin.setSelectedItem(0);
  46.         }
  47.     }
  48.     else if ( cmd == "closeResults" )
  49.     {
  50.         if ( resultsWin ) {
  51.             resultsWin.close();
  52.             resultsWin = null;
  53.         }
  54.     }
  55. }
  56.  
  57. function getResultsWin()
  58. {
  59.     // get the results win from the persistent global property
  60.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  61.     return resultsWin;
  62. }
  63.  
  64. //***************** LOCAL FUNCTIONS  ******************
  65.  
  66. function onLoad()
  67. {
  68.     // do nothing since we did it all in receiveArguments
  69. }
  70.  
  71. // this callback function is called when the user presses 
  72. // Go To Line button in the results window
  73. function goToLine()
  74. {
  75.     var resultsWin = dw.constructor.MM_debuggerSyntaxResults;
  76.     //alert(resultsWin);
  77.     var selItem = resultsWin.getSelectedItem();
  78.     var itemVals = resultsWin.getItem(selItem);
  79.     var icon = itemVals[0];
  80.     var desc = itemVals[1];
  81.     var filePath = itemVals[2];
  82.     var off1 = new Number(itemVals[3]);
  83.     var off2 = new Number(itemVals[4]);
  84.     var cols = itemVals[5];
  85.     var theDoc = dw.openDocument(filePath);
  86.  
  87.     if (theDoc.getView() == 'split' || theDoc.getView() == 'code' || theDoc.getView() == 'split code') 
  88.     {
  89.         dw.setFocus('textView');
  90.     }
  91.     else if (dw.getFloaterVisibility('html')) 
  92.     {
  93.         dw.setFocus('html');
  94.     }
  95.     else if ( theDoc.getView() == 'design' )
  96.     {
  97.         theDoc.setView('split')
  98.         dw.setFocus('textView');
  99.     }
  100.  
  101.     theDoc.source.setSelection(off1.valueOf(), off2.valueOf());
  102. }
  103.  
  104.