Skip to content

Commit

Permalink
Move reverse_fn_order into ViewConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Jan 21, 2023
1 parent 634e007 commit 319b1c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct ViewConfig {
pub ui_font: FontId,
pub code_font: FontId,
pub diff_colors: Vec<Color32>,
pub reverse_fn_order: bool,
}

impl Default for ViewConfig {
Expand All @@ -75,6 +76,7 @@ impl Default for ViewConfig {
ui_font: FontId { size: 12.0, family: FontFamily::Proportional },
code_font: FontId { size: 14.0, family: FontFamily::Monospace },
diff_colors: DEFAULT_COLOR_ROTATION.to_vec(),
reverse_fn_order: false,
}
}
}
Expand Down Expand Up @@ -113,7 +115,6 @@ pub struct ViewState {
pub check_update: Option<Box<CheckUpdateResult>>,
// Config
pub diff_kind: DiffKind,
pub reverse_fn_order: bool,
pub view_config: ViewConfig,
}

Expand All @@ -133,7 +134,6 @@ impl Default for ViewState {
utc_offset: UtcOffset::UTC,
check_update: None,
diff_kind: Default::default(),
reverse_fn_order: false,
view_config: Default::default(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
}
}

ui.checkbox(&mut view_state.reverse_fn_order, "Reverse function order (deferred)");
ui.checkbox(&mut view_state.view_config.reverse_fn_order, "Reverse function order (deferred)");
ui.separator();
}
5 changes: 1 addition & 4 deletions src/views/symbol_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ fn symbol_list_ui(
highlighted_symbol: &mut Option<String>,
selected_symbol: &mut Option<SymbolReference>,
current_view: &mut View,
reverse_function_order: bool,
lower_search: &str,
config: &ViewConfig,
) {
Expand Down Expand Up @@ -164,7 +163,7 @@ fn symbol_list_ui(
CollapsingHeader::new(format!("{} ({:x})", section.name, section.size))
.default_open(true)
.show(ui, |ui| {
if section.kind == ObjSectionKind::Code && reverse_function_order {
if section.kind == ObjSectionKind::Code && config.reverse_fn_order {
for symbol in section.symbols.iter().rev() {
if !symbol_matches_search(symbol, lower_search) {
continue;
Expand Down Expand Up @@ -292,7 +291,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) {
highlighted_symbol,
selected_symbol,
current_view,
view_state.reverse_fn_order,
&lower_search,
&view_state.view_config,
);
Expand All @@ -312,7 +310,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) {
highlighted_symbol,
selected_symbol,
current_view,
view_state.reverse_fn_order,
&lower_search,
&view_state.view_config,
);
Expand Down

0 comments on commit 319b1c3

Please sign in to comment.