Replace crappy Fl::scheme() thing with a more useful theme implementation in Fl_Theme and Fl_Color_Sheme classes.

Theme settings are now common between all Non-* programs.

Also adds a new 'Clean' theme.
This commit is contained in:
Jonathan Moore Liles 2012-04-10 23:59:12 -07:00
parent e424182dce
commit fdcf74ddbe
26 changed files with 846 additions and 317 deletions

89
FL/Clean_Theme.C Normal file
View File

@ -0,0 +1,89 @@
/*******************************************************************************/
/* 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) */
/* { */
/* /\* 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)
{
fl_rect( x, y, w, h, bc );
}
static void rectf ( int x, int y,int w, int h, Fl_Color bc )
{
fl_rectf( x, y, w, h, fl_color_average( FL_WHITE, bc, 0.05 ) );
}
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.1 ) );
}
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.1 ) );
}
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.1 ) );
}
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_BLACK, c, 0.1 ) );
}
static void
init_theme ( void )
{
/* replace the gtk+ boxes... (is there a better way?) */
Fl::set_boxtype( FL_UP_BOX, up_box, 1,1,1,1 );
Fl::set_boxtype( FL_DOWN_BOX, down_box, 1,1,1,1 );
Fl::set_boxtype( FL_THIN_UP_BOX, up_box, 1,1,1,1 );
Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 1,1,1,1 );
Fl::set_boxtype( FL_UP_FRAME, up_frame, 1,1,1,1 );
Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 1,1,1,1 );
Fl::set_boxtype( FL_ROUND_UP_BOX, up_box, 1,1,1,1 );
Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_box, 1,1,1,1 );
}
void
init_clean_theme ( void )
{
Fl_Theme *t = new Fl_Theme( "Clean", "", "", init_theme );
Fl_Theme::add( t );
}

View File

@ -17,6 +17,4 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/ /*******************************************************************************/
#include <FL/Fl.H> void init_clean_theme ( void );
void init_gleam_boxtypes ( void );

View File

@ -20,11 +20,11 @@
#pragma GCC diagnostic ignored "-Wchar-subscripts" #pragma GCC diagnostic ignored "-Wchar-subscripts"
#include "Crystal_Boxtypes.H"
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <string.h> #include <string.h>
#include "FL/Fl_Theme.H"
/* Crystal boxes, base (obviously) on the FLTK1 'plastic' boxes, but /* Crystal boxes, base (obviously) on the FLTK1 'plastic' boxes, but
* without the rude color blending and with a slightly enhanced * without the rude color blending and with a slightly enhanced
* appearance. */ * appearance. */
@ -370,16 +370,26 @@ down_round ( int x, int y, int w, int h, Fl_Color c )
} }
void static void
init_crystal_boxtypes ( void ) init_theme ( void )
{ {
printf( "Initializing crystal boxtypes" );
/* replace the plastic boxes... (is there a better way?) */ /* replace the plastic boxes... (is there a better way?) */
Fl::set_boxtype( FL_PLASTIC_UP_BOX, up_box, 4,4,8,8 ); Fl::set_boxtype( FL_UP_BOX, up_box, 4,4,8,8 );
Fl::set_boxtype( FL_PLASTIC_DOWN_BOX, down_box, 2,2,4,4 ); Fl::set_boxtype( FL_DOWN_BOX, down_box, 2,2,4,4 );
Fl::set_boxtype( FL_PLASTIC_UP_FRAME, up_frame, 2,2,4,4 ); Fl::set_boxtype( FL_UP_FRAME, up_frame, 2,2,4,4 );
Fl::set_boxtype( FL_PLASTIC_DOWN_FRAME, down_frame, 2,2,4,4 ); Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 2,2,4,4 );
Fl::set_boxtype( FL_PLASTIC_THIN_UP_BOX, thin_up_box, 1,1,2,2 ); Fl::set_boxtype( FL_THIN_UP_BOX, thin_up_box, 1,1,2,2 );
Fl::set_boxtype( FL_PLASTIC_THIN_DOWN_BOX, down_box, 1,1,2,2 ); Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 1,1,2,2 );
Fl::set_boxtype( FL_PLASTIC_ROUND_UP_BOX, up_round, 1,1,2,2 ); Fl::set_boxtype( FL_ROUND_UP_BOX, up_round, 1,1,2,2 );
Fl::set_boxtype( FL_PLASTIC_ROUND_DOWN_BOX, down_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 );
} }

