Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

chore: merge upstream search

nusaturn0c95c5e646a2
diff --cc kit/CMakeLists.txt
index b163c5a,6602f5f..40b573c
--- a/kit/CMakeLists.txt
+++ b/kit/CMakeLists.txt
@@@ -21,14 -21,10 +21,18 @@@ add_library(bui_kit STATI
intern/kit_regions.c
intern/kit_nodes.c
intern/kit_custom.c
+ intern/kit_filebrowser.c
+ intern/kit_filebrowser_paths.c
+ intern/kit_filebrowser_posix.c
+ intern/kit_filebrowser_win32.c
+ intern/kit_filelist.c
+ intern/kit_filelist_view.c
+ intern/kit_fileops.c
+ intern/kit_fsmenu.c
+ # Blender's UI sources copied and edited for the kit (C++; see blender/bk_blender.h)
+ intern/blender/interface_string_search.cc
+ intern/blender/interface_utils.cc
+ intern/blender/interface_undo.cc
extern/nanosvg/blender_nanosvg.c
extern/nanosvg/blender_raster.c
)
diff --cc kit/include/BUI_kit.h
index 5ee7480,6c62518..f1c89c8
--- a/kit/include/BUI_kit.h
+++ b/kit/include/BUI_kit.h
@@@ -536,39 -536,19 +536,49 @@@ void BK_draw_widget(BuiRaster *r, cons
/* Width of `s` (len < 0: NUL-terminated) in the UI font at BK_scale(). */
float BK_text_width(const char *s, int len);
- /* Evaluate Blender-style number input ("2*pi", "1/3 + 2^2"). */
+ /* Evaluate Blender-style number input ("2*pi", "1/3 + 2^2"): Blender's
+ * BLI_expr_pylike_eval (+ - * / // % ** ^, comparisons, and/or/not, x if c
+ * else y, pi e tau, min max sin cos sqrt atan2 floor ...). */
int BK_eval_number(const char *expr, double *r_value);
+/* -- file browser (Blender's File Browser, editors/space_file) -------------------------------
+ * BK_node_new("filebrowser") is the whole browser: bookmark panels (Volumes, System,
+ * Bookmarks, Recent), the directory-path bar, the file list (Name / Date Modified / Size,
+ * click a header to sort) and the execute bar. Put it in any window; it fills its rect.
+ * strings "dir", "file" (a name, or a path whose folder becomes "dir"), "button" (execute
+ * label), "search", "bookmarks_file" (default $XDG_CONFIG_HOME/bui/bookmarks.txt,
+ * %APPDATA%\bui\bookmarks.txt, or $BUI_BOOKMARKS); get "path" (first result)
+ * numbers "mode" (0 open, 1 save, 2 directory), "multiple", "hidden", "filter" (index),
+ * "sort" (0 name, 1 date, 2 size), "invert"; get "state" (0 browsing, 1 chosen,
+ * -1 cancelled), "count", "selected"; set "execute", "cancel", "refresh" to act
+ * lists "filters": one "Label\tpattern pattern ..." per entry ("*.py", or ".py");
+ * get "result": the chosen paths
+ * events BK_EV_SUBMIT (a = state) when chosen or cancelled, BK_EV_CHANGE on a folder change
+ * Keys: Return opens / executes, BackSpace or Alt+Up parent, Alt+Left / Alt+Right history,
+ * Ctrl+H hidden files, Ctrl+B bookmark the folder, Delete on a bookmark removes it, I new
+ * folder, F2 rename, R refresh, A / Alt+A (de)select all with "multiple", Escape cancels.
+ *
+ * BK_file_dialog runs one in its own native window until it is answered: returns the number
+ * of chosen paths (0 cancelled, -1 no window host), stored NULL-terminated in *r_paths
+ * (free with BK_file_dialog_free). `filters` as above. */
+int BK_file_dialog(const char *title,
+ int mode,
+ const char *dir,
+ const char *file,
+ const char *const *filters,
+ int nfilters,
+ int multiple,
+ char ***r_paths);
+void BK_file_dialog_free(char **paths);
+
+ /* Menu search ranks with Blender's string search (word initials, typos);
+ * items chosen from a search rank first for short queries (Blender's recent
+ * searches). On by default, kept in memory; load/save use one line per item. */
+ void BK_recent_searches_enable(int enabled);
+ void BK_recent_searches_clear(void);
+ void BK_recent_searches_load(const char *path);
+ void BK_recent_searches_save(const char *path);
+
#ifdef __cplusplus
}
#endif