# qbj196/photoviewer architecture

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

- Interactive diagram: https://gitdiagram.com/qbj196/photoviewer
- Repository: https://github.com/qbj196/photoviewer

## Overview

PhotoViewer is a Windows desktop image viewer. Users open an image by launching with a file path, using the open command, or dropping a file; the viewer loads it, presents it in a navigable image sequence, and supports viewing controls and file actions. The sampled code shows window creation, control dispatch, painting, and WIC decoding. The decoder call from the view is not visible in the excerpts, so that link is marked unverified; Resource.h is listed as a core module but was not sampled.

Main entry points: [`ViewWnd.cpp`](https://github.com/qbj196/photoviewer/blob/master/ViewWnd.cpp) (View and navigation), [`MainWnd.cpp`](https://github.com/qbj196/photoviewer/blob/master/MainWnd.cpp) (Main window), [`CtrlWnd.cpp`](https://github.com/qbj196/photoviewer/blob/master/CtrlWnd.cpp) (Control window), [`Decoder.cpp`](https://github.com/qbj196/photoviewer/blob/master/Decoder.cpp) (Image decoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Window shell"]
  node_main["Main window<br/>[MainWnd.cpp]"]
  node_controls["Control window<br/>[CtrlWnd.cpp]"]
  node_resources["Resource identifiers<br/>[Resource.h]"]
end

subgraph group_viewing["Image viewing"]
  node_view["View and navigation<br/>[ViewWnd.cpp]"]
  node_sequence["Image sequence<br/>[ViewWnd.cpp]"]
  node_decoder["Image decoding<br/>[Decoder.cpp]"]
end

subgraph group_actions["Viewer actions"]
  node_shell_services["Windows shell services"]
  node_wallpaper["Desktop wallpaper"]
  node_clipboard["Clipboard"]
end

node_user(("User"))
node_wic["Windows Imaging"]
node_display["Windows display"]

node_user -->|"opens or drops"| node_main
node_main -->|"creates"| node_controls
node_main -->|"creates"| node_view
node_main -->|"forwards file"| node_view
node_main -->|"forwards input"| node_view
node_controls -->|"posts commands"| node_view
node_view -->|"navigates files"| node_sequence
node_view -.->|"loads image"| node_decoder
node_decoder -->|"decodes with"| node_wic
node_view -->|"paints image"| node_display
node_view -->|"opens file location"| node_shell_services
node_view -->|"sets wallpaper"| node_wallpaper
node_view -->|"copies path or file"| node_clipboard

click node_main "https://github.com/qbj196/photoviewer/blob/master/MainWnd.cpp"
click node_controls "https://github.com/qbj196/photoviewer/blob/master/CtrlWnd.cpp"
click node_view "https://github.com/qbj196/photoviewer/blob/master/ViewWnd.cpp"
click node_sequence "https://github.com/qbj196/photoviewer/blob/master/ViewWnd.cpp"
click node_decoder "https://github.com/qbj196/photoviewer/blob/master/Decoder.cpp"
click node_resources "https://github.com/qbj196/photoviewer/blob/master/Resource.h"

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_main,node_controls,node_resources,node_user toneBlue
class node_view,node_sequence,node_decoder toneAmber
class node_shell_services,node_wallpaper,node_clipboard toneMint
class node_wic,node_display toneIndigo
```

## Components

### Window shell

- [Main window](https://github.com/qbj196/photoviewer/blob/master/MainWnd.cpp): `MainWnd.cpp`
- [Control window](https://github.com/qbj196/photoviewer/blob/master/CtrlWnd.cpp): `CtrlWnd.cpp`
- [Resource identifiers](https://github.com/qbj196/photoviewer/blob/master/Resource.h): `Resource.h`

### Image viewing

- [View and navigation](https://github.com/qbj196/photoviewer/blob/master/ViewWnd.cpp): `ViewWnd.cpp`
- [Image sequence](https://github.com/qbj196/photoviewer/blob/master/ViewWnd.cpp): `ViewWnd.cpp`
- [Image decoding](https://github.com/qbj196/photoviewer/blob/master/Decoder.cpp): `Decoder.cpp`

### Viewer actions

- **Windows shell services**
- **Desktop wallpaper**
- **Clipboard**

### Other components

- **User**
- **Windows Imaging**
- **Windows display**

## Connections

- User → Main window: opens or drops (evidence: `MainWnd.cpp`)
- Main window → Control window: creates (evidence: `MainWnd.cpp`)
- Main window → View and navigation: creates (evidence: `MainWnd.cpp`)
- Main window → View and navigation: forwards file (evidence: `MainWnd.cpp`)
- Main window → View and navigation: forwards input (evidence: `MainWnd.cpp`)
- Control window → View and navigation: posts commands (evidence: `CtrlWnd.cpp`)
- View and navigation → Image sequence: navigates files (evidence: `ViewWnd.cpp`)
- View and navigation → Image decoding: loads image
- Image decoding → Windows Imaging: decodes with (evidence: `Decoder.cpp`)
- View and navigation → Windows display: paints image (evidence: `ViewWnd.cpp`)
- View and navigation → Windows shell services: opens file location (evidence: `ViewWnd.cpp`)
- View and navigation → Desktop wallpaper: sets wallpaper (evidence: `ViewWnd.cpp`)
- View and navigation → Clipboard: copies path or file (evidence: `ViewWnd.cpp`)
