diff --git a/app/assets/css/main.css b/app/assets/css/main.css index ff3fd4e..99125fd 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -5690,117 +5690,6 @@ button.tile:hover { stroke-dasharray: 3 2; } -/* Logic analyzer: above the bottom bar, as wide as it. */ -.analyzer { - position: absolute; - left: var(--bar-x); - width: var(--bar-w); - bottom: 76px; - z-index: 19; - display: flex; - flex-direction: column; - max-height: 40vh; - background: rgb(19 24 31 / 0.97); - border: 1px solid var(--border); - border-radius: 12px; - box-shadow: 0 10px 30px rgb(0 0 0 / 0.4); - font-size: 12px; -} - -.analyzer-head { - display: flex; - align-items: center; - gap: 8px; - padding: 6px 8px 6px 12px; - border-bottom: 1px solid var(--border); -} - -.analyzer-empty { - padding: 12px; -} - -.analyzer-body { - display: flex; - overflow-y: auto; - min-height: 0; -} - -.analyzer-names { - flex: none; - border-right: 1px solid var(--border); -} - -.analyzer-names li { - display: flex; - align-items: center; - gap: 6px; - padding: 0 4px 0 12px; - border-bottom: 1px solid rgb(37 46 58 / 0.5); -} - -.analyzer-names li > .truncate { - flex: 1; - min-width: 0; -} - -.analyzer-val { - color: var(--on); - font-family: var(--font-mono); - font-size: 11px; -} - -.analyzer-wave { - position: relative; - flex: 1; - min-width: 0; - overflow: hidden; - cursor: crosshair; -} - -.analyzer-wave svg { - display: block; -} - -.analyzer-bit { - fill: none; - stroke: var(--on); - stroke-width: 1.5; -} - -.analyzer-bus { - fill: var(--on-dim); - stroke: var(--on); - stroke-width: 1; -} - -.analyzer-bus-text { - fill: var(--text); - font-family: var(--font-mono); - font-size: 10px; -} - -.analyzer-mark { - stroke: var(--border); - stroke-width: 1; -} - -.analyzer-cursor { - stroke: var(--accent); - stroke-width: 1; -} - -.analyzer-cycle { - position: absolute; - right: 6px; - top: 2px; - color: var(--muted); - font-size: 10px; - pointer-events: none; -} - -.analyzer-head .hint { - margin: 0; -} .node .pixel-rgb { fill: #5a6779; @@ -6373,3 +6262,55 @@ button.tile:hover { .bench-empty { margin-top: 12px; } + +/* Logic analyzer part */ +.node .scope-body { + fill: #10161d; + stroke: #3b4554; +} + +.node .scope-lane { + fill: #0a0f14; +} + +.node .scope-mark { + stroke: #1f2833; + stroke-width: 1; +} + +.node .scope-wave { + fill: none; + stroke: var(--on); + stroke-width: 1.5; + pointer-events: none; +} + +.node .scope-bus { + fill: var(--on-dim); + stroke: var(--on); + stroke-width: 1; + pointer-events: none; +} + +.node .scope-bus-text, +.node .scope-value { + fill: var(--text); + font-family: var(--font-mono); + font-size: 9.5px; + pointer-events: none; +} + +.node .scope-value { + fill: var(--on); +} + +.scope-chan { + display: flex; + align-items: center; + gap: 4px; + margin-bottom: 4px; +} + +.scope-chan .scope-bits { + width: 52px; +} diff --git a/app/components/editor/Analyzer.vue b/app/components/editor/Analyzer.vue deleted file mode 100644 index 0297c8a..0000000 --- a/app/components/editor/Analyzer.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue index 90452c6..15e08ab 100644 --- a/app/components/editor/App.vue +++ b/app/components/editor/App.vue @@ -45,7 +45,6 @@ watch( - diff --git a/app/components/editor/Canvas.vue b/app/components/editor/Canvas.vue index 0891c4c..0d500d7 100644 --- a/app/components/editor/Canvas.vue +++ b/app/components/editor/Canvas.vue @@ -10,7 +10,6 @@ import { dropLinks, dropPins, fitStart, type DropPin } from '~/lib/logic/fit' import type { CanvasOps, MenuEntry } from '~/composables/useMenu' import { cableInUse, LANE, plugLayout, ribbon, RIBBON_MAX } from '~/lib/logic/cables' import { latchLayout, latchSeam } from '~/lib/logic/latch' -import { probeAt } from '~/lib/logic/probes' import { keyCode } from '~/lib/logic/devices' import { moveParts, moveStart, type MoveStart } from '~/lib/logic/move' import { wirePath, type HopSpan } from '~/lib/draw' @@ -1174,7 +1173,7 @@ function onPointerUp(e: PointerEvent) { ed.commit(false) } else if (d.moved) { ed.unplugMoved(new Set(d.orig.nodes.keys())) - if (d.node.kind !== 'bench' || !ed.dropBench(d.node)) ed.commit(false) + if ((d.node.kind !== 'bench' && d.node.kind !== 'scope') || !ed.dropBench(d.node)) ed.commit(false) } else if (d.benchHit === 'run') ed.runBenchNow(d.node.id, true) else if (typeof d.benchHit === 'number') ed.applyBenchRow(d.node.id, d.benchHit) else if (d.toggle && d.row) ed.toggleRow(d.node, d.row) @@ -1699,8 +1698,6 @@ function openMenuAt(target: Element, at: Pt, x: number, y: number) { const pull = endActions(n).find(x => x.key === 'pull') if (pull) here.push({ label: 'Pull the cable out', icon: pull.icon, run: () => pull.run(new PointerEvent('pointerdown')) }) } - const probe = p && !p.port ? probeAt(def.value, n, pin, dir, ed.getDef.value) : null - if (probe) here.push({ label: 'Watch in analyzer', icon: 'lucide:activity', run: () => ed.watchSignal(probe) }) if (dir === 'in' && ed.canInvert(n, pin)) { const on = n.invert?.includes(pin) here.push({ label: on ? 'Take the bubble off this input' : 'Invert this input', icon: 'lucide:circle-dot', keys: 'Alt+click', run: () => ed.toggleInvert(n, pin) }) diff --git a/app/components/editor/NodeSettings.vue b/app/components/editor/NodeSettings.vue index 6f0fa2d..610af55 100644 --- a/app/components/editor/NodeSettings.vue +++ b/app/components/editor/NodeSettings.vue @@ -5,7 +5,7 @@ import { compile } from '~/lib/logic/compile' import { cableOf } from '~/lib/logic/cables' import { INVERTIBLE } from '~/lib/logic/compile' import { cableBits, cableOffsets, chipPins, MAX_BITS, panelOffsets, portName, rowLabel } from '~/lib/logic/geometry' -import { SINK_KINDS, SOURCE_KINDS } from '~/lib/logic/ops' +import { SINK_KINDS, SOURCE_KINDS, uid } from '~/lib/logic/ops' import { KIND_NAMES } from '~/lib/logic/progress' import { baseOf, gateFamily, inputCount, MAX_GATE_INPUTS } from '~/lib/logic/wide' import { LAMP_COLORS, WIRE_COLORS, type CircuitNode, type NodeKind, type PanelControl, type PanelRow } from '~/lib/logic/types' @@ -344,6 +344,21 @@ function setRowHz(row: PanelRow, e: Event) { else delete row.hz ed.commit() } + +/** Logic analyzer channels. */ +function addChannel(bits: number) { + const used = new Set((n.value.scope?.cols ?? []).map(c => c.name)) + let k = 0 + while (used.has(`CH${k}`)) k++ + ed.setScope(n.value.id, cols => cols.push({ id: uid('c'), name: `CH${k}`, bits })) +} +function renameChannel(i: number, name: string) { + if (name.trim()) ed.setScope(n.value.id, cols => (cols[i]!.name = name.trim().slice(0, 40))) +} +function setChannelBits(i: number, v: string) { + const bits = Math.round(Number(v)) + if (bits >= 1 && bits <= 32) ed.setScope(n.value.id, cols => (cols[i]!.bits = bits)) +} + + +