# jashanjodhb/smartshot architecture

> Architecture diagram of the GitHub repository jashanjodhb/smartshot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jashanjodhb/smartshot
- Repository: https://github.com/jashanjodhb/smartshot

## Overview

SmartShot pairs a Windows tray capture app with a OneNote task pane. The main workflow is capture → session/file and clipboard staging → reorder/remove and choose width → insert into OneNote or export PDF. The optional HTTP bridge lets the pane manage desktop captures where browser policy permits; clipboard and file intake remain the primary handoff. Edges are limited to relationships visible in excerpts, indexed references, or README statements; unsampled add-in and native route details are not inferred.

Main entry points: [`SmartShot/src/taskpane/taskpane.js`](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js) (Pane workflow), [`native/src/main.cpp`](https://github.com/jashanjodhb/smartshot/blob/main/native/src/main.cpp) (Tray controls), [`native/src/session.cpp`](https://github.com/jashanjodhb/smartshot/blob/main/native/src/session.cpp) (Capture session), [`native/src/capture.cpp`](https://github.com/jashanjodhb/smartshot/blob/main/native/src/capture.cpp) (Screen capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_native["Desktop capture"]
  node_tray["Tray controls<br/>[main.cpp]"]
  node_capture["Screen capture<br/>[capture.cpp]"]
  node_session[("Capture session<br/>[session.cpp]")]
  node_image["Image codec<br/>[image.cpp]"]
  node_clipboard["Clipboard publishing<br/>[clipboard.cpp]"]
  node_pdfnative["Desktop PDF export<br/>[pdf.cpp]"]
  node_files["Capture files"]
end

subgraph group_pane["OneNote add-in"]
  node_paneui["Pane workflow<br/>[taskpane.js]"]
  node_intake["Clipboard and file intake<br/>[taskpane.js]"]
  node_staged[("Staged screenshots<br/>[taskpane.js]")]
  node_onenote["Page insertion<br/>[onenote.js]"]
  node_pdfjs["Pane PDF export<br/>[pdf.js]"]
  node_pdfdownload["PDF download"]
end

subgraph group_bridge["Optional bridge"]
  node_bridgeclient["Bridge client<br/>[bridge.js]"]
  node_http["HTTP server<br/>[httpserver.cpp]"]
  node_nativeapi["Bridge route handling<br/>[main.cpp]"]
end

node_user(("User"))
node_windowsclip["Windows clipboard"]
node_onenoteapp["OneNote page"]

node_user -->|"chooses capture"| node_tray
node_tray -->|"starts capture"| node_capture
node_capture -->|"adds bitmap"| node_session
node_session -->|"encodes PNG"| node_image
node_session -->|"writes PNGs"| node_files
node_tray -->|"publishes capture"| node_clipboard
node_clipboard -->|"sets clipboard"| node_windowsclip
node_windowsclip -->|"pastes shots"| node_intake
node_files -->|"drops or browses"| node_intake
node_paneui -->|"wires inputs"| node_intake
node_intake -->|"stages images"| node_staged
node_paneui -->|"inserts images"| node_onenote
node_onenote -->|"writes page"| node_onenoteapp
node_paneui -->|"builds export"| node_pdfjs
node_pdfjs -->|"creates PDF"| node_pdfdownload
node_user -->|"stages and exports"| node_paneui
node_user -->|"exports session"| node_tray
node_tray -->|"builds session PDF"| node_pdfnative
node_session -->|"supplies PNGs"| node_pdfnative
node_user -.->|"enables bridge"| node_bridgeclient
node_paneui -->|"probes and requests"| node_bridgeclient
node_bridgeclient -->|"sends HTTP"| node_http
node_http -->|"dispatches requests"| node_nativeapi
node_nativeapi -->|"manages captures"| node_session
node_nativeapi -->|"requests capture"| node_capture
node_nativeapi -->|"builds PDF"| node_pdfnative

click node_tray "https://github.com/jashanjodhb/smartshot/blob/main/native/src/main.cpp"
click node_capture "https://github.com/jashanjodhb/smartshot/blob/main/native/src/capture.cpp"
click node_session "https://github.com/jashanjodhb/smartshot/blob/main/native/src/session.cpp"
click node_image "https://github.com/jashanjodhb/smartshot/blob/main/native/src/image.cpp"
click node_clipboard "https://github.com/jashanjodhb/smartshot/blob/main/native/src/clipboard.cpp"
click node_pdfnative "https://github.com/jashanjodhb/smartshot/blob/main/native/src/pdf.cpp"
click node_paneui "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js"
click node_intake "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js"
click node_staged "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js"
click node_onenote "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/onenote.js"
click node_pdfjs "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/pdf.js"
click node_bridgeclient "https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/bridge.js"
click node_http "https://github.com/jashanjodhb/smartshot/blob/main/native/src/httpserver.cpp"
click node_nativeapi "https://github.com/jashanjodhb/smartshot/blob/main/native/src/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tray,node_capture,node_session,node_image,node_clipboard,node_pdfnative,node_files,node_user toneBlue
class node_paneui,node_intake,node_staged,node_onenote,node_pdfjs,node_pdfdownload toneAmber
class node_bridgeclient,node_http,node_nativeapi toneMint
class node_windowsclip,node_onenoteapp toneIndigo
```

## Components

### Desktop capture

- [Tray controls](https://github.com/jashanjodhb/smartshot/blob/main/native/src/main.cpp): `native/src/main.cpp`
- [Screen capture](https://github.com/jashanjodhb/smartshot/blob/main/native/src/capture.cpp): `native/src/capture.cpp`
- [Capture session](https://github.com/jashanjodhb/smartshot/blob/main/native/src/session.cpp): `native/src/session.cpp`
- [Image codec](https://github.com/jashanjodhb/smartshot/blob/main/native/src/image.cpp): `native/src/image.cpp`
- [Clipboard publishing](https://github.com/jashanjodhb/smartshot/blob/main/native/src/clipboard.cpp): `native/src/clipboard.cpp`
- [Desktop PDF export](https://github.com/jashanjodhb/smartshot/blob/main/native/src/pdf.cpp): `native/src/pdf.cpp`
- **Capture files**

### OneNote add-in

- [Pane workflow](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js): `SmartShot/src/taskpane/taskpane.js`
- [Clipboard and file intake](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js): `SmartShot/src/taskpane/taskpane.js`
- [Staged screenshots](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/taskpane.js): `SmartShot/src/taskpane/taskpane.js`
- [Page insertion](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/onenote.js): `SmartShot/src/taskpane/onenote.js`
- [Pane PDF export](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/pdf.js): `SmartShot/src/taskpane/pdf.js`
- **PDF download**

### Optional bridge

- [Bridge client](https://github.com/jashanjodhb/smartshot/blob/main/SmartShot/src/taskpane/bridge.js): `SmartShot/src/taskpane/bridge.js`
- [HTTP server](https://github.com/jashanjodhb/smartshot/blob/main/native/src/httpserver.cpp): `native/src/httpserver.cpp`
- [Bridge route handling](https://github.com/jashanjodhb/smartshot/blob/main/native/src/main.cpp): `native/src/main.cpp`

### Other components

- **User**
- **Windows clipboard**
- **OneNote page**

## Connections

- User → Tray controls: chooses capture (evidence: `README.md`)
- Tray controls → Screen capture: starts capture (evidence: `native/src/main.cpp`)
- Screen capture → Capture session: adds bitmap
- Capture session → Image codec: encodes PNG (evidence: `native/src/session.cpp`)
- Capture session → Capture files: writes PNGs (evidence: `native/src/session.cpp`)
- Tray controls → Clipboard publishing: publishes capture (evidence: `native/src/main.cpp`)
- Clipboard publishing → Windows clipboard: sets clipboard (evidence: `README.md`)
- Windows clipboard → Clipboard and file intake: pastes shots (evidence: `README.md`)
- Capture files → Clipboard and file intake: drops or browses (evidence: `README.md`)
- Pane workflow → Clipboard and file intake: wires inputs (evidence: `SmartShot/src/taskpane/taskpane.js`)
- Clipboard and file intake → Staged screenshots: stages images (evidence: `SmartShot/src/taskpane/taskpane.js`)
- Pane workflow → Page insertion: inserts images (evidence: `SmartShot/src/taskpane/taskpane.js`)
- Page insertion → OneNote page: writes page (evidence: `README.md`)
- Pane workflow → Pane PDF export: builds export (evidence: `SmartShot/src/taskpane/taskpane.js`)
- Pane PDF export → PDF download: creates PDF
- User → Pane workflow: stages and exports (evidence: `README.md`)
- User → Tray controls: exports session (evidence: `README.md`)
- Tray controls → Desktop PDF export: builds session PDF (evidence: `native/src/main.cpp`)
- Capture session → Desktop PDF export: supplies PNGs
- User → Bridge client: enables bridge (evidence: `README.md`)
- Pane workflow → Bridge client: probes and requests (evidence: `SmartShot/src/taskpane/taskpane.js`)
- Bridge client → HTTP server: sends HTTP (evidence: `SmartShot/src/taskpane/bridge.js`)
- HTTP server → Bridge route handling: dispatches requests (evidence: `native/src/main.cpp`)
- Bridge route handling → Capture session: manages captures (evidence: `native/src/main.cpp`)
- Bridge route handling → Screen capture: requests capture (evidence: `native/src/main.cpp`)
- Bridge route handling → Desktop PDF export: builds PDF (evidence: `native/src/main.cpp`)
