From fdcf74ddbe6f1c4136dfbdab92ace83af748f382 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 10 Apr 2012 23:59:12 -0700 Subject: [PATCH] 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. --- FL/Clean_Theme.C | 89 ++++++++ FL/{Gleam_Boxtypes.H => Clean_Theme.H} | 4 +- FL/{Crystal_Boxtypes.C => Crystal_Theme.C} | 34 +-- FL/{Crystal_Boxtypes.H => Crystal_Theme.H} | 6 +- FL/Fl_Theme.C | 230 +++++++++++++++++++++ FL/Fl_Theme.H | 120 +++++++++++ FL/Fl_Theme_Chooser.fl | 180 ++++++++++++++++ FL/{Gleam_Boxtypes.C => Gleam_Theme.C} | 43 ++-- FL/{color_scheme.H => Gleam_Theme.H} | 5 +- FL/color_scheme.C | 81 -------- FL/makefile.inc | 8 +- FL/ntk-chtheme.C | 32 +++ FL/themes.H | 82 ++++++++ mixer/src/Controller_Module.C | 1 - mixer/src/Meter_Indicator_Module.C | 1 - mixer/src/Mixer.C | 48 +---- mixer/src/Mixer_Strip.H | 1 - mixer/src/Module_Parameter_Editor.C | 3 +- mixer/src/main.C | 14 +- sequencer/src/gui/ui.fl | 28 +-- sequencer/src/main.C | 14 +- session-manager/src/session-manager.C | 15 +- timeline/src/Sequence.C | 2 - timeline/src/TLE.fl | 109 ++-------- timeline/src/Track.C | 2 - timeline/src/main.C | 11 +- 26 files changed, 846 insertions(+), 317 deletions(-) create mode 100644 FL/Clean_Theme.C rename FL/{Gleam_Boxtypes.H => Clean_Theme.H} (96%) rename FL/{Crystal_Boxtypes.C => Crystal_Theme.C} (94%) rename FL/{Crystal_Boxtypes.H => Crystal_Theme.H} (91%) create mode 100644 FL/Fl_Theme.C create mode 100644 FL/Fl_Theme.H create mode 100644 FL/Fl_Theme_Chooser.fl rename FL/{Gleam_Boxtypes.C => Gleam_Theme.C} (80%) rename FL/{color_scheme.H => Gleam_Theme.H} (90%) delete mode 100644 FL/color_scheme.C create mode 100644 FL/ntk-chtheme.C create mode 100644 FL/themes.H diff --git a/FL/Clean_Theme.C b/FL/Clean_Theme.C new file mode 100644 index 0000000..4ee8ebd --- /dev/null +++ b/FL/Clean_Theme.C @@ -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 +#include + +#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 ); +} diff --git a/FL/Gleam_Boxtypes.H b/FL/Clean_Theme.H similarity index 96% rename from FL/Gleam_Boxtypes.H rename to FL/Clean_Theme.H index ebef3e7..8aa99bd 100644 --- a/FL/Gleam_Boxtypes.H +++ b/FL/Clean_Theme.H @@ -17,6 +17,4 @@ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*******************************************************************************/ -#include - -void init_gleam_boxtypes ( void ); +void init_clean_theme ( void ); diff --git a/FL/Crystal_Boxtypes.C b/FL/Crystal_Theme.C similarity index 94% rename from FL/Crystal_Boxtypes.C rename to FL/Crystal_Theme.C index 7ca4788..b69d727 100644 --- a/FL/Crystal_Boxtypes.C +++ b/FL/Crystal_Theme.C @@ -20,11 +20,11 @@ #pragma GCC diagnostic ignored "-Wchar-subscripts" - -#include "Crystal_Boxtypes.H" #include #include +#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. */ @@ -370,16 +370,26 @@ down_round ( int x, int y, int w, int h, Fl_Color c ) } -void -init_crystal_boxtypes ( void ) +static void +init_theme ( void ) { + printf( "Initializing crystal boxtypes" ); + /* 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_PLASTIC_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_PLASTIC_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_PLASTIC_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_PLASTIC_ROUND_DOWN_BOX, down_round, 1,1,2,2 ); + 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 ); } diff --git a/FL/Crystal_Boxtypes.H b/FL/Crystal_Theme.H similarity index 91% rename from FL/Crystal_Boxtypes.H rename to FL/Crystal_Theme.H index 8bd29e7..77e20cc 100644 --- a/FL/Crystal_Boxtypes.H +++ b/FL/Crystal_Theme.H @@ -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 */ /* 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. */ /*******************************************************************************/ -#include - -void init_crystal_boxtypes ( void ); +void init_crystal_theme ( void ); diff --git a/FL/Fl_Theme.C b/FL/Fl_Theme.C new file mode 100644 index 0000000..d508402 --- /dev/null +++ b/FL/Fl_Theme.C @@ -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 +#include +#include + +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; +} + + + + + diff --git a/FL/Fl_Theme.H b/FL/Fl_Theme.H new file mode 100644 index 0000000..fcfb364 --- /dev/null +++ b/FL/Fl_Theme.H @@ -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 + +/* 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; } +}; diff --git a/FL/Fl_Theme_Chooser.fl b/FL/Fl_Theme_Chooser.fl new file mode 100644 index 0000000..e5b9eb1 --- /dev/null +++ b/FL/Fl_Theme_Chooser.fl @@ -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 } {public global +} + +decl {\#include } {private local +} + +decl {\#include } {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 } + 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();} {} +} diff --git a/FL/Gleam_Boxtypes.C b/FL/Gleam_Theme.C similarity index 80% rename from FL/Gleam_Boxtypes.C rename to FL/Gleam_Theme.C index daea4a0..ed94e45 100644 --- a/FL/Gleam_Boxtypes.C +++ b/FL/Gleam_Theme.C @@ -23,7 +23,7 @@ #include #include -#include "Gleam_Boxtypes.H" +#include "FL/Fl_Theme.H" 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)); } -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) { 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)); } -static void thin_down_box(int x, int y, int w, int h, Fl_Color c) +static void +init_theme ( void ) { - - down_box(x, y, w, h, c); - + /* 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_boxtypes ( void ) +init_gleam_theme ( void ) { - /* replace the gtk+ boxes... (is there a better way?) */ - 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 *t = new Fl_Theme( "Gleam", "", "", init_theme ); + Fl_Theme::add( t ); +} diff --git a/FL/color_scheme.H b/FL/Gleam_Theme.H similarity index 90% rename from FL/color_scheme.H rename to FL/Gleam_Theme.H index f3fa636..9ed1072 100644 --- a/FL/color_scheme.H +++ b/FL/Gleam_Theme.H @@ -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 */ /* 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. */ /*******************************************************************************/ -void color_scheme ( const char *name ); -void get_system_colors ( void ); +void init_gleam_theme ( void ); diff --git a/FL/color_scheme.C b/FL/color_scheme.C deleted file mode 100644 index 4a94198..0000000 --- a/FL/color_scheme.C +++ /dev/null @@ -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 -#include - -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() ); -} diff --git a/FL/makefile.inc b/FL/makefile.inc index 51071f9..10e0bba 100644 --- a/FL/makefile.inc +++ b/FL/makefile.inc @@ -11,7 +11,7 @@ SRCS:=$(SRCS:.fl=.C) SRCS:=$(sort $(SRCS)) OBJS:=$(SRCS:.C=.o) -all: FL/libfl_widgets.a +all: FL/libfl_widgets.a ntk-chtheme FL/libfl_widgets.a: $(OBJS) @ ar rcs $@ $(OBJS) @@ -19,8 +19,12 @@ FL/libfl_widgets.a: $(OBJS) .PHONEY: FL 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: rm -f $(OBJS) FL/libfl_widgets.a .deps install: - @ \ No newline at end of file + @ diff --git a/FL/ntk-chtheme.C b/FL/ntk-chtheme.C new file mode 100644 index 0000000..7f9e232 --- /dev/null +++ b/FL/ntk-chtheme.C @@ -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(); +} diff --git a/FL/themes.H b/FL/themes.H new file mode 100644 index 0000000..8d75565 --- /dev/null +++ b/FL/themes.H @@ -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 ); + } +} diff --git a/mixer/src/Controller_Module.C b/mixer/src/Controller_Module.C index f9b1714..2e12764 100644 --- a/mixer/src/Controller_Module.C +++ b/mixer/src/Controller_Module.C @@ -30,7 +30,6 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" #include #include "FL/Fl_Arc_Dial.H" #include "FL/Fl_Labelpad_Group.H" diff --git a/mixer/src/Meter_Indicator_Module.C b/mixer/src/Meter_Indicator_Module.C index ad8e511..9648692 100644 --- a/mixer/src/Meter_Indicator_Module.C +++ b/mixer/src/Meter_Indicator_Module.C @@ -27,7 +27,6 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" #include "FL/Fl_Arc_Dial.H" #include "FL/Fl_Labelpad_Group.H" diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index eddc8cf..0a63643 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -35,6 +35,7 @@ #include "FL/Fl_Menu_Settings.H" #include "About_Dialog.H" #include +#include "FL/Fl_Theme_Chooser.H" #include "file.h" @@ -44,7 +45,6 @@ #include #include "FL/Fl_Value_SliderX.H" -#include "FL/color_scheme.H" #include "OSC/Endpoint.H" #include #include "FL/Fl_Blinker.H" @@ -274,37 +274,9 @@ void Mixer::cb_menu(Fl_Widget* o) { { rows( 3 ); } - else if (! strcmp( picked, "&Options/&Display/&Style/&Default") ) + else if (! strcmp( picked, "&View/&Theme") ) { - Fl::scheme( "gtk+" ); - } - 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" ); + fl_theme_chooser(); } 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 ) : Fl_Group( X, Y, W, H, L ) { - get_system_colors(); - - Fl::scheme( "plastic" ); - color_scheme( "dark" ); - Loggable::dirty_callback( &Mixer::handle_dirty, this ); _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/Two", '2', 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( "_&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( "&View/&Theme", 0, 0, 0 ); 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/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); diff --git a/mixer/src/Mixer_Strip.H b/mixer/src/Mixer_Strip.H index 968f96a..5186d4e 100644 --- a/mixer/src/Mixer_Strip.H +++ b/mixer/src/Mixer_Strip.H @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/mixer/src/Module_Parameter_Editor.C b/mixer/src/Module_Parameter_Editor.C index e6c3830..674a421 100644 --- a/mixer/src/Module_Parameter_Editor.C +++ b/mixer/src/Module_Parameter_Editor.C @@ -27,7 +27,6 @@ #include #include #include -#include "FL/Crystal_Boxtypes.H" #include "FL/Fl_Flowpack.H" #include "FL/Fl_Labelpad_Group.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; _resized = false; diff --git a/mixer/src/main.C b/mixer/src/main.C index 49b2673..5150593 100644 --- a/mixer/src/main.C +++ b/mixer/src/main.C @@ -32,8 +32,8 @@ #include #include #include -#include -#include +#include "FL/themes.H" +#include "FL/Fl_Theme.H" #include "Thread.H" #include "debug.h" @@ -174,14 +174,8 @@ main ( int argc, char **argv ) LOG_REGISTER_CREATE( Meter_Indicator_Module ); LOG_REGISTER_CREATE( Controller_Module ); - init_crystal_boxtypes(); - init_gleam_boxtypes(); - signal( SIGPIPE, SIG_IGN ); - Fl::get_system_colors(); - Fl::scheme( "gtk+" ); - Fl::lock(); Fl_Double_Window *main_window; @@ -209,6 +203,10 @@ main ( int argc, char **argv ) o->show( 0, 0 ); } + fl_register_themes(); + + Fl_Theme::set(); + const char *osc_port = NULL; nsm = new NSM_Client; diff --git a/sequencer/src/gui/ui.fl b/sequencer/src/gui/ui.fl index 4617a9c..147f65a 100644 --- a/sequencer/src/gui/ui.fl +++ b/sequencer/src/gui/ui.fl @@ -34,6 +34,9 @@ decl {class Fl_Scalepack;} {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 } @@ -149,12 +152,6 @@ class UI {open } { 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; playback_mode_menu = NULL; @@ -225,11 +222,11 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape ) if ( maybe_save_song() ) 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 } { - Fl_Menu_Bar menu_bar {open selected - xywh {0 0 865 30} color 37 + Fl_Menu_Bar menu_bar {open + xywh {0 0 865 30} color 47 } { Submenu {} { label {&File} open @@ -438,6 +435,11 @@ config.follow_playhead = val ? true : false;} xywh {0 0 40 24} type Radio value 1 } } + MenuItem {} { + label {&Theme} + callback {fl_theme_chooser();} + xywh {0 0 40 24} + } } Submenu {} { label {&Help} open @@ -763,7 +765,7 @@ if ( playlist->length() ) } Fl_Group phrase_tab { label Phrase open - xywh {0 98 865 674} color 37 + xywh {0 98 865 674} color 47 hide code0 {update_phrase_widgets();} } { Fl_Box phrase_canvas_widget { @@ -814,8 +816,8 @@ o->maximum( phrase::phrases() );} } } Fl_Group pattern_tab { - label Pattern open - xywh {0 98 865 674} color 37 hide + label Pattern open selected + xywh {0 98 865 674} color 47 code0 {update_pattern_widgets();} } { Fl_Box pattern_canvas_widget { @@ -828,7 +830,7 @@ o->maximum( phrase::phrases() );} class O_Canvas } Fl_Group {} {open - xywh {0 694 865 78} + xywh {0 694 865 78} color 47 } { Fl_Input pattern_name_field { label {name:} diff --git a/sequencer/src/main.C b/sequencer/src/main.C index 1c3a213..ccce2ef 100644 --- a/sequencer/src/main.C +++ b/sequencer/src/main.C @@ -38,9 +38,8 @@ #include "../icons/icon-16x16.xpm" #endif -#include "FL/color_scheme.H" -#include "FL/Crystal_Boxtypes.H" -#include "FL/Gleam_Boxtypes.H" +#include "FL/Fl_Theme.H" +#include "FL/themes.H" // extern const char *BUILD_ID; // extern const char *VERSION; @@ -274,11 +273,6 @@ main ( int argc, char **argv ) init_colors(); - init_crystal_boxtypes(); - init_gleam_boxtypes(); - color_scheme( "dark" ); - Fl::scheme( "plastic" ); - ui = new UI; #ifdef HAVE_XPM @@ -286,6 +280,10 @@ main ( int argc, char **argv ) #endif ui->main_window->show( 0, 0 ); + fl_register_themes(); + + Fl_Theme::set(); + instance_name = strdup( APP_NAME ); const char *nsm_url = getenv( "NSM_URL" ); diff --git a/session-manager/src/session-manager.C b/session-manager/src/session-manager.C index d200e28..a98f809 100644 --- a/session-manager/src/session-manager.C +++ b/session-manager/src/session-manager.C @@ -47,9 +47,7 @@ #define APP_NAME "Non Session Manager" -#include "FL/Crystal_Boxtypes.H" -#include "FL/Gleam_Boxtypes.H" -#include "FL/color_scheme.H" +#include "FL/themes.H" #ifdef HAVE_XPM #include "FL/Fl.H" @@ -944,13 +942,6 @@ main (int argc, char **argv ) (char**)icon_16x16, &p, &mask, NULL); #endif - init_crystal_boxtypes(); - init_gleam_boxtypes(); - - Fl::get_system_colors(); - - color_scheme( "Dark" ); - Fl::scheme( "plastic" ); Fl::lock(); Fl_Double_Window *main_window; @@ -976,6 +967,10 @@ main (int argc, char **argv ) #endif o->show( 0, NULL ); } + + fl_register_themes(); + + Fl_Theme::set(); static struct option long_options[] = { diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index 74b5a6c..71a2256 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -28,8 +28,6 @@ #include "Transport.H" // for locate() -#include "FL/Crystal_Boxtypes.H" - #include "const.h" #include "debug.h" diff --git a/timeline/src/TLE.fl b/timeline/src/TLE.fl index f637fab..df7d042 100644 --- a/timeline/src/TLE.fl +++ b/timeline/src/TLE.fl @@ -28,9 +28,6 @@ decl {const float STATUS_UPDATE_FREQ = 0.5f;} {private local decl {\#include "Fl_Menu_Settings.H"} {private local } -decl {\#include "color_scheme.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 "FL/Crystal_Boxtypes.H"} {private local -} - -decl {\#include "FL/Gleam_Boxtypes.H"} {private local -} - decl {\#include } {private local } @@ -165,18 +156,10 @@ Fl::lock(); } Function {TLE()} {open } { - code { - -make_window(); + code {make_window(); Fl::visible_focus( 0 ); -get_system_colors(); - -Fl::scheme( "gtk+" ); - -color_scheme( "dark" ); - // constrain window to size of screen. { int sx, sy, sw, sh; @@ -241,7 +224,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} label {Non DAW : Timeline} callback {if ( Fl::event_key() != FL_Escape ) 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 private xywh {0 0 1024 25} @@ -466,6 +449,12 @@ Project::compact();} 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 {} { label {&Options} open @@ -555,56 +544,6 @@ timeline->redraw();} 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 {} { label {&Behavior} open @@ -654,23 +593,23 @@ ab.run();} xywh {0 1 1025 73} } { Fl_Pack {} {open - xywh {0 23 483 46} type HORIZONTAL + xywh {5 29 475 40} type HORIZONTAL code0 {o->spacing( 10 );} } { Fl_Box {} { label {} - xywh {5 23 189 46} color 30 + xywh {5 29 189 40} color 30 code0 {transport = o;} code1 {o->labeltype( FL_NO_LABEL );} class Transport } - Fl_Pack clocks_pack { - private xywh {195 23 288 46} type HORIZONTAL + Fl_Pack clocks_pack {open + private xywh {195 29 285 40} type HORIZONTAL code0 {o->spacing( 2 );} } { Fl_Box {} { 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 );} code1 {o->run( &transport->frame );} class Clock @@ -686,11 +625,11 @@ ab.run();} } Fl_Box {} { label {} - xywh {487 27 148 42} resizable + xywh {480 27 210 42} resizable code0 {o->labeltype( FL_NO_LABEL );} } Fl_Group {} {open - xywh {745 26 280 44} + xywh {810 26 215 44} } { Fl_Box {} { label {capture:} @@ -717,7 +656,7 @@ ab.run();} private xywh {921 41 104 14} labelsize 10 } Fl_Box {} { - label {filesystem} + label filesystem xywh {810 27 55 18} labelsize 10 align 16 } 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} } { - code { -if ( p->value() != v ) + code {if ( p->value() != v ) { p->value( v ); @@ -833,8 +771,7 @@ snprintf( s, 5, "%d%%", (int)v ); p->label( s ); -} -} {} +}} {} } Function {update_status()} {open private } { @@ -891,9 +828,7 @@ if ( timeline->session_manager_name() != NULL ) find_item( menubar, "&Project/&Open" )->deactivate(); } -// project_name->redraw(); - -} {} +// project_name->redraw();} {} } 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 ); Fl::background( 50, 50, 50 ); - Fl::foreground( 255, 255, 255 ); - - Fl::scheme( Fl::scheme() );} {} + Fl::foreground( 255, 255, 255 );} {} } class Project_Info_Dialog {open @@ -1013,7 +946,7 @@ if ( logo_box->image() ) code0 {o->value( timeline->ntracks() );} } Fl_Box logo_box { - label {} selected + label {} 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" ) );} code1 {o->label( NULL );} diff --git a/timeline/src/Track.C b/timeline/src/Track.C index 1a42171..f2fecb6 100644 --- a/timeline/src/Track.C +++ b/timeline/src/Track.C @@ -106,8 +106,6 @@ Track::~Track ( ) Loggable::block_end(); } -#include "FL/Crystal_Boxtypes.H" - void Track::init ( void ) { diff --git a/timeline/src/main.C b/timeline/src/main.C index 3405990..98c972d 100644 --- a/timeline/src/main.C +++ b/timeline/src/main.C @@ -42,8 +42,8 @@ #include "TLE.H" #include "Timeline.H" -#include "FL/Crystal_Boxtypes.H" -#include "FL/Gleam_Boxtypes.H" +#include "FL/themes.H" +#include "FL/Fl_Theme.H" #include "Project.H" #include "Transport.H" @@ -184,9 +184,6 @@ main ( int argc, char **argv ) LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Track ); - init_crystal_boxtypes(); - init_gleam_boxtypes(); - signal( SIGPIPE, SIG_IGN ); if ( ! ensure_dirs() ) @@ -249,6 +246,10 @@ main ( int argc, char **argv ) tle->main_window->icon((char *)p); #endif tle->main_window->show( 0, NULL ); + + fl_register_themes(); + + Fl_Theme::set(); char *nsm_url = getenv( "NSM_URL" );