From 9f59ce18a21c8544d996235787ff1d7a6557153d Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sun, 28 Jun 2009 10:54:55 -0700 Subject: change default toolbar tools to: prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock --- src/FbTk/StringUtil.cc | 2 +- src/ToolFactory.cc | 32 ++++++-------------------------- src/Toolbar.cc | 2 +- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 7c8f91c..18e000e 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc @@ -63,7 +63,7 @@ namespace StringUtil { /** Tries to find a string in another and ignoring the case of the characters - Returns 0 on success else pointer to str. + Returns 0 on failure else pointer to str. */ const char *strcasestr(const char *str, const char *ptn) { const char *s2, *p2; diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc index c5cb895..be83616 100644 --- a/src/ToolFactory.cc +++ b/src/ToolFactory.cc @@ -101,36 +101,17 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & item = new SystemTray(parent, dynamic_cast(*m_systray_theme), screen()); } else if (name == "clock") { item = new ClockTool(parent, m_clock_theme, screen(), tbar.menu()); - } else if (name == "nextworkspace" || - name == "prevworkspace") { - - FbTk::RefCount > cmd(FbTk::CommandParser::instance().parse(name)); - if (*cmd == 0) // we need a command - return 0; - - // TODO maybe direction of arrows should depend on toolbar layout ? - FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT; - if (name == "nextworkspace") - arrow_type = FbTk::FbDrawable::RIGHT; - - ArrowButton *win = new ArrowButton(arrow_type, parent, - 0, 0, - button_size, button_size); - win->setOnClick(cmd); - item = new ButtonTool(win, ToolbarItem::SQUARE, - dynamic_cast(*m_button_theme), - screen().imageControl()); - } else { - FbTk::RefCount > cmd(FbTk::CommandParser::instance().parse(name)); if (*cmd == 0) // we need a command return 0; - FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::LEFT; - if (name == "nextwindow") - arrow_type = FbTk::FbDrawable::RIGHT; - + // TODO maybe direction of arrows should depend on toolbar layout ? + FbTk::FbDrawable::TriangleType arrow_type = FbTk::FbDrawable::RIGHT; + const char *tmp = name.c_str(); + if (FbTk::StringUtil::strcasestr(tmp, "prev")) + arrow_type = FbTk::FbDrawable::LEFT; + ArrowButton *win = new ArrowButton(arrow_type, parent, 0, 0, button_size, button_size); @@ -138,7 +119,6 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & item = new ButtonTool(win, ToolbarItem::SQUARE, dynamic_cast(*m_button_theme), screen().imageControl()); - } if (item) diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 63157b3..2552de9 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -243,7 +243,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"), - m_rc_tools(scrn.resourceManager(), "workspacename, prevworkspace, nextworkspace, iconbar, systemtray, prevwindow, nextwindow, clock", + m_rc_tools(scrn.resourceManager(), "prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock", scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"), m_shape(new FbTk::Shape(frame.window, 0)), m_resize_lock(false) { -- cgit v0.11.2