diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | po/fr.po | 203 | ||||
-rw-r--r-- | po/weechat.pot | 180 | ||||
-rw-r--r-- | src/common/command.c | 136 | ||||
-rw-r--r-- | src/common/completion.c | 53 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 297 | ||||
-rw-r--r-- | src/gui/gui.h | 11 | ||||
-rw-r--r-- | weechat/ChangeLog | 4 | ||||
-rw-r--r-- | weechat/TODO | 6 | ||||
-rw-r--r-- | weechat/po/fr.po | 203 | ||||
-rw-r--r-- | weechat/po/weechat.pot | 180 | ||||
-rw-r--r-- | weechat/src/common/command.c | 136 | ||||
-rw-r--r-- | weechat/src/common/completion.c | 53 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-display.c | 297 | ||||
-rw-r--r-- | weechat/src/gui/gui.h | 11 |
16 files changed, 1172 insertions, 608 deletions
@@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-02-05 +ChangeLog - 2005-02-06 Version 0.1.0 (under dev!): + * improved /window command: now split and merge are ok * away nicks are now displayed with another color (new option: "irc_away_check") * added away indicator in status bar * added lag indicator (and auto-disconnect after a delay if important lag) @@ -21,6 +22,7 @@ Version 0.1.0 (under dev!): * fixed many memory leaks * fixed colors bug: removed "gray" color (replaced by "default"), colors are ok when terminal has white (or light) background + * fixed crash when resizing terminal to small size * fixed crash when multiple servers and big messages received from server * fixed crash when closing some private buffers * fixed crash when unknown section with option(s) in config file @@ -1,7 +1,7 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -TODO - 2005-01-23 +TODO - 2005-02-06 Legend: # done @@ -22,7 +22,7 @@ v0.1.0: * Interface: # add lag indicator - + "/window" command, split terminal in multiple windows + # "/window" command, split terminal in multiple windows (horizontally/vertically) + internationalization (traduce WeeChat in many languages) @@ -60,9 +60,7 @@ Future versions: + Gtk GUI - color for nicks (except own nick) when nick colors are disabled - interpret special chars in messages (color & bold for example) - - improve completion (for example complete command parameters when possible) - understand incomplete commands if unambigous (for example: /he for /help is ok) - - tab key with empty command line should switch to next window (like F7) ? Qt GUI * TCP/IP communication: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.0-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-02-05 18:41+0100\n" +"POT-Creation-Date: 2005-02-06 04:10+0100\n" "PO-Revision-Date: 2005-01-01 13:00+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1162,7 +1162,7 @@ msgstr "drapeau de mode inconnu" msgid "can't change mode for other users" msgstr "impossible de changer le mode pour les autres utilisateurs" -#: src/irc/irc-display.c:145 src/common/command.c:820 +#: src/irc/irc-display.c:145 src/common/command.c:801 msgid "Server: " msgstr "Serveur: " @@ -1229,7 +1229,7 @@ msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n" msgid "%s cannot create new private window \"%s\"\n" msgstr "%s impossible de créer la fenêtre privée \"%s\"\n" -#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1331 +#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1341 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n" @@ -1762,60 +1762,60 @@ msgstr "" msgid "%s lag is high, disconnecting from server...\n" msgstr "%s le lag est élevé, déconnexion du serveur...\n" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "bytes" msgstr "octets" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Kb" msgstr "Ko" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Mb" msgstr "Mo" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Gb" msgstr "Go" -#: src/gui/curses/gui-display.c:935 +#: src/gui/curses/gui-display.c:960 msgid "(away)" msgstr "(absent)" -#: src/gui/curses/gui-display.c:1013 +#: src/gui/curses/gui-display.c:1038 #, c-format msgid "%d:[not connected] " msgstr "%d:[non connecté] " -#: src/gui/curses/gui-display.c:1024 +#: src/gui/curses/gui-display.c:1049 msgid "Act: " msgstr "Act: " -#: src/gui/curses/gui-display.c:1068 +#: src/gui/curses/gui-display.c:1093 #, c-format msgid "Lag: %.1f" msgstr "Lag: %.1f" -#: src/gui/curses/gui-display.c:1080 src/gui/curses/gui-display.c:1083 +#: src/gui/curses/gui-display.c:1105 src/gui/curses/gui-display.c:1108 msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1277 msgid " [A] Accept" msgstr " [A] Accepter" -#: src/gui/curses/gui-display.c:1253 src/gui/curses/gui-display.c:1259 -#: src/gui/curses/gui-display.c:1266 +#: src/gui/curses/gui-display.c:1278 src/gui/curses/gui-display.c:1284 +#: src/gui/curses/gui-display.c:1291 msgid " [C] Cancel" msgstr " [C] Annuler" -#: src/gui/curses/gui-display.c:1254 src/gui/curses/gui-display.c:1260 -#: src/gui/curses/gui-display.c:1267 src/gui/curses/gui-display.c:1274 -#: src/gui/curses/gui-display.c:1279 +#: src/gui/curses/gui-display.c:1279 src/gui/curses/gui-display.c:1285 +#: src/gui/curses/gui-display.c:1292 src/gui/curses/gui-display.c:1299 +#: src/gui/curses/gui-display.c:1304 msgid " [Q] Close DCC view" msgstr " [Q] Fermer la vue DCC" -#: src/gui/curses/gui-display.c:1273 +#: src/gui/curses/gui-display.c:1298 msgid " [R] Remove" msgstr " [R] Retirer" @@ -2025,23 +2025,21 @@ msgid "manage windows" msgstr "gestion des fenêtres" #: src/common/command.c:102 -msgid "[action]" -msgstr "[action]" +msgid "[list | splith | splitv | [merge [down | up | left | right | all]]]" +msgstr "[list | splith | splitv | [merge [down | up | left | right | all]]]" -#: src/common/command.c:103 +#: src/common/command.c:104 msgid "" -"action: action to do:\n" -" close close current window (under development!)\n" -" list list opened windows (no parameter implies this list)\n" -" splith split current window horizontally\n" -" splitv split current window vertically" +" list list opened windows (no parameter implies this list)\n" +"splith split current window horizontally\n" +"splitv split current window vertically\n" +" merge merge window with another" msgstr "" "action: action à effectuer:\n" -" close ferme la fenêtre courante (en développement !)\n" -" list liste toutes les fenêtres ouvertes (pas de paramètre affiche cette " -"liste)\n" -" splith éclate la fenêtre en deux horizontalement\n" -" splitv éclate la fenêtre en deux verticalement" +" list liste les fenêtres ouvertes (pas de paramètre affiche cette liste)\n" +"splith éclate la fenêtre en deux horizontalement\n" +"splitv éclate la fenêtre en deux verticalement\n" +" merge fusionne la fenêtre avec une autre" #: src/common/command.c:250 #, c-format @@ -2119,7 +2117,7 @@ msgstr "%s impossible de trouver le pseudo pour envoyer le message\n" msgid "This window is not a channel!\n" msgstr "Cette fenêtre n'est pas un canal !\n" -#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:855 +#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:865 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" @@ -2143,141 +2141,142 @@ msgid "No alias defined.\n" msgstr "Aucun alias défini.\n" #: src/common/command.c:807 -msgid "Opened buffers:\n" -msgstr "Tampons ouverts:\n" - -#: src/common/command.c:826 msgid "Channel: " msgstr "Canal: " -#: src/common/command.c:829 src/common/command.c:839 +#: src/common/command.c:810 src/common/command.c:820 msgid " (server: " msgstr " (serveur: " -#: src/common/command.c:836 +#: src/common/command.c:817 msgid "Private with: " msgstr "Privé avec: " -#: src/common/command.c:878 src/common/command.c:992 +#: src/common/command.c:844 +msgid "Opened buffers:\n" +msgstr "Tampons ouverts:\n" + +#: src/common/command.c:888 src/common/command.c:1002 #, c-format msgid "%s incorrect buffer number\n" msgstr "%s numéro de buffer incorrect\n" -#: src/common/command.c:892 +#: src/common/command.c:902 #, c-format msgid "%s can not close the single buffer\n" msgstr "%s impossible de fermer le tampon unique\n" -#: src/common/command.c:902 +#: src/common/command.c:912 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" "%s impossible de fermer le tampon du serveur tant que des canaux sont " "ouverts\n" -#: src/common/command.c:928 +#: src/common/command.c:938 msgid "Notify levels: " msgstr "Niveaux de notification: " -#: src/common/command.c:955 src/common/command.c:965 +#: src/common/command.c:965 src/common/command.c:975 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "%s niveau de notification incorrect (doit être entre 0 et 3)\n" -#: src/common/command.c:983 +#: src/common/command.c:993 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "%s buffer \"%s\" non trouvé pour la commande \"%s\"\n" -#: src/common/command.c:1017 +#: src/common/command.c:1027 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n" -#: src/common/command.c:1046 +#: src/common/command.c:1056 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "%s déjà connecté au serveur \"%s\" !\n" -#: src/common/command.c:1066 src/common/command.c:1109 -#: src/common/command.c:1759 +#: src/common/command.c:1076 src/common/command.c:1119 +#: src/common/command.c:1769 #, c-format msgid "%s server \"%s\" not found\n" msgstr "%s serveur \"%s\" non trouvé\n" -#: src/common/command.c:1092 +#: src/common/command.c:1102 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "%s non connecté au serveur \"%s\" !\n" -#: src/common/command.c:1100 +#: src/common/command.c:1110 msgid "Auto-reconnection is cancelled\n" msgstr "La reconnexion automatique est annulée\n" -#: src/common/command.c:1129 +#: src/common/command.c:1139 #, c-format msgid "> List of %s internal commands:\n" msgstr "> Liste des commandes internes %s :\n" -#: src/common/command.c:1140 +#: src/common/command.c:1150 msgid "> List of IRC commands:\n" msgstr "> Liste des commandes IRC :\n" -#: src/common/command.c:1158 +#: src/common/command.c:1168 #, c-format msgid "> Help on %s internal command \"" msgstr "> Aide sur la commande interne %s \"" -#: src/common/command.c:1163 src/common/command.c:1186 +#: src/common/command.c:1173 src/common/command.c:1196 msgid "Syntax: " msgstr "Syntaxe: " -#: src/common/command.c:1181 +#: src/common/command.c:1191 msgid "> Help on IRC command \"" msgstr "> Aide sur la commande IRC \"" -#: src/common/command.c:1200 +#: src/common/command.c:1210 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n" -#: src/common/command.c:1225 +#: src/common/command.c:1235 msgid "Registered Perl scripts:\n" msgstr "Scripts Perl enregistrés :\n" -#: src/common/command.c:1242 src/common/command.c:1264 -#: src/common/command.c:1286 +#: src/common/command.c:1252 src/common/command.c:1274 +#: src/common/command.c:1296 msgid " (none)\n" msgstr " (aucun)\n" -#: src/common/command.c:1247 +#: src/common/command.c:1257 msgid "Perl message handlers:\n" msgstr "Fonctions Perl pour messages :\n" -#: src/common/command.c:1256 +#: src/common/command.c:1266 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr " IRC(%s) => Perl(%s)\n" -#: src/common/command.c:1269 +#: src/common/command.c:1279 msgid "Perl command handlers:\n" msgstr "Commandes Perl :\n" -#: src/common/command.c:1278 +#: src/common/command.c:1288 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr " Commande /%s => Perl(%s)\n" -#: src/common/command.c:1298 +#: src/common/command.c:1308 msgid "Perl scripts unloaded\n" msgstr "Scripts Perl déchargés\n" -#: src/common/command.c:1324 src/common/command.c:1991 +#: src/common/command.c:1334 src/common/command.c:2040 +#: src/common/command.c:2052 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "%s option inconnue pour la commande \"%s\"\n" -#: src/common/command.c:1337 +#: src/common/command.c:1347 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" @@ -2286,31 +2285,31 @@ msgstr "" "Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le " "script ./configure\n" -#: src/common/command.c:1391 +#: src/common/command.c:1401 msgid "No server.\n" msgstr "Pas de serveur.\n" -#: src/common/command.c:1402 +#: src/common/command.c:1412 #, c-format msgid "Server '%s' not found.\n" msgstr "Serveur '%s' non trouvé.\n" -#: src/common/command.c:1414 +#: src/common/command.c:1424 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n" -#: src/common/command.c:1422 +#: src/common/command.c:1432 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n" -#: src/common/command.c:1441 +#: src/common/command.c:1451 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n" -#: src/common/command.c:1449 +#: src/common/command.c:1459 #, c-format msgid "" "%s you can not delete server \"%s\" because you are connected to. Try /" @@ -2319,100 +2318,104 @@ msgstr "" "%s vous ne pouvez pas supprimer le server \"%s\" car vous êtes connecté " "dessus. Essayez /disconnect %s avant.\n" -#: src/common/command.c:1465 src/common/command.c:1606 +#: src/common/command.c:1475 src/common/command.c:1616 msgid "Server" msgstr "Serveur" -#: src/common/command.c:1468 +#: src/common/command.c:1478 msgid "has been deleted\n" msgstr "a été supprimé\n" -#: src/common/command.c:1483 +#: src/common/command.c:1493 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:1493 +#: src/common/command.c:1503 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n" -#: src/common/command.c:1518 src/common/command.c:1546 -#: src/common/command.c:1559 src/common/command.c:1585 +#: src/common/command.c:1528 src/common/command.c:1556 +#: src/common/command.c:1569 src/common/command.c:1595 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n" -#: src/common/command.c:1531 +#: src/common/command.c:1541 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n" -#: src/common/command.c:1572 +#: src/common/command.c:1582 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "%s commande manquante pour le paramètre \"%s\"\n" -#: src/common/command.c:1609 +#: src/common/command.c:1619 msgid "created\n" msgstr "créé\n" -#: src/common/command.c:1615 +#: src/common/command.c:1625 #, c-format msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1672 +#: src/common/command.c:1682 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1695 +#: src/common/command.c:1705 msgid "(password hidden) " msgstr "(mot de passe caché)" -#: src/common/command.c:1791 src/common/command.c:1838 +#: src/common/command.c:1801 src/common/command.c:1848 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "%s option de configuration \"%s\" non trouvée\n" -#: src/common/command.c:1796 src/common/command.c:1830 +#: src/common/command.c:1806 src/common/command.c:1840 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "%s valeur incorrecte pour l'option \"%s\"\n" -#: src/common/command.c:1812 +#: src/common/command.c:1822 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "%s l'option \"%s\" ne peut pas être changée lorsque WeeChat tourne\n" -#: src/common/command.c:1914 +#: src/common/command.c:1924 #, c-format msgid "No config option found with \"%s\"\n" msgstr "Aucune option de configuration trouvée avec \"%s\"\n" -#: src/common/command.c:1917 +#: src/common/command.c:1927 msgid "No config option found\n" msgstr "Aucune option de configuration trouvée\n" -#: src/common/command.c:1924 +#: src/common/command.c:1934 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "option(s) de configuration trouvée(s) avec \"%s\"\n" -#: src/common/command.c:1927 +#: src/common/command.c:1937 msgid "config option(s) found\n" msgstr "option(s) de configuration trouvée(s)\n" -#: src/common/command.c:1947 +#: src/common/command.c:1957 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1957 +#: src/common/command.c:1967 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" +#: src/common/command.c:1987 +msgid "Opened windows:\n" +msgstr "Fenêtres ouvertes:\n" + #: src/common/weechat.c:184 #, c-format msgid "" @@ -3401,15 +3404,3 @@ msgstr "" #: src/common/weeconfig.c:1504 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" - -#~ msgid "> List of " -#~ msgstr "> Liste de " - -#~ msgid " commands:\n" -#~ msgstr " commandes:\n" - -#~ msgid "> Help on " -#~ msgstr "> Aide sur " - -#~ msgid " command \"" -#~ msgstr " commande \"" diff --git a/po/weechat.pot b/po/weechat.pot index 653e62da7..4482c8ba7 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-02-05 18:41+0100\n" +"POT-Creation-Date: 2005-02-06 04:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1068,7 +1068,7 @@ msgstr "" msgid "can't change mode for other users" msgstr "" -#: src/irc/irc-display.c:145 src/common/command.c:820 +#: src/irc/irc-display.c:145 src/common/command.c:801 msgid "Server: " msgstr "" @@ -1132,7 +1132,7 @@ msgstr "" msgid "%s cannot create new private window \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1331 +#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1341 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "" @@ -1650,60 +1650,60 @@ msgstr "" msgid "%s lag is high, disconnecting from server...\n" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "bytes" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Kb" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Mb" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Gb" msgstr "" -#: src/gui/curses/gui-display.c:935 +#: src/gui/curses/gui-display.c:960 msgid "(away)" msgstr "" -#: src/gui/curses/gui-display.c:1013 +#: src/gui/curses/gui-display.c:1038 #, c-format msgid "%d:[not connected] " msgstr "" -#: src/gui/curses/gui-display.c:1024 +#: src/gui/curses/gui-display.c:1049 msgid "Act: " msgstr "" -#: src/gui/curses/gui-display.c:1068 +#: src/gui/curses/gui-display.c:1093 #, c-format msgid "Lag: %.1f" msgstr "" -#: src/gui/curses/gui-display.c:1080 src/gui/curses/gui-display.c:1083 +#: src/gui/curses/gui-display.c:1105 src/gui/curses/gui-display.c:1108 msgid "-MORE-" msgstr "" -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1277 msgid " [A] Accept" msgstr "" -#: src/gui/curses/gui-display.c:1253 src/gui/curses/gui-display.c:1259 -#: src/gui/curses/gui-display.c:1266 +#: src/gui/curses/gui-display.c:1278 src/gui/curses/gui-display.c:1284 +#: src/gui/curses/gui-display.c:1291 msgid " [C] Cancel" msgstr "" -#: src/gui/curses/gui-display.c:1254 src/gui/curses/gui-display.c:1260 -#: src/gui/curses/gui-display.c:1267 src/gui/curses/gui-display.c:1274 -#: src/gui/curses/gui-display.c:1279 +#: src/gui/curses/gui-display.c:1279 src/gui/curses/gui-display.c:1285 +#: src/gui/curses/gui-display.c:1292 src/gui/curses/gui-display.c:1299 +#: src/gui/curses/gui-display.c:1304 msgid " [Q] Close DCC view" msgstr "" -#: src/gui/curses/gui-display.c:1273 +#: src/gui/curses/gui-display.c:1298 msgid " [R] Remove" msgstr "" @@ -1884,16 +1884,15 @@ msgid "manage windows" msgstr "" #: src/common/command.c:102 -msgid "[action]" +msgid "[list | splith | splitv | [merge [down | up | left | right | all]]]" msgstr "" -#: src/common/command.c:103 +#: src/common/command.c:104 msgid "" -"action: action to do:\n" -" close close current window (under development!)\n" -" list list opened windows (no parameter implies this list)\n" -" splith split current window horizontally\n" -" splitv split current window vertically" +" list list opened windows (no parameter implies this list)\n" +"splith split current window horizontally\n" +"splitv split current window vertically\n" +" merge merge window with another" msgstr "" #: src/common/command.c:250 @@ -1964,7 +1963,7 @@ msgstr "" msgid "This window is not a channel!\n" msgstr "" -#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:855 +#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:865 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "" @@ -1988,269 +1987,274 @@ msgid "No alias defined.\n" msgstr "" #: src/common/command.c:807 -msgid "Opened buffers:\n" -msgstr "" - -#: src/common/command.c:826 msgid "Channel: " msgstr "" -#: src/common/command.c:829 src/common/command.c:839 +#: src/common/command.c:810 src/common/command.c:820 msgid " (server: " msgstr "" -#: src/common/command.c:836 +#: src/common/command.c:817 msgid "Private with: " msgstr "" -#: src/common/command.c:878 src/common/command.c:992 +#: src/common/command.c:844 +msgid "Opened buffers:\n" +msgstr "" + +#: src/common/command.c:888 src/common/command.c:1002 #, c-format msgid "%s incorrect buffer number\n" msgstr "" -#: src/common/command.c:892 +#: src/common/command.c:902 #, c-format msgid "%s can not close the single buffer\n" msgstr "" -#: src/common/command.c:902 +#: src/common/command.c:912 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" -#: src/common/command.c:928 +#: src/common/command.c:938 msgid "Notify levels: " msgstr "" -#: src/common/command.c:955 src/common/command.c:965 +#: src/common/command.c:965 src/common/command.c:975 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "" -#: src/common/command.c:983 +#: src/common/command.c:993 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1017 +#: src/common/command.c:1027 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "" -#: src/common/command.c:1046 +#: src/common/command.c:1056 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1066 src/common/command.c:1109 -#: src/common/command.c:1759 +#: src/common/command.c:1076 src/common/command.c:1119 +#: src/common/command.c:1769 #, c-format msgid "%s server \"%s\" not found\n" msgstr "" -#: src/common/command.c:1092 +#: src/common/command.c:1102 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1100 +#: src/common/command.c:1110 msgid "Auto-reconnection is cancelled\n" msgstr "" -#: src/common/command.c:1129 +#: src/common/command.c:1139 #, c-format msgid "> List of %s internal commands:\n" msgstr "" -#: src/common/command.c:1140 +#: src/common/command.c:1150 msgid "> List of IRC commands:\n" msgstr "" -#: src/common/command.c:1158 +#: src/common/command.c:1168 #, c-format msgid "> Help on %s internal command \"" msgstr "" -#: src/common/command.c:1163 src/common/command.c:1186 +#: src/common/command.c:1173 src/common/command.c:1196 msgid "Syntax: " msgstr "" -#: src/common/command.c:1181 +#: src/common/command.c:1191 msgid "> Help on IRC command \"" msgstr "" -#: src/common/command.c:1200 +#: src/common/command.c:1210 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "" -#: src/common/command.c:1225 +#: src/common/command.c:1235 msgid "Registered Perl scripts:\n" msgstr "" -#: src/common/command.c:1242 src/common/command.c:1264 -#: src/common/command.c:1286 +#: src/common/command.c:1252 src/common/command.c:1274 +#: src/common/command.c:1296 msgid " (none)\n" msgstr "" -#: src/common/command.c:1247 +#: src/common/command.c:1257 msgid "Perl message handlers:\n" msgstr "" -#: src/common/command.c:1256 +#: src/common/command.c:1266 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr "" -#: src/common/command.c:1269 +#: src/common/command.c:1279 msgid "Perl command handlers:\n" msgstr "" -#: src/common/command.c:1278 +#: src/common/command.c:1288 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr "" -#: src/common/command.c:1298 +#: src/common/command.c:1308 msgid "Perl scripts unloaded\n" msgstr "" -#: src/common/command.c:1324 src/common/command.c:1991 +#: src/common/command.c:1334 src/common/command.c:2040 +#: src/common/command.c:2052 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "" -#: src/common/command.c:1337 +#: src/common/command.c:1347 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" msgstr "" -#: src/common/command.c:1391 +#: src/common/command.c:1401 msgid "No server.\n" msgstr "" -#: src/common/command.c:1402 +#: src/common/command.c:1412 #, c-format msgid "Server '%s' not found.\n" msgstr "" -#: src/common/command.c:1414 +#: src/common/command.c:1424 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "" -#: src/common/command.c:1422 +#: src/common/command.c:1432 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "" -#: src/common/command.c:1441 +#: src/common/command.c:1451 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1449 +#: src/common/command.c:1459 #, c-format msgid "" "%s you can not delete server \"%s\" because you are connected to. Try /" "disconnect %s before.\n" msgstr "" -#: src/common/command.c:1465 src/common/command.c:1606 +#: src/common/command.c:1475 src/common/command.c:1616 msgid "Server" msgstr "" -#: src/common/command.c:1468 +#: src/common/command.c:1478 msgid "has been deleted\n" msgstr "" -#: src/common/command.c:1483 +#: src/common/command.c:1493 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "" -#: src/common/command.c:1493 +#: src/common/command.c:1503 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "" -#: src/common/command.c:1518 src/common/command.c:1546 -#: src/common/command.c:1559 src/common/command.c:1585 +#: src/common/command.c:1528 src/common/command.c:1556 +#: src/common/command.c:1569 src/common/command.c:1595 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1531 +#: src/common/command.c:1541 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1572 +#: src/common/command.c:1582 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1609 +#: src/common/command.c:1619 msgid "created\n" msgstr "" -#: src/common/command.c:1615 +#: src/common/command.c:1625 #, c-format msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1672 +#: src/common/command.c:1682 msgid "(unknown)" msgstr "" -#: src/common/command.c:1695 +#: src/common/command.c:1705 msgid "(password hidden) " msgstr "" -#: src/common/command.c:1791 src/common/command.c:1838 +#: src/common/command.c:1801 src/common/command.c:1848 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "" -#: src/common/command.c:1796 src/common/command.c:1830 +#: src/common/command.c:1806 src/common/command.c:1840 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "" -#: src/common/command.c:1812 +#: src/common/command.c:1822 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "" -#: src/common/command.c:1914 +#: src/common/command.c:1924 #, c-format msgid "No config option found with \"%s\"\n" msgstr "" -#: src/common/command.c:1917 +#: src/common/command.c:1927 msgid "No config option found\n" msgstr "" -#: src/common/command.c:1924 +#: src/common/command.c:1934 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "" -#: src/common/command.c:1927 +#: src/common/command.c:1937 msgid "config option(s) found\n" msgstr "" -#: src/common/command.c:1947 +#: src/common/command.c:1957 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1957 +#: src/common/command.c:1967 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" +#: src/common/command.c:1987 +msgid "Opened windows:\n" +msgstr "" + #: src/common/weechat.c:184 #, c-format msgid "" diff --git a/src/common/command.c b/src/common/command.c index 7b7cb68ba..e6cf37ad5 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -99,13 +99,13 @@ t_weechat_command weechat_commands[] = N_("alias_name"), N_("alias_name: name of alias to remove"), 1, 1, NULL, weechat_cmd_unalias }, { "window", N_("manage windows"), - N_("[action]"), - N_("action: action to do:\n" - " close close current window (under development!)\n" - " list list opened windows (no parameter implies this list)\n" - " splith split current window horizontally\n" - " splitv split current window vertically"), - 0, MAX_ARGS, weechat_cmd_window, NULL }, + N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"), + N_( + " list list opened windows (no parameter implies this list)\n" + "splith split current window horizontally\n" + "splitv split current window vertically\n" + " merge merge window with another"), + 0, 2, weechat_cmd_window, NULL }, { NULL, NULL, NULL, NULL, 0, 0, NULL, NULL } }; @@ -788,6 +788,43 @@ weechat_cmd_alias (char *arguments) } /* + * weechat_cmd_buffer_display_info: display info about a buffer + */ + +void +weechat_cmd_buffer_display_info (t_gui_buffer *buffer) +{ + if (buffer->dcc) + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n"); + else if (BUFFER_IS_SERVER (buffer)) + { + gui_printf (NULL, _("Server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s\n", SERVER(buffer)->name); + } + else if (BUFFER_IS_CHANNEL (buffer)) + { + gui_printf (NULL, _("Channel: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", CHANNEL(buffer)->name); + gui_printf (NULL, _(" (server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", SERVER(buffer)->name); + gui_printf (NULL, ")\n"); + } + else if (BUFFER_IS_PRIVATE (buffer)) + { + gui_printf (NULL, _("Private with: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, + "%s", CHANNEL(buffer)->name); + gui_printf (NULL, _(" (server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", SERVER(buffer)->name); + gui_printf (NULL, ")\n"); + } +} + +/* * weechat_cmd_buffer: manage buffers */ @@ -813,34 +850,7 @@ weechat_cmd_buffer (int argc, char **argv) gui_printf (NULL, "%d", ptr_buffer->number); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] "); - if (ptr_buffer->dcc) - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n"); - else if (BUFFER_IS_SERVER (ptr_buffer)) - { - gui_printf (NULL, _("Server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s\n", SERVER(ptr_buffer)->name); - } - else if (BUFFER_IS_CHANNEL (ptr_buffer)) - { - gui_printf (NULL, _("Channel: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", CHANNEL(ptr_buffer)->name); - gui_printf (NULL, _(" (server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", SERVER(ptr_buffer)->name); - gui_printf (NULL, ")\n"); - } - else if (BUFFER_IS_PRIVATE (ptr_buffer)) - { - gui_printf (NULL, _("Private with: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, - "%s", CHANNEL(ptr_buffer)->name); - gui_printf (NULL, _(" (server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", SERVER(ptr_buffer)->name); - gui_printf (NULL, ")\n"); - } + weechat_cmd_buffer_display_info (ptr_buffer); } } else @@ -1966,11 +1976,36 @@ weechat_cmd_unalias (char *arguments) int weechat_cmd_window (int argc, char **argv) { + t_gui_window *ptr_win; + int i; + if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ - irc_display_prefix (NULL, PREFIX_ERROR); - gui_printf (NULL, "window list -- NOT DEVELOPED!\n"); + + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Opened windows:\n")); + + i = 1; + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); + gui_printf (NULL, "%d", i); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ("); + gui_printf (NULL, "%d", ptr_win->win_x); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":"); + gui_printf (NULL, "%d", ptr_win->win_y); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ";"); + gui_printf (NULL, "%d", ptr_win->win_width); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "x"); + gui_printf (NULL, "%d", ptr_win->win_height); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ") "); + + weechat_cmd_buffer_display_info (ptr_win->buffer); + + i++; + } } else { @@ -1984,12 +2019,39 @@ weechat_cmd_window (int argc, char **argv) /* split window vertically */ gui_window_split_vertic (gui_current_window); } + else if (strcasecmp (argv[0], "merge") == 0) + { + if (argc >= 2) + { + if (strcasecmp (argv[1], "down") == 0) + gui_window_merge_down (gui_current_window); + else if (strcasecmp (argv[1], "up") == 0) + gui_window_merge_up (gui_current_window); + else if (strcasecmp (argv[1], "left") == 0) + gui_window_merge_left (gui_current_window); + else if (strcasecmp (argv[1], "right") == 0) + gui_window_merge_right (gui_current_window); + else if (strcasecmp (argv[1], "all") == 0) + gui_window_merge_all (gui_current_window); + else + { + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, + _("%s unknown option for \"%s\" command\n"), + WEECHAT_ERROR, "window merge"); + return -1; + } + } + else + gui_window_merge_auto (gui_current_window); + } else { irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "window"); + return -1; } } return 0; diff --git a/src/common/completion.c b/src/common/completion.c index 1ca4ad225..f0aea7cd1 100644 --- a/src/common/completion.c +++ b/src/common/completion.c @@ -233,21 +233,46 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if ((strcasecmp (completion->base_command, "window") == 0) - && (completion->base_command_arg == 2)) + if (strcasecmp (completion->base_command, "window") == 0) { - weelist_add (&completion->completion_list, - &completion->last_completion, - "close"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "list"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "splith"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "splitv"); + if (completion->base_command_arg == 1) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splith"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splitv"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "merge"); + return; + } + + if (completion->base_command_arg == 2) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "down"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "up"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "left"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "right"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "all"); + return; + } + + completion_stop (completion); return; } diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 1fe7ea1e9..591cccecb 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -299,6 +299,29 @@ gui_curses_window_clear (WINDOW *window) } /* + * gui_draw_window_separator: draw window separation + */ + +void +gui_draw_window_separator (t_gui_window *window) +{ + if (window->win_separator) + delwin (window->win_separator); + + if (window->win_x > 0) + { + window->win_separator = newwin (window->win_height, + 1, + window->win_y, + window->win_x - 1); + gui_window_set_color (window->win_separator, COLOR_WIN_TITLE); + wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); + wrefresh (window->win_separator); + refresh (); + } +} + +/* * gui_draw_buffer_title: draw title window for a buffer */ @@ -419,6 +442,8 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count) { num_displayed = window->win_chat_width - window->win_chat_cursor_x; + if (num_displayed < 0) + return; saved_char = ptr_message->message[offset + num_displayed]; ptr_message->message[offset + num_displayed] = '\0'; if (lines_displayed >= num_lines - count) @@ -1583,49 +1608,6 @@ gui_move_page_down (t_gui_window *window) } /* - * gui_curses_resize_handler: called when term size is modified - */ - -void -gui_curses_resize_handler () -{ - t_gui_window *ptr_win, *old_current_window; - int old_width, old_height; - int new_width, new_height; - - getmaxyx (stdscr, old_height, old_width); - - endwin (); - refresh (); - - getmaxyx (stdscr, new_height, new_width); - - old_current_window = gui_current_window; - - /* TODO: manage when some windows are outside new term size */ - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - ptr_win->dcc_first = NULL; - ptr_win->dcc_selected = NULL; - if (ptr_win->win_x + ptr_win->win_width == old_width) - ptr_win->win_width = new_width - ptr_win->win_x; - if (ptr_win->win_y + ptr_win->win_height == old_height) - ptr_win->win_height = new_height - ptr_win->win_y; - gui_switch_to_buffer (ptr_win, ptr_win->buffer); - } - - gui_current_window = old_current_window; - if ((new_width > 5) && (new_height > 5)) - { - gui_ok = 1; - gui_calculate_pos_size (gui_current_window); - gui_redraw_buffer (gui_current_window->buffer); - } - else - gui_ok = 0; -} - -/* * gui_window_init_subviews: init subviews for a WeeChat window */ @@ -1703,16 +1685,227 @@ gui_window_split_vertic (t_gui_window *window) gui_switch_to_buffer (gui_current_window, gui_current_window->buffer); gui_redraw_buffer (gui_current_window->buffer); - /* create & draw separator if window is not on the left */ - gui_current_window->win_separator = newwin (gui_current_window->win_height, - 1, - gui_current_window->win_y, - gui_current_window->win_x - 1); - gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE); - wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); - wrefresh (gui_current_window->win_separator); - refresh (); + /* create & draw separator */ + gui_draw_window_separator (gui_current_window); + } +} + +/* + * gui_window_merge_down: merge window, direction down + */ + +int +gui_window_merge_down (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_y == window->win_y + window->win_height) + && (ptr_win->win_x == window->win_x) + && (ptr_win->win_width == window->win_width)) + { + window->win_height += ptr_win->win_height; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found below current window */ + return -1; +} + +/* + * gui_window_merge_up: merge window, direction up + */ + +int +gui_window_merge_up (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_y + ptr_win->win_height == window->win_y) + && (ptr_win->win_x == window->win_x) + && (ptr_win->win_width == window->win_width)) + { + window->win_height += ptr_win->win_height; + window->win_y -= ptr_win->win_height; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found above current window */ + return -1; +} + +/* + * gui_window_merge_left: merge window, direction left + */ + +int +gui_window_merge_left (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_x + ptr_win->win_width + 1 == window->win_x) + && (ptr_win->win_y == window->win_y) + && (ptr_win->win_height == window->win_height)) + { + window->win_width += ptr_win->win_width + 1; + window->win_x -= ptr_win->win_width + 1; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } } + + /* no window found on the left of current window */ + return -1; +} + +/* + * gui_window_merge_right: merge window, direction right + */ + +int +gui_window_merge_right (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_x == window->win_x + window->win_width + 1) + && (ptr_win->win_y == window->win_y) + && (ptr_win->win_height == window->win_height)) + { + window->win_width += ptr_win->win_width + 1; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found on the right of current window */ + return -1; +} + +/* + * gui_window_merge: merge a window, direction auto + */ + +void +gui_window_merge_auto (t_gui_window *window) +{ + if (gui_window_merge_down (window) == 0) + return; + if (gui_window_merge_up (window) == 0) + return; + if (gui_window_merge_left (window) == 0) + return; + if (gui_window_merge_right (window) == 0) + return; +} + +/* + * gui_window_merge_all: merge all windows + */ + +void +gui_window_merge_all (t_gui_window *window) +{ + while (gui_windows->next_window) + { + gui_window_free ((gui_windows == window) ? gui_windows->next_window : gui_windows); + } + window->win_x = 0; + window->win_y = 0; + window->win_width = COLS; + window->win_height = LINES; + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); +} + +/* + * gui_curses_resize_handler: called when term size is modified + */ + +void +gui_curses_resize_handler () +{ + t_gui_window *ptr_win, *old_current_window; + int old_width, old_height; + int new_width, new_height; + int merge_all_windows; + + getmaxyx (stdscr, old_height, old_width); + + endwin (); + refresh (); + + getmaxyx (stdscr, new_height, new_width); + + old_current_window = gui_current_window; + + gui_ok = ((new_width > 5) && (new_height > 5)); + + merge_all_windows = 0; + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + ptr_win->dcc_first = NULL; + ptr_win->dcc_selected = NULL; + + if (!merge_all_windows) + { + if ((ptr_win->win_x > new_width - 5) + || (ptr_win->win_y > new_height - 5)) + merge_all_windows = 1; + else + { + if (ptr_win->win_x + ptr_win->win_width == old_width) + ptr_win->win_width = new_width - ptr_win->win_x; + if (ptr_win->win_y + ptr_win->win_height == old_height) + ptr_win->win_height = new_height - ptr_win->win_y; + if ((ptr_win->win_width < 5) || (ptr_win->win_height < 5)) + merge_all_windows = 1; + } + } + } + + if (merge_all_windows) + gui_window_merge_all (gui_current_window); + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + gui_calculate_pos_size (ptr_win); + gui_switch_to_buffer (ptr_win, ptr_win->buffer); + gui_draw_window_separator (ptr_win); + } + + gui_current_window = old_current_window; + gui_redraw_buffer (gui_current_window->buffer); } /* diff --git a/src/gui/gui.h b/src/gui/gui.h index 756a807a4..1056ce1f6 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -247,9 +247,8 @@ extern t_gui_buffer *last_gui_buffer; extern t_gui_buffer *buffer_before_dcc; extern t_gui_infobar *gui_infobar; -/* prototypes */ - /* GUI independent functions */ + extern t_gui_window *gui_window_new (int, int, int, int); extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int); extern void gui_buffer_clear (t_gui_buffer *); @@ -267,7 +266,9 @@ extern void gui_move_next_word (t_gui_buffer *); extern void gui_buffer_insert_string (t_gui_buffer *, char *, int); extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int); extern void gui_move_buffer_to_number (t_gui_window *, int); + /* GUI dependant functions */ + extern int gui_assign_color (int *, char *); extern int gui_get_color_by_name (char *); extern char *gui_get_color_by_value (int); @@ -292,6 +293,12 @@ extern void gui_curses_resize_handler (); extern void gui_window_init_subwindows (t_gui_window *); extern void gui_window_split_horiz (t_gui_window *); extern void gui_window_split_vertic (t_gui_window *); +extern int gui_window_merge_up (t_gui_window *); +extern int gui_window_merge_down (t_gui_window *); +extern int gui_window_merge_left (t_gui_window *); +extern int gui_window_merge_right (t_gui_window *); +extern void gui_window_merge_auto (t_gui_window *); +extern void gui_window_merge_all (t_gui_window *); extern void gui_pre_init (int *, char **[]); extern void gui_init_colors (); extern void gui_set_window_title (); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index a398b64b1..188c10111 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-02-05 +ChangeLog - 2005-02-06 Version 0.1.0 (under dev!): + * improved /window command: now split and merge are ok * away nicks are now displayed with another color (new option: "irc_away_check") * added away indicator in status bar * added lag indicator (and auto-disconnect after a delay if important lag) @@ -21,6 +22,7 @@ Version 0.1.0 (under dev!): * fixed many memory leaks * fixed colors bug: removed "gray" color (replaced by "default"), colors are ok when terminal has white (or light) background + * fixed crash when resizing terminal to small size * fixed crash when multiple servers and big messages received from server * fixed crash when closing some private buffers * fixed crash when unknown section with option(s) in config file diff --git a/weechat/TODO b/weechat/TODO index 9dc371506..fe1af8a43 100644 --- a/weechat/TODO +++ b/weechat/TODO @@ -1,7 +1,7 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -TODO - 2005-01-23 +TODO - 2005-02-06 Legend: # done @@ -22,7 +22,7 @@ v0.1.0: * Interface: # add lag indicator - + "/window" command, split terminal in multiple windows + # "/window" command, split terminal in multiple windows (horizontally/vertically) + internationalization (traduce WeeChat in many languages) @@ -60,9 +60,7 @@ Future versions: + Gtk GUI - color for nicks (except own nick) when nick colors are disabled - interpret special chars in messages (color & bold for example) - - improve completion (for example complete command parameters when possible) - understand incomplete commands if unambigous (for example: /he for /help is ok) - - tab key with empty command line should switch to next window (like F7) ? Qt GUI * TCP/IP communication: diff --git a/weechat/po/fr.po b/weechat/po/fr.po index ebf787158..99690cbf8 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.0-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-02-05 18:41+0100\n" +"POT-Creation-Date: 2005-02-06 04:10+0100\n" "PO-Revision-Date: 2005-01-01 13:00+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1162,7 +1162,7 @@ msgstr "drapeau de mode inconnu" msgid "can't change mode for other users" msgstr "impossible de changer le mode pour les autres utilisateurs" -#: src/irc/irc-display.c:145 src/common/command.c:820 +#: src/irc/irc-display.c:145 src/common/command.c:801 msgid "Server: " msgstr "Serveur: " @@ -1229,7 +1229,7 @@ msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n" msgid "%s cannot create new private window \"%s\"\n" msgstr "%s impossible de créer la fenêtre privée \"%s\"\n" -#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1331 +#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1341 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n" @@ -1762,60 +1762,60 @@ msgstr "" msgid "%s lag is high, disconnecting from server...\n" msgstr "%s le lag est élevé, déconnexion du serveur...\n" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "bytes" msgstr "octets" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Kb" msgstr "Ko" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Mb" msgstr "Mo" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Gb" msgstr "Go" -#: src/gui/curses/gui-display.c:935 +#: src/gui/curses/gui-display.c:960 msgid "(away)" msgstr "(absent)" -#: src/gui/curses/gui-display.c:1013 +#: src/gui/curses/gui-display.c:1038 #, c-format msgid "%d:[not connected] " msgstr "%d:[non connecté] " -#: src/gui/curses/gui-display.c:1024 +#: src/gui/curses/gui-display.c:1049 msgid "Act: " msgstr "Act: " -#: src/gui/curses/gui-display.c:1068 +#: src/gui/curses/gui-display.c:1093 #, c-format msgid "Lag: %.1f" msgstr "Lag: %.1f" -#: src/gui/curses/gui-display.c:1080 src/gui/curses/gui-display.c:1083 +#: src/gui/curses/gui-display.c:1105 src/gui/curses/gui-display.c:1108 msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1277 msgid " [A] Accept" msgstr " [A] Accepter" -#: src/gui/curses/gui-display.c:1253 src/gui/curses/gui-display.c:1259 -#: src/gui/curses/gui-display.c:1266 +#: src/gui/curses/gui-display.c:1278 src/gui/curses/gui-display.c:1284 +#: src/gui/curses/gui-display.c:1291 msgid " [C] Cancel" msgstr " [C] Annuler" -#: src/gui/curses/gui-display.c:1254 src/gui/curses/gui-display.c:1260 -#: src/gui/curses/gui-display.c:1267 src/gui/curses/gui-display.c:1274 -#: src/gui/curses/gui-display.c:1279 +#: src/gui/curses/gui-display.c:1279 src/gui/curses/gui-display.c:1285 +#: src/gui/curses/gui-display.c:1292 src/gui/curses/gui-display.c:1299 +#: src/gui/curses/gui-display.c:1304 msgid " [Q] Close DCC view" msgstr " [Q] Fermer la vue DCC" -#: src/gui/curses/gui-display.c:1273 +#: src/gui/curses/gui-display.c:1298 msgid " [R] Remove" msgstr " [R] Retirer" @@ -2025,23 +2025,21 @@ msgid "manage windows" msgstr "gestion des fenêtres" #: src/common/command.c:102 -msgid "[action]" -msgstr "[action]" +msgid "[list | splith | splitv | [merge [down | up | left | right | all]]]" +msgstr "[list | splith | splitv | [merge [down | up | left | right | all]]]" -#: src/common/command.c:103 +#: src/common/command.c:104 msgid "" -"action: action to do:\n" -" close close current window (under development!)\n" -" list list opened windows (no parameter implies this list)\n" -" splith split current window horizontally\n" -" splitv split current window vertically" +" list list opened windows (no parameter implies this list)\n" +"splith split current window horizontally\n" +"splitv split current window vertically\n" +" merge merge window with another" msgstr "" "action: action à effectuer:\n" -" close ferme la fenêtre courante (en développement !)\n" -" list liste toutes les fenêtres ouvertes (pas de paramètre affiche cette " -"liste)\n" -" splith éclate la fenêtre en deux horizontalement\n" -" splitv éclate la fenêtre en deux verticalement" +" list liste les fenêtres ouvertes (pas de paramètre affiche cette liste)\n" +"splith éclate la fenêtre en deux horizontalement\n" +"splitv éclate la fenêtre en deux verticalement\n" +" merge fusionne la fenêtre avec une autre" #: src/common/command.c:250 #, c-format @@ -2119,7 +2117,7 @@ msgstr "%s impossible de trouver le pseudo pour envoyer le message\n" msgid "This window is not a channel!\n" msgstr "Cette fenêtre n'est pas un canal !\n" -#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:855 +#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:865 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" @@ -2143,141 +2141,142 @@ msgid "No alias defined.\n" msgstr "Aucun alias défini.\n" #: src/common/command.c:807 -msgid "Opened buffers:\n" -msgstr "Tampons ouverts:\n" - -#: src/common/command.c:826 msgid "Channel: " msgstr "Canal: " -#: src/common/command.c:829 src/common/command.c:839 +#: src/common/command.c:810 src/common/command.c:820 msgid " (server: " msgstr " (serveur: " -#: src/common/command.c:836 +#: src/common/command.c:817 msgid "Private with: " msgstr "Privé avec: " -#: src/common/command.c:878 src/common/command.c:992 +#: src/common/command.c:844 +msgid "Opened buffers:\n" +msgstr "Tampons ouverts:\n" + +#: src/common/command.c:888 src/common/command.c:1002 #, c-format msgid "%s incorrect buffer number\n" msgstr "%s numéro de buffer incorrect\n" -#: src/common/command.c:892 +#: src/common/command.c:902 #, c-format msgid "%s can not close the single buffer\n" msgstr "%s impossible de fermer le tampon unique\n" -#: src/common/command.c:902 +#: src/common/command.c:912 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" "%s impossible de fermer le tampon du serveur tant que des canaux sont " "ouverts\n" -#: src/common/command.c:928 +#: src/common/command.c:938 msgid "Notify levels: " msgstr "Niveaux de notification: " -#: src/common/command.c:955 src/common/command.c:965 +#: src/common/command.c:965 src/common/command.c:975 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "%s niveau de notification incorrect (doit être entre 0 et 3)\n" -#: src/common/command.c:983 +#: src/common/command.c:993 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "%s buffer \"%s\" non trouvé pour la commande \"%s\"\n" -#: src/common/command.c:1017 +#: src/common/command.c:1027 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n" -#: src/common/command.c:1046 +#: src/common/command.c:1056 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "%s déjà connecté au serveur \"%s\" !\n" -#: src/common/command.c:1066 src/common/command.c:1109 -#: src/common/command.c:1759 +#: src/common/command.c:1076 src/common/command.c:1119 +#: src/common/command.c:1769 #, c-format msgid "%s server \"%s\" not found\n" msgstr "%s serveur \"%s\" non trouvé\n" -#: src/common/command.c:1092 +#: src/common/command.c:1102 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "%s non connecté au serveur \"%s\" !\n" -#: src/common/command.c:1100 +#: src/common/command.c:1110 msgid "Auto-reconnection is cancelled\n" msgstr "La reconnexion automatique est annulée\n" -#: src/common/command.c:1129 +#: src/common/command.c:1139 #, c-format msgid "> List of %s internal commands:\n" msgstr "> Liste des commandes internes %s :\n" -#: src/common/command.c:1140 +#: src/common/command.c:1150 msgid "> List of IRC commands:\n" msgstr "> Liste des commandes IRC :\n" -#: src/common/command.c:1158 +#: src/common/command.c:1168 #, c-format msgid "> Help on %s internal command \"" msgstr "> Aide sur la commande interne %s \"" -#: src/common/command.c:1163 src/common/command.c:1186 +#: src/common/command.c:1173 src/common/command.c:1196 msgid "Syntax: " msgstr "Syntaxe: " -#: src/common/command.c:1181 +#: src/common/command.c:1191 msgid "> Help on IRC command \"" msgstr "> Aide sur la commande IRC \"" -#: src/common/command.c:1200 +#: src/common/command.c:1210 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n" -#: src/common/command.c:1225 +#: src/common/command.c:1235 msgid "Registered Perl scripts:\n" msgstr "Scripts Perl enregistrés :\n" -#: src/common/command.c:1242 src/common/command.c:1264 -#: src/common/command.c:1286 +#: src/common/command.c:1252 src/common/command.c:1274 +#: src/common/command.c:1296 msgid " (none)\n" msgstr " (aucun)\n" -#: src/common/command.c:1247 +#: src/common/command.c:1257 msgid "Perl message handlers:\n" msgstr "Fonctions Perl pour messages :\n" -#: src/common/command.c:1256 +#: src/common/command.c:1266 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr " IRC(%s) => Perl(%s)\n" -#: src/common/command.c:1269 +#: src/common/command.c:1279 msgid "Perl command handlers:\n" msgstr "Commandes Perl :\n" -#: src/common/command.c:1278 +#: src/common/command.c:1288 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr " Commande /%s => Perl(%s)\n" -#: src/common/command.c:1298 +#: src/common/command.c:1308 msgid "Perl scripts unloaded\n" msgstr "Scripts Perl déchargés\n" -#: src/common/command.c:1324 src/common/command.c:1991 +#: src/common/command.c:1334 src/common/command.c:2040 +#: src/common/command.c:2052 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "%s option inconnue pour la commande \"%s\"\n" -#: src/common/command.c:1337 +#: src/common/command.c:1347 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" @@ -2286,31 +2285,31 @@ msgstr "" "Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le " "script ./configure\n" -#: src/common/command.c:1391 +#: src/common/command.c:1401 msgid "No server.\n" msgstr "Pas de serveur.\n" -#: src/common/command.c:1402 +#: src/common/command.c:1412 #, c-format msgid "Server '%s' not found.\n" msgstr "Serveur '%s' non trouvé.\n" -#: src/common/command.c:1414 +#: src/common/command.c:1424 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n" -#: src/common/command.c:1422 +#: src/common/command.c:1432 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n" -#: src/common/command.c:1441 +#: src/common/command.c:1451 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n" -#: src/common/command.c:1449 +#: src/common/command.c:1459 #, c-format msgid "" "%s you can not delete server \"%s\" because you are connected to. Try /" @@ -2319,100 +2318,104 @@ msgstr "" "%s vous ne pouvez pas supprimer le server \"%s\" car vous êtes connecté " "dessus. Essayez /disconnect %s avant.\n" -#: src/common/command.c:1465 src/common/command.c:1606 +#: src/common/command.c:1475 src/common/command.c:1616 msgid "Server" msgstr "Serveur" -#: src/common/command.c:1468 +#: src/common/command.c:1478 msgid "has been deleted\n" msgstr "a été supprimé\n" -#: src/common/command.c:1483 +#: src/common/command.c:1493 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:1493 +#: src/common/command.c:1503 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n" -#: src/common/command.c:1518 src/common/command.c:1546 -#: src/common/command.c:1559 src/common/command.c:1585 +#: src/common/command.c:1528 src/common/command.c:1556 +#: src/common/command.c:1569 src/common/command.c:1595 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n" -#: src/common/command.c:1531 +#: src/common/command.c:1541 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n" -#: src/common/command.c:1572 +#: src/common/command.c:1582 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "%s commande manquante pour le paramètre \"%s\"\n" -#: src/common/command.c:1609 +#: src/common/command.c:1619 msgid "created\n" msgstr "créé\n" -#: src/common/command.c:1615 +#: src/common/command.c:1625 #, c-format msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1672 +#: src/common/command.c:1682 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1695 +#: src/common/command.c:1705 msgid "(password hidden) " msgstr "(mot de passe caché)" -#: src/common/command.c:1791 src/common/command.c:1838 +#: src/common/command.c:1801 src/common/command.c:1848 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "%s option de configuration \"%s\" non trouvée\n" -#: src/common/command.c:1796 src/common/command.c:1830 +#: src/common/command.c:1806 src/common/command.c:1840 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "%s valeur incorrecte pour l'option \"%s\"\n" -#: src/common/command.c:1812 +#: src/common/command.c:1822 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "%s l'option \"%s\" ne peut pas être changée lorsque WeeChat tourne\n" -#: src/common/command.c:1914 +#: src/common/command.c:1924 #, c-format msgid "No config option found with \"%s\"\n" msgstr "Aucune option de configuration trouvée avec \"%s\"\n" -#: src/common/command.c:1917 +#: src/common/command.c:1927 msgid "No config option found\n" msgstr "Aucune option de configuration trouvée\n" -#: src/common/command.c:1924 +#: src/common/command.c:1934 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "option(s) de configuration trouvée(s) avec \"%s\"\n" -#: src/common/command.c:1927 +#: src/common/command.c:1937 msgid "config option(s) found\n" msgstr "option(s) de configuration trouvée(s)\n" -#: src/common/command.c:1947 +#: src/common/command.c:1957 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1957 +#: src/common/command.c:1967 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" +#: src/common/command.c:1987 +msgid "Opened windows:\n" +msgstr "Fenêtres ouvertes:\n" + #: src/common/weechat.c:184 #, c-format msgid "" @@ -3401,15 +3404,3 @@ msgstr "" #: src/common/weeconfig.c:1504 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" - -#~ msgid "> List of " -#~ msgstr "> Liste de " - -#~ msgid " commands:\n" -#~ msgstr " commandes:\n" - -#~ msgid "> Help on " -#~ msgstr "> Aide sur " - -#~ msgid " command \"" -#~ msgstr " commande \"" diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot index 653e62da7..4482c8ba7 100644 --- a/weechat/po/weechat.pot +++ b/weechat/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-02-05 18:41+0100\n" +"POT-Creation-Date: 2005-02-06 04:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1068,7 +1068,7 @@ msgstr "" msgid "can't change mode for other users" msgstr "" -#: src/irc/irc-display.c:145 src/common/command.c:820 +#: src/irc/irc-display.c:145 src/common/command.c:801 msgid "Server: " msgstr "" @@ -1132,7 +1132,7 @@ msgstr "" msgid "%s cannot create new private window \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1331 +#: src/irc/irc-send.c:717 src/irc/irc-send.c:791 src/common/command.c:1341 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "" @@ -1650,60 +1650,60 @@ msgstr "" msgid "%s lag is high, disconnecting from server...\n" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "bytes" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Kb" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Mb" msgstr "" -#: src/gui/curses/gui-display.c:572 +#: src/gui/curses/gui-display.c:597 msgid "Gb" msgstr "" -#: src/gui/curses/gui-display.c:935 +#: src/gui/curses/gui-display.c:960 msgid "(away)" msgstr "" -#: src/gui/curses/gui-display.c:1013 +#: src/gui/curses/gui-display.c:1038 #, c-format msgid "%d:[not connected] " msgstr "" -#: src/gui/curses/gui-display.c:1024 +#: src/gui/curses/gui-display.c:1049 msgid "Act: " msgstr "" -#: src/gui/curses/gui-display.c:1068 +#: src/gui/curses/gui-display.c:1093 #, c-format msgid "Lag: %.1f" msgstr "" -#: src/gui/curses/gui-display.c:1080 src/gui/curses/gui-display.c:1083 +#: src/gui/curses/gui-display.c:1105 src/gui/curses/gui-display.c:1108 msgid "-MORE-" msgstr "" -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1277 msgid " [A] Accept" msgstr "" -#: src/gui/curses/gui-display.c:1253 src/gui/curses/gui-display.c:1259 -#: src/gui/curses/gui-display.c:1266 +#: src/gui/curses/gui-display.c:1278 src/gui/curses/gui-display.c:1284 +#: src/gui/curses/gui-display.c:1291 msgid " [C] Cancel" msgstr "" -#: src/gui/curses/gui-display.c:1254 src/gui/curses/gui-display.c:1260 -#: src/gui/curses/gui-display.c:1267 src/gui/curses/gui-display.c:1274 -#: src/gui/curses/gui-display.c:1279 +#: src/gui/curses/gui-display.c:1279 src/gui/curses/gui-display.c:1285 +#: src/gui/curses/gui-display.c:1292 src/gui/curses/gui-display.c:1299 +#: src/gui/curses/gui-display.c:1304 msgid " [Q] Close DCC view" msgstr "" -#: src/gui/curses/gui-display.c:1273 +#: src/gui/curses/gui-display.c:1298 msgid " [R] Remove" msgstr "" @@ -1884,16 +1884,15 @@ msgid "manage windows" msgstr "" #: src/common/command.c:102 -msgid "[action]" +msgid "[list | splith | splitv | [merge [down | up | left | right | all]]]" msgstr "" -#: src/common/command.c:103 +#: src/common/command.c:104 msgid "" -"action: action to do:\n" -" close close current window (under development!)\n" -" list list opened windows (no parameter implies this list)\n" -" splith split current window horizontally\n" -" splitv split current window vertically" +" list list opened windows (no parameter implies this list)\n" +"splith split current window horizontally\n" +"splitv split current window vertically\n" +" merge merge window with another" msgstr "" #: src/common/command.c:250 @@ -1964,7 +1963,7 @@ msgstr "" msgid "This window is not a channel!\n" msgstr "" -#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:855 +#: src/common/command.c:736 src/common/command.c:760 src/common/command.c:865 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "" @@ -1988,269 +1987,274 @@ msgid "No alias defined.\n" msgstr "" #: src/common/command.c:807 -msgid "Opened buffers:\n" -msgstr "" - -#: src/common/command.c:826 msgid "Channel: " msgstr "" -#: src/common/command.c:829 src/common/command.c:839 +#: src/common/command.c:810 src/common/command.c:820 msgid " (server: " msgstr "" -#: src/common/command.c:836 +#: src/common/command.c:817 msgid "Private with: " msgstr "" -#: src/common/command.c:878 src/common/command.c:992 +#: src/common/command.c:844 +msgid "Opened buffers:\n" +msgstr "" + +#: src/common/command.c:888 src/common/command.c:1002 #, c-format msgid "%s incorrect buffer number\n" msgstr "" -#: src/common/command.c:892 +#: src/common/command.c:902 #, c-format msgid "%s can not close the single buffer\n" msgstr "" -#: src/common/command.c:902 +#: src/common/command.c:912 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" -#: src/common/command.c:928 +#: src/common/command.c:938 msgid "Notify levels: " msgstr "" -#: src/common/command.c:955 src/common/command.c:965 +#: src/common/command.c:965 src/common/command.c:975 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "" -#: src/common/command.c:983 +#: src/common/command.c:993 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1017 +#: src/common/command.c:1027 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "" -#: src/common/command.c:1046 +#: src/common/command.c:1056 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1066 src/common/command.c:1109 -#: src/common/command.c:1759 +#: src/common/command.c:1076 src/common/command.c:1119 +#: src/common/command.c:1769 #, c-format msgid "%s server \"%s\" not found\n" msgstr "" -#: src/common/command.c:1092 +#: src/common/command.c:1102 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1100 +#: src/common/command.c:1110 msgid "Auto-reconnection is cancelled\n" msgstr "" -#: src/common/command.c:1129 +#: src/common/command.c:1139 #, c-format msgid "> List of %s internal commands:\n" msgstr "" -#: src/common/command.c:1140 +#: src/common/command.c:1150 msgid "> List of IRC commands:\n" msgstr "" -#: src/common/command.c:1158 +#: src/common/command.c:1168 #, c-format msgid "> Help on %s internal command \"" msgstr "" -#: src/common/command.c:1163 src/common/command.c:1186 +#: src/common/command.c:1173 src/common/command.c:1196 msgid "Syntax: " msgstr "" -#: src/common/command.c:1181 +#: src/common/command.c:1191 msgid "> Help on IRC command \"" msgstr "" -#: src/common/command.c:1200 +#: src/common/command.c:1210 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "" -#: src/common/command.c:1225 +#: src/common/command.c:1235 msgid "Registered Perl scripts:\n" msgstr "" -#: src/common/command.c:1242 src/common/command.c:1264 -#: src/common/command.c:1286 +#: src/common/command.c:1252 src/common/command.c:1274 +#: src/common/command.c:1296 msgid " (none)\n" msgstr "" -#: src/common/command.c:1247 +#: src/common/command.c:1257 msgid "Perl message handlers:\n" msgstr "" -#: src/common/command.c:1256 +#: src/common/command.c:1266 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr "" -#: src/common/command.c:1269 +#: src/common/command.c:1279 msgid "Perl command handlers:\n" msgstr "" -#: src/common/command.c:1278 +#: src/common/command.c:1288 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr "" -#: src/common/command.c:1298 +#: src/common/command.c:1308 msgid "Perl scripts unloaded\n" msgstr "" -#: src/common/command.c:1324 src/common/command.c:1991 +#: src/common/command.c:1334 src/common/command.c:2040 +#: src/common/command.c:2052 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "" -#: src/common/command.c:1337 +#: src/common/command.c:1347 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" msgstr "" -#: src/common/command.c:1391 +#: src/common/command.c:1401 msgid "No server.\n" msgstr "" -#: src/common/command.c:1402 +#: src/common/command.c:1412 #, c-format msgid "Server '%s' not found.\n" msgstr "" -#: src/common/command.c:1414 +#: src/common/command.c:1424 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "" -#: src/common/command.c:1422 +#: src/common/command.c:1432 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "" -#: src/common/command.c:1441 +#: src/common/command.c:1451 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1449 +#: src/common/command.c:1459 #, c-format msgid "" "%s you can not delete server \"%s\" because you are connected to. Try /" "disconnect %s before.\n" msgstr "" -#: src/common/command.c:1465 src/common/command.c:1606 +#: src/common/command.c:1475 src/common/command.c:1616 msgid "Server" msgstr "" -#: src/common/command.c:1468 +#: src/common/command.c:1478 msgid "has been deleted\n" msgstr "" -#: src/common/command.c:1483 +#: src/common/command.c:1493 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "" -#: src/common/command.c:1493 +#: src/common/command.c:1503 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "" -#: src/common/command.c:1518 src/common/command.c:1546 -#: src/common/command.c:1559 src/common/command.c:1585 +#: src/common/command.c:1528 src/common/command.c:1556 +#: src/common/command.c:1569 src/common/command.c:1595 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1531 +#: src/common/command.c:1541 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1572 +#: src/common/command.c:1582 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1609 +#: src/common/command.c:1619 msgid "created\n" msgstr "" -#: src/common/command.c:1615 +#: src/common/command.c:1625 #, c-format msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1672 +#: src/common/command.c:1682 msgid "(unknown)" msgstr "" -#: src/common/command.c:1695 +#: src/common/command.c:1705 msgid "(password hidden) " msgstr "" -#: src/common/command.c:1791 src/common/command.c:1838 +#: src/common/command.c:1801 src/common/command.c:1848 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "" -#: src/common/command.c:1796 src/common/command.c:1830 +#: src/common/command.c:1806 src/common/command.c:1840 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "" -#: src/common/command.c:1812 +#: src/common/command.c:1822 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "" -#: src/common/command.c:1914 +#: src/common/command.c:1924 #, c-format msgid "No config option found with \"%s\"\n" msgstr "" -#: src/common/command.c:1917 +#: src/common/command.c:1927 msgid "No config option found\n" msgstr "" -#: src/common/command.c:1924 +#: src/common/command.c:1934 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "" -#: src/common/command.c:1927 +#: src/common/command.c:1937 msgid "config option(s) found\n" msgstr "" -#: src/common/command.c:1947 +#: src/common/command.c:1957 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1957 +#: src/common/command.c:1967 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" +#: src/common/command.c:1987 +msgid "Opened windows:\n" +msgstr "" + #: src/common/weechat.c:184 #, c-format msgid "" diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 7b7cb68ba..e6cf37ad5 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -99,13 +99,13 @@ t_weechat_command weechat_commands[] = N_("alias_name"), N_("alias_name: name of alias to remove"), 1, 1, NULL, weechat_cmd_unalias }, { "window", N_("manage windows"), - N_("[action]"), - N_("action: action to do:\n" - " close close current window (under development!)\n" - " list list opened windows (no parameter implies this list)\n" - " splith split current window horizontally\n" - " splitv split current window vertically"), - 0, MAX_ARGS, weechat_cmd_window, NULL }, + N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"), + N_( + " list list opened windows (no parameter implies this list)\n" + "splith split current window horizontally\n" + "splitv split current window vertically\n" + " merge merge window with another"), + 0, 2, weechat_cmd_window, NULL }, { NULL, NULL, NULL, NULL, 0, 0, NULL, NULL } }; @@ -788,6 +788,43 @@ weechat_cmd_alias (char *arguments) } /* + * weechat_cmd_buffer_display_info: display info about a buffer + */ + +void +weechat_cmd_buffer_display_info (t_gui_buffer *buffer) +{ + if (buffer->dcc) + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n"); + else if (BUFFER_IS_SERVER (buffer)) + { + gui_printf (NULL, _("Server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s\n", SERVER(buffer)->name); + } + else if (BUFFER_IS_CHANNEL (buffer)) + { + gui_printf (NULL, _("Channel: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", CHANNEL(buffer)->name); + gui_printf (NULL, _(" (server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", SERVER(buffer)->name); + gui_printf (NULL, ")\n"); + } + else if (BUFFER_IS_PRIVATE (buffer)) + { + gui_printf (NULL, _("Private with: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, + "%s", CHANNEL(buffer)->name); + gui_printf (NULL, _(" (server: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, + "%s", SERVER(buffer)->name); + gui_printf (NULL, ")\n"); + } +} + +/* * weechat_cmd_buffer: manage buffers */ @@ -813,34 +850,7 @@ weechat_cmd_buffer (int argc, char **argv) gui_printf (NULL, "%d", ptr_buffer->number); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] "); - if (ptr_buffer->dcc) - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n"); - else if (BUFFER_IS_SERVER (ptr_buffer)) - { - gui_printf (NULL, _("Server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s\n", SERVER(ptr_buffer)->name); - } - else if (BUFFER_IS_CHANNEL (ptr_buffer)) - { - gui_printf (NULL, _("Channel: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", CHANNEL(ptr_buffer)->name); - gui_printf (NULL, _(" (server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", SERVER(ptr_buffer)->name); - gui_printf (NULL, ")\n"); - } - else if (BUFFER_IS_PRIVATE (ptr_buffer)) - { - gui_printf (NULL, _("Private with: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, - "%s", CHANNEL(ptr_buffer)->name); - gui_printf (NULL, _(" (server: ")); - gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, - "%s", SERVER(ptr_buffer)->name); - gui_printf (NULL, ")\n"); - } + weechat_cmd_buffer_display_info (ptr_buffer); } } else @@ -1966,11 +1976,36 @@ weechat_cmd_unalias (char *arguments) int weechat_cmd_window (int argc, char **argv) { + t_gui_window *ptr_win; + int i; + if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ - irc_display_prefix (NULL, PREFIX_ERROR); - gui_printf (NULL, "window list -- NOT DEVELOPED!\n"); + + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Opened windows:\n")); + + i = 1; + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); + gui_printf (NULL, "%d", i); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ("); + gui_printf (NULL, "%d", ptr_win->win_x); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":"); + gui_printf (NULL, "%d", ptr_win->win_y); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ";"); + gui_printf (NULL, "%d", ptr_win->win_width); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "x"); + gui_printf (NULL, "%d", ptr_win->win_height); + gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ") "); + + weechat_cmd_buffer_display_info (ptr_win->buffer); + + i++; + } } else { @@ -1984,12 +2019,39 @@ weechat_cmd_window (int argc, char **argv) /* split window vertically */ gui_window_split_vertic (gui_current_window); } + else if (strcasecmp (argv[0], "merge") == 0) + { + if (argc >= 2) + { + if (strcasecmp (argv[1], "down") == 0) + gui_window_merge_down (gui_current_window); + else if (strcasecmp (argv[1], "up") == 0) + gui_window_merge_up (gui_current_window); + else if (strcasecmp (argv[1], "left") == 0) + gui_window_merge_left (gui_current_window); + else if (strcasecmp (argv[1], "right") == 0) + gui_window_merge_right (gui_current_window); + else if (strcasecmp (argv[1], "all") == 0) + gui_window_merge_all (gui_current_window); + else + { + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, + _("%s unknown option for \"%s\" command\n"), + WEECHAT_ERROR, "window merge"); + return -1; + } + } + else + gui_window_merge_auto (gui_current_window); + } else { irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "window"); + return -1; } } return 0; diff --git a/weechat/src/common/completion.c b/weechat/src/common/completion.c index 1ca4ad225..f0aea7cd1 100644 --- a/weechat/src/common/completion.c +++ b/weechat/src/common/completion.c @@ -233,21 +233,46 @@ completion_build_list (t_completion *completion, void *channel) } return; } - if ((strcasecmp (completion->base_command, "window") == 0) - && (completion->base_command_arg == 2)) + if (strcasecmp (completion->base_command, "window") == 0) { - weelist_add (&completion->completion_list, - &completion->last_completion, - "close"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "list"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "splith"); - weelist_add (&completion->completion_list, - &completion->last_completion, - "splitv"); + if (completion->base_command_arg == 1) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splith"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splitv"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "merge"); + return; + } + + if (completion->base_command_arg == 2) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "down"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "up"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "left"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "right"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "all"); + return; + } + + completion_stop (completion); return; } diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 1fe7ea1e9..591cccecb 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -299,6 +299,29 @@ gui_curses_window_clear (WINDOW *window) } /* + * gui_draw_window_separator: draw window separation + */ + +void +gui_draw_window_separator (t_gui_window *window) +{ + if (window->win_separator) + delwin (window->win_separator); + + if (window->win_x > 0) + { + window->win_separator = newwin (window->win_height, + 1, + window->win_y, + window->win_x - 1); + gui_window_set_color (window->win_separator, COLOR_WIN_TITLE); + wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); + wrefresh (window->win_separator); + refresh (); + } +} + +/* * gui_draw_buffer_title: draw title window for a buffer */ @@ -419,6 +442,8 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count) { num_displayed = window->win_chat_width - window->win_chat_cursor_x; + if (num_displayed < 0) + return; saved_char = ptr_message->message[offset + num_displayed]; ptr_message->message[offset + num_displayed] = '\0'; if (lines_displayed >= num_lines - count) @@ -1583,49 +1608,6 @@ gui_move_page_down (t_gui_window *window) } /* - * gui_curses_resize_handler: called when term size is modified - */ - -void -gui_curses_resize_handler () -{ - t_gui_window *ptr_win, *old_current_window; - int old_width, old_height; - int new_width, new_height; - - getmaxyx (stdscr, old_height, old_width); - - endwin (); - refresh (); - - getmaxyx (stdscr, new_height, new_width); - - old_current_window = gui_current_window; - - /* TODO: manage when some windows are outside new term size */ - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - ptr_win->dcc_first = NULL; - ptr_win->dcc_selected = NULL; - if (ptr_win->win_x + ptr_win->win_width == old_width) - ptr_win->win_width = new_width - ptr_win->win_x; - if (ptr_win->win_y + ptr_win->win_height == old_height) - ptr_win->win_height = new_height - ptr_win->win_y; - gui_switch_to_buffer (ptr_win, ptr_win->buffer); - } - - gui_current_window = old_current_window; - if ((new_width > 5) && (new_height > 5)) - { - gui_ok = 1; - gui_calculate_pos_size (gui_current_window); - gui_redraw_buffer (gui_current_window->buffer); - } - else - gui_ok = 0; -} - -/* * gui_window_init_subviews: init subviews for a WeeChat window */ @@ -1703,16 +1685,227 @@ gui_window_split_vertic (t_gui_window *window) gui_switch_to_buffer (gui_current_window, gui_current_window->buffer); gui_redraw_buffer (gui_current_window->buffer); - /* create & draw separator if window is not on the left */ - gui_current_window->win_separator = newwin (gui_current_window->win_height, - 1, - gui_current_window->win_y, - gui_current_window->win_x - 1); - gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE); - wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); - wrefresh (gui_current_window->win_separator); - refresh (); + /* create & draw separator */ + gui_draw_window_separator (gui_current_window); + } +} + +/* + * gui_window_merge_down: merge window, direction down + */ + +int +gui_window_merge_down (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_y == window->win_y + window->win_height) + && (ptr_win->win_x == window->win_x) + && (ptr_win->win_width == window->win_width)) + { + window->win_height += ptr_win->win_height; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found below current window */ + return -1; +} + +/* + * gui_window_merge_up: merge window, direction up + */ + +int +gui_window_merge_up (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_y + ptr_win->win_height == window->win_y) + && (ptr_win->win_x == window->win_x) + && (ptr_win->win_width == window->win_width)) + { + window->win_height += ptr_win->win_height; + window->win_y -= ptr_win->win_height; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found above current window */ + return -1; +} + +/* + * gui_window_merge_left: merge window, direction left + */ + +int +gui_window_merge_left (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_x + ptr_win->win_width + 1 == window->win_x) + && (ptr_win->win_y == window->win_y) + && (ptr_win->win_height == window->win_height)) + { + window->win_width += ptr_win->win_width + 1; + window->win_x -= ptr_win->win_width + 1; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } } + + /* no window found on the left of current window */ + return -1; +} + +/* + * gui_window_merge_right: merge window, direction right + */ + +int +gui_window_merge_right (t_gui_window *window) +{ + t_gui_window *ptr_win; + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win != window) + { + if ((ptr_win->win_x == window->win_x + window->win_width + 1) + && (ptr_win->win_y == window->win_y) + && (ptr_win->win_height == window->win_height)) + { + window->win_width += ptr_win->win_width + 1; + gui_window_free (ptr_win); + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); + return 0; + } + } + } + + /* no window found on the right of current window */ + return -1; +} + +/* + * gui_window_merge: merge a window, direction auto + */ + +void +gui_window_merge_auto (t_gui_window *window) +{ + if (gui_window_merge_down (window) == 0) + return; + if (gui_window_merge_up (window) == 0) + return; + if (gui_window_merge_left (window) == 0) + return; + if (gui_window_merge_right (window) == 0) + return; +} + +/* + * gui_window_merge_all: merge all windows + */ + +void +gui_window_merge_all (t_gui_window *window) +{ + while (gui_windows->next_window) + { + gui_window_free ((gui_windows == window) ? gui_windows->next_window : gui_windows); + } + window->win_x = 0; + window->win_y = 0; + window->win_width = COLS; + window->win_height = LINES; + gui_switch_to_buffer (window, window->buffer); + gui_redraw_buffer (window->buffer); +} + +/* + * gui_curses_resize_handler: called when term size is modified + */ + +void +gui_curses_resize_handler () +{ + t_gui_window *ptr_win, *old_current_window; + int old_width, old_height; + int new_width, new_height; + int merge_all_windows; + + getmaxyx (stdscr, old_height, old_width); + + endwin (); + refresh (); + + getmaxyx (stdscr, new_height, new_width); + + old_current_window = gui_current_window; + + gui_ok = ((new_width > 5) && (new_height > 5)); + + merge_all_windows = 0; + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + ptr_win->dcc_first = NULL; + ptr_win->dcc_selected = NULL; + + if (!merge_all_windows) + { + if ((ptr_win->win_x > new_width - 5) + || (ptr_win->win_y > new_height - 5)) + merge_all_windows = 1; + else + { + if (ptr_win->win_x + ptr_win->win_width == old_width) + ptr_win->win_width = new_width - ptr_win->win_x; + if (ptr_win->win_y + ptr_win->win_height == old_height) + ptr_win->win_height = new_height - ptr_win->win_y; + if ((ptr_win->win_width < 5) || (ptr_win->win_height < 5)) + merge_all_windows = 1; + } + } + } + + if (merge_all_windows) + gui_window_merge_all (gui_current_window); + + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + gui_calculate_pos_size (ptr_win); + gui_switch_to_buffer (ptr_win, ptr_win->buffer); + gui_draw_window_separator (ptr_win); + } + + gui_current_window = old_current_window; + gui_redraw_buffer (gui_current_window->buffer); } /* diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h index 756a807a4..1056ce1f6 100644 --- a/weechat/src/gui/gui.h +++ b/weechat/src/gui/gui.h @@ -247,9 +247,8 @@ extern t_gui_buffer *last_gui_buffer; extern t_gui_buffer *buffer_before_dcc; extern t_gui_infobar *gui_infobar; -/* prototypes */ - /* GUI independent functions */ + extern t_gui_window *gui_window_new (int, int, int, int); extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int); extern void gui_buffer_clear (t_gui_buffer *); @@ -267,7 +266,9 @@ extern void gui_move_next_word (t_gui_buffer *); extern void gui_buffer_insert_string (t_gui_buffer *, char *, int); extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int); extern void gui_move_buffer_to_number (t_gui_window *, int); + /* GUI dependant functions */ + extern int gui_assign_color (int *, char *); extern int gui_get_color_by_name (char *); extern char *gui_get_color_by_value (int); @@ -292,6 +293,12 @@ extern void gui_curses_resize_handler (); extern void gui_window_init_subwindows (t_gui_window *); extern void gui_window_split_horiz (t_gui_window *); extern void gui_window_split_vertic (t_gui_window *); +extern int gui_window_merge_up (t_gui_window *); +extern int gui_window_merge_down (t_gui_window *); +extern int gui_window_merge_left (t_gui_window *); +extern int gui_window_merge_right (t_gui_window *); +extern void gui_window_merge_auto (t_gui_window *); +extern void gui_window_merge_all (t_gui_window *); extern void gui_pre_init (int *, char **[]); extern void gui_init_colors (); extern void gui_set_window_title (); |