diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-02-21 19:31:44 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-02-21 19:31:44 +0100 |
commit | 412332653a74e3f7a9c629d88cb7d71c1c3f254b (patch) | |
tree | 895c173b04ec70e84648086931e0bf3069453ab8 | |
parent | 8b273613dfca3b21a3c808d14002cc70f2588fe5 (diff) | |
download | weechat-412332653a74e3f7a9c629d88cb7d71c1c3f254b.zip |
Allow relative size for command /window resize
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | po/cs.po | 6 | ||||
-rw-r--r-- | po/de.po | 7 | ||||
-rw-r--r-- | po/es.po | 6 | ||||
-rw-r--r-- | po/fr.po | 14 | ||||
-rw-r--r-- | po/hu.po | 6 | ||||
-rw-r--r-- | po/it.po | 7 | ||||
-rw-r--r-- | po/pl.po | 6 | ||||
-rw-r--r-- | po/pt_BR.po | 6 | ||||
-rw-r--r-- | po/ru.po | 6 | ||||
-rw-r--r-- | po/weechat.pot | 6 | ||||
-rw-r--r-- | src/core/wee-command.c | 28 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 54 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk-window.c | 12 | ||||
-rw-r--r-- | src/gui/gui-window.h | 2 |
19 files changed, 127 insertions, 48 deletions
@@ -7,6 +7,7 @@ v0.3.5-dev, 2011-02-21 Version 0.3.5 (under dev!) -------------------------- +* core: allow relative size for command /window resize * core: add some default keys for gnome-terminal (home/end, ctrl+up/down, alt+pgup/pgdn) * core: add option "memory" to command /debug diff --git a/doc/de/autogen/user/weechat_commands.txt b/doc/de/autogen/user/weechat_commands.txt index 1df14f4a6..7f39b63d7 100644 --- a/doc/de/autogen/user/weechat_commands.txt +++ b/doc/de/autogen/user/weechat_commands.txt @@ -513,7 +513,7 @@ Beispiele: /window list -1|+1|b#|up|down|left|right splith|splitv [<pct>] - resize <pct> + resize [+/-]<pct> merge [all] page_up|page_down refresh diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index b8c93bc2c..3baa49ef3 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -513,7 +513,7 @@ Examples: /window list -1|+1|b#|up|down|left|right splith|splitv [<pct>] - resize <pct> + resize [+/-]<pct> merge [all] page_up|page_down refresh diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index be85e9dfb..d382fab64 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -513,7 +513,7 @@ Exemples: /window list -1|+1|b#|up|down|left|right splith|splitv [<pct>] - resize <pct> + resize [+/-]<pct> merge [all] page_up|page_down refresh diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index 8f59d2ba0..5fca63682 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -513,7 +513,7 @@ Esempi: /window list -1|+1|b#|up|down|left|right splith|splitv [<pct>] - resize <pct> + resize [+/-]<pct> merge [all] page_up|page_down refresh @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:29+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1707,8 +1707,8 @@ msgstr "spravuje okna" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-17 15:02+0100\n" "Last-Translator: Nils G.\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1830,9 +1830,10 @@ msgstr "" msgid "manage windows" msgstr "Fenster verwalten" +#, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:29+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1745,8 +1745,8 @@ msgstr "gestión de ventanas" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" -"PO-Revision-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" +"PO-Revision-Date: 2011-02-21 19:07+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -1793,15 +1793,11 @@ msgid "manage windows" msgstr "gestion des fenêtres" msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" -"scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" -"scroll_next_highlight || zoom" -msgstr "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" +msgstr "list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|scroll_next_highlight || zoom" msgid "" " list: list opened windows (without argument, this list is " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:29+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1507,8 +1507,8 @@ msgstr "ablakok kezelése" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-17 15:03+0100\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1733,9 +1733,10 @@ msgstr "" msgid "manage windows" msgstr "gestione finestre" +#, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:29+0100\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1753,8 +1753,8 @@ msgstr "zarządza oknami" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index e02e21440..615604102 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:30+0100\n" "Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1735,8 +1735,8 @@ msgstr "gerencia janelas" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.5-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: 2011-02-07 17:30+0100\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1516,8 +1516,8 @@ msgstr "управление окнами" #, fuzzy msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 39f41698f..bcf93cc31 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2011-02-17 15:01+0100\n" +"POT-Creation-Date: 2011-02-21 19:06+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1318,8 +1318,8 @@ msgid "manage windows" msgstr "" msgid "" -"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize <pct> " -"|| merge [all] || page_up|page_down || refresh || scroll|scroll_up|" +"list || -1|+1|b#|up|down|left|right || splith|splitv [<pct>] || resize [+/-]" +"<pct> || merge [all] || page_up|page_down || refresh || scroll|scroll_up|" "scroll_down|scroll_top|scroll_bottom|scroll_previous_highlight|" "scroll_next_highlight || zoom" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 3666694e5..32eff9737 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -4418,11 +4418,27 @@ COMMAND_CALLBACK(window) { if (argc > 2) { - error = NULL; - number = strtol (argv[2], &error, 10); - if (error && !error[0] - && (number > 0) && (number < 100)) - gui_window_resize (gui_current_window, number); + if ((argv[2][0] == '+') || (argv[2][0] == '-')) + { + error = NULL; + number = strtol (argv[2] + 1, &error, 10); + if (error && !error[0]) + { + if (argv[2][0] == '-') + number *= -1; + gui_window_resize_delta (gui_current_window, number); + } + } + else + { + error = NULL; + number = strtol (argv[2], &error, 10); + if (error && !error[0] + && (number > 0) && (number < 100)) + { + gui_window_resize (gui_current_window, number); + } + } } return WEECHAT_RC_OK; } @@ -5162,7 +5178,7 @@ command_init () N_("list" " || -1|+1|b#|up|down|left|right" " || splith|splitv [<pct>]" - " || resize <pct>" + " || resize [+/-]<pct>" " || merge [all]" " || page_up|page_down" " || refresh" diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 762a67d02..0a1f3e75c 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -1533,7 +1533,7 @@ gui_window_split_horizontal (struct t_gui_window *window, int percentage) height2 = window->win_height - height1; if ((height1 >= GUI_WINDOW_MIN_HEIGHT) && (height2 >= GUI_WINDOW_MIN_HEIGHT) - && (percentage > 0) && (percentage <= 100)) + && (percentage > 0) && (percentage < 100)) { new_window = gui_window_new (window, window->buffer, window->win_x, window->win_y, @@ -1578,7 +1578,7 @@ gui_window_split_vertical (struct t_gui_window *window, int percentage) width2 = window->win_width - width1 - 1; if ((width1 >= GUI_WINDOW_MIN_WIDTH) && (width2 >= GUI_WINDOW_MIN_WIDTH) - && (percentage > 0) && (percentage <= 100)) + && (percentage > 0) && (percentage < 100)) { new_window = gui_window_new (window, window->buffer, window->win_x + width1 + 1, window->win_y, @@ -1625,9 +1625,59 @@ gui_window_resize (struct t_gui_window *window, int percentage) old_split_pct = parent->split_pct; if (((parent->split_horizontal) && (window->ptr_tree == parent->child2)) || ((!(parent->split_horizontal)) && (window->ptr_tree == parent->child1))) + { parent->split_pct = percentage; + } else + { parent->split_pct = 100 - percentage; + } + + add_bottom = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_BOTTOM); + add_top = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_TOP); + add_left = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_LEFT); + add_right = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_RIGHT); + + if (gui_window_auto_resize (gui_windows_tree, add_left, add_top, + gui_window_get_width () - add_left - add_right, + gui_window_get_height () - add_top - add_bottom, + 1) < 0) + parent->split_pct = old_split_pct; + else + gui_window_ask_refresh (1); + } +} + +/* + * gui_window_resize_delta: resize window using delta percentage + */ + +void +gui_window_resize_delta (struct t_gui_window *window, int delta_percentage) +{ + struct t_gui_window_tree *parent; + int old_split_pct, add_bottom, add_top, add_left, add_right; + + if (!gui_ok) + return; + + parent = window->ptr_tree->parent_node; + if (parent) + { + old_split_pct = parent->split_pct; + if (((parent->split_horizontal) && (window->ptr_tree == parent->child2)) + || ((!(parent->split_horizontal)) && (window->ptr_tree == parent->child1))) + { + parent->split_pct += delta_percentage; + } + else + { + parent->split_pct -= delta_percentage; + } + if (parent->split_pct < 1) + parent->split_pct = 1; + else if (parent->split_pct > 99) + parent->split_pct = 99; add_bottom = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_BOTTOM); add_top = gui_bar_root_get_size (NULL, GUI_BAR_POSITION_TOP); diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c index 4d9cdd883..9623e6475 100644 --- a/src/gui/gtk/gui-gtk-window.c +++ b/src/gui/gtk/gui-gtk-window.c @@ -577,6 +577,18 @@ gui_window_resize (struct t_gui_window *window, int percentage) } /* + * gui_window_resize_delta: resize window using delta percentage + */ + +void +gui_window_resize_delta (struct t_gui_window *window, int delta_percentage) +{ + /* TODO: write this function for Gtk */ + (void) window; + (void) delta_percentage; +} + +/* * gui_window_merge: merge window with its sister */ diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h index 87d4da5ee..98f3dcf65 100644 --- a/src/gui/gui-window.h +++ b/src/gui/gui-window.h @@ -163,6 +163,8 @@ extern struct t_gui_window *gui_window_split_horizontal (struct t_gui_window *wi extern struct t_gui_window *gui_window_split_vertical (struct t_gui_window *window, int percentage); extern void gui_window_resize (struct t_gui_window *window, int percentage); +extern void gui_window_resize_delta (struct t_gui_window *window, + int delta_percentage); extern int gui_window_merge (struct t_gui_window *window); extern void gui_window_merge_all (struct t_gui_window *window); extern void gui_window_switch_up (struct t_gui_window *window); |