1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

Add 2 new default bar items (input_paste and input_search), used by default input bar

This commit is contained in:
Sebastien Helleu
2008-10-10 15:58:11 +02:00
parent bfc9751fb7
commit 349371197c
14 changed files with 229 additions and 13 deletions
+13 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1963,6 +1963,18 @@ msgstr "Seznam pro aliasy:\n"
msgid "Bar \"%s\" updated"
msgstr "Alias \"%s\" => \"%s\" vytvořen\n"
#, fuzzy, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr " Vložit %d řádků ? [ctrl-Y] Ano [ctrl-N] Ne"
#, fuzzy
msgid "Text search"
msgstr "Vyhledávání textu: "
#, fuzzy
msgid "Text search (exact)"
msgstr "Vyhledávání textu (rozlišování velikosti znaků): "
#, fuzzy
msgid "filtered"
msgstr "uživatel byl zablokován"
+13 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1910,6 +1910,18 @@ msgstr "Liste der Aliases:\n"
msgid "Bar \"%s\" updated"
msgstr "Alias \"%s\" => \"%s\" angelegt\n"
#, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr ""
#, fuzzy
msgid "Text search"
msgstr "Textsuche"
#, fuzzy
msgid "Text search (exact)"
msgstr "Textsuche (genau)"
#, fuzzy
msgid "filtered"
msgstr "/users wurde deaktiviert"
+11 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1892,6 +1892,16 @@ msgstr "Lista de alias:\n"
msgid "Bar \"%s\" updated"
msgstr "Alias \"%s\" => \"%s\" creado\n"
#, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr ""
msgid "Text search"
msgstr ""
msgid "Text search (exact)"
msgstr ""
#, fuzzy
msgid "filtered"
msgstr "los usuarios han sido desactivados"
+12 -2
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-10-08 13:12+0200\n"
"PO-Revision-Date: 2008-10-08 13:13+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+0200\n"
"PO-Revision-Date: 2008-10-10 15:52+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -1914,6 +1914,16 @@ msgstr "objets de la barre"
msgid "Bar \"%s\" updated"
msgstr "Barre \"%s\" mise à jour"
#, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr "%sColler %d lignes ? [ctrl-Y] Oui [ctrl-N] Non"
msgid "Text search"
msgstr "Recherche texte"
msgid "Text search (exact)"
msgstr "Recherche texte (exact)"
msgid "filtered"
msgstr "filtré"
+13 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1917,6 +1917,18 @@ msgstr "Aliaszok listája:\n"
msgid "Bar \"%s\" updated"
msgstr "A \"%s\" => \"%s\" aliasz elkészült\n"
#, fuzzy, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr " Beszúrható %d sor? [ctrl-Y] Igen [ctrl-N] Nem"
#, fuzzy
msgid "Text search"
msgstr "Szöveg keresése: "
#, fuzzy
msgid "Text search (exact)"
msgstr "Szöveg keresése (pontos): "
#, fuzzy
msgid "filtered"
msgstr "a felhasználók le lettek tiltva"
+13 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1921,6 +1921,18 @@ msgstr "Список сокращений:\n"
msgid "Bar \"%s\" updated"
msgstr "Сокращение \"%s\" => \"%s\" создано\n"
#, fuzzy, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr " Вставить %d строк ? [ctrl-Y] Да [ctrl-N] Нет"
#, fuzzy
msgid "Text search"
msgstr "Поиск текста: "
#, fuzzy
msgid "Text search (exact)"
msgstr "Поиск текста (регистрозависимый): "
#, fuzzy
msgid "filtered"
msgstr "команда users отключена"
+11 -1
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-10-08 13:12+0200\n"
"POT-Creation-Date: 2008-10-10 15:52+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"
@@ -1607,6 +1607,16 @@ msgstr ""
msgid "Bar \"%s\" updated"
msgstr ""
#, c-format
msgid "%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
msgstr ""
msgid "Text search"
msgstr ""
msgid "Text search (exact)"
msgstr ""
msgid "filtered"
msgstr ""
+1
View File
@@ -413,6 +413,7 @@ gui_keyboard_read_cb (void *data)
{
gui_keyboard_paste_pending = 1;
gui_input_draw (gui_current_window->buffer, 1);
gui_input_paste_pending_signal ();
}
}
}
+104 -3
View File
@@ -42,6 +42,7 @@
#include "gui-completion.h"
#include "gui-filter.h"
#include "gui-hotlist.h"
#include "gui-keyboard.h"
#include "gui-nicklist.h"
#include "gui-window.h"
@@ -49,9 +50,10 @@
struct t_gui_bar_item *gui_bar_items = NULL; /* first bar item */
struct t_gui_bar_item *last_gui_bar_item = NULL; /* last bar item */
char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] =
{ "input_prompt", "input_text", "time", "buffer_count", "buffer_plugin",
"buffer_name", "buffer_filter", "buffer_nicklist_count", "scroll", "hotlist",
"completion", "buffer_title", "buffer_nicklist"
{ "input_paste", "input_prompt", "input_search", "input_text", "time",
"buffer_count", "buffer_plugin", "buffer_name", "buffer_filter",
"buffer_nicklist_count", "scroll", "hotlist", "completion", "buffer_title",
"buffer_nicklist"
};
struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL;
struct t_hook *gui_bar_item_timer = NULL;
@@ -617,6 +619,45 @@ gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin)
}
}
/*
* gui_bar_item_default_input_paste: default item for input paste question
*/
char *
gui_bar_item_default_input_paste (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char *text_paste_pending = N_("%sPaste %d lines ? [ctrl-Y] Yes [ctrl-N] No");
char *ptr_message, *buf;
int length;
/* make C compiler happy */
(void) data;
(void) item;
(void) max_width;
(void) max_height;
if (!window)
return NULL;
if (window != gui_current_window)
return NULL;
if (!gui_keyboard_paste_pending)
return NULL;
ptr_message = _(text_paste_pending);
length = strlen (ptr_message) + 16 + 1;
buf = malloc (length);
if (buf)
snprintf (buf, length, ptr_message,
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_actions))),
gui_keyboard_get_paste_lines ());
return buf;
}
/*
* gui_bar_item_default_input_prompt: default item for input prompt
*/
@@ -657,6 +698,50 @@ gui_bar_item_default_input_prompt (void *data, struct t_gui_bar_item *item,
return buf;
}
/*
* gui_bar_item_default_input_search: default item for input search status
*/
char *
gui_bar_item_default_input_search (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char *text_search = N_("Text search");
char *text_search_exact = N_("Text search (exact)");
char *ptr_message, *buf;
int length;
/* make C compiler happy */
(void) data;
(void) item;
(void) max_width;
(void) max_height;
if (!window)
window = gui_current_window;
if (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
return NULL;
ptr_message = (window->buffer->text_search_exact) ?
_(text_search_exact) : _(text_search);
length = 16 + strlen (ptr_message) + 1;
buf = malloc (length);
if (buf)
{
snprintf (buf, length, "%s%s",
(window->buffer->text_search_found
|| !window->buffer->input_buffer
|| !window->buffer->input_buffer[0]) ?
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input))) :
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_text_not_found))),
ptr_message);
}
return buf;
}
/*
* gui_bar_item_default_input_text: default item for input text
*/
@@ -1218,6 +1303,13 @@ gui_bar_item_hook_signal (const char *signal, const char *item)
void
gui_bar_item_init ()
{
/* input paste */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE],
&gui_bar_item_default_input_paste, NULL);
gui_bar_item_hook_signal ("input_paste_pending",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE]);
/* input prompt */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT],
@@ -1225,6 +1317,15 @@ gui_bar_item_init ()
gui_bar_item_hook_signal ("input_prompt_changed",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT]);
/* input search */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH],
&gui_bar_item_default_input_search, NULL);
gui_bar_item_hook_signal ("input_search",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH]);
gui_bar_item_hook_signal ("input_text_changed",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH]);
/* input text */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT],
+3 -1
View File
@@ -22,7 +22,9 @@
enum t_gui_bar_item_weechat
{
GUI_BAR_ITEM_INPUT_PROMPT = 0,
GUI_BAR_ITEM_INPUT_PASTE = 0,
GUI_BAR_ITEM_INPUT_PROMPT,
GUI_BAR_ITEM_INPUT_SEARCH,
GUI_BAR_ITEM_INPUT_TEXT,
GUI_BAR_ITEM_TIME,
GUI_BAR_ITEM_BUFFER_COUNT,
+7 -1
View File
@@ -1670,15 +1670,21 @@ gui_bar_create_default_input ()
{
/* create input bar */
length = 1 /* "[" */
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE])
+ 3 /* "],[" */
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT])
+ 3 /* "],[" */
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH])
+ 2 /* "]," */
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT])
+ 1 /* \0 */;
buf = malloc (length);
if (buf)
{
snprintf (buf, length, "[%s],%s",
snprintf (buf, length, "[%s],[%s],[%s],%s",
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE],
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT],
gui_bar_item_names[GUI_BAR_ITEM_INPUT_SEARCH],
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
if (gui_bar_new (NULL, GUI_BAR_DEFAULT_NAME_INPUT,
"0", /* hidden */
+24
View File
@@ -47,6 +47,16 @@
char *gui_input_clipboard = NULL; /* clipboard content */
/*
* gui_input_paste_pending_signal: send signal "input_paste_pending"
*/
void
gui_input_paste_pending_signal ()
{
hook_signal_send ("input_paste_pending", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_input_prompt_changed_signal: send signal "input_prompt_changed"
*/
@@ -77,6 +87,16 @@ gui_input_text_cursor_moved_signal ()
hook_signal_send ("input_text_cursor_moved", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_input_search_signal: send signal "input_search"
*/
void
gui_input_search_signal ()
{
hook_signal_send ("input_search", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_input_optimize_size: optimize input buffer size by adding
* or deleting data block (predefined size)
@@ -334,7 +354,10 @@ gui_input_return ()
if (gui_current_window->buffer->input)
{
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
{
gui_window_search_stop (gui_current_window);
gui_input_search_signal ();
}
else if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
@@ -539,6 +562,7 @@ gui_input_search_text ()
gui_window_search_restart (gui_current_window);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
}
gui_input_search_signal ();
}
}
+2
View File
@@ -28,8 +28,10 @@ extern char *gui_input_clipboard;
/* input functions */
extern void gui_input_paste_pending_signal ();
extern void gui_input_prompt_changed_signal ();
extern void gui_input_text_changed_signal ();
extern void gui_input_search_signal ();
extern void gui_input_optimize_size (struct t_gui_buffer *buffer);
extern void gui_input_init_color_mask (struct t_gui_buffer *buffer);
extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
+2
View File
@@ -635,6 +635,7 @@ void
gui_keyboard_paste_accept ()
{
gui_keyboard_paste_pending = 0;
gui_input_paste_pending_signal ();
}
@@ -647,6 +648,7 @@ gui_keyboard_paste_cancel ()
{
gui_keyboard_buffer_reset ();
gui_keyboard_paste_pending = 0;
gui_input_paste_pending_signal ();
}
/*