mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
Merge branch 'tooltip'
This commit is contained in:
commit
77c09da555
7 changed files with 105 additions and 75 deletions
|
@ -59,10 +59,10 @@ class GMasterTrack : public Fl_Group
|
|||
title( strdup(l) ),
|
||||
bg( x, y , w, h, title ),
|
||||
|
||||
clipSel(x + 5, y + 26, 140, 294,"Testing"),
|
||||
clipSel(x + 5, y + 26 + 26, 140, 294,"Testing"),
|
||||
|
||||
|
||||
tapTempo(x + 25 + 22, y + 475, 44, 44,"Tap"),
|
||||
tapTempo(x + 25 + 22, y + 475 + 26, 44, 44,"Tap"),
|
||||
/*
|
||||
button2(x + 5, y + 44, 100, 18,"Play"),
|
||||
button3(x + 5, y + 64, 100, 18,"Stop"),
|
||||
|
@ -70,14 +70,14 @@ class GMasterTrack : public Fl_Group
|
|||
button5(x +57, y + 84, 48, 18,"+"),
|
||||
button6(x + 5, y +104, 18, 18,"6"),
|
||||
*/
|
||||
metronomeButton(x + 5,y + 424,140,30,"Metro"),
|
||||
metronomeButton(x + 5,y + 424 + 26,140,30,"Metro"),
|
||||
|
||||
dial1(x+25-22, y +475, 44, 44, "BPM"),
|
||||
dial1(x+25-22, y +475 + 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, 36, 150, "Vol")
|
||||
volume(x+108, y +495 + 26, 36, 150, "Vol")
|
||||
{
|
||||
ID = privateID++;
|
||||
|
||||
|
|
59
src/gtrack.cxx
Normal file
59
src/gtrack.cxx
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
#include "gtrack.hxx"
|
||||
#include "gui.hxx"
|
||||
|
||||
extern Gui* gui;
|
||||
|
||||
void gtrack_button_callback(Fl_Widget *w, void *data)
|
||||
{
|
||||
int track = 0;
|
||||
if ( data )
|
||||
track = *(int*)data;
|
||||
//cout << "Button " << *(int*)data << " " << w->label() << " clicked" << endl;
|
||||
|
||||
if ( strcmp( w->label() , "Rec" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_RECORD_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
//w->tooltip( "Rec Clicked" );
|
||||
gui->setTooltip("Rec clicked");
|
||||
}
|
||||
else if ( strcmp( w->label() , "Play" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_PLAY_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
//w->tooltip( "Play clicked" );
|
||||
gui->setTooltip("Play clicked");
|
||||
}
|
||||
else if ( strcmp( w->label() , "Stop" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_STOP_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "+" ) == 0 )
|
||||
{
|
||||
EventLooperLoopLength e = EventLooperLoopLength(track, 2);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "-" ) == 0 )
|
||||
{
|
||||
EventLooperLoopLength e = EventLooperLoopLength(track, 0.5);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "Load" ) == 0 )
|
||||
{
|
||||
AudioBuffer* ab = Worker::loadSample( choose_file() );
|
||||
EventLooperLoad e = EventLooperLoad( track, 0 , ab );
|
||||
cout << "writing event ab ptr = " << ab << endl;
|
||||
writeToDspRingbuffer( &e );
|
||||
cout << "writing event done" << endl;
|
||||
}
|
||||
else if ( strcmp( w->label() , "Vol" ) == 0 )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << __FILE__ << __LINE__ << " Error: unknown command string" << endl;
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@
|
|||
#include "avtk/avtk_clip_selector.h"
|
||||
|
||||
|
||||
#include "config.hxx"
|
||||
#include "worker.hxx"
|
||||
#include "audiobuffer.hxx"
|
||||
#include "eventhandler.hxx"
|
||||
|
@ -45,54 +46,7 @@ static string choose_file()
|
|||
return path;
|
||||
}
|
||||
|
||||
static void gtrack_button_callback(Fl_Widget *w, void *data) {
|
||||
int track = 0;
|
||||
if ( data )
|
||||
track = *(int*)data;
|
||||
//cout << "Button " << *(int*)data << " " << w->label() << " clicked" << endl;
|
||||
|
||||
if ( strcmp( w->label() , "Rec" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_RECORD_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "Play" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_PLAY_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "Stop" ) == 0 )
|
||||
{
|
||||
EventLooperState e = EventLooperState(track,Looper::STATE_STOP_QUEUED);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "+" ) == 0 )
|
||||
{
|
||||
EventLooperLoopLength e = EventLooperLoopLength(track, 2);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "-" ) == 0 )
|
||||
{
|
||||
EventLooperLoopLength e = EventLooperLoopLength(track, 0.5);
|
||||
writeToDspRingbuffer( &e );
|
||||
}
|
||||
else if ( strcmp( w->label() , "Load" ) == 0 )
|
||||
{
|
||||
AudioBuffer* ab = Worker::loadSample( choose_file() );
|
||||
EventLooperLoad e = EventLooperLoad( track, 0 , ab );
|
||||
cout << "writing event ab ptr = " << ab << endl;
|
||||
writeToDspRingbuffer( &e );
|
||||
cout << "writing event done" << endl;
|
||||
}
|
||||
else if ( strcmp( w->label() , "Vol" ) == 0 )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << __FILE__ << __LINE__ << " Error: unknown command string" << endl;
|
||||
}
|
||||
}
|
||||
extern void gtrack_button_callback(Fl_Widget *w, void *data);
|
||||
|
||||
class GTrack : public Fl_Group
|
||||
{
|
||||
|
@ -102,23 +56,23 @@ class GTrack : public Fl_Group
|
|||
title( strdup(l) ),
|
||||
bg( x, y , w, h, title ),
|
||||
|
||||
clipSel(x + 5, y + 26, 100, 294,"Clip"),
|
||||
clipSel(x + 5, y + 26 + 26, 100, 294,""),
|
||||
|
||||
button1(x + 5, y + 324, 100, 18,"Rec"),
|
||||
button2(x + 5, y + 344, 100, 18,"Play"),
|
||||
button3(x + 5, y + 364, 100, 18,"Stop"),
|
||||
button4(x + 5, y + 384, 48, 18,"-"),
|
||||
button5(x +57, y + 384, 48, 18,"+"),
|
||||
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,"+"),
|
||||
|
||||
button6(x + 5, y + 404, 100, 18,"Load"),
|
||||
button6(x + 5, y + 404 + 26, 100, 18,"Load"),
|
||||
|
||||
volume(x+68, y +495, 36, 150, "Vol"),
|
||||
volume(x+68, y +495 + 26, 36, 150, "Vol"),
|
||||
|
||||
dial1(x+15, y +452, 24, 24, "REV"),
|
||||
dial2(x+45, y +452, 24, 24, "SC"),
|
||||
dial3(x+75, y +452, 24, 24, "POST"),
|
||||
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"),
|
||||
|
||||
progress(x+5, y+428, 100, 18, "")
|
||||
progress(x+5, y+428 + 26, 100, 18, "")
|
||||
{
|
||||
ID = privateID++;
|
||||
|
||||
|
|
25
src/gui.cxx
25
src/gui.cxx
|
@ -17,6 +17,20 @@ int AudioBuffer::privateID = 0;
|
|||
|
||||
using namespace std;
|
||||
|
||||
extern Gui* gui;
|
||||
|
||||
|
||||
static void luppp_tooltip(std::string s)
|
||||
{
|
||||
gui->setTooltip(s);
|
||||
}
|
||||
|
||||
void Gui::setTooltip( std::string s )
|
||||
{
|
||||
tooltip = s;
|
||||
tooltipLabel->label( tooltip.c_str() );
|
||||
}
|
||||
|
||||
void close_cb(Fl_Widget*o, void*) {
|
||||
if ((Fl::event() == FL_KEYDOWN || Fl::event() == FL_SHORTCUT)
|
||||
&& Fl::event_key() == FL_Escape)
|
||||
|
@ -39,10 +53,11 @@ Gui::Gui() :
|
|||
//window.callback( close_cb, 0 );
|
||||
|
||||
|
||||
|
||||
Avtk::Image* headerImage = new Avtk::Image(0,0,1272,36,"header.png");
|
||||
headerImage->setPixbuf( header.pixel_data, 4 );
|
||||
|
||||
Gui::tooltipLabel = new Fl_Box(100, 20, 200, 20, "tooltips go here");
|
||||
|
||||
//window.resizable( headerImage );
|
||||
|
||||
int i = 0;
|
||||
|
@ -57,13 +72,6 @@ Gui::Gui() :
|
|||
|
||||
unit = new GUnitTrack(9 + i * 118 + 158, 40, 150, 700, "Units");
|
||||
|
||||
|
||||
/*
|
||||
box = new Fl_Box(655, 5, 200, 60, "BPM = 120");
|
||||
box->box(FL_UP_BOX);
|
||||
box->labelsize(36);
|
||||
box->labeltype(FL_SHADOW_LABEL);
|
||||
*/
|
||||
window.end();
|
||||
}
|
||||
|
||||
|
@ -80,3 +88,4 @@ int Gui::show()
|
|||
|
||||
return Fl::run();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "gmastertrack.hxx"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -23,6 +24,9 @@ class Gui
|
|||
Gui();
|
||||
int show();
|
||||
GTrack* getTrack(int id);
|
||||
|
||||
// for pushing strings to tooltip area
|
||||
void setTooltip( std::string s );
|
||||
|
||||
private:
|
||||
Fl_Double_Window window;
|
||||
|
@ -32,6 +36,9 @@ class Gui
|
|||
GUnitTrack* unit;
|
||||
|
||||
vector<GTrack*> tracks;
|
||||
|
||||
std::string tooltip;
|
||||
Fl_Box* tooltipLabel;
|
||||
};
|
||||
|
||||
#endif // LUPPP_GUI
|
||||
|
|
|
@ -36,8 +36,8 @@ int main()
|
|||
rbToGui = jack_ringbuffer_create( 5000 * sizeof(EventBase));
|
||||
|
||||
|
||||
jack = new Jack();
|
||||
jack->activate();
|
||||
//jack = new Jack();
|
||||
//jack->activate();
|
||||
|
||||
gui = new Gui();
|
||||
gui->show();
|
||||
|
|
1
wscript
1
wscript
|
@ -22,6 +22,7 @@ def build(bld):
|
|||
sources = ['src/gui.cxx',
|
||||
'src/main.cxx',
|
||||
'src/jack.cxx',
|
||||
'src/gtrack.cxx',
|
||||
'src/looper.cxx',
|
||||
'src/controller/apc.cxx',
|
||||
'src/eventhandlergui.cxx',
|
||||
|
|
Loading…
Add table
Reference in a new issue