From d82891c719e7c69782f7447c3db00477123101d0 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 29 Jun 2012 00:30:27 +0200 Subject: [PATCH] CHANGED: #1471 CDBGroupComboBox no longer depends on the isLoggedin global Ryzom game variable. --HG-- branch : gui-refactoring --- code/ryzom/client/src/far_tp.cpp | 3 +- .../src/interface_v3/dbgroup_combo_box.cpp | 19 +++----- .../src/interface_v3/dbgroup_combo_box.h | 17 +++---- .../src/interface_v3/interface_manager.cpp | 3 +- code/ryzom/client/src/login.cpp | 44 ++++++++++++++++--- 5 files changed, 53 insertions(+), 33 deletions(-) diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index 5b4b28c99..1b15b63c2 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -1351,6 +1351,7 @@ void CFarTP::onDssDown(bool forceReturn) } extern bool loginFinished; +void setLoginFinished( bool f ); extern bool loginOK; void CFarTP::joinSessionResult(uint32 /* userId */, TSessionId /* sessionId */, uint32 /* result */, const std::string &/* shardAddr */, const std::string &/* participantStatus */) @@ -1365,7 +1366,7 @@ void CFarTP::joinSessionResult(uint32 /* userId */, TSessionId /* sessionId */, // // FSAddr = shardAddr; // -// loginFinished = true; +// setLoginFinished( true ); // loginOK = true; // // LoginSM.pushEvent(CLoginStateMachine::ev_connect); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp index 2a95a0b6c..e35f1e159 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp @@ -15,24 +15,22 @@ // along with this program. If not, see . - -#include "stdpch.h" #include "dbgroup_combo_box.h" #include "nel/gui/group_menu.h" #include "nel/misc/xml_auto_ptr.h" -#include "interface_manager.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/action_handler.h" #include "nel/gui/lua_ihm.h" - -#include "nel/gui/lua_ihm.h" +#include "nel/gui/widget_manager.h" using namespace std; using namespace NLMISC; NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box"); -extern bool loginFinished; +std::string CDBGroupComboBox::measureMenu; +std::string CDBGroupComboBox::selectMenu; +std::string CDBGroupComboBox::selectMenuOut; // *************************************************************************** CDBGroupComboBox::CDBGroupComboBox(const TCtorParam ¶m) @@ -56,9 +54,8 @@ CDBGroupComboBox::~CDBGroupComboBox() // *************************************************************************** sint32 CDBGroupComboBox::evalContentWidth() const { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); // get the menu to open. - CGroupMenu *groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( loginFinished ? WIN_COMBO_BOX_MEASURE_MENU : WIN_COMBO_BOX_MEASURE_MENU_LOGIN )); + CGroupMenu *groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::measureMenu )); if( !groupMenu ) { return 0; @@ -543,7 +540,6 @@ class CHandlerComboBoxSelectStart : public IActionHandler public: virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */) { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); CDBGroupComboBox *pCB = dynamic_cast(pCaller->getParent()); if (pCB == NULL) return; // if no choice, return. @@ -551,10 +547,10 @@ public: return; // get the menu to open. - CGroupMenu *groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(loginFinished ? WIN_COMBO_BOX_SELECT_MENU: WIN_COMBO_BOX_SELECT_MENU_LOGIN )); + CGroupMenu *groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::selectMenu )); if( !groupMenu ) { - groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_COMBO_BOX_SELECT_MENU_OUTGAME)); + groupMenu= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( CDBGroupComboBox::selectMenuOut )); } if( !groupMenu ) return; @@ -606,7 +602,6 @@ class CHandlerComboBoxSelectEnd : public IActionHandler public: virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params) { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); CDBGroupComboBox *pCB = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); if (pCB == NULL) return; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h index 606d7b430..bf2a44c12 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h @@ -30,17 +30,6 @@ namespace NLGUI } -// *************************************************************************** -#define WIN_COMBO_BOX_SELECT_MENU "ui:interface:combo_box_select_menu" -#define WIN_COMBO_BOX_MEASURE_MENU "ui:interface:combo_box_measure_menu" - -#define WIN_COMBO_BOX_SELECT_MENU_OUTGAME "ui:outgame:combo_box_select_menu" - -#define WIN_COMBO_BOX_SELECT_MENU_LOGIN "ui:login:combo_box_select_menu" -#define WIN_COMBO_BOX_MEASURE_MENU_LOGIN "ui:login:combo_box_measure_menu" - - - // *************************************************************************** /** * Widget: ComboBox of text @@ -155,12 +144,16 @@ protected: private: - void setup(); void dirt(); public: // private : fill a menu with current content void fillMenu(CGroupMenu *groupMenu) const; + + + static std::string measureMenu; + static std::string selectMenu; + static std::string selectMenuOut; }; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 10ca54ea3..a3d87f447 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -174,6 +174,7 @@ using namespace NLNET; // ------------------------------------------------------------------------------------------------ extern bool loginFinished; +void setLoginFinished( bool f ); // Edit actions CActionsManager EditActions; @@ -788,7 +789,7 @@ void badXMLParseMessageBox() // ------------------------------------------------------------------------------------------------ void CInterfaceManager::initInGame() { - loginFinished = true; + setLoginFinished( true ); _LogState = false; // Whole initInGame profile diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 5d37d7c54..ad9631f69 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -40,6 +40,7 @@ #include "nel/gui/view_text.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/ctrl_text_button.h" +#include "interface_v3/dbgroup_combo_box.h" #include "sound_manager.h" #include "far_tp.h" @@ -143,6 +144,33 @@ uint32 TotalPatchSize; CLoginStateMachine LoginSM; +// *************************************************************************** +#define WIN_COMBO_BOX_SELECT_MENU "ui:interface:combo_box_select_menu" +#define WIN_COMBO_BOX_MEASURE_MENU "ui:interface:combo_box_measure_menu" +#define WIN_COMBO_BOX_SELECT_MENU_OUTGAME "ui:outgame:combo_box_select_menu" +#define WIN_COMBO_BOX_SELECT_MENU_LOGIN "ui:login:combo_box_select_menu" +#define WIN_COMBO_BOX_MEASURE_MENU_LOGIN "ui:login:combo_box_measure_menu" + +bool isLoginFinished() +{ + return loginFinished; +} + +void setLoginFinished( bool f ) +{ + loginFinished = f; + if( loginFinished ) + { + CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU ); + CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU ); + } + else + { + CDBGroupComboBox::measureMenu.assign( WIN_COMBO_BOX_MEASURE_MENU_LOGIN ); + CDBGroupComboBox::selectMenu.assign( WIN_COMBO_BOX_SELECT_MENU_LOGIN ); + } +} + // *************************************************************************** // Pop a fatal error message box, giving the option to 'quit' the client, plus a help button @@ -349,6 +377,7 @@ static void updatePatchingInfoText(const std::string &baseUIPath) // Main loop of the login step void loginMainLoop() { + CDBGroupComboBox::selectMenuOut.assign( WIN_COMBO_BOX_SELECT_MENU_OUTGAME ); CInterfaceManager *pIM = CInterfaceManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance(); @@ -757,7 +786,7 @@ void initLoginScreen() CCtrlTextButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT)); if (pCB != NULL) pCB->setActive(false); - loginFinished = false; + setLoginFinished( false ); loginOK = false; } @@ -882,6 +911,7 @@ bool login() // CCtrlTextButton *pCB = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_BUTTON_CONNECT)); // if (pCB != NULL) pCB->setActive(false); // +// setLoginFinished( false ); // loginFinished = false; // loginOK = false; @@ -1280,7 +1310,7 @@ class CAHOnGameConfiguration : public IActionHandler { // launch the ryzom configurator launchProgram(Configurator, ""); - loginFinished = true; + setLoginFinished( true ); loginOK = false; LoginSM.pushEvent(CLoginStateMachine::ev_quit); @@ -1301,7 +1331,7 @@ class CAHLoginQuit : public IActionHandler { nlinfo("CAHLoginQuit called"); - loginFinished = true; + setLoginFinished( true ); loginOK = false; LoginSM.pushEvent(CLoginStateMachine::ev_quit); @@ -1400,7 +1430,7 @@ void ConnectToShard() if (ClientCfg.R2Mode) { // r2 mode - loginFinished = true; + setLoginFinished( true ); loginOK = true; LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); @@ -1414,7 +1444,7 @@ void ConnectToShard() if(res.empty()) { - loginFinished = true; + setLoginFinished( true ); loginOK = true; LoginSM.pushEvent(CLoginStateMachine::ev_enter_game); @@ -2625,7 +2655,7 @@ class CAHOnConnectToShard: public IActionHandler Cookie[i] = '|'; } - loginFinished = true; + setLoginFinished( true ); loginOK = true; LoginSM.pushEvent(CLoginStateMachine::ev_connect); @@ -2639,7 +2669,7 @@ class CAHOnBackToLogin: public IActionHandler { virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { - loginFinished = false; + setLoginFinished( false ); loginOK = false; LoginSM.pushEvent(CLoginStateMachine::ev_relog);