CComponentsPicture: structure of class highly simplified

It should be now easier to use images as objects. An initialized
picture object should provide all relevant properties and some
functionalities of picture viewer.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5eb63b9515
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-06-20 (Fri, 20 Jun 2014)

Origin message was:
------------------
CComponentsPicture: structure of class highly simplified

It should be now easier to use images as objects. An initialized
picture object should provide all relevant properties and some
functionalities of picture viewer.


------------------
This commit was generated by Migit
This commit is contained in:
2014-06-20 17:20:15 +02:00
committed by vanhofen
parent d10a1b79e4
commit f2da159bdf
12 changed files with 190 additions and 196 deletions

View File

@@ -32,7 +32,7 @@
#include <gui/movieplayer.h>
#include <driver/pictureviewer/pictureviewer.h>
#include <neutrino.h>
#include <system/debug.h>
#include "luainstance.h"
/* the magic color that tells us we are using one of the palette colors */
@@ -1886,8 +1886,7 @@ int CLuaInstance::CPictureNew(lua_State *L)
CLuaCWindow* parent = NULL;
lua_Integer x=10, y=10, dx=100, dy=100;
std::string image_name = "";
lua_Integer alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER;
lua_Integer alignment = 0;
std::string tmp1 = "false"; // has_shadow
lua_Integer color_frame = (lua_Integer)COL_MENUCONTENT_PLUS_6;
lua_Integer color_background = (lua_Integer)COL_MENUCONTENT_PLUS_0;
@@ -1899,7 +1898,11 @@ int CLuaInstance::CPictureNew(lua_State *L)
tableLookup(L, "dx" , dx);
tableLookup(L, "dy" , dy);
tableLookup(L, "image" , image_name);
tableLookup(L, "alignment" , alignment);
tableLookup(L, "alignment" , alignment); //invalid argumet, for compatibility
if (alignment)
dprintf(DEBUG_NORMAL, "[CLuaInstance][%s - %d] invalid argument: 'alignment' has no effect!\n", __func__, __LINE__);
tableLookup(L, "has_shadow" , tmp1);
bool has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes");
tableLookup(L, "color_frame" , color_frame);
@@ -1910,7 +1913,7 @@ int CLuaInstance::CPictureNew(lua_State *L)
CLuaPicture **udata = (CLuaPicture **) lua_newuserdata(L, sizeof(CLuaPicture *));
*udata = new CLuaPicture();
(*udata)->cp = new CComponentsPicture(x, y, dx, dy, image_name, alignment, pw, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_background, (fb_pixel_t)color_shadow);
(*udata)->cp = new CComponentsPicture(x, y, dx, dy, image_name, pw, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_background, (fb_pixel_t)color_shadow);
(*udata)->parent = pw;
luaL_getmetatable(L, "cpicture");
lua_setmetatable(L, -2);