FLTK->NTK
FLTK fork gets Cairo and is renamed to NTK. Themes are moved from FL into NTK core. Fl_Arc_Dial is moved into NTK core.
This commit is contained in:
parent
a588f4ae96
commit
2c6b6b1a75
|
@ -1,3 +1,3 @@
|
|||
[submodule "lib/fltk"]
|
||||
path = lib/fltk
|
||||
[submodule "lib/ntk"]
|
||||
path = lib/ntk
|
||||
url = git://git.tuxfamily.org/gitroot/non/fltk.git
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 Jonathan Moore Liles */
|
||||
/* Copyright (C) 2001-2005 by Colin Jones */
|
||||
/* */
|
||||
/* 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Taken from the "Gleam" FLTK scheme, as modified by prodatum */
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
#include "FL/Fl_Theme.H"
|
||||
|
||||
static void clean_color(Fl_Color c)
|
||||
{
|
||||
c = fl_color_average( FL_GRAY, c, 0.4 );
|
||||
|
||||
if (Fl::draw_box_active())
|
||||
fl_color(c);
|
||||
else
|
||||
fl_color(fl_inactive(c));
|
||||
}
|
||||
|
||||
static void rect(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
// clean_color( bc );
|
||||
fl_rect( x, y, w, h, bc );
|
||||
}
|
||||
|
||||
static void rectf ( int x, int y,int w, int h, Fl_Color bc )
|
||||
{
|
||||
clean_color(fl_color_average( FL_WHITE, bc, 0.05 ) );
|
||||
fl_rectf( x, y, w, h );
|
||||
}
|
||||
|
||||
static void up_frame(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
|
||||
}
|
||||
|
||||
static void up_box(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
rectf(x, y, w, h, c );
|
||||
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
|
||||
}
|
||||
|
||||
static void down_frame(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
rect(x, y, w, h, fl_color_average( FL_BLACK, c, 0.2 ) );
|
||||
}
|
||||
|
||||
static void down_box(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
rectf(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
|
||||
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.4 ) );
|
||||
}
|
||||
|
||||
static void flat_box( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
rectf( x, y, w, h, c );
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme ( void )
|
||||
{
|
||||
Fl::set_boxtype( FL_UP_BOX, up_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_DOWN_BOX, down_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_THIN_UP_BOX, up_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_UP_FRAME, up_frame, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_ROUND_UP_BOX, up_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_FLAT_BOX, flat_box, 0, 0, 0, 0 );
|
||||
}
|
||||
|
||||
void
|
||||
init_clean_theme ( void )
|
||||
{
|
||||
Fl_Theme *t = new Fl_Theme( "Clean", "", "", init_theme );
|
||||
|
||||
Fl_Theme::add( t );
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
void init_clean_theme ( void );
|
|
@ -1,395 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* 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 GCC diagnostic ignored "-Wchar-subscripts"
|
||||
|
||||
#include <FL/fl_draw.H>
|
||||
#include <string.h>
|
||||
|
||||
#include "FL/Fl_Theme.H"
|
||||
|
||||
/* Crystal boxes, base (obviously) on the FLTK1 'plastic' boxes, but
|
||||
* without the rude color blending and with a slightly enhanced
|
||||
* appearance. */
|
||||
|
||||
extern uchar *fl_gray_ramp();
|
||||
|
||||
inline Fl_Color
|
||||
shade_color ( uchar gc, Fl_Color bc )
|
||||
{
|
||||
return fl_color_average( ( Fl_Color ) gc, bc, 0.25f );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
frame_rect ( int x, int y, int w, int h, const char *c, Fl_Color bc )
|
||||
{
|
||||
uchar *g = fl_gray_ramp();
|
||||
int b = strlen( c ) / 4 + 1;
|
||||
|
||||
for ( x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b-- )
|
||||
{
|
||||
// Draw lines around the perimeter of the button, 4 colors per
|
||||
// circuit.
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_line( x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_line( x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_line( x + w - 1, y - b, x, y - b, x - b, y );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_line( x - b, y, x - b, y + h, x, y + h + b );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
frame_round ( int x, int y, int w, int h, const char *c, Fl_Color bc )
|
||||
{
|
||||
uchar *g = fl_gray_ramp();
|
||||
int b = strlen( c ) / 4 + 1;
|
||||
|
||||
if ( ! Fl::draw_box_active() )
|
||||
bc = fl_inactive( bc );
|
||||
|
||||
if ( w == h )
|
||||
{
|
||||
for ( ; b > 1; b--, x++, y++, w -= 2, h -= 2 )
|
||||
{
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, h, 45.0, 135.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, h, 315.0, 405.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, h, 225.0, 315.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, h, 135.0, 225.0 );
|
||||
}
|
||||
}
|
||||
else if ( w > h )
|
||||
{
|
||||
int d = h / 2;
|
||||
for ( ; b > 1; d--, b--, x++, y++, w -= 2, h -= 2 )
|
||||
{
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, h, h, 90.0, 135.0 );
|
||||
fl_xyline( x + d, y, x + w - d );
|
||||
fl_arc( x + w - h, y, h, h, 45.0, 90.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x + w - h, y, h, h, 315.0, 405.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x + w - h, y, h, h, 270.0, 315.0 );
|
||||
fl_xyline( x + d, y + h - 1, x + w - d );
|
||||
fl_arc( x, y, h, h, 225.0, 270.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, h, h, 135.0, 225.0 );
|
||||
}
|
||||
}
|
||||
else if ( w < h )
|
||||
{
|
||||
int d = w / 2;
|
||||
for ( ; b > 1; d--, b--, x++, y++, w -= 2, h -= 2 )
|
||||
{
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, w, 45.0, 135.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y, w, w, 0.0, 45.0 );
|
||||
fl_yxline( x + w - 1, y + d, y + h - d );
|
||||
fl_arc( x, y + h - w, w, w, 315.0, 360.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y + h - w, w, w, 225.0, 315.0 );
|
||||
fl_color( shade_color( g[*c++], bc ) );
|
||||
fl_arc( x, y + h - w, w, w, 180.0, 225.0 );
|
||||
fl_yxline( x, y + d, y + h - d );
|
||||
fl_arc( x, y, w, w, 135.0, 180.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
shade_rect ( int x, int y, int w, int h, const char *c, Fl_Color bc )
|
||||
{
|
||||
uchar *g = fl_gray_ramp();
|
||||
int i, j;
|
||||
int clen = strlen( c ) - 1;
|
||||
int chalf = clen / 2;
|
||||
int cstep = 1;
|
||||
|
||||
if ( ! Fl::draw_box_active() )
|
||||
bc = fl_inactive( bc );
|
||||
|
||||
if ( h < ( w * 2 ) )
|
||||
{
|
||||
// Horizontal shading...
|
||||
if ( clen >= h )
|
||||
cstep = 2;
|
||||
|
||||
for ( i = 0, j = 0; j < chalf; i++, j += cstep )
|
||||
{
|
||||
// Draw the top line and points...
|
||||
fl_color( shade_color( g[c[i]], bc ) );
|
||||
fl_xyline( x + 1, y + i, x + w - 2 );
|
||||
|
||||
fl_color( shade_color( g[c[i] - 2], bc ) );
|
||||
fl_point( x, y + i + 1 );
|
||||
fl_point( x + w - 1, y + i + 1 );
|
||||
|
||||
// Draw the bottom line and points...
|
||||
fl_color( shade_color( g[c[clen - i]], bc ) );
|
||||
fl_xyline( x + 1, y + h - i, x + w - 2 );
|
||||
|
||||
fl_color( shade_color( g[c[clen - i] - 2], bc ) );
|
||||
fl_point( x, y + h - i );
|
||||
fl_point( x + w - 1, y + h - i );
|
||||
}
|
||||
|
||||
// Draw the interior and sides...
|
||||
i = chalf / cstep;
|
||||
|
||||
// fl_color( shade_color( g[c[chalf]], bc ) );
|
||||
fl_color( bc );
|
||||
fl_rectf( x + 1, y + i, w - 2, h - 2 * i + 1 );
|
||||
|
||||
fl_color( shade_color( g[c[chalf] - 2], bc ) );
|
||||
fl_yxline( x, y + i, y + h - i );
|
||||
fl_yxline( x + w - 1, y + i, y + h - i );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vertical shading...
|
||||
if ( clen >= w )
|
||||
cstep = 2;
|
||||
|
||||
for ( i = 0, j = 0; j < chalf; i++, j += cstep )
|
||||
{
|
||||
// Draw the left line and points...
|
||||
fl_color( shade_color( g[c[i]], bc ) );
|
||||
fl_yxline( x + i, y + 1, y + h - 1 );
|
||||
|
||||
fl_color( shade_color( g[c[i] - 2], bc ) );
|
||||
fl_point( x + i + 1, y );
|
||||
fl_point( x + i + 1, y + h );
|
||||
|
||||
// Draw the right line and points...
|
||||
fl_color( shade_color( g[c[clen - i]], bc ) );
|
||||
fl_yxline( x + w - 1 - i, y + 1, y + h - 1 );
|
||||
|
||||
fl_color( shade_color( g[c[clen - i] - 2], bc ) );
|
||||
fl_point( x + w - 2 - i, y );
|
||||
fl_point( x + w - 2 - i, y + h );
|
||||
}
|
||||
|
||||
// Draw the interior, top, and bottom...
|
||||
i = chalf / cstep;
|
||||
|
||||
fl_color( shade_color( g[c[chalf]], bc ) );
|
||||
fl_rectf( x + i, y + 1, w - 2 * i, h - 1 );
|
||||
|
||||
fl_color( shade_color( g[c[chalf] - 2], bc ) );
|
||||
fl_xyline( x + i, y, x + w - i );
|
||||
fl_xyline( x + i, y + h, x + w - i );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shade_round ( int x, int y, int w, int h, const char *c, Fl_Color bc )
|
||||
{
|
||||
uchar *g = fl_gray_ramp();
|
||||
int i;
|
||||
int clen = strlen( c ) - 1;
|
||||
int chalf = clen / 2;
|
||||
|
||||
if ( w > h )
|
||||
{
|
||||
int d = h / 2;
|
||||
const int na = 8;
|
||||
for ( i = 0; i < chalf; i++, d--, x++, y++, w -= 2, h -= 2 )
|
||||
{
|
||||
fl_color( shade_color( g[c[i]], bc ) );
|
||||
fl_pie( x, y, h, h, 90.0, 135.0 + i * na );
|
||||
fl_xyline( x + d, y, x + w - d );
|
||||
fl_pie( x + w - h, y, h, h, 45.0 + i * na, 90.0 );
|
||||
fl_color( shade_color( g[c[i] - 2], bc ) );
|
||||
fl_pie( x + w - h, y, h, h, 315.0 + i * na, 405.0 + i * na );
|
||||
fl_color( shade_color( g[c[clen - i]], bc ) );
|
||||
fl_pie( x + w - h, y, h, h, 270.0, 315.0 + i * na );
|
||||
fl_xyline( x + d, y + h - 1, x + w - d );
|
||||
fl_pie( x, y, h, h, 225.0 + i * na, 270.0 );
|
||||
fl_color( shade_color( g[c[clen - i] - 2], bc ) );
|
||||
fl_pie( x, y, h, h, 135.0 + i * na, 225.0 + i * na );
|
||||
|
||||
|
||||
}
|
||||
// fl_color( shade_color( g[c[chalf]], bc ) );
|
||||
fl_color( bc );
|
||||
fl_rectf( x + d, y, w - h + 1, h + 1 );
|
||||
fl_pie( x, y, h, h, 90.0, 270.0 );
|
||||
fl_pie( x + w - h, y, h, h, 270.0, 90.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
int d = w / 2;
|
||||
const int na = 8;
|
||||
for ( i = 0; i < chalf; i++, d--, x++, y++, w -= 2, h -= 2 )
|
||||
{
|
||||
fl_color( shade_color( g[c[i]], bc ) );
|
||||
fl_pie( x, y, w, w, 45.0 + i * na, 135.0 + i * na );
|
||||
fl_color( shade_color( g[c[i] - 2], bc ) );
|
||||
fl_pie( x, y, w, w, 0.0, 45.0 + i * na );
|
||||
fl_yxline( x + w - 1, y + d, y + h - d );
|
||||
fl_pie( x, y + h - w, w, w, 315.0 + i * na, 360.0 );
|
||||
fl_color( shade_color( g[c[clen - i]], bc ) );
|
||||
fl_pie( x, y + h - w, w, w, 225.0 + i * na, 315.0 + i * na );
|
||||
fl_color( shade_color( g[c[clen - i] - 2], bc ) );
|
||||
fl_pie( x, y + h - w, w, w, 180.0, 225.0 + i * na );
|
||||
fl_yxline( x, y + d, y + h - d );
|
||||
fl_pie( x, y, w, w, 135.0 + i * na, 180.0 );
|
||||
}
|
||||
// fl_color( shade_color( g[c[chalf]], bc ) );
|
||||
fl_color( bc );
|
||||
fl_rectf( x, y + d, w + 1, h - w + 1 );
|
||||
fl_pie( x, y, w, w, 0.0, 180.0 );
|
||||
fl_pie( x, y + h - w, w, w, 180.0, 360.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
up_frame ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
frame_rect( x, y, w, h - 1, "KLDIIJLM", c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
narrow_thin_box ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
if ( h <= 0 || w <= 0 )
|
||||
return;
|
||||
uchar *g = fl_gray_ramp();
|
||||
fl_color( shade_color( g['R'], c ) );
|
||||
fl_rectf( x + 1, y + 1, w - 2, h - 2 );
|
||||
fl_color( shade_color( g['I'], c ) );
|
||||
if ( w > 1 )
|
||||
{
|
||||
fl_xyline( x + 1, y, x + w - 2 );
|
||||
fl_xyline( x + 1, y + h - 1, x + w - 2 );
|
||||
}
|
||||
if ( h > 1 )
|
||||
{
|
||||
fl_yxline( x, y + 1, y + h - 2 );
|
||||
fl_yxline( x + w - 1, y + 1, y + h - 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
thin_up_box ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
if ( w > 4 && h > 4 )
|
||||
{
|
||||
shade_rect( x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c );
|
||||
frame_rect( x, y, w, h - 1, "IJLM", c );
|
||||
}
|
||||
else
|
||||
narrow_thin_box( x, y, w, h, c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
up_box ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
if ( w > 8 && h > 8 )
|
||||
{
|
||||
shade_rect( x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c );
|
||||
// shade_rect( x + 1, y + 1, w - 2, h - 3, "STUVWVQRWXVUVVQ", c );
|
||||
// shade_rect( x + 1, y + 1, w - 2, h - 3, "FISPPQQRSSTTUPJ", c );
|
||||
|
||||
frame_rect( x, y, w, h - 1, "IJLM", c );
|
||||
|
||||
}
|
||||
else
|
||||
thin_up_box( x, y, w, h, c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
up_round ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
shade_round( x, y, w, h, "RVQNOPQRSTUVWVQ", c );
|
||||
frame_round( x, y, w, h, "IJLM", c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
down_frame ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
frame_rect( x, y, w, h - 1, "LLLLTTRR", c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
down_box ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
if ( w > 6 && h > 6 )
|
||||
{
|
||||
// shade_rect( x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c );
|
||||
fl_rectf( x + 2, y + 2, w - 4, h - 5 , fl_darker( c ) );
|
||||
down_frame( x, y, w, h, c );
|
||||
}
|
||||
else
|
||||
{
|
||||
narrow_thin_box( x, y, w, h, c );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
down_round ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
shade_round( x, y, w, h, "STUVWWWVT", c );
|
||||
frame_round( x, y, w, h, "IJLM", c );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_theme ( void )
|
||||
{
|
||||
printf( "Initializing crystal boxtypes" );
|
||||
|
||||
/* replace the plastic boxes... (is there a better way?) */
|
||||
Fl::set_boxtype( FL_UP_BOX, up_box, 4,4,8,8 );
|
||||
Fl::set_boxtype( FL_DOWN_BOX, down_box, 2,2,4,4 );
|
||||
Fl::set_boxtype( FL_UP_FRAME, up_frame, 2,2,4,4 );
|
||||
Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 2,2,4,4 );
|
||||
Fl::set_boxtype( FL_THIN_UP_BOX, thin_up_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_ROUND_UP_BOX, up_round, 1,1,2,2 );
|
||||
Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_round, 1,1,2,2 );
|
||||
}
|
||||
|
||||
void
|
||||
init_crystal_theme ( void )
|
||||
{
|
||||
Fl_Theme *t = new Fl_Theme( "Crystal", "", "", init_theme );
|
||||
|
||||
Fl_Theme::add( t );
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
void init_crystal_theme ( void );
|
332
FL/Fl_Arc_Dial.C
332
FL/Fl_Arc_Dial.C
|
@ -1,332 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
|
||||
#include "Fl_Arc_Dial.H"
|
||||
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
|
||||
int Fl_Arc_Dial::_default_style = Fl_Arc_Dial::PLASTIC_DIAL;
|
||||
|
||||
/** This simple box is suitable for use with knob-type widgets. It
|
||||
* comprises a border with shadow, and a cap with glare-lines akin
|
||||
* to those seen on burnished aluminum knobs. */
|
||||
static void
|
||||
burnished_oval_box ( int x, int y, int w, int h, Fl_Color c )
|
||||
{
|
||||
/* draw background */
|
||||
fl_color( fl_darker( c ) );
|
||||
fl_pie( x, y, w, h, 0, 360 );
|
||||
fl_color( fl_darker( fl_darker( c ) ) );
|
||||
fl_pie( x, y, w, h, 180 + 215, 180 + 45 );
|
||||
|
||||
/* shrink */
|
||||
x += 4;
|
||||
y += 4;
|
||||
w -= 7;
|
||||
h -= 7;
|
||||
|
||||
/* draw cap */
|
||||
fl_color( c );
|
||||
fl_pie( x, y, w, h, 0, 360 );
|
||||
|
||||
/* draw glare */
|
||||
|
||||
const int a1 = 10;
|
||||
const int a2 = 90;
|
||||
|
||||
fl_color( fl_color_average( FL_WHITE, c, 0.15f ) );
|
||||
fl_pie( x, y, w, h, a1, a2 );
|
||||
fl_pie( x, y, w, h, 180 + a1, 180 + a2 );
|
||||
fl_color( fl_color_average( FL_WHITE, c, 0.25f ) );
|
||||
|
||||
const int d = (a2 - a1) / 2;
|
||||
fl_pie( x, y, w, h, a1 + (d / 2), a2 - (d / 2) );
|
||||
fl_pie( x, y, w, h, 180 + a1 + (d / 2), 180 + a2 - (d / 2) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::draw_box ( void )
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
Fl_Arc_Dial::handle ( int m )
|
||||
{
|
||||
/* Fl_Dial and friends should really handle mousewheel, but they don't in FTLK1 */
|
||||
|
||||
switch ( m )
|
||||
{
|
||||
case FL_MOUSEWHEEL:
|
||||
{
|
||||
if ( this != Fl::belowmouse() )
|
||||
return 0;
|
||||
|
||||
int steps = 16;
|
||||
|
||||
if ( Fl::event_ctrl() )
|
||||
steps = 128;
|
||||
|
||||
float step = fabs( maximum() - minimum() ) / (float)steps;
|
||||
|
||||
float d = ((float)Fl::event_dy()) * step;
|
||||
|
||||
double v = value() + d;
|
||||
|
||||
if ( maximum() > minimum() )
|
||||
{
|
||||
if ( v < minimum() )
|
||||
v = minimum();
|
||||
else if ( v > maximum() )
|
||||
v = maximum();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v > minimum() )
|
||||
v = minimum();
|
||||
else if ( v < maximum() )
|
||||
v = maximum();
|
||||
}
|
||||
|
||||
value( v );
|
||||
do_callback();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int X, Y, S;
|
||||
|
||||
get_knob_dimensions ( &X, &Y, &S );
|
||||
|
||||
return Fl_Dial::handle( m, X, Y, S, S );
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::draw ( void )
|
||||
{
|
||||
int X, Y, S;
|
||||
|
||||
get_knob_dimensions ( &X, &Y, &S);
|
||||
|
||||
draw_box();
|
||||
draw_label();
|
||||
|
||||
double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();
|
||||
|
||||
if ( type() == ARC_DIAL )
|
||||
{
|
||||
/* fl_line_style( FL_SOLID, 0 ); */
|
||||
if ( type() == ARC_DIAL )
|
||||
fl_draw_box( FL_ROUNDED_BOX, X, Y, S, S, color() );
|
||||
|
||||
/* shrink a bit */
|
||||
X += S / 8.0;
|
||||
Y += S / 8.0;
|
||||
S -= S / 4;
|
||||
|
||||
fl_line_style( FL_SOLID, S / 6 );
|
||||
|
||||
/* background arc */
|
||||
fl_color( fl_darker( color() ) );
|
||||
fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() );
|
||||
|
||||
/* foreground arc */
|
||||
fl_color( selection_color() );
|
||||
fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle );
|
||||
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
|
||||
fl_color( fl_contrast( labelcolor(), color() ) );
|
||||
}
|
||||
else if ( type() == PLASTIC_DIAL || type() == BURNISHED_DIAL )
|
||||
{
|
||||
draw_knob();
|
||||
|
||||
draw_cursor( X, Y, S);
|
||||
}
|
||||
|
||||
/* Some strange bug in FLTK prevents us from always been able to draw text
|
||||
* here, so don't even try for now. */
|
||||
/* char s[10]; */
|
||||
|
||||
/* fl_font( FL_HELVETICA, 8 ); */
|
||||
|
||||
/* snprintf( s, sizeof( s ), "%.1f", value() ); */
|
||||
|
||||
/* /\* fl_rectf( X, Y + S, S, 14, FL_BACKGROUND2_COLOR ); *\/ */
|
||||
/* fl_color( FL_WHITE ); */
|
||||
/* fl_draw( s, X, Y + S, S, 14, FL_ALIGN_CENTER ); */
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::get_knob_dimensions ( int *X, int *Y, int *S )
|
||||
{
|
||||
int ox, oy, ww, hh, side;
|
||||
ox = x();
|
||||
oy = y();
|
||||
ww = w();
|
||||
hh = h();
|
||||
|
||||
if (ww > hh)
|
||||
{
|
||||
side = hh;
|
||||
ox = ox + (ww - side) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
side = ww;
|
||||
oy = oy + (hh - side) / 2;
|
||||
}
|
||||
side = w() > h() ? hh : ww;
|
||||
|
||||
*X = ox;
|
||||
*Y = oy;
|
||||
*S = side;
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::draw_cursor ( int ox, int oy, int side )
|
||||
{
|
||||
double angle;
|
||||
|
||||
// fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .7f));
|
||||
|
||||
angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();
|
||||
|
||||
fl_color( fl_contrast( selection_color(), FL_BACKGROUND_COLOR ) );
|
||||
|
||||
fl_line_style( FL_SOLID, side / 8 );
|
||||
|
||||
const int d = 6;
|
||||
|
||||
/* account for edge conditions */
|
||||
angle = angle < angle1() + d ? angle1() + d : angle;
|
||||
angle = angle > angle2() - d ? angle2() - d : angle;
|
||||
|
||||
ox += side / 4;
|
||||
oy += side / 4;
|
||||
side -= side / 2;
|
||||
|
||||
fl_arc( ox, oy, side, side, 270 - (angle - d), 270 - (angle + d) );
|
||||
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::draw_knob ( void )
|
||||
{
|
||||
int ox, oy, ww, hh, side;
|
||||
|
||||
get_knob_dimensions ( &ox, &oy, &side );
|
||||
|
||||
ww = w();
|
||||
hh = h();
|
||||
draw_label();
|
||||
fl_clip(ox, oy, ww, hh);
|
||||
|
||||
|
||||
// background
|
||||
/* fl_color(FL_BACKGROUND_COLOR); */
|
||||
/* fl_rectf(ox, oy, side, side); */
|
||||
|
||||
/* scale color */
|
||||
fl_color(fl_color_average(color(), FL_BACKGROUND2_COLOR, .6));
|
||||
|
||||
fl_pie(ox + 1, oy + 3, side - 2, side - 12, 0, 360);
|
||||
// scale
|
||||
draw_scale(ox, oy, side);
|
||||
|
||||
Fl_Color c = active_r() ? fl_color_average(FL_BACKGROUND_COLOR, FL_WHITE, .7) : FL_INACTIVE_COLOR;
|
||||
|
||||
if ( type() == BURNISHED_DIAL )
|
||||
{
|
||||
burnished_oval_box( ox + 5, oy + 5, side - 12, side - 12, c );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_pie(ox + 6, oy + 6, side - 12, side - 12, 0, 360);
|
||||
|
||||
// shadow
|
||||
|
||||
fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .8f));
|
||||
fl_pie(ox + 8, oy + 12, side - 16, side - 16, 0, 360);
|
||||
fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_BLACK, .2f));
|
||||
fl_pie(ox + 9, oy + 12, side - 18, side - 18, 0, 360);
|
||||
|
||||
// knob edge
|
||||
fl_color( c);
|
||||
|
||||
|
||||
fl_pie(ox + 8, oy + 8, side - 16, side - 16, 0, 360);
|
||||
|
||||
fl_color(fl_color_average(FL_BACKGROUND_COLOR, FL_WHITE, .6));
|
||||
fl_pie(ox + 10, oy + 10, side - 20, side - 20, 0, 360);
|
||||
|
||||
}
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::draw_scale ( int ox, int oy, int side )
|
||||
{
|
||||
float x1, y1, x2, y2, rds, cx, cy, ca, sa;
|
||||
rds = side / 2;
|
||||
cx = ox + side / 2;
|
||||
cy = oy + side / 2;
|
||||
if (_scaleticks == 0)
|
||||
return;
|
||||
double a_step = (10.0 * 3.14159 / 6.0) / _scaleticks;
|
||||
double a_orig = -(3.14159 / 3.0);
|
||||
for (int a = 0; a <= _scaleticks; a++)
|
||||
{
|
||||
double na = a_orig + a * a_step;
|
||||
ca = cos(na);
|
||||
sa = sin(na);
|
||||
x1 = cx + (rds) * ca;
|
||||
y1 = cy - (rds) * sa;
|
||||
x2 = cx + (rds - 6) * ca;
|
||||
y2 = cy - (rds - 6) * sa;
|
||||
fl_color(FL_BACKGROUND_COLOR);
|
||||
fl_line(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Arc_Dial::scaleticks ( int tck )
|
||||
{
|
||||
_scaleticks = tck;
|
||||
if (_scaleticks < 0)
|
||||
_scaleticks = 0;
|
||||
if (_scaleticks > 31)
|
||||
_scaleticks = 31;
|
||||
if (visible())
|
||||
damage(FL_DAMAGE_ALL);
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
/* simple stylistic variation on Fl_Dial */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FL/Fl_Dial.H>
|
||||
|
||||
class Fl_Arc_Dial : public Fl_Dial
|
||||
{
|
||||
static int _default_style;
|
||||
|
||||
int _scaleticks;
|
||||
|
||||
void draw_knob ( void );
|
||||
void draw_scale ( int ox, int oy, int side );
|
||||
void draw_cursor ( int ox, int oy, int sidei );
|
||||
|
||||
void get_knob_dimensions ( int *X, int *Y, int *S );
|
||||
|
||||
protected:
|
||||
|
||||
virtual int handle ( int );
|
||||
virtual void draw ( void );
|
||||
virtual void draw_box ( void );
|
||||
|
||||
public:
|
||||
|
||||
void scaleticks ( int tck );
|
||||
|
||||
int
|
||||
type ( void ) const
|
||||
{
|
||||
if ( Fl_Dial::type() == DEFAULT )
|
||||
return Fl_Arc_Dial::_default_style;
|
||||
else
|
||||
return Fl_Dial::type();
|
||||
}
|
||||
|
||||
void type ( int n )
|
||||
{
|
||||
Fl_Dial::type( n );
|
||||
}
|
||||
|
||||
static void default_style ( int n ) { Fl_Arc_Dial::_default_style = n; }
|
||||
|
||||
enum
|
||||
{
|
||||
DEFAULT,
|
||||
BURNISHED_DIAL,
|
||||
ARC_DIAL,
|
||||
PLASTIC_DIAL
|
||||
};
|
||||
|
||||
|
||||
Fl_Arc_Dial ( int X, int Y, int W, int H, const char *L = 0 ) :
|
||||
Fl_Dial( X, Y, W, H, L )
|
||||
{
|
||||
_scaleticks = 12;
|
||||
|
||||
box( FL_NO_BOX );
|
||||
type( DEFAULT );
|
||||
}
|
||||
|
||||
};
|
233
FL/Fl_Theme.C
233
FL/Fl_Theme.C
|
@ -1,233 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
#include "FL/Fl_Theme.H"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Preferences.H>
|
||||
|
||||
Fl_Theme *Fl_Theme::first;
|
||||
Fl_Theme *Fl_Theme::_current;
|
||||
Fl_Color_Scheme *Fl_Color_Scheme::first;
|
||||
|
||||
int Fl_Theme::total;
|
||||
int Fl_Color_Scheme::total;
|
||||
|
||||
void
|
||||
Fl_Theme::add ( Fl_Theme *t )
|
||||
{
|
||||
t->next = first;
|
||||
first = t;
|
||||
total++;
|
||||
}
|
||||
|
||||
Fl_Theme **
|
||||
Fl_Theme::get ( void )
|
||||
{
|
||||
Fl_Theme **r = (Fl_Theme**) malloc( sizeof( Fl_Theme* ) * ( total + 1 ) );
|
||||
|
||||
int i = 0;
|
||||
for ( Fl_Theme *t = first; t; t = t->next, i++ )
|
||||
r[i] = t;
|
||||
|
||||
r[i] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
Fl_Preferences *prefs ( void )
|
||||
{
|
||||
char *path;
|
||||
|
||||
asprintf( &path, "%s/.config/ntk/", getenv("HOME" ) );
|
||||
|
||||
Fl_Preferences *p = new Fl_Preferences( path, "ntk", "theme" );
|
||||
|
||||
free( path );
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static void conf_set ( const char *key, const char *value )
|
||||
{
|
||||
Fl_Preferences *p = prefs();
|
||||
|
||||
p->set( key, value );
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
||||
static void conf_set ( const char *key, Fl_Color value )
|
||||
{
|
||||
Fl_Preferences *p = prefs();
|
||||
|
||||
p->set( key, (int)value );
|
||||
|
||||
delete p;
|
||||
}
|
||||
|
||||
static const char *conf_get ( const char *key, const char *def )
|
||||
{
|
||||
static char buf[256];
|
||||
|
||||
Fl_Preferences *p = prefs();
|
||||
|
||||
p->get( key, buf, def, sizeof( buf ) );
|
||||
|
||||
delete p;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static
|
||||
Fl_Color
|
||||
conf_get_color ( const char *key, Fl_Color def )
|
||||
{
|
||||
Fl_Preferences *p = prefs();
|
||||
|
||||
int c;
|
||||
|
||||
p->get( key, c, def );
|
||||
|
||||
delete p;
|
||||
|
||||
return (Fl_Color)c;
|
||||
}
|
||||
|
||||
static bool dont_save = false;
|
||||
|
||||
/* sets the configured default */
|
||||
int
|
||||
Fl_Theme::set ( void )
|
||||
{
|
||||
const char *name = conf_get( "theme", "clean" );
|
||||
|
||||
int rv = set( name );
|
||||
|
||||
dont_save = true;
|
||||
|
||||
Fl_Color_Scheme::set( "System" );
|
||||
|
||||
dont_save = false;
|
||||
|
||||
uchar r, g, b;
|
||||
|
||||
Fl::get_color( conf_get_color( "background", FL_BACKGROUND_COLOR ), r, g, b );
|
||||
Fl::background( r, g, b );
|
||||
Fl::get_color( conf_get_color( "background2", FL_BACKGROUND2_COLOR ), r, g, b );
|
||||
Fl::background2( r, g, b );
|
||||
Fl::get_color( conf_get_color( "foreground", FL_FOREGROUND_COLOR ), r, g, b );
|
||||
Fl::foreground( r, g, b );
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
Fl_Theme::set ( const char *name )
|
||||
{
|
||||
for ( Fl_Theme *t = first; t; t = t->next )
|
||||
if ( !strcasecmp( t->name(), name ) )
|
||||
{
|
||||
/* reset boxtypes */
|
||||
Fl::reload_scheme();
|
||||
|
||||
printf( "Theme set to %s\n", t->name() );
|
||||
t->_init_func();
|
||||
Fl_Theme::_current = t;
|
||||
|
||||
conf_set( "theme", t->name() );
|
||||
|
||||
for ( Fl_Window *w = Fl::first_window(); w; w = Fl::next_window( w ) )
|
||||
w->redraw();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Color_Scheme::add ( Fl_Color_Scheme *t )
|
||||
{
|
||||
t->next = first;
|
||||
first = t;
|
||||
total++;
|
||||
}
|
||||
|
||||
Fl_Color_Scheme **
|
||||
Fl_Color_Scheme::get ( void )
|
||||
{
|
||||
Fl_Color_Scheme **r = (Fl_Color_Scheme**) malloc( sizeof( Fl_Color_Scheme* ) * ( total + 1 ) );
|
||||
|
||||
int i = 0;
|
||||
for ( Fl_Color_Scheme *t = first; t; t = t->next, i++ )
|
||||
r[i] = t;
|
||||
|
||||
r[i] = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
Fl_Color_Scheme::save ( void )
|
||||
{
|
||||
if ( ! dont_save )
|
||||
{
|
||||
conf_set( "background", Fl::get_color( FL_BACKGROUND_COLOR ) );
|
||||
conf_set( "foreground", Fl::get_color( FL_FOREGROUND_COLOR ) );
|
||||
conf_set( "background2", Fl::get_color( FL_BACKGROUND2_COLOR ) );
|
||||
}
|
||||
|
||||
for ( Fl_Window *w = Fl::first_window(); w; w = Fl::next_window( w ) )
|
||||
w->redraw();
|
||||
}
|
||||
|
||||
int
|
||||
Fl_Color_Scheme::set ( const char *name )
|
||||
{
|
||||
for ( Fl_Color_Scheme *t = first; t; t = t->next )
|
||||
if ( !strcasecmp( t->name(), name ) )
|
||||
{
|
||||
uchar r, g, b;
|
||||
|
||||
Fl::get_color( t->_bg, r, g, b );
|
||||
Fl::background( r, g, b );
|
||||
Fl::get_color( t->_bg2, r, g, b );
|
||||
Fl::background2( r, g, b );
|
||||
Fl::get_color( t->_fg, r, g, b );
|
||||
Fl::foreground( r, g, b );
|
||||
/* Fl::get_color( t->_sel, r, g, b ); */
|
||||
/* Fl::selection( r, g, b ); */
|
||||
|
||||
conf_set( "color_scheme", t->name() );
|
||||
|
||||
save();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
120
FL/Fl_Theme.H
120
FL/Fl_Theme.H
|
@ -1,120 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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.H>
|
||||
|
||||
/* class Fl_Theme */
|
||||
/* { */
|
||||
|
||||
/* public: */
|
||||
|
||||
/* virtual const char *name ( void ) const = 0; */
|
||||
/* virtual const char *author ( void ) const = 0; */
|
||||
/* virtual const char *description ( void ) const = 0; */
|
||||
|
||||
/* virtual void up_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void down_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void thin_up_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void thin_down_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void round_up_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void round_down_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void rounded_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void oval_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void shadow_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void rshadow_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void diamond_box ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void check_on ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void check_off ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void radio_on ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void radio_off ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
|
||||
/* virtual void up_frame ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
/* virtual void down_frame ( int X, int Y, int W, int H, Fl_Color c ) = 0; */
|
||||
|
||||
/* }; */
|
||||
|
||||
class Fl_Color_Scheme
|
||||
{
|
||||
Fl_Color_Scheme *next;
|
||||
static int total;
|
||||
static Fl_Color_Scheme *first;
|
||||
|
||||
Fl_Color _bg;
|
||||
Fl_Color _bg2;
|
||||
Fl_Color _fg;
|
||||
Fl_Color _sel;
|
||||
|
||||
const char *_name;
|
||||
|
||||
public:
|
||||
|
||||
const char *name ( void ) const { return _name; }
|
||||
|
||||
Fl_Color_Scheme ( const char *name, Fl_Color background, Fl_Color background2, Fl_Color foreground, Fl_Color selection )
|
||||
{
|
||||
_bg = background;
|
||||
_bg2 = background2;
|
||||
_fg = foreground;
|
||||
_sel = selection;
|
||||
_name = name;
|
||||
|
||||
}
|
||||
|
||||
static void add ( Fl_Color_Scheme *td );
|
||||
static Fl_Color_Scheme **get ( void );
|
||||
static int set ( const char *name );
|
||||
static void save ( void );
|
||||
};
|
||||
|
||||
|
||||
class Fl_Theme
|
||||
{
|
||||
Fl_Theme *next;
|
||||
static int total;
|
||||
static Fl_Theme *first;
|
||||
static Fl_Theme *_current;
|
||||
|
||||
const char *_name;
|
||||
const char *_description;
|
||||
const char *_author;
|
||||
|
||||
void (*_init_func)(void);
|
||||
|
||||
public:
|
||||
|
||||
const char *name ( void ) const { return _name; }
|
||||
const char *description ( void ) { return _description; }
|
||||
const char *author ( void ) { return _author; }
|
||||
|
||||
Fl_Theme( const char *name, const char *description, const char *author, void (*init_func)(void) )
|
||||
{
|
||||
_name = name;
|
||||
_description = description;
|
||||
_author = author;
|
||||
_init_func = init_func;
|
||||
}
|
||||
|
||||
static void add ( Fl_Theme *td );
|
||||
static Fl_Theme **get ( void );
|
||||
static int set ( void );
|
||||
static int set ( const char *name );
|
||||
static const Fl_Theme *current ( void ) { return _current; }
|
||||
};
|
|
@ -1,180 +0,0 @@
|
|||
# data file for the Fltk User Interface Designer (fluid)
|
||||
version 1.0300
|
||||
header_name {.H}
|
||||
code_name {.C}
|
||||
decl {\#include "FL/Fl_Theme.H"} {public global
|
||||
}
|
||||
|
||||
decl {\#include <FL/Fl_Button.H>} {public global
|
||||
}
|
||||
|
||||
decl {\#include <FL/Fl_Color_Chooser.H>} {private local
|
||||
}
|
||||
|
||||
decl {\#include <FL/Fl_Double_Window.H>} {private local
|
||||
}
|
||||
|
||||
class Fl_Color_Button {open : {public Fl_Button}
|
||||
} {
|
||||
Function {Fl_Color_Button( int X, int Y, int W, int H, const char *L = 0 ) : Fl_Button( X, Y, W, H, L )} {open
|
||||
} {
|
||||
code {} {}
|
||||
}
|
||||
Function {handle( int m )} {open return_type int
|
||||
} {
|
||||
code {switch ( m )
|
||||
{
|
||||
case FL_PUSH:
|
||||
{
|
||||
uchar r, g, b;
|
||||
|
||||
Fl::get_color( color(), r, g, b );
|
||||
|
||||
fl_color_chooser( label(), r, g, b );
|
||||
|
||||
color( fl_rgb_color( r, g, b ) );
|
||||
|
||||
do_callback();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Fl_Button::handle( m );} {}
|
||||
}
|
||||
}
|
||||
|
||||
widget_class Fl_Theme_Chooser {
|
||||
label Theme open
|
||||
xywh {560 246 435 380} type Double
|
||||
class Fl_Double_Window visible
|
||||
} {
|
||||
Fl_Choice theme_choice {
|
||||
label {Theme:}
|
||||
callback {Fl_Theme::set( o->mvalue()->label() );
|
||||
|
||||
redraw();} open
|
||||
xywh {120 20 300 25} down_box BORDER_BOX
|
||||
} {}
|
||||
Fl_Choice color_scheme_choice {
|
||||
label {Color Scheme:}
|
||||
callback {Fl_Color_Scheme::set( o->mvalue()->label() );
|
||||
|
||||
redraw();} open
|
||||
xywh {120 48 300 25} down_box BORDER_BOX
|
||||
} {}
|
||||
Fl_Return_Button {} {
|
||||
label OK
|
||||
callback {hide();} selected
|
||||
xywh {355 345 75 25}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label Example open
|
||||
xywh {5 215 425 120} box ENGRAVED_FRAME
|
||||
} {
|
||||
Fl_Scrollbar {} {
|
||||
label {Scroll Bar}
|
||||
xywh {155 240 265 25} type Horizontal align 1
|
||||
}
|
||||
Fl_Check_Button {} {
|
||||
label {Check Button}
|
||||
xywh {15 230 120 15} down_box DOWN_BOX
|
||||
}
|
||||
Fl_Dial {} {
|
||||
label Dial
|
||||
xywh {155 275 35 35}
|
||||
}
|
||||
Fl_Progress {} {
|
||||
label Progress
|
||||
xywh {240 300 185 30}
|
||||
code0 {o->value( 0.50 );}
|
||||
}
|
||||
Fl_Light_Button {} {
|
||||
label {Light Button}
|
||||
xywh {15 285 120 35}
|
||||
}
|
||||
}
|
||||
Fl_Button background_color_button {
|
||||
label {Background 1:}
|
||||
callback {uchar r,g,b;
|
||||
|
||||
Fl::get_color( o->color(), r,g,b );
|
||||
|
||||
Fl::background( r,g,b );
|
||||
|
||||
o->window()->redraw();
|
||||
|
||||
Fl_Color_Scheme::save();}
|
||||
xywh {120 76 300 25} box BORDER_BOX align 4 when 6
|
||||
code0 {\#include <FL/fl_ask.H>}
|
||||
code1 {o->color( FL_BACKGROUND_COLOR );}
|
||||
class Fl_Color_Button
|
||||
}
|
||||
Fl_Button background2_color_button {
|
||||
label {Background 2:}
|
||||
callback {uchar r,g,b;
|
||||
|
||||
Fl::get_color( o->color(), r,g,b );
|
||||
|
||||
Fl::background2( r,g,b );
|
||||
|
||||
o->window()->redraw();
|
||||
|
||||
Fl_Color_Scheme::save();}
|
||||
xywh {120 104 300 25} box BORDER_BOX align 4
|
||||
code1 {o->color( FL_BACKGROUND2_COLOR );}
|
||||
class Fl_Color_Button
|
||||
}
|
||||
Fl_Button foreground_color_button {
|
||||
label {Foreground:}
|
||||
callback {uchar r,g,b;
|
||||
|
||||
Fl::get_color( o->color(), r,g,b );
|
||||
|
||||
Fl::foreground( r,g,b );
|
||||
|
||||
o->window()->redraw();
|
||||
|
||||
Fl_Color_Scheme::save();}
|
||||
xywh {120 132 300 25} box BORDER_BOX align 4
|
||||
code1 {o->color( FL_FOREGROUND_COLOR );}
|
||||
class Fl_Color_Button
|
||||
}
|
||||
Fl_Button selection_color_button {
|
||||
label {Selection:}
|
||||
xywh {120 160 300 25} box BORDER_BOX align 4 hide
|
||||
class Fl_Color_Button
|
||||
}
|
||||
code {{
|
||||
Fl_Theme **ta = Fl_Theme::get();
|
||||
|
||||
for ( Fl_Theme **t = ta; *t; t++ )
|
||||
theme_choice->add( (*t)->name() );
|
||||
|
||||
free( ta );
|
||||
|
||||
const Fl_Menu_Item *item = theme_choice->find_item( Fl_Theme::current()->name() );
|
||||
|
||||
theme_choice->value( item );
|
||||
}
|
||||
|
||||
{
|
||||
Fl_Color_Scheme **ta = Fl_Color_Scheme::get();
|
||||
|
||||
for ( Fl_Color_Scheme **t = ta; *t; t++ )
|
||||
color_scheme_choice->add( (*t)->name() );
|
||||
|
||||
free( ta );
|
||||
}} {}
|
||||
}
|
||||
|
||||
Function {fl_theme_chooser()} {open C return_type void
|
||||
} {
|
||||
code {Fl_Window *w = new Fl_Theme_Chooser();
|
||||
|
||||
w->end();
|
||||
w->show();
|
||||
|
||||
while( w->shown() )
|
||||
Fl::check();} {}
|
||||
}
|
169
FL/Gleam_Theme.C
169
FL/Gleam_Theme.C
|
@ -1,169 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 Jonathan Moore Liles */
|
||||
/* Copyright (C) 2001-2005 by Colin Jones */
|
||||
/* */
|
||||
/* 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Taken from the "Gleam" FLTK scheme, as modified by prodatum */
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
#include "FL/Fl_Theme.H"
|
||||
|
||||
static void gleam_color(Fl_Color c)
|
||||
{
|
||||
if (Fl::draw_box_active())
|
||||
fl_color(c);
|
||||
else
|
||||
fl_color(fl_inactive(c));
|
||||
}
|
||||
static void frame_rect(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
|
||||
// Draw the outline around the perimeter of the box
|
||||
fl_color(fl_color_average(FL_BLACK, FL_BACKGROUND_COLOR, .1));
|
||||
fl_line(x, y, x + w, y);
|
||||
fl_line(x + w, y, x + w, y + h);
|
||||
fl_line(x + w, y + h, x, y + h);
|
||||
fl_line(x, y + h, x, y);
|
||||
|
||||
}
|
||||
|
||||
static void shade_rect_up(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
// Draws the shiny
|
||||
float third = (float) h / 3;
|
||||
gleam_color(bc);
|
||||
fl_rectf(x, y, w, third + 1);
|
||||
|
||||
//gleam_color(fl_color_average(bc, FL_WHITE, .90f));
|
||||
//fl_rectf(x, y, w, half + 1);
|
||||
|
||||
float step_size = 0.10 / ((float) h - third);
|
||||
int j = 0;
|
||||
//step_size = (.1 / (float) half);
|
||||
//printf("1 / %i = %f \n", half, (1.0/half));
|
||||
|
||||
/**
|
||||
* This loop generates the nice gradient at the bottom of the
|
||||
* widget
|
||||
**/
|
||||
for (float k = 1; k >= .90; k -= step_size)
|
||||
{
|
||||
j++;
|
||||
gleam_color(fl_color_average(bc, FL_WHITE, k));
|
||||
fl_line(x, y + j + third - 1, x + w - 1, y + j + third - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void frame_rect_up(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
|
||||
// Draw the outline around the perimeter of the box
|
||||
gleam_color(bc);
|
||||
fl_line(x, y, x + w, y); //Go across.
|
||||
fl_line(x, y + (h / 2), x, y + 1); //Go to top
|
||||
fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
|
||||
|
||||
gleam_color(fl_darker(bc));
|
||||
fl_line(x, y + h, x + w, y + h); //Go across again!
|
||||
fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
|
||||
fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
|
||||
|
||||
}
|
||||
|
||||
static void frame_rect_down(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
|
||||
// Draw the outline around the perimeter of the box
|
||||
gleam_color(fl_darker(bc));
|
||||
fl_line(x, y, x + w, y); //Go across.
|
||||
fl_line(x, y + (h / 2), x, y + 1); //Go to top
|
||||
fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
|
||||
|
||||
//gleam_color(bc);
|
||||
fl_line(x, y + h, x + w, y + h); //Go across again!
|
||||
fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
|
||||
fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
|
||||
|
||||
}
|
||||
|
||||
static void shade_rect_down(int x, int y, int w, int h, Fl_Color bc)
|
||||
{
|
||||
|
||||
gleam_color(bc);
|
||||
Fl_Color color = fl_color();
|
||||
fl_rectf(x, y, w, h);
|
||||
gleam_color(fl_color_average(bc, fl_darker(color), 0.65));
|
||||
fl_line(x, y + 1, x + w, y + 1);
|
||||
fl_line(x, y + 1, x, y + h - 2);
|
||||
gleam_color(fl_color_average(bc, fl_darker(color), 0.85));
|
||||
fl_line(x + 1, y + 2, x + w, y + 2);
|
||||
fl_line(x + 1, y + 2, x + 1, y + h - 2);
|
||||
|
||||
}
|
||||
|
||||
static void up_frame(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
|
||||
}
|
||||
|
||||
static void up_box(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
shade_rect_up(x + 1, y, w - 2, h - 1, c);
|
||||
frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
|
||||
//draw the inner rect.
|
||||
frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f));
|
||||
|
||||
}
|
||||
|
||||
static void down_frame(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
frame_rect_down(x, y, w - 1, h - 1, fl_darker(c));
|
||||
}
|
||||
|
||||
static void down_box(int x, int y, int w, int h, Fl_Color c)
|
||||
{
|
||||
shade_rect_down(x + 1, y, w - 2, h, c);
|
||||
down_frame(x, y, w, h, fl_darker(c));
|
||||
//draw the inner rect.
|
||||
//frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65));
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme ( void )
|
||||
{
|
||||
/* replace the gtk+ boxes... (is there a better way?) */
|
||||
Fl::set_boxtype( FL_UP_BOX, up_box, 2,2,4,4 );
|
||||
Fl::set_boxtype( FL_DOWN_BOX, down_box, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_THIN_UP_BOX, up_box, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_UP_FRAME, up_frame, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_ROUND_UP_BOX, up_box, 2,2,3,3 );
|
||||
Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_box, 2,2,3,3 );
|
||||
}
|
||||
|
||||
void
|
||||
init_gleam_theme ( void )
|
||||
{
|
||||
Fl_Theme *t = new Fl_Theme( "Gleam", "", "", init_theme );
|
||||
|
||||
Fl_Theme::add( t );
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
void init_gleam_theme ( void );
|
|
@ -11,7 +11,7 @@ SRCS:=$(SRCS:.fl=.C)
|
|||
SRCS:=$(sort $(SRCS))
|
||||
OBJS:=$(SRCS:.C=.o)
|
||||
|
||||
all: FL/libfl_widgets.a ntk-chtheme
|
||||
all: FL/libfl_widgets.a util/ntk-perf
|
||||
|
||||
FL/libfl_widgets.a: $(OBJS)
|
||||
@ ar rcs $@ $(OBJS)
|
||||
|
@ -19,7 +19,14 @@ FL/libfl_widgets.a: $(OBJS)
|
|||
.PHONEY: FL
|
||||
FL: FL/libfl_widgets.a
|
||||
|
||||
ntk-chtheme: ntk-chtheme.o $(FLTK_LIBS) FL/libfl_widgets.a
|
||||
# ntk-chtheme: ntk-chtheme.o $(FLTK_LIBS) FL/libfl_widgets.a
|
||||
# @ echo -n Linking session handler.
|
||||
# @ $(CXX) $(CXXFLAGS) $(FLTK_LDFLAGS) $(LIBS) $^ -o $@ -LFL -lfl_widgets && echo $(DONE)
|
||||
|
||||
|
||||
util/ntk-perf.o: util/ntk-perf.C
|
||||
|
||||
util/ntk-perf: util/ntk-perf.o $(FLTK_LIBS) FL/libfl_widgets.a
|
||||
@ echo -n Linking session handler.
|
||||
@ $(CXX) $(CXXFLAGS) $^ -o $@ $(FLTK_LDFLAGS) $(LIBS) -LFL -lfl_widgets && echo $(DONE)
|
||||
|
||||
|
|
82
FL/themes.H
82
FL/themes.H
|
@ -1,82 +0,0 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
#include "FL/Crystal_Theme.H"
|
||||
#include "FL/Gleam_Theme.H"
|
||||
#include "FL/Clean_Theme.H"
|
||||
|
||||
#include "FL/Fl_Theme.H"
|
||||
|
||||
void fl_register_themes ( void )
|
||||
{
|
||||
init_clean_theme();
|
||||
init_crystal_theme();
|
||||
init_gleam_theme();
|
||||
|
||||
{
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "Dark",
|
||||
fl_rgb_color( 50, 50, 50 ),
|
||||
fl_rgb_color( 100, 100, 100 ),
|
||||
fl_rgb_color( 255, 255, 255 ),
|
||||
FL_YELLOW );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
{
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "Darker",
|
||||
fl_rgb_color( 20, 20, 20 ),
|
||||
fl_rgb_color( 100, 100, 100 ),
|
||||
fl_rgb_color( 240, 240, 240 ),
|
||||
FL_YELLOW );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
{
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "Gray",
|
||||
fl_rgb_color( 100, 100, 100 ),
|
||||
fl_rgb_color( 127, 127, 127 ),
|
||||
fl_rgb_color( 255, 255, 255 ),
|
||||
FL_YELLOW );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
{
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "Black",
|
||||
fl_rgb_color( 0, 0, 0 ),
|
||||
fl_rgb_color( 20, 20, 20 ),
|
||||
fl_rgb_color( 240, 240, 240 ),
|
||||
FL_YELLOW );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
{
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "Light",
|
||||
fl_rgb_color( 220, 220, 220 ),
|
||||
fl_rgb_color( 192, 192, 192 ),
|
||||
fl_rgb_color( 0, 0, 0 ),
|
||||
FL_BLUE );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
{
|
||||
Fl::get_system_colors();
|
||||
|
||||
Fl_Color_Scheme *o = new Fl_Color_Scheme( "System",
|
||||
(Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR ),
|
||||
(Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR ),
|
||||
(Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR ),
|
||||
FL_BLUE );
|
||||
Fl_Color_Scheme::add( o );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
|
||||
/*******************************************************************************/
|
||||
/* Copyright (C) 2012 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. */
|
||||
/*******************************************************************************/
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Single_Window.H>
|
||||
#include <FL/Fl_Scalepack.H>
|
||||
#include <FL/Fl_Choice.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static Fl_Boxtype boxtype = FL_UP_BOX;
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
unsigned long long tv_to_ts ( timeval *tv )
|
||||
{
|
||||
return tv->tv_sec * 1e6 + tv->tv_usec;
|
||||
}
|
||||
|
||||
unsigned long long get_ts ( void )
|
||||
{
|
||||
struct timeval then;
|
||||
gettimeofday( &then, NULL );
|
||||
|
||||
return tv_to_ts( &then );
|
||||
}
|
||||
|
||||
class PerfTest : public Fl_Widget
|
||||
{
|
||||
public:
|
||||
|
||||
PerfTest ( int X, int Y, int W, int H, const char *L=0 ) : Fl_Widget( X, Y, W, H, L )
|
||||
{
|
||||
align(FL_ALIGN_TOP | FL_ALIGN_RIGHT |FL_ALIGN_INSIDE);
|
||||
box(FL_UP_BOX);
|
||||
labelcolor( FL_WHITE );
|
||||
use_cairo = false;
|
||||
}
|
||||
|
||||
|
||||
bool use_cairo;
|
||||
|
||||
void draw ( void )
|
||||
{
|
||||
if ( use_cairo )
|
||||
fl_push_use_cairo(true);
|
||||
|
||||
fl_rectf( x(), y(), w(), h(), FL_BLACK );
|
||||
|
||||
unsigned long long then = get_ts();
|
||||
|
||||
fl_push_clip( x(), y(), w(), h() );
|
||||
|
||||
int count = 400;
|
||||
|
||||
/* draw stuff */
|
||||
int i = 0;
|
||||
for ( ; i < count; ++i )
|
||||
fl_draw_box( boxtype, x(), y(), w(), h(), fl_lighter( FL_BLACK ) );
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
unsigned long long now = get_ts();
|
||||
|
||||
double elapsedms = (now - then) / 1000.0;
|
||||
|
||||
static char text[256];
|
||||
sprintf( text, "Drew %i boxes in in %fms", i, elapsedms );
|
||||
|
||||
fl_color( FL_RED );
|
||||
fl_draw( text, x(), y(), w(), h(), FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
|
||||
|
||||
draw_label();
|
||||
|
||||
if ( use_cairo )
|
||||
fl_pop_use_cairo();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
boxtype_cb ( Fl_Widget *w, void *v )
|
||||
{
|
||||
const char *picked = ((Fl_Choice*)w)->mvalue()->label();
|
||||
|
||||
if ( !strcmp( picked, "UP_BOX" ) )
|
||||
boxtype = FL_UP_BOX;
|
||||
else if ( !strcmp( picked, "FLAT_BOX" ) )
|
||||
boxtype = FL_FLAT_BOX;
|
||||
else if ( !strcmp( picked, "ROUNDED_BOX" ) )
|
||||
boxtype = FL_ROUNDED_BOX;
|
||||
else if ( !strcmp( picked, "OVAL_BOX" ) )
|
||||
boxtype = FL_OVAL_BOX;
|
||||
|
||||
w->window()->redraw();
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char **argv )
|
||||
{
|
||||
{
|
||||
Fl_Single_Window *w = new Fl_Single_Window( 800, 600 );
|
||||
|
||||
{ Fl_Choice *o = new Fl_Choice( 0, 0, 200, 24, "Boxtype" );
|
||||
o->align( FL_ALIGN_RIGHT );
|
||||
|
||||
o->callback( boxtype_cb, NULL );
|
||||
|
||||
o->add( "UP_BOX" );
|
||||
o->add( "FLAT_BOX" );
|
||||
o->add( "ROUNDED_BOX" );
|
||||
o->add( "OVAL_BOX" );
|
||||
}
|
||||
|
||||
{
|
||||
Fl_Scalepack *o = new Fl_Scalepack( 0, 24, 800, 600 - 24 );
|
||||
o->type( 0 );
|
||||
|
||||
{
|
||||
PerfTest *o = new PerfTest( 0,0, 800, 400, "Xlib" );
|
||||
}
|
||||
|
||||
{
|
||||
PerfTest *o = new PerfTest( 0,0, 800, 400, "Cairo" );
|
||||
o->use_cairo = true;
|
||||
}
|
||||
|
||||
o->end();
|
||||
}
|
||||
|
||||
w->end();
|
||||
w->show();
|
||||
}
|
||||
|
||||
/* { */
|
||||
/* Fl_Single_Window *w = new Fl_Single_Window( 800, 600 ); */
|
||||
|
||||
/* PerfTest *o = new PerfTest( 0,0, 800, 600 ); */
|
||||
|
||||
/* w->end(); */
|
||||
/* w->show(); */
|
||||
/* } */
|
||||
|
||||
Fl::run();
|
||||
}
|
|
@ -21,7 +21,7 @@ begin_tests
|
|||
require_command ar ar
|
||||
require_command makedepend makedepend
|
||||
require_FLTK 1.3.0 images
|
||||
require_command FLUID lib/fltk/fluid/fluid
|
||||
require_command FLUID lib/ntk/fluid/fluid
|
||||
require_package JACK 0.103.0 jack
|
||||
test_version `version_of jack` 0.105.0 || append "JACK_MIDI_PROTO_API=yes"
|
||||
require_package sndfile 1.0.17 sndfile
|
||||
|
|
28
lib/Makefile
28
lib/Makefile
|
@ -1,23 +1,23 @@
|
|||
|
||||
OBJS:= fltk/lib/libfltk.a fltk/lib/libfltk_images.a
|
||||
SRCS:= fltk/src/*.cpp fltk/FL/*.H
|
||||
OBJS:= ntk/lib/libntk.a ntk/lib/libntk_images.a
|
||||
SRCS:= ntk/src/*.cxx ntk/FL/*.H
|
||||
|
||||
$(SRCS): fltk/config.h
|
||||
@ echo Building FLTK
|
||||
cd fltk && make
|
||||
$(SRCS): ntk/config.h
|
||||
@ echo Building NTK
|
||||
cd ntk && make
|
||||
|
||||
$(OBJS): fltk/config.h $(SRCS)
|
||||
@ echo Building FLTK
|
||||
cd fltk && make
|
||||
$(OBJS): ntk/config.h $(SRCS)
|
||||
@ echo Building NTK
|
||||
cd ntk && make
|
||||
|
||||
config:
|
||||
@ echo Configuring FLTK
|
||||
cd fltk && ./configure --prefix=/dev/null --disable-shared --disable-gl --enable-threads --enable-xft --disable-xdbe --enable-xinerama
|
||||
ntk/config.h: Makefile
|
||||
@ echo Configuring NTK
|
||||
cd ntk && ./configure --prefix=/usr/local --enable-shared --disable-gl --enable-threads --enable-xft --enable-cairo --enable-cairoext --enable-xinerama
|
||||
|
||||
# config: $(OBJS)
|
||||
config: ntk/config.h
|
||||
|
||||
clean:
|
||||
|
||||
all: $(OBJS)
|
||||
@ echo Building FLTK
|
||||
cd fltk && make
|
||||
@ echo Building NTK
|
||||
cd ntk && make
|
||||
|
|
1
lib/fltk
1
lib/fltk
|
@ -1 +0,0 @@
|
|||
Subproject commit af74a40270f234be3c37f835202e75770f6656ae
|
|
@ -0,0 +1 @@
|
|||
Subproject commit b8cbf58019493b5871d5f04a7efa35547b4c6eb3
|
|
@ -17,7 +17,7 @@ begin_tests
|
|||
require_command ar ar
|
||||
require_command makedepend makedepend
|
||||
require_FLTK 1.3.0 images
|
||||
require_command FLUID lib/fltk/fluid/fluid
|
||||
require_command FLUID lib/ntk/fluid/fluid
|
||||
require_package JACK 0.103.0 jack
|
||||
require_package lrdf 0.4.0 lrdf
|
||||
require_package liblo 0.23 liblo
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <FL/Fl_Menu_.H>
|
||||
#include <FL/Fl_Light_Button.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include "FL/Fl_Arc_Dial.H"
|
||||
#include "FL/Fl_Dial.H"
|
||||
#include "FL/Fl_Labelpad_Group.H"
|
||||
#include "FL/Fl_Value_SliderX.H"
|
||||
#include "Panner.H"
|
||||
|
@ -381,7 +381,7 @@ Controller_Module::connect_to ( Port *p )
|
|||
}
|
||||
else
|
||||
{
|
||||
{ Fl_Arc_Dial *o = new Fl_Arc_Dial( 0, 0, 50, 50, p->name() );
|
||||
{ Fl_Dial *o = new Fl_Dial( 0, 0, 50, 50, p->name() );
|
||||
w = o;
|
||||
control = o;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <FL/Fl_Counter.H>
|
||||
#include <FL/Fl_Light_Button.H>
|
||||
|
||||
#include "FL/Fl_Arc_Dial.H"
|
||||
#include "FL/Fl_Dial.H"
|
||||
#include "FL/Fl_Labelpad_Group.H"
|
||||
#include "FL/Fl_Scalepack.H"
|
||||
|
||||
|
|
|
@ -277,17 +277,17 @@ void Mixer::cb_menu(Fl_Widget* o) {
|
|||
}
|
||||
else if (! strcmp( picked, "&Options/&Display/&Knobs/&Burnished") )
|
||||
{
|
||||
Fl_Arc_Dial::default_style( Fl_Arc_Dial::BURNISHED_DIAL );
|
||||
Fl_Dial::default_style( Fl_Dial::BURNISHED_DIAL );
|
||||
redraw_windows();
|
||||
}
|
||||
else if (! strcmp( picked, "&Options/&Display/&Knobs/&Arc") )
|
||||
{
|
||||
Fl_Arc_Dial::default_style( Fl_Arc_Dial::ARC_DIAL );
|
||||
Fl_Dial::default_style( Fl_Dial::ARC_DIAL );
|
||||
redraw_windows();
|
||||
}
|
||||
else if (! strcmp( picked, "&Options/&Display/&Knobs/&Plastic") )
|
||||
{
|
||||
Fl_Arc_Dial::default_style( Fl_Arc_Dial::PLASTIC_DIAL );
|
||||
Fl_Dial::default_style( Fl_Dial::PLASTIC_DIAL );
|
||||
redraw_windows();
|
||||
}
|
||||
else if (! strcmp( picked, "&Options/&Display/&Sliders/&Nice") )
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <FL/Fl_Scalepack.H>
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/Fl_Flip_Button.H>
|
||||
#include <FL/Fl_Arc_Dial.H>
|
||||
#include <FL/Fl_Dial.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/*******************************************************************************/
|
||||
|
||||
#include <FL/Fl.H>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -30,7 +32,7 @@
|
|||
#include "FL/Fl_Flowpack.H"
|
||||
#include "FL/Fl_Labelpad_Group.H"
|
||||
#include "FL/Fl_Value_SliderX.H"
|
||||
#include "FL/Fl_Arc_Dial.H"
|
||||
#include "FL/Fl_Dial.H"
|
||||
|
||||
#include "Module.H"
|
||||
#include "Module_Parameter_Editor.H"
|
||||
|
@ -198,7 +200,7 @@ Module_Parameter_Editor::make_controls ( void )
|
|||
{
|
||||
if ( mode_choice->value() == 0 )
|
||||
{
|
||||
Fl_Arc_Dial *o = new Fl_Arc_Dial( 0, 0, 60, 60, p->name() );
|
||||
Fl_Dial *o = new Fl_Dial( 0, 0, 60, 60, p->name() );
|
||||
w = o;
|
||||
|
||||
if ( p->hints.ranged )
|
||||
|
|
|
@ -361,12 +361,13 @@ hostname_resolvable ()
|
|||
require_FLTK ()
|
||||
{
|
||||
local use
|
||||
local appendflags
|
||||
|
||||
require_command fltk_config lib/fltk/fltk-config
|
||||
require_command ntk_config lib/ntk/ntk-config
|
||||
|
||||
echo -n "Checking for ${BOLD}FLTK${SGR0}..."
|
||||
|
||||
FLTK_VERSION=`lib/fltk/fltk-config --version`
|
||||
FLTK_VERSION=`lib/ntk/ntk-config --version`
|
||||
|
||||
if ! test_version $FLTK_VERSION $1
|
||||
then
|
||||
|
@ -377,14 +378,18 @@ require_FLTK ()
|
|||
fi
|
||||
|
||||
use=
|
||||
appendflags=
|
||||
|
||||
while [ $# -gt 1 ]
|
||||
do
|
||||
shift 1
|
||||
|
||||
[ "$1" = 'cairo' ] && appendflags="-DFLTK_HAVE_CAIRO=1 -DUSE_X11=1"
|
||||
|
||||
use="$use --use-$1"
|
||||
done
|
||||
|
||||
append "FLTK_LIBS=`lib/fltk/fltk-config $use --libs | sed 's/,\\?--as-needed//g'`"
|
||||
append "FLTK_LDFLAGS=`lib/fltk/fltk-config $use --ldflags | sed 's/,\\?--as-needed//g'`"
|
||||
append "FLTK_CFLAGS=`lib/fltk/fltk-config $use --cflags`"
|
||||
append "FLTK_LIBS=`lib/ntk/ntk-config $use --libs | sed 's/,\\?--as-needed//g'`"
|
||||
append "FLTK_LDFLAGS=`lib/ntk/ntk-config $use --ldflags | sed 's/,\\?--as-needed//g'`"
|
||||
append "FLTK_CFLAGS=`lib/ntk/ntk-config $use --cflags` $appendflags"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ begin_tests
|
|||
require_package JACK 0.103.0 jack
|
||||
suggest_package XPM 2.0.0 xpm
|
||||
require_FLTK 1.3.0 images
|
||||
require_command FLUID lib/fltk/fluid/fluid
|
||||
require_command FLUID lib/ntk/fluid/fluid
|
||||
test_version `version_of jack` 0.105.0 || append "JACK_MIDI_PROTO_API=yes"
|
||||
require_package liblo 0.23 liblo
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ begin_tests
|
|||
require_command ar ar
|
||||
require_command makedepend makedepend
|
||||
require_FLTK 1.3.0 images
|
||||
require_command FLUID lib/fltk/fluid/fluid
|
||||
require_command FLUID lib/ntk/fluid/fluid
|
||||
suggest_package JACK 0.103.0 jack
|
||||
require_package liblo 0.23 liblo
|
||||
require_package sigcpp 2.0.0 sigc++-2.0
|
||||
|
|
|
@ -26,14 +26,14 @@ src/session-manager: src/session-manager.o nonlib/libnonlib.a $(FLTK_LIBS)
|
|||
|
||||
src/nsm-proxy: src/nsm-proxy.o nonlib/libnonlib.a
|
||||
@ echo -n Linking NSM Proxy.
|
||||
@ $(CXX) $(CXXFLAGS) $(LIBS) $^ -o $@ -Lnonlib -lnonlib && echo $(DONE)
|
||||
@ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -Lnonlib -lnonlib && echo $(DONE)
|
||||
|
||||
# src/NSM_Proxy_UI.o:
|
||||
# @ cd src && $(FLUID) -c NSM_Proxy_UI.fl
|
||||
|
||||
src/nsm-proxy-gui: src/NSM_Proxy_UI.o src/nsm-proxy-gui.o nonlib/libnonlib.a $(FLTK_LIBS)
|
||||
@ echo -n Linking NSM Proxy.
|
||||
@ $(CXX) $(CXXFLAGS) $(FLTK_LDFLAGS) $(XPM_LIBS) $(LIBS) $^ -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE)
|
||||
@ $(CXX) $(CXXFLAGS) $(FLTK_LDFLAGS) $^ -o $@ $(XPM_LIBS) $(LIBS) -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE)
|
||||
|
||||
src/send_osc: src/send_osc.o nonlib/libnonlib.a
|
||||
@ $(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS) -Lnonlib -lnonlib && echo $(DONE)
|
||||
|
|
|
@ -24,7 +24,7 @@ begin_tests
|
|||
require_command ar ar
|
||||
require_command makedepend makedepend
|
||||
require_FLTK 1.3.0 images
|
||||
require_command FLUID lib/fltk/fluid/fluid
|
||||
require_command FLUID lib/ntk/fluid/fluid
|
||||
require_package JACK 0.103.0 jack
|
||||
require_package sndfile 1.0.17 sndfile
|
||||
require_package liblo 0.23 liblo
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <sys/time.h>
|
||||
#include <FL/fl_ask.H>
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include "Audio_Sequence.H"
|
||||
#include "Waveform.H"
|
||||
|
||||
|
@ -204,17 +204,22 @@ Audio_Sequence::draw ( void )
|
|||
(o->x() + o->w()) - (*r)->x(),
|
||||
o->h() );
|
||||
|
||||
Fl_Color c = fl_color_average( o->box_color(), (*r)->box_color(), 0.50f );
|
||||
c = fl_color_average( c, FL_YELLOW, 0.30f );
|
||||
/* Fl_Color c = fl_color_average( o->color(), (*r)->color(), 0.50f ); */
|
||||
/* c = fl_color_average( c, FL_YELLOW, 0.30f ); */
|
||||
|
||||
/* Fl_Color c = fl_color_add_alpha( FL_YELLOW, 50 ); */
|
||||
Fl_Color c = FL_YELLOW;
|
||||
|
||||
/* fl_push_use_cairo( true ); */
|
||||
|
||||
fl_push_clip( b.x, b.y, b.w, b.h );
|
||||
|
||||
draw_box( FL_FLAT_BOX, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
draw_box( FL_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c );
|
||||
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
/* fl_pop_use_cairo(); */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,9 +241,9 @@ Audio_Sequence::draw ( void )
|
|||
Rectangle b( (*r)->x(), o->y(), (o->x() + o->w()) - (*r)->x(), o->h() );
|
||||
|
||||
/* draw overlapping waveforms in X-ray style. */
|
||||
bool t = Waveform::fill;
|
||||
/* bool t = Waveform::fill; */
|
||||
|
||||
Waveform::fill = false;
|
||||
/* Waveform::fill = false; */
|
||||
|
||||
fl_push_clip( b.x, b.y, b.w, b.h );
|
||||
|
||||
|
@ -246,9 +251,7 @@ Audio_Sequence::draw ( void )
|
|||
(*r)->draw();
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
Waveform::fill = t;
|
||||
|
||||
/* Waveform::fill = t; */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 )
|
|||
_mode = CV;
|
||||
|
||||
mode( OSC );
|
||||
|
||||
|
||||
if ( track )
|
||||
track->add( this );
|
||||
|
||||
|
@ -114,7 +114,7 @@ Control_Sequence::init ( void )
|
|||
_highlighted = false;
|
||||
_output = NULL;
|
||||
_osc_output = NULL;
|
||||
color( fl_darker( FL_YELLOW ) );
|
||||
// color( );
|
||||
|
||||
interpolation( Linear );
|
||||
}
|
||||
|
@ -248,7 +248,6 @@ Control_Sequence::mode ( Mode m )
|
|||
void
|
||||
Control_Sequence::draw_curve ( bool flip, bool filled )
|
||||
{
|
||||
|
||||
const int bx = x();
|
||||
const int by = y() + Fl::box_dy( box() );
|
||||
const int bw = w();
|
||||
|
@ -328,11 +327,8 @@ Control_Sequence::draw ( void )
|
|||
|
||||
if ( draw_with_gradient )
|
||||
{
|
||||
/* const Fl_Color c2 = fl_color_average( selection_color, FL_WHITE, 0.90f ); */
|
||||
/* const Fl_Color c1 = fl_color_average( color, c2, 0.60f ); */
|
||||
|
||||
const Fl_Color c1 = fl_color_average( selection_color, FL_WHITE, 0.90f );
|
||||
const Fl_Color c2 = fl_color_average( color, c1, 0.60f );
|
||||
const Fl_Color c1 = fl_color_average( selection_color, FL_BLACK, 0.50f );
|
||||
const Fl_Color c2 = fl_color_average( color, FL_WHITE, 0.60f );
|
||||
|
||||
for ( int gy = 0; gy < bh; gy++ )
|
||||
{
|
||||
|
@ -356,7 +352,7 @@ Control_Sequence::draw ( void )
|
|||
{
|
||||
if ( draw_with_polygon )
|
||||
{
|
||||
fl_color( draw_with_gradient ? color : fl_color_average( color, selection_color, 0.45f ) );
|
||||
fl_color( color );
|
||||
|
||||
fl_begin_complex_polygon();
|
||||
draw_curve( draw_with_gradient, true );
|
||||
|
@ -383,7 +379,7 @@ Control_Sequence::draw ( void )
|
|||
fl_line_style( FL_SOLID, 0 );
|
||||
}
|
||||
|
||||
timeline->draw_measure_lines( x(), y(), w(), h(), color );
|
||||
// timeline->draw_measure_lines( x(), y(), w(), h(), color );
|
||||
|
||||
if ( interpolation() == None || _highlighted || Fl::focus() == this )
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
|
||||
|
|
|
@ -280,7 +280,7 @@ Sequence::draw ( void )
|
|||
|
||||
// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H );
|
||||
|
||||
timeline->draw_measure_lines( X, Y, W, H, color() );
|
||||
// timeline->draw_measure_lines( X, Y, W, H, color() );
|
||||
|
||||
for ( list <Sequence_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); ++r )
|
||||
(*r)->draw_box();
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
|
||||
void remove_selected ( void );
|
||||
|
||||
Fl_Color color ( void ) const { return this == Fl::focus() ? fl_color_average( FL_FOREGROUND_COLOR, Fl_Widget::color(), 0.50f ) : Fl_Widget::color(); }
|
||||
Fl_Color color ( void ) const { return this == Fl::focus() ? fl_color_average( FL_FOREGROUND_COLOR, Fl_Widget::color(), 0.20f ) : Fl_Widget::color(); }
|
||||
void color ( Fl_Color v ) { Fl_Widget::color( v ); }
|
||||
|
||||
const std::list <Sequence_Widget *> widgets ( void ) const { return _widgets; }
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* provides cursor overlays, scrolling, zooming, measure lines, tempo
|
||||
* map and just about everything else. */
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Scroll.H>
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/Fl_Scrollbar.H>
|
||||
|
@ -701,19 +702,16 @@ draw_measure_cb ( nframes_t frame, const BBT &bbt, void *arg )
|
|||
{
|
||||
Fl_Color *color = (Fl_Color*)arg;
|
||||
|
||||
fl_color( FL_BLACK );
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
Fl_Color c = fl_color_average( FL_LIGHT3, FL_RED, 0.50 );
|
||||
|
||||
if ( bbt.beat )
|
||||
++color;
|
||||
|
||||
fl_color( *color );
|
||||
c = FL_LIGHT3;
|
||||
|
||||
fl_color( fl_color_add_alpha( c, 48 ) );
|
||||
|
||||
const int x = timeline->ts_to_x( frame - timeline->xoffset ) + Track::width();
|
||||
|
||||
fl_line( x, 0, x, 5000 );
|
||||
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
fl_line( x, 0, x, timeline->h() );
|
||||
}
|
||||
|
||||
/* FIXME: wrong place for this */
|
||||
|
@ -858,25 +856,21 @@ done:
|
|||
|
||||
/** maybe draw appropriate measure lines in rectangle defined by X, Y, W, and H, using color /color/ as a base */
|
||||
void
|
||||
Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color )
|
||||
Timeline::draw_measure_lines ( int X, int Y, int W, int H )
|
||||
{
|
||||
if ( ! draw_with_measure_lines )
|
||||
return;
|
||||
|
||||
Fl_Color colors[2];
|
||||
|
||||
colors[1] = fl_color_average( FL_BLACK, color, 0.65f );
|
||||
colors[0] = fl_color_average( FL_RED, colors[1], 0.65f );
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
|
||||
const nframes_t start = x_to_offset( X );
|
||||
const nframes_t length = x_to_ts( W );
|
||||
|
||||
fl_push_clip( X, Y, W, H );
|
||||
|
||||
render_tempomap( start, length, draw_measure_cb, &colors );
|
||||
render_tempomap( start, length, draw_measure_cb, NULL );
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -895,6 +889,7 @@ Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
|
|||
|
||||
fl_push_clip( tl->tracks->x(), tl->rulers->y() + tl->rulers->h(), tl->tracks->w(), tl->h() - tl->rulers->h() - tl->hscroll->h() );
|
||||
tl->draw_child( *tl->tracks );
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
fl_pop_clip();
|
||||
|
@ -958,6 +953,7 @@ Timeline::draw ( void )
|
|||
|
||||
fl_push_clip( tracks->x(), rulers->y() + rulers->h(), tracks->w(), hscroll->y() - (rulers->y() + rulers->h()) );
|
||||
draw_child( *tracks );
|
||||
|
||||
fl_pop_clip();
|
||||
|
||||
draw_child( *hscroll );
|
||||
|
@ -988,7 +984,7 @@ Timeline::draw ( void )
|
|||
else
|
||||
fl_scroll( X, Y, W, H, dx, dy, draw_clip, this );
|
||||
}
|
||||
|
||||
|
||||
if ( damage() & FL_DAMAGE_CHILD )
|
||||
{
|
||||
fl_push_clip( rulers->x(), rulers->y(), rulers->w(), rulers->h() );
|
||||
|
@ -1012,6 +1008,8 @@ done:
|
|||
|
||||
_old_xposition = xoffset;
|
||||
_old_yposition = _yposition;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** draw a single cursor line at /frame/ with color /color/ using symbol routine /symbol/ for the cap */
|
||||
|
|
|
@ -189,8 +189,8 @@ public:
|
|||
typedef void (measure_line_callback)( nframes_t frame, const BBT & bbt, void *arg );
|
||||
|
||||
position_info solve_tempomap ( nframes_t when ) const;
|
||||
void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color );
|
||||
void draw_measure_BBT ( int X, int Y, int W, int H, Fl_Color color );
|
||||
void draw_measure_lines ( int X, int Y, int W, int H );
|
||||
void draw_measure_BBT ( int X, int Y, int W, int H );
|
||||
position_info render_tempomap ( nframes_t start, nframes_t length, measure_line_callback *cb, void *arg ) const;
|
||||
|
||||
void xposition ( int X );
|
||||
|
|
|
@ -622,6 +622,8 @@ Track::add ( Control_Sequence *t )
|
|||
t->track( this );
|
||||
|
||||
control->add( t );
|
||||
|
||||
t->color( color() );
|
||||
|
||||
engine->unlock();
|
||||
|
||||
|
@ -831,6 +833,15 @@ Track::menu ( void ) const
|
|||
void
|
||||
Track::draw ( void )
|
||||
{
|
||||
if ( ! fl_not_clipped( x(), y(), w(), h() ) )
|
||||
return;
|
||||
|
||||
int X, Y, W, H;
|
||||
|
||||
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
|
||||
|
||||
fl_push_clip( x(), y(), w(), h() );
|
||||
|
||||
if ( _selected )
|
||||
{
|
||||
Fl_Color c = color();
|
||||
|
@ -843,6 +854,10 @@ Track::draw ( void )
|
|||
}
|
||||
else
|
||||
Fl_Group::draw();
|
||||
|
||||
timeline->draw_measure_lines( X, Y, W, H );
|
||||
|
||||
fl_pop_clip();
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
/* routines to draw a waveform from peak data */
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
#include "Waveform.H"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -63,45 +63,75 @@ Waveform::draw ( int X, int Y, int W, int H,
|
|||
|
||||
const int halfheight = H / 2;
|
||||
const int mid = Y + halfheight;
|
||||
const int ty = Y + halfheight;
|
||||
|
||||
W = min( peaks, W );
|
||||
|
||||
|
||||
if ( Waveform::fill )
|
||||
{
|
||||
j = start;
|
||||
for ( int x = X; x < X + W; ++x, j += skip )
|
||||
if ( Waveform::vary_color )
|
||||
{
|
||||
const Peak p = pbuf[ j ];
|
||||
j = start;
|
||||
for ( int x = X; x < X + W; ++x, j += skip )
|
||||
{
|
||||
const Peak p = pbuf[ j ];
|
||||
|
||||
const float diff = fabs( p.max - p.min );
|
||||
|
||||
if ( diff > 2.0f )
|
||||
fl_color( FL_RED );
|
||||
else
|
||||
if ( Waveform::vary_color )
|
||||
fl_color( fl_color_average( FL_WHITE, color, diff * 0.5f ) );
|
||||
const float diff = fabs( p.max - p.min );
|
||||
|
||||
if ( diff > 2.0f )
|
||||
fl_color( FL_RED );
|
||||
else
|
||||
fl_color( color );
|
||||
if ( Waveform::vary_color )
|
||||
fl_color( fl_color_average( FL_WHITE, color, diff * 0.5f ) );
|
||||
else
|
||||
fl_color( color );
|
||||
|
||||
const int ty = mid - ( halfheight * p.min );
|
||||
const int by = mid - ( halfheight * p.max );
|
||||
fl_line( x, ty, x, by );
|
||||
const int ty = mid - ( halfheight * p.min );
|
||||
const int by = mid - ( halfheight * p.max );
|
||||
fl_line( x, ty, x, by );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// fl_color( fl_color_add_alpha( color, 127 ) );
|
||||
fl_color( color );
|
||||
|
||||
fl_begin_complex_polygon();
|
||||
|
||||
j = start;
|
||||
|
||||
for ( int x = X; x < X + W; x++, j += skip )
|
||||
fl_vertex( x, ty - ( halfheight * pbuf[ j ].min ) );
|
||||
|
||||
// fl_end_line();
|
||||
|
||||
// fl_begin_line();
|
||||
|
||||
j = start + ( W * skip );
|
||||
|
||||
for ( int x = X + W; x >= X; x--, j -= skip )
|
||||
fl_vertex( x, ty - ( halfheight * pbuf[ j ].max ) );
|
||||
|
||||
fl_end_complex_polygon();
|
||||
|
||||
// fl_line_style( FL_SOLID, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
const int ty = Y + halfheight;
|
||||
|
||||
if ( Waveform::outline )
|
||||
{
|
||||
fl_color( fl_darker( fl_darker( color ) ) );
|
||||
|
||||
fl_line_style( FL_SOLID | FL_CAP_FLAT, 2 );
|
||||
fl_line_style( FL_SOLID, 0 );
|
||||
|
||||
fl_begin_line();
|
||||
|
||||
unsigned long end = start + W;
|
||||
|
||||
j = start;
|
||||
|
||||
for ( int x = X; x < X + W; ++x, j += skip )
|
||||
for ( int x = X; x < X + W; x++, j += skip )
|
||||
fl_vertex( x, ty - ( halfheight * pbuf[ j ].min ) );
|
||||
|
||||
fl_end_line();
|
||||
|
@ -110,7 +140,7 @@ Waveform::draw ( int X, int Y, int W, int H,
|
|||
|
||||
j = start;
|
||||
|
||||
for ( int x = X; x < X + W; ++x, j += skip )
|
||||
for ( int x = X; x < X + W; x++, j += skip )
|
||||
fl_vertex( x, ty - ( halfheight * pbuf[ j ].max ) );
|
||||
|
||||
fl_end_line();
|
||||
|
|
Loading…
Reference in New Issue