Centralize color schemes.

Also, add new color scheme "Very Dark".
This commit is contained in:
Jonathan Moore Liles 2010-01-31 00:47:08 -06:00
parent 417497a368
commit b774ee3f50
5 changed files with 133 additions and 70 deletions

75
FL/color_scheme.C Normal file
View File

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

21
FL/color_scheme.H Normal file
View File

@ -0,0 +1,21 @@
/*******************************************************************************/
/* 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. */
/*******************************************************************************/
void color_scheme ( const char *name );
void get_system_colors ( void );

View File

@ -41,6 +41,8 @@
#include <string.h>
#include "debug.h"
#include "FL/color_scheme.H"
const double STATUS_UPDATE_FREQ = 0.2f;
extern char *user_config_dir;
@ -155,39 +157,19 @@ void Mixer::cb_menu(Fl_Widget* o) {
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&System") )
{
//Fl::get_system_colors();
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() );
color_scheme( "system" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Dark") )
{
Fl::background2( 100, 100, 100 );
Fl::background( 50, 50, 50 );
Fl::foreground( 255, 255, 255 );
Fl::scheme( Fl::scheme() );
color_scheme( "dark" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Very Dark") )
{
color_scheme( "very dark" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Light") )
{
Fl::background2( 192, 192, 192 );
Fl::background( 220, 220, 220 );
Fl::foreground( 0, 0, 0 );
Fl::scheme( Fl::scheme() );
color_scheme( "light" );
}
else if ( ! strcmp( picked, "&Help/&About" ) )
{
@ -214,13 +196,10 @@ 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::get_system_colors();
Fl::scheme( "plastic" );
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 );
color_scheme( "dark" );
_rows = 1;
box( FL_NO_BOX );
@ -237,9 +216,10 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
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/&Colors/&System", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE );
o->add( "_&Options/&Display/&Colors/&Dark", 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/&System", 0, 0, 0, FL_MENU_RADIO );
o->add( "&Help/&Manual" );
o->add( "&Help/&About" );
o->callback( cb_menu, this );

View File

@ -303,7 +303,7 @@ Mixer_Strip::init ( )
// box(FL_THIN_UP_BOX);
box( FL_RFLAT_BOX );
Fl_Group::color( fl_darker( FL_BACKGROUND_COLOR ) );
Fl_Group::color( FL_BACKGROUND_COLOR );
clip_children( 1 );
@ -461,7 +461,7 @@ Mixer_Strip::draw ( void )
if ( damage() != FL_DAMAGE_USER1 )
Fl_Group::draw();
Fl_Group::draw_box( FL_ROUNDED_FRAME, x(), y(), w(), h(), _focused ? Fl_Group::selection_color() : Fl_Group::color() );
Fl_Group::draw_box( FL_ROUNDED_FRAME, x(), y(), w(), h(), _focused ? Fl_Group::selection_color() : FL_BLACK );
}

View File

@ -26,6 +26,8 @@ decl {const float STATUS_UPDATE_FREQ = 0.1f;} {}
decl {\#include "Fl_Menu_Settings.H"} {}
decl {\#include "color_scheme.H"} {}
decl {\#include "Timeline.H"} {}
decl {\#include "Transport.H"} {}
@ -148,14 +150,11 @@ make_window();
Fl::visible_focus( 0 );
Fl::get_system_colors();
get_system_colors();
Fl::scheme( "plastic" );
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 );
set_theme_dark();
color_scheme( "dark" );
// constrain window to size of screen.
{
@ -554,43 +553,31 @@ timeline->redraw();}
label {C&olors} open
xywh {10 10 74 25}
} {
MenuItem {} {
label System
callback {//Fl::get_system_colors();
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() );}
xywh {10 10 40 25} type Radio
}
MenuItem {} {
label Dark
callback {
set_theme_dark(); }
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 {Fl::background2( 192, 192, 192 );
Fl::background( 220, 220, 220 );
Fl::foreground( 0, 0, 0 );
Fl::scheme( Fl::scheme() );}
callback {
color_scheme( "light" ); }
xywh {30 30 40 25} type Radio
}
MenuItem {} {
label System
callback {
color_scheme( "system" ); }
xywh {10 10 40 25} type Radio
}
}
}
Submenu {} {