1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 06:46:38 +02:00

Add new /layout command and save_layout_on_exit config option, to save/restore windows and buffers order (task #5453)

This commit is contained in:
Sebastien Helleu
2008-10-02 18:03:27 +02:00
parent f51f02547e
commit 2ffd141cf4
41 changed files with 1960 additions and 267 deletions
+3 -1
View File
@@ -1,10 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2008-09-22
ChangeLog - 2008-10-02
Version 0.2.7 (under dev!):
* add new /layout command and save_layout_on_exit config option, to
save/restore windows and buffers order (task #5453)
* fix network connection for hostnames resolving to several IPs: try all
IPs in list until one succeeds (bug #21473, debian bug #498610)
* fix display bug with some weird UTF-8 chars (bug #19687)
+13 -1
View File
@@ -139,6 +139,18 @@ belegen/freigeben von Tasten
unbind: unbind a key
reset: restore bindings to the default values and delete ALL personal bindings (use carefully!)
</programlisting>
<command>layout [[save | apply | reset] [buffers | windows]]</command>
<programlisting>
save/apply/reset layout for buffers and windows
save: save current layout
apply: apply saved layout
reset: remove saved layout
buffers: save/apply only buffers (order of buffers)
windows: save/apply only windows (buffer displayed by each window)
Without argument, this command displays saved layout.
</programlisting>
<command>plugin [list [Name]] | [listfull [Name]] | [load Dateiname] | [autoload] | [reload [Name]] | [unload [Name]]</command>
<programlisting>
auflisten/laden/entladen von Plugins
@@ -150,7 +162,7 @@ autoload: autoload plugins in system or user directory
reload: reload one plugin (if no name given, unload all plugins, then autoload plugins)
unload: unload one or all plugins
Without argument, /plugin command lists loaded plugins.
Without argument, this command lists loaded plugins.
</programlisting>
<command>quit</command>
<programlisting>
+17 -1
View File
@@ -1734,7 +1734,7 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_on_exit</command>
<command>weechat.look.save_config_on_exit</command>
<itemizedlist>
<listitem>
<para>description: save configuration file on exit</para>
@@ -1750,6 +1750,22 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_layout_on_exit</command>
<itemizedlist>
<listitem>
<para>description: save layout on exit (buffers, windows, or both)</para>
</listitem>
<listitem>
<para>type: integer</para>
</listitem>
<listitem>
<para>values: none, buffers, windows, all</para>
</listitem>
<listitem>
<para>default value: all</para>
</listitem>
</itemizedlist>
<command>weechat.look.scroll_amount</command>
<itemizedlist>
<listitem>
+13 -1
View File
@@ -139,6 +139,18 @@ bind/unbind keys
unbind: unbind a key
reset: restore bindings to the default values and delete ALL personal bindings (use carefully!)
</programlisting>
<command>layout [[save | apply | reset] [buffers | windows]]</command>
<programlisting>
save/apply/reset layout for buffers and windows
save: save current layout
apply: apply saved layout
reset: remove saved layout
buffers: save/apply only buffers (order of buffers)
windows: save/apply only windows (buffer displayed by each window)
Without argument, this command displays saved layout.
</programlisting>
<command>plugin [list [name]] | [listfull [name]] | [load filename] | [autoload] | [reload [name]] | [unload [name]]</command>
<programlisting>
list/load/unload plugins
@@ -150,7 +162,7 @@ autoload: autoload plugins in system or user directory
reload: reload one plugin (if no name given, unload all plugins, then autoload plugins)
unload: unload one or all plugins
Without argument, /plugin command lists loaded plugins.
Without argument, this command lists loaded plugins.
</programlisting>
<command>quit</command>
<programlisting>
+17 -1
View File
@@ -1734,7 +1734,7 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_on_exit</command>
<command>weechat.look.save_config_on_exit</command>
<itemizedlist>
<listitem>
<para>description: save configuration file on exit</para>
@@ -1750,6 +1750,22 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_layout_on_exit</command>
<itemizedlist>
<listitem>
<para>description: save layout on exit (buffers, windows, or both)</para>
</listitem>
<listitem>
<para>type: integer</para>
</listitem>
<listitem>
<para>values: none, buffers, windows, all</para>
</listitem>
<listitem>
<para>default value: all</para>
</listitem>
</itemizedlist>
<command>weechat.look.scroll_amount</command>
<itemizedlist>
<listitem>
+13 -1
View File
@@ -137,6 +137,18 @@ associer/libérer des touches
unbind: supprimer l'association à une touche
reset: restaure les touches aux valeurs par défaut et supprime TOUTES les touches personnelles (utiliser avec précaution !)
</programlisting>
<command>layout [[save | apply | reset] [buffers | windows]]</command>
<programlisting>
sauve/applique/réinitialise la disposition des tampons et fenêtres
save: sauve la disposition courante
apply: applique la disposition sauvegardée
reset: supprime la disposition sauvegardée
buffers: sauve/applique seulement pour les tampons (ordre des tampons)
windows: sauve/applique seulement pour les fenêtres (le tampon affiché par chaque fenêtre)
Sans paramètre, cette commande affiche la disposition sauvegardée.
</programlisting>
<command>plugin [list [nom]] | [listfull [nom]] | [load fichier] | [autoload] | [reload [nom]] | [unload [nom]]</command>
<programlisting>
liste/charge/décharge des extensions
@@ -148,7 +160,7 @@ autoload: charger automatiquement les extensions dans un répertoire système ou
reload: recharger une extension (si pas de nom donné, décharger toutes les extensions, puis puis recharger automatiquement les extensions)
unload: décharger une ou plusieurs exteneions
Sans paramètre, la commande /plugin liste les extensions chargées.
Sans paramètre, cette commande liste les extensions chargées.
</programlisting>
<command>quit</command>
<programlisting>
+17 -1
View File
@@ -1734,7 +1734,7 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_on_exit</command>
<command>weechat.look.save_config_on_exit</command>
<itemizedlist>
<listitem>
<para>description: sauvegarder la configuration en quittant</para>
@@ -1750,6 +1750,22 @@
</listitem>
</itemizedlist>
<command>weechat.look.save_layout_on_exit</command>
<itemizedlist>
<listitem>
<para>description: sauve la disposition en quittant (tampons, fenêtres, ou les deux)</para>
</listitem>
<listitem>
<para>type: entier</para>
</listitem>
<listitem>
<para>valeurs: none, buffers, windows, all</para>
</listitem>
<listitem>
<para>valeur par défaut: all</para>
</listitem>
</itemizedlist>
<command>weechat.look.scroll_amount</command>
<itemizedlist>
<listitem>
+2
View File
@@ -74,6 +74,8 @@
./src/gui/gui-input.h
./src/gui/gui-keyboard.c
./src/gui/gui-keyboard.h
./src/gui/gui-layout.c
./src/gui/gui-layout.h
./src/gui/gui-main.h
./src/gui/gui-nicklist.c
./src/gui/gui-nicklist.h
+66 -4
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -395,6 +395,45 @@ msgstr "Žádná klávesa nenalezena.\n"
msgid "%sError: unable to bind key \"%s\""
msgstr "%s nemohu napojit kalávesu \"%s\"\n"
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
#, fuzzy
msgid "Saved layout for buffers:"
msgstr "časová známka pro buffer"
#, fuzzy
msgid "Saved layout for windows:"
msgstr "konec /who seznamu"
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
#, fuzzy
msgid "Layout reset for buffers"
msgstr "časová známka pro buffer"
#, fuzzy
msgid "Layout reset for windows"
msgstr "konec /who seznamu"
#, fuzzy
msgid "Plugins loaded:"
msgstr "Načtené pluginy:\n"
@@ -863,6 +902,22 @@ msgstr ""
" reset: obnoví klávesy na výchozí hodnoty a smaže VŠECHNY uživatlské "
"zkratky (používejte opatrně!)"
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr "seznam/načíst/odebrat pluginy"
@@ -883,7 +938,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
" list: vypíše načtené pluginy\n"
"listfull: vypíše načtené s detailními informacemi\n"
@@ -1034,8 +1089,8 @@ msgstr ""
#, fuzzy
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
"%s mel by ste nyní provést /save pro zapsání volby \"save_on_exit\" "
"dokonfiguračního souboru.\n"
@@ -1219,6 +1274,9 @@ msgstr "použít značku na serveru/kanále pro zobrazení první nepřečtené
msgid "save configuration file on exit"
msgstr "uložit soubor s nastavením při ukončení"
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "o kolik řádů posunou pomocí scroll_up a scroll_down"
@@ -4693,6 +4751,10 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s chybí argument pro volbu \"%s\"\n"
#, fuzzy
#~ msgid "Saved buffers layout:"
#~ msgstr "Seznam bufferů:"
#, fuzzy
#~ msgid "%s: disconnected from server"
#~ msgstr "Odpojen od serveru!\n"
+62 -4
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -401,6 +401,45 @@ msgstr "Keine Taste gefunden.\n"
msgid "%sError: unable to bind key \"%s\""
msgstr "%s kann die Taste \"%s\" nicht zuordnen\n"
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
#, fuzzy
msgid "Saved layout for buffers:"
msgstr "Timestamp für Puffer"
#, fuzzy
msgid "Saved layout for windows:"
msgstr "Ende der /who-Liste"
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
#, fuzzy
msgid "Layout reset for buffers"
msgstr "Timestamp für Puffer"
#, fuzzy
msgid "Layout reset for windows"
msgstr "Ende der /who-Liste"
#, fuzzy
msgid "Plugins loaded:"
msgstr "Plugins geladen:\n"
@@ -837,6 +876,22 @@ msgstr ""
" reset: Standardbelegung wiederherstellen und entferne ALLE eigenen "
"Belegungen (Vorsicht!)"
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr "auflisten/laden/entladen von Plugins"
@@ -857,7 +912,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
" list: geladene Plugins auflisten\n"
"listfull: geladene Plugins mit Details für jedes Plugin auflisten\n"
@@ -999,8 +1054,8 @@ msgstr ""
#, fuzzy
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
"%s Sie sollten jetzt /save ausführen, um die Option \"save_on_exit\" in die "
"Konfigurationsdatei zu schreiben.\n"
@@ -1177,6 +1232,9 @@ msgstr "markiere die erste, ungelesene Zeile bei Server- und Channel-Puffern"
msgid "save configuration file on exit"
msgstr "Konfiguration beim Verlassen abspeichern"
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "Anzahl der zu scrollenden Zeilen bei Bild-Hoch- und Bild-Runter-Taste"
+62 -4
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -396,6 +396,45 @@ msgstr "Ningún alias definido.\n"
msgid "%sError: unable to bind key \"%s\""
msgstr "%s No ha sido posible atar la clave \"%s\"\n"
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
#, fuzzy
msgid "Saved layout for buffers:"
msgstr "fecha y hora para las búfers"
#, fuzzy
msgid "Saved layout for windows:"
msgstr "fin de la lista /who"
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
#, fuzzy
msgid "Layout reset for buffers"
msgstr "fecha y hora para las búfers"
#, fuzzy
msgid "Layout reset for windows"
msgstr "fin de la lista /who"
#, fuzzy
msgid "Plugins loaded:"
msgstr "Plugins cargados:\n"
@@ -829,6 +868,22 @@ msgstr ""
" reset: restaura anclajes a los valores por defecto y elimina todos los "
"anclajes personales (usar cuidadosamente)"
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr "listar/cargar/descargar plugins"
@@ -847,7 +902,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
msgid "quit WeeChat"
@@ -977,8 +1032,8 @@ msgstr ""
"ejemplo 25 significa crear una nueva ventana de tamaño = tamaño_actual / 4"
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
#, fuzzy, c-format
@@ -1160,6 +1215,9 @@ msgstr ""
msgid "save configuration file on exit"
msgstr "guardar configuración a disco"
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "cuántas líneas a desplazar con scroll_up and scroll_down"
+71 -7
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"PO-Revision-Date: 2008-09-24 14:16+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2008-10-02 17:58+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -367,6 +367,43 @@ msgstr "Aucune touche trouvée"
msgid "%sError: unable to bind key \"%s\""
msgstr "%sErreur: impossible de créer la touche \"%s\""
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr "feuille: id: %d, parent: %d, extension: '%s', tampon: '%s'"
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr "noeud: id: %d, parent: %d, enfant1: %d, enfant2: %d, taille: %d%% (%s)"
msgid "horizontal split"
msgstr "découpage horizontal"
msgid "vertical split"
msgstr "découpage vertical"
msgid "Saved layout for buffers:"
msgstr "Disposition sauvegardée pour les tampons :"
msgid "Saved layout for windows:"
msgstr "Disposition sauvegardée pour les fenêtres :"
msgid "No layout saved"
msgstr "Pas de disposition sauvée"
msgid "Layout saved for buffers (order of buffers)"
msgstr "Disposition sauvegardée pour les tampons (ordre des tampons)"
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
"Disposition sauvegardée pour les fenêtres (le tampon affiché par chaque "
"fenêtre)"
msgid "Layout reset for buffers"
msgstr "Disposition réinitialisée pour les tampons"
msgid "Layout reset for windows"
msgstr "Disposition réinitialisée pour les fenêtres"
msgid "Plugins loaded:"
msgstr "Extensions chargées:"
@@ -867,6 +904,30 @@ msgstr ""
" reset: restaure les touches aux valeurs par défaut et supprime TOUTES "
"les touches personnelles (utiliser avec précaution !)"
msgid "save/apply/reset layout for buffers and windows"
msgstr "sauve/applique/réinitialise la disposition des tampons et fenêtres"
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr "[[save | apply | reset] [buffers | windows]]"
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
" save: sauve la disposition courante\n"
" apply: applique la disposition sauvegardée\n"
" reset: supprime la disposition sauvegardée\n"
"buffers: sauve/applique seulement pour les tampons (ordre des tampons)\n"
"windows: sauve/applique seulement pour les fenêtres (le tampon affiché par "
"chaque fenêtre)\n"
"\n"
"Sans paramètre, cette commande affiche la disposition sauvegardée."
msgid "list/load/unload plugins"
msgstr "liste/charge/décharge des extensions"
@@ -886,7 +947,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
" list: lister les extensions chargées\n"
"listfull: lister les extensions chargées (verbeux)\n"
@@ -897,7 +958,7 @@ msgstr ""
"extensions, puis puis recharger automatiquement les extensions)\n"
" unload: décharger une ou plusieurs exteneions\n"
"\n"
"Sans paramètre, la commande /plugin liste les extensions chargées."
"Sans paramètre, cette commande liste les extensions chargées."
msgid "quit WeeChat"
msgstr "quitter WeeChat"
@@ -1038,11 +1099,11 @@ msgstr ""
"taille_courante / 4"
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
"Attention: vous devriez taper /save maintenant pour écrire l'option "
"\"save_on_exit\" dans le fichier de configuration"
"\"save_config_on_exit\" dans le fichier de configuration"
#, c-format
msgid "\t\tDay changed to %s"
@@ -1221,6 +1282,9 @@ msgstr ""
msgid "save configuration file on exit"
msgstr "sauvegarder la configuration en quittant"
msgid "save layout on exit (buffers, windows, or both)"
msgstr "sauve la disposition en quittant (tampons, fenêtres, ou les deux)"
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "nombre de lignes pour le défilement avec scroll_up et scroll_down"
+62 -4
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -402,6 +402,45 @@ msgstr "Nem találtam billentyűt.\n"
msgid "%sError: unable to bind key \"%s\""
msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
#, fuzzy
msgid "Saved layout for buffers:"
msgstr "a pufferek időbélyege"
#, fuzzy
msgid "Saved layout for windows:"
msgstr "a /who lista vége"
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
#, fuzzy
msgid "Layout reset for buffers"
msgstr "a pufferek időbélyege"
#, fuzzy
msgid "Layout reset for windows"
msgstr "a /who lista vége"
#, fuzzy
msgid "Plugins loaded:"
msgstr "Betöltött modulok:\n"
@@ -850,6 +889,22 @@ msgstr ""
" reset: billenzyűparancsok visszaállítása az eredeti értékekre és MINDEN "
"személyes hozzárendelés törlése (használja óvatosan!)"
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr "modulok listázása/betöltése/eltávolítása"
@@ -870,7 +925,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
"list: betöltött modulok listája\n"
"listfull: betöltött modulok listája részletes információkkal együtt\n"
@@ -1011,8 +1066,8 @@ msgstr ""
#, fuzzy
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
"%s most javasolt a /save parancs futtatása, hogy a \"save_on_exit\" (mentés "
"kilépéskor) opció bekerüljön a konfigurációs fájlba.\n"
@@ -1186,6 +1241,9 @@ msgstr "jelölje a szerveren/szobában utoljára olvasott sort"
msgid "save configuration file on exit"
msgstr "beállítások mentése kilépéskor"
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "a scroll_up és scroll_down hány sort görgessen"
+62 -4
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -397,6 +397,45 @@ msgstr "Клавиши не найдены.\n"
msgid "%sError: unable to bind key \"%s\""
msgstr "%s не могу установить клавишу \"%s\"\n"
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
#, fuzzy
msgid "Saved layout for buffers:"
msgstr "время в буферах"
#, fuzzy
msgid "Saved layout for windows:"
msgstr "конец списка /who"
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
#, fuzzy
msgid "Layout reset for buffers"
msgstr "время в буферах"
#, fuzzy
msgid "Layout reset for windows"
msgstr "конец списка /who"
#, fuzzy
msgid "Plugins loaded:"
msgstr "Загруженные plugin'ы\n"
@@ -845,6 +884,22 @@ msgstr ""
" reset: сбросить клавиши на значения по умолчанию и удалить ВСЕ личные "
"привязки (используйте внимательно!)"
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr "перечислить/загрузить/выгрузить plugin'ы"
@@ -865,7 +920,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
" list: перечислить загруженные pluginы\n"
"listfull: перечислить загруженные pluginы с дополнительной информацией\n"
@@ -1006,8 +1061,8 @@ msgstr ""
#, fuzzy
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
"%s вам следует набрать /save чтобы записать параметр \"save_on_exit\" в "
"конфигурационный файл.\n"
@@ -1189,6 +1244,9 @@ msgstr "использовать маркер непрочитанных соо
msgid "save configuration file on exit"
msgstr "сохранять конфигурационный файл при выходе"
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr "количество проматываемых кнопками PageUp и PageDown строк"
+2
View File
@@ -75,6 +75,8 @@ SET(WEECHAT_SOURCES
./src/gui/gui-input.h
./src/gui/gui-keyboard.c
./src/gui/gui-keyboard.h
./src/gui/gui-layout.c
./src/gui/gui-layout.h
./src/gui/gui-main.h
./src/gui/gui-nicklist.c
./src/gui/gui-nicklist.h
+58 -4
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-09-24 14:15+0200\n"
"POT-Creation-Date: 2008-10-02 17:51+0200\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"
@@ -344,6 +344,41 @@ msgstr ""
msgid "%sError: unable to bind key \"%s\""
msgstr ""
#, c-format
msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
msgstr ""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr ""
msgid "horizontal split"
msgstr ""
msgid "vertical split"
msgstr ""
msgid "Saved layout for buffers:"
msgstr ""
msgid "Saved layout for windows:"
msgstr ""
msgid "No layout saved"
msgstr ""
msgid "Layout saved for buffers (order of buffers)"
msgstr ""
msgid "Layout saved for windows (buffer displayed by each window)"
msgstr ""
msgid "Layout reset for buffers"
msgstr ""
msgid "Layout reset for windows"
msgstr ""
msgid "Plugins loaded:"
msgstr ""
@@ -719,6 +754,22 @@ msgid ""
"bindings (use carefully!)"
msgstr ""
msgid "save/apply/reset layout for buffers and windows"
msgstr ""
msgid "[[save | apply | reset] [buffers | windows]]"
msgstr ""
msgid ""
" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by each window)\n"
"\n"
"Without argument, this command displays saved layout."
msgstr ""
msgid "list/load/unload plugins"
msgstr ""
@@ -736,7 +787,7 @@ msgid ""
"autoload plugins)\n"
" unload: unload one or all plugins\n"
"\n"
"Without argument, /plugin command lists loaded plugins."
"Without argument, this command lists loaded plugins."
msgstr ""
msgid "quit WeeChat"
@@ -838,8 +889,8 @@ msgid ""
msgstr ""
msgid ""
"Warning: you should now issue /save to write \"save_on_exit\" option in "
"configuration file"
"Warning: you should now issue /save to write \"save_config_on_exit\" option "
"in configuration file"
msgstr ""
#, c-format
@@ -982,6 +1033,9 @@ msgstr ""
msgid "save configuration file on exit"
msgstr ""
msgid "save layout on exit (buffers, windows, or both)"
msgstr ""
msgid "how many lines to scroll by with scroll_up and scroll_down"
msgstr ""
+187 -4
View File
@@ -51,6 +51,7 @@
#include "../gui/gui-hotlist.h"
#include "../gui/gui-input.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-main.h"
#include "../gui/gui-status.h"
#include "../gui/gui-window.h"
@@ -685,7 +686,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
{
gui_window_switch_to_buffer (gui_current_window,
ptr_buffer);
gui_window_redraw_buffer (ptr_buffer);
gui_status_refresh_needed = 1;
}
}
@@ -1501,6 +1502,175 @@ command_key (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
/*
* command_layout_display_tree: display tree of windows
*/
void
command_layout_display_tree (struct t_gui_layout_window *layout_window,
int indent)
{
char format[128];
if (layout_window)
{
if (layout_window->plugin_name)
{
/* leaf */
snprintf (format, sizeof (format), "%%-%ds%s",
indent * 2,
_("leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"));
gui_chat_printf (NULL, format,
" ",
layout_window->internal_id,
(layout_window->parent_node) ?
layout_window->parent_node->internal_id : 0,
(layout_window->plugin_name) ?
layout_window->plugin_name : "-",
(layout_window->buffer_name) ?
layout_window->buffer_name : "-");
}
else
{
/* node */
snprintf (format, sizeof (format), "%%-%ds%s",
indent * 2,
_("node: id: %d, parent: %d, child1: %d, child2: %d, "
"size: %d%% (%s)"));
gui_chat_printf (NULL, format,
" ",
layout_window->internal_id,
(layout_window->parent_node) ?
layout_window->parent_node->internal_id : 0,
(layout_window->child1) ?
layout_window->child1->internal_id : 0,
(layout_window->child2) ?
layout_window->child2->internal_id : 0,
layout_window->split_pct,
(layout_window->split_horiz) ?
_("horizontal split") : _("vertical split"));
}
if (layout_window->child1)
command_layout_display_tree (layout_window->child1, indent + 1);
if (layout_window->child2)
command_layout_display_tree (layout_window->child2, indent + 1);
}
}
/*
* command_layout: save/apply buffers/windows layout
*/
int
command_layout (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
int flag_buffers, flag_windows;
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
/* display all key bindings */
if (argc == 1)
{
if (gui_layout_buffers || gui_layout_windows)
{
if (gui_layout_buffers)
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Saved layout for buffers:"));
for (ptr_layout_buffer = gui_layout_buffers;
ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
gui_chat_printf (NULL, " %d. %s / %s",
ptr_layout_buffer->number,
ptr_layout_buffer->plugin_name,
ptr_layout_buffer->buffer_name);
}
}
if (gui_layout_windows)
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Saved layout for windows:"));
command_layout_display_tree (gui_layout_windows, 1);
}
}
else
gui_chat_printf (NULL, _("No layout saved"));
return WEECHAT_RC_OK;
}
flag_buffers = 1;
flag_windows = 1;
if (argc > 2)
{
if (string_strcasecmp (argv[2], "buffers") == 0)
flag_windows = 0;
else if (string_strcasecmp (argv[2], "windows") == 0)
flag_buffers = 0;
}
/* save layout */
if (string_strcasecmp (argv[1], "save") == 0)
{
if (flag_buffers)
{
gui_layout_buffer_save ();
gui_chat_printf (NULL,
_("Layout saved for buffers (order of buffers)"));
}
if (flag_windows)
{
gui_layout_window_save ();
gui_chat_printf (NULL,
_("Layout saved for windows (buffer displayed by "
"each window)"));
}
return WEECHAT_RC_OK;
}
/* apply layout */
if (string_strcasecmp (argv[1], "apply") == 0)
{
if (flag_buffers)
gui_layout_buffer_apply ();
if (flag_windows)
gui_layout_window_apply ();
return WEECHAT_RC_OK;
}
/* reset layout */
if (string_strcasecmp (argv[1], "reset") == 0)
{
if (flag_buffers)
{
gui_layout_buffer_reset ();
gui_chat_printf (NULL,
_("Layout reset for buffers"));
}
if (flag_windows)
{
gui_layout_window_reset ();
gui_chat_printf (NULL,
_("Layout reset for windows"));
}
return WEECHAT_RC_OK;
}
return WEECHAT_RC_OK;
}
/*
* command_plugin_list: list loaded plugins
*/
@@ -2346,9 +2516,10 @@ command_upgrade (void *data, struct t_gui_buffer *buffer,
exec_args[0] = strdup (ptr_binary);
exec_args[3] = strdup (weechat_home);
/* unload plugins, save config, then upgrade */
/* save layout, unload plugins, save config, then upgrade */
gui_layout_save_on_exit ();
plugin_end ();
if (CONFIG_BOOLEAN(config_look_save_on_exit))
if (CONFIG_BOOLEAN(config_look_save_config_on_exit))
(void) config_weechat_write ();
gui_main_end (1);
log_close ();
@@ -2922,6 +3093,18 @@ command_init ()
"delete ALL personal bindings (use carefully!)"),
"unbind|reset",
&command_key, NULL);
hook_command (NULL, "layout",
N_("save/apply/reset layout for buffers and windows"),
N_("[[save | apply | reset] [buffers | windows]]"),
N_(" save: save current layout\n"
" apply: apply saved layout\n"
" reset: remove saved layout\n"
"buffers: save/apply only buffers (order of buffers)\n"
"windows: save/apply only windows (buffer displayed by "
"each window)\n\n"
"Without argument, this command displays saved layout."),
"save|apply|reset buffers|windows",
&command_layout, NULL);
hook_command (NULL, "plugin",
N_("list/load/unload plugins"),
N_("[list [name]] | [listfull [name]] | [load filename] | "
@@ -2933,7 +3116,7 @@ command_init ()
" reload: reload one plugin (if no name given, unload "
"all plugins, then autoload plugins)\n"
" unload: unload one or all plugins\n\n"
"Without argument, /plugin command lists loaded plugins."),
"Without argument, this command lists loaded plugins."),
"list|listfull|load|autoload|reload|unload %f|%p",
&command_plugin, NULL);
hook_command (NULL, "quit",
+177 -29
View File
@@ -48,6 +48,7 @@
#include "../gui/gui-filter.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-status.h"
#include "../gui/gui-window.h"
@@ -94,7 +95,8 @@ struct t_config_option *config_look_prefix_align;
struct t_config_option *config_look_prefix_align_max;
struct t_config_option *config_look_prefix_suffix;
struct t_config_option *config_look_read_marker;
struct t_config_option *config_look_save_on_exit;
struct t_config_option *config_look_save_config_on_exit;
struct t_config_option *config_look_save_layout_on_exit;
struct t_config_option *config_look_scroll_amount;
struct t_config_option *config_look_set_title;
@@ -195,21 +197,22 @@ struct t_hook *config_day_change_timer = NULL;
/*
* config_change_save_on_exit: called when "save_on_exit" flag is changed
* config_change_save_config_on_exit: called when "save_config_on_exit" flag is changed
*/
void
config_change_save_on_exit (void *data, struct t_config_option *option)
config_change_save_config_on_exit (void *data, struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
if (!CONFIG_BOOLEAN(config_look_save_on_exit))
if (!CONFIG_BOOLEAN(config_look_save_config_on_exit))
{
gui_chat_printf (NULL,
_("Warning: you should now issue /save to write "
"\"save_on_exit\" option in configuration file"));
"\"save_config_on_exit\" option in configuration "
"file"));
}
}
@@ -256,7 +259,7 @@ config_change_buffer_content (void *data, struct t_config_option *option)
(void) option;
if (gui_ok)
gui_window_redraw_buffer (gui_current_window->buffer);
gui_current_window->refresh_needed = 1;
}
/*
@@ -273,7 +276,7 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
gui_chat_change_time_format ();
if (gui_ok)
gui_window_redraw_buffer (gui_current_window->buffer);
gui_window_refresh_needed = 1;
}
/*
@@ -302,7 +305,7 @@ config_change_read_marker (void *data, struct t_config_option *option)
(void) data;
(void) option;
gui_window_redraw_all_buffers ();
gui_window_refresh_needed = 1;
}
/*
@@ -463,6 +466,10 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
/* remove all bars */
gui_bar_free_all ();
/* remove layout */
gui_layout_buffer_reset ();
gui_layout_window_reset ();
/* remove all filters */
gui_filter_free_all ();
@@ -479,7 +486,6 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
/*
* config_weechat_bar_read: read bar option in config file
* return: 1 if ok, 0 if error
*/
int
@@ -544,12 +550,140 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file,
}
}
return 1;
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/*
* config_weechat_layout_read: read layout option in config file
*/
int
config_weechat_layout_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
int argc;
char **argv, *error1, *error2, *error3, *error4;
long number1, number2, number3, number4;
struct t_gui_layout_window *parent;
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
if (option_name && value && value[0])
{
if (string_strcasecmp (option_name, "buffer") == 0)
{
argv = string_explode (value, ";", 0, 0, &argc);
if (argv)
{
if (argc >= 3)
{
error1 = NULL;
number1 = strtol (argv[2], &error1, 10);
if (error1 && !error1[0])
{
gui_layout_buffer_add (argv[0], argv[1], number1);
}
}
string_free_exploded (argv);
}
}
else if (string_strcasecmp (option_name, "window") == 0)
{
argv = string_explode (value, ";", 0, 0, &argc);
if (argv)
{
if (argc >= 6)
{
error1 = NULL;
number1 = strtol (argv[0], &error1, 10);
error2 = NULL;
number2 = strtol (argv[1], &error2, 10);
error3 = NULL;
number3 = strtol (argv[2], &error3, 10);
error4 = NULL;
number4 = strtol (argv[3], &error4, 10);
if (error1 && !error1[0] && error2 && !error2[0]
&& error3 && !error3[0] && error4 && !error4[0])
{
parent = gui_layout_window_search_by_id (number2);
gui_layout_window_add (number1,
parent,
number3,
number4,
(strcmp (argv[4], "-") != 0) ?
argv[4] : NULL,
(strcmp (argv[4], "-") != 0) ?
argv[5] : NULL);
}
}
string_free_exploded (argv);
}
}
}
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/*
* config_weechat_layout_write: write windows layout in configuration file
*/
void
config_weechat_layout_write_tree (struct t_config_file *config_file,
struct t_gui_layout_window *layout_window)
{
config_file_write_line (config_file, "window", "\"%d;%d;%d;%d;%s;%s\"",
layout_window->internal_id,
(layout_window->parent_node) ?
layout_window->parent_node->internal_id : 0,
layout_window->split_pct,
layout_window->split_horiz,
(layout_window->plugin_name) ?
layout_window->plugin_name : "-",
(layout_window->buffer_name) ?
layout_window->buffer_name : "-");
if (layout_window->child1)
config_weechat_layout_write_tree (config_file, layout_window->child1);
if (layout_window->child2)
config_weechat_layout_write_tree (config_file, layout_window->child2);
}
/*
* config_weechat_layout_write: write layout section in configuration file
*/
void
config_weechat_layout_write (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
/* make C compiler happy */
(void) data;
config_file_write_line (config_file, section_name, NULL);
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
config_file_write_line (config_file, "buffer", "\"%s;%s;%d\"",
ptr_layout_buffer->plugin_name,
ptr_layout_buffer->buffer_name,
ptr_layout_buffer->number);
}
if (gui_layout_windows)
config_weechat_layout_write_tree (config_file, gui_layout_windows);
}
/*
* config_weechat_filter_read: read filter option from config file
* return 1 if ok, 0 if error
*/
int
@@ -566,24 +700,21 @@ config_weechat_filter_read (void *data,
(void) config_file;
(void) section;
if (option_name)
if (option_name && value && value[0])
{
if (value && value[0])
argv = string_explode (value, ";", 0, 0, &argc);
argv_eol = string_explode (value, ";", 1, 0, NULL);
if (argv && argv_eol && (argc >= 3))
{
argv = string_explode (value, ";", 0, 0, &argc);
argv_eol = string_explode (value, ";", 1, 0, NULL);
if (argv && argv_eol && (argc >= 3))
{
gui_filter_new (argv[0], argv[1], argv_eol[2]);
}
if (argv)
string_free_exploded (argv);
if (argv_eol)
string_free_exploded (argv_eol);
gui_filter_new (argv[0], argv[1], argv_eol[2]);
}
if (argv)
string_free_exploded (argv);
if (argv_eol)
string_free_exploded (argv_eol);
}
return 1;
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/*
@@ -615,7 +746,6 @@ config_weechat_filter_write (void *data, struct t_config_file *config_file,
/*
* config_weechat_key_read: read key option in config file
* return 1 if ok, 0 if error
*/
int
@@ -642,7 +772,7 @@ config_weechat_key_read (void *data, struct t_config_file *config_file,
}
}
return 1;
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/*
@@ -915,11 +1045,16 @@ config_weechat_init ()
N_("use a marker (line or char) on buffers to show first unread line"),
"none|line|dotted-line|char",
0, 0, "dotted-line", NULL, NULL, &config_change_read_marker, NULL, NULL, NULL);
config_look_save_on_exit = config_file_new_option (
config_look_save_config_on_exit = config_file_new_option (
weechat_config_file, ptr_section,
"save_on_exit", "boolean",
"save_config_on_exit", "boolean",
N_("save configuration file on exit"),
NULL, 0, 0, "on", NULL, NULL, &config_change_save_on_exit, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL);
config_look_save_layout_on_exit = config_file_new_option (
weechat_config_file, ptr_section,
"save_layout_on_exit", "integer",
N_("save layout on exit (buffers, windows, or both)"),
"none|buffers|windows|all", 0, 0, "all", NULL, NULL, NULL, NULL, NULL, NULL);
config_look_scroll_amount = config_file_new_option (
weechat_config_file, ptr_section,
"scroll_amount", "integer",
@@ -1545,6 +1680,19 @@ config_weechat_init ()
weechat_config_section_bar = ptr_section;
/* layout */
ptr_section = config_file_new_section (weechat_config_file, "layout",
0, 0,
&config_weechat_layout_read, NULL,
&config_weechat_layout_write, NULL,
NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
return 0;
}
/* filters */
ptr_section = config_file_new_section (weechat_config_file, "filter",
0, 0,
+39 -18
View File
@@ -24,26 +24,46 @@
#define WEECHAT_CONFIG_NAME "weechat"
#define CONFIG_LOOK_NICKLIST_LEFT 0
#define CONFIG_LOOK_NICKLIST_RIGHT 1
#define CONFIG_LOOK_NICKLIST_TOP 2
#define CONFIG_LOOK_NICKLIST_BOTTOM 3
enum t_config_look_nicklist
{
CONFIG_LOOK_NICKLIST_LEFT = 0,
CONFIG_LOOK_NICKLIST_RIGHT,
CONFIG_LOOK_NICKLIST_TOP,
CONFIG_LOOK_NICKLIST_BOTTOM,
};
#define CONFIG_LOOK_PREFIX_ALIGN_NONE 0
#define CONFIG_LOOK_PREFIX_ALIGN_LEFT 1
#define CONFIG_LOOK_PREFIX_ALIGN_RIGHT 2
enum t_config_look_prefix_align
{
CONFIG_LOOK_PREFIX_ALIGN_NONE = 0,
CONFIG_LOOK_PREFIX_ALIGN_LEFT,
CONFIG_LOOK_PREFIX_ALIGN_RIGHT,
};
#define CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC 0
#define CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_DESC 1
#define CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_ASC 2
#define CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_DESC 3
#define CONFIG_LOOK_HOTLIST_SORT_NUMBER_ASC 4
#define CONFIG_LOOK_HOTLIST_SORT_NUMBER_DESC 5
enum t_config_look_hotlist_sort
{
CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_ASC = 0,
CONFIG_LOOK_HOTLIST_SORT_GROUP_TIME_DESC,
CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_ASC,
CONFIG_LOOK_HOTLIST_SORT_GROUP_NUMBER_DESC,
CONFIG_LOOK_HOTLIST_SORT_NUMBER_ASC,
CONFIG_LOOK_HOTLIST_SORT_NUMBER_DESC,
};
#define CONFIG_LOOK_READ_MARKER_NONE 0
#define CONFIG_LOOK_READ_MARKER_LINE 1
#define CONFIG_LOOK_READ_MARKER_DOTTED_LINE 2
#define CONFIG_LOOK_READ_MARKER_CHAR 3
enum t_config_look_read_marker
{
CONFIG_LOOK_READ_MARKER_NONE = 0,
CONFIG_LOOK_READ_MARKER_LINE,
CONFIG_LOOK_READ_MARKER_DOTTED_LINE,
CONFIG_LOOK_READ_MARKER_CHAR,
};
enum t_config_look_save_layout_on_exit
{
CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE = 0,
CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_BUFFERS,
CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_WINDOWS,
CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_ALL,
};
extern struct t_config_file *weechat_config_file;
extern struct t_config_section *weechat_config_section_bar;
@@ -81,7 +101,8 @@ extern struct t_config_option *config_look_prefix_align;
extern struct t_config_option *config_look_prefix_align_max;
extern struct t_config_option *config_look_prefix_suffix;
extern struct t_config_option *config_look_read_marker;
extern struct t_config_option *config_look_save_on_exit;
extern struct t_config_option *config_look_save_config_on_exit;
extern struct t_config_option *config_look_save_layout_on_exit;
extern struct t_config_option *config_look_scroll_amount;
extern struct t_config_option *config_look_set_title;
+2
View File
@@ -39,6 +39,7 @@
#include "../gui/gui-filter.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-main.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
@@ -78,6 +79,7 @@ debug_dump (int crash)
gui_window_print_log ();
gui_buffer_print_log ();
gui_layout_print_log ();
gui_keyboard_print_log (NULL);
gui_filter_print_log ();
gui_bar_print_log ();
+4 -1
View File
@@ -63,6 +63,7 @@
#include "wee-util.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-main.h"
#include "../gui/gui-keyboard.h"
#include "../plugins/plugin.h"
@@ -397,11 +398,13 @@ main (int argc, char *argv[])
plugin_init (weechat_auto_load_plugins, /* init plugin interface(s) */
argc, argv);
command_startup (1); /* command executed after plugins */
gui_layout_window_apply (); /* apply saved layout for windows */
gui_main_loop (); /* WeeChat main loop */
gui_layout_save_on_exit (); /* save layout */
plugin_end (); /* end plugin interface(s) */
if (CONFIG_BOOLEAN(config_look_save_on_exit))
if (CONFIG_BOOLEAN(config_look_save_config_on_exit))
(void) config_weechat_write (NULL); /* save WeeChat config file */
gui_main_end (1); /* shut down WeeChat GUI */
config_file_free_all (); /* free all configuration files */
+5 -4
View File
@@ -14,10 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
IF(NOT DISABLE_NCURSES)
SUBDIRS( curses )
ENDIF(NOT DISABLE_NCURSES)
SET(LIB_GUI_COMMON_SRC
gui-bar.c gui-bar.h
gui-bar-item.c gui-bar-item.h
@@ -30,6 +26,7 @@ gui-history.c gui-history.h
gui-hotlist.c gui-hotlist.h
gui-input.c gui-input.h
gui-keyboard.c gui-keyboard.h
gui-layout.c gui-layout.h
gui-main.h
gui-nicklist.c gui-nicklist.h
gui-status.c gui-status.h
@@ -38,6 +35,10 @@ gui-window.c gui-window.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
IF(NOT DISABLE_NCURSES)
SUBDIRS( curses )
ENDIF(NOT DISABLE_NCURSES)
IF(ENABLE_GTK)
ADD_SUBDIRECTORY( gtk )
ENDIF(ENABLE_GTK)
+2
View File
@@ -40,6 +40,8 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \
gui-input.h \
gui-keyboard.c \
gui-keyboard.h \
gui-layout.c \
gui-layout.h \
gui-main.h \
gui-status.c \
gui-status.h \
+1 -1
View File
@@ -48,6 +48,6 @@ ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
INCLUDE_DIRECTORIES(.. ../../core ../../plugins)
# Because of a linker bug, we have to link 2 times with libweechat_core.a
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS} ${STATIC_LIBS})
INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
+45 -47
View File
@@ -122,7 +122,6 @@ gui_main_init ()
gui_buffer_set_title (ptr_buffer,
"WeeChat " WEECHAT_COPYRIGHT_DATE
" - " WEECHAT_WEBSITE);
gui_window_redraw_buffer (ptr_buffer);
}
else
gui_init_ok = 0;
@@ -246,58 +245,57 @@ gui_main_loop ()
/* execute hook timers */
hook_timer_exec ();
/* refresh status bar if needed */
if (gui_status_refresh_needed)
gui_status_draw (1);
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (ptr_bar->bar_refresh_needed)
{
gui_bar_draw (ptr_bar);
ptr_bar->bar_refresh_needed = 0;
}
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->refresh_needed)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
gui_window_redraw_buffer (ptr_win->buffer);
ptr_win->refresh_needed = 0;
}
}
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
/* refresh title if needed */
if (ptr_buffer->title_refresh_needed)
gui_chat_draw_title (ptr_buffer, 1);
/* refresh chat if needed */
if (ptr_buffer->chat_refresh_needed)
{
gui_chat_draw (ptr_buffer,
(ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0);
}
/* refresh nicklist if needed */
if (ptr_buffer->nicklist_refresh_needed)
gui_nicklist_draw (ptr_buffer, 1);
/* refresh input if needed */
if (ptr_buffer->input_refresh_needed)
gui_input_draw (ptr_buffer, 1);
}
/* refresh window if needed */
if (gui_window_refresh_needed)
{
gui_window_refresh_screen ();
gui_window_refresh_needed = 0;
}
else
{
/* refresh status bar if needed */
if (gui_status_refresh_needed)
gui_status_draw (1);
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (ptr_bar->bar_refresh_needed)
gui_bar_draw (ptr_bar);
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->refresh_needed)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
gui_window_redraw_buffer (ptr_win->buffer);
ptr_win->refresh_needed = 0;
}
}
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
/* refresh title if needed */
if (ptr_buffer->title_refresh_needed)
gui_chat_draw_title (ptr_buffer, 1);
/* refresh nicklist if needed */
if (ptr_buffer->nicklist_refresh_needed)
gui_nicklist_draw (ptr_buffer, 1);
/* refresh chat if needed */
if (ptr_buffer->chat_refresh_needed)
{
gui_chat_draw (ptr_buffer,
(ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0);
}
/* refresh input if needed */
if (ptr_buffer->input_refresh_needed)
gui_input_draw (ptr_buffer, 1);
}
}
/* wait for keyboard or network activity */
FD_ZERO (&read_fds);
+17 -4
View File
@@ -40,21 +40,31 @@
/*
* gui_nicklist_draw: draw nick window for a buffer
* return 1 if chat window has been refreshed, 0 if only
* nicklist has been refreshed
*/
void
int
gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
{
struct t_gui_window *ptr_win;
struct t_gui_nick_group *ptr_group, *save_ptr_group;
struct t_gui_nick *ptr_nick, *save_ptr_nick;
struct t_config_option *ptr_option;
int i, j, k, x, y, x2, max_y, column, max_length, max_chars;
int rc, i, j, k, x, y, x2, max_y, column, max_length, max_chars;
int nicks_displayed, num_to_display, chars_left;
char format_empty[32], *buf, *ptr_buf, *ptr_next, saved_char;
if (!gui_ok || (!buffer->nicklist))
return;
rc = 0;
if (!gui_ok)
return 0;
if (!buffer->nicklist)
{
buffer->nicklist_refresh_needed = 0;
return 0;
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -80,6 +90,7 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
ptr_win->win_nick_x);
gui_chat_draw (buffer, 1);
erase = 1;
rc = 1;
}
}
@@ -334,4 +345,6 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
}
buffer->nicklist_refresh_needed = 0;
return rc;
}
+31 -20
View File
@@ -585,9 +585,8 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer)
return;
gui_chat_draw_title (buffer, 1);
gui_chat_draw (buffer, 1);
if (buffer->nicklist)
gui_nicklist_draw (buffer, 1);
if (!gui_nicklist_draw (buffer, 1))
gui_chat_draw (buffer, 1);
gui_status_draw (1);
gui_input_draw (buffer, 1);
}
@@ -714,9 +713,11 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
{
gui_bar_draw (ptr_bar_win->bar);
ptr_bar_win->bar->bar_refresh_needed = 1;
}
window->refresh_needed = 1;
hook_signal_send ("buffer_switch",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -750,7 +751,7 @@ gui_window_switch (struct t_gui_window *window)
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
gui_current_window->refresh_needed = 1;
}
/*
@@ -1298,14 +1299,16 @@ gui_window_refresh_windows ()
* gui_window_split_horiz: split a window horizontally
*/
void
struct t_gui_window *
gui_window_split_horiz (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int height1, height2;
if (!gui_ok)
return;
return NULL;
new_window = NULL;
height1 = (window->win_height * percentage) / 100;
height2 = window->win_height - height1;
@@ -1313,10 +1316,11 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
if ((height1 >= GUI_WINDOW_MIN_HEIGHT) && (height2 >= GUI_WINDOW_MIN_HEIGHT)
&& (percentage > 0) && (percentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x, window->win_y,
window->win_width, height1,
100, percentage)))
new_window = gui_window_new (window,
window->win_x, window->win_y,
window->win_width, height1,
100, percentage);
if (new_window)
{
/* reduce old window height (bottom window) */
window->win_y = new_window->win_y + new_window->win_height;
@@ -1332,20 +1336,24 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
gui_window_switch (new_window);
}
}
return new_window;
}
/*
* gui_window_split_vertic: split a window vertically
*/
void
struct t_gui_window *
gui_window_split_vertic (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int width1, width2;
if (!gui_ok)
return;
return NULL;
new_window = NULL;
width1 = (window->win_width * percentage) / 100;
width2 = window->win_width - width1 - 1;
@@ -1353,10 +1361,11 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
if ((width1 >= GUI_WINDOW_MIN_WIDTH) && (width2 >= GUI_WINDOW_MIN_WIDTH)
&& (percentage > 0) && (percentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
width2, window->win_height,
percentage, 100)))
new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
width2, window->win_height,
percentage, 100);
if (new_window)
{
/* reduce old window height (left window) */
window->win_width = width1;
@@ -1374,6 +1383,8 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
gui_window_draw_separator (gui_current_window);
}
}
return new_window;
}
/*
@@ -1410,7 +1421,7 @@ gui_window_resize (struct t_gui_window *window, int percentage)
1) < 0)
parent->split_pct = old_split_pct;
else
gui_window_refresh_windows ();
gui_window_refresh_needed = 1;
}
}
@@ -1456,7 +1467,7 @@ gui_window_merge (struct t_gui_window *window)
gui_window_tree_node_to_leaf (parent, window);
gui_window_switch_to_buffer (window, window->buffer);
gui_window_redraw_buffer (window->buffer);
window->refresh_needed = 1;
return 1;
}
return 0;
@@ -1501,7 +1512,7 @@ gui_window_merge_all (struct t_gui_window *window)
gui_current_window = window;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_redraw_buffer (window->buffer);
window->refresh_needed = 1;
}
}
+3
View File
@@ -28,6 +28,8 @@
#include <curses.h>
#endif
struct t_gui_buffer;
#define GUI_WINDOW_MIN_WIDTH 10
#define GUI_WINDOW_MIN_HEIGHT 5
@@ -92,6 +94,7 @@ extern void gui_keyboard_default_bindings ();
extern int gui_keyboard_read_cb (void *data);
/* window functions */
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
extern int gui_window_utf_char_valid (const char *utf_char);
extern void gui_window_wprintw (WINDOW *window, const char *data, ...);
extern void gui_window_clear_weechat (WINDOW *window, int num_color);
+1 -1
View File
@@ -36,6 +36,6 @@ ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_GTK_SRC})
INCLUDE_DIRECTORIES(.. ../../core ../../plugins)
# Because of a linker bug, we have to link 2 times with libweechat_core.a
TARGET_LINK_LIBRARIES(${EXECUTABLE} -lweechat_core ${STATIC_LIBS} ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS} ${STATIC_LIBS})
INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
-1
View File
@@ -180,7 +180,6 @@ gui_main_init ()
gui_buffer_set_title (ptr_buffer,
PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE
" - " WEECHAT_WEBSITE);
gui_window_redraw_buffer (ptr_buffer);
}
else
gui_init_ok = 0;
+5 -1
View File
@@ -31,12 +31,16 @@
/*
* gui_nicklist_draw: draw nick window for a buffer
* return 1 if chat window has been refreshed, 0 if only
* nicklist has been refreshed
*/
void
int
gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
{
/* TODO: write this function for Gtk */
(void) buffer;
(void) erase;
return 0;
}
+22 -12
View File
@@ -610,24 +610,27 @@ gui_window_refresh_windows ()
* gui_window_split_horiz: split a window horizontally
*/
void
struct t_gui_window *
gui_window_split_horiz (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int height1, height2;
if (!gui_ok)
return;
return NULL;
new_window = NULL;
height1 = (window->win_height * percentage) / 100;
height2 = window->win_height - height1;
if ((percentage > 0) && (percentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x, window->win_y,
window->win_width, height1,
100, percentage)))
new_window = gui_window_new (window,
window->win_x, window->win_y,
window->win_width, height1,
100, percentage);
if (new_window)
{
/* reduce old window height (bottom window) */
window->win_y = new_window->win_y + new_window->win_height;
@@ -645,30 +648,35 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
return new_window;
}
/*
* gui_window_split_vertic: split a window vertically
*/
void
struct t_gui_window *
gui_window_split_vertic (struct t_gui_window *window, int percentage)
{
struct t_gui_window *new_window;
int width1, width2;
if (!gui_ok)
return;
return NULL;
new_window = NULL;
width1 = (window->win_width * percentage) / 100;
width2 = window->win_width - width1 - 1;
if ((percentage > 0) && (percentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
width2, window->win_height,
percentage, 100)))
new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
width2, window->win_height,
percentage, 100);
if (new_window)
{
/* reduce old window height (left window) */
window->win_width = width1;
@@ -688,6 +696,8 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
gui_window_draw_separator (gui_current_window);
}
}
return new_window;
}
/*
+2 -3
View File
@@ -23,6 +23,7 @@
#include <gtk/gtk.h>
struct t_gui_window;
struct t_gui_buffer;
struct t_gui_line;
/* TODO: remove these temporary defines */
@@ -82,9 +83,6 @@ struct t_gui_gtk_objects
int current_color_attr; /* attr sum of last color(s) used */
};
//extern t_gui_color gui_weechat_colors[];
//extern int gui_irc_colors[GUI_NUM_IRC_COLORS][2];
extern GtkWidget *gui_gtk_main_window;
extern GtkWidget *gui_gtk_vbox1;
extern GtkWidget *gui_gtk_entry_topic;
@@ -114,6 +112,7 @@ extern void gui_keyboard_read ();
extern void gui_keyboard_flush ();
/* window functions */
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
extern void gui_window_title_set ();
extern void gui_window_title_reset ();
+88 -14
View File
@@ -48,6 +48,7 @@
#include "gui-hotlist.h"
#include "gui-input.h"
#include "gui-keyboard.h"
#include "gui-layout.h"
#include "gui-main.h"
#include "gui-nicklist.h"
#include "gui-status.h"
@@ -62,6 +63,71 @@ char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] =
{ "none", "highlight", "message", "all" };
/*
* gui_buffer_find_pos: find position for buffer in list
*/
struct t_gui_buffer *
gui_buffer_find_pos (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *ptr_buffer;
/* if no number is asked by layout, then add to the end by default */
if (buffer->layout_number < 1)
return NULL;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (buffer->layout_number <= ptr_buffer->number)
return ptr_buffer;
}
/* position not found, add to the end */
return NULL;
}
/*
* gui_buffer_insert: insert buffer in good position in list of buffers
*/
void
gui_buffer_insert (struct t_gui_buffer *buffer)
{
struct t_gui_buffer *pos, *ptr_buffer;
pos = gui_buffer_find_pos (buffer);
if (pos)
{
/* add buffer into the list (before position found) */
buffer->number = pos->number;
buffer->prev_buffer = pos->prev_buffer;
buffer->next_buffer = pos;
if (pos->prev_buffer)
(pos->prev_buffer)->next_buffer = buffer;
else
gui_buffers = buffer;
pos->prev_buffer = buffer;
for (ptr_buffer = pos; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->number++;
}
}
else
{
/* add buffer to the end */
buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
buffer->prev_buffer = last_gui_buffer;
if (gui_buffers)
last_gui_buffer->next_buffer = buffer;
else
gui_buffers = buffer;
last_gui_buffer = buffer;
buffer->next_buffer = NULL;
}
}
/*
* gui_buffer_new: create a new buffer in current window
*/
@@ -100,7 +166,9 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
/* init buffer */
new_buffer->plugin = plugin;
new_buffer->plugin_name_for_upgrade = NULL;
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
/* number will be set later (when inserting buffer in list) */
new_buffer->layout_number = gui_layout_buffer_get_number ((plugin) ? plugin->name : "core",
name);
new_buffer->name = strdup (name);
new_buffer->type = GUI_BUFFER_TYPE_FORMATED;
new_buffer->notify = CONFIG_INTEGER(config_look_buffer_notify_default);
@@ -180,13 +248,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->last_key = NULL;
/* add buffer to buffers list */
new_buffer->prev_buffer = last_gui_buffer;
if (gui_buffers)
last_gui_buffer->next_buffer = new_buffer;
else
gui_buffers = new_buffer;
last_gui_buffer = new_buffer;
new_buffer->next_buffer = NULL;
gui_buffer_insert (new_buffer);
/* first buffer creation ? */
if (!gui_current_window->buffer)
@@ -197,9 +259,12 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
gui_current_window->start_line_pos = 0;
gui_window_calculate_pos_size (gui_current_window, 1);
gui_window_switch_to_buffer (gui_current_window, new_buffer);
gui_window_redraw_buffer (new_buffer);
}
/* check if this buffer should be assigned to a window,
according to windows layout saved */
gui_layout_window_check_buffer (new_buffer);
hook_signal_send ("buffer_open",
WEECHAT_HOOK_SIGNAL_POINTER, new_buffer);
}
@@ -576,7 +641,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
else if (string_strcasecmp (property, "display") == 0)
{
gui_window_switch_to_buffer (gui_current_window, buffer);
gui_window_redraw_buffer (buffer);
gui_status_refresh_needed = 1;
}
else if (string_strcasecmp (property, "name") == 0)
{
@@ -1010,7 +1075,7 @@ gui_buffer_switch_previous (struct t_gui_window *window)
else
gui_window_switch_to_buffer (window, last_gui_buffer);
gui_window_redraw_buffer (window->buffer);
gui_status_refresh_needed = 1;
}
/*
@@ -1032,7 +1097,7 @@ gui_buffer_switch_next (struct t_gui_window *window)
else
gui_window_switch_to_buffer (window, gui_buffers);
gui_window_redraw_buffer (window->buffer);
gui_status_refresh_needed = 1;
}
/*
@@ -1058,7 +1123,7 @@ gui_buffer_switch_by_number (struct t_gui_window *window, int number)
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
{
gui_window_switch_to_buffer (window, ptr_buffer);
gui_window_redraw_buffer (window->buffer);
gui_status_refresh_needed = 1;
return;
}
}
@@ -1152,7 +1217,7 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number)
ptr_buffer->number = i++;
}
gui_window_redraw_buffer (buffer);
gui_status_refresh_needed = 1;
snprintf (buf1_str, sizeof (buf1_str) - 1, "%d", buffer->number);
argv[0] = buf1_str;
@@ -1388,12 +1453,17 @@ gui_buffer_print_log ()
log_printf ("");
log_printf ("[buffer (addr:0x%x)]", ptr_buffer);
log_printf (" plugin . . . . . . . . : 0x%x", ptr_buffer->plugin);
log_printf (" plugin_name_for_upgrade: '%s'", ptr_buffer->plugin_name_for_upgrade);
log_printf (" number . . . . . . . . : %d", ptr_buffer->number);
log_printf (" layout_number. . . . . : %d", ptr_buffer->layout_number);
log_printf (" name . . . . . . . . . : '%s'", ptr_buffer->name);
log_printf (" type . . . . . . . . . : %d", ptr_buffer->type);
log_printf (" notify . . . . . . . . : %d", ptr_buffer->notify);
log_printf (" num_displayed. . . . . : %d", ptr_buffer->num_displayed);
log_printf (" close_callback . . . . : 0x%x", ptr_buffer->close_callback);
log_printf (" close_callback_data. . : 0x%x", ptr_buffer->close_callback_data);
log_printf (" title. . . . . . . . . : '%s'", ptr_buffer->title);
log_printf (" title_refresh_needed . : %d", ptr_buffer->title_refresh_needed);
log_printf (" lines. . . . . . . . . : 0x%x", ptr_buffer->lines);
log_printf (" last_line. . . . . . . : 0x%x", ptr_buffer->last_line);
log_printf (" last_read_line . . . . : 0x%x", ptr_buffer->last_read_line);
@@ -1419,6 +1489,7 @@ gui_buffer_print_log ()
log_printf (" input_buffer_length. . : %d", ptr_buffer->input_buffer_length);
log_printf (" input_buffer_pos . . . : %d", ptr_buffer->input_buffer_pos);
log_printf (" input_buffer_1st_disp. : %d", ptr_buffer->input_buffer_1st_display);
log_printf (" input_refresh_needed . : %d", ptr_buffer->input_refresh_needed);
log_printf (" completion . . . . . . : 0x%x", ptr_buffer->completion);
log_printf (" history. . . . . . . . : 0x%x", ptr_buffer->history);
log_printf (" last_history . . . . . : 0x%x", ptr_buffer->last_history);
@@ -1429,8 +1500,11 @@ gui_buffer_print_log ()
log_printf (" text_search_found. . . : %d", ptr_buffer->text_search_found);
log_printf (" text_search_input. . . : '%s'", ptr_buffer->text_search_input);
log_printf (" highlight_words. . . . : '%s'", ptr_buffer->highlight_words);
log_printf (" highlight_tags . . . . : '%s'", ptr_buffer->highlight_tags);
log_printf (" highlight_tags_count . : %d", ptr_buffer->highlight_tags_count);
log_printf (" highlight_tags_array . : 0x%x", ptr_buffer->highlight_tags_array);
log_printf (" keys . . . . . . . . . : 0x%x", ptr_buffer->keys);
log_printf (" last_key . . . . . . . : 0x%x", ptr_buffer->last_key);
log_printf (" prev_buffer. . . . . . : 0x%x", ptr_buffer->prev_buffer);
log_printf (" next_buffer. . . . . . : 0x%x", ptr_buffer->next_buffer);
+2
View File
@@ -76,6 +76,8 @@ struct t_gui_buffer
char *plugin_name_for_upgrade; /* plugin name when upgrading */
int number; /* buffer number (for jump/switch) */
int layout_number; /* the number of buffer saved in */
/* layout */
char *name; /* buffer name */
enum t_gui_buffer_type type; /* buffer type (formated, free, ..) */
int notify; /* 0 = never */
+4 -7
View File
@@ -1256,7 +1256,7 @@ gui_input_jump_smart ()
gui_window_switch_to_buffer (gui_current_window,
gui_hotlist->buffer);
gui_window_scroll_bottom (gui_current_window);
gui_window_redraw_buffer (gui_current_window->buffer);
gui_status_refresh_needed = 1;
}
else
{
@@ -1265,7 +1265,7 @@ gui_input_jump_smart ()
gui_window_switch_to_buffer (gui_current_window,
gui_hotlist_initial_buffer);
gui_window_scroll_bottom (gui_current_window);
gui_window_redraw_buffer (gui_current_window->buffer);
gui_status_refresh_needed = 1;
gui_hotlist_initial_buffer = NULL;
}
}
@@ -1315,7 +1315,7 @@ gui_input_hotlist_clear ()
if (gui_hotlist)
{
gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist);
gui_window_redraw_buffer (gui_current_window->buffer);
gui_status_refresh_needed = 1;
}
gui_hotlist_initial_buffer = gui_current_window->buffer;
}
@@ -1377,7 +1377,7 @@ gui_input_set_unread ()
}
/* refresh all windows */
gui_window_redraw_all_buffers ();
gui_window_refresh_needed = 1;
}
/*
@@ -1388,10 +1388,7 @@ void
gui_input_set_unread_current_buffer ()
{
if (gui_current_window)
{
gui_buffer_set_unread (gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
/*
+624
View File
@@ -0,0 +1,624 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* gui-layout.c: layout functions, used by all GUI */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "../core/weechat.h"
#include "../core/wee-log.h"
#include "../core/wee-config.h"
#include "../core/wee-string.h"
#include "../plugins/plugin.h"
#include "gui-layout.h"
#include "gui-buffer.h"
#include "gui-window.h"
struct t_gui_layout_buffer *gui_layout_buffers = NULL;
struct t_gui_layout_buffer *last_gui_layout_buffer = NULL;
struct t_gui_layout_window *gui_layout_windows = NULL;
int internal_id = 0;
struct t_gui_window *window1 = NULL;
struct t_gui_window *window2 = NULL;
/*
* gui_layout_buffer_remove: remove a buffer layout
*/
void
gui_layout_buffer_remove (struct t_gui_layout_buffer *layout_buffer)
{
/* free data */
if (layout_buffer->plugin_name)
free (layout_buffer->plugin_name);
if (layout_buffer->buffer_name)
free (layout_buffer->buffer_name);
/* remove layout from list */
if (layout_buffer->prev_layout)
layout_buffer->prev_layout->next_layout = layout_buffer->next_layout;
if (layout_buffer->next_layout)
layout_buffer->next_layout->prev_layout = layout_buffer->prev_layout;
if (gui_layout_buffers == layout_buffer)
gui_layout_buffers = layout_buffer->next_layout;
if (last_gui_layout_buffer == layout_buffer)
last_gui_layout_buffer = layout_buffer->prev_layout;
free (layout_buffer);
}
/*
* gui_layout_buffer_remove_all: remove all buffer layouts
*/
void
gui_layout_buffer_remove_all ()
{
while (gui_layout_buffers)
{
gui_layout_buffer_remove (gui_layout_buffers);
}
}
/*
* gui_layout_buffer_reset: reset layout for buffers
*/
void
gui_layout_buffer_reset ()
{
struct t_gui_buffer *ptr_buffer;
gui_layout_buffer_remove_all ();
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
ptr_buffer->layout_number = 0;
}
}
/*
* gui_layout_buffer_add: add a buffer layout
*/
struct t_gui_layout_buffer *
gui_layout_buffer_add (const char *plugin_name, const char *buffer_name,
int number)
{
struct t_gui_layout_buffer *new_layout_buffer;
new_layout_buffer = malloc (sizeof (*new_layout_buffer));
if (new_layout_buffer)
{
/* init layout buffer */
new_layout_buffer->plugin_name = strdup (plugin_name);
new_layout_buffer->buffer_name = strdup (buffer_name);
new_layout_buffer->number = number;
/* add layout buffer to list */
new_layout_buffer->prev_layout = last_gui_layout_buffer;
if (gui_layout_buffers)
last_gui_layout_buffer->next_layout = new_layout_buffer;
else
gui_layout_buffers = new_layout_buffer;
last_gui_layout_buffer = new_layout_buffer;
new_layout_buffer->next_layout = NULL;
}
return new_layout_buffer;
}
/*
* gui_layout_buffer_save: save current layout for buffers
*/
void
gui_layout_buffer_save ()
{
struct t_gui_buffer *ptr_buffer;
gui_layout_buffer_remove_all ();
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
gui_layout_buffer_add ((ptr_buffer->plugin) ?
ptr_buffer->plugin->name : "core",
ptr_buffer->name,
ptr_buffer->number);
}
}
/*
* gui_layout_buffer_get_number: get number for a plugin/buffer
* return 0 if not found
*/
int
gui_layout_buffer_get_number (const char *plugin_name, const char *buffer_name)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
if ((string_strcasecmp (ptr_layout_buffer->plugin_name, plugin_name) == 0)
&& (string_strcasecmp (ptr_layout_buffer->buffer_name, buffer_name) == 0))
{
return ptr_layout_buffer->number;
}
}
/* plugin/buffer not found */
return 0;
}
/*
* gui_layout_buffer_apply: apply current layout for buffers
*/
void
gui_layout_buffer_apply ()
{
struct t_gui_buffer *ptr_buffer;
char *plugin_core = "core", *plugin_name;
if (gui_layout_buffers)
{
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
plugin_name = (ptr_buffer->plugin) ? ptr_buffer->plugin->name : plugin_core;
ptr_buffer->layout_number = gui_layout_buffer_get_number (plugin_name,
ptr_buffer->name);
if ((ptr_buffer->layout_number > 0)
&& (ptr_buffer->layout_number != ptr_buffer->number))
{
gui_buffer_move_to_number (ptr_buffer,
ptr_buffer->layout_number);
}
}
}
}
/*
* gui_layout_window_remove: remove a window layout
*/
void
gui_layout_window_remove (struct t_gui_layout_window *layout_window)
{
/* first free childs */
if (layout_window->child1)
gui_layout_window_remove (layout_window->child1);
if (layout_window->child2)
gui_layout_window_remove (layout_window->child2);
/* free data */
if (layout_window->plugin_name)
free (layout_window->plugin_name);
if (layout_window->buffer_name)
free (layout_window->buffer_name);
free (layout_window);
}
/*
* gui_layout_window_remove_all: remove all window layouts
*/
void
gui_layout_window_remove_all ()
{
if (gui_layout_windows)
{
gui_layout_window_remove (gui_layout_windows);
gui_layout_windows = NULL;
}
}
/*
* gui_layout_window_reset: reset layout for windows
*/
void
gui_layout_window_reset ()
{
struct t_gui_window *ptr_win;
gui_layout_window_remove_all ();
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name)
{
free (ptr_win->layout_plugin_name);
ptr_win->layout_plugin_name = NULL;
}
if (ptr_win->layout_buffer_name)
{
free (ptr_win->layout_buffer_name);
ptr_win->layout_buffer_name = NULL;
}
}
}
/*
* gui_layout_window_search_by_id_tree: search a layout window by internal id
* in a tree
*/
struct t_gui_layout_window *
gui_layout_window_search_by_id_tree (struct t_gui_layout_window *tree, int id)
{
struct t_gui_layout_window *res;
if (tree->internal_id == id)
return tree;
if (tree->child1)
{
res = gui_layout_window_search_by_id_tree (tree->child1, id);
if (res)
return res;
}
if (tree->child2)
{
res = gui_layout_window_search_by_id_tree (tree->child2, id);
if (res)
return res;
}
return NULL;
}
/*
* gui_layout_window_search_by_id: search a layout window by internal id
*/
struct t_gui_layout_window *
gui_layout_window_search_by_id (int id)
{
if (!gui_layout_windows)
return NULL;
return gui_layout_window_search_by_id_tree (gui_layout_windows, id);
}
/*
* gui_layout_window_add: add a window layout
*/
struct t_gui_layout_window *
gui_layout_window_add (int internal_id,
struct t_gui_layout_window *parent,
int split_pct, int split_horiz,
const char *plugin_name, const char *buffer_name)
{
struct t_gui_layout_window *new_layout_window;
new_layout_window = malloc (sizeof (*new_layout_window));
if (new_layout_window)
{
/* init layout window */
new_layout_window->internal_id = internal_id;
new_layout_window->parent_node = parent;
new_layout_window->split_pct = split_pct;
new_layout_window->split_horiz = split_horiz;
new_layout_window->child1 = NULL;
new_layout_window->child2 = NULL;
new_layout_window->plugin_name = (plugin_name) ? strdup (plugin_name) : NULL;
new_layout_window->buffer_name = (buffer_name) ? strdup (buffer_name) : NULL;
if (parent)
{
/* assign this window to child1 or child2 of parent */
if (!parent->child1)
parent->child1 = new_layout_window;
else if (!parent->child2)
parent->child2 = new_layout_window;
}
else
{
/* no parent? => it's root! */
gui_layout_windows = new_layout_window;
}
}
return new_layout_window;
}
/*
* gui_layout_window_save_tree: save tree of windows
*/
void
gui_layout_window_save_tree (struct t_gui_layout_window *parent_layout,
struct t_gui_window_tree *tree)
{
struct t_gui_layout_window *layout_window;
if (tree->window)
{
layout_window = gui_layout_window_add (internal_id++,
parent_layout,
0, 0,
(tree->window->buffer->plugin) ?
tree->window->buffer->plugin->name : "core",
tree->window->buffer->name);
}
else
{
layout_window = gui_layout_window_add (internal_id++,
parent_layout,
tree->split_pct,
tree->split_horiz,
NULL,
NULL);
}
if (tree->child1)
gui_layout_window_save_tree (layout_window, tree->child1);
if (tree->child2)
gui_layout_window_save_tree (layout_window, tree->child2);
}
/*
* gui_layout_window_save: save current layout for windows
*/
void
gui_layout_window_save ()
{
gui_layout_window_remove_all ();
internal_id = 1;
gui_layout_window_save_tree (NULL, gui_windows_tree);
}
/*
* gui_layout_window_check_buffer: check if buffer can be assigned to one window
*/
void
gui_layout_window_check_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_win;
char *plugin_core = "core", *plugin_name;
plugin_name = (buffer->plugin) ? buffer->plugin->name : plugin_core;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name && ptr_win->layout_buffer_name)
{
if ((strcmp (ptr_win->layout_plugin_name, plugin_name) == 0)
&& (strcmp (ptr_win->layout_buffer_name, buffer->name) == 0))
{
gui_window_switch_to_buffer (ptr_win, buffer);
}
}
}
}
/*
* gui_layout_window_check_all_buffers: for each window, check if another
* buffer should be assigned, and if yes,
* assign it
*/
void
gui_layout_window_check_all_buffers ()
{
struct t_gui_window *ptr_win;
struct t_gui_buffer *ptr_buffer;
char *plugin_core = "core", *plugin_name;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->layout_plugin_name && ptr_win->layout_buffer_name)
{
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
plugin_name = (ptr_buffer->plugin) ? ptr_buffer->plugin->name : plugin_core;
if ((strcmp (ptr_win->layout_plugin_name, plugin_name) == 0)
&& (strcmp (ptr_win->layout_buffer_name, ptr_buffer->name) == 0))
{
gui_window_switch_to_buffer (ptr_win, ptr_buffer);
break;
}
}
}
}
}
/*
* gui_layout_window_apply_tree: apply tree windows (resplit screen according
* to windows tree and assing buffer to windows)
*/
void
gui_layout_window_apply_tree (struct t_gui_layout_window *layout_window)
{
struct t_gui_window *new_window;
if (layout_window->split_pct != 0)
{
/* node */
if (layout_window->split_horiz)
{
new_window = gui_window_split_horiz (gui_current_window,
layout_window->split_pct);
}
else
{
new_window = gui_window_split_vertic (gui_current_window,
layout_window->split_pct);
}
if (new_window)
{
if (window2)
window1 = window2;
window2 = new_window;
}
}
else
{
/* leaf */
if (window1)
{
gui_window_set_layout_plugin_name (window1,
layout_window->plugin_name);
gui_window_set_layout_buffer_name (window1,
layout_window->buffer_name);
window1 = window2;
window2 = NULL;
}
}
if (layout_window->child1)
gui_layout_window_apply_tree (layout_window->child1);
if (layout_window->child2)
gui_layout_window_apply_tree (layout_window->child2);
}
/*
* gui_layout_window_apply: apply current layout for windows
*/
void
gui_layout_window_apply ()
{
struct t_gui_window *old_window;
if (gui_layout_windows)
{
gui_window_merge_all (gui_current_window);
old_window = gui_current_window;
window1 = gui_current_window;
window2 = NULL;
gui_layout_window_apply_tree (gui_layout_windows);
gui_layout_window_check_all_buffers ();
gui_window_switch (old_window);
}
}
/*
* gui_layout_save_on_exit: save layout according to option
* "save_layout_on_exit"
*/
void
gui_layout_save_on_exit ()
{
/* save layout on exit */
switch (CONFIG_BOOLEAN(config_look_save_layout_on_exit))
{
case CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE:
break;
case CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_BUFFERS:
gui_layout_buffer_save ();
break;
case CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_WINDOWS:
gui_layout_window_save ();
break;
case CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_ALL:
gui_layout_buffer_save ();
gui_layout_window_save ();
break;
}
}
/*
* gui_layout_print_log_window: print windows layout infos in log (usually for
* crash dump)
*/
void
gui_layout_print_log_window (struct t_gui_layout_window *layout_window,
int level)
{
log_printf ("");
log_printf ("[layout window (addr:0x%x) (%s) (level %d)]",
layout_window,
(layout_window->plugin_name) ? "leaf" : "node",
level);
log_printf (" internal_id. . . . . . : %d", layout_window->internal_id);
log_printf (" parent_node. . . . . . : 0x%x", layout_window->parent_node);
log_printf (" split_pct. . . . . . . : %d", layout_window->split_pct);
log_printf (" split_horiz. . . . . . : %d", layout_window->split_horiz);
log_printf (" child1 . . . . . . . . : 0x%x", layout_window->child1);
log_printf (" child2 . . . . . . . . : 0x%x", layout_window->child2);
log_printf (" plugin_name. . . . . . : '%s'", layout_window->plugin_name);
log_printf (" buffer_name. . . . . . : '%s'", layout_window->buffer_name);
if (layout_window->child1)
gui_layout_print_log_window (layout_window->child1, level + 1);
if (layout_window->child2)
gui_layout_print_log_window (layout_window->child2, level + 1);
}
/*
* gui_layout_print_log: print layout infos in log (usually for crash dump)
*/
void
gui_layout_print_log ()
{
struct t_gui_layout_buffer *ptr_layout_buffer;
log_printf ("");
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
log_printf ("");
log_printf ("[layout buffer (addr:0x%x)]", ptr_layout_buffer);
log_printf (" plugin_name. . . . . . : '%s'", ptr_layout_buffer->plugin_name);
log_printf (" buffer_name. . . . . . : '%s'", ptr_layout_buffer->buffer_name);
log_printf (" number . . . . . . . . : %d", ptr_layout_buffer->number);
log_printf (" prev_layout. . . . . . : 0x%x", ptr_layout_buffer->prev_layout);
log_printf (" next_layout. . . . . . : 0x%x", ptr_layout_buffer->next_layout);
}
if (gui_layout_windows)
gui_layout_print_log_window (gui_layout_windows, 0);
}
+84
View File
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_GUI_LAYOUT_H
#define __WEECHAT_GUI_LAYOUT_H 1
/* layout structures */
struct t_gui_layout_buffer
{
char *plugin_name;
char *buffer_name;
int number;
struct t_gui_layout_buffer *prev_layout; /* link to previous layout */
struct t_gui_layout_buffer *next_layout; /* link to next layout */
};
struct t_gui_layout_window
{
int internal_id; /* used to save/read layout from */
/* config (to find parent) */
struct t_gui_layout_window *parent_node; /* pointer to parent node */
/* node info */
int split_pct; /* % of split size (child1) */
int split_horiz; /* 1 if horizontal, 0 if vertical */
struct t_gui_layout_window *child1; /* first child, NULL if a leaf */
struct t_gui_layout_window *child2; /* second child, NULL if leaf */
/* leaf info */
char *plugin_name;
char *buffer_name;
};
/* layout variables */
extern struct t_gui_layout_buffer *gui_layout_buffers;
extern struct t_gui_layout_buffer *gui_layout_last_buffer;
extern struct t_gui_layout_window *gui_layout_windows;
/* layout functions */
extern void gui_layout_buffer_reset ();
extern struct t_gui_layout_buffer *gui_layout_buffer_add (const char *plugin_name,
const char *buffer_name,
int number);
extern void gui_layout_buffer_save ();
extern int gui_layout_buffer_get_number (const char *plugin_name,
const char *buffer_name);
extern void gui_layout_buffer_apply ();
extern void gui_layout_window_reset ();
extern struct t_gui_layout_window *gui_layout_window_search_by_id (int id);
extern struct t_gui_layout_window *gui_layout_window_add (int internal_id,
struct t_gui_layout_window *parent,
int split_pct,
int split_horiz,
const char *plugin_name,
const char *buffer_name);
extern void gui_layout_window_save ();
extern void gui_layout_window_apply ();
extern void gui_layout_window_check_buffer (struct t_gui_buffer *buffer);
extern void gui_layout_save_on_exit ();
extern void gui_layout_print_log ();
#endif /* gui-layout.h */
+1 -1
View File
@@ -86,6 +86,6 @@ extern void gui_nicklist_print_log (struct t_gui_nick_group *group, int indent);
/* nicklist functions (GUI dependent) */
extern void gui_nicklist_draw (struct t_gui_buffer *buffer, int erase);
extern int gui_nicklist_draw (struct t_gui_buffer *buffer, int erase);
#endif /* gui-nicklist.h */
+56 -51
View File
@@ -73,8 +73,8 @@ gui_window_tree_init (struct t_gui_window *window)
if (!gui_windows_tree)
return 0;
gui_windows_tree->parent_node = NULL;
gui_windows_tree->split_horiz = 0;
gui_windows_tree->split_pct = 0;
gui_windows_tree->split_horiz = 0;
gui_windows_tree->child1 = NULL;
gui_windows_tree->child2 = NULL;
gui_windows_tree->window = window;
@@ -90,8 +90,8 @@ void
gui_window_tree_node_to_leaf (struct t_gui_window_tree *node,
struct t_gui_window *window)
{
node->split_horiz = 0;
node->split_pct = 0;
node->split_horiz = 0;
if (node->child1)
{
free (node->child1);
@@ -201,6 +201,7 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height
return NULL;
}
/* position & size */
new_window->win_x = x;
new_window->win_y = y;
new_window->win_width = width;
@@ -212,42 +213,52 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height
new_window->new_y = -1;
new_window->new_width = -1;
new_window->new_height = -1;
/* chat window */
new_window->win_chat_x = 0;
new_window->win_chat_y = 0;
new_window->win_chat_width = 0;
new_window->win_chat_height = 0;
new_window->win_chat_cursor_x = 0;
new_window->win_chat_cursor_y = 0;
/* nicklist */
new_window->win_nick_x = 0;
new_window->win_nick_y = 0;
new_window->win_nick_width = 0;
new_window->win_nick_height = 0;
new_window->win_nick_num_max = 0;
new_window->win_nick_start = 0;
/* title */
new_window->win_title_x = 0;
new_window->win_title_y = 0;
new_window->win_title_width = 0;
new_window->win_title_height = 0;
new_window->win_title_start = 0;
/* status */
new_window->win_status_x = 0;
new_window->win_status_y = 0;
new_window->win_status_width = 0;
new_window->win_status_height = 0;
/* input */
new_window->win_input_x = 0;
new_window->win_input_y = 0;
new_window->win_input_width = 0;
new_window->win_input_height = 0;
new_window->win_input_cursor_x = 0;
/* refresh */
new_window->refresh_needed = 0;
/* buffer and layout infos */
new_window->buffer = NULL;
new_window->layout_plugin_name = NULL;
new_window->layout_buffer_name = NULL;
/* scroll */
new_window->first_line_displayed = 0;
new_window->start_line = NULL;
new_window->start_line_pos = 0;
@@ -354,6 +365,42 @@ gui_window_get_pointer (struct t_gui_window *window, const char *property)
return NULL;
}
/*
* gui_window_set_layout_plugin_name: set layout plugin name for window
*/
void
gui_window_set_layout_plugin_name (struct t_gui_window *window,
const char *plugin_name)
{
if (window->layout_plugin_name)
{
free (window->layout_plugin_name);
window->layout_plugin_name = NULL;
}
if (plugin_name)
window->layout_plugin_name = strdup (plugin_name);
}
/*
* gui_window_set_layout_buffer_name: set layout buffer name for window
*/
void
gui_window_set_layout_buffer_name (struct t_gui_window *window,
const char *buffer_name)
{
if (window->layout_buffer_name)
{
free (window->layout_buffer_name);
window->layout_buffer_name = NULL;
}
if (buffer_name)
window->layout_buffer_name = strdup (buffer_name);
}
/*
* gui_window_free: delete a window
*/
@@ -411,50 +458,6 @@ gui_window_search_by_buffer (struct t_gui_buffer *buffer)
return NULL;
}
/*
* gui_window_switch_server: switch server on servers buffer
* (if same buffer is used for all buffers)
*/
void
gui_window_switch_server (struct t_gui_window *window)
{
(void) window;
/*struct t_gui_buffer *ptr_buffer;
t_irc_server *ptr_server;
ptr_buffer = gui_buffer_servers_search ();
if (ptr_buffer)
{
ptr_server = (GUI_SERVER(ptr_buffer)
&& GUI_SERVER(ptr_buffer)->next_server) ?
GUI_SERVER(ptr_buffer)->next_server : irc_servers;
while (ptr_server != GUI_SERVER(window->buffer))
{
if (ptr_server->buffer)
break;
if (ptr_server->next_server)
ptr_server = ptr_server->next_server;
else
{
if (GUI_SERVER(ptr_buffer) == NULL)
{
ptr_server = NULL;
break;
}
ptr_server = irc_servers;
}
}
if (ptr_server && (ptr_server != GUI_SERVER(ptr_buffer)))
{
ptr_buffer->server = ptr_server;
gui_status_draw (window->buffer, 1);
gui_input_draw (window->buffer, 1);
}
}*/
}
/*
* gui_window_switch_previous: switch to previous window
*/
@@ -1067,6 +1070,8 @@ gui_window_print_log ()
log_printf (" win_input_height. . : %d", ptr_window->win_input_height);
log_printf (" win_input_cursor_x. : %d", ptr_window->win_input_cursor_x);
log_printf (" buffer. . . . . . . : 0x%x", ptr_window->buffer);
log_printf (" layout_plugin_name. : '%s'", ptr_window->layout_plugin_name);
log_printf (" layout_buffer_name. : '%s'", ptr_window->layout_buffer_name);
log_printf (" first_line_displayed: %d", ptr_window->first_line_displayed);
log_printf (" start_line. . . . . : 0x%x", ptr_window->start_line);
log_printf (" start_line_pos. . . : %d", ptr_window->start_line_pos);
+18 -10
View File
@@ -78,9 +78,15 @@ struct t_gui_window
/* GUI specific objects */
void *gui_objects; /* pointer to a GUI specific struct */
/* buffer and layout infos */
struct t_gui_buffer *buffer; /* buffer currently displayed */
char *layout_plugin_name; /* plugin and buffer that should be */
char *layout_buffer_name; /* displayed in this window (even if */
/* buffer does not exist yet, it will*/
/* be assigned later) */
/* scroll */
int first_line_displayed; /* = 1 if first line is displayed */
struct t_gui_line *start_line; /* pointer to line if scrolling */
int start_line_pos; /* position in first line displayed */
@@ -98,10 +104,10 @@ struct t_gui_window_tree
struct t_gui_window_tree *parent_node; /* pointer to parent node */
/* node info */
int split_horiz; /* 1 if horizontal, 0 if vertical */
int split_pct; /* % of split size (child1) */
struct t_gui_window_tree *child1; /* first child, NULL if a leaf */
struct t_gui_window_tree *child2; /* second child, NULL if a leaf */
int split_horiz; /* 1 if horizontal, 0 if vertical */
struct t_gui_window_tree *child1; /* first child, NULL if a leaf */
struct t_gui_window_tree *child2; /* second child, NULL if a leaf */
/* leaf info */
struct t_gui_window *window; /* pointer to window, NULL if a node */
@@ -129,6 +135,10 @@ extern char *gui_window_get_string (struct t_gui_window *window,
const char *property);
extern void *gui_window_get_pointer (struct t_gui_window *window,
const char *property);
extern void gui_window_set_layout_plugin_name (struct t_gui_window *window,
const char *plugin_name);
extern void gui_window_set_layout_buffer_name (struct t_gui_window *window,
const char *buffer_name);
extern void gui_window_free (struct t_gui_window *window);
extern struct t_gui_window *gui_window_search_by_buffer (struct t_gui_buffer *buffer);
extern void gui_window_switch_server (struct t_gui_window *window);
@@ -157,8 +167,6 @@ extern void gui_window_objects_free (struct t_gui_window *window,
int free_bar_windows);
extern int gui_window_calculate_pos_size (struct t_gui_window *window,
int force_calculate);
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
extern void gui_window_redraw_all_buffers ();
extern void gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer);
extern void gui_window_switch (struct t_gui_window *window);
@@ -176,10 +184,10 @@ extern void gui_window_nicklist_beginning (struct t_gui_window *window);
extern void gui_window_nicklist_end (struct t_gui_window *window);
extern void gui_window_init_subwindows (struct t_gui_window *window);
extern void gui_window_refresh_windows ();
extern void gui_window_split_horiz (struct t_gui_window *window,
int percentage);
extern void gui_window_split_vertic (struct t_gui_window *window,
int percentage);
extern struct t_gui_window *gui_window_split_horiz (struct t_gui_window *window,
int percentage);
extern struct t_gui_window *gui_window_split_vertic (struct t_gui_window *window,
int percentage);
extern void gui_window_resize (struct t_gui_window *window, int percentage);
extern int gui_window_merge (struct t_gui_window *window);
extern void gui_window_merge_all (struct t_gui_window *window);