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.

748 lines
20KB

  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. #include <FL/fl_draw.H>
  19. #include <FL/Fl.H>
  20. #include <FL/Fl_Widget.H>
  21. #include <FL/Fl_Menu_Item.H>
  22. #include <FL/fl_show_colormap.H>
  23. #include "Sequence.H"
  24. #include "Audio_Region.H"
  25. #include "Timeline.H"
  26. #include "Waveform.H"
  27. #include "Audio_Sequence.H"
  28. #include "Track.H"
  29. #include "Engine/Audio_File.H"
  30. #include <algorithm>
  31. using std::min;
  32. using std::max;
  33. extern Timeline *timeline;
  34. bool Audio_Region::inherit_track_color = true;
  35. Fl_Boxtype Audio_Region::_box = FL_UP_BOX;
  36. Fl_Color Audio_Region::_selection_color = FL_MAGENTA;
  37. static Fl_Color fl_invert_color ( Fl_Color c )
  38. {
  39. unsigned char r, g, b;
  40. Fl::get_color( c, r, g, b );
  41. return fl_rgb_color( 255 - r, 255 - g, 255 - b );
  42. }
  43. void
  44. Audio_Region::get ( Log_Entry &e ) const
  45. {
  46. e.add( ":source", _clip ? _clip->name() : "" );
  47. e.add( ":gain", _scale );
  48. e.add( ":fade-in-type", _fade_in.type );
  49. e.add( ":fade-in-duration", _fade_in.length );
  50. e.add( ":fade-out-type", _fade_out.type );
  51. e.add( ":fade-out-duration", _fade_out.length );
  52. Sequence_Region::get( e );
  53. e.add( ":offset", _r->offset );
  54. e.add( ":loop", _loop );
  55. }
  56. void
  57. Audio_Region::set ( Log_Entry &e )
  58. {
  59. for ( int i = 0; i < e.size(); ++i )
  60. {
  61. const char *s, *v;
  62. e.get( i, &s, &v );
  63. if ( ! strcmp( s, ":gain" ) )
  64. _scale = atof( v );
  65. else if ( ! strcmp( s, ":color" ) )
  66. _box_color = (Fl_Color)atoi( v );
  67. else if ( ! strcmp( s, ":fade-in-type" ) )
  68. _fade_in.type = (Fade::fade_type_e)atoi( v );
  69. else if ( ! strcmp( s, ":fade-in-duration" ) )
  70. _fade_in.length = atoll( v );
  71. else if ( ! strcmp( s, ":fade-out-type" ) )
  72. _fade_out.type = (Fade::fade_type_e)atoi( v );
  73. else if ( ! strcmp( s, ":fade-out-duration" ) )
  74. _fade_out.length = atoll( v );
  75. else if ( ! strcmp( s, ":offset" ) )
  76. _r->offset = atoll( v );
  77. else if ( ! strcmp( s, ":loop" ) )
  78. _loop = atoll( v );
  79. else if ( ! strcmp( s, ":source" ) )
  80. {
  81. if ( ! ( _clip = Audio_File::from_file( v ) ) )
  82. {
  83. printf( "Grave error: could not open source \"%s\"\n", v );
  84. }
  85. }
  86. }
  87. Sequence_Region::set( e );
  88. }
  89. void
  90. Audio_Region::init ( void )
  91. {
  92. _loop = 0;
  93. _sequence = NULL;
  94. _scale = 1.0f;
  95. _clip = NULL;
  96. _box_color = FL_CYAN;
  97. _color = FL_BLUE;
  98. _fade_in.length = 256;
  99. _fade_in.type = Fade::Sigmoid;
  100. _fade_out = _fade_in;
  101. }
  102. /* copy constructor */
  103. Audio_Region::Audio_Region ( const Audio_Region & rhs ) : Sequence_Region( rhs )
  104. {
  105. // *((Sequence_Region*)this) = (Sequence_Region &)rhs;
  106. _clip = rhs._clip;
  107. _scale = rhs._scale;
  108. _fade_in = rhs._fade_in;
  109. _fade_out = rhs._fade_out;
  110. _loop = rhs._loop;
  111. log_create();
  112. }
  113. /* */
  114. Audio_Region::Audio_Region ( Audio_File *c )
  115. {
  116. init();
  117. _clip = c;
  118. _r->length = _clip->length();
  119. log_create();
  120. }
  121. /* used when DND importing */
  122. Audio_Region::Audio_Region ( Audio_File *c, Sequence *t, nframes_t o )
  123. {
  124. init();
  125. _clip = c;
  126. _sequence = t;
  127. _r->offset = 0;
  128. _r->start = o;
  129. _r->length = _clip->length();
  130. sequence()->add( this );
  131. int sum = 0;
  132. const char *s = rindex( _clip->name(), '/' );
  133. if ( ! s )
  134. s = _clip->name();
  135. for ( int i = strlen( s ); i--; )
  136. sum += s[ i ];
  137. while ( sum >> 8 )
  138. sum = (sum & 0xFF) + (sum >> 8);
  139. _color = (Fl_Color)sum;
  140. /* _color = fl_color_average( FL_YELLOW, (Fl_Color)sum, 0.80 ); */
  141. // _color = FL_YELLOW;
  142. _box_color = FL_WHITE;
  143. log_create();
  144. }
  145. Audio_Region::~Audio_Region ( )
  146. {
  147. log_destroy();
  148. }
  149. void
  150. Audio_Region::menu_cb ( Fl_Widget *w, void *v )
  151. {
  152. ((Audio_Region*)v)->menu_cb( (Fl_Menu_*) w );
  153. }
  154. void
  155. Audio_Region::menu_cb ( const Fl_Menu_ *m )
  156. {
  157. char picked[256];
  158. m->item_pathname( picked, sizeof( picked ) );
  159. Logger log( this );
  160. if ( ! strcmp( picked, "Fade/In/Linear" ) )
  161. _fade_in.type = Fade::Linear;
  162. else if ( ! strcmp( picked, "Fade/In/Sigmoid" ) )
  163. _fade_in.type = Fade::Sigmoid;
  164. else if ( ! strcmp( picked, "Fade/In/Logarithmic" ) )
  165. _fade_in.type = Fade::Logarithmic;
  166. else if ( ! strcmp( picked, "Fade/In/Parabolic" ) )
  167. _fade_in.type = Fade::Parabolic;
  168. else if ( ! strcmp( picked, "Fade/Out/Linear" ) )
  169. _fade_out.type = Fade::Linear;
  170. else if ( ! strcmp( picked, "Fade/Out/Sigmoid" ) )
  171. _fade_out.type = Fade::Sigmoid;
  172. else if ( ! strcmp( picked, "Fade/Out/Logarithmic" ) )
  173. _fade_out.type = Fade::Logarithmic;
  174. else if ( ! strcmp( picked, "Fade/Out/Parabolic" ) )
  175. _fade_out.type = Fade::Parabolic;
  176. else if ( ! strcmp( picked, "/Color" ) )
  177. box_color( fl_show_colormap( box_color() ) );
  178. else if ( ! strcmp( picked, "/Fade in to mouse" ) )
  179. {
  180. nframes_t offset = x_to_offset( Fl::event_x() );
  181. if ( offset < length() )
  182. _fade_in.length = offset;
  183. DMESSAGE( "set fade in duration" );
  184. }
  185. else if ( ! strcmp( picked, "/Fade out to mouse" ) )
  186. {
  187. long offset = length() - x_to_offset( Fl::event_x() );
  188. if ( offset > 0 )
  189. _fade_out.length = offset;
  190. }
  191. else if ( ! strcmp( picked, "/Loop point to mouse" ) )
  192. {
  193. nframes_t offset = x_to_offset( Fl::event_x() );
  194. if ( offset > 0 )
  195. {
  196. nframes_t f = offset + _r->start;
  197. if ( timeline->nearest_line( &f, false ) )
  198. _loop = f - _r->start;
  199. else
  200. _loop = offset;
  201. }
  202. }
  203. else if ( ! strcmp( picked, "/Clear loop point" ) )
  204. _loop = 0;
  205. else if ( ! strcmp( picked, "/Normalize" ) )
  206. normalize();
  207. else if ( ! strcmp( picked, "/Remove" ) )
  208. remove();
  209. else
  210. FATAL( "Unknown menu choice \"%s\"", picked );
  211. redraw();
  212. }
  213. #include "FL/test_press.H"
  214. #include "FL/menu_popup.H"
  215. /** build the context menu for this region */
  216. Fl_Menu_Button &
  217. Audio_Region::menu ( void )
  218. {
  219. static Fl_Menu_Button m( 0, 0, 0, 0, "Region" );
  220. Fade::fade_type_e it = _fade_in.type;
  221. Fade::fade_type_e ot = _fade_out.type;
  222. Fl_Menu_Item items[] =
  223. {
  224. { "Fade", 0, 0, 0, FL_SUBMENU },
  225. { "In", 0, 0, 0, FL_SUBMENU },
  226. { "Linear", 0, 0, 0, FL_MENU_RADIO | ( it == Fade::Linear ? FL_MENU_VALUE : 0 ) },
  227. { "Sigmoid", 0, 0, 0, FL_MENU_RADIO | ( it == Fade::Sigmoid ? FL_MENU_VALUE : 0 ) },
  228. { "Logarithmic", 0, 0, 0, FL_MENU_RADIO | ( it == Fade::Logarithmic ? FL_MENU_VALUE : 0 ) },
  229. { "Parabolic", 0, 0, 0, FL_MENU_RADIO | ( it == Fade::Parabolic ? FL_MENU_VALUE : 0 ) },
  230. { 0 },
  231. { "Out", 0, 0, 0, FL_SUBMENU },
  232. { "Linear", 0, 0, 0, FL_MENU_RADIO | ( ot == Fade::Linear ? FL_MENU_VALUE : 0 ) },
  233. { "Sigmoid", 0, 0, 0, FL_MENU_RADIO | ( ot == Fade::Sigmoid ? FL_MENU_VALUE : 0 ) },
  234. { "Logarithmic", 0, 0, 0, FL_MENU_RADIO | ( ot == Fade::Logarithmic ? FL_MENU_VALUE : 0 ) },
  235. { "Parabolic", 0, 0, 0, FL_MENU_RADIO | ( ot == Fade::Parabolic ? FL_MENU_VALUE : 0 ) },
  236. { 0 },
  237. { 0 },
  238. { "Color", 0, 0, 0, inherit_track_color ? FL_MENU_INACTIVE : 0 },
  239. { "Fade in to mouse", FL_F + 3, 0, 0 },
  240. { "Fade out to mouse", FL_F + 4, 0, 0 },
  241. { "Loop point to mouse", 'l', 0, 0 },
  242. { "Clear loop point", FL_SHIFT + 'l', 0, 0 },
  243. { "Normalize", 'n', 0, 0 },
  244. { "Remove", 0, 0, 0 },
  245. { 0 },
  246. };
  247. menu_set_callback( items, &Audio_Region::menu_cb, (void*)this );
  248. m.copy( items, (void*)this );
  249. return m;
  250. }
  251. /** Draws the curve for a single fade. /X/ and /W/ repersent the
  252. portion of the region covered by this draw, which may or may not
  253. cover the fade in question. */
  254. void
  255. Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, int W )
  256. {
  257. const int dy = y() + Fl::box_dy( box() );
  258. const int dh = h() - Fl::box_dh( box() );
  259. const int height = dh;
  260. const int width = timeline->ts_to_x( fade.length );
  261. fl_color( fl_lighter( FL_BLACK ) );
  262. fl_push_matrix();
  263. if ( dir == Fade::In )
  264. fl_translate( line_x(), dy );
  265. else
  266. {
  267. fl_translate( line_x() + abs_w(), dy );
  268. /* flip */
  269. fl_scale( -1.0, 1.0 );
  270. }
  271. fl_scale( width, height );
  272. if ( line )
  273. fl_begin_line();
  274. else
  275. fl_begin_polygon();
  276. fl_vertex( 0.0, 0.0 );
  277. fl_vertex( 0.0, 1.0 );
  278. // if ( draw_real_fade_curve )
  279. {
  280. nframes_t tsx = timeline->x_to_ts( 1 );
  281. nframes_t ts = 0;
  282. for ( int i = 0; i < width; ++i, ts += tsx )
  283. fl_vertex( i / (float)width, 1.0f - fade.gain( ts / (float)fade.length ) );
  284. }
  285. fl_vertex( 1.0, 0.0 );
  286. if ( line )
  287. fl_end_line();
  288. else
  289. fl_end_polygon();
  290. fl_pop_matrix();
  291. }
  292. struct Peaks_Redraw_Request {
  293. Audio_Region *region;
  294. nframes_t start;
  295. nframes_t end;
  296. Peaks_Redraw_Request ( Audio_Region *region, nframes_t start, nframes_t end ) : region( region ), start( start), end( end )
  297. {
  298. }
  299. };
  300. /* static wrapper */
  301. void
  302. Audio_Region::peaks_pending_cb ( void *v )
  303. {
  304. Peaks_Redraw_Request *r = (Peaks_Redraw_Request*)v;
  305. r->region->peaks_pending_cb( r );
  306. }
  307. void
  308. Audio_Region::peaks_pending_cb ( Peaks_Redraw_Request *r )
  309. {
  310. int npeaks = timeline->ts_to_x( r->end - r->start );
  311. if ( _clip->peaks()->ready( r->start, npeaks, timeline->fpp() ) )
  312. {
  313. printf( "damaging from timeout\n" );
  314. /* FIXME: only need to damage the affected area! */
  315. timeline->damage( FL_DAMAGE_ALL, x(), y(), w(), h() );
  316. delete r;
  317. }
  318. else
  319. Fl::repeat_timeout( 0.1f, &Audio_Region::peaks_pending_cb, (void*)r );
  320. }
  321. void
  322. Audio_Region::draw_box( void )
  323. {
  324. /* dirty hack to keep the box from flipping to vertical at small sizes */
  325. fl_push_clip( x(), y(), w(), h() );
  326. Fl_Color selection_color = _selection_color;
  327. Fl_Color color = Audio_Region::inherit_track_color ? sequence()->track()->color() : _box_color;
  328. color = fl_color_average( color, sequence()->color(), 0.75f );
  329. if ( this == ((Audio_Sequence*)sequence())->capture_region() )
  330. {
  331. color = FL_RED;
  332. }
  333. else if ( ! active_r() )
  334. {
  335. color = fl_inactive( color );
  336. selection_color = fl_inactive( selection_color );
  337. }
  338. if ( selected() )
  339. fl_draw_box( fl_down( box() ), x() - ( h() >> 1 ), y(), w() + ( h() >> 1 ) + 50, h(), selection_color );
  340. else
  341. fl_draw_box( box(), x() - ( h() >> 1 ), y(), w() + ( h() >> 1 ) + 50, h(), color );
  342. /* draw fades */
  343. draw_fade( _fade_in, Fade::In, false, x(), w() );
  344. draw_fade( _fade_out, Fade::Out, false, x(), w() );
  345. fl_pop_clip();
  346. }
  347. /** Draw (part of) region. X, Y, W and H are the rectangle we're clipped to. */
  348. void
  349. Audio_Region::draw ( void )
  350. {
  351. /* intersect clip with region */
  352. int X, Y, W, H;
  353. fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
  354. if ( ! ( W > 0 && H > 0 ) )
  355. /* no coverage */
  356. return;
  357. const int scroll_x = this->scroll_x();
  358. const int start_x = timeline->ts_to_x( _r->start );
  359. if ( start_x > scroll_x + sequence()->w() ||
  360. start_x + abs_w() < scroll_x )
  361. /* not in viewport */
  362. return;
  363. /* account for waveform outlines... */
  364. X -= 2;
  365. W += 4;
  366. /* start with region length... */
  367. int rw = min( abs_w(), sequence()->w() );
  368. /* calculate waveform offset due to scrolling */
  369. nframes_t offset = 0;
  370. if ( start_x < scroll_x )
  371. {
  372. offset = timeline->x_to_ts( scroll_x - start_x );
  373. rw -= scroll_x - start_x;
  374. }
  375. const int rx = x();
  376. fl_push_clip( rx, Y, rw, H );
  377. /* draw fade curve outlines--this is only here because of crossfades */
  378. draw_fade( _fade_in, Fade::In, true, X, W );
  379. draw_fade( _fade_out, Fade::Out, true, X, W );
  380. int xo = 0;
  381. do {
  382. int channels;
  383. int peaks;
  384. Peak *pbuf;
  385. nframes_t start = _r->offset;
  386. /* int loop_peaks_needed = min( _loop ? timeline->ts_to_x( _loop ) : timeline->ts_to_x( _clip->length() ), rw ); */
  387. int loop_peaks_needed = _loop ? timeline->ts_to_x( _loop ) : timeline->ts_to_x( _clip->length() );
  388. if ( ! xo )
  389. {
  390. if ( _loop )
  391. start += offset % _loop;
  392. else
  393. start += offset;
  394. /* compensate for ??? */
  395. /* compensate for scrolling */
  396. if ( X - rx > 0 )
  397. start += timeline->x_to_ts( X - rx );
  398. loop_peaks_needed -= timeline->ts_to_x( offset ) % loop_peaks_needed;
  399. assert( loop_peaks_needed > 0 );
  400. if ( _loop && offset < _loop )
  401. {
  402. const int x = loop_peaks_needed;
  403. /* FIXME: is there no way to draw these symbols direclty? */
  404. fl_font( FL_SYMBOL, 14 );
  405. fl_color( FL_WHITE );
  406. fl_draw( "@2>", X + x - 7, y(), 14, 14, (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM), 0, 1 );
  407. fl_color( FL_WHITE );
  408. fl_draw( "@2<", X + x - 7, y() + h() - 14, 14, 14, (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM), 0, 1 );
  409. }
  410. }
  411. const int total_peaks_needed = min( timeline->ts_to_x( _clip->length() - start ), rw );
  412. const nframes_t end = start + timeline->x_to_ts( loop_peaks_needed );
  413. if ( _clip->read_peaks( timeline->fpp(),
  414. start,
  415. end,
  416. &peaks, &pbuf, &channels ) &&
  417. peaks )
  418. {
  419. assert( pbuf );
  420. int ch = (h() - Fl::box_dh( box() )) / channels;
  421. Waveform::scale( pbuf, peaks * channels, _scale );
  422. for ( int i = 0; i < channels; ++i )
  423. {
  424. Waveform::draw( X + xo,
  425. (y() + Fl::box_dy( box() )) + (i * ch),
  426. loop_peaks_needed,
  427. ch,
  428. pbuf + i, peaks, channels,
  429. selected() ? fl_invert_color( _color ) : _color );
  430. }
  431. }
  432. if ( peaks < loop_peaks_needed )
  433. {
  434. /* couldn't read peaks--perhaps they're being generated. Try again later. */
  435. Fl::add_timeout( 0.1f, &Audio_Region::peaks_pending_cb,
  436. new Peaks_Redraw_Request( this, start + timeline->x_to_ts( peaks ), end ) );
  437. }
  438. xo += loop_peaks_needed;
  439. }
  440. while ( _loop && xo < W );
  441. timeline->draw_measure_lines( X, Y, W, H, _box_color );
  442. /* fl_color( FL_BLACK ); */
  443. /* fl_line( rx, Y, rx, Y + H ); */
  444. /* fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H ); */
  445. if ( _clip->dummy() )
  446. {
  447. char pat[256];
  448. snprintf( pat, sizeof( pat ), "Missing Source!: %s", _clip->name() );
  449. draw_label( pat, align() );
  450. }
  451. else
  452. draw_label( _clip->name(), align() );
  453. /* if ( current() ) */
  454. /* { */
  455. /* /\* draw length bubble *\/ */
  456. /* char pat[40]; */
  457. /* snprintf( pat, sizeof( pat ), "%dm:%.1fs", (int)(length() / timeline->sample_rate()) / 60, (double)length() / timeline->sample_rate() ); */
  458. /* draw_label( pat, (Fl_Align)(FL_ALIGN_INSIDE | FL_ALIGN_CENTER), FL_GREEN ); */
  459. /* } */
  460. fl_pop_clip();
  461. }
  462. int
  463. Audio_Region::handle ( int m )
  464. {
  465. static int ox, oy;
  466. static bool copied = false;
  467. static nframes_t os;
  468. int X = Fl::event_x();
  469. int Y = Fl::event_y();
  470. Logger _log( this );
  471. switch ( m )
  472. {
  473. case FL_FOCUS:
  474. case FL_UNFOCUS:
  475. return 1;
  476. case FL_KEYBOARD:
  477. return menu().test_shortcut() != 0;
  478. case FL_ENTER:
  479. return Sequence_Region::handle( m );
  480. case FL_LEAVE:
  481. return Sequence_Region::handle( m );
  482. case FL_PUSH:
  483. {
  484. /* splitting */
  485. if ( test_press( FL_BUTTON2 | FL_SHIFT ) )
  486. {
  487. /* split */
  488. if ( ! copied )
  489. {
  490. Loggable::block_start();
  491. Audio_Region *copy = new Audio_Region( *this );
  492. trim( RIGHT, X );
  493. copy->trim( LEFT, X );
  494. sequence()->add( copy );
  495. log_end();
  496. Loggable::block_end();
  497. }
  498. return 0;
  499. }
  500. else
  501. {
  502. ox = x() - X;
  503. oy = y() - Y;
  504. /* for panning */
  505. os = _r->offset;
  506. if ( test_press( FL_BUTTON2 | FL_CTRL ) )
  507. {
  508. normalize();
  509. return 1;
  510. }
  511. else if ( test_press( FL_BUTTON3 ) )
  512. {
  513. /* context menu */
  514. menu_popup( &menu() );
  515. return 1;
  516. }
  517. else
  518. return Sequence_Region::handle( m );
  519. }
  520. break;
  521. }
  522. case FL_RELEASE:
  523. {
  524. Sequence_Region::handle( m );
  525. copied = false;
  526. return 1;
  527. }
  528. case FL_DRAG:
  529. if ( ! _drag )
  530. {
  531. begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) );
  532. _log.hold();
  533. }
  534. if ( test_press( FL_BUTTON1 | FL_SHIFT | FL_CTRL ) )
  535. {
  536. /* panning */
  537. int d = (ox + X) - x();
  538. long td = timeline->x_to_ts( d );
  539. if ( td > 0 && os < (nframes_t)td )
  540. _r->offset = 0;
  541. else
  542. _r->offset = os - td;
  543. redraw();
  544. return 1;
  545. }
  546. return Sequence_Region::handle( m );
  547. default:
  548. return Sequence_Region::handle( m );
  549. break;
  550. }
  551. return 0;
  552. }
  553. /**********/
  554. /* Public */
  555. /**********/
  556. /** return the name of the audio source this region represents */
  557. const char *
  558. Audio_Region::source_name ( void ) const
  559. {
  560. return _clip->name();
  561. }
  562. /** set the amplitude scaling for this region from the normalization
  563. * factor for the range of samples represented by this region */
  564. void
  565. Audio_Region::normalize ( void )
  566. {
  567. int peaks, channels;
  568. Peak *pbuf;
  569. if ( _clip->read_peaks( length(), offset(), offset() + length(), &peaks, &pbuf, &channels ) &&
  570. peaks )
  571. _scale = pbuf->normalization_factor();
  572. /* FIXME: wrong place for this? */
  573. sequence()->handle_widget_change( start(), length() );
  574. redraw();
  575. }