diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/ThemeItems.hh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/FbTk/ThemeItems.hh b/src/FbTk/ThemeItems.hh index d652c52..4d4d081 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.3 2003/11/28 23:02:05 fluxgen Exp $ | 22 | // $Id: ThemeItems.hh,v 1.4 2004/01/02 21:59:52 fluxgen Exp $ |
23 | 23 | ||
24 | /// @file implements common theme items | 24 | /// @file implements common theme items |
25 | 25 | ||
@@ -64,9 +64,13 @@ void FbTk::ThemeItem<int>::setDefaultValue() { | |||
64 | 64 | ||
65 | template <> | 65 | template <> |
66 | void FbTk::ThemeItem<int>::setFromString(const char *str) { | 66 | void FbTk::ThemeItem<int>::setFromString(const char *str) { |
67 | if (str == 0) | 67 | if (str == 0) { |
68 | setDefaultValue(); | ||
68 | return; | 69 | return; |
69 | sscanf(str, "%d", &m_value); | 70 | } |
71 | |||
72 | if (sscanf(str, "%d", &m_value) < 1) | ||
73 | setDefaultValue(); | ||
70 | } | 74 | } |
71 | 75 | ||
72 | template <> | 76 | template <> |
@@ -124,16 +128,21 @@ void ThemeItem<FbTk::Texture>::load() { | |||
124 | 128 | ||
125 | StringUtil::removeFirstWhitespace(pixmap_name); | 129 | StringUtil::removeFirstWhitespace(pixmap_name); |
126 | StringUtil::removeTrailingWhitespace(pixmap_name); | 130 | StringUtil::removeTrailingWhitespace(pixmap_name); |
127 | 131 | if (pixmap_name.empty()) { | |
132 | m_value.pixmap() = 0; | ||
133 | return; | ||
134 | } | ||
128 | std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name, | 135 | std::auto_ptr<PixmapWithMask> pm(Image::load(pixmap_name, |
129 | m_tm.screenNum())); | 136 | m_tm.screenNum())); |
130 | if (pm.get() == 0) { | 137 | if (pm.get() == 0) { |
131 | if (FbTk::ThemeManager::instance().verbose()) | 138 | if (FbTk::ThemeManager::instance().verbose()) { |
132 | cerr<<"Resource("<<name()+".pixmap" | 139 | cerr<<"Resource("<<name()+".pixmap" |
133 | <<"): Failed to load image: "<<pixmap_name<<endl; | 140 | <<"): Failed to load image: "<<pixmap_name<<endl; |
141 | } | ||
134 | m_value.pixmap() = 0; | 142 | m_value.pixmap() = 0; |
135 | } else | 143 | } else |
136 | m_value.pixmap() = pm->pixmap().release(); | 144 | m_value.pixmap() = pm->pixmap().release(); |
145 | |||
137 | } | 146 | } |
138 | 147 | ||
139 | template <> | 148 | template <> |