From b774610cf6ca4678d9c30e0ed2289f4595efb431 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 26 Jan 2009 22:02:34 +0100 Subject: add README viewer --- configure.ac | 2 +- src/gipfel.cxx | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 707b693..dd5848c 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/Panorama.H]) AC_CONFIG_HEADER(config.h) -CPPFLAGS="-Wall -g -I/usr/local/include -DDATADIR=\\\"$datadir\\\" $CPPFLAGS" +CPPFLAGS="-Wall -g -I/usr/local/include -DDATADIR=\\\"$datadir\\\" -DDOCDIR=\\\"$docdir\\\" $CPPFLAGS" LDFLAGS="-g $LDFLAGS" # Checks for programs. diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 3fcee80..c3b963b 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "Fl_Value_Dial.H" #include "Fl_Search_Chooser.H" @@ -248,12 +250,27 @@ void distortion_cb(Fl_Value_Input*, void*) { void about_cb() { fl_message("gipfel -- and you know what you see.\n" "Version %s\n\n" - "(c) Johannes Hofmann 2006-2008\n\n" + "(c) Johannes Hofmann 2006-2009\n\n" "Default datafile by http://www.alpin-koordinaten.de\n", VERSION); } +void readme_cb() { + Fl_Window *win = new Fl_Window(800, 600, "README"); + Fl_Text_Buffer *textBuf = new Fl_Text_Buffer(); + Fl_Text_Display *textDisp = new Fl_Text_Display(0, 0, win->w(), win->h()); + char buf[PATH_MAX]; + + textDisp->textfont(FL_COURIER); + textDisp->buffer(textBuf); + win->resizable(textDisp); + snprintf(buf, PATH_MAX, "%s/README", DOCDIR); + textBuf->appendfile(buf); + win->end(); + win->show(); +} + void fill_menubar(Fl_Menu_Bar* mb) { mb->add("&File/L&oad Image", FL_CTRL+'o', (Fl_Callback*)open_cb); mb->add("&File/&Save Image", FL_CTRL+'s', (Fl_Callback*)save_cb); @@ -272,6 +289,7 @@ void fill_menubar(Fl_Menu_Bar* mb) { mb->add("&Option/Show Hidden", 0, (Fl_Callback *) hidden_cb, (void *)0, FL_MENU_TOGGLE); + mb->add("&Help/Readme", 0, (Fl_Callback*)readme_cb); mb->add("&Help/About", 0, (Fl_Callback*)about_cb); } -- cgit v1.2.3