Browse Source

Add nifty mouseover region time display.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
ec2dc52307
5 changed files with 31 additions and 5 deletions
  1. +8
    -0
      Makefile
  2. +17
    -1
      Region.C
  3. +3
    -1
      Region.H
  4. +2
    -2
      Track_Widget.C
  5. +1
    -1
      Track_Widget.H

+ 8
- 0
Makefile View File

@@ -29,6 +29,14 @@ test: $(OBJS)
mixer: Mixer_Strip.o Mixer.o mixer: Mixer_Strip.o Mixer.o
$(CXX) $(CXXFLAGS) $(LIBS) Mixer_Strip.o Mixer.o -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: clean:
rm -f $(OBJS) test makedepend rm -f $(OBJS) test makedepend




+ 17
- 1
Region.C View File

@@ -85,7 +85,7 @@ Region::init ( void )
_end = 0; _end = 0;
_scale = 1.0f; _scale = 1.0f;
_clip = NULL; _clip = NULL;
_current = false;


_box_color = FL_CYAN; _box_color = FL_CYAN;
_color = FL_BLUE; _color = FL_BLUE;
@@ -103,6 +103,7 @@ Region::Region ( const Region & rhs )
_scale = rhs._scale; _scale = rhs._scale;
_box_color = rhs._box_color; _box_color = rhs._box_color;
_color = rhs._color; _color = rhs._color;
_current = false;


log_create(); log_create();
} }
@@ -222,6 +223,14 @@ Region::handle ( int m )


switch ( m ) switch ( m )
{ {
case FL_ENTER:
_current = true;
redraw();
break;
case FL_LEAVE:
_current = false;
redraw();
break;
case FL_PUSH: case FL_PUSH:
{ {


@@ -469,7 +478,14 @@ Region::draw ( int X, int Y, int W, int H )


draw_label( _clip->name(), align() ); 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 ) */ /* if ( _selected ) */
/* { */ /* { */


+ 3
- 1
Region.H View File

@@ -43,10 +43,12 @@ using namespace std;
class Region : public Track_Widget class Region : public Track_Widget
{ {


Audio_File *_clip; /* clip this region represents */
Audio_File *_clip; /* clip this region represents */


float _scale; /* amplitude adjustment */ float _scale; /* amplitude adjustment */


bool _current; /* region is receiving operations */

static Fl_Boxtype _box; static Fl_Boxtype _box;
static Fl_Color _selection_color; static Fl_Color _selection_color;
static Fl_Color selection_color ( void ) { return _selection_color; } static Fl_Color selection_color ( void ) { return _selection_color; }


+ 2
- 2
Track_Widget.C View File

@@ -23,7 +23,7 @@ list <Track_Widget *> Track_Widget::_selection;
Track_Widget * Track_Widget::_current; Track_Widget * Track_Widget::_current;


void 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; int X, Y;


@@ -47,7 +47,7 @@ Track_Widget::draw_label ( const char *label, Fl_Align align )


Fl_Label lab; Fl_Label lab;


lab.color = 0;
lab.color = color;
lab.type = FL_SHADOW_LABEL; lab.type = FL_SHADOW_LABEL;
lab.value = label; lab.value = label;
lab.font = FL_HELVETICA; lab.font = FL_HELVETICA;


+ 1
- 1
Track_Widget.H View File

@@ -214,7 +214,7 @@ public:
return _offset < rhs._offset; 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 ); virtual int handle ( int m );


static bool static bool


Loading…
Cancel
Save