2 /*******************************************************************************/
3 /* Copyright (C) 2008 Jonathan Moore Liles */
5 /* This program is free software; you can redistribute it and/or modify it */
6 /* under the terms of the GNU General Public License as published by the */
7 /* Free Software Foundation; either version 2 of the License, or (at your */
8 /* option) any later version. */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
12 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
15 /* You should have received a copy of the GNU General Public License along */
16 /* with This program; see the file COPYING. If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************************/
23 #include "Annotation_Point.H"
24 #include "Annotation_Region.H"
29 class Annotation_Sequence : public Sequence
34 virtual void get ( Log_Entry &e ) const
36 e.add( ":track", _track );
42 for ( int i = 0; i < e.size(); ++i )
48 if ( ! strcmp( ":track", s ) )
51 sscanf( v, "%X", &i );
52 Track *t = (Track*)Loggable::find( i );
61 Annotation_Sequence ( ) : Sequence ( 0 )
63 color( fl_darker( FL_GREEN ) );
69 LOG_CREATE_FUNC( Annotation_Sequence );
71 Fl_Cursor cursor ( void ) const { return FL_CURSOR_INSERT; }
73 Annotation_Sequence ( Track *track ) : Sequence( track )
75 color( fl_darker( FL_GREEN ) );
80 /* Annotation_Sequence ( int X, int Y, int W, int H ) : Sequence ( 0 ) */
84 ~Annotation_Sequence ( )
86 Loggable::block_start();
92 track()->remove( this );
94 Loggable::block_end();
100 if ( Sequence::handle( m ) )
109 if ( Fl::event_button1() )
111 add( new Annotation_Point( this, x_to_offset( Fl::event_x() ), "mark" ) );
114 if ( Fl::event_button3() && Fl::event_shift() )
116 Annotation_Region *r = new Annotation_Region( this, x_to_offset( Fl::event_x() ), "mark" );
120 Sequence_Widget::pushed( r );
129 else if ( Fl::event_button3() && ! ( Fl::event_state() & ( FL_ALT | FL_SHIFT | FL_CTRL ) ) )
132 Fl_Menu_Item menu[] =
138 const Fl_Menu_Item *r = menu->popup( Fl::event_x(), Fl::event_y(), "Annotation Sequence" );
142 if ( r == &menu[ 0 ] )
144 Fl::delete_widget( this );