Index: gc_lang/fr/tb/content/lex_editor.css ================================================================== --- gc_lang/fr/tb/content/lex_editor.css +++ gc_lang/fr/tb/content/lex_editor.css @@ -5,29 +5,17 @@ */ .dictionary { font-size: 18px; font-weight: bold; color: hsl(210, 50%, 50%); - width: 220px; } .dic_text { font-size: 18px; color: hsl(210, 50%, 50%); } -.dic_saved_date_label { - width: 120px; - text-align: right; -} -.dic_saved_date { - width: 180px; -} -.dic_num_entries { - width: 60px; - text-align: right; -} -.dic_num_entries_label { - width: 100px; +.align_right { + text-align: right; } /* Add new words @@ -74,10 +62,14 @@ #generated_words_table { width: 400px; height: 600px; } +.delete_entry { + color: hsl(0, 100%, 50%); + font-weight: bold; +} /* Lexicon tab */ @@ -90,5 +82,6 @@ width: 120px; } .data { width: 90px; } + Index: gc_lang/fr/tb/content/lex_editor.js ================================================================== --- gc_lang/fr/tb/content/lex_editor.js +++ gc_lang/fr/tb/content/lex_editor.js @@ -65,17 +65,15 @@ this.listen(); } _createHeader () { let xListheadNode = createNode("listhead"); - xListheadNode.appendChild(createNode("listheader", { label: "·", width: "12px" })); for (let sColumn of this.lColumn) { xListheadNode.appendChild(createNode("listheader", { label: sColumn })); } this.xTable.appendChild(xListheadNode); let xListcolsNode = createNode("listcols"); - xListcolsNode.appendChild(createNode("listcol", { flex: 1 })); for (let cColumn of this.lColumnWidth) { xListcolsNode.appendChild(createNode("listcol", { flex: cColumn })); } this.xTable.appendChild(xListcolsNode); } @@ -113,18 +111,16 @@ this.showEntryNumber(); } showEntryNumber () { if (this.xNumEntry) { - this.xNumEntry.textContent = this.nEntry; + this.xNumEntry.value = this.nEntry; } } _addRow (lData) { - let xRowNode = createNode("listitem", { id: this.sNodeId + "_row_" + this.iEntryIndex }); - xRowNode.appendChild(createNode("listcell", { label: "×", className: "delete_entry", title: "Effacer cette entrée", value: this.iEntryIndex })); - //xRowNode.appendChild(createNode("listcell", { label: this.iEntryIndex })); + let xRowNode = createNode("listitem", { id: this.sNodeId + "_item_" + this.iEntryIndex, value: this.iEntryIndex }); for (let data of lData) { xRowNode.appendChild(createNode("listcell", { label: data })); } this.xTable.appendChild(xRowNode); this.iEntryIndex += 1; @@ -135,12 +131,14 @@ } onTableClick (xEvent) { try { let xElem = xEvent.target; + console.log(xElem); if (xElem.className) { - if (xElem.className == "delete_entry") { + if (xElem.className.startsWith(this.sNodeId+"_item_")) { + console.log("!"); this.deleteRow(xElem.value); } } } catch (e) { @@ -449,10 +447,12 @@ lEntry.push(s.split("\t")); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); enableElement("export_button"); + } else { + disableElement("export_button"); } }, setDictData: function (nEntries, sDate) { document.getElementById("dic_num_entries").value = nEntries; @@ -473,12 +473,16 @@ let oJSON = oDAWG.createBinaryJSON(1); prefs.setCharPref("oPersonalDictionary", JSON.stringify(oJSON)); this.oIBDAWG = new IBDAWG(oJSON); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); //browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} }); + enableElement("export_button"); + } else { + prefs.setCharPref("oPersonalDictionary", ""); + this.setDictData(0, "[néant]"); + disableElement("export_button"); } - enableElement("export_button"); }, import: function () { console.log("import"); }, @@ -514,11 +518,11 @@ } } -const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10],"progress_lexicon", "num_entries"); -const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [10, 10], "progress_new_words"); +const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10], "progress_lexicon", "num_entries"); +const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [1, 1], "progress_new_words"); oBinaryDict.load(); oBinaryDict.listen(); oGenerator.listen(); Index: gc_lang/fr/tb/content/lex_editor.xul ================================================================== --- gc_lang/fr/tb/content/lex_editor.xul +++ gc_lang/fr/tb/content/lex_editor.xul @@ -16,14 +16,17 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">