Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/scrollpane.cc')
-rw-r--r--src/ui/scrollpane.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ui/scrollpane.cc b/src/ui/scrollpane.cc
index 20325d8..463956d 100644
--- a/src/ui/scrollpane.cc
+++ b/src/ui/scrollpane.cc
@@ -22,7 +22,7 @@ ScrollPane::ScrollPane(Widget *parent, ui::Text &text) : Widget(parent), scrollp
ScrollPane::~ScrollPane()
{
}
-
+
void ScrollPane::set_alignment(const unsigned int alignment)
{
scrollpane_alignment = alignment;
@@ -68,7 +68,7 @@ void ScrollPane::draw()
scrollpane_scroll = (int) scrollpane_text.size();
else if (scrollpane_scroll < 0)
scrollpane_scroll = 0;
-
+
int bottom = (int) scrollpane_text.size() - scrollpane_scroll;
int current_line = 0;
@@ -100,8 +100,8 @@ void ScrollPane::draw()
}
// new word, wrap if necessary
- else if ((*c == '\n' ) || ( *c == ' ')) {
-
+ else if ((*c == '\n') || (*c == ' ')) {
+
if (line_length + word_length > (size_t) text_width) {
if (line.size()) {
lines.push_back(line);
@@ -111,33 +111,33 @@ void ScrollPane::draw()
line_length = 0;
}
}
-
+
line.append(word);
line_length += word_length;
word.clear();
word_length = 0;
wordpen = pen;
-
+
// new line
- if (*c == '\n' ) {
+ if (*c == '\n') {
lines.push_back(line);
line.clear();
line_length = 0;
pen = 'N';
wordpen = 'N';
- // new word
- } else if (*c == ' ' ) {
+ // new word
+ } else if (*c == ' ') {
line += ' ';
line_length++;
}
}
// new character
- else {
+ else {
word += *c;
word_length++;
-
+
if (word_length == (size_t) text_width) {
if (line.size()) {
lines.push_back(line);
@@ -158,15 +158,15 @@ void ScrollPane::draw()
c++;
}
-
+
}
- current_line++;
+ current_line++;
}
gl::color(palette()->text());
const math ::Vector2f gl(global_location());
float y = 0;
-
+
if ((alignment() & AlignTop) == AlignTop) {
int i = (int) lines.size();
for (ui::Text::iterator it = lines.begin(); it != lines.end(); it++) {