Add fancy new focus frame.

pull/116/head
Jonathan Moore Liles 2013-09-06 23:42:21 -07:00
parent 933bfe882a
commit 7da3bb325f
5 changed files with 92 additions and 10 deletions

57
FL/focus_frame.C Normal file
View File

@ -0,0 +1,57 @@
/*******************************************************************************/
/* Copyright (C) 2012 Jonathan Moore Liles */
/* */
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */
/* Free Software Foundation; either version 2 of the License, or (at your */
/* option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU General Public License along */
/* with This program; see the file COPYING. If not,write to the Free Software */
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/
#include <FL/Fl.H>
#include <FL/fl_draw.H>
void
draw_focus_frame ( int x, int y, int w, int h, Fl_Color c )
{
fl_push_clip( x, y, w, h );
// fl_color( fl_color_average( FL_GRAY, c, 0.50 ) );
fl_color( fl_color_add_alpha( c, 100 ) );
fl_line_style( FL_DASH, 2 );
fl_rect( x, y, w, h );
fl_line_style( FL_SOLID, 2 );
fl_color( c );
int l = 15;
fl_line( x, y, x + l, y );
fl_line( x, y + l, x, y );
fl_line( x + w - 1, y, x + w - l - 1, y );
fl_line( x + w - 1, y, x + w - 1, y + l - 1 );
fl_line( x, y + h - 1, x, y + h - l - 1);
fl_line( x, y + h - 1, x + l, y + h - 1 );
fl_line( x + w - 1, y + h - 1, x + w - 1, y + h - l - 1 );
fl_line( x + w - 1, y + h - 1, x + w - l, y + h - 1 );
fl_line_style( FL_SOLID, 0 );
fl_pop_clip();
}

22
FL/focus_frame.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. */
/*******************************************************************************/
void
draw_focus_frame ( int x, int y, int w, int h, Fl_Color c );

View File

@ -21,6 +21,7 @@ New_Project_Dialog.fl
event_name.C
menu_popup.C
test_press.C
focus_frame.C
''',
includes = '.',
export_incdirs = [ '.' 'FL' ],

View File

@ -52,13 +52,14 @@
#include "Controller_Module.H"
#include "Meter_Indicator_Module.H"
#include "debug.h"
#include "FL/focus_frame.H"
#include <FL/Fl_Menu_Button.H>
#include "FL/test_press.H"
#include "FL/menu_popup.H"
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Choice.H>
#include "Group.H"
#include "FL/focus_frame.H"
extern Mixer *mixer;
@ -498,7 +499,7 @@ Mixer_Strip::update ( void )
void
Mixer_Strip::init ( )
{
selection_color( FL_RED );
selection_color( FL_MAGENTA );
_mute_controller_mode = 0;
_gain_controller_mode = 0;
@ -718,11 +719,13 @@ void
Mixer_Strip::draw ( void )
{
/* don't bother drawing anything else, all we're doing is drawing the focus. */
if ( damage() & ~FL_DAMAGE_USER1 )
// if ( damage() & ~FL_DAMAGE_USER1 )
Fl_Group::draw();
fl_color( Fl::focus() == this ? Fl_Group::selection_color() : FL_BLACK );
fl_rect( x(), y(), w(), h() );
if ( Fl::focus() == this )
draw_focus_frame( x(),y(),w(),h(), Fl_Group::selection_color() );
/* else */
/* clear_focus_frame( x(),y(),w(),h(), FL_BACKGROUND_COLOR ); */
}
/*****************/

View File

@ -36,6 +36,7 @@
#include "AUX_Module.H"
#include "Spatializer_Module.H"
#include "FL/focus_frame.H"
#include <FL/Fl_Menu_Button.H>
#include "FL/test_press.H"
#include "FL/menu_popup.H"
@ -138,7 +139,7 @@ Module::init ( void )
labeltype( FL_NO_LABEL );
align( FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
set_visible_focus();
selection_color( FL_RED );
selection_color( FL_MAGENTA );
labelsize(12);
color( fl_color_average( FL_WHITE, FL_CYAN, 0.40 ) );
tooltip( "Left click to edit parameters; Ctrl + left click to select; right click or MENU key for menu." );
@ -648,9 +649,7 @@ Module::draw_box ( int tx, int ty, int tw, int th )
fl_pop_clip();
if ( this == Fl::focus() )
{
fl_draw_box( FL_UP_FRAME, tx, ty, tw, th, selection_color() );
}
draw_focus_frame( tx,ty,tw,th, selection_color() );
fl_pop_clip();
}