View File

@ -1,6 +1,6 @@
/*******************************************************************************/ /*******************************************************************************/
/* Copyright (C) 2008 Jonathan Moore Liles */ /* Copyright (C) 2012 Jonathan Moore Liles */
/* */ /* */
/* This program is free software; you can redistribute it and/or modify it */ /* 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 */ /* under the terms of the GNU General Public License as published by the */
@ -17,6 +17,4 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/ /*******************************************************************************/
#include <FL/Fl.H> void init_crystal_theme ( void );
void init_crystal_boxtypes ( void );

230
FL/Fl_Theme.C Normal file
View File

@ -0,0 +1,230 @@
/*******************************************************************************/
/* 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 ) )
{
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 Normal file
View File

@ -0,0 +1,120 @@
/*******************************************************************************/
/* 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; }
};

180
FL/Fl_Theme_Chooser.fl Normal file
View File

@ -0,0 +1,180 @@
# 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();} {}
}

View File

@ -23,7 +23,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include "Gleam_Boxtypes.H" #include "FL/Fl_Theme.H"
static void gleam_color(Fl_Color c) static void gleam_color(Fl_Color c)
{ {
@ -124,15 +124,6 @@ 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)); frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
} }
static void thin_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(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f));
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) 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); shade_rect_up(x + 1, y, w - 2, h - 1, c);
@ -155,26 +146,24 @@ static void down_box(int x, int y, int w, int h, Fl_Color c)
//frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65)); //frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65));
} }
static void thin_down_box(int x, int y, int w, int h, Fl_Color c) static void
init_theme ( void )
{ {
/* replace the gtk+ boxes... (is there a better way?) */
down_box(x, y, w, h, c); 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 void
init_gleam_boxtypes ( void ) init_gleam_theme ( void )
{ {
/* replace the gtk+ boxes... (is there a better way?) */ Fl_Theme *t = new Fl_Theme( "Gleam", "", "", init_theme );
Fl::set_boxtype( FL_GTK_UP_BOX, up_box, 2,2,4,4 );
Fl::set_boxtype( FL_GTK_DOWN_BOX, down_box, 2,2,3,3 );
Fl::set_boxtype( FL_GTK_THIN_UP_BOX, up_box, 2,2,3,3 );
Fl::set_boxtype( FL_GTK_THIN_DOWN_BOX, down_box, 2,2,3,3 );
Fl::set_boxtype( FL_GTK_UP_FRAME, up_frame, 2,2,3,3 );
Fl::set_boxtype( FL_GTK_DOWN_FRAME, down_frame, 2,2,3,3 );
/* Fl::set_boxtype( FL_GTK_THIN_UP_BOX, thin_up_box, 1,1,1,1 ); */
/* Fl::set_boxtype( FL_GTK_THIN_DOWN_BOX, thin_down_box, 1,1,1,1 ); */
Fl::set_boxtype( FL_GTK_ROUND_UP_BOX, up_box, 2,2,3,3 );
Fl::set_boxtype( FL_GTK_ROUND_DOWN_BOX, down_box, 2,2,3,3 );
}
Fl_Theme::add( t );
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************/ /*******************************************************************************/
/* Copyright (C) 2010 Jonathan Moore Liles */ /* Copyright (C) 2012 Jonathan Moore Liles */
/* */ /* */
/* This program is free software; you can redistribute it and/or modify it */ /* 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 */ /* under the terms of the GNU General Public License as published by the */
@ -17,5 +17,4 @@
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/ /*******************************************************************************/
void color_scheme ( const char *name ); void init_gleam_theme ( void );
void get_system_colors ( void );

View File

@ -1,81 +0,0 @@
/*******************************************************************************/
/* Copyright (C) 2010 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 "color_scheme.H"
#include <FL/Fl.H>
#include <string.h>
static Fl_Color system_colors[3];
void
get_system_colors ( void )
{
Fl::get_system_colors();
system_colors[ 0 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND_COLOR );
system_colors[ 1 ] = (Fl_Color)Fl::get_color( FL_FOREGROUND_COLOR );
system_colors[ 2 ] = (Fl_Color)Fl::get_color( FL_BACKGROUND2_COLOR );
}
void
color_scheme ( const char *name )
{
if ( !strcasecmp( name, "gray" ) )
{
Fl::background2( 127, 127, 127 );
Fl::background( 100, 100, 100 );
Fl::foreground( 255, 255, 255 );
}
if ( !strcasecmp( name, "dark" ) )
{
Fl::background2( 100, 100, 100 );
Fl::background( 50, 50, 50 );
Fl::foreground( 255, 255, 255 );
}
else if ( !strcasecmp( name, "light" ))
{
Fl::background2( 192, 192, 192 );
Fl::background( 220, 220, 220 );
Fl::foreground( 0, 0, 0 );
}
if ( !strcasecmp( name, "very dark" ) )
{
Fl::background2( 100, 100, 100 );
Fl::background( 20, 20, 20 );
Fl::foreground( 240, 240, 240 );
}
else if ( !strcasecmp( name, "system" ) )
{
unsigned char r, g, b;
Fl::get_color( system_colors[ 0 ], r, g, b );
Fl::background( r, g, b );
Fl::get_color( system_colors[ 1 ], r, g, b );
Fl::foreground( r, g, b );
Fl::get_color( system_colors[ 2 ], r, g, b );
Fl::background2( r, g, b );
}
Fl::scheme( Fl::scheme() );
}

View File

@ -11,7 +11,7 @@ SRCS:=$(SRCS:.fl=.C)
SRCS:=$(sort $(SRCS)) SRCS:=$(sort $(SRCS))
OBJS:=$(SRCS:.C=.o) OBJS:=$(SRCS:.C=.o)
all: FL/libfl_widgets.a all: FL/libfl_widgets.a ntk-chtheme
FL/libfl_widgets.a: $(OBJS) FL/libfl_widgets.a: $(OBJS)
@ ar rcs $@ $(OBJS) @ ar rcs $@ $(OBJS)
@ -19,6 +19,10 @@ FL/libfl_widgets.a: $(OBJS)
.PHONEY: FL .PHONEY: FL
FL: FL/libfl_widgets.a FL: 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)
clean: clean:
rm -f $(OBJS) FL/libfl_widgets.a .deps rm -f $(OBJS) FL/libfl_widgets.a .deps

32
FL/ntk-chtheme.C Normal file
View File

@ -0,0 +1,32 @@
/*******************************************************************************/
/* 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/themes.H"
#include "FL/Fl_Theme_Chooser.C"
int
main ( int argc, char **argv )
{
fl_register_themes();
Fl_Theme::set();
fl_theme_chooser();
}

82
FL/themes.H Normal file
View File

@ -0,0 +1,82 @@
/*******************************************************************************/
/* 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 );
}
}

View File

@ -30,7 +30,6 @@
#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_.H> #include <FL/Fl_Menu_.H>
#include <FL/Fl_Light_Button.H> #include <FL/Fl_Light_Button.H>
#include "FL/Crystal_Boxtypes.H"
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include "FL/Fl_Arc_Dial.H" #include "FL/Fl_Arc_Dial.H"
#include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Labelpad_Group.H"

View File

@ -27,7 +27,6 @@
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/Fl_Counter.H> #include <FL/Fl_Counter.H>
#include <FL/Fl_Light_Button.H> #include <FL/Fl_Light_Button.H>
#include "FL/Crystal_Boxtypes.H"
#include "FL/Fl_Arc_Dial.H" #include "FL/Fl_Arc_Dial.H"
#include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Labelpad_Group.H"

View File

@ -35,6 +35,7 @@
#include "FL/Fl_Menu_Settings.H" #include "FL/Fl_Menu_Settings.H"
#include "About_Dialog.H" #include "About_Dialog.H"
#include <FL/Fl_File_Chooser.H> #include <FL/Fl_File_Chooser.H>
#include "FL/Fl_Theme_Chooser.H"
#include "file.h" #include "file.h"
@ -44,7 +45,6 @@
#include <sys/types.h> #include <sys/types.h>
#include "FL/Fl_Value_SliderX.H" #include "FL/Fl_Value_SliderX.H"
#include "FL/color_scheme.H"
#include "OSC/Endpoint.H" #include "OSC/Endpoint.H"
#include <lo/lo.h> #include <lo/lo.h>
#include "FL/Fl_Blinker.H" #include "FL/Fl_Blinker.H"
@ -274,37 +274,9 @@ void Mixer::cb_menu(Fl_Widget* o) {
{ {
rows( 3 ); rows( 3 );
} }
else if (! strcmp( picked, "&Options/&Display/&Style/&Default") ) else if (! strcmp( picked, "&View/&Theme") )
{ {
Fl::scheme( "gtk+" ); fl_theme_chooser();
}
else if (! strcmp( picked, "&Options/&Display/&Style/&Flat") )
{
Fl::scheme( "gtk+" );
}
else if (! strcmp( picked, "&Options/&Display/&Style/&Round") )
{
Fl::scheme( "plastic" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&System") )
{
color_scheme( "system" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Dark") )
{
color_scheme( "dark" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Very Dark") )
{
color_scheme( "very dark" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Light") )
{
color_scheme( "light" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Gray") )
{
color_scheme( "gray" );
} }
else if (! strcmp( picked, "&Options/&Display/&Knobs/&Burnished") ) else if (! strcmp( picked, "&Options/&Display/&Knobs/&Burnished") )
{ {
@ -378,11 +350,6 @@ void Mixer::cb_menu(Fl_Widget* o, void* v) {
Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
Fl_Group( X, Y, W, H, L ) Fl_Group( X, Y, W, H, L )
{ {
get_system_colors();
Fl::scheme( "plastic" );
color_scheme( "dark" );
Loggable::dirty_callback( &Mixer::handle_dirty, this ); Loggable::dirty_callback( &Mixer::handle_dirty, this );
_rows = 1; _rows = 1;
@ -399,14 +366,7 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
o->add( "&Mixer/&Rows/One", '1', 0, 0 ); o->add( "&Mixer/&Rows/One", '1', 0, 0 );
o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); o->add( "&Mixer/&Rows/Two", '2', 0, 0 );
o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); o->add( "&Mixer/&Rows/Three", '3', 0, 0 );
o->add( "_&Options/&Display/&Style/&Default", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "&View/&Theme", 0, 0, 0 );
o->add( "_&Options/&Display/&Style/&Flat", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Style/&Round", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&Dark", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );
o->add( "_&Options/&Display/&Colors/&Very Dark", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&Light", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&Gray", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO );
o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );

View File

@ -26,7 +26,6 @@
#include <FL/Fl_Pack.H> #include <FL/Fl_Pack.H>
#include <FL/Fl_Flip_Button.H> #include <FL/Fl_Flip_Button.H>
#include <FL/Fl_Arc_Dial.H> #include <FL/Fl_Arc_Dial.H>
#include <FL/Crystal_Boxtypes.H>
#include <FL/Fl_Group.H> #include <FL/Fl_Group.H>
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>

View File

@ -27,7 +27,6 @@
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Counter.H> #include <FL/Fl_Counter.H>
#include "FL/Crystal_Boxtypes.H"
#include "FL/Fl_Flowpack.H" #include "FL/Fl_Flowpack.H"
#include "FL/Fl_Labelpad_Group.H" #include "FL/Fl_Labelpad_Group.H"
#include "FL/Fl_Value_SliderX.H" #include "FL/Fl_Value_SliderX.H"
@ -43,7 +42,7 @@
Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_Window( 0, 0, 800, 600 ) Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_Window( 800, 600 )
{ {
_module = module; _module = module;
_resized = false; _resized = false;

View File

@ -32,8 +32,8 @@
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#include <FL/Fl_Shared_Image.H> #include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Pack.H> #include <FL/Fl_Pack.H>
#include <FL/Crystal_Boxtypes.H> #include "FL/themes.H"
#include <FL/Gleam_Boxtypes.H> #include "FL/Fl_Theme.H"
#include "Thread.H" #include "Thread.H"
#include "debug.h" #include "debug.h"
@ -174,14 +174,8 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Meter_Indicator_Module ); LOG_REGISTER_CREATE( Meter_Indicator_Module );
LOG_REGISTER_CREATE( Controller_Module ); LOG_REGISTER_CREATE( Controller_Module );
init_crystal_boxtypes();
init_gleam_boxtypes();
signal( SIGPIPE, SIG_IGN ); signal( SIGPIPE, SIG_IGN );
Fl::get_system_colors();
Fl::scheme( "gtk+" );
Fl::lock(); Fl::lock();
Fl_Double_Window *main_window; Fl_Double_Window *main_window;
@ -209,6 +203,10 @@ main ( int argc, char **argv )
o->show( 0, 0 ); o->show( 0, 0 );
} }
fl_register_themes();
Fl_Theme::set();
const char *osc_port = NULL; const char *osc_port = NULL;
nsm = new NSM_Client; nsm = new NSM_Client;

View File

@ -34,6 +34,9 @@ decl {class Fl_Scalepack;} {public local
decl {class Fl_Sometimes_Input;} {public local decl {class Fl_Sometimes_Input;} {public local
} }
decl {\#include "FL/Fl_Theme_Chooser.H"} {private local
}
decl {\#include "FL/Fl_Scalepack.H"} {private local decl {\#include "FL/Fl_Scalepack.H"} {private local
} }
@ -149,12 +152,6 @@ class UI {open
} { } {
code {fl_register_images(); code {fl_register_images();
// // Make her pretty
// Fl::background( 32, 32, 32 );
// Fl::background2( 36, 36, 36 );
// Fl::foreground( 255, 255, 255 );
// Fl::scheme( "plastic" );
canvas_background_color = FL_GREEN; canvas_background_color = FL_GREEN;
playback_mode_menu = NULL; playback_mode_menu = NULL;
@ -225,11 +222,11 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape )
if ( maybe_save_song() ) if ( maybe_save_song() )
quit();} open quit();} open
xywh {365 131 865 805} type Double color 38 resizable xywh {798 131 865 805} type Double color 47 resizable
code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible
} { } {
Fl_Menu_Bar menu_bar {open selected Fl_Menu_Bar menu_bar {open
xywh {0 0 865 30} color 37 xywh {0 0 865 30} color 47
} { } {
Submenu {} { Submenu {} {
label {&File} open label {&File} open
@ -438,6 +435,11 @@ config.follow_playhead = val ? true : false;}
xywh {0 0 40 24} type Radio value 1 xywh {0 0 40 24} type Radio value 1
} }
} }
MenuItem {} {
label {&Theme}
callback {fl_theme_chooser();}
xywh {0 0 40 24}
}
} }
Submenu {} { Submenu {} {
label {&Help} open label {&Help} open
@ -763,7 +765,7 @@ if ( playlist->length() )
} }
Fl_Group phrase_tab { Fl_Group phrase_tab {
label Phrase open label Phrase open
xywh {0 98 865 674} color 37 xywh {0 98 865 674} color 47 hide
code0 {update_phrase_widgets();} code0 {update_phrase_widgets();}
} { } {
Fl_Box phrase_canvas_widget { Fl_Box phrase_canvas_widget {
@ -814,8 +816,8 @@ o->maximum( phrase::phrases() );}
} }
} }
Fl_Group pattern_tab { Fl_Group pattern_tab {
label Pattern open label Pattern open selected
xywh {0 98 865 674} color 37 hide xywh {0 98 865 674} color 47
code0 {update_pattern_widgets();} code0 {update_pattern_widgets();}
} { } {
Fl_Box pattern_canvas_widget { Fl_Box pattern_canvas_widget {
@ -828,7 +830,7 @@ o->maximum( phrase::phrases() );}
class O_Canvas class O_Canvas
} }
Fl_Group {} {open Fl_Group {} {open
xywh {0 694 865 78} xywh {0 694 865 78} color 47
} { } {
Fl_Input pattern_name_field { Fl_Input pattern_name_field {
label {name:} label {name:}

View File

@ -38,9 +38,8 @@
#include "../icons/icon-16x16.xpm" #include "../icons/icon-16x16.xpm"
#endif #endif
#include "FL/color_scheme.H" #include "FL/Fl_Theme.H"
#include "FL/Crystal_Boxtypes.H" #include "FL/themes.H"
#include "FL/Gleam_Boxtypes.H"
// extern const char *BUILD_ID; // extern const char *BUILD_ID;
// extern const char *VERSION; // extern const char *VERSION;
@ -274,11 +273,6 @@ main ( int argc, char **argv )
init_colors(); init_colors();
init_crystal_boxtypes();
init_gleam_boxtypes();
color_scheme( "dark" );
Fl::scheme( "plastic" );
ui = new UI; ui = new UI;
#ifdef HAVE_XPM #ifdef HAVE_XPM
@ -286,6 +280,10 @@ main ( int argc, char **argv )
#endif #endif
ui->main_window->show( 0, 0 ); ui->main_window->show( 0, 0 );
fl_register_themes();
Fl_Theme::set();
instance_name = strdup( APP_NAME ); instance_name = strdup( APP_NAME );
const char *nsm_url = getenv( "NSM_URL" ); const char *nsm_url = getenv( "NSM_URL" );

View File

@ -47,9 +47,7 @@
#define APP_NAME "Non Session Manager" #define APP_NAME "Non Session Manager"
#include "FL/Crystal_Boxtypes.H" #include "FL/themes.H"
#include "FL/Gleam_Boxtypes.H"
#include "FL/color_scheme.H"
#ifdef HAVE_XPM #ifdef HAVE_XPM
#include "FL/Fl.H" #include "FL/Fl.H"
@ -944,13 +942,6 @@ main (int argc, char **argv )
(char**)icon_16x16, &p, &mask, NULL); (char**)icon_16x16, &p, &mask, NULL);
#endif #endif
init_crystal_boxtypes();
init_gleam_boxtypes();
Fl::get_system_colors();
color_scheme( "Dark" );
Fl::scheme( "plastic" );
Fl::lock(); Fl::lock();
Fl_Double_Window *main_window; Fl_Double_Window *main_window;
@ -977,6 +968,10 @@ main (int argc, char **argv )
o->show( 0, NULL ); o->show( 0, NULL );
} }
fl_register_themes();
Fl_Theme::set();
static struct option long_options[] = static struct option long_options[] =
{ {
{ "nsm-url", required_argument, 0, 'n' }, { "nsm-url", required_argument, 0, 'n' },

View File

@ -28,8 +28,6 @@
#include "Transport.H" // for locate() #include "Transport.H" // for locate()
#include "FL/Crystal_Boxtypes.H"
#include "const.h" #include "const.h"
#include "debug.h" #include "debug.h"

View File

@ -28,9 +28,6 @@ decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local
decl {\#include "Fl_Menu_Settings.H"} {private local decl {\#include "Fl_Menu_Settings.H"} {private local
} }
decl {\#include "color_scheme.H"} {private local
}
decl {\#include "Timeline.H"} {private local decl {\#include "Timeline.H"} {private local
} }
@ -61,12 +58,6 @@ decl {\#include "Audio_Region.H" // for options} {private local
decl {\#include "Control_Sequence.H" // for options} {private local decl {\#include "Control_Sequence.H" // for options} {private local
} }
decl {\#include "FL/Crystal_Boxtypes.H"} {private local
}
decl {\#include "FL/Gleam_Boxtypes.H"} {private local
}
decl {\#include <FL/Fl_File_Chooser.H>} {private local decl {\#include <FL/Fl_File_Chooser.H>} {private local
} }
@ -165,18 +156,10 @@ Fl::lock();
} }
Function {TLE()} {open Function {TLE()} {open
} { } {
code { code {make_window();
make_window();
Fl::visible_focus( 0 ); Fl::visible_focus( 0 );
get_system_colors();
Fl::scheme( "gtk+" );
color_scheme( "dark" );
// constrain window to size of screen. // constrain window to size of screen.
{ {
int sx, sy, sw, sh; int sx, sy, sw, sh;
@ -241,7 +224,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {}
label {Non DAW : Timeline} label {Non DAW : Timeline}
callback {if ( Fl::event_key() != FL_Escape ) callback {if ( Fl::event_key() != FL_Escape )
timeline->command_quit();} open timeline->command_quit();} open
public xywh {705 125 1025 770} type Double resizable xclass Non_DAW visible xywh {705 125 1025 770} type Double resizable xclass Non_DAW visible
} { } {
Fl_Menu_Bar menubar {open Fl_Menu_Bar menubar {open
private xywh {0 0 1024 25} private xywh {0 0 1024 25}
@ -466,6 +449,12 @@ Project::compact();}
xywh {30 30 40 25} shortcut 0x33 xywh {30 30 40 25} shortcut 0x33
} }
} }
MenuItem {} {
label {&Theme}
callback {fl_theme_chooser();} selected
xywh {10 10 40 24}
code0 {\#include "FL/Fl_Theme_Chooser.H"}
}
} }
Submenu {} { Submenu {} {
label {&Options} open label {&Options} open
@ -555,56 +544,6 @@ timeline->redraw();}
xywh {50 50 40 25} type Toggle value 1 xywh {50 50 40 25} type Toggle value 1
} }
} }
Submenu {} {
label {&Style} open
xywh {10 10 74 25}
} {
MenuItem {} {
label Default
callback {Fl::scheme( "gtk+" );}
xywh {10 10 40 25} type Radio value 1
}
MenuItem {} {
label Flat
callback {Fl::scheme( "gtk+" );}
xywh {20 20 40 25} type Radio
}
MenuItem {} {
label Round
callback {Fl::scheme( "plastic" );}
xywh {30 30 40 25} type Radio
}
}
Submenu {} {
label {C&olors} open
xywh {10 10 74 25}
} {
MenuItem {} {
label Dark
callback {color_scheme( "dark" );}
xywh {20 20 40 25} type Radio value 1
}
MenuItem {} {
label {Very Dark}
callback {color_scheme( "very dark" );}
xywh {20 20 40 25} type Radio
}
MenuItem {} {
label Light
callback {color_scheme( "light" );}
xywh {30 30 40 25} type Radio
}
MenuItem {} {
label Gray
callback {color_scheme( "gray" );}
xywh {30 30 40 25} type Radio
}
MenuItem {} {
label System
callback {color_scheme( "system" );}
xywh {10 10 40 25} type Radio
}
}
} }
Submenu {} { Submenu {} {
label {&Behavior} open label {&Behavior} open
@ -654,23 +593,23 @@ ab.run();}
xywh {0 1 1025 73} xywh {0 1 1025 73}
} { } {
Fl_Pack {} {open Fl_Pack {} {open
xywh {0 23 483 46} type HORIZONTAL xywh {5 29 475 40} type HORIZONTAL
code0 {o->spacing( 10 );} code0 {o->spacing( 10 );}
} { } {
Fl_Box {} { Fl_Box {} {
label {<Transport>} label {<Transport>}
xywh {5 23 189 46} color 30 xywh {5 29 189 40} color 30
code0 {transport = o;} code0 {transport = o;}
code1 {o->labeltype( FL_NO_LABEL );} code1 {o->labeltype( FL_NO_LABEL );}
class Transport class Transport
} }
Fl_Pack clocks_pack { Fl_Pack clocks_pack {open
private xywh {195 23 288 46} type HORIZONTAL private xywh {195 29 285 40} type HORIZONTAL
code0 {o->spacing( 2 );} code0 {o->spacing( 2 );}
} { } {
Fl_Box {} { Fl_Box {} {
label PLAYHEAD label PLAYHEAD
private xywh {195 29 137 40} box BORDER_BOX color 40 private xywh {196 29 137 40} box BORDER_BOX color 40
code0 {o->type( Clock::HMS );} code0 {o->type( Clock::HMS );}
code1 {o->run( &transport->frame );} code1 {o->run( &transport->frame );}
class Clock class Clock
@ -686,11 +625,11 @@ ab.run();}
} }
Fl_Box {} { Fl_Box {} {
label {<empty>} label {<empty>}
xywh {487 27 148 42} resizable xywh {480 27 210 42} resizable
code0 {o->labeltype( FL_NO_LABEL );} code0 {o->labeltype( FL_NO_LABEL );}
} }
Fl_Group {} {open Fl_Group {} {open
xywh {745 26 280 44} xywh {810 26 215 44}
} { } {
Fl_Box {} { Fl_Box {} {
label {capture:} label {capture:}
@ -717,7 +656,7 @@ ab.run();}
private xywh {921 41 104 14} labelsize 10 private xywh {921 41 104 14} labelsize 10
} }
Fl_Box {} { Fl_Box {} {
label {filesystem} label filesystem
xywh {810 27 55 18} labelsize 10 align 16 xywh {810 27 55 18} labelsize 10 align 16
} }
Fl_Progress disk_usage_progress { Fl_Progress disk_usage_progress {
@ -824,8 +763,7 @@ project_name->redraw();} {}
} }
Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void} Function {update_progress( Fl_Progress *p, char *s, float v )} {private return_type {static void}
} { } {
code { code {if ( p->value() != v )
if ( p->value() != v )
{ {
p->value( v ); p->value( v );
@ -833,8 +771,7 @@ snprintf( s, 5, "%d%%", (int)v );
p->label( s ); p->label( s );
} }} {}
} {}
} }
Function {update_status()} {open private Function {update_status()} {open private
} { } {
@ -891,9 +828,7 @@ if ( timeline->session_manager_name() != NULL )
find_item( menubar, "&Project/&Open" )->deactivate(); find_item( menubar, "&Project/&Open" )->deactivate();
} }
// project_name->redraw(); // project_name->redraw();} {}
} {}
} }
Function {update_cb( void *v )} {open private return_type {static void} Function {update_cb( void *v )} {open private return_type {static void}
} { } {
@ -951,9 +886,7 @@ Function {set_theme_dark()} {C return_type void
} { } {
code {Fl::background2( 100, 100, 100 ); code {Fl::background2( 100, 100, 100 );
Fl::background( 50, 50, 50 ); Fl::background( 50, 50, 50 );
Fl::foreground( 255, 255, 255 ); Fl::foreground( 255, 255, 255 );} {}
Fl::scheme( Fl::scheme() );} {}
} }
class Project_Info_Dialog {open class Project_Info_Dialog {open
@ -1013,7 +946,7 @@ if ( logo_box->image() )
code0 {o->value( timeline->ntracks() );} code0 {o->value( timeline->ntracks() );}
} }
Fl_Box logo_box { Fl_Box logo_box {
label {<LOGO>} selected label {<LOGO>}
private xywh {20 173 485 268} color 53 labelfont 1 labelsize 18 align 16 private xywh {20 173 485 268} color 53 labelfont 1 labelsize 18 align 16
code0 {o->image( Fl_Shared_Image::get( PIXMAP_PATH "non-daw/icon-256x256.png" ) );} code0 {o->image( Fl_Shared_Image::get( PIXMAP_PATH "non-daw/icon-256x256.png" ) );}
code1 {o->label( NULL );} code1 {o->label( NULL );}

View File

@ -106,8 +106,6 @@ Track::~Track ( )
Loggable::block_end(); Loggable::block_end();
} }
#include "FL/Crystal_Boxtypes.H"
void void
Track::init ( void ) Track::init ( void )
{ {

View File

@ -42,8 +42,8 @@
#include "TLE.H" #include "TLE.H"
#include "Timeline.H" #include "Timeline.H"
#include "FL/Crystal_Boxtypes.H" #include "FL/themes.H"
#include "FL/Gleam_Boxtypes.H" #include "FL/Fl_Theme.H"
#include "Project.H" #include "Project.H"
#include "Transport.H" #include "Transport.H"
@ -184,9 +184,6 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Time_Point );
LOG_REGISTER_CREATE( Track ); LOG_REGISTER_CREATE( Track );
init_crystal_boxtypes();
init_gleam_boxtypes();
signal( SIGPIPE, SIG_IGN ); signal( SIGPIPE, SIG_IGN );
if ( ! ensure_dirs() ) if ( ! ensure_dirs() )
@ -250,6 +247,10 @@ main ( int argc, char **argv )
#endif #endif
tle->main_window->show( 0, NULL ); tle->main_window->show( 0, NULL );
fl_register_themes();
Fl_Theme::set();
char *nsm_url = getenv( "NSM_URL" ); char *nsm_url = getenv( "NSM_URL" );
if ( nsm_url ) if ( nsm_url )