@@ -13,6 +13,7 @@ use winit::raw_window_handle::HasWindowHandle;
13
13
14
14
struct SmApp {
15
15
first_frame : bool ,
16
+ save_new_recipe : bool ,
16
17
recipe_change_request : Option < String > ,
17
18
recipe : Recipe ,
18
19
metadata : WidgetMetadata ,
@@ -98,6 +99,7 @@ pub fn sm_gui<'gui>(
98
99
Ok ( Box :: new (
99
100
SmApp {
100
101
first_frame : true ,
102
+ save_new_recipe : false ,
101
103
recipe_change_request : None ,
102
104
recipe_saved : format ! ( "{:?}" , recipe) ,
103
105
recipe,
@@ -428,7 +430,7 @@ impl eframe::App for SmApp {
428
430
ui. label ( key. to_owned ( ) + ":" ) ;
429
431
let response = ui. add (
430
432
egui:: Slider :: new ( & mut int, min..=max)
431
- //.text(key )
433
+ . clamping ( egui :: SliderClamping :: Never )
432
434
. step_by ( increment) ,
433
435
) ;
434
436
@@ -482,10 +484,6 @@ impl eframe::App for SmApp {
482
484
}
483
485
}
484
486
485
- // if i.consume_shortcut(&Ctrls){
486
- // println!("you pressed ctrl+s");
487
- // }
488
-
489
487
if !self . selected_files . is_empty ( ) {
490
488
self . start_rendering = true ;
491
489
}
@@ -496,12 +494,6 @@ impl eframe::App for SmApp {
496
494
. collapsible ( false )
497
495
. resizable ( false )
498
496
. show ( ctx, |ui| {
499
- ui. heading ( "\n known bugs" ) ;
500
- ui. label (
501
- concat ! (
502
- "\n - Starting to render causes the GUI to freeze instead of closing, just minimize it tbh"
503
- ) ,
504
- ) ;
505
497
ui. heading ( "\n what is this" ) ;
506
498
ui. label (
507
499
"user interface to edit the recipe.ini text file more conveniently" ,
@@ -524,7 +516,7 @@ impl eframe::App for SmApp {
524
516
"github\n " ,
525
517
"https://github.com/couleur-tweak-tips/smoothie-rs" ,
526
518
)
527
- . on_hover_text_at_pointer ( "see /smrs-egui/ folder" )
519
+ . on_hover_text_at_pointer ( "see /src/smgui.rs folder" )
528
520
. secondary_clicked ( )
529
521
{
530
522
let url = "https://github.com/couleur-tweak-tips/smoothie-rs" ;
@@ -545,7 +537,10 @@ impl eframe::App for SmApp {
545
537
self . show_confirmation_dialog = true ;
546
538
}
547
539
}
548
-
540
+ if self . save_new_recipe {
541
+ self . recipe_saved = format ! ( "{:?}" , self . recipe) ;
542
+ self . save_new_recipe = false ;
543
+ }
549
544
if self . recipe_change_request . is_some ( ) {
550
545
let old_recipe = self . recipe_change_request . clone ( ) . unwrap ( ) ;
551
546
if format ! ( "{:?}" , self . recipe) != self . recipe_saved {
@@ -571,8 +566,11 @@ impl eframe::App for SmApp {
571
566
self . recipe_change_request = None ;
572
567
let ( recipe, metadata) = crate :: recipe:: get_recipe ( & mut self . args ) ;
573
568
self . recipe = recipe. clone ( ) ;
574
- self . recipe_saved = format ! ( "{:?}" , recipe) ;
575
569
self . metadata = metadata;
570
+ // the recipe isn't formatted yet, let it go through a frame
571
+ // to normalize bools and int slider increments
572
+ //self.recipe_saved = format!("{:?}", recipe);
573
+ self . save_new_recipe ;
576
574
}
577
575
if ui. button ( "Don't Save" ) . clicked ( ) {
578
576
self . recipe_change_request = None ;
0 commit comments