forked from 1b-agent/opencadstudio-upstream
Merge remote-tracking branch 'origin/main' into codex/block-definition-command-line
# Conflicts: # src/app/commands/inquiry.rs # src/modules/draw/modify/block_edit.rs
This commit is contained in:
commit
99e30f1548
33 files changed
+1660
-199
No files matched your search
@@ -63,6 +63,11 @@ impl CadModule for BlockEditorModule {
|
||||
"Close Block Editor",
|
||||
include_bytes!("../../../assets/icons/mt_cancel.svg"),
|
||||
),
|
||||
command(
|
||||
"BTESTBLOCK",
|
||||
"Test Block",
|
||||
include_bytes!("../../../assets/icons/edit_block.svg"),
|
||||
),
|
||||
],
|
||||
},
|
||||
RibbonGroup {
|
||||
|
||||
+10
-1
@@ -15,7 +15,7 @@ mod report;
|
||||
pub mod select;
|
||||
pub mod units;
|
||||
|
||||
use crate::modules::{CadModule, RibbonGroup, RibbonItem};
|
||||
use crate::modules::{CadModule, IconKind, ModuleEvent, RibbonGroup, RibbonItem, ToolDef};
|
||||
|
||||
pub struct DrawModule;
|
||||
|
||||
@@ -249,6 +249,15 @@ impl CadModule for DrawModule {
|
||||
default: "DIST",
|
||||
}],
|
||||
},
|
||||
RibbonGroup {
|
||||
title: "Close",
|
||||
tools: vec![RibbonItem::LargeTool(ToolDef {
|
||||
id: "BCLOSETESTBLOCK",
|
||||
label: "Close Test Block",
|
||||
icon: IconKind::Svg(include_bytes!("../../../assets/icons/mt_ok.svg")),
|
||||
event: ModuleEvent::Command("BCLOSETESTBLOCK".into()),
|
||||
})],
|
||||
},
|
||||
// Support group lives on the Start tab now (see view.rs:
|
||||
// start_page_view). Removed from the Draw ribbon to declutter.
|
||||
]
|
||||
|
||||
@@ -70,9 +70,10 @@ pub struct BlockEditSession {
|
||||
/// Transient UCS being manipulated in this block tab. On commit its full
|
||||
/// frame is baked into the definition and this returns to `None`.
|
||||
pub editor_ucs: Option<codec::tables::Ucs>,
|
||||
/// The definition was created empty to be edited (a new name at BEDIT /
|
||||
/// -BEDIT); closing without saving removes it again.
|
||||
pub created_for_edit: bool,
|
||||
/// Snapshot of the document prior to creating an empty new block for editing.
|
||||
/// If the session is closed without saving, this snapshot is restored so
|
||||
/// no block record remains in the block table.
|
||||
pub unpersisted_pre_document: Option<codec::CadDocument>,
|
||||
}
|
||||
|
||||
// ── BEDIT pick command ─────────────────────────────────────────────────────
|
||||
@@ -122,3 +123,6 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["BSAVE", "BSAVEAS", "BCLOSE"]
|
||||
});
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["BTESTBLOCK", "BCLOSETESTBLOCK"]
|
||||
});
|
||||
@@ -763,7 +763,7 @@ enum BeditStep {
|
||||
}
|
||||
|
||||
/// -BEDIT: `Enter block name or [?]:` opens the block editor on that
|
||||
/// definition, creating an empty one for a new name.
|
||||
/// definition, or on a new empty one for a new name.
|
||||
pub struct DashBeditCommand {
|
||||
step: BeditStep,
|
||||
table: BlockTable,
|
||||
@@ -845,7 +845,7 @@ impl CadCommand for DashBeditCommand {
|
||||
return Some(CmdResult::ReportError("Invalid block name.".to_string()));
|
||||
}
|
||||
let name = self.table.find_user(t).unwrap_or_else(|| t.to_string());
|
||||
CmdResult::Dispatch(format!("BEDIT_OPEN:{name}"))
|
||||
CmdResult::Dispatch(format!("BEDIT_NEW:{name}"))
|
||||
}
|
||||
BeditStep::ListPattern => {
|
||||
self.step = BeditStep::Name;
|
||||
|
||||
Reference in new issue
Block a user