diff --git a/src/main.rs b/src/main.rs index c532ee7..c49f757 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use clap::{command, Parser}; +use clap::{Parser, command}; use core::service_items::ServiceItem; use core::slide::*; use core::songs::Song; @@ -8,29 +8,27 @@ use cosmic::cosmic_theme::palette::WithAlpha; use cosmic::iced::keyboard::{Key, Modifiers}; use cosmic::iced::window::{Mode, Position}; use cosmic::iced::{ - self, event, window, Background as BG, Color, Length, Padding, - Point, Shadow, Vector, + self, Background as BG, Color, Length, Padding, Point, Shadow, + Vector, event, window, }; use cosmic::iced_futures::Subscription; use cosmic::iced_widget::{column, row, stack}; -use cosmic::widget::dnd_destination::{ - dnd_destination, dnd_destination_for_data, -}; +use cosmic::theme; +use cosmic::widget::dnd_destination::dnd_destination; use cosmic::widget::nav_bar::nav_bar_style; use cosmic::widget::segmented_button::Entity; +use cosmic::widget::text; use cosmic::widget::tooltip::Position as TPosition; use cosmic::widget::{ - button, horizontal_space, mouse_area, nav_bar, search_input, - tooltip, vertical_space, Space, + Space, button, horizontal_space, mouse_area, nav_bar, + search_input, tooltip, vertical_space, }; -use cosmic::widget::{container, text}; use cosmic::widget::{icon, slider}; -use cosmic::{executor, Application, ApplicationExt, Element}; -use cosmic::{prelude::*, theme}; -use cosmic::{widget::Container, Theme}; +use cosmic::{Application, ApplicationExt, Element, executor}; +use cosmic::{Theme, widget::Container}; use crisp::types::Value; use lisp::parse_lisp; -use miette::{miette, Result}; +use miette::{Result, miette}; use rayon::prelude::*; use resvg::usvg::fontdb; use std::fs::read_to_string; @@ -39,10 +37,10 @@ use std::sync::Arc; use tracing::{debug, level_filters::LevelFilter}; use tracing::{error, warn}; use tracing_subscriber::EnvFilter; +use ui::EditorMode; use ui::library::{self, Library}; use ui::presenter::{self, Presenter}; use ui::song_editor::{self, SongEditor}; -use ui::EditorMode; use crate::ui::text_svg; diff --git a/src/ui/presenter.rs b/src/ui/presenter.rs index 7a32c76..f355abe 100644 --- a/src/ui/presenter.rs +++ b/src/ui/presenter.rs @@ -2,36 +2,36 @@ use miette::{IntoDiagnostic, Result}; use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc}; use cosmic::{ + Task, iced::{ + Background, Border, Color, ContentFit, Font, Length, Shadow, + Vector, alignment::Horizontal, border, font::{Family, Stretch, Style, Weight}, - Background, Border, Color, ContentFit, Font, Length, Shadow, - Vector, }, iced_widget::{ rich_text, scrollable::{ - scroll_to, AbsoluteOffset, Direction, Scrollbar, + AbsoluteOffset, Direction, Scrollbar, scroll_to, }, span, stack, vertical_rule, }, prelude::*, widget::{ - container, image, mouse_area, responsive, scrollable, text, - Column, Container, Id, Image, Row, Space, + Column, Container, Id, Image, Row, Space, container, image, + mouse_area, responsive, scrollable, text, }, - Task, }; -use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer}; +use iced_video_player::{Position, Video, VideoPlayer, gst_pbutils}; use rodio::{Decoder, OutputStream, Sink}; use tracing::{debug, error, info, warn}; use url::Url; use crate::{ + BackgroundKind, core::{service_items::ServiceItem, slide::Slide}, ui::text_svg, - BackgroundKind, }; const REFERENCE_WIDTH: f32 = 1920.0; @@ -709,109 +709,6 @@ pub(crate) fn slide_view<'a>( ) -> Element<'a, Message> { let res = responsive(move |size| { let width = size.height * 16.0 / 9.0; - // let slide_text = slide.text(); - - // let font = SvgFont::from(font).size(font_size.floor() as u8); - // let text_container = if delegate { - // // text widget based - // let font_size = scale_font(slide.font_size() as f32, width); - // let lines = slide_text.lines(); - // let text: Vec> = lines - // .map(|t| { - // rich_text([span(format!("{}\n", t)) - // .background( - // Background::Color(Color::BLACK) - // .scale_alpha(0.4), - // ) - // .border(border::rounded(10)) - // .padding(10)]) - // .size(font_size) - // .font(font) - // .center() - // .into() - // // let chars: Vec = t - // // .chars() - // // .map(|c| -> Span { - // // let character: String = format!("{}/n", c); - // // span(character) - // // .size(font_size) - // // .font(font) - // // .background( - // // Background::Color(Color::BLACK) - // // .scale_alpha(0.4), - // // ) - // // .border(border::rounded(10)) - // // .padding(10) - // }) - // .collect(); - // let text = Column::with_children(text).spacing(26); - // let text = Container::new(text) - // .center(Length::Fill) - // .align_x(Horizontal::Left); - // } else { - // // SVG based - // let text: Element = - // if let Some(text) = &slide.text_svg { - // if let Some(handle) = &text.handle { - // debug!("we made it boys"); - // Image::new(handle) - // .content_fit(ContentFit::Cover) - // .width(Length::Fill) - // .height(Length::Fill) - // .into() - // } else { - // Space::with_width(0).into() - // } - // } else { - // Space::with_width(0).into() - // }; - // Container::new(text) - // .center(Length::Fill) - // .align_x(Horizontal::Left) - // // text widget based - // // let font_size = - // // scale_font(slide.font_size() as f32, width); - // // let lines = slide_text.lines(); - // // let text: Vec> = lines - // // .map(|t| { - // // rich_text([span(format!("{}\n", t)) - // // .background( - // // Background::Color(Color::BLACK) - // // .scale_alpha(0.4), - // // ) - // // .border(border::rounded(10)) - // // .padding(10)]) - // // .size(font_size) - // // .font(font) - // // .center() - // // .into() - // // // let chars: Vec = t - // // // .chars() - // // // .map(|c| -> Span { - // // // let character: String = format!("{}/n", c); - // // // span(character) - // // // .size(font_size) - // // // .font(font) - // // // .background( - // // // Background::Color(Color::BLACK) - // // // .scale_alpha(0.4), - // // // ) - // // // .border(border::rounded(10)) - // // // .padding(10) - // // }) - // // .collect(); - // // let text = Column::with_children(text).spacing(26); - // // Container::new(text) - // // .center(Length::Fill) - // // .align_x(Horizontal::Left) - // }; - - // let stroke_text_container = Container::new(stroke_text) - // .center(Length::Fill) - // .align_x(Horizontal::Left); - - // let text_stack = - // stack!(stroke_text_container, text_container); let text: Element = if let Some(text) = &slide.text_svg {