mirror of https://github.com/odrling/Aegisub
Add support for setting status bar text from Lua
This commit is contained in:
parent
8cc3a35dd4
commit
10814a7d0b
|
@ -40,3 +40,11 @@ Returns: 2 values, all numbers.
|
|||
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 "command/command.h"
|
||||
#include "compat.h"
|
||||
#include "frame_main.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "options.h"
|
||||
#include "project.h"
|
||||
|
@ -52,6 +53,7 @@
|
|||
#include "video_controller.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <libaegisub/dispatch.h>
|
||||
#include <libaegisub/format.h>
|
||||
#include <libaegisub/lua/ffi.h>
|
||||
#include <libaegisub/lua/modules.h>
|
||||
|
@ -270,6 +272,19 @@ namespace {
|
|||
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)
|
||||
{
|
||||
const agi::Context *c = get_context(L);
|
||||
|
@ -473,6 +488,7 @@ namespace {
|
|||
set_field<get_translation>(L, "gettext");
|
||||
set_field<project_properties>(L, "project_properties");
|
||||
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
|
||||
lua_settable(L, LUA_GLOBALSINDEX);
|
||||
|
|
Loading…
Reference in New Issue