Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Updated to egui 0.27.2 and latest icy_engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger committed Apr 9, 2024
1 parent 663fa63 commit 2397261
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 29 deletions.
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ license = "Apache-2.0"
repository = "https://github.com/mkrueger/icy_term"

[dependencies]
egui = "0.26.0"
eframe = { version = "0.26.0", default-features = false, features = [
egui = "0.27.2"
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.
] }
egui_extras = { version="0.26.0", features = ["all_loaders"] }
egui_glow = "0.26.0"
egui_extras = { version="0.27.2", features = ["all_loaders"] }
egui_glow = "0.27.2"
egui-modal = "0.3.3"
egui-bind = "0.11.0"
egui_file = "0.16.2"
egui-bind = "0.12.0"
egui_file = "0.17.0"
glow = "0.13.0"
dark-light = "1.0.0"
serde = "1.0.185"
Expand All @@ -32,9 +32,9 @@ serial = "0.4.0"
#sound
rodio = { version = "0.17.1" , default-features = false, features = [] }
icy_engine = { git ="https://github.com/mkrueger/icy_engine" }
icy_engine_egui = { git ="https://github.com/mkrueger/icy_engine_egui" }
icy_engine_gui = { git ="https://github.com/mkrueger/icy_engine" }
#icy_engine = { path = "../icy_engine" }
#icy_engine_egui = { path = "../icy_engine_egui" }
#icy_engine_gui = { path = "../icy_engine" }

walkdir = "2"
toml = "0.8.1"
Expand All @@ -47,7 +47,7 @@ chrono = "0.4.26" # Utc hanldung
thiserror = "1.0"
anyhow = "1.0.75"

i18n-embed-fl = "0.7.0"
i18n-embed-fl = "0.8.0"
# currently disabled because there needs to be a fix for wasm32:
#rust-embed = "6.8.1"
once_cell = "1.18.0"
Expand Down
2 changes: 1 addition & 1 deletion src/data/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use egui::Modifiers;
use egui_bind::KeyOrPointer;
use i18n_embed_fl::fl;
use icy_engine::Color;
use icy_engine_egui::MonitorSettings;
use icy_engine_gui::MonitorSettings;
use toml::Value;

use crate::{Modem, TerminalResult};
Expand Down
2 changes: 1 addition & 1 deletion src/ui/buffer_update_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use icy_engine::{
rip::bgi::MouseField,
BufferParser, Caret,
};
use icy_engine_egui::BufferView;
use icy_engine_gui::BufferView;
use std::{mem, path::PathBuf, sync::Arc, thread};
use web_time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion src/ui/dialogs/find_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use egui::{FontFamily, FontId, Rect, RichText, SelectableLabel, TextEdit, Ui, Vec2};
use i18n_embed_fl::fl;
use icy_engine::{AttributedChar, Buffer, Position, Selection, TextPane, UnicodeConverter};
use icy_engine_egui::BufferView;
use icy_engine_gui::BufferView;

