diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
commit | 690d926ac444243611cd875fb84fabb4e6db2cf2 (patch) | |
tree | c8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/ClockTool.cc | |
parent | 1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff) | |
download | fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.zip fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.tar.bz2 |
introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered
version of the content of a string. this helps to reduce the number of
calls to reorder the string before drawing it (as introduced in the patch
from Ken Bloom) and to be more consistent in menus and textboxes (drawing
cursors and underlining text).
Diffstat (limited to 'src/ClockTool.cc')
-rw-r--r-- | src/ClockTool.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 1e4dd58..f6a9797 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -93,7 +93,7 @@ timeval calcNextTimeout(const std::string& fmt_string) { | |||
93 | class ClockMenuItem: public FbTk::MenuItem { | 93 | class ClockMenuItem: public FbTk::MenuItem { |
94 | public: | 94 | public: |
95 | explicit ClockMenuItem(ClockTool &tool): | 95 | explicit ClockMenuItem(ClockTool &tool): |
96 | FbTk::MenuItem(""), m_tool(tool) { | 96 | FbTk::MenuItem(FbTk::BiDiString("")), m_tool(tool) { |
97 | 97 | ||
98 | setClockModeLabel(); | 98 | setClockModeLabel(); |
99 | setCloseOnClick(false); | 99 | setCloseOnClick(false); |
@@ -160,7 +160,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, | |||
160 | FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen, | 160 | FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen, |
161 | FbTk::Menu &menu): | 161 | FbTk::Menu &menu): |
162 | ToolbarItem(ToolbarItem::FIXED), | 162 | ToolbarItem(ToolbarItem::FIXED), |
163 | m_button(parent, theme->font(), ""), | 163 | m_button(parent, theme->font(), FbTk::BiDiString("")), |
164 | m_theme(theme), | 164 | m_theme(theme), |
165 | m_screen(screen), | 165 | m_screen(screen), |
166 | m_pixmap(0), | 166 | m_pixmap(0), |
@@ -243,7 +243,7 @@ void ClockTool::update(FbTk::Subject *subj) { | |||
243 | // we only replace numbers with zeros because everything else should be | 243 | // we only replace numbers with zeros because everything else should be |
244 | // relatively static. If we replace all text with zeros then widths of | 244 | // relatively static. If we replace all text with zeros then widths of |
245 | // proportional fonts with some strftime formats will be considerably off. | 245 | // proportional fonts with some strftime formats will be considerably off. |
246 | std::string text(m_button.text()); | 246 | FbTk::FbString text(m_button.text().logical()); |
247 | 247 | ||
248 | int textlen = text.size(); | 248 | int textlen = text.size(); |
249 | for (int i=0; i < textlen; ++i) { | 249 | for (int i=0; i < textlen; ++i) { |
@@ -255,7 +255,7 @@ void ClockTool::update(FbTk::Subject *subj) { | |||
255 | unsigned int new_width = m_button.width(); | 255 | unsigned int new_width = m_button.width(); |
256 | unsigned int new_height = m_button.height(); | 256 | unsigned int new_height = m_button.height(); |
257 | translateSize(orientation(), new_width, new_height); | 257 | translateSize(orientation(), new_width, new_height); |
258 | new_width = m_theme->font().textWidth(text, text.size()); | 258 | new_width = m_theme->font().textWidth(text.c_str(), text.size()); |
259 | translateSize(orientation(), new_width, new_height); | 259 | translateSize(orientation(), new_width, new_height); |
260 | if (new_width != m_button.width() || new_height != m_button.height()) { | 260 | if (new_width != m_button.width() || new_height != m_button.height()) { |
261 | resize(new_width, new_height); | 261 | resize(new_width, new_height); |
@@ -296,7 +296,7 @@ void ClockTool::updateTime() { | |||
296 | if( time_string_len == 0) | 296 | if( time_string_len == 0) |
297 | return; | 297 | return; |
298 | std::string text = m_stringconvertor.recode(time_string); | 298 | std::string text = m_stringconvertor.recode(time_string); |
299 | if (m_button.text() == text) | 299 | if (m_button.text().logical() == text) |
300 | return; | 300 | return; |
301 | 301 | ||
302 | m_button.setText(text); | 302 | m_button.setText(text); |