Add nifty mouseover region time display.

pull/3/head
Jonathan Moore Liles 2008-03-05 21:24:31 -06:00
parent e70ff0b101
commit ec2dc52307
5 changed files with 31 additions and 5 deletions

View File

@ -29,6 +29,14 @@ test: $(OBJS)
mixer: Mixer_Strip.o Mixer.o
$(CXX) $(CXXFLAGS) $(LIBS) Mixer_Strip.o Mixer.o -o $@
ESRCS=Audio_File.C Audio_File_SF.C Loggable.C
EOBJS=$(ESRCS:.C=.o)
engine: $(EOBJS)
$(CXX) $(CXXFLAGS) $(LIBS) $(EOBJS) -o $@
clean:
rm -f $(OBJS) test makedepend

View File

@ -85,7 +85,7 @@ Region::init ( void )
_end = 0;
_scale = 1.0f;
_clip = NULL;
_current = false;
_box_color = FL_CYAN;
_color = FL_BLUE;
@ -103,6 +103,7 @@ Region::Region ( const Region & rhs )
_scale = rhs._scale;
_box_color = rhs._box_color;
_color = rhs._color;
_current = false;
log_create();
}
@ -222,6 +223,14 @@ Region::handle ( int m )
switch ( m )
{
case FL_ENTER:
_current = true;
redraw();
break;
case FL_LEAVE:
_current = false;
redraw();
break;
case FL_PUSH:
{
@ -469,7 +478,14 @@ Region::draw ( int X, int Y, int W, int H )
draw_label( _clip->name(), align() );
if ( _current )
{
char pat[40];
snprintf( pat, sizeof( pat ), "%dm:%.1fs", (int)(length() / timeline->sample_rate) / 60, (double)length() / timeline->sample_rate );
draw_label( pat, (Fl_Align)(FL_ALIGN_INSIDE | FL_ALIGN_CENTER), FL_GRAY );
}
/* if ( _selected ) */
/* { */

View File

@ -43,10 +43,12 @@ using namespace std;
class Region : public Track_Widget
{
Audio_File *_clip; /* clip this region represents */
Audio_File *_clip; /* clip this region represents */
float _scale; /* amplitude adjustment */
bool _current; /* region is receiving operations */
static Fl_Boxtype _box;
static Fl_Color _selection_color;
static Fl_Color selection_color ( void ) { return _selection_color; }

View File

@ -23,7 +23,7 @@ list <Track_Widget *> Track_Widget::_selection;
Track_Widget * Track_Widget::_current;
void
Track_Widget::draw_label ( const char *label, Fl_Align align )
Track_Widget::draw_label ( const char *label, Fl_Align align, Fl_Color color )
{
int X, Y;
@ -47,7 +47,7 @@ Track_Widget::draw_label ( const char *label, Fl_Align align )
Fl_Label lab;
lab.color = 0;
lab.color = color;
lab.type = FL_SHADOW_LABEL;
lab.value = label;
lab.font = FL_HELVETICA;

View File

@ -214,7 +214,7 @@ public:
return _offset < rhs._offset;
}
virtual void draw_label ( const char *label, Fl_Align align );
virtual void draw_label ( const char *label, Fl_Align align, Fl_Color color=(Fl_Color)0 );
virtual int handle ( int m );
static bool