# giuspen/cherrytree architecture

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

- Interactive diagram: https://gitdiagram.com/giuspen/cherrytree
- Repository: https://github.com/giuspen/cherrytree

## Overview

CherryTree is a desktop hierarchical note-taking application. Users create or open a notebook, navigate its tree, edit rich-text or code content, and save in XML, SQLite, or multifile storage; they can also import, export, search, and protect documents. The graph preserves these documented product capabilities and the principal UI-to-storage workflow. Source excerpts are partial, so several capability links rely on the README; optional archive integration is shown as unverified where its runtime wiring was not excerpted.

Main entry points: [`src/ct/ct_main_win.cc`](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_main_win.cc) (Main window), [`src/ct/ct_storage_control.cc`](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_control.cc) (Storage control), [`src/ct/ct_widgets.cc`](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_widgets.cc) (Embedded content), [`src/ct/ct_actions_file.cc`](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_actions_file.cc) (User actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Notebook application"]
  node_window["Main window<br/>[ct_main_win.cc]"]
  node_actions["User actions<br/>[ct_actions_file.cc]"]
  node_tree["Notebook tree<br/>[ct_treestore.cc]"]
  node_config["Preferences<br/>[ct_config.cc]"]
end

subgraph group_content["Editing and content"]
  node_editor["Text editor<br/>[ct_text_view.cc]"]
  node_widgets["Embedded content<br/>[ct_widgets.cc]"]
  node_codebox["Codeboxes<br/>[ct_codebox.cc]"]
  node_tables["Tables<br/>[ct_table.cc]"]
  node_images["Images<br/>[ct_image.cc]"]
end

subgraph group_documents["Document operations"]
  node_storage["Storage control"]
  node_xml[("XML documents<br/>[ct_storage_xml.cc]")]
  node_sqlite[("SQLite documents")]
  node_multifile[("Multifile documents")]
  node_imports["Import formats<br/>[ct_imports.cc]"]
  node_parsers["Text parsers<br/>[ct_parser.cc]"]
  node_exports["Document exports<br/>[ct_export2html.cc]"]
end

subgraph group_archive["Archive support"]
  node_archive["7-Zip archive engine"]
  node_archiveiface["Archive interface<br/>[ct_p7za_iface.cc]"]
  node_archivecore["Archive primitives"]
end

node_user(("Notebook user"))

node_user -->|"uses"| node_window
node_window -.->|"dispatches"| node_actions
node_actions -.->|"manages"| node_tree
node_window -.->|"opens and saves"| node_storage
node_window -.->|"edits content"| node_editor
node_editor -->|"anchors"| node_widgets
node_widgets -.->|"includes"| node_codebox
node_widgets -.->|"includes"| node_tables
node_widgets -.->|"includes"| node_images
node_window -->|"configures"| node_config
node_storage -->|"selects backend"| node_xml
node_storage -->|"selects backend"| node_sqlite
node_storage -->|"selects backend"| node_multifile
node_xml -->|"serializes content"| node_widgets
node_user -->|"requests import"| node_imports
node_imports -.->|"parses text"| node_parsers
node_user -->|"requests export"| node_exports
node_storage -->|"uses protection"| node_archiveiface
node_archiveiface -.->|"delegates archive work"| node_archive
node_archive -.->|"uses primitives"| node_archivecore

click node_window "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_main_win.cc"
click node_actions "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_actions_file.cc"
click node_tree "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_treestore.cc"
click node_editor "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_text_view.cc"
click node_widgets "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_widgets.cc"
click node_codebox "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_codebox.cc"
click node_tables "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_table.cc"
click node_images "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_image.cc"
click node_config "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_config.cc"
click node_storage "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_control.cc"
click node_xml "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_xml.cc"
click node_sqlite "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_sqlite.cc"
click node_multifile "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_multifile.cc"
click node_imports "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_imports.cc"
click node_parsers "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_parser.cc"
click node_exports "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_export2html.cc"
click node_archive "https://github.com/giuspen/cherrytree/tree/master/src/7za/CPP/7zip"
click node_archiveiface "https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_p7za_iface.cc"
click node_archivecore "https://github.com/giuspen/cherrytree/tree/master/src/7za/CPP/Common"

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_window,node_actions,node_tree,node_config,node_user toneBlue
class node_editor,node_widgets,node_codebox,node_tables,node_images toneAmber
class node_storage,node_xml,node_sqlite,node_multifile,node_imports,node_parsers,node_exports toneMint
class node_archive,node_archiveiface,node_archivecore toneRose
```

## Components

### Notebook application

- [Main window](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_main_win.cc): `src/ct/ct_main_win.cc`
- [User actions](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_actions_file.cc): `src/ct/ct_actions_file.cc`
- [Notebook tree](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_treestore.cc): `src/ct/ct_treestore.cc`
- [Preferences](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_config.cc): `src/ct/ct_config.cc`

### Editing and content

- [Text editor](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_text_view.cc): `src/ct/ct_text_view.cc`
- [Embedded content](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_widgets.cc): `src/ct/ct_widgets.cc`
- [Codeboxes](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_codebox.cc): `src/ct/ct_codebox.cc`
- [Tables](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_table.cc): `src/ct/ct_table.cc`
- [Images](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_image.cc): `src/ct/ct_image.cc`

### Document operations

- [Storage control](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_control.cc): `src/ct/ct_storage_control.cc`
- [XML documents](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_xml.cc): `src/ct/ct_storage_xml.cc`
- [SQLite documents](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_sqlite.cc): `src/ct/ct_storage_sqlite.cc`
- [Multifile documents](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_storage_multifile.cc): `src/ct/ct_storage_multifile.cc`
- [Import formats](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_imports.cc): `src/ct/ct_imports.cc`
- [Text parsers](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_parser.cc): `src/ct/ct_parser.cc`
- [Document exports](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_export2html.cc): `src/ct/ct_export2html.cc`

### Archive support

- [7-Zip archive engine](https://github.com/giuspen/cherrytree/tree/master/src/7za/CPP/7zip): `src/7za/CPP/7zip`
- [Archive interface](https://github.com/giuspen/cherrytree/blob/master/src/ct/ct_p7za_iface.cc): `src/ct/ct_p7za_iface.cc`
- [Archive primitives](https://github.com/giuspen/cherrytree/tree/master/src/7za/CPP/Common): `src/7za/CPP/Common`

### Other components

- **Notebook user**

## Connections

- Notebook user → Main window: uses
- Main window → User actions: dispatches
- User actions → Notebook tree: manages
- Main window → Storage control: opens and saves
- Main window → Text editor: edits content
- Text editor → Embedded content: anchors
- Embedded content → Codeboxes: includes
- Embedded content → Tables: includes
- Embedded content → Images: includes
- Main window → Preferences: configures
- Storage control → XML documents: selects backend (evidence: `src/ct/ct_storage_control.cc`)
- Storage control → SQLite documents: selects backend (evidence: `src/ct/ct_storage_control.cc`)
- Storage control → Multifile documents: selects backend (evidence: `src/ct/ct_storage_control.cc`)
- XML documents → Embedded content: serializes content (evidence: `src/ct/ct_storage_xml.cc`)
- Notebook user → Import formats: requests import
- Import formats → Text parsers: parses text
- Notebook user → Document exports: requests export
- Storage control → Archive interface: uses protection (evidence: `src/ct/ct_storage_control.cc`)
- Archive interface → 7-Zip archive engine: delegates archive work
- 7-Zip archive engine → Archive primitives: uses primitives (evidence: `src/7za/CPP/7zip/UI/Console/Main.cpp`)
