mirror of https://github.com/encounter/objdiff.git
Move reverse_fn_order into ViewConfig
This commit is contained in:
parent
634e007cbc
commit
319b1c35c0
|
@ -67,6 +67,7 @@ pub struct ViewConfig {
|
||||||
pub ui_font: FontId,
|
pub ui_font: FontId,
|
||||||
pub code_font: FontId,
|
pub code_font: FontId,
|
||||||
pub diff_colors: Vec<Color32>,
|
pub diff_colors: Vec<Color32>,
|
||||||
|
pub reverse_fn_order: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ViewConfig {
|
impl Default for ViewConfig {
|
||||||
|
@ -75,6 +76,7 @@ impl Default for ViewConfig {
|
||||||
ui_font: FontId { size: 12.0, family: FontFamily::Proportional },
|
ui_font: FontId { size: 12.0, family: FontFamily::Proportional },
|
||||||
code_font: FontId { size: 14.0, family: FontFamily::Monospace },
|
code_font: FontId { size: 14.0, family: FontFamily::Monospace },
|
||||||
diff_colors: DEFAULT_COLOR_ROTATION.to_vec(),
|
diff_colors: DEFAULT_COLOR_ROTATION.to_vec(),
|
||||||
|
reverse_fn_order: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +115,6 @@ pub struct ViewState {
|
||||||
pub check_update: Option<Box<CheckUpdateResult>>,
|
pub check_update: Option<Box<CheckUpdateResult>>,
|
||||||
// Config
|
// Config
|
||||||
pub diff_kind: DiffKind,
|
pub diff_kind: DiffKind,
|
||||||
pub reverse_fn_order: bool,
|
|
||||||
pub view_config: ViewConfig,
|
pub view_config: ViewConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +134,6 @@ impl Default for ViewState {
|
||||||
utc_offset: UtcOffset::UTC,
|
utc_offset: UtcOffset::UTC,
|
||||||
check_update: None,
|
check_update: None,
|
||||||
diff_kind: Default::default(),
|
diff_kind: Default::default(),
|
||||||
reverse_fn_order: false,
|
|
||||||
view_config: Default::default(),
|
view_config: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
ui.separator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,6 @@ fn symbol_list_ui(
|
||||||
highlighted_symbol: &mut Option<String>,
|
highlighted_symbol: &mut Option<String>,
|
||||||
selected_symbol: &mut Option<SymbolReference>,
|
selected_symbol: &mut Option<SymbolReference>,
|
||||||
current_view: &mut View,
|
current_view: &mut View,
|
||||||
reverse_function_order: bool,
|
|
||||||
lower_search: &str,
|
lower_search: &str,
|
||||||
config: &ViewConfig,
|
config: &ViewConfig,
|
||||||
) {
|
) {
|
||||||
|
@ -164,7 +163,7 @@ fn symbol_list_ui(
|
||||||
CollapsingHeader::new(format!("{} ({:x})", section.name, section.size))
|
CollapsingHeader::new(format!("{} ({:x})", section.name, section.size))
|
||||||
.default_open(true)
|
.default_open(true)
|
||||||
.show(ui, |ui| {
|
.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() {
|
for symbol in section.symbols.iter().rev() {
|
||||||
if !symbol_matches_search(symbol, lower_search) {
|
if !symbol_matches_search(symbol, lower_search) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -292,7 +291,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) {
|
||||||
highlighted_symbol,
|
highlighted_symbol,
|
||||||
selected_symbol,
|
selected_symbol,
|
||||||
current_view,
|
current_view,
|
||||||
view_state.reverse_fn_order,
|
|
||||||
&lower_search,
|
&lower_search,
|
||||||
&view_state.view_config,
|
&view_state.view_config,
|
||||||
);
|
);
|
||||||
|
@ -312,7 +310,6 @@ pub fn symbol_diff_ui(ui: &mut Ui, view_state: &mut ViewState) {
|
||||||
highlighted_symbol,
|
highlighted_symbol,
|
||||||
selected_symbol,
|
selected_symbol,
|
||||||
current_view,
|
current_view,
|
||||||
view_state.reverse_fn_order,
|
|
||||||
&lower_search,
|
&lower_search,
|
||||||
&view_state.view_config,
|
&view_state.view_config,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue