aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc197
1 files changed, 23 insertions, 174 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 2e71dcf..3d26810 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.187 2003/06/20 01:48:06 fluxgen Exp $ 25// $Id: Screen.cc,v 1.188 2003/06/23 13:10:52 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -175,38 +175,6 @@ private:
175 175
176 176
177template<> 177template<>
178void FbTk::Resource<Toolbar::Placement>::
179setFromString(const char *strval) {
180 if (strcasecmp(strval, "TopLeft")==0)
181 m_value = Toolbar::TOPLEFT;
182 else if (strcasecmp(strval, "BottomLeft")==0)
183 m_value = Toolbar::BOTTOMLEFT;
184 else if (strcasecmp(strval, "TopCenter")==0)
185 m_value = Toolbar::TOPCENTER;
186 else if (strcasecmp(strval, "BottomCenter")==0)
187 m_value = Toolbar::BOTTOMCENTER;
188 else if (strcasecmp(strval, "TopRight")==0)
189 m_value = Toolbar::TOPRIGHT;
190 else if (strcasecmp(strval, "BottomRight")==0)
191 m_value = Toolbar::BOTTOMRIGHT;
192 else if (strcasecmp(strval, "LeftTop") == 0)
193 m_value = Toolbar::LEFTTOP;
194 else if (strcasecmp(strval, "LeftCenter") == 0)
195 m_value = Toolbar::LEFTCENTER;
196 else if (strcasecmp(strval, "LeftBottom") == 0)
197 m_value = Toolbar::LEFTBOTTOM;
198 else if (strcasecmp(strval, "RightTop") == 0)
199 m_value = Toolbar::RIGHTTOP;
200 else if (strcasecmp(strval, "RightCenter") == 0)
201 m_value = Toolbar::RIGHTCENTER;
202 else if (strcasecmp(strval, "RightBottom") == 0)
203 m_value = Toolbar::RIGHTBOTTOM;
204 else
205 setDefaultValue();
206}
207
208
209template<>
210void FbTk::Resource<ToolbarHandler::ToolbarMode>:: 178void FbTk::Resource<ToolbarHandler::ToolbarMode>::
211setFromString(const char *strval) { 179setFromString(const char *strval) {
212 if (strcasecmp(strval, "Off") == 0) 180 if (strcasecmp(strval, "Off") == 0)
@@ -226,52 +194,6 @@ setFromString(const char *strval) {
226} 194}
227 195
228 196
229string FbTk::Resource<Toolbar::Placement>::
230getString() {
231 switch (m_value) {
232 case Toolbar::TOPLEFT:
233 return string("TopLeft");
234 break;
235 case Toolbar::BOTTOMLEFT:
236 return string("BottomLeft");
237 break;
238 case Toolbar::TOPCENTER:
239 return string("TopCenter");
240 break;
241 case Toolbar::BOTTOMCENTER:
242 return string("BottomCenter");
243 break;
244 case Toolbar::TOPRIGHT:
245 return string("TopRight");
246 break;
247 case Toolbar::BOTTOMRIGHT:
248 return string("BottomRight");
249 break;
250 case Toolbar::LEFTTOP:
251 return string("LeftTop");
252 break;
253 case Toolbar::LEFTCENTER:
254 return string("LeftCenter");
255 break;
256 case Toolbar::LEFTBOTTOM:
257 return string("LeftBottom");
258 break;
259 case Toolbar::RIGHTTOP:
260 return string("RightTop");
261 break;
262 case Toolbar::RIGHTCENTER:
263 return string("RightCenter");
264 break;
265 case Toolbar::RIGHTBOTTOM:
266 return string("RightBottom");
267 break;
268 }
269 //default string
270 return string("BottomCenter");
271}
272
273
274
275template<> 197template<>
276string FbTk::Resource<ToolbarHandler::ToolbarMode>:: 198string FbTk::Resource<ToolbarHandler::ToolbarMode>::
277getString() { 199getString() {
@@ -351,84 +273,6 @@ void setupWorkspacemenu(BScreen &scr, FbTk::Menu &menu) {
351}; 273};
352 274
353 275
354template<>
355void FbTk::Resource<Slit::Placement>::setFromString(const char *strval) {
356 if (strcasecmp(strval, "TopLeft")==0)
357 m_value = Slit::TOPLEFT;
358 else if (strcasecmp(strval, "CenterLeft")==0)
359 m_value = Slit::CENTERLEFT;
360 else if (strcasecmp(strval, "BottomLeft")==0)
361 m_value = Slit::BOTTOMLEFT;
362 else if (strcasecmp(strval, "TopCenter")==0)
363 m_value = Slit::TOPCENTER;
364 else if (strcasecmp(strval, "BottomCenter")==0)
365 m_value = Slit::BOTTOMCENTER;
366 else if (strcasecmp(strval, "TopRight")==0)
367 m_value = Slit::TOPRIGHT;
368 else if (strcasecmp(strval, "CenterRight")==0)
369 m_value = Slit::CENTERRIGHT;
370 else if (strcasecmp(strval, "BottomRight")==0)
371 m_value = Slit::BOTTOMRIGHT;
372 else
373 setDefaultValue();
374}
375
376template<>
377void FbTk::Resource<Slit::Direction>::setFromString(const char *strval) {
378 if (strcasecmp(strval, "Vertical") == 0)
379 m_value = Slit::VERTICAL;
380 else if (strcasecmp(strval, "Horizontal") == 0)
381 m_value = Slit::HORIZONTAL;
382 else
383 setDefaultValue();
384}
385
386string FbTk::Resource<Slit::Placement>::getString() {
387 switch (m_value) {
388 case Slit::TOPLEFT:
389 return string("TopLeft");
390 break;
391 case Slit::CENTERLEFT:
392 return string("CenterLeft");
393 break;
394 case Slit::BOTTOMLEFT:
395 return string("BottomLeft");
396 break;
397 case Slit::TOPCENTER:
398 return string("TopCenter");
399 break;
400 case Slit::BOTTOMCENTER:
401 return string("BottomCenter");
402 break;
403 case Slit::TOPRIGHT:
404 return string("TopRight");
405 break;
406 case Slit::CENTERRIGHT:
407 return string("CenterRight");
408 break;
409 case Slit::BOTTOMRIGHT:
410 return string("BottomRight");
411 break;
412 }
413 //default string
414 return string("BottomRight");
415}
416
417template<>
418string FbTk::Resource<Slit::Direction>::getString() {
419 switch (m_value) {
420 case Slit::VERTICAL:
421 return string("Vertical");
422 break;
423 case Slit::HORIZONTAL:
424 return string("Horizontal");
425 break;
426 }
427 // default string
428 return string("Vertical");
429}
430
431
432template <> 276template <>
433void FbTk::ThemeItem<std::string>::load() { } 277void FbTk::ThemeItem<std::string>::load() { }
434 278
@@ -460,7 +304,7 @@ void FbTk::ThemeItem<int>::setFromString(const char *str) {
460BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, 304BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
461 const std::string &scrname, 305 const std::string &scrname,
462 const std::string &altscrname): 306 const std::string &altscrname):
463 toolbar_auto_hide(rm, false, scrname+".toolbar.autoHide", altscrname+".Toolbar.AutoHide"), 307
464 image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"), 308 image_dither(rm, false, scrname+".imageDither", altscrname+".ImageDither"),
465 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"), 309 opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"),
466 full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"), 310 full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
@@ -477,17 +321,9 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
477 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), 321 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
478 focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"), 322 focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"),
479 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), 323 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"),
480 toolbar_width_percent(rm, 65,
481 scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
482 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), 324 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
483 menu_alpha(rm, 255, scrname+".menuAlpha", altscrname+".MenuAlpha"), 325 menu_alpha(rm, 255, scrname+".menuAlpha", altscrname+".MenuAlpha"),
484 326 toolbar_mode(rm, ToolbarHandler::ICONS, scrname+".toolbar.mode", altscrname+".Toolbar.Mode") {
485 toolbar_layernum(rm, Fluxbox::Layer(Fluxbox::instance()->getDesktopLayer()),
486 scrname+".toolbar.layer", altscrname+".Toolbar.Layer"),
487 toolbar_mode(rm, ToolbarHandler::ICONS, scrname+".toolbar.mode", altscrname+".Toolbar.Mode"),
488 toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"),
489 toolbar_placement(rm, Toolbar::BOTTOMCENTER,
490 scrname+".toolbar.placement", altscrname+".Toolbar.Placement") {
491 327
492}; 328};
493 329
@@ -902,10 +738,8 @@ void BScreen::reconfigure() {
902 } 738 }
903 } 739 }
904 740
905 if (toolbar()) { 741 if (toolbar())
906 toolbar()->setPlacement(*resource.toolbar_placement);
907 toolbar()->reconfigure(); 742 toolbar()->reconfigure();
908 }
909 743
910#ifdef SLIT 744#ifdef SLIT
911 if (slit()) 745 if (slit())
@@ -1099,8 +933,6 @@ void BScreen::changeWorkspaceID(unsigned int id) {
1099 m_current_workspace = getWorkspace(id); 933 m_current_workspace = getWorkspace(id);
1100 934
1101 workspacemenu->setItemSelected(currentWorkspace()->workspaceID() + 2, true); 935 workspacemenu->setItemSelected(currentWorkspace()->workspaceID() + 2, true);
1102 if (toolbar() != 0)
1103 toolbar()->redrawWorkspaceLabel(true);
1104 936
1105 currentWorkspace()->showAll(); 937 currentWorkspace()->showAll();
1106 938
@@ -2680,14 +2512,31 @@ int BScreen::getHeadHeight(int head) const {
2680#endif // XINERAMA 2512#endif // XINERAMA
2681} 2513}
2682 2514
2515// TODO: when toolbar gets its resources moved into Toolbar.hh/cc, then
2516// this can be gone and a consistent interface for the two used
2517// on the actual objects
2518
2519
2520template <>
2521int BScreen::getOnHead<Slit>(Slit &slit) {
2522 return 0;
2523}
2524
2525template <>
2526void BScreen::setOnHead<Slit>(Slit &slit, int head) {
2527 // slit.saveOnHead(head);
2528 slit.reconfigure();
2529}
2530
2683template <> 2531template <>
2684int BScreen::getOnHead<Toolbar>(Toolbar &tbar) { 2532int BScreen::getOnHead<Toolbar>(Toolbar &tbar) {
2685 return getToolbarOnHead(); 2533 return 0;
2534 // return tbar.getOnHead();
2686} 2535}
2687 2536
2688template <> 2537template <>
2689void BScreen::setOnHead<Toolbar>(Toolbar &tbar, int head) { 2538void BScreen::setOnHead<Toolbar>(Toolbar &tbar, int head) {
2690 saveToolbarOnHead(head); 2539 // saveToolbarOnHead(head);
2691 tbar.reconfigure(); 2540 tbar.reconfigure();
2692} 2541}
2693 2542