Files
DOSSIER/src/MasseSettingsApp.jsx
T
karim 13a5e1eb7a AGPL-3.0 Dual-Lizenz + Pill-Stil-UI + Section-Style-Overhaul + Plan-Mode-Template
Lizenz:
- AGPL-3.0 LICENSE-File im Repo-Root (GNU Volltext)
- SPDX-Header + Copyright in allen Source-Files (Python/JSX/JS/Rust)
- license-Feld in package.json + Cargo.toml
- About-App komplett neu: Dual-Lizenz-Block (AGPL + Commercial),
  openbureau-Branding, Version-Pills, made-in-Switzerland-Footer

UI-Restyle (3 Wellen) — alle Dialoge + Satellites + Panel-Sidebars
auf gemeinsamen Pill-Stil aus BarControls (BarToggle/BarButton/BarCombo):
- Welle 1: GeschossDialog/Settings, AusschnittSettings, LayoutDialog
- Welle 2: ConfirmDeleteEbene, Kamera, MasseSettings, Osm, Swisstopo,
  TextEditor, AusschnittLayerDialog, LayerCombinations
- Welle 3: LayoutsApp, MassstabApp, WerkzeugeApp, OverridesApp,
  ZeichnungsebenenApp; Werkzeuge mit ElementeApp-PillGroup-Layout

GeschossDialog Header-Refactor: +Geschoss/+Zeichnung in Toolbar oben,
move-Pfeile-Spalte breiter (kein Overlap mit G-Haken)

Ausschnitte Rows als Pills, kein Outer-Border ums Suchfeld

Section-Style komplett neu (gestaltung.py + GestaltungApp.jsx):
- ObjectSectionAttributesSource.FromObject (richtiger Enum-Name fuer Mac)
- HatchPatternPrintColor + BoundaryPrintColor mit-setzen (Display = Print)
- BoundaryColor nur bei explizitem User-Override, sonst Rhino-Default
- background_color_hex Parameter (BackgroundFillMode=SolidColor)
- Readback aus GetCustomSectionStyle statt direkt aus Attributes
- UI: Schnittkante > Section Style > Solid-Fill mit proper SectionHead
- 'Boundary' (3D Pen) -> 'Background' weil sich's wie Section-Hintergrund verhaelt

Plan-Mode 'Dossier Plan' via Template:
- rhino/templates/dossier_plan.ini wird direkt geladen
- Fallback auf Technical-Clone + ini-Patch wenn Template fehlt
- Auto-Cleanup von Orphan-Modes vor Import (Name- oder Guid-Match)
- ClipSectionUsage=1 + TechnicalMask=15 als bekannte Soll-Werte
- Bei Template-Pfad keine ini-Patches (1:1 wie User exportiert)
- Sanity-Print listet alle registrierten Modes nach Anlegen

Bridge-Unification: 4 Settings-Apps (Ebenen/Project/Geschoss*Dialog)
benutzen jetzt chunkende send() statt eigene bridgeSend ohne Chunk-
Logik -> grosse Payloads (Hatch-Refs etc.) kommen nicht mehr truncated
bei Python an (loeste 'JSON-Fehler char 990'-Regression in Ebenen-
Settings)

Library-Imports robust: 'import library' jetzt Top-Level in elemente.py
+ rhinopanel.py (statt Lazy in Methoden) -> 'No module named library'-
Crashes weg auch wenn sys.path zwischendurch resettet wird

Tools fuer Display-Mode-Maintenance:
- _clean_display_modes.py (loescht alle Custom-Modes, Built-ins bleiben)
- _inspect_plan_mode.py / _inspect_obj_section.py / _inspect_obj_boundary.py
  (Diagnose-Skripte fuer SectionStyle-Property-Reverse-Engineering)
- _reset_rhino_settings.sh (Backup + Nuke der Rhino-Settings als
  letzte Bastion gegen korrupte Display-Modes)
2026-05-26 17:09:18 +02:00

180 lines
5.7 KiB
React

// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2026 Karim Gabriele Varano
import { useEffect, useState } from 'react'
import Icon from './components/Icon'
import { BarButton, BarCombo, BAR_H } from './components/BarControls'
import { onMessage, notifyReady,
masseSetActive as setActive,
masseSavePreset as savePreset,
masseDeletePreset as deletePreset } from './lib/rhinoBridge'
const RAUM_RUNDUNGS_LABELS = {
'exakt': 'Exakt (2 Nachk.)',
'0.01': 'auf 0.01 m²',
'0.1': 'auf 0.1 m²',
'0.5': 'auf 0.5 m²',
'1': 'auf 1 m²',
}
const labelXs = {
fontSize: 9, color: 'var(--text-muted)',
textTransform: 'uppercase', letterSpacing: '0.06em',
fontWeight: 600,
}
const pillInput = {
height: BAR_H,
background: 'var(--bg-input)',
border: '1px solid var(--border)',
borderRadius: 999,
color: 'var(--text-primary)',
fontSize: 11, fontFamily: 'var(--font)',
padding: '0 10px',
outline: 'none',
boxSizing: 'border-box',
}
function Row({ label, children }) {
return (
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span style={{ ...labelXs, width: 130, flexShrink: 0 }}>{label}</span>
<div style={{ flex: 1 }}>{children}</div>
</div>
)
}
export default function MasseSettingsApp() {
const [presets, setPresets] = useState([])
const [activeId, setActiveId] = useState(null)
useEffect(() => {
onMessage('STATE', (s) => {
setPresets(s.presets || [])
setActiveId(s.activeId || null)
})
notifyReady()
}, [])
const active = presets.find(p => p.id === activeId) || presets[0]
const update = (patch) => {
if (!active) return
savePreset({ ...active, ...patch })
}
const addNew = () => {
const name = (window.prompt('Name für neues Mass:') || '').trim()
if (!name) return
const tmpl = active || { raumRundung: '0.1', dimDezimalstellen: 2, dimEinheit: 'm' }
savePreset({
name,
raumRundung: tmpl.raumRundung,
dimDezimalstellen: tmpl.dimDezimalstellen,
dimEinheit: tmpl.dimEinheit,
})
}
const remove = () => {
if (!active) return
if (presets.length <= 1) {
window.alert('Mindestens ein Mass muss erhalten bleiben.')
return
}
if (!window.confirm(`Mass "${active.name}" löschen?`)) return
deletePreset(active.id)
}
return (
<div style={{
padding: 16,
display: 'flex', flexDirection: 'column', gap: 14,
fontFamily: 'var(--font)', color: 'var(--text-primary)',
background: 'var(--bg-panel)', minHeight: '100vh',
boxSizing: 'border-box',
}}>
{/* Header */}
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<Icon name="straighten" size={14} style={{ color: 'var(--accent)' }} />
<span style={{ fontSize: 13, fontWeight: 600 }}>Masse</span>
<span style={{ fontSize: 10, color: 'var(--text-muted)', flex: 1 }}>
Globale Vorgaben für Raum-Rundung und Mass-Linien
</span>
</div>
{/* Picker + Aktionen */}
<Row label="Aktiv">
<div style={{ display: 'flex', gap: 4 }}>
<BarCombo stretch
value={activeId || (active?.id || '')}
onChange={(v) => setActive(v)}>
{presets.map(p => (
<option key={p.id} value={p.id}>{p.name}</option>
))}
</BarCombo>
<BarButton icon="add"
onClick={addNew}
title="Neues Mass anlegen (mit aktuellen Werten als Vorlage)" />
<BarButton icon="delete"
onClick={remove}
disabled={presets.length <= 1}
title="Aktives Mass löschen" />
</div>
</Row>
{active && (
<div style={{
display: 'flex', flexDirection: 'column', gap: 10,
padding: 12, borderRadius: 'var(--r-lg)',
background: 'var(--bg-section)',
border: '1px solid var(--border-light)',
}}>
<Row label="Name">
<input
type="text"
value={active.name}
onChange={(e) => update({ name: e.target.value })}
style={{ ...pillInput, width: '100%' }}
/>
</Row>
<Row label="Raum-Rundung">
<BarCombo stretch
value={active.raumRundung}
onChange={(v) => update({ raumRundung: v })}>
{Object.entries(RAUM_RUNDUNGS_LABELS).map(([v, l]) => (
<option key={v} value={v}>{l}</option>
))}
</BarCombo>
</Row>
<Row label="Mass-Dezimalstellen">
<BarCombo stretch
value={String(active.dimDezimalstellen)}
onChange={(v) => update({ dimDezimalstellen: parseInt(v, 10) })}>
{[0, 1, 2, 3, 4].map(n => (
<option key={n} value={n}>{n} {n === 1 ? 'Stelle' : 'Stellen'}</option>
))}
</BarCombo>
</Row>
<Row label="Mass-Einheit">
<BarCombo stretch
value={active.dimEinheit}
onChange={(v) => update({ dimEinheit: v })}>
<option value="m">m (Meter)</option>
<option value="cm">cm (Zentimeter)</option>
<option value="mm">mm (Millimeter)</option>
</BarCombo>
</Row>
</div>
)}
<div style={{ fontSize: 10, color: 'var(--text-muted)',
padding: '6px 8px',
background: 'var(--bg-section)',
borderRadius: 4, lineHeight: 1.5 }}>
Änderungen werden sofort auf alle Räume angewendet. Pro-Raum gesetzte
Rundungen (im Element-Panel) haben Vorrang vor dem aktiven Mass.
Mass-Linien-Anwendung kommt im nächsten Schritt.
</div>
</div>
)
}