Add 'gleam' inspired boxtypes to replace the ones in the gtk+ theme. Also, tweak crystal boxtypes.

This commit is contained in:
Jonathan Moore Liles 2012-03-01 20:23:23 -08:00
parent 6cd4dd6ea0
commit 9bb9a91b22
16 changed files with 271 additions and 50 deletions

View File

@ -21,10 +21,11 @@
#pragma GCC diagnostic ignored "-Wchar-subscripts"
#include "Boxtypes.H"
#include "Crystal_Boxtypes.H"
#include <FL/fl_draw.H>
#include <string.h>
/** This simple box is suitable for use with knob-type widgets. It
* comprises a border with shadow, and a cap with glare-lines akin
* to those seen on burnished aluminum knobs. */
@ -359,16 +360,12 @@ up_box ( int x, int y, int w, int h, Fl_Color c )
{
if ( w > 8 && h > 8 )
{
// shade_rect( x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c );
shade_rect( x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c );
// shade_rect( x + 1, y + 1, w - 2, h - 3, "STUVWVQRWXVUVVQ", c );
shade_rect( x + 1, y + 1, w - 2, h - 3, "FISPPQQRSSTTUPJ", c );
/* stipple */
fl_color( fl_color_average( FL_GRAY, c, 0.10f ) );
for ( int i = y + 1; i < y + h - 8; i += 5 )
fl_line( x + 1, i, x + w - 2, i );
// shade_rect( x + 1, y + 1, w - 2, h - 3, "FISPPQQRSSTTUPJ", c );
frame_rect( x, y, w, h - 1, "IJLM", c );
}
else
thin_up_box( x, y, w, h, c );
@ -395,7 +392,8 @@ down_box ( int x, int y, int w, int h, Fl_Color c )
{
if ( w > 6 && h > 6 )
{
shade_rect( x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c );
// shade_rect( x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c );
fl_rectf( x + 2, y + 2, w - 4, h - 5 , fl_darker( c ) );
down_frame( x, y, w, h, c );
}
else
@ -414,19 +412,10 @@ down_round ( int x, int y, int w, int h, Fl_Color c )
void
init_boxtypes ( void )
init_crystal_boxtypes ( void )
{
Fl::set_boxtype( FL_BURNISHED_OVAL_BOX, burnished_oval_box, 4, 4, 7, 7 );
Fl::set_boxtype( FL_CRYSTAL_UP_BOX, up_box, 4,4,8,8 );
Fl::set_boxtype( FL_CRYSTAL_DOWN_BOX, down_box, 2,2,4,4 );
Fl::set_boxtype( FL_CRYSTAL_UP_FRAME, up_frame, 2,2,4,4 );
Fl::set_boxtype( FL_CRYSTAL_DOWN_FRAME, down_frame, 2,2,4,4 );
Fl::set_boxtype( FL_CRYSTAL_THIN_UP_BOX, thin_up_box, 1,1,2,2 );
Fl::set_boxtype( FL_CRYSTAL_THIN_DOWN_BOX, down_box, 1,1,2,2 );
/* 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 );
@ -434,7 +423,6 @@ init_boxtypes ( void )
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_CRYSTAL_ROUND_UP_BOX, up_round, 1,1,2,2 );
Fl::set_boxtype( FL_CRYSTAL_ROUND_DOWN_BOX, down_round, 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 );
}

View File

@ -19,15 +19,6 @@
#include <FL/Fl.H>
#define FL_BURNISHED_OVAL_BOX FL_FREE_BOXTYPE
#define FL_BURNISHED_OVAL_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+0)
#define FL_CRYSTAL_UP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+1)
#define FL_CRYSTAL_DOWN_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+2)
#define FL_CRYSTAL_UP_FRAME (Fl_Boxtype)(FL_FREE_BOXTYPE+3)
#define FL_CRYSTAL_DOWN_FRAME (Fl_Boxtype)(FL_FREE_BOXTYPE+4)
#define FL_CRYSTAL_THIN_UP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+5)
#define FL_CRYSTAL_THIN_DOWN_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+6)
#define FL_CRYSTAL_ROUND_UP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+7)
#define FL_CRYSTAL_ROUND_DOWN_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+8)
void init_boxtypes ( void );
void init_crystal_boxtypes ( void );

180
FL/Gleam_Boxtypes.C Normal file
View File

@ -0,0 +1,180 @@
/*******************************************************************************/
/* 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 "Gleam_Boxtypes.H"
static void gleam_color(Fl_Color c)
{
if (Fl::draw_box_active())
fl_color(c);
else
fl_color(fl_inactive(c));
}
static void frame_rect(int x, int y, int w, int h, Fl_Color bc)
{
// Draw the outline around the perimeter of the box
fl_color(fl_color_average(FL_BLACK, FL_BACKGROUND_COLOR, .1));
fl_line(x, y, x + w, y);
fl_line(x + w, y, x + w, y + h);
fl_line(x + w, y + h, x, y + h);
fl_line(x, y + h, x, y);
}
static void shade_rect_up(int x, int y, int w, int h, Fl_Color bc)
{
// Draws the shiny
float third = (float) h / 3;
gleam_color(bc);
fl_rectf(x, y, w, third + 1);
//gleam_color(fl_color_average(bc, FL_WHITE, .90f));
//fl_rectf(x, y, w, half + 1);
float step_size = 0.10 / ((float) h - third);
int j = 0;
//step_size = (.1 / (float) half);
//printf("1 / %i = %f \n", half, (1.0/half));
/**
* This loop generates the nice gradient at the bottom of the
* widget
**/
for (float k = 1; k >= .90; k -= step_size)
{
j++;
gleam_color(fl_color_average(bc, FL_WHITE, k));
fl_line(x, y + j + third - 1, x + w - 1, y + j + third - 1);
}
}
static void frame_rect_up(int x, int y, int w, int h, Fl_Color bc)
{
// Draw the outline around the perimeter of the box
gleam_color(bc);
fl_line(x, y, x + w, y); //Go across.
fl_line(x, y + (h / 2), x, y + 1); //Go to top
fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
gleam_color(fl_darker(bc));
fl_line(x, y + h, x + w, y + h); //Go across again!
fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
}
static void frame_rect_down(int x, int y, int w, int h, Fl_Color bc)
{
// Draw the outline around the perimeter of the box
gleam_color(fl_darker(bc));
fl_line(x, y, x + w, y); //Go across.
fl_line(x, y + (h / 2), x, y + 1); //Go to top
fl_line(x + w, y + (h / 2), x + w, y + 1); //Go to top
//gleam_color(bc);
fl_line(x, y + h, x + w, y + h); //Go across again!
fl_line(x, y + (h / 2), x, y + h - 1); //Go to top
fl_line(x + w, y + (h / 2), x + w, y + h - 1); //Go to top
}
static void shade_rect_down(int x, int y, int w, int h, Fl_Color bc)
{
gleam_color(bc);
Fl_Color color = fl_color();
fl_rectf(x, y, w, h);
gleam_color(fl_color_average(bc, fl_darker(color), 0.65));
fl_line(x, y + 1, x + w, y + 1);
fl_line(x, y + 1, x, y + h - 2);
gleam_color(fl_color_average(bc, fl_darker(color), 0.85));
fl_line(x + 1, y + 2, x + w, y + 2);
fl_line(x + 1, y + 2, x + 1, y + h - 2);
}
static void up_frame(int x, int y, int w, int h, Fl_Color c)
{
frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
}
static void 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);
frame_rect_up(x, y, w - 1, h - 1, fl_darker(c));
//draw the inner rect.
frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_WHITE, .25f));
}
static void down_frame(int x, int y, int w, int h, Fl_Color c)
{
frame_rect_down(x, y, w - 1, h - 1, fl_darker(c));
}
static void down_box(int x, int y, int w, int h, Fl_Color c)
{
shade_rect_down(x + 1, y, w - 2, h, c);
down_frame(x, y, w, h, fl_darker(c));
//draw the inner rect.
//frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65));
}
static void thin_down_box(int x, int y, int w, int h, Fl_Color c)
{
down_box(x, y, w, h, c);
}
void
init_gleam_boxtypes ( 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 );
}

