feat(styles): mark the current style with a ✓ in the list
Every style manager now shows a leading ✓ next to the current style (current text/dim style, active table/multileader/multiline style), with the other rows padded so names stay aligned. The marker replaces the multileader/multiline-only ◀ and is wired for all five managers by threading the current-style name into each view. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
de4eb31003
commit
885bacd0f6
5 changed files with 19 additions and 5 deletions
|
|
@ -75,6 +75,7 @@ impl OpenCADStudio {
|
||||||
return crate::ui::textstyle::view_window(crate::ui::textstyle::TextStyleView {
|
return crate::ui::textstyle::view_window(crate::ui::textstyle::TextStyleView {
|
||||||
styles,
|
styles,
|
||||||
selected: &self.textstyle_selected,
|
selected: &self.textstyle_selected,
|
||||||
|
current: &tab.scene.document.header.current_text_style_name,
|
||||||
font_buf: &self.textstyle_font,
|
font_buf: &self.textstyle_font,
|
||||||
width_buf: &self.textstyle_width,
|
width_buf: &self.textstyle_width,
|
||||||
oblique_buf: &self.textstyle_oblique,
|
oblique_buf: &self.textstyle_oblique,
|
||||||
|
|
@ -118,6 +119,7 @@ impl OpenCADStudio {
|
||||||
return crate::ui::tablestyle::view_window(
|
return crate::ui::tablestyle::view_window(
|
||||||
styles,
|
styles,
|
||||||
&self.tablestyle_selected,
|
&self.tablestyle_selected,
|
||||||
|
&self.ribbon.active_table_style,
|
||||||
selected_style,
|
selected_style,
|
||||||
&self.ts_hmargin,
|
&self.ts_hmargin,
|
||||||
&self.ts_vmargin,
|
&self.ts_vmargin,
|
||||||
|
|
@ -369,6 +371,11 @@ impl OpenCADStudio {
|
||||||
return crate::ui::dimstyle::view_window(
|
return crate::ui::dimstyle::view_window(
|
||||||
styles,
|
styles,
|
||||||
&self.dimstyle_selected,
|
&self.dimstyle_selected,
|
||||||
|
&self.tabs[self.active_tab]
|
||||||
|
.scene
|
||||||
|
.document
|
||||||
|
.header
|
||||||
|
.current_dimstyle_name,
|
||||||
self.dimstyle_tab,
|
self.dimstyle_tab,
|
||||||
crate::ui::dimstyle::DimStyleValues {
|
crate::ui::dimstyle::DimStyleValues {
|
||||||
dimdle: &self.ds_dimdle,
|
dimdle: &self.ds_dimdle,
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ fn hdivider<'a>() -> Element<'a, Message> {
|
||||||
pub fn view_window<'a>(
|
pub fn view_window<'a>(
|
||||||
styles: Vec<String>,
|
styles: Vec<String>,
|
||||||
selected: &'a str,
|
selected: &'a str,
|
||||||
|
current: &'a str,
|
||||||
tab: u8,
|
tab: u8,
|
||||||
vals: DimStyleValues<'a>,
|
vals: DimStyleValues<'a>,
|
||||||
rename_active: Option<&'a str>,
|
rename_active: Option<&'a str>,
|
||||||
|
|
@ -724,7 +725,7 @@ pub fn view_window<'a>(
|
||||||
kind: crate::app::StyleKind::Dim,
|
kind: crate::app::StyleKind::Dim,
|
||||||
styles: &styles,
|
styles: &styles,
|
||||||
selected,
|
selected,
|
||||||
current: None,
|
current: Some(current),
|
||||||
rename_active,
|
rename_active,
|
||||||
rename_buf,
|
rename_buf,
|
||||||
on_new: Message::DimStyleDialogNew,
|
on_new: Message::DimStyleDialogNew,
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,12 @@ pub fn view<'a, 'b>(s: Scaffold<'a, 'b>) -> Element<'a, Message> {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|name| {
|
.map(|name| {
|
||||||
let is_sel = name.as_str() == s.selected;
|
let is_sel = name.as_str() == s.selected;
|
||||||
|
// Mark the current style with a leading ✓; pad the rest so names
|
||||||
|
// line up.
|
||||||
let label = if s.current == Some(name.as_str()) {
|
let label = if s.current == Some(name.as_str()) {
|
||||||
format!("{name} ◀")
|
format!("✓ {name}")
|
||||||
} else {
|
} else {
|
||||||
name.clone()
|
format!(" {name}")
|
||||||
};
|
};
|
||||||
crate::ui::style_list::item(
|
crate::ui::style_list::item(
|
||||||
name,
|
name,
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ fn btn_s(accent: bool) -> impl Fn(&Theme, button::Status) -> button::Style {
|
||||||
pub fn view_window<'a>(
|
pub fn view_window<'a>(
|
||||||
styles: Vec<String>,
|
styles: Vec<String>,
|
||||||
selected: &'a str,
|
selected: &'a str,
|
||||||
|
current: &'a str,
|
||||||
selected_style: Option<&'a acadrust::objects::TableStyle>,
|
selected_style: Option<&'a acadrust::objects::TableStyle>,
|
||||||
hmargin_buf: &'a str,
|
hmargin_buf: &'a str,
|
||||||
vmargin_buf: &'a str,
|
vmargin_buf: &'a str,
|
||||||
|
|
@ -356,7 +357,7 @@ pub fn view_window<'a>(
|
||||||
kind: crate::app::StyleKind::Table,
|
kind: crate::app::StyleKind::Table,
|
||||||
styles: &styles,
|
styles: &styles,
|
||||||
selected,
|
selected,
|
||||||
current: None,
|
current: Some(current),
|
||||||
rename_active,
|
rename_active,
|
||||||
rename_buf,
|
rename_buf,
|
||||||
on_new: Message::TableStyleDialogNew,
|
on_new: Message::TableStyleDialogNew,
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ use iced::{Background, Border, Color, Element, Fill, Theme};
|
||||||
pub struct TextStyleView<'a> {
|
pub struct TextStyleView<'a> {
|
||||||
pub styles: Vec<String>,
|
pub styles: Vec<String>,
|
||||||
pub selected: &'a str,
|
pub selected: &'a str,
|
||||||
|
/// Name of the current text style (marked with ✓ in the list).
|
||||||
|
pub current: &'a str,
|
||||||
pub font_buf: &'a str,
|
pub font_buf: &'a str,
|
||||||
pub width_buf: &'a str,
|
pub width_buf: &'a str,
|
||||||
pub oblique_buf: &'a str,
|
pub oblique_buf: &'a str,
|
||||||
|
|
@ -120,6 +122,7 @@ pub fn view_window<'a>(v: TextStyleView<'a>) -> Element<'a, Message> {
|
||||||
let TextStyleView {
|
let TextStyleView {
|
||||||
styles,
|
styles,
|
||||||
selected,
|
selected,
|
||||||
|
current,
|
||||||
font_buf,
|
font_buf,
|
||||||
width_buf,
|
width_buf,
|
||||||
oblique_buf,
|
oblique_buf,
|
||||||
|
|
@ -258,7 +261,7 @@ pub fn view_window<'a>(v: TextStyleView<'a>) -> Element<'a, Message> {
|
||||||
kind: StyleKind::Text,
|
kind: StyleKind::Text,
|
||||||
styles: &styles,
|
styles: &styles,
|
||||||
selected,
|
selected,
|
||||||
current: None,
|
current: Some(current),
|
||||||
rename_active,
|
rename_active,
|
||||||
rename_buf,
|
rename_buf,
|
||||||
on_new: Message::TextStyleDialogNew,
|
on_new: Message::TextStyleDialogNew,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue