Grammalecte  Check-in [6b3259a6bb]

Overview
Comment:[tb] ui and code update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | tbme
Files: files | file ages | folders
SHA3-256: 6b3259a6bb30def4dbea3606523b0ddf811dbbf02bc629a61b89a4db0f78dd9a
User & Date: olr on 2019-09-03 18:45:38
Other Links: branch diff | manifest | tags
Context
2019-09-04
16:35
[tb] lexicon editor: ui update check-in: 437198b8d6 user: olr tags: tb, tbme
2019-09-03
18:45
[tb] ui and code update check-in: 6b3259a6bb user: olr tags: tb, tbme
15:40
[tb] remove useless Hunspell dictionaries check-in: 8b2726d0c3 user: olr tags: tb, tbme
Changes

Modified gc_lang/fr/mailext/content/lex_editor.css from [f637f1110a] to [d28ca8e3b0].

1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16








-
+







/* CSS */

button {
    font-weight: bold;
}

/*
    Dictionary
*/ 
*/
.dictionary {
    font-size: 18px;
    font-weight: bold;
    color: hsl(210, 50%, 50%);
}
.dic_text {
    font-size: 18px;
78
79
80
81
82
83
84






85
86
87
88
89
90
91
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97







+
+
+
+
+
+







*/

#lexicon_table {
    width: 600px;
    height: 650px;
}

.list_header {
    padding: 2px 10px;
    font-weight: bold;
    background-color: hsl(0, 0%, 95%);
    border-bottom: 1px solid hsl(0, 0%, 50%);
}
.info_label {
    width: 120px;
}
.data {
    width: 90px;
}

Modified gc_lang/fr/mailext/content/lex_editor.js from [55ae60b578] to [fccff12209].

62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80
81
82
83
84
62
63
64
65
66
67
68


69
70
71
72





73
74
75
76
77
78
79







-
-
+
+


