diff --git a/TODO b/TODO index 294c0ea..5357021 100644 --- a/TODO +++ b/TODO @@ -9,7 +9,6 @@ Can type a letter with a comboboxes Windows version Need packaging Better build system for wxFreeChart (hacked by me) -Category color/font Shared accounts Documentation (en) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 0b69222..5fbb212 100644 Binary files a/ressources/po/french.mo and b/ressources/po/french.mo differ diff --git a/ressources/po/french.po b/ressources/po/french.po index abbf444..bf75f79 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-05 12:06+0200\n" +"POT-Creation-Date: 2010-09-08 10:57+0200\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -19,16 +19,16 @@ msgstr "" # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#: src/view/PreferencesPanel.cpp:582 +#: src/view/PreferencesPanel.cpp:638 #: src/view/StatsPanel.cpp:282 msgid " - " msgstr " - " -#: src/view/PreferencesPanel.cpp:367 -#: src/view/PreferencesPanel.cpp:386 -#: src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:540 +#: src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:402 +#: src/view/PreferencesPanel.cpp:532 +#: src/view/PreferencesPanel.cpp:551 +#: src/view/PreferencesPanel.cpp:596 #: src/view/UsersDialog.cpp:116 msgid " already exists" msgstr " existe déjà " @@ -37,18 +37,22 @@ msgstr " existe déjà " msgid " entries found" msgstr " entrées trouvées" -#: src/model/Database.cpp:141 +#: src/model/Database.cpp:147 msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:994 +#: src/view/AccountPanel.cpp:996 msgid " operations ?" msgstr " opérations ?" -#: src/view/PreferencesPanel.cpp:589 +#: src/view/PreferencesPanel.cpp:645 msgid " profil ?" msgstr " profil ?" +#: src/model/Database.cpp:136 +msgid "!! Warning !! If there was a bug, the old database will be suppressed !" +msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" + #: src/view/SearchPanel.cpp:221 msgid "1 entry found" msgstr "1 entrée trouvée" @@ -57,13 +61,13 @@ msgstr "1 entrée trouvée" msgid "About" msgstr "A propos" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 #: src/view/SearchPanel.cpp:89 msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:367 -#: src/view/PreferencesPanel.cpp:386 +#: src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:402 msgid "Account " msgstr "Le compte " @@ -88,19 +92,19 @@ msgstr "Montant min" msgid "Amount to" msgstr "Montant max" -#: src/view/PreferencesPanel.cpp:348 -#: src/view/PreferencesPanel.cpp:589 -#: src/view/AccountPanel.cpp:989 +#: src/view/PreferencesPanel.cpp:364 +#: src/view/PreferencesPanel.cpp:645 +#: src/view/AccountPanel.cpp:991 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/PreferencesPanel.cpp:457 -#: src/view/AccountPanel.cpp:673 +#: src/view/PreferencesPanel.cpp:513 +#: src/view/AccountPanel.cpp:675 #: src/view/SearchPanel.cpp:350 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" -#: src/view/PreferencesPanel.cpp:263 +#: src/view/PreferencesPanel.cpp:279 msgid "Ascending" msgstr "Croissant" @@ -114,13 +118,13 @@ msgstr "Annuler" msgid "Categories" msgstr "Catégories" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 #: src/view/SearchPanel.cpp:88 msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:532 +#: src/view/PreferencesPanel.cpp:551 msgid "Category " msgstr "Catégorie" @@ -144,7 +148,7 @@ msgstr "Changer d'utilisateur" msgid "Check mode" msgstr "Mode rapprochement" -#: src/view/PreferencesPanel.cpp:215 +#: src/view/PreferencesPanel.cpp:220 msgid "Color" msgstr "Couleur" @@ -157,15 +161,15 @@ msgstr "Confirmer le mot de passe" msgid "Cost repartition" msgstr "Répartition des coûts" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:187 +#: src/view/AccountPanel.cpp:189 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:188 +#: src/view/AccountPanel.cpp:190 msgid "Cur Debit" msgstr "Cur Débit" @@ -173,7 +177,7 @@ msgstr "Cur Débit" msgid "Current value" msgstr "Valeur courante" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Date" msgstr "Date" @@ -185,7 +189,7 @@ msgstr "Date min" msgid "Date to" msgstr "Date max" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Debit" msgstr "Débit" @@ -194,16 +198,16 @@ msgid "Default" msgstr "Défaut" #: src/view/PreferencesPanel.cpp:167 -#: src/view/PreferencesPanel.cpp:217 -#: src/view/AccountPanel.cpp:848 +#: src/view/PreferencesPanel.cpp:222 +#: src/view/AccountPanel.cpp:850 msgid "Delete" msgstr "Supprimer" -#: src/view/PreferencesPanel.cpp:264 +#: src/view/PreferencesPanel.cpp:280 msgid "Descending" msgstr "Décroissant" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 #: src/view/SearchPanel.cpp:85 msgid "Description" msgstr "Description" @@ -213,19 +217,19 @@ msgstr "Description" #: src/model/Database.cpp:95 #: src/model/Database.cpp:102 #: src/model/Database.cpp:120 -#: src/model/Database.cpp:141 -#: src/model/Database.cpp:149 -#: src/model/Database.cpp:170 +#: src/model/Database.cpp:147 +#: src/model/Database.cpp:155 +#: src/model/Database.cpp:176 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/PreferencesPanel.cpp:344 -#: src/view/PreferencesPanel.cpp:367 -#: src/view/PreferencesPanel.cpp:386 -#: src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:534 -#: src/view/PreferencesPanel.cpp:540 -#: src/view/AccountPanel.cpp:985 +#: src/view/PreferencesPanel.cpp:360 +#: src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:402 +#: src/view/PreferencesPanel.cpp:532 +#: src/view/PreferencesPanel.cpp:551 +#: src/view/PreferencesPanel.cpp:590 +#: src/view/PreferencesPanel.cpp:596 +#: src/view/AccountPanel.cpp:987 #: src/view/UsersDialog.cpp:88 #: src/view/UsersDialog.cpp:116 #: src/view/SearchPanel.cpp:139 @@ -235,7 +239,7 @@ msgstr "Description" msgid "Error" msgstr "Erreur" -#: src/model/Database.cpp:170 +#: src/model/Database.cpp:176 msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" @@ -243,13 +247,13 @@ msgstr "Erreur durant la création de la base de données initiale" msgid "Final value" msgstr "Valeur finale" -#: src/model/Database.cpp:305 -#: src/controller/KissCount.cpp:276 -#: src/view/grid/GridAccount.cpp:136 +#: src/model/Database.cpp:311 +#: src/controller/KissCount.cpp:278 +#: src/view/grid/GridAccount.cpp:143 msgid "Fix" msgstr "Fixe" -#: src/view/PreferencesPanel.cpp:216 +#: src/view/PreferencesPanel.cpp:221 msgid "Font" msgstr "Police" @@ -262,15 +266,15 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:845 +#: src/view/AccountPanel.cpp:847 msgid "Generate month" msgstr "Générer mois" -#: src/controller/KissCount.cpp:278 +#: src/controller/KissCount.cpp:280 msgid "Groceries" msgstr "Courses" -#: src/controller/KissCount.cpp:280 +#: src/controller/KissCount.cpp:282 msgid "Hobbies" msgstr "Loisirs" @@ -294,7 +298,7 @@ msgstr "Montant max invalide" msgid "Invalid date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:534 +#: src/view/PreferencesPanel.cpp:590 msgid "Invalid name" msgstr "Nom invalide" @@ -310,11 +314,11 @@ msgstr "Mot de passe invalide" msgid "Invalide date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:344 +#: src/view/PreferencesPanel.cpp:360 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:985 +#: src/view/AccountPanel.cpp:987 msgid "It must be at least one month !" msgstr "Il doit rester au mois un mois" @@ -322,8 +326,8 @@ msgstr "Il doit rester au mois un mois" msgid "Kill me" msgstr "Kill me" -#: src/view/PreferencesPanel.cpp:574 -#: src/view/PreferencesPanel.cpp:577 +#: src/view/PreferencesPanel.cpp:630 +#: src/view/PreferencesPanel.cpp:633 #: src/view/StatsPanel.cpp:297 msgid "KissCount" msgstr "KissCount" @@ -332,21 +336,21 @@ msgstr "KissCount" msgid "Language" msgstr "Langue" -#: src/view/PreferencesPanel.cpp:577 +#: src/view/PreferencesPanel.cpp:633 msgid "Language not changed" msgstr "Langue non changée" -#: src/view/PreferencesPanel.cpp:574 +#: src/view/PreferencesPanel.cpp:630 msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" #: src/view/PreferencesPanel.cpp:66 #: src/view/PreferencesPanel.cpp:163 -#: src/view/PreferencesPanel.cpp:214 +#: src/view/PreferencesPanel.cpp:219 msgid "Name" msgstr "Nom" -#: src/view/PreferencesPanel.cpp:546 +#: src/view/PreferencesPanel.cpp:602 msgid "Name changed" msgstr "Nom changé" @@ -360,8 +364,12 @@ msgid "New password " msgstr "Nouveau mot de passe" #: src/model/Database.cpp:135 -msgid "No database found, creating a new one" -msgstr "Aucune base de données trouvée, création d'une nouvelle" +msgid "" +"No database found, would you like to create a new one ?\n" +"\n" +msgstr "" +"Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" +"\n" #: src/view/SearchPanel.cpp:224 msgid "No entry found" @@ -381,7 +389,7 @@ msgstr "OK" msgid "Old password " msgstr "Ancien mot de passe" -#: src/controller/KissCount.cpp:282 +#: src/controller/KissCount.cpp:284 msgid "Operating exepense" msgstr "Frais de fonctionnement" @@ -393,7 +401,7 @@ msgstr "Ordre des opérations" msgid "Operations" msgstr "Opérations" -#: src/controller/KissCount.cpp:286 +#: src/controller/KissCount.cpp:288 msgid "Other" msgstr "Autres" @@ -419,8 +427,8 @@ msgstr "" msgid "Please retype new password" msgstr "Re entrez le mot de passe" -#: src/view/PreferencesPanel.cpp:548 -#: src/view/PreferencesPanel.cpp:582 +#: src/view/PreferencesPanel.cpp:604 +#: src/view/PreferencesPanel.cpp:638 #: src/view/ButtonPanel.cpp:72 msgid "Preferences" msgstr "Préférences" @@ -437,7 +445,7 @@ msgstr "Quitter" msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:189 +#: src/view/AccountPanel.cpp:191 msgid "Remains" msgstr "Restant" @@ -469,28 +477,28 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:171 +#: src/view/AccountPanel.cpp:173 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:172 +#: src/view/AccountPanel.cpp:174 msgid "Total Debit" msgstr "Total Débit" #: src/model/Database.cpp:95 #: src/model/Database.cpp:102 #: src/model/Database.cpp:120 -#: src/model/Database.cpp:149 +#: src/model/Database.cpp:155 msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" -#: src/controller/KissCount.cpp:284 +#: src/controller/KissCount.cpp:286 msgid "Unexpected" msgstr "Exceptionnel" #: src/model/User.cpp:46 #: src/model/User.cpp:60 -#: src/model/User.cpp:80 +#: src/model/User.cpp:91 msgid "Unknown" msgstr "Inconnu" @@ -502,7 +510,7 @@ msgstr "La mise à jour à échouée !\n" msgid "User" msgstr "Utilisateur" -#: src/view/PreferencesPanel.cpp:540 +#: src/view/PreferencesPanel.cpp:596 #: src/view/UsersDialog.cpp:38 #: src/view/UsersDialog.cpp:116 msgid "User " diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 480d59d..1f86cdb 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-05 12:06+0200\n" +"POT-Creation-Date: 2010-09-08 10:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,13 +17,13 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/PreferencesPanel.cpp:582 src/view/StatsPanel.cpp:282 +#: src/view/PreferencesPanel.cpp:638 src/view/StatsPanel.cpp:282 msgid " - " msgstr "" -#: src/view/PreferencesPanel.cpp:367 src/view/PreferencesPanel.cpp:386 -#: src/view/PreferencesPanel.cpp:476 src/view/PreferencesPanel.cpp:495 -#: src/view/PreferencesPanel.cpp:540 src/view/UsersDialog.cpp:116 +#: src/view/PreferencesPanel.cpp:383 src/view/PreferencesPanel.cpp:402 +#: src/view/PreferencesPanel.cpp:532 src/view/PreferencesPanel.cpp:551 +#: src/view/PreferencesPanel.cpp:596 src/view/UsersDialog.cpp:116 msgid " already exists" msgstr "" @@ -31,18 +31,22 @@ msgstr "" msgid " entries found" msgstr "" -#: src/model/Database.cpp:141 +#: src/model/Database.cpp:147 msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:994 +#: src/view/AccountPanel.cpp:996 msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:589 +#: src/view/PreferencesPanel.cpp:645 msgid " profil ?" msgstr "" +#: src/model/Database.cpp:136 +msgid "!! Warning !! If there was a bug, the old database will be suppressed !" +msgstr "" + #: src/view/SearchPanel.cpp:221 msgid "1 entry found" msgstr "" @@ -51,11 +55,11 @@ msgstr "" msgid "About" msgstr "" -#: src/view/grid/GridAccount.cpp:55 src/view/SearchPanel.cpp:89 +#: src/view/grid/GridAccount.cpp:60 src/view/SearchPanel.cpp:89 msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:367 src/view/PreferencesPanel.cpp:386 +#: src/view/PreferencesPanel.cpp:383 src/view/PreferencesPanel.cpp:402 msgid "Account " msgstr "" @@ -79,17 +83,17 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:348 src/view/PreferencesPanel.cpp:589 -#: src/view/AccountPanel.cpp:989 +#: src/view/PreferencesPanel.cpp:364 src/view/PreferencesPanel.cpp:645 +#: src/view/AccountPanel.cpp:991 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:457 src/view/AccountPanel.cpp:673 +#: src/view/PreferencesPanel.cpp:513 src/view/AccountPanel.cpp:675 #: src/view/SearchPanel.cpp:350 msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/PreferencesPanel.cpp:263 +#: src/view/PreferencesPanel.cpp:279 msgid "Ascending" msgstr "" @@ -102,11 +106,11 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/grid/GridAccount.cpp:55 src/view/SearchPanel.cpp:88 +#: src/view/grid/GridAccount.cpp:60 src/view/SearchPanel.cpp:88 msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:476 src/view/PreferencesPanel.cpp:495 +#: src/view/PreferencesPanel.cpp:532 src/view/PreferencesPanel.cpp:551 msgid "Category " msgstr "" @@ -130,7 +134,7 @@ msgstr "" msgid "Check mode" msgstr "" -#: src/view/PreferencesPanel.cpp:215 +#: src/view/PreferencesPanel.cpp:220 msgid "Color" msgstr "" @@ -142,15 +146,15 @@ msgstr "" msgid "Cost repartition" msgstr "" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:187 +#: src/view/AccountPanel.cpp:189 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:188 +#: src/view/AccountPanel.cpp:190 msgid "Cur Debit" msgstr "" @@ -158,7 +162,7 @@ msgstr "" msgid "Current value" msgstr "" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Date" msgstr "" @@ -170,7 +174,7 @@ msgstr "" msgid "Date to" msgstr "" -#: src/view/grid/GridAccount.cpp:55 +#: src/view/grid/GridAccount.cpp:60 msgid "Debit" msgstr "" @@ -178,35 +182,35 @@ msgstr "" msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:167 src/view/PreferencesPanel.cpp:217 -#: src/view/AccountPanel.cpp:848 +#: src/view/PreferencesPanel.cpp:167 src/view/PreferencesPanel.cpp:222 +#: src/view/AccountPanel.cpp:850 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:264 +#: src/view/PreferencesPanel.cpp:280 msgid "Descending" msgstr "" -#: src/view/grid/GridAccount.cpp:55 src/view/SearchPanel.cpp:85 +#: src/view/grid/GridAccount.cpp:60 src/view/SearchPanel.cpp:85 msgid "Description" msgstr "" #: src/model/Database.cpp:38 src/model/Database.cpp:55 #: src/model/Database.cpp:95 src/model/Database.cpp:102 -#: src/model/Database.cpp:120 src/model/Database.cpp:141 -#: src/model/Database.cpp:149 src/model/Database.cpp:170 +#: src/model/Database.cpp:120 src/model/Database.cpp:147 +#: src/model/Database.cpp:155 src/model/Database.cpp:176 #: src/view/PasswordDialog.cpp:72 src/view/PasswordDialog.cpp:78 -#: src/view/PreferencesPanel.cpp:344 src/view/PreferencesPanel.cpp:367 -#: src/view/PreferencesPanel.cpp:386 src/view/PreferencesPanel.cpp:476 -#: src/view/PreferencesPanel.cpp:495 src/view/PreferencesPanel.cpp:534 -#: src/view/PreferencesPanel.cpp:540 src/view/AccountPanel.cpp:985 +#: src/view/PreferencesPanel.cpp:360 src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:402 src/view/PreferencesPanel.cpp:532 +#: src/view/PreferencesPanel.cpp:551 src/view/PreferencesPanel.cpp:590 +#: src/view/PreferencesPanel.cpp:596 src/view/AccountPanel.cpp:987 #: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:116 #: src/view/SearchPanel.cpp:139 src/view/SearchPanel.cpp:149 #: src/view/SearchPanel.cpp:163 src/view/SearchPanel.cpp:174 msgid "Error" msgstr "" -#: src/model/Database.cpp:170 +#: src/model/Database.cpp:176 msgid "Error creating original database" msgstr "" @@ -214,12 +218,12 @@ msgstr "" msgid "Final value" msgstr "" -#: src/model/Database.cpp:305 src/controller/KissCount.cpp:276 -#: src/view/grid/GridAccount.cpp:136 +#: src/model/Database.cpp:311 src/controller/KissCount.cpp:278 +#: src/view/grid/GridAccount.cpp:143 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:216 +#: src/view/PreferencesPanel.cpp:221 msgid "Font" msgstr "" @@ -231,15 +235,15 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:845 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:847 msgid "Generate month" msgstr "" -#: src/controller/KissCount.cpp:278 +#: src/controller/KissCount.cpp:280 msgid "Groceries" msgstr "" -#: src/controller/KissCount.cpp:280 +#: src/controller/KissCount.cpp:282 msgid "Hobbies" msgstr "" @@ -263,7 +267,7 @@ msgstr "" msgid "Invalid date range" msgstr "" -#: src/view/PreferencesPanel.cpp:534 +#: src/view/PreferencesPanel.cpp:590 msgid "Invalid name" msgstr "" @@ -279,11 +283,11 @@ msgstr "" msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:344 +#: src/view/PreferencesPanel.cpp:360 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:985 +#: src/view/AccountPanel.cpp:987 msgid "It must be at least one month !" msgstr "" @@ -291,7 +295,7 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/PreferencesPanel.cpp:574 src/view/PreferencesPanel.cpp:577 +#: src/view/PreferencesPanel.cpp:630 src/view/PreferencesPanel.cpp:633 #: src/view/StatsPanel.cpp:297 msgid "KissCount" msgstr "" @@ -300,20 +304,20 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:577 +#: src/view/PreferencesPanel.cpp:633 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:574 +#: src/view/PreferencesPanel.cpp:630 msgid "Language successfully changed, please go to another panel" msgstr "" #: src/view/PreferencesPanel.cpp:66 src/view/PreferencesPanel.cpp:163 -#: src/view/PreferencesPanel.cpp:214 +#: src/view/PreferencesPanel.cpp:219 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:546 +#: src/view/PreferencesPanel.cpp:602 msgid "Name changed" msgstr "" @@ -326,7 +330,9 @@ msgid "New password " msgstr "" #: src/model/Database.cpp:135 -msgid "No database found, creating a new one" +msgid "" +"No database found, would you like to create a new one ?\n" +"\n" msgstr "" #: src/view/SearchPanel.cpp:224 @@ -346,7 +352,7 @@ msgstr "" msgid "Old password " msgstr "" -#: src/controller/KissCount.cpp:282 +#: src/controller/KissCount.cpp:284 msgid "Operating exepense" msgstr "" @@ -358,7 +364,7 @@ msgstr "" msgid "Operations" msgstr "" -#: src/controller/KissCount.cpp:286 +#: src/controller/KissCount.cpp:288 msgid "Other" msgstr "" @@ -381,7 +387,7 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:548 src/view/PreferencesPanel.cpp:582 +#: src/view/PreferencesPanel.cpp:604 src/view/PreferencesPanel.cpp:638 #: src/view/ButtonPanel.cpp:72 msgid "Preferences" msgstr "" @@ -398,7 +404,7 @@ msgstr "" msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:189 +#: src/view/AccountPanel.cpp:191 msgid "Remains" msgstr "" @@ -427,24 +433,24 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:171 +#: src/view/AccountPanel.cpp:173 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:172 +#: src/view/AccountPanel.cpp:174 msgid "Total Debit" msgstr "" #: src/model/Database.cpp:95 src/model/Database.cpp:102 -#: src/model/Database.cpp:120 src/model/Database.cpp:149 +#: src/model/Database.cpp:120 src/model/Database.cpp:155 msgid "Unable to open Database" msgstr "" -#: src/controller/KissCount.cpp:284 +#: src/controller/KissCount.cpp:286 msgid "Unexpected" msgstr "" -#: src/model/User.cpp:46 src/model/User.cpp:60 src/model/User.cpp:80 +#: src/model/User.cpp:46 src/model/User.cpp:60 src/model/User.cpp:91 msgid "Unknown" msgstr "" @@ -456,7 +462,7 @@ msgstr "" msgid "User" msgstr "" -#: src/view/PreferencesPanel.cpp:540 src/view/UsersDialog.cpp:38 +#: src/view/PreferencesPanel.cpp:596 src/view/UsersDialog.cpp:38 #: src/view/UsersDialog.cpp:116 msgid "User " msgstr "" diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index e72b11e..d586405 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -31,7 +31,7 @@ KissCount::KissCount(const char* bdd_filename) : _user(NULL) try { - _db = new Database(bdd_filename); + _db = new Database(bdd_filename, this); } catch (std::string s) { @@ -193,6 +193,7 @@ void KissCount::UpdateCategory(Category& category) if (_user->_categories[i].id == category.id) { _user->_categories[i] = category; + _user->_categoriesFonts[i] = ExtractFont(category.font); break; } } @@ -236,6 +237,7 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year op = *it; op.month = monthTo; op.year = yearTo; + op.checked = false; op.id = AddOperation(op); (*_user->_operations[yearTo])[monthTo].push_back(op); } @@ -372,3 +374,59 @@ std::map* KissCount::GetNotChecked(int month, int year) { return _db->GetNotChecked(_user, month, year); } + +wxFont KissCount::ExtractFont(wxString strFont) +{ + long int pos, pointSize, family, style, weight; + wxString faceName; + + if (!strFont.Length()) + { + DEFAULT_FONT(f); + return f; + } + + pos = strFont.Find(wxT(";")); + + if (pos != -1) + { + strFont.SubString(0, pos).ToLong(&pointSize); + strFont = strFont.SubString(pos+1, strFont.Length()); + } + + pos = strFont.Find(wxT(";")); + + if (pos != -1) + { + strFont.SubString(0, pos).ToLong(&family); + strFont = strFont.SubString(pos+1, strFont.Length()); + } + + pos = strFont.Find(wxT(";")); + + if (pos != -1) + { + strFont.SubString(0, pos).ToLong(&style); + strFont = strFont.SubString(pos+1, strFont.Length()); + } + + pos = strFont.Find(wxT(";")); + + if (pos != -1) + { + strFont.SubString(0, pos).ToLong(&weight); + strFont = strFont.SubString(pos+1, strFont.Length()); + } + + faceName = strFont; + + return wxFont(pointSize, family, style, weight, false, faceName) ; +} + +wxString KissCount::CompactFont(const wxFont& font) +{ + wxString res = wxString::Format(wxT("%d;%d;%d;%d;"), font.GetPointSize(), font.GetFamily(), font.GetStyle(), font.GetWeight()); + res += font.GetFaceName(); + + return res; +} diff --git a/src/controller/KissCount.h b/src/controller/KissCount.h index bdb88f1..9c162ef 100644 --- a/src/controller/KissCount.h +++ b/src/controller/KissCount.h @@ -30,6 +30,8 @@ #define APP_VERSION "v0.1 beta" class wxUI; +class Database; + class KissCount { public: @@ -82,6 +84,9 @@ public: std::map* GetNotChecked(int month, int year); + wxFont ExtractFont(wxString strFont); + wxString CompactFont(const wxFont& font); + private: wxUI* _wxUI; Database* _db; diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 41ff681..06d6315 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -82,7 +82,7 @@ static inline wxString DoubleToString(double d) return res; } -Database::Database(const char* filename) +Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) { std::ifstream bdd_file; @@ -132,7 +132,13 @@ void Database::CreateDatabase() std::string line; wxString wxline; - wxMessageBox(_("No database found, creating a new one"), wxT("KissCount"), wxICON_EXCLAMATION | wxOK ); + wxString message = _("No database found, would you like to create a new one ?\n\n"); + message += _("!! Warning !! If there was a bug, the old database will be suppressed !"); + + wxMessageDialog dialog(NULL, message, wxT("KissCount"), wxYES_NO); + + if (dialog.ShowModal() == wxID_NO) + throw std::string("No database") ; init_script.open(INIT_SCRIPT); @@ -306,6 +312,7 @@ User* Database::LoadUser(const wxString& name) user->_categories.push_back(category); else user->_categories.insert(user->_categories.begin(), category); + user->_categoriesFonts.push_back(_kiss->ExtractFont(category.font)); } set.Finalize(); diff --git a/src/model/Database.h b/src/model/Database.h index dbff009..760f597 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -28,14 +28,17 @@ #include #include "model.h" +#include "../controller/KissCount.h" #define BDD_FILE "kc.bdd" #define INIT_SCRIPT "init.sql" +class KissCount; + class Database { public: - Database(const char* filename); + Database(const char* filename, KissCount* kiss); std::list GetUsers(); bool IsValidUser(const wxString& user, const wxString& password); @@ -81,6 +84,7 @@ public: std::map* GetNotChecked(User* user, int month, int year); private: + KissCount* _kiss; wxSQLite3Database _db; void CreateDatabase(); diff --git a/src/model/User.cpp b/src/model/User.cpp index f7f3048..92ba34e 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -70,6 +70,17 @@ wxString User::GetCategoryId(wxString& catName) return wxT("0") ; } +const wxFont& User::GetCategoryFont(wxString& catId) +{ + wxFont f; + + for (unsigned int i=0; i<_categories.size(); i++) + if (_categories[i].id == catId) + return _categoriesFonts[i]; + + return f; +} + wxString User::GetAccountName(const wxString& accountId) { std::vector::iterator it; diff --git a/src/model/User.h b/src/model/User.h index 570e8d1..00b709c 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -40,11 +40,13 @@ public: std::vector _accounts; std::map >* > _operations; std::vector _categories; + std::vector _categoriesFonts; std::map _preferences; Category GetCategory(wxString& catId); wxString GetCategoryName(wxString& catId); wxString GetCategoryId(wxString& catName); + const wxFont& GetCategoryFont(wxString& catId); wxString GetAccountName(const wxString& accountId); wxString GetAccountId(wxString& accountName); int GetCategoriesNumber(); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 02e0a70..ffaa3b8 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -117,6 +117,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(* _checkCheckMode = new wxCheckBox(this, CHECK_MODE_ID, _("Check mode")); + _tree.SetIndent(5); + hbox->Add(&_tree, 0); hbox2->Add(_accountsGrid, 0); hbox2->Add(_calendar, 0); diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 9ce5245..8c55dd2 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -201,12 +201,17 @@ void PreferencesPanel::InitAccounts(User* user) _categoriesGrid->SetCellBackgroundColour(row, i, color); \ } +#define SET_ROW_FONT(row, font) for(int i=0; iSetCellFont(row, i, font); \ + } + void PreferencesPanel::InitCategories(User* user) { std::vector::iterator it; int curLine = 0; DEFAULT_FONT(font); - + _categoriesGrid->CreateGrid(0, NUMBER_COLS_CATEGORY); _categoriesGrid->SetRowLabelSize(0); _categoriesGrid->SetDefaultCellFont(font); @@ -228,9 +233,20 @@ void PreferencesPanel::InitCategories(User* user) _categoriesGrid->SetCellEditor(curLine, CATEGORY_DELETE, new wxGridCellBoolEditor ()); } + _categoriesGrid->SetCellRenderer(curLine, CATEGORY_COLOR, new wxGridCellButtonRenderer (wxT("..."))); + _categoriesGrid->SetCellRenderer(curLine, CATEGORY_FONT, new wxGridCellButtonRenderer (wxT("..."))); + _categoriesGrid->SetCellEditor(curLine, CATEGORY_COLOR, new wxGridCellButtonEditor (wxT("..."))); + _categoriesGrid->SetCellEditor(curLine, CATEGORY_FONT, new wxGridCellButtonEditor (wxT("..."))); + _categoriesGrid->SetCellAlignment(curLine, CATEGORY_COLOR, wxALIGN_CENTRE, wxALIGN_CENTRE); _categoriesGrid->SetCellAlignment(curLine, CATEGORY_FONT, wxALIGN_CENTRE, wxALIGN_CENTRE); _categoriesGrid->SetCellAlignment(curLine, CATEGORY_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); + + if (it->font.Length()) + { + wxFont font = user->GetCategoryFont(it->id); + SET_ROW_FONT(curLine, font); + } } _categoriesGrid->SetReadOnly(0, CATEGORY_NAME, true); @@ -437,6 +453,46 @@ void PreferencesPanel::OnCategoryModified(wxGridEvent& event) inModification = true; + if (event.GetCol() == CATEGORY_COLOR) + { + wxColourData color; + color.SetColour(wxColor(user->_categories[row].color)); + wxColourDialog dial(this, &color); + + if (dial.ShowModal() == wxID_OK) + { + user->_categories[row].color = dial.GetColourData().GetColour(); + _kiss->UpdateCategory(user->_categories[row]); + + SET_ROW_COLOR(row, user->_categories[row].color); + _wxUI->NeedReload(); + } + + inModification = false ; + return ; + } + + if (event.GetCol() == CATEGORY_FONT) + { + wxFontData font; + font.SetInitialFont(_kiss->ExtractFont(user->_categories[row].font)); + wxFontDialog dial(this, font); + + if (dial.ShowModal() == wxID_OK) + { + font = dial.GetFontData(); + + user->_categories[row].font = _kiss->CompactFont(font.GetChosenFont()); + _kiss->UpdateCategory(user->_categories[row]); + + SET_ROW_FONT(row, font.GetChosenFont()); + _wxUI->NeedReload(); + } + + inModification = false ; + return ; + } + value = _categoriesGrid->GetCellValue(row, CATEGORY_NAME); if (value.Length()) { diff --git a/src/view/PreferencesPanel.h b/src/view/PreferencesPanel.h index a743849..ffaf471 100644 --- a/src/view/PreferencesPanel.h +++ b/src/view/PreferencesPanel.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include "wxUI.h" diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 9d38d46..fab9501 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -24,6 +24,11 @@ SetCellBackgroundColour(row, i, color); \ } +#define SET_ROW_FONT(row, font) for(int i=0; iGetCategory(op->category); + SetCellEditor(line, DATE, new CalendarEditor(op->day, op->month, op->year)); description = op->description; UNESCAPE_CHARS(description); @@ -156,7 +165,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix, SetCellRenderer(line, CHECKED, new wxGridCellBoolRenderer ()); SetCellEditor(line, CHECKED, new wxGridCellFastBoolEditor ()); - color = user->GetCategory(op->category).color; + color = cat.color; if (op->checked) { @@ -168,6 +177,11 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix, } SET_ROW_COLOR(line, color); + if (cat.font.Length()) + { + font = user->GetCategoryFont(cat.id); + SET_ROW_FONT(line, font); + } } else { @@ -183,9 +197,13 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix, SetCellEditor(line, DATE, new CalendarEditor(0, curMonth, curYear)); if (fix) - SET_ROW_COLOR(line, OWN_YELLOW) - else - SET_ROW_COLOR(line, OWN_GREEN); + { + SET_ROW_COLOR(line, OWN_YELLOW); + } + else + { + SET_ROW_COLOR(line, OWN_GREEN); + } SetReadOnly(line, CHECKED, true); SetReadOnly(line, DELETE, true); @@ -196,6 +214,8 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix, SetCellAlignment(line, DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); SetCellAlignment(line, CHECKED, wxALIGN_CENTRE, wxALIGN_CENTRE); + AutoSizeRow(line); + Layout(); SetMinSize(GetMinSize()); } diff --git a/src/view/grid/wxGridCellButtonEditor.cpp b/src/view/grid/wxGridCellButtonEditor.cpp new file mode 100644 index 0000000..b1836a8 --- /dev/null +++ b/src/view/grid/wxGridCellButtonEditor.cpp @@ -0,0 +1,94 @@ +/* + Copyright 2010 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "wxGridCellButtonEditor.h" + +enum {BUTTON_ID = 1} ; + +// BEGIN_EVENT_TABLE(wxGridCellButtonEditor, wxEvtHandler) +// EVT_BUTTON(BUTTON_ID, wxGridCellButtonEditor::OnButton) +// END_EVENT_TABLE() + +wxGridCellButtonEditor::wxGridCellButtonEditor(const wxString& text) : _text(text), _button(NULL) +{} + +wxGridCellButtonEditor::~wxGridCellButtonEditor() +{ + if (_button) delete _button; +} + +wxGridCellEditor* wxGridCellButtonEditor::Clone () const +{ + return new wxGridCellButtonEditor(_text); +} + +void wxGridCellButtonEditor::BeginEdit (int row, int col, wxGrid *grid) +{ + _row = row; + _col = col; + _grid = grid; + + if (_grid) + { + wxGridEvent event (_grid->GetId(), wxEVT_GRID_CELL_CHANGE, this, _row, _col); + _grid->GetEventHandler()->AddPendingEvent(event); + } +} + +void wxGridCellButtonEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) +{ + if (_button) return; + _button = new wxButton(parent, id, _text); + _button->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxGridCellButtonEditor::OnButton), NULL, this); +} + +bool wxGridCellButtonEditor::EndEdit (int row, int col, /*const*/ wxGrid *grid/*, const wxString &oldval, wxString *newval*/) +{ + return false; +} + +void wxGridCellButtonEditor::ApplyEdit (int row, int col, wxGrid *grid) +{} + +void wxGridCellButtonEditor::Reset () +{} + +wxString wxGridCellButtonEditor::GetValue() const +{ + return wxT(""); +} + +void wxGridCellButtonEditor::SetSize (const wxRect &rect) +{ + if (_button) _button->SetSize(rect); +} + +void wxGridCellButtonEditor::Show (bool show, wxGridCellAttr *attr=NULL) +{ + if (_button) _button->Show(show); +} + +void wxGridCellButtonEditor::OnButton(wxCommandEvent& evt) +{ + if (_grid) + { + wxGridEvent event (_grid->GetId(), wxEVT_GRID_CELL_CHANGE, this, _row, _col); + _grid->GetEventHandler()->AddPendingEvent(event); + } +} diff --git a/src/view/grid/wxGridCellButtonEditor.h b/src/view/grid/wxGridCellButtonEditor.h new file mode 100644 index 0000000..d57f841 --- /dev/null +++ b/src/view/grid/wxGridCellButtonEditor.h @@ -0,0 +1,54 @@ +/* + Copyright 2010 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef WXGRIDCELLBUTTONEDITOR_H +#define WXGRIDCELLBUTTONEDITOR_H + +#include +#include +#include + +class wxGridCellButtonEditor : public wxGridCellEditor, public wxEvtHandler +{ +public: + wxGridCellButtonEditor(const wxString& text); + ~wxGridCellButtonEditor(); + + wxGridCellEditor* Clone () const; + + void BeginEdit (int row, int col, wxGrid *grid); + void Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler); + bool EndEdit (int row, int col, wxGrid *grid/*, const wxString &oldval, wxString *newval*/); + void ApplyEdit (int row, int col, wxGrid *grid); + void Reset () ; + wxString GetValue() const ; + void SetSize (const wxRect &rect); + void Show (bool show, wxGridCellAttr *attr); + + void OnButton(wxCommandEvent& event); +private: + wxString _text; + wxButton* _button; + int _row, _col; + wxGrid* _grid; + + /* DECLARE_EVENT_TABLE(); */ +}; + +#endif diff --git a/src/view/grid/wxGridCellButtonRenderer.cpp b/src/view/grid/wxGridCellButtonRenderer.cpp new file mode 100644 index 0000000..1278e63 --- /dev/null +++ b/src/view/grid/wxGridCellButtonRenderer.cpp @@ -0,0 +1,96 @@ +/* + Copyright 2010 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#include "wxGridCellButtonRenderer.h" + +wxGridCellButtonRenderer::wxGridCellButtonRenderer(const wxString& text) : _text(text) +{ + +} + +wxGridCellRenderer* wxGridCellButtonRenderer::Clone () const +{ + return new wxGridCellButtonRenderer(_text); +} + +void wxGridCellButtonRenderer::Draw (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &_rect, int row, int col, bool isSelected) +{ + wxRect rect = _rect; + wxCoord w, h, descent, external_leading; + + wxBrush originalBrush = dc.GetBrush(); + wxPen originalPen = dc.GetPen(); + + dc.SetPen(wxPen(*wxLIGHT_GREY)); + dc.SetBrush(wxBrush(grid.GetCellBackgroundColour(row, col))); + dc.DrawRectangle(rect); + + rect.x += 2 ; + rect.y += 2 ; + rect.width -= 6 ; + rect.height -= 6 ; + + dc.SetPen(wxPen(*wxWHITE)); + dc.DrawLine(rect.x, rect.y, rect.x + rect.width, rect.y); + dc.DrawLine(rect.x, rect.y, rect.x, rect.y + rect.height); + + dc.SetPen(wxPen(*wxBLACK)); + dc.DrawLine(rect.x, rect.y + rect.height, rect.x + rect.width + 1, rect.y + rect.height); + dc.DrawLine(rect.x + rect.width, rect.y, rect.x + rect.width, rect.y + rect.height); + + dc.SetPen(wxPen(wxColor(0x80, 0x80, 0x80))); + dc.DrawLine(rect.x + 1, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); + dc.DrawLine(rect.x + rect.width - 1, rect.y + 1, rect.x + rect.width - 1, rect.y + rect.height); + + rect.x += 1 ; + rect.y += 1 ; + rect.width -= 2 ; + rect.height -= 2 ; + + dc.SetPen(wxPen(*wxLIGHT_GREY)); + dc.SetBrush(wxBrush(*wxLIGHT_GREY)); + dc.DrawRectangle(rect); + + dc.GetTextExtent(_text, &w, &h, &descent, &external_leading); + + if (w < rect.width) + rect.x += (rect.width - w) / 2; + + if (h < rect.height) + rect.y += (rect.height - h) / 2; + + rect.y -= (external_leading + descent); + + dc.SetTextForeground(*wxBLACK); + // dc.SetTextBackground(wxColor(128, 128, 128, 255)); + dc.SetTextBackground(*wxLIGHT_GREY); + + dc.DrawText(_text, rect.x, rect.y); + + dc.SetBrush(originalBrush); + dc.SetPen(originalPen); +} + +wxSize wxGridCellButtonRenderer::GetBestSize (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) +{ + wxCoord w, h; + + dc.GetTextExtent(_text, &w, &h); + return wxSize(w+14, h+14); // (2 + 2 + 3) * 2 +} diff --git a/src/view/grid/wxGridCellButtonRenderer.h b/src/view/grid/wxGridCellButtonRenderer.h new file mode 100644 index 0000000..32ef204 --- /dev/null +++ b/src/view/grid/wxGridCellButtonRenderer.h @@ -0,0 +1,39 @@ +/* + Copyright 2010 Grégory Soutadé + + This file is part of KissCount. + + KissCount is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + KissCount is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with KissCount. If not, see . +*/ + +#ifndef WXGRIDCELLBUTTONRENDERER_H +#define WXGRIDCELLBUTTONRENDERER_H + +#include +#include + +class wxGridCellButtonRenderer : public wxGridCellRenderer +{ +public: + wxGridCellButtonRenderer(const wxString& text); + + virtual wxGridCellRenderer* Clone () const; + virtual void Draw (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected); + virtual wxSize GetBestSize (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col); + +private: + wxString _text; +}; + +#endif diff --git a/src/view/wxUI.h b/src/view/wxUI.h index 91e989d..b42684f 100644 --- a/src/view/wxUI.h +++ b/src/view/wxUI.h @@ -31,6 +31,8 @@ #include #include "grid/wxMyGrid.h" #include "grid/wxGridCellFastBoolEditor.h" +#include "grid/wxGridCellButtonRenderer.h" +#include "grid/wxGridCellButtonEditor.h" class KissCount; class ButtonPanel;