Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Notable changes per release. Releases are tagged `vX.Y.Z`; the version lives in
- CMake package: `find_package(TachyonUI)` with `TachyonUI::gui_core` and `TachyonUI::gui_controls`; Windows x64 with MSVC.
- The backends are libraries of their own: `gui_backend_vulkan`, `gui_backend_d3d12`, `gui_backend_metal`, `gui_backend_sdlgpu` and `gui_backend_sdl` (windows and clipboard). `gui_core` and `gui_controls` hold none of them, so an app that sets its own backends links no SDL, Vulkan, VMA or D3D12MA. Apps link `TachyonUI::gui_backend_default` as well as `gui_controls` to get the built-in backends; without it and without a window backend set, `Initialize` fails and says which library to link. `RegisterGraphicsBackend`, `RegisterDefaultWindowBackend` and `RegisterDefaultClipboard` set the defaults; the `TACHYON_VULKAN`-style definitions come from `gui_backend_default` and the backend libraries.
- The package installs third-party headers only for the libraries its public headers include (SDL3, VMA, D3D12 Memory Allocator). The privately linked ones (HarfBuzz, skribidi, SheenBidi, libunibreak, budoux, nanosvg, vk-bootstrap) are there as library files alone, without headers or package configs.
- The file system, file icons and file thumbnails (`IFileSystem`, `MemoryFileSystem`, `FileIcons`, `FileThumbnails`) moved out of `gui_controls` into the examples (`examples/app_controls`, as `<app_controls/...>`): they serve one kind of app. The showcase's Files panel uses them from there.
- No files or DLLs to ship: the shaders, the default themes and the fonts are built into the library (`TACHYON_EMBED_RESOURCES`), and the bundled SDL3 is linked statically. `SetResourceRoot` is only needed for an app's own themes and fonts; a file there replaces the built-in one of the same name.
- Resource files must be named in their exact case on every platform. The built-in themes and fonts are no longer found by a name in another case on Windows. `SetPathCaseCheck` compares the paths of the theme, font, icon and shader files the library opens with their names on disk: debug builds log a wrong case, `PathCaseCheck::Fail` refuses the file as Linux would, and the test programs run with it. `FindPathCaseMismatch` and `CheckPathCase` do the same for an app's own files. A test checks every resource path in the source and docs against the files on disk, and that no two files differ only in case. See [Resource paths](docs/contributing/resource-paths.md).
- `GraphicsContext::SetShaderDirectory` is gone; `VulkanGraphicsContext::SetShaderDirectory` loads shaders from disk instead of the built-in ones. The package no longer installs `shaders_compiled/`.
Expand Down
14 changes: 10 additions & 4 deletions docs/controls/trees-and-grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,14 @@ gridState.onOpen = [this](ID itemID) {

## File views

The file views show a tree and a grid of files. They read the files through an
`IFileSystem` (`gui_controls/gui_file_system.h`), so the files don't have to be on disk:
A tree list and a grid view can browse files, as the showcase's Files panel does.

- The file code is part of the examples, not the library: it belongs to one kind of app.
- It's in `examples/app_controls/`, a small library the showcase links
(`tachyon_app_controls`).
- Copy it into your app, or use it as a model for your own.
- The panel reads the files through an `IFileSystem` (`app_controls/gui_file_system.h`), so
the files don't have to be on disk:

| Method | Effect |
| --- | --- |
Expand Down Expand Up @@ -228,7 +234,7 @@ if (!files.Move("TachyonUI/notes.txt", "Archive", error))
ShowToast(ToastDesc{ .severity = Severity::Error, .title = "Can't move it", .body = error });
```

`FileIcons` (`gui_controls/gui_file_icons.h`) gets the OS icon for a file or folder.
`FileIcons` (`app_controls/gui_file_icons.h`) gets the OS icon for a file or folder.

- On Windows it uses the shell's icons:
- one per extension
Expand Down Expand Up @@ -256,7 +262,7 @@ const IconID square = textSystem->RegisterIconFromPixels("white-square", uint2{
Button(square, [this] { Fill(); });
```

`FileThumbnails` (`gui_controls/gui_file_thumbnails.h`) gets a file's thumbnail: a small
`FileThumbnails` (`app_controls/gui_file_thumbnails.h`) gets a file's thumbnail: a small
picture of a photo's contents or of a video frame, as Explorer shows it.

- On Windows it reads them from the shell on a background thread.
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ if(TACHYON_BUILD_EXAMPLES)
endif()

if(TACHYON_BUILD_SHOWCASE)
add_subdirectory(app_controls)
add_subdirectory(showcase)
endif()
14 changes: 14 additions & 0 deletions examples/app_controls/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# App-level parts the examples build on, which belong to one kind of app rather than the
# library: the file system, file icons and thumbnails of the showcase's Files panel.
add_library(tachyon_app_controls STATIC
gui_file_system.h
gui_file_system.cpp
gui_file_icons.h
gui_file_icons.cpp
gui_file_thumbnails.h
gui_file_thumbnails.cpp)
# Included as <app_controls/...>.
target_include_directories(tachyon_app_controls PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(tachyon_app_controls PUBLIC gui_core)
tachyon_apply_compile_options(tachyon_app_controls)
set_target_properties(tachyon_app_controls PROPERTIES FOLDER "Examples")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <gui_controls/gui_file_icons.h>
#include <app_controls/gui_file_icons.h>

#include <gui_core/text/gui_text_system.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <gui_controls/gui_file_system.h>
#include <app_controls/gui_file_system.h>

#include <algorithm>
#include <system_error>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <gui_controls/gui_file_thumbnails.h>
#include <app_controls/gui_file_thumbnails.h>

#include <gui_core/gui_base_types.h>
#include <gui_core/text/gui_text_system.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <gtest/gtest.h>

#include <gui_controls/gui_file_icons.h>
#include <gui_controls/gui_file_system.h>
#include <app_controls/gui_file_icons.h>
#include <app_controls/gui_file_system.h>

#include "gui_text_system_stub.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <gtest/gtest.h>

#include <gui_controls/gui_file_thumbnails.h>
#include <app_controls/gui_file_thumbnails.h>

#include "fake_clock.h"
#include "gui_text_system_stub.h"
Expand Down
4 changes: 3 additions & 1 deletion examples/showcase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ tachyon_add_example(showcase
"${PROJECT_SOURCE_DIR}/workdirectory/themes/dark.css"
"${PROJECT_SOURCE_DIR}/workdirectory/themes/light.css"
"${PROJECT_SOURCE_DIR}/workdirectory/themes/styles.css"
"${PROJECT_SOURCE_DIR}/workdirectory/themes/showcase.css")
"${PROJECT_SOURCE_DIR}/workdirectory/themes/showcase.css"

LIBS tachyon_app_controls)

tachyon_precompile_headers(showcase <gui_controls/gui_application.h>)
if(TACHYON_METAL)
Expand Down
6 changes: 3 additions & 3 deletions examples/showcase/panel_files.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "application.h"
#include <gui_controls/gui_file_icons.h>
#include <gui_controls/gui_file_system.h>
#include <gui_controls/gui_file_thumbnails.h>
#include <app_controls/gui_file_icons.h>
#include <app_controls/gui_file_system.h>
#include <app_controls/gui_file_thumbnails.h>

#include <algorithm>
#include <cctype>
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/panel_misc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "application.h"
#include <gui_controls/gui_file_thumbnails.h>
#include <app_controls/gui_file_thumbnails.h>
#include <gui_controls/gui_node_view_helpers.h>
#include <gui_core/diagnostics/gui_logging.h>

Expand Down
7 changes: 0 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,6 @@ list(APPEND GUI_CONTROLS_FILES

gui_controls/gui_tree_utils.h

gui_controls/gui_file_system.h
gui_controls/gui_file_system.cpp
gui_controls/gui_file_icons.h
gui_controls/gui_file_icons.cpp
gui_controls/gui_file_thumbnails.h
gui_controls/gui_file_thumbnails.cpp

gui_controls/controls.cpp
gui_controls/controls_box_fields.cpp
gui_controls/controls_curve.cpp
Expand Down
22 changes: 20 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ list(APPEND GUI_CORE_TEST_FILES
skribidi_text_measurement_test.cpp
skribidi_glyph_quad_test.cpp
controls_grid_view_test.cpp
file_system_test.cpp
file_thumbnails_test.cpp
controls_menu_test.cpp
controls_settings_test.cpp
transition_manager_test.cpp
Expand Down Expand Up @@ -243,6 +241,26 @@ set_target_properties(gui_ui_only_tests PROPERTIES
)


# The examples' app-level parts (examples/app_controls), tested with the examples' code.
if(TARGET tachyon_app_controls)
set(_app_controls_test_dir "${PROJECT_SOURCE_DIR}/examples/app_controls/tests")
add_executable(app_controls_tests
"${_app_controls_test_dir}/file_system_test.cpp"
"${_app_controls_test_dir}/file_thumbnails_test.cpp"
main.cpp)
# The tests share this folder's helpers (gui_text_system_stub.h, fake_clock.h).
target_include_directories(app_controls_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(app_controls_tests PRIVATE tachyon_app_controls GTest::gtest GTest::gmock)
tachyon_apply_compile_options(app_controls_tests)
tachyon_copy_runtime_dlls(app_controls_tests)
gtest_discover_tests(app_controls_tests DISCOVERY_MODE PRE_TEST DISCOVERY_TIMEOUT 60)
set_target_properties(app_controls_tests PROPERTIES
FOLDER "Tests"
VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/workdirectory"
)
endif()


# Tests on a real GPU, in two programs. They drive real windows through SDL, and SKIP
# themselves when no suitable device or display is present, so they're safe to build
# everywhere.
Expand Down
Loading