Generic plugin runtime (src/plugin/, HostSession, per-tab plugin_state, command router). QGIS-style add-on layout with plugin.toml and single PluginRegistration. Storm Sewer refactored as reference consumer with dispatch.rs, catchments, LandXML, headless tests (43 passing). Core update.rs decoupled from storm_sewer via CadCommand object-pick hooks. Docs: plugin-architecture.md, plugin-template, PR and issue-78 reply drafts.
34 lines
No EOL
815 B
Rust
34 lines
No EOL
815 B
Rust
pub mod dispatch;
|
|
pub mod manifest;
|
|
pub mod plugin;
|
|
pub mod register;
|
|
|
|
use crate::modules::{CadModule, IconKind, ModuleEvent, RibbonGroup, RibbonItem, ToolDef};
|
|
|
|
inventory::submit!(crate::command::CommandRegistration {
|
|
names: &["MP_HELLO"]
|
|
});
|
|
|
|
pub struct MyPluginModule;
|
|
|
|
impl CadModule for MyPluginModule {
|
|
fn id(&self) -> &'static str {
|
|
"my_plugin"
|
|
}
|
|
|
|
fn title(&self) -> &'static str {
|
|
"My Plugin"
|
|
}
|
|
|
|
fn ribbon_groups(&self) -> Vec<RibbonGroup> {
|
|
vec![RibbonGroup {
|
|
title: "Tools",
|
|
tools: vec![RibbonItem::LargeTool(ToolDef {
|
|
id: "MP_HELLO",
|
|
label: "Hello",
|
|
icon: IconKind::Glyph("★"),
|
|
event: ModuleEvent::Command("MP_HELLO".to_string()),
|
|
})],
|
|
}]
|
|
}
|
|
} |