### Install TreeSheets Target and Directories Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Installs the TreeSheets executable, documentation, examples, and data directories. ```cmake install(TARGETS TreeSheets DESTINATION ${TREESHEETS_BINDIR}) ``` ```cmake install(DIRECTORY TS/docs DESTINATION ${TREESHEETS_DOCDIR}) ``` ```cmake file(GLOB treesheets_readme_files "TS/readme*.html") install(FILES ${treesheets_readme_files} DESTINATION ${TREESHEETS_DOCDIR}) ``` ```cmake install(DIRECTORY TS/examples DESTINATION ${TREESHEETS_DOCDIR}) ``` ```cmake install(DIRECTORY TS/images DESTINATION ${TREESHEETS_PKGDATADIR}) ``` ```cmake install(DIRECTORY TS/scripts DESTINATION ${TREESHEETS_PKGDATADIR}) ``` -------------------------------- ### Install Translations Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Placeholder comment for installing translations to the correct platform-specific path. ```cmake # Install translations to correct platform-specific path. ``` -------------------------------- ### Default Installation Paths Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Sets default installation paths when not on Linux, BSD, or macOS. ```cmake else() set(TREESHEETS_BINDIR .) set(TREESHEETS_DOCDIR .) set(TREESHEETS_PKGDATADIR .) endif() ``` -------------------------------- ### Linux/BSD Installation Paths Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Configures installation paths for Linux and BSD systems, including data directories and documentation. ```cmake if(LINUX OR BSD) OPTION(TREESHEETS_RELOCATABLE_INSTALLATION "Install data relative to the TreeSheets binary, instead of respecting the Filesystem Hierarchy Standard" OFF) endif() ``` ```cmake if((LINUX OR BSD) AND NOT TREESHEETS_RELOCATABLE_INSTALLATION) include(GNUInstallDirs) set(TREESHEETS_BINDIR ${CMAKE_INSTALL_BINDIR}) set(TREESHEETS_DOCDIR ${CMAKE_INSTALL_DOCDIR}) set(TREESHEETS_FULL_DOCDIR ${CMAKE_INSTALL_FULL_DOCDIR}) set(TREESHEETS_PKGDATADIR ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}) set(TREESHEETS_FULL_PKGDATADIR ${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}) # Convert relative to absolute paths because only absolute paths are looked up on Linux (and BSD) target_compile_definitions(TreeSheets PRIVATE "LOCALEDIR=L\"${CMAKE_INSTALL_FULL_LOCALEDIR}\"" "TREESHEETS_DOCDIR=\"${TREESHEETS_FULL_DOCDIR}\"" "TREESHEETS_DATADIR=\"${TREESHEETS_FULL_PKGDATADIR}\"" ) # Adapt the AppStream metainfo to release version and date string(TIMESTAMP TREESHEETS_RELEASE_DATE "%Y-%m-%d") configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/platform/linux/com.strlen.TreeSheets.metainfo.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/com.strlen.TreeSheets.metainfo.xml" @ONLY ) install(FILES platform/linux/com.strlen.TreeSheets.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) install(FILES platform/linux/com.strlen.TreeSheets.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES platform/linux/com.strlen.TreeSheets.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.strlen.TreeSheets.metainfo.xml" DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo) ``` -------------------------------- ### Install Lobster Modules Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Installs Lobster modules if the ENABLE_LOBSTER option is set. ```cmake if(ENABLE_LOBSTER) set(lobster_modules ${lobster_SOURCE_DIR}/modules/std.lobster ${lobster_SOURCE_DIR}/modules/stdtype.lobster ${lobster_SOURCE_DIR}/modules/vec.lobster ${lobster_SOURCE_DIR}/modules/color.lobster ) install(FILES ${lobster_modules} DESTINATION ${TREESHEETS_PKGDATADIR}/scripts/modules) endif(ENABLE_LOBSTER) ``` -------------------------------- ### macOS Installation Paths Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Sets installation paths relative to the application bundle for macOS. ```cmake elseif(APPLE) # Paths must be relative to use with CPack set(TREESHEETS_BINDIR .) set(TREESHEETS_DOCDIR TreeSheets.app/Contents/Resources) set(TREESHEETS_PKGDATADIR TreeSheets.app/Contents/Resources) ``` -------------------------------- ### Install macOS Icon Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Installs the application icon for macOS if the APPLE variable is set. ```cmake if(APPLE) install( FILES "platform/osx/App.icns" DESTINATION "TreeSheets.app/Contents/Resources" ) endif() ``` -------------------------------- ### Install TreeSheets Source: https://context7.com/aardappel/treesheets/llms.txt Commands for installing TreeSheets using CMake. Specify a prefix for custom installation locations on macOS. ```bash cmake --install _build # Linux (may need sudo) cmake --install _build --prefix /opt/treesheets # macOS custom prefix ``` -------------------------------- ### Install TreeSheets Source: https://github.com/aardappel/treesheets/blob/master/README.md Installs the built TreeSheets application. On Linux, this command typically requires root privileges. ```sh cmake --install _build ``` -------------------------------- ### Install Translation MO Files Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Installs translation MO files to appropriate directories based on the operating system. Paths are made relative for CPack compatibility. ```cmake file(GLOB mo_files "${CMAKE_CURRENT_SOURCE_DIR}/TS/translations/*/ts.mo") foreach(mo_file IN LISTS mo_files) cmake_path(GET mo_file PARENT_PATH locale_dir) cmake_path(GET locale_dir FILENAME locale) if(WIN32 OR TREESHEETS_RELOCATABLE_INSTALLATION) # Paths must be relative to use with CPack install(FILES "${mo_file}" DESTINATION "translations/${locale}") elseif(APPLE) # Paths must be relative to use with CPack install(FILES "${mo_file}" DESTINATION "TreeSheets.app/Contents/Resources/translations/${locale}.lproj") else() # Falling back to GNU scheme install(FILES "${mo_file}" DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${locale}/LC_MESSAGES") endif() endforeach() ``` -------------------------------- ### Reading Table, Struct, and Presence Fields Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Functions to get the starting index of table and struct fields, and to check if a field is present in a Flatbuffer binary string. ```APIDOC ## flatbuffers.field_table ### Description Returns the starting index of a table field within the Flatbuffer binary string. ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (int) The starting index of the table field, or 0 if not present. ``` ```APIDOC ## flatbuffers.field_struct ### Description Returns the starting index of a struct field within the Flatbuffer binary string. ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (int) The starting index of the struct field, or 0 if not present. ``` ```APIDOC ## flatbuffers.field_present ### Description Checks if a Flatbuffer field is present (i.e., not equal to its default value). ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (int) 1 if the field is present, 0 otherwise. ``` -------------------------------- ### Install TreeSheets from .deb Package Source: https://github.com/aardappel/treesheets/wiki/TreeSheets-install,-uninstall-scripts-for-Arch-Linux-and-its-based-distros Use this script to extract and install the latest TreeSheets application files from a downloaded .deb package. Ensure the script is in the same directory as the .deb file and run with `sh treesheets-install.sh`. It copies binaries, desktop entries, documentation, icons, and mime types to their respective system locations. ```shell #!/bin/sh ar x *.deb rm control.tar.gz debian-binary tar -xzf data.tar.gz rm data.tar.gz sudo cp usr/bin/TreeSheets /usr/bin/TreeSheets sudo chown root:root /usr/bin/TreeSheets sudo cp usr/share/applications/com.strlen.TreeSheets.desktop /usr/share/applications/com.strlen.TreeSheets.desktop sudo chown root:root /usr/share/applications/com.strlen.TreeSheets.desktop sudo cp -R usr/share/doc/TreeSheets /usr/share/doc/ sudo chown -R root:root /usr/share/doc/TreeSheets/ sudo cp usr/share/icons/hicolor/scalable/apps/com.strlen.TreeSheets.svg /usr/share/icons/hicolor/scalable/apps/com.strlen.TreeSheets.svg sudo chown root:root /usr/share/icons/hicolor/scalable/apps/com.strlen.TreeSheets.svg sudo gtk-update-icon-cache -f -t /usr/share/icons/hicolor # select following lines and uncomment in Geany with CTRL+E if prefer copy also languages, add new languages as they come out #~ sudo cp usr/share/locale/de/LC_MESSAGES/ts.mo /usr/share/locale/de/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/de/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/fr_FR/LC_MESSAGES/ts.mo /usr/share/locale/fr_FR/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/fr_FR/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/it/LC_MESSAGES/ts.mo /usr/share/locale/it/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/it/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/ko/LC_MESSAGES/ts.mo /usr/share/locale/ko/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/ko/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/pt_BR/LC_MESSAGES/ts.mo /usr/share/locale/pt_BR/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/pt_BR/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/ru_RU/LC_MESSAGES/ts.mo /usr/share/locale/ru_RU/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/ru_RU/LC_MESSAGES/ts.mo #~ sudo cp usr/share/locale/zh_CN/LC_MESSAGES/ts.mo /usr/share/locale/zh_CN/LC_MESSAGES/ts.mo #~ sudo chown root:root /usr/share/locale/zh_CN/LC_MESSAGES/ts.mo sudo cp -R usr/share/TreeSheets /usr/share/ sudo chown -R root:root /usr/share/TreeSheets/ sudo cp usr/share/mime/packages/com.strlen.TreeSheets.xml /usr/share/mime/packages/com.strlen.TreeSheets.xml sudo chown root:root /usr/share/mime/packages/com.strlen.TreeSheets.xml sudo update-mime-database /usr/share/mime rm -r usr sudo update-desktop-database /usr/share/applications 2>/dev/null ``` -------------------------------- ### Deep Match Example 1: Shallow Jamie Swap Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/HIERARCHY_SWAP.md Illustrates a two-level hop swap. The first press scopes to the grandparent grid ('Sales'), and the second press operates on the 'Departments' grid, merging all 'Jamie' nodes. ```text Departments Sales Q4 Jamie Support Jamie Engineering Backend Team A Jamie ``` ```text Departments Sales Jamie Q4 Support Jamie Engineering Backend Team A Jamie ``` ```text Departments Jamie Sales Q4 Support Engineering Backend Team A ``` -------------------------------- ### Deep Match Example 2: Mid-depth Jamie Swap Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/HIERARCHY_SWAP.md Demonstrates a single-pass merge. The selected cell's grandparent grid is already the 'Departments' grid, allowing all 'Jamie' nodes to be discovered and merged immediately. ```text Departments Jamie Sales Q4 Support Engineering Backend Team A ``` -------------------------------- ### Deep Match Example 3: Deep Jamie Swap Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/HIERARCHY_SWAP.md Shows a deep match requiring multiple presses. Each press operates two levels up, necessitating three swaps to reach the 'Departments' grid for a full merge of all 'Jamie' nodes. ```text Departments Sales Q4 Jamie Support Jamie Engineering Backend Jamie Team A ``` ```text Departments Sales Q4 Jamie Support Jamie Engineering Jamie Backend Team A ``` ```text Departments Jamie Sales Q4 Support Engineering Backend Team A ``` -------------------------------- ### File I/O in Lobster Scripts Source: https://context7.com/aardappel/treesheets/llms.txt The `file` module in Lobster scripts provides file system access. Examples show reading a file into lines and writing leaf cell texts to a file. ```lobster // Read a file and split into lines let content = read_file("notes.txt") if content: let lines = tokenize(content, "\n", " \t") ts.goto_root() ts.create_grid(1, length(lines)) for(lines) i, line: ts.goto_column_row(0, i) ts.set_text(line) ts.goto_parent() ts.set_status_message("Imported " + length(lines) + " lines from notes.txt") else: ts.set_status_message("Error: could not read notes.txt") // Write all leaf cell texts to a file var out = "" def collect_leaves(): let n = ts.num_children() if n == 0: let t = ts.get_text() if t != "" out += t + "\n" for(n) i: ts.goto_child(i) collect_leaves() ts.goto_parent() ts.goto_root() collect_leaves() if write_file("export.txt", out, 1): ts.set_status_message("Exported leaves to export.txt") ``` -------------------------------- ### Flat Sibling Merge Example Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/HIERARCHY_SWAP.md Illustrates a single-pass merge where multiple 'Tag' siblings are promoted and merged at the document root. Ancestor-clone steps add a 'Root' child to each promoted 'Tag', which are then collapsed into one. ```xml Root Tag Tag Tag Other ``` ```xml Root Other Tag Root ``` -------------------------------- ### Build and Package TreeSheets Source: https://github.com/aardappel/treesheets/blob/master/README.md Builds the project and packages it for binary distribution. The output format varies by operating system (ZIP, DMG, or Debian package). ```sh cmake --build _build --target package -j ``` -------------------------------- ### Create and Edit Grid Structure Source: https://context7.com/aardappel/treesheets/llms.txt Demonstrates creating a grid, inserting a column, and deleting cells. These operations modify the document structure and should be used with care. ```lobster // Build a 3×3 multiplication table under the current cell ts.goto_root() ts.create_grid(3, 3) for(3) row: for(3) col: ts.goto_column_row(col, row) ts.set_text(string((col + 1) * (row + 1))) ts.goto_parent() // Insert an extra header column before column 0 ts.goto_root() ts.insert_column(0) for(3) row: ts.goto_column_row(0, row) ts.set_text("row " + (row + 1)) ts.goto_parent() // Delete cells in top-right 1×1 corner (col 3, row 0, size 1×1) ts.goto_root() ts.delete(int2 { 3, 0 }, int2 { 1, 1 }) ``` -------------------------------- ### Building TreeSheets from Source (Shell Script) Source: https://context7.com/aardappel/treesheets/llms.txt Commands for cloning the TreeSheets repository, configuring the build with CMake (including optional static wxWidgets), and building either a package or just the executable. ```sh # 1. Clone git clone https://github.com/aardappel/treesheets cd treesheets # 2. Configure (Release, static wxWidgets if not pre-installed) cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release \ -DwxBUILD_INSTALL=OFF -DwxBUILD_SHARED=OFF # 3a. Build a distributable package # Windows → ZIP + Nullsoft installer # macOS → .dmg drag-and-drop image # Linux → .deb binary package cmake --build _build --target package -j # 3b. Build only (no package) cmake --build _build -j # Linux/macOS cmake --build _build -j --config Release # Windows MSVC ``` -------------------------------- ### type_enum_value_name Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the name of an enum value. ```APIDOC ## type_enum_value_name ### Description Returns the string name of an enum value given its type ID and index. ### Signature - **type_enum_value_name**(enum_type_id: typeid(any), idx: int) -> string ``` -------------------------------- ### type_field_name Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the name of a field in an object. ```APIDOC ## type_field_name ### Description Returns the name of a specified field within an object. Returns an empty string for non-object types or if the index is out of bounds. ### Signature - **type_field_name**(obj: any, idx: int) -> string ``` -------------------------------- ### type_field_count Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the number of fields in an object. ```APIDOC ## type_field_count ### Description Returns the number of fields in an object. For other reference types, it returns 0. ### Signature - **type_field_count**(obj: any) -> int ``` -------------------------------- ### Configure Build System with CMake Source: https://github.com/aardappel/treesheets/blob/master/README.md Configures the build system for a release build. This step is necessary before building or packaging. ```sh cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release ``` -------------------------------- ### Build TreeSheets Only Source: https://github.com/aardappel/treesheets/blob/master/README.md Builds the project without packaging. For Windows, you may need to append `--config Release`. ```sh cmake --build _build -j ``` -------------------------------- ### type_string Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the string representation of the type of a reference. ```APIDOC ## type_string ### Description Returns a string that represents the type of a given reference (object, vector, string, resource). ### Signature - **type_string**(ref: any) -> string ``` -------------------------------- ### reference_count(val: any) Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the reference count of any given value. ```APIDOC ## reference_count(val: any) ### Description Get the reference count of any value. Primarily for compiler debugging. ### Parameters #### Path Parameters - **val** (any) - Required - The value to get the reference count for. ### Returns - int: The reference count of the value. ``` -------------------------------- ### Resize Window and Set Status Message Source: https://context7.com/aardappel/treesheets/llms.txt Resizes the application window to a specified width and height, and then displays a welcome message including the current document's filename in the status bar. ```lobster // Resize the window and show a greeting in the status bar ts.set_window_size(1280, 800) ts.set_status_message("Welcome to TreeSheets! Document: " + ts.get_filename()) ``` -------------------------------- ### type_element_string Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the string representation of the element type of a vector. ```APIDOC ## type_element_string ### Description Returns a string representing the type of the elements within a given vector. ### Signature - **type_element_string**(v: [any]) -> string ``` -------------------------------- ### program_name() Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Returns the name of the main program (e.g. "foo.lobster"), or an empty string if running from an lpak. ```APIDOC ## program_name() ### Description Returns the name of the main program (e.g. "foo.lobster"), "" if running from lpak. ### Returns - string: The name of the main program. ``` -------------------------------- ### type_id Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets a unique integer ID for the type of a reference. ```APIDOC ## type_id ### Description Returns a unique integer ID representing the type of a given reference (object, vector, string, resource). This ID accounts for subtypes and dynamic type information, differing from `typeof`. ### Signature - **type_id**(ref: any) -> int ``` -------------------------------- ### type_field_value Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the string representation of a field's value in an object. ```APIDOC ## type_field_value ### Description Returns a string representation of the value of a specified field within an object. Returns an empty string for non-object types or if the index is out of bounds. ### Signature - **type_field_value**(obj: any, idx: int) -> string ``` -------------------------------- ### type_field_string Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets the string representation of a field's type in an object. ```APIDOC ## type_field_string ### Description Returns a string representing the type of a specified field within an object. Returns an empty string for non-object types or if the index is out of bounds. ### Signature - **type_field_string**(obj: any, idx: int) -> string ``` -------------------------------- ### Baseline: Single Match Promotion Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/HIERARCHY_SWAP.md Demonstrates a simple promotion where a single matching node is moved to its grandparent grid. This operation does not involve a merge as only one instance of the node exists. ```text Projects Project A Alice Project B Bob ``` ```text Projects Project B Bob Alice Project A ``` -------------------------------- ### CPack Configuration for Windows Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Sets CPack generator to INNOSETUP and ZIP for Windows, configuring package name, executables, and architecture-specific settings. ```cmake set(CPACK_GENERATOR "INNOSETUP" "ZIP") set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_PROJECT_NAME}) set(CPACK_PACKAGE_EXECUTABLES "TreeSheets" "TreeSheets") if(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|arm64") set(CPACK_INNOSETUP_SETUP_ArchitecturesAllowed "arm64") set(ARCH_NAME "winarm64") else() set(CPACK_INNOSETUP_SETUP_ArchitecturesAllowed "x64compatible") set(ARCH_NAME "winx64") endif() set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}-${ARCH_NAME}") set(CPACK_INNOSETUP_RUN_EXECUTABLES "TreeSheets") set(CPACK_INNOSETUP_PACKAGE_NAME ${CMAKE_PROJECT_NAME}) set(CPACK_INNOSETUP_LANGUAGES "brazilianPortuguese" "english" "french" "german" "italian" "korean" "russian" ) set(CPACK_INNOSETUP_SETUP_PrivilegesRequired "lowest") set(CPACK_INNOSETUP_IGNORE_README_PAGE ON) set(CPACK_INNOSETUP_IGNORE_LICENSE_PAGE ON) set(CPACK_INNOSETUP_USE_MODERN_WIZARD ON) ``` -------------------------------- ### Note Functions Source: https://context7.com/aardappel/treesheets/llms.txt Functions to get and set notes associated with cells. ```APIDOC ## ts.get_note / ts.set_note ### Description `get_note()` retrieves the note associated with the current cell. `set_note()` sets or updates the note for the current cell. ### Method `ts.get_note() -> string` `ts.set_note(note: string)` ### Example ```lobster def annotate_leaves(): let n = ts.num_children() let t = ts.get_text() let note = ts.get_note() if t != "" and note == "" and n == 0: ts.set_note("added: " + date_time_string()) for(n) i: ts.goto_child(i) annotate_leaves() ts.goto_parent() ts.goto_root() annotate_leaves() ``` ``` -------------------------------- ### command_line_arguments() Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Returns a list of strings representing the command line arguments. ```APIDOC ## command_line_arguments() ### Description Returns a list of strings representing the command line arguments. ### Returns - [string]: A list of command line arguments. ``` -------------------------------- ### Text Manipulation Source: https://context7.com/aardappel/treesheets/llms.txt Functions to get and set the text content of cells. ```APIDOC ## ts.get_text / ts.set_text ### Description `get_text()` retrieves the text content of the current cell. `set_text()` updates the text content of the current cell. ### Method `ts.get_text() -> string` `ts.set_text(text: string)` ### Example ```lobster def replace_all(find: string, repl: string): let n = ts.num_children() let t = ts.get_text() if find_string(t, find) >= 0: ts.set_text(replace_string(t, find, repl)) for(n) i: ts.goto_child(i) replace_all(find, repl) ts.goto_parent() ts.goto_root() replace_all("TODO", "DONE") ts.set_status_message("Replacement complete.") ``` ``` -------------------------------- ### seconds_elapsed() Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Returns the number of seconds elapsed since the program started. ```APIDOC ## seconds_elapsed() ### Description Seconds since program start as a float, unlike gl.time() it is calculated every time it is called. ### Returns - float: The number of seconds elapsed since program start. ``` -------------------------------- ### thread_read(type: typeid(any)) Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets an object from the thread queue, blocking if none are available. ```APIDOC ## thread_read(type: typeid(any)) ### Description Get an object from the thread queue. Pass the typeof object. Blocks if no such objects available. Returns object, or nil if this was the result of thread_wake() or stop_worker_threads() was called. ### Parameters #### Path Parameters - **type** (typeid(any)) - Required - The type of object to retrieve. ### Returns - any?: The object from the thread queue, or nil. ``` -------------------------------- ### date_time_build_info() Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Returns a string containing information about when the program was compiled. ```APIDOC ## date_time_build_info() ### Description A string representing information from when this program was compiled. ### Returns - string: Build information string. ``` -------------------------------- ### set_console(on: bool) Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Turns the console window on or off (Windows only). ```APIDOC ## set_console(on: bool) ### Description Lets you turn on/off the console window (on Windows). ### Parameters #### Path Parameters - **on** (bool) - Required - True to turn on the console, false to turn it off. ``` -------------------------------- ### get_stack_trace() Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets a stack trace of the current program location without stopping execution. ```APIDOC ## get_stack_trace() ### Description Gets a stack trace of the current location of the program (needs --runtime-stack-trace) without actually stopping the program. ### Returns - string: The stack trace of the current program location. ``` -------------------------------- ### Text and Note Manipulation Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Functions for getting and setting the text content and notes associated with a cell. ```APIDOC ## ts.get_text ### Description Gets the text content of the current cell. ### Returns - `string`: The text of the current cell. ### Method `ts.get_text()` ## ts.get_note ### Description Gets the note associated with the current cell. ### Returns - `string`: The note of the current cell. ### Method `ts.get_note()` ## ts.set_text ### Description Sets the text content of the current cell. ### Parameters - `text` (string) - The new text content for the cell. ### Method `ts.set_text(text: string)` ## ts.set_note ### Description Sets the note for the current cell. ### Parameters - `text` (string) - The new note for the cell. ### Method `ts.set_note(text: string)` ``` -------------------------------- ### compile_run_file Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Compiles and runs Lobster source code from a specified file in a sandboxed environment. Similar to `compile_run_code` but takes a filename. ```APIDOC ## compile_run_file ### Description Compiles and runs Lobster source code from a specified file in a sandboxed environment. This function is the same as `compile_run_code`, but it accepts a filename as input instead of a code string. ### Signature `compile_run_file(filename: string, args: [string]) -> string, string?` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **filename** (string) - The path to the Lobster source file to compile and run. - **args** (array of strings) - Arguments to pass to the compiled program. ### Returns - **string** - The return value of the program. - **string?** - An error string, or nil if no error occurred. ``` -------------------------------- ### get_memory_usage(n: int) Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Gets a text showing the top N object types using the most memory. ```APIDOC ## get_memory_usage(n: int) ### Description Gets a text showing the top n object types that are using the most memory. ### Parameters #### Path Parameters - **n** (int) - Required - The number of top object types to display. ### Returns - string: A text string detailing memory usage. ``` -------------------------------- ### Recursively Count Cells Source: https://context7.com/aardappel/treesheets/llms.txt Recursively counts all cells in the document starting from the current position. Assumes `ts.goto_root()` has been called. ```lobster // Recursively count all cells in the document def count_cells() -> int: let n = ts.num_children() if n == 0: return 1 var total = 1 for(n) i: ts.goto_child(i) total += count_cells() ts.goto_parent() return total ts.goto_root() let total = count_cells() ts.set_status_message("Total cells: " + total) ``` -------------------------------- ### Change Directory to TreeSheets Source: https://github.com/aardappel/treesheets/blob/master/README.md Navigate into the cloned TreeSheets repository directory. ```sh cd treesheets ``` -------------------------------- ### Include CPack Module Source: https://github.com/aardappel/treesheets/blob/master/CMakeLists.txt Includes the CPack module to enable packaging functionality. ```cmake include(CPack) ``` -------------------------------- ### Uninstall TreeSheets Source: https://github.com/aardappel/treesheets/wiki/TreeSheets-install,-uninstall-scripts-for-Arch-Linux-and-its-based-distros This script removes TreeSheets from your system by deleting its installed files and updating system caches. Run this script to completely uninstall the application. ```shell #!/bin/sh sudo rm /usr/bin/TreeSheets /usr/share/applications/com.strlen.TreeSheets.desktop /usr/share/icons/hicolor/scalable/apps/com.strlen.TreeSheets.svg /usr/share/mime/packages/com.strlen.TreeSheets.xml ~/.config/TreeSheets.conf 2>/dev/null sudo rm /usr/share/locale/de/LC_MESSAGES/ts.mo /usr/share/locale/fr_FR/LC_MESSAGES/ts.mo /usr/share/locale/it/LC_MESSAGES/ts.mo /usr/share/locale/ko/LC_MESSAGES/ts.mo /usr/share/locale/pt_BR/LC_MESSAGES/ts.mo /usr/share/locale/ru_RU/LC_MESSAGES/ts.mo /usr/share/locale/zh_CN/LC_MESSAGES/ts.mo 2>/dev/null sudo rm -fr /usr/share/doc/TreeSheets/ /usr/share/TreeSheets/ 2>/dev/null sudo gtk-update-icon-cache -f -t /usr/share/icons/hicolor sudo update-mime-database /usr/share/mime ``` -------------------------------- ### Reading String and Vector Fields Source: https://github.com/aardappel/treesheets/blob/master/TS/docs/script_reference.html Functions to read string fields, vector lengths, and vector element start positions from a Flatbuffer binary string. ```APIDOC ## flatbuffers.field_string ### Description Reads a string field from a Flatbuffer binary string. ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (string) The value of the string field, or an empty string if not present. ``` ```APIDOC ## flatbuffers.field_vector_len ### Description Reads the length of a vector field from a Flatbuffer binary string. ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (int) The length of the vector, or 0 if not present. ``` ```APIDOC ## flatbuffers.field_vector ### Description Returns the starting index of a vector field within the Flatbuffer binary string. ### Parameters - **string** (string) - The Flatbuffer binary data. - **tablei** (int) - The starting index of the table within the binary data. - **vo** (int) - The vtable offset of the field. ### Returns - (int) The starting index of the vector field, or 0 if not present. ```