File Browser: autocomplete keeps focus in the file field when entering a folder.

There is a bunch of internal refactoring going on too:
* No longer use operators to handle these directory and file fields, only makes
  things more complicated than they should be.
* Handle autocomplete partial/full match deeper in the UI code
* Directory field still does not keep focus, that's for another time to fix,
  you can already do pretty quick keyboard only navigation with the file field.

Reviewed By: elubie

Differential Revision: http://developer.blender.org/D29
This commit is contained in:
Brecht Van Lommel 2013-11-22 01:35:38 +01:00
parent 6a6c7b10de
commit 77719bfd06
13 changed files with 129 additions and 178 deletions

View File

@ -321,7 +321,7 @@ typedef struct uiSearchItems uiSearchItems;
typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr);
typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2);
typedef bool (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items);
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
@ -474,7 +474,6 @@ uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, i
uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
@ -634,8 +633,9 @@ void uiBlockSetDrawExtraFunc(uiBlock *block,
void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect),
void *arg1, void *arg2);
bool UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id);
bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id);
bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but);
void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but);

View File

@ -3112,45 +3112,6 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
return but;
}
#if 0 /* UNUSED */
static uiBut *UNUSED_FUNCTION(ui_def_but_operator) (uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
if (str == NULL && ot == NULL) str = opname;
return ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
}
#endif
static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
wmOperatorType *ot;
ot = WM_operatortype_find(opname, 0);
if (!str) {
if (ot) str = ot->name;
else str = opname;
}
if ((!tip || tip[0] == '\0') && ot && ot->description) {
tip = ot->description;
}
but = ui_def_but(block, type, -1, str, x, y, width, height, poin, min, max, a1, a2, tip);
but->optype = ot;
but->opcontext = opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_is_but_rna_undo(), we never need undo here */
if (!ot) {
but->flag |= UI_BUT_DISABLED;
but->lock = TRUE;
but->lockstr = "";
}
return but;
}
uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
@ -3342,13 +3303,6 @@ uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, co
return uiDefButO_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
}
uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but = ui_def_but_operator_text(block, type, opname, opcontext, str, x, y, width, height, poin, min, max, a1, a2, tip);
ui_check_but(but);
return but;
}
/* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */
uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{

View File

@ -421,7 +421,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->func_arg2 = but->func_arg2;
after->funcN = but->funcN;
after->func_argN = MEM_dupallocN(but->func_argN);
after->func_argN = (but->func_argN) ? MEM_dupallocN(but->func_argN) : NULL;
after->rename_func = but->rename_func;
after->rename_arg1 = but->rename_arg1;
@ -1922,10 +1922,10 @@ static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directi
return changed;
}
static bool ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data)
static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data)
{
char *str;
bool changed = true;
int changed;
str = data->str;
@ -2332,7 +2332,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
case TABKEY:
/* there is a key conflict here, we can't tab with autocomplete */
if (but->autocomplete_func || data->searchbox) {
changed = ui_textedit_autocomplete(C, but, data);
int autocomplete = ui_textedit_autocomplete(C, but, data);
changed = autocomplete != AUTOCOMPLETE_NO_MATCH;
if(autocomplete == AUTOCOMPLETE_FULL_MATCH)
button_activate_state(C, but, BUTTON_STATE_EXIT);
update = true; /* do live update for tab key */
}
/* the hotkey here is not well defined, was G.qual so we check all */
@ -8033,8 +8038,8 @@ void UI_remove_popup_handlers_all(bContext *C, ListBase *handlers)
WM_event_free_ui_handler_all(C, handlers, ui_handler_popup, ui_handler_remove_popup);
}
bool UI_textbutton_activate_event(const bContext *C, ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id)
bool UI_textbutton_activate_rna(const bContext *C, ARegion *ar,
const void *rna_poin_data, const char *rna_prop_id)
{
uiBlock *block;
uiBut *but = NULL;
@ -8062,6 +8067,31 @@ bool UI_textbutton_activate_event(const bContext *C, ARegion *ar,
}
}
bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
{
ARegion *ar = CTX_wm_region(C);
uiBlock *block;
uiBut *but = NULL;
for (block = ar->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next)
if (but == actbut && but->type == TEX)
break;
if (but)
break;
}
if (but) {
uiButActiveOnly(C, ar, block, but);
return true;
}
else {
return false;
}
}
void ui_button_clipboard_free(void)
{
curvemapping_free_data(&but_copypaste_curve);

View File

@ -479,7 +479,7 @@ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBu
bool ui_searchbox_inside(struct ARegion *ar, int x, int y);
int ui_searchbox_find_index(struct ARegion *ar, const char *name);
void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, const bool reset);
bool ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str);
int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str);
void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event);
bool ui_searchbox_apply(uiBut *but, struct ARegion *ar);
void ui_searchbox_free(struct bContext *C, struct ARegion *ar);

