non/main.C

137 lines
3.8 KiB
C++
Raw Normal View History

2008-02-14 06:47:12 +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_Window.H>
2008-02-16 05:23:58 +01:00
#include <FL/Fl_Double_Window.H>
2008-02-14 06:47:12 +01:00
#include <FL/Fl_Scroll.H>
// #include <FL/Fl_Scrollbar.H>
2008-02-14 08:40:47 +01:00
#include <FL/Fl_Pack.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Slider.H>
2008-02-14 06:47:12 +01:00
#include "Scalebar.H"
// #include "Waveform.H"
2008-02-14 08:40:47 +01:00
#include "Region.H"
2008-02-14 06:47:12 +01:00
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include "Track.H"
#include "Audio_Track.H"
#include "Timeline.H"
#include "Tempo_Track.H"
2008-02-21 13:57:33 +01:00
#include "Time_Track.H"
2008-02-22 21:20:44 +01:00
#include "Loggable.H"
2008-02-17 22:25:02 +01:00
#include "const.h"
2008-02-21 17:20:36 +01:00
Timeline *timeline;
void
cb_scroll ( Fl_Widget *w, void *v )
{
Scalebar *sb = (Scalebar*)w;
2008-02-20 08:24:56 +01:00
if ( sb->zoom_changed() )
{
2008-02-23 06:11:37 +01:00
// timeline->fpp = sb->zoom() * 256;
timeline->fpp = sb->zoom() * 1;
/* timeline->fpp = max( min( timeline->fpp, 4096.0f ), (float)2 ); */
2008-02-17 22:25:02 +01:00
int maxx = timeline->ts_to_x( timeline->length );
sb->range( 0, maxx );
timeline->redraw();
}
else
{
timeline->position( sb->value() );
}
2008-02-21 13:57:33 +01:00
2008-02-21 17:20:36 +01:00
/* timeline->xoffset = timeline->x_to_ts( sb->value() ); */
/* // timeline->tracks->redraw(); */
/* timeline->scroll->redraw(); */
2008-02-20 08:08:36 +01:00
2008-02-21 17:20:36 +01:00
printf( "%lu\n", timeline->xoffset );
2008-02-20 08:08:36 +01:00
/* for ( int i = timeline->tracks->children(); i-- ; ) */
/* { */
/* Fl_Group *track = (Fl_Group*)timeline->tracks->child( i ); */
/* track->damage( FL_DAMAGE_SCROLL ); */
/* } */
2008-02-20 08:24:56 +01:00
/* for ( int i = timeline->rulers->children(); i-- ; ) */
/* { */
/* Fl_Group *track = (Fl_Group*)timeline->rulers->child( i ); */
/* track->damage( FL_DAMAGE_SCROLL ); */
/* } */
2008-02-21 13:57:33 +01:00
2008-02-20 07:11:33 +01:00
/* /\* for ( int j = track->children(); j-- ; ) *\/ */
/* /\* ((Region*)(track->child( j )))->resize(); *\/ */
/* /\* } *\/ */
}
2008-02-14 06:47:12 +01:00
int
main ( int argc, char **argv )
{
Fl_Window *main_window = new Fl_Window( 0, 0, 800, 600 );
2008-02-14 06:47:12 +01:00
2008-02-21 13:57:33 +01:00
Fl::get_system_colors();
Fl::scheme( "plastic" );
2008-02-22 21:20:44 +01:00
Loggable::open( "history" );
2008-02-21 17:20:36 +01:00
timeline = new Timeline( 0, 0, 800, 600, "Timeline" );
2008-02-21 17:20:36 +01:00
// Region *wave = new Region( Clip::from_file( "streambass8.wav" ) );
2008-02-14 08:40:47 +01:00
2008-02-21 17:20:36 +01:00
/* track1->next( track2 ); */
/* track2->prev( track1 ); */
2008-02-14 06:47:12 +01:00
2008-02-21 17:20:36 +01:00
timeline->scrollbar = new Scalebar( 0, 600 - 24, 800, 24 );
timeline->scrollbar->range( 0, 48000 * 2 );
2008-02-23 06:11:37 +01:00
timeline->scrollbar->zoom_range( 2, 8192 );
2008-02-21 17:20:36 +01:00
timeline->scrollbar->type( 1 );
timeline->scrollbar->callback( cb_scroll, 0 );
2008-02-20 07:11:33 +01:00
2008-02-14 06:47:12 +01:00
main_window->end();
main_window->show();
/* wave->redraw(); */
2008-02-14 06:47:12 +01:00
Fl::run();
}