-Track names saved/reloaded with JSON

This commit is contained in:
Harry van Haaren 2013-09-10 23:57:47 +01:00
parent 05702236d4
commit 699e94e090
3 changed files with 8 additions and 22 deletions

View file

@ -32,6 +32,7 @@
namespace Avtk
{
// FIXME: Refactor to .hxx .cxx
class Background : public Fl_Widget
{
public:
@ -45,8 +46,6 @@ class Background : public Fl_Widget
label = strdup(_label);
//printf("AVTK background label: %s\n", label );
highlight = false;
}
bool highlight;
@ -59,6 +58,7 @@ class Background : public Fl_Widget
free( (char*) label);
label = strdup( l );
redraw();
}
const char* getLabel()
{
@ -81,26 +81,6 @@ class Background : public Fl_Widget
cairo_set_source_rgba( cr, 28 / 255.f, 28 / 255.f , 28 / 255.f , 1 );
cairo_fill( cr );
/*
// set up dashed lines, 1 px off, 1 px on
double dashes[1];
dashes[0] = 2.0;
cairo_set_dash ( cr, dashes, 1, 0.0);
cairo_set_line_width( cr, 1.0);
// loop over each 2nd line, drawing dots
for ( int i = x; i < x + w; i += 4 )
{
cairo_move_to( cr, i, y );
cairo_line_to( cr, i, y + h );
}
cairo_set_source_rgba( cr, 28 / 255.f, 28 / 255.f , 28 / 255.f , 0.5 );
cairo_stroke(cr);
cairo_set_dash ( cr, dashes, 0, 0.0);
*/
// draw header
// backing
cairo_rectangle(cr, x, y, w, 20);

View file

@ -262,6 +262,11 @@ void DiskReader::readTracks()
readScenes( t, track );
// name
{
cJSON* name = cJSON_GetObjectItem( track, "name");
gui->getTrack(t)->bg.setLabel( name->valuestring );
}
// fader
{
cJSON* fader = cJSON_GetObjectItem( track, "fader");

View file

@ -134,6 +134,7 @@ void DiskWriter::writeSession( std::string path, std::string sessionName )
// add track metadata: volumes, sends etc
cJSON_AddNumberToObject( track, "ID", t );
cJSON_AddStringToObject( track, "name", gui->getTrack(t)->bg.getLabel() );
cJSON_AddNumberToObject( track, "fader", gui->getTrack(t)->getVolume()->value() );
cJSON_AddNumberToObject( track, "side", gui->getTrack(t)->side.value() );