ui improvements

This commit is contained in:
Simon Gardling
2022-04-12 14:56:08 -04:00
parent 945a6289d8
commit 7dfe1cd067
2 changed files with 16 additions and 11 deletions

View File

@@ -105,7 +105,7 @@ impl FunctionEntry {
self.update_string(&output_string); self.update_string(&output_string);
} }
pub fn settings(&mut self, ctx: &Context) { pub fn settings_window(&mut self, ctx: &Context) {
let mut invalidate_nth = false; let mut invalidate_nth = false;
egui::Window::new(format!("Settings: {}", self.raw_func_str)) egui::Window::new(format!("Settings: {}", self.raw_func_str))
.open(&mut self.settings_opened) .open(&mut self.settings_opened)

View File

@@ -429,11 +429,10 @@ impl MathApp {
let functions_len = self.functions.len(); let functions_len = self.functions.len();
let mut remove_i: Option<usize> = None; let mut remove_i: Option<usize> = None;
ui.label("Functions:");
for (i, function) in self.functions.iter_mut().enumerate() { for (i, function) in self.functions.iter_mut().enumerate() {
// Entry for a function // Entry for a function
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.label("Function:");
// There's more than 1 function! Functions can now be deleted // There's more than 1 function! Functions can now be deleted
if ui if ui
.add_enabled(functions_len > 1, Button::new("X")) .add_enabled(functions_len > 1, Button::new("X"))
@@ -476,7 +475,7 @@ impl MathApp {
// Contains the function string in a text box that the user can edit // Contains the function string in a text box that the user can edit
function.auto_complete(ui, i) function.auto_complete(ui, i)
}); });
function.settings(ctx); function.settings_window(ctx);
} }
// Remove function if the user requests it // Remove function if the user requests it
@@ -484,15 +483,21 @@ impl MathApp {
self.functions.remove(remove_i_unwrap); self.functions.remove(remove_i_unwrap);
} }
ui.with_layout(egui::Layout::bottom_up(emath::Align::Min), |ui| {
// Contents put in reverse order from bottom to top
// Licensing information
ui.label(
RichText::new("(and licensed under AGPLv3)").color(Color32::LIGHT_GRAY),
)
.on_hover_text(&ASSETS.text_license_info);
// Hyperlink to project's github // Hyperlink to project's github
ui.hyperlink_to( ui.hyperlink_to(
"I'm Open Source!", "I'm Open Source!",
"https://github.com/Titaniumtown/YTBN-Graphing-Software", "https://github.com/Titaniumtown/YTBN-Graphing-Software",
); );
});
// Licensing information
ui.label(RichText::new("(and licensed under AGPLv3)").color(Color32::LIGHT_GRAY))
.on_hover_text(&ASSETS.text_license_info);
}); });
} }
} }