eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot dic/encoding.cpp dic/encoding.h po/eliot.... [cppdic]


From: eliot-dev
Subject: [Eliot-dev] eliot dic/encoding.cpp dic/encoding.h po/eliot.... [cppdic]
Date: Sun, 16 Dec 2007 18:20:55 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         cppdic
Changes by:     Olivier Teulière <ipkiss>      07/12/16 18:20:55

Modified files:
        dic            : encoding.cpp encoding.h 
        po             : eliot.pot fr.po 
        utils          : ncurses.cpp ncurses.h 

Log message:
         - new truncOrPad() utility function
         - ncurses interface:
           * better handling of the status line
           * global keys now work in any panel

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/encoding.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.11&r2=1.1.2.12
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/encoding.h?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.6&r2=1.1.2.7
http://cvs.savannah.gnu.org/viewcvs/eliot/po/eliot.pot?cvsroot=eliot&only_with_tag=cppdic&r1=1.6.6.5&r2=1.6.6.6
http://cvs.savannah.gnu.org/viewcvs/eliot/po/fr.po?cvsroot=eliot&only_with_tag=cppdic&r1=1.6.6.5&r2=1.6.6.6
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/ncurses.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.22.2.8&r2=1.22.2.9
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/ncurses.h?cvsroot=eliot&only_with_tag=cppdic&r1=1.6.4.2&r2=1.6.4.3

Patches:
Index: dic/encoding.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/encoding.cpp,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -b -r1.1.2.11 -r1.1.2.12
--- dic/encoding.cpp    16 Dec 2007 15:58:43 -0000      1.1.2.11
+++ dic/encoding.cpp    16 Dec 2007 18:20:54 -0000      1.1.2.12
@@ -229,6 +229,35 @@
 }
 
 
