non/Mixer/main.C

143 lines
4.0 KiB
C++
Raw Normal View History

2009-12-25 01:59:39 +01:00
/*******************************************************************************/
/* 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. */
/*******************************************************************************/
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
2009-12-25 01:59:39 +01:00
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Pack.H>
#include "Mixer_Strip.H"
#include <stdlib.h>
#include <unistd.h>
#include "DPM.H"
#include "Mixer.H"
#include "util/Thread.H"
#include "util/debug.h"
#include "Project.H"
2009-12-25 01:59:39 +01:00
Mixer *mixer;
#include <FL/Boxtypes.H>
#include "Loggable.H"
#include <FL/Fl_Tooltip.H>
#include <FL/fl_ask.H>
/* for registration */
#include "Module.H"
#include "Gain_Module.H"
#include "Plugin_Module.H"
#include "JACK_Module.H"
#include "Meter_Module.H"
#include "Meter_Indicator_Module.H"
#include "Controller_Module.H"
2010-01-18 04:16:31 +01:00
#include "Mono_Pan_Module.H"
#include "Chain.H"
#include <signal.h>
2010-01-12 06:31:02 +01:00
static void cb_main ( Fl_Widget *w, void *v )
{
}
2009-12-25 01:59:39 +01:00
int
main ( int argc, char **argv )
{
Thread::init();
Thread thread( "UI" );
thread.set();
Fl_Tooltip::color( FL_BLACK );
Fl_Tooltip::textcolor( FL_YELLOW );
Fl_Tooltip::size( 14 );
Fl_Tooltip::hoverdelay( 0.1f );
// Fl::visible_focus( 0 );
2009-12-25 01:59:39 +01:00
LOG_REGISTER_CREATE( Mixer_Strip );
LOG_REGISTER_CREATE( Chain );
LOG_REGISTER_CREATE( Plugin_Module );
LOG_REGISTER_CREATE( Gain_Module );
LOG_REGISTER_CREATE( Meter_Module );
LOG_REGISTER_CREATE( JACK_Module );
2010-01-18 04:16:31 +01:00
LOG_REGISTER_CREATE( Mono_Pan_Module );
LOG_REGISTER_CREATE( Meter_Indicator_Module );
LOG_REGISTER_CREATE( Controller_Module );
2009-12-25 01:59:39 +01:00
init_boxtypes();
signal( SIGPIPE, SIG_IGN );
2009-12-25 01:59:39 +01:00
Fl::get_system_colors();
Fl::scheme( "plastic" );
// Fl::scheme( "gtk+" );
/* Fl::foreground( 0xFF, 0xFF, 0xFF ); */
/* Fl::background( 0x10, 0x10, 0x10 ); */
Plugin_Module::spawn_discover_thread();
Fl_Double_Window *main_window;
2009-12-25 01:59:39 +01:00
{
Fl_Double_Window *o = main_window = new Fl_Double_Window( 1024, 768, "Mixer" );
2010-01-12 06:31:02 +01:00
{
Fl_Widget *o = mixer = new Mixer( 0, 0, main_window->w(), main_window->h(), NULL );
Fl_Group::current()->resizable(o);
}
o->end();
2009-12-25 01:59:39 +01:00
2010-01-12 06:31:02 +01:00
o->callback( cb_main, main_window );
o->show( argc, argv );
}
2009-12-25 01:59:39 +01:00
{
if ( argc > 1 )
{
/* char name[1024]; */
2009-12-25 01:59:39 +01:00
/* snprintf( name, sizeof( name ), "%s/history", argv[1] ); */
2009-12-25 01:59:39 +01:00
/* Loggable::open( name ); */
MESSAGE( "Loading \"%s\"", argv[1] );
if ( int err = Project::open( argv[1] ) )
2010-01-12 06:31:02 +01:00
{
fl_alert( "Error opening project specified on commandline: %s", Project::errstr( err ) );
}
2009-12-25 01:59:39 +01:00
}
else
{
WARNING( "Running without a project--nothing will be saved." );
}
}
Fl::run();
delete main_window;
main_window = NULL;
2009-12-25 01:59:39 +01:00
MESSAGE( "Your fun is over" );
}