X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4d39789a6269ba9023b163ffe4a5c1c51fe592fd..9b6b96172d1d20d9daf3c11bc5f0222f487d53d7:/lib/gui/elistboxcontent.cpp diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 5421f252..f5ae2b38 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -374,10 +374,11 @@ void eListboxPythonStringContent::setList(PyObject *list) PyObject *eListboxPythonStringContent::getCurrentSelection() { - if (!m_list) - return 0; - if (!cursorValid()) - return 0; + if (!(m_list && cursorValid())) + { + Py_INCREF(Py_None); + return Py_None; + } PyObject *r = PyList_GET_ITEM(m_list, m_cursor); Py_XINCREF(r); return r; @@ -466,18 +467,23 @@ 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, value_alignment_left ? gPainter::RT_HALIGN_LEFT : 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")) { PyObject *pvalue = PyTuple_GET_ITEM(value, 1); + PyObject *psize = PyTuple_GET_ITEM(value, 2); /* convert value to Long. fallback to -1 on error. */ int value = (pvalue && PyInt_Check(pvalue)) ? PyInt_AsLong(pvalue) : -1; + int size = (pvalue && PyInt_Check(psize)) ? PyInt_AsLong(psize) : 100; /* calc. slider length */ - int width = item_right.width() * value / 100; + int width = item_right.width() * value / size; int height = item_right.height(); @@ -491,8 +497,8 @@ 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(value_alignment_left ? eTextPara::dirLeft : eTextPara::dirRight); @@ -514,7 +520,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); @@ -710,6 +716,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c break; } + case TYPE_PIXMAP_ALPHATEST: case TYPE_PIXMAP: // pixmap { if (!(px && py && pwidth && pheight && pfnt)) @@ -733,7 +740,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;