mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 10:47:56 +01:00
Contract stubs: refresh-app
Written by a Codex stage agent; committed by bin/codex-stubs (the sandbox keeps .git read-only).
This commit is contained in:
1 parent
87271ea907
commit
f8023e17c0
105 files changed
+1105
-362
No files matched your search
Generated
+1
@@ -2474,6 +2474,7 @@ dependencies = [
|
||||
name = "deckcraft-web"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft",
|
||||
"craft-web-api",
|
||||
"craft-web-host",
|
||||
"deckcraft-engine",
|
||||
|
||||
@@ -14,6 +14,7 @@ name = "deckcraft-web"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
craft = { workspace = true, features = ["ui", "web-host"] }
|
||||
deckcraft-engine = { workspace = true }
|
||||
deckcraft-ui-egui = { workspace = true }
|
||||
# The page command API (storytold/craft-libs#413): window.deckcraft over the control channel.
|
||||
|
||||
@@ -272,8 +272,10 @@ impl Popup {
|
||||
impl eframe::App for Popup {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
|
||||
let snapshot = self.snapshot.borrow();
|
||||
let notes = snapshot.as_ref().map_or("", |snapshot| snapshot.notes.as_str());
|
||||
if !self.view.prepare(ui.ctx(), notes) {
|
||||
// P3(show-w8): ss.A11
|
||||
let notes = snapshot.as_ref().map(|snapshot| snapshot.notes.text()).unwrap_or_default();
|
||||
// P3(show-w8): ss.A11
|
||||
if !self.view.prepare(ui.ctx(), ¬es) {
|
||||
return;
|
||||
}
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_millis(500));
|
||||
@@ -304,3 +306,30 @@ impl Drop for Popup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates the opener side of the presenter popup link.
|
||||
#[allow(dead_code)] // P3(show-w8): ss.A13
|
||||
pub fn opener(ctx: &egui::Context) -> Option<Box<dyn craft::web_host::link::WindowLink>> {
|
||||
let _ = (ctx,);
|
||||
todo!("ss.A13")
|
||||
}
|
||||
|
||||
/// The popup page showing the presenter body as its own show scope instance.
|
||||
#[allow(dead_code)] // P3(show-w8): ss.A13
|
||||
pub struct PopupApp;
|
||||
|
||||
impl PopupApp {
|
||||
/// Installs the popup runtime and opens its presenter page, reporting an unavailable peer.
|
||||
#[allow(dead_code)] // P3(show-w8): ss.A13
|
||||
pub fn new(ctx: &egui::Context, install: craft::ui::runtime::InstallSpec) -> Result<Self, String> {
|
||||
let _ = (ctx, install);
|
||||
todo!("ss.A13")
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for PopupApp {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {
|
||||
let _ = (ui, frame);
|
||||
todo!("ss.A13")
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,8 @@ pub fn start() {
|
||||
if let Some(bridge) = &app_bridge {
|
||||
bridge.connect(&mut services, cc.egui_ctx.clone());
|
||||
}
|
||||
let mut app = SlideApp::new(Session::new(), services);
|
||||
// P3(platform-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), services);
|
||||
// In host mode the parent sends the presentation to edit; no sample meanwhile.
|
||||
if app_bridge.is_some() {
|
||||
if let Err(e) = app.start_for_host() {
|
||||
@@ -135,7 +136,8 @@ impl eframe::App for WebShell {
|
||||
bridge.report_dirty(&self.app);
|
||||
}
|
||||
if self.app.show.is_none()
|
||||
&& let Some(host) = self.app.services.presenter.as_mut()
|
||||
// P3(platform-w5): sh.A9
|
||||
&& let Some(host) = self.app.services.presenter_base.as_mut()
|
||||
{
|
||||
host.close();
|
||||
}
|
||||
@@ -185,7 +187,8 @@ fn services(inbox: Inbox, ctx: egui::Context) -> Services {
|
||||
}
|
||||
};
|
||||
Services {
|
||||
presenter,
|
||||
// P3(platform-w5): sh.A9
|
||||
presenter_base: presenter,
|
||||
open_async: Some(Box::new(move |purpose: &str, request: u64| {
|
||||
let inbox = open_inbox.clone();
|
||||
let ctx = ctx.clone();
|
||||
|
||||
@@ -268,7 +268,8 @@ fn timed_out_request_does_not_run_when_the_window_resumes() {
|
||||
let t = reply(&mut r).unwrap();
|
||||
assert_eq!(t["error"], "timeout");
|
||||
// The window resumes and drains the queue, exactly as `SlideApp::drain_control` does.
|
||||
let mut app = deckcraft_ui_egui::SlideApp::new(deckcraft_engine::Session::with_new(), deckcraft_ui_egui::Services::default());
|
||||
// P3(platform-w3): sh.A2
|
||||
let mut app = deckcraft_ui_egui::SlideApp::new_base(deckcraft_engine::Session::with_new(), deckcraft_ui_egui::Services::default());
|
||||
let ctx = egui::Context::default();
|
||||
let before = app.session.active().unwrap().doc.slides.len();
|
||||
let req = rx.try_recv().expect("the timed-out request is still queued");
|
||||
|
||||
@@ -392,7 +392,8 @@ fn main() -> eframe::Result {
|
||||
options,
|
||||
Box::new(move |cc| {
|
||||
deckcraft_ui_egui::install_ime_pass_hooks(&cc.egui_ctx);
|
||||
let mut app = SlideApp::new(Session::new(), services);
|
||||
// P3(platform-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), services);
|
||||
// Presenter View asks winit how many displays there are when a show starts.
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
if let Some(window) = cc.winit_window().cloned() {
|
||||
@@ -458,7 +459,8 @@ mod tests {
|
||||
fn on_exit_ends_the_process_on_macos() {
|
||||
if std::env::var_os("DECKCRAFT_TEST_ON_EXIT").is_some() {
|
||||
let mut app = App(
|
||||
SlideApp::new(Session::new(), Services::default()),
|
||||
// P3(platform-w3): sh.A2
|
||||
SlideApp::new_base(Session::new(), Services::default()),
|
||||
#[cfg(target_os = "macos")]
|
||||
fmv_macos_events::Inbox::default(),
|
||||
);
|
||||
@@ -543,7 +545,8 @@ mod tests {
|
||||
let runs = std::rc::Rc::new(std::cell::Cell::new(0));
|
||||
let counted = runs.clone();
|
||||
let services = Services { at_exit: Some(Box::new(move || counted.set(counted.get() + 1))), ..Default::default() };
|
||||
let mut app = App(SlideApp::new(Session::new(), services));
|
||||
// P3(platform-w3): sh.A2
|
||||
let mut app = App(SlideApp::new_base(Session::new(), services));
|
||||
eframe::App::on_exit(&mut app);
|
||||
assert_eq!(runs.get(), 1);
|
||||
eframe::App::on_exit(&mut app);
|
||||
|
||||
@@ -19,7 +19,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
s.execute("animation.add", &json!({"effect": effect, "start": start, "duration": dur})).unwrap();
|
||||
}
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w11): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("animation".into());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -35,11 +35,14 @@ impl SlideApp {
|
||||
/// Remove temporary PDFs created for printing.
|
||||
pub fn cleanup_print_previews(&mut self) {
|
||||
self.print_previews.cleanup();
|
||||
// P3(shell-w11): sh.A8
|
||||
self.print_previews_base.cleanup();
|
||||
}
|
||||
|
||||
/// Build application UI state, taking ownership of audio output and initialising media, dialogs,
|
||||
/// synthetic input, and timing fields.
|
||||
pub fn new(session: Session, mut services: Services) -> Self {
|
||||
// P3(shell-w11): sh.A2
|
||||
pub fn new_base(session: Session, mut services: Services) -> Self {
|
||||
let audio_out = services.audio_out.take();
|
||||
// P3(shell-w11): sh.A8
|
||||
let catalog = match craft::ui::runtime::commands::AppCatalog::new(Vec::new(), 0) {
|
||||
@@ -143,6 +146,8 @@ impl SlideApp {
|
||||
opening_generation: 0,
|
||||
canvas_rect: None,
|
||||
eyedropper: None,
|
||||
// P3(shell-w11): cv.A1
|
||||
eyedropper_base: None,
|
||||
canvas_scale: 1.0,
|
||||
slide_rect: None,
|
||||
canvas_region: None,
|
||||
@@ -150,7 +155,9 @@ impl SlideApp {
|
||||
integrated_titlebar: false,
|
||||
backstage: None,
|
||||
pending_urls: vec![],
|
||||
print_previews: files::PrintPreviews::default(),
|
||||
print_previews: Default::default(),
|
||||
// P3(shell-w11): sh.A8
|
||||
print_previews_base: files::PrintPreviews::default(),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
updates_rt: updates_ui::Runtime::default(),
|
||||
pending_copy: None,
|
||||
@@ -377,7 +384,8 @@ impl SlideApp {
|
||||
self.opening_ui(&ctx);
|
||||
if self.show.is_some() {
|
||||
self.anim_preview = None;
|
||||
show::ui(self, ui);
|
||||
// P3(shell-w11): ss.A9
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| show::ui(self, ui, cx));
|
||||
doc_window::show(self, &ctx);
|
||||
self.perf.frame_ms = now_ms() - t0;
|
||||
self.ui_end(&ctx);
|
||||
@@ -488,3 +496,12 @@ impl crate::SlideApp {
|
||||
todo!("cv.A1")
|
||||
}
|
||||
}
|
||||
|
||||
impl SlideApp {
|
||||
/// Installs the runtime, app icons, fonts and looks, and opens the platform settings store.
|
||||
/// Keeps the installed host and builds spelling jobs over its shared job service.
|
||||
pub fn new(ctx: &egui::Context, platform: crate::Platform) -> Result<SlideApp, craft::ui::runtime::InstallError> {
|
||||
let _ = (ctx, platform);
|
||||
todo!("sh.A2")
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,8 @@ impl SlideApp {
|
||||
let bytes = deckcraft_engine::cmd::file::pdf_bytes(&doc, ¶ms);
|
||||
return self.download(&format!("{title}.pdf"), bytes);
|
||||
}
|
||||
let preview_path = match self.print_previews.create(&title) {
|
||||
// P3(shell-w6): sh.A8
|
||||
let preview_path = match self.print_previews_base.create(&title) {
|
||||
Ok(path) => path,
|
||||
Err(e) => {
|
||||
self.set_status(format!("Couldn't create a private print preview: {e}"));
|
||||
@@ -290,7 +291,8 @@ impl SlideApp {
|
||||
true
|
||||
}
|
||||
Err(_) => {
|
||||
self.print_previews.discard(&preview_path);
|
||||
// P3(shell-w6): sh.A8
|
||||
self.print_previews_base.discard(&preview_path);
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,8 @@ impl SlideApp {
|
||||
let visible = show::viewport_visible(ctx);
|
||||
let Some(doc) = self.session.active().map(|d| d.doc.clone()) else { return };
|
||||
let Some(show) = self.show.as_mut() else { return };
|
||||
if show.presenter_grid && self.services.presenter.as_ref().is_some_and(|host| !host.is_open()) {
|
||||
// P3(show-w9): sh.A9
|
||||
if show.presenter_grid && self.services.presenter_base.as_ref().is_some_and(|host| !host.is_open()) {
|
||||
// A web popup closed with its grid open must not hold auto-advance while this tab is hidden (#1866).
|
||||
show.presenter_grid = false;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ fn tile(ui: &mut Ui, label: &str, theme: Option<&deckcraft_model::Theme>, big: b
|
||||
}
|
||||
let thumb = Rect::from_min_size(rect.min + vec2(8.0, 10.0), vec2(thumb_w, thumb_w * 9.0 / 16.0));
|
||||
match theme {
|
||||
Some(th) => crate::ribbon::paint_theme_tile(p, thumb, th),
|
||||
// P3(shell-w7): rb.A20
|
||||
Some(th) => crate::ribbon::paint_theme_tile_base(p, thumb, th),
|
||||
None => {
|
||||
p.rect_filled(thumb, CornerRadius::same(2), Color32::WHITE);
|
||||
p.rect_stroke(thumb, CornerRadius::same(2), Stroke::new(1.0, Color32::from_gray(200)), StrokeKind::Inside);
|
||||
|
||||
@@ -29,7 +29,8 @@ fn harness(app: SlideApp) -> Harness<'static, SlideApp> {
|
||||
}
|
||||
|
||||
fn new_app() -> SlideApp {
|
||||
SlideApp::new(Session::with_new(), Services::default())
|
||||
// P3(shell-w7): sh.A2
|
||||
SlideApp::new_base(Session::with_new(), Services::default())
|
||||
}
|
||||
|
||||
/// A folder of its own for one test's files.
|
||||
@@ -243,7 +244,8 @@ fn open_lists_recent_files_and_opens_one() {
|
||||
let path = dir.join("Quarterly review.pptx").to_string_lossy().to_string();
|
||||
let mut s = Session::with_new();
|
||||
s.execute("file.saveAs", &json!({"path": path})).unwrap();
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.recent = vec![path.clone(), dir.join("Other.pptx").to_string_lossy().to_string()];
|
||||
let mut h = harness(app);
|
||||
h.state_mut().run("app.backstage", json!({"page": "open"})).unwrap();
|
||||
@@ -276,7 +278,8 @@ fn open_lists_recent_files_and_opens_one() {
|
||||
fn save_as_and_export_run_the_file_commands() {
|
||||
let dir = temp_dir("saveas");
|
||||
let (services, asked) = saving_into(&dir);
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), services));
|
||||
let title = h.state().session.active().unwrap().title();
|
||||
|
||||
// Save on a presentation without a file goes to Save As.
|
||||
@@ -329,7 +332,8 @@ fn save_as_and_export_run_the_file_commands() {
|
||||
fn change_file_type_png_can_leave_the_background_transparent() {
|
||||
let dir = temp_dir("png-clear");
|
||||
let (services, _) = saving_into(&dir);
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), services));
|
||||
h.state_mut().run("app.backstage", json!({"page": "export"})).unwrap();
|
||||
h.run_steps(3);
|
||||
click_on_page(&h, "Change File Type");
|
||||
@@ -354,7 +358,8 @@ fn change_file_type_png_can_leave_the_background_transparent() {
|
||||
fn change_file_type_exports_all_slides_as_pictures() {
|
||||
let dir = temp_dir("all-slides");
|
||||
let (services, asked) = saving_into(&dir);
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), services));
|
||||
h.state_mut().run("slide.new", json!({})).unwrap();
|
||||
h.state_mut().run("slide.new", json!({})).unwrap();
|
||||
let title = h.state().session.active().unwrap().title();
|
||||
@@ -462,7 +467,8 @@ fn host_close_prompt_keeps_the_presentation_when_the_save_fails() {
|
||||
download: Some(Box::new(|_: &str, _: &[u8]| {})),
|
||||
..Default::default()
|
||||
};
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), services));
|
||||
h.state_mut().run("slide.new", json!({})).unwrap();
|
||||
h.run_steps(2);
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::W);
|
||||
@@ -496,7 +502,8 @@ fn host_save_as_under_the_same_name_returns_to_the_slide() {
|
||||
download: Some(Box::new(|_: &str, _: &[u8]| {})),
|
||||
..Default::default()
|
||||
};
|
||||
let mut app = SlideApp::new(Session::new(), services);
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), services);
|
||||
app.start_for_host().unwrap();
|
||||
let deck = deckcraft_engine::cmd::file::save_bytes(&Session::with_new().doc().unwrap().doc, "pptx").unwrap();
|
||||
app.open_from_host(Some("deck.pptx"), &deck);
|
||||
@@ -557,7 +564,8 @@ fn info_saves_a_property_draft_when_save_is_clicked() {
|
||||
let path = dir.join("Draft.pptx").to_string_lossy().to_string();
|
||||
let mut s = Session::with_new();
|
||||
s.execute("file.saveAs", &json!({"path": path})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()));
|
||||
h.state_mut().run("app.backstage", json!({"page": "info"})).unwrap();
|
||||
h.run_steps(3);
|
||||
h.get_by_role_and_label(Role::TextInput, "Author").click();
|
||||
@@ -576,7 +584,8 @@ fn info_saves_a_property_draft_when_save_is_clicked() {
|
||||
/// has nowhere to go.
|
||||
#[test]
|
||||
fn the_start_screen_is_file_home() {
|
||||
let mut h = harness(SlideApp::new(Session::new(), Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), Services::default()));
|
||||
assert_eq!(page(&h), Some(Page::Home));
|
||||
assert!(h.query_by_label("Back").is_none());
|
||||
assert!(h.query_all_by_label("Info").next().is_none());
|
||||
@@ -597,7 +606,8 @@ fn the_start_screen_is_file_home() {
|
||||
/// edit a presentation while the File-tab navigation keys still work.
|
||||
#[test]
|
||||
fn start_screen_ignores_text_paste_and_ime_while_file_keys_navigate() {
|
||||
let mut h = harness(SlideApp::new(Session::new(), Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), Services::default()));
|
||||
assert_eq!(page(&h), Some(Page::Home));
|
||||
h.input_mut().events.extend([
|
||||
egui::Event::Text("x".into()),
|
||||
@@ -618,13 +628,15 @@ fn start_screen_ignores_text_paste_and_ime_while_file_keys_navigate() {
|
||||
/// Preferences. Both are in-app windows, so no native dialog is involved.
|
||||
#[test]
|
||||
fn start_screen_opens_the_palette_and_preferences() {
|
||||
let mut h = harness(SlideApp::new(Session::new(), Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), Services::default()));
|
||||
h.key_press_modifiers(Modifiers::COMMAND | Modifiers::SHIFT, Key::P);
|
||||
h.run_steps(3);
|
||||
assert!(h.state().palette.is_some(), "Ctrl+Shift+P opens the command palette");
|
||||
assert!(h.state().session.active().is_none(), "without creating a presentation");
|
||||
|
||||
let mut h = harness(SlideApp::new(Session::new(), Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), Services::default()));
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::Comma);
|
||||
h.run_steps(3);
|
||||
assert_eq!(h.state().dialog.as_ref().map(|d| d.id.as_str()), Some("preferences"), "Ctrl+, opens Preferences");
|
||||
@@ -644,7 +656,8 @@ fn start_screen_opens_files_and_the_file_tab_from_the_keyboard() {
|
||||
})),
|
||||
..Default::default()
|
||||
};
|
||||
let mut h = harness(SlideApp::new(Session::new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), services));
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::O);
|
||||
h.run_steps(3);
|
||||
let asked = opens.borrow();
|
||||
@@ -653,7 +666,8 @@ fn start_screen_opens_files_and_the_file_tab_from_the_keyboard() {
|
||||
assert!(h.state().session.active().is_none(), "a cancelled open leaves the start screen");
|
||||
assert_eq!(page(&h), Some(Page::Home));
|
||||
|
||||
let mut h = harness(SlideApp::new(Session::new(), Services::default()));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), Services::default()));
|
||||
assert_eq!(h.state().backstage.as_ref().and_then(|b| b.focus), None);
|
||||
h.key_press_modifiers(Modifiers::ALT, Key::F);
|
||||
h.run_steps(3);
|
||||
@@ -674,7 +688,8 @@ fn start_screen_ignores_document_shortcuts() {
|
||||
})),
|
||||
..Default::default()
|
||||
};
|
||||
let mut h = harness(SlideApp::new(Session::new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), services));
|
||||
for (mods, key) in [(Modifiers::COMMAND, Key::S), (Modifiers::COMMAND, Key::K), (Modifiers::COMMAND, Key::F), (Modifiers::COMMAND, Key::W)] {
|
||||
h.key_press_modifiers(mods, key);
|
||||
h.run_steps(2);
|
||||
@@ -697,7 +712,8 @@ fn a_file_that_cant_be_opened_says_why() {
|
||||
std::fs::write(&path, b"not a presentation").unwrap();
|
||||
let picked = path.to_string_lossy().to_string();
|
||||
let services = Services { pick_open: Some(Box::new(move |_: &str| Some(picked.clone()))), ..Default::default() };
|
||||
let mut h = harness(SlideApp::new(Session::new(), services));
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::new(), services));
|
||||
h.state_mut().run("app.backstage", json!({"page": "open"})).unwrap();
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Browse").click();
|
||||
@@ -722,7 +738,8 @@ fn a_file_that_cant_be_opened_says_why() {
|
||||
fn print_previews_pages_and_prints_a_pdf() {
|
||||
let dir = temp_dir("print");
|
||||
let (services, _) = saving_into(&dir);
|
||||
let mut app = SlideApp::new(Session::with_new(), services);
|
||||
// P3(shell-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), services);
|
||||
for _ in 0..3 {
|
||||
app.run("slide.new", json!({})).unwrap();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ fn browse_button_applies_the_picked_files_theme() {
|
||||
};
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "title", "title": "Hello"})).unwrap();
|
||||
let mut app = SlideApp::new(s, services);
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, services);
|
||||
app.ui.tab = "Design".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -32,7 +32,8 @@ use ime::ime_output;
|
||||
use input::resize_cursor;
|
||||
pub(crate) use input::{page_flick, trackpad_twist};
|
||||
use input::{pointer, trackpad_scroll, wheel_slide_target};
|
||||
use media::{gif_buttons, media_bar, media_frames};
|
||||
// P3(canvas-w6): cv.A3
|
||||
use media::{gif_buttons_base, media_bar, media_frames};
|
||||
use overlays::overlays;
|
||||
#[cfg(test)]
|
||||
pub(crate) use overlays::text_marks;
|
||||
@@ -344,7 +345,8 @@ pub fn show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
overlays(app, ui, &painter, xf, &t);
|
||||
ime_output(app, ui, xf);
|
||||
media_bar(app, ui, xf);
|
||||
gif_buttons(app, ui, xf, &gifs);
|
||||
// P3(canvas-w6): cv.A3
|
||||
gif_buttons_base(app, ui, xf, &gifs);
|
||||
if resp.secondary_clicked()
|
||||
&& let Some(p) = resp.interact_pointer_pos()
|
||||
{
|
||||
@@ -410,3 +412,5 @@ pub(crate) mod handles;
|
||||
pub(crate) mod picture;
|
||||
pub(crate) mod previews;
|
||||
pub(crate) mod tool;
|
||||
|
||||
pub(crate) mod text_host;
|
||||
@@ -13,7 +13,8 @@ fn turn_guides_on_drag_one_and_drop_it_off_the_slide() {
|
||||
let _gpu = crate::gpu_lock::gpu_lock();
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(canvas-w10): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use super::{Rect, Sense, SlideApp, Target, Ui, Xf, json, pos2, screen_rect, vec2};
|
||||
|
||||
/// Play/pause on an animated GIF under the pointer or selected on its own.
|
||||
pub(super) fn gif_buttons(app: &mut SlideApp, ui: &mut Ui, xf: Xf, gifs: &[crate::media::Gif]) {
|
||||
// P3(canvas-w14): cv.A3
|
||||
pub(super) fn gif_buttons_base(app: &mut SlideApp, ui: &mut Ui, xf: Xf, gifs: &[crate::media::Gif]) {
|
||||
let Some(d) = app.session.active() else { return };
|
||||
if d.selection.text.is_some() || app.session.tool.dragging() {
|
||||
return;
|
||||
@@ -36,7 +37,8 @@ pub(super) fn media_frames(app: &SlideApp, painter: &egui::Painter, xf: Xf) {
|
||||
}
|
||||
for (id, x, clip) in crate::media::slide_media(&d.doc, d.selection.slide) {
|
||||
if clip.video {
|
||||
crate::media::paint_frame(painter, &app.media, id, screen_rect(xf, &x), clip.crop);
|
||||
// P3(canvas-w14): cv.A9
|
||||
crate::media::paint_frame_base(painter, &app.media, id, screen_rect(xf, &x), clip.crop);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,3 +89,10 @@ pub(crate) fn show_controls(app: &mut crate::SlideApp, ui: &mut egui::Ui, space:
|
||||
let _ = (app, ui, space);
|
||||
todo!("cv.A3")
|
||||
}
|
||||
|
||||
/// Shows the GIF pause buttons over the slide picture.
|
||||
#[allow(dead_code)] // P3(canvas-w14): cv.A3
|
||||
pub(crate) fn gif_buttons(app: &mut SlideApp, ui: &mut Ui, space: &craft::ui::canvas::CanvasSpace, gifs: &[crate::media::Gif]) {
|
||||
let _ = (app, ui, space, gifs);
|
||||
todo!("cv.A3")
|
||||
}
|
||||
@@ -40,7 +40,8 @@ fn drag_indents_add_move_and_remove_tabs_on_the_ruler() {
|
||||
let id = s.execute("insert.textBox", &json!({"rect": [100, 150, 500, 40]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("text.edit", &json!({"id": id})).unwrap();
|
||||
s.execute("text.insert", &json!({"text": "Name\tRole\tTeam"})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(canvas-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.ruler = true;
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
@@ -91,7 +92,8 @@ fn editing_harness() -> Harness<'static, SlideApp> {
|
||||
let id = s.execute("insert.textBox", &json!({"rect": [100, 150, 500, 40]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("text.edit", &json!({"id": id})).unwrap();
|
||||
s.execute("text.insert", &json!({"text": "Item\t9.50"})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(canvas-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.ruler = true;
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -100,7 +100,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(Session::with_new(), Services::default()),
|
||||
// P3(canvas-w11): sh.A2
|
||||
SlideApp::new_base(Session::with_new(), Services::default()),
|
||||
);
|
||||
h.run_steps(3);
|
||||
h
|
||||
@@ -320,7 +321,8 @@ fn app_with_table() -> (egui_kittest::Harness<'static, SlideApp>, deckcraft_mode
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(s, Services::default()),
|
||||
// P3(canvas-w11): sh.A2
|
||||
SlideApp::new_base(s, Services::default()),
|
||||
);
|
||||
// The app keeps requesting repaints, so step frames instead of run().
|
||||
harness.run_steps(2);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// Hosts the text editor over the slide picture, except during animation previews.
|
||||
#[allow(dead_code)] // P3(canvas-w8): cv.A3
|
||||
pub(crate) fn show_editor(
|
||||
app: &mut crate::SlideApp,
|
||||
ui: &mut egui::Ui,
|
||||
space: &craft::ui::canvas::CanvasSpace,
|
||||
) -> Option<craft::text::ui::editor::TextEditorOutput> {
|
||||
let _ = (app, ui, space);
|
||||
todo!("cv.A3")
|
||||
}
|
||||
@@ -21,7 +21,8 @@ fn harness() -> (Harness<'static, SlideApp>, usize) {
|
||||
s.close_document(1);
|
||||
s.set_active(0);
|
||||
s.execute("review.compare", &json!({"name": "Q3 review.deckcraft", "data": rev})).unwrap();
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w13): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -467,7 +467,8 @@ mod tests {
|
||||
fn screenshot_reply_is_path_only_or_explicitly_inline() {
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
let mut app = SlideApp::new(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
// P3(shell-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
let written = Arc::new(Mutex::new(Vec::new()));
|
||||
let sink = Arc::clone(&written);
|
||||
app.services.write = Some(Box::new(move |_path, bytes| {
|
||||
|
||||
@@ -10,7 +10,8 @@ use serde_json::json;
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
fn harness() -> Harness<'static, SlideApp> {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Insert".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 1100.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -83,7 +83,8 @@ mod about_credits_tests {
|
||||
/// or Models was open. Click through Contributors, Models and back to About.
|
||||
#[test]
|
||||
fn about_dialog_tabs_keep_responding() {
|
||||
let mut app = SlideApp::new(deckcraft_engine::Session::with_new(), Services::default());
|
||||
// P3(dialogs-w18): sh.A2
|
||||
let mut app = SlideApp::new_base(deckcraft_engine::Session::with_new(), Services::default());
|
||||
app.dialog = Some(Dialog::new("about"));
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -30,7 +30,8 @@ fn two_boxes() -> Harness<'static, SlideApp> {
|
||||
}
|
||||
|
||||
fn harness_of(s: Session) -> Harness<'static, SlideApp> {
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w8): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -12,7 +12,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
s.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 320.0, 80.0], "text": "Hello"})).unwrap();
|
||||
// A selected shape, not a caret: the dialog then formats the text that is already there.
|
||||
let _ = s.execute("text.exit", &json!({}));
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w11): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -12,7 +12,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 320.0, 80.0], "text": "Hello"})).unwrap();
|
||||
let _ = s.execute("text.exit", &json!({}));
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w9): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -35,7 +35,8 @@ fn slides(h: &Harness<'_, SlideApp>) -> usize {
|
||||
|
||||
#[test]
|
||||
fn insert_ribbon_opens_the_dialog_without_editing() {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Insert".into();
|
||||
let mut h = harness(app);
|
||||
h.get_by_label("Photo Album…").click();
|
||||
@@ -53,7 +54,8 @@ fn create_inserts_the_album_in_one_step() {
|
||||
read: Some(Box::new(move |_| Ok(bytes.clone()))),
|
||||
..Default::default()
|
||||
};
|
||||
let mut app = SlideApp::new(Session::with_new(), services);
|
||||
// P3(dialogs-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), services);
|
||||
app.run("insert.photoAlbum", json!({})).expect("open");
|
||||
let mut h = harness(app);
|
||||
h.get_by_label("Add Pictures…").click();
|
||||
@@ -81,7 +83,8 @@ fn create_inserts_the_album_in_one_step() {
|
||||
#[test]
|
||||
fn update_reflows_the_open_album() {
|
||||
let data = deckcraft_engine::cmd::base64_encode(&png());
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.run("insert.photoAlbum", json!({"pictures": [{"name": "hill.png", "data": data}, {"name": "lake.png", "data": data}], "layout": "1"}))
|
||||
.expect("create");
|
||||
assert_eq!(slides_of(&app), 3);
|
||||
@@ -117,7 +120,8 @@ fn slides_of(app: &SlideApp) -> usize {
|
||||
|
||||
#[test]
|
||||
fn create_with_nothing_keeps_the_dialog() {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.run("insert.photoAlbum", json!({})).expect("open");
|
||||
let mut h = harness(app);
|
||||
h.get_by_label("Create").click();
|
||||
|
||||
@@ -23,7 +23,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(Session::with_new(), Services::default()),
|
||||
// P3(dialogs-w17): sh.A2
|
||||
SlideApp::new_base(Session::with_new(), Services::default()),
|
||||
);
|
||||
// The app keeps asking for frames, so step instead of run().
|
||||
h.run_steps(3);
|
||||
|
||||
@@ -12,7 +12,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(deckcraft_engine::Session::with_new(), Services::default()),
|
||||
// P3(dialogs-w9): sh.A2
|
||||
SlideApp::new_base(deckcraft_engine::Session::with_new(), Services::default()),
|
||||
);
|
||||
h.run_steps(2);
|
||||
h
|
||||
|
||||
@@ -14,7 +14,8 @@ fn spelling_dialog_changes_and_ignores_words() {
|
||||
let aff = "SET UTF-8\nTRY esianrtolcdugmphbyfvkwzxjq\nSFX S Y 1\nSFX S 0 s .\n";
|
||||
let dic = "6\nthe/S\nslide/S\nquarter/S\nplan/S\nour\nfor\n";
|
||||
deckcraft_engine::spell::install("en-US", deckcraft_engine::spell::Dictionary::parse(aff.as_bytes(), dic.as_bytes()));
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w15): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.session.execute("shape.insert", &json!({"preset": "rect", "rect": [100, 100, 500, 120], "text": "Our plna for teh quarter"})).unwrap();
|
||||
app.dialog = Some(crate::dialogs::Dialog::new("spelling"));
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1100.0, 700.0)).build_ui_state(
|
||||
@@ -57,7 +58,8 @@ fn squiggles_mark_misspelt_words_in_the_background() {
|
||||
let dir = std::env::temp_dir().join(format!("deckcraft-ui-userdic-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
deckcraft_engine::spell::set_user_dictionary_path(dir.join("user.dic"));
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w15): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.session.execute("slide.layout", &json!({"layout": "blank"})).ok();
|
||||
let id = app
|
||||
.session
|
||||
@@ -121,7 +123,8 @@ fn squiggles_in_table_cells_and_notes_and_on_the_ui_thread() {
|
||||
let aff = "SET UTF-8\nTRY esianrtolcdugmphbyfvkwzxjq\nSFX S Y 1\nSFX S 0 s .\n";
|
||||
let dic = "10\nthe/S\nplan/S\nsales\nregion/S\ntotal/S\nnorth\nsouth\nremember\nto\nshow\n";
|
||||
deckcraft_engine::spell::install("xx-TB", deckcraft_engine::spell::Dictionary::parse(aff.as_bytes(), dic.as_bytes()));
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w15): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.squiggles.force_inline = true;
|
||||
app.session.execute("slide.layout", &json!({"layout": "blank"})).ok();
|
||||
let id = app.session.execute("insert.table", &json!({"rows": 2, "cols": 2, "rect": [80, 80, 600, 160]})).unwrap()["id"].as_u64().unwrap();
|
||||
@@ -200,7 +203,8 @@ fn notes_menu_language_dialog_and_repeated_words() {
|
||||
let aff = "SET UTF-8\nTRY esianrtolcdugmphbyfvkwzxjq\n";
|
||||
let dic = "6\nthe\nplan\nremember\nis\ngood\nwork\n";
|
||||
deckcraft_engine::spell::install("xx-NM", deckcraft_engine::spell::Dictionary::parse(aff.as_bytes(), dic.as_bytes()));
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w15): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.session.execute("slide.layout", &json!({"layout": "blank"})).ok();
|
||||
let id = app
|
||||
.session
|
||||
|
||||
@@ -53,7 +53,8 @@ fn header_footer_apply_keeps_an_existing_date_format() {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(session, crate::Services::default()),
|
||||
// P3(dialogs-w19): sh.A2
|
||||
SlideApp::new_base(session, crate::Services::default()),
|
||||
);
|
||||
harness.run_steps(2);
|
||||
assert_eq!(date_fields(harness.state()), vec!["datetime4".to_string()]);
|
||||
@@ -94,7 +95,8 @@ fn export_dialog_writes_an_animated_gif() {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(session, services),
|
||||
// P3(dialogs-w19): sh.A2
|
||||
SlideApp::new_base(session, services),
|
||||
);
|
||||
harness.run_steps(2);
|
||||
harness.state_mut().run("app.exportDialog", json!({})).unwrap();
|
||||
@@ -145,7 +147,8 @@ fn export_dialog_writes_a_png_with_a_transparent_background() {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(deckcraft_engine::Session::with_new(), services),
|
||||
// P3(dialogs-w19): sh.A2
|
||||
SlideApp::new_base(deckcraft_engine::Session::with_new(), services),
|
||||
);
|
||||
harness.run_steps(2);
|
||||
harness.state_mut().run("app.exportDialog", json!({})).unwrap();
|
||||
|
||||
@@ -8,7 +8,8 @@ use egui_kittest::kittest::Queryable;
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
fn harness() -> Harness<'static, SlideApp> {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Design".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 1100.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -7,7 +7,8 @@ use egui_kittest::kittest::Queryable;
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
fn harness() -> Harness<'static, SlideApp> {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(dialogs-w11): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Design".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 1100.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -119,7 +119,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn an_offered_release_opens_the_prompt() {
|
||||
let mut app = SlideApp::new(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
// P3(dialogs-w18): sh.A2
|
||||
let mut app = SlideApp::new_base(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
let ctx = egui::Context::default();
|
||||
assert!(!app.updates_rt.updater.prompt_open());
|
||||
app.updates_rt.updater.offer(craft_update::Release { tag: "v99.0.0".into(), ..Default::default() });
|
||||
@@ -130,7 +131,8 @@ mod tests {
|
||||
/// An app whose updater keeps its outcome records under `root`, reads no launcher choice and
|
||||
/// asks no server, with the check at start turned on.
|
||||
fn app_with_records(root: &std::path::Path) -> SlideApp {
|
||||
let mut app = SlideApp::new(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
// P3(dialogs-w18): sh.A2
|
||||
let mut app = SlideApp::new_base(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
app.updates_rt.updater = Updater::new(&crate::UPDATE_APP, VERSION)
|
||||
.with_paths(craft_update::Paths::under(root))
|
||||
.with_pins_path(root.join("pins.json"))
|
||||
@@ -143,7 +145,8 @@ mod tests {
|
||||
/// under Stable's folders) stay untouched, and Help > Check for Updates… says so.
|
||||
#[test]
|
||||
fn a_nightly_launch_never_starts_the_stable_updater() {
|
||||
let mut app = SlideApp::new(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
// P3(dialogs-w18): sh.A2
|
||||
let mut app = SlideApp::new_base(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
assert!(app.updates_rt.stable_services, "the test binary is a stable launch");
|
||||
app.updates_rt.stable_services = false;
|
||||
assert_eq!(request_check(&mut app), Err(NIGHTLY_UPDATES.to_string()));
|
||||
|
||||
@@ -94,11 +94,13 @@ pub fn tick(app: &mut SlideApp, ctx: &Context) {
|
||||
if ctx.data_mut(|d| d.remove_temp::<bool>(key(TRANSPARENT))).unwrap_or(false) {
|
||||
begin(app, Pick::TransparentColor);
|
||||
}
|
||||
if app.eyedropper.is_some() {
|
||||
// P3(canvas-w13): cv.A1
|
||||
if app.eyedropper_base.is_some() {
|
||||
let outside =
|
||||
ctx.input(|i| i.pointer.primary_pressed() && i.pointer.hover_pos().is_some_and(|p| app.canvas_rect.is_none_or(|c| !c.contains(p))));
|
||||
if outside {
|
||||
app.eyedropper = None;
|
||||
// P3(canvas-w13): cv.A1
|
||||
app.eyedropper_base = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +113,8 @@ fn begin(app: &mut SlideApp, pick: Pick) {
|
||||
}
|
||||
let slide = d.selection.slide;
|
||||
let image = deckcraft_render::render_slide(&d.doc, slide, &deckcraft_render::RenderOpts { scale: SCALE, ..Default::default() });
|
||||
app.eyedropper = Some(State { pick, slide, image });
|
||||
// P3(canvas-w13): cv.A1
|
||||
app.eyedropper_base = Some(State { pick, slide, image });
|
||||
app.set_status(match pick {
|
||||
Pick::Menu(_) => "Eyedropper: click the slide (Esc cancels)",
|
||||
Pick::TransparentColor => "Set Transparent Color: click the colour in the picture (Esc cancels)",
|
||||
@@ -125,10 +128,12 @@ fn hex(c: [u8; 4]) -> String {
|
||||
/// The slide canvas while the Eyedropper waits: the pointer is a crosshair with the colour under it
|
||||
/// beside it, a click takes it. Returns true when it used the pointer (the tools get none).
|
||||
pub fn canvas(app: &mut SlideApp, ui: &Ui, resp: &egui::Response, xf: Xf) -> bool {
|
||||
let Some(state) = app.eyedropper.as_ref() else { return false };
|
||||
// P3(canvas-w13): cv.A1
|
||||
let Some(state) = app.eyedropper_base.as_ref() else { return false };
|
||||
let escape = ui.input(|i| i.key_pressed(egui::Key::Escape));
|
||||
if escape || resp.secondary_clicked() {
|
||||
app.eyedropper = None;
|
||||
// P3(canvas-w13): cv.A1
|
||||
app.eyedropper_base = None;
|
||||
return true;
|
||||
}
|
||||
let Some(pos) = resp.hover_pos() else { return true };
|
||||
@@ -136,7 +141,8 @@ pub fn canvas(app: &mut SlideApp, ui: &Ui, resp: &egui::Response, xf: Xf) -> boo
|
||||
if !on_slide {
|
||||
ui.ctx().set_cursor_icon(CursorIcon::NotAllowed);
|
||||
if resp.clicked() {
|
||||
app.eyedropper = None;
|
||||
// P3(canvas-w13): cv.A1
|
||||
app.eyedropper_base = None;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -148,7 +154,8 @@ pub fn canvas(app: &mut SlideApp, ui: &Ui, resp: &egui::Response, xf: Xf) -> boo
|
||||
}
|
||||
if resp.clicked() {
|
||||
let (pick, slide) = (state.pick, state.slide);
|
||||
app.eyedropper = None;
|
||||
// P3(canvas-w13): cv.A1
|
||||
app.eyedropper_base = None;
|
||||
match pick {
|
||||
Pick::Menu(menu) => {
|
||||
match app.session.execute("slide.colorAt", &serde_json::json!({"slide": slide, "x": p.x, "y": p.y, "scale": SCALE})) {
|
||||
|
||||
@@ -20,7 +20,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(session, Services::default()),
|
||||
// P3(canvas-w13): sh.A2
|
||||
SlideApp::new_base(session, Services::default()),
|
||||
);
|
||||
h.run_steps(4);
|
||||
h
|
||||
@@ -123,7 +124,8 @@ fn set_transparent_color_takes_the_colour_clicked_in_the_picture() {
|
||||
session.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let data = deckcraft_engine::cmd::base64_encode(&png);
|
||||
session.execute("insert.picture", &json!({"data": data, "name": "a.png", "rect": [100, 100, 400, 200]})).unwrap();
|
||||
let mut app = SlideApp::new(session, Services::default());
|
||||
// P3(canvas-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(session, Services::default());
|
||||
app.ui.tab = "Picture Format".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 1200.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -90,7 +90,8 @@ fn light_text_fields_show_in_dialogs_panes_and_the_ribbon() {
|
||||
let light = theme::Tokens::light();
|
||||
|
||||
// Home › Find: "Find what:" in the dialog card.
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), Services::default()));
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), Services::default()));
|
||||
h.state_mut().run("app.find", json!({})).unwrap();
|
||||
h.run_steps(3);
|
||||
assert_visible(&h, "Find and Replace", h.ctx.global_style().visuals.window_fill);
|
||||
@@ -105,13 +106,15 @@ fn light_text_fields_show_in_dialogs_panes_and_the_ribbon() {
|
||||
assert!(stands_apart(fill, stroke, surface), "focused field: fill {fill:?}, outline {stroke:?}");
|
||||
|
||||
// Review › Thesaurus: the search box on the task pane.
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), Services::default()));
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(Session::with_new(), Services::default()));
|
||||
h.state_mut().ui.pane = Some("thesaurus".into());
|
||||
h.run_steps(3);
|
||||
assert_visible(&h, "Thesaurus pane", light.card);
|
||||
|
||||
// Transitions › Duration: the spinner on the ribbon.
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Transitions".into();
|
||||
let h = harness(app);
|
||||
assert_visible(&h, "Transitions ribbon", light.card);
|
||||
|
||||
@@ -13,7 +13,8 @@ fn ctrl_f_puts_the_caret_in_find_what() {
|
||||
s.execute("insert.textBox", &json!({"rect": [40, 40, 400, 80], "text": "Hello there"})).unwrap();
|
||||
s.execute("text.exit", &json!({})).unwrap();
|
||||
s.doc_mut().unwrap().selection.shapes.clear();
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w16): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -30,7 +30,8 @@ fn host_app(fail: bool) -> (SlideApp, Got) {
|
||||
..Default::default()
|
||||
};
|
||||
// Host mode starts as the web shell starts it: an empty presentation for the page's file.
|
||||
let mut app = SlideApp::new(Session::new(), services);
|
||||
// P3(shell-w6): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), services);
|
||||
app.start_for_host().unwrap();
|
||||
(app, got)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ fn harness(n: usize) -> egui_kittest::Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(s, Services::default()),
|
||||
// P3(shell-w10): sh.A2
|
||||
SlideApp::new_base(s, Services::default()),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ fn harness(session: Session) -> egui_kittest::Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(session, Services::default()),
|
||||
// P3(shell-w9): sh.A2
|
||||
SlideApp::new_base(session, Services::default()),
|
||||
);
|
||||
crate::install_ime_pass_hooks(&h.ctx);
|
||||
// The app keeps requesting repaints, so step frames instead of run().
|
||||
@@ -202,7 +203,8 @@ fn a_discarded_pass_keeps_the_tombstone_until_a_settled_pass_publishes_the_inter
|
||||
ui.ctx().will_discard(),
|
||||
));
|
||||
},
|
||||
SlideApp::new(Session::with_new(), Services::default()),
|
||||
// P3(shell-w9): sh.A2
|
||||
SlideApp::new_base(Session::with_new(), Services::default()),
|
||||
);
|
||||
h.run_steps(3);
|
||||
let title = h.state().session.active().unwrap().doc.slides[0].shapes[0].id.0;
|
||||
@@ -239,7 +241,8 @@ fn a_discarded_pass_keeps_the_tombstone_until_a_settled_pass_publishes_the_inter
|
||||
fn accepted_no_descriptor_pass_retires_the_settled_tombstone() {
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(shell-w9): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
let ctx = egui::Context::default();
|
||||
let title = app.session.active().unwrap().doc.slides[0].shapes[0].id.0;
|
||||
app.run("text.edit", json!({"id": title})).unwrap();
|
||||
|
||||
@@ -45,7 +45,8 @@ fn setup() -> (SlideApp, Inbox, Arc<Mutex<Vec<(String, u64)>>>) {
|
||||
})),
|
||||
..Default::default()
|
||||
};
|
||||
(SlideApp::new(Session::with_new(), services), inbox, started)
|
||||
// P3(shell-w6): sh.A2
|
||||
(SlideApp::new_base(Session::with_new(), services), inbox, started)
|
||||
}
|
||||
|
||||
fn deliver(inbox: &Inbox, id: u64, name: &str, bytes: Vec<u8>) {
|
||||
|
||||
@@ -24,7 +24,8 @@ fn harness(tab: &str) -> (Harness<'static, SlideApp>, [ShapeId; 2]) {
|
||||
s.execute("shape.fill", &json!({"color": "#FF0000"})).unwrap();
|
||||
s.execute("shape.line", &json!({"color": "#0000FF", "width": 3})).unwrap();
|
||||
s.execute("selection.select", &json!({"ids": [ids[0].0]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = tab.into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -368,7 +368,9 @@ pub struct SlideApp {
|
||||
/// Canvas screen rect and points-per-slide-point scale (for control & tests).
|
||||
pub canvas_rect: Option<egui::Rect>,
|
||||
/// The Eyedropper is waiting for a click on the slide.
|
||||
pub eyedropper: Option<eyedropper::State>,
|
||||
pub eyedropper: Option<eyedropper::Armed>,
|
||||
// P3(shell-w11): cv.A1
|
||||
eyedropper_base: Option<eyedropper::State>,
|
||||
pub canvas_scale: f32,
|
||||
pub slide_rect: Option<egui::Rect>,
|
||||
/// Where the canvas texture (the slide and the pasteboard drawn around it) is on screen.
|
||||
@@ -381,7 +383,9 @@ pub struct SlideApp {
|
||||
/// creating or closing a presentation leaves it.
|
||||
pub backstage: Option<backstage::Backstage>,
|
||||
pending_urls: Vec<String>,
|
||||
print_previews: app::files::PrintPreviews,
|
||||
print_previews: craft::platform::temp::TempFiles,
|
||||
// P3(shell-w11): sh.A8
|
||||
print_previews_base: app::files::PrintPreviews,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
updates_rt: updates_ui::Runtime,
|
||||
/// Text for the system clipboard from a Copy or Cut command, handed over on the next frame.
|
||||
|
||||
@@ -325,7 +325,8 @@ impl MediaHost {
|
||||
}
|
||||
|
||||
/// The current video frame of shape `id`, once one has decoded.
|
||||
pub fn texture(&self, id: ShapeId) -> Option<&TextureHandle> {
|
||||
// P3(canvas-w14): cv.A9
|
||||
fn texture_base(&self, id: ShapeId) -> Option<&TextureHandle> {
|
||||
self.videos.get(&id).and_then(|v| v.tex.as_ref())
|
||||
}
|
||||
|
||||
@@ -455,8 +456,10 @@ fn crop_uv(crop: [f64; 4]) -> Rect {
|
||||
|
||||
/// Draw the playing video frame of `id` into `rect`: letterboxed to the frame's aspect, or, when
|
||||
/// the video is cropped, the cropped part stretched over the whole box as PowerPoint shows it.
|
||||
pub fn paint_frame(painter: &egui::Painter, host: &MediaHost, id: ShapeId, rect: Rect, crop: [f64; 4]) -> bool {
|
||||
let Some(tex) = host.texture(id) else { return false };
|
||||
// P3(canvas-w14): cv.A9
|
||||
pub(crate) fn paint_frame_base(painter: &egui::Painter, host: &MediaHost, id: ShapeId, rect: Rect, crop: [f64; 4]) -> bool {
|
||||
// P3(canvas-w14): cv.A9
|
||||
let Some(tex) = host.texture_base(id) else { return false };
|
||||
if crop.iter().any(|v| *v > 0.0) {
|
||||
painter.rect_filled(rect, CornerRadius::ZERO, Color32::BLACK);
|
||||
painter.image(tex.id(), rect, crop_uv(crop), Color32::WHITE);
|
||||
@@ -809,7 +812,8 @@ mod tests {
|
||||
assert!(host.videos.get(&id).is_some_and(|v| v.feed.is_none()), "VP8 opens no video feed");
|
||||
host.tick_clock(0.1, &mut s);
|
||||
host.sync_video_textures(&egui::Context::default());
|
||||
assert!(host.texture(id).is_none(), "no VP8 frame exists to show");
|
||||
// P3(canvas-w14): cv.A9
|
||||
assert!(host.texture_base(id).is_none(), "no VP8 frame exists to show");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -889,3 +893,18 @@ mod tests {
|
||||
assert_eq!(host.videos.values().filter(|v| v.feed.is_some()).count(), MAX_VIDEO_FEEDS);
|
||||
}
|
||||
}
|
||||
|
||||
impl MediaHost {
|
||||
/// Returns the cached current video frame of the shape, once one has decoded.
|
||||
pub fn texture(&self, id: ShapeId) -> Option<craft::ui::primitives::CachedTexture> {
|
||||
let _ = (id,);
|
||||
todo!("cv.A9")
|
||||
}
|
||||
}
|
||||
|
||||
/// Appends the playing video frame as shapes and reports whether a frame was available.
|
||||
#[allow(dead_code)] // P3(canvas-w14): cv.A9
|
||||
pub fn paint_frame(shapes: &mut Vec<egui::Shape>, host: &MediaHost, id: ShapeId, rect: Rect, crop: [f64; 4]) -> bool {
|
||||
let _ = (shapes, host, id, rect, crop);
|
||||
todo!("cv.A9")
|
||||
}
|
||||
@@ -41,7 +41,8 @@ fn play_on_the_editor_media_bar_plays_the_selected_clip() {
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let r = s.execute("insert.audio", &json!({"name": "tone.wav", "data": deckcraft_engine::cmd::base64_encode(&wav(2.0))})).unwrap();
|
||||
let id = ShapeId(r["id"].as_u64().unwrap() as u32);
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(canvas-w14): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
@@ -85,7 +86,8 @@ fn the_media_bar_never_paints_or_clicks_into_the_notes_pane() {
|
||||
// Dragged across the bottom edge of the slide, onto the pasteboard.
|
||||
let h_slide = s.doc().unwrap().doc.slide_size.height;
|
||||
s.execute("shape.setBounds", &json!({"ids": [id.0], "x": 300.0, "y": h_slide - 10.0, "w": 120.0, "h": 60.0})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(canvas-w14): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.notes = true;
|
||||
app.ui.notes_height = 140.0;
|
||||
let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|
||||
@@ -155,7 +155,8 @@ mod tests {
|
||||
#[test]
|
||||
fn opens_in_the_background_and_adds_the_document() {
|
||||
let path = saved_deck("ok", 3);
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
app.open_path_in_background(&path);
|
||||
assert!(app.opening.is_some(), "the read runs on a thread");
|
||||
wait(&mut app);
|
||||
@@ -170,7 +171,8 @@ mod tests {
|
||||
#[test]
|
||||
fn cancel_drops_the_result() {
|
||||
let path = saved_deck("cancel", 2);
|
||||
let mut app = SlideApp::new(Session::with_new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), crate::Services::default());
|
||||
app.open_path_in_background(&path);
|
||||
app.cancel_opening();
|
||||
assert!(app.opening.is_none());
|
||||
@@ -182,7 +184,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn errors_are_shown_and_a_second_open_waits() {
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
app.open_path_in_background("/nonexistent/deckcraft/missing.pptx");
|
||||
app.open_path_in_background("/nonexistent/deckcraft/other.pptx");
|
||||
assert!(app.status.as_ref().is_some_and(|(m, _)| m.starts_with("Still opening missing.pptx")));
|
||||
@@ -196,7 +199,8 @@ mod tests {
|
||||
#[test]
|
||||
fn the_progress_window_shows_and_cancel_closes_it() {
|
||||
use egui_kittest::kittest::Queryable;
|
||||
let mut app = SlideApp::new(Session::with_new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), crate::Services::default());
|
||||
// A read that never answers: the window stays until Cancel.
|
||||
let (_tx, rx) = std::sync::mpsc::channel();
|
||||
app.opening = Some(Opening { path: "/decks/Big deck.pptx".into(), started_ms: crate::now_ms(), generation: 1, rx });
|
||||
@@ -237,7 +241,8 @@ mod tests {
|
||||
std::fs::create_dir_all(legacy.parent().unwrap()).unwrap();
|
||||
std::fs::write(&legacy, include_bytes!("../../ppt/tests/fixtures/old-talk.pps")).unwrap();
|
||||
for path in [saved_as("Talk.PPSX", 3), legacy.to_string_lossy().to_string()] {
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
assert!(app.open_from_system(std::slice::from_ref(&path)).is_empty());
|
||||
assert_eq!(app.session.documents().len(), 1);
|
||||
let show = app.show.as_ref().expect("the slide show started");
|
||||
@@ -253,7 +258,8 @@ mod tests {
|
||||
fn a_pptx_from_the_system_opens_for_editing() {
|
||||
let pptx = saved_as("edit.pptx", 3);
|
||||
let ppsx = saved_as("first.ppsx", 2);
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
assert!(app.open_from_system(std::slice::from_ref(&pptx)).is_empty());
|
||||
assert!(app.show.is_none());
|
||||
assert!(app.open_from_system(&[ppsx.clone(), pptx.clone()]).is_empty());
|
||||
@@ -267,7 +273,8 @@ mod tests {
|
||||
#[test]
|
||||
fn file_open_opens_a_ppsx_for_editing() {
|
||||
let path = saved_as("open.ppsx", 2);
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
app.open_path_in_background(&path);
|
||||
wait(&mut app);
|
||||
assert_eq!(app.session.active().unwrap().doc.slides.len(), 2);
|
||||
@@ -282,7 +289,8 @@ mod tests {
|
||||
fn leaving_the_ppsx_show_keeps_the_deck_open() {
|
||||
let path = saved_as("leave.ppsx", 2);
|
||||
for leave in [egui::Key::Escape, egui::Key::ArrowRight] {
|
||||
let mut app = SlideApp::new(Session::new(), crate::Services::default());
|
||||
// P3(shell-w3): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::new(), crate::Services::default());
|
||||
assert!(app.open_from_system(std::slice::from_ref(&path)).is_empty());
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(egui::vec2(1000.0, 700.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -190,7 +190,8 @@ mod tests {
|
||||
s.execute("shape.fill", &json!({"id": a, "color": "accent1", "transparency": 0.0})).unwrap();
|
||||
s.execute("shape.fill", &json!({"id": b, "color": "accent1", "transparency": 0.4})).unwrap();
|
||||
s.execute("edit.select", &json!({"ids": [a]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "fill".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
@@ -231,7 +232,8 @@ mod tests {
|
||||
if let Some(p) = fill {
|
||||
s.execute("shape.fill", &p).unwrap();
|
||||
}
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "fill".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
@@ -342,7 +344,8 @@ mod tests {
|
||||
s.execute("arrange.group", &json!({})).unwrap();
|
||||
s.execute("shape.fill", &json!({"color": "#ff0000"})).unwrap();
|
||||
}
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "fill".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
@@ -396,7 +399,8 @@ mod tests {
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "fill".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
|
||||
@@ -37,7 +37,8 @@ fn picture_mode(h: &Harness<'_, SlideApp>) -> PictureMode {
|
||||
fn picture_fill_shows_transparency_and_tiling() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("design.background", &json!({"picture": PNG, "name": "dot.png"})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()));
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()));
|
||||
assert!(h.query_all_by_label("Format Background").next().is_some(), "the pane is open");
|
||||
let _ = h.get_by_label("Picture or texture fill");
|
||||
assert!(h.query_all_by_label("Transparency").next().is_some());
|
||||
@@ -54,7 +55,8 @@ fn picture_fill_shows_transparency_and_tiling() {
|
||||
fn solid_fill_shows_transparency_without_tile_options() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("design.background", &json!({"color": "accent1"})).unwrap();
|
||||
let h = harness(SlideApp::new(s, Services::default()));
|
||||
// P3(panels-w10): sh.A2
|
||||
let h = harness(SlideApp::new_base(s, Services::default()));
|
||||
assert!(h.query_all_by_label("Transparency").next().is_some());
|
||||
let _ = h.get_by_label("Solid fill");
|
||||
assert!(h.query_by_label("Tile picture as texture").is_none());
|
||||
@@ -66,7 +68,8 @@ fn apply_to_all_copies_the_picture() {
|
||||
s.execute("design.background", &json!({"picture": PNG, "name": "dot.png"})).unwrap();
|
||||
s.execute("slide.new", &json!({})).unwrap();
|
||||
s.execute("slide.go", &json!({"index": 0})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()));
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()));
|
||||
h.get_by_label("Apply to All").click();
|
||||
h.run_steps(2);
|
||||
let doc = &h.state().session.active().unwrap().doc;
|
||||
|
||||
@@ -14,7 +14,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
let r = s.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 200.0, 120.0]})).unwrap();
|
||||
let id = r.get("id").and_then(|v| v.as_u64()).unwrap();
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w9): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "effects".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 1100.0)).build_ui_state(
|
||||
|
||||
@@ -547,7 +547,8 @@ mod tests {
|
||||
let sc = deckcraft_model::Theme::default().colors;
|
||||
// P3(panels-w10): pn.A10
|
||||
let _ = ≻
|
||||
let mut app = crate::SlideApp::new(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut app = crate::SlideApp::new_base(deckcraft_engine::Session::new(), crate::Services::default());
|
||||
let start = Gradient {
|
||||
stops: vec![
|
||||
GradientStop { pos: 0.0, color: ColorRef::scheme(SchemeSlot::Accent1) },
|
||||
|
||||
@@ -77,7 +77,8 @@ fn pick_hex(h: &mut Harness<'_, SlideApp>, button: &str, hex: &str) {
|
||||
#[test]
|
||||
fn shape_pattern_fill_picks_a_preset_from_the_gallery() {
|
||||
let (s, id) = patterned_shape();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "format");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "format");
|
||||
let _ = h.get_by_label("Pattern fill");
|
||||
assert!(h.query_by_label("Transparency").is_none(), "a pattern has no solid-fill transparency");
|
||||
assert_eq!(crate::fillui::pattern_gallery().count(), 48);
|
||||
@@ -103,7 +104,8 @@ fn shape_pattern_fill_keeps_preset_and_system_colors() {
|
||||
let fg = json!({"preset": "red", "lumMod": 50000});
|
||||
let bg = json!({"system": "window", "last": "#F0F0F0"});
|
||||
s.execute("shape.fill", &json!({"pattern": {"preset": "pct25", "fg": fg, "bg": bg}})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "format");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "format");
|
||||
let before = shape_pattern(&h, id);
|
||||
assert!(matches!(before.fg.base, ColorBase::Preset { .. }) && matches!(before.bg.base, ColorBase::System { .. }));
|
||||
h.get_by_label("Zig zag").click();
|
||||
@@ -118,7 +120,8 @@ fn shape_pattern_fill_keeps_preset_and_system_colors() {
|
||||
#[test]
|
||||
fn pattern_gallery_shows_which_swatch_has_keyboard_focus() {
|
||||
let (s, _) = patterned_shape();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "format");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "format");
|
||||
let r = h.get_by_label("Zig zag").rect();
|
||||
let accent = crate::theme::Tokens::get(&h.ctx).accent;
|
||||
let outlined = |h: &Harness<'_, SlideApp>| {
|
||||
@@ -141,7 +144,8 @@ fn pattern_gallery_shows_which_swatch_has_keyboard_focus() {
|
||||
fn shape_solid_fill_keeps_its_transparency_without_a_pattern_gallery() {
|
||||
let (mut s, _) = patterned_shape();
|
||||
s.execute("shape.fill", &json!({"color": "accent2"})).unwrap();
|
||||
let h = harness(SlideApp::new(s, Services::default()), "format");
|
||||
// P3(panels-w10): sh.A2
|
||||
let h = harness(SlideApp::new_base(s, Services::default()), "format");
|
||||
// 0.37 exposes the slider's numeric entry as a SpinButton with the same name; the slider is
|
||||
// the control the user drags.
|
||||
let _ = h.get_by_role_and_label(Role::Slider, "Transparency");
|
||||
@@ -152,7 +156,8 @@ fn shape_solid_fill_keeps_its_transparency_without_a_pattern_gallery() {
|
||||
#[test]
|
||||
fn shape_pattern_fill_sets_its_foreground_and_background_colors() {
|
||||
let (s, id) = patterned_shape();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "format");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "format");
|
||||
pick_hex(&mut h, "Foreground color", "00FF00");
|
||||
let pt = shape_pattern(&h, id);
|
||||
assert_eq!(pt.fg, ColorRef::rgb(Rgba::from_hex("00FF00").unwrap()));
|
||||
@@ -167,7 +172,8 @@ fn shape_pattern_fill_sets_its_foreground_and_background_colors() {
|
||||
fn background_pattern_fill_offers_every_preset_and_both_colors() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("design.background", &json!({"pattern": {"preset": "pct20", "fg": "accent1", "bg": "bg1"}})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "background");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "background");
|
||||
h.get_by_label("Zig zag").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(background_pattern(&h).preset, "zigZag");
|
||||
@@ -181,7 +187,8 @@ fn background_pattern_fill_keeps_a_system_color() {
|
||||
let mut s = Session::with_new();
|
||||
let bg = json!({"system": "window", "last": "#F0F0F0"});
|
||||
s.execute("design.background", &json!({"pattern": {"preset": "pct20", "fg": "accent1", "bg": bg}})).unwrap();
|
||||
let mut h = harness(SlideApp::new(s, Services::default()), "background");
|
||||
// P3(panels-w10): sh.A2
|
||||
let mut h = harness(SlideApp::new_base(s, Services::default()), "background");
|
||||
let before = background_pattern(&h).bg;
|
||||
assert!(matches!(before.base, ColorBase::System { .. }));
|
||||
h.get_by_label("Zig zag").click();
|
||||
|
||||
@@ -24,7 +24,8 @@ fn harness() -> (Harness<'static, SlideApp>, Vec<u32>) {
|
||||
s.execute("shape.rename", &json!({"id": g, "name": "G"})).unwrap();
|
||||
s.execute("edit.select", &json!({"ids": []})).unwrap();
|
||||
ids.push(g);
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w12): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("selection".into());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -23,7 +23,8 @@ fn text_pane_types_adds_and_demotes() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.smartArt", &json!({"kind": "list", "items": ["Plan", "Build"]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w14): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("smartart".into());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
@@ -57,7 +58,8 @@ fn home_convert_to_smartart_gallery_converts_the_text() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.textBox", &json!({"text": "Goals\nRevenue\nGrowth"})).unwrap();
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w14): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
@@ -82,7 +84,8 @@ fn layout_gallery_shows_cached_pictures_and_previews_on_hover() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.smartArt", &json!({"kind": "process", "items": ["Plan", "Build", "Ship"]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w14): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "SmartArt Design".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -16,7 +16,8 @@ fn thesaurus_pane_swaps_the_word_at_the_caret() {
|
||||
s.execute("text.edit", &json!({"id": id})).unwrap();
|
||||
s.execute("text.insert", &json!({"text": "Our Goal is growth."})).unwrap();
|
||||
s.execute("text.edit", &json!({"id": id, "at": [0, 6]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w13): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "Review".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -445,7 +445,8 @@ mod tests {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(Session::with_new(), Services::default()),
|
||||
// P3(panels-w5): sh.A2
|
||||
SlideApp::new_base(Session::with_new(), Services::default()),
|
||||
);
|
||||
h.run_steps(3);
|
||||
h
|
||||
@@ -514,7 +515,8 @@ mod tests {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(s, Services::default()),
|
||||
// P3(panels-w5): sh.A2
|
||||
SlideApp::new_base(s, Services::default()),
|
||||
);
|
||||
h.run_steps(3);
|
||||
let ids = order(&h);
|
||||
|
||||
@@ -44,8 +44,8 @@ pub struct Snapshot {
|
||||
pub slide: usize,
|
||||
pub total: usize,
|
||||
pub ended: bool,
|
||||
pub notes: String,
|
||||
pub elapsed: String,
|
||||
pub notes: deckcraft_model::TextBody,
|
||||
pub elapsed: f64,
|
||||
pub paused: bool,
|
||||
pub notes_px: f32,
|
||||
pub blank: Option<String>,
|
||||
@@ -103,6 +103,10 @@ impl DeltaCache {
|
||||
}
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub enum Command {
|
||||
/// Runs a show command, including the typed slide-number commands.
|
||||
Run {
|
||||
command: String,
|
||||
},
|
||||
Key {
|
||||
name: String,
|
||||
command: bool,
|
||||
@@ -164,7 +168,8 @@ impl View {
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, snapshot: &Snapshot) -> Vec<Command> {
|
||||
if !self.prepare(ui.ctx(), &snapshot.notes) {
|
||||
// P3(show-w8): ss.A11
|
||||
if !self.prepare(ui.ctx(), &snapshot.notes.text()) {
|
||||
return Vec::new();
|
||||
}
|
||||
let mut commands = Vec::new();
|
||||
@@ -206,7 +211,8 @@ impl View {
|
||||
update(ui.ctx(), "remote-next", &mut self.previous_next, &mut self.next, &snapshot.next);
|
||||
let key = |name: &str| Command::Key { name: name.into(), command: false, shift: false, alt: false, ctrl: false };
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.heading(&snapshot.elapsed);
|
||||
// P3(show-w8): ss.A11
|
||||
ui.heading(crate::show::format_elapsed(snapshot.elapsed));
|
||||
ui.label(format!("Slide {} of {}", snapshot.slide.saturating_add(1), snapshot.total));
|
||||
for (label, name) in [("◀ Previous", "ArrowLeft"), ("Next ▶", "ArrowRight")] {
|
||||
if ui.button(label).clicked() {
|
||||
@@ -286,7 +292,8 @@ impl View {
|
||||
});
|
||||
egui::ScrollArea::vertical().show(right, |ui| {
|
||||
ui.label(
|
||||
egui::RichText::new(if snapshot.notes.is_empty() { "No notes." } else { &snapshot.notes })
|
||||
// P3(show-w8): ss.A11
|
||||
egui::RichText::new(if snapshot.notes.is_empty() { "No notes.".to_owned() } else { snapshot.notes.text() })
|
||||
.size(snapshot.notes_px.clamp(10.0, 72.0)),
|
||||
);
|
||||
});
|
||||
@@ -344,8 +351,10 @@ mod tests {
|
||||
slide: 0,
|
||||
total: 2,
|
||||
ended: false,
|
||||
notes: String::new(),
|
||||
elapsed: "00:00:00".into(),
|
||||
// P3(show-w8): ss.A11
|
||||
notes: deckcraft_model::TextBody::default(),
|
||||
// P3(show-w8): ss.A11
|
||||
elapsed: 0.0,
|
||||
paused: false,
|
||||
notes_px: 18.0,
|
||||
blank: None,
|
||||
@@ -447,12 +456,14 @@ mod tests {
|
||||
let arabic = "\u{645}\u{631}\u{62d}\u{628}\u{627}";
|
||||
let japanese = "\u{65e5}\u{672c}\u{8a9e}";
|
||||
let korean = "\u{d55c}\u{ae00}";
|
||||
data.notes = format!("{arabic} {japanese} {korean}");
|
||||
// P3(show-w8): ss.A11
|
||||
data.notes = deckcraft_model::TextBody::from_text(&format!("{arabic} {japanese} {korean}"));
|
||||
let mut installing = 0;
|
||||
let mut layouts = 0;
|
||||
for _ in 0..4 {
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
if !view.prepare(ui.ctx(), &data.notes) {
|
||||
// P3(show-w8): ss.A11
|
||||
if !view.prepare(ui.ctx(), &data.notes.text()) {
|
||||
installing += 1;
|
||||
assert!(view.ui(ui, &data).is_empty(), "no commands during a discarded font-install pass");
|
||||
return;
|
||||
@@ -481,8 +492,10 @@ mod tests {
|
||||
slide: 0,
|
||||
total: 3,
|
||||
ended: false,
|
||||
notes: "Synthetic notes".into(),
|
||||
elapsed: "00:00:00".into(),
|
||||
// P3(show-w8): ss.A11
|
||||
notes: deckcraft_model::TextBody::from_text("Synthetic notes"),
|
||||
// P3(show-w8): ss.A11
|
||||
elapsed: 0.0,
|
||||
paused: false,
|
||||
notes_px: 18.0,
|
||||
blank: None,
|
||||
@@ -545,3 +558,44 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Command {
|
||||
/// Reads a presenter message from the link payload.
|
||||
pub fn from_payload(text: &str) -> Option<Command> {
|
||||
let _ = (text,);
|
||||
todo!("ss.A11")
|
||||
}
|
||||
/// Writes the presenter message inside the link envelope.
|
||||
pub fn to_payload(&self) -> String {
|
||||
todo!("ss.A11")
|
||||
}
|
||||
}
|
||||
|
||||
impl Snapshot {
|
||||
/// Reads a presenter message from the link payload.
|
||||
pub fn from_payload(text: &str) -> Option<Snapshot> {
|
||||
let _ = (text,);
|
||||
todo!("ss.A11")
|
||||
}
|
||||
/// Writes the presenter message inside the link envelope.
|
||||
pub fn to_payload(&self) -> String {
|
||||
todo!("ss.A11")
|
||||
}
|
||||
}
|
||||
|
||||
/// A presenter snapshot with the preview changes carried by its payload.
|
||||
pub struct SnapshotDelta {
|
||||
/// The current presenter state.
|
||||
pub snapshot: Snapshot,
|
||||
/// Whether the current slide preview changed.
|
||||
pub current_changed: bool,
|
||||
/// Whether the next slide preview changed.
|
||||
pub next_changed: bool,
|
||||
}
|
||||
|
||||
/// Merges a presenter delta with the previous snapshot.
|
||||
#[allow(dead_code)] // P3(show-w8): ss.A11
|
||||
pub fn merge(previous: Option<&Snapshot>, delta: SnapshotDelta) -> Snapshot {
|
||||
let _ = (previous, delta);
|
||||
todo!("ss.A11")
|
||||
}
|
||||
@@ -8,7 +8,8 @@ use deckcraft_engine::Session;
|
||||
|
||||
#[test]
|
||||
fn show_presenter_answers_on_and_window() {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
let v = app.run("show.presenter", json!({"on": true})).unwrap();
|
||||
assert_eq!(v, json!({"on": true, "window": true}));
|
||||
let v = app.run("show.presenter", json!({})).unwrap();
|
||||
@@ -23,7 +24,8 @@ fn presenter_view_needs_a_second_display() {
|
||||
// hidden window stalled every frame.
|
||||
let presenter = |displays: Option<usize>, setting: bool| {
|
||||
let services = Services { displays: Some(Box::new(move || displays)), ..Default::default() };
|
||||
let mut app = SlideApp::new(Session::with_new(), services);
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), services);
|
||||
app.ui.presenter_view = setting;
|
||||
app.start_show(0, false);
|
||||
app.show.as_ref().map(|s| s.presenter)
|
||||
|
||||
@@ -20,7 +20,8 @@ fn reflection_none_clears_after_a_second_preset() {
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [72.0, 36.0, 144.0, 108.0]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w9): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "effects".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
@@ -48,7 +49,8 @@ fn reflection_none_stays_cleared_when_a_slider_only_had_focus() {
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [72.0, 36.0, 144.0, 108.0]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w9): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.pane = Some("format".into());
|
||||
app.ui.format_tab = "effects".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_ui_state(
|
||||
|
||||
@@ -15,7 +15,8 @@ fn harness() -> Harness<'static, SlideApp> {
|
||||
s.execute("text.exit", &json!({})).unwrap();
|
||||
s.execute("format.font", &json!({"family": "Comic Neue"})).unwrap();
|
||||
s.execute("format.size", &json!({"size": 40})).unwrap();
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w11): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
// The product's default window. The Home ribbon overflows here with the bundled interface
|
||||
// fonts; the ribbon's own edge chevron must make its Editing group reachable instead of the
|
||||
// regression widening the fixture past the width the app actually opens at.
|
||||
|
||||
@@ -31,7 +31,8 @@ fn harness(file: &Rc<RefCell<Vec<u8>>>) -> Harness<'static, SlideApp> {
|
||||
read: Some(Box::new(move |_| Ok(f.borrow().clone()))),
|
||||
..Services::default()
|
||||
};
|
||||
let app = SlideApp::new(s, services);
|
||||
// P3(dialogs-w14): sh.A2
|
||||
let app = SlideApp::new_base(s, services);
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
|
||||
@@ -32,37 +32,55 @@ mod title_bar;
|
||||
mod transitions;
|
||||
mod view;
|
||||
|
||||
use animations::animations;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use animations::animations_base;
|
||||
pub use animations::paint_anim_tile;
|
||||
#[cfg(test)]
|
||||
use animations::{animation_effect_rows, marked_options, text_build_id};
|
||||
pub use arrange::{align_menu, arrange_menu};
|
||||
use chart::chart_design;
|
||||
use design::design;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use chart::chart_design_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use design::design_base;
|
||||
pub use design::paint_theme_tile;
|
||||
use draw::draw;
|
||||
// P3(ribbon-w4): rb.A20
|
||||
pub(crate) use design::paint_theme_tile_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use draw::draw_base;
|
||||
pub use galleries::{cref_param, effects_menu, outline_menu, paint_preset, shapes_gallery};
|
||||
pub use home::font_families;
|
||||
use home::home;
|
||||
use insert::insert;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use home::home_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use insert::insert_base;
|
||||
pub use insert::table_grid_picker;
|
||||
use masters::{handout_master, notes_master, slide_master};
|
||||
use picture_format::picture_format;
|
||||
use playback::playback;
|
||||
use review::review;
|
||||
use shape_format::shape_format;
|
||||
use slide_show::{record, slide_show};
|
||||
use smartart::smartart_design;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use masters::{handout_master_base, notes_master_base, slide_master_base};
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use picture_format::picture_format_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use playback::playback_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use review::review_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use shape_format::shape_format_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use slide_show::{record_base, slide_show_base};
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use smartart::smartart_design_base;
|
||||
pub use table::paint_table_style;
|
||||
use table::{table_design, table_layout};
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use table::{table_design_base, table_layout_base};
|
||||
pub use title_bar::{MAC_CONTENT_LEFT, MAC_TITLE_BAR, TITLE_H, title_bar};
|
||||
#[cfg(test)]
|
||||
use title_bar::{MAC_LIGHT, MAC_LIGHT_PITCH, MAC_LIGHTS_LEFT, title_geometry};
|
||||
pub use transitions::paint_transition_tile;
|
||||
#[cfg(test)]
|
||||
use transitions::transition_effect_rows;
|
||||
use transitions::transitions;
|
||||
use view::view;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use transitions::transitions_base;
|
||||
// P3(ribbon-w4): rb.A4
|
||||
use view::view_base;
|
||||
|
||||
/// Is engine command `id` enabled right now?
|
||||
/// Whether `id` names an engine or UI command.
|
||||
@@ -220,26 +238,46 @@ pub fn show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
ui.horizontal_top(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 1.0;
|
||||
match tab.as_str() {
|
||||
"Home" => home(app, ui),
|
||||
"Insert" => insert(app, ui),
|
||||
"Draw" => draw(app, ui),
|
||||
"Design" => design(app, ui),
|
||||
"Transitions" => transitions(app, ui),
|
||||
"Animations" => animations(app, ui),
|
||||
"Slide Show" => slide_show(app, ui),
|
||||
"Record" => record(app, ui),
|
||||
"Review" => review(app, ui),
|
||||
"View" => view(app, ui),
|
||||
"Shape Format" => shape_format(app, ui),
|
||||
"Picture Format" => picture_format(app, ui),
|
||||
"Table Design" => table_design(app, ui),
|
||||
"Layout" => table_layout(app, ui),
|
||||
"Chart Design" => chart_design(app, ui),
|
||||
DIAGRAM_TAB_ID => smartart_design(app, ui),
|
||||
"Playback" => playback(app, ui),
|
||||
"Slide Master" => slide_master(app, ui),
|
||||
"Handout Master" => handout_master(app, ui),
|
||||
"Notes Master" => notes_master(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Home" => home_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Insert" => insert_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Draw" => draw_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Design" => design_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Transitions" => transitions_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Animations" => animations_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Slide Show" => slide_show_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Record" => record_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Review" => review_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"View" => view_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Shape Format" => shape_format_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Picture Format" => picture_format_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Table Design" => table_design_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Layout" => table_layout_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Chart Design" => chart_design_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
DIAGRAM_TAB_ID => smartart_design_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Playback" => playback_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Slide Master" => slide_master_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Handout Master" => handout_master_base(app, ui),
|
||||
// P3(ribbon-w4): rb.A4
|
||||
"Notes Master" => notes_master_base(app, ui),
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,7 +11,8 @@ fn harness(size: egui::Vec2) -> Harness<'static, SlideApp> {
|
||||
let mut session = Session::with_new();
|
||||
let id = session.execute("shape.insert", &json!({"preset": "rect", "rect": [80.0, 80.0, 200.0, 120.0]})).unwrap()["id"].as_u64().unwrap();
|
||||
session.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
let mut app = SlideApp::new(session, Services::default());
|
||||
// P3(ribbon-w8): sh.A2
|
||||
let mut app = SlideApp::new_base(session, Services::default());
|
||||
app.ui.tab = "Animations".into();
|
||||
let mut h = Harness::builder().with_size(size).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -24,7 +24,8 @@ fn harness(select: &[usize]) -> (Harness<'static, SlideApp>, Vec<ShapeId>) {
|
||||
.collect();
|
||||
let picked: Vec<u32> = select.iter().map(|&i| ids[i].0).collect();
|
||||
s.execute("selection.select", &json!({"ids": picked})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(ribbon-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "Shape Format".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -6,7 +6,8 @@ use super::{
|
||||
// ---------- Animations ----------
|
||||
|
||||
/// Render animation preview, gallery, add/effect options, trigger, timing, and playback controls.
|
||||
pub(super) fn animations(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w8): rb.A4
|
||||
pub(super) fn animations_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let has_sel = app.session.active().is_some_and(|d| !d.selection.shapes.is_empty());
|
||||
let cur: Option<deckcraft_model::Animation> = app.session.active().and_then(|d| {
|
||||
let s = d.current_slide()?;
|
||||
@@ -330,3 +331,10 @@ mod animation_option_label_tests {
|
||||
assert_eq!(animation_option_label("changeFontSize", "decrease"), "Decrease");
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w8): rb.A4
|
||||
pub(crate) fn animations(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -2,7 +2,9 @@ use super::{
|
||||
Icon, ShapeId, SlideApp, Ui, big, big_button, big_button_ex, enabled, group, json, menu_item, rows, run, small_button_ex, theme, widgets,
|
||||
};
|
||||
|
||||
pub fn arrange_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
pub fn arrange_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
ui.label(egui::RichText::new("Order Objects").font(theme::bold(12.0)));
|
||||
for (l, id, ic) in [
|
||||
("Bring to Front", "arrange.bringToFront", Icon::BringToFront),
|
||||
@@ -19,7 +21,12 @@ pub fn arrange_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
menu_item(app, ui, Icon::Group, "Regroup", "arrange.regroup", json!({}));
|
||||
ui.separator();
|
||||
ui.label(egui::RichText::new("Position Objects").font(theme::bold(12.0)));
|
||||
ui.menu_button("Align", |ui| align_menu(app, ui));
|
||||
// P3(ribbon-w5): rb.A16
|
||||
ui.menu_button("Align", |ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| align_menu(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
ui.menu_button("Rotate", |ui| {
|
||||
menu_item(app, ui, Icon::RotateRight, "Rotate Right 90°", "arrange.rotateRight", json!({}));
|
||||
menu_item(app, ui, Icon::RotateLeft, "Rotate Left 90°", "arrange.rotateLeft", json!({}));
|
||||
@@ -32,7 +39,9 @@ pub fn arrange_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn align_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
pub fn align_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
let selection = app.session.active().map(|d| d.selection.shapes.clone()).unwrap_or_default();
|
||||
let to_slide = align_to_slide(app.align_to.as_ref(), &selection);
|
||||
let to = if to_slide { "slide" } else { "selection" };
|
||||
@@ -69,7 +78,8 @@ fn align_to_slide(choice: Option<&(Vec<ShapeId>, bool)>, selection: &[ShapeId])
|
||||
}
|
||||
|
||||
/// Render ordering, align, group/ungroup, and rotate controls for the current selection.
|
||||
pub(super) fn arrange_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
pub(super) fn arrange_group_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let sel = enabled(app, "arrange.bringForward");
|
||||
let (m, a) = big_button_ex(ui, Icon::BringForward, "Bring\nForward", sel, true, false);
|
||||
@@ -94,7 +104,12 @@ pub(super) fn arrange_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
big(app, ui, Icon::SelectionPane, "Selection\nPane", "view.pane", json!({"pane": "selection"}));
|
||||
let r = big_button(ui, Icon::AlignObjects, "Align", sel);
|
||||
egui::Popup::menu(&r).show(|ui| align_menu(app, ui));
|
||||
// P3(ribbon-w5): rb.A16
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| align_menu(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
rows(ui, |ui| {
|
||||
let (main, arrow) = small_button_ex(ui, Icon::Group, "Group", sel, false, true);
|
||||
if main.clicked() {
|
||||
@@ -124,7 +139,8 @@ pub(super) fn arrange_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
|
||||
/// Render width and height controls bound to the selected shape, plus the size-position dialog.
|
||||
pub(super) fn size_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
pub(super) fn size_group_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let bx = app
|
||||
.session
|
||||
.active()
|
||||
@@ -158,3 +174,17 @@ pub(super) fn size_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens the ribbon group and runs the picked command.
|
||||
#[allow(dead_code)] // P3(ribbon-w5): rb.A16
|
||||
pub(crate) fn arrange_group(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A16")
|
||||
}
|
||||
|
||||
/// Opens the ribbon group and runs the picked command.
|
||||
#[allow(dead_code)] // P3(ribbon-w5): rb.A16
|
||||
pub(crate) fn size_group(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A16")
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
use super::arrange::arrange_group;
|
||||
// P3(ribbon-w11): rb.A16
|
||||
use super::arrange::arrange_group_base;
|
||||
use super::insert::chart_menu_types;
|
||||
use super::{Icon, SlideApp, Ui, big, big_button, group, json};
|
||||
|
||||
pub(super) fn chart_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn chart_design_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::ChangeChartType, "Change\nChart Type", true);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
@@ -21,5 +23,13 @@ pub(super) fn chart_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
big(app, ui, Icon::EditData, "Edit\nData", "app.dialog", json!({"id": "chartData"}));
|
||||
});
|
||||
arrange_group(app, ui);
|
||||
// P3(ribbon-w11): rb.A16
|
||||
arrange_group_base(app, ui);
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn chart_design(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -7,7 +7,8 @@ use super::{
|
||||
|
||||
/// Render the Design tab's themes, variants, colours, fonts, effects, background, and slide
|
||||
/// size controls.
|
||||
pub(super) fn design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w8): rb.A4
|
||||
pub(super) fn design_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let themes = deckcraft_model::theme::builtin_themes();
|
||||
let cur = app.session.active().and_then(|d| d.doc.masters.first().map(|m| m.theme.name.clone())).unwrap_or_default();
|
||||
group(ui, |ui| {
|
||||
@@ -20,7 +21,8 @@ pub(super) fn design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
sel,
|
||||
|p, r, i| {
|
||||
if let Some(th) = themes.get(i) {
|
||||
paint_theme_tile(p, r, th);
|
||||
// P3(ribbon-w8): rb.A20
|
||||
paint_theme_tile_base(p, r, th);
|
||||
}
|
||||
},
|
||||
|i| names.get(i).cloned().unwrap_or_default(),
|
||||
@@ -46,7 +48,8 @@ pub(super) fn design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
sel,
|
||||
|p, r, i| {
|
||||
if let Some(t) = tiles.get(i) {
|
||||
paint_theme_tile(p, r, t);
|
||||
// P3(ribbon-w8): rb.A20
|
||||
paint_theme_tile_base(p, r, t);
|
||||
}
|
||||
},
|
||||
|i| names.get(i).cloned().unwrap_or_default(),
|
||||
@@ -160,7 +163,8 @@ pub(super) fn design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn paint_theme_tile(p: &egui::Painter, r: Rect, th: &deckcraft_model::Theme) {
|
||||
// P3(ribbon-w8): rb.A20
|
||||
pub(crate) fn paint_theme_tile_base(p: &egui::Painter, r: Rect, th: &deckcraft_model::Theme) {
|
||||
let bg = theme::to_color32(th.colors.get(deckcraft_color::SchemeSlot::Lt1));
|
||||
let fg = theme::to_color32(th.colors.get(deckcraft_color::SchemeSlot::Dk1));
|
||||
p.rect(r, CornerRadius::same(2), bg, Stroke::new(1.0, Color32::from_gray(200)), egui::StrokeKind::Inside);
|
||||
@@ -171,3 +175,17 @@ pub fn paint_theme_tile(p: &egui::Painter, r: Rect, th: &deckcraft_model::Theme)
|
||||
p.rect_filled(Rect::from_min_size(pos2(r.min.x + 8.0 + k as f32 * w, r.max.y - 11.0), vec2(w - 1.5, 5.0)), CornerRadius::ZERO, c);
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w8): rb.A4
|
||||
pub(crate) fn design(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
|
||||
/// Paints a theme tile through the content painter.
|
||||
#[allow(dead_code)] // P3(ribbon-w8): rb.A20
|
||||
pub fn paint_theme_tile(cx: &craft::ui::primitives::ContentPainterCx<'_>, r: Rect, th: &deckcraft_model::Theme) {
|
||||
let _ = (cx, r, th);
|
||||
todo!("rb.A20")
|
||||
}
|
||||
@@ -2,7 +2,8 @@ use super::{Icon, SlideApp, Ui, big_button, big_button_ex, group, json, run};
|
||||
|
||||
// ---------- Draw ----------
|
||||
|
||||
pub(super) fn draw(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w7): rb.A4
|
||||
pub(super) fn draw_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
use deckcraft_engine::ToolKind;
|
||||
let cur = app.session.tool.kind.clone();
|
||||
group(ui, |ui| {
|
||||
@@ -43,3 +44,10 @@ pub(super) fn draw(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let _ = r.on_hover_text("Ink to Math (coming soon)");
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w7): rb.A4
|
||||
pub(crate) fn draw(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -33,7 +33,8 @@ fn table(h: &Harness<'_, SlideApp>) -> Option<(deckcraft_model::Table, deckcraft
|
||||
fn draw_a_table_split_it_and_erase_the_border() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(ribbon-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "Insert".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -7,7 +7,8 @@ use egui_kittest::kittest::Queryable;
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
fn harness() -> Harness<'static, SlideApp> {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(ribbon-w5): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Design".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -54,15 +54,18 @@ pub fn cref_param(c: &deckcraft_model::ColorRef) -> Value {
|
||||
/// Clicking runs `cmd` with `{"kind": …}` plus `extra`; hovering shows the layout larger, drawn
|
||||
/// with `nodes` (the selected graphic's outline) when given: a live preview without touching the
|
||||
/// document.
|
||||
pub(super) fn smartart_gallery(
|
||||
pub(crate) fn smartart_gallery(
|
||||
app: &mut SlideApp,
|
||||
ui: &mut Ui,
|
||||
cx: &mut craft::ui::contract::BodyCx<'_>,
|
||||
cmd: &str,
|
||||
extra: Value,
|
||||
current: &str,
|
||||
(style, colors): (&str, &str),
|
||||
nodes: Option<&[deckcraft_model::DiagramNode]>,
|
||||
) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
use deckcraft_engine::cmd::smartart::{LAYOUTS, category};
|
||||
ui.set_min_width(440.0);
|
||||
let slide = app.session.active().map(|d| d.selection.slide).unwrap_or(0);
|
||||
@@ -125,7 +128,9 @@ pub(super) fn smartart_gallery(
|
||||
}
|
||||
|
||||
/// Shapes gallery popup body: every preset by category. Returns the chosen preset.
|
||||
pub fn shapes_gallery(ui: &mut Ui) -> Option<&'static str> {
|
||||
pub fn shapes_gallery(ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) -> Option<&'static str> {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let mut out = None;
|
||||
ui.set_max_width(330.0);
|
||||
@@ -222,7 +227,8 @@ pub(super) fn kurbo_flatten(path: &deckcraft_geom::BezPath, mut f: impl FnMut(Fl
|
||||
});
|
||||
}
|
||||
|
||||
pub fn outline_menu(app: &mut SlideApp, ui: &mut Ui, sc: &deckcraft_color::ColorScheme) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
pub(crate) fn outline_menu_base(app: &mut SlideApp, ui: &mut Ui, sc: &deckcraft_color::ColorScheme) {
|
||||
if let Some(c) = widgets::color_grid(ui, sc, Some("No Outline")) {
|
||||
match c {
|
||||
Some(c) => {
|
||||
@@ -273,7 +279,9 @@ pub fn outline_menu(app: &mut SlideApp, ui: &mut Ui, sc: &deckcraft_color::Color
|
||||
});
|
||||
}
|
||||
|
||||
pub fn effects_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
pub fn effects_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
ui.menu_button("Shadow", |ui| {
|
||||
for (l, v) in [
|
||||
("No Shadow", "none"),
|
||||
@@ -338,7 +346,9 @@ pub fn effects_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn quick_styles(app: &mut SlideApp, ui: &mut Ui) {
|
||||
pub(super) fn quick_styles(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
// P3(ribbon-w5): rb.A16
|
||||
let _ = cx;
|
||||
let sc = scheme(app);
|
||||
let slots = [
|
||||
deckcraft_color::SchemeSlot::Dk1,
|
||||
@@ -408,3 +418,10 @@ pub fn preset_outline(r: Rect, name: &str) -> Vec<Vec<egui::Pos2>> {
|
||||
let _ = (r, name);
|
||||
todo!("rb.A16")
|
||||
}
|
||||
|
||||
/// Shows the outline menu; a pick runs its command and closes the menu.
|
||||
#[allow(dead_code)] // P3(ribbon-w5): rb.A16
|
||||
pub fn outline_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
let _ = (app, ui, cx);
|
||||
todo!("rb.A16")
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// P3(ribbon-w6): rb.A16
|
||||
use super::arrange::arrange_menu;
|
||||
use super::galleries::{cref_param, effects_menu, outline_menu, quick_styles, shapes_gallery, smartart_gallery};
|
||||
use super::galleries::{cref_param, effects_menu, outline_menu_base, quick_styles, shapes_gallery, smartart_gallery};
|
||||
use super::{
|
||||
Color32, CornerRadius, Icon, Rect, Sense, SlideApp, Stroke, Tokens, Ui, Value, big, big_button, big_button_ex, color_split, dropdown, enabled,
|
||||
fmt_state, group, icon_toggle, json, pos2, rows, run, scheme, small, small_button, small_button_ex, small_button_named, toggle, vec2, widgets,
|
||||
@@ -385,7 +386,14 @@ fn paragraph_group(app: &mut SlideApp, ui: &mut Ui, st: &Value) {
|
||||
}
|
||||
});
|
||||
let r = icon_toggle(ui, Icon::SmartArt, "Convert to Diagram", enabled(app, "smartArt.fromText"), false);
|
||||
egui::Popup::menu(&r).show(|ui| smartart_gallery(app, ui, "smartArt.fromText", json!({}), "", ("", ""), None));
|
||||
// P3(ribbon-w6): rb.A16
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| {
|
||||
smartart_gallery(app, ui, cx, "smartArt.fromText", json!({}), "", ("", ""), None)
|
||||
})
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
if ui.add_enabled(en, egui::Button::new("Paragraph…").min_size(vec2(88.0, 22.0))).on_hover_text("Paragraph").clicked() {
|
||||
run(app, "format.paragraphDialog", json!({}));
|
||||
}
|
||||
@@ -400,16 +408,30 @@ fn drawing_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let en = enabled(app, "shape.insert");
|
||||
let r = big_button(ui, Icon::Shapes, "Shapes", en).on_hover_text("Shapes");
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
if let Some(p) = shapes_gallery(ui) {
|
||||
// P3(ribbon-w6): rb.A16
|
||||
if let Some(p) = craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| shapes_gallery(ui, cx))
|
||||
.inner
|
||||
.flatten()
|
||||
{
|
||||
app.session.set_tool(deckcraft_engine::ToolKind::Shape { preset: p.to_string() });
|
||||
}
|
||||
});
|
||||
big(app, ui, Icon::TextBox, "Text Box", "insert.textBox", json!({}));
|
||||
let sel = enabled(app, "shape.fill");
|
||||
let r = big_button(ui, Icon::Arrange, "Arrange", sel);
|
||||
egui::Popup::menu(&r).show(|ui| arrange_menu(app, ui));
|
||||
// P3(ribbon-w6): rb.A16
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| arrange_menu(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
let r = big_button(ui, Icon::QuickStyles, "Quick\nStyles", sel);
|
||||
egui::Popup::menu(&r).width(330.0).show(|ui| quick_styles(app, ui));
|
||||
// P3(ribbon-w6): rb.A16
|
||||
egui::Popup::menu(&r).width(330.0).show(|ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| quick_styles(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
rows(ui, |ui| {
|
||||
let sc = scheme(app);
|
||||
let (m, a) = small_button_ex(ui, Icon::ShapeFill, "Shape Fill", sel, false, true);
|
||||
@@ -436,17 +458,24 @@ fn drawing_group(app: &mut SlideApp, ui: &mut Ui) {
|
||||
run(app, "shape.line", json!({"color": c}));
|
||||
}
|
||||
if let Some(a) = a {
|
||||
widgets::color_popup(&a).show(|ui| outline_menu(app, ui, &sc));
|
||||
// P3(ribbon-w6): rb.A16
|
||||
widgets::color_popup(&a).show(|ui| outline_menu_base(app, ui, &sc));
|
||||
}
|
||||
let (main, arrow) = small_button_ex(ui, Icon::ShapeEffects, "Shape Effects", sel, false, true);
|
||||
if let Some(arrow) = arrow {
|
||||
widgets::split_menu(&main, &arrow, |ui| effects_menu(app, ui));
|
||||
// P3(ribbon-w6): rb.A16
|
||||
widgets::split_menu(&main, &arrow, |ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| effects_menu(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn home(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w6): rb.A4
|
||||
pub(super) fn home_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let st = fmt_state(app);
|
||||
clipboard_group(app, ui);
|
||||
slides_group(app, ui);
|
||||
@@ -479,3 +508,10 @@ pub(super) fn painter_toggle(app: &mut SlideApp, ui: &mut Ui, icon: Icon, label:
|
||||
let _ = (app, ui, icon, label, cmd, armed);
|
||||
todo!("rb.A19")
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w6): rb.A4
|
||||
pub(crate) fn home(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -9,7 +9,8 @@ use crate::{Services, SlideApp};
|
||||
|
||||
#[test]
|
||||
fn clicking_inside_the_icons_popup_keeps_it_open() {
|
||||
let mut app = SlideApp::new(Session::with_new(), Services::default());
|
||||
// P3(ribbon-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(Session::with_new(), Services::default());
|
||||
app.ui.tab = "Insert".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -14,7 +14,8 @@ fn pen_a_rectangle_then_ink_to_shape() {
|
||||
let _gpu = crate::gpu_lock::gpu_lock();
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(ribbon-w7): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "Draw".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -29,7 +29,8 @@ fn photo_album_button(app: &mut SlideApp, ui: &mut Ui) {
|
||||
|
||||
// ---------- Insert ----------
|
||||
|
||||
pub(super) fn insert(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w7): rb.A4
|
||||
pub(super) fn insert_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let (main, arrow) = big_button_ex(ui, Icon::NewSlide, "New\nSlide", enabled(app, "slide.new"), true, false);
|
||||
if main.clicked() {
|
||||
@@ -66,7 +67,11 @@ pub(super) fn insert(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::Shapes, "Shapes", enabled(app, "shape.insert"));
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
if let Some(p) = shapes_gallery(ui) {
|
||||
// P3(ribbon-w7): rb.A16
|
||||
if let Some(p) = craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| shapes_gallery(ui, cx))
|
||||
.inner
|
||||
.flatten()
|
||||
{
|
||||
app.session.set_tool(deckcraft_engine::ToolKind::Shape { preset: p.to_string() });
|
||||
}
|
||||
});
|
||||
@@ -272,3 +277,10 @@ pub(super) fn chart_menu_types() -> Vec<Option<deckcraft_model::chart::ChartType
|
||||
v.extend(ChartType::OFFICE_2016.iter().copied().filter(|k| !ChartType::MAIN.contains(k)).map(Some));
|
||||
v
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w7): rb.A4
|
||||
pub(crate) fn insert(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -26,7 +26,8 @@ fn app_on_blank() -> (SlideApp, usize) {
|
||||
let mut session = Session::with_new();
|
||||
let blank = session.doc().unwrap().doc.masters[0].layouts.iter().position(|l| l.name == "Blank").unwrap();
|
||||
session.execute("view.slideMaster", &json!({"master": 0, "layout": blank})).unwrap();
|
||||
let mut app = SlideApp::new(session, Services::default());
|
||||
// P3(ribbon-w11): sh.A2
|
||||
let mut app = SlideApp::new_base(session, Services::default());
|
||||
app.ui.tab = "Slide Master".into();
|
||||
(app, blank)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ fn master_checks(app: &SlideApp) -> (bool, bool, bool) {
|
||||
(preserve, title, footers)
|
||||
}
|
||||
|
||||
pub(super) fn slide_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn slide_master_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
big(app, ui, Icon::NewSlide, "Insert\nLayout", "master.insertLayout", json!({}));
|
||||
big(app, ui, Icon::DeleteSlide, "Delete", "master.deleteLayout", json!({}));
|
||||
@@ -70,7 +71,8 @@ pub(super) fn slide_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn notes_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn notes_master_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
use deckcraft_model::PhType;
|
||||
let shown = |app: &SlideApp, k: PhType| {
|
||||
@@ -100,7 +102,8 @@ pub(super) fn notes_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn handout_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn handout_master_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::Layout, &format!("Slides Per\nPage: {}", app.ui.handout_per_page), true);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
@@ -139,3 +142,24 @@ pub(super) fn handout_master(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn slide_master(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn notes_master(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn handout_master(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::arrange::{arrange_group, size_group};
|
||||
// P3(ribbon-w10): rb.A16
|
||||
use super::arrange::{arrange_group_base, size_group_base};
|
||||
use super::galleries::{cref_param, shapes_gallery};
|
||||
use super::{
|
||||
Color32, CornerRadius, Icon, Rect, SlideApp, Stroke, Ui, Value, big, big_button, color_split, enabled, group, json, pos2, rows, run, scheme,
|
||||
@@ -7,7 +8,8 @@ use super::{
|
||||
|
||||
/// Render the Picture Format tab's corrections, colour, artistic effects, transparency, styles,
|
||||
/// border, and picture actions.
|
||||
pub(super) fn picture_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w10): rb.A4
|
||||
pub(super) fn picture_format_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::RemoveBackground, "Remove\nBackground", enabled(app, "picture.removeBackground"));
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
@@ -169,12 +171,17 @@ pub(super) fn picture_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
big(app, ui, Icon::AltText, "Alt\nText", "app.dialog", json!({"id": "altText"}));
|
||||
});
|
||||
arrange_group(app, ui);
|
||||
// P3(ribbon-w10): rb.A16
|
||||
arrange_group_base(app, ui);
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::Crop, "Crop", true);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
ui.label("Crop to Shape");
|
||||
if let Some(p) = shapes_gallery(ui) {
|
||||
// P3(ribbon-w10): rb.A16
|
||||
if let Some(p) = craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| shapes_gallery(ui, cx))
|
||||
.inner
|
||||
.flatten()
|
||||
{
|
||||
run(app, "shape.change", json!({"preset": p}));
|
||||
}
|
||||
ui.separator();
|
||||
@@ -185,7 +192,8 @@ pub(super) fn picture_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
});
|
||||
size_group(app, ui);
|
||||
// P3(ribbon-w10): rb.A16
|
||||
size_group_base(app, ui);
|
||||
}
|
||||
|
||||
const STYLE_TILE: egui::Vec2 = vec2(56.0, 44.0);
|
||||
@@ -321,3 +329,10 @@ fn compress_menu(app: &mut SlideApp, ui: &mut Ui) {
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w10): rb.A4
|
||||
pub(crate) fn picture_format(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -20,7 +20,8 @@ fn picture_format(width: f32) -> (Harness<'static, SlideApp>, ShapeId) {
|
||||
let data = deckcraft_engine::cmd::base64_encode(&png);
|
||||
let id = s.execute("insert.picture", &json!({"data": data, "name": "a.png", "rect": [200, 100, 400, 250]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(ribbon-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = "Picture Format".into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(width, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::{Icon, ShapeKind, SlideApp, Ui, big, big_button, group, json, rows, run};
|
||||
|
||||
pub(super) fn playback(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn playback_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let m = app
|
||||
.session
|
||||
.active()
|
||||
@@ -53,3 +54,10 @@ pub(super) fn playback(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn playback(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -17,7 +17,8 @@ fn comment_nav(app: &mut SlideApp, ui: &mut Ui, forward: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn review(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w9): rb.A4
|
||||
pub(super) fn review_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
big(app, ui, Icon::Spelling, "Spelling", "app.dialog", json!({"id": "spelling"}));
|
||||
big(app, ui, Icon::Thesaurus, "Thesaurus", "review.thesaurusPane", json!({}));
|
||||
@@ -56,3 +57,10 @@ pub(super) fn review(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w9): rb.A4
|
||||
pub(crate) fn review(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
use super::arrange::{arrange_group, size_group};
|
||||
use super::galleries::{cref_param, effects_menu, outline_menu, quick_styles, shapes_gallery};
|
||||
// P3(ribbon-w9): rb.A16
|
||||
use super::arrange::{arrange_group_base, size_group_base};
|
||||
// P3(ribbon-w9): rb.A16
|
||||
use super::galleries::{cref_param, effects_menu, outline_menu_base, quick_styles, shapes_gallery};
|
||||
use super::{
|
||||
Color32, CornerRadius, Icon, Rect, Sense, SlideApp, Stroke, Tokens, Ui, big, big_button, enabled, group, json, pos2, rows, run, scheme,
|
||||
small_button, small_button_ex, theme, vec2, widgets,
|
||||
@@ -107,13 +109,18 @@ fn stroke_guide(p: &egui::Painter, g: &deckcraft_geom::warp::Guide, color: Color
|
||||
}
|
||||
|
||||
/// Render the Shape Format tab's shape, fill, outline, effects, text, arrange, and size controls.
|
||||
pub(super) fn shape_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w9): rb.A4
|
||||
pub(super) fn shape_format_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let sc = scheme(app);
|
||||
let sel = enabled(app, "shape.fill");
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::Shapes, "Shapes", true);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
if let Some(p) = shapes_gallery(ui) {
|
||||
// P3(ribbon-w9): rb.A16
|
||||
if let Some(p) = craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| shapes_gallery(ui, cx))
|
||||
.inner
|
||||
.flatten()
|
||||
{
|
||||
app.session.set_tool(deckcraft_engine::ToolKind::Shape { preset: p.to_string() });
|
||||
}
|
||||
});
|
||||
@@ -121,7 +128,11 @@ pub(super) fn shape_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let r = big_button(ui, Icon::EditShape, "Edit\nShape", sel);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
ui.label("Change Shape");
|
||||
if let Some(p) = shapes_gallery(ui) {
|
||||
// P3(ribbon-w9): rb.A16
|
||||
if let Some(p) = craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| shapes_gallery(ui, cx))
|
||||
.inner
|
||||
.flatten()
|
||||
{
|
||||
run(app, "shape.change", json!({"preset": p}));
|
||||
}
|
||||
ui.separator();
|
||||
@@ -145,7 +156,12 @@ pub(super) fn shape_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::QuickStyles, "Shape\nStyles", sel);
|
||||
egui::Popup::menu(&r).width(330.0).show(|ui| quick_styles(app, ui));
|
||||
// P3(ribbon-w9): rb.A16
|
||||
egui::Popup::menu(&r).width(330.0).show(|ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| quick_styles(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
rows(ui, |ui| {
|
||||
let (m, a) = small_button_ex(ui, Icon::ShapeFill, "Shape Fill", sel, false, true);
|
||||
if m.clicked() {
|
||||
@@ -175,11 +191,17 @@ pub(super) fn shape_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
run(app, "shape.line", json!({"color": c}));
|
||||
}
|
||||
if let Some(a) = a {
|
||||
widgets::color_popup(&a).show(|ui| outline_menu(app, ui, &sc));
|
||||
// P3(ribbon-w9): rb.A16
|
||||
widgets::color_popup(&a).show(|ui| outline_menu_base(app, ui, &sc));
|
||||
}
|
||||
let (main, arrow) = small_button_ex(ui, Icon::ShapeEffects, "Shape Effects", sel, false, true);
|
||||
if let Some(arrow) = arrow {
|
||||
widgets::split_menu(&main, &arrow, |ui| effects_menu(app, ui));
|
||||
// P3(ribbon-w9): rb.A16
|
||||
widgets::split_menu(&main, &arrow, |ui| {
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| effects_menu(app, ui, cx))
|
||||
.inner
|
||||
.unwrap_or_default()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -219,8 +241,10 @@ pub(super) fn shape_format(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
big(app, ui, Icon::AltText, "Alt\nText", "app.dialog", json!({"id": "altText"}));
|
||||
});
|
||||
arrange_group(app, ui);
|
||||
size_group(app, ui);
|
||||
// P3(ribbon-w9): rb.A16
|
||||
arrange_group_base(app, ui);
|
||||
// P3(ribbon-w9): rb.A16
|
||||
size_group_base(app, ui);
|
||||
group(ui, |ui| {
|
||||
big(app, ui, Icon::FormatBackground, "Format\nPane", "view.pane", json!({"pane": "format"}));
|
||||
});
|
||||
@@ -267,3 +291,10 @@ fn smooth_corners_row(app: &mut SlideApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w9): rb.A4
|
||||
pub(crate) fn shape_format(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -2,7 +2,8 @@ use super::{Icon, SlideApp, Ui, big, big_button, big_button_ex, group, json, row
|
||||
|
||||
// ---------- Slide Show / Record / Review / View ----------
|
||||
|
||||
pub(super) fn slide_show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w9): rb.A4
|
||||
pub(super) fn slide_show_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
if big_button(ui, Icon::PlayFromStart, "Play from\nStart", true).clicked() {
|
||||
app.start_show(app.show_start_index(), false);
|
||||
@@ -52,7 +53,8 @@ pub(super) fn slide_show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn record(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w9): rb.A4
|
||||
pub(super) fn record_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::Cameo, "Cameo", false);
|
||||
let _ = r.on_hover_text("Camera capture is not available yet");
|
||||
@@ -76,3 +78,17 @@ pub(super) fn record(app: &mut SlideApp, ui: &mut Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w9): rb.A4
|
||||
pub(crate) fn slide_show(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w9): rb.A4
|
||||
pub(crate) fn record(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
use super::arrange::arrange_group;
|
||||
// P3(ribbon-w11): rb.A16
|
||||
use super::arrange::arrange_group_base;
|
||||
use super::galleries::smartart_gallery;
|
||||
use super::{Icon, SlideApp, Ui, Value, big_button, group, json, rows, run, small_button, small_button_ex, widgets};
|
||||
|
||||
/// SmartArt Design: Create Graphic (Text Pane, Add Shape, Promote, Demote, Remove) and Layouts.
|
||||
pub(super) fn smartart_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w11): rb.A4
|
||||
pub(super) fn smartart_design_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let sel = app.session.active().and_then(deckcraft_engine::cmd::smartart::selected);
|
||||
let row = app.ui.smartart_row;
|
||||
let (gid, n, kind, style, colors) = match &sel {
|
||||
@@ -53,7 +55,12 @@ pub(super) fn smartart_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let outline = sel.as_ref().map(|(_, d)| d.nodes.clone());
|
||||
if let Some(arrow) = arrow {
|
||||
widgets::split_menu(&main, &arrow, |ui| {
|
||||
smartart_gallery(app, ui, "smartArt.layout", json!({"id": gid}), &kind, (&style, &colors), outline.as_deref());
|
||||
// P3(ribbon-w11): rb.A16
|
||||
craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| {
|
||||
smartart_gallery(app, ui, cx, "smartArt.layout", json!({"id": gid}), &kind, (&style, &colors), outline.as_deref())
|
||||
})
|
||||
.inner
|
||||
.unwrap_or_default();
|
||||
});
|
||||
}
|
||||
let (main, arrow) = small_button_ex(ui, Icon::Layout, "Convert", gid.is_some(), false, true);
|
||||
@@ -99,5 +106,13 @@ pub(super) fn smartart_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
});
|
||||
arrange_group(app, ui);
|
||||
// P3(ribbon-w11): rb.A16
|
||||
arrange_group_base(app, ui);
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w11): rb.A4
|
||||
pub(crate) fn smartart_design(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
use super::arrange::arrange_group;
|
||||
// P3(ribbon-w10): rb.A16
|
||||
use super::arrange::arrange_group_base;
|
||||
use super::galleries::cref_param;
|
||||
use super::{
|
||||
Color32, CornerRadius, Icon, Rect, Sense, ShapeKind, SlideApp, Stroke, Ui, Value, big, big_button, big_button_ex, color_split, group, json,
|
||||
menu_item, pos2, rows, run, scheme, small, theme, toggle, vec2, widgets,
|
||||
};
|
||||
|
||||
pub(super) fn table_design(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w10): rb.A4
|
||||
pub(super) fn table_design_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let tbl = app
|
||||
.session
|
||||
.active()
|
||||
@@ -188,7 +190,8 @@ pub fn paint_table_style(p: &egui::Painter, r: Rect, id: &str, sc: &deckcraft_co
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn table_layout(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w10): rb.A4
|
||||
pub(super) fn table_layout_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
group(ui, |ui| {
|
||||
let r = big_button(ui, Icon::DeleteTable, "Delete", true);
|
||||
egui::Popup::menu(&r).show(|ui| {
|
||||
@@ -235,5 +238,20 @@ pub(super) fn table_layout(app: &mut SlideApp, ui: &mut Ui) {
|
||||
});
|
||||
});
|
||||
});
|
||||
arrange_group(app, ui);
|
||||
// P3(ribbon-w10): rb.A16
|
||||
arrange_group_base(app, ui);
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w10): rb.A4
|
||||
pub(crate) fn table_design(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w10): rb.A4
|
||||
pub(crate) fn table_layout(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -8,7 +8,8 @@ use super::{
|
||||
|
||||
/// Render transition preview, gallery, options, sound, and timing controls for the current
|
||||
/// slide.
|
||||
pub(super) fn transitions(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w8): rb.A4
|
||||
pub(super) fn transitions_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let cur = app.session.active().and_then(|d| d.current_slide().and_then(|s| s.transition.clone()));
|
||||
let kind = cur.as_ref().map(|t| t.kind.clone()).unwrap_or_else(|| "none".into());
|
||||
group(ui, |ui| {
|
||||
@@ -244,3 +245,10 @@ pub(super) fn transition_effect_rows(kind: &str, current: Option<&str>) -> Vec<(
|
||||
let opts = deckcraft_model::anim::TRANSITIONS.iter().find(|x| x.0 == kind).map(|x| x.4).unwrap_or(&[]);
|
||||
marked_options(opts, current)
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w8): rb.A4
|
||||
pub(crate) fn transitions(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::{Icon, SlideApp, Target, Ui, big_button, big_button_ex, group, json, rows, run, theme};
|
||||
|
||||
pub(super) fn view(app: &mut SlideApp, ui: &mut Ui) {
|
||||
// P3(ribbon-w7): rb.A4
|
||||
pub(super) fn view_base(app: &mut SlideApp, ui: &mut Ui) {
|
||||
use crate::ViewMode;
|
||||
group(ui, |ui| {
|
||||
for (icon, label, id, mode) in [
|
||||
@@ -161,3 +162,10 @@ pub(crate) struct ZoomPick {
|
||||
kind: u8,
|
||||
picked: Vec<usize>,
|
||||
}
|
||||
|
||||
/// Opens this tab's ribbon groups.
|
||||
#[allow(dead_code)] // P3(ribbon-w7): rb.A4
|
||||
pub(crate) fn view(app: &mut SlideApp, row: &mut craft::menu::ribbon::RibbonRow<'_>) {
|
||||
let _ = (app, row);
|
||||
todo!("rb.A4")
|
||||
}
|
||||
@@ -41,7 +41,10 @@ pub type Inbox = std::sync::Arc<std::sync::Mutex<Vec<InboxEvent>>>;
|
||||
#[derive(Default)]
|
||||
pub struct Services {
|
||||
/// Browser-owned presenter popup; absent on native hosts.
|
||||
pub presenter: Option<Box<dyn crate::presenter::Host>>,
|
||||
pub presenter: Option<Box<dyn craft::web_host::link::WindowLink>>,
|
||||
/// The base presenter host retained until its readers move to the window link.
|
||||
// P3(shell-w11): sh.A9
|
||||
pub presenter_base: Option<Box<dyn crate::presenter::Host>>,
|
||||
/// Open-file dialog for a purpose (`open`, `picture`, `audio`, `video`) → path.
|
||||
pub pick_open: Option<PickFn>,
|
||||
/// Save dialog with a suggested name → path.
|
||||
|
||||
@@ -154,7 +154,8 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
for ui in [hostile.clone().sanitized(), UiState { zoom: Some(1.0e4), ..Default::default() }] {
|
||||
let mut app = crate::SlideApp::new(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
// P3(shell-w12): sh.A2
|
||||
let mut app = crate::SlideApp::new_base(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
// The second case is not sanitized: the canvas keeps a stray zoom in range itself.
|
||||
app.ui = ui;
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state(
|
||||
|
||||
@@ -23,14 +23,17 @@ pub(crate) use zoom::GRID_CAP;
|
||||
#[cfg(test)]
|
||||
use media::{on_screen, pointer_on_media_bar, shown_slide_rect, slide_media_bars};
|
||||
use presenter::{NOTES_DEFAULT, PresenterTimer};
|
||||
// P3(show-w4): ss.A11
|
||||
pub(crate) use presenter::format_elapsed;
|
||||
#[cfg(test)]
|
||||
use presenter::{NOTES_MAX, NOTES_MIN, NOTES_STEP, format_elapsed, presenter_notes, presenter_window, wall_clock};
|
||||
use presenter::{NOTES_MAX, NOTES_MIN, NOTES_STEP, presenter_notes, presenter_window, wall_clock};
|
||||
#[cfg(test)]
|
||||
use render::{below_playing_video, next_rect, render_frame, start_prefetch};
|
||||
use render::{render_backdrop, render_threads};
|
||||
#[cfg(test)]
|
||||
use ui::transition_layers;
|
||||
pub use ui::ui;
|
||||
// P3(show-w4): ss.A9
|
||||
pub(crate) use ui::ui;
|
||||
use zoom::Zoom;
|
||||
#[cfg(test)]
|
||||
use zoom::{GOTO_DIGITS, norm_on_slide, see_all_cells, see_all_hit, toggle_blank, unit_uv, wheel_zoom_lines, zoom_uv};
|
||||
@@ -88,7 +91,7 @@ pub struct Show {
|
||||
prefetch: Option<Prefetch>,
|
||||
/// The current slide's backdrop, under its animation frames.
|
||||
backdrop: Option<Backdrop>,
|
||||
blank: Option<Color32>,
|
||||
blank: Option<Blank>,
|
||||
/// See All Slides covers the show until a slide is chosen.
|
||||
pub grid: bool,
|
||||
/// The Presenter View's own See All Slides: the grid replaces the slide and notes in that window only; the audience keeps the slide.
|
||||
@@ -100,7 +103,7 @@ pub struct Show {
|
||||
pen: bool,
|
||||
/// A dot that follows the pointer and leaves no ink (`Cmd/Ctrl+L`).
|
||||
laser: bool,
|
||||
strokes: Vec<Vec<Pos2>>,
|
||||
strokes: Vec<Vec<craft::behavior::kurbo::Point>>,
|
||||
/// Digits typed for Go to Slide, shown until Enter, Esc, or a short pause.
|
||||
goto: String,
|
||||
goto_at: f64,
|
||||
@@ -333,7 +336,14 @@ impl Show {
|
||||
grid: self.grid,
|
||||
pen: self.pen,
|
||||
laser: self.laser,
|
||||
blank: self.blank.map(|c| [c.r(), c.g(), c.b(), c.a()]),
|
||||
// P3(show-w4): ss.A4
|
||||
blank: self
|
||||
.blank
|
||||
.map(|c| match c {
|
||||
Blank::Black => Color32::BLACK,
|
||||
Blank::White => Color32::WHITE,
|
||||
})
|
||||
.map(|c| [c.r(), c.g(), c.b(), c.a()]),
|
||||
zoom: self.zoom.map(|z| [bits(z.nx), bits(z.ny), bits(z.scale)]),
|
||||
zoom_arm: self.zoom_arm,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::presenter::NOTES_STEP;
|
||||
use super::zoom::{plain, toggle_blank};
|
||||
use super::{Color32, Presentation, Show, ShowAction};
|
||||
// P3(show-w4): ss.A4
|
||||
use super::{Presentation, Show, ShowAction};
|
||||
|
||||
/// Read the current viewport's show keys before its widgets can consume them. Both the
|
||||
/// audience window and Presenter View use this path, including animation steps and end-of-show.
|
||||
@@ -143,8 +144,10 @@ fn tool_key(show: &mut Show, k: egui::Key, m: egui::Modifiers, now: f64, present
|
||||
match k {
|
||||
L if m.command => show.set_laser(!show.laser),
|
||||
A if m.command => show.arrow(),
|
||||
B | Period => toggle_blank(show, Color32::BLACK),
|
||||
W | Comma => toggle_blank(show, Color32::WHITE),
|
||||
// P3(show-w4): ss.A4
|
||||
B | Period => toggle_blank(show, super::Blank::Black),
|
||||
// P3(show-w4): ss.A4
|
||||
W | Comma => toggle_blank(show, super::Blank::White),
|
||||
E => show.strokes.clear(),
|
||||
G if plain(m) => show.open_grid(presenter),
|
||||
Z if plain(m) => show.zoom_key(),
|
||||
|
||||
@@ -61,7 +61,8 @@ fn finite_secs(n: f64) -> f64 {
|
||||
if n.is_finite() && n >= 0.0 { n } else { 0.0 }
|
||||
}
|
||||
|
||||
pub(super) fn format_elapsed(secs: f64) -> String {
|
||||
// P3(show-w7): ss.A11
|
||||
pub(crate) fn format_elapsed(secs: f64) -> String {
|
||||
let s = finite_secs(secs) as u64;
|
||||
let s = s.min(99 * 3600 + 59 * 60 + 59);
|
||||
format!("{:02}:{:02}:{:02}", s / 3600, (s / 60) % 60, s % 60)
|
||||
@@ -186,11 +187,15 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std::
|
||||
if button(ui, "Reset").clicked() {
|
||||
show.timer.reset(now);
|
||||
}
|
||||
if button(ui, if show.blank == Some(Color32::BLACK) { "Black on" } else { "Black" }).clicked() {
|
||||
toggle_blank(show, Color32::BLACK);
|
||||
// P3(show-w7): ss.A4
|
||||
if button(ui, if show.blank == Some(super::Blank::Black) { "Black on" } else { "Black" }).clicked() {
|
||||
// P3(show-w7): ss.A4
|
||||
toggle_blank(show, super::Blank::Black);
|
||||
}
|
||||
if button(ui, if show.blank == Some(Color32::WHITE) { "White on" } else { "White" }).clicked() {
|
||||
toggle_blank(show, Color32::WHITE);
|
||||
// P3(show-w7): ss.A4
|
||||
if button(ui, if show.blank == Some(super::Blank::White) { "White on" } else { "White" }).clicked() {
|
||||
// P3(show-w7): ss.A4
|
||||
toggle_blank(show, super::Blank::White);
|
||||
}
|
||||
if button(ui, if show.presenter_grid { "All slides on" } else { "All slides" }).clicked() {
|
||||
show.presenter_grid = !show.presenter_grid;
|
||||
@@ -242,7 +247,15 @@ pub(super) fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &std::
|
||||
}
|
||||
}
|
||||
if let Some(c) = show.blank {
|
||||
ui.painter().rect_filled(cr, CornerRadius::ZERO, c);
|
||||
// P3(show-w7): ss.A4
|
||||
ui.painter().rect_filled(
|
||||
cr,
|
||||
CornerRadius::ZERO,
|
||||
match c {
|
||||
super::Blank::Black => Color32::BLACK,
|
||||
super::Blank::White => Color32::WHITE,
|
||||
},
|
||||
);
|
||||
}
|
||||
let nr = next_rect(right, doc);
|
||||
ui.painter().text(right.min, Align2::LEFT_TOP, "Next", theme::font(13.0), Color32::from_gray(170));
|
||||
|
||||
@@ -34,7 +34,8 @@ fn a_still_cursor_hides_over_a_clickable_shape() {
|
||||
let size = session.active().unwrap().doc.slide_size;
|
||||
let r = session.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap();
|
||||
session.execute("insert.hyperlink", &json!({"url": "https://example.org", "ids": [r["id"]]})).unwrap();
|
||||
let app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let app = SlideApp::new_base(session, crate::Services::default());
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
@@ -62,7 +63,8 @@ fn keep_cursor_visible_leaves_a_still_cursor_over_a_link() {
|
||||
session.execute("slide.go", &json!({"index": 0})).unwrap();
|
||||
let r = session.execute("shape.insert", &json!({"preset": "rect", "rect": [0.0, 0.0, size.width, size.height]})).unwrap();
|
||||
session.execute("insert.hyperlink", &json!({"slide": 1, "ids": [r["id"]]})).unwrap();
|
||||
let mut app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, crate::Services::default());
|
||||
app.ui.presenter_view = false;
|
||||
app.run("show.keepCursor", json!({"on": true})).unwrap();
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25).build_ui_state(
|
||||
@@ -89,7 +91,8 @@ fn keep_cursor_visible_leaves_a_still_cursor_over_a_link() {
|
||||
fn set_up_slide_show_keeps_the_cursor_visible() {
|
||||
use egui_kittest::kittest::Queryable;
|
||||
|
||||
let app = SlideApp::new(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let app = SlideApp::new_base(deckcraft_engine::Session::with_new(), crate::Services::default());
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1200.0, 800.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
@@ -202,7 +205,8 @@ fn show_with_clip() -> (egui_kittest::Harness<'static, SlideApp>, ShapeId, Pos2,
|
||||
let slide = std::rc::Rc::new(std::cell::Cell::new(Rect::NOTHING));
|
||||
let slide_seen = slide.clone();
|
||||
// Presenter view opens an embedded window over the whole screen here, which takes the clicks.
|
||||
let mut app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, crate::Services::default());
|
||||
app.ui.presenter_view = false;
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(size).with_step_dt(0.25).build_ui_state(
|
||||
move |ui, app: &mut SlideApp| {
|
||||
@@ -302,7 +306,8 @@ fn show_with_gif() -> (egui_kittest::Harness<'static, SlideApp>, ShapeId, Pos2)
|
||||
.unwrap();
|
||||
let slide = std::rc::Rc::new(std::cell::Cell::new(Rect::NOTHING));
|
||||
let slide_seen = slide.clone();
|
||||
let mut app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, crate::Services::default());
|
||||
app.ui.presenter_view = false;
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(0.25).build_ui_state(
|
||||
move |ui, app: &mut SlideApp| {
|
||||
@@ -413,7 +418,8 @@ fn slideshow_navigation_advances_once_with_presenter_view() {
|
||||
let mut session = deckcraft_engine::Session::with_new();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
let mut app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, crate::Services::default());
|
||||
app.ui.presenter_view = true;
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
@@ -808,7 +814,8 @@ fn show_of_three() -> egui_kittest::Harness<'static, SlideApp> {
|
||||
let mut session = deckcraft_engine::Session::with_new();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
let mut app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, crate::Services::default());
|
||||
app.ui.presenter_view = false;
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
@@ -894,11 +901,14 @@ fn escape_leaves_the_grid_then_the_zoom_and_blank_toggles() {
|
||||
assert!(show.zoom_arm);
|
||||
show.zoom_key();
|
||||
assert!(!show.zoom_arm);
|
||||
toggle_blank(&mut show, Color32::BLACK);
|
||||
// P3(show-w10): ss.A4
|
||||
toggle_blank(&mut show, super::Blank::Black);
|
||||
assert_eq!(show.blank_name(), Some("black"));
|
||||
toggle_blank(&mut show, Color32::WHITE);
|
||||
// P3(show-w10): ss.A4
|
||||
toggle_blank(&mut show, super::Blank::White);
|
||||
assert_eq!(show.blank_name(), Some("white"));
|
||||
toggle_blank(&mut show, Color32::WHITE);
|
||||
// P3(show-w10): ss.A4
|
||||
toggle_blank(&mut show, super::Blank::White);
|
||||
assert_eq!(show.blank_name(), None);
|
||||
show.zoom = Some(Zoom::at(0.4, 0.6));
|
||||
assert!(show.apply(ShowAction::Slide(1), &doc, 1.0));
|
||||
@@ -1088,7 +1098,8 @@ fn back_leaves_a_slide_whose_first_animation_is_with_previous() {
|
||||
session
|
||||
.execute("animation.add", &json!({"effect": "fade", "class": "entrance", "ids": [id.0], "start": "withPrevious", "duration": 500}))
|
||||
.unwrap();
|
||||
let app = SlideApp::new(session, crate::Services::default());
|
||||
// P3(show-w10): sh.A2
|
||||
let app = SlideApp::new_base(session, crate::Services::default());
|
||||
let mut harness = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
@@ -1154,7 +1165,8 @@ fn input_state_tracks_the_modes_that_move_show_click_targets() {
|
||||
assert_ne!(show.input_state(), base, "a zoomed slide has a different click mapping");
|
||||
show.zoom = None;
|
||||
|
||||
show.blank = Some(Color32::BLACK);
|
||||
// P3(show-w10): ss.A4
|
||||
show.blank = Some(super::Blank::Black);
|
||||
assert_ne!(show.input_state(), base, "a blank screen has no slide click targets");
|
||||
}
|
||||
|
||||
@@ -1193,8 +1205,10 @@ fn remote_presenter_uses_the_audience_state_and_closes_with_the_show() {
|
||||
let mut session = deckcraft_engine::Session::with_new();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
session.execute("slide.new", &json!({})).unwrap();
|
||||
let services = crate::Services { presenter: Some(Box::new(Mock(bridge.clone()))), ..Default::default() };
|
||||
let mut app = SlideApp::new(session, services);
|
||||
// P3(show-w10): sh.A9
|
||||
let services = crate::Services { presenter_base: Some(Box::new(Mock(bridge.clone()))), ..Default::default() };
|
||||
// P3(show-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(session, services);
|
||||
app.ui.presenter_view = true;
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(1000.0, 700.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -2,7 +2,8 @@ use super::keys::{handle_keys, keyboard};
|
||||
use super::media::{
|
||||
Pick, Under, gif_hit, media_bar_target, media_hit, on_screen, pointer_on_media_bar, run_media_cues, shapes_under_pointer, show_media,
|
||||
};
|
||||
use super::presenter::{PresenterTimer, format_elapsed, presenter_window};
|
||||
// P3(show-w5): ss.A11
|
||||
use super::presenter::{PresenterTimer, presenter_window};
|
||||
use super::render::{below_playing_video, fit, part_textures, quad_mesh, render_frame, render_overlay, render_threads, start_prefetch};
|
||||
use super::zoom::{
|
||||
Zoom, grid_indices, norm_on_slide, paint_grid, see_all_hit, slide_aspect, slide_box, slide_to_screen, toggle_blank, tool_bar_rect, unit_uv,
|
||||
@@ -54,11 +55,14 @@ struct Sl {
|
||||
|
||||
/// Draw and advance the active show, handling hidden frames, timing, input, transitions, and
|
||||
/// presenter/reading presentation.
|
||||
pub fn ui(app: &mut SlideApp, ui: &mut Ui) {
|
||||
pub(crate) fn ui(app: &mut SlideApp, ui: &mut Ui, bcx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
// P3(show-w5): ss.A9
|
||||
let _ = bcx;
|
||||
let ctx = ui.ctx().clone();
|
||||
let Some((doc_uid, doc)) = app.session.active().map(|d| (d.uid, d.doc.clone())) else {
|
||||
app.show = None;
|
||||
if let Some(host) = app.services.presenter.as_mut() {
|
||||
// P3(show-w5): sh.A9
|
||||
if let Some(host) = app.services.presenter_base.as_mut() {
|
||||
host.close();
|
||||
}
|
||||
return;
|
||||
@@ -74,11 +78,13 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) {
|
||||
return;
|
||||
}
|
||||
show.observe_visible_frame(now, web_time::Instant::now());
|
||||
begin_show(&ctx, &mut show, &doc, now, app.services.presenter.is_some());
|
||||
// P3(show-w5): sh.A9
|
||||
begin_show(&ctx, &mut show, &doc, now, app.services.presenter_base.is_some());
|
||||
let mut out = Out { keep: keyboard(&ctx, &mut show, &doc, now, false), actions: vec![] };
|
||||
if show.presenter
|
||||
&& !show.reading
|
||||
&& let Some(host) = app.services.presenter.as_mut()
|
||||
// P3(show-w5): sh.A9
|
||||
&& let Some(host) = app.services.presenter_base.as_mut()
|
||||
{
|
||||
if show.remote_opened && show.presenter_grid && !host.is_open() {
|
||||
// A grid left open in the closed popup would hold auto-advance for the rest of the show.
|
||||
@@ -140,7 +146,8 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) {
|
||||
if out.keep
|
||||
&& show.presenter
|
||||
&& !show.reading
|
||||
&& let Some(host) = app.services.presenter.as_mut()
|
||||
// P3(show-w5): sh.A9
|
||||
&& let Some(host) = app.services.presenter_base.as_mut()
|
||||
{
|
||||
if now - show.remote_sent >= 0.2 {
|
||||
let next = show.state.peek_next(&doc);
|
||||
@@ -174,8 +181,10 @@ pub fn ui(app: &mut SlideApp, ui: &mut Ui) {
|
||||
slide: show.state.slide,
|
||||
total: doc.slides.len(),
|
||||
ended: show.ended,
|
||||
notes: doc.slides.get(show.state.slide).map(|s| s.notes_text()).unwrap_or_default(),
|
||||
elapsed: format_elapsed(show.timer.elapsed(now)),
|
||||
// P3(show-w5): ss.A11
|
||||
notes: doc.slides.get(show.state.slide).map(|s| s.notes.clone()).unwrap_or_default(),
|
||||
// P3(show-w5): ss.A11
|
||||
elapsed: show.timer.elapsed(now),
|
||||
paused: show.timer.paused(),
|
||||
notes_px: show.notes_px,
|
||||
blank: show.blank_name().map(str::to_owned),
|
||||
@@ -580,7 +589,8 @@ fn draw_videos(app: &mut SlideApp, show: &mut Show, f: &Fr, sl: &Sl, painter: &e
|
||||
} else {
|
||||
slide_box(srect, uv, (sw, sh), (x.x as f32, x.y as f32, x.w as f32, x.h as f32))
|
||||
};
|
||||
if crate::media::paint_frame(painter, &app.media, *id, r, clip.crop) {
|
||||
// P3(show-w5): cv.A9
|
||||
if crate::media::paint_frame_base(painter, &app.media, *id, r, clip.crop) {
|
||||
framed.push(*id);
|
||||
}
|
||||
}
|
||||
@@ -686,7 +696,15 @@ fn draw_slide(app: &mut SlideApp, ui: &mut Ui, show: &mut Show, f: &Fr, painter:
|
||||
fn draw_pen_and_hints(ui: &mut Ui, show: &mut Show, f: &Fr, painter: &egui::Painter, pointing: bool) {
|
||||
let Fr { ctx, doc, now, full, srect, .. } = *f;
|
||||
if let Some(c) = show.blank {
|
||||
painter.rect_filled(full, CornerRadius::ZERO, c);
|
||||
// P3(show-w5): ss.A4
|
||||
painter.rect_filled(
|
||||
full,
|
||||
CornerRadius::ZERO,
|
||||
match c {
|
||||
super::Blank::Black => Color32::BLACK,
|
||||
super::Blank::White => Color32::WHITE,
|
||||
},
|
||||
);
|
||||
}
|
||||
if !show.goto.is_empty() {
|
||||
let label = format!("Go to slide {}", show.goto);
|
||||
@@ -711,7 +729,8 @@ fn draw_pen_and_hints(ui: &mut Ui, show: &mut Show, f: &Fr, painter: &egui::Pain
|
||||
&& let Some((nx, ny)) = norm_on_slide(srect, uv, p)
|
||||
&& let Some(s) = show.strokes.last_mut()
|
||||
{
|
||||
s.push(pos2(nx, ny));
|
||||
// P3(show-w5): ss.A4
|
||||
s.push(craft::behavior::kurbo::Point::new(nx as f64 * doc.slide_size.width, ny as f64 * doc.slide_size.height));
|
||||
}
|
||||
ctx.set_cursor_icon(egui::CursorIcon::Crosshair);
|
||||
} else if show.laser {
|
||||
@@ -729,7 +748,9 @@ fn draw_pen_and_hints(ui: &mut Ui, show: &mut Show, f: &Fr, painter: &egui::Pain
|
||||
let pen_col = theme::to_color32(doc.show.pen_color);
|
||||
let uv = show.zoom_uv();
|
||||
for s in &show.strokes {
|
||||
let pts: Vec<Pos2> = s.iter().map(|q| slide_to_screen(srect, uv, q.x, q.y)).collect();
|
||||
// P3(show-w5): ss.A4
|
||||
let pts: Vec<Pos2> =
|
||||
s.iter().map(|q| slide_to_screen(srect, uv, (q.x / doc.slide_size.width) as f32, (q.y / doc.slide_size.height) as f32)).collect();
|
||||
painter.add(egui::Shape::line(pts, Stroke::new(3.0, pen_col)));
|
||||
}
|
||||
if show.laser
|
||||
@@ -805,10 +826,12 @@ fn draw_bars(ui: &mut Ui, show: &mut Show, f: &Fr, painter: &egui::Painter, out:
|
||||
show.set_laser(!show.laser);
|
||||
}
|
||||
if b(&mut child, "Black").clicked() {
|
||||
toggle_blank(show, Color32::BLACK);
|
||||
// P3(show-w5): ss.A4
|
||||
toggle_blank(show, super::Blank::Black);
|
||||
}
|
||||
if b(&mut child, "White").clicked() {
|
||||
toggle_blank(show, Color32::WHITE);
|
||||
// P3(show-w5): ss.A4
|
||||
toggle_blank(show, super::Blank::White);
|
||||
}
|
||||
if b(&mut child, "All").clicked() {
|
||||
show.grid = !show.grid;
|
||||
@@ -853,7 +876,8 @@ fn finish(app: &mut SlideApp, mut show: Show, f: &Fr, keep: bool) {
|
||||
if keep {
|
||||
app.show = Some(show);
|
||||
} else {
|
||||
if let Some(host) = app.services.presenter.as_mut() {
|
||||
// P3(show-w5): sh.A9
|
||||
if let Some(host) = app.services.presenter_base.as_mut() {
|
||||
host.close();
|
||||
}
|
||||
app.media.stop_owned(crate::media::Owner::Show);
|
||||
|
||||
@@ -86,8 +86,10 @@ impl Show {
|
||||
|
||||
pub fn blank_name(&self) -> Option<&'static str> {
|
||||
match self.blank {
|
||||
Some(c) if c == Color32::BLACK => Some("black"),
|
||||
Some(c) if c == Color32::WHITE => Some("white"),
|
||||
// P3(show-w4): ss.A4
|
||||
Some(c) if c == super::Blank::Black => Some("black"),
|
||||
// P3(show-w4): ss.A4
|
||||
Some(c) if c == super::Blank::White => Some("white"),
|
||||
Some(_) => Some("blank"),
|
||||
None => None,
|
||||
}
|
||||
@@ -259,7 +261,7 @@ pub(super) fn zoom_frame(slide: Rect, uv: Rect) -> Rect {
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn toggle_blank(show: &mut Show, color: Color32) {
|
||||
pub(super) fn toggle_blank(show: &mut Show, color: super::Blank) {
|
||||
show.blank = if show.blank == Some(color) { None } else { Some(color) };
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ fn open_with_size(w: f64, h: f64) -> egui_kittest::Harness<'static, SlideApp> {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
SlideApp::new(s, Services::default()),
|
||||
// P3(dialogs-w8): sh.A2
|
||||
SlideApp::new_base(s, Services::default()),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -51,7 +52,8 @@ fn extreme_loaded_slide_sizes_open_in_every_view() {
|
||||
fn the_canvas_fit_survives_a_zero_slide_size_in_memory() {
|
||||
let mut s = Session::with_new();
|
||||
std::sync::Arc::make_mut(&mut s.active_mut().unwrap().doc).slide_size = deckcraft_model::Size::new(0.0, f64::NAN);
|
||||
let app = SlideApp::new(s, Services::default());
|
||||
// P3(dialogs-w8): sh.A2
|
||||
let app = SlideApp::new_base(s, Services::default());
|
||||
let (r, scale) = crate::canvas::layout(&app, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, 700.0)));
|
||||
assert!(scale.is_finite() && scale > 0.0, "{scale}");
|
||||
assert!(r.min.x.is_finite() && r.max.y.is_finite(), "{r:?}");
|
||||
|
||||
@@ -542,3 +542,10 @@ fn outline_slide(app: &mut SlideApp, ui: &mut Ui, t: &Tokens, i: usize, s: &deck
|
||||
}
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
|
||||
/// Shows the Outline view as a pane body.
|
||||
#[allow(dead_code)] // P3(panels-w6): pn.A5
|
||||
pub(crate) fn outline_body(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) {
|
||||
let _ = (app, ui, cx);
|
||||
todo!("pn.A5")
|
||||
}
|
||||
@@ -17,7 +17,8 @@ fn harness(with_sections: bool) -> Harness<'static, SlideApp> {
|
||||
s.execute("section.add", &json!({"name": "Alpha", "at": 0})).unwrap();
|
||||
s.execute("section.add", &json!({"name": "Beta", "at": 2})).unwrap();
|
||||
}
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(panels-w6): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.view = crate::ViewMode::Sorter;
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
@@ -21,7 +21,8 @@ fn harness(tab: &str) -> (Harness<'static, SlideApp>, [ShapeId; 2]) {
|
||||
ids[i] = ShapeId(r["id"].as_u64().unwrap() as u32);
|
||||
}
|
||||
s.execute("selection.select", &json!({"ids": [ids[0].0, ids[1].0]})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
// P3(shell-w10): sh.A2
|
||||
let mut app = SlideApp::new_base(s, Services::default());
|
||||
app.ui.tab = tab.into();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1800.0, 900.0)).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
|
||||
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user