summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/ThemeItems.hh25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/FbTk/ThemeItems.hh b/src/FbTk/ThemeItems.hh
index 1a6a402..23b8e25 100644
--- a/src/FbTk/ThemeItems.hh
+++ b/src/FbTk/ThemeItems.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ThemeItems.hh,v 1.1 2003/10/13 22:56:28 fluxgen Exp $ 22// $Id: ThemeItems.hh,v 1.2 2003/10/25 22:09:19 fluxgen Exp $
23 23
24/// @file implements common theme items 24/// @file implements common theme items
25 25
@@ -113,17 +113,23 @@ void ThemeItem<FbTk::Texture>::load() {
113 113
114 114
115 // set default value if we failed to load color 115 // set default value if we failed to load color
116 if (!m_value.color().setFromString(color_name.c_str(), m_tm.screenNum())) 116 if (!m_value.color().setFromString(color_name.c_str(),
117 m_tm.screenNum()))
117 m_value.color().setFromString("darkgray", m_tm.screenNum()); 118 m_value.color().setFromString("darkgray", m_tm.screenNum());
118 119
119 if (!m_value.colorTo().setFromString(colorto_name.c_str(), m_tm.screenNum())) 120 if (!m_value.colorTo().setFromString(colorto_name.c_str(),
121 m_tm.screenNum()))
120 m_value.colorTo().setFromString("white", m_tm.screenNum()); 122 m_value.colorTo().setFromString("white", m_tm.screenNum());
121 123
124 StringUtil::removeFirstWhitespace(pixmap_name);
125 StringUtil::removeTrailingWhitespace(pixmap_name);
122 126
123 std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name, m_tm.screenNum())); 127 std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name,
128 m_tm.screenNum()));
124 if (pm.get() == 0) { 129 if (pm.get() == 0) {
125 if (FbTk::ThemeManager::instance().verbose()) 130 if (FbTk::ThemeManager::instance().verbose())
126 cerr<<"Resource("<<name()+".pixmap"<<"): Failed to load image: "<<pixmap_name<<endl; 131 cerr<<"Resource("<<name()+".pixmap"
132 <<"): Failed to load image: "<<pixmap_name<<endl;
127 m_value.pixmap() = 0; 133 m_value.pixmap() = 0;
128 } else 134 } else
129 m_value.pixmap() = pm->pixmap().release(); 135 m_value.pixmap() = pm->pixmap().release();
@@ -163,9 +169,14 @@ setFromString(const char *str) {
163 if (str == 0) 169 if (str == 0)
164 setDefaultValue(); 170 setDefaultValue();
165 else { 171 else {
166 std::auto_ptr<FbTk::PixmapWithMask> pm(Image::load(str, m_tm.screenNum())); 172 std::string filename(str);
173
174 StringUtil::removeFirstWhitespace(filename);
175 StringUtil::removeTrailingWhitespace(filename);
176
177 std::auto_ptr<FbTk::PixmapWithMask> pm(Image::load(filename, m_tm.screenNum()));
167 if (pm.get() == 0) 178 if (pm.get() == 0)
168 setDefaultValue(); 179 setDefaultValue();
169 else { 180 else {
170 (*this)->pixmap() = pm->pixmap().release(); 181 (*this)->pixmap() = pm->pixmap().release();
171 (*this)->mask() = pm->mask().release(); 182 (*this)->mask() = pm->mask().release();