+string truncOrPad(const string &iStr, unsigned int iWidth, char iChar)
+{
+    wstring wstr = convertToWc(iStr);
+    unsigned int width = 0;
+    unsigned int pos;
+    for (pos = 0; pos < wstr.size(); ++pos)
+    {
+        int n = wcwidth(wstr[pos]);
+        if (n == -1)
+        {
+            ostringstream ss;
+            ss << "truncAndConvert: non printable character: " << wstr[pos];
+            // XXX: Should we throw an exception instead? Just ignore the 
problem?
+            cerr << ss.str() << endl;;
+            //throw DicException(ss.str());
+            return convertToMb(wstr);
+        }
+        if (width + n > iWidth)
+            break;
+        width += n;
+    }
+
+    if (iWidth > width)
+        return convertToMb(wstr.substr(0, pos)) + string(iWidth - width, 
iChar);
+    else
+        return convertToMb(wstr.substr(0, pos));
+}
+
+
 string padAndConvert(const wstring &iWstr, unsigned int iLength,
                      bool iLeftPad, char c)
 {

Index: dic/encoding.h
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/encoding.h,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- dic/encoding.h      16 Dec 2007 15:58:43 -0000      1.1.2.6
+++ dic/encoding.h      16 Dec 2007 18:20:54 -0000      1.1.2.7
@@ -66,6 +66,13 @@
 string truncAndConvert(const wstring &iWStr, unsigned int iMaxWidth);
 
 /**
+ * Make sure the displayed version of iStr has a width of iWidth.
+ * If the string is too long, truncate it, if it is too short, pad it
+ * with iChar
+ */
+string truncOrPad(const string &iStr, unsigned int iWidth, char iChar = ' ');
+
+/**
  * Convert the given string into a multi-byte one. If the number of columns
  * needed to display the resulting string is less than iLength, pad it with
  * the given character (defaulting to space)

Index: po/eliot.pot
===================================================================
RCS file: /cvsroot/eliot/eliot/po/eliot.pot,v
retrieving revision 1.6.6.5
retrieving revision 1.6.6.6
diff -u -b -r1.6.6.5 -r1.6.6.6
--- po/eliot.pot        16 Dec 2007 15:58:44 -0000      1.6.6.5
+++ po/eliot.pot        16 Dec 2007 18:20:55 -0000      1.6.6.6
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-12-16 16:44+0100\n"
+"POT-Creation-Date: 2007-12-16 19:18+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <address@hidden>\n"
 "Language-Team: LANGUAGE <address@hidden>\n"
@@ -260,151 +260,151 @@
 msgid "result:"
 msgstr ""
 
-#: utils/ncurses.cpp:271
+#: utils/ncurses.cpp:270
 msgid "Scores"
 msgstr ""
 
-#: utils/ncurses.cpp:277
+#: utils/ncurses.cpp:276
 #, c-format
 msgid "Player %d: %d"
 msgstr ""
 
-#: utils/ncurses.cpp:286
+#: utils/ncurses.cpp:285
 msgid "Racks"
 msgstr ""
 
-#: utils/ncurses.cpp:293
+#: utils/ncurses.cpp:292
 #, c-format
 msgid "Player %d: %ls"
 msgstr ""
 
-#: utils/ncurses.cpp:304 utils/ncurses.cpp:307
+#: utils/ncurses.cpp:303 utils/ncurses.cpp:306
 msgid "Search complete"
 msgstr ""
 
-#: utils/ncurses.cpp:317
+#: utils/ncurses.cpp:316
 msgid "Search results"
 msgstr ""
 
-#: utils/ncurses.cpp:345
+#: utils/ncurses.cpp:344
 msgid "History of the game"
 msgstr ""
 
-#: utils/ncurses.cpp:351
+#: utils/ncurses.cpp:350
 msgid " N |   RACK   |    SOLUTION     | REF | PTS | P | BONUS"
 msgstr ""
 
-#: utils/ncurses.cpp:385
+#: utils/ncurses.cpp:384
 msgid "Help"
 msgstr ""
 
-#: utils/ncurses.cpp:389
+#: utils/ncurses.cpp:388
 msgid "[Global]"
 msgstr ""
 
-#: utils/ncurses.cpp:390
+#: utils/ncurses.cpp:389
 msgid "   h, H, ?          Show/hide help box"
 msgstr ""
 
-#: utils/ncurses.cpp:391
+#: utils/ncurses.cpp:390
 msgid "   y, Y             Show/hide history of the game"
 msgstr ""
 
-#: utils/ncurses.cpp:392
+#: utils/ncurses.cpp:391
 msgid ""
 "   b, B             Show/hide contents of the bag (including letters of the "
 "racks)"
 msgstr ""
 
-#: utils/ncurses.cpp:393
+#: utils/ncurses.cpp:392
 msgid "   e, E             Show/hide dots on empty squares of the board"
 msgstr ""
 
-#: utils/ncurses.cpp:394
+#: utils/ncurses.cpp:393
 msgid "   d, D             Check the existence of a word in the dictionary"
 msgstr ""
 
-#: utils/ncurses.cpp:395
+#: utils/ncurses.cpp:394
 msgid "   j, J             Play a word"
 msgstr ""
 
-#: utils/ncurses.cpp:396
+#: utils/ncurses.cpp:395
 msgid "   s, S             Save the game"
 msgstr ""
 
-#: utils/ncurses.cpp:397
+#: utils/ncurses.cpp:396
 msgid "   l, L             Load a game"
 msgstr ""
 
-#: utils/ncurses.cpp:398
+#: utils/ncurses.cpp:397
 msgid "   q, Q             Quit"
 msgstr ""
 
-#: utils/ncurses.cpp:401
+#: utils/ncurses.cpp:400
 msgid "[Training mode]"
 msgstr ""
 
-#: utils/ncurses.cpp:402
+#: utils/ncurses.cpp:401
 msgid "   *                Take a random rack"
 msgstr ""
 
-#: utils/ncurses.cpp:403
+#: utils/ncurses.cpp:402
 msgid "   +                Complete the current rack randomly"
 msgstr ""
 
-#: utils/ncurses.cpp:404
+#: utils/ncurses.cpp:403
 msgid "   t, T             Set the rack manually"
 msgstr ""
 
-#: utils/ncurses.cpp:405
+#: utils/ncurses.cpp:404
 msgid "   c, C             Compute all the possible words"
 msgstr ""
 
-#: utils/ncurses.cpp:406
+#: utils/ncurses.cpp:405
 msgid "   r, R             Show/hide search results"
 msgstr ""
 
-#: utils/ncurses.cpp:409
+#: utils/ncurses.cpp:408
 msgid "[Duplicate mode]"
 msgstr ""
 
-#: utils/ncurses.cpp:410
+#: utils/ncurses.cpp:409
 msgid "   n, N             Switch to the next human player"
 msgstr ""
 
-#: utils/ncurses.cpp:413
+#: utils/ncurses.cpp:412
 msgid "[Free game mode]"
 msgstr ""
 
-#: utils/ncurses.cpp:414
+#: utils/ncurses.cpp:413
 msgid "   p, P             Pass your turn (with or without changing letters)"
 msgstr ""
 
-#: utils/ncurses.cpp:417
+#: utils/ncurses.cpp:416
 msgid "[Miscellaneous]"
 msgstr ""
 
-#: utils/ncurses.cpp:418
+#: utils/ncurses.cpp:417
 msgid "   <up>, <down>     Navigate in a box line by line"
 msgstr ""
 
-#: utils/ncurses.cpp:419
+#: utils/ncurses.cpp:418
 msgid "   <pgup>, <pgdown> Navigate in a box page by page"
 msgstr ""
 
-#: utils/ncurses.cpp:420
+#: utils/ncurses.cpp:419
 msgid "   Ctrl-l           Refresh the screen"
 msgstr ""
 
-#: utils/ncurses.cpp:431 wxwin/auxframes.cc:148
+#: utils/ncurses.cpp:430 wxwin/auxframes.cc:148
 msgid "Bag"
 msgstr ""
 
-#: utils/ncurses.cpp:438
+#: utils/ncurses.cpp:437
 msgid " LETTER | POINTS | FREQUENCY | REMAINING"
 msgstr ""
 
-#: utils/ncurses.cpp:491
+#: utils/ncurses.cpp:490
 msgid "Play a word"
 msgstr ""
 
@@ -412,115 +412,115 @@
 #. "Coordinates:". For example:
 #. Pl. word   :
 #. Coordinates:
-#: utils/ncurses.cpp:492 utils/ncurses.cpp:500
+#: utils/ncurses.cpp:491 utils/ncurses.cpp:499
 msgid "Played word:"
 msgstr ""
 
-#: utils/ncurses.cpp:493 utils/ncurses.cpp:501
+#: utils/ncurses.cpp:492 utils/ncurses.cpp:500
 msgid "Coordinates:"
 msgstr ""
 
-#: utils/ncurses.cpp:515
+#: utils/ncurses.cpp:514
 msgid "Incorrect or misplaced word"
 msgstr ""
 
-#: utils/ncurses.cpp:530
+#: utils/ncurses.cpp:524
 msgid "Dictionary"
 msgstr ""
 
-#: utils/ncurses.cpp:531
+#: utils/ncurses.cpp:525
 msgid "Enter the word to check:"
 msgstr ""
 
-#: utils/ncurses.cpp:540
+#: utils/ncurses.cpp:534
 #, c-format
 msgid "The word '%ls' exists"
 msgstr ""
 
-#: utils/ncurses.cpp:542
+#: utils/ncurses.cpp:536
 #, c-format
 msgid "The word '%ls' does not exist"
 msgstr ""
 
-#: utils/ncurses.cpp:553 wxwin/mainframe.cc:464 wxwin/mainframe.cc:472
+#: utils/ncurses.cpp:546 wxwin/mainframe.cc:464 wxwin/mainframe.cc:472
 msgid "Save the game"
 msgstr ""
 
-#: utils/ncurses.cpp:554 utils/ncurses.cpp:584
+#: utils/ncurses.cpp:547 utils/ncurses.cpp:576
 msgid "Enter the file name:"
 msgstr ""
 
-#: utils/ncurses.cpp:564
+#: utils/ncurses.cpp:557
 #, c-format
 msgid "Cannot open file %ls for writing"
 msgstr ""
 
-#: utils/ncurses.cpp:571
+#: utils/ncurses.cpp:564
 #, c-format
 msgid "Game saved in %ls"
 msgstr ""
 
-#: utils/ncurses.cpp:583 wxwin/mainframe.cc:268 wxwin/mainframe.cc:389
+#: utils/ncurses.cpp:575 wxwin/mainframe.cc:268 wxwin/mainframe.cc:389
 #: wxwin/mainframe.cc:413
 msgid "Load a game"
 msgstr ""
 
-#: utils/ncurses.cpp:594
+#: utils/ncurses.cpp:586
 #, c-format
 msgid "Cannot open file %ls for reading"
 msgstr ""
 
-#: utils/ncurses.cpp:602
+#: utils/ncurses.cpp:594
 #, c-format
 msgid "Invalid saved game"
 msgstr ""
 
-#: utils/ncurses.cpp:606
+#: utils/ncurses.cpp:598
 #, c-format
 msgid "Game loaded"
 msgstr ""
 
-#: utils/ncurses.cpp:622
+#: utils/ncurses.cpp:613
 msgid "Pass your turn"
 msgstr ""
 
-#: utils/ncurses.cpp:623
+#: utils/ncurses.cpp:614
 msgid "Enter the letters to change:"
 msgstr ""
 
-#: utils/ncurses.cpp:632
+#: utils/ncurses.cpp:623
 msgid "Cannot pass the turn"
 msgstr ""
 
-#: utils/ncurses.cpp:643
+#: utils/ncurses.cpp:633
 msgid "Set rack"
 msgstr ""
 
-#: utils/ncurses.cpp:644
+#: utils/ncurses.cpp:634
 msgid "Enter the new letters:"
 msgstr ""
 
-#: utils/ncurses.cpp:653
+#: utils/ncurses.cpp:643
 msgid "Cannot take these letters from the bag"
 msgstr ""
 
-#: utils/ncurses.cpp:1013
+#: utils/ncurses.cpp:1037
 msgid "Training mode"
 msgstr ""
 
-#: utils/ncurses.cpp:1015
+#: utils/ncurses.cpp:1039
 msgid "Free game mode"
 msgstr ""
 
-#: utils/ncurses.cpp:1017
+#: utils/ncurses.cpp:1041
 msgid "Duplicate mode"
 msgstr ""
 
-#: utils/ncurses.cpp:1020
+#: utils/ncurses.cpp:1044
 msgid "Joker game"
 msgstr ""
 
-#: utils/ncurses.cpp:1021
+#: utils/ncurses.cpp:1045
 msgid "[h for help]"
 msgstr ""
 

Index: po/fr.po
===================================================================
RCS file: /cvsroot/eliot/eliot/po/fr.po,v
retrieving revision 1.6.6.5
retrieving revision 1.6.6.6
diff -u -b -r1.6.6.5 -r1.6.6.6
--- po/fr.po    16 Dec 2007 15:58:44 -0000      1.6.6.5
+++ po/fr.po    16 Dec 2007 18:20:55 -0000      1.6.6.6
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: eliot 1.4\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-12-16 16:44+0100\n"
+"POT-Creation-Date: 2007-12-16 19:18+0100\n"
 "PO-Revision-Date: 2005-02-06 20:03+0100\n"
 "Last-Translator: Olivier Teuliere <address@hidden>\n"
 "Language-Team: French <address@hidden>\n"
@@ -276,57 +276,57 @@
 msgid "result:"
 msgstr "résultat :"
 
-#: utils/ncurses.cpp:271
+#: utils/ncurses.cpp:270
 msgid "Scores"
 msgstr "Scores"
 
-#: utils/ncurses.cpp:277
+#: utils/ncurses.cpp:276
 #, c-format
 msgid "Player %d: %d"
 msgstr "Joueur %d : %d"
 
-#: utils/ncurses.cpp:286
+#: utils/ncurses.cpp:285
 msgid "Racks"
 msgstr "Tirages"
 
-#: utils/ncurses.cpp:293
+#: utils/ncurses.cpp:292
 #, c-format
 msgid "Player %d: %ls"
 msgstr "Joueur %d : %ls"
 
-#: utils/ncurses.cpp:304 utils/ncurses.cpp:307
+#: utils/ncurses.cpp:303 utils/ncurses.cpp:306
 msgid "Search complete"
 msgstr "Recherche terminée"
 
-#: utils/ncurses.cpp:317
+#: utils/ncurses.cpp:316
 msgid "Search results"
 msgstr "Résultats de la recherche"
 
-#: utils/ncurses.cpp:345
+#: utils/ncurses.cpp:344
 msgid "History of the game"
 msgstr "Historique de la partie"
 
-#: utils/ncurses.cpp:351
+#: utils/ncurses.cpp:350
 msgid " N |   RACK   |    SOLUTION     | REF | PTS | P | BONUS"
 msgstr " N |  TIRAGE  |    SOLUTION     | REF | PTS | J | BONUS"
 
-#: utils/ncurses.cpp:385
+#: utils/ncurses.cpp:384
 msgid "Help"
 msgstr "Aide"
 
-#: utils/ncurses.cpp:389
+#: utils/ncurses.cpp:388
 msgid "[Global]"
 msgstr "[Général]"
 
-#: utils/ncurses.cpp:390
+#: utils/ncurses.cpp:389
 msgid "   h, H, ?          Show/hide help box"
 msgstr "   h, H, ?          Afficher/cacher la boîte d'aide"
 
-#: utils/ncurses.cpp:391
+#: utils/ncurses.cpp:390
 msgid "   y, Y             Show/hide history of the game"
 msgstr "   y, Y             Afficher/cacher l'historique de la partie"
 
-#: utils/ncurses.cpp:392
+#: utils/ncurses.cpp:391
 msgid ""
 "   b, B             Show/hide contents of the bag (including letters of the "
 "racks)"
@@ -334,98 +334,98 @@
 "   b, B             Afficher/cacher le contenu du sac (avec les lettres des "
 "tirages)"
 
-#: utils/ncurses.cpp:393
+#: utils/ncurses.cpp:392
 msgid "   e, E             Show/hide dots on empty squares of the board"
 msgstr ""
 "   e, E             Afficher/cacher les points sur les cases vides du "
 "plateau de jeu"
 
-#: utils/ncurses.cpp:394
+#: utils/ncurses.cpp:393
 msgid "   d, D             Check the existence of a word in the dictionary"
 msgstr "   d, D             Vérifier l'existence d'un mot dans le 
dictionnaire"
 
-#: utils/ncurses.cpp:395
+#: utils/ncurses.cpp:394
 msgid "   j, J             Play a word"
 msgstr "   j, J             Jouer un mot"
 
-#: utils/ncurses.cpp:396
+#: utils/ncurses.cpp:395
 msgid "   s, S             Save the game"
 msgstr "   s, S             Sauvegarder la partie"
 
-#: utils/ncurses.cpp:397
+#: utils/ncurses.cpp:396
 msgid "   l, L             Load a game"
 msgstr "   l, L             Charger une partie"
 
-#: utils/ncurses.cpp:398
+#: utils/ncurses.cpp:397
 msgid "   q, Q             Quit"
 msgstr "   q, Q             Quitter"
 
-#: utils/ncurses.cpp:401
+#: utils/ncurses.cpp:400
 msgid "[Training mode]"
 msgstr "[Mode entraînement]"
 
-#: utils/ncurses.cpp:402
+#: utils/ncurses.cpp:401
 msgid "   *                Take a random rack"
 msgstr "   *                Tirage aléatoire"
 
-#: utils/ncurses.cpp:403
+#: utils/ncurses.cpp:402
 msgid "   +                Complete the current rack randomly"
 msgstr "   +                Compléter le tirage courant de manière 
aléatoire"
 
-#: utils/ncurses.cpp:404
+#: utils/ncurses.cpp:403
 msgid "   t, T             Set the rack manually"
 msgstr "   t, T             Entrer le tirage manuellement"
 
-#: utils/ncurses.cpp:405
+#: utils/ncurses.cpp:404
 msgid "   c, C             Compute all the possible words"
 msgstr "   c, C             Calculer tous les mots possibles"
 
-#: utils/ncurses.cpp:406
+#: utils/ncurses.cpp:405
 msgid "   r, R             Show/hide search results"
 msgstr "   r, R             Afficher/cacher les résultats de la recherche"
 
-#: utils/ncurses.cpp:409
+#: utils/ncurses.cpp:408
 msgid "[Duplicate mode]"
 msgstr "[Mode duplicate]"
 
-#: utils/ncurses.cpp:410
+#: utils/ncurses.cpp:409
 msgid "   n, N             Switch to the next human player"
 msgstr "   n, N             Passer au joueur humain suivant"
 
-#: utils/ncurses.cpp:413
+#: utils/ncurses.cpp:412
 msgid "[Free game mode]"
 msgstr "[Mode partie libre]"
 
-#: utils/ncurses.cpp:414
+#: utils/ncurses.cpp:413
 msgid "   p, P             Pass your turn (with or without changing letters)"
 msgstr ""
 "   p, P             Passer son tour (en changeant ou pas certaines lettres)"
 
-#: utils/ncurses.cpp:417
+#: utils/ncurses.cpp:416
 msgid "[Miscellaneous]"
 msgstr "[Divers]"
 
-#: utils/ncurses.cpp:418
+#: utils/ncurses.cpp:417
 msgid "   <up>, <down>     Navigate in a box line by line"
 msgstr "   <haut>, <bas>    Naviguer dans une boîte ligne par ligne"
 
-#: utils/ncurses.cpp:419
+#: utils/ncurses.cpp:418
 msgid "   <pgup>, <pgdown> Navigate in a box page by page"
 msgstr "   <pgup>, <pgdown> Naviguer dans une boîte page par page"
 
-#: utils/ncurses.cpp:420
+#: utils/ncurses.cpp:419
 msgid "   Ctrl-l           Refresh the screen"
 msgstr "   Ctrl-l           Rafraîchir l'écran"
 
-#: utils/ncurses.cpp:431 wxwin/auxframes.cc:148
+#: utils/ncurses.cpp:430 wxwin/auxframes.cc:148
 msgid "Bag"
 msgstr "Sac"
 
-#: utils/ncurses.cpp:438
+#: utils/ncurses.cpp:437
 msgid " LETTER | POINTS | FREQUENCY | REMAINING"
 msgstr " LETTRE | POINTS | FREQUENCE | RESTANT"
 
-#: utils/ncurses.cpp:491
+#: utils/ncurses.cpp:490
 msgid "Play a word"
 msgstr "Jouer un mot"
 
@@ -433,115 +433,115 @@
 #. "Coordinates:". For example:
 #. Pl. word   :
 #. Coordinates:
-#: utils/ncurses.cpp:492 utils/ncurses.cpp:500
+#: utils/ncurses.cpp:491 utils/ncurses.cpp:499
 msgid "Played word:"
 msgstr "Mot joué    :"
 
-#: utils/ncurses.cpp:493 utils/ncurses.cpp:501
+#: utils/ncurses.cpp:492 utils/ncurses.cpp:500
 msgid "Coordinates:"
 msgstr "Coordonnées :"
 
-#: utils/ncurses.cpp:515
+#: utils/ncurses.cpp:514
 msgid "Incorrect or misplaced word"
 msgstr "Mot incorrect ou mal placé"
 
-#: utils/ncurses.cpp:530
+#: utils/ncurses.cpp:524
 msgid "Dictionary"
 msgstr "Dictionnaire"
 
-#: utils/ncurses.cpp:531
+#: utils/ncurses.cpp:525
 msgid "Enter the word to check:"
 msgstr "Entrer le mot à vérifier:"
 
-#: utils/ncurses.cpp:540
+#: utils/ncurses.cpp:534
 #, c-format
 msgid "The word '%ls' exists"
 msgstr "Le mot '%ls' existe"
 
-#: utils/ncurses.cpp:542
+#: utils/ncurses.cpp:536
 #, c-format
 msgid "The word '%ls' does not exist"
 msgstr "Le mot '%ls' n'existe pas"
 
-#: utils/ncurses.cpp:553 wxwin/mainframe.cc:464 wxwin/mainframe.cc:472
+#: utils/ncurses.cpp:546 wxwin/mainframe.cc:464 wxwin/mainframe.cc:472
 msgid "Save the game"
 msgstr "Sauvegarder la partie"
 
-#: utils/ncurses.cpp:554 utils/ncurses.cpp:584
+#: utils/ncurses.cpp:547 utils/ncurses.cpp:576
 msgid "Enter the file name:"
 msgstr "Entrer le nom du fichier :"
 
-#: utils/ncurses.cpp:564
+#: utils/ncurses.cpp:557
 #, c-format
 msgid "Cannot open file %ls for writing"
 msgstr "Impossible d'ouvrir le fichier %ls en écriture"
 
-#: utils/ncurses.cpp:571
+#: utils/ncurses.cpp:564
 #, c-format
 msgid "Game saved in %ls"
 msgstr "Partie sauvée dans %ls"
 
-#: utils/ncurses.cpp:583 wxwin/mainframe.cc:268 wxwin/mainframe.cc:389
+#: utils/ncurses.cpp:575 wxwin/mainframe.cc:268 wxwin/mainframe.cc:389
 #: wxwin/mainframe.cc:413
 msgid "Load a game"
 msgstr "Charger une partie"
 
-#: utils/ncurses.cpp:594
+#: utils/ncurses.cpp:586
 #, c-format
 msgid "Cannot open file %ls for reading"
 msgstr "Impossible d'ouvrir le fichier %ls en lecture"
 
-#: utils/ncurses.cpp:602
+#: utils/ncurses.cpp:594
 #, c-format
 msgid "Invalid saved game"
 msgstr "Partie sauvée invalide"
 
-#: utils/ncurses.cpp:606
+#: utils/ncurses.cpp:598
 #, c-format
 msgid "Game loaded"
 msgstr "Partie chargée"
 
-#: utils/ncurses.cpp:622
+#: utils/ncurses.cpp:613
 msgid "Pass your turn"
 msgstr "Passer son tour"
 
-#: utils/ncurses.cpp:623
+#: utils/ncurses.cpp:614
 msgid "Enter the letters to change:"
 msgstr "Entrer les lettres à changer:"
 
-#: utils/ncurses.cpp:632
+#: utils/ncurses.cpp:623
 msgid "Cannot pass the turn"
 msgstr "Impossible de passer le tour"
 
-#: utils/ncurses.cpp:643
+#: utils/ncurses.cpp:633
 msgid "Set rack"
 msgstr "Choix du tirage"
 
-#: utils/ncurses.cpp:644
+#: utils/ncurses.cpp:634
 msgid "Enter the new letters:"
 msgstr "Entrer les nouvelles lettres:"
 
-#: utils/ncurses.cpp:653
+#: utils/ncurses.cpp:643
 msgid "Cannot take these letters from the bag"
 msgstr "Impossible de retirer ces lettres du sac"
 
-#: utils/ncurses.cpp:1013
+#: utils/ncurses.cpp:1037
 msgid "Training mode"
 msgstr "Mode entraînement"
 
-#: utils/ncurses.cpp:1015
+#: utils/ncurses.cpp:1039
 msgid "Free game mode"
 msgstr "Mode partie libre"
 
-#: utils/ncurses.cpp:1017
+#: utils/ncurses.cpp:1041
 msgid "Duplicate mode"
 msgstr "Mode duplicate"
 
-#: utils/ncurses.cpp:1020
+#: utils/ncurses.cpp:1044
 msgid "Joker game"
 msgstr "Partie joker"
 
-#: utils/ncurses.cpp:1021
+#: utils/ncurses.cpp:1045
 msgid "[h for help]"
 msgstr "[h pour l'aide]"
 

Index: utils/ncurses.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/ncurses.cpp,v
retrieving revision 1.22.2.8
retrieving revision 1.22.2.9
diff -u -b -r1.22.2.8 -r1.22.2.9
--- utils/ncurses.cpp   16 Dec 2007 15:58:44 -0000      1.22.2.8
+++ utils/ncurses.cpp   16 Dec 2007 18:20:55 -0000      1.22.2.9
@@ -193,8 +193,7 @@
     int y = lines - 1;
     if (error)
         wattron(win, COLOR_PAIR(COLOR_YELLOW));
-    mvwprintw(win, y, x, iMessage.c_str());
-    whline(win, ' ', cols - x - 1 - iMessage.size());
+    mvwprintw(win, y, x, truncOrPad(iMessage, cols).c_str());
     if (error)
         wattron(win, COLOR_PAIR(COLOR_WHITE));
 }
@@ -514,11 +513,6 @@
         {
             drawStatus(win, _("Incorrect or misplaced word"));
         }
-        else
-        {
-            // If everything went well, go back to the default view
-            setState(DEFAULT);
-        }
     }
     box.clear();
 }
@@ -540,9 +534,8 @@
             snprintf(s, 100, _("The word '%ls' exists"), word.c_str());
         else
             snprintf(s, 100, _("The word '%ls' does not exist"), word.c_str());
-        drawStatus(win, s);
+        drawStatus(win, s, false);
     }
-    m_state = DEFAULT;
     box.clear();
 }
 
@@ -572,7 +565,6 @@
         }
         drawStatus(win, s);
     }
-    m_state = DEFAULT;
     box.clear();
 }
 
@@ -611,7 +603,6 @@
         }
         drawStatus(win, s);
     }
-    m_state = DEFAULT;
     box.clear();
 }
 
@@ -632,7 +623,6 @@
             drawStatus(win, _("Cannot pass the turn"));
         }
     }
-    m_state = DEFAULT;
     box.clear();
 }
 
@@ -787,15 +777,30 @@
     switch (iKey)
     {
         case '*':
+            if (m_state != DEFAULT)
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             iGame.setRackRandom(false, Game::RACK_ALL);
             return 1;
 
         case '+':
+            if (m_state != DEFAULT)
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             iGame.setRackRandom(false, Game::RACK_NEW);
             return 1;
 
         case 't':
         case 'T':
+            if (m_state != DEFAULT)
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             setRack(m_win, 22, 10, iGame);
             return 1;
 
@@ -842,8 +847,11 @@
 
 int CursesIntf::handleKey(int iKey)
 {
-    if (m_state == DEFAULT)
-    {
+    // Remove any error message in the status line
+    if (m_state == DEFAULT || m_state == RESULTS)
+        drawStatus(m_win, "", false);
+
+    // Handle game-specific keys
         int res;
         if (m_game->getMode() == Game::kTRAINING)
         {
@@ -857,11 +865,11 @@
         {
             res = handleKeyForGame(iKey, (FreeGame&)*m_game);
         }
-
         if (res != 2)
             return res;
-    }
-    else // m_state is in {HELP, RESULTS, HISTORY, BAG}
+
+    // Handle scrolling keys
+    if (m_state != DEFAULT)
     {
         switch (iKey)
         {
@@ -880,6 +888,7 @@
         }
     }
 
+    // Handle other global keys
     switch (iKey)
     {
         // Toggle help
@@ -907,7 +916,10 @@
         case 'r':
         case 'R':
             if (m_game->getMode() != Game::kTRAINING)
+            {
+                beep();
                 return 0;
+            }
             if (m_state == RESULTS)
                 setState(DEFAULT);
             else
@@ -931,51 +943,63 @@
             m_showDots = !m_showDots;
             return 1;
 
+        // Ctrl-L should clear and redraw the screen
+        case 0x0c:
+            clear();
+            // Force the re-definition of the current box
+            setState(m_state);
+            return 1;
+
         // Check a word in the dictionary
         case 'd':
         case 'D':
-            if (m_state != DEFAULT)
-                return 0;
+            if (m_state != DEFAULT && m_state != RESULTS)
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             checkWord(m_win, 22, 10);
-            return 1;
+            return 0;
 
         // Play a word
         case 'j':
         case 'J':
             if (m_state != DEFAULT && m_state != RESULTS)
-                return 0;
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             playWord(m_win, 22, 10);
             return 1;
 
-        // Ctrl-L should clear and redraw the screen
-        case 0x0c:
-            clear();
-            // Force the re-definition of the current box
-            setState(m_state);
-            return 1;
-
         case 'l':
         case 'L':
             if (m_state != DEFAULT)
-                return 0;
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             loadGame(m_win, 22, 10);
             return 1;
 
         case 's':
         case 'S':
             if (m_state != DEFAULT)
-                return 0;
+            {
+                setState(DEFAULT);
+                redraw(m_win);
+            }
             saveGame(m_win, 22, 10);
-            return 1;
+            return 0;
 
         // Quit
         case 'q':
         case 'Q':
-        //case 0x1b: // Esc
             m_dying = true;
             return 0;
 
         default:
+            beep();
             return 0;
     }
 }
@@ -1019,8 +1043,11 @@
     if (m_game->getVariant() == Game::kJOKER)
         variant = string(" - ") + _("Joker game");
     string title = "Eliot (" + mode + variant + ") " + _("[h for help]");
-    mvwprintw(win, 0, 0, title.c_str());
-    whline(win, ' ', COLS - title.size());
+
+    int lines;
+    int cols;
+    getmaxyx(m_win, lines, cols);
+    mvwprintw(win, 0, 0, truncOrPad(title, cols).c_str());
     attroff(A_REVERSE);
 
     wrefresh(win);
@@ -1069,7 +1096,7 @@
         init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
         init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
         init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
-        init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
+        init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_RED);
 
         init_pair(COLOR_BLUE, COLOR_BLACK, COLOR_BLUE);
         init_pair(COLOR_CYAN, COLOR_BLACK, COLOR_CYAN);

Index: utils/ncurses.h
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/ncurses.h,v
retrieving revision 1.6.4.2
retrieving revision 1.6.4.3
diff -u -b -r1.6.4.2 -r1.6.4.3
--- utils/ncurses.h     16 Dec 2007 15:58:44 -0000      1.6.4.2
+++ utils/ncurses.h     16 Dec 2007 18:20:55 -0000      1.6.4.3
@@ -155,7 +155,7 @@
     // Indicate that the '?' character is accepted
     static const unsigned int kJOKER = 1 << 0;
     // Accept characters for a file name
-    static const unsigned int kFILENAME = 1 << 0;
+    static const unsigned int kFILENAME = 1 << 1;
 
     // Handle the key in Training mode
     int handleKeyForGame(int iKey, Training &iGame);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]