From 2ff8e3d4a8812d24a8a4b51b21cac1b378291a04 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 14 Dec 2015 22:33:33 +0100 Subject: [PATCH] CLuaInstCCText::CCTextScroll: Add Parameter 'pages' - By pages parameter the number of pages can be specified to be scrolled - Set Lua api version to 1.30 Example: ct = ctext.new{...} ... ct:scroll{dir="down", pages=2}; Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e3fdcaec99d10bc0eb6f414ba3012999e3267197 Author: Michael Liebmann Date: 2015-12-14 (Mon, 14 Dec 2015) Origin message was: ------------------ CLuaInstCCText::CCTextScroll: Add Parameter 'pages' - By pages parameter the number of pages can be specified to be scrolled - Set Lua api version to 1.30 Example: ct = ctext.new{...} ... ct:scroll{dir="down", pages=2}; ------------------ This commit was generated by Migit --- src/gui/lua/lua_cc_text.cpp | 8 ++++++-- src/gui/lua/luainstance.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index e680a46b7..5f87e409e 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -215,15 +215,19 @@ int CLuaInstCCText::CCTextScroll(lua_State *L) std::string tmp = "true"; tableLookup(L, "dir", tmp); bool scrollDown = (tmp == "down" || tmp == "1"); + lua_Integer pages = 1; + tableLookup(L, "pages", pages); //get the textbox instance from lua object and use CTexBbox scroll methods CTextBox* ctb = m->ct->getCTextBoxObject(); if (ctb) { + if (pages == -1) + pages = ctb->getPages(); ctb->enableBackgroundPaint(true); if (scrollDown) - ctb->scrollPageDown(1); + ctb->scrollPageDown(pages); else - ctb->scrollPageUp(1); + ctb->scrollPageUp(pages); ctb->enableBackgroundPaint(false); } return 0; diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index 2d21eb0c6..98fe6ea40 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -31,7 +31,7 @@ extern "C" { #include "luainstance_helpers.h" #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 29 +#define LUA_API_VERSION_MINOR 30 /* inspired by Steve Kemp http://www.steve.org.uk/ */ class CLuaInstance