mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Ticket #3453: Find file: show pattern and content in the results dialog title.
Initial step: * (dlg_set_title): new API. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
faa893b683
commit
a38c7f19e9
@ -42,6 +42,7 @@
|
||||
#include "lib/strutil.h"
|
||||
#include "lib/fileloc.h" /* MC_HISTORY_FILE */
|
||||
#include "lib/event.h" /* mc_event_raise() */
|
||||
#include "lib/util.h" /* MC_PTR_FREE */
|
||||
|
||||
#include "lib/widget.h"
|
||||
#include "lib/widget/mouse.h"
|
||||
@ -653,6 +654,7 @@ dlg_default_repaint (WDialog * h)
|
||||
|
||||
if (h->title != NULL)
|
||||
{
|
||||
/* TODO: truncate long title */
|
||||
tty_setcolor (h->color[DLG_COLOR_TITLE]);
|
||||
widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2);
|
||||
tty_print_string (h->title);
|
||||
@ -783,16 +785,7 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
||||
|
||||
new_d->mouse_status = MOU_UNHANDLED;
|
||||
|
||||
/* Strip existing spaces, add one space before and after the title */
|
||||
if (title != NULL && *title != '\0')
|
||||
{
|
||||
char *t;
|
||||
|
||||
t = g_strstrip (g_strdup (title));
|
||||
if (*t != '\0')
|
||||
new_d->title = g_strdup_printf (" %s ", t);
|
||||
g_free (t);
|
||||
}
|
||||
dlg_set_title (new_d, title);
|
||||
|
||||
/* unique name of event group for this dialog */
|
||||
new_d->event_group = g_strdup_printf ("%s_%p", MCEVENT_GROUP_DIALOG, (void *) new_d);
|
||||
@ -1257,6 +1250,25 @@ dlg_save_history (WDialog * h)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
dlg_set_title (WDialog * h, const char *title)
|
||||
{
|
||||
MC_PTR_FREE (h->title);
|
||||
|
||||
/* Strip existing spaces, add one space before and after the title */
|
||||
if (title != NULL && title[0] != '\0')
|
||||
{
|
||||
char *t;
|
||||
|
||||
t = g_strstrip (g_strdup (title));
|
||||
if (t[0] != '\0')
|
||||
h->title = g_strdup_printf (" %s ", t);
|
||||
g_free (t);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
dlg_get_title (const WDialog * h, size_t len)
|
||||
{
|
||||
|
@ -131,6 +131,7 @@ void dlg_run_done (WDialog * h);
|
||||
void dlg_save_history (WDialog * h);
|
||||
void dlg_process_event (WDialog * h, int key, Gpm_Event * event);
|
||||
|
||||
void dlg_set_title (WDialog * h, const char *title);
|
||||
char *dlg_get_title (const WDialog * h, size_t len);
|
||||
|
||||
void dlg_redraw (WDialog * h);
|
||||
|
Loading…
Reference in New Issue
Block a user