Search window improvements (Richard Hitt)

This commit is contained in:
Berke Viktor
2012-05-28 23:17:09 +02:00
parent 1f62507fc0
commit a6cc734b38
7 changed files with 861 additions and 168 deletions

View File

@@ -1215,6 +1215,41 @@ menu_search ()
search_open (current_sess);
}
static void
menu_search_next ()
{
GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext);
xtext_buffer *buf = xtext->buffer;
if (!gtk_xtext_search (xtext, buf->search_text,
(buf->search_flags & (case_match | follow | regexp)), NULL))
{
fe_message (_("Search hit end, not found."), FE_MSG_ERROR);
}
}
static void
menu_search_prev ()
{
GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext);
xtext_buffer *buf = xtext->buffer;
if (!gtk_xtext_search(xtext, buf->search_text,
(buf->search_flags & (case_match | follow | regexp) | backward), NULL))
{
fe_message (_("Search hit end, not found."), FE_MSG_ERROR);
}
}
static void
menu_search_reset ()
{
GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext);
xtext_buffer *buf = xtext->buffer;
gtk_xtext_search (xtext, "", 0, NULL);
}
static void
menu_resetmarker (GtkWidget * wid, gpointer none)
{
@@ -1675,11 +1710,17 @@ static struct mymenu mymenu[] = {
{N_("Reset Marker Line"), menu_resetmarker, 0, M_MENUITEM, 0, 0, 1, GDK_m},
{N_("_Copy Selection"), menu_copy_selection, 0, M_MENUITEM, 0, 0, 1, GDK_C},
{N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1, GDK_l},
#define SEARCH_OFFSET 68
{N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f},
{N_("Save Text..."), menu_savebuffer, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1},
#define SEARCH_OFFSET 70
{N_("Search"), 0, GTK_STOCK_JUSTIFY_LEFT, M_MENUSUB, 0, 0, 1},
{N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f},
{N_("Reset Search"), menu_search_reset, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_F},
{N_("Search Next" ), menu_search_next, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_g},
{N_("Search Previous" ), menu_search_prev, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_G},
{0, 0, 0, M_END, 0, 0, 0},
{N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 74 */
{N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 70 */
{N_("_Contents"), menu_docs, GTK_STOCK_HELP, M_MENUSTOCK, 0, 0, 1, GDK_F1},
#if 0
{N_("Check for updates"), menu_update, 0, M_MENUITEM, 0, 1},