@@ -200,10 +200,6 @@ impl FreeplayScene {
200200
201201/// Recorder related methods
202202impl FreeplayScene {
203- fn preview_bar_button ( ) -> nuon:: Button {
204- nuon:: button ( ) . size ( 30.0 , 30.0 ) . border_radius ( [ 5.0 ; 4 ] )
205- }
206-
207203 fn clear_preview ( & mut self ) {
208204 self . preview_state = None ;
209205 self . keyboard . set_song_config ( Default :: default ( ) ) ;
@@ -324,14 +320,6 @@ impl FreeplayScene {
324320 self . recorder_status . clone ( )
325321 }
326322
327- fn record_button_label ( & self ) -> & ' static str {
328- if self . recorder . is_recording ( ) {
329- "STOP"
330- } else {
331- "REC"
332- }
333- }
334-
335323 fn stop_recording ( & mut self , ctx : & Context ) -> Result < ( ) , String > {
336324 self . recorder . stop ( ) ;
337325 self . rebuild_preview ( ctx)
@@ -429,7 +417,6 @@ impl FreeplayScene {
429417 let width = ctx. window_state . logical_size . width ;
430418 let preview = self . preview_ui_state ( ) ;
431419
432- let record_label = self . record_button_label ( ) ;
433420 let status_label = self . preview_status_label ( ) ;
434421
435422 enum Msg {
@@ -453,7 +440,9 @@ impl FreeplayScene {
453440 . color ( [ 37 , 35 , 42 ] )
454441 . build ( ui) ;
455442
456- if Self :: preview_bar_button ( )
443+ if nuon:: button ( )
444+ . size ( 30.0 , 30.0 )
445+ . border_radius ( [ 5.0 ; 4 ] )
457446 . icon ( icons:: left_arrow_icon ( ) )
458447 . build ( ui)
459448 {
@@ -480,65 +469,68 @@ impl FreeplayScene {
480469 . build ( ui) ;
481470
482471 nuon:: translate ( ) . x ( width) . build ( ui, |ui| {
483- if preview. available {
484- if Self :: preview_bar_button ( )
485- . x ( -30.0 )
486- . icon ( if preview. is_paused {
487- icons:: play_icon ( )
488- } else {
489- icons:: pause_icon ( )
490- } )
491- . build ( ui)
492- {
493- msg = Msg :: TogglePlay ;
494- }
495- } else {
496- nuon:: quad ( )
497- . x ( -30.0 )
498- . size ( 30.0 , 30.0 )
499- . color ( [ 52 , 52 , 52 ] )
500- . border_radius ( [ 5.0 ; 4 ] )
501- . build ( ui) ;
502- nuon:: label ( )
503- . x ( -30.0 )
504- . size ( 30.0 , 30.0 )
505- . icon ( icons:: play_icon ( ) )
506- . color ( [ 140 , 140 , 140 ] )
507- . build ( ui) ;
472+ nuon:: translate ( ) . x ( -30.0 ) . add_to_current ( ui) ;
473+
474+ if nuon:: button ( )
475+ . size ( 30.0 , 30.0 )
476+ . border_radius ( [ 5.0 ; 4 ] )
477+ . icon ( if preview. is_paused {
478+ icons:: play_icon ( )
479+ } else {
480+ icons:: pause_icon ( )
481+ } )
482+ . font_color ( if preview. available {
483+ [ 255 , 255 , 255 , 255 ]
484+ } else {
485+ [ 255 , 255 , 255 , 100 ]
486+ } )
487+ . build ( ui)
488+ && preview. available
489+ {
490+ msg = Msg :: TogglePlay ;
508491 }
509492
493+ nuon:: translate ( ) . x ( -30.0 ) . add_to_current ( ui) ;
494+
510495 if nuon:: button ( )
511- . x ( -85.0 )
512- . size ( 45.0 , 30.0 )
496+ . size ( 30.0 , 30.0 )
513497 . border_radius ( [ 5.0 ; 4 ] )
514- . color ( [ 67 , 67 , 67 ] )
515- . hover_color ( [ 87 , 87 , 87 ] )
516- . preseed_color ( [ 97 , 97 , 97 ] )
517- . label ( "SAVE" )
498+ . icon ( icons:: save_icon ( ) )
499+ . font_color ( if preview. available {
500+ [ 255 , 255 , 255 , 255 ]
501+ } else {
502+ [ 255 , 255 , 255 , 100 ]
503+ } )
518504 . build ( ui)
505+ && preview. available
519506 {
520507 msg = Msg :: Save ;
521508 }
522509
510+ nuon:: translate ( ) . x ( -30.0 ) . add_to_current ( ui) ;
511+
523512 if nuon:: button ( )
524- . x ( -147.0 )
525- . size ( 52.0 , 30.0 )
513+ . size ( 30.0 , 30.0 )
526514 . border_radius ( [ 5.0 ; 4 ] )
527- . label ( record_label)
515+ . icon ( if self . recorder . is_recording ( ) {
516+ icons:: record_stop_icon ( )
517+ } else {
518+ icons:: record_icon ( )
519+ } )
528520 . color ( if self . recorder . is_recording ( ) {
529- [ 125 , 27 , 27 ]
521+ [ 208 , 18 , 0 , 255 ]
530522 } else {
531- [ 67 , 67 , 67 ]
523+ [ 0 , 0 , 0 , 0 ]
532524 } )
533525 . hover_color ( if self . recorder . is_recording ( ) {
534- [ 145 , 37 , 37 ]
526+ [ 165 , 47 , 47 ]
535527 } else {
536- [ 87 , 87 , 87 ]
528+ [ 97 , 97 , 97 ]
537529 } )
538530 . preseed_color ( if self . recorder . is_recording ( ) {
539- [ 165 , 47 , 47 ]
531+ [ 145 , 37 , 37 ]
540532 } else {
541- [ 97 , 97 , 97 ]
533+ [ 87 , 87 , 87 ]
542534 } )
543535 . build ( ui)
544536 {
@@ -566,13 +558,15 @@ impl FreeplayScene {
566558 if preview. length > 0.0 {
567559 for measure in preview. measures . iter ( ) {
568560 let x = ( measure. as_secs_f32 ( ) / preview. length ) * width;
569- let color = if x < width * preview. progress {
570- nuon:: Color :: new ( 1.0 , 1.0 , 1.0 , 0.5 )
571- } else {
572- nuon:: Color :: new ( 0.4 , 0.4 , 0.4 , 1.0 )
573- } ;
574-
575- nuon:: quad ( ) . x ( x) . size ( 1.0 , 45.0 ) . color ( color) . build ( ui) ;
561+ nuon:: quad ( )
562+ . x ( x)
563+ . size ( 1.0 , 45.0 )
564+ . color ( if x < width * preview. progress {
565+ [ 255 , 255 , 255 , 127 ]
566+ } else {
567+ [ 102 , 102 , 102 , 255 ]
568+ } )
569+ . build ( ui) ;
576570 }
577571 }
578572
@@ -582,11 +576,7 @@ impl FreeplayScene {
582576 . size ( ( width - 20.0 ) . max ( 0.0 ) , 15.0 )
583577 . text ( & status_label)
584578 . text_justify ( nuon:: TextJustify :: Left )
585- . color ( if preview. available {
586- [ 210 , 210 , 210 ]
587- } else {
588- [ 170 , 170 , 170 ]
589- } )
579+ . color ( [ 255 , 255 , 255 , 200 ] )
590580 . build ( ui) ;
591581 } ) ;
592582 } ) ;
0 commit comments