@@ -46,7 +46,6 @@ use crate::{
46
46
} ,
47
47
} ;
48
48
49
- #[ derive( Default ) ]
50
49
pub struct ViewState {
51
50
pub jobs : JobQueue ,
52
51
pub config_state : ConfigViewState ,
@@ -63,6 +62,30 @@ pub struct ViewState {
63
62
pub show_debug : bool ,
64
63
pub show_graphics : bool ,
65
64
pub show_jobs : bool ,
65
+ pub show_side_panel : bool ,
66
+ }
67
+
68
+ impl Default for ViewState {
69
+ fn default ( ) -> Self {
70
+ Self {
71
+ jobs : Default :: default ( ) ,
72
+ config_state : Default :: default ( ) ,
73
+ demangle_state : Default :: default ( ) ,
74
+ rlwinm_decode_state : Default :: default ( ) ,
75
+ diff_state : Default :: default ( ) ,
76
+ graphics_state : Default :: default ( ) ,
77
+ frame_history : Default :: default ( ) ,
78
+ show_appearance_config : false ,
79
+ show_demangle : false ,
80
+ show_rlwinm_decode : false ,
81
+ show_project_config : false ,
82
+ show_arch_config : false ,
83
+ show_debug : false ,
84
+ show_graphics : false ,
85
+ show_jobs : false ,
86
+ show_side_panel : true ,
87
+ }
88
+ }
66
89
}
67
90
68
91
/// The configuration for a single object file.
@@ -485,12 +508,26 @@ impl eframe::App for App {
485
508
show_debug,
486
509
show_graphics,
487
510
show_jobs,
511
+ show_side_panel,
488
512
} = view_state;
489
513
490
514
frame_history. on_new_frame ( ctx. input ( |i| i. time ) , frame. info ( ) . cpu_usage ) ;
491
515
516
+ let side_panel_available = diff_state. current_view == View :: SymbolDiff ;
517
+
492
518
egui:: TopBottomPanel :: top ( "top_panel" ) . show ( ctx, |ui| {
493
519
egui:: menu:: bar ( ui, |ui| {
520
+ if ui
521
+ . add_enabled (
522
+ side_panel_available,
523
+ egui:: Button :: new ( if * show_side_panel { "⏴" } else { "⏵" } ) ,
524
+ )
525
+ . on_hover_text ( "Toggle side panel" )
526
+ . clicked ( )
527
+ {
528
+ * show_side_panel = !* show_side_panel;
529
+ }
530
+ ui. separator ( ) ;
494
531
ui. menu_button ( "File" , |ui| {
495
532
#[ cfg( debug_assertions) ]
496
533
if ui. button ( "Debug…" ) . clicked ( ) {
@@ -607,30 +644,26 @@ impl eframe::App for App {
607
644
} ) ;
608
645
} ) ;
609
646
610
- let build_success = matches ! ( & diff_state. build, Some ( b) if b. first_status. success && b. second_status. success) ;
611
- if diff_state. current_view == View :: FunctionDiff && build_success {
612
- egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
613
- function_diff_ui ( ui, diff_state, appearance) ;
614
- } ) ;
615
- } else if diff_state. current_view == View :: DataDiff && build_success {
616
- egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
617
- data_diff_ui ( ui, diff_state, appearance) ;
618
- } ) ;
619
- } else if diff_state. current_view == View :: ExtabDiff && build_success {
620
- egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
621
- extab_diff_ui ( ui, diff_state, appearance) ;
622
- } ) ;
623
- } else {
624
- egui:: SidePanel :: left ( "side_panel" ) . show ( ctx, |ui| {
647
+ if side_panel_available {
648
+ egui:: SidePanel :: left ( "side_panel" ) . show_animated ( ctx, * show_side_panel, |ui| {
625
649
egui:: ScrollArea :: both ( ) . show ( ui, |ui| {
626
650
config_ui ( ui, state, show_project_config, config_state, appearance) ;
627
651
} ) ;
628
652
} ) ;
653
+ }
629
654
630
- egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
655
+ egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
656
+ let build_success = matches ! ( & diff_state. build, Some ( b) if b. first_status. success && b. second_status. success) ;
657
+ if diff_state. current_view == View :: FunctionDiff && build_success {
658
+ function_diff_ui ( ui, diff_state, appearance) ;
659
+ } else if diff_state. current_view == View :: DataDiff && build_success {
660
+ data_diff_ui ( ui, diff_state, appearance) ;
661
+ } else if diff_state. current_view == View :: ExtabDiff && build_success {
662
+ extab_diff_ui ( ui, diff_state, appearance) ;
663
+ } else {
631
664
symbol_diff_ui ( ui, diff_state, appearance) ;
632
- } ) ;
633
- }
665
+ }
666
+ } ) ;
634
667
635
668
project_window ( ctx, state, show_project_config, config_state, appearance) ;
636
669
appearance_window ( ctx, show_appearance_config, appearance) ;
0 commit comments