From 7fb24accd94284e0e203f60443faab060b938e77 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 7 Sep 2009 21:52:34 +0200 Subject: show current file name in window title Submitted by Sydro. --- COPYING | 2 +- ChangeLog | 1 + src/flpsed.cxx | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/COPYING b/COPYING index bb397a2..f6f4769 120000 --- a/COPYING +++ b/COPYING @@ -1 +1 @@ -/usr/pkg/share/automake-1.10/COPYING \ No newline at end of file +/usr/pkg/share/automake-1.11/COPYING \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 1e1ddcc..d85ea90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ flpsed-0.5.3 * Fix warnings (reported by Kapil Hari Paranjape). * Fix scroll_to_end() when scroll is higher than the document. * NEWS -> ChangeLog. +* Show current file name in the window title (by Sydro). flpsed-0.5.2 * Add Ctrl-l (last page) and Ctrl-r (previous page) hotkeys. (by Paulo Jnkml) diff --git a/src/flpsed.cxx b/src/flpsed.cxx index f568255..2896874 100644 --- a/src/flpsed.cxx +++ b/src/flpsed.cxx @@ -34,6 +34,7 @@ PSEditor *psed_p = NULL; Fl_Scroll *scroll = NULL; Fl_Hold_Browser *page_sel = NULL; +Fl_Window *win; int xev_handler(int ev) { if (psed_p) @@ -132,6 +133,11 @@ void open_file(char *file) { const char *args[5]; pid_t pid; char *dot = strrchr(file, '.'); + static const char *title_prefix = "flpsed - "; + int title_len = strlen(file) + strlen(title_prefix) + 1; + char *title = (char*) malloc(title_len); + + snprintf(title, title_len, "%s%s", title_prefix, file); if (dot && strcasecmp(dot, ".pdf") == 0) { // assume pdf and try to import it using pdftops @@ -153,6 +159,8 @@ void open_file(char *file) { } else if (WEXITSTATUS(status) != 0) { fl_message("PDF import failed\n"); } + + win->copy_label(title); } else { perror("pexecvp"); } @@ -160,8 +168,11 @@ void open_file(char *file) { // assume postscript psed_p->open_file(file); psed_p->load(); + win->copy_label(title); } + free(title); + page_sel_fill(); } @@ -482,7 +493,6 @@ int main(int argc, char** argv) { char *sep, *tmp, **my_argv; int c, err, bflag = 0, dflag = 0; int i, n; - Fl_Window *win; Fl_Menu_Bar *m; struct {char *tag; char *value;} tv[TV_LEN]; int tv_idx = 0, my_argc; -- cgit v1.2.3