Add support for setting status bar text from Lua
This commit is contained in:
parent
d0c05fbcde
commit
d660f7f2b0
2 changed files with 24 additions and 0 deletions
|
@ -40,3 +40,11 @@ Returns: 2 values, all numbers.
|
||||||
2. End of the selection, in milliseconds.
|
2. End of the selection, in milliseconds.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Setting the main frame's status bar text
|
||||||
|
|
||||||
|
function aegisub.set_status_bar_text(text)
|
||||||
|
|
||||||
|
Returns: 0 values
|
||||||
|
|
||||||
|
---
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "audio_timing.h"
|
#include "audio_timing.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "frame_main.h"
|
||||||
#include "include/aegisub/context.h"
|
#include "include/aegisub/context.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
@ -52,6 +53,7 @@
|
||||||
#include "video_controller.h"
|
#include "video_controller.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <libaegisub/dispatch.h>
|
||||||
#include <libaegisub/format.h>
|
#include <libaegisub/format.h>
|
||||||
#include <libaegisub/lua/ffi.h>
|
#include <libaegisub/lua/ffi.h>
|
||||||
#include <libaegisub/lua/modules.h>
|
#include <libaegisub/lua/modules.h>
|
||||||
|
@ -270,6 +272,19 @@ namespace {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_set_status_text(lua_State *L)
|
||||||
|
{
|
||||||
|
const agi::Context *c = get_context(L);
|
||||||
|
if (!c || !c->frame) {
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
std::string text = check_string(L, 1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
agi::dispatch::Main().Async([=] { c->frame->StatusTimeout(to_wx(text)); });
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int project_properties(lua_State *L)
|
int project_properties(lua_State *L)
|
||||||
{
|
{
|
||||||
const agi::Context *c = get_context(L);
|
const agi::Context *c = get_context(L);
|
||||||
|
@ -473,6 +488,7 @@ namespace {
|
||||||
set_field<get_translation>(L, "gettext");
|
set_field<get_translation>(L, "gettext");
|
||||||
set_field<project_properties>(L, "project_properties");
|
set_field<project_properties>(L, "project_properties");
|
||||||
set_field<lua_get_audio_selection>(L, "get_audio_selection");
|
set_field<lua_get_audio_selection>(L, "get_audio_selection");
|
||||||
|
set_field<lua_set_status_text>(L, "set_status_text");
|
||||||
|
|
||||||
// store aegisub table to globals
|
// store aegisub table to globals
|
||||||
lua_settable(L, LUA_GLOBALSINDEX);
|
lua_settable(L, LUA_GLOBALSINDEX);
|
||||||
|
|
Loading…
Reference in a new issue