diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-05 08:49:05 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-05 08:49:05 (GMT) |
commit | 8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c (patch) | |
tree | f6a2ba871afcf5dd16ca9ea2754938cc66c1310a | |
parent | 83656fc0e817c2a00a315176e651881cdfc804eb (diff) | |
download | fluxbox-8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c.zip fluxbox-8feb0b8c83559e44bc6b2fc418c9cf7b6b46a03c.tar.bz2 |
avoid constructing new strings implicit
-rw-r--r-- | src/ClockTool.cc | 2 | ||||
-rw-r--r-- | src/FbTk/MenuItem.cc | 6 | ||||
-rw-r--r-- | src/FbTk/TextBox.cc | 2 | ||||
-rw-r--r-- | src/FbTk/TextButton.cc | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index c2d029f..1e4dd58 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -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.c_str(), text.size()); | 258 | new_width = m_theme->font().textWidth(text, 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); |
diff --git a/src/FbTk/MenuItem.cc b/src/FbTk/MenuItem.cc index dcd7dd7..f995666 100644 --- a/src/FbTk/MenuItem.cc +++ b/src/FbTk/MenuItem.cc | |||
@@ -54,12 +54,12 @@ void MenuItem::drawLine(FbDrawable &draw, | |||
54 | int bottom = height - bevelW - 1; | 54 | int bottom = height - bevelW - 1; |
55 | 55 | ||
56 | text_y += bottom > underline_height ? underline_height : bottom; | 56 | text_y += bottom > underline_height ? underline_height : bottom; |
57 | int text_w = theme->frameFont().textWidth(m_label.c_str(), m_label.size()); | 57 | int text_w = theme->frameFont().textWidth(m_label, m_label.size()); |
58 | 58 | ||
59 | // width of the searchstring | 59 | // width of the searchstring |
60 | size = size > m_label.length() ? m_label.length() : size; | 60 | size = size > m_label.length() ? m_label.length() : size; |
61 | std::string search_string = m_label.substr(0,size); | 61 | std::string search_string = m_label.substr(0,size); |
62 | int search_string_w = theme->frameFont().textWidth(search_string.c_str(), size); | 62 | int search_string_w = theme->frameFont().textWidth(search_string, size); |
63 | 63 | ||
64 | // pay attention to the text justification | 64 | // pay attention to the text justification |
65 | switch(theme->frameFontJustify()) { | 65 | switch(theme->frameFontJustify()) { |
@@ -157,7 +157,7 @@ void MenuItem::draw(FbDrawable &draw, | |||
157 | // | 157 | // |
158 | int text_y = y, text_x = x; | 158 | int text_y = y, text_x = x; |
159 | 159 | ||
160 | int text_w = theme->frameFont().textWidth(label().c_str(), label().size()); | 160 | int text_w = theme->frameFont().textWidth(label(), label().size()); |
161 | 161 | ||
162 | int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth()); | 162 | int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth()); |
163 | text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2; | 163 | text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2; |
diff --git a/src/FbTk/TextBox.cc b/src/FbTk/TextBox.cc index 87ad609..87e18e8 100644 --- a/src/FbTk/TextBox.cc +++ b/src/FbTk/TextBox.cc | |||
@@ -369,7 +369,7 @@ void TextBox::adjustEndPos() { | |||
369 | 369 | ||
370 | void TextBox::adjustStartPos() { | 370 | void TextBox::adjustStartPos() { |
371 | 371 | ||
372 | int text_width = font().textWidth(text().c_str(), m_end_pos); | 372 | int text_width = font().textWidth(text(), m_end_pos); |
373 | if (text_width < static_cast<signed>(width())) | 373 | if (text_width < static_cast<signed>(width())) |
374 | return; | 374 | return; |
375 | 375 | ||
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 380537e..04aa367 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc | |||
@@ -126,7 +126,7 @@ void TextButton::clearArea(int x, int y, | |||
126 | 126 | ||
127 | 127 | ||
128 | unsigned int TextButton::textWidth() const { | 128 | unsigned int TextButton::textWidth() const { |
129 | return font().textWidth(text().data(), text().size()); | 129 | return font().textWidth(text(), text().size()); |
130 | } | 130 | } |
131 | 131 | ||
132 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { | 132 | void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { |
@@ -161,7 +161,7 @@ void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) { | |||
161 | font().drawText(*drawable, | 161 | font().drawText(*drawable, |
162 | screenNumber(), | 162 | screenNumber(), |
163 | gc(), // graphic context | 163 | gc(), // graphic context |
164 | text().data(), textlen, // string and string size | 164 | text(), textlen, // string and string size |
165 | textx, texty, m_orientation); // position | 165 | textx, texty, m_orientation); // position |
166 | } | 166 | } |
167 | 167 | ||