From 3410218c50813102ded43e8b38141aefe3d62adb Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Jun 2011 19:34:28 +0200 Subject: [PATCH] Changed: Merge changes from next patch --- .../src/interface_v3/action_handler_game.cpp | 6 ++++ .../client/src/interface_v3/dbview_number.cpp | 34 +++++++++++++++++-- .../client/src/interface_v3/dbview_number.h | 1 + .../client/src/interface_v3/guild_manager.cpp | 6 ---- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index f358fa3fd..22d65d138 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -48,6 +48,7 @@ #include "view_bitmap.h" #include "action_handler_tools.h" #include "../connection.h" +#include "../client_chat_manager.h" // Game specific includes #include "../motion/user_controls.h" @@ -99,6 +100,8 @@ extern bool IsInRingSession; // Context help extern void contextHelp (const std::string &help); +extern CClientChatManager ChatMngr; + void beastOrder (const std::string &orderStr, const std::string &beastIndexStr, bool confirmFree = true); @@ -973,6 +976,9 @@ public: // Create the message for the server to execute a phrase. sendMsgToServer("GUILD:QUIT"); CGuildManager::getInstance()->closeAllInterfaces(); + + if (PeopleInterraction.TheUserChat.Filter.getTargetGroup() == CChatGroup::guild) + ChatMngr.updateChatModeAndButton(CChatGroup::say); } }; REGISTER_ACTION_HANDLER( CHandlerDoQuitGuild, "do_quit_guild"); diff --git a/code/ryzom/client/src/interface_v3/dbview_number.cpp b/code/ryzom/client/src/interface_v3/dbview_number.cpp index ebfda110e..8ca6e7c94 100644 --- a/code/ryzom/client/src/interface_v3/dbview_number.cpp +++ b/code/ryzom/client/src/interface_v3/dbview_number.cpp @@ -79,6 +79,10 @@ bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) if (ptr) _Positive = convertBool(ptr); else _Positive = false; + ptr = xmlGetProp (cur, (xmlChar*)"format"); + if (ptr) _Format = convertBool(ptr); + else _Format = false; + ptr = xmlGetProp (cur, (xmlChar*)"divisor"); if (ptr) fromString((const char*)ptr, _Divisor); @@ -98,6 +102,30 @@ bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) return true; } +// *************************************************************************** +// Helper function +ucstring formatThousands(const ucstring& s, const ucstring& separator) +{ + int j; + int k; + int topI = s.length() - 1; + + if (topI < 4) return s; + + ucstring ns; + do + { + for (j = topI, k = 0; j >= 0 && k < 3; --j, ++k ) + { + ns = s[j] + ns; // new char is added to front of ns + if( j > 0 && k == 2) ns = separator + ns; // j > 0 means still more digits + } + topI -= 3; + + } while(topI >= 0); + return ns; +} + // *************************************************************************** void CDBViewNumber::checkCoords() { @@ -106,8 +134,10 @@ void CDBViewNumber::checkCoords() if (_Cache != val) { _Cache= val; - if (_Positive) setText(val >= 0 ? ((string)_Prefix)+toString(val)+(string)_Suffix : "?"); - else setText( ((string)_Prefix)+toString(val)+(string)_Suffix ); + static ucstring separator = NLMISC::CI18N::get("uiThousandsSeparator"); + ucstring value = _Format ? formatThousands(toString(val), separator) : toString(val); + if (_Positive) setText(val >= 0 ? ( ucstring(_Prefix) + value + ucstring(_Suffix) ) : ucstring("?")); + else setText( ucstring(_Prefix) + value + ucstring(_Suffix) ); } } diff --git a/code/ryzom/client/src/interface_v3/dbview_number.h b/code/ryzom/client/src/interface_v3/dbview_number.h index 724209e73..1c7079f06 100644 --- a/code/ryzom/client/src/interface_v3/dbview_number.h +++ b/code/ryzom/client/src/interface_v3/dbview_number.h @@ -57,6 +57,7 @@ protected: CInterfaceProperty _Number; sint64 _Cache; bool _Positive; // only positive values are displayed + bool _Format; // the number will be formatted (like "1,000,000") if >= 10k sint64 _Divisor, _Modulo; // string to append to the value (eg: meters) CStringShared _Suffix; diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 6abd0c029..c9bb4ec01 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -29,7 +29,6 @@ #include "group_html.h" #include "../init_main_loop.h" #include "inventory_manager.h" -#include "../client_chat_manager.h" #include "../connection.h" #include "../entity_cl.h" @@ -49,7 +48,6 @@ using namespace std; using namespace NLMISC; extern CPeopleInterraction PeopleInterraction; -extern CClientChatManager ChatMngr; NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListAscensor, std::string, "list_sheet_guild"); @@ -541,10 +539,6 @@ void CGuildManager::closeAllInterfaces() CGroupContainer *pGuildChat = dynamic_cast(pIM->getElementFromId(WIN_GUILD_CHAT)); if (pGuildChat != NULL) pGuildChat->setActive(false); - - if (PeopleInterraction.TheUserChat.Filter.getTargetGroup() == CChatGroup::guild) - ChatMngr.updateChatModeAndButton(CChatGroup::say); - } // ***************************************************************************