#[derive(Default)]
pub struct DialogState {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/dialogs/settings_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use eframe::egui::{self, RichText};
use egui::{Layout, TextEdit, Vec2};
use i18n_embed_fl::fl;
use icy_engine_egui::show_monitor_settings;
use icy_engine_gui::show_monitor_settings;

use crate::{
ui::{MainWindowMode, MainWindowState},
Expand All @@ -22,7 +22,7 @@ pub(crate) enum Message {
ResetKeybindSettings,
UpdateIEMSI(crate::IEMSISettings),
UpdateModem(Modem),
UpdateMonitorSettings(icy_engine_egui::MonitorSettings),
UpdateMonitorSettings(icy_engine_gui::MonitorSettings),
// ChangeOpenglScaling(Scaling),
UpdateKeybinds(KeyBindings),
ChangeConsoleBeep(bool),
Expand Down Expand Up @@ -341,7 +341,7 @@ fn show_modem_settings(state: &MainWindowState, ui: &mut egui::Ui) -> Option<Mes
#[cfg(test)]
mod tests {
#![allow(clippy::field_reassign_with_default)]
use icy_engine_egui::MonitorSettings;
use icy_engine_gui::MonitorSettings;

use crate::{
ui::{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use egui::Vec2;
use egui_bind::BindTarget;
use i18n_embed_fl::fl;
use icy_engine::{AttributedChar, Caret, Position};
use icy_engine_egui::BufferView;
use icy_engine_gui::BufferView;
use std::mem;
use std::path::PathBuf;
use std::sync::Arc;
Expand Down
20 changes: 8 additions & 12 deletions src/ui/terminal_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use eframe::{
egui::{self, CursorIcon, PointerButton},
epaint::Vec2,
};
use egui::{ImageButton, Modifiers, RichText};
use egui::{ImageButton, Margin, Modifiers, RichText};
use i18n_embed_fl::fl;
use icy_engine::{Position, Selection, TextPane};

Expand All @@ -26,9 +26,7 @@ fn encode_mouse_position(pos: i32) -> char {
impl MainWindow {
pub fn update_terminal_window(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame, show_dialing_directory: bool) {
let toolbar_bg_color = ctx.style().visuals.extreme_bg_color;
let button_frame = egui::containers::Frame::none()
.fill(toolbar_bg_color)
.inner_margin(egui::style::Margin::same(6.0));
let button_frame = egui::containers::Frame::none().fill(toolbar_bg_color).inner_margin(Margin::same(6.0));

let enable_ui = matches!(self.get_mode(), MainWindowMode::ShowTerminal);

Expand Down Expand Up @@ -177,9 +175,7 @@ impl MainWindow {
});
});
}
let frame_no_margins = egui::containers::Frame::none()
.outer_margin(egui::style::Margin::same(0.0))
.inner_margin(egui::style::Margin::same(0.0));
let frame_no_margins = egui::containers::Frame::none().outer_margin(Margin::same(0.0)).inner_margin(Margin::same(0.0));

egui::CentralPanel::default().frame(frame_no_margins).show(ctx, |ui| {
if !enable_ui {
Expand Down Expand Up @@ -234,14 +230,14 @@ impl MainWindow {
self.buffer_update_thread.lock().enabled = !enabled;
}*/

let opt = icy_engine_egui::TerminalOptions {
let opt = icy_engine_gui::TerminalOptions {
filter: self.get_options().scaling.get_filter(),
monitor_settings,
stick_to_bottom: true,
use_terminal_height: true,
..Default::default()
};
let (mut response, calc) = icy_engine_egui::show_terminal_area(ui, self.buffer_view.clone(), opt);
let (mut response, calc) = icy_engine_gui::show_terminal_area(ui, self.buffer_view.clone(), opt);
let inner_response = response.context_menu(|ui| terminal_context_menu(ui, self));
if let Some(inner_response) = inner_response {
response = inner_response.response;
Expand Down Expand Up @@ -512,7 +508,7 @@ impl MainWindow {
}
}

if response.drag_released_by(PointerButton::Primary) && self.drag_start.is_some() {
if response.drag_stopped_by(PointerButton::Primary) && self.drag_start.is_some() {
self.shift_pressed_during_selection = ui.input(|i| i.modifiers.shift);
if response.hover_pos().is_some() {
let l = self.buffer_view.lock();
Expand Down Expand Up @@ -564,10 +560,10 @@ impl MainWindow {
let key_map = im.cur_map();
let mut key_code = key as u32;
if modifiers.ctrl || modifiers.command {
key_code |= icy_engine_egui::ui::CTRL_MOD;
key_code |= icy_engine_gui::ui::CTRL_MOD;
}
if modifiers.shift {
key_code |= icy_engine_egui::ui::SHIFT_MOD;
key_code |= icy_engine_gui::ui::SHIFT_MOD;
}
for (k, m) in key_map {
if *k == key_code {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/util/screen_modes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::Display;

use icy_engine::{BitFont, Color, Palette, Size, ATARI, ATARI_DEFAULT_PALETTE, C64_DEFAULT_PALETTE, C64_LOWER, C64_UPPER, CP437, VIEWDATA, VIEWDATA_PALETTE};
use icy_engine_egui::BufferInputMode;
use icy_engine_gui::BufferInputMode;

use crate::ui::MainWindow;

Expand Down

0 comments on commit 2397261

Please sign in to comment.