Skip to content

Commit 6b75ca3

Browse files
committed
maximised by default, increased input width, changed way of setting zoom factor
1 parent 2e7dd83 commit 6b75ca3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/bin/gui/main.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// #![windows_subsystem = "windows"]
22
use eframe::egui;
33
use anyhow::Result;
4-
use egui::Color32;
4+
use egui::{Color32, TextEdit};
55
use itertools::Itertools;
66
use nfd2::Response;
77
use pathdiff::diff_paths;
@@ -23,7 +23,7 @@ struct AppState {
2323
impl AppState {
2424
fn new(cc: &eframe::CreationContext<'_>, file: String, cwd: PathBuf) -> Self {
2525
// Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
26-
cc.egui_ctx.set_pixels_per_point(1.5);
26+
cc.egui_ctx.set_zoom_factor(1.5);
2727
// Restore app state using cc.storage (requires the "persistence" feature).
2828
// Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
2929
// for e.g. egui::PaintCallback.
@@ -51,6 +51,9 @@ impl AppState {
5151

5252
impl eframe::App for AppState {
5353
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
54+
let mut style = (*ctx.style()).clone();
55+
style.spacing.text_edit_width = 650.;
56+
ctx.set_style(style);
5457
egui::CentralPanel::default().show(ctx, |ui| {
5558
ui.horizontal(|ui| {
5659
ui.vertical(|ui| {
@@ -152,7 +155,13 @@ fn main() -> Result<()> {
152155
}
153156
file_path.file_name().unwrap().to_string_lossy().to_string()
154157
};
155-
let native_options = eframe::NativeOptions::default();
158+
let native_options = eframe::NativeOptions {
159+
viewport: egui::ViewportBuilder {
160+
maximized: Some(true),
161+
..Default::default()
162+
},
163+
..Default::default()
164+
};
156165
eframe::run_native(
157166
"Simple Renamer", native_options,
158167
Box::new(|cc| Ok(Box::new(AppState::new(cc, file, cwd))))

0 commit comments

Comments
 (0)