View File

@ -1051,7 +1051,7 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
ED_region_tag_redraw(ar);
}
bool ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
{
uiSearchboxData *data = ar->regiondata;
int match = AUTOCOMPLETE_NO_MATCH;
@ -1064,7 +1064,8 @@ bool ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
match = autocomplete_end(data->items.autocpl, str);
data->items.autocpl = NULL;
}
return match != AUTOCOMPLETE_NO_MATCH;
return match;
}
static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)

View File

@ -75,25 +75,6 @@
#include "file_intern.h" // own include
/* button events */
enum {
B_FS_DIRNAME,
B_FS_FILENAME
} /*eFile_ButEvents*/;
static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
{
switch (event) {
case B_FS_FILENAME:
file_filename_exec(C, NULL);
break;
case B_FS_DIRNAME:
file_directory_exec(C, NULL);
break;
}
}
/* Note: This function uses pixelspace (0, 0, winx, winy), not view2d.
* The controls are laid out as follows:
*
@ -139,7 +120,6 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Initialize UI block. */
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
/* exception to make space for collapsed region icon */
for (artmp = CTX_wm_area(C)->regionbase.first; artmp; artmp = artmp->next) {
@ -180,21 +160,31 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* callbacks for operator check functions */
uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
min_x, line1_y, line1_w - chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
but = uiDefBut(block, TEX, -1, "",
min_x, line1_y, line1_w - chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
uiButClearFlag(but, UI_BUT_UNDO);
uiButSetNFunc(but, file_directory_enter_handle, NULL, but);
/* TODO, directory editing is non-functional while a library is loaded
* until this is properly supported just disable it. */
if (sfile->files && filelist_lib(sfile->files))
uiButSetFlag(but, UI_BUT_DISABLED);
if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
but = uiDefButTextO(block, TEX, "FILE_OT_filename", 0, "",
but = uiDefBut(block, TEX, -1, "",
min_x, line2_y, line2_w - chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
uiButClearFlag(but, UI_BUT_UNDO);
/* silly workaround calling NFunc to ensure this does not get called
* immediate ui_apply_but_func but only after button deactivates */
uiButSetNFunc(but, file_filename_enter_handle, NULL, but);
/* check if this overrides a file and if the operator option is used */
if (overwrite_alert) {

View File

@ -72,8 +72,6 @@ void FILE_OT_execute(struct wmOperatorType *ot);
void FILE_OT_cancel(struct wmOperatorType *ot);
void FILE_OT_parent(struct wmOperatorType *ot);
void FILE_OT_directory_new(struct wmOperatorType *ot);
void FILE_OT_directory(struct wmOperatorType *ot);
void FILE_OT_filename(struct wmOperatorType *ot);
void FILE_OT_previous(struct wmOperatorType *ot);
void FILE_OT_next(struct wmOperatorType *ot);
void FILE_OT_refresh(struct wmOperatorType *ot);
@ -88,11 +86,12 @@ int file_cancel_exec(bContext *C, struct wmOperator *unused);
int file_parent_exec(bContext *C, struct wmOperator *unused);
int file_previous_exec(bContext *C, struct wmOperator *unused);
int file_next_exec(bContext *C, struct wmOperator *unused);
int file_filename_exec(bContext *C, struct wmOperator *unused);
int file_directory_exec(bContext *C, struct wmOperator *unused);
int file_directory_new_exec(bContext *C, struct wmOperator *unused);
int file_delete_exec(bContext *C, struct wmOperator *unused);
void file_directory_enter_handle(bContext *C, void *arg_unused, void *arg_but);
void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but);
int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
void file_sfile_to_operator(struct wmOperator *op, struct SpaceFile *sfile, char *filepath);
@ -106,8 +105,8 @@ float file_string_width(const char *str);
float file_font_pointsize(void);
void file_change_dir(bContext *C, int checkdir);
int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file);
bool autocomplete_directory(struct bContext *C, char *str, void *arg_v);
bool autocomplete_file(struct bContext *C, char *str, void *arg_v);
int autocomplete_directory(struct bContext *C, char *str, void *arg_v);
int autocomplete_file(struct bContext *C, char *str, void *arg_v);
/* file_panels.c */
void file_panels_register(struct ARegionType *art);

View File

@ -47,6 +47,8 @@
#include "ED_screen.h"
#include "ED_fileselect.h"
#include "UI_interface.h"
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
@ -1133,6 +1135,12 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
/* reload dir to make sure we're seeing what's in the directory */
ED_fileselect_clear(wm, sfile);
if (RNA_boolean_get(op->ptr, "open")) {
BLI_strncpy(sfile->params->dir, path, sizeof(sfile->params->dir));
file_change_dir(C, 1);
}
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
@ -1155,7 +1163,8 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
prop = RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Name of new directory");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "open", false, "Open", "Open new directory");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
@ -1196,36 +1205,13 @@ static void file_expand_directory(bContext *C)
}
}
static int file_directory_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
file_expand_directory(C);
if (!BLI_exists(sfile->params->dir)) {
return WM_operator_confirm_message(C, op, "Create new directory?");
}
return file_directory_exec(C, op);
}
return OPERATOR_CANCELLED;
}
int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UNUSED(arg_but))
{
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
file_expand_directory(C);
if (!BLI_exists(sfile->params->dir)) {
BLI_dir_create_recursive(sfile->params->dir);
}
/* special case, user may have pasted a filepath into the directory */
if (BLI_is_file(sfile->params->dir)) {
char path[sizeof(sfile->params->dir)];
@ -1234,39 +1220,53 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
}
BLI_cleanup_dir(G.main->name, sfile->params->dir);
file_change_dir(C, 1);
if (BLI_exists(sfile->params->dir)) {
/* if directory exists, enter it immediately */
file_change_dir(C, 1);
/* don't do for now because it selects entire text instead of
* placing cursor at the end */
/* UI_textbutton_activate_but(C, but); */
}
else {
const char *lastdir = folderlist_peeklastdir(sfile->folders_prev);
/* if not, ask to create it and enter if confirmed */
PointerRNA ptr;
WM_operator_properties_create(&ptr, "FILE_OT_directory_new");
RNA_string_set(&ptr, "directory", sfile->params->dir);
RNA_boolean_set(&ptr, "open", true);
if (lastdir)
BLI_strncpy(sfile->params->dir, lastdir, sizeof(sfile->params->dir));
WM_operator_name_call(C, "FILE_OT_directory_new", WM_OP_INVOKE_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
}
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
return OPERATOR_FINISHED;
}
static int file_filename_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
file_expand_directory(C);
return file_filename_exec(C, op);
}
return OPERATOR_CANCELLED;
}
int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg_but)
{
SpaceFile *sfile = CTX_wm_space_file(C);
uiBut *but = (uiBut*)arg_but;
char matched_file[FILE_MAX];
char filepath[sizeof(sfile->params->dir)];
if (sfile->params) {
int matches = 0;
int matches;
matched_file[0] = '\0';
filepath[0] = '\0';
if ((matches = file_select_match(sfile, sfile->params->file, matched_file))) {
file_expand_directory(C);
matches = file_select_match(sfile, sfile->params->file, matched_file);
if (matches) {
/* int i, numfiles = filelist_numfiles(sfile->files); */ /* XXX UNUSED */
sfile->params->file[0] = '\0';
/* replace the pattern (or filename that the user typed in, with the first selected file of the match */
@ -1285,6 +1285,7 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
BLI_strncpy(sfile->params->dir, filepath, sizeof(sfile->params->dir));
sfile->params->file[0] = '\0';
file_change_dir(C, 1);
UI_textbutton_activate_but(C, but);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
else if (sfile->params->type == FILE_LOADLIB) {
@ -1295,47 +1296,12 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
BLI_strncpy(sfile->params->dir, filepath, sizeof(sfile->params->dir));
sfile->params->file[0] = '\0';
file_change_dir(C, 0);
UI_textbutton_activate_but(C, but);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
}
}
}
return OPERATOR_FINISHED;
}
/* TODO, directory operator is non-functional while a library is loaded
* until this is properly supported just disable it. */
static int file_directory_poll(bContext *C)
{
/* sfile->files can be NULL on file load */
SpaceFile *sfile = CTX_wm_space_file(C);
return ED_operator_file_active(C) && (sfile->files == NULL || filelist_lib(sfile->files) == NULL);
}
void FILE_OT_directory(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Enter Directory Name";
ot->description = "Enter a directory name";
ot->idname = "FILE_OT_directory";
/* api callbacks */
ot->invoke = file_directory_invoke;
ot->exec = file_directory_exec;
ot->poll = file_directory_poll; /* <- important, handler is on window level */
}
void FILE_OT_filename(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Enter File Name";
ot->description = "Enter a file name";
ot->idname = "FILE_OT_filename";
/* api callbacks */
ot->invoke = file_filename_invoke;
ot->exec = file_filename_exec;
}
void FILE_OT_refresh(struct wmOperatorType *ot)

View File

@ -479,6 +479,17 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir)
BLI_addtail(folderlist, folder);
}
const char *folderlist_peeklastdir(ListBase *folderlist)
{
struct FolderList *folder;
if (!folderlist->last)
return NULL;
folder = folderlist->last;
return folder->foldername;
}
int folderlist_clear_next(struct SpaceFile *sfile)
{
struct FolderList *folder;

View File

@ -98,6 +98,7 @@ void folderlist_free(struct ListBase *folderlist);
struct ListBase * folderlist_duplicate(ListBase *folderlist);
void folderlist_popdir(struct ListBase *folderlist, char *dir);
void folderlist_pushdir(struct ListBase *folderlist, const char *dir);
const char * folderlist_peeklastdir(struct ListBase *folderdist);
int folderlist_clear_next(struct SpaceFile *sfile);
void thumbnails_start(struct FileList *filelist, const struct bContext *C);

View File

@ -634,7 +634,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
return match;
}
bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile = CTX_wm_space_file(C);
int match = AUTOCOMPLETE_NO_MATCH;
@ -684,10 +684,10 @@ bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
}
}
return match == AUTOCOMPLETE_FULL_MATCH;
return match;
}
bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
int autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile = CTX_wm_space_file(C);
int match = AUTOCOMPLETE_NO_MATCH;
@ -706,7 +706,8 @@ bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
}
match = autocomplete_end(autocpl, str);
}
return match == AUTOCOMPLETE_FULL_MATCH;
return match;
}
void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile)

View File

@ -395,8 +395,6 @@ static void file_operatortypes(void)
WM_operatortype_append(FILE_OT_delete);
WM_operatortype_append(FILE_OT_rename);
WM_operatortype_append(FILE_OT_smoothscroll);
WM_operatortype_append(FILE_OT_directory);
WM_operatortype_append(FILE_OT_filename);
}
/* NOTE: do not add .blend file reading on this level */

View File

@ -534,7 +534,7 @@ static void text_properties_area_draw(const bContext *C, ARegion *ar)
/* this flag trick is make sure buttons have been added already */
if (st->flags & ST_FIND_ACTIVATE) {
if (UI_textbutton_activate_event(C, ar, st, "find_text")) {
if (UI_textbutton_activate_rna(C, ar, st, "find_text")) {
/* if the panel was already open we need to do another redraw */
ScrArea *sa = CTX_wm_area(C);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_TEXT, sa);