]> git.sesse.net Git - nageru/blobdiff - theme.cpp
Make some labels and a white balance button per preview (the latter is not hooked...
[nageru] / theme.cpp
index 61ead92e98bc8503a8c137f135bf89aa18c2ba27..f8e0d8eff2801a5c91e220819779d652b821431a 100644 (file)
--- a/theme.cpp
+++ b/theme.cpp
@@ -469,6 +469,38 @@ Theme::get_chain(unsigned num, float t, unsigned width, unsigned height)
        });
 }
 
+std::string Theme::get_channel_name(unsigned channel)
+{
+       unique_lock<mutex> lock(m);
+       lua_getglobal(L, "channel_name");
+       lua_pushnumber(L, channel);
+       if (lua_pcall(L, 1, 1, 0) != 0) {
+               fprintf(stderr, "error running function `channel_nam': %s\n", lua_tostring(L, -1));
+               exit(1);
+       }
+
+       std::string ret = lua_tostring(L, -1);
+       lua_pop(L, 1);
+       assert(lua_gettop(L) == 0);
+       return ret;
+}
+
+bool Theme::get_supports_set_wb(unsigned channel)
+{
+       unique_lock<mutex> lock(m);
+       lua_getglobal(L, "supports_set_wb");
+       lua_pushnumber(L, channel);
+       if (lua_pcall(L, 1, 1, 0) != 0) {
+               fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1));
+               exit(1);
+       }
+
+       bool ret = checkbool(L, -1);
+       lua_pop(L, 1);
+       assert(lua_gettop(L) == 0);
+       return ret;
+}
+
 std::vector<std::string> Theme::get_transition_names(float t)
 {
        unique_lock<mutex> lock(m);