summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-05-23 10:25:47 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-05-23 10:25:47 (GMT)
commitfbcdd34b223174a28ff712b7d03e56339fa2fe07 (patch)
treeda036effaeeb5ba7788f4b0403151aa864e9d16d
parentff9c68e247704bd1522ea7a2055b7fa4b2b0c568 (diff)
downloadfluxbox_lack-fbcdd34b223174a28ff712b7d03e56339fa2fe07.zip
fluxbox_lack-fbcdd34b223174a28ff712b7d03e56339fa2fe07.tar.bz2
mostly cosmetic fixes, mainly discovered by 'clang --analyze'
reordering of Resource-related stuff was because of "error: explicit specialization of 'getString' after instantiation" complaints.
-rw-r--r--src/FbTk/TextureRender.cc2
-rw-r--r--src/FbWinFrame.cc2
-rw-r--r--src/IconButton.cc6
-rw-r--r--src/Keys.cc2
-rw-r--r--src/Resources.cc151
-rw-r--r--src/Screen.cc63
-rw-r--r--src/ScreenPlacement.cc61
-rw-r--r--src/Slit.cc60
-rw-r--r--src/Toolbar.cc63
9 files changed, 208 insertions, 202 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index 73c1a94..116142d 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -68,7 +68,7 @@ TextureRender::TextureRender(ImageControl &imgctrl,
68 XColor *_colors, size_t num_colors): 68 XColor *_colors, size_t num_colors):
69 control(imgctrl), 69 control(imgctrl),
70 colors(_colors), 70 colors(_colors),
71 ncolors(ncolors), 71 ncolors(static_cast<int>(num_colors)),
72 cpc(imgctrl.colorsPerChannel()), 72 cpc(imgctrl.colorsPerChannel()),
73 cpccpc(cpc * cpc), 73 cpccpc(cpc * cpc),
74 red(0), green(0), blue(0), 74 red(0), green(0), blue(0),
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 2975252..b311be6 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -160,7 +160,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
160// reconfigure(); 160// reconfigure();
161 } 161 }
162 162
163 return true; 163 return ret;
164} 164}
165 165
166void FbWinFrame::hide() { 166void FbWinFrame::hide() {
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 320918c..0a50661 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -189,8 +189,10 @@ void IconButton::refreshEverything(bool setup) {
189 unsigned int w = width(); 189 unsigned int w = width();
190 unsigned int h = height(); 190 unsigned int h = height();
191 FbTk::translateSize(orientation(), w, h); 191 FbTk::translateSize(orientation(), w, h);
192 int iconx = 1, icony = 1; 192 int iconx = 1;
193 unsigned int neww = w, newh = h; 193 int icony = 1;
194 unsigned int neww;
195 unsigned int newh = h;
194 if (newh > 2*static_cast<unsigned>(icony)) 196 if (newh > 2*static_cast<unsigned>(icony))
195 newh -= 2*icony; 197 newh -= 2*icony;
196 else 198 else
diff --git a/src/Keys.cc b/src/Keys.cc
index f03dc01..2b64656 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -458,7 +458,7 @@ bool Keys::addBinding(const string &linebuffer) {
458 } else if (extractKeyFromString(arg, "move", key)) { 458 } else if (extractKeyFromString(arg, "move", key)) {
459 type = MotionNotify; 459 type = MotionNotify;
460 460
461 } else if (key = FbTk::KeyUtil::getKey(val[argc].c_str())) { // convert from string symbol 461 } else if ((key = FbTk::KeyUtil::getKey(val[argc].c_str()))) { // convert from string symbol
462 type = KeyPress; 462 type = KeyPress;
463 463
464 // keycode covers the following three two-byte cases: 464 // keycode covers the following three two-byte cases:
diff --git a/src/Resources.cc b/src/Resources.cc
index 60c7461..734cd75 100644
--- a/src/Resources.cc
+++ b/src/Resources.cc
@@ -49,6 +49,14 @@ using namespace FbTk;
49namespace FbTk { 49namespace FbTk {
50 50
51template<> 51template<>
52string FbTk::Resource<int>::
53getString() const {
54 char strval[256];
55 sprintf(strval, "%d", **this);
56 return string(strval);
57}
58
59template<>
52void FbTk::Resource<int>:: 60void FbTk::Resource<int>::
53setFromString(const char* strval) { 61setFromString(const char* strval) {
54 int val; 62 int val;
@@ -57,70 +65,16 @@ setFromString(const char* strval) {
57} 65}
58 66
59template<> 67template<>
60void FbTk::Resource<string>:: 68string FbTk::Resource<string>::
61setFromString(const char *strval) { 69getString() const { return **this; }
62 *this = strval;
63}
64
65template<>
66void FbTk::Resource<bool>::
67setFromString(char const *strval) {
68 *this = (bool)!strcasecmp(strval, "true");
69}
70
71template<>
72void FbTk::Resource<vector<WinButton::Type> >::
73setFromString(char const *strval) {
74 vector<string> val;
75 StringUtil::stringtok(val, strval);
76 //clear old values
77 m_value.clear();
78
79 std::string v;
80 for (size_t i = 0; i < val.size(); i++) {
81 v = FbTk::StringUtil::toLower(val[i]);
82 if (v == "maximize")
83 m_value.push_back(WinButton::MAXIMIZE);
84 else if (v == "minimize")
85 m_value.push_back(WinButton::MINIMIZE);
86 else if (v == "shade")
87 m_value.push_back(WinButton::SHADE);
88 else if (v == "stick")
89 m_value.push_back(WinButton::STICK);
90 else if (v == "menuIcon")
91 m_value.push_back(WinButton::MENUICON);
92 else if (v == "close")
93 m_value.push_back(WinButton::CLOSE);
94 }
95}
96
97template<>
98void FbTk::Resource<Fluxbox::TabsAttachArea>::
99setFromString(char const *strval) {
100 if (strcasecmp(strval, "Titlebar")==0)
101 m_value= Fluxbox::ATTACH_AREA_TITLEBAR;
102 else
103 m_value= Fluxbox::ATTACH_AREA_WINDOW;
104}
105
106template<>
107void FbTk::Resource<unsigned int>::
108setFromString(const char *strval) {
109 if (sscanf(strval, "%ul", &m_value) != 1)
110 setDefaultValue();
111}
112 70
113template<> 71template<>
114void FbTk::Resource<long long>:: 72void FbTk::Resource<string>::
115setFromString(const char *strval) { 73setFromString(const char *strval) {
116 if (sscanf(strval, "%lld", &m_value) != 1) 74 *this = strval;
117 setDefaultValue();
118} 75}
119 76
120 77
121//-----------------------------------------------------------------
122//---- manipulators for int, bool, and some enums with Resource ---
123//-----------------------------------------------------------------
124template<> 78template<>
125string FbTk::Resource<bool>:: 79string FbTk::Resource<bool>::
126getString() const { 80getString() const {
@@ -128,17 +82,11 @@ getString() const {
128} 82}
129 83
130template<> 84template<>
131string FbTk::Resource<int>:: 85void FbTk::Resource<bool>::
132getString() const { 86setFromString(char const *strval) {
133 char strval[256]; 87 *this = (bool)!strcasecmp(strval, "true");
134 sprintf(strval, "%d", **this);
135 return string(strval);
136} 88}
137 89
138template<>
139string FbTk::Resource<string>::
140getString() const { return **this; }
141
142 90
143template<> 91template<>
144string FbTk::Resource<vector<WinButton::Type> >:: 92string FbTk::Resource<vector<WinButton::Type> >::
@@ -173,6 +121,34 @@ getString() const {
173 return retval; 121 return retval;
174} 122}
175 123
124
125
126template<>
127void FbTk::Resource<vector<WinButton::Type> >::
128setFromString(char const *strval) {
129 vector<string> val;
130 StringUtil::stringtok(val, strval);
131 //clear old values
132 m_value.clear();
133
134 std::string v;
135 for (size_t i = 0; i < val.size(); i++) {
136 v = FbTk::StringUtil::toLower(val[i]);
137 if (v == "maximize")
138 m_value.push_back(WinButton::MAXIMIZE);
139 else if (v == "minimize")
140 m_value.push_back(WinButton::MINIMIZE);
141 else if (v == "shade")
142 m_value.push_back(WinButton::SHADE);
143 else if (v == "stick")
144 m_value.push_back(WinButton::STICK);
145 else if (v == "menuIcon")
146 m_value.push_back(WinButton::MENUICON);
147 else if (v == "close")
148 m_value.push_back(WinButton::CLOSE);
149 }
150}
151
176template<> 152template<>
177string FbTk::Resource<Fluxbox::TabsAttachArea>:: 153string FbTk::Resource<Fluxbox::TabsAttachArea>::
178getString() const { 154getString() const {
@@ -183,6 +159,15 @@ getString() const {
183} 159}
184 160
185template<> 161template<>
162void FbTk::Resource<Fluxbox::TabsAttachArea>::
163setFromString(char const *strval) {
164 if (strcasecmp(strval, "Titlebar")==0)
165 m_value= Fluxbox::ATTACH_AREA_TITLEBAR;
166 else
167 m_value= Fluxbox::ATTACH_AREA_WINDOW;
168}
169
170template<>
186string FbTk::Resource<unsigned int>:: 171string FbTk::Resource<unsigned int>::
187getString() const { 172getString() const {
188 char tmpstr[128]; 173 char tmpstr[128];
@@ -191,6 +176,14 @@ getString() const {
191} 176}
192 177
193template<> 178template<>
179void FbTk::Resource<unsigned int>::
180setFromString(const char *strval) {
181 if (sscanf(strval, "%ul", &m_value) != 1)
182 setDefaultValue();
183}
184
185
186template<>
194string FbTk::Resource<long long>:: 187string FbTk::Resource<long long>::
195getString() const { 188getString() const {
196 char tmpstr[128]; 189 char tmpstr[128];
@@ -199,13 +192,9 @@ getString() const {
199} 192}
200 193
201template<> 194template<>
202void FbTk::Resource<Layer>:: 195void FbTk::Resource<long long>::
203setFromString(const char *strval) { 196setFromString(const char *strval) {
204 string str(strval); 197 if (sscanf(strval, "%lld", &m_value) != 1)
205 int tempnum = ::Layer::getNumFromString(str);
206 if (tempnum >= 0 && tempnum < ::Layer::NUM_LAYERS)
207 m_value = tempnum;
208 else
209 setDefaultValue(); 198 setDefaultValue();
210} 199}
211 200
@@ -217,9 +206,13 @@ getString() const {
217} 206}
218 207
219template<> 208template<>
220void FbTk::Resource<long>:: 209void FbTk::Resource<Layer>::
221setFromString(const char *strval) { 210setFromString(const char *strval) {
222 if (sscanf(strval, "%ld", &m_value) != 1) 211 string str(strval);
212 int tempnum = ::Layer::getNumFromString(str);
213 if (tempnum >= 0 && tempnum < ::Layer::NUM_LAYERS)
214 m_value = tempnum;
215 else
223 setDefaultValue(); 216 setDefaultValue();
224} 217}
225 218
@@ -230,4 +223,12 @@ getString() const {
230 sprintf(tmpstr, "%ld", m_value); 223 sprintf(tmpstr, "%ld", m_value);
231 return string(tmpstr); 224 return string(tmpstr);
232} 225}
226
227template<>
228void FbTk::Resource<long>::
229setFromString(const char *strval) {
230 if (sscanf(strval, "%ld", &m_value) != 1)
231 setDefaultValue();
232}
233
233} // end namespace FbTk 234} // end namespace FbTk
diff --git a/src/Screen.cc b/src/Screen.cc
index c2929d0..b712b81 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -209,37 +209,6 @@ private:
209namespace FbTk { 209namespace FbTk {
210 210
211template<> 211template<>
212void FbTk::Resource<FbWinFrame::TabPlacement>::
213setFromString(const char *strval) {
214 if (strcasecmp(strval, "TopLeft") == 0)
215 m_value = FbWinFrame::TOPLEFT;
216 else if (strcasecmp(strval, "BottomLeft") == 0)
217 m_value = FbWinFrame::BOTTOMLEFT;
218 else if (strcasecmp(strval, "Top") == 0)
219 m_value = FbWinFrame::TOP;
220 else if (strcasecmp(strval, "Bottom") == 0)
221 m_value = FbWinFrame::BOTTOM;
222 else if (strcasecmp(strval, "TopRight") == 0)
223 m_value = FbWinFrame::TOPRIGHT;
224 else if (strcasecmp(strval, "BottomRight") == 0)
225 m_value = FbWinFrame::BOTTOMRIGHT;
226 else if (strcasecmp(strval, "LeftTop") == 0)
227 m_value = FbWinFrame::LEFTTOP;
228 else if (strcasecmp(strval, "Left") == 0)
229 m_value = FbWinFrame::LEFT;
230 else if (strcasecmp(strval, "LeftBottom") == 0)
231 m_value = FbWinFrame::LEFTBOTTOM;
232 else if (strcasecmp(strval, "RightTop") == 0)
233 m_value = FbWinFrame::RIGHTTOP;
234 else if (strcasecmp(strval, "Right") == 0)
235 m_value = FbWinFrame::RIGHT;
236 else if (strcasecmp(strval, "RightBottom") == 0)
237 m_value = FbWinFrame::RIGHTBOTTOM;
238 else
239 setDefaultValue();
240}
241
242template<>
243string FbTk::Resource<FbWinFrame::TabPlacement>:: 212string FbTk::Resource<FbWinFrame::TabPlacement>::
244getString() const { 213getString() const {
245 switch (m_value) { 214 switch (m_value) {
@@ -283,6 +252,38 @@ getString() const {
283 //default string 252 //default string
284 return string("TopLeft"); 253 return string("TopLeft");
285} 254}
255
256template<>
257void FbTk::Resource<FbWinFrame::TabPlacement>::
258setFromString(const char *strval) {
259 if (strcasecmp(strval, "TopLeft") == 0)
260 m_value = FbWinFrame::TOPLEFT;
261 else if (strcasecmp(strval, "BottomLeft") == 0)
262 m_value = FbWinFrame::BOTTOMLEFT;
263 else if (strcasecmp(strval, "Top") == 0)
264 m_value = FbWinFrame::TOP;
265 else if (strcasecmp(strval, "Bottom") == 0)
266 m_value = FbWinFrame::BOTTOM;
267 else if (strcasecmp(strval, "TopRight") == 0)
268 m_value = FbWinFrame::TOPRIGHT;
269 else if (strcasecmp(strval, "BottomRight") == 0)
270 m_value = FbWinFrame::BOTTOMRIGHT;
271 else if (strcasecmp(strval, "LeftTop") == 0)
272 m_value = FbWinFrame::LEFTTOP;
273 else if (strcasecmp(strval, "Left") == 0)
274 m_value = FbWinFrame::LEFT;
275 else if (strcasecmp(strval, "LeftBottom") == 0)
276 m_value = FbWinFrame::LEFTBOTTOM;
277 else if (strcasecmp(strval, "RightTop") == 0)
278 m_value = FbWinFrame::RIGHTTOP;
279 else if (strcasecmp(strval, "Right") == 0)
280 m_value = FbWinFrame::RIGHT;
281 else if (strcasecmp(strval, "RightBottom") == 0)
282 m_value = FbWinFrame::RIGHTBOTTOM;
283 else
284 setDefaultValue();
285}
286
286} // end namespace FbTk 287} // end namespace FbTk
287 288
288 289
diff --git a/src/ScreenPlacement.cc b/src/ScreenPlacement.cc
index a617956..3e0c377 100644
--- a/src/ScreenPlacement.cc
+++ b/src/ScreenPlacement.cc
@@ -132,24 +132,6 @@ bool ScreenPlacement::placeWindow(const FluxboxWindow &win, int head,
132 132
133////////////////////// Placement Resources 133////////////////////// Placement Resources
134namespace FbTk { 134namespace FbTk {
135
136template <>
137void FbTk::Resource<ScreenPlacement::PlacementPolicy>::setFromString(const char *str) {
138 if (strcasecmp("RowSmartPlacement", str) == 0)
139 *(*this) = ScreenPlacement::ROWSMARTPLACEMENT;
140 else if (strcasecmp("ColSmartPlacement", str) == 0)
141 *(*this) = ScreenPlacement::COLSMARTPLACEMENT;
142 else if (strcasecmp("RowMinOverlapPlacement", str) == 0)
143 *(*this) = ScreenPlacement::ROWMINOVERLAPPLACEMENT;
144 else if (strcasecmp("ColMinOverlapPlacement", str) == 0)
145 *(*this) = ScreenPlacement::COLMINOVERLAPPLACEMENT;
146 else if (strcasecmp("UnderMousePlacement", str) == 0)
147 *(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT;
148 else if (strcasecmp("CascadePlacement", str) == 0)
149 *(*this) = ScreenPlacement::CASCADEPLACEMENT;
150 else
151 setDefaultValue();
152}
153 135
154template <> 136template <>
155std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const { 137std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const {
@@ -172,16 +154,24 @@ std::string FbTk::Resource<ScreenPlacement::PlacementPolicy>::getString() const
172} 154}
173 155
174template <> 156template <>
175void FbTk::Resource<ScreenPlacement::RowDirection>::setFromString(const char *str) { 157void FbTk::Resource<ScreenPlacement::PlacementPolicy>::setFromString(const char *str) {
176 if (strcasecmp("LeftToRight", str) == 0) 158 if (strcasecmp("RowSmartPlacement", str) == 0)
177 *(*this) = ScreenPlacement::LEFTRIGHT; 159 *(*this) = ScreenPlacement::ROWSMARTPLACEMENT;
178 else if (strcasecmp("RightToLeft", str) == 0) 160 else if (strcasecmp("ColSmartPlacement", str) == 0)
179 *(*this) = ScreenPlacement::RIGHTLEFT; 161 *(*this) = ScreenPlacement::COLSMARTPLACEMENT;
162 else if (strcasecmp("RowMinOverlapPlacement", str) == 0)
163 *(*this) = ScreenPlacement::ROWMINOVERLAPPLACEMENT;
164 else if (strcasecmp("ColMinOverlapPlacement", str) == 0)
165 *(*this) = ScreenPlacement::COLMINOVERLAPPLACEMENT;
166 else if (strcasecmp("UnderMousePlacement", str) == 0)
167 *(*this) = ScreenPlacement::UNDERMOUSEPLACEMENT;
168 else if (strcasecmp("CascadePlacement", str) == 0)
169 *(*this) = ScreenPlacement::CASCADEPLACEMENT;
180 else 170 else
181 setDefaultValue(); 171 setDefaultValue();
182
183} 172}
184 173
174
185template <> 175template <>
186std::string FbTk::Resource<ScreenPlacement::RowDirection>::getString() const { 176std::string FbTk::Resource<ScreenPlacement::RowDirection>::getString() const {
187 switch (*(*this)) { 177 switch (*(*this)) {
@@ -196,14 +186,13 @@ std::string FbTk::Resource<ScreenPlacement::RowDirection>::getString() const {
196 186
197 187
198template <> 188template <>
199void FbTk::Resource<ScreenPlacement::ColumnDirection>::setFromString(const char *str) { 189void FbTk::Resource<ScreenPlacement::RowDirection>::setFromString(const char *str) {
200 if (strcasecmp("TopToBottom", str) == 0) 190 if (strcasecmp("LeftToRight", str) == 0)
201 *(*this) = ScreenPlacement::TOPBOTTOM; 191 *(*this) = ScreenPlacement::LEFTRIGHT;
202 else if (strcasecmp("BottomToTop", str) == 0) 192 else if (strcasecmp("RightToLeft", str) == 0)
203 *(*this) = ScreenPlacement::BOTTOMTOP; 193 *(*this) = ScreenPlacement::RIGHTLEFT;
204 else 194 else
205 setDefaultValue(); 195 setDefaultValue();
206
207} 196}
208 197
209template <> 198template <>
@@ -217,4 +206,16 @@ std::string FbTk::Resource<ScreenPlacement::ColumnDirection>::getString() const
217 206
218 return "TopToBottom"; 207 return "TopToBottom";
219} 208}
209
210
211template <>
212void FbTk::Resource<ScreenPlacement::ColumnDirection>::setFromString(const char *str) {
213 if (strcasecmp("TopToBottom", str) == 0)
214 *(*this) = ScreenPlacement::TOPBOTTOM;
215 else if (strcasecmp("BottomToTop", str) == 0)
216 *(*this) = ScreenPlacement::BOTTOMTOP;
217 else
218 setDefaultValue();
219}
220
220} // end namespace FbTk 221} // end namespace FbTk
diff --git a/src/Slit.cc b/src/Slit.cc
index fb3da30..7aaa096 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -90,36 +90,6 @@ using std::dec;
90namespace FbTk { 90namespace FbTk {
91 91
92template<> 92template<>
93void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
94 if (strcasecmp(strval, "TopLeft")==0)
95 m_value = Slit::TOPLEFT;
96 else if (strcasecmp(strval, "LeftCenter")==0)
97 m_value = Slit::LEFTCENTER;
98 else if (strcasecmp(strval, "BottomLeft")==0)
99 m_value = Slit::BOTTOMLEFT;
100 else if (strcasecmp(strval, "TopCenter")==0)
101 m_value = Slit::TOPCENTER;
102 else if (strcasecmp(strval, "BottomCenter")==0)
103 m_value = Slit::BOTTOMCENTER;
104 else if (strcasecmp(strval, "TopRight")==0)
105 m_value = Slit::TOPRIGHT;
106 else if (strcasecmp(strval, "RightCenter")==0)
107 m_value = Slit::RIGHTCENTER;
108 else if (strcasecmp(strval, "BottomRight")==0)
109 m_value = Slit::BOTTOMRIGHT;
110 else if (strcasecmp(strval, "LeftTop")==0)
111 m_value = Slit::LEFTTOP;
112 else if (strcasecmp(strval, "LeftBottom")==0)
113 m_value = Slit::LEFTBOTTOM;
114 else if (strcasecmp(strval, "RightTop")==0)
115 m_value = Slit::RIGHTTOP;
116 else if (strcasecmp(strval, "RightBottom")==0)
117 m_value = Slit::RIGHTBOTTOM;
118 else
119 setDefaultValue();
120}
121
122template<>
123string FbTk::Resource<Slit::Placement>::getString() const { 93string FbTk::Resource<Slit::Placement>::getString() const {
124 switch (m_value) { 94 switch (m_value) {
125 case Slit::TOPLEFT: 95 case Slit::TOPLEFT:
@@ -163,6 +133,36 @@ string FbTk::Resource<Slit::Placement>::getString() const {
163 return string("RightBottom"); 133 return string("RightBottom");
164} 134}
165 135
136template<>
137void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
138 if (strcasecmp(strval, "TopLeft")==0)
139 m_value = Slit::TOPLEFT;
140 else if (strcasecmp(strval, "LeftCenter")==0)
141 m_value = Slit::LEFTCENTER;
142 else if (strcasecmp(strval, "BottomLeft")==0)
143 m_value = Slit::BOTTOMLEFT;
144 else if (strcasecmp(strval, "TopCenter")==0)
145 m_value = Slit::TOPCENTER;
146 else if (strcasecmp(strval, "BottomCenter")==0)
147 m_value = Slit::BOTTOMCENTER;
148 else if (strcasecmp(strval, "TopRight")==0)
149 m_value = Slit::TOPRIGHT;
150 else if (strcasecmp(strval, "RightCenter")==0)
151 m_value = Slit::RIGHTCENTER;
152 else if (strcasecmp(strval, "BottomRight")==0)
153 m_value = Slit::BOTTOMRIGHT;
154 else if (strcasecmp(strval, "LeftTop")==0)
155 m_value = Slit::LEFTTOP;
156 else if (strcasecmp(strval, "LeftBottom")==0)
157 m_value = Slit::LEFTBOTTOM;
158 else if (strcasecmp(strval, "RightTop")==0)
159 m_value = Slit::RIGHTTOP;
160 else if (strcasecmp(strval, "RightBottom")==0)
161 m_value = Slit::RIGHTBOTTOM;
162 else
163 setDefaultValue();
164}
165
166} // end namespace FbTk 166} // end namespace FbTk
167namespace { 167namespace {
168 168
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index e64d74e..4ed765a 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -80,37 +80,6 @@ using std::list;
80namespace FbTk { 80namespace FbTk {
81 81
82template<> 82template<>
83void FbTk::Resource<Toolbar::Placement>::
84setFromString(const char *strval) {
85 if (strcasecmp(strval, "TopLeft")==0)
86 m_value = Toolbar::TOPLEFT;
87 else if (strcasecmp(strval, "BottomLeft")==0)
88 m_value = Toolbar::BOTTOMLEFT;
89 else if (strcasecmp(strval, "TopCenter")==0)
90 m_value = Toolbar::TOPCENTER;
91 else if (strcasecmp(strval, "BottomCenter")==0)
92 m_value = Toolbar::BOTTOMCENTER;
93 else if (strcasecmp(strval, "TopRight")==0)
94 m_value = Toolbar::TOPRIGHT;
95 else if (strcasecmp(strval, "BottomRight")==0)
96 m_value = Toolbar::BOTTOMRIGHT;
97 else if (strcasecmp(strval, "LeftTop") == 0)
98 m_value = Toolbar::LEFTTOP;
99 else if (strcasecmp(strval, "LeftCenter") == 0)
100 m_value = Toolbar::LEFTCENTER;
101 else if (strcasecmp(strval, "LeftBottom") == 0)
102 m_value = Toolbar::LEFTBOTTOM;
103 else if (strcasecmp(strval, "RightTop") == 0)
104 m_value = Toolbar::RIGHTTOP;
105 else if (strcasecmp(strval, "RightCenter") == 0)
106 m_value = Toolbar::RIGHTCENTER;
107 else if (strcasecmp(strval, "RightBottom") == 0)
108 m_value = Toolbar::RIGHTBOTTOM;
109 else
110 setDefaultValue();
111}
112
113template<>
114string FbTk::Resource<Toolbar::Placement>:: 83string FbTk::Resource<Toolbar::Placement>::
115getString() const { 84getString() const {
116 switch (m_value) { 85 switch (m_value) {
@@ -154,6 +123,38 @@ getString() const {
154 //default string 123 //default string
155 return string("BottomCenter"); 124 return string("BottomCenter");
156} 125}
126
127template<>
128void FbTk::Resource<Toolbar::Placement>::
129setFromString(const char *strval) {
130 if (strcasecmp(strval, "TopLeft")==0)
131 m_value = Toolbar::TOPLEFT;
132 else if (strcasecmp(strval, "BottomLeft")==0)
133 m_value = Toolbar::BOTTOMLEFT;
134 else if (strcasecmp(strval, "TopCenter")==0)
135 m_value = Toolbar::TOPCENTER;
136 else if (strcasecmp(strval, "BottomCenter")==0)
137 m_value = Toolbar::BOTTOMCENTER;
138 else if (strcasecmp(strval, "TopRight")==0)
139 m_value = Toolbar::TOPRIGHT;
140 else if (strcasecmp(strval, "BottomRight")==0)
141 m_value = Toolbar::BOTTOMRIGHT;
142 else if (strcasecmp(strval, "LeftTop") == 0)
143 m_value = Toolbar::LEFTTOP;
144 else if (strcasecmp(strval, "LeftCenter") == 0)
145 m_value = Toolbar::LEFTCENTER;
146 else if (strcasecmp(strval, "LeftBottom") == 0)
147 m_value = Toolbar::LEFTBOTTOM;
148 else if (strcasecmp(strval, "RightTop") == 0)
149 m_value = Toolbar::RIGHTTOP;
150 else if (strcasecmp(strval, "RightCenter") == 0)
151 m_value = Toolbar::RIGHTCENTER;
152 else if (strcasecmp(strval, "RightBottom") == 0)
153 m_value = Toolbar::RIGHTBOTTOM;
154 else
155 setDefaultValue();
156}
157
157} // end namespace FbTk 158} // end namespace FbTk
158 159
159namespace { 160namespace {