Improve presenter menus, browser focus and saved appearance preferences
This commit is contained in:
parent
f2235de77a
commit
192ede74fe
|
|
@ -59,8 +59,9 @@ implementation choices for target packaging and clean-machine acceptance.
|
|||
Open source PDFs read-only. Never rewrite a document as a side effect of presenting.
|
||||
Failed loads retain the working document. Bound renderer memory/cache usage; handle
|
||||
malformed, encrypted and large PDFs explicitly. Keep slow rendering off the UI thread.
|
||||
Audience outputs must never show operator notes, dialogs, paths or controls. Require
|
||||
explicit output activation, start blanked, and preserve blanking during navigation.
|
||||
Audience outputs must never show operator notes, dialogs, paths or controls. Show presentation output automatically on startup/document open by default, with a
|
||||
saved opt-out. Preserve manual blanking during navigation; topology changes and host
|
||||
failure recovery still blank explicitly and must show an unmistakable operator warning.
|
||||
Display disconnects must not move operator content onto an audience output.
|
||||
Never claim physical multiscreen acceptance from headless unit tests.
|
||||
|
||||
|
|
|
|||
|
|
@ -2212,7 +2212,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.13"
|
||||
version = "0.1.14"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
@ -2230,6 +2230,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"sha2",
|
||||
"softbuffer",
|
||||
"sys-locale",
|
||||
"tempfile",
|
||||
"toml",
|
||||
"winit",
|
||||
|
|
@ -2991,6 +2992,15 @@ dependencies = [
|
|||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sys-locale"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.13"
|
||||
version = "0.1.14"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
**Native presenter:** open PDFs or naturally ordered picture folders, with configurable
|
||||
presenter previews/notes, a safe slide browser and mirrored display roles. Outputs
|
||||
start blanked; use **Show presentation** when destinations are ready. Both roles
|
||||
show automatically when a document opens (saved opt-out in Menu). Both roles
|
||||
default to fullscreen; a single monitor uses presenter-only rehearsal.
|
||||
|
||||
```sh
|
||||
|
|
|
|||
|
|
@ -1724,6 +1724,12 @@ License expression: MIT
|
|||
Source: https://github.com/mystor/synstructure
|
||||
LICENSE: text 219920e865eee70b
|
||||
|
||||
sys-locale 0.3.2
|
||||
License expression: MIT OR Apache-2.0
|
||||
Source: https://github.com/1Password/sys-locale
|
||||
LICENSE-APACHE: text c71d239df91726fc
|
||||
LICENSE-MIT: text 5cc390ab5e5e6507
|
||||
|
||||
tempfile 3.27.0
|
||||
License expression: MIT OR Apache-2.0
|
||||
Source: https://github.com/Stebalien/tempfile
|
||||
|
|
@ -6881,6 +6887,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
|
||||
=== 5cc390ab5e5e6507 ===
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 1Password
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
=== 5e05b024f653a5ce ===
|
||||
Copyright (c) 2017 Robert Grosse
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ repository.workspace = true
|
|||
description = "Portable multiscreen PDF and image presenter"
|
||||
|
||||
[dependencies]
|
||||
sys-locale = "=0.3.2"
|
||||
winit = "=0.30.13"
|
||||
softbuffer = { version = "=0.4.8", default-features = false, features = ["x11", "x11-dlopen", "wayland", "wayland-dlopen"] }
|
||||
font8x8 = "=0.3.1"
|
||||
|
|
|
|||
|
|
@ -77,3 +77,8 @@ pub mod output;
|
|||
pub mod presenter_ui;
|
||||
/// Shared native application state.
|
||||
pub mod studio;
|
||||
|
||||
/// Presenter interface language.
|
||||
pub mod localization;
|
||||
/// Standalone presenter palettes.
|
||||
pub mod theme;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,131 @@
|
|||
//! Interface catalog; diagnostic messages from workers remain in their original language.
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Language {
|
||||
#[default]
|
||||
System,
|
||||
En,
|
||||
Fr,
|
||||
}
|
||||
impl Language {
|
||||
pub const ALL: [Self; 3] = [Self::System, Self::En, Self::Fr];
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Self::System => "System / Système",
|
||||
Self::En => "English",
|
||||
Self::Fr => "Français",
|
||||
}
|
||||
}
|
||||
pub fn french(self) -> bool {
|
||||
match self {
|
||||
Self::Fr => true,
|
||||
Self::En => false,
|
||||
Self::System => system_french(),
|
||||
}
|
||||
}
|
||||
}
|
||||
fn system_french() -> bool {
|
||||
static FRENCH: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
*FRENCH.get_or_init(|| {
|
||||
sys_locale::get_locale().is_some_and(|s| s.to_ascii_lowercase().starts_with("fr"))
|
||||
})
|
||||
}
|
||||
pub fn apply(ctx: &egui::Context, language: &Language) {
|
||||
ctx.data_mut(|d| d.insert_temp(egui::Id::new("french"), language.french()));
|
||||
}
|
||||
pub fn tr<'a>(ctx: &egui::Context, text: &'a str) -> &'a str {
|
||||
if !ctx.data(|d| d.get_temp::<bool>(egui::Id::new("french")).unwrap_or(false)) {
|
||||
return text;
|
||||
}
|
||||
match text {
|
||||
"Appearance" => "Apparence",
|
||||
"Preferences" => "Préférences",
|
||||
"Storage locations" => "Emplacements de stockage",
|
||||
"Preparing slide…" => "Préparation de la diapositive…",
|
||||
"No slide" => "Aucune diapositive",
|
||||
"Size" => "Taille",
|
||||
"Keep header visible" => "Garder l’en-tête visible",
|
||||
"Keep footer visible" => "Garder le pied de page visible",
|
||||
"Show both" => "Afficher les deux",
|
||||
"Layout…" => "Disposition…",
|
||||
"PREVIOUS" => "PRÉCÉDENTE",
|
||||
"CURRENT" => "ACTUELLE",
|
||||
"NEXT" => "SUIVANTE",
|
||||
"PRESENTER NOTES · AUTO-FIT" => "NOTES · TAILLE AUTOMATIQUE",
|
||||
"No notes for this slide" => "Aucune note pour cette diapositive",
|
||||
"Hide" => "Masquer",
|
||||
"Pin" => "Épingler",
|
||||
"Menu" => "Menu",
|
||||
"Displays" => "Écrans",
|
||||
"All slides" => "Toutes les diapositives",
|
||||
"Layout" => "Disposition",
|
||||
"Show presentation" => "Afficher la présentation",
|
||||
"Blank presentation" => "Masquer la présentation",
|
||||
"Previous" => "Précédente",
|
||||
"Next" => "Suivante",
|
||||
"NO OUTPUT DISPLAYED" => "AUCUNE SORTIE AFFICHÉE",
|
||||
"PRESENTING" => "EN DIFFUSION",
|
||||
"PREPARING OUTPUT" => "PRÉPARATION DE LA SORTIE",
|
||||
"Your presenter view" => "Votre vue présentateur",
|
||||
"Balanced" => "Équilibrée",
|
||||
"Slide focus" => "Diapositive seule",
|
||||
"Notes first" => "Priorité aux notes",
|
||||
"Hidden bars reveal near edges. Right-click to restore." => {
|
||||
"Approchez des bords pour voir les barres. Clic droit pour les rétablir."
|
||||
}
|
||||
"Previous slide" => "Diapositive précédente",
|
||||
"Current slide" => "Diapositive actuelle",
|
||||
"Next slide" => "Diapositive suivante",
|
||||
"Notes" => "Notes",
|
||||
"Elapsed time" => "Temps écoulé",
|
||||
"Time · HH:MM" => "Heure · HH:MM",
|
||||
"Save layout · This project" => "Enregistrer · Ce projet",
|
||||
"Save layout · All projects" => "Enregistrer · Tous les projets",
|
||||
"Use all-projects default" => "Utiliser la disposition globale",
|
||||
"Project layouts override the default." => {
|
||||
"La disposition du projet prime sur la disposition globale."
|
||||
}
|
||||
"Each screen has one role; repeat a role to mirror it." => {
|
||||
"Un rôle par écran. Répétez un rôle pour le dupliquer."
|
||||
}
|
||||
"Unused" => "Inutilisé",
|
||||
"Presenter" => "Présentateur",
|
||||
"Presentation" => "Présentation",
|
||||
"Swap groups" => "Inverser les groupes",
|
||||
"Presenter fullscreen" => "Présentateur en plein écran",
|
||||
"Presentation fullscreen" => "Présentation en plein écran",
|
||||
"Apply and remember" => "Appliquer et mémoriser",
|
||||
"Applying a setup blanks output. Show when destinations are verified." => {
|
||||
"Appliquer masque la sortie. Vérifiez les destinations avant de la réactiver."
|
||||
}
|
||||
"Open a PDF or picture folder to browse slides." => {
|
||||
"Ouvrez un PDF ou un dossier d’images pour parcourir les diapositives."
|
||||
}
|
||||
"Close" => "Fermer",
|
||||
"Preview size" => "Taille des aperçus",
|
||||
"Change on click" => "Diffuser au clic",
|
||||
"Presenter screen" => "Écran du présentateur",
|
||||
"Show selected" => "Diffuser la sélection",
|
||||
"Click changes presentation" => "Le clic change la présentation",
|
||||
"Click only selects — browse safely" => "Le clic sélectionne sans diffuser",
|
||||
" · CURRENT" => " · ACTUELLE",
|
||||
"Open PDF…" => "Ouvrir un PDF…",
|
||||
"Open picture folder…" => "Ouvrir un dossier d’images…",
|
||||
"Reset timer" => "Réinitialiser le chronomètre",
|
||||
"Leave fullscreen / safe blank" => "Quitter le plein écran et masquer la sortie",
|
||||
"RAM budget per process (presenter + output each use this allowance):" => {
|
||||
"Budget RAM par processus (présentateur et sortie disposent chacun de ce budget) :"
|
||||
}
|
||||
"Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px." => {
|
||||
"Restez dans la RAM disponible : la mémoire virtuelle peut ralentir l’affichage. Rendu limité à 4096 px."
|
||||
}
|
||||
"Show presentation automatically when opening a document" => {
|
||||
"Afficher automatiquement la présentation à l’ouverture d’un document"
|
||||
}
|
||||
"Quit" => "Quitter",
|
||||
"Theme" => "Thème",
|
||||
"Language" => "Langue",
|
||||
_ => text,
|
||||
}
|
||||
}
|
||||
|
|
@ -57,6 +57,11 @@ impl NativeWindow {
|
|||
el.create_window(
|
||||
Window::default_attributes()
|
||||
.with_title(title)
|
||||
.with_window_level(if role == Role::Browser {
|
||||
winit::window::WindowLevel::AlwaysOnTop
|
||||
} else {
|
||||
winit::window::WindowLevel::Normal
|
||||
})
|
||||
.with_visible(false)
|
||||
.with_inner_size(PhysicalSize::new(1100, 750)),
|
||||
)?,
|
||||
|
|
@ -118,6 +123,9 @@ impl NativeWindow {
|
|||
));
|
||||
}
|
||||
self.window.set_visible(true);
|
||||
if self.role == Role::Browser {
|
||||
self.window.focus_window();
|
||||
}
|
||||
self.window
|
||||
.set_cursor_visible(self.role != Role::Presentation);
|
||||
}
|
||||
|
|
@ -154,6 +162,10 @@ impl NativeWindow {
|
|||
if u64::from(size.width) * u64::from(size.height) > 40_000_000 {
|
||||
return Err("Display exceeds 40 megapixels".into());
|
||||
}
|
||||
if let Some(s) = studio.as_ref() {
|
||||
s.settings.theme.apply(&self.ctx);
|
||||
crate::localization::apply(&self.ctx, &s.settings.language);
|
||||
}
|
||||
let input = self.input.take_egui_input(&self.window);
|
||||
let role = self.role;
|
||||
let ui_state = &mut self.ui;
|
||||
|
|
@ -505,6 +517,12 @@ impl App {
|
|||
let actions = std::mem::take(&mut s.actions);
|
||||
repaint |= !actions.is_empty();
|
||||
for action in actions {
|
||||
if matches!(action, Action::OpenBrowser) {
|
||||
for window in self.windows.iter().filter(|w| w.role == Role::Browser) {
|
||||
window.window.set_minimized(false);
|
||||
window.window.focus_window();
|
||||
}
|
||||
}
|
||||
s.execute(action);
|
||||
}
|
||||
if let Some(output) = &self.output {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//! Native controls for the approved presenter layout and safe slide browser.
|
||||
use crate::localization::tr;
|
||||
// Native controls for the approved presenter layout and safe slide browser.
|
||||
use crate::{
|
||||
settings::Layout,
|
||||
studio::{Action, Studio},
|
||||
|
|
@ -28,6 +29,7 @@ impl Default for UiState {
|
|||
}
|
||||
impl UiState {
|
||||
pub fn image(&mut self, ui: &mut Ui, s: &Studio, page: usize, rect: Rect) {
|
||||
let locale = ui.ctx().clone();
|
||||
ui.painter()
|
||||
.rect_filled(rect, 6., Color32::from_rgb(18, 28, 31));
|
||||
if let Some(frame) = s.frame(page) {
|
||||
|
|
@ -59,9 +61,9 @@ impl UiState {
|
|||
rect.center(),
|
||||
egui::Align2::CENTER_CENTER,
|
||||
if page < s.count() {
|
||||
"Preparing slide…"
|
||||
tr(&locale, "Preparing slide…")
|
||||
} else {
|
||||
"No slide"
|
||||
tr(&locale, "No slide")
|
||||
},
|
||||
FontId::proportional(18.),
|
||||
Color32::GRAY,
|
||||
|
|
@ -103,19 +105,21 @@ fn button(ui: &mut Ui, label: &str, action: Action, actions: &mut Vec<Action>) {
|
|||
}
|
||||
}
|
||||
fn widget(ui: &mut Ui, label: &str, w: &mut crate::settings::Widget, min: f32, max: f32) {
|
||||
let locale = ui.ctx().clone();
|
||||
ui.checkbox(&mut w.show, label);
|
||||
ui.add_enabled(
|
||||
w.show,
|
||||
egui::Slider::new(&mut w.size, min..=max).text("Size"),
|
||||
egui::Slider::new(&mut w.size, min..=max).text(tr(&locale, "Size")),
|
||||
);
|
||||
ui.separator();
|
||||
}
|
||||
pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
||||
let locale = ui.ctx().clone();
|
||||
native.trim(s);
|
||||
let ctx = ui.ctx().clone();
|
||||
let screen = ui.max_rect();
|
||||
ui.painter()
|
||||
.rect_filled(screen, 0., Color32::from_rgb(16, 21, 23));
|
||||
.rect_filled(screen, 0., ui.visuals().panel_fill);
|
||||
let now = Instant::now();
|
||||
let pointer = ctx.input(|i| i.pointer.hover_pos());
|
||||
if pointer.is_some_and(|p| p.y < screen.top() + 72.) {
|
||||
|
|
@ -128,14 +132,14 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
let footer = s.layout.footer || native.footer_until > now;
|
||||
let background = ui.interact(screen, ui.id().with("context"), Sense::click());
|
||||
background.context_menu(|ui| {
|
||||
ui.checkbox(&mut s.layout.header, "Keep header visible");
|
||||
ui.checkbox(&mut s.layout.footer, "Keep footer visible");
|
||||
if ui.button("Show both").clicked() {
|
||||
ui.checkbox(&mut s.layout.header, tr(&locale, "Keep header visible"));
|
||||
ui.checkbox(&mut s.layout.footer, tr(&locale, "Keep footer visible"));
|
||||
if ui.button(tr(&locale, "Show both")).clicked() {
|
||||
s.layout.header = true;
|
||||
s.layout.footer = true;
|
||||
ui.close();
|
||||
}
|
||||
if ui.button("Layout…").clicked() {
|
||||
if ui.button(tr(&locale, "Layout…")).clicked() {
|
||||
s.layout_open = true;
|
||||
ui.close();
|
||||
}
|
||||
|
|
@ -173,13 +177,17 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if preview_visible {
|
||||
let items = [
|
||||
(
|
||||
"PREVIOUS",
|
||||
tr(&locale, "PREVIOUS"),
|
||||
s.requested.checked_sub(1),
|
||||
s.layout.previous.clone(),
|
||||
),
|
||||
("CURRENT", Some(s.requested), s.layout.current.clone()),
|
||||
(
|
||||
"NEXT",
|
||||
tr(&locale, "CURRENT"),
|
||||
Some(s.requested),
|
||||
s.layout.current.clone(),
|
||||
),
|
||||
(
|
||||
tr(&locale, "NEXT"),
|
||||
(s.requested + 1 < s.count()).then_some(s.requested + 1),
|
||||
s.layout.next.clone(),
|
||||
),
|
||||
|
|
@ -208,7 +216,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
page.map_or(String::new(), |p| format!("{} / {}", p + 1, s.count()))
|
||||
),
|
||||
FontId::proportional(13.),
|
||||
TEAL,
|
||||
ui.visuals().hyperlink_color,
|
||||
);
|
||||
if let Some(page) = page {
|
||||
native.image(
|
||||
|
|
@ -223,21 +231,20 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
}
|
||||
if s.layout.notes.show {
|
||||
let rect = Rect::from_min_max(Pos2::new(body.left(), body.bottom() - notes_h), body.max);
|
||||
ui.painter()
|
||||
.rect_filled(rect, 8., Color32::from_rgb(25, 33, 36));
|
||||
ui.painter().rect_filled(rect, 8., ui.visuals().window_fill);
|
||||
ui.painter().text(
|
||||
rect.min + Vec2::splat(14.),
|
||||
egui::Align2::LEFT_TOP,
|
||||
"PRESENTER NOTES · AUTO-FIT",
|
||||
tr(&locale, "PRESENTER NOTES · AUTO-FIT"),
|
||||
FontId::proportional(12.),
|
||||
TEAL,
|
||||
ui.visuals().hyperlink_color,
|
||||
);
|
||||
let text = s
|
||||
.deck
|
||||
.as_ref()
|
||||
.and_then(|d| d.notes.get(s.requested))
|
||||
.filter(|n| !n.is_empty())
|
||||
.map_or("No notes for this slide", String::as_str);
|
||||
.map_or(tr(&locale, "No notes for this slide"), String::as_str);
|
||||
let area = Rect::from_min_max(rect.min + Vec2::new(16., 40.), rect.max - Vec2::splat(16.));
|
||||
if area.is_positive() {
|
||||
if native
|
||||
|
|
@ -251,7 +258,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
f.layout(
|
||||
text.into(),
|
||||
FontId::proportional(lo),
|
||||
Color32::WHITE,
|
||||
ui.visuals().text_color(),
|
||||
area.width(),
|
||||
)
|
||||
});
|
||||
|
|
@ -261,7 +268,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
f.layout(
|
||||
text.into(),
|
||||
FontId::proportional(mid),
|
||||
Color32::WHITE,
|
||||
ui.visuals().text_color(),
|
||||
area.width(),
|
||||
)
|
||||
});
|
||||
|
|
@ -277,49 +284,87 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if let Some((_, _, galley)) = &native.note_cache {
|
||||
ui.painter()
|
||||
.with_clip_rect(area)
|
||||
.galley(area.min, galley.clone(), Color32::WHITE);
|
||||
.galley_with_override_text_color(
|
||||
area.min,
|
||||
galley.clone(),
|
||||
ui.visuals().text_color(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if header {
|
||||
let rect = Rect::from_min_size(screen.min, Vec2::new(screen.width(), 64.));
|
||||
ui.painter()
|
||||
.rect_filled(rect, 0., Color32::from_rgb(25, 37, 40));
|
||||
ui.painter().rect_filled(rect, 0., ui.visuals().window_fill);
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(10.)), |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
if ui
|
||||
.button(if s.layout.header { "Hide" } else { "Pin" })
|
||||
.button(if s.layout.header {
|
||||
tr(&locale, "Hide")
|
||||
} else {
|
||||
tr(&locale, "Pin")
|
||||
})
|
||||
.clicked()
|
||||
{
|
||||
s.layout.header = !s.layout.header;
|
||||
native.header_until = now;
|
||||
}
|
||||
if ui.button("Menu").clicked() {
|
||||
s.menu_open = !s.menu_open;
|
||||
}
|
||||
let trigger = ui.button(tr(&locale, "Menu"));
|
||||
let mut menu_open = if trigger.clicked() {
|
||||
!s.menu_open
|
||||
} else {
|
||||
s.menu_open
|
||||
};
|
||||
egui::Popup::menu(&trigger)
|
||||
.open_bool(&mut menu_open)
|
||||
.show(|ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.max_height(520.)
|
||||
.show(ui, |ui| menu(ui, s));
|
||||
});
|
||||
s.menu_open = menu_open;
|
||||
ui.label(
|
||||
s.deck
|
||||
.as_ref()
|
||||
.map_or("PDF Presenter", |d| d.title.as_str()),
|
||||
);
|
||||
if ui.button("Displays").clicked() {
|
||||
if ui.button(tr(&locale, "Displays")).clicked() {
|
||||
s.draft_routes = s.routes.clone();
|
||||
s.displays_open = true;
|
||||
}
|
||||
button(ui, "All slides", Action::OpenBrowser, &mut s.actions);
|
||||
if ui.button("Layout").clicked() {
|
||||
s.layout_open = !s.layout_open;
|
||||
}
|
||||
button(
|
||||
ui,
|
||||
if s.blanked {
|
||||
"Show presentation"
|
||||
} else {
|
||||
"Blank presentation"
|
||||
},
|
||||
Action::Blank,
|
||||
tr(&locale, "All slides"),
|
||||
Action::OpenBrowser,
|
||||
&mut s.actions,
|
||||
);
|
||||
if ui.button(tr(&locale, "Layout")).clicked() {
|
||||
s.layout_open = !s.layout_open;
|
||||
}
|
||||
let inactive = s.blanked || s.routes.presentation.is_empty() || s.count() == 0;
|
||||
let color = if inactive {
|
||||
ui.visuals().error_fg_color
|
||||
} else {
|
||||
ui.visuals().hyperlink_color
|
||||
};
|
||||
let (indicator, _) = ui.allocate_exact_size(Vec2::splat(12.), Sense::hover());
|
||||
ui.painter().circle_filled(indicator.center(), 5., color);
|
||||
if ui
|
||||
.button(
|
||||
egui::RichText::new(if s.blanked {
|
||||
tr(&locale, "Show presentation")
|
||||
} else {
|
||||
tr(&locale, "Blank presentation")
|
||||
})
|
||||
.color(if s.blanked {
|
||||
ui.visuals().error_fg_color
|
||||
} else {
|
||||
ui.visuals().hyperlink_color
|
||||
}),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
s.actions.push(Action::Blank);
|
||||
}
|
||||
if s.layout.elapsed.show {
|
||||
let secs = s.started.elapsed().as_secs();
|
||||
ui.label(
|
||||
|
|
@ -341,36 +386,47 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
Pos2::new(screen.left(), screen.bottom() - 90.),
|
||||
Vec2::new(screen.width(), 90.),
|
||||
);
|
||||
ui.painter()
|
||||
.rect_filled(rect, 0., Color32::from_rgb(25, 37, 40));
|
||||
ui.painter().rect_filled(rect, 0., ui.visuals().window_fill);
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(8.)), |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
button(
|
||||
ui,
|
||||
"Previous",
|
||||
tr(&locale, "Previous"),
|
||||
Action::Go(s.requested.saturating_sub(1)),
|
||||
&mut s.actions,
|
||||
);
|
||||
button(ui, "Next", Action::Go(s.requested + 1), &mut s.actions);
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Next"),
|
||||
Action::Go(s.requested + 1),
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.label(format!(
|
||||
"{} / {}",
|
||||
if s.count() == 0 { 0 } else { s.requested + 1 },
|
||||
s.count()
|
||||
));
|
||||
let unavailable = s.blanked || s.routes.presentation.is_empty() || s.count() == 0;
|
||||
ui.colored_label(
|
||||
TEAL,
|
||||
if s.routes.presentation.is_empty() {
|
||||
"REHEARSAL"
|
||||
} else if s.blanked {
|
||||
"BLANKED"
|
||||
} else if s.displayed == Some(s.requested) {
|
||||
"PRESENTING"
|
||||
if unavailable {
|
||||
ui.visuals().error_fg_color
|
||||
} else {
|
||||
"PREPARING"
|
||||
ui.visuals().hyperlink_color
|
||||
},
|
||||
if unavailable {
|
||||
tr(&locale, "NO OUTPUT DISPLAYED")
|
||||
} else if s.displayed == Some(s.requested) {
|
||||
tr(&locale, "PRESENTING")
|
||||
} else {
|
||||
tr(&locale, "PREPARING OUTPUT")
|
||||
},
|
||||
);
|
||||
if ui
|
||||
.button(if s.layout.footer { "Hide" } else { "Pin" })
|
||||
.button(if s.layout.footer {
|
||||
tr(&locale, "Hide")
|
||||
} else {
|
||||
tr(&locale, "Pin")
|
||||
})
|
||||
.clicked()
|
||||
{
|
||||
s.layout.footer = !s.layout.footer;
|
||||
|
|
@ -405,65 +461,54 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
});
|
||||
});
|
||||
}
|
||||
if !footer && (s.blanked || s.routes.presentation.is_empty() || s.count() == 0) {
|
||||
egui::Area::new("output-warning".into())
|
||||
.anchor(egui::Align2::RIGHT_TOP, Vec2::new(-12., 76.))
|
||||
.interactable(false)
|
||||
.show(&ctx, |ui| {
|
||||
egui::Frame::popup(ui.style()).show(ui, |ui| {
|
||||
ui.colored_label(
|
||||
ui.visuals().error_fg_color,
|
||||
tr(&locale, "NO OUTPUT DISPLAYED"),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
if !s.jump.is_empty() {
|
||||
egui::Area::new("jump".into())
|
||||
.anchor(egui::Align2::CENTER_BOTTOM, Vec2::new(0., -80.))
|
||||
.show(&ctx, |ui| {
|
||||
egui::Frame::popup(ui.style()).show(ui, |ui| {
|
||||
ui.label(format!(
|
||||
"Go to slide {} · Enter to show · Esc to cancel",
|
||||
s.jump
|
||||
"{} {} · {}",
|
||||
if s.settings.language.french() {
|
||||
"Diapositive"
|
||||
} else {
|
||||
"Go to slide"
|
||||
},
|
||||
s.jump,
|
||||
if s.settings.language.french() {
|
||||
"Entrée : diffuser · Échap : annuler"
|
||||
} else {
|
||||
"Enter to show · Esc to cancel"
|
||||
}
|
||||
));
|
||||
});
|
||||
});
|
||||
}
|
||||
if s.menu_open {
|
||||
egui::Window::new("Menu")
|
||||
.collapsible(false)
|
||||
.resizable(false)
|
||||
.show(&ctx, |ui| {
|
||||
button(ui, "Open PDF…", Action::Pick(false), &mut s.actions);
|
||||
button(
|
||||
ui,
|
||||
"Open picture folder…",
|
||||
Action::Pick(true),
|
||||
&mut s.actions,
|
||||
);
|
||||
button(ui, "All slides", Action::OpenBrowser, &mut s.actions);
|
||||
if ui.button("Reset timer").clicked() {
|
||||
s.started = Instant::now();
|
||||
}
|
||||
button(
|
||||
ui,
|
||||
"Leave fullscreen / safe blank",
|
||||
Action::Windowed,
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.separator();
|
||||
ui.label(s.preparation_status());
|
||||
ui.label(format!("Processed slides: {}", s.cache_path.display()));
|
||||
ui.label("RAM budget per process (presenter + output each use this allowance):");
|
||||
if ui.add(egui::Slider::new(&mut s.settings.buffer_mib, 256..=16384).text("MiB")).changed() { s.remember_buffer_budget(); }
|
||||
ui.small("Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px.");
|
||||
ui.label(format!("Configuration: {}", s.settings_path.display()));
|
||||
button(ui, "Quit", Action::Exit, &mut s.actions);
|
||||
if ui.button("Close menu").clicked() {
|
||||
s.menu_open = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if s.layout_open {
|
||||
let mut open = true;
|
||||
egui::Window::new("Your presenter view")
|
||||
egui::Window::new(tr(&locale, "Your presenter view"))
|
||||
.id(egui::Id::new("layout-window"))
|
||||
.open(&mut open)
|
||||
.default_width(330.)
|
||||
.vscroll(true)
|
||||
.show(&ctx, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Balanced").clicked() {
|
||||
if ui.button(tr(&locale, "Balanced")).clicked() {
|
||||
s.layout = Layout::default();
|
||||
}
|
||||
if ui.button("Slide focus").clicked() {
|
||||
if ui.button(tr(&locale, "Slide focus")).clicked() {
|
||||
s.layout = Layout::default();
|
||||
s.layout.previous.show = false;
|
||||
s.layout.next.show = false;
|
||||
|
|
@ -471,117 +516,209 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
s.layout.elapsed.show = false;
|
||||
s.layout.clock.show = false;
|
||||
}
|
||||
if ui.button("Notes first").clicked() {
|
||||
if ui.button(tr(&locale, "Notes first")).clicked() {
|
||||
s.layout.notes.show = true;
|
||||
s.layout.notes.size = 60.;
|
||||
s.layout.previous.show = false;
|
||||
}
|
||||
});
|
||||
ui.checkbox(&mut s.layout.header, "Keep header visible");
|
||||
ui.checkbox(&mut s.layout.footer, "Keep footer visible");
|
||||
ui.small("Hidden bars reveal near edges. Right-click to restore.");
|
||||
widget(ui, "Previous slide", &mut s.layout.previous, 30., 160.);
|
||||
widget(ui, "Current slide", &mut s.layout.current, 60., 200.);
|
||||
widget(ui, "Next slide", &mut s.layout.next, 30., 160.);
|
||||
widget(ui, "Notes", &mut s.layout.notes, 12., 65.);
|
||||
widget(ui, "Elapsed time", &mut s.layout.elapsed, 16., 72.);
|
||||
widget(ui, "Time · HH:MM", &mut s.layout.clock, 16., 72.);
|
||||
ui.checkbox(&mut s.layout.header, tr(&locale, "Keep header visible"));
|
||||
ui.checkbox(&mut s.layout.footer, tr(&locale, "Keep footer visible"));
|
||||
ui.small(tr(
|
||||
&locale,
|
||||
"Hidden bars reveal near edges. Right-click to restore.",
|
||||
));
|
||||
widget(
|
||||
ui,
|
||||
tr(&locale, "Previous slide"),
|
||||
&mut s.layout.previous,
|
||||
30.,
|
||||
160.,
|
||||
);
|
||||
widget(
|
||||
ui,
|
||||
tr(&locale, "Current slide"),
|
||||
&mut s.layout.current,
|
||||
60.,
|
||||
200.,
|
||||
);
|
||||
widget(ui, tr(&locale, "Next slide"), &mut s.layout.next, 30., 160.);
|
||||
widget(ui, tr(&locale, "Notes"), &mut s.layout.notes, 12., 65.);
|
||||
widget(
|
||||
ui,
|
||||
tr(&locale, "Elapsed time"),
|
||||
&mut s.layout.elapsed,
|
||||
16.,
|
||||
72.,
|
||||
);
|
||||
widget(
|
||||
ui,
|
||||
tr(&locale, "Time · HH:MM"),
|
||||
&mut s.layout.clock,
|
||||
16.,
|
||||
72.,
|
||||
);
|
||||
button(
|
||||
ui,
|
||||
"Save layout · This project",
|
||||
tr(&locale, "Save layout · This project"),
|
||||
Action::SaveProject,
|
||||
&mut s.actions,
|
||||
);
|
||||
button(
|
||||
ui,
|
||||
"Save layout · All projects",
|
||||
tr(&locale, "Save layout · All projects"),
|
||||
Action::SaveGlobal,
|
||||
&mut s.actions,
|
||||
);
|
||||
button(
|
||||
ui,
|
||||
"Use all-projects default",
|
||||
tr(&locale, "Use all-projects default"),
|
||||
Action::UseGlobal,
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.small("Project layouts override the default.");
|
||||
ui.small(tr(&locale, "Project layouts override the default."));
|
||||
});
|
||||
s.layout_open = open;
|
||||
}
|
||||
if s.displays_open {
|
||||
let mut open = true;
|
||||
egui::Window::new("Displays")
|
||||
egui::Window::new(tr(&locale, "Displays"))
|
||||
.id(egui::Id::new("displays-window"))
|
||||
.open(&mut open)
|
||||
.default_width(520.)
|
||||
.default_width(600.)
|
||||
.vscroll(true)
|
||||
.show(&ctx, |ui| {
|
||||
ui.label("Each screen has one role; repeat a role to mirror it.");
|
||||
for m in &s.monitors {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(format!("{} · {}×{}", m.name, m.size.0, m.size.1));
|
||||
let mut role = if s.draft_routes.presenter.contains(&m.id) {
|
||||
1
|
||||
} else if s.draft_routes.presentation.contains(&m.id) {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
egui::ComboBox::from_id_salt(&m.id)
|
||||
.selected_text(["Unused", "Presenter", "Presentation"][role])
|
||||
.show_ui(ui, |ui| {
|
||||
for (i, name) in
|
||||
["Unused", "Presenter", "Presentation"].iter().enumerate()
|
||||
{
|
||||
ui.selectable_value(&mut role, i, *name);
|
||||
}
|
||||
ui.label(tr(
|
||||
&locale,
|
||||
"Each screen has one role; repeat a role to mirror it.",
|
||||
));
|
||||
for (index, m) in s.monitors.iter().enumerate() {
|
||||
egui::Frame::group(ui.style())
|
||||
.inner_margin(12.)
|
||||
.show(ui, |ui| {
|
||||
ui.set_min_width(540.);
|
||||
ui.horizontal(|ui| {
|
||||
let (rect, _) =
|
||||
ui.allocate_exact_size(Vec2::new(64., 40.), Sense::hover());
|
||||
ui.painter()
|
||||
.rect_filled(rect, 4., ui.visuals().extreme_bg_color);
|
||||
ui.painter().rect_stroke(
|
||||
rect,
|
||||
4.,
|
||||
egui::Stroke::new(2_f32, ui.visuals().hyperlink_color),
|
||||
egui::StrokeKind::Inside,
|
||||
);
|
||||
ui.painter().text(
|
||||
rect.center(),
|
||||
egui::Align2::CENTER_CENTER,
|
||||
(index + 1).to_string(),
|
||||
FontId::proportional(22.),
|
||||
ui.visuals().text_color(),
|
||||
);
|
||||
ui.vertical(|ui| {
|
||||
ui.strong(&m.name);
|
||||
ui.small(format!("{} × {} px", m.size.0, m.size.1));
|
||||
});
|
||||
});
|
||||
s.draft_routes.presenter.retain(|id| id != &m.id);
|
||||
s.draft_routes.presentation.retain(|id| id != &m.id);
|
||||
match role {
|
||||
1 => s.draft_routes.presenter.push(m.id.clone()),
|
||||
2 => s.draft_routes.presentation.push(m.id.clone()),
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
ui.add_space(8.);
|
||||
let mut role = if s.draft_routes.presenter.contains(&m.id) {
|
||||
1
|
||||
} else if s.draft_routes.presentation.contains(&m.id) {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
ui.push_id(&m.id, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
for (i, name) in [
|
||||
tr(&locale, "Unused"),
|
||||
tr(&locale, "Presenter"),
|
||||
tr(&locale, "Presentation"),
|
||||
]
|
||||
.iter()
|
||||
.enumerate()
|
||||
{
|
||||
ui.selectable_value(&mut role, i, *name);
|
||||
}
|
||||
});
|
||||
});
|
||||
s.draft_routes.presenter.retain(|id| id != &m.id);
|
||||
s.draft_routes.presentation.retain(|id| id != &m.id);
|
||||
match role {
|
||||
1 => s.draft_routes.presenter.push(m.id.clone()),
|
||||
2 => s.draft_routes.presentation.push(m.id.clone()),
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
ui.add_space(8.);
|
||||
}
|
||||
if ui.button("Swap groups").clicked() && !s.draft_routes.presentation.is_empty() {
|
||||
if ui.button(tr(&locale, "Swap groups")).clicked()
|
||||
&& !s.draft_routes.presentation.is_empty()
|
||||
{
|
||||
std::mem::swap(
|
||||
&mut s.draft_routes.presenter,
|
||||
&mut s.draft_routes.presentation,
|
||||
);
|
||||
}
|
||||
ui.checkbox(&mut s.settings.presenter_fullscreen, "Presenter fullscreen");
|
||||
ui.checkbox(
|
||||
&mut s.settings.presenter_fullscreen,
|
||||
tr(&locale, "Presenter fullscreen"),
|
||||
);
|
||||
ui.checkbox(
|
||||
&mut s.settings.presentation_fullscreen,
|
||||
"Presentation fullscreen",
|
||||
tr(&locale, "Presentation fullscreen"),
|
||||
);
|
||||
button(
|
||||
ui,
|
||||
"Apply and remember",
|
||||
tr(&locale, "Apply and remember"),
|
||||
Action::ApplyRoutes,
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.small("Applying a setup blanks output. Show when destinations are verified.");
|
||||
ui.small(tr(
|
||||
&locale,
|
||||
"Applying a setup blanks output. Show when destinations are verified.",
|
||||
));
|
||||
});
|
||||
s.displays_open &= open;
|
||||
}
|
||||
}
|
||||
pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
||||
let locale = ui.ctx().clone();
|
||||
ui.painter()
|
||||
.rect_filled(ui.max_rect(), 0., ui.visuals().panel_fill);
|
||||
native.trim(s);
|
||||
if s.count() == 0 {
|
||||
ui.label(tr(
|
||||
&locale,
|
||||
"Open a PDF or picture folder to browse slides.",
|
||||
));
|
||||
}
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.heading("All slides");
|
||||
ui.add(
|
||||
egui::Slider::new(&mut s.settings.thumbnail_size, 100. ..=400.).text("Preview size"),
|
||||
ui.heading(tr(&locale, "All slides"));
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Close"),
|
||||
Action::CloseBrowser,
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.checkbox(&mut s.change_on_click, "Change on click");
|
||||
ui.add(
|
||||
egui::Slider::new(&mut s.settings.thumbnail_size, 100. ..=400.)
|
||||
.text(tr(&locale, "Preview size")),
|
||||
);
|
||||
ui.checkbox(&mut s.change_on_click, tr(&locale, "Change on click"));
|
||||
egui::ComboBox::from_id_salt("browser-monitor")
|
||||
.selected_text(
|
||||
s.settings
|
||||
.browser_monitor
|
||||
.as_deref()
|
||||
.unwrap_or("Presenter screen"),
|
||||
.unwrap_or(tr(&locale, "Presenter screen")),
|
||||
)
|
||||
.show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut s.settings.browser_monitor, None, "Presenter screen");
|
||||
ui.selectable_value(
|
||||
&mut s.settings.browser_monitor,
|
||||
None,
|
||||
tr(&locale, "Presenter screen"),
|
||||
);
|
||||
for monitor in &s.monitors {
|
||||
ui.selectable_value(
|
||||
&mut s.settings.browser_monitor,
|
||||
|
|
@ -592,25 +729,45 @@ pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
});
|
||||
button(
|
||||
ui,
|
||||
"Show selected",
|
||||
tr(&locale, "Show selected"),
|
||||
Action::Go(s.browser_selected),
|
||||
&mut s.actions,
|
||||
);
|
||||
});
|
||||
ui.label(format!(
|
||||
"Selected {} · Current {} · {}",
|
||||
"{} {} · {} {} · {}",
|
||||
if s.settings.language.french() {
|
||||
"Sélection"
|
||||
} else {
|
||||
"Selected"
|
||||
},
|
||||
s.browser_selected + 1,
|
||||
if s.settings.language.french() {
|
||||
"Actuelle"
|
||||
} else {
|
||||
"Current"
|
||||
},
|
||||
s.requested + 1,
|
||||
if s.change_on_click {
|
||||
"Click changes presentation"
|
||||
tr(&locale, "Click changes presentation")
|
||||
} else {
|
||||
"Click only selects — browse safely"
|
||||
tr(&locale, "Click only selects — browse safely")
|
||||
}
|
||||
));
|
||||
if !s.jump.is_empty() {
|
||||
ui.label(format!(
|
||||
"Go to slide {} — Enter to show, Escape to cancel",
|
||||
s.jump
|
||||
"{} {} — {}",
|
||||
if s.settings.language.french() {
|
||||
"Diapositive"
|
||||
} else {
|
||||
"Go to slide"
|
||||
},
|
||||
s.jump,
|
||||
if s.settings.language.french() {
|
||||
"Entrée : diffuser, Échap : annuler"
|
||||
} else {
|
||||
"Enter to show, Escape to cancel"
|
||||
}
|
||||
));
|
||||
}
|
||||
let size = s.settings.thumbnail_size;
|
||||
|
|
@ -637,7 +794,7 @@ pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
egui::Stroke::new(
|
||||
2_f32,
|
||||
if s.requested == page {
|
||||
TEAL
|
||||
ui.visuals().hyperlink_color
|
||||
} else {
|
||||
Color32::GOLD
|
||||
},
|
||||
|
|
@ -655,7 +812,7 @@ pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
"{}{}",
|
||||
page + 1,
|
||||
if s.requested == page {
|
||||
" · CURRENT"
|
||||
tr(&locale, " · CURRENT")
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
|
@ -666,3 +823,99 @@ pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn menu(ui: &mut Ui, s: &mut Studio) {
|
||||
let locale = ui.ctx().clone();
|
||||
ui.set_min_width(260.);
|
||||
let actions_before = s.actions.len();
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Open PDF…"),
|
||||
Action::Pick(false),
|
||||
&mut s.actions,
|
||||
);
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Open picture folder…"),
|
||||
Action::Pick(true),
|
||||
&mut s.actions,
|
||||
);
|
||||
ui.separator();
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "All slides"),
|
||||
Action::OpenBrowser,
|
||||
&mut s.actions,
|
||||
);
|
||||
if ui.button(tr(&locale, "Displays")).clicked() {
|
||||
s.draft_routes = s.routes.clone();
|
||||
s.displays_open = true;
|
||||
ui.close();
|
||||
}
|
||||
if ui.button(tr(&locale, "Layout")).clicked() {
|
||||
s.layout_open = true;
|
||||
ui.close();
|
||||
}
|
||||
ui.menu_button(tr(&locale, "Appearance"), |ui| {
|
||||
ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
ui.set_min_width(250.);
|
||||
let mut changed = false;
|
||||
ui.label(tr(&locale, "Theme"));
|
||||
egui::ComboBox::from_id_salt("theme")
|
||||
.selected_text(s.settings.theme.name())
|
||||
.show_ui(ui, |ui| {
|
||||
for theme in crate::theme::Theme::ALL {
|
||||
let name = theme.name();
|
||||
changed |= ui
|
||||
.selectable_value(&mut s.settings.theme, theme.clone(), name)
|
||||
.changed();
|
||||
}
|
||||
});
|
||||
ui.label(tr(&locale, "Language"));
|
||||
egui::ComboBox::from_id_salt("language")
|
||||
.selected_text(s.settings.language.name())
|
||||
.show_ui(ui, |ui| {
|
||||
for language in crate::localization::Language::ALL {
|
||||
changed |= ui
|
||||
.selectable_value(&mut s.settings.language, language, language.name())
|
||||
.changed();
|
||||
}
|
||||
});
|
||||
if changed {
|
||||
s.save_preferences();
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
});
|
||||
});
|
||||
ui.menu_button(tr(&locale,"Preferences"), |ui| {
|
||||
ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
ui.set_width(370.);
|
||||
if ui.checkbox(&mut s.settings.auto_show,tr(&locale,"Show presentation automatically when opening a document")).changed() {s.save_preferences();}
|
||||
ui.separator();
|
||||
ui.label(tr(&locale,"RAM budget per process (presenter + output each use this allowance):"));
|
||||
if ui.add(egui::Slider::new(&mut s.settings.buffer_mib,256..=16384).text("MiB")).changed() {s.remember_buffer_budget();}
|
||||
ui.small(tr(&locale,"Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px."));
|
||||
ui.separator();
|
||||
ui.label(s.preparation_status());
|
||||
ui.collapsing(tr(&locale,"Storage locations"), |ui| {
|
||||
ui.label(format!("{}: {}",if s.settings.language.french(){"Diapositives préparées"}else{"Processed slides"},s.cache_path.display()));
|
||||
ui.label(format!("Configuration: {}",s.settings_path.display()));
|
||||
});
|
||||
});
|
||||
});
|
||||
ui.separator();
|
||||
if ui.button(tr(&locale, "Reset timer")).clicked() {
|
||||
s.started = Instant::now();
|
||||
ui.close();
|
||||
}
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Leave fullscreen / safe blank"),
|
||||
Action::Windowed,
|
||||
&mut s.actions,
|
||||
);
|
||||
button(ui, tr(&locale, "Quit"), Action::Exit, &mut s.actions);
|
||||
if s.actions.len() != actions_before {
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,9 @@ pub struct Settings {
|
|||
pub browser_monitor: Option<String>,
|
||||
pub thumbnail_size: f32,
|
||||
pub buffer_mib: u32,
|
||||
pub auto_show: bool,
|
||||
pub theme: crate::theme::Theme,
|
||||
pub language: crate::localization::Language,
|
||||
}
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
|
|
@ -151,6 +154,9 @@ impl Default for Settings {
|
|||
browser_monitor: None,
|
||||
thumbnail_size: 220.,
|
||||
buffer_mib: 1024,
|
||||
auto_show: true,
|
||||
theme: Default::default(),
|
||||
language: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ impl Studio {
|
|||
deck: None,
|
||||
requested: 0,
|
||||
displayed: None,
|
||||
blanked: true,
|
||||
blanked: false,
|
||||
status: "Ready — open a PDF or picture folder, or drop it here.".into(),
|
||||
awake_status: "Sleep protection starting…".into(),
|
||||
generation: 0,
|
||||
|
|
@ -228,9 +228,14 @@ impl Studio {
|
|||
self.privacy_hold = recovering && self.routes.presenter.is_empty();
|
||||
self.draft_routes = self.routes.clone();
|
||||
self.dirty_routes = true;
|
||||
self.blanked = true;
|
||||
self.blanked = recovering || !self.settings.auto_show;
|
||||
self.new_output = true;
|
||||
self.status="Screen setup refreshed. Presentation is blanked; review destinations and Show when ready.".into();
|
||||
self.status = if recovering {
|
||||
"Screen setup changed. Output blanked; review destinations before showing."
|
||||
} else {
|
||||
"Screen setup ready."
|
||||
}
|
||||
.into();
|
||||
}
|
||||
}
|
||||
pub fn execute(&mut self, action: Action) {
|
||||
|
|
@ -327,6 +332,7 @@ impl Studio {
|
|||
self.status = format!("Settings: {error}");
|
||||
} else if let Some(settings) = packet.reply.settings {
|
||||
if !self.smoke {
|
||||
self.blanked = !settings.auto_show;
|
||||
self.settings = settings;
|
||||
self.layout = self.settings.for_project(&self.project());
|
||||
self.routes = Routes::default();
|
||||
|
|
@ -442,7 +448,7 @@ impl Studio {
|
|||
)
|
||||
});
|
||||
self.deck = Some(info);
|
||||
self.blanked = true;
|
||||
self.blanked = !self.settings.auto_show;
|
||||
self.new_output = true;
|
||||
}
|
||||
if let Some(info) = packet.reply.frame {
|
||||
|
|
@ -639,6 +645,9 @@ impl Studio {
|
|||
pub fn buffer_generation(&self) -> u64 {
|
||||
(self.generation << 32) | u64::from(self.target_edge)
|
||||
}
|
||||
pub fn save_preferences(&mut self) {
|
||||
self.pending_save = true;
|
||||
}
|
||||
pub fn remember_buffer_budget(&mut self) {
|
||||
self.pending_save = true;
|
||||
self.ram_blocked = false;
|
||||
|
|
@ -653,7 +662,62 @@ impl Studio {
|
|||
&& self.prepared.len() == self.count()
|
||||
&& (self.routes.presentation.is_empty() || self.output_buffered == self.count())
|
||||
}
|
||||
fn preparation_status_fr(&self) -> String {
|
||||
if self.loading {
|
||||
return "Ouverture et vérification du cache… Estimation en cours".into();
|
||||
}
|
||||
if self.deck.is_none() {
|
||||
return self.status.clone();
|
||||
}
|
||||
let n = self.prepared.len();
|
||||
let total = self.count();
|
||||
let ram = self.buffer_bytes() / (1024 * 1024);
|
||||
if self.notes_loading {
|
||||
return format!("Lecture des notes · {n}/{total} en mémoire · diffusion disponible");
|
||||
}
|
||||
if self.fully_buffered() {
|
||||
return format!(
|
||||
"PRÊT — {total} diapositives en RAM · {ram} Mio · {} px",
|
||||
self.target_edge
|
||||
);
|
||||
}
|
||||
if self.ram_blocked {
|
||||
return format!(
|
||||
"Budget RAM atteint — {n}/{total} en mémoire. Augmentez le budget dans Menu pour terminer."
|
||||
);
|
||||
}
|
||||
if !self.failed.is_empty() {
|
||||
return format!(
|
||||
"Préparation incomplète — {n}/{total} en mémoire. {}",
|
||||
self.status
|
||||
);
|
||||
}
|
||||
let count = if n == total { self.output_buffered } else { n };
|
||||
let eta = if count > 0 && count < total {
|
||||
format!(
|
||||
"~{} s restantes",
|
||||
(self.preparation_started.elapsed().as_secs_f64() / count as f64
|
||||
* (total - count) as f64)
|
||||
.ceil() as u64
|
||||
)
|
||||
} else {
|
||||
"Estimation en cours…".into()
|
||||
};
|
||||
if n == total {
|
||||
format!(
|
||||
"Chargement de la sortie — {count}/{total} · {ram} Mio dans le présentateur · {eta}"
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"Préparation {} px — {n}/{total} · {ram} Mio · {eta} · {} en cache",
|
||||
self.target_edge, self.cached_slides
|
||||
)
|
||||
}
|
||||
}
|
||||
pub fn preparation_status(&self) -> String {
|
||||
if self.settings.language.french() {
|
||||
return self.preparation_status_fr();
|
||||
}
|
||||
if self.loading {
|
||||
return "Opening source and verifying cached slide identity… ETA estimating".into();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,352 @@
|
|||
//! Built-in palettes adapted from Canvas Pilot (MIT); no sibling runtime dependency.
|
||||
use egui::Color32;
|
||||
const BG: Color32 = Color32::from_rgb(17, 23, 32);
|
||||
const PANEL: Color32 = Color32::from_rgb(27, 35, 48);
|
||||
const FIELD: Color32 = Color32::from_rgb(18, 26, 37);
|
||||
const LINE: Color32 = Color32::from_rgb(53, 68, 88);
|
||||
const TEXT: Color32 = Color32::from_rgb(237, 243, 252);
|
||||
const MUTED: Color32 = Color32::from_rgb(165, 181, 201);
|
||||
const CYAN: Color32 = Color32::from_rgb(102, 219, 239);
|
||||
const AMBER: Color32 = Color32::from_rgb(246, 197, 119);
|
||||
const PURPLE: Color32 = Color32::from_rgb(102, 85, 217);
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Theme {
|
||||
#[default]
|
||||
Midra,
|
||||
HighContrast,
|
||||
FoxifiedDark,
|
||||
CorporateLight,
|
||||
Bluecore,
|
||||
DupontMonsanto,
|
||||
EdenGreen,
|
||||
FoxifiedLight,
|
||||
Hci,
|
||||
IronDocks,
|
||||
Peaceframe,
|
||||
Rebel,
|
||||
SiriusMind,
|
||||
Solarized,
|
||||
SonsOfBanard,
|
||||
StormPilot,
|
||||
TessierAshpol,
|
||||
Ustf,
|
||||
VerdantRebel,
|
||||
WeicatIndustrial,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Palette {
|
||||
pub canvas: Color32,
|
||||
pub banner: Color32,
|
||||
pub grid: Color32,
|
||||
pub layer: Color32,
|
||||
pub pattern: [Color32; 2],
|
||||
pub bg: Color32,
|
||||
pub panel: Color32,
|
||||
pub field: Color32,
|
||||
pub line: Color32,
|
||||
pub text: Color32,
|
||||
pub muted: Color32,
|
||||
pub cyan: Color32,
|
||||
pub amber: Color32,
|
||||
pub purple: Color32,
|
||||
}
|
||||
|
||||
impl Theme {
|
||||
pub const ALL: [Self; 20] = [
|
||||
Self::Midra,
|
||||
Self::HighContrast,
|
||||
Self::FoxifiedDark,
|
||||
Self::CorporateLight,
|
||||
Self::Bluecore,
|
||||
Self::DupontMonsanto,
|
||||
Self::EdenGreen,
|
||||
Self::FoxifiedLight,
|
||||
Self::Hci,
|
||||
Self::IronDocks,
|
||||
Self::Peaceframe,
|
||||
Self::Rebel,
|
||||
Self::SiriusMind,
|
||||
Self::Solarized,
|
||||
Self::SonsOfBanard,
|
||||
Self::StormPilot,
|
||||
Self::TessierAshpol,
|
||||
Self::Ustf,
|
||||
Self::VerdantRebel,
|
||||
Self::WeicatIndustrial,
|
||||
];
|
||||
pub fn name(&self) -> &str {
|
||||
match self {
|
||||
Self::Midra => "Midra Dark",
|
||||
Self::HighContrast => "High Contrast",
|
||||
Self::FoxifiedDark => "Foxified Dark",
|
||||
Self::CorporateLight => "Corporate Light",
|
||||
Self::Bluecore => "Bluecore",
|
||||
Self::DupontMonsanto => "Dupont Monsanto",
|
||||
Self::EdenGreen => "Eden Green",
|
||||
Self::FoxifiedLight => "Foxified Light",
|
||||
Self::Hci => "HCI",
|
||||
Self::IronDocks => "Iron Docks",
|
||||
Self::Peaceframe => "Peaceframe",
|
||||
Self::Rebel => "Rebel",
|
||||
Self::SiriusMind => "Sirius Mind",
|
||||
Self::Solarized => "Solarized",
|
||||
Self::SonsOfBanard => "Sons Of Banard",
|
||||
Self::StormPilot => "Storm Pilot",
|
||||
Self::TessierAshpol => "Tessier Ashpol",
|
||||
Self::Ustf => "USTF",
|
||||
Self::VerdantRebel => "Verdant Rebel",
|
||||
Self::WeicatIndustrial => "Weicat Industrial",
|
||||
}
|
||||
}
|
||||
pub fn is_light(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::CorporateLight
|
||||
| Self::FoxifiedLight
|
||||
| Self::Hci
|
||||
| Self::Peaceframe
|
||||
| Self::Solarized
|
||||
)
|
||||
}
|
||||
pub fn palette(&self) -> Palette {
|
||||
let rgb = |hex: u32| Color32::from_rgb((hex >> 16) as u8, (hex >> 8) as u8, hex as u8);
|
||||
match self {
|
||||
Self::HighContrast => Palette {
|
||||
canvas: rgb(0x000000),
|
||||
banner: rgb(0x101010),
|
||||
grid: rgb(0x777777),
|
||||
layer: rgb(0x101010),
|
||||
pattern: [rgb(0x000000), rgb(0xffffff)],
|
||||
bg: rgb(0x000000),
|
||||
panel: rgb(0x000000),
|
||||
field: rgb(0x101010),
|
||||
line: rgb(0xaaaaaa),
|
||||
text: rgb(0xffffff),
|
||||
muted: rgb(0xdddddd),
|
||||
cyan: rgb(0x00ffff),
|
||||
amber: rgb(0xffff00),
|
||||
purple: rgb(0x202080),
|
||||
},
|
||||
Self::Bluecore => sotv_palette(
|
||||
[
|
||||
0x1a222d, 0x232f3a, 0x111922, 0x2b3948, 0xd0e4ff, 0xaaccee, 0x3399ff, 0x4488cc,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::DupontMonsanto => sotv_palette(
|
||||
[
|
||||
0x1f2c1a, 0x2f3d26, 0x141c10, 0x3d4f2e, 0xeaffcc, 0xd5e6aa, 0x697513, 0xbbdd44,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::EdenGreen => sotv_palette(
|
||||
[
|
||||
0x1c2b1a, 0x263f25, 0x152017, 0x2f4a2b, 0xcceebb, 0xbbddaa, 0x6da436, 0x66aa55,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::FoxifiedLight => sotv_palette(
|
||||
[
|
||||
0xfff8f2, 0xfff0e6, 0xffe5d0, 0xffd6b3, 0x5a2e0c, 0xaa6033, 0xff8330, 0xcc7744,
|
||||
],
|
||||
true,
|
||||
),
|
||||
Self::Hci => sotv_palette(
|
||||
[
|
||||
0xf2f9f6, 0xe3f0eb, 0xd0e4dd, 0xc6e8de, 0x144d40, 0x226658, 0x33ccaa, 0x66ccb3,
|
||||
],
|
||||
true,
|
||||
),
|
||||
Self::IronDocks => sotv_palette(
|
||||
[
|
||||
0x1e1e1e, 0x2b2b2b, 0x121212, 0x3a3a3a, 0xe0e0e0, 0xcccccc, 0xe17100, 0xaaaaaa,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::Peaceframe => sotv_palette(
|
||||
[
|
||||
0xe8f3fb, 0xd4e8f5, 0xbcd9eb, 0xcbe2f2, 0x1c3f55, 0x345f77, 0x3399cc, 0x77aac6,
|
||||
],
|
||||
true,
|
||||
),
|
||||
Self::Rebel => sotv_palette(
|
||||
[
|
||||
0x1a1a1a, 0x2a2a2a, 0x111111, 0x444444, 0xf5f5f5, 0xaaaaaa, 0x555555, 0x666666,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::SiriusMind => sotv_palette(
|
||||
[
|
||||
0x0e1a2b, 0x162538, 0x0a121d, 0x1f2f47, 0xd0e6ff, 0xaaccee, 0x3d77b1, 0x4477aa,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::Solarized => sotv_palette(
|
||||
[
|
||||
0xfdf6e3, 0xfefcea, 0xeee8d5, 0xeee8d5, 0x586e75, 0xa0b1b7, 0x516a73, 0xcccccc,
|
||||
],
|
||||
true,
|
||||
),
|
||||
Self::SonsOfBanard => sotv_palette(
|
||||
[
|
||||
0x1e1c18, 0x2c2a26, 0x121110, 0x3a3832, 0xf0d9b5, 0xe0c8a0, 0xbd7c20, 0xcc9966,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::StormPilot => sotv_palette(
|
||||
[
|
||||
0x101022, 0x1b1b33, 0x080818, 0x2b2b4a, 0xccddff, 0xaabbee, 0x5d5d82, 0x5577aa,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::TessierAshpol => sotv_palette(
|
||||
[
|
||||
0x12171b, 0x1a2025, 0x0e1215, 0x202830, 0xccf2ff, 0xb0d8e6, 0x4e8ca0, 0x77cce0,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::Ustf => sotv_palette(
|
||||
[
|
||||
0x0f1b2b, 0x162536, 0x0a121f, 0x1e2e44, 0xe0e8f0, 0xf2f2f2, 0xff4444, 0x446688,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::VerdantRebel => sotv_palette(
|
||||
[
|
||||
0x1b2a1b, 0x273a27, 0x141d14, 0x314f31, 0xccffd9, 0xaaffcc, 0x00aa72, 0x66dd99,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::WeicatIndustrial => sotv_palette(
|
||||
[
|
||||
0x1c1a14, 0x2a261d, 0x0f0e0a, 0x3a341e, 0xfff5cc, 0xffeb99, 0x8f7511, 0xe6b800,
|
||||
],
|
||||
false,
|
||||
),
|
||||
Self::Midra => Palette {
|
||||
canvas: rgb(0x142d40),
|
||||
banner: rgb(0x264556),
|
||||
grid: rgb(0x27475a),
|
||||
layer: rgb(0x173b50),
|
||||
pattern: [rgb(0x264b5d), rgb(0x1a3344)],
|
||||
bg: BG,
|
||||
panel: PANEL,
|
||||
field: FIELD,
|
||||
line: LINE,
|
||||
text: TEXT,
|
||||
muted: MUTED,
|
||||
cyan: CYAN,
|
||||
amber: AMBER,
|
||||
purple: PURPLE,
|
||||
},
|
||||
Self::FoxifiedDark => Palette {
|
||||
canvas: rgb(0x281a12),
|
||||
banner: rgb(0x503322),
|
||||
grid: rgb(0x62432e),
|
||||
layer: rgb(0x43291d),
|
||||
pattern: [rgb(0x503322), rgb(0x362318)],
|
||||
bg: rgb(0x2e1f16),
|
||||
panel: rgb(0x3b261b),
|
||||
field: rgb(0x1e1309),
|
||||
line: rgb(0xaa6033),
|
||||
text: rgb(0xffcc99),
|
||||
muted: rgb(0xffd8b1),
|
||||
cyan: rgb(0xff6600),
|
||||
amber: AMBER,
|
||||
purple: rgb(0x854018),
|
||||
},
|
||||
Self::CorporateLight => Palette {
|
||||
canvas: rgb(0xffffff),
|
||||
banner: rgb(0xe5e9f0),
|
||||
grid: rgb(0xd8dee6),
|
||||
layer: rgb(0xe9eef3),
|
||||
pattern: [rgb(0xe5e9f0), rgb(0xf5f7fa)],
|
||||
bg: rgb(0xf4f5f7),
|
||||
panel: Color32::WHITE,
|
||||
field: rgb(0xf0f1f3),
|
||||
line: rgb(0xbbbbbb),
|
||||
text: rgb(0x222222),
|
||||
muted: rgb(0x52616f),
|
||||
cyan: rgb(0x216783),
|
||||
amber: rgb(0x815600),
|
||||
purple: rgb(0xc5dce8),
|
||||
},
|
||||
}
|
||||
}
|
||||
pub fn apply(&self, ctx: &egui::Context) {
|
||||
let p = self.palette();
|
||||
let mut v = if self.is_light() {
|
||||
egui::Visuals::light()
|
||||
} else {
|
||||
egui::Visuals::dark()
|
||||
};
|
||||
v.override_text_color = Some(p.text);
|
||||
v.panel_fill = p.bg;
|
||||
v.window_fill = p.panel;
|
||||
v.extreme_bg_color = p.field;
|
||||
v.faint_bg_color = p.bg;
|
||||
v.hyperlink_color = p.cyan;
|
||||
v.warn_fg_color = p.amber;
|
||||
v.error_fg_color = if self.is_light() {
|
||||
Color32::from_rgb(165, 30, 40)
|
||||
} else {
|
||||
Color32::LIGHT_RED
|
||||
};
|
||||
v.window_stroke = egui::Stroke::new(1_f32, p.line);
|
||||
v.selection.bg_fill = p.purple;
|
||||
v.selection.stroke.color = p.text;
|
||||
for (w, fill) in [
|
||||
(&mut v.widgets.noninteractive, p.panel),
|
||||
(&mut v.widgets.inactive, p.field),
|
||||
(&mut v.widgets.hovered, p.panel.lerp_to_gamma(p.text, 0.08)),
|
||||
(&mut v.widgets.active, p.purple),
|
||||
(&mut v.widgets.open, p.panel),
|
||||
] {
|
||||
w.bg_fill = fill;
|
||||
w.weak_bg_fill = fill;
|
||||
w.bg_stroke = egui::Stroke::new(
|
||||
if *self == Self::HighContrast {
|
||||
2_f32
|
||||
} else {
|
||||
1_f32
|
||||
},
|
||||
p.line,
|
||||
);
|
||||
w.fg_stroke = egui::Stroke::new(1_f32, p.text);
|
||||
}
|
||||
ctx.set_visuals(v);
|
||||
}
|
||||
}
|
||||
fn sotv_palette(colors: [u32; 8], light: bool) -> Palette {
|
||||
let [bg, panel, field, layer, text, subtle, accent, line] =
|
||||
colors.map(|hex| Color32::from_rgb((hex >> 16) as u8, (hex >> 8) as u8, hex as u8));
|
||||
let mix = |a: Color32, b: Color32| {
|
||||
Color32::from_rgb(
|
||||
((a.r() as u16 + b.r() as u16) / 2) as u8,
|
||||
((a.g() as u16 + b.g() as u16) / 2) as u8,
|
||||
((a.b() as u16 + b.b() as u16) / 2) as u8,
|
||||
)
|
||||
};
|
||||
Palette {
|
||||
bg,
|
||||
panel,
|
||||
field,
|
||||
layer,
|
||||
text,
|
||||
muted: if light { mix(subtle, text) } else { subtle },
|
||||
cyan: if light { mix(accent, text) } else { accent },
|
||||
amber: if light {
|
||||
Color32::from_rgb(129, 86, 0)
|
||||
} else {
|
||||
AMBER
|
||||
},
|
||||
purple: mix(accent, panel),
|
||||
line,
|
||||
canvas: bg,
|
||||
banner: panel,
|
||||
grid: mix(line, bg),
|
||||
pattern: [layer, panel],
|
||||
}
|
||||
}
|
||||
|
|
@ -174,3 +174,19 @@ fn navigating_buffered_show_during_failed_open_does_not_cancel_open_completion()
|
|||
assert_eq!(s.requested, 1);
|
||||
assert!(std::sync::Arc::ptr_eq(&frame, &s.full_frame(1).unwrap()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opening_document_honors_auto_show_and_navigation_preserves_manual_blank() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("show.pdf");
|
||||
common::pdf(&path);
|
||||
for auto_show in [true, false] {
|
||||
let mut s = studio(&path, &temp.path().join("cache"));
|
||||
s.settings.auto_show = auto_show;
|
||||
prepare(&mut s);
|
||||
assert_eq!(s.blanked, !auto_show);
|
||||
s.blanked = true;
|
||||
s.execute(Action::Go(1));
|
||||
assert!(s.blanked);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ fn browser_virtualizes_thumbnails_without_changing_presented_slide() {
|
|||
#[test]
|
||||
fn shared_actions_preserve_blanking_and_save_scope() {
|
||||
let mut s = studio();
|
||||
s.blanked = true;
|
||||
s.execute(Action::Go(5));
|
||||
assert_eq!(s.requested, 5);
|
||||
assert!(s.blanked);
|
||||
|
|
@ -164,3 +165,104 @@ fn lost_operator_screen_never_becomes_notes_on_previous_public_output() {
|
|||
assert!(!s.privacy_hold);
|
||||
assert_eq!(s.routes.presenter, vec!["one"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn palettes_and_languages_apply_to_presenter_browser_and_popups() {
|
||||
use pdf_presenter::{
|
||||
localization::{Language, apply, tr},
|
||||
theme::Theme,
|
||||
};
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut ui = UiState::default();
|
||||
for theme in Theme::ALL {
|
||||
theme.apply(&ctx);
|
||||
assert_eq!(
|
||||
ctx.global_style().visuals.text_color(),
|
||||
theme.palette().text
|
||||
);
|
||||
for language in Language::ALL {
|
||||
apply(&ctx, &language);
|
||||
if language == Language::Fr {
|
||||
assert_eq!(tr(&ctx, "Displays"), "Écrans");
|
||||
}
|
||||
s.menu_open = true;
|
||||
s.displays_open = true;
|
||||
s.layout_open = true;
|
||||
let output = ctx.run_ui(input(Vec2::new(1400., 1000.)), |root| {
|
||||
presenter_ui::presenter(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
let output = ctx.run_ui(input(Vec2::new(1000., 700.)), |root| {
|
||||
presenter_ui::browser(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn startup_output_is_enabled_but_disconnect_still_blanks() {
|
||||
let mut s = Studio::new(true, None);
|
||||
assert!(!s.blanked);
|
||||
let monitors = studio().monitors;
|
||||
s.set_monitors(monitors.clone(), 0);
|
||||
assert!(!s.blanked);
|
||||
s.set_monitors(vec![monitors[0].clone()], 0);
|
||||
assert!(s.blanked);
|
||||
let mut opt_out = Studio::new(true, None);
|
||||
opt_out.settings.auto_show = false;
|
||||
opt_out.set_monitors(monitors, 0);
|
||||
assert!(opt_out.blanked);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_click_opens_slide_browser_and_menu_dropdown() {
|
||||
fn text_position(shapes: &[egui::epaint::ClippedShape], label: &str) -> Pos2 {
|
||||
fn find(shape: &egui::Shape, label: &str) -> Option<Pos2> {
|
||||
match shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == label => {
|
||||
Some(t.pos + t.galley.size() * 0.5)
|
||||
}
|
||||
egui::Shape::Vec(shapes) => shapes.iter().find_map(|s| find(s, label)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
shapes.iter().find_map(|s| find(&s.shape, label)).unwrap()
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut native = UiState::default();
|
||||
let size = Vec2::new(1920., 1080.);
|
||||
for label in ["All slides", "Menu"] {
|
||||
let mut output = ctx.run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native)
|
||||
});
|
||||
for _ in 0..2 {
|
||||
output = ctx.run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native)
|
||||
});
|
||||
}
|
||||
let pos = text_position(&output.shapes, label);
|
||||
for pressed in [true, false] {
|
||||
let mut raw = input(size);
|
||||
raw.events = vec![
|
||||
egui::Event::PointerMoved(pos),
|
||||
egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: Default::default(),
|
||||
},
|
||||
];
|
||||
let _ = ctx.run_ui(raw, |ui| presenter_ui::presenter(ui, &mut s, &mut native));
|
||||
}
|
||||
if label == "All slides" {
|
||||
assert!(
|
||||
s.actions.iter().any(|a| matches!(a, Action::OpenBrowser)),
|
||||
"All slides click at {pos:?} must dispatch an action"
|
||||
);
|
||||
} else {
|
||||
assert!(s.menu_open, "Menu click must open the anchored dropdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ fn settings_roundtrip_preserves_project_overrides_and_hidden_bars() {
|
|||
let mut settings = Settings::default();
|
||||
settings.layout.notes.size = 42.;
|
||||
settings.buffer_mib = 2048;
|
||||
settings.auto_show = false;
|
||||
settings.theme = pdf_presenter::theme::Theme::CorporateLight;
|
||||
settings.language = pdf_presenter::localization::Language::Fr;
|
||||
let mut project = Layout::default();
|
||||
project.current.show = false;
|
||||
project.header = false;
|
||||
|
|
@ -22,6 +25,9 @@ fn settings_roundtrip_preserves_project_overrides_and_hidden_bars() {
|
|||
assert_eq!(loaded.for_project("other").notes.size, 42.);
|
||||
assert_eq!(loaded.routes, settings.routes);
|
||||
assert_eq!(loaded.buffer_mib, 2048);
|
||||
assert!(!loaded.auto_show);
|
||||
assert_eq!(loaded.theme, settings.theme);
|
||||
assert_eq!(loaded.language, settings.language);
|
||||
let bytes = std::fs::read(&path).unwrap();
|
||||
settings.version = 2;
|
||||
assert!(settings::write(&path, &settings).is_err());
|
||||
|
|
@ -55,6 +61,7 @@ fn settings_reject_invalid_versions_ranges_and_duplicate_roles() {
|
|||
std::fs::write(&p, "version=1").unwrap();
|
||||
assert!(settings::read(&p).unwrap().layout.header);
|
||||
assert_eq!(settings::read(&p).unwrap().buffer_mib, 1024);
|
||||
assert!(settings::read(&p).unwrap().auto_show);
|
||||
}
|
||||
#[test]
|
||||
fn monitor_recovery_preserves_survivors_and_distinct_groups() {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,20 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.14
|
||||
|
||||
- Replace the floating Menu with an anchored dropdown; present display assignments
|
||||
as numbered cards with direct role choices.
|
||||
- Raise/focus the windowed slide browser over fullscreen presenter windows and
|
||||
restore an existing browser when opened again; add an explicit Close control.
|
||||
- Show output by default on document open, with a saved opt-out. Distinguish disabled
|
||||
output using a colored indicator and NO OUTPUT DISPLAYED, including with hidden bars.
|
||||
- Add Canvas Pilot’s 20 built-in palettes and System/English/French interface and
|
||||
progress preferences. Persist globally with backward-compatible settings defaults.
|
||||
Detailed diagnostics remain verbatim; other languages/external packs are not bundled.
|
||||
- Retain emergency blanking, topology privacy protection and existing RAM preparation.
|
||||
|
||||
|
||||
### 0.1.13
|
||||
|
||||
- Prepare every slide at the largest active screen resolution (4096-pixel edge cap),
|
||||
|
|
|
|||
|
|
@ -125,3 +125,29 @@ coverage is 84.42% (75% floor), with no production exclusions. Linux and Windows
|
|||
artifacts are rebuilt, and macOS aarch64 is compile-checked. The native presenter was
|
||||
visually inspected with the local PDF and showed all three slides buffered in RAM.
|
||||
Navigating the previous buffered show while a new load fails is also regression-tested.
|
||||
|
||||
|
||||
## 0.1.14 presenter workflow
|
||||
|
||||
Menu is an anchored dropdown with Appearance and Preferences submenus. Displays uses
|
||||
numbered screen cards and direct role selection. The independent windowed slide
|
||||
browser requests topmost placement/focus; reopening restores/focuses it. Output is
|
||||
enabled by default on successful document open, with a globally saved opt-out.
|
||||
Emergency/topology blanking still applies, and NO OUTPUT DISPLAYED is explicit even
|
||||
with a hidden footer. Appearance contains all 20 Canvas Pilot built-in palettes and
|
||||
System/English/French. Additional languages and external packs remain unimplemented;
|
||||
worker/OS diagnostics are preserved verbatim. This repository remains standalone.
|
||||
|
||||
Validation on the available Linux/X11 desktop: real pointer clicks opened All slides,
|
||||
its Close control, the compact dropdown and display cards. A separate release run
|
||||
loaded persisted French/Corporate Light preferences and auto_show=false, showing the
|
||||
red output indicator and translated warning. The test harness had to raise its app
|
||||
before synthetic pointer delivery; input sent to another foreground window was not
|
||||
an application failure. Temporary preferences/cache and owned test processes were
|
||||
cleaned up. This is local GUI evidence, not acceptance of the multi-OS physical matrix.
|
||||
|
||||
41 Rust tests, including native smoke/output and new pointer-dispatch/default-output
|
||||
regressions, and 10 Python tests pass. Formatting, Clippy/rustdoc with warnings denied,
|
||||
and macOS aarch64 compile-check pass. Whole-application coverage is 82.73% (75% floor),
|
||||
without production exclusions. Linux and Windows x86_64 release builds succeed. Windows/macOS runtime validation
|
||||
remains open.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
version = 1
|
||||
auto_show = true
|
||||
theme = "midra"
|
||||
language = "system"
|
||||
presenter_fullscreen = true
|
||||
presentation_fullscreen = true
|
||||
thumbnail_size = 220.0
|
||||
|
|
|
|||
|
|
@ -12,6 +12,18 @@ with an error, without rewriting the bad file. Missing files use defaults. Reads
|
|||
bounded to 4 MiB. Writes validate then atomically replace using a same-directory
|
||||
flushed temporary file. Unknown fields are ignored and not preserved on round trip.
|
||||
|
||||
- `auto_show`: boolean, default true (0.1.14). Enables output on startup and successful
|
||||
document open; false starts/opens blanked. Manual navigation preserves blanking.
|
||||
Display topology changes, safe fullscreen exit and host recovery still blank output.
|
||||
- `theme`: built-in palette enum in snake_case, default `midra` (0.1.14). Values:
|
||||
`midra`, `high_contrast`, `foxified_dark`, `corporate_light`, `bluecore`,
|
||||
`dupont_monsanto`, `eden_green`, `foxified_light`, `hci`, `iron_docks`, `peaceframe`,
|
||||
`rebel`, `sirius_mind`, `solarized`, `sons_of_banard`, `storm_pilot`,
|
||||
`tessier_ashpol`, `ustf`, `verdant_rebel`, `weicat_industrial`.
|
||||
- `language`: `system` (default), `en` or `fr` (0.1.14). Native OS locale selects
|
||||
French for `fr*`, English otherwise. Unknown theme/language values are rejected.
|
||||
Missing new fields in older v1 files use these defaults; no migration is required.
|
||||
Theme, language and automatic-output changes persist asynchronously, globally.
|
||||
- `layout`: `previous`, `current`, `next`, `notes`, `elapsed`, `clock`, each with
|
||||
boolean `show` and finite floating `size`; plus boolean `header`/`footer`.
|
||||
Previous/next sizes are relative weights 30–160, current 60–200; notes size
|
||||
|
|
|
|||
|
|
@ -19,9 +19,12 @@ presenter is withheld to protect notes. Reconnect an operator screen, or restart
|
|||
windowed rehearsal after verifying privacy. Duplicate monitor names are distinguished
|
||||
by enumeration order; verify identical models.
|
||||
|
||||
**Show presentation** activates output; **Blank presentation** or B hides it. Navigation
|
||||
Output is enabled by default when opening a document. Menu → Preferences → Show presentation
|
||||
automatically lets you save an opt-out. **Show presentation** restores blanked output; **Blank presentation** or B hides it. Navigation
|
||||
preserves blanking. Until an uncached requested slide is ready, output holds the last
|
||||
usable frame. The footer distinguishes requested and acknowledged displayed slides.
|
||||
usable frame. The footer distinguishes requested and acknowledged displayed slides. A red
|
||||
**NO OUTPUT DISPLAYED** warning marks blanking, no assigned output or no document;
|
||||
it remains visible when the footer is hidden. Preparing output has a separate status.
|
||||
Escape cancels a pending slide number/menu, closes the browser, or safely leaves
|
||||
fullscreen and blanks output. Closing a presentation window blanks it; close a
|
||||
presenter or choose Menu → Quit to end the application.
|
||||
|
|
@ -72,10 +75,10 @@ Opening a show starts two supervised preparation workers. The current slide gets
|
|||
Then the **entire deck** is prepared at the largest connected role screen's pixel
|
||||
edge, preserving slide aspect ratio. Smaller screens use that same frame scaled to
|
||||
fit; separate copies for every smaller resolution would waste RAM. The current
|
||||
renderer limit is 4096 pixels per side, shown in Menu. Resolution changes start a
|
||||
renderer limit is 4096 pixels per side, shown in Menu → Preferences. Resolution changes start a
|
||||
new preparation pass with a new buffer identity.
|
||||
|
||||
Processed frames are kept in the application's persistent cache; Menu shows its
|
||||
Processed frames are kept in the application's persistent cache; Menu → Preferences → Storage locations shows its
|
||||
location. Reopening with unchanged source contents, resolution and renderer reuses
|
||||
those frames without PDF rasterization or image decoding. It still verifies source
|
||||
identity/checksums and reads frames into RAM: a restart cannot literally take zero
|
||||
|
|
@ -94,7 +97,7 @@ Navigation then performs no application slide-file reads, PDF rendering or image
|
|||
decoding. Raster composition still happens, and the OS can page memory under pressure.
|
||||
The entire prepared deck stays resident instead of evicting distant slides.
|
||||
|
||||
Menu → RAM budget controls the decoded-slide allowance for **each process**, default
|
||||
Menu → Preferences → RAM budget controls the decoded-slide allowance for **each process**, default
|
||||
1024 MiB, configurable from 256 to 16384 MiB. Presenter and output can each consume
|
||||
that allowance; textures, workers and other application memory are additional.
|
||||
Preparation reserves capacity for in-flight frames. If the deck cannot fit, it pauses
|
||||
|
|
@ -124,3 +127,22 @@ you may remove its `slides-v1` directory while the app is closed. A full/unwrita
|
|||
reports an error and retains the last working output. OS window services/system
|
||||
libraries are prerequisites; PDF/image/font libraries are bundled in the executable. `--licenses` prints bundled
|
||||
dependency/font notices without launching a window.
|
||||
|
||||
## Appearance and language
|
||||
|
||||
Menu opens a dropdown below its button; click outside or press Escape to dismiss it.
|
||||
Displays uses numbered screen cards with direct Unused / Presenter / Presentation
|
||||
choices. Repeat a role to mirror it, then Apply and remember.
|
||||
|
||||
Menu → Appearance → Theme offers the same 20 built-in palettes as Canvas Pilot, including light,
|
||||
dark and High Contrast. Menu → Appearance → Language offers System, English and Français. System
|
||||
uses the native OS locale and falls back to English for other languages. Choices are
|
||||
saved globally and apply to all presenter/browser windows; slides are never recolored.
|
||||
The controls and preparation progress are translated; detailed worker/OS diagnostics
|
||||
remain verbatim. Additional Canvas Pilot languages and external theme/language packs
|
||||
are not included in this version.
|
||||
|
||||
All slides opens a windowed browser above fullscreen windows and requests focus.
|
||||
Opening it again restores/focuses the existing browser. Close or Escape dismisses it.
|
||||
The destination remains configurable in the browser, defaulting to the presenter.
|
||||
Window-manager focus restrictions may still require clicking the browser on some systems.
|
||||
|
|
|
|||
Loading…
Reference in New Issue