mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 17:11:40 -05:00
-Added Avtk::Box to use as background instead of Fl widget, should fix BG theming color issue
This commit is contained in:
parent
ca0fab2d17
commit
ebb9e8f5a1
5 changed files with 171 additions and 19 deletions
165
src/avtk/avtk_box.h
Normal file
165
src/avtk/avtk_box.h
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Author: Harry van Haaren 2013
|
||||
* harryhaaren@gmail.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AVTK_BOX_H
|
||||
#define AVTK_BOX_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
|
||||
namespace Avtk
|
||||
{
|
||||
|
||||
// FIXME: Refactor to .hxx .cxx
|
||||
class Box : public Fl_Widget
|
||||
{
|
||||
public:
|
||||
Box(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||
Fl_Widget(_x, _y, _w, _h, _label)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
|
||||
r = g = b = 0;
|
||||
|
||||
label = strdup(_label);
|
||||
|
||||
highlight = false;
|
||||
}
|
||||
bool highlight;
|
||||
int x, y, w, h;
|
||||
const char* label;
|
||||
|
||||
int r,g,b;
|
||||
|
||||
void setLabel(const char* l)
|
||||
{
|
||||
if( label )
|
||||
free( (char*) label);
|
||||
|
||||
label = strdup( l );
|
||||
redraw();
|
||||
}
|
||||
const char* getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
void setColor( int red, int green, int blue )
|
||||
{
|
||||
r = red;
|
||||
g = green;
|
||||
b = blue;
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
if (damage() & FL_DAMAGE_ALL)
|
||||
{
|
||||
cairo_t *cr = Fl::cairo_cc();
|
||||
|
||||
cairo_save( cr );
|
||||
|
||||
cairo_set_line_width(cr, 1.5);
|
||||
|
||||
// fill background
|
||||
cairo_rectangle( cr, x, y, w, h);
|
||||
cairo_set_source_rgba( cr, r, g, b, 1 );
|
||||
cairo_fill( cr );
|
||||
|
||||
/*
|
||||
// stroke rim
|
||||
cairo_rectangle(cr, x, y, w, h);
|
||||
cairo_set_source_rgba( cr, 66 / 255.f, 66 / 255.f , 66 / 255.f , 1 );
|
||||
cairo_stroke( cr );
|
||||
*/
|
||||
|
||||
cairo_restore( cr );
|
||||
}
|
||||
}
|
||||
|
||||
void resize(int X, int Y, int W, int H)
|
||||
{
|
||||
Fl_Widget::resize(X,Y,W,H);
|
||||
x = X;
|
||||
y = Y;
|
||||
w = W;
|
||||
h = H;
|
||||
redraw();
|
||||
}
|
||||
|
||||
/*
|
||||
int handle(int event)
|
||||
{
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case FL_PUSH:
|
||||
if ( Fl::event_state(FL_BUTTON3) && Fl::event_y() < y + 20 )
|
||||
{
|
||||
const char* name = fl_input( "Track name: ", "" );
|
||||
if ( name )
|
||||
{
|
||||
free( (char*) label );
|
||||
label = strdup( name );
|
||||
redraw();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
redraw();
|
||||
return 1;
|
||||
case FL_DRAG: {
|
||||
int t = Fl::event_inside(this);
|
||||
if (t != highlight) {
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case FL_RELEASE:
|
||||
if (highlight) {
|
||||
highlight = 0;
|
||||
redraw();
|
||||
do_callback();
|
||||
}
|
||||
return 1;
|
||||
case FL_SHORTCUT:
|
||||
if ( test_shortcut() )
|
||||
{
|
||||
do_callback();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
return Fl_Widget::handle(event);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
} // Avtk
|
||||
|
||||
#endif // AVTK_BOX_H
|
||||
|
|
@ -183,14 +183,6 @@ GMasterTrack::GMasterTrack(int x, int y, int w, int h, const char* l ) :
|
|||
beatLights[2]->setColor( 1.0, 1.0 , 0.0 );
|
||||
beatLights[3]->setColor( 0.0, 1.0 , 0.0 );
|
||||
|
||||
volBox.maximum(1.0f);
|
||||
volBox.minimum(0.0f);
|
||||
volBox.color( fl_rgb_color( 0,0,0 ) );
|
||||
|
||||
source.maximum(1.0f);
|
||||
source.minimum(0.0f);
|
||||
source.color( fl_rgb_color( 0,0,0 ) );
|
||||
|
||||
volume.amplitude( 0.0, 0.0 );
|
||||
volume.callback( gmastertrack_volume_callback, 0 );
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <FL/Fl_Slider.H>
|
||||
#include <FL/Fl_Progress.H>
|
||||
|
||||
#include "avtk/avtk_box.h"
|
||||
#include "avtk/avtk_dial.h"
|
||||
#include "avtk/avtk_button.h"
|
||||
#include "avtk/avtk_reverb.h"
|
||||
|
@ -54,8 +55,8 @@ class GMasterTrack : public Fl_Group
|
|||
|
||||
Avtk::ClipSelector clipSel;
|
||||
|
||||
Fl_Progress source;
|
||||
Fl_Progress volBox;
|
||||
Avtk::Box source;
|
||||
Avtk::Box volBox;
|
||||
|
||||
Avtk::Button tapTempo;
|
||||
Avtk::LightButton metronomeButton;
|
||||
|
|
|
@ -47,16 +47,9 @@ GTrack::GTrack(int x, int y, int w, int h, const char* l ) :
|
|||
recordActive.setColor( 1, 0.0, 0.0 );
|
||||
recordActive.callback( gtrack_record_cb, this );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
volume.callback( gtrack_vol_cb, this );
|
||||
|
||||
volBox.maximum(1.0f);
|
||||
volBox.minimum(0.0f);
|
||||
volBox.color( fl_rgb_color( 0,0,0 ) );
|
||||
volBox.selection_color( FL_BLUE );
|
||||
//volBox.color( fl_rgb_color( 0,0,0 ) );
|
||||
|
||||
end(); // close the group
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <FL/Fl_Progress.H>
|
||||
#include <FL/Fl_Native_File_Chooser.H>
|
||||
|
||||
#include "avtk/avtk_box.h"
|
||||
#include "avtk/avtk_dial.h"
|
||||
#include "avtk/avtk_button.h"
|
||||
#include "avtk/avtk_background.h"
|
||||
|
@ -61,7 +62,7 @@ class GTrack : public Fl_Group
|
|||
|
||||
Avtk::ClipSelector clipSel;
|
||||
|
||||
Fl_Progress volBox;
|
||||
Avtk::Box volBox;
|
||||
|
||||
Avtk::Volume volume;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue