--- js-console-old/consoleBindings.xml	2007-10-29 01:18:49.000000000 +0100
+++ js-console/consoleBindings.xml	2008-08-05 02:13:41.000000000 +0200
@@ -2,20 +2,20 @@
 
 <!--
    - The Developer of this Code is HJ van Rantwijk. Copyright
-   - (C) 2001-2007 by HJ van Rantwijk.  All Rights Reserved.
+   - (C) 2001-2008 by HJ van Rantwijk.  All Rights Reserved.
    -
    -->
 
-<!DOCTYPE window SYSTEM "chrome://global/locale/console.dtd">
+<!DOCTYPE window SYSTEM "chrome://multiviews/locale/js-console/console.dtd">
 
 <bindings id="consoleBindings"
           xmlns="http://www.mozilla.org/xbl"
           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
           xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="console-box" extends="xul:box">
+  <binding id="console-box" extends="xul:box" chromedir="rtl">
     <content>
-      <xul:stringbundle src="chrome://global/locale/console.properties" role="string-bundle"/>
+      <xul:stringbundle src="chrome://multiviews/locale/js-console/console.properties" role="string-bundle"/>
       <xul:vbox class="console-box-internal">
         <xul:vbox class="console-rows" role="console-rows" xbl:inherits="dir=sortOrder"/>
       </xul:vbox>
@@ -65,7 +65,7 @@
         ]]></setter>
       </property>
 
-       <property name="filters">
+      <property name="filters">
         <getter>return this.mFilters;</getter>
         <setter><![CDATA[
           this.mFilters = val || "None";
@@ -74,8 +74,7 @@
         ]]></setter>
       </property>
 
-
-       <property name="languages">
+      <property name="languages">
         <getter>return this.mLanguages;</getter>
         <setter><![CDATA[
           this.mLanguages = val || "None";
@@ -120,7 +119,12 @@
           this.mErrors = document.getElementById("StatusbarErrors");
           this.mWarnings = document.getElementById("StatusbarWarnings");
           this.mMessages = document.getElementById("StatusbarMessages");
-          this.mCount = 0;         
+
+          this.mMode = "All";
+          this.mLanguages = "None";
+          this.mFilter = "None";
+
+          this.mCount = 0;
           this.mConsoleRowBox = document.getAnonymousElementByAttribute(this, "role", "console-rows");
           this.mStrBundle = document.getAnonymousElementByAttribute(this, "role", "string-bundle");
 
@@ -134,12 +138,16 @@
               "(Missing @mozilla.org/consoleservice;1)");
             return;
           }       
-          var value = this.getAttribute("mode");
+          var mode = this.getAttribute("mode");
 
-          if (["All", "Errors", "Warnings", "Messages"].indexOf(value) == -1)
-            value = "All";
-          // dump("\n\ninit mode: " + value);
-          this.mMode = value;
+          if (mode) {
+            if (["All", "Errors", "Warnings", "Messages"].indexOf(mode) == -1)
+              mode = "All";
+          }
+          else
+            mode = "All";
+
+          this.mode = mode;
 
           var filters = this.getAttribute("filters");
 
@@ -154,7 +162,7 @@
               }
             }
             if (filters.length == 0)
-              filters = "Off";
+              this.mFilters = "None";
             else
               this.mFilters = String(filters).replace(/,/g, " ");
           }
@@ -177,13 +185,15 @@
               }
             }
             if (languages.length == 0)
-              value = "JavaScript CSS XML";
+              this.mLanguages = "None";
             else
               this.mLanguages = String(languages).replace(/,/g, " ");
           }
           else {
             // dump("\nFixing languages");
             this.mLanguages = "JavaScript CSS XML";
+            this.setAttribute("languages", this.mLanguages);
+            document.persist("ConsoleBox", "languages");
           }
           // dump("\nthis.mLanguages: " + this.mLanguages);
           this.mThrobber.setAttribute("busy", "true");
@@ -319,24 +329,32 @@
           var nsIScriptError = Components.interfaces.nsIScriptError;
           
           // Is this error actually just a non-fatal warning?
+          var dupCount = 0;
           var typetext, warning = aMessage.flags & nsIScriptError.warningFlag != 0;
 
           if (warning) {
             typetext = "typeWarning";
             this.mWarnings.value++;
+            dupCount = this.mWarnings.value;
           }
           else {
             typetext = "typeError";
             this.mErrors.value++;
+            dupCount = this.mErrors.value;
           }
           var row = this.createConsoleRow();
-          row.setAttribute("typetext", this.mStrBundle.getString(typetext));
           row.setAttribute("type", warning ? "warning" : "error");
-          row.setAttribute("msg", aMessage.errorMessage); // message);
-          /* dump("\naMessage.flags       : " + aMessage.flags);
-          dump("\naMessage.message     : " + aMessage.message);
-          dump("\naMessage.category    : " + aMessage.category);
-          dump("\naMessage.errorMessage: " + aMessage.errorMessage); */
+          row.setAttribute("msg", aMessage.errorMessage);
+dupCount = 0;
+          if (dupCount) {
+            row.setAttribute("typetext", this.mStrBundle.getString(typetext + "s"));
+            row.setAttribute("count", dupCount);
+            var dupInfo = this.mStrBundle.getFormattedString("duplicates", [dupCount], 1);
+            row.setAttribute("dupinfo", dupInfo);
+          }
+          else {
+            row.setAttribute("typetext", this.mStrBundle.getString(typetext));
+          }
 
           if (aMessage.category) {
             var category = aMessage.category.toLowerCase();
@@ -345,9 +363,10 @@
               category = "xml";
             row.setAttribute("category", category);
           }
-          // dump("\ngetAttribute('category'): " + row.getAttribute('category'));
           if (aMessage.lineNumber || aMessage.sourceName) {
             row.setAttribute("url", aMessage.sourceName);
+            var source = this.mStrBundle.getFormattedString("errSource", [aMessage.lineNumber], 1);
+            row.setAttribute("source", source);
             row.setAttribute("line", aMessage.lineNumber);
           }
           else {
@@ -531,18 +550,16 @@
           <xul:image class="console-icon" xbl:inherits="src,type"/>
         </xul:box>
         <xul:vbox class="console-row-content" xbl:inherits="selected" flex="1">
-          <xul:box class="console-row-msg" align="start">
+          <xul:box class="console-row-msg">
             <xul:label class="label" xbl:inherits="value=typetext"/>
+            <xul:label class="console-row-dupInfo" xbl:inherits="value=dupinfo,count"
+                       tooltiptext="&duplicates.tooltiptext;"/>
             <xul:description class="console-error-msg" xbl:inherits="xbl:text=msg" flex="1"/>
           </xul:box>
-          <xul:box class="console-row-file" xbl:inherits="hidden=hideSource">
-            <xul:label class="label" value="&errFile.label;"/>
-            <xul:box class="console-error-source" xbl:inherits="url, line"/>
-            <xul:spacer flex="1"/>
-            <xul:box class="lineNumberBox" xbl:inherits="line">
-              <xul:label class="label" value="&errLine.label;"/>
-              <xul:label class="label" xbl:inherits="value=line"/>
-            </xul:box>
+          <xul:box class="console-row-source" xbl:inherits="hidden=hideSource">
+            <xul:label value="&sourceFile.label;" xbl:inherits="value=source"/>
+            <xul:box class="console-error-source" xbl:inherits="url,line"
+                     tooltiptext="&sourceURL.tooltiptext;"/>
           </xul:box>
           <xul:vbox class="console-row-code" xbl:inherits="selected,hidden=hideCode">
             <xul:label class="monospace console-code" xbl:inherits="value=code" crop="end"/>
@@ -643,5 +660,21 @@
     </handlers>
   </binding>
 
+  <binding id="searchbar">
+    <resources>
+      <stylesheet src="chrome://multiviews/content/js-console/consoleSearch.css"/>
+    </resources>
+    <content>
+      <xul:textbox flex="1" anonid="searchbar-textbox" class="searchbar-textbox">
+        <xul:hbox class="search-go-container" chromedir="ltr" pack="start">
+          <xul:image anonid="search-go-button" class="search-go-button" 
+                     chromedir="ltr" pack="end"
+                     onclick="alert('clicked');"
+                     tooltiptext="Search" />
+        </xul:hbox>
+      </xul:textbox>
+    </content>
+  </binding>
+
 </bindings>
 
