auto screen refresh when running command

This commit is contained in:
Penwing 2024-02-02 19:01:42 +01:00
parent 95bfd219e9
commit 98662a6c3f
5 changed files with 787 additions and 768 deletions

View file

@ -44,7 +44,8 @@ impl Calcifer {
if self.tabs[self.selected_tab.to_index()].language == PROJECT_EXTENSION {
ui.separator();
self.project_content.item_window.visible = self.toggle(ui, self.project_content.item_window.visible, "🖊");
self.project_content.item_window.visible =
self.toggle(ui, self.project_content.item_window.visible, "🖊");
}
});
});
@ -248,8 +249,7 @@ impl Calcifer {
});
ui.separator();
if self.tabs[self.selected_tab.to_index()].language == PROJECT_EXTENSION
{
if self.tabs[self.selected_tab.to_index()].language == PROJECT_EXTENSION {
self.draw_project_file(ui);
} else {
self.draw_code_file(ui);
@ -293,14 +293,19 @@ impl Calcifer {
pub fn draw_windows(&mut self, ctx: &egui::Context) {
if self.project_content.item_window.visible {
if self.project_content.categories.len() > 1 && self.project_content.categories[self.project_content.selected_item.category].content.len() > 0 {
if self.project_content.categories.len() > 1
&& self.project_content.categories[self.project_content.selected_item.category]
.content
.len()
> 0
{
self.project_content.item_window.show(
ctx,
&mut self.project_content.categories[self.project_content.selected_item.category]
&mut self.project_content.categories
[self.project_content.selected_item.category]
.content[self.project_content.selected_item.row],
);
} else {
self.project_content.item_window.visible = false;
}
}

View file

@ -264,6 +264,11 @@ impl eframe::App for Calcifer {
self.draw_windows(ctx);
self.time_watch[6] = watch.elapsed().as_micros() as f32 / 1000.0;
if self.running_command {
egui::Context::request_repaint(ctx);
//thread::sleep(time::Duration::from_secs_f32(RUNNING_COMMAND_REFRESH));
}
}
fn on_exit(&mut self, _gl: std::option::Option<&eframe::glow::Context>) {

View file

@ -162,7 +162,9 @@ pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project)
let category = project.selected_item.category.clone();
let row = project.selected_item.row.clone();
if ui.input(|i| i.key_pressed(egui::Key::ArrowLeft) && i.modifiers.shift) && project.selected_item.category > 0 {
if ui.input(|i| i.key_pressed(egui::Key::ArrowLeft) && i.modifiers.shift)
&& project.selected_item.category > 0
{
moved = true;
if !project.was_moving {
let temp = project.categories[category].content[row].clone();
@ -171,7 +173,9 @@ pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project)
project.selected_item.category -= 1;
project.selected_item.row = project.categories[category - 1].content.len() - 1;
}
} else if ui.input(|i| i.key_pressed(egui::Key::ArrowRight) && i.modifiers.shift) && project.selected_item.category < project.categories.len() - 2 {
} else if ui.input(|i| i.key_pressed(egui::Key::ArrowRight) && i.modifiers.shift)
&& project.selected_item.category < project.categories.len() - 2
{
moved = true;
if !project.was_moving {
let temp = project.categories[category].content[row].clone();
@ -200,7 +204,9 @@ pub fn draw_project(ui: &mut egui::Ui, theme: ColorTheme, project: &mut Project)
project.categories[category].content[row + 1] = temp.clone();
project.selected_item.row += 1;
}
} else if ui.input(|i| i.key_pressed(egui::Key::ArrowLeft)) && project.selected_item.category > 0 {
} else if ui.input(|i| i.key_pressed(egui::Key::ArrowLeft))
&& project.selected_item.category > 0
{
moved = true;
if !project.was_moving {
project.selected_item.category -= 1;

View file

@ -26,6 +26,9 @@ impl ProjectItemWindow {
ui.set_min_height(250.0);
ui.add(egui::TextEdit::singleline(&mut item.name).desired_width(f32::INFINITY));
ui.separator();
ui.add_sized(ui.available_size(), egui::TextEdit::multiline(&mut item.description));
ui.add_sized(
ui.available_size(),
egui::TextEdit::multiline(&mut item.description),
);
}
}