From c64c4211aa35e7aeac5c3d8a6b1e780ef04e364e Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 16 Jan 2026 09:47:11 -0600 Subject: [PATCH] trying to make chips for the verse order --- src/ui/song_editor.rs | 93 +++++++++++++-------------------- src/ui/widgets/draggable/row.rs | 33 ++++++------ 2 files changed, 50 insertions(+), 76 deletions(-) diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index 935e3e3..374931b 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -36,7 +36,10 @@ use crate::{ presenter::slide_view, slide_editor::SlideEditor, text_svg, - widgets::verse_editor::{self, VerseEditor}, + widgets::{ + draggable, + verse_editor::{self, VerseEditor}, + }, }, }; @@ -479,76 +482,43 @@ order", .iter() .map(|verse| { let name = verse.get_name(); - let dark_text = theme::Text::Color( - theme::active() - .cosmic() - .primary - .base - .color, - ); + let dark_text = color!(0, 0, 0); + let light_text = color!(255, 255, 255); let (background_color, text_color) = match verse { - VerseName::Verse { .. } => ( - color!(242, 100, 48), - theme::active() - .cosmic() - .primary - .base - .color, - ), - VerseName::PreChorus { .. } => ( - color!(217, 3, 104), - theme::active() - .cosmic() - .primary - .base - .color, - ), - VerseName::Chorus { .. } => ( - color!(58, 134, 255), - theme::active() - .cosmic() - .primary - .base - .color, - ), + VerseName::Verse { .. } => { + (color!(0xf26430), dark_text) + } + VerseName::PreChorus { .. } => { + (color!(0xd90368), dark_text) + } + VerseName::Chorus { .. } => { + (color!(0x3A86ff), dark_text) + } VerseName::PostChorus { .. } => { todo!() } - VerseName::Bridge { .. } => ( - color!(71, 229, 188), - theme::active() - .cosmic() - .primary - .base - .color, - ), - VerseName::Intro { .. } => ( - color!(255, 212, 0), - theme::active() - .cosmic() - .primary - .base - .color, - ), - VerseName::Outro { .. } => ( - color!(255, 212, 0), - theme::active() - .cosmic() - .primary - .base - .color, - ), + VerseName::Bridge { .. } => { + (color!(0x47e5bc), dark_text) + } + VerseName::Intro { .. } => { + (color!(0xffd400), dark_text) + } + VerseName::Outro { .. } => { + (color!(0xffd400), dark_text) + } VerseName::Instrumental { .. } => { todo!() } - VerseName::Other { .. } => todo!(), + VerseName::Other { .. } => { + (color!(0xffd400), dark_text) + } }; text(verse.get_name()) - .color(text_color) + .class(theme::Text::Color(text_color)) .apply(container) .style(move |t| { let style = @@ -564,6 +534,7 @@ order", ); style }) + .padding(space_xs) .into() }) .collect() @@ -574,6 +545,11 @@ order", vec![] }; + let verse_options = + container(draggable::row(verse_options).spacing(space_s)) + .padding(space_m) + .class(theme::Container::Card); + let lyric_title = text::heading("Lyrics"); let lyric_input = column![ lyric_title, @@ -611,6 +587,7 @@ order", title_input, author_input, verse_input, + verse_options, verse_scroller ] .spacing(25) diff --git a/src/ui/widgets/draggable/row.rs b/src/ui/widgets/draggable/row.rs index 67f2212..f8df19b 100644 --- a/src/ui/widgets/draggable/row.rs +++ b/src/ui/widgets/draggable/row.rs @@ -22,6 +22,7 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +use cosmic::Theme; use cosmic::iced::advanced::layout::{self, Layout}; use cosmic::iced::advanced::widget::{Operation, Tree, Widget, tree}; use cosmic::iced::advanced::{Clipboard, Shell, overlay, renderer}; @@ -30,7 +31,7 @@ use cosmic::iced::event::{self, Event}; use cosmic::iced::{self, Transformation, mouse}; use cosmic::iced::{ Background, Border, Color, Element, Length, Padding, Pixels, - Point, Rectangle, Size, Theme, Vector, + Point, Rectangle, Size, Vector, }; use super::{Action, DragEvent, DropPosition}; @@ -802,7 +803,7 @@ where pub struct Wrapping< 'a, Message, - Theme = iced::Theme, + Theme = cosmic::Theme, Renderer = iced::Renderer, > where Theme: Catalog, @@ -1029,7 +1030,7 @@ pub struct Style { /// A styling function for a [`Row`]. pub type StyleFn<'a, Theme> = Box Style + 'a>; -impl Catalog for Theme { +impl Catalog for cosmic::Theme { type Class<'a> = StyleFn<'a, Self>; fn default<'a>() -> Self::Class<'a> { @@ -1041,26 +1042,22 @@ impl Catalog for Theme { } } -pub fn default(theme: &Theme) -> Style { +pub fn default(theme: &cosmic::Theme) -> Style { Style { scale: 1.05, - moved_item_overlay: theme - .extended_palette() - .primary - .base - .color - .scale_alpha(0.2), + moved_item_overlay: Color::from( + theme.cosmic().primary.base.color, + ) + .scale_alpha(0.2), ghost_border: Border { width: 1.0, - color: theme.extended_palette().secondary.base.color, + color: theme.cosmic().secondary.base.color.into(), radius: 0.0.into(), }, - ghost_background: theme - .extended_palette() - .secondary - .base - .color - .scale_alpha(0.2) - .into(), + ghost_background: Color::from( + theme.cosmic().secondary.base.color, + ) + .scale_alpha(0.2) + .into(), } }