mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-06 01:21:38 -05:00
-Tooltips working
This commit is contained in:
parent
a99daa5aa8
commit
0b67eed283
5 changed files with 77 additions and 68 deletions
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,56 +46,7 @@ static string choose_file()
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gtrack_button_callback(Fl_Widget *w, void *data) {
|
extern 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" );
|
|
||||||
}
|
|
||||||
else if ( strcmp( w->label() , "Play" ) == 0 )
|
|
||||||
{
|
|
||||||
EventLooperState e = EventLooperState(track,Looper::STATE_PLAY_QUEUED);
|
|
||||||
writeToDspRingbuffer( &e );
|
|
||||||
w->tooltip( "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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class GTrack : public Fl_Group
|
class GTrack : public Fl_Group
|
||||||
{
|
{
|
||||||
|
|
29
src/gui.cxx
29
src/gui.cxx
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <FL/Fl_Tooltip.H>
|
|
||||||
|
|
||||||
#include "audiobuffer.hxx"
|
#include "audiobuffer.hxx"
|
||||||
|
|
||||||
// include the header.c file in the planning dir:
|
// include the header.c file in the planning dir:
|
||||||
|
@ -13,13 +11,25 @@
|
||||||
#include "../planning/header.c"
|
#include "../planning/header.c"
|
||||||
|
|
||||||
// Hack, move to gtrack.cpp
|
// Hack, move to gtrack.cpp
|
||||||
Fl_Box* Gui::tooltipLabel = 0;
|
|
||||||
int GTrack::privateID = 0;
|
int GTrack::privateID = 0;
|
||||||
int GMasterTrack::privateID = 0;
|
int GMasterTrack::privateID = 0;
|
||||||
int AudioBuffer::privateID = 0;
|
int AudioBuffer::privateID = 0;
|
||||||
|
|
||||||
using namespace std;
|
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*) {
|
void close_cb(Fl_Widget*o, void*) {
|
||||||
if ((Fl::event() == FL_KEYDOWN || Fl::event() == FL_SHORTCUT)
|
if ((Fl::event() == FL_KEYDOWN || Fl::event() == FL_SHORTCUT)
|
||||||
|
@ -38,8 +48,6 @@ static void gui_static_read_rb(void* inst)
|
||||||
Gui::Gui() :
|
Gui::Gui() :
|
||||||
window(1272,750)
|
window(1272,750)
|
||||||
{
|
{
|
||||||
fl_show_tooltip = &Gui::show_tooltip;
|
|
||||||
|
|
||||||
window.color(FL_BLACK);
|
window.color(FL_BLACK);
|
||||||
window.label("Luppp 5");
|
window.label("Luppp 5");
|
||||||
//window.callback( close_cb, 0 );
|
//window.callback( close_cb, 0 );
|
||||||
|
@ -64,13 +72,6 @@ Gui::Gui() :
|
||||||
|
|
||||||
unit = new GUnitTrack(9 + i * 118 + 158, 40, 150, 700, "Units");
|
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();
|
window.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +89,3 @@ int Gui::show()
|
||||||
return Fl::run();
|
return Fl::run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::show_tooltip( const char* c )
|
|
||||||
{
|
|
||||||
tooltipLabel->label( c );
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Gui
|
||||||
GTrack* getTrack(int id);
|
GTrack* getTrack(int id);
|
||||||
|
|
||||||
// for pushing strings to tooltip area
|
// for pushing strings to tooltip area
|
||||||
static void show_tooltip( const char* );
|
void setTooltip( std::string s );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Fl_Double_Window window;
|
Fl_Double_Window window;
|
||||||
|
@ -37,7 +37,8 @@ class Gui
|
||||||
|
|
||||||
vector<GTrack*> tracks;
|
vector<GTrack*> tracks;
|
||||||
|
|
||||||
static Fl_Box* tooltipLabel;
|
std::string tooltip;
|
||||||
|
Fl_Box* tooltipLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LUPPP_GUI
|
#endif // LUPPP_GUI
|
||||||
|
|
1
wscript
1
wscript
|
@ -22,6 +22,7 @@ def build(bld):
|
||||||
sources = ['src/gui.cxx',
|
sources = ['src/gui.cxx',
|
||||||
'src/main.cxx',
|
'src/main.cxx',
|
||||||
'src/jack.cxx',
|
'src/jack.cxx',
|
||||||
|
'src/gtrack.cxx',
|
||||||
'src/looper.cxx',
|
'src/looper.cxx',
|
||||||
'src/controller/apc.cxx',
|
'src/controller/apc.cxx',
|
||||||
'src/eventhandlergui.cxx',
|
'src/eventhandlergui.cxx',
|
||||||
|
|
Loading…
Add table
Reference in a new issue