From 1250637f0e5bf0585811b16c51e9081f1d7f1aa9 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 12 Apr 2005 18:34:41 +0000 Subject: add flmountains.cxx add flmountains.cxx --- src/Makefile | 9 +++- src/gipfel.cxx | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 src/gipfel.cxx (limited to 'src') diff --git a/src/Makefile b/src/Makefile index adcb519..5f7ab8d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ CC=gcc -CFLAGS=-g +CPP=c++ +CFLAGS=-g -I/usr/X11R6/include LDFLAGS=-g OBJECTS=panorama.o @@ -7,8 +8,14 @@ OBJECTS=panorama.o %.o: %.c $(CC) -c $(CFLAGS) $*.c +%.o: %.cxx + $(CPP) -c $(CFLAGS) $*.c + panorama: $(OBJECTS) $(CC) -o panorama $(OBJECTS) -lm +flmountains: $(flmountains.o) + $(CPP) -o flmountains flmountains.o -L/usr/X11R6/lib -lm -lfltk -lfltk_images + clean: rm -f panorama $(OBJECTS) diff --git a/src/gipfel.cxx b/src/gipfel.cxx new file mode 100644 index 0000000..70657f3 --- /dev/null +++ b/src/gipfel.cxx @@ -0,0 +1,142 @@ +// +// "$Id: gipfel.cxx,v 1.1 2005/04/12 20:34:41 hofmann Exp $" +// +// flpsed program. +// +// Copyright 2004 by Johannes Hofmann +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +char *filename; + +void open_cb() { + char *file = fl_file_chooser("Open File?", "*.ps", filename); + if(file != NULL) { + + } +} + +void about_cb() { + fl_message("flpsed -- a pseudo PostScript editor\n" + "(c) Johannes Hofmann 2004, 2005\n\n" + "PostScript is a registered trademark of Adobe Systems"); +} + +Fl_Menu_Item menuitems[] = { + { "&File", 0, 0, 0, FL_SUBMENU }, + { "&Open File...", FL_CTRL + 'o', (Fl_Callback *)open_cb }, + {0}, + { 0 } +}; + + +void usage() { + fprintf(stderr, + "usage: flpsed [-hbd] [-t =] [] []\n" + " -h print this message\n" + " -b batch mode (no gui)\n" + " -d dump tags and values from a document\n" + " to stdout (this implies -b)\n" + " -t = set text to where tag is \n" + " optional input file; in batch mode if no\n" + " input file is given, input is read from stdin\n" + " optional output file for batch mode; if no\n" + " output file is given, output is written to stdout\n"); +} + + +int main(int argc, char** argv) { + char c, *sep, *tmp, **my_argv; + int err, bflag = 0, dflag = 0, my_argc; + Fl_Window *win; + Fl_Scroll *scroll; + Fl_Menu_Bar *m; + + err = 0; + while ((c = getopt(argc, argv, "hdbt:")) != EOF) { + switch (c) { + case 'h': + usage(); + exit(0); + break; + case 'b': + bflag = 1; + break; + case 'd': + dflag = 1; + break; + default: + err++; + } + } + + if (err) { + usage(); + exit(1); + } + + my_argc = argc - optind; + my_argv = argv + optind; + + fprintf(stderr, "%d %s\n", my_argc, my_argv[0]); + if (my_argc >= 1) { + filename = my_argv[0]; + } + + fl_register_images(); + win = new Fl_Window(600,700); + m = new Fl_Menu_Bar(0, 0, 600, 30); + m->menu(menuitems); + scroll = new Fl_Scroll(0, 30, win->w(), win->h()-30); + fprintf(stderr, "%s\n", filename); + + Fl_Image *img = new Fl_JPEG_Image(filename); + Fl_Box *b = new Fl_Box(0, 0, img->w(), img->h()); + b->image(img); + scroll->end(); + + + win->resizable(scroll); + + win->end(); + win->show(1, argv); + + return Fl::run(); +} -- cgit v1.2.3