void actionPart ()
	{
		// If the line starts with '/tell ', do not try to expand
		static const ucstring TELL_STR("/tell ");
		if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR)
		{
			if (_GroupEdit->expand()) return;
		}
		CInterfaceManager *im = CInterfaceManager::getInstance();
		if (!im->isInGame()) return;
		// there was no / at the start of the line so try to cycle through the last people on which a tell was done
		const ucstring *lastTellPeople = ChatMngr.cycleLastTell();
		if (!lastTellPeople) return;
		// Get chat box from ist edit box
		// If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window
		CChatWindow *cw = getChatWndMgr().getChatWindowFromCaller(_GroupEdit);
		if (!cw) return;
		CFilteredChat *fc = PeopleInterraction.getFilteredChatFromChatWindow(cw);
		if (fc)
		{
			fc->Filter.setTargetPlayer(*lastTellPeople);
		}
		else
		{
			// it is not a filtered chat, display 'tell' (must be ingame)
			_GroupEdit->setCommand(ucstring("tell ") + *lastTellPeople + (ucchar) ' ', false);
		}
	}
/** skip a block of character in a string, (same behaviour than when Ctrl-arrow is pressed)
  * It returns the new index
  */
static uint skipUCCharsRight(uint startPos, const ucstring &str)
{
	uint pos = startPos;
	uint endIndex = (uint)str.length();
	uint ccat = getCharacterCategory(str[pos]);
	// skip characters of the same category
	while (pos != endIndex && getCharacterCategory(str[pos]) == ccat) ++pos;
	// skip spaces
	while (pos != endIndex && str[pos] == ' ') ++pos;
	return pos;
}
예제 #3
0
파일: misc.cpp 프로젝트: AzyxWare/ryzom
void setCase (ucstring &str, TCaseMode mode)
{
	const uint length = (uint)str.length();
	uint i;
	bool newString = true;
	bool newSentence = true;
	bool newWord = true;
	switch (mode)
	{
	case CaseLower:
		str = toLower (str);
		break;
	case CaseUpper:
		str = toUpper (str);
		break;
	case CaseFirstStringLetterUp:
		for (i=0; i<length; i++)
		{
			if (!isSeparator (str[i]))
			{
				if (newString)
					str[i] = toUpper (str[i]);
				else
					str[i] = toLower (str[i]);
				newString = false;
			}
		}
		break;
	case CaseFirstSentenceLetterUp:
		for (i=0; i<length; i++)
		{
			if (isEndSentence (str, i))
				newSentence = true;
			else
			{
				if (newSentence)
					str[i] = toUpper (str[i]);
				else
					str[i] = toLower (str[i]);

				if (!isSeparator (str[i]))
					newSentence = false;
			}
		}
		break;
	case CaseFirstWordLetterUp:
		for (i=0; i<length; i++)
		{
			if (isSeparator (str[i]) || isEndSentence (str, i))
				newWord = true;
			else
			{
				if (newWord)
					str[i] = toUpper (str[i]);
				else
					str[i] = toLower (str[i]);

				newWord = false;
			}
		}
		break;
	default:
		break;
	}
}