22
FL/Gleam_Boxtypes.H Normal file
View File

@ -0,0 +1,22 @@
/*******************************************************************************/
/* Copyright (C) 2012 Jonathan Moore Liles */
/* */
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */
/* Free Software Foundation; either version 2 of the License, or (at your */
/* option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU General Public License along */
/* with This program; see the file COPYING. If not,write to the Free Software */
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/
#include <FL/Fl.H>
void init_gleam_boxtypes ( void );

View File

@ -36,6 +36,12 @@ get_system_colors ( void )
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 );

View File

@ -30,7 +30,7 @@
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Light_Button.H>
#include "FL/Boxtypes.H"
#include "FL/Crystal_Boxtypes.H"
#include <FL/fl_draw.H>
#include "FL/Fl_Arc_Dial.H"
#include "FL/Fl_Labelpad_Group.H"
@ -342,7 +342,7 @@ Controller_Module::connect_to ( Port *p )
w = o;
o->type(4);
o->color(FL_GRAY0);
o->color(FL_BACKGROUND_COLOR);
o->selection_color((Fl_Color)1);
o->minimum(1.5);
o->maximum(0);

View File

@ -56,6 +56,7 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
DPM::blend( FL_GREEN, FL_RED );
box( FL_ROUNDED_BOX );
color( FL_BACKGROUND_COLOR );
}
/* which marks to draw beside meter */

