From 4982fb29a07d489327e8ed037c840b6afcc698ea Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 14 Dec 2001 19:34:30 +0000 Subject: [PATCH] Clean up default menu for FLTK applications - don't need "About FLTK". Add "--post program" option to fltk-config so that MacOS apps can bind the resources. Also binds resources with --compile. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1846 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Makefile.in | 6 +++--- configure.in | 8 ++++---- fltk-config.in | 22 ++++++++++++++++++---- fluid/Makefile | 6 +++--- makeinclude.in | 6 +++--- src/Fl_mac.cxx | 27 +++++++++++++++++---------- test/Makefile | 34 +++++++++++++++++----------------- 7 files changed, 65 insertions(+), 44 deletions(-) diff --git a/FL/Makefile.in b/FL/Makefile.in index b71b1c57e..0f91e04dc 100644 --- a/FL/Makefile.in +++ b/FL/Makefile.in @@ -1,5 +1,5 @@ # -# "$Id: Makefile.in,v 1.1.2.1 2001/11/19 21:25:35 easysw Exp $" +# "$Id: Makefile.in,v 1.1.2.2 2001/12/14 19:34:29 easysw Exp $" # # Header makefile for the Fast Light Tool Kit (FLTK). # @@ -32,7 +32,7 @@ install: -mkdir -p $(includedir) rm -rf $(includedir)/FL mkdir $(includedir)/FL - cp ../FL/*.[hH] $(includedir)/FL + cp ../FL/*.[hHr] $(includedir)/FL @HLINKS@ cd $(includedir)/FL;\ @HLINKS@ for file in *.H; do\ @HLINKS@ rm -f "`basename $$file H`h";\ @@ -52,5 +52,5 @@ uninstall: # -# End of "$Id: Makefile.in,v 1.1.2.1 2001/11/19 21:25:35 easysw Exp $". +# End of "$Id: Makefile.in,v 1.1.2.2 2001/12/14 19:34:29 easysw Exp $". # diff --git a/configure.in b/configure.in index 3727e5b4f..816844bd8 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl -*- sh -*- dnl the "configure" script is made from this by running GNU "autoconf" dnl -dnl "$Id: configure.in,v 1.33.2.31.2.39 2001/12/09 20:26:24 easysw Exp $" +dnl "$Id: configure.in,v 1.33.2.31.2.40 2001/12/14 19:34:29 easysw Exp $" dnl dnl Configuration script for the Fast Light Tool Kit (FLTK). dnl @@ -260,7 +260,7 @@ dnl Check for standard graphics API and OpenGL... HLINKS= dnl some environments need postprocessing (Darwin, MacOS) -POSTBUILD= +POSTBUILD=: dnl Check for pthreads for multi-threaded apps... if test "$enable_threads" = yes; then @@ -315,7 +315,7 @@ case $uname in HLINKS="#" # Add a postbuild step after linking applications - POSTBUILD="/Developer/Tools/Rez -t APPL ../FL/mac.r -o \$@" + POSTBUILD="/Developer/Tools/Rez -t APPL -o" ;; *) @@ -610,5 +610,5 @@ AC_OUTPUT(makeinclude fltk.list fltk-config FL/Makefile) chmod +x fltk-config dnl -dnl End of "$Id: configure.in,v 1.33.2.31.2.39 2001/12/09 20:26:24 easysw Exp $". +dnl End of "$Id: configure.in,v 1.33.2.31.2.40 2001/12/14 19:34:29 easysw Exp $". dnl diff --git a/fltk-config.in b/fltk-config.in index dfc0bc53c..a11656ab5 100755 --- a/fltk-config.in +++ b/fltk-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# "$Id: fltk-config.in,v 1.12.2.5 2001/11/28 15:55:33 easysw Exp $" +# "$Id: fltk-config.in,v 1.12.2.6 2001/12/14 19:34:29 easysw Exp $" # # FLTK configuration utility. # @@ -45,18 +45,19 @@ srcdir=@srcdir@ CXX="@CXX@" CC="@CC@" +# post-process command (only needed for MacOS) +POSTBUILD="@POSTBUILD@" + # flags for C++ compiler: CFLAGS="@CFLAGS@" CXXFLAGS="@CXXFLAGS@" LDFLAGS="@LDFLAGS@" LDLIBS="@LDFLAGS@ @LIBS@" -# program to make the archive: +# libraries to link with: LIBNAME="@LIBNAME@" DSONAME="@DSONAME@" DSOLINK="@DSOLINK@" - -# libraries to link with: IMAGELIBS="@IMAGELIBS@" usage () @@ -83,6 +84,7 @@ Options telling what information we request: Option to compile and link an application: [--compile program.cxx] + [--post program] " exit $1 } @@ -92,6 +94,7 @@ fi no_plugins=no compile= +post= # Parse command line options while test $# -gt 0 @@ -147,6 +150,11 @@ do ;; --compile) compile=$2 + post=$2 + shift + ;; + --post) + post=$2 shift ;; *) @@ -192,11 +200,17 @@ fi if test -n "$compile"; then prog=`basename $compile .cxx` + post=$prog echo $CXX $CXXFLAGS -o $prog $compile $LDSTATIC $CXX $CXXFLAGS -o $prog $compile $LDSTATIC fi +if test -n "$post" -a "$POSTBUILD" != ":"; then + echo $POSTBUILD $post $includedir/FL/mac.r + $POSTBUILD $post $includedir/FL/mac.r +fi + if test "$echo_prefix" = "yes"; then echo $prefix fi diff --git a/fluid/Makefile b/fluid/Makefile index 37f28766c..174b46515 100644 --- a/fluid/Makefile +++ b/fluid/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.10.2.6.2.6 2001/12/06 02:20:36 matthiaswm Exp $" +# "$Id: Makefile,v 1.10.2.6.2.7 2001/12/14 19:34:29 easysw Exp $" # # FLUID makefile for the Fast Light Tool Kit (FLTK). # @@ -53,7 +53,7 @@ $(PROGRAM) : $(OBJECTS) ../lib/$(LIBNAME) echo Linking $@... $(CXX) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) $(LINKFLTK) $(LDLIBS) \ $(IMAGELIBS) - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r clean : -@ rm -f *.o $(PROGRAM) $(CLEAN) core *~ makedepend @@ -87,5 +87,5 @@ rebuild: ./fluid -c widget_panel.fl # -# End of "$Id: Makefile,v 1.10.2.6.2.6 2001/12/06 02:20:36 matthiaswm Exp $". +# End of "$Id: Makefile,v 1.10.2.6.2.7 2001/12/14 19:34:29 easysw Exp $". # diff --git a/makeinclude.in b/makeinclude.in index 4ad8af3e5..6b39599f4 100644 --- a/makeinclude.in +++ b/makeinclude.in @@ -1,5 +1,5 @@ # -# "$Id: makeinclude.in,v 1.7.2.11.2.11 2001/12/12 21:57:17 easysw Exp $" +# "$Id: makeinclude.in,v 1.7.2.11.2.12 2001/12/14 19:34:29 easysw Exp $" # # Make include file for the Fast Light Tool Kit (FLTK). # @configure_input@ @@ -86,7 +86,7 @@ CAT3EXT =@CAT3EXT@ .o$(EXEEXT): echo Linking $@... $(CXX) -I.. $(CXXFLAGS) $< $(LINKFLTK) $(LDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r .c.o: echo Compiling $<... @@ -109,5 +109,5 @@ CAT3EXT =@CAT3EXT@ mv t.z $@ # -# End of "$Id: makeinclude.in,v 1.7.2.11.2.11 2001/12/12 21:57:17 easysw Exp $". +# End of "$Id: makeinclude.in,v 1.7.2.11.2.12 2001/12/14 19:34:29 easysw Exp $". # diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 50f61c250..986f25741 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.4 2001/12/12 07:50:37 matthiaswm Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.5 2001/12/14 19:34:30 easysw Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -217,8 +217,7 @@ static double do_queued_events( double time = 0.0 ) break; // TODO: cheat // SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 ); } -#else - #ifdef TARGET_API_MAC_CARBON +#elif defined(TARGET_API_MAC_CARBON) OSStatus ret; EventRef ev; static EventTargetRef target = 0; @@ -235,8 +234,7 @@ static double do_queued_events( double time = 0.0 ) } ReleaseEvent( ev ); } - - #else +#else EventRecord ev; unsigned long ticks = (int)(time*60.0); // setting ticks to 7fffffff will wait forever if ( WaitNextEvent(everyEvent, &ev, ticks, rgn) ) @@ -244,7 +242,6 @@ static double do_queued_events( double time = 0.0 ) fl_handle(ev); //: handle the nullEvent to get mouse up events SetRectRgn(rgn, ev.where.h, ev.where.v, ev.where.h+1, ev.where.v+1 ); } - #endif #endif #if CONSOLIDATE_MOTION @@ -351,9 +348,14 @@ OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventRef even GetEventParameter( event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(EventMouseWheelAxis), NULL, &axis ); long delta; GetEventParameter( event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(long), NULL, &delta ); - if ( axis == kEventMouseWheelAxisY ) + if ( axis == kEventMouseWheelAxisX ) { - Fl::e_dy = - delta; + Fl::e_dx = delta; + if ( Fl::e_dx) Fl::handle( FL_MOUSEWHEEL, window ); + } + else if ( axis == kEventMouseWheelAxisY ) + { + Fl::e_dy = -delta; if ( Fl::e_dy) Fl::handle( FL_MOUSEWHEEL, window ); } return noErr; @@ -553,6 +555,7 @@ void fl_open_display() { // create a minimal menu bar (\todo "about app", "FLTK settings") // Any FLTK application may replace this menu later with its own bar. +#if 0 fl_system_menu = GetNewMBar( 128 ); if ( fl_system_menu ) { SetMenuBar( fl_system_menu ); @@ -567,7 +570,11 @@ void fl_open_display() { */ AppendResMenu( GetMenuHandle( 1 ), 'DRVR' ); } - +#else + ClearMenuBar(); + AppendResMenu( GetMenuHandle( 1 ), 'DRVR' ); +#endif // 0 + DrawMenuBar(); } } @@ -1502,6 +1509,6 @@ elapsedNanoseconds = AbsoluteToNanoseconds(elapsedTime); */ // -// End of "$Id: Fl_mac.cxx,v 1.1.2.4 2001/12/12 07:50:37 matthiaswm Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.5 2001/12/14 19:34:30 easysw Exp $". // diff --git a/test/Makefile b/test/Makefile index 8fb239a70..763e0f6f0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.19.2.7.2.19 2001/12/14 16:48:13 easysw Exp $" +# "$Id: Makefile,v 1.19.2.7.2.20 2001/12/14 19:34:30 easysw Exp $" # # Test/example program makefile for the Fast Light Tool Kit (FLTK). # @@ -166,78 +166,78 @@ $(ALL): ../lib/$(LIBNAME) editor$(EXEEXT): editor.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) editor.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r file_chooser$(EXEEXT): file_chooser.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) file_chooser.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r help$(EXEEXT): help.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) help.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r keyboard$(EXEEXT): keyboard.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) keyboard.o $(LINKFLTK) $(LDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r keyboard.o: keyboard.cxx keyboard_ui.cxx mandelbrot$(EXEEXT): mandelbrot.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) mandelbrot.o $(LINKFLTK) $(LDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r mandlebrot.o: mandelbrot.cxx mandelbrot_ui.cxx pixmap_browser$(EXEEXT): pixmap_browser.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) pixmap_browser.o -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r # OpenGL demos... CubeView$(EXEEXT): CubeMain.o CubeView.o CubeViewUI.o echo Linking $@... $(CXX) $(CXXFLAGS) CubeMain.o CubeView.o CubeViewUI.o \ $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r CubeMain.o: CubeViewUI.h CubeView.h CubeView.o: CubeView.h cube$(EXEEXT): cube.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) cube.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r fractals$(EXEEXT): fractals.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) fractals.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r fullscreen$(EXEEXT): fullscreen.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) fullscreen.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r glpuzzle$(EXEEXT): glpuzzle.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) glpuzzle.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r gl_overlay$(EXEEXT): gl_overlay.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) gl_overlay.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r shiny$(EXEEXT): shiny.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) shiny.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r shiny.o: shiny.cxx shiny_panel.cxx shape$(EXEEXT): shape.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) shape.o $(LINKFLTKGL) $(LINKFLTK) $(GLDLIBS) -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r # If you have libjpeg installed, you might want to try this test program: jpeg_image$(EXEEXT): jpeg_image.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) jpeg_image.o $(LINKFLTK) $(LDLIBS) -ljpeg -lXext -o $@ - $(POSTBUILD) + $(POSTBUILD) $@ ../FL/mac.r depend: # $(MAKEDEPEND) -I.. $(CXXFLAGS) $(CPPFILES) > makedepend @@ -253,5 +253,5 @@ uninstall: @echo Nothing to uninstall in test directory. # -# End of "$Id: Makefile,v 1.19.2.7.2.19 2001/12/14 16:48:13 easysw Exp $". +# End of "$Id: Makefile,v 1.19.2.7.2.20 2001/12/14 19:34:30 easysw Exp $". #