diff --git a/FL/Makefile b/FL/Makefile deleted file mode 100644 index be865eb..0000000 --- a/FL/Makefile +++ /dev/null @@ -1,115 +0,0 @@ - -############################################################################### -# Copyright (C) 2008 Jonathan Moore Liles # -# # -# 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 program; see the file COPYING. If not,write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -############################################################################### - -## Makefile for the Non-DAW. - -## -## Do not edit this file; run `make config` instead. -## - -VERSION := 1.0.0 -PACKAGE := FL - -all: .config - -.config: configure - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - -config: - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - --include .config - -export SYSTEM_PATH:=$(prefix)/share/ -export DOCUMENT_PATH:=$(prefix)/share/doc/ -export PIXMAP_PATH:=$(prefix)/share/pixmaps/ - -# a bit of a hack to make sure this runs before any rules -ifneq ($(CALCULATING),yes) -TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) -endif - -ifeq ($(USE_DEBUG),yes) - CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 - CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions -else - CFLAGS := -pipe -O2 -DNDEBUG - CXXFLAGS := -fno-rtti -fno-exceptions -endif - - -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ - -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ - -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ - -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" - -CXXFLAGS += $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) -CXXFLAGS := $(CFLAGS) $(CXXFLAGS) - -INCLUDES := -I. -Iutil -IFL -Inonlib - -include scripts/colors - -ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)$(PACKAGE) [$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(YELLOW)$<$(SGR0)" -else - COMPILING="Compiling: $<" -endif - -.C.o: - @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.C : %.fl - @ cd `dirname $<` && fluid -c ../$< - -DONE := $(BOLD)$(GREEN)done$(SGR0) - -include makefile.inc - -SRCS:=$(FL_SRCS) -OBJS:=$(FL_OBJS) - -# FIXME: isn't there a better way? -$(OBJS): .config Makefile - -TAGS: $(SRCS) - etags $(SRCS) - -.deps: .config $(SRCS) -ifneq ($(CALCULATING),yes) - @ echo -n Calculating dependencies... - @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) - @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) -endif - -clean_deps: - @ rm -f .deps - -install: - @ echo ... - -.PHONEY: clean config depend clean_deps - -clean: FL_clean - --include .deps diff --git a/FL/Makefile b/FL/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/FL/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/FL/makefile.inc b/FL/makefile.inc index faa3410..ff9a84b 100644 --- a/FL/makefile.inc +++ b/FL/makefile.inc @@ -1,20 +1,26 @@ # -*- mode: makefile; -*- +VERSION := 1.1.0 +PACKAGE := FL + all: FL -FL_SRCS := $(wildcard FL/*.C FL/*.fl) +SRCS := $(wildcard FL/*.C FL/*.fl) -FL_SRCS:=$(FL_SRCS:.fl=.C) -FL_SRCS:=$(sort $(FL_SRCS)) -FL_OBJS:=$(FL_SRCS:.C=.o) +SRCS:=$(SRCS:.fl=.C) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) all: FL/libfl_widgets.a -FL/libfl_widgets.a: $(FL_OBJS) - @ ar rcs $@ $(FL_OBJS) +FL/libfl_widgets.a: $(OBJS) + @ ar rcs $@ $(OBJS) .PHONEY: FL FL: FL/libfl_widgets.a -FL_clean: - rm -f $(FL_OBJS) FL/libfl_widgets.a +clean: + rm -f $(OBJS) FL/libfl_widgets.a + +install: + @ \ No newline at end of file diff --git a/mixer/Makefile b/mixer/Makefile deleted file mode 100644 index 16c31ce..0000000 --- a/mixer/Makefile +++ /dev/null @@ -1,142 +0,0 @@ - -############################################################################### -# Copyright (C) 2008 Jonathan Moore Liles # -# # -# 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 program; see the file COPYING. If not,write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -############################################################################### - -## Makefile for the Non-DAW. - -## -## Do not edit this file; run `make config` instead. -## - -VERSION := 1.1.0 -PACKAGE := MIXER - -all: .config - -.config: configure - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - -config: - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - --include .config - -export SYSTEM_PATH:=$(prefix)/share/ -export DOCUMENT_PATH:=$(prefix)/share/doc/ -export PIXMAP_PATH:=$(prefix)/share/pixmaps/ -export ICON_PATH:=$(prefix)/share/icons/ -export DESKTOP_PATH:=$(prefix)/share/applications/ - - -# a bit of a hack to make sure this runs before any rules -ifneq ($(CALCULATING),yes) -TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) -endif - -ifeq ($(USE_DEBUG),yes) - CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 - CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions -else - CFLAGS := -pipe -O2 -DNDEBUG - CXXFLAGS := -fno-rtti -fno-exceptions -endif - - -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ - -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ - -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ - -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" - -CXXFLAGS := $(CFLAGS) $(CXXFLAGS) - -INCLUDES := -I. -Iutil -IFL -Inonlib - -include scripts/colors - -ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)MIXER [$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(YELLOW)$<$(SGR0)" -else - COMPILING="Compiling: $<" -endif - -.C.o: - @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.C : %.fl - @ cd `dirname $<` && fluid -c ../$< - -DONE := $(BOLD)$(GREEN)done$(SGR0) - -include FL/makefile.inc -#include nonlib/makefile.inc -include makefile.inc - -SRCS:=$(Mixer_SRCS) -OBJS:=$(Mixer_OBJS) -CXXFLAGS += $(Mixer_CFLAGS) - -# FIXME: isn't there a better way? -$(OBJS): .config Makefile - -TAGS: $(SRCS) - etags $(SRCS) - -.deps: .config $(SRCS) -ifneq ($(CALCULATING),yes) - @ echo -n Calculating dependencies... - @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) - @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) -endif - - -install: all - @ echo -n "Installing..." - @ install src/mixer "$(DESTDIR)$(prefix)"/bin/non-mixer - @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-mixer - @ $(MAKE) -s -C doc install - @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-mixer" - @ install -m 644 icons/hicolor/256x256/apps/non-mixer.png "$(DESTDIR)$(PIXMAP_PATH)"/non-mixer/icon-256x256.png - @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" - @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" - @ install -d "$(DESTDIR)$(DESKTOP_PATH)" - @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-mixer.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-mixer.desktop" - @ echo "$(DONE)" -ifneq ($(USE_DEBUG),yes) - @ echo -n "Stripping..." - @ strip $(DESTDIR)$(prefix)/bin/non-mixer - @ echo "$(DONE)" -endif - -clean_deps: - @ rm -f .deps - -.PHONEY: clean config depend clean_deps - -clean: FL_clean Mixer_clean - -dist: - git archive --prefix=non-mixer-$(VERSION)/ v$(VERSION) | bzip2 > non-mixer-$(VERSION).tar.bz2 - -scan-gpl: - @ scripts/scan-gpl $(SRCS) || echo $(BOLD)$(RED)Some source files do not contain proper license information! - --include .deps diff --git a/mixer/Makefile b/mixer/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/mixer/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/mixer/configure b/mixer/configure index efdf4c6..5a6a28d 100755 --- a/mixer/configure +++ b/mixer/configure @@ -26,4 +26,17 @@ suggest_package XPM 2.0.0 xpm test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" +if ! hostname_resolvable +then + echo "Your hostname \"$(hostname)\" does not resolve to a valid address." + echo "This is a broken configuration and will cause liblo (the" + echo "OSC library) to fail to function. Add the line:" + echo + echo "127.0.0.1 $(hostname)" + echo + echo "to your /etc/hosts file to fix. And consider switching to a saner distribution." + echo + fail "Invalid hostname!" +fi + end diff --git a/mixer/makefile.inc b/mixer/makefile.inc index f55d3df..3c3d97d 100644 --- a/mixer/makefile.inc +++ b/mixer/makefile.inc @@ -1,22 +1,44 @@ # -*- mode: makefile; -*- +VERSION := 1.1.0 +PACKAGE := MIXER +BIN_NAME := non-mixer + all: Mixer -Mixer_SRCS := $(wildcard src/*.C src/*.fl src/Engine/*.C) +SRCS := $(wildcard src/*.C src/*.fl src/Engine/*.C) -Mixer_SRCS:=$(Mixer_SRCS:.fl=.C) -Mixer_SRCS:=$(sort $(Mixer_SRCS)) -Mixer_OBJS:=$(Mixer_SRCS:.C=.o) +SRCS:=$(SRCS:.fl=.C) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) -Mixer_LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(LASH_LIBS) $(LRDF_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) +LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(LASH_LIBS) $(LRDF_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) -Mixer_CFLAGS := $(FLTK_CFLAGS) $(JACK_CFLAGS) $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) +CFLAGS := $(FLTK_CFLAGS) $(JACK_CFLAGS) $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) -src/mixer: $(Mixer_OBJS) FL/libfl_widgets.a nonlib/libnonlib.a +src/mixer: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a @ echo -n Linking mixer... - @ $(CXX) $(CXXFLAGS) $(Mixer_LIBS) $(Mixer_OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib -ldl && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib -ldl && echo $(DONE) Mixer: src/mixer -Mixer_clean: - rm -f $(Mixer_OBJS) src/mixer +clean: + rm -f $(OBJS) src/mixer + +install: all + @ echo -n "Installing..." + @ install src/mixer "$(DESTDIR)$(prefix)"/bin/non-mixer + @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-mixer + @ $(MAKE) -s -C doc install + @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-mixer" + @ install -m 644 icons/hicolor/256x256/apps/non-mixer.png "$(DESTDIR)$(PIXMAP_PATH)"/non-mixer/icon-256x256.png + @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" + @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" + @ install -d "$(DESTDIR)$(DESKTOP_PATH)" + @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-mixer.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-mixer.desktop" + @ echo "$(DONE)" +ifneq ($(USE_DEBUG),yes) + @ echo -n "Stripping..." + @ strip $(DESTDIR)$(prefix)/bin/non-mixer + @ echo "$(DONE)" +endif diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index 25bf57a..ca3f6f6 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -382,6 +382,8 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl::scheme( "plastic" ); color_scheme( "dark" ); + Loggable::dirty_callback( &Mixer::handle_dirty, this ); + _rows = 1; box( FL_NO_BOX ); labelsize( 96 ); @@ -668,6 +670,19 @@ Mixer::get_unique_track_name ( const char *name ) return strdup( pat ); } +void +Mixer::handle_dirty ( int d, void *v ) +{ + //Mixer *m = (Mixer*)v; + if ( !nsm ) + return; + + if ( d == 1 ) + nsm->is_dirty(); + else if ( d == 0 ) + nsm->is_clean(); +} + void Mixer::snapshot ( void ) diff --git a/mixer/src/Mixer.H b/mixer/src/Mixer.H index 338b527..1df1b28 100644 --- a/mixer/src/Mixer.H +++ b/mixer/src/Mixer.H @@ -67,6 +67,8 @@ private: void redraw_windows ( void ); + static void handle_dirty ( int, void *v ); + protected: int handle ( int m ); diff --git a/mixer/src/Plugin_Module.C b/mixer/src/Plugin_Module.C index 02b4920..57f3bb9 100644 --- a/mixer/src/Plugin_Module.C +++ b/mixer/src/Plugin_Module.C @@ -290,6 +290,12 @@ Plugin_Module::spawn_discover_thread ( void ) plugin_discover_thread->clone( &Plugin_Module::discover_thread, NULL ); } +void +Plugin_Module::join_discover_thread ( void ) +{ + plugin_discover_thread->join(); +} + /* return a list of available plugins */ Plugin_Module::Plugin_Info * Plugin_Module::get_all_plugins ( void ) diff --git a/mixer/src/Plugin_Module.H b/mixer/src/Plugin_Module.H index 15e85c0..e32cafc 100644 --- a/mixer/src/Plugin_Module.H +++ b/mixer/src/Plugin_Module.H @@ -91,6 +91,7 @@ private: public: static void spawn_discover_thread ( void ); + static void join_discover_thread ( void ); Plugin_Module ( ); virtual ~Plugin_Module(); diff --git a/mixer/src/Project.C b/mixer/src/Project.C index 195c90d..e78e0aa 100644 --- a/mixer/src/Project.C +++ b/mixer/src/Project.C @@ -174,7 +174,7 @@ Project::save ( void ) int r = mixer->save(); - Loggable::clear_dirty(); +// Loggable::clear_dirty(); return r; // return Loggable::save_unjournaled_state(); @@ -282,7 +282,7 @@ Project::open ( const char *name ) // timeline->zoom_fit(); - Loggable::clear_dirty(); +// Loggable::clear_dirty(); MESSAGE( "Loaded project \"%s\"", name ); @@ -309,7 +309,10 @@ Project::create ( const char *name, const char *template_name ) } if ( chdir( name ) ) + { FATAL( "WTF? Cannot change to new project directory" ); + return false; + } // mkdir( "sources", 0777 ); creat( "snapshot", 0666 ); diff --git a/mixer/src/main.C b/mixer/src/main.C index 8463042..5de2b53 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -70,6 +70,8 @@ const double NSM_CHECK_INTERVAL = 0.25f; +const char COPYRIGHT[] = "Copyright (c) 2008-2012 Jonathan Moore Liles"; + char *user_config_dir; Mixer *mixer; NSM_Client *nsm; @@ -120,7 +122,7 @@ check_sigterm ( void * ) if ( got_sigterm ) { MESSAGE( "Got SIGTERM, quitting..." ); - mixer->command_quit(); + mixer->quit(); } } @@ -128,6 +130,8 @@ int main ( int argc, char **argv ) { + printf( "%s %s %s -- %s\n", APP_TITLE, VERSION, "", COPYRIGHT ); + #ifdef HAVE_XPM fl_open_display(); Pixmap p, mask; @@ -144,6 +148,8 @@ main ( int argc, char **argv ) ensure_dirs(); signal( SIGTERM, sigterm_handler ); + signal( SIGHUP, sigterm_handler ); + signal( SIGINT, sigterm_handler ); Fl_Tooltip::color( FL_BLACK ); Fl_Tooltip::textcolor( FL_YELLOW ); @@ -174,8 +180,6 @@ main ( int argc, char **argv ) Fl::lock(); - Plugin_Module::spawn_discover_thread(); - Fl_Double_Window *main_window; { @@ -198,7 +202,7 @@ main ( int argc, char **argv ) #ifdef HAVE_XPM o->icon((char *)p); #endif - o->show( argc, argv ); + o->show( 0, 0 ); } const char *osc_port = NULL; @@ -210,6 +214,7 @@ main ( int argc, char **argv ) static struct option long_options[] = { + { "help", no_argument, 0, '?' }, { "instance", required_argument, 0, 'i' }, { "osc-port", required_argument, 0, 'p' }, { 0, 0, 0, 0 } @@ -234,12 +239,14 @@ main ( int argc, char **argv ) instance_override = true; break; case '?': - printf( "Usage: %s [--osc-port portnum]\n\n", argv[0] ); + printf( "\nUsage: %s [--instance instance_name] [--osc-port portnum] [path_to_project]\n\n", argv[0] ); exit(0); break; } } + Plugin_Module::spawn_discover_thread(); + mixer->init_osc( osc_port ); char *nsm_url = getenv( "NSM_URL" ); @@ -264,6 +271,9 @@ main ( int argc, char **argv ) { if ( optind < argc ) { + MESSAGE( "Waiting for plugins..." ); + Plugin_Module::join_discover_thread(); + MESSAGE( "Loading \"%s\"", argv[optind] ); if ( ! mixer->command_load( argv[optind] ) ) @@ -272,7 +282,7 @@ main ( int argc, char **argv ) } } } - + Fl::add_check( check_sigterm ); Fl::run(); diff --git a/nonlib/Loggable.C b/nonlib/Loggable.C index 2fc8b6d..89e8d79 100644 --- a/nonlib/Loggable.C +++ b/nonlib/Loggable.C @@ -59,6 +59,9 @@ void *Loggable::_progress_callback_arg = NULL; snapshot_func *Loggable::_snapshot_callback = NULL; void *Loggable::_snapshot_callback_arg = NULL; +dirty_func *Loggable::_dirty_callback = NULL; +void *Loggable::_dirty_callback_arg = NULL; + Loggable::~Loggable ( ) @@ -213,6 +216,8 @@ Loggable::replay ( FILE *fp ) if ( _progress_callback ) _progress_callback( 0, _progress_callback_arg ); + clear_dirty(); + return true; } @@ -511,6 +516,8 @@ Loggable::snapshot ( FILE *fp ) _fp = ofp; + clear_dirty(); + return true; } @@ -712,7 +719,7 @@ Loggable::log_end ( void ) log_print( _old_state, new_state ); - ++_dirty; + set_dirty(); } delete new_state; @@ -730,7 +737,7 @@ Loggable::log_end ( void ) void Loggable::log_create ( void ) const { - ++_dirty; + set_dirty(); if ( ! _fp ) /* replaying, don't bother */ @@ -782,7 +789,7 @@ Loggable::log_destroy ( void ) const /* the unjournaled state may have changed: make a note of it. */ record_unjournaled(); - ++_dirty; + set_dirty(); if ( ! _fp ) /* tearing down... don't bother */ diff --git a/nonlib/Loggable.H b/nonlib/Loggable.H index 65b9357..84aa242 100644 --- a/nonlib/Loggable.H +++ b/nonlib/Loggable.H @@ -35,6 +35,7 @@ typedef void (progress_func)( int, void * ); typedef void (snapshot_func)( void * ); +typedef void (dirty_func)( int, void * ); class Log_Entry; class Loggable; @@ -87,6 +88,9 @@ class Loggable static snapshot_func *_snapshot_callback; static void *_snapshot_callback_arg; + static dirty_func *_dirty_callback; + static void *_dirty_callback_arg; + private: static unsigned int _relative_id; @@ -132,6 +136,10 @@ private: static bool replay ( FILE *fp ); + static void signal_dirty ( int v ) { if ( _dirty_callback ) _dirty_callback( v, _dirty_callback_arg ); } + static void set_dirty ( void ) { signal_dirty( ++_dirty ); } + static void clear_dirty ( void ) { signal_dirty( _dirty = 0 ); } + public: static bool replay ( const char *name ); @@ -141,6 +149,8 @@ public: static void snapshot_callback ( snapshot_func *p, void *arg ) { _snapshot_callback = p; _snapshot_callback_arg = arg; } static void progress_callback ( progress_func *p, void *arg ) { _progress_callback = p; _progress_callback_arg = arg;} + static void dirty_callback ( dirty_func *p, void *arg ) { _dirty_callback = p; _dirty_callback_arg = arg;} + static const char *escape ( const char *s ); unsigned int id ( void ) const { return _id; } @@ -192,7 +202,6 @@ public: static bool do_this ( const char *s, bool reverse ); static int dirty ( void ) { return _dirty; } - static void clear_dirty ( void ) { _dirty = 0; } void log_create ( void ) const; diff --git a/nonlib/Makefile b/nonlib/Makefile deleted file mode 100644 index 5964116..0000000 --- a/nonlib/Makefile +++ /dev/null @@ -1,115 +0,0 @@ - -############################################################################### -# Copyright (C) 2008 Jonathan Moore Liles # -# # -# 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 program; see the file COPYING. If not,write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -############################################################################### - -## Makefile for the Non-DAW. - -## -## Do not edit this file; run `make config` instead. -## - -VERSION := 1.0.0 -PACKAGE := NONLIB - -all: .config - -.config: configure - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - -config: - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - --include .config - -export SYSTEM_PATH:=$(prefix)/share/ -export DOCUMENT_PATH:=$(prefix)/share/doc/ -export PIXMAP_PATH:=$(prefix)/share/pixmaps/ - -# a bit of a hack to make sure this runs before any rules -ifneq ($(CALCULATING),yes) -TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) -endif - -ifeq ($(USE_DEBUG),yes) - CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 - CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions -else - CFLAGS := -pipe -O2 -DNDEBUG - CXXFLAGS := -fno-rtti -fno-exceptions -endif - - -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ - -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ - -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ - -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" - -CXXFLAGS := $(CFLAGS) $(CXXFLAGS) - -INCLUDES := -I. -Iutil -IFL -Inonlib - -include scripts/colors - -ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)NONLIB [$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(YELLOW)$<$(SGR0)" -else - COMPILING="Compiling: $<" -endif - -.C.o: - @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.C : %.fl - @ cd `dirname $<` && fluid -c ../$< - -DONE := $(BOLD)$(GREEN)done$(SGR0) - -include makefile.inc - -SRCS:=$(nonlib_SRCS) -OBJS:=$(nonlib_OBJS) -CXXFLAGS += $(nonlib_CFLAGS) - -# FIXME: isn't there a better way? -$(OBJS): .config Makefile - -TAGS: $(SRCS) - etags $(SRCS) - -.deps: .config $(SRCS) -ifneq ($(CALCULATING),yes) - @ echo -n Calculating dependencies... - @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) - @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) -endif - -clean_deps: - @ rm -f .deps - -.PHONEY: clean config depend clean_deps - -install: - @ echo ... - -clean: nonlib_clean - --include .deps diff --git a/nonlib/Makefile b/nonlib/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/nonlib/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/nonlib/file.C b/nonlib/file.C index f4abbd0..42fb8ea 100644 --- a/nonlib/file.C +++ b/nonlib/file.C @@ -24,6 +24,7 @@ #include #include #include +#include unsigned long modification_time ( const char *file ) @@ -182,25 +183,25 @@ read_line ( const char *dir, const char *name, char **value ) #include /** return the number of blocks free on filesystem containing file named /file/ */ -unsigned long +fsblkcnt_t free_space ( const char *file ) { - struct statvfs st; + struct statfs st; memset( &st, 0, sizeof( st ) ); - statvfs( file, &st ); + statfs( file, &st ); - return st.f_bfree; + return st.f_bavail; } /** return the total number of blocks on filesystem containing file named /file/ */ -unsigned long +fsblkcnt_t total_space ( const char *file ) { - struct statvfs st; + struct statfs st; memset( &st, 0, sizeof( st ) ); - statvfs( file, &st ); + statfs( file, &st ); return st.f_blocks; } @@ -209,7 +210,10 @@ total_space ( const char *file ) int percent_used ( const char *file ) { - const size_t ts = total_space( file ); + const double ts = total_space( file ); + const double fs = free_space( file ); - return 100 - ( ts ? free_space( file ) * 100 / ts : 0 ); + double percent_free = ( ( fs / ts ) * 100.0f ); + + return (int) (100.0f - percent_free); } diff --git a/nonlib/makefile.inc b/nonlib/makefile.inc index 2a31592..f8c47cd 100644 --- a/nonlib/makefile.inc +++ b/nonlib/makefile.inc @@ -1,19 +1,25 @@ # -*- mode: makefile; -*- -nonlib_SRCS := $(wildcard nonlib/*.C nonlib/JACK/*.C nonlib/LASH/*.C nonlib/OSC/*.C nonlib/NSM/*.C) +VERSION := 1.1.0 +PACKAGE := NONLIB -nonlib_SRCS:=$(sort $(nonlib_SRCS)) -nonlib_OBJS:=$(nonlib_SRCS:.C=.o) +SRCS := $(wildcard nonlib/*.C nonlib/JACK/*.C nonlib/LASH/*.C nonlib/OSC/*.C nonlib/NSM/*.C) -nonlib_CFLAGS := $(SIGCPP_CFLAGS) $(LIBLO_CFLAGS) $(JACK_CFLAGS) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) + +CFLAGS := $(SIGCPP_CFLAGS) $(LIBLO_CFLAGS) $(JACK_CFLAGS) all: nonlib/libnonlib.a -nonlib/libnonlib.a: $(nonlib_OBJS) - @ ar rcs $@ $(nonlib_OBJS) +nonlib/libnonlib.a: $(OBJS) + @ ar rcs $@ $(OBJS) .PHONEY: nonlib nonlib: nonlib/libnonlib.a -nonlib_clean: - rm -f $(nonlib_OBJS) nonlib/libnonlib.a +clean: + rm -f $(OBJS) nonlib/libnonlib.a + +install: + @ \ No newline at end of file diff --git a/scripts/Makefile b/scripts/Makefile new file mode 100644 index 0000000..7257183 --- /dev/null +++ b/scripts/Makefile @@ -0,0 +1,119 @@ + +############################################################################### +# Copyright (C) 2008 Jonathan Moore Liles # +# # +# 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 program; see the file COPYING. If not,write to the Free Software # +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # +############################################################################### + +## Makefile for the Non-DAW. + +## +## Do not edit this file; run `make config` instead. +## + + +all: .config + +.config: configure + @ echo '<<< Configuring '$(PACKAGE) + @ ./configure + +config: + @ echo '<<< Configuring '$(PACKAGE) + @ ./configure + +-include .config + +export SYSTEM_PATH:=$(prefix)/share/ +export DOCUMENT_PATH:=$(prefix)/share/doc/ +export PIXMAP_PATH:=$(prefix)/share/pixmaps/ +export ICON_PATH:=$(prefix)/share/icons/ +export DESKTOP_PATH:=$(prefix)/share/applications/ + +# a bit of a hack to make sure this runs before any rules +ifneq ($(CALCULATING),yes) +TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) +endif + +ifeq ($(USE_DEBUG),yes) + CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 + CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions +else + CFLAGS := -pipe -O2 -DNDEBUG + CXXFLAGS := -fno-rtti -fno-exceptions +endif + +# include FL/makefile.inc +include makefile.inc + +CFLAGS+=-DVERSION=\"$(VERSION)\" \ + -DINSTALL_PREFIX=\"$(prefix)\" \ + -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ + -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ + -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" + +CXXFLAGS := $(CFLAGS) $(CXXFLAGS) + +INCLUDES := -I. -Iutil -IFL -Inonlib + +include scripts/colors + +SPACE+=" `tput cuf 20`" + +ifneq ($(CALCULATING),yes) + COMPILING="$(BOLD)$(BLACK)$(PACKAGE)$(SPACE)$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(CYAN)$<$(SGR0)" +else + COMPILING="Compiling: $<" +endif + +.C.o: + @ echo $(COMPILING) + @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ + +%.C : %.fl + @ cd `dirname $<` && fluid -c ../$< + +DONE := $(BOLD)$(GREEN)done$(SGR0) + + +# SRCS:=$(Timeline_SRCS) +# OBJS:=$(Timeline_OBJS) +# CXXFLAGS += $(Timeline_CFLAGS) + +# FIXME: isn't there a better way? +$(OBJS): .config Makefile + +TAGS: $(SRCS) + etags $(SRCS) + +.deps: .config $(SRCS) +ifneq ($(CALCULATING),yes) + @ echo -n Calculating dependencies... + @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) + @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) +endif + +clean_deps: + @ rm -f .deps + +.PHONEY: clean config depend clean_deps + +dist: + git archive --prefix=${BIN_NAME}-$(VERSION)/ v$(VERSION) | bzip2 > ${BIN_NAME}-$(VERSION).tar.bz2 + +scan-gpl: + @ scripts/scan-gpl $(SRCS) || echo $(BOLD)$(RED)Some source files do not contain proper license information! + +-include .deps diff --git a/scripts/config-funcs b/scripts/config-funcs index be1f400..7180243 100644 --- a/scripts/config-funcs +++ b/scripts/config-funcs @@ -344,6 +344,11 @@ version_of () echo `pkg-config --modversion $1` } +hostname_resolvable () +{ + ping -c1 `hostname` >/dev/null 2>/dev/null +} + require_FLTK () { local use diff --git a/session-manager/Makefile b/session-manager/Makefile deleted file mode 100644 index 16db9d4..0000000 --- a/session-manager/Makefile +++ /dev/null @@ -1,145 +0,0 @@ - -############################################################################### -# Copyright (C) 2008 Jonathan Moore Liles # -# # -# 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 program; see the file COPYING. If not,write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -############################################################################### - -## Makefile for the Non-DAW. - -## -## Do not edit this file; run `make config` instead. -## - -VERSION := 1.0.0 -PACKAGE := SESSION_MANAGER - -all: .config - -.config: configure - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - -config: - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - --include .config - -export SYSTEM_PATH:=$(prefix)/share/ -export DOCUMENT_PATH:=$(prefix)/share/doc/ -export PIXMAP_PATH:=$(prefix)/share/pixmaps/ -export ICON_PATH:=$(prefix)/share/icons/ -export DESKTOP_PATH:=$(prefix)/share/applications/ - -# a bit of a hack to make sure this runs before any rules -ifneq ($(CALCULATING),yes) -TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) -endif - -ifeq ($(USE_DEBUG),yes) - CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 - CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions -else - CFLAGS := -pipe -O2 -DNDEBUG - CXXFLAGS := -fno-rtti -fno-exceptions -endif - - -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ - -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ - -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ - -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" - -CXXFLAGS := $(CFLAGS) $(CXXFLAGS) - -INCLUDES := -I. -Iutil -IFL -Inonlib - -include scripts/colors - -ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)${PACKAGE} [$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(YELLOW)$<$(SGR0)" -else - COMPILING="Compiling: $<" -endif - -.C.o: - @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.C : %.fl - @ cd `dirname $<` && fluid -c ../$< - -DONE := $(BOLD)$(GREEN)done$(SGR0) - -include FL/makefile.inc -#include nonlib/makefile.inc -include makefile.inc - -SRCS:=$(Session_SRCS) -OBJS:=$(Session_OBJS) -CXXFLAGS += $(Session_CFLAGS) - -# FIXME: isn't there a better way? -$(OBJS): .config Makefile - -TAGS: $(SRCS) - etags $(SRCS) - -.deps: .config $(SRCS) -ifneq ($(CALCULATING),yes) - @ echo -n Calculating dependencies... - @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) - @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) -endif - - -install: all - @ echo -n "Installing..." - @ install src/nsmd "$(DESTDIR)$(prefix)"/bin/nsmd - @ install src/session-manager "$(DESTDIR)$(prefix)"/bin/non-session-manager - @ install src/jackpatch "$(DESTDIR)$(prefix)"/bin/jackpatch - @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-session-manager - @ $(MAKE) -s -C doc install - @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-session-manager" - @ install -m 644 icons/hicolor/256x256/apps/non-session-manager.png "$(DESTDIR)$(PIXMAP_PATH)"/non-session-manager/icon-256x256.png - @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" - @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" - @ install -d "$(DESTDIR)$(DESKTOP_PATH)" - @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-session-manager.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-session-manager.desktop" - @ echo "$(DONE)" -ifneq ($(USE_DEBUG),yes) - @ echo -n "Stripping..." - @ strip "$(DESTDIR)$(prefix)"/bin/jackpatch - @ strip "$(DESTDIR)$(prefix)"/bin/nsmd - @ strip "$(DESTDIR)$(prefix)"/bin/non-session-manager - @ echo "$(DONE)" -endif - -clean_deps: - @ rm -f .deps - -.PHONEY: clean config depend clean_deps - -clean: Session_clean - -dist: - git archive --prefix=non-session-$(VERSION)/ v$(VERSION) | bzip2 > non-session-$(VERSION).tar.bz2 - -scan-gpl: - @ scripts/scan-gpl $(SRCS) || echo $(BOLD)$(RED)Some source files do not contain proper license information! - --include .deps diff --git a/session-manager/Makefile b/session-manager/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/session-manager/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/session-manager/configure b/session-manager/configure index b2ff068..38766a4 100755 --- a/session-manager/configure +++ b/session-manager/configure @@ -26,3 +26,16 @@ suggest_package XPM 2.0.0 xpm test_version `version_of liblo` 0.26 || warn "Version $(version_of liblo) of liblo is slow to create servers. Consider upgrading to 0.26 or later" end + +if ! hostname_resolvable +then + echo "Your hostname \"$(hostname)\" does not resolve to a valid address." + echo "This is a broken configuration and will cause liblo (the" + echo "OSC library) to fail to function. Add the line:" + echo + echo "127.0.0.1 $(hostname)" + echo + echo "to your /etc/hosts file to fix. And consider switching to a saner distribution." + echo + fail "Invalid hostname!" +fi diff --git a/session-manager/makefile.inc b/session-manager/makefile.inc index 33926a0..a521781 100644 --- a/session-manager/makefile.inc +++ b/session-manager/makefile.inc @@ -1,32 +1,60 @@ # -*- mode: makefile; -*- +VERSION := 1.0.0 +PACKAGE := SESSION_MANAGER +BIN_NAME := non-session-manager + all: Session -Session_SRCS := $(wildcard src/*.C src/*.fl) -# Session_SRCS += util/debug.C util/Thread.C util/file.C +SRCS := $(wildcard src/*.C src/*.fl) +# SRCS += util/debug.C util/Thread.C util/file.C -Session_SRCS:=$(Session_SRCS:.fl=.C) -Session_SRCS:=$(sort $(Session_SRCS)) -Session_OBJS:=$(Session_SRCS:.C=.o) +SRCS:=$(SRCS:.fl=.C) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) -Session_LIBS := $(LIBLO_LIBS) $(SIGCPP_LIBS) -Session_CFLAGS := $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) $(FLTK_CLFAGS) +LIBS := $(LIBLO_LIBS) $(SIGCPP_LIBS) +CFLAGS := $(LIBLO_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) $(FLTK_CFLAGS) src/nsmd: src/nsmd.o nonlib/libnonlib.a @ echo -n Linking session handler. - @ $(CXX) $(CXXFLAGS) $(Session_LIBS) src/nsmd.o -o $@ -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $(LIBS) src/nsmd.o -o $@ -Lnonlib -lnonlib && echo $(DONE) src/session-manager: src/session-manager.o nonlib/libnonlib.a @ echo -n Linking session handler. - @ $(CXX) $(CXXFLAGS) $(FLTK_LIBS) $(XPM_LIBS) $(Session_LIBS) src/session-manager.o -o $@ -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $(FLTK_LIBS) $(XPM_LIBS) $(LIBS) src/session-manager.o -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) src/send_osc: src/send_osc.o nonlib/libnonlib.a - @ $(CXX) $(CXXFLAGS) $(Session_LIBS) src/send_osc.o -o $@ -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $(LIBS) src/send_osc.o -o $@ -Lnonlib -lnonlib && echo $(DONE) src/jackpatch: src/jackpatch.o @ $(CXX) $(CXXFLAGS) $(JACK_LIBS) $(LIBLO_LIBS) src/jackpatch.o -o $@ && echo $(DONE) Session: src/send_osc src/nsmd src/session-manager src/jackpatch -Session_clean: - rm -f $(Session_OBJS) src/nsmd src/session-manager src/jackpatch +clean: + rm -f $(OBJS) src/nsmd src/session-manager src/jackpatch + + + +install: all + @ echo -n "Installing..." + @ install src/nsmd "$(DESTDIR)$(prefix)"/bin/nsmd + @ install src/session-manager "$(DESTDIR)$(prefix)"/bin/non-session-manager + @ install src/jackpatch "$(DESTDIR)$(prefix)"/bin/jackpatch + @ mkdir -p "$(DESTDIR)$(SYSTEM_PATH)"/non-session-manager + @ $(MAKE) -s -C doc install + @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-session-manager" + @ install -m 644 icons/hicolor/256x256/apps/non-session-manager.png "$(DESTDIR)$(PIXMAP_PATH)"/non-session-manager/icon-256x256.png + @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" + @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" + @ install -d "$(DESTDIR)$(DESKTOP_PATH)" + @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-session-manager.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-session-manager.desktop" + @ echo "$(DONE)" +ifneq ($(USE_DEBUG),yes) + @ echo -n "Stripping..." + @ strip "$(DESTDIR)$(prefix)"/bin/jackpatch + @ strip "$(DESTDIR)$(prefix)"/bin/nsmd + @ strip "$(DESTDIR)$(prefix)"/bin/non-session-manager + @ echo "$(DONE)" +endif diff --git a/session-manager/src/jackpatch.c b/session-manager/src/jackpatch.c index 0dabeab..657b082 100644 --- a/session-manager/src/jackpatch.c +++ b/session-manager/src/jackpatch.c @@ -448,7 +448,7 @@ die ( void ) void set_traps ( void ) { -// signal( SIGHUP, signal_handler ); + signal( SIGHUP, signal_handler ); signal( SIGINT, signal_handler ); // signal( SIGQUIT, signal_handler ); // signal( SIGSEGV, signal_handler ); diff --git a/session-manager/src/nsmd.C b/session-manager/src/nsmd.C index 520db63..5181d56 100644 --- a/session-manager/src/nsmd.C +++ b/session-manager/src/nsmd.C @@ -1607,6 +1607,9 @@ OSC_HANDLER( is_dirty ) MESSAGE( "Client sends dirty" ); Client *c = get_client_by_address( lo_message_get_source( msg ) ); + + if ( ! c ) + return 0; c->dirty = 1; @@ -1622,6 +1625,9 @@ OSC_HANDLER( is_clean ) Client *c = get_client_by_address( lo_message_get_source( msg ) ); + if ( ! c ) + return 0; + c->dirty = 0; if ( gui_is_active ) @@ -1635,6 +1641,9 @@ OSC_HANDLER( message ) { Client *c = get_client_by_address( lo_message_get_source( msg ) ); + if ( ! c ) + return 0; + if ( gui_is_active ) osc_server->send( gui_addr, "/nsm/gui/client/message", c->client_id, argv[0]->i, &argv[1]->s ); @@ -1650,6 +1659,12 @@ OSC_HANDLER( error ) { Client *c = get_client_by_address( lo_message_get_source( msg ) ); + if ( ! c ) + { + WARNING( "Error from unknown client" ); + return 0; + } + // const char *rpath = &argv[0]->s; int err_code = argv[1]->i; diff --git a/session-manager/src/session-manager.C b/session-manager/src/session-manager.C index 775e616..d200e28 100644 --- a/session-manager/src/session-manager.C +++ b/session-manager/src/session-manager.C @@ -47,6 +47,9 @@ #define APP_NAME "Non Session Manager" +#include "FL/Crystal_Boxtypes.H" +#include "FL/Gleam_Boxtypes.H" +#include "FL/color_scheme.H" #ifdef HAVE_XPM #include "FL/Fl.H" @@ -127,7 +130,7 @@ public: { _remove_button->show(); _restart_button->show(); - color( FL_RED ); + color( fl_darker( FL_RED ) ); redraw(); } else @@ -153,14 +156,14 @@ public: if ( ! strcmp( command, "ready" ) ) { - color( FL_GREEN ); + color( fl_darker( FL_GREEN ) ); // _progress->value( 0.0f ); } else if ( ! strcmp( command, "quit" ) || ! strcmp( command, "kill" ) || ! strcmp( command, "error" ) ) { - color( FL_RED ); + color( fl_darker( FL_RED ) ); } else if ( ! strcmp( command, "stopped" ) ) { @@ -168,7 +171,7 @@ public: } else { - color( FL_YELLOW ); + color( fl_darker( FL_YELLOW ) ); } redraw(); @@ -222,7 +225,7 @@ public: _client_id = NULL; align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); - color( FL_RED ); + color( fl_darker( FL_RED ) ); box( FL_UP_BOX ); { Fl_Progress *o = _progress = new Fl_Progress( ( X + W ) - ( W / 4) - 20, Y + 5, ( W / 4 ), H - 10, NULL ); @@ -355,6 +358,9 @@ public: /* strip out formatting codes */ + if ( !name ) + return; + foreach_daemon ( d ) { osc->send( (*d)->addr, "/nsm/server/open", index( name, ' ' ) + 1 ); @@ -659,6 +665,7 @@ public: { Fl_Pack *o = clients_pack = new Fl_Pack( X + ( W / 3 ), Y + 50, ( W / 3 ) * 2, H - 50 ); o->align( FL_ALIGN_TOP ); + o->spacing( 2 ); o->type( Fl_Pack::VERTICAL ); o->end(); } @@ -937,7 +944,12 @@ main (int argc, char **argv ) (char**)icon_16x16, &p, &mask, NULL); #endif + init_crystal_boxtypes(); + init_gleam_boxtypes(); + Fl::get_system_colors(); + + color_scheme( "Dark" ); Fl::scheme( "plastic" ); Fl::lock(); diff --git a/timeline/Makefile b/timeline/Makefile deleted file mode 100644 index 8295969..0000000 --- a/timeline/Makefile +++ /dev/null @@ -1,154 +0,0 @@ - -############################################################################### -# Copyright (C) 2008 Jonathan Moore Liles # -# # -# 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 program; see the file COPYING. If not,write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -############################################################################### - -## Makefile for the Non-DAW. - -## -## Do not edit this file; run `make config` instead. -## - -VERSION := 1.1.0 -PACKAGE := TIMELINE - -all: .config - -.config: configure - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - -config: - @ echo '<<< Configuring '$(PACKAGE) - @ ./configure - --include .config - -export SYSTEM_PATH:=$(prefix)/share/ -export DOCUMENT_PATH:=$(prefix)/share/doc/ -export PIXMAP_PATH:=$(prefix)/share/pixmaps/ -export ICON_PATH:=$(prefix)/share/icons/ -export DESKTOP_PATH:=$(prefix)/share/applications/ - -# a bit of a hack to make sure this runs before any rules -ifneq ($(CALCULATING),yes) -TOTAL := $(shell $(MAKE) CALCULATING=yes -n 2>/dev/null | sed -n 's/^.*Compiling: \([^"]\+\)"/\1/p' > .files ) -endif - -ifeq ($(USE_DEBUG),yes) - CFLAGS := -pipe -ggdb -fno-inline -Wall -Wextra -O0 - CXXFLAGS := -Wnon-virtual-dtor -Wno-missing-field-initializers -fno-rtti -fno-exceptions -else - CFLAGS := -pipe -O2 -DNDEBUG - CXXFLAGS := -fno-rtti -fno-exceptions -endif - - -ifeq ($(USE_UNOPTIMIZED_DRAWING),yes) - CFLAGS+=-DUSE_UNOPTIMIZED_DRAWING -endif - -ifeq ($(USE_SINGLEBUFFERED_TIMELINE),yes) - CFLAGS+=-DUSE_SINGLEBUFFERED_TIMELINE -endif - -ifeq ($(USE_WIDGET_FOR_TIMELINE),yes) - CFLAGS+=-DUSE_WIDGET_FOR_TIMELINE -endif - -CFLAGS+=-DVERSION=\"$(VERSION)\" \ - -DINSTALL_PREFIX=\"$(prefix)\" \ - -DSYSTEM_PATH=\"$(SYSTEM_PATH)\" \ - -DDOCUMENT_PATH=\"$(DOCUMENT_PATH)\" \ - -DPIXMAP_PATH=\"$(PIXMAP_PATH)\" - -CXXFLAGS := $(CFLAGS) $(CXXFLAGS) - -INCLUDES := -I. -Iutil -IFL -Inonlib - -include scripts/colors - -ifneq ($(CALCULATING),yes) - COMPILING="$(BOLD)$(BLACK)$(PACKAGE) [$(SGR0)$(CYAN)`scripts/percent-complete .files "$<"`$(SGR0)$(BOLD)$(BLACK)]$(SGR0) $(BOLD)$(YELLOW)$<$(SGR0)" -else - COMPILING="Compiling: $<" -endif - -.C.o: - @ echo $(COMPILING) - @ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.C : %.fl - @ cd `dirname $<` && fluid -c ../$< - -DONE := $(BOLD)$(GREEN)done$(SGR0) - -include FL/makefile.inc -# include nonlib/makefile.inc -include makefile.inc - -SRCS:=$(Timeline_SRCS) -OBJS:=$(Timeline_OBJS) -CXXFLAGS += $(Timeline_CFLAGS) - -# FIXME: isn't there a better way? -$(OBJS): .config Makefile - -TAGS: $(SRCS) - etags $(SRCS) - -.deps: .config $(SRCS) -ifneq ($(CALCULATING),yes) - @ echo -n Calculating dependencies... - @ makedepend -f- -- $(CXXFLAGS) $(INCLUDES) -- $(SRCS) 2>/dev/null > .deps && echo $(DONE) - @ # gcc -M $(CXXFLAGS) $(INCLUDES) $(SRCS) > .deps && echo $(DONE) -endif - - -install: all - @ echo -n "Installing..." - @ install src/timeline $(prefix)/bin/non-daw - @ mkdir -p $(SYSTEM_PATH)/non-daw - @ mkdir -p $(PIXMAP_PATH)/non-daw - @ $(MAKE) -s -C doc install - @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-daw" - @ install -m 644 icons/hicolor/256x256/apps/non-daw.png "$(DESTDIR)$(PIXMAP_PATH)"/non-daw/icon-256x256.png - @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" - @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" - @ install -d "$(DESTDIR)$(DESKTOP_PATH)" - @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-daw.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-daw.desktop" - @ echo "$(DONE)" -ifneq ($(USE_DEBUG),yes) - @ echo -n "Stripping..." - @ strip $(prefix)/bin/non-daw - @ echo "$(DONE)" -endif - -clean_deps: - @ rm -f .deps - -.PHONEY: clean config depend clean_deps - -clean: FL_clean Timeline_clean - -dist: - git archive --prefix=non-daw-$(VERSION)/ v$(VERSION) | bzip2 > non-daw-$(VERSION).tar.bz2 - -scan-gpl: - @ scripts/scan-gpl $(SRCS) || echo $(BOLD)$(RED)Some source files do not contain proper license information! - --include .deps diff --git a/timeline/Makefile b/timeline/Makefile new file mode 120000 index 0000000..c259b75 --- /dev/null +++ b/timeline/Makefile @@ -0,0 +1 @@ +scripts/Makefile \ No newline at end of file diff --git a/timeline/configure b/timeline/configure index 1202937..6822b72 100755 --- a/timeline/configure +++ b/timeline/configure @@ -31,6 +31,19 @@ require_package liblo 0.23 liblo require_package sigcpp 2.0.0 sigc++-2.0 suggest_package XPM 2.0.0 xpm +if ! hostname_resolvable +then + echo "Your hostname \"$(hostname)\" does not resolve to a valid address." + echo "This is a broken configuration and will cause liblo (the" + echo "OSC library) to fail to function. Add the line:" + echo + echo "127.0.0.1 $(hostname)" + echo + echo "to your /etc/hosts file to fix. And consider switching to a saner distribution." + echo + fail "Invalid hostname!" +fi + if ! test_version 1.1.10 $FLTK_VERSION then warn "*** PERFORMANCE WARNING ***" diff --git a/timeline/makefile.inc b/timeline/makefile.inc index b5e24ea..7073a96 100644 --- a/timeline/makefile.inc +++ b/timeline/makefile.inc @@ -1,24 +1,57 @@ # -*- mode: makefile; -*- +VERSION := 1.1.0 +PACKAGE := TIMELINE +BIN_NAME := non-daw + all: Timeline -Timeline_VERSION := 0.5.0 +SRCS := $(wildcard src/*.C src/*.fl src/Engine/*.C) -Timeline_SRCS := $(wildcard src/*.C src/*.fl src/Engine/*.C) +SRCS:=$(SRCS:.fl=.C) +SRCS:=$(sort $(SRCS)) +OBJS:=$(SRCS:.C=.o) -Timeline_SRCS:=$(Timeline_SRCS:.fl=.C) -Timeline_SRCS:=$(sort $(Timeline_SRCS)) -Timeline_OBJS:=$(Timeline_SRCS:.C=.o) +LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(SNDFILE_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) -Timeline_LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(SNDFILE_LIBS) $(LIBLO_LIBS) $(SIGCPP_LIBS) $(XPM_LIBS) +CFLAGS := $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) -Timeline_CFLAGS := $(SNDFILE_CFLAGS) $(FLTK_CFLAGS) $(JACK_CFLAGS) $(SIGCPP_CFLAGS) $(XPM_CFLAGS) +ifeq ($(USE_UNOPTIMIZED_DRAWING),yes) + CFLAGS+=-DUSE_UNOPTIMIZED_DRAWING +endif -src/timeline: $(Timeline_OBJS) FL/libfl_widgets.a nonlib/libnonlib.a +ifeq ($(USE_SINGLEBUFFERED_TIMELINE),yes) + CFLAGS+=-DUSE_SINGLEBUFFERED_TIMELINE +endif + +ifeq ($(USE_WIDGET_FOR_TIMELINE),yes) + CFLAGS+=-DUSE_WIDGET_FOR_TIMELINE +endif + +src/timeline: $(OBJS) FL/libfl_widgets.a nonlib/libnonlib.a @ echo -n Linking timeline... - @ $(CXX) $(CXXFLAGS) $(INCLUDES) $(Timeline_LIBS) $(Timeline_OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) + @ $(CXX) $(CXXFLAGS) $(INCLUDES) $(LIBS) $(OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) Timeline: src/timeline -Timeline_clean: - rm -f $(Timeline_OBJS) Timeline/timeline +clean: + rm -f $(OBJS) src/timeline + +install: all + @ echo -n "Installing..." + @ install src/timeline $(prefix)/bin/non-daw + @ mkdir -p $(SYSTEM_PATH)/non-daw + @ mkdir -p $(PIXMAP_PATH)/non-daw + @ $(MAKE) -s -C doc install + @ install -d "$(DESTDIR)$(PIXMAP_PATH)/non-daw" + @ install -m 644 icons/hicolor/256x256/apps/non-daw.png "$(DESTDIR)$(PIXMAP_PATH)"/non-daw/icon-256x256.png + @ install -d "$(DESTDIR)$(ICON_PATH)/hicolor" + @ cp -au icons/hicolor/ "$(DESTDIR)$(ICON_PATH)" + @ install -d "$(DESTDIR)$(DESKTOP_PATH)" + @ sed 's:@BIN_PATH@:$(prefix)/bin:' non-daw.desktop.in > "$(DESTDIR)$(DESKTOP_PATH)/non-daw.desktop" + @ echo "$(DONE)" +ifneq ($(USE_DEBUG),yes) + @ echo -n "Stripping..." + @ strip $(prefix)/bin/non-daw + @ echo "$(DONE)" +endif diff --git a/timeline/src/Project.H b/timeline/src/Project.H index dc09573..9abe4e6 100644 --- a/timeline/src/Project.H +++ b/timeline/src/Project.H @@ -51,6 +51,7 @@ public: static const char *errstr ( int n ) { return _errstr[ ( 0 - n ) - 1 ]; } + static const char * path ( void ) { return Project::_path; } static const char *name ( void ) { return Project::_name; } static void compact ( void ); static bool close ( void ); diff --git a/timeline/src/TLE.fl b/timeline/src/TLE.fl index d5024b9..ef21f76 100644 --- a/timeline/src/TLE.fl +++ b/timeline/src/TLE.fl @@ -717,7 +717,7 @@ ab.run();} private xywh {921 41 104 14} labelsize 10 } Fl_Box {} { - label {disk:} + label {filesystem} xywh {810 27 55 18} labelsize 10 align 16 } Fl_Progress disk_usage_progress { @@ -838,7 +838,10 @@ update_progress( capture_buffer_progress, cbp, timeline->total_input_buffer_perc update_progress( playback_buffer_progress, pbp, timeline->total_output_buffer_percent() ); update_progress( cpu_load_progress, clp, engine ? engine->cpu_load() : 0 ); -update_progress( disk_usage_progress, dup, percent_used( "." ) ); +if ( Project::open() ) + update_progress( disk_usage_progress, dup, percent_used( Project::path() ) ); +else + update_progress( disk_usage_progress, dup, 0 ); if ( timeline->total_capture_xruns() ) capture_buffer_progress->selection_color( FL_RED ); diff --git a/timeline/src/main.C b/timeline/src/main.C index 1edbf81..2a4bbbe 100644 --- a/timeline/src/main.C +++ b/timeline/src/main.C @@ -73,7 +73,7 @@ char *instance_name = NULL; const char APP_NAME[] = "Non-DAW"; const char APP_TITLE[] = "The Non-DAW"; -const char COPYRIGHT[] = "Copyright (C) 2008-2010 Jonathan Moore Liles"; +const char COPYRIGHT[] = "Copyright (C) 2008-2012 Jonathan Moore Liles"; const double NSM_CHECK_INTERVAL = 0.25f; @@ -155,13 +155,14 @@ main ( int argc, char **argv ) Fl::visual(FL_RGB8); - Thread::init(); Thread thread( "UI" ); thread.set(); signal( SIGTERM, sigterm_handler ); + signal( SIGHUP, sigterm_handler ); + signal( SIGINT, sigterm_handler ); fl_register_images(); @@ -187,21 +188,16 @@ main ( int argc, char **argv ) printf( "%s %s -- %s\n", APP_TITLE, VERSION, COPYRIGHT ); - tle = new TLE; instance_name = strdup( APP_NAME ); bool instance_override = false; - /* we don't really need a pointer for this */ - // will be created on project new/open - engine = NULL; - - nsm = new NSM_Client; const char *osc_port = NULL; static struct option long_options[] = { + { "help", no_argument, 0, '?' }, { "instance", required_argument, 0, 'i' }, { "osc-port", required_argument, 0, 'p' }, { 0, 0, 0, 0 } @@ -214,23 +210,32 @@ main ( int argc, char **argv ) { switch ( c ) { + case 'p': DMESSAGE( "Using OSC port %s", optarg ); osc_port = optarg; break; case 'i': - DMESSAGE( "Using OSC port %s", optarg ); + DMESSAGE( "Using instance name %s", optarg ); free( instance_name ); instance_name = strdup( optarg ); instance_override = true; break; case '?': - printf( "Usage: %s [--osc-port portnum]\n\n", argv[0] ); + printf( "\nUsage: %s [--instance instance_name] [--osc-port portnum] [path_to_project]\n\n", argv[0] ); exit(0); break; } } + /* we don't really need a pointer for this */ + // will be created on project new/open + engine = NULL; + + tle = new TLE; + + nsm = new NSM_Client; + MESSAGE( "Starting GUI" ); tle->run();