-
-
-
-
-







        this.lEntry = [];
        this.nEntry = 0
        this._createHeader();
    }

    _createHeader () {
        let xListheadNode = createNode("richlistitem");
        for (let sColumn of this.lColumn) {
            xListheadNode.appendChild(createNode("div", { class: "listheader", label: sColumn }));
        for (let i=0;  i < this.lColumn.length;  i++) {
            xListheadNode.appendChild(createNode("label", { class: "listheader", value: this.lColumn[i], flex: this.lColumnWidth[i] }));
        }
        this.xTable.appendChild(xListheadNode);
        let xListcolsNode = createNode("richlistitem");
        for (let cColumn of this.lColumnWidth) {
            xListcolsNode.appendChild(createNode("div", { class: "listcol", flex: cColumn }));
        }
        this.xTable.appendChild(xListcolsNode);
    }

    clear () {
        while (this.xTable.firstChild) {
            this.xTable.removeChild(this.xTable.firstChild);
        }
        this.iEntryIndex = 0;
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
111
112
113
114
115
116
117

118
119
120
121
122
123
124
125







-
+







            this.xNumEntry.value = this.nEntry;
        }
    }

    _addRow (lData) {
        let xRowNode = createNode("richlistitem", { id: this.sNodeId + "_item_" + this.iEntryIndex, value: this.iEntryIndex });
        for (let data of lData) {
            xRowNode.appendChild(createNode("div", { class:"listcell", label: data }));
            xRowNode.appendChild(createNode("label", { class:"listcell", label: data }));
        }
        this.xTable.appendChild(xRowNode);
        this.iEntryIndex += 1;
    }

    deleteSelection () {
        for (let xItem of this.xTable.selectedItems) {

Modified gc_lang/fr/mailext/content/lex_editor.xul from [8bd0fd27f3] to [1fe6db7187].

155
156
157
158
159
160
161
162
163


164
165
166
167
168
169
170
155
156
157
158
159
160
161


162
163
164
165
166
167
168
169
170







-
-
+
+








              <listitem>
                <listcell label="George"/>
                <listcell label="House"/>
              </listitem>
              -->
            </richlistbox>
            <!--<progressmeter id="progress_new_words" value="0"/>-->
            <html:progress id="progress_new_words" max="100" value="0">
            <progressmeter id="progress_new_words" value="0"/>
            <!--<html:progress id="progress_new_words" max="100" value="0">-->
            <hbox>
              <button id="delete_selection" label="Effacer la sélection" />
              <spacer flex="1" />
              <button id="add_to_lexicon" label="Ajouter au lexique" />
            </hbox>
          </vbox>
        </hbox>
178
179
180
181
182
183
184
185
186


187
188
189
190
191
192
193
178
179
180
181
182
183
184


185
186
187
188
189
190
191
192
193







-
-
+
+







            <hbox>
              <label class="info_label" value="Nombre d’entrées : " />
              <label id="num_entries" class="data" value="0" />
            </hbox>
            <spacer flex="1" />
            <button id="delete_button" label="Supprimer la sélection" />
            <spacer flex="20" />
            <!--<progressmeter id="progress_lexicon" value="0"/>-->
            <html:progress id="progress_lexicon" max="100" value="0">
            <progressmeter id="progress_lexicon" value="0"/>
            <!--<html:progress id="progress_lexicon" max="100" value="0">-->
            <button id="save_button" label="Enregistrer" />
          </vbox>

          <vbox>
            <richlistbox id="lexicon_table" seltype="multiple">
              <!--
              <listhead>
237
238
239
240
241
242
243
244
245


246
247
248
249
250
251
252
237
238
239
240
241
242
243


244
245
246
247
248
249
250
251
252







-
-
+
+







            </hbox>
            <button id="search_regex_button" label="Chercher" />
            <label value="" />
            <description>La recherche par expressions régulières peut générer un nombre gigantesque de résultats. Seules les 2000 premières occurrences trouvées seront affichées. La recherche peut être longue, parce tout le graphe de mots, qui contient 500 000 flexions, sera parcouru si besoin.</description>

            <spacer flex="1" />

            <!--<progressmeter id="progress_search" value="0"/>-->
            <html:progress id="progress_search" max="100" value="0">
            <progressmeter id="progress_search" value="0"/>
            <!--<html:progress id="progress_search" max="100" value="0">-->
            <hbox>
              <spacer flex="1" />
              <label id="search_num_entries" class="align_right" value="0" />
              <label value="entrées" />
            </hbox>
          </vbox>
          <vbox>

Modified gc_lang/fr/mailext/content/overlay.js from [2dc7dc1240] to [40318f50b2].

336
337
338
339
340
341
342
343

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368

369
370
371
372
373


374
375
376
377
378
379

380
381
382
383
384
385
386
336
337
338
339
340
341
342

343

344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361

362
363
364
365

366

367



368
369




370

371
372
373
374
375
376
377
378







-
+
-


















-




-
+
-

-
-
-
+
+
-
-
-
-

-
+







                function (aCaught) { console.error('Promise Error - ', aCaught); }
            );
        });
        xNodeSuggLine.appendChild(xNodeSuggButton);
        xNodeDiv.appendChild(xNodeSuggLine);
        return xNodeDiv;
    },
    loadUI: function() {
    loadUI: function () {
        console.log("loadUI");
        this._strings = document.getElementById("grammarchecker-strings");
        let that = this;
        let nsGrammarCommand = {
            isCommandEnabled: function (aCommand, dummy) {
                return (IsDocumentEditable() && !IsInHTMLSourceMode());
            },
            getCommandStateParams: function (aCommand, aParams, aRefCon) {},
            doCommandParams: function (aCommand, aParams, aRefCon) {},
            doCommand: function (aCommand) {
                that.onParseText(aCommand);
            }
        };
        let xCommandTable = GetComposerCommandTable();
        xCommandTable.registerCommand("cmd_grammar", nsGrammarCommand);
        let sButtonId = "grammarchecker-toolbar-button";
        let sButtonId2 = "grammalecte-menu";
        let xNavBar  = document.getElementById("composeToolbar2");
        let lCurSet  = xNavBar.currentSet.split(",");
        console.log("navBar", lCurSet);
        if (lCurSet.indexOf(sButtonId) == -1) {
            let iPos = lCurSet.indexOf("spellingButton") + 1 || lCurSet.length;
            let aSet = lCurSet.slice(0, iPos).concat(sButtonId).concat(sButtonId2).concat(lCurSet.slice(iPos));
            xNavBar.setAttribute("currentset", aSet.join(","));
            xNavBar.currentSet = aSet.join(",");
            //xNavBar.currentSet = aSet.join(",");
            //document.persist(xNavBar.id, "currentset");
            Services.xulStore.persist(xNavBar, "currentset");
            try {
                Ci.BrowserToolboxCustomizeDone(true);
            }
            Ci.BrowserToolboxCustomizeDone(true);
        }
            catch (e) {
                console.error(e);
            }
        }
    },
    clearPreview: function() {
    clearPreview: function () {
        let xPreview = document.getElementById("grammalecte-errors");
        while (xPreview.firstChild) {
            xPreview.removeChild(xPreview.firstChild);
        };
        let xEditor = GetCurrentEditor();
        if (xEditor != null) {
            try {
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
470
471
472
473
474
475
476






















477
478
479
480
481
482
483







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        this.openDialog("chrome://grammarchecker/content/lex_editor.xul", "", "chrome, resizable=no");
    },
    onAbout: function (e) {
        this.openDialog("chrome://grammarchecker/content/about.xul", "", "chrome, dialog, modal, resizable=no");
    }
};


var oDictIgniter = {
    bDone: false,
    init: function () {
        if (!this.bDone) {
            oSpellControl.init();
            this._setDictionary('fr-FR-modern', 'bDictModern');
            this._setDictionary('fr-FR-classic', 'bDictClassic');
            this._setDictionary('fr-FR-reform', 'bDictReform');
            this._setDictionary('fr-FR-classic-reform', 'bDictClassicReform');
        }
    },
    _setDictionary: function (sDicName, sOptName) {
        try {
            oSpellControl.setExtensionDictFolder(sDicName, prefs.getBoolPref(sOptName));
        }
        catch (e) {
            console.error(e);
        }
    }
}


var oTextFormatter = {
    init: function () {
        try {
            this.closePanel();
            this.listen();
            let sTFOptions = prefs.getCharPref("sTFOptions");
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
857
858
859
860
861
862
863

864
865
866
867
868
869
870
871
872
873







-










    }
}


/* EVENTS */

window.addEventListener("load", function (xEvent) {
    // oDictIgniter.init();
    oGrammarChecker.loadGC();
    //oGrammarChecker.fullTests();
}, false);

window.addEventListener("compose-window-init", function (xEvent) {
    oGrammarChecker.loadUI();
    oGrammarChecker.closePanel();
    oGrammarChecker.clearPreview();
    oTextFormatter.init();
}, true);