summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 5ff9ed46..94a554e8 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,14 +51,14 @@
ChatWindow::ChatWindow(Network * network):
Window(""), mNetwork(network), mTmpVisible(false)
{
- setWindowName(_("Chat"));
+ setWindowName("Chat");
setResizable(true);
setDefaultSize(600, 123, ImageRect::LOWER_LEFT);
setMinWidth(150);
setMinHeight(90);
- mItemLinkHandler = new ItemLinkHandler();
+ mItemLinkHandler = new ItemLinkHandler;
mChatInput = new ChatInput;
mChatInput->setActionEventId("chatinput");
@@ -163,13 +162,15 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
case BY_GM:
if (tmp.nick.empty())
{
- tmp.nick = std::string(_("Global announcement: "));
+ tmp.nick = std::string(_("Global announcement:"));
+ tmp.nick += " ";
lineColor = "##G";
}
else
{
- tmp.nick = strprintf(_("Global announcement from %s: "),
+ tmp.nick = strprintf(_("Global announcement from %s:"),
tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##1"; // Equiv. to BrowserBox::RED
}
break;
@@ -192,7 +193,8 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
lineColor = "##P";
break;
case ACT_WHISPER:
- tmp.nick += CAT_WHISPER;
+ tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##W";
break;
case ACT_IS:
@@ -290,7 +292,7 @@ void ChatWindow::chatLog(CHATSKILL act)
chatLog(const_msg(act), BY_SERVER);
}
-void ChatWindow::action(const gcn::ActionEvent & event)
+void ChatWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "chatinput")
{
@@ -326,7 +328,7 @@ void ChatWindow::action(const gcn::ActionEvent & event)
}
}
-void ChatWindow::requestChatFocus()
+bool ChatWindow::requestChatFocus()
{
// Make sure chatWindow is visible
if (!isVisible())
@@ -341,9 +343,14 @@ void ChatWindow::requestChatFocus()
mTmpVisible = true;
}
+ // Don't do anything else if the input is already visible and has focus
+ if (mChatInput->isVisible() && mChatInput->isFocused())
+ return false;
+
// Give focus to the chat input
mChatInput->setVisible(true);
mChatInput->requestFocus();
+ return true;
}
bool ChatWindow::isInputFocused()
@@ -685,7 +692,7 @@ std::string ChatWindow::const_msg(CHATSKILL act)
msg += _("You cannot do that right now!");
break;
case RFAIL_ZENY:
- msg += _("Seems you need more GP... ;-)");
+ msg += _("Seems you need more money... ;-)");
break;
case RFAIL_WEAPON:
msg += _("You cannot use this skill with that kind of weapon!");
@@ -735,9 +742,8 @@ void ChatWindow::scroll(int amount)
mTextOutput->showPart(scr);
}
-void ChatWindow::keyPressed(gcn::KeyEvent & event)
+void ChatWindow::keyPressed(gcn::KeyEvent &event)
{
-
if (event.getKey().getValue() == Key::DOWN &&
mCurHist != mHistory.end())
{