Merge origin/main into blocks-palette-pr

This commit is contained in:
Obtrusive8276
2026-11-01 13:13:32 +01:00
4 changed files with 79 additions and 18 deletions
+35 -17
View File
@@ -194,6 +194,31 @@ fn filters_for_save(name: &str) -> [(&'static str, &'static str); 6] {
filters
}
/// The main window: its size, title bar, placement and rendering needs.
fn window_options() -> eframe::NativeOptions {
eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_title("CADCraft")
.with_inner_size([1600.0, 1000.0])
.with_min_inner_size([900.0, 560.0])
.with_drag_and_drop(true)
.with_fullsize_content_view(true)
.with_titlebar_shown(false)
.with_title_shown(false)
.with_app_id(APP_ID),
persist_window: false,
// The window opens centred on its screen, not cascaded from the top-left corner (#1129).
// Wayland compositors place windows themselves.
centered: true,
// CADCraft installs its own capped font chain (`theme::install_fonts`); never run
// system-font discovery as a hidden fallback.
system_font_fallback: false,
// A stencil buffer clips the contents of clipped layout viewports on the GPU.
stencil_buffer: STENCIL_BITS,
..Default::default()
}
}
const APP_ID: &str = "ai.storyteller.cadcraft";
/// Stencil bits of the window's render pass (see `NativeOptions::stencil_buffer`).
@@ -256,22 +281,7 @@ fn main() -> eframe::Result {
// The crosshair is drawn by the app: present without a queue on Linux/BSD, where X11
// swapchains hold two frames back under vsync (`CADCRAFT_VSYNC=1` restores vsync).
wgpu_options: eframe::egui_wgpu::WgpuConfiguration::default().with_surface_config(surface),
viewport: egui::ViewportBuilder::default()
.with_title("CADCraft")
.with_inner_size([1600.0, 1000.0])
.with_min_inner_size([900.0, 560.0])
.with_drag_and_drop(true)
.with_fullsize_content_view(true)
.with_titlebar_shown(false)
.with_title_shown(false)
.with_app_id(APP_ID),
persist_window: false,
// CADCraft installs its own capped font chain (`theme::install_fonts`); never run
// system-font discovery as a hidden fallback.
system_font_fallback: false,
// A stencil buffer clips the contents of clipped layout viewports on the GPU.
stencil_buffer: STENCIL_BITS,
..Default::default()
..window_options()
};
if let Some(icon) = app_icon() {
options.viewport = options.viewport.with_icon(icon);
@@ -383,7 +393,7 @@ fn main() -> eframe::Result {
#[cfg(test)]
mod tests {
use super::{filters_for_save, follow_desktop};
use super::{filters_for_save, follow_desktop, window_options};
#[test]
fn save_dialog_offers_dwg_with_the_drawing_format_first() {
@@ -401,6 +411,14 @@ mod tests {
}
}
/// #1129: the window opens centred, not cascaded from the top-left corner.
#[test]
fn the_window_opens_centred() {
let o = window_options();
assert!(o.centered, "centred on launch");
assert!(!o.persist_window, "no saved position to restore instead");
}
/// View ▸ Theme ▸ System on Linux: winit reports no theme, so the desktop's answer stands in;
/// without one (or where winit answers and the desktop doesn't) the input is left alone.
#[test]
+9
View File
@@ -63,6 +63,8 @@ fn missing_commands_menus_tools_and_snap_labels(language: &str) -> Vec<String> {
let catalog = catalog(language).unwrap();
let mut sources = BTreeSet::new();
sources.extend(crate::menus::MENUS.iter().copied());
// File ▸ Open Recent is built at run time, not from a command's menu path.
sources.extend([crate::menus::OPEN_RECENT, crate::menus::CLEAR_RECENT]);
for c in cadcraft_engine::command_specs() {
sources.insert(c.label);
sources.extend(c.menu.iter().copied());
@@ -560,6 +562,13 @@ fn production_font_chain_covers_latin_and_shortcut_symbols() {
});
}
/// #1129: in Chinese every menu, submenu, command, tool palette and object-snap label is
/// translated, so no menu shows English entries.
#[test]
fn chinese_menus_and_commands_are_fully_translated() {
assert_eq!(missing_commands_menus_tools_and_snap_labels("zh"), Vec::<String>::new());
}
/// Bosnian counts: 1, 21 `one`; 2–4, 22–24 (not 12–14) `few`; everything else `other`.
#[test]
fn bosnian_counts_take_one_few_other() {
+32
View File
@@ -1375,3 +1375,35 @@
This drawing has no blocks. 此图形中没有块。
This library has no drawings or blocks. 此库中没有图形或块。
Only the first {n} are shown. 仅显示前 {n} 个。
# Menu and command labels the October 2026 update missed (#1129).
Align Multileaders 对齐多重引线
Analyze Usage 分析使用情况
Break-line Symbol 折断线符号
Change 更改
Change Properties 修改特性
Clear Recent Files 清除最近的文件
Close Block Editor 关闭块编辑器
Collect 合并
Collect Multileaders 合并多重引线
Convert Text to Mtext 将文字转换为多行文字
Customize 自定义
Drag Dynamic Grip 拖动动态夹点
Dynamic Block Data 动态块数据
Dynamic Block Grips 动态块夹点
Dynamic Block Reference 动态块参照
Edit Command Aliases (PGP)... 编辑命令别名 (PGP)...
Edit Multileader 编辑多重引线
Evaluate LISP 求值 LISP
Explode Attributes to Text 将属性分解为文字
Express Tools 扩展工具
Groups 编组
Hatch Pick 拾取图案填充
Implied Loops 隐含环
Justify 对正
Move/Copy/Rotate 移动/复制/旋转
Save Block 保存块
Save Block As 块另存为
Save Layout as Template 将布局另存为样板
Set Dynamic Property 设置动态特性
Units 单位
1 # CADCraft Simplified Chinese interface catalog — original translations.
1375
1376
1377
1378 # Menu and command labels the October 2026 update missed (#1129).
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
+3 -1
View File
@@ -10,6 +10,8 @@ pub const MENUS: &[&str] = &["File", "Edit", "View", "Insert", "Format", "Tools"
/// File ▸ Open Recent: one `ui.recent.<n>` item per recent file, then Clear Recent Files.
pub const OPEN_RECENT: &str = "Open Recent";
/// The last item of File ▸ Open Recent.
pub const CLEAR_RECENT: &str = "Clear Recent Files";
const RECENT_ITEM: &str = "ui.recent.";
const RECENT_CLEAR: &str = "ui.recent.clear";
@@ -636,7 +638,7 @@ pub fn recent_entries(app: &CadApp) -> Vec<Entry> {
.map(|(i, path)| Entry::Item { label: file_name(path), id: format!("{RECENT_ITEM}{i}"), shortcut: None, enabled: true })
.collect();
let enabled = !app.ui.recent_files.is_empty();
entries.push(Entry::Item { label: "Clear Recent Files".into(), id: RECENT_CLEAR.into(), shortcut: None, enabled });
entries.push(Entry::Item { label: CLEAR_RECENT.into(), id: RECENT_CLEAR.into(), shortcut: None, enabled });
entries
}