diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index b8ef66615..943495de1 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -267,6 +267,33 @@ namespace { return 4; } + int project_properties(lua_State *L) + { + const agi::Context *c = get_context(L); + if (!c) + lua_pushnil(L); + else { + lua_createtable(L, 0, 14); +#define PUSH_FIELD(name) set_field(L, #name, c->ass->Properties.name) + PUSH_FIELD(automation_scripts); + PUSH_FIELD(export_filters); + PUSH_FIELD(export_encoding); + PUSH_FIELD(style_storage); + PUSH_FIELD(audio_file); + PUSH_FIELD(video_file); + PUSH_FIELD(timecodes_file); + PUSH_FIELD(keyframes_file); + PUSH_FIELD(video_zoom); + PUSH_FIELD(ar_value); + PUSH_FIELD(scroll_position); + PUSH_FIELD(active_row); + PUSH_FIELD(ar_mode); + PUSH_FIELD(video_position); +#undef PUSH_FIELD + } + return 1; + } + class LuaFeature { int myid = 0; protected: @@ -422,7 +449,7 @@ namespace { // make "aegisub" table lua_pushstring(L, "aegisub"); - lua_createtable(L, 0, 12); + lua_createtable(L, 0, 13); set_field(L, "register_macro"); set_field(L, "register_filter"); @@ -437,6 +464,7 @@ namespace { set_field(L, "__init_clipboard"); set_field(L, "file_name"); set_field(L, "gettext"); + set_field(L, "project_properties"); // store aegisub table to globals lua_settable(L, LUA_GLOBALSINDEX); diff --git a/src/subs_controller.h b/src/subs_controller.h index 2e5987501..5425e0871 100644 --- a/src/subs_controller.h +++ b/src/subs_controller.h @@ -54,10 +54,6 @@ class SubsController { agi::signal::Signal FileOpen; /// The file has been saved agi::signal::Signal<> FileSave; - /// The file is about to be saved - /// This signal is intended for adding metadata which is awkward or - /// expensive to always keep up to date - agi::signal::Signal<> UpdateProperties; /// The filename of the currently open file, if any agi::fs::path filename; @@ -111,6 +107,11 @@ public: /// Can the file be saved in its current format? bool CanSave() const; + /// The file is about to be saved + /// This signal is intended for adding metadata which is awkward or + /// expensive to always keep up to date + agi::signal::Signal<> UpdateProperties; + DEFINE_SIGNAL_ADDERS(FileOpen, AddFileOpenListener) DEFINE_SIGNAL_ADDERS(FileSave, AddFileSaveListener)