Merge pull request #1722 from ramox81/codex/view-background

# Conflicts:
#	locales/ar-SA/opencadstudio.ftl
#	locales/bg-BG/opencadstudio.ftl
#	locales/cs-CZ/opencadstudio.ftl
#	locales/de-DE/opencadstudio.ftl
#	locales/el-GR/opencadstudio.ftl
#	locales/en-US/opencadstudio.ftl
#	locales/es-ES/opencadstudio.ftl
#	locales/fi-FI/opencadstudio.ftl
#	locales/fr-FR/opencadstudio.ftl
#	locales/hi-IN/opencadstudio.ftl
#	locales/hu-HU/opencadstudio.ftl
#	locales/it-IT/opencadstudio.ftl
#	locales/ja-JP/opencadstudio.ftl
#	locales/ko-KR/opencadstudio.ftl
#	locales/lo-LA/opencadstudio.ftl
#	locales/nl-NL/opencadstudio.ftl
#	locales/pl-PL/opencadstudio.ftl
#	locales/pt-BR/opencadstudio.ftl
#	locales/ru-RU/opencadstudio.ftl
#	locales/tr-TR/opencadstudio.ftl
#	locales/zh-CN/opencadstudio.ftl
#	locales/zh-TW/opencadstudio.ftl
This commit is contained in:
Hakan Seven committed 2026-10-13 07:44:01 +03:00
commit 03445a540d
40 files changed
+1801 -46

No files matched your search

+4 -2
View File
@@ -30,6 +30,7 @@ pub(super) fn viewport_controls<'a>(
tile_count: usize,
render_mode_menu_open: bool,
render_mode_preview: Option<codec::entities::ViewportRenderMode>,
style_name: Option<String>,
) -> Element<'a, Message> {
let render_modes: Vec<RenderModeChoice> = crate::modules::view::visual_style::VISUAL_STYLES
.iter()
@@ -98,7 +99,7 @@ pub(super) fn viewport_controls<'a>(
// flyout keeps the current style unchanged while hovering; a click commits.
let picker_head = button(
row![
text(RenderModeChoice(render_mode).to_string()).size(11),
text(style_name.unwrap_or_else(|| RenderModeChoice(render_mode).to_string())).size(11),
crate::ui::icons::themed_arrow_toggle(render_mode_menu_open, 9.0),
]
.spacing(6)
@@ -379,7 +380,7 @@ mod tests {
#[test]
fn test_viewport_controls_construction() {
for style in crate::modules::view::visual_style::VISUAL_STYLES {
let _el = viewport_controls(style.mode, true, true, true, 1, false, None);
let _el = viewport_controls(style.mode, true, true, true, 1, false, None, None);
let _el_open = viewport_controls(
style.mode,
false,
@@ -388,6 +389,7 @@ mod tests {
2,
true,
Some(M::Wireframe3D),
None,
);
}
}
+14
View File
@@ -1297,6 +1297,18 @@ bg={bg_ms:.1}ms n={view_count}"
let rect = tab.scene.active_model_tile_bounds(vw, vh);
// Unified control chip: split buttons + render-mode picker +
// grid / grid-snap toggles, for the active Model tile.
// A named style (Realistic, …) the tile draws as shows by name.
let style_name = match tab.scene.document.objects.get(&tab.scene.active_visual_style()) {
Some(codec::objects::ObjectType::VisualStyle(style)) => {
match crate::modules::view::visual_style::mode_for_style_name(&style.description) {
Some((mode, true)) if mode == tab.render_mode => {
Some(crate::t!(style.description.as_str()).into_owned())
}
_ => None,
}
}
_ => None,
};
let bar = viewport_controls(
tab.render_mode,
self.show_grid,
@@ -1305,6 +1317,7 @@ bg={bg_ms:.1}ms n={view_count}"
tab.scene.model_tiles.borrow().len(),
self.render_mode_menu_open,
self.render_mode_preview,
style_name,
);
// Adaptive: DensitySwap measures the bar's real width every frame
// (reported into `render_bar_w`, which the ViewCube reads to decide
@@ -1397,6 +1410,7 @@ bg={bg_ms:.1}ms n={view_count}"
0,
self.render_mode_menu_open,
self.render_mode_preview,
None,
);
let adaptive: Element<'_, Message> = DensitySwap::new(vec![
iced::widget::opaque(bar),
+11
View File
@@ -35,6 +35,11 @@ impl OpenCADStudio {
Some(K::PointCloudAttach) => crate::t!("Attach Point Cloud").into_owned(),
Some(K::PointCloudColorMap) => crate::t!("Point Cloud Color Map").into_owned(),
Some(K::PcSection) => crate::t!("Extract Section Lines from Point Cloud").into_owned(),
Some(K::ViewBackground) => format!(
"{} — {}",
crate::tr!("view-background", "title"),
self.view_background.as_ref().map_or("", |s| s.view.as_str())
),
Some(K::UnderlayLayers) => crate::t!("Underlay Layers").into_owned(),
Some(K::PdfImportSettings) => crate::t!("PDF Import Settings").into_owned(),
Some(K::PdfImportFile) => crate::t!("Import PDF").into_owned(),
@@ -512,6 +517,12 @@ impl OpenCADStudio {
crate::ui::window::pdf_dialogs::view_pc_section(state, flow)
})
}
super::super::ModalKind::ViewBackground => {
let state = self.view_background.as_ref()?;
sized_flow(ex, 420, 560, |flow| {
crate::ui::window::pdf_dialogs::view_background(state, flow)
})
}
super::super::ModalKind::UnderlayLayers => {
let state = self.underlay_layers.as_ref()?;
sized_flow(ex, 460, 520, |flow| {