summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-05 21:29:13 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-05 21:29:13 +0000
commitcb5a80c169e10adf6d6b9392bba7c9946edf087d (patch)
tree321f9be819b01406dbbd6cf31cb7ddbb2244b3c1 /src/gui/chat.cpp
parent7c7c50bf115299cd3a160b0eb9abfa8d7fdb2fd5 (diff)
downloadmana-client-cb5a80c169e10adf6d6b9392bba7c9946edf087d.tar.gz
mana-client-cb5a80c169e10adf6d6b9392bba7c9946edf087d.tar.bz2
mana-client-cb5a80c169e10adf6d6b9392bba7c9946edf087d.tar.xz
mana-client-cb5a80c169e10adf6d6b9392bba7c9946edf087d.zip
Implemented wrapping for textbox (still could use a small fix) and made death
notice dialog release modal focus immediately.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp74
1 files changed, 6 insertions, 68 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 84a12585..a0b027ae 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -41,6 +41,8 @@ ChatWindow::ChatWindow(const std::string &logfile):
chatInput = new ChatInput();
textOutput->setEditable(false);
scrollArea = new ScrollArea(textOutput);
+ scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ scrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
scrollArea->setDimension(gcn::Rectangle(
2, 0, 596, 98 - chatInput->getHeight() - 5));
scrollArea->setOpaque(false);
@@ -101,42 +103,10 @@ void ChatWindow::chat_log(std::string line, int own)
line = tmp.nick + line;
- // A try to get text sentences no too long...
- bool finished = false;
- unsigned int maxLength = 97;
-
- while (!finished)
- {
- std::string tempText = line;
-
- if (line.length() > maxLength)
- {
- if (line.length() > maxLength) {
- line = cutString(tempText, maxLength);
- }
-
- //tmp.text = tempText;
-
- //chatlog_file << tmp.nick << tmp.text << "\n";
- //chatlog_file.flush();
-
- //chatlog.push_front(tmp);
- }
- else // Normal message
- {
- //tmp.text = line;
- //chatlog_file << tmp.nick << tmp.text << "\n";
- //chatlog_file.flush();
-
- //chatlog.push_front(tmp);
- finished = true;
- }
-
- textOutput->setText(
- textOutput->getText() + std::string("\n") + tempText);
- scrollArea->setVerticalScrollAmount(
- scrollArea->getVerticalMaxScroll());
- }
+ textOutput->setText(
+ textOutput->getText() + std::string("\n") + line);
+ scrollArea->setVerticalScrollAmount(
+ scrollArea->getVerticalMaxScroll());
}
void ChatWindow::chat_log(CHATSKILL action)
@@ -356,38 +326,6 @@ std::string ChatWindow::const_msg(CHATSKILL action)
return msg;
}
-std::string ChatWindow::cutString(std::string& value, unsigned int maximumLength)
-{
- // If the string exceeds the maximum length
- if (value.length() > maximumLength)
- {
- unsigned int index = 0;
- unsigned int lastSpace = 0;
- std::string cutOff = "";
-
- for (index = 0; index < maximumLength; index++) {
- if (value.at(index) == ' ') {
- lastSpace = index;
- }
- }
-
- // If the last space is at the beginning of the string
- if (lastSpace == 0) {
- // Just cut it right off from the end
- cutOff = value.substr(maximumLength);
- value = value.substr(0, maximumLength);
- } else {
- // Cut it off from the last space forward
- cutOff = value.substr(lastSpace + 1);
- value = value.substr(0, lastSpace);
- }
-
- return cutOff;
- }
-
- return std::string("");
-}
-
void ChatWindow::keyPress(const gcn::Key &key)
{
if (key.getValue() == key.DOWN && curHist != history.end())