diff --git a/Cargo.toml b/Cargo.toml index 281aca2..e983e16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,22 +45,22 @@ regex = "1.9.5" directories = "5.0.1" tokio = { version = "1.37.0", features = ["full"] } -egui = "0.27.2" -eframe = "0.27.2" +egui = "0.28.1" +eframe = "0.28.1" # eframe = { version = "0.27.2", default-features = false, features = [ # "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. # "default_fonts", # Embed the default egui fonts. # "glow", # Use the glow rendering backend. Alternative: "wgpu". # "persistence", # Enable restoring app state when restarting the app. # ], optional = true } -egui_extras = { version="0.27.2", features = ["all_loaders", "svg", "image"] } +egui_extras = { version="0.28.1", features = ["all_loaders", "svg", "image"] } # egui_extras = { version="0.27.2", features = [] } -egui_glow = "0.27.2" +egui_glow = "0.28.1" glow = "0.13.0" -egui-modal = "0.3.6" -egui-bind = "0.12.0" -egui_file = "0.17.0" -egui-notify = "0.14.0" +egui-modal = "0.4.0" +egui-bind = "0.13.0" +egui_file = "0.18.0" +egui-notify = "0.15.0" [profile.release] opt-level = 'z' # Optimize for size diff --git a/crates/icy_draw/Cargo.toml b/crates/icy_draw/Cargo.toml index 00c1e76..cf93872 100644 --- a/crates/icy_draw/Cargo.toml +++ b/crates/icy_draw/Cargo.toml @@ -17,8 +17,7 @@ egui_glow = { workspace = true } egui-modal = { workspace = true } glow = { workspace = true } egui_file = { workspace = true } -egui_tiles = { git ="https://github.com/mkrueger/egui_tiles"} -#egui_tiles = { path = "../egui_tiles" } +egui_tiles = "0.9.0" egui-bind = { workspace = true } egui-notify = { workspace = true } log = { workspace = true } @@ -42,7 +41,7 @@ icy_sauce = { workspace = true } bstr = { workspace = true } -egui_code_editor = "0.2.7" +egui_code_editor = "0.2.9" mlua = { version = "0.9.1", features = ["lua54", "vendored"] } regex = { workspace = true } diff --git a/crates/icy_draw/src/main.rs b/crates/icy_draw/src/main.rs index 8a13e34..556734b 100644 --- a/crates/icy_draw/src/main.rs +++ b/crates/icy_draw/src/main.rs @@ -186,7 +186,7 @@ fn main() { } window.open_file(&path, false); } - Box::new(window) + Ok(Box::new(window)) }), ) { log::error!("Error returned by run_native: {}", err); diff --git a/crates/icy_draw/src/model/tools/brush_imp.rs b/crates/icy_draw/src/model/tools/brush_imp.rs index bad1eba..dd36b7d 100644 --- a/crates/icy_draw/src/model/tools/brush_imp.rs +++ b/crates/icy_draw/src/model/tools/brush_imp.rs @@ -130,7 +130,7 @@ impl Tool for BrushTool { ui.horizontal(|ui| { ui.label(fl!(crate::LANGUAGE_LOADER, "tool-size-label")); - ui.add(egui::DragValue::new(&mut self.size).clamp_range(1..=20).speed(1)); + ui.add(egui::DragValue::new(&mut self.size).range(1..=20).speed(1)); }); /* ui.radio_value(&mut self.brush_type, BrushType::Shade, fl!(crate::LANGUAGE_LOADER, "tool-shade")); diff --git a/crates/icy_draw/src/model/tools/erase_imp.rs b/crates/icy_draw/src/model/tools/erase_imp.rs index fff2820..a63a5eb 100644 --- a/crates/icy_draw/src/model/tools/erase_imp.rs +++ b/crates/icy_draw/src/model/tools/erase_imp.rs @@ -104,7 +104,7 @@ impl Tool for EraseTool { fn show_ui(&mut self, _ctx: &egui::Context, ui: &mut egui::Ui, _editor_opt: Option<&mut AnsiEditor>) -> Option { ui.horizontal(|ui| { ui.label(fl!(crate::LANGUAGE_LOADER, "tool-size-label")); - ui.add(egui::DragValue::new(&mut self.size).clamp_range(1..=20).speed(1)); + ui.add(egui::DragValue::new(&mut self.size).range(1..=20).speed(1)); }); ui.radio_value(&mut self.brush_type, EraseType::Solid, fl!(crate::LANGUAGE_LOADER, "tool-solid")); ui.radio_value(&mut self.brush_type, EraseType::Shade, fl!(crate::LANGUAGE_LOADER, "tool-shade")); diff --git a/crates/icy_draw/src/model/tools/pencil_imp.rs b/crates/icy_draw/src/model/tools/pencil_imp.rs index 101b0b4..eb2bf68 100644 --- a/crates/icy_draw/src/model/tools/pencil_imp.rs +++ b/crates/icy_draw/src/model/tools/pencil_imp.rs @@ -17,7 +17,7 @@ pub struct PencilTool { undo_op: Option, draw_mode: BrushMode, color_mode: ColorMode, - pub attr: TextAttribute, + pub _attr: TextAttribute, last_pos: Position, cur_pos: Position, @@ -32,7 +32,7 @@ impl Default for PencilTool { char_code: Rc::new(RefCell::new('\u{00B0}')), last_pos: Position::default(), cur_pos: Position::default(), - attr: icy_engine::TextAttribute::default(), + _attr: icy_engine::TextAttribute::default(), } } } diff --git a/crates/icy_draw/src/model/tools/tag_imp.rs b/crates/icy_draw/src/model/tools/tag_imp.rs index bf19afa..7f34d10 100644 --- a/crates/icy_draw/src/model/tools/tag_imp.rs +++ b/crates/icy_draw/src/model/tools/tag_imp.rs @@ -118,7 +118,7 @@ impl Tool for TagTool { let font_id = FontId::new(14.0, FontFamily::Proportional); let text: WidgetText = tag.replacement_value.clone().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); ui.painter().galley_with_override_text_color( egui::Align2::LEFT_TOP.align_size_within_rect(galley.size(), rect.shrink(4.0)).min, galley, diff --git a/crates/icy_draw/src/ui/commands.rs b/crates/icy_draw/src/ui/commands.rs index c959e54..36e43e0 100644 --- a/crates/icy_draw/src/ui/commands.rs +++ b/crates/icy_draw/src/ui/commands.rs @@ -427,7 +427,9 @@ impl CommandWrapper { } let response = ui.with_layout(ui.layout().with_cross_justify(true), |ui| { - ui.set_enabled(self.is_enabled); + if !self.is_enabled { + ui.disable(); + } if let Some((KeyOrPointer::Key(k), modifier)) = self.key { let mut shortcut = k.name().to_string(); @@ -445,7 +447,7 @@ impl CommandWrapper { button_with_shortcut(ui, true, &self.label, shortcut) } else { - ui.add(egui::Button::new(&self.label).wrap(false)) + ui.add(egui::Button::new(&self.label).wrap_mode(egui::TextWrapMode::Truncate)) } }); diff --git a/crates/icy_draw/src/ui/dialogs/edit_tag_dialog.rs b/crates/icy_draw/src/ui/dialogs/edit_tag_dialog.rs index 0fe7e48..cfdf736 100644 --- a/crates/icy_draw/src/ui/dialogs/edit_tag_dialog.rs +++ b/crates/icy_draw/src/ui/dialogs/edit_tag_dialog.rs @@ -84,7 +84,10 @@ impl ModalDialog for EditTagDialog { self.tag.replacement_value = tag.tag.clone(); self.show_replacements = false; } - ui.add(Label::new(RichText::new(&tag.description).font(FontId::new(font_size, FontFamily::Proportional))).wrap(false)); + ui.add( + Label::new(RichText::new(&tag.description).font(FontId::new(font_size, FontFamily::Proportional))) + .wrap_mode(egui::TextWrapMode::Truncate), + ); }); } } diff --git a/crates/icy_draw/src/ui/dialogs/export_file_dialog/mod.rs b/crates/icy_draw/src/ui/dialogs/export_file_dialog/mod.rs index 6a92e40..860b148 100644 --- a/crates/icy_draw/src/ui/dialogs/export_file_dialog/mod.rs +++ b/crates/icy_draw/src/ui/dialogs/export_file_dialog/mod.rs @@ -128,7 +128,7 @@ impl ModalDialog for ExportFileDialog { self.format_type = format_type; } } - if ui.add(egui::Button::new("…").wrap(false)).clicked() { + if ui.add(egui::Button::new("…").wrap_mode(egui::TextWrapMode::Truncate)).clicked() { let mut initial_path = None; crate::set_default_initial_directory_opt(&mut initial_path); let mut dialog = FileDialog::save_file(initial_path); diff --git a/crates/icy_draw/src/ui/dialogs/font_manager.rs b/crates/icy_draw/src/ui/dialogs/font_manager.rs index a44c882..3dcccb3 100644 --- a/crates/icy_draw/src/ui/dialogs/font_manager.rs +++ b/crates/icy_draw/src/ui/dialogs/font_manager.rs @@ -63,7 +63,7 @@ impl crate::ModalDialog for FontManager { let font_id = FontId::new(12.0, FontFamily::Monospace); let text: WidgetText = format!("{i:-3}.").into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id.clone()); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id.clone()); let size = galley.size(); let mut title_rect = rect; title_rect.set_left(title_rect.left() + 4.0); @@ -81,7 +81,7 @@ impl crate::ModalDialog for FontManager { let font_id = TextStyle::Button.resolve(ui.style()); let text: WidgetText = font.name.clone().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut title_rect = rect; title_rect.set_left(title_rect.left() + 4.0 + size.x + 4.0); ui.painter().galley_with_override_text_color( @@ -92,7 +92,7 @@ impl crate::ModalDialog for FontManager { let font_id = TextStyle::Button.resolve(ui.style()); let text: WidgetText = format!("{}x{}", font.size.width, font.size.height).into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut title_rect = rect; title_rect.set_left(title_rect.left() + 399.0); ui.painter().galley_with_override_text_color( @@ -108,7 +108,7 @@ impl crate::ModalDialog for FontManager { fl!(crate::LANGUAGE_LOADER, "manage-font-not_used_label") } .into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut title_rect = rect; title_rect.set_left(title_rect.left() + 480.0); ui.painter().galley_with_override_text_color( diff --git a/crates/icy_draw/src/ui/dialogs/font_selector.rs b/crates/icy_draw/src/ui/dialogs/font_selector.rs index 595cd99..3862d1a 100644 --- a/crates/icy_draw/src/ui/dialogs/font_selector.rs +++ b/crates/icy_draw/src/ui/dialogs/font_selector.rs @@ -333,7 +333,7 @@ impl FontSelector { let font_id = FontId::new(14.0, FontFamily::Proportional); let text: WidgetText = font.0.name.clone().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); ui.painter().galley_with_override_text_color( egui::Align2::LEFT_TOP.align_size_within_rect(galley.size(), rect.shrink(4.0)).min, galley, @@ -390,7 +390,7 @@ impl FontSelector { fn print_source(font_type: String, ui: &egui::Ui, rect: Rect, text_color: Color32) -> f32 { let font_id = FontId::new(12.0, FontFamily::Proportional); let text: WidgetText = font_type.into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let galley_size = galley.size(); let left_side = rect.right() - galley_size.x - 10.0; diff --git a/crates/icy_draw/src/ui/dialogs/new_file_dialog.rs b/crates/icy_draw/src/ui/dialogs/new_file_dialog.rs index 0fd3ab7..5d995ae 100644 --- a/crates/icy_draw/src/ui/dialogs/new_file_dialog.rs +++ b/crates/icy_draw/src/ui/dialogs/new_file_dialog.rs @@ -505,7 +505,7 @@ impl crate::ModalDialog for NewFileDialog { let font_id = FontId::new(20.0, eframe::epaint::FontFamily::Proportional); let text: WidgetText = template.title().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut title_rect = rect; title_rect.set_left(title_rect.left() + 40.0); title_rect.set_top(title_rect.top() + 4.0); @@ -517,7 +517,7 @@ impl crate::ModalDialog for NewFileDialog { let font_id = FontId::new(14.0, eframe::epaint::FontFamily::Proportional); let text: WidgetText = template.description().lines().next().unwrap_or_default().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut descr_rect = rect; descr_rect.set_top(descr_rect.top() + 34.0); ui.painter().galley_with_override_text_color( diff --git a/crates/icy_draw/src/ui/dialogs/select_palette_dialog.rs b/crates/icy_draw/src/ui/dialogs/select_palette_dialog.rs index 6ab5757..1e72296 100644 --- a/crates/icy_draw/src/ui/dialogs/select_palette_dialog.rs +++ b/crates/icy_draw/src/ui/dialogs/select_palette_dialog.rs @@ -193,7 +193,7 @@ impl SelectPaletteDialog { let font_id = FontId::new(14.0, FontFamily::Proportional); let text: WidgetText = palette.0.title.clone().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); ui.painter().galley_with_override_text_color( egui::Align2::LEFT_TOP.align_size_within_rect(galley.size(), rect.shrink(4.0)).min, galley, @@ -236,7 +236,7 @@ impl SelectPaletteDialog { let font_id = FontId::new(12.0, FontFamily::Proportional); let text: WidgetText = font_type.into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let rect = Rect::from_min_size( Pos2::new((rect.right() - galley.size().x - 10.0).floor(), (rect.top() + 8.0).floor()), diff --git a/crates/icy_draw/src/ui/dialogs/select_tdf_font_dialog.rs b/crates/icy_draw/src/ui/dialogs/select_tdf_font_dialog.rs index cc79dfd..586682e 100644 --- a/crates/icy_draw/src/ui/dialogs/select_tdf_font_dialog.rs +++ b/crates/icy_draw/src/ui/dialogs/select_tdf_font_dialog.rs @@ -67,7 +67,7 @@ impl SelectFontDialog { let font_id = TextStyle::Button.resolve(ui.style()); let text: WidgetText = font.name.clone().into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); ui.painter().galley_with_override_text_color( egui::Align2::LEFT_TOP.align_size_within_rect(galley.size(), rect.shrink(4.0)).min, galley, @@ -86,7 +86,7 @@ impl SelectFontDialog { }; let text: WidgetText = ch.to_string().into(); let font_id = FontId::new(14.0, FontFamily::Monospace); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let mut rect = rect.shrink(4.0); rect.set_top(rect.top() + y); @@ -159,7 +159,7 @@ impl SelectFontDialog { let font_id = FontId::new(12.0, FontFamily::Proportional); let text: WidgetText = font_type.into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); let rect = Rect::from_min_size( Pos2::new((rect.right() - galley.size().x - 10.0).floor(), (rect.top() + 8.0).floor()), diff --git a/crates/icy_draw/src/ui/document_docking.rs b/crates/icy_draw/src/ui/document_docking.rs index 277c2b8..7d27182 100644 --- a/crates/icy_draw/src/ui/document_docking.rs +++ b/crates/icy_draw/src/ui/document_docking.rs @@ -206,7 +206,7 @@ impl egui_tiles::Behavior for DocumentBehavior { fn on_tab_button(&mut self, tiles: &Tiles, tile_id: TileId, button_response: eframe::egui::Response) -> Response { let response_opt = button_response.context_menu(|ui| { if ui.button(fl!(crate::LANGUAGE_LOADER, "tab-context-menu-close")).clicked() { - self.on_close_requested(tiles, tile_id); + // self.on_close_requested(tiles, tile_id); ui.close_menu(); } if ui.button(fl!(crate::LANGUAGE_LOADER, "tab-context-menu-close_others")).clicked() { @@ -234,10 +234,10 @@ impl egui_tiles::Behavior for DocumentBehavior { button_response } } - + /* fn on_close_requested(&mut self, _tiles: &Tiles, tile_id: TileId) { self.request_close = Some(tile_id); - } + }*/ fn simplification_options(&self) -> egui_tiles::SimplificationOptions { egui_tiles::SimplificationOptions { @@ -245,10 +245,10 @@ impl egui_tiles::Behavior for DocumentBehavior { ..Default::default() } } - + /* fn has_close_buttons(&self) -> bool { true - } + }*/ fn top_bar_right_ui(&mut self, tiles: &Tiles, ui: &mut Ui, _tile_id: TileId, tabs: &Tabs, _scroll_offset: &mut f32) { if let Some(id) = tabs.active { diff --git a/crates/icy_draw/src/ui/editor/animation/mod.rs b/crates/icy_draw/src/ui/editor/animation/mod.rs index a679161..83b5350 100644 --- a/crates/icy_draw/src/ui/editor/animation/mod.rs +++ b/crates/icy_draw/src/ui/editor/animation/mod.rs @@ -199,7 +199,7 @@ impl Document for AnimationEditor { .show_inside(ui, |ui| { ui.horizontal(|ui| { if !self.animator.lock().unwrap().error.is_empty() { - ui.set_enabled(false); + ui.disable(); } if self.animator.lock().unwrap().success() { diff --git a/crates/icy_draw/src/ui/editor/ansi/mod.rs b/crates/icy_draw/src/ui/editor/ansi/mod.rs index eb6b154..211715e 100644 --- a/crates/icy_draw/src/ui/editor/ansi/mod.rs +++ b/crates/icy_draw/src/ui/editor/ansi/mod.rs @@ -572,7 +572,8 @@ impl AnsiEditor { self.output_string(text); } - egui::Event::CompositionEnd(text) | egui::Event::Text(text) => { + /* egui::Event::CompositionEnd(text) |*/ + egui::Event::Text(text) => { if !ui.input(|i| i.modifiers.ctrl || i.modifiers.command || i.modifiers.alt) { for c in text.chars() { cur_tool.handle_key(self, MKey::Character(c as u16), MModifiers::None); @@ -796,7 +797,7 @@ pub const DEFAULT_CHAR_SET_TABLE: [[u8; 10]; 15] = [ ]; pub fn terminal_context_menu(editor: &AnsiEditor, commands: &Commands, ui: &mut egui::Ui) -> Option { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); let mut result = None; ui.input_mut(|i| i.events.clear()); diff --git a/crates/icy_draw/src/ui/editor/charfont/mod.rs b/crates/icy_draw/src/ui/editor/charfont/mod.rs index 1f1d296..69346c1 100644 --- a/crates/icy_draw/src/ui/editor/charfont/mod.rs +++ b/crates/icy_draw/src/ui/editor/charfont/mod.rs @@ -115,7 +115,7 @@ impl Document for CharFontEditor { if self.selected_font < self.fonts.len() { ScrollArea::vertical().show(ui, |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); for i in 0..self.fonts.len() { if ui.selectable_value(&mut self.selected_font, i, &self.fonts[i].name).clicked() { @@ -210,7 +210,7 @@ impl Document for CharFontEditor { ui.label(fl!(crate::LANGUAGE_LOADER, "tdf-editor-spacing_label")); }); if ui - .add(egui::DragValue::new(&mut self.fonts[self.selected_font].spaces).clamp_range(0.0..=40.0)) + .add(egui::DragValue::new(&mut self.fonts[self.selected_font].spaces).range(0.0..=40.0)) .changed() { self.undostack_len += 1; diff --git a/crates/icy_draw/src/ui/tool_docking.rs b/crates/icy_draw/src/ui/tool_docking.rs index a650e41..0b873ec 100644 --- a/crates/icy_draw/src/ui/tool_docking.rs +++ b/crates/icy_draw/src/ui/tool_docking.rs @@ -41,10 +41,10 @@ impl egui_tiles::Behavior for ToolBehavior { ..Default::default() } } - + /* fn has_close_buttons(&self) -> bool { false - } + }*/ } pub trait ToolWindow { diff --git a/crates/icy_draw/src/ui/top_bar.rs b/crates/icy_draw/src/ui/top_bar.rs index 47a7669..ffdeb24 100644 --- a/crates/icy_draw/src/ui/top_bar.rs +++ b/crates/icy_draw/src/ui/top_bar.rs @@ -73,7 +73,7 @@ impl<'a> MainWindow<'a> { self.commands[0].new_file.ui(ui, &mut result); self.commands[0].open_file.ui(ui, &mut result); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-open_recent"), |ui| unsafe { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); let get_recent_files = MRU_FILES.get_recent_files(); if !get_recent_files.is_empty() { @@ -99,7 +99,7 @@ impl<'a> MainWindow<'a> { }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-edit"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(200.0); if let Some(doc) = self.get_active_document() { if doc.lock().can_undo() { @@ -153,7 +153,7 @@ impl<'a> MainWindow<'a> { } ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-paste-as"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(200.0); let button = button_with_shortcut(ui, pop_data(BUFFER_DATA).is_some(), fl!(crate::LANGUAGE_LOADER, "menu-paste-as-new-image"), ""); @@ -170,7 +170,7 @@ impl<'a> MainWindow<'a> { }); ui.separator(); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-area_operations"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(300.0); self.commands[0].justify_line_left.ui(ui, &mut result); @@ -200,7 +200,10 @@ impl<'a> MainWindow<'a> { ui.separator(); if ui - .add_enabled(has_buffer, egui::Button::new(fl!(crate::LANGUAGE_LOADER, "menu-edit-sauce")).wrap(false)) + .add_enabled( + has_buffer, + egui::Button::new(fl!(crate::LANGUAGE_LOADER, "menu-edit-sauce")).wrap_mode(egui::TextWrapMode::Truncate), + ) .clicked() { result = Some(Message::EditSauce); @@ -211,7 +214,10 @@ impl<'a> MainWindow<'a> { ui.separator(); if ui - .add_enabled(has_buffer, egui::Button::new(fl!(crate::LANGUAGE_LOADER, "menu-set-canvas-size")).wrap(false)) + .add_enabled( + has_buffer, + egui::Button::new(fl!(crate::LANGUAGE_LOADER, "menu-set-canvas-size")).wrap_mode(egui::TextWrapMode::Truncate), + ) .clicked() { result = Some(Message::SetCanvasSize); @@ -220,7 +226,7 @@ impl<'a> MainWindow<'a> { }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-selection"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(200.0); self.commands[0].select_all.ui(ui, &mut result); self.commands[0].deselect.ui(ui, &mut result); @@ -235,7 +241,7 @@ impl<'a> MainWindow<'a> { self.commands[0].crop.ui(ui, &mut result); }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-colors"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(300.0); if has_buffer { if let Some(pane) = self.get_active_pane_mut() { @@ -243,7 +249,7 @@ impl<'a> MainWindow<'a> { if let Some(editor) = lock.get_ansi_editor_mut() { let lock = &mut editor.buffer_view.lock(); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-ice-mode"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(240.0); if ui @@ -275,7 +281,7 @@ impl<'a> MainWindow<'a> { }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-palette-mode"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(240.0); if ui @@ -343,7 +349,7 @@ impl<'a> MainWindow<'a> { self.commands[0].switch_to_default_color.ui(ui, &mut result); }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-fonts"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(220.0); let mut font_mode = FontMode::Single; if let Some(pane) = self.get_active_pane_mut() { @@ -351,7 +357,7 @@ impl<'a> MainWindow<'a> { font_mode = editor.buffer_view.lock().get_buffer().font_mode; ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-font-mode"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(240.0); let lock = &mut editor.buffer_view.lock(); @@ -413,7 +419,7 @@ impl<'a> MainWindow<'a> { self.commands[0].open_tdf_directory.ui(ui, &mut result); }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-view"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(320.0); ui.menu_button( fl!( @@ -422,7 +428,7 @@ impl<'a> MainWindow<'a> { zoom = format!("{}%", (100. * unsafe { SETTINGS.get_scale().x }) as i32) ), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(270.0); self.commands[0].zoom_reset.ui(ui, &mut result); @@ -467,7 +473,7 @@ impl<'a> MainWindow<'a> { ); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-guides"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(200.0); if ui.selectable_label(cur_guide == Some(Vec2::new(80.0, 25.0)), "Smallscale 80x25").clicked() { result = Some(Message::SetGuide(80, 25)); @@ -496,7 +502,7 @@ impl<'a> MainWindow<'a> { }); ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-raster"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(100.0); let raster = [(1, 1), (2, 2), (4, 2), (4, 4), (8, 2), (8, 4), (8, 8), (16, 4), (16, 8), (16, 16)]; @@ -537,10 +543,13 @@ impl<'a> MainWindow<'a> { unsafe { if !PLUGINS.is_empty() { ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-plugins"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(250.0); for (i, p) in PLUGINS.iter().enumerate() { - if ui.add_enabled(has_buffer, egui::Button::new(p.title.clone()).wrap(false)).clicked() { + if ui + .add_enabled(has_buffer, egui::Button::new(p.title.clone()).wrap_mode(egui::TextWrapMode::Truncate)) + .clicked() + { result = Some(Message::RunPlugin(i)); ui.close_menu(); } @@ -553,7 +562,7 @@ impl<'a> MainWindow<'a> { } ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-help"), |ui| { - ui.style_mut().wrap = Some(false); + ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate); ui.set_min_width(170.0); let r = ui.hyperlink_to(fl!(crate::LANGUAGE_LOADER, "menu-discuss"), "https://github.com/mkrueger/icy_tools/discussions"); if r.clicked() { diff --git a/crates/icy_engine/src/formats/icy_draw.rs b/crates/icy_engine/src/formats/icy_draw.rs index 23a3275..328b209 100644 --- a/crates/icy_engine/src/formats/icy_draw.rs +++ b/crates/icy_engine/src/formats/icy_draw.rs @@ -373,10 +373,13 @@ impl OutputFormat for IcyDraw { if image_empty { writer.write_image_data(&[0, 0, 0, 0]).unwrap(); } else { - let (_, data) = buf.render_to_rgba(crate::Rectangle { - start: Position::new(0, first_line), - size: Size::new(buf.get_width(), last_line - first_line), - }, true); + let (_, data) = buf.render_to_rgba( + crate::Rectangle { + start: Position::new(0, first_line), + size: Size::new(buf.get_width(), last_line - first_line), + }, + true, + ); writer.write_image_data(&data).unwrap(); } writer.finish().unwrap(); diff --git a/crates/icy_engine_gui/src/ui/buffer_view/terminal_renderer.rs b/crates/icy_engine_gui/src/ui/buffer_view/terminal_renderer.rs index 4314a3e..75fb1c1 100644 --- a/crates/icy_engine_gui/src/ui/buffer_view/terminal_renderer.rs +++ b/crates/icy_engine_gui/src/ui/buffer_view/terminal_renderer.rs @@ -128,17 +128,17 @@ impl TerminalRenderer { } if self.redraw_view - || calc.char_scroll_position != self.last_scroll_position - || calc.char_size != self.last_char_size - || calc.buffer_rect.size() != self.last_buffer_rect_size - || edit_state.is_buffer_dirty() + || calc.char_scroll_position != self.last_scroll_position + || calc.char_size != self.last_char_size + || calc.buffer_rect.size() != self.last_buffer_rect_size + || edit_state.is_buffer_dirty() { - /* println!("{} - {}, {}, {}, {} ", - self.redraw_view, - calc.char_scroll_position != self.last_scroll_position, - calc.char_size != self.last_char_size, - calc.buffer_rect.size() != self.last_buffer_rect_size, - edit_state.is_buffer_dirty());*/ + /* println!("{} - {}, {}, {}, {} ", + self.redraw_view, + calc.char_scroll_position != self.last_scroll_position, + calc.char_size != self.last_char_size, + calc.buffer_rect.size() != self.last_buffer_rect_size, + edit_state.is_buffer_dirty());*/ self.last_scroll_position = calc.char_scroll_position; self.last_char_size = calc.char_size; diff --git a/crates/icy_engine_gui/src/ui/mod.rs b/crates/icy_engine_gui/src/ui/mod.rs index c31b683..fc4380a 100644 --- a/crates/icy_engine_gui/src/ui/mod.rs +++ b/crates/icy_engine_gui/src/ui/mod.rs @@ -351,7 +351,7 @@ pub fn show_terminal_area(ui: &mut egui::Ui, buffer_view: Arc = ui.input(|i| i.events.clone()); for e in events { - if let egui::Event::Scroll(vec) = e { - self.char_scroll_position.y -= vec.y; + if let egui::Event::MouseWheel { delta, .. } = e { + self.char_scroll_position.y -= delta.y; self.set_scroll_position = true; } } @@ -380,8 +380,8 @@ impl SmoothScroll { if response.hovered() { let events: Vec = ui.input(|i| i.events.clone()); for e in events { - if let egui::Event::Scroll(vec) = e { - self.char_scroll_position.x -= vec.x; + if let egui::Event::MouseWheel { delta, .. } = e { + self.char_scroll_position.x -= delta.x; self.set_scroll_position = true; } } diff --git a/crates/icy_term/src/features/auto_login.rs b/crates/icy_term/src/features/auto_login.rs index ad9d69d..f4a5623 100644 --- a/crates/icy_term/src/features/auto_login.rs +++ b/crates/icy_term/src/features/auto_login.rs @@ -5,7 +5,7 @@ use crate::{util::PatternRecognizer, Res}; pub struct AutoLogin { pub logged_in: bool, - pub disabled: bool, + pub _disabled: bool, pub iemsi: IEmsi, _last_char_recv: Instant, _first_char_recv: Option, @@ -25,7 +25,7 @@ impl AutoLogin { pub fn new(login_expr: &str, user_name: String, password: String) -> Self { Self { logged_in: false, - disabled: false, + _disabled: false, iemsi: IEmsi::default(), _first_char_recv: None, _last_char_recv: Instant::now(), diff --git a/crates/icy_term/src/main.rs b/crates/icy_term/src/main.rs index 84bd048..9d6a6ef 100644 --- a/crates/icy_term/src/main.rs +++ b/crates/icy_term/src/main.rs @@ -174,7 +174,7 @@ fn main() { log::info!("Starting iCY TERM {}", *VERSION); - if let Err(err) = eframe::run_native(&DEFAULT_TITLE, native_options, Box::new(|cc| Box::new(MainWindow::new(cc, options)))) { + if let Err(err) = eframe::run_native(&DEFAULT_TITLE, native_options, Box::new(|cc| Ok(Box::new(MainWindow::new(cc, options))))) { log::error!("Error returned by run_native: {}", err); } log::info!("shutting down."); diff --git a/crates/icy_term/src/ui/com_thread.rs b/crates/icy_term/src/ui/com_thread.rs index 95405bc..b2965e4 100644 --- a/crates/icy_term/src/ui/com_thread.rs +++ b/crates/icy_term/src/ui/com_thread.rs @@ -11,14 +11,14 @@ use web_time::Instant; use super::connect::SendData; pub struct ConnectionThreadData { - pub tx: mpsc::Sender, + pub _tx: mpsc::Sender, pub rx: mpsc::Receiver, pub com: Box, - pub thread_is_running: bool, - pub is_connected: bool, + pub _thread_is_running: bool, + pub _is_connected: bool, // used for baud rate emulation - pub data_buffer: VecDeque, + pub _data_buffer: VecDeque, pub baud_rate: u32, - pub last_send_time: Instant, + pub _last_send_time: Instant, } diff --git a/crates/icy_term/src/ui/dialogs/dialing_directory_dialog.rs b/crates/icy_term/src/ui/dialogs/dialing_directory_dialog.rs index ce57f79..e106c33 100644 --- a/crates/icy_term/src/ui/dialogs/dialing_directory_dialog.rs +++ b/crates/icy_term/src/ui/dialogs/dialing_directory_dialog.rs @@ -681,7 +681,7 @@ impl egui::Widget for AddressRow { .font(FontId::new(14.0, FontFamily::Proportional)) .color(ui.ctx().style().visuals.warn_fg_color), ); - let star_text = star_text.into_galley(ui, Some(false), wrap_width, egui::TextStyle::Button); + let star_text = star_text.into_galley(ui, Some(egui::TextWrapMode::Truncate), wrap_width, egui::TextStyle::Button); let star_text_size = star_text.size(); let rt = RichText::new(addr.system_name.clone()) @@ -689,17 +689,17 @@ impl egui::Widget for AddressRow { .strong(); let name_text = WidgetText::from(rt); - let name_text = name_text.into_galley(ui, Some(false), wrap_width, egui::TextStyle::Button); + let name_text = name_text.into_galley(ui, Some(egui::TextWrapMode::Truncate), wrap_width, egui::TextStyle::Button); let name_text_size = name_text.size(); let addr_text = WidgetText::from(RichText::new(addr.address.clone()).font(FontId::new(12.0, FontFamily::Monospace))); - let addr_text = addr_text.into_galley(ui, Some(false), wrap_width, egui::TextStyle::Button); + let addr_text = addr_text.into_galley(ui, Some(egui::TextWrapMode::Truncate), wrap_width, egui::TextStyle::Button); let mut desired_size = total_extra + name_text.size() + Vec2::new(0.0, addr_text.size().y); desired_size.x = phone_list_width; desired_size.y = desired_size.y.at_least(ui.spacing().interact_size.y).floor(); let (rect, response) = ui.allocate_at_least(desired_size, egui::Sense::click()); - response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, selected, name_text.text())); + response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, true, selected, name_text.text())); if ui.is_rect_visible(response.rect) { let visuals = ui.style().interact_selectable(&response, selected); @@ -876,10 +876,14 @@ pub fn view_dialing_directory(window: &mut MainWindow, ctx: &egui::Context) { } let connect_text = WidgetText::from(fl!(crate::LANGUAGE_LOADER, "dialing_directory-connect-button")); - let connect_text_size = connect_text.into_galley(ui, Some(false), 1000., egui::TextStyle::Button).size(); + let connect_text_size = connect_text + .into_galley(ui, Some(egui::TextWrapMode::Truncate), 1000., egui::TextStyle::Button) + .size(); let cancel_text = WidgetText::from(fl!(crate::LANGUAGE_LOADER, "dialing_directory-cancel-button")); - let cancel_text_size = cancel_text.into_galley(ui, Some(false), 1000., egui::TextStyle::Button).size(); + let cancel_text_size = cancel_text + .into_galley(ui, Some(egui::TextWrapMode::Truncate), 1000., egui::TextStyle::Button) + .size(); ui.add_space(ui.available_size_before_wrap().x - connect_text_size.x - cancel_text_size.x - 8.); diff --git a/crates/icy_term/src/ui/dialogs/up_download_dialog.rs b/crates/icy_term/src/ui/dialogs/up_download_dialog.rs index f8698c9..8371fcc 100644 --- a/crates/icy_term/src/ui/dialogs/up_download_dialog.rs +++ b/crates/icy_term/src/ui/dialogs/up_download_dialog.rs @@ -151,13 +151,18 @@ impl FileTransferDialog { match transfer_info.get_log_message(self.selected_log, i) { Some(msg) => match msg { OutputLogMessage::Error(msg) => { - ui.add(Label::new(RichText::new(msg).color(ctx.style().visuals.error_fg_color)).wrap(false)); + ui.add( + Label::new(RichText::new(msg).color(ctx.style().visuals.error_fg_color)) + .wrap_mode(egui::TextWrapMode::Truncate), + ); } OutputLogMessage::Warning(msg) => { - ui.add(Label::new(RichText::new(msg).color(ctx.style().visuals.warn_fg_color)).wrap(false)); + ui.add( + Label::new(RichText::new(msg).color(ctx.style().visuals.warn_fg_color)).wrap_mode(egui::TextWrapMode::Truncate), + ); } OutputLogMessage::Info(msg) => { - ui.add(Label::new(RichText::new(msg)).wrap(false)); + ui.add(Label::new(RichText::new(msg)).wrap_mode(egui::TextWrapMode::Truncate)); } }, None => { diff --git a/crates/icy_term/src/ui/terminal_thread.rs b/crates/icy_term/src/ui/terminal_thread.rs index 3d78ff7..5515ed1 100644 --- a/crates/icy_term/src/ui/terminal_thread.rs +++ b/crates/icy_term/src/ui/terminal_thread.rs @@ -186,13 +186,13 @@ pub fn start_update_thread( update_thread.lock().connection_time = Instant::now(); let mut connection = ConnectionThreadData { - is_connected: false, + _is_connected: false, com, baud_rate: connection_data.baud_emulation.get_baud_rate(), - data_buffer: VecDeque::new(), - thread_is_running: true, - tx: tx, - last_send_time: Instant::now(), + _data_buffer: VecDeque::new(), + _thread_is_running: true, + _tx: tx, + _last_send_time: Instant::now(), rx: rx2, }; let mut data = [0; 1024 * 64]; diff --git a/crates/icy_term/src/ui/terminal_window.rs b/crates/icy_term/src/ui/terminal_window.rs index 6e4dd91..568846d 100644 --- a/crates/icy_term/src/ui/terminal_window.rs +++ b/crates/icy_term/src/ui/terminal_window.rs @@ -32,7 +32,7 @@ impl MainWindow { if !self.is_fullscreen_mode { egui::TopBottomPanel::top("button_bar").frame(button_frame).show(ctx, |ui| { if !enable_ui { - ui.set_enabled(false); + ui.disable(); } ui.horizontal(|ui| { let r = ui.add(ImageButton::new(UPLOAD.clone().tint(crate::ui::button_tint(ui)))).on_hover_ui(|ui| { @@ -178,7 +178,7 @@ impl MainWindow { egui::CentralPanel::default().frame(frame_no_margins).show(ctx, |ui| { if !enable_ui { - ui.set_enabled(false); + ui.disable(); } let rect = ui.available_rect_before_wrap(); @@ -271,7 +271,8 @@ impl MainWindow { egui::Event::Paste(text) => { self.output_string(&text); } - egui::Event::CompositionEnd(text) | egui::Event::Text(text) => { + /*egui::Event::CompositionEnd(text) |*/ + egui::Event::Text(text) => { for c in text.chars() { self.output_char(c); } @@ -651,7 +652,7 @@ fn terminal_context_menu(ui: &mut egui::Ui, window: &mut MainWindow) { { ui.separator(); if ui - .add(egui::Button::new(fl!(crate::LANGUAGE_LOADER, "terminal-menu-export")).wrap(false)) + .add(egui::Button::new(fl!(crate::LANGUAGE_LOADER, "terminal-menu-export")).wrap_mode(egui::TextWrapMode::Truncate)) .clicked() { window.init_export_dialog(ui.ctx()); diff --git a/crates/icy_view/src/main.rs b/crates/icy_view/src/main.rs index dccd62c..548034d 100644 --- a/crates/icy_view/src/main.rs +++ b/crates/icy_view/src/main.rs @@ -64,7 +64,7 @@ fn main() { } let cmd = fd.file_view.refresh(); fd.handle_command(cmd); - Box::new(fd) + Ok(Box::new(fd)) }), ) .unwrap(); diff --git a/crates/icy_view_gui/src/ui/file_view.rs b/crates/icy_view_gui/src/ui/file_view.rs index 14540ec..0e820c1 100644 --- a/crates/icy_view_gui/src/ui/file_view.rs +++ b/crates/icy_view_gui/src/ui/file_view.rs @@ -311,7 +311,7 @@ impl FileView { let font_id = FontId::new(14.0, FontFamily::Proportional); let text: WidgetText = label.into(); - let galley = text.into_galley(ui, Some(false), f32::INFINITY, font_id); + let galley = text.into_galley(ui, Some(egui::TextWrapMode::Truncate), f32::INFINITY, font_id); ui.painter() .galley_with_override_text_color(egui::Align2::LEFT_TOP.align_size_within_rect(galley.size(), rect).min, galley, text_color); if response.hovered() { diff --git a/crates/icy_view_gui/src/ui/mod.rs b/crates/icy_view_gui/src/ui/mod.rs index f5ba8d8..c2b2d87 100644 --- a/crates/icy_view_gui/src/ui/mod.rs +++ b/crates/icy_view_gui/src/ui/mod.rs @@ -64,7 +64,9 @@ impl<'a> App for MainWindow<'a> { .exact_width(250.0) .resizable(true) .show(ctx, |ui| { - ui.set_enabled(self.sauce_dialog.is_none() && self.help_dialog.is_none()); + if !(self.sauce_dialog.is_none() && self.help_dialog.is_none()) { + ui.disable(); + } let command = self.file_view.show_ui(ui, false); self.handle_command(command); }); @@ -73,7 +75,9 @@ impl<'a> App for MainWindow<'a> { .inner_margin(Margin::same(0.0)) .fill(Color32::BLACK); egui::CentralPanel::default().frame(frame_no_margins).show(ctx, |ui| { - ui.set_enabled(self.sauce_dialog.is_none() && self.help_dialog.is_none()); + if !(self.sauce_dialog.is_none() && self.help_dialog.is_none()) { + ui.disable(); + } self.paint_main_area(ui) }); self.in_scroll &= self.file_view.options.auto_scroll_enabled;