Compare commits

...

6 commits

Author SHA1 Message Date
Chris Cochrun
891ad2587e now the text is a little nicer looking...
Some checks failed
/ test (push) Has been cancelled
2025-07-07 14:28:17 -05:00
Chris Cochrun
d94572201a making sure run is in debug mode so I'm considering performance 2025-07-04 07:14:37 -05:00
Chris Cochrun
9207df10ba svgs are still bad.
I didn't realize that svgs take so long to parse in the usvg crate and
therefore there is nothing to do here. Unless there was a way to build
it outside the view run, but I'm not sure that's possible.
2025-07-04 07:13:06 -05:00
Chris Cochrun
e7a160272d better text_stroke 2025-07-04 06:54:21 -05:00
Chris Cochrun
7f66f33462 making header better and fixing stroke width on text 2025-07-04 06:11:48 -05:00
Chris Cochrun
049e5bd7cc fixing text_svg 2025-07-03 21:59:52 -05:00
5 changed files with 35 additions and 27 deletions

View file

@ -6,13 +6,13 @@ default:
build: build:
RUST_LOG=debug cargo build RUST_LOG=debug cargo build
run: run:
RUST_LOG=debug cargo run --release -- {{ui}} {{file}} RUST_LOG=debug cargo run -- {{ui}} {{file}}
clean: clean:
RUST_LOG=debug cargo clean RUST_LOG=debug cargo clean
test: test:
RUST_LOG=debug cargo test --benches --tests --all-features -- --nocapture RUST_LOG=debug cargo test --benches --tests --all-features -- --nocapture
profile: profile:
cargo flamegraph --image-width 4000 -- {{ui}} {{file}} cargo flamegraph --image-width 8000 -- {{ui}} {{file}}
alias r := run alias r := run
alias c := clean alias c := clean

View file

@ -288,22 +288,6 @@ impl cosmic::Application for App {
} }
fn header_start(&self) -> Vec<Element<Self::Message>> { fn header_start(&self) -> Vec<Element<Self::Message>> {
vec![]
}
fn header_center(&self) -> Vec<Element<Self::Message>> {
vec![search_input("Search...", "")
.on_input(|_| Message::None)
.on_submit(|_| Message::None)
.width(Length::Fill)
.into()]
}
fn header_end(&self) -> Vec<Element<Self::Message>> {
// let editor_toggle = toggler(self.editor_mode.is_some())
// .label("Editor")
// .spacing(10)
// .width(Length::Shrink)
// .on_toggle(Message::EditorToggle);
let presenter_window = self.windows.get(1); let presenter_window = self.windows.get(1);
let text = if self.presentation_open { let text = if self.presentation_open {
text::body("End Presentation") text::body("End Presentation")
@ -370,6 +354,30 @@ impl cosmic::Application for App {
) )
.into(), .into(),
horizontal_space().width(HEADER_SPACE).into(), horizontal_space().width(HEADER_SPACE).into(),
]
}
fn header_center(&self) -> Vec<Element<Self::Message>> {
vec![search_input("Search...", "")
.on_input(|_| Message::None)
.on_submit(|_| Message::None)
.width(300)
.into()]
}
fn header_end(&self) -> Vec<Element<Self::Message>> {
// let editor_toggle = toggler(self.editor_mode.is_some())
// .label("Editor")
// .spacing(10)
// .width(Length::Shrink)
// .on_toggle(Message::EditorToggle);
let presenter_window = self.windows.get(1);
let text = if self.presentation_open {
text::body("End Presentation")
} else {
text::body("Present")
};
vec![
tooltip( tooltip(
button::custom( button::custom(
row!( row!(

View file

@ -4,6 +4,7 @@ use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
use cosmic::{ use cosmic::{
iced::{ iced::{
alignment::Horizontal, alignment::Horizontal,
border,
font::{Family, Stretch, Style, Weight}, font::{Family, Stretch, Style, Weight},
Background, Border, Color, ContentFit, Font, Length, Shadow, Background, Border, Color, ContentFit, Font, Length, Shadow,
Vector, Vector,
@ -551,12 +552,11 @@ pub(crate) fn slide_view(
// .text(&slide_text) // .text(&slide_text)
// .fill("#fff") // .fill("#fff")
// .shadow(text_svg::shadow(2, 2, 5, "#000000")) // .shadow(text_svg::shadow(2, 2, 5, "#000000"))
// .stroke(text_svg::stroke(1, "#000")) // .stroke(text_svg::stroke(3, "#000"))
// .font(font) // .font(font)
// .view() // .view()
// .map(|m| Message::None); // .map(|m| Message::None);
// let text = text!("{}", &slide_text);
// text widget based // text widget based
let lines = slide_text.lines(); let lines = slide_text.lines();
let text: Vec<Element<Message>> = lines let text: Vec<Element<Message>> = lines
@ -566,14 +566,15 @@ pub(crate) fn slide_view(
Background::Color(Color::BLACK) Background::Color(Color::BLACK)
.scale_alpha(0.4), .scale_alpha(0.4),
) )
.padding(1)]) .border(border::rounded(10))
.padding(10)])
.size(font_size) .size(font_size)
.font(font) .font(font)
.center() .center()
.into() .into()
}) })
.collect(); .collect();
let text = Column::with_children(text).spacing(6); let text = Column::with_children(text).spacing(26);
//Next //Next
let text_container = Container::new(text) let text_container = Container::new(text)

View file

@ -218,7 +218,7 @@ impl TextSvg {
}; };
let stroke = if let Some(stroke) = &self.stroke { let stroke = if let Some(stroke) = &self.stroke {
format!( format!(
"stroke=\"{}\" stroke-width=\"{}\"", "stroke=\"{}\" stroke-width=\"{}px\" stroke-linejoin=\"arcs\" paint-order=\"stroke\"",
stroke.color, stroke.size stroke.color, stroke.size
) )
} else { } else {
@ -249,17 +249,16 @@ impl TextSvg {
self.fill, stroke, text); self.fill, stroke, text);
// debug!(final_svg); // debug!(final_svg);
lazy(self.clone(), move |_s| Svg::new(Handle::from_memory( Svg::new(Handle::from_memory(
Box::leak(<std::string::String as Clone>::clone(&final_svg).into_boxed_str()).as_bytes(), Box::leak(<std::string::String as Clone>::clone(&final_svg).into_boxed_str()).as_bytes(),
)) ))
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fill)) .height(Length::Fill)
.into() .into()
})).width(Length::Fill).height(Length::Fill).into() })).width(Length::Fill).height(Length::Fill).into()
} }
fn text_spans(&self) -> Vec<String> { fn text_spans(&self) -> Vec<String> {
let total_lines = self.text.lines().count();
self.text self.text
.lines() .lines()
.enumerate() .enumerate()

View file

@ -4,7 +4,7 @@
(slide (video :source "~/vids/The Basics of Hanging Drywall.mkv" :fit contain)) (slide (video :source "~/vids/The Basics of Hanging Drywall.mkv" :fit contain))
(slide (video :source "~/vids/Ladybird Is The Future Of Web Browsers.webm" :fit contain)) (slide (video :source "~/vids/Ladybird Is The Future Of Web Browsers.webm" :fit contain))
(song :id 7 :author "North Point Worship" (song :id 7 :author "North Point Worship"
:font "Quicksand Bold" :font-size 30 :font "Quicksand Bold" :font-size 60
:shadow "" :stroke "" :shadow "" :stroke ""
:title "Death Was Arrested" :title "Death Was Arrested"
:background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover) :background (image :source "file:///home/chris/nc/tfc/openlp/CMG - Bright Mountains 01.jpg" :fit cover)