View File

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

View File

@ -252,12 +252,16 @@ void Mixer::cb_menu(Fl_Widget* o) {
}
else if (! strcmp( picked, "&Options/&Display/&Style/&Default") )
{
Fl::scheme( "plastic" );
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" );
@ -274,6 +278,10 @@ void Mixer::cb_menu(Fl_Widget* o) {
{
color_scheme( "light" );
}
else if (! strcmp( picked, "&Options/&Display/&Colors/&Gray") )
{
color_scheme( "gray" );
}
else if ( ! strcmp( picked, "&Help/&About" ) )
{
About_Dialog ab( PIXMAP_PATH "/non-mixer/icon-256x256.png" );
@ -336,9 +344,11 @@ 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/&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( "&Help/&Manual" );
o->add( "&Help/&About" );

View File

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

View File

@ -204,10 +204,12 @@ Module_Parameter_Editor::make_controls ( void )
o->maximum( p->hints.maximum );
}
o->box( FL_BURNISHED_OVAL_BOX );
// o->box( FL_BURNISHED_OVAL_BOX );
o->box( FL_ROUNDED_BOX );
o->color( fl_darker( fl_darker( FL_GRAY ) ) );
o->selection_color( FL_WHITE );
o->value( p->control_value() );
o->type( FL_FILL_DIAL );
// o->step( fabs( ( o->maximum() - o->minimum() ) ) / 32.0f );
}

View File

@ -32,7 +32,8 @@
#include <FL/fl_ask.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Pack.H>
#include <FL/Boxtypes.H>
#include <FL/Crystal_Boxtypes.H>
#include <FL/Gleam_Boxtypes.H>
#include "Thread.H"
#include "debug.h"
@ -163,12 +164,13 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Meter_Indicator_Module );
LOG_REGISTER_CREATE( Controller_Module );
init_boxtypes();
init_crystal_boxtypes();
init_gleam_boxtypes();
signal( SIGPIPE, SIG_IGN );
Fl::get_system_colors();
Fl::scheme( "plastic" );
Fl::scheme( "gtk+" );
Fl::lock();

View File

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

View File

@ -61,6 +61,12 @@ 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 <FL/Fl_File_Chooser.H>} {private local
}
@ -167,7 +173,7 @@ Fl::visible_focus( 0 );
get_system_colors();
Fl::scheme( "plastic" );
Fl::scheme( "gtk+" );
color_scheme( "dark" );
@ -555,7 +561,7 @@ timeline->redraw();}
} {
MenuItem {} {
label Default
callback {Fl::scheme( "plastic" );}
callback {Fl::scheme( "gtk+" );}
xywh {10 10 40 25} type Radio value 1
}
MenuItem {} {
@ -563,6 +569,11 @@ timeline->redraw();}
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
@ -583,6 +594,11 @@ timeline->redraw();}
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" );}

View File

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

View File

@ -41,7 +41,9 @@
#include "TLE.H"
#include "Timeline.H"
#include "../FL/Boxtypes.H"
#include "FL/Crystal_Boxtypes.H"
#include "FL/Gleam_Boxtypes.H"
#include "Project.H"
#include "Transport.H"
@ -172,7 +174,8 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Time_Point );
LOG_REGISTER_CREATE( Track );
init_boxtypes();
init_crystal_boxtypes();
init_gleam_boxtypes();
signal( SIGPIPE, SIG_IGN );