Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

899 lines
21KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. /* A Track is a container for various sequences; the sequence, the
  19. * takes (inactive sequences), annotation sequences, control
  20. * sequences */
  21. /* TODO: split into Track and Audio_Track (and maybe later Video_Track
  22. * and MIDI_Track */
  23. #include <sys/time.h>
  24. #include "Track.H"
  25. #include "Transport.H"
  26. #include "../FL/Fl_Sometimes_Input.H"
  27. #include <FL/fl_ask.H>
  28. #include <FL/Fl_Color_Chooser.H>
  29. #include <FL/Fl.H>
  30. #include "Engine/Engine.H" // for lock()
  31. #include "Control_Sequence.H"
  32. #include "Annotation_Sequence.H"
  33. #include "const.h"
  34. #include "util/debug.h"
  35. int Track::_soloing = 0;
  36. const char *Track::capture_format = "Wav 24";
  37. Track::Track ( const char *L, int channels ) :
  38. Fl_Group ( 0, 0, 0, 0, 0 )
  39. {
  40. init();
  41. if ( L )
  42. name( L );
  43. color( (Fl_Color)rand() );
  44. configure_inputs( channels );
  45. configure_outputs( channels );
  46. log_create();
  47. }
  48. Track::Track ( ) : Fl_Group( 0, 0, 1, 1 )
  49. {
  50. init();
  51. timeline->add_track( this );
  52. }
  53. Track::~Track ( )
  54. {
  55. Loggable::block_start();
  56. /* must destroy sequences first to preserve proper log order */
  57. takes->clear();
  58. control->clear();
  59. annotation->clear();
  60. delete sequence();
  61. takes = NULL;
  62. control = NULL;
  63. annotation = NULL;
  64. log_destroy();
  65. /* ensure that soloing accounting is performed */
  66. solo( false );
  67. timeline->remove_track( this );
  68. /* give up our ports */
  69. configure_inputs( 0 );
  70. configure_outputs( 0 );
  71. _sequence = NULL;
  72. if ( _name )
  73. free( _name );
  74. Loggable::block_end();
  75. }
  76. #include "FL/Boxtypes.H"
  77. void
  78. Track::init ( void )
  79. {
  80. _sequence = NULL;
  81. _name = NULL;
  82. _selected = false;
  83. _show_all_takes = false;
  84. _size = 1;
  85. record_ds = NULL;
  86. playback_ds = NULL;
  87. labeltype( FL_NO_LABEL );
  88. // clear_visible_focus();
  89. Fl_Group::size( timeline->w(), height() );
  90. Track *o = this;
  91. o->box( FL_THIN_UP_BOX );
  92. {
  93. Fl_Group *o = new Fl_Group( 0, 0, 149, 70 );
  94. o->color( ( Fl_Color ) 53 );
  95. {
  96. Fl_Input *o = name_field = new Fl_Sometimes_Input( 2, 2, 144, 24 );
  97. o->color( FL_BACKGROUND_COLOR );
  98. o->labeltype( FL_NO_LABEL );
  99. o->labelcolor( FL_GRAY0 );
  100. o->textcolor( FL_FOREGROUND_COLOR );
  101. o->callback( cb_input_field, (void*)this );
  102. }
  103. {
  104. Fl_Group *o = controls = new Fl_Group( 2, 28, 149, 24 );
  105. {
  106. Fl_Button *o = record_button =
  107. new Fl_Button( 6, 28, 26, 24, "@circle" );
  108. o->type( 1 );
  109. o->box( FL_ROUNDED_BOX );
  110. o->down_box( FL_ROUNDED_BOX );
  111. o->color( FL_LIGHT1 );
  112. o->selection_color( FL_RED );
  113. o->labelsize( 9 );
  114. o->callback( cb_button, this );
  115. }
  116. {
  117. Fl_Button *o = mute_button =
  118. new Fl_Button( 35, 28, 26, 24, "m" );
  119. o->selection_color( fl_color_average( FL_YELLOW, FL_GREEN, 0.50 ) );
  120. o->type( 1 );
  121. o->box( FL_ROUNDED_BOX );
  122. o->down_box( FL_ROUNDED_BOX );
  123. o->color( FL_LIGHT1 );
  124. o->labelsize( 15 );
  125. o->callback( cb_button, this );
  126. }
  127. {
  128. Fl_Button *o = solo_button =
  129. new Fl_Button( 66, 28, 26, 24, "s" );
  130. o->selection_color( fl_color_average( FL_YELLOW, FL_RED, 0.50 ) );
  131. o->type( 1 );
  132. o->box( FL_ROUNDED_BOX );
  133. o->down_box( FL_ROUNDED_BOX );
  134. o->color( FL_LIGHT1 );
  135. o->labelsize( 15 );
  136. o->callback( cb_button, this );
  137. }
  138. {
  139. Fl_Menu_Button *o = take_menu =
  140. new Fl_Menu_Button( 97, 28, 47, 24, "T" );
  141. o->box( FL_THIN_UP_BOX );
  142. o->color( FL_LIGHT1 );
  143. o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
  144. o->callback( cb_button, this );
  145. o->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE );
  146. o->add( "New", 0, 0, 0, FL_MENU_DIVIDER );
  147. }
  148. o->end();
  149. }
  150. {
  151. Fl_Box *o = new Fl_Box( 0, 72, 149, 38 );
  152. o->box( FL_NO_BOX );
  153. Fl_Group::current()->resizable( o );
  154. }
  155. o->size( Track::width(), h() );
  156. o->end();
  157. }
  158. {
  159. Fl_Pack *o = pack = new Fl_Pack( width(), 0, 1006, 115 );
  160. o->labeltype( FL_NO_LABEL );
  161. o->resize( x() + width(), y(), w() - width(), h() );
  162. resizable( o );
  163. {
  164. // Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 0 );
  165. Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 1 );
  166. o->end();
  167. }
  168. {
  169. Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 0 );
  170. o->end();
  171. }
  172. {
  173. Fl_Pack *o = takes = new Fl_Pack( width(), 0, pack->w(), 0 );
  174. o->end();
  175. o->hide();
  176. }
  177. o->end();
  178. }
  179. end();
  180. }
  181. void
  182. Track::set ( Log_Entry &e )
  183. {
  184. for ( int i = 0; i < e.size(); ++i )
  185. {
  186. const char *s, *v;
  187. e.get( i, &s, &v );
  188. if ( ! strcmp( s, ":height" ) )
  189. {
  190. size( atoi( v ) );
  191. resize();
  192. }
  193. else if ( ! strcmp( s, ":selected" ) )
  194. _selected = atoi( v );
  195. // else if ( ! strcmp( s, ":armed"
  196. else if ( ! strcmp( s, ":name" ) )
  197. name( v );
  198. else if ( ! strcmp( s, ":inputs" ) )
  199. configure_inputs( atoi( v ) );
  200. else if ( ! strcmp( s, ":outputs" ) )
  201. configure_outputs( atoi( v ) );
  202. else if ( ! strcmp( s, ":color" ) )
  203. {
  204. color( (Fl_Color)atoll( v ) );
  205. redraw();
  206. }
  207. else if ( ! strcmp( s, ":show-all-takes" ) )
  208. show_all_takes( atoi( v ) );
  209. else if ( ! strcmp( s, ":solo" ) )
  210. solo( atoi( v ) );
  211. else if ( ! strcmp( s, ":mute" ) )
  212. mute( atoi( v ) );
  213. else if ( ! strcmp( s, ":arm" ) )
  214. armed( atoi( v ) );
  215. else if ( ! strcmp( s, ":sequence" ) )
  216. {
  217. int i;
  218. sscanf( v, "%X", &i );
  219. if ( i )
  220. {
  221. Audio_Sequence *t = (Audio_Sequence*)Loggable::find( i );
  222. /* FIXME: our track might not have been
  223. * defined yet... what should we do about this
  224. * chicken/egg problem? */
  225. if ( t )
  226. {
  227. // assert( t );
  228. sequence( t );
  229. }
  230. }
  231. }
  232. }
  233. }
  234. void
  235. Track::get ( Log_Entry &e ) const
  236. {
  237. e.add( ":name", _name );
  238. e.add( ":sequence", sequence() );
  239. e.add( ":selected", _selected );
  240. e.add( ":color", (unsigned long)color());
  241. }
  242. void
  243. Track::get_unjournaled ( Log_Entry &e ) const
  244. {
  245. e.add( ":height", size() );
  246. e.add( ":inputs", input.size() );
  247. e.add( ":outputs", output.size() );
  248. e.add( ":show-all-takes", _show_all_takes );
  249. e.add( ":armed", armed() );
  250. e.add( ":mute", mute() );
  251. e.add( ":solo", solo() );
  252. }
  253. void
  254. Track::log_children ( void ) const
  255. {
  256. log_create();
  257. for ( int i = control->children(); i--; )
  258. ((Sequence*)control->child( i ))->log_children();
  259. for ( int i = annotation->children(); i--; )
  260. ((Sequence*)annotation->child( i ))->log_children();
  261. for ( int i = takes->children(); i--; )
  262. ((Sequence*)takes->child( i ))->log_children();
  263. sequence()->log_children();
  264. }
  265. void
  266. Track::solo ( bool b )
  267. {
  268. if ( b && ! solo_button->value() )
  269. ++_soloing;
  270. else if ( ! b && solo_button->value() )
  271. --_soloing;
  272. solo_button->value( b );
  273. }
  274. void
  275. Track::cb_input_field ( Fl_Widget *, void *v )
  276. {
  277. ((Track*)v)->cb_input_field();
  278. }
  279. void
  280. Track::cb_button ( Fl_Widget *w, void *v )
  281. {
  282. ((Track*)v)->cb_button( w );
  283. }
  284. void
  285. Track::cb_input_field ( void )
  286. {
  287. log_start();
  288. name( name_field->value() );
  289. log_end();
  290. }
  291. void
  292. Track::cb_button ( Fl_Widget *w )
  293. {
  294. if ( w == record_button )
  295. {
  296. }
  297. if ( w == mute_button )
  298. {
  299. }
  300. if ( w == solo_button )
  301. {
  302. if ( solo_button->value() )
  303. ++_soloing;
  304. else
  305. --_soloing;
  306. }
  307. else
  308. if ( w == take_menu )
  309. {
  310. int v = take_menu->value();
  311. switch ( v )
  312. {
  313. case 0: /* show all takes */
  314. show_all_takes( take_menu->menu()[ v ].value() );
  315. break;
  316. case 1: /* new */
  317. sequence( (Audio_Sequence*)sequence()->clone_empty() );
  318. break;
  319. case 2: /* remove */
  320. if ( takes->children() )
  321. {
  322. Loggable::block_start();
  323. Audio_Sequence *s = sequence();
  324. sequence( (Audio_Sequence*)takes->child( 0 ) );
  325. delete s;
  326. Loggable::block_end();
  327. }
  328. break;
  329. case 3:
  330. if ( takes->children() )
  331. {
  332. Loggable::block_start();
  333. takes->clear();
  334. Loggable::block_end();
  335. }
  336. break;
  337. default:
  338. sequence( (Audio_Sequence*)take_menu->menu()[ v ].user_data() );
  339. }
  340. }
  341. }
  342. static int pack_visible( Fl_Pack *p )
  343. {
  344. int v = 0;
  345. for ( int i = p->children(); i--; )
  346. if ( p->child( i )->visible() )
  347. v++;
  348. return v;
  349. }
  350. /* adjust size of widget and children */
  351. void
  352. Track::resize ( void )
  353. {
  354. for ( int i = takes->children(); i--; )
  355. takes->child( i )->size( w(), height() );
  356. for ( int i = annotation->children(); i--; )
  357. annotation->child( i )->size( w(), 24 );
  358. for ( int i = control->children(); i--; )
  359. control->child( i )->size( w(), height() );
  360. /* FIXME: hack! */
  361. if ( annotation->children() )
  362. annotation->show();
  363. else
  364. annotation->hide();
  365. if ( _show_all_takes )
  366. {
  367. takes->show();
  368. Fl_Group::size( w(), height() * ( 1 + takes->children() + pack_visible( control ) ) );
  369. }
  370. else
  371. {
  372. takes->hide();
  373. Fl_Group::size( w(), height() * ( 1 + pack_visible( control ) ) );
  374. }
  375. Fl_Group::size( w(), h() + ( ( 24 ) * pack_visible( annotation ) ) );
  376. if ( sequence() )
  377. sequence()->size( w(), height() );
  378. if ( controls->y() + controls->h() > y() + h() )
  379. controls->hide();
  380. else
  381. controls->show();
  382. /* FIXME: why is this necessary? */
  383. if ( parent() )
  384. parent()->parent()->redraw();
  385. }
  386. void
  387. Track::size ( int v )
  388. {
  389. if ( v < 0 || v > 3 )
  390. return;
  391. _size = v;
  392. resize();
  393. }
  394. void
  395. Track::update_take_menu ( void )
  396. {
  397. take_menu->clear();
  398. take_menu->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE | ( _show_all_takes ? FL_MENU_VALUE : 0 ) );
  399. take_menu->add( "New", 0, 0, 0 );
  400. if ( takes->children() )
  401. {
  402. take_menu->add( "Remove", 0, 0, 0 );
  403. take_menu->add( "Remove others", 0, 0, 0, FL_MENU_DIVIDER );
  404. for ( int i = 0; i < takes->children(); ++i )
  405. {
  406. Sequence *s = (Sequence *)takes->child( i );
  407. take_menu->add( s->name(), 0, 0, s );
  408. }
  409. }
  410. }
  411. void
  412. Track::add ( Audio_Sequence * t )
  413. {
  414. takes->insert( *t, 0 );
  415. t->color( fl_color_average( FL_BLACK, FL_GRAY, 0.25f ) );
  416. t->labeltype( FL_ENGRAVED_LABEL );
  417. update_take_menu();
  418. }
  419. void
  420. Track::remove ( Audio_Sequence *t )
  421. {
  422. if ( ! takes )
  423. return;
  424. timeline->wrlock();
  425. if ( sequence() == t )
  426. {
  427. pack->remove( t );
  428. if ( takes->children() )
  429. sequence( (Audio_Sequence*)takes->child( 0 ) );
  430. else
  431. /* FIXME: should this ever happen? */
  432. _sequence = NULL;
  433. }
  434. else
  435. takes->remove( t );
  436. /* delete t; */
  437. timeline->unlock();
  438. resize();
  439. update_take_menu();
  440. }
  441. void
  442. Track::remove ( Annotation_Sequence *t )
  443. {
  444. if ( ! annotation )
  445. return;
  446. annotation->remove( t );
  447. resize();
  448. }
  449. void
  450. Track::remove ( Control_Sequence *t )
  451. {
  452. if ( ! control )
  453. return;
  454. engine->lock();
  455. control->remove( t );
  456. engine->unlock();
  457. resize();
  458. }
  459. void
  460. Track::sequence ( Audio_Sequence * t )
  461. {
  462. t->track( this );
  463. if ( sequence() )
  464. add( sequence() );
  465. _sequence = t;
  466. pack->insert( *t, 1 );
  467. t->color( FL_GRAY );
  468. t->labeltype( FL_NO_LABEL );
  469. update_take_menu();
  470. resize();
  471. }
  472. void
  473. Track::add ( Control_Sequence *t )
  474. {
  475. DMESSAGE( "adding control sequence" );
  476. engine->lock();
  477. t->track( this );
  478. control->add( t );
  479. engine->unlock();
  480. resize();
  481. }
  482. void
  483. Track::add ( Annotation_Sequence *t )
  484. {
  485. DMESSAGE( "adding annotation sequence" );
  486. t->track( this );
  487. annotation->add( t );
  488. resize();
  489. }
  490. /** add all widget on this track falling within the given rectangle to
  491. the selection. */
  492. void
  493. Track::select ( int X, int Y, int W, int H,
  494. bool include_control, bool merge_control )
  495. {
  496. Sequence *t = sequence();
  497. if ( ! ( t->y() > Y + H || t->y() + t->h() < Y ) )
  498. t->select_range( X, W );
  499. else
  500. include_control = true;
  501. if ( include_control )
  502. for ( int i = control->children(); i--; )
  503. {
  504. Control_Sequence *c = (Control_Sequence*)control->child( i );
  505. if ( merge_control ||
  506. ( c->y() >= Y && c->y() + c->h() <= Y + H ) )
  507. c->select_range( X, W );
  508. }
  509. }
  510. #include <FL/Fl_Menu_Button.H>
  511. void
  512. Track::menu_cb ( Fl_Widget *w, void *v )
  513. {
  514. ((Track*)v)->menu_cb( (Fl_Menu_*) w );
  515. }
  516. void
  517. Track::menu_cb ( const Fl_Menu_ *m )
  518. {
  519. char picked[256];
  520. m->item_pathname( picked, sizeof( picked ) );
  521. Logger log( this );
  522. if ( ! strcmp( picked, "Type/Mono" ) )
  523. {
  524. configure_inputs( 1 );
  525. configure_outputs( 1 );
  526. }
  527. else if ( ! strcmp( picked, "Type/Stereo" ) )
  528. {
  529. configure_inputs( 2 );
  530. configure_outputs( 2 );
  531. }
  532. else if ( ! strcmp( picked, "Type/Quad" ) )
  533. {
  534. configure_inputs( 4 );
  535. configure_outputs( 4 );
  536. }
  537. else if ( ! strcmp( picked, "Type/..." ) )
  538. {
  539. const char *s = fl_input( "How many channels?", "3" );
  540. if ( s )
  541. {
  542. int c = atoi( s );
  543. if ( c <= 0 || c > 10 )
  544. fl_alert( "Invalid number of channels." );
  545. else
  546. {
  547. configure_inputs( c );
  548. configure_outputs( c );
  549. }
  550. }
  551. }
  552. else if ( ! strcmp( picked, "/Add Control" ) )
  553. {
  554. new Control_Sequence( this );
  555. }
  556. else if ( ! strcmp( picked, "/Add Annotation" ) )
  557. {
  558. add( new Annotation_Sequence( this ) );
  559. }
  560. else if ( ! strcmp( picked, "/Color" ) )
  561. {
  562. unsigned char r, g, b;
  563. Fl::get_color( color(), r, g, b );
  564. if ( fl_color_chooser( "Track Color", r, g, b ) )
  565. {
  566. color( fl_rgb_color( r, g, b ) );
  567. }
  568. redraw();
  569. }
  570. else if ( ! strcmp( picked, "Flags/Record" ) )
  571. {
  572. armed( m->mvalue()->flags & FL_MENU_VALUE );
  573. }
  574. else if ( ! strcmp( picked, "Flags/Mute" ) )
  575. {
  576. mute( m->mvalue()->flags & FL_MENU_VALUE );
  577. }
  578. else if ( ! strcmp( picked, "Flags/Solo" ) )
  579. {
  580. solo( m->mvalue()->flags & FL_MENU_VALUE );
  581. }
  582. else if ( ! strcmp( picked, "Size/Small" ) )
  583. {
  584. size( 0 );
  585. }
  586. else if ( ! strcmp( picked, "Size/Medium" ) )
  587. {
  588. size( 1 );
  589. }
  590. else if ( ! strcmp( picked, "Size/Large" ) )
  591. {
  592. size( 2 );
  593. }
  594. else if ( ! strcmp( picked, "Size/Huge" ) )
  595. {
  596. size( 3 );
  597. }
  598. else if ( ! strcmp( picked, "/Remove" ) )
  599. {
  600. int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );
  601. if ( r == 2 )
  602. {
  603. timeline->remove_track( this );
  604. Fl::delete_widget( this );
  605. }
  606. }
  607. else if ( ! strcmp( picked, "/Rename" ) )
  608. {
  609. ((Fl_Sometimes_Input*)name_field)->take_focus();
  610. }
  611. }
  612. #include "FL/menu_popup.H"
  613. /** build the context menu */
  614. Fl_Menu_Button &
  615. Track::menu ( void ) const
  616. {
  617. static Fl_Menu_Button m( 0, 0, 0, 0, "Track" );
  618. int c = output.size();
  619. int s = size();
  620. Fl_Menu_Item menu[] =
  621. {
  622. { "Type", 0, 0, 0, FL_SUBMENU },
  623. { "Mono", 0, 0, 0, FL_MENU_RADIO | ( c == 1 ? FL_MENU_VALUE : 0 ) },
  624. { "Stereo", 0, 0, 0, FL_MENU_RADIO | ( c == 2 ? FL_MENU_VALUE : 0 ) },
  625. { "Quad", 0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) },
  626. { "...", 0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) },
  627. { 0 },
  628. { "Add Control", 0, 0, 0 },
  629. { "Add Annotation", 0, 0, 0 },
  630. { "Color", 0, 0, 0 },
  631. { "Rename", FL_CTRL + 'n', 0, 0 },
  632. { "Size", 0, 0, 0, FL_SUBMENU },
  633. { "Small", FL_ALT + '1', 0, 0, FL_MENU_RADIO | ( s == 0 ? FL_MENU_VALUE : 0 ) },
  634. { "Medium", FL_ALT + '2', 0, 0, FL_MENU_RADIO | ( s == 1 ? FL_MENU_VALUE : 0 ) },
  635. { "Large", FL_ALT + '3', 0, 0, FL_MENU_RADIO | ( s == 2 ? FL_MENU_VALUE : 0 ) },
  636. { "Huge", FL_ALT + '4', 0, 0, FL_MENU_RADIO | ( s == 3 ? FL_MENU_VALUE : 0 ) },
  637. { 0 },
  638. { "Flags", 0, 0, 0, FL_SUBMENU },
  639. { "Record", FL_CTRL + 'r', 0, 0, FL_MENU_TOGGLE | ( armed() ? FL_MENU_VALUE : 0 ) },
  640. { "Mute", FL_CTRL + 'm', 0, 0, FL_MENU_TOGGLE | ( mute() ? FL_MENU_VALUE : 0 ) },
  641. { "Solo", FL_CTRL + 's', 0, 0, FL_MENU_TOGGLE | ( solo() ? FL_MENU_VALUE : 0 ) },
  642. { 0 },
  643. { "Remove", 0, 0, 0 }, // transport->rolling ? FL_MENU_INACTIVE : 0 },
  644. { 0 },
  645. };
  646. menu_set_callback( menu, &Track::menu_cb, (void*)this );
  647. m.copy( menu, (void*)this );
  648. return m;
  649. }
  650. #include "FL/event_name.H"
  651. #include "FL/test_press.H"
  652. void
  653. Track::draw ( void )
  654. {
  655. if ( _selected )
  656. {
  657. Fl_Color c = color();
  658. color( FL_RED );
  659. Fl_Group::draw();
  660. color( c );
  661. }
  662. else
  663. Fl_Group::draw();
  664. }
  665. int
  666. Track::handle ( int m )
  667. {
  668. /* if ( m != FL_NO_EVENT ) */
  669. /* DMESSAGE( "%s", event_name( m ) ); */
  670. switch ( m )
  671. {
  672. case FL_KEYBOARD:
  673. {
  674. Fl_Menu_Button * men = &menu();
  675. if ( Fl::event_key() == FL_Menu )
  676. {
  677. menu_popup( men );
  678. return 1;
  679. }
  680. else
  681. return men->test_shortcut() || Fl_Group::handle( m );
  682. }
  683. case FL_MOUSEWHEEL:
  684. {
  685. Logger log( this );
  686. if ( ! Fl::event_shift() )
  687. return 0;
  688. int d = Fl::event_dy();
  689. if ( d < 0 )
  690. size( size() - 1 );
  691. else
  692. size( size() + 1 );
  693. return 1;
  694. }
  695. case FL_PUSH:
  696. {
  697. Logger log( this );
  698. if ( Fl_Group::handle( m ) )
  699. return 1;
  700. if ( test_press( FL_BUTTON3 ) && Fl::event_x() < Track::width() )
  701. {
  702. menu_popup( &menu() );
  703. return 1;
  704. }
  705. return 0;
  706. }
  707. default:
  708. return Fl_Group::handle( m );
  709. }
  710. return 0;
  711. }