Browse Source

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.
tags/non-daw-v1.2.0
Jonathan Moore Liles 11 years ago
parent
commit
2c6b6b1a75
39 changed files with 319 additions and 1850 deletions
  1. +2
    -2
      .gitmodules
  2. +0
    -97
      FL/Clean_Theme.C
  3. +0
    -20
      FL/Clean_Theme.H
  4. +0
    -395
      FL/Crystal_Theme.C
  5. +0
    -20
      FL/Crystal_Theme.H
  6. +0
    -332
      FL/Fl_Arc_Dial.C
  7. +0
    -82
      FL/Fl_Arc_Dial.H
  8. +0
    -233
      FL/Fl_Theme.C
  9. +0
    -120
      FL/Fl_Theme.H
  10. +0
    -180
      FL/Fl_Theme_Chooser.fl
  11. +0
    -169
      FL/Gleam_Theme.C
  12. +0
    -20
      FL/Gleam_Theme.H
  13. +9
    -2
      FL/makefile.inc
  14. +0
    -82
      FL/themes.H
  15. +0
    -0
      FL/util/ntk-chtheme.C
  16. +163
    -0
      FL/util/ntk-perf.C
  17. +1
    -1
      configure
  18. +14
    -14
      lib/Makefile
  19. +0
    -1
      lib/fltk
  20. +1
    -0
      lib/ntk
  21. +1
    -1
      mixer/configure
  22. +2
    -2
      mixer/src/Controller_Module.C
  23. +1
    -1
      mixer/src/Meter_Indicator_Module.C
  24. +3
    -3
      mixer/src/Mixer.C
  25. +1
    -1
      mixer/src/Mixer_Strip.H
  26. +4
    -2
      mixer/src/Module_Parameter_Editor.C
  27. +10
    -5
      scripts/config-funcs
  28. +1
    -1
      sequencer/configure
  29. +1
    -1
      session-manager/configure
  30. +2
    -2
      session-manager/makefile.inc
  31. +1
    -1
      timeline/configure
  32. +12
    -9
      timeline/src/Audio_Sequence.C
  33. +6
    -10
      timeline/src/Control_Sequence.C
  34. +1
    -1
      timeline/src/Sequence.C
  35. +1
    -1
      timeline/src/Sequence.H
  36. +14
    -16
      timeline/src/Timeline.C
  37. +2
    -2
      timeline/src/Timeline.H
  38. +15
    -0
      timeline/src/Track.C
  39. +51
    -21
      timeline/src/Waveform.C

+ 2
- 2
.gitmodules View File

@@ -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

+ 0
- 97
FL/Clean_Theme.C View File

@@ -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 );
}

+ 0
- 20
FL/Clean_Theme.H View File

@@ -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 );

+ 0
- 395
FL/Crystal_Theme.C View File

@@ -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 );
}

+ 0
- 20
FL/Crystal_Theme.H View File

@@ -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 );

+ 0
- 332
FL/Fl_Arc_Dial.C View File

@@ -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);
}

+ 0
- 82
FL/Fl_Arc_Dial.H View File

@@ -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 );
}

};

+ 0
- 233
FL/Fl_Theme.C View File

@@ -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;
}






+ 0
- 120
FL/Fl_Theme.H View File

@@ -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; }
};

+ 0
- 180
FL/Fl_Theme_Chooser.fl View File

@@ -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();} {}
}

+ 0
- 169
FL/Gleam_Theme.C View File

@@ -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 );
}

+ 0
- 20
FL/Gleam_Theme.H View File

@@ -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 );

+ 9
- 2
FL/makefile.inc View File

@@ -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)



+ 0
- 82
FL/themes.H View File

@@ -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 );
}
}

FL/ntk-chtheme.C → FL/util/ntk-chtheme.C View File


+ 163
- 0
FL/util/ntk-perf.C View File

@@ -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();
}

+ 1
- 1
configure View File

@@ -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


+ 14
- 14
lib/Makefile View File

@@ -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

+ 0
- 1
lib/fltk

@@ -1 +0,0 @@
Subproject commit af74a40270f234be3c37f835202e75770f6656ae

+ 1
- 0
lib/ntk

@@ -0,0 +1 @@
Subproject commit b8cbf58019493b5871d5f04a7efa35547b4c6eb3

+ 1
- 1
mixer/configure View File

@@ -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


+ 2
- 2
mixer/src/Controller_Module.C View File

@@ -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;



+ 1
- 1
mixer/src/Meter_Indicator_Module.C View File

@@ -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"



+ 3
- 3
mixer/src/Mixer.C View File

@@ -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();