egui: expose autorouter options in the GUI

This commit is contained in:
Mikolaj Wielgus 2024-08-31 00:49:40 +02:00
parent a52515f6d3
commit 59f88e854c
3 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,5 @@
menu-file = File
menu-options = Options
menu-debug = Debug
action-open-dsn = Open
@ -16,6 +17,8 @@ action-measure-length = Measure Length
action-undo = Undo
action-redo = Redo
presort-by-pairwise-detours = Presort by pairwise detours
show-ratsnest = Show Ratsnest
show-navmesh = Show Navmesh
show-bboxes = Show BBoxes

View File

@ -170,8 +170,6 @@ impl eframe::App for App {
/// Called each time the UI has to be repainted.
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.update_state(ctx.input(|i| i.stable_dt));
self.top.update(
ctx,
&self.translator,
@ -183,6 +181,8 @@ impl eframe::App for App {
&self.maybe_design,
);
self.update_state(ctx.input(|i| i.stable_dt));
if let Some(ref mut layers) = self.maybe_layers {
if let Some(invoker) = self.arc_mutex_maybe_invoker.lock().unwrap().as_ref() {
layers.update(ctx, invoker.autorouter().board());

View File

@ -21,6 +21,7 @@ use crate::{
};
pub struct Top {
pub autorouter_options: AutorouterOptions,
pub is_placing_via: bool,
pub show_ratsnest: bool,
pub show_navmesh: bool,
@ -31,6 +32,7 @@ pub struct Top {
impl Top {
pub fn new() -> Self {
Self {
autorouter_options: AutorouterOptions::new(),
is_placing_via: false,
show_ratsnest: false,
show_navmesh: false,
@ -135,6 +137,15 @@ impl Top {
autoroute.button(ctx, ui);
ui.menu_button(tr.text("menu-options"), |ui| {
ui.checkbox(
&mut self.autorouter_options.presort_by_pairwise_detours,
tr.text("presort-by-pairwise-detours"),
);
});
ui.separator();
place_via.toggle_widget(ctx, ui, &mut self.is_placing_via);
remove_bands.button(ctx, ui);
@ -252,7 +263,7 @@ impl Top {
maybe_execute.insert(ExecuteWithStatus::new(invoker.execute_stepper(
Command::Autoroute(
selection.pin_selection,
AutorouterOptions::new(),
self.autorouter_options,
),
)?));
}
@ -309,7 +320,7 @@ impl Top {
maybe_execute.insert(ExecuteWithStatus::new(invoker.execute_stepper(
Command::CompareDetours(
selection.pin_selection,
AutorouterOptions::new(),
self.autorouter_options,
),
)?));
}