home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / AIMP2 / aimp_2.61.583.exe / $TEMP / YandexPackSetup.msi / fil803C8A4C96824CDCBD95E9C1ED4659B6 < prev    next >
Extensible Markup Language  |  2010-07-12  |  3KB  |  93 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE bindings [
  3.   <!ENTITY % yaSpellcheckerDTD SYSTEM "chrome://yasearch/locale/spellchecker/spellchecker.dtd">
  4.   %yaSpellcheckerDTD;
  5. ]>
  6. <bindings xmlns="http://www.mozilla.org/xbl"
  7.           xmlns:xbl="http://www.mozilla.org/xbl"
  8.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  9.   
  10.   <binding id="spellchecker-tree"
  11.            extends="chrome://global/content/bindings/tree.xml#tree">
  12.     <implementation>
  13.       <field name="editorKeyPressHandler">null</field>
  14.       <field name="_yaEditingData">null</field>
  15.       
  16.       <constructor><![CDATA[
  17.         var me = this;
  18.         
  19.         this.editorKeyPressHandler = function __editorKeyPressHandler(aEvent) {
  20.           if (aEvent.keyCode == aEvent.DOM_VK_RETURN || aEvent.keyCode == aEvent.DOM_VK_ENTER) {
  21.             me.stopEditing(true);
  22.             
  23.             if (aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey) {
  24.               document.documentElement.acceptDialog();
  25.             } else {
  26.               aEvent.preventDefault();
  27.               aEvent.stopPropagation();
  28.             }
  29.             
  30.           } else if (aEvent.keyCode == aEvent.DOM_VK_CANCEL || aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
  31.             me.stopEditing(false);
  32.             aEvent.preventDefault();
  33.             aEvent.stopPropagation();
  34.           }
  35.         }
  36.         
  37.         var oldStartEditing = this.startEditing;
  38.         this.startEditing = function __startEditing(aRow, aColumn) {
  39.           me.inputField.inputField.addEventListener("keypress", me.editorKeyPressHandler, false);
  40.           
  41.           var ret = oldStartEditing.apply(me, arguments);
  42.           
  43.           me._yaEditingData = me.getAttribute("editing") == "true" ? {
  44.             textValue: me.inputField.value,
  45.             row: me._editingRow,
  46.             column: me._editingColumn,
  47.             shouldAccept: false
  48.           } : null;
  49.           
  50.           var event = document.createEvent("Events");
  51.           event.initEvent("yaStartEditing", true, true);
  52.           this.dispatchEvent(event);
  53.           
  54.           return ret;
  55.         }
  56.         
  57.         var oldStopEditing = this.stopEditing;
  58.         this.stopEditing = function __stopEditing(aShouldAccept) {
  59.           me.inputField.inputField.removeEventListener("keypress", me.editorKeyPressHandler, false);
  60.           
  61.           var currentValue = me.inputField.value;
  62.           
  63.           var ret = oldStopEditing.apply(me, arguments);
  64.           
  65.           if (me._yaEditingData && !me.hasAttribute("editing")) {
  66.             var event = document.createEvent("Events");
  67.             event.initEvent("yaStopEditing", true, true);
  68.             
  69.             event.yaTextChangedData = {
  70.               textBefore: me._yaEditingData.textValue,
  71.               textAfter: currentValue,
  72.               row: me._yaEditingData.row,
  73.               column: me._yaEditingData.column,
  74.               shouldAccept: aShouldAccept
  75.             }
  76.             
  77.             setTimeout(function(me){me.dispatchEvent(event);}, 10, this);
  78.             
  79.             me._yaEditingData = null;
  80.           }
  81.           
  82.           return ret;
  83.         }
  84.       ]]></constructor>
  85.       
  86.       <destructor><![CDATA[
  87.         this.editorKeyPressHandler = null;
  88.         this.startEditing = null;
  89.         this.stopEditing = null;
  90.       ]]></destructor>
  91.     </implementation>
  92.   </binding>
  93. </bindings>