settings: use timed serializer, handle zoom properly, use custom text style for note body font size, added font size slider, added preview note
This commit is contained in:
@@ -69,7 +69,13 @@ pub async fn android_main(app: AndroidApp) {
|
||||
Box::new(move |cc| {
|
||||
let ctx = &cc.egui_ctx;
|
||||
let mut notedeck = Notedeck::new(ctx, path, &app_args);
|
||||
setup_chrome(ctx, ¬edeck.args(), notedeck.theme());
|
||||
setup_chrome(
|
||||
ctx,
|
||||
¬edeck.args(),
|
||||
notedeck.theme(),
|
||||
notedeck.note_body_font_size(),
|
||||
notedeck.zoom_factor(),
|
||||
);
|
||||
|
||||
let context = &mut notedeck.app_context();
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
|
||||
@@ -113,8 +113,7 @@ impl ChromePanelAction {
|
||||
match self {
|
||||
Self::SaveTheme(theme) => {
|
||||
ui.ctx().set_theme(*theme);
|
||||
ctx.settings_handler.set_theme(*theme);
|
||||
ctx.settings_handler.save();
|
||||
ctx.settings.set_theme(*theme);
|
||||
}
|
||||
|
||||
Self::Toolbar(toolbar_action) => match toolbar_action {
|
||||
|
||||
@@ -98,7 +98,13 @@ async fn main() {
|
||||
let columns = Damus::new(&mut notedeck.app_context(), &args);
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
|
||||
setup_chrome(ctx, notedeck.args(), notedeck.theme());
|
||||
setup_chrome(
|
||||
ctx,
|
||||
notedeck.args(),
|
||||
notedeck.theme(),
|
||||
notedeck.note_body_font_size(),
|
||||
notedeck.zoom_factor(),
|
||||
);
|
||||
|
||||
// ensure we recognized all the arguments
|
||||
let completely_unrecognized: Vec<String> = notedeck
|
||||
|
||||
@@ -38,7 +38,13 @@ impl PreviewRunner {
|
||||
"unrecognized args: {:?}",
|
||||
notedeck.unrecognized_args()
|
||||
);
|
||||
setup_chrome(ctx, notedeck.args(), notedeck.theme());
|
||||
setup_chrome(
|
||||
ctx,
|
||||
notedeck.args(),
|
||||
notedeck.theme(),
|
||||
notedeck.note_body_font_size(),
|
||||
notedeck.zoom_factor(),
|
||||
);
|
||||
|
||||
notedeck.set_app(PreviewApp::new(preview));
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
use crate::{fonts, theme};
|
||||
|
||||
use eframe::NativeOptions;
|
||||
use egui::ThemePreference;
|
||||
use notedeck::{AppSizeHandler, DataPath};
|
||||
use egui::{FontId, ThemePreference};
|
||||
use notedeck::{AppSizeHandler, DataPath, NotedeckTextStyle};
|
||||
use notedeck_ui::app_images;
|
||||
use tracing::info;
|
||||
|
||||
pub fn setup_chrome(ctx: &egui::Context, args: ¬edeck::Args, theme: ThemePreference) {
|
||||
pub fn setup_chrome(
|
||||
ctx: &egui::Context,
|
||||
args: ¬edeck::Args,
|
||||
theme: ThemePreference,
|
||||
note_body_font_size: f32,
|
||||
zoom_factor: f32,
|
||||
) {
|
||||
let is_mobile = args
|
||||
.is_mobile
|
||||
.unwrap_or(notedeck::ui::is_compiled_as_mobile());
|
||||
@@ -31,6 +37,15 @@ pub fn setup_chrome(ctx: &egui::Context, args: ¬edeck::Args, theme: ThemePref
|
||||
ctx.set_visuals_of(egui::Theme::Light, theme::light_mode());
|
||||
|
||||
setup_cc(ctx, is_mobile);
|
||||
|
||||
ctx.set_zoom_factor(zoom_factor);
|
||||
|
||||
let mut style = (*ctx.style()).clone();
|
||||
style.text_styles.insert(
|
||||
NotedeckTextStyle::NoteBody.text_style(),
|
||||
FontId::proportional(note_body_font_size),
|
||||
);
|
||||
ctx.set_style(style);
|
||||
}
|
||||
|
||||
pub fn setup_cc(ctx: &egui::Context, is_mobile: bool) {
|
||||
@@ -39,7 +54,6 @@ pub fn setup_cc(ctx: &egui::Context, is_mobile: bool) {
|
||||
if notedeck::ui::is_compiled_as_mobile() {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() + 0.2);
|
||||
}
|
||||
|
||||
//ctx.set_pixels_per_point(1.0);
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user