non/Panner.H

84 lines
2.6 KiB
C++
Raw Normal View History

2008-03-13 20:23:18 +01:00
/*******************************************************************************/
/* Copyright (C) 2008 Jonathan Moore Liles */
/* */
/* 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; see the file COPYING. If not,write to the Free Software */
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/
#pragma once
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
2008-03-13 20:42:24 +01:00
#include <FL/Fl.H>
2008-03-13 20:23:18 +01:00
#include <vector>
using namespace std;
class Panner : public Fl_Widget
{
struct Point
{
/* axes */
float x, y;
Point ( ) : x( 0.0f ), y( 0.0f ) { }
Point ( float X, float Y ) : x( X ), y( Y ) { }
};
/* channel configuration */
int _ins,
_outs;
vector <Point> _points;
static int pw ( void ) { return 6; }
static int ph ( void ) { return 6; }
2008-03-13 20:42:24 +01:00
static int _configs[][12];
2008-03-13 20:23:18 +01:00
void bbox ( int &X, int &Y, int &W, int &H )
{
2008-03-13 22:03:00 +01:00
W = w() - Fl::box_dw( box() );
H = h() - Fl::box_dh( box() );
2008-03-13 20:23:18 +01:00
X = x() + Fl::box_dx( box() );
Y = y() + Fl::box_dy( box() );
}
2008-03-13 20:42:24 +01:00
Point * event_point ( void );
2008-03-13 20:23:18 +01:00
public:
Panner ( int X, int Y, int W, int H, const char *L = 0 ) :
Fl_Widget( X, Y, W, H, L )
{
_ins = _outs = 4;
_points.push_back( Point( -1, -1 ) );
_points.push_back( Point( 1, 1 ) );
_points.push_back( Point( -1, 1 ) );
_points.push_back( Point( 1, -1 ) );
_outs = 5;
}
virtual ~Panner ( ) { }
2008-03-13 20:42:24 +01:00
virtual void draw ( void );
virtual int handle ( int );
2008-03-13 20:23:18 +01:00
};