From ee76b56c0ba37586a521c23d4509a204fdb1e164 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Wed, 24 Jul 2013 23:58:08 +0100 Subject: [PATCH] -UI updated, ClipSelector working --- src/avtk/avtk_clip_selector.h | 14 +++++++-- src/gmastertrack.hxx | 6 ++-- src/gtrack.hxx | 58 ++++++++++++++++++++++++++--------- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/src/avtk/avtk_clip_selector.h b/src/avtk/avtk_clip_selector.h index 1715dda..4cb21f6 100644 --- a/src/avtk/avtk_clip_selector.h +++ b/src/avtk/avtk_clip_selector.h @@ -231,11 +231,21 @@ class ClipSelector : public Fl_Button return 1; case FL_PUSH: highlight = 1; + { + // calculate the clicked clip number + int clipHeight = (h / numClips); + int clipNum = ( (Fl::event_y() ) - y ) / clipHeight; + if (clipNum >= numClips) + clipNum = numClips -1; // fix for clicking the lowest pixel + printf("clip number %i\n" , clipNum); + } do_callback(); return 1; - case FL_DRAG: { + case FL_DRAG: + { int t = Fl::event_inside(this); - if (t != highlight) { + if (t != highlight) + { highlight = t; redraw(); } diff --git a/src/gmastertrack.hxx b/src/gmastertrack.hxx index 054ec67..aa5d6f9 100644 --- a/src/gmastertrack.hxx +++ b/src/gmastertrack.hxx @@ -59,7 +59,7 @@ class GMasterTrack : public Fl_Group title( strdup(l) ), bg( x, y , w, h, title ), - clipSel(x + 5, y + 26 + 26, 140, 294,"Testing"), + clipSel(x + 5, y + 26 + 102, 140, 294,"Testing"), tapTempo(x + 25 + 22, y + 475 + 26, 44, 44,"Tap"), @@ -72,12 +72,12 @@ class GMasterTrack : public Fl_Group */ metronomeButton(x + 5,y + 424 + 26,140,30,"Metro"), - dial1(x+25-22, y +475 + 26, 44, 44, "BPM"), + dial1(x+25-22, y +465 + 26, 44, 44, "BPM"), /* dial2(x+45, y +155, 24, 24, "B"), dial3(x+75, y +155, 24, 24, "C") */ - volume(x+108, y +495 + 26, 36, 150, "Vol") + volume(x+108, y +530, 36, 150, "Vol") { ID = privateID++; diff --git a/src/gtrack.hxx b/src/gtrack.hxx index b46b5ae..bacbe4c 100644 --- a/src/gtrack.hxx +++ b/src/gtrack.hxx @@ -56,33 +56,40 @@ class GTrack : public Fl_Group title( strdup(l) ), bg( x, y , w, h, title ), - clipSel(x + 5, y + 26 + 26, 100, 294,""), + clipSel(x + 5, y + 26 + 102, 100, 294,""), - button1(x + 5, y + 324 + 26, 100, 18,"Rec"), - button2(x + 5, y + 344 + 26, 100, 18,"Play"), - button3(x + 5, y + 364 + 26, 100, 18,"Stop"), - button4(x + 5, y + 384 + 26, 48, 18,"-"), - button5(x +57, y + 384 + 26, 48, 18,"+"), + volBox(x+5, y+522+2, 100, 250, ""), - button6(x + 5, y + 404 + 26, 100, 18,"Load"), + /* + button1(x + 5, y + 324 + 102, 100, 18,"Rec"), + button2(x + 5, y + 344 + 102, 100, 18,"Play"), + button3(x + 5, y + 364 + 102, 100, 18,"Stop"), + button4(x + 5, y + 384 + 102, 48, 18,"-"), + button5(x +57, y + 384 + 102, 48, 18,"+"), + button6(x + 5, y + 404 + 102, 100, 18,"Load"), + */ - volume(x+68, y +495 + 26, 36, 150, "Vol"), + volume(x+68, y +530, 36, 150, "Vol"), - dial1(x+15, y +452 + 26, 24, 24, "REV"), - dial2(x+45, y +452 + 26, 24, 24, "SC"), - dial3(x+75, y +452 + 26, 24, 24, "POST"), + dial1(x+25, y +452 + 102, 24, 24, "REV"), + dial2(x+25, y +452 + 152, 24, 24, "SC"), + dial3(x+25, y +452 + 202, 24, 24, "POST"), - progress(x+5, y+428 + 26, 100, 18, "") + progress(x+5, y+ 26, 100, 100, "Source UI"), + + //unit(x+5, y+200+26, 100, 100, "Unit"), + + fx(x+5, y+ 422, 100, 100, "FX") { ID = privateID++; - + /* button1.callback( gtrack_button_callback, &ID ); button2.callback( gtrack_button_callback, &ID ); button3.callback( gtrack_button_callback, &ID ); button4.callback( gtrack_button_callback, &ID ); button5.callback( gtrack_button_callback, &ID ); button6.callback( gtrack_button_callback, &ID ); - + */ volume.callback( gtrack_button_callback, 0 ); volume.amplitude( 0.75, 0.5 ); @@ -92,6 +99,22 @@ class GTrack : public Fl_Group progress.color( FL_BLACK ); progress.selection_color( FL_BLUE ); + fx.maximum(1.0f); + fx.minimum(0.0f); + fx.color( FL_BLACK ); + fx.selection_color( FL_BLUE ); + + + volBox.maximum(1.0f); + volBox.minimum(0.0f); + volBox.color( FL_BLACK ); + volBox.selection_color( FL_BLUE ); + /* + unit.maximum(1.0f); + unit.minimum(0.0f); + unit.color( FL_BLACK ); + unit.selection_color( FL_BLUE ); + */ end(); // close the group } @@ -108,13 +131,15 @@ class GTrack : public Fl_Group Avtk::ClipSelector clipSel; + Fl_Progress volBox; + /* Avtk::Button button1; Avtk::Button button2; Avtk::Button button3; Avtk::Button button4; Avtk::Button button5; Avtk::Button button6; - + */ Avtk::Volume volume; @@ -123,6 +148,9 @@ class GTrack : public Fl_Group Avtk::Dial dial3; Fl_Progress progress; + //Fl_Progress unit; + Fl_Progress fx; + static int privateID; };