X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/9f9c513165bbcae496b79656304e60bf74557af4..8ea443e11cc862e68ebc092f7c9def2a4b811771:/lib/gui/elistboxcontent.cpp diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index d72b21bc..ff93eac2 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -260,6 +260,7 @@ eListboxPythonStringContent::eListboxPythonStringContent() eListboxPythonStringContent::~eListboxPythonStringContent() { + Py_XDECREF(m_list); } void eListboxPythonStringContent::cursorHome() @@ -423,12 +424,16 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, /* handle left part. get item from tuple, convert to string, display. */ text = PyTuple_GET_ITEM(item, 0); -// text = PyObject_Str(text); /* creates a new object - old object was borrowed! */ + text = PyObject_Str(text); /* creates a new object - old object was borrowed! */ const char *string = (text && PyString_Check(text)) ? PyString_AsString(text) : ""; eSize item_left = eSize(m_seperation, m_itemsize.height()); eSize item_right = eSize(m_itemsize.width() - m_seperation, m_itemsize.height()); painter.renderText(eRect(offset, item_left), string, gPainter::RT_HALIGN_LEFT); -// Py_XDECREF(text); + Py_XDECREF(text); + + /* when we have no label, align value to the left. (FIXME: + don't we want to specifiy this individually?) */ + int value_alignment_left = !*string; /* now, handle the value. get 2nd part from tuple*/ value = PyTuple_GET_ITEM(item, 1); @@ -461,7 +466,10 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, PyObject *pvalue = PyTuple_GET_ITEM(value, 1); const char *value = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : ""; painter.setFont(fnt2); - painter.renderText(eRect(offset + eSize(m_seperation, 0), item_right), value, gPainter::RT_HALIGN_RIGHT); + if (value_alignment_left) + painter.renderText(eRect(offset, item_right), value, gPainter::RT_HALIGN_LEFT); + else + painter.renderText(eRect(offset + eSize(m_seperation, 0), item_right), value, gPainter::RT_HALIGN_RIGHT); /* pvalue is borrowed */ } else if (!strcmp(atype, "slider")) @@ -486,11 +494,11 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, { PyObject *pvalue = PyTuple_GET_ITEM(value, 1); const char *text = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : ""; - - ePtr para = new eTextPara(eRect(offset + eSize(m_seperation, 0), item_right)); + int xoffs = value_alignment_left ? 0 : m_seperation; + ePtr para = new eTextPara(eRect(offset + eSize(xoffs, 0), item_right)); para->setFont(fnt2); para->renderString(text, 0); - para->realign(eTextPara::dirRight); + para->realign(value_alignment_left ? eTextPara::dirLeft : eTextPara::dirRight); int glyphs = para->size(); PyObject *plist = 0; @@ -509,7 +517,7 @@ void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, int num = PyInt_Check(entry) ? PyInt_AsLong(entry) : -1; if ((num < 0) || (num >= glyphs)) - eWarning("glyph index %d in PythonConfigList out of bounds!"); + eWarning("glyph index %d in PythonConfigList out of bounds!", num); else { para->setGlyphFlag(num, GS_INVERT); @@ -705,6 +713,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c break; } + case TYPE_PIXMAP_ALPHATEST: case TYPE_PIXMAP: // pixmap { if (!(px && py && pwidth && pheight && pfnt)) @@ -728,7 +737,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c r &= itemrect; painter.clip(r); - painter.blit(pixmap, r.topLeft(), r); + painter.blit(pixmap, r.topLeft(), r, (type == TYPE_PIXMAP_ALPHATEST) ? gPainter::BT_ALPHATEST : 0); painter.clippop(); break;