mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Updated ClipSelector, changed volume & GTrack
This commit is contained in:
parent
47eebaa396
commit
08debba6ba
3 changed files with 243 additions and 19 deletions
|
@ -104,7 +104,7 @@ class ClipSelector : public Fl_Button
|
|||
|
||||
cairo_restore( cr );
|
||||
|
||||
draw_label();
|
||||
//draw_label();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
234
src/avtk/avtk_volume.h
Normal file
234
src/avtk/avtk_volume.h
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* 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_VOLUME_H
|
||||
#define AVTK_VOLUME_H
|
||||
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Slider.H>
|
||||
#include <valarray>
|
||||
#include <string>
|
||||
|
||||
namespace Avtk
|
||||
{
|
||||
|
||||
class Volume : public Fl_Slider
|
||||
{
|
||||
public:
|
||||
Volume(int _x, int _y, int _w, int _h, const char *_label = 0):
|
||||
Fl_Slider(_x, _y, _w, _h, _label)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = _h;
|
||||
|
||||
label = _label;
|
||||
|
||||
mouseClickedX = 0;
|
||||
mouseClickedY = 0;
|
||||
mouseClicked = false;
|
||||
|
||||
active = true;
|
||||
highlight = false;
|
||||
|
||||
ampL = 0;
|
||||
ampR = 0;
|
||||
compress = 0;
|
||||
value( 0.78f );
|
||||
}
|
||||
|
||||
void amplitude (float aL, float aR) {ampL = aL; ampR = aR; redraw();}
|
||||
void compression(float c) {compress = c; redraw();}
|
||||
|
||||
bool active;
|
||||
bool highlight;
|
||||
int x, y, w, h;
|
||||
const char* label;
|
||||
|
||||
int mouseClickedX;
|
||||
int mouseClickedY;
|
||||
bool mouseClicked;
|
||||
|
||||
float ampL, ampR;
|
||||
float compress;
|
||||
|
||||
void set_active(bool a)
|
||||
{
|
||||
active = a;
|
||||
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, 66 / 255.f, 66 / 255.f , 66 / 255.f, 0.4);
|
||||
//cairo_set_source_rgb( cr, 28 / 255.f, 28 / 255.f , 28 / 255.f );
|
||||
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
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_set_source_rgb(cr, 0.4,0.4,0.4);
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
cairo_move_to( cr, x + ((w / 2.f)*i), y );
|
||||
cairo_line_to( cr, x + ((w / 2.f)*i), y + h );
|
||||
}
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
cairo_move_to( cr, x , y + ((h / 4.f)*i) );
|
||||
cairo_line_to( cr, x + w, y + ((h / 4.f)*i) );
|
||||
}
|
||||
|
||||
cairo_set_source_rgba( cr, 66 / 255.f, 66 / 255.f , 66 / 255.f , 0.5 );
|
||||
cairo_stroke(cr);
|
||||
cairo_set_dash ( cr, dashes, 0, 0.0);
|
||||
|
||||
|
||||
// audio level
|
||||
|
||||
//cairo_move_to(cr, x+w*0.3, y+h); // left
|
||||
//cairo_line_to(cr, x+w*0.3, y+h*(1-ampL) );
|
||||
|
||||
//cairo_move_to(cr, x+w*0.7, y+h); // right
|
||||
//cairo_line_to(cr, x+w*0.7, y+h*(1-ampL) );
|
||||
|
||||
|
||||
cairo_rectangle(cr, x+w*0.15, y+h*(1-ampL), 9.9, h - h*(1-ampL) );
|
||||
cairo_rectangle(cr, x+w*0.56, y+h*(1-ampR), 9.9, h - h*(1-ampR) );
|
||||
|
||||
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 0.21 );
|
||||
cairo_fill_preserve( cr );
|
||||
cairo_set_source_rgba( cr, 0 / 255.f, 153 / 255.f , 255 / 255.f , 1 );
|
||||
cairo_stroke(cr);
|
||||
|
||||
// compression
|
||||
//cairo_rectangle(cr, x+w*0.45, y+h - h*(1-ampL), 8.9, h*(1-ampL));
|
||||
|
||||
// fader
|
||||
cairo_rectangle(cr, x+5, y+2+(h-24)*(1-value()), w-10, 20);
|
||||
cairo_set_source_rgba( cr, 1.0f, 0.48, 0.f, 1);
|
||||
cairo_set_line_width(cr, 1.9);
|
||||
cairo_stroke( cr );
|
||||
|
||||
|
||||
// stroke outline
|
||||
cairo_rectangle(cr, x, y, w, h);
|
||||
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
|
||||
cairo_set_line_width(cr, 1.9);
|
||||
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:
|
||||
highlight = 0;
|
||||
redraw();
|
||||
return 1;
|
||||
case FL_DRAG:
|
||||
{
|
||||
if ( Fl::event_state(FL_BUTTON1) )
|
||||
{
|
||||
if ( mouseClicked == false ) // catch the "click" event
|
||||
{
|
||||
mouseClickedX = Fl::event_x();
|
||||
mouseClickedY = Fl::event_y();
|
||||
mouseClicked = true;
|
||||
}
|
||||
|
||||
float deltaY = mouseClickedY - Fl::event_y();
|
||||
|
||||
float valY = value();
|
||||
valY += deltaY / h;
|
||||
|
||||
if ( valY > 1.0 ) valY = 1.0;
|
||||
if ( valY < 0.0 ) valY = 0.0;
|
||||
|
||||
//handle_drag( value + deltaY );
|
||||
set_value( valY );
|
||||
|
||||
mouseClickedX = Fl::event_x();
|
||||
mouseClickedY = Fl::event_y();
|
||||
redraw();
|
||||
do_callback();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
case FL_RELEASE:
|
||||
if (highlight) {
|
||||
highlight = 0;
|
||||
redraw();
|
||||
do_callback();
|
||||
}
|
||||
mouseClicked = false;
|
||||
return 1;
|
||||
case FL_SHORTCUT:
|
||||
if ( test_shortcut() )
|
||||
{
|
||||
do_callback();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
return Fl_Widget::handle(event);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // Avtk
|
||||
|
||||
#endif // AVTK_VOLUME_H
|
|
@ -11,6 +11,7 @@
|
|||
#include <FL/Fl_Native_File_Chooser.H>
|
||||
|
||||
#include "avtk/avtk_dial.h"
|
||||
#include "avtk/avtk_volume.h"
|
||||
#include "avtk/avtk_button.h"
|
||||
#include "avtk/avtk_background.h"
|
||||
#include "avtk/avtk_clip_selector.h"
|
||||
|
@ -111,11 +112,11 @@ class GTrack : public Fl_Group
|
|||
|
||||
button6(x + 5, y + 404, 100, 18,"Load"),
|
||||
|
||||
volume(x+55-22, y +490, 34, 34, "Vol"),
|
||||
volume(x+68, y +495, 36, 150, "Vol"),
|
||||
|
||||
dial1(x+15, y +455, 24, 24, "A"),
|
||||
dial2(x+45, y +455, 24, 24, "B"),
|
||||
dial3(x+75, y +455, 24, 24, "C"),
|
||||
dial1(x+15, y +452, 24, 24, "REV"),
|
||||
dial2(x+45, y +452, 24, 24, "SC"),
|
||||
dial3(x+75, y +452, 24, 24, "POST"),
|
||||
|
||||
progress(x+5, y+428, 100, 18, "")
|
||||
{
|
||||
|
@ -130,23 +131,12 @@ class GTrack : public Fl_Group
|
|||
|
||||
volume.callback( gtrack_button_callback, 0 );
|
||||
|
||||
volume.amplitude( 0.75, 0.5 );
|
||||
|
||||
progress.maximum(1.0f);
|
||||
progress.minimum(0.0f);
|
||||
progress.color( FL_BLACK );
|
||||
progress.selection_color( FL_BLUE );
|
||||
/*
|
||||
00366 Fl_Color color() const {return color_;}
|
||||
00367
|
||||
00378 void color(Fl_Color bg) {color_ = bg;}
|
||||
00379
|
||||
00384 Fl_Color selection_color() const {return color2_;}
|
||||
00385
|
||||
00394 void selection_color(Fl_Color a) {color2_ = a;}
|
||||
00395
|
||||
00403 void color(Fl_Color bg, Fl_Color sel) {color_=bg; color2_=sel;}
|
||||
00404
|
||||
*/
|
||||
|
||||
|
||||
end(); // close the group
|
||||
}
|
||||
|
@ -172,7 +162,7 @@ class GTrack : public Fl_Group
|
|||
Avtk::Button button6;
|
||||
|
||||
|
||||
Avtk::Dial volume;
|
||||
Avtk::Volume volume;
|
||||
|
||||
Avtk::Dial dial1;
|
||||
Avtk::Dial dial2;
|
||||
|
|
Loading…
Add table
Reference in a new issue