diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-04-12 18:34:41 +0000 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-04-12 18:34:41 +0000 |
commit | 1250637f0e5bf0585811b16c51e9081f1d7f1aa9 (patch) | |
tree | 048227560eeffbf11e4f4eae138e16be6bcf5f80 /src | |
parent | 9053ca6dddb1456f99a3a3abd5532a999bc7b469 (diff) |
add flmountains.cxx
add flmountains.cxx
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 9 | ||||
-rw-r--r-- | src/gipfel.cxx | 142 |
2 files changed, 150 insertions, 1 deletions
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 <stdio.h> +#include <string.h> +#include <unistd.h> +#include <signal.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <fcntl.h> +#include <errno.h> +#include <signal.h> + +#include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Scroll.H> +#include <FL/Fl_File_Chooser.H> +#include <FL/Fl_Input.H> +#include <FL/Fl_Int_Input.H> +#include <FL/Fl_Menu_Bar.H> +#include <FL/Fl_Menu_Item.H> +#include <FL/Fl_JPEG_Image.H> +#include <FL/Fl_Shared_Image.H> + + +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 <tag>=<value>] [<infile>] [<outfile>]\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 <tag>=<value> set text to <value> where tag is <tag>\n" + " <infile> optional input file; in batch mode if no\n" + " input file is given, input is read from stdin\n" + " <outfile> 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(); +} |