Skip to content

Commit

Permalink
Bump egui
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualEhrmanntraut committed Jul 5, 2024
1 parent 10899ed commit 87a07d5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,33 @@ strip = true
lto = "thin"

[dependencies]
winit = { version = "0.29.15", default-features = true }
eframe = { version = "0.27.2", default-features = false, features = [
winit = { version = "0.29.4", default-features = true }
eframe = { version = "0.28.1", default-features = false, features = [
"accesskit",
"persistence",
"wgpu",
"wayland",
"x11",
] }
egui = { version = "0.27.2", default-features = false, features = [
egui = { version = "0.28.1", default-features = false, features = [
"persistence",
] }
egui_extras = "0.27.2"
egui_extras = "0.28.1"
hex = "0.4.3"
plist = "1.6.1"
plist = "1.7.0"
rfd = "0.14.1"
serde = { version = "1.0.201", features = ["derive"] }
serde = { version = "1.0.203", features = ["derive"] }
egui-modal = "0.3.6"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.5.1"
objc2-app-kit = { version = "0.2.0", features = [
objc2 = "0.5.2"
objc2-app-kit = { version = "0.2.2", features = [
"NSResponder",
"NSApplication",
"NSMenu",
"NSMenuItem",
] }
objc2-foundation = { version = "0.2.0", features = ["NSString", "NSThread"] }
objc2-foundation = { version = "0.2.2", features = ["NSString", "NSThread"] }

[patch.crates-io]
egui-modal = { git = "https://github.com/crumblingstatue/egui-modal/", branch = "egui-0.28" }
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ fn main() {
..Default::default()
},
Box::new(|cc| {
Box::new(PlistOxide::new(
Ok(Box::new(PlistOxide::new(
cc,
std::env::args().nth(1).map(PathBuf::from),
))
)))
}),
)
.unwrap();
Expand Down
30 changes: 19 additions & 11 deletions src/widgets/click_text_edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//! See LICENSE for details.

use egui::{
Color32, Context, CursorIcon, Id, Key, Response, RichText, TextEdit, TextStyle, Ui, Widget,
WidgetInfo,
Color32, Context, CursorIcon, Id, Key, PopupCloseBehavior, Response, RichText, TextEdit,
TextStyle, Ui, Widget, WidgetInfo,
};

type GetSetValue<'a> = Box<dyn 'a + FnMut(Option<String>) -> String>;
Expand Down Expand Up @@ -84,14 +84,20 @@ impl<'a> Widget for ClickableTextEdit<'a> {
.id(kb_edit_id)
.font(TextStyle::Monospace),
);
egui::popup::popup_below_widget(ui, popup_id, &response, |ui| {
ui.set_min_width(100.0);
ui.label(
RichText::new("Value is currently invalid")
.color(Color32::RED)
.strong(),
);
});
egui::popup::popup_below_widget(
ui,
popup_id,
&response,
PopupCloseBehavior::IgnoreClicks,
|ui| {
ui.set_min_width(100.0);
ui.label(
RichText::new("Value is currently invalid")
.color(Color32::RED)
.strong(),
);
},
);

if validate_value(state.edit_string.as_str()) {
ui.memory_mut(egui::Memory::close_popup);
Expand Down Expand Up @@ -127,7 +133,9 @@ impl<'a> Widget for ClickableTextEdit<'a> {
let value = get(&mut get_set_value);
response.changed = value != old_value;

response.widget_info(|| WidgetInfo::text_edit(old_value.as_str(), value.as_str()));
response.widget_info(|| {
WidgetInfo::text_edit(ui.is_enabled(), old_value.as_str(), value.as_str())
});
response
}
}
6 changes: 4 additions & 2 deletions src/widgets/toggle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ impl<'a> Widget for Toggle<'a> {
*on = !*on;
response.mark_changed();
}
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, *on, ""));
response.widget_info(|| {
egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), *on, "")
});

if ui.is_rect_visible(rect) {
let how_on = ui.ctx().animate_bool(response.id, *on);
let how_on = ui.ctx().animate_bool_responsive(response.id, *on);
let visuals = ui.style().interact_selectable(&response, *on);
let rect = rect.expand(visuals.expansion);
let radius = 0.5 * rect.height();
Expand Down

0 comments on commit 87a07d5

Please sign in to comment.