Save independent presenter layouts by display identity
This commit is contained in:
parent
5bc9c83675
commit
2dadf99ee0
|
|
@ -2245,7 +2245,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.75"
|
||||
version = "0.1.76"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.75"
|
||||
version = "0.1.76"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
|
|
|
|||
|
|
@ -216,9 +216,12 @@ impl NativeWindow {
|
|||
let display_action = &mut self.display_action;
|
||||
let zoom_change = &mut self.zoom_change;
|
||||
let output = ctx.run_ui(input, |ui| match role {
|
||||
Role::Presenter => {
|
||||
presenter_ui::presenter(ui, studio.as_deref_mut().unwrap(), ui_state)
|
||||
}
|
||||
Role::Presenter => presenter_ui::presenter_on_display(
|
||||
ui,
|
||||
studio.as_deref_mut().unwrap(),
|
||||
ui_state,
|
||||
&self.monitor,
|
||||
),
|
||||
Role::Browser => presenter_ui::browser(ui, studio.as_deref_mut().unwrap(), ui_state),
|
||||
Role::Presentation => {
|
||||
ui.painter()
|
||||
|
|
@ -1337,7 +1340,34 @@ impl ApplicationHandler for App {
|
|||
crate::navigation::Hold::new(direction, Instant::now()),
|
||||
));
|
||||
}
|
||||
self.key(role, event.logical_key, consumed, modifiers);
|
||||
let local_dismissed = matches!(event.logical_key, Key::Named(NamedKey::Escape))
|
||||
&& !modifiers.ctrl
|
||||
&& !modifiers.alt
|
||||
&& !modifiers.command
|
||||
&& role == Role::Presenter
|
||||
&& self.studio.as_mut().is_some_and(|s| {
|
||||
if s.route_trial.is_some()
|
||||
|| s.notes_editor.is_some()
|
||||
|| s.notes_import.is_some()
|
||||
|| !s.jump.is_empty()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let Some(view) =
|
||||
s.presenter_views.get_mut(&self.windows[index].monitor)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let open = view.layout_open || view.menu_open;
|
||||
view.layout_open = false;
|
||||
view.menu_open = false;
|
||||
open
|
||||
});
|
||||
if local_dismissed {
|
||||
self.redraw();
|
||||
} else {
|
||||
self.key(role, event.logical_key, consumed, modifiers);
|
||||
}
|
||||
}
|
||||
}
|
||||
WindowEvent::Resized(_) | WindowEvent::ScaleFactorChanged { .. } => {
|
||||
|
|
@ -1455,9 +1485,15 @@ impl ApplicationHandler for App {
|
|||
&& let Some(s) = &mut self.studio
|
||||
{
|
||||
match self.smoke_stage {
|
||||
0 => s.layout_open = true,
|
||||
0 => {
|
||||
for view in s.presenter_views.values_mut() {
|
||||
view.layout_open = true;
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
s.layout_open = false;
|
||||
for view in s.presenter_views.values_mut() {
|
||||
view.layout_open = false;
|
||||
}
|
||||
s.displays_open = true;
|
||||
}
|
||||
2 => {
|
||||
|
|
@ -1466,11 +1502,15 @@ impl ApplicationHandler for App {
|
|||
}
|
||||
3 => s.execute(Action::CloseBrowser),
|
||||
4 => {
|
||||
s.layout.header = false;
|
||||
s.layout.footer = false;
|
||||
for view in s.presenter_views.values_mut() {
|
||||
view.layout.header = false;
|
||||
view.layout.footer = false;
|
||||
}
|
||||
}
|
||||
5 => {
|
||||
s.layout = Default::default();
|
||||
for view in s.presenter_views.values_mut() {
|
||||
view.layout = Default::default();
|
||||
}
|
||||
// Escape dismisses transient UI; fullscreen is an explicit control.
|
||||
}
|
||||
6 => {
|
||||
|
|
|
|||
|
|
@ -675,23 +675,23 @@ fn timer_position(ui: &mut Ui, id: &str, position: &mut TimerPosition) {
|
|||
}
|
||||
});
|
||||
}
|
||||
fn timer_height(s: &Studio, position: TimerPosition) -> f32 {
|
||||
fn timer_height(layout: &Layout, position: TimerPosition) -> f32 {
|
||||
[
|
||||
(&s.layout.elapsed, s.layout.elapsed_position),
|
||||
(&s.layout.clock, s.layout.clock_position),
|
||||
(&layout.elapsed, layout.elapsed_position),
|
||||
(&layout.clock, layout.clock_position),
|
||||
]
|
||||
.into_iter()
|
||||
.filter(|(w, p)| w.show && *p == position)
|
||||
.map(|(w, _)| w.size * 1.3 + 36.)
|
||||
.fold(0., f32::max)
|
||||
}
|
||||
fn timers(ui: &mut Ui, s: &Studio, position: TimerPosition) {
|
||||
fn timers(ui: &mut Ui, s: &Studio, layout: &Layout, position: TimerPosition) {
|
||||
let locale = ui.ctx().clone();
|
||||
let secs = s.timer.seconds(Instant::now(), s.timer_limit());
|
||||
let entries = [
|
||||
(
|
||||
&s.layout.elapsed,
|
||||
s.layout.elapsed_position,
|
||||
&layout.elapsed,
|
||||
layout.elapsed_position,
|
||||
if s.layout.timer_mode == TimerMode::Countdown {
|
||||
"Countdown"
|
||||
} else {
|
||||
|
|
@ -700,8 +700,8 @@ fn timers(ui: &mut Ui, s: &Studio, position: TimerPosition) {
|
|||
format!("{:02}:{:02}", secs / 60, secs % 60),
|
||||
),
|
||||
(
|
||||
&s.layout.clock,
|
||||
s.layout.clock_position,
|
||||
&layout.clock,
|
||||
layout.clock_position,
|
||||
"Time · HH:MM",
|
||||
chrono::Local::now().format("%H:%M").to_string(),
|
||||
),
|
||||
|
|
@ -784,13 +784,14 @@ fn timers(ui: &mut Ui, s: &Studio, position: TimerPosition) {
|
|||
fn side_timers(
|
||||
ui: &mut Ui,
|
||||
s: &Studio,
|
||||
layout: &Layout,
|
||||
rect: &mut Rect,
|
||||
left: TimerPosition,
|
||||
right: TimerPosition,
|
||||
) {
|
||||
let original = *rect;
|
||||
for (position, is_left) in [(left, true), (right, false)] {
|
||||
let size = timer_height(s, position);
|
||||
let size = timer_height(layout, position);
|
||||
if size == 0. || !original.is_positive() {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -817,13 +818,40 @@ fn side_timers(
|
|||
.layout(egui::Layout::top_down(egui::Align::Min)),
|
||||
|ui| {
|
||||
ui.set_clip_rect(ui.clip_rect().intersect(column));
|
||||
timers(ui, s, position);
|
||||
timers(ui, s, layout, position);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Render a legacy/default view (also used by headless UI callers).
|
||||
pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
||||
let mut view = crate::studio::PresenterView {
|
||||
layout: s.layout.clone(),
|
||||
layout_open: s.layout_open,
|
||||
menu_open: s.menu_open,
|
||||
};
|
||||
presenter_view(ui, s, native, &mut view, None);
|
||||
view.layout.timer_mode = s.layout.timer_mode;
|
||||
view.layout.countdown_seconds = s.layout.countdown_seconds;
|
||||
view.layout.timer_autostart = s.layout.timer_autostart;
|
||||
s.layout = view.layout;
|
||||
s.layout_open = view.layout_open;
|
||||
s.menu_open = view.menu_open;
|
||||
}
|
||||
/// A native presenter always edits and renders the layout of its own monitor.
|
||||
pub fn presenter_on_display(ui: &mut Ui, s: &mut Studio, native: &mut UiState, display: &str) {
|
||||
let mut view = s.take_presenter_view(display);
|
||||
presenter_view(ui, s, native, &mut view, Some(display));
|
||||
s.presenter_views.insert(display.into(), view);
|
||||
}
|
||||
fn presenter_view(
|
||||
ui: &mut Ui,
|
||||
s: &mut Studio,
|
||||
native: &mut UiState,
|
||||
view: &mut crate::studio::PresenterView,
|
||||
display: Option<&str>,
|
||||
) {
|
||||
let locale = ui.ctx().clone();
|
||||
native.trim(s);
|
||||
let ctx = ui.ctx().clone();
|
||||
|
|
@ -838,8 +866,8 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if pointer.is_some_and(|p| p.y > screen.bottom() - 72.) {
|
||||
native.footer_until = now + Duration::from_millis(700);
|
||||
}
|
||||
let header = s.layout.header || native.header_until > now || s.menu_open;
|
||||
let footer = s.layout.footer || native.footer_until > now;
|
||||
let header = view.layout.header || native.header_until > now || view.menu_open;
|
||||
let footer = view.layout.footer || native.footer_until > now;
|
||||
if native.navigation_hold.is_some() && (!footer || !ctx.input(|i| i.focused)) {
|
||||
native.navigation_hold = None;
|
||||
s.actions.push(Action::FinishNavigation);
|
||||
|
|
@ -864,19 +892,19 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
s.actions.push(Action::RevertRoutes);
|
||||
ui.close();
|
||||
}
|
||||
ui.checkbox(&mut s.layout.header, tr(&locale, "Keep header visible"));
|
||||
ui.checkbox(&mut s.layout.footer, tr(&locale, "Keep footer visible"));
|
||||
ui.checkbox(&mut view.layout.header, tr(&locale, "Keep header visible"));
|
||||
ui.checkbox(&mut view.layout.footer, tr(&locale, "Keep footer visible"));
|
||||
if ui.button(tr(&locale, "Show both")).clicked() {
|
||||
s.layout.header = true;
|
||||
s.layout.footer = true;
|
||||
view.layout.header = true;
|
||||
view.layout.footer = true;
|
||||
ui.close();
|
||||
}
|
||||
if ui.button(tr(&locale, "Layout…")).clicked() {
|
||||
s.layout_open = true;
|
||||
view.layout_open = true;
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
let header_timer_height = timer_height(s, TimerPosition::Header);
|
||||
let header_timer_height = timer_height(&view.layout, TimerPosition::Header);
|
||||
let separate_header_timers =
|
||||
header_timer_height > 100. || (header_timer_height > 0. && screen.width() < 1400.);
|
||||
let header_controls_height = if screen.width() < 1100. { 76. } else { 44. };
|
||||
|
|
@ -890,14 +918,14 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
.max(header_controls_height + 20.)
|
||||
.min(screen.height() * 0.35);
|
||||
let mut body = screen.shrink(16.);
|
||||
if s.layout.header {
|
||||
if view.layout.header {
|
||||
body.min.y += header_height;
|
||||
}
|
||||
if s.layout.footer {
|
||||
if view.layout.footer {
|
||||
body.max.y -= 90.;
|
||||
}
|
||||
if s.layout.slide_progress {
|
||||
let height = s
|
||||
if view.layout.slide_progress {
|
||||
let height = view
|
||||
.layout
|
||||
.slide_progress_height
|
||||
.min(body.height().max(0.) * 0.25);
|
||||
|
|
@ -923,7 +951,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
});
|
||||
}
|
||||
for position in [TimerPosition::AboveSlides, TimerPosition::BelowNotes] {
|
||||
let height = timer_height(s, position).min(body.height().max(0.) * 0.35);
|
||||
let height = timer_height(&view.layout, position).min(body.height().max(0.) * 0.35);
|
||||
if height > 0. {
|
||||
let top = if position == TimerPosition::AboveSlides {
|
||||
body.top()
|
||||
|
|
@ -941,14 +969,15 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
egui::UiBuilder::new()
|
||||
.max_rect(rect)
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|ui| timers(ui, s, position),
|
||||
|ui| timers(ui, s, &view.layout, position),
|
||||
);
|
||||
}
|
||||
}
|
||||
let preview_visible = s.layout.previous.show || s.layout.current.show || s.layout.next.show;
|
||||
let notes_h = if s.layout.notes.show {
|
||||
let preview_visible =
|
||||
view.layout.previous.show || view.layout.current.show || view.layout.next.show;
|
||||
let notes_h = if view.layout.notes.show {
|
||||
if preview_visible {
|
||||
body.height() * s.layout.notes.size / 100.
|
||||
body.height() * view.layout.notes.size / 100.
|
||||
} else {
|
||||
body.height()
|
||||
}
|
||||
|
|
@ -974,12 +1003,13 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if !preview_visible {
|
||||
preview = body;
|
||||
}
|
||||
if !s.layout.notes.show {
|
||||
if !view.layout.notes.show {
|
||||
notes_rect = body;
|
||||
}
|
||||
side_timers(
|
||||
ui,
|
||||
s,
|
||||
&view.layout,
|
||||
&mut preview,
|
||||
TimerPosition::LeftOfSlides,
|
||||
TimerPosition::RightOfSlides,
|
||||
|
|
@ -987,17 +1017,18 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if !preview_visible {
|
||||
notes_rect = preview;
|
||||
}
|
||||
if !s.layout.notes.show {
|
||||
if !view.layout.notes.show {
|
||||
notes_rect = preview;
|
||||
}
|
||||
side_timers(
|
||||
ui,
|
||||
s,
|
||||
&view.layout,
|
||||
&mut notes_rect,
|
||||
TimerPosition::LeftOfNotes,
|
||||
TimerPosition::RightOfNotes,
|
||||
);
|
||||
if !s.layout.notes.show {
|
||||
if !view.layout.notes.show {
|
||||
preview = notes_rect;
|
||||
}
|
||||
if preview_visible {
|
||||
|
|
@ -1005,17 +1036,17 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
(
|
||||
tr(&locale, "PREVIOUS"),
|
||||
s.requested.checked_sub(1),
|
||||
s.layout.previous.clone(),
|
||||
view.layout.previous.clone(),
|
||||
),
|
||||
(
|
||||
tr(&locale, "CURRENT"),
|
||||
Some(s.requested),
|
||||
s.layout.current.clone(),
|
||||
view.layout.current.clone(),
|
||||
),
|
||||
(
|
||||
tr(&locale, "NEXT"),
|
||||
(s.requested + 1 < s.count()).then_some(s.requested + 1),
|
||||
s.layout.next.clone(),
|
||||
view.layout.next.clone(),
|
||||
),
|
||||
];
|
||||
let total: f32 = items
|
||||
|
|
@ -1102,7 +1133,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
x = rect.right() + 14.;
|
||||
}
|
||||
}
|
||||
if s.layout.notes.show {
|
||||
if view.layout.notes.show {
|
||||
let rect = notes_rect;
|
||||
let response = ui.interact(rect, ui.id().with("presenter-notes"), Sense::click());
|
||||
response
|
||||
|
|
@ -1183,15 +1214,15 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
ui.with_layout(
|
||||
egui::Layout::left_to_right(egui::Align::Center).with_main_wrap(true),
|
||||
|ui| {
|
||||
if bar_visibility_button(ui, s.layout.header, true).clicked() {
|
||||
s.layout.header = !s.layout.header;
|
||||
if bar_visibility_button(ui, view.layout.header, true).clicked() {
|
||||
view.layout.header = !view.layout.header;
|
||||
native.header_until = now;
|
||||
}
|
||||
let trigger = ui.button(tr(&locale, "Menu"));
|
||||
let mut menu_open = if trigger.clicked() {
|
||||
!s.menu_open
|
||||
!view.menu_open
|
||||
} else {
|
||||
s.menu_open
|
||||
view.menu_open
|
||||
};
|
||||
// Settings controls and nested selectors must not dismiss their parent menu.
|
||||
egui::Popup::menu(&trigger)
|
||||
|
|
@ -1205,7 +1236,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
)
|
||||
.show(ui, |ui| menu(ui, s));
|
||||
});
|
||||
s.menu_open = menu_open;
|
||||
view.menu_open = menu_open;
|
||||
ui.add_sized(
|
||||
[100., 20.],
|
||||
egui::Label::new(
|
||||
|
|
@ -1225,7 +1256,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
&mut s.actions,
|
||||
);
|
||||
if ui.button(tr(&locale, "Layout")).clicked() {
|
||||
s.layout_open = !s.layout_open;
|
||||
view.layout_open = !view.layout_open;
|
||||
}
|
||||
if ui.button(tr(&locale, "Tools")).clicked() {
|
||||
s.toolbox.open = !s.toolbox.open;
|
||||
|
|
@ -1258,7 +1289,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
s.actions.push(Action::Blank);
|
||||
}
|
||||
if !separate_header_timers {
|
||||
timers(ui, s, TimerPosition::Header);
|
||||
timers(ui, s, &view.layout, TimerPosition::Header);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
@ -1272,7 +1303,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
egui::UiBuilder::new()
|
||||
.max_rect(timer_rect)
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|ui| timers(ui, s, TimerPosition::Header),
|
||||
|ui| timers(ui, s, &view.layout, TimerPosition::Header),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1284,8 +1315,8 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
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| {
|
||||
if bar_visibility_button(ui, s.layout.footer, false).clicked() {
|
||||
s.layout.footer = !s.layout.footer;
|
||||
if bar_visibility_button(ui, view.layout.footer, false).clicked() {
|
||||
view.layout.footer = !view.layout.footer;
|
||||
native.footer_until = now;
|
||||
}
|
||||
navigation_button(ui, s, native, tr(&locale, "Previous"), -1);
|
||||
|
|
@ -1427,7 +1458,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
});
|
||||
});
|
||||
}
|
||||
if s.layout_open {
|
||||
if view.layout_open {
|
||||
let mut open = true;
|
||||
egui::Window::new(tr(&locale, "Your presenter view"))
|
||||
.id(egui::Id::new("layout-window"))
|
||||
|
|
@ -1441,6 +1472,16 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
ui.spacing_mut().button_padding = Vec2::new(12., 7.);
|
||||
ui.spacing_mut().interact_size.y = 30.;
|
||||
ui.visuals_mut().slider_trailing_fill = true;
|
||||
if let Some(display) = display {
|
||||
if let Some((index, monitor)) = s.monitors.iter().enumerate().find(|(_, m)| m.id == display) {
|
||||
ui.strong(format!("{} {} · {}", if s.settings.language.french() { "Écran" } else { "Display" }, index + 1, monitor.name));
|
||||
}
|
||||
ui.label(if s.settings.language.french() {
|
||||
"Disposition et sauvegardes propres à cet écran. Le fonctionnement du minuteur reste partagé."
|
||||
} else {
|
||||
"Layout and saves apply to this display. Timer behavior is shared."
|
||||
});
|
||||
}
|
||||
ui.label(tr(
|
||||
&locale,
|
||||
"Changes appear immediately. Save to reuse this layout.",
|
||||
|
|
@ -1461,20 +1502,20 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
layout_section(ui, tr(&locale, "Start with a preset"), |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui.button(tr(&locale, "Balanced")).clicked() {
|
||||
s.layout = Layout::default();
|
||||
view.layout = Layout::default();
|
||||
}
|
||||
if ui.button(tr(&locale, "Slide focus")).clicked() {
|
||||
s.layout = Layout::default();
|
||||
s.layout.previous.show = false;
|
||||
s.layout.next.show = false;
|
||||
s.layout.notes.show = false;
|
||||
s.layout.elapsed.show = false;
|
||||
s.layout.clock.show = false;
|
||||
view.layout = Layout::default();
|
||||
view.layout.previous.show = false;
|
||||
view.layout.next.show = false;
|
||||
view.layout.notes.show = false;
|
||||
view.layout.elapsed.show = false;
|
||||
view.layout.clock.show = false;
|
||||
}
|
||||
if ui.button(tr(&locale, "Notes first")).clicked() {
|
||||
s.layout.notes.show = true;
|
||||
s.layout.notes.size = 60.;
|
||||
s.layout.previous.show = false;
|
||||
view.layout.notes.show = true;
|
||||
view.layout.notes.size = 60.;
|
||||
view.layout.previous.show = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -1486,7 +1527,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Previous slide"),
|
||||
&mut s.layout.previous,
|
||||
&mut view.layout.previous,
|
||||
30.,
|
||||
160.,
|
||||
"Relative size",
|
||||
|
|
@ -1494,7 +1535,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Current slide"),
|
||||
&mut s.layout.current,
|
||||
&mut view.layout.current,
|
||||
60.,
|
||||
200.,
|
||||
"Relative size",
|
||||
|
|
@ -1502,7 +1543,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Next slide"),
|
||||
&mut s.layout.next,
|
||||
&mut view.layout.next,
|
||||
30.,
|
||||
160.,
|
||||
"Relative size",
|
||||
|
|
@ -1511,7 +1552,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Notes"),
|
||||
&mut s.layout.notes,
|
||||
&mut view.layout.notes,
|
||||
12.,
|
||||
65.,
|
||||
"Space (%)",
|
||||
|
|
@ -1523,18 +1564,18 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Elapsed time"),
|
||||
&mut s.layout.elapsed,
|
||||
&mut view.layout.elapsed,
|
||||
16.,
|
||||
320.,
|
||||
"Text size",
|
||||
);
|
||||
ui.add_enabled_ui(s.layout.elapsed.show, |ui| {
|
||||
ui.add_enabled_ui(view.layout.elapsed.show, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(tr(&locale, "Elapsed time position"));
|
||||
timer_position(
|
||||
ui,
|
||||
"elapsed-position",
|
||||
&mut s.layout.elapsed_position,
|
||||
&mut view.layout.elapsed_position,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -1542,40 +1583,40 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
widget(
|
||||
ui,
|
||||
tr(&locale, "Time · HH:MM"),
|
||||
&mut s.layout.clock,
|
||||
&mut view.layout.clock,
|
||||
16.,
|
||||
320.,
|
||||
"Text size",
|
||||
);
|
||||
ui.add_enabled_ui(s.layout.clock.show, |ui| {
|
||||
ui.add_enabled_ui(view.layout.clock.show, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(tr(&locale, "Clock position"));
|
||||
timer_position(
|
||||
ui,
|
||||
"clock-position",
|
||||
&mut s.layout.clock_position,
|
||||
&mut view.layout.clock_position,
|
||||
);
|
||||
});
|
||||
});
|
||||
ui.separator();
|
||||
ui.checkbox(
|
||||
&mut s.layout.slide_progress,
|
||||
&mut view.layout.slide_progress,
|
||||
tr(&locale, "Slide progress bar"),
|
||||
);
|
||||
ui.add_enabled(
|
||||
s.layout.slide_progress,
|
||||
egui::Slider::new(&mut s.layout.slide_progress_height, 8. ..=120.)
|
||||
view.layout.slide_progress,
|
||||
egui::Slider::new(&mut view.layout.slide_progress_height, 8. ..=120.)
|
||||
.text(tr(&locale, "Bar height")),
|
||||
);
|
||||
});
|
||||
layout_section(ui, tr(&locale, "Header and footer"), |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.checkbox(
|
||||
&mut s.layout.header,
|
||||
&mut view.layout.header,
|
||||
tr(&locale, "Keep header visible"),
|
||||
);
|
||||
ui.checkbox(
|
||||
&mut s.layout.footer,
|
||||
&mut view.layout.footer,
|
||||
tr(&locale, "Keep footer visible"),
|
||||
);
|
||||
});
|
||||
|
|
@ -1592,14 +1633,14 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
button(
|
||||
ui,
|
||||
tr(&locale, "Save layout · This project"),
|
||||
Action::SaveProject,
|
||||
display.map_or(Action::SaveProject, |display| Action::SaveDisplayLayout { display: display.into(), project: true, layout: view.layout.clone() }),
|
||||
&mut s.actions,
|
||||
);
|
||||
});
|
||||
button(
|
||||
ui,
|
||||
tr(&locale, "Save layout · All projects"),
|
||||
Action::SaveGlobal,
|
||||
display.map_or(Action::SaveGlobal, |display| Action::SaveDisplayLayout { display: display.into(), project: false, layout: view.layout.clone() }),
|
||||
&mut s.actions,
|
||||
);
|
||||
});
|
||||
|
|
@ -1608,14 +1649,14 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
button(
|
||||
ui,
|
||||
tr(&locale, "Use all-projects default"),
|
||||
Action::UseGlobal,
|
||||
display.map_or(Action::UseGlobal, |display| Action::UseDisplayDefault(display.into())),
|
||||
&mut s.actions,
|
||||
);
|
||||
});
|
||||
ui.small(tr(&locale, "Project layouts override the default."));
|
||||
});
|
||||
});
|
||||
s.layout_open = open;
|
||||
view.layout_open = open;
|
||||
}
|
||||
if s.displays_open {
|
||||
let mut open = true;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,13 @@ impl Default for SlideColors {
|
|||
}
|
||||
}
|
||||
}
|
||||
/// Saved visual layouts for one monitor; shared timer behavior uses legacy layouts.
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct DisplayLayouts {
|
||||
pub layout: Layout,
|
||||
pub projects: BTreeMap<String, Layout>,
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Settings {
|
||||
|
|
@ -218,6 +225,7 @@ pub struct Settings {
|
|||
pub slide_colors: SlideColors,
|
||||
pub layout: Layout,
|
||||
pub projects: BTreeMap<String, Layout>,
|
||||
pub display_layouts: BTreeMap<String, DisplayLayouts>,
|
||||
pub routes: Routes,
|
||||
pub presenter_fullscreen: bool,
|
||||
pub presentation_fullscreen: bool,
|
||||
|
|
@ -262,6 +270,7 @@ impl Default for Settings {
|
|||
slide_colors: SlideColors::default(),
|
||||
layout: Layout::default(),
|
||||
projects: BTreeMap::new(),
|
||||
display_layouts: BTreeMap::new(),
|
||||
routes: Routes::default(),
|
||||
presenter_fullscreen: true,
|
||||
presentation_fullscreen: true,
|
||||
|
|
@ -289,6 +298,25 @@ impl Settings {
|
|||
if self.projects.len() > 4096 || !(100. ..=400.).contains(&self.thumbnail_size) {
|
||||
return Err("Invalid settings limits".into());
|
||||
}
|
||||
if self.display_layouts.len() > 128
|
||||
|| self
|
||||
.display_layouts
|
||||
.values()
|
||||
.map(|profile| profile.projects.len())
|
||||
.sum::<usize>()
|
||||
> 4096
|
||||
{
|
||||
return Err("Too many display layouts".into());
|
||||
}
|
||||
for (display, profile) in &self.display_layouts {
|
||||
if display.is_empty() || display.len() > 1024 {
|
||||
return Err("Invalid display layout identifier".into());
|
||||
}
|
||||
profile.layout.validate()?;
|
||||
for layout in profile.projects.values() {
|
||||
layout.validate()?;
|
||||
}
|
||||
}
|
||||
self.routes.validate()?;
|
||||
self.layout.validate()?;
|
||||
for layout in self.projects.values() {
|
||||
|
|
@ -296,6 +324,18 @@ impl Settings {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn for_display(&self, display: &str, project: &str) -> Layout {
|
||||
self.display_layouts.get(display).map_or_else(
|
||||
|| self.for_project(project),
|
||||
|profile| {
|
||||
profile
|
||||
.projects
|
||||
.get(project)
|
||||
.unwrap_or(&profile.layout)
|
||||
.clone()
|
||||
},
|
||||
)
|
||||
}
|
||||
pub fn for_project(&self, key: &str) -> Layout {
|
||||
self.projects.get(key).unwrap_or(&self.layout).clone()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,18 @@ pub enum Action {
|
|||
ImportNotes(PathBuf),
|
||||
ApplyNotesImport,
|
||||
Go(usize),
|
||||
Navigate { delta: i32, repeated: bool },
|
||||
Navigate {
|
||||
delta: i32,
|
||||
repeated: bool,
|
||||
},
|
||||
FinishNavigation,
|
||||
Blank,
|
||||
SaveDisplayLayout {
|
||||
display: String,
|
||||
project: bool,
|
||||
layout: Layout,
|
||||
},
|
||||
UseDisplayDefault(String),
|
||||
SaveProject,
|
||||
SaveGlobal,
|
||||
UseGlobal,
|
||||
|
|
@ -74,9 +83,16 @@ pub struct RouteTrial {
|
|||
presenter_fullscreen: bool,
|
||||
presentation_fullscreen: bool,
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct PresenterView {
|
||||
pub layout: Layout,
|
||||
pub layout_open: bool,
|
||||
pub menu_open: bool,
|
||||
}
|
||||
pub struct Studio {
|
||||
pub settings: Settings,
|
||||
pub layout: Layout,
|
||||
pub presenter_views: HashMap<String, PresenterView>,
|
||||
pub monitors: Vec<Monitor>,
|
||||
pub routes: Routes,
|
||||
pub draft_routes: Routes,
|
||||
|
|
@ -186,6 +202,7 @@ impl Studio {
|
|||
Self {
|
||||
settings: Settings::default(),
|
||||
layout: Layout::default(),
|
||||
presenter_views: HashMap::new(),
|
||||
monitors: vec![],
|
||||
routes: Routes::default(),
|
||||
draft_routes: Routes::default(),
|
||||
|
|
@ -347,6 +364,39 @@ impl Studio {
|
|||
.into();
|
||||
}
|
||||
}
|
||||
fn ensure_display_profile(&mut self, display: &str) -> bool {
|
||||
if display.is_empty()
|
||||
|| display.len() > 1024
|
||||
|| (self.settings.display_layouts.len() >= 128
|
||||
&& !self.settings.display_layouts.contains_key(display))
|
||||
{
|
||||
self.status = "Cannot save another display layout.".into();
|
||||
return false;
|
||||
}
|
||||
let layout = self.settings.layout.clone();
|
||||
self.settings
|
||||
.display_layouts
|
||||
.entry(display.into())
|
||||
.or_insert_with(|| settings::DisplayLayouts {
|
||||
layout,
|
||||
projects: Default::default(),
|
||||
});
|
||||
true
|
||||
}
|
||||
pub fn take_presenter_view(&mut self, display: &str) -> PresenterView {
|
||||
if let Some(view) = self.presenter_views.remove(display) {
|
||||
return view;
|
||||
}
|
||||
// Retain disconnected screens during ordinary hotplug, with bounded session state.
|
||||
if self.presenter_views.len() >= 128 {
|
||||
self.presenter_views
|
||||
.retain(|id, _| self.routes.presenter.contains(id));
|
||||
}
|
||||
PresenterView {
|
||||
layout: self.settings.for_display(display, &self.project()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
pub fn timer_limit(&self) -> Option<Duration> {
|
||||
(self.layout.timer_mode == settings::TimerMode::Countdown)
|
||||
.then(|| Duration::from_secs(self.layout.countdown_seconds as u64))
|
||||
|
|
@ -531,6 +581,70 @@ impl Studio {
|
|||
}
|
||||
self.new_output = true;
|
||||
}
|
||||
Action::SaveDisplayLayout {
|
||||
display,
|
||||
project,
|
||||
mut layout,
|
||||
} => {
|
||||
if !self.ensure_display_profile(&display) {
|
||||
return;
|
||||
}
|
||||
let key = self.project();
|
||||
// Timer behavior remains shared; only its appearance belongs to a monitor.
|
||||
layout.timer_mode = self.layout.timer_mode;
|
||||
layout.countdown_seconds = self.layout.countdown_seconds;
|
||||
layout.timer_autostart = self.layout.timer_autostart;
|
||||
if project {
|
||||
let total: usize = self
|
||||
.settings
|
||||
.display_layouts
|
||||
.values()
|
||||
.map(|p| p.projects.len())
|
||||
.sum();
|
||||
if total >= 4096
|
||||
&& !self.settings.display_layouts[&display]
|
||||
.projects
|
||||
.contains_key(&key)
|
||||
{
|
||||
self.status = "Too many saved display/project layouts.".into();
|
||||
return;
|
||||
}
|
||||
let mut shared = self.settings.for_project(&key);
|
||||
shared.timer_mode = layout.timer_mode;
|
||||
shared.countdown_seconds = layout.countdown_seconds;
|
||||
shared.timer_autostart = layout.timer_autostart;
|
||||
self.settings.projects.insert(key.clone(), shared);
|
||||
self.settings
|
||||
.display_layouts
|
||||
.get_mut(&display)
|
||||
.unwrap()
|
||||
.projects
|
||||
.insert(key, layout);
|
||||
} else {
|
||||
self.settings.layout.timer_mode = layout.timer_mode;
|
||||
self.settings.layout.countdown_seconds = layout.countdown_seconds;
|
||||
self.settings.layout.timer_autostart = layout.timer_autostart;
|
||||
self.settings
|
||||
.display_layouts
|
||||
.get_mut(&display)
|
||||
.unwrap()
|
||||
.layout = layout;
|
||||
}
|
||||
self.pending_save = true;
|
||||
}
|
||||
Action::UseDisplayDefault(display) => {
|
||||
if !self.ensure_display_profile(&display) {
|
||||
return;
|
||||
}
|
||||
let key = self.project();
|
||||
let profile = self.settings.display_layouts.get_mut(&display).unwrap();
|
||||
profile.projects.remove(&key);
|
||||
let layout = profile.layout.clone();
|
||||
if let Some(view) = self.presenter_views.get_mut(&display) {
|
||||
view.layout = layout;
|
||||
}
|
||||
self.pending_save = true;
|
||||
}
|
||||
Action::SaveProject => {
|
||||
let key = self.project();
|
||||
self.settings.projects.insert(key, self.layout.clone());
|
||||
|
|
@ -879,6 +993,7 @@ impl Studio {
|
|||
self.settings = settings;
|
||||
self.set_zoom(crate::zoom::View::default());
|
||||
self.layout = self.settings.for_project(&self.project());
|
||||
self.presenter_views.clear();
|
||||
self.routes = Routes::default();
|
||||
}
|
||||
self.dirty_routes = true;
|
||||
|
|
@ -1002,6 +1117,7 @@ impl Studio {
|
|||
self.timer = crate::timer::Timer::default();
|
||||
self.displayed = None;
|
||||
self.layout = self.settings.for_project(&info.key);
|
||||
self.presenter_views.clear();
|
||||
self.status = info.warnings.first().cloned().unwrap_or_else(|| {
|
||||
format!(
|
||||
"Opened {} slides. Preparing first slide…",
|
||||
|
|
|
|||
|
|
@ -1056,6 +1056,15 @@ fn progress_bar_height_changes_rendered_geometry() {
|
|||
output.shapes.iter().any(|s| contains_bar(&s.shape, height)),
|
||||
"Missing bar at height {height}"
|
||||
);
|
||||
let display = format!("display-{height}");
|
||||
let mut view = s.take_presenter_view(&display);
|
||||
view.layout = s.layout.clone();
|
||||
s.presenter_views.insert(display.clone(), view);
|
||||
s.layout.slide_progress_height = 32.; // Shared fallback must not set this display's height.
|
||||
let output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut native, &display)
|
||||
});
|
||||
assert!(output.shapes.iter().any(|s| contains_bar(&s.shape, height)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1587,3 +1596,107 @@ fn one_presenter_confirmation_dismisses_both_presenters_on_three_monitors() {
|
|||
assert_eq!(s.routes, expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn presenter_layouts_are_display_scoped_and_save_actions_keep_the_origin() {
|
||||
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,
|
||||
}
|
||||
}
|
||||
let mut s = studio();
|
||||
s.routes.presenter = vec!["one".into(), "two".into()];
|
||||
s.routes.presentation.clear();
|
||||
s.settings.routes = s.routes.clone();
|
||||
let main = s.take_presenter_view("one");
|
||||
let main_layout = main.layout.clone();
|
||||
s.presenter_views.insert("one".into(), main);
|
||||
let mut second = s.take_presenter_view("two");
|
||||
second.layout_open = true;
|
||||
second.layout.notes.show = false;
|
||||
second.layout.current.size = 180.;
|
||||
second.layout.clock_position = pdf_presenter::settings::TimerPosition::LeftOfSlides;
|
||||
s.presenter_views.insert("two".into(), second);
|
||||
s.layout.timer_mode = pdf_presenter::settings::TimerMode::Countdown;
|
||||
s.layout.countdown_seconds = 99;
|
||||
let contexts = [Context::default(), Context::default()];
|
||||
let mut natives = [UiState::default(), UiState::default()];
|
||||
let size = Vec2::new(1400., 1000.);
|
||||
// Only the second presenter's Layout panel is open.
|
||||
let main_output = contexts[0].run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut natives[0], "one")
|
||||
});
|
||||
assert!(
|
||||
main_output
|
||||
.shapes
|
||||
.iter()
|
||||
.all(|shape| find(&shape.shape, "Save layout · All projects").is_none())
|
||||
);
|
||||
let mut output = contexts[1].run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut natives[1], "two")
|
||||
});
|
||||
for _ in 0..2 {
|
||||
output = contexts[1].run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut natives[1], "two")
|
||||
});
|
||||
}
|
||||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|shape| find(&shape.shape, "Save layout · All projects"))
|
||||
.unwrap();
|
||||
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 _ = contexts[1].run_ui(raw, |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut natives[1], "two")
|
||||
});
|
||||
}
|
||||
assert!(
|
||||
s.actions
|
||||
.iter()
|
||||
.any(|a| matches!(a, Action::SaveDisplayLayout { display, .. } if display == "two"))
|
||||
);
|
||||
// Another presenter renders before the queued save: it cannot steal the save's scope.
|
||||
let _ = contexts[0].run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter_on_display(ui, &mut s, &mut natives[0], "one")
|
||||
});
|
||||
for action in std::mem::take(&mut s.actions) {
|
||||
s.execute(action);
|
||||
}
|
||||
assert_eq!(s.presenter_views["one"].layout, main_layout);
|
||||
assert!(!s.settings.for_display("two", "demo").notes.show);
|
||||
assert!(s.settings.for_display("one", "demo").notes.show);
|
||||
assert_eq!(s.settings.layout.countdown_seconds, 99);
|
||||
assert_eq!(s.timer_limit(), Some(std::time::Duration::from_secs(99)));
|
||||
assert!(!s.settings.display_layouts.contains_key("one"));
|
||||
let mut project_layout = s.presenter_views["two"].layout.clone();
|
||||
project_layout.notes.show = true;
|
||||
s.execute(Action::SaveDisplayLayout {
|
||||
display: "two".into(),
|
||||
project: true,
|
||||
layout: project_layout.clone(),
|
||||
});
|
||||
assert!(s.settings.for_display("two", "demo").notes.show);
|
||||
assert!(!s.settings.for_display("two", "other").notes.show);
|
||||
s.execute(Action::UseDisplayDefault("two".into()));
|
||||
assert!(!s.presenter_views["two"].layout.notes.show);
|
||||
let all = s.monitors.clone();
|
||||
s.set_monitors(vec![all[0].clone()], 0);
|
||||
s.set_monitors(all, 0);
|
||||
assert!(!s.presenter_views["two"].layout.notes.show);
|
||||
// Restart/source change discards transient views but keeps the display profiles.
|
||||
let restored = s.settings.for_display("two", "demo");
|
||||
s.presenter_views.clear();
|
||||
assert_eq!(s.take_presenter_view("two").layout, restored);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,3 +235,71 @@ fn timer_and_progress_settings_migrate_validate_and_roundtrip() {
|
|||
}
|
||||
assert!(toml::from_str::<Settings>("[layout]\ntimer_mode='unknown'").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_layout_profiles_roundtrip_migrate_and_validate() {
|
||||
use settings::DisplayLayouts;
|
||||
let mut s: Settings =
|
||||
toml::from_str("version=1\n[layout.notes]\nshow=true\nsize=40.0").unwrap();
|
||||
assert!(s.display_layouts.is_empty());
|
||||
let mut legacy_project = s.layout.clone();
|
||||
legacy_project.notes.size = 55.;
|
||||
s.projects.insert("show".into(), legacy_project.clone());
|
||||
assert_eq!(s.for_display("main#1", "show"), legacy_project);
|
||||
let mut alternate = Layout::default();
|
||||
alternate.current.size = 180.;
|
||||
alternate.notes.show = false;
|
||||
alternate.header = false;
|
||||
alternate.clock_position = settings::TimerPosition::RightOfSlides;
|
||||
let mut project = alternate.clone();
|
||||
project.slide_progress = true;
|
||||
s.display_layouts.insert(
|
||||
"Side screen#1".into(),
|
||||
DisplayLayouts {
|
||||
layout: alternate.clone(),
|
||||
projects: [("show".into(), project.clone())].into(),
|
||||
},
|
||||
);
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
settings::write(&path, &s).unwrap();
|
||||
let loaded = settings::read(&path).unwrap();
|
||||
assert_eq!(loaded.for_display("Side screen#1", "show"), project);
|
||||
assert_eq!(loaded.for_display("Side screen#1", "other"), alternate);
|
||||
assert_eq!(loaded.for_display("main#1", "show"), legacy_project);
|
||||
let mut bad = loaded.clone();
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.layout
|
||||
.notes
|
||||
.size = f32::NAN;
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.projects
|
||||
.get_mut("show")
|
||||
.unwrap()
|
||||
.current
|
||||
.size = 0.;
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
bad.display_layouts.insert("".into(), Default::default());
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
for i in 0..128 {
|
||||
bad.display_layouts
|
||||
.insert(format!("display-{i}"), Default::default());
|
||||
}
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded;
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.projects = (0..4097)
|
||||
.map(|i| (format!("project-{i}"), Layout::default()))
|
||||
.collect();
|
||||
assert!(bad.validate().is_err());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,21 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.76
|
||||
|
||||
- Give every presenter display its own complete visual layout, presets, local
|
||||
customization panel/menu and saved project/all-project profiles. Profiles follow
|
||||
monitor IDs through reconnects; existing settings remain the fallback.
|
||||
- Keep slide navigation, output confirmation and timer behavior shared, while
|
||||
widget visibility, sizing, placement and bars are independent. Scoped saves
|
||||
retain their originating display even when another presenter renders first.
|
||||
- Add bounded, backward-compatible v1 display layout profiles with examples,
|
||||
validation/round-trip tests and multi-presenter save/reconnect regression coverage.
|
||||
Linux workspace/native tests, 13 Python tests, formatting and warnings-denied
|
||||
Clippy/rustdoc pass; whole-application coverage is 84.78% (75% floor). The Linux
|
||||
release binary is rebuilt. Windows/macOS builds and physical display testing
|
||||
remain open; no release was published.
|
||||
|
||||
### 0.1.75
|
||||
|
||||
- Prepare the 0.1.75 preview release with Linux/Windows x86_64 packages and a
|
||||
|
|
|
|||
|
|
@ -440,3 +440,26 @@ other presenter windows. Physical multi-monitor verification remains open.
|
|||
Linux workspace/native tests, 13 Python helper tests, formatting and warnings-denied
|
||||
Clippy/rustdoc pass. Whole-application coverage is 84.56% (75% floor). The Linux
|
||||
release binary is rebuilt; Windows/macOS builds and publication were not performed.
|
||||
|
||||
|
||||
## 0.1.76 display-bound presenter layouts
|
||||
|
||||
Native presenter rendering takes a PresenterView by monitor ID from shared Studio
|
||||
session state. Each view owns its visual Layout and menu/layout-panel visibility;
|
||||
no temporary substitution of shared Studio layout state is used during rendering.
|
||||
The shared timer still reads the shared project/global timer configuration, and
|
||||
navigation/output/recovery state remain shared. Scoped save actions carry both
|
||||
monitor ID and a layout snapshot so another window rendering before dispatch cannot
|
||||
redirect a save. Settings persistence remains on the existing supervised worker.
|
||||
|
||||
The additive v1 display_layouts contract, bounds, fallback precedence and examples
|
||||
are documented in settings.md. Explicit saves persist per-display project/default
|
||||
profiles. Session edits survive ordinary hotplug; successful source/settings loads
|
||||
resolve profiles afresh. Per-window Escape dismisses only its local panels, while
|
||||
trial recovery retains priority. Native smoke exercises the actual display-scoped
|
||||
panels, and headless multi-context tests exercise save origin and isolation.
|
||||
|
||||
Validation: Linux workspace/native tests, 13 Python helper tests, formatting and
|
||||
warnings-denied Clippy/rustdoc pass. Whole-application coverage is 84.78% against
|
||||
the 75% floor. The Linux release binary is rebuilt. Windows/macOS builds and
|
||||
physical multi-presenter customization/reconnect acceptance remain open.
|
||||
|
|
|
|||
|
|
@ -35,3 +35,16 @@ footer = false
|
|||
[layout.current]
|
||||
show = false
|
||||
size = 60.0
|
||||
|
||||
# Optional per-display visual profiles (0.1.76+).
|
||||
[display_layouts."Secondary#1".layout]
|
||||
header = false
|
||||
clock_position = "left_of_slides"
|
||||
|
||||
[display_layouts."Secondary#1".layout.notes]
|
||||
show = false
|
||||
size = 35.0
|
||||
|
||||
[display_layouts."Secondary#1".projects."0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"]
|
||||
slide_progress = true
|
||||
slide_progress_height = 40.0
|
||||
|
|
|
|||
|
|
@ -77,7 +77,35 @@ flushed temporary file. Unknown fields are ignored and not preserved on round tr
|
|||
Start after expiry restarts the configured duration immediately.
|
||||
- `projects`: at most 4096 SHA-256 canonical-path keys mapping to full layouts.
|
||||
Path identity uses OS encoded bytes, not source content. Moving files or switching
|
||||
platforms may therefore select a different layout. Project overrides win globally.
|
||||
platforms may therefore select a different layout. These remain the shared timer
|
||||
settings and the legacy visual fallback for displays without profiles.
|
||||
- `display_layouts`: optional map added in 0.1.76; keys are the same monitor IDs
|
||||
used by routes (`native-name#occurrence`), not presenter indexes or primary status.
|
||||
At most 128 profiles; keys are nonempty UTF-8 strings of at most 1024 bytes.
|
||||
Each profile contains `layout` (all-project visual default) and `projects`
|
||||
(canonical-path SHA keys to visual overrides). At most 4096 display/project
|
||||
overrides in total. All nested Layout fields use the existing units, ranges and
|
||||
validation above, including finite sizes. Missing maps are empty; old v1 files
|
||||
require no rewrite/migration. Older binaries ignore these additive profiles and
|
||||
discard them on resave.
|
||||
Resolution is display/project override → display default → legacy project/global
|
||||
layout if there is no display profile. The first save creates a profile whose
|
||||
default is copied from the legacy global layout; Save all projects replaces that
|
||||
display default, Save this project stores only that display's project override,
|
||||
and Use all-project layout removes only that display's project override.
|
||||
The three timer-behavior fields (`timer_mode`, `countdown_seconds`,
|
||||
`timer_autostart`) in display layouts are compatibility copies, not independent
|
||||
timers. Their authoritative values remain the shared legacy project/global
|
||||
layout; scoped saves also save those shared timer fields. Timer visibility, size
|
||||
and position are independent per display. Use all-project layout only resets the
|
||||
current display's visuals and leaves shared timer behavior unchanged.
|
||||
Runtime edits are retained by display ID across ordinary window recreation and
|
||||
hotplug, but only explicit Save persists them. Successful source/settings loads
|
||||
resolve saved profiles afresh; failed source loads preserve current edits.
|
||||
Session view state is bounded to 128 retained displays, pruning disconnected
|
||||
entries when that limit is reached. Menus/panel visibility are per presenter and
|
||||
transient. Reordering monitors/roles does not copy a layout to another ID;
|
||||
indistinguishable native names still share the existing route identifier limits.
|
||||
- `routes.presenter` and `routes.presentation`: arrays of monitor identifiers
|
||||
(`native-name#occurrence`), disjoint and unique, at most 32 entries combined.
|
||||
Saved preferences are not overwritten by temporary missing-monitor fallback.
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ navigation or zoom.
|
|||
|
||||
## Layout and notes
|
||||
|
||||
Each presenter display has its own Layout controls and saved layout. Open Layout
|
||||
on the display you want to customize; the panel identifies that display. Presets,
|
||||
widget visibility/sizes/positions and header/footer settings affect only that screen.
|
||||
|
||||
Layout independently enables and sizes previous/current/next slides, notes, elapsed
|
||||
time and the local HH:MM clock. Hidden widgets release their space. Notes wrap and
|
||||
automatically shrink to fit; extremely long notes can become too small to read.
|
||||
|
|
@ -121,9 +125,13 @@ when you want it. Saved layouts keep their chosen visibility.
|
|||
The header's **Reset timer** button returns elapsed time to zero and arms it for the next presentation action. Bundled UI fonts cover their supplied
|
||||
character sets; broad CJK text coverage remains a packaging acceptance item.
|
||||
|
||||
Save layout (this project) stores an override for the canonical document/folder path.
|
||||
Save layout (all projects) changes the default; existing project overrides win.
|
||||
Use all-project layout removes this project's override. Project settings live in the
|
||||
Save layout (this project) stores an override for this display and the canonical
|
||||
document/folder path. Save layout (all projects) changes this display's default;
|
||||
its existing project overrides win. Use all-project layout removes only this
|
||||
display's override. Other presenter layouts are unaffected. Timer mode, duration,
|
||||
automatic start and start/pause/reset stay shared; timer appearance is per display.
|
||||
Layouts follow the same display identities as the routing settings on reconnect.
|
||||
Existing layouts remain the fallback until you save a display-specific profile. Project settings live in the
|
||||
user configuration, not in or beside the source document. Moving the source changes
|
||||
its project identity. The menu shows the configuration location.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue