forked from 1b-agent/opencadstudio-upstream
Frames: state-following ribbon list, DWF/DGN frames, image frame encoding and profile, frame-only picking
- The Frames list shows the drawing's frame state (hide / display and plot / display but not plot / frames vary), follows commands, undo and document switches, and lists the mixed state as a disabled item. - DWFFRAME and DGNFRAME are frame variables of their own, kept in the header, and FRAME sets them with the others. - Out-of-range frame values say "Requires an integer between 0 and 2." and ask again; a set value reports "Regenerating model.". - IMAGEFRAME is stored in the image variables as bits (2 is written as 3) and a drawing without them uses the profile value, which setting IMAGEFRAME updates and the settings file keeps. - Raster images, PDF underlays and wipeouts are picked on their frame only; underlay snap geometry is never picked. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
801882314f
commit
7f8f8457c7
72 files changed
+451
-65
No files matched your search
+12
-3
@@ -477,6 +477,14 @@ impl Ribbon {
|
||||
self.close_dropdown();
|
||||
}
|
||||
|
||||
/// Show `cmd` as the current item of a dropdown that mirrors a drawing
|
||||
/// setting, without running it.
|
||||
pub fn set_dropdown_current(&mut self, dropdown_id: &'static str, cmd: &'static str) {
|
||||
if self.last_cmd.get(dropdown_id) != Some(&cmd) {
|
||||
self.last_cmd.insert(dropdown_id, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
// ── View ──────────────────────────────────────────────────────────────
|
||||
|
||||
pub fn view(
|
||||
@@ -873,6 +881,7 @@ impl Ribbon {
|
||||
.iter()
|
||||
.map(|(cmd, label, item_icon)| {
|
||||
let is_current = *cmd == last_cmd;
|
||||
let disabled = widgets::is_disabled_item(cmd);
|
||||
let checkmark: Element<'_, Message> =
|
||||
crate::ui::icons::themed_check_cell(is_current);
|
||||
let icon_el: Element<Message> =
|
||||
@@ -884,7 +893,7 @@ impl Ribbon {
|
||||
.size(11)
|
||||
.wrapping(iced::advanced::text::Wrapping::None)
|
||||
.style(move |theme: &Theme| iced::widget::text::Style {
|
||||
color: (!is_current).then_some(
|
||||
color: (!is_current || disabled).then_some(
|
||||
theme
|
||||
.palette()
|
||||
.background
|
||||
@@ -899,10 +908,10 @@ impl Ribbon {
|
||||
.spacing(4)
|
||||
.align_y(iced::Center),
|
||||
)
|
||||
.on_press(Message::DropdownSelectItem {
|
||||
.on_press_maybe((!disabled).then_some(Message::DropdownSelectItem {
|
||||
dropdown_id: dd_id,
|
||||
cmd: *cmd,
|
||||
})
|
||||
}))
|
||||
.style(popup_row_style)
|
||||
.width(Fill)
|
||||
.padding([4, 10])
|
||||
|
||||
@@ -94,6 +94,11 @@ thread_local! {
|
||||
RefCell::new(HashMap::default());
|
||||
}
|
||||
|
||||
/// Dropdown items that report a state and cannot be picked.
|
||||
pub(super) fn is_disabled_item(cmd: &str) -> bool {
|
||||
cmd == "FRAMES3"
|
||||
}
|
||||
|
||||
fn ribbon_label_bounds(
|
||||
renderer: &iced::Renderer,
|
||||
label: &str,
|
||||
@@ -678,13 +683,18 @@ pub(super) fn render_small<'a>(
|
||||
container(make_icon(cur_icon, SMALL_ICON)).width(Length::Fixed(SMALL_W)),
|
||||
text(localized_label.clone()).size(10).wrapping(advanced_text::Wrapping::None),
|
||||
].spacing(3).align_y(iced::Center);
|
||||
// A state that is only shown (not chosen) opens the list instead.
|
||||
let face_btn = button(face)
|
||||
.on_press(Message::RibbonToolClick {
|
||||
tool_id: last.to_string(),
|
||||
event: ModuleEvent::Command(last.to_string()),
|
||||
.on_press(if is_disabled_item(last) {
|
||||
Message::ToggleRibbonDropdown(id.to_string())
|
||||
} else {
|
||||
Message::RibbonToolClick {
|
||||
tool_id: last.to_string(),
|
||||
event: ModuleEvent::Command(last.to_string()),
|
||||
}
|
||||
})
|
||||
.style(move |theme: &Theme, status| tool_btn_style(theme, active, status))
|
||||
.width(Length::Fixed(LABELED_SMALL_W)).height(ROW_H).padding([3, 4]);
|
||||
.width(Length::Shrink).height(ROW_H).padding([3, 4]);
|
||||
let arrow = button(container(icons::themed_arrow_down(8.0))
|
||||
.width(Fill).height(Fill).align_x(iced::Center).align_y(iced::Center))
|
||||
.on_press(Message::ToggleRibbonDropdown(id.to_string()))
|
||||
|
||||
Reference in new issue
Block a user