From: Felix Domke Date: Wed, 9 Aug 2006 00:24:38 +0000 (+0000) Subject: add possibility to have multiple windowstyles. LCD can have different colors now. X-Git-Tag: 2.6.0~3076 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/ab2ae6bd08a0ef13fc7462d51fc3a9ab15509b17 add possibility to have multiple windowstyles. LCD can have different colors now. --- diff --git a/data/skin.xml b/data/skin.xml index 6f727af5..c096a5fe 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -13,7 +13,8 @@ - + + <color name="Background" color="#33294a6b" /> <color name="LabelForeground" color="#ffffff" /> @@ -39,6 +40,22 @@ </borderset> </windowstyle> + <!-- this is for LCD --> + <windowstyle type="skinned" id="1"> + <color name="Background" color="#000000" /> + <color name="LabelForeground" color="#ffffff" /> + <color name="ListboxBackground" color="#000000" /> + <color name="ListboxForeground" color="#ffffff" /> + <color name="ListboxSelectedBackground" color="#000000" /> + <color name="ListboxSelectedForeground" color="#ffffff" /> + <color name="ListboxMarkedBackground" color="#000000" /> + <color name="ListboxMarkedForeground" color="#ffffff" /> + <color name="ListboxMarkedAndSelectedBackground" color="#000000" /> + <color name="ListboxMarkedAndSelectedForeground" color="#ffffff" /> + <color name="WindowTitleForeground" color="#ffffff" /> + <color name="WindowTitleBackground" color="#000000" /> + </windowstyle> + <fonts> <font filename="md_khmurabi_10.ttf" name="Regular" scale="100" /> <font filename="ae_AlMateen.ttf" name="Replacement" scale="90" replacement="1" /> diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index eaaa81c8..4d0c0a9b 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -330,6 +330,7 @@ eWidgetDesktop::eWidgetDesktop(eSize size): m_mainloop(0), m_timer(0) m_screen.m_dirty_region = gRegion(eRect(ePoint(0, 0), size)); m_screen.m_screen_size = size; m_require_redraw = 0; + m_style_id = 0; CONNECT(gRC::getInstance()->notify, eWidgetDesktop::notify); setCompositionMode(cmImmediate); diff --git a/lib/gui/ewidgetdesktop.h b/lib/gui/ewidgetdesktop.h index f88efa88..fb4b3b82 100644 --- a/lib/gui/ewidgetdesktop.h +++ b/lib/gui/ewidgetdesktop.h @@ -63,6 +63,9 @@ public: }; void setCompositionMode(int mode); + + int getStyleID() { return m_style_id; } + void setStyleID(int id) { m_style_id = id; } private: ePtrList<eWidget> m_root; void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible); @@ -83,6 +86,8 @@ private: void notify(); void clearVisibility(eWidget *widget); + + int m_style_id; }; #endif diff --git a/lib/gui/ewindow.cpp b/lib/gui/ewindow.cpp index 4cb2e76f..83e65ec3 100644 --- a/lib/gui/ewindow.cpp +++ b/lib/gui/ewindow.cpp @@ -16,7 +16,7 @@ eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0) ePtr<eWindowStyle> style; if (mgr) - mgr->getStyle(style); + mgr->getStyle(desktop->getStyleID(), style); /* when there is either no style manager or no style, revert to simple style. */ if (!style) diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index 4cfaa8d4..2558669a 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -19,14 +19,14 @@ eWindowStyleManager::~eWindowStyleManager() m_instance = 0; } -void eWindowStyleManager::getStyle(ePtr<eWindowStyle> &style) +void eWindowStyleManager::getStyle(int style_id, ePtr<eWindowStyle> &style) { - style = m_current_style; + style = m_current_style[style_id]; } -void eWindowStyleManager::setStyle(eWindowStyle *style) +void eWindowStyleManager::setStyle(int style_id, eWindowStyle *style) { - m_current_style = style; + m_current_style[style_id] = style; } eWindowStyleManager *eWindowStyleManager::m_instance; diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 3c9c805b..4824aad6 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -51,12 +51,12 @@ public: eWindowStyleManager(); ~eWindowStyleManager(); #endif - void getStyle(ePtr<eWindowStyle> &style); - void setStyle(eWindowStyle *style); + void getStyle(int style_id, ePtr<eWindowStyle> &style); + void setStyle(int style_id, eWindowStyle *style); static int getInstance(ePtr<eWindowStyleManager> &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; } private: static eWindowStyleManager *m_instance; - ePtr<eWindowStyle> m_current_style; + std::map<int, ePtr<eWindowStyle> > m_current_style; }; TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManagerPtr); diff --git a/skin.py b/skin.py index ecd4355e..c95d049d 100644 --- a/skin.py +++ b/skin.py @@ -228,6 +228,7 @@ def loadSingleSkinData(desktop, dom_skin, path_prefix): for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"): style = eWindowStyleSkinned() + id = int(windowstyle.getAttribute("id") or "0") # defaults font = gFont("Regular", 20) @@ -263,7 +264,7 @@ def loadSingleSkinData(desktop, dom_skin, path_prefix): x = eWindowStyleManagerPtr() eWindowStyleManager.getInstance(x) - x.setStyle(style) + x.setStyle(id, style) def loadSkinData(desktop): skins = dom_skins[:]