This commit is contained in:
parent
6cb06c4f0d
commit
18603f4998
2 changed files with 20 additions and 125 deletions
26
src/main.rs
26
src/main.rs
|
@ -1,4 +1,4 @@
|
||||||
use clap::{command, Parser};
|
use clap::{Parser, command};
|
||||||
use core::service_items::ServiceItem;
|
use core::service_items::ServiceItem;
|
||||||
use core::slide::*;
|
use core::slide::*;
|
||||||
use core::songs::Song;
|
use core::songs::Song;
|
||||||
|
@ -8,29 +8,27 @@ use cosmic::cosmic_theme::palette::WithAlpha;
|
||||||
use cosmic::iced::keyboard::{Key, Modifiers};
|
use cosmic::iced::keyboard::{Key, Modifiers};
|
||||||
use cosmic::iced::window::{Mode, Position};
|
use cosmic::iced::window::{Mode, Position};
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
self, event, window, Background as BG, Color, Length, Padding,
|
self, Background as BG, Color, Length, Padding, Point, Shadow,
|
||||||
Point, Shadow, Vector,
|
Vector, event, window,
|
||||||
};
|
};
|
||||||
use cosmic::iced_futures::Subscription;
|
use cosmic::iced_futures::Subscription;
|
||||||
use cosmic::iced_widget::{column, row, stack};
|
use cosmic::iced_widget::{column, row, stack};
|
||||||
use cosmic::widget::dnd_destination::{
|
use cosmic::theme;
|
||||||
dnd_destination, dnd_destination_for_data,
|
use cosmic::widget::dnd_destination::dnd_destination;
|
||||||
};
|
|
||||||
use cosmic::widget::nav_bar::nav_bar_style;
|
use cosmic::widget::nav_bar::nav_bar_style;
|
||||||
use cosmic::widget::segmented_button::Entity;
|
use cosmic::widget::segmented_button::Entity;
|
||||||
|
use cosmic::widget::text;
|
||||||
use cosmic::widget::tooltip::Position as TPosition;
|
use cosmic::widget::tooltip::Position as TPosition;
|
||||||
use cosmic::widget::{
|
use cosmic::widget::{
|
||||||
button, horizontal_space, mouse_area, nav_bar, search_input,
|
Space, button, horizontal_space, mouse_area, nav_bar,
|
||||||
tooltip, vertical_space, Space,
|
search_input, tooltip, vertical_space,
|
||||||
};
|
};
|
||||||
use cosmic::widget::{container, text};
|
|
||||||
use cosmic::widget::{icon, slider};
|
use cosmic::widget::{icon, slider};
|
||||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
use cosmic::{Application, ApplicationExt, Element, executor};
|
||||||
use cosmic::{prelude::*, theme};
|
use cosmic::{Theme, widget::Container};
|
||||||
use cosmic::{widget::Container, Theme};
|
|
||||||
use crisp::types::Value;
|
use crisp::types::Value;
|
||||||
use lisp::parse_lisp;
|
use lisp::parse_lisp;
|
||||||
use miette::{miette, Result};
|
use miette::{Result, miette};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use resvg::usvg::fontdb;
|
use resvg::usvg::fontdb;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
|
@ -39,10 +37,10 @@ use std::sync::Arc;
|
||||||
use tracing::{debug, level_filters::LevelFilter};
|
use tracing::{debug, level_filters::LevelFilter};
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
use ui::EditorMode;
|
||||||
use ui::library::{self, Library};
|
use ui::library::{self, Library};
|
||||||
use ui::presenter::{self, Presenter};
|
use ui::presenter::{self, Presenter};
|
||||||
use ui::song_editor::{self, SongEditor};
|
use ui::song_editor::{self, SongEditor};
|
||||||
use ui::EditorMode;
|
|
||||||
|
|
||||||
use crate::ui::text_svg;
|
use crate::ui::text_svg;
|
||||||
|
|
||||||
|
|
|
@ -2,36 +2,36 @@ use miette::{IntoDiagnostic, Result};
|
||||||
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
Task,
|
||||||
iced::{
|
iced::{
|
||||||
|
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
||||||
|
Vector,
|
||||||
alignment::Horizontal,
|
alignment::Horizontal,
|
||||||
border,
|
border,
|
||||||
font::{Family, Stretch, Style, Weight},
|
font::{Family, Stretch, Style, Weight},
|
||||||
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
|
||||||
Vector,
|
|
||||||
},
|
},
|
||||||
iced_widget::{
|
iced_widget::{
|
||||||
rich_text,
|
rich_text,
|
||||||
scrollable::{
|
scrollable::{
|
||||||
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
AbsoluteOffset, Direction, Scrollbar, scroll_to,
|
||||||
},
|
},
|
||||||
span, stack, vertical_rule,
|
span, stack, vertical_rule,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
widget::{
|
widget::{
|
||||||
container, image, mouse_area, responsive, scrollable, text,
|
Column, Container, Id, Image, Row, Space, container, image,
|
||||||
Column, Container, Id, Image, Row, Space,
|
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 rodio::{Decoder, OutputStream, Sink};
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
BackgroundKind,
|
||||||
core::{service_items::ServiceItem, slide::Slide},
|
core::{service_items::ServiceItem, slide::Slide},
|
||||||
ui::text_svg,
|
ui::text_svg,
|
||||||
BackgroundKind,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const REFERENCE_WIDTH: f32 = 1920.0;
|
const REFERENCE_WIDTH: f32 = 1920.0;
|
||||||
|
@ -709,109 +709,6 @@ pub(crate) fn slide_view<'a>(
|
||||||
) -> Element<'a, Message> {
|
) -> Element<'a, Message> {
|
||||||
let res = responsive(move |size| {
|
let res = responsive(move |size| {
|
||||||
let width = size.height * 16.0 / 9.0;
|
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<Element<Message>> = 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<Span> = 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<Message> =
|
|
||||||
// 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<Element<Message>> = 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<Span> = 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<Message> =
|
let text: Element<Message> =
|
||||||
if let Some(text) = &slide.text_svg {
|
if let Some(text) = &slide.text_svg {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue