void NET_Poll(void) { PollProcedure *pp; bool useModem; if (!configRestored) { if (serialAvailable) { if (config_com_modem.getInt() == 1.0) useModem = true; else useModem = false; SetComPortConfig (0, config_com_port.getInt(), config_com_irq.getInt(), config_com_baud.getInt(), useModem); SetModemConfig (0, config_modem_dialtype.getString(), config_modem_clear.getString(), config_modem_init.getString(), config_modem_hangup.getString()); } configRestored = true; } SetNetTime(); for (pp = pollProcedureList; pp; pp = pp->next) { if (pp->nextTime > net_time) break; pollProcedureList = pp->next; pp->procedure();//(pp->arg); } }
MainApp::MainApp() { Bind(wxEVT_CLOSE_WINDOW, &MainApp::onClose, this); m_wxLoginForm = nullptr; m_wxTBIcon = nullptr; m_wxMainForm = nullptr; m_bQuiteMode = false; m_bLoggedIn = false; m_iMode = MODE_LOGOUT; //need to overide the value in corecount if not set if (gc_corecount.getInt() == 0) { //need to change the value so it will trigger the cvar callback gc_corecount.setValue(1); gc_corecount.setValue(0); } m_pOfflineDialog = nullptr; m_pInternalLink = nullptr; #ifdef WITH_GTEST m_UnitTestForm = nullptr; #endif onLoginAcceptedEvent += guiDelegate(this, &MainApp::onLoginAcceptedCB); onInternalLinkEvent += guiDelegate(this, &MainApp::onInternalLink); onInternalLinkStrEvent += guiDelegate(this, &MainApp::onInternalStrLink); onNotifyGiftUpdateEvent += guiDelegate(this, &MainApp::onNotifyGiftUpdate); }
/** * An svc_signonnum has been received, perform a client side setup */ void CL_SignonReply(void) { char str[8192]; Con_DPrintf("CL_SignonReply: %i\n", cls.signon); switch (cls.signon) { case 1: MSG_WriteByte(&cls.message, clc_stringcmd); MSG_WriteString(&cls.message, "prespawn"); break; case 2: MSG_WriteByte(&cls.message, clc_stringcmd); MSG_WriteString(&cls.message, va("name \"%s\"\n", cl_name.getString())); MSG_WriteByte(&cls.message, clc_stringcmd); MSG_WriteString(&cls.message, va("color %i %i\n", cl_color.getInt() >> 4, cl_color.getInt()&15)); MSG_WriteByte(&cls.message, clc_stringcmd); sprintf(str, "spawn %s", cls.spawnparms); MSG_WriteString(&cls.message, str); break; case 3: MSG_WriteByte(&cls.message, clc_stringcmd); MSG_WriteString(&cls.message, "begin"); MemoryObj::Report(); // print remaining memory break; case 4: SCR_EndLoadingPlaque(); // allow normal screen updates break; } }
void SCR_SizeDown_f(void) { //JHL:HACK; changed to affect the HUD, not SCR size if (hud.getInt() > 0) { hud.set(hud.getFloat() - 1); vid.recalc_refdef = 1; } //qmb :hud //Cvar_SetValue ("viewsize",scr_viewsize.value-10); //vid.recalc_refdef = 1; }
MainApp::MainApp() { Bind(wxEVT_CLOSE_WINDOW, &MainApp::onClose, this); //need to override the value in core count if not set if (gc_corecount.getInt() == 0) { //need to change the value so it will trigger the cvar callback gc_corecount.setValue(1); gc_corecount.setValue(0); } onLoginAcceptedEvent += guiDelegate(this, &MainApp::onLoginAcceptedCB); onInternalLinkEvent += guiDelegate(this, &MainApp::onInternalLink); onInternalLinkStrEvent += guiDelegate(this, &MainApp::onInternalStrLink); onNotifyGiftUpdateEvent += guiDelegate(this, &MainApp::onNotifyGiftUpdate); onLoggedOutEvent += guiDelegate(this, &MainApp::onLoggedOut); }
/** * Returns false if the time is too short to run a frame */ bool Host_FilterTime(float time) { realtime += time; if (max_fps.getInt() > 0) { // CAPTURE <*****@*****.**> if (!cls.capturedemo) // only allow the following early return if not capturing: if (!cls.timedemo && realtime - oldrealtime < 1.0 / max_fps.getFloat()) return false; // framerate is too high } host_frametime = realtime - oldrealtime; oldrealtime = realtime; if (host_framerate.getFloat() > 0) host_frametime = host_framerate.getFloat(); else { // don't allow really long or short frames if (host_frametime > 0.1) host_frametime = 0.1; if (host_frametime < 0.001) host_frametime = 0.001; } return true; }
LoginForm::LoginForm(wxWindow* parent) : gcFrame(parent, wxID_ANY, Managers::GetString(L"#LF_TITLE"), wxDefaultPosition, wxSize(420,286), wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxWANTS_CHARS|wxMINIMIZE_BOX, true) { m_comboProvider = nullptr; m_bAutoLogin = false; m_pNewAccount = nullptr; Bind(wxEVT_COMMAND_TEXT_ENTER, &LoginForm::onTextBoxEnter, this); Bind(wxEVT_CLOSE_WINDOW, &LoginForm::onClose, this); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onButtonClick, this); Bind(wxEVT_MOVE, &LoginForm::onMove, this); m_imgLogo = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 253,81 )); m_imgAvatar = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 )); m_imgLogo->setImage("#login_logo"); m_imgAvatar->setImage("#login_default_avatar"); m_tbUsername = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_USER"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS); m_tbPassword = new gcTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS|wxTE_PASSWORD); m_tbPasswordDisp = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_PASS")); gcString strStagingUrl(gc_login_stage_url.getString()); gcString strStagingLast(gc_login_stage_last.getString()); if (strStagingUrl.size() > 0) { wxArrayString choices; choices.Add("Prod"); choices.Add("Test"); m_comboProvider = new gcChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices); if (strStagingLast == "Test") m_comboProvider->SetSelection(1); else m_comboProvider->SetSelection(0); } m_cbRemPass = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_AUTO")); m_cbRemPass->SetToolTip(Managers::GetString(L"#LF_AUTO_TOOLTIP")); #ifdef WIN32 m_cbProxyOff = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_PROXYOFF")); m_cbProxyOff->SetToolTip(Managers::GetString(L"#LF_PROXYOFF_TOOLTIP")); #endif m_cbBypassSSLRevocationCheck = new gcCheckBox( this, wxID_ANY, Managers::GetString( L"#LF_REVOCATION" ) ); m_cbBypassSSLRevocationCheck->SetToolTip( Managers::GetString( L"#LF_REVOCATION_TOOLTIP" ) ); m_butSignin = new gcButton(this, wxID_ANY, Managers::GetString(L"#LOGIN"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); m_butCancel = new gcButton(this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); m_linkOffline = new LoginLink(this, Managers::GetString(L"#LF_OFFLINE"), wxALIGN_LEFT); m_linkNewAccount = new LoginLink(this, Managers::GetString(L"#LF_NEWACCOUNT"), wxALIGN_CENTER); m_linkLostPassword = new LoginLink( this, Managers::GetString(L"#LF_LOSTPASS"), wxALIGN_RIGHT); m_butTwitter = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42)); m_butSteam = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42)); m_butFacebook = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42)); m_butGoogle = new gcImageButton(this, wxID_ANY, wxDefaultPosition, wxSize(42, 42)); m_butTwitter->setDefaultImage("#login_twitter"); m_butSteam->setDefaultImage("#login_steam"); m_butFacebook->setDefaultImage("#login_facebook"); m_butGoogle->setDefaultImage("#login_google"); m_butTwitter->SetCursor(wxCursor(wxCURSOR_HAND)); m_butSteam->SetCursor(wxCursor(wxCURSOR_HAND)); m_butFacebook->SetCursor(wxCursor(wxCURSOR_HAND)); m_butGoogle->SetCursor(wxCursor(wxCURSOR_HAND)); m_butTwitter->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this); m_butSteam->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this); m_butFacebook->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this); m_butGoogle->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onAltLoginClick, this); //focus gets set to the first child. Redirect input to username box m_imgLogo->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this); m_imgAvatar->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this); #ifdef WIN32 Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); m_imgLogo->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); m_imgLogo->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); m_imgLogo->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); m_imgAvatar->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); m_imgAvatar->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); m_imgAvatar->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); #endif m_tbUsername->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this); m_tbUsername->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbUsername->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this); m_tbUsername->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this); m_tbPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbPassword->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this); m_tbPasswordDisp->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this); m_tbPasswordDisp->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this); m_cbRemPass->Bind(wxEVT_CHAR, &LoginForm::onChar, this); #ifdef WIN32 m_cbProxyOff->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LoginForm::onCheckBoxClick, this ); #endif m_cbBypassSSLRevocationCheck->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LoginForm::onCheckBoxClick, this ); m_linkOffline->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkNewAccount->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkLostPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkOffline->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_linkNewAccount->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_linkLostPassword->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_butCancel->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_butSignin->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbUsername->SetValue(Managers::GetString(L"#LF_USER")); m_tbPasswordDisp->SetValue(Managers::GetString(L"#LF_PASS")); m_tbPassword->Show(false); m_tbPasswordDisp->Show(true); #ifdef WIN32 wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 3, 0, 0 ); #else wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 2, 0, 0 ); #endif fgSizer4->AddGrowableCol( 0 ); fgSizer4->SetFlexibleDirection( wxBOTH ); fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer4->Add( m_cbRemPass, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); #ifdef WIN32 fgSizer4->Add( m_cbProxyOff, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); #endif fgSizer4->Add( m_cbBypassSSLRevocationCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 ); wxFlexGridSizer* fgSizer4a = new wxFlexGridSizer( 1, 2, 0, 0 ); fgSizer4a->AddGrowableCol( 0 ); fgSizer4a->SetFlexibleDirection( wxBOTH ); fgSizer4a->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer4a->Add( m_butSignin, 0, wxTOP | wxBOTTOM | wxLEFT, 5 ); fgSizer4a->Add( m_butCancel, 0, wxTOP | wxBOTTOM | wxLEFT, 5 ); wxFlexGridSizer* fgSizer5 = new wxFlexGridSizer( 1, 3, 0, 0 ); fgSizer5->AddGrowableCol( 0 ); fgSizer5->AddGrowableCol( 1 ); fgSizer5->AddGrowableCol( 2 ); fgSizer5->AddGrowableRow( 0 ); fgSizer5->SetFlexibleDirection( wxBOTH ); fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer5->Add( m_linkOffline, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); fgSizer5->Add( m_linkNewAccount, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); fgSizer5->Add( m_linkLostPassword, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); wxFlexGridSizer* fgSizer6 = new wxFlexGridSizer( 5, 1, 0, 0 ); fgSizer6->AddGrowableCol( 0 ); fgSizer6->SetFlexibleDirection( wxBOTH ); fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); if (m_comboProvider) { wxFlexGridSizer* fgSizer10 = new wxFlexGridSizer(1, 2, 0, 0); fgSizer10->AddGrowableCol(0); fgSizer10->Add(m_tbUsername, 0, wxEXPAND, 5); fgSizer10->Add(m_comboProvider, 0, wxLEFT, 5); fgSizer6->Add(fgSizer10, 0, wxEXPAND | wxLEFT, 5); } else { fgSizer6->Add(m_tbUsername, 0, wxEXPAND | wxLEFT, 5); } fgSizer6->Add( m_tbPassword, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); fgSizer6->Add( m_tbPasswordDisp, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); fgSizer6->Add( fgSizer4, 1, wxEXPAND, 5 ); fgSizer6->Add( fgSizer4a, 1, wxEXPAND, 5 ); wxFlexGridSizer* fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 ); fgSizer3->AddGrowableCol( 1 ); fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer3->Add( m_imgAvatar, 0, 0, 5 ); fgSizer3->Add( fgSizer6, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); wxFlexGridSizer* fgSizerAltLogin = new wxFlexGridSizer(1, 9, 0, 0); fgSizerAltLogin->AddGrowableCol(2); fgSizerAltLogin->AddGrowableCol(4); fgSizerAltLogin->AddGrowableCol(6); fgSizerAltLogin->AddGrowableRow(0); fgSizerAltLogin->Add(15, 0, 1, wxEXPAND, 5); fgSizerAltLogin->Add(m_butTwitter, 0, 0, 5); fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5); fgSizerAltLogin->Add(m_butSteam, 0, 0, 5); fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5); fgSizerAltLogin->Add(m_butFacebook, 0, 0, 5); fgSizerAltLogin->Add(0, 0, 1, wxEXPAND, 5); fgSizerAltLogin->Add(m_butGoogle, 0, 0, 5); fgSizerAltLogin->Add(15, 0, 1, wxEXPAND, 5); wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 6, 1, 0, 0 ); fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer2->Add( m_imgLogo, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 ); fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 ); fgSizer2->Add(0, 9, 1, wxEXPAND, 5); fgSizer2->Add(fgSizer5, 1, wxEXPAND, 5); fgSizer2->Add(0, 9, 1, wxEXPAND, 5); fgSizer2->Add(fgSizerAltLogin, 1, wxEXPAND, 5); wxFlexGridSizer* fgSizer1 = new wxFlexGridSizer( 1, 3, 0, 0 ); fgSizer1->AddGrowableCol( 0 ); fgSizer1->AddGrowableCol( 2 ); fgSizer1->AddGrowableRow( 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 ); fgSizer1->Add( 0, 15, 1, wxEXPAND|wxBOTTOM, 15 ); this->SetSizer( fgSizer1 ); this->Layout(); m_bSavePos = false; m_vTabOrder.push_back(m_tbUsername); m_vTabOrder.push_back(m_tbPasswordDisp); m_vTabOrder.push_back(m_tbPassword); m_vTabOrder.push_back( m_cbRemPass ); #ifdef WIN32 m_vTabOrder.push_back( m_cbProxyOff ); #endif m_vTabOrder.push_back( m_cbBypassSSLRevocationCheck ); m_vTabOrder.push_back(m_butSignin); m_vTabOrder.push_back(m_butCancel); m_vTabOrder.push_back(m_linkOffline); m_vTabOrder.push_back(m_linkNewAccount); m_vTabOrder.push_back(m_linkLostPassword); Centre(wxCENTRE_ON_SCREEN); SetFocus(); if (gc_login_x.getInt() == -1 || gc_login_y.getInt() == -1) { int x = wxSystemSettings::GetMetric(wxSYS_SCREEN_X); int y = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y); int w=0; int h=0; GetSize(&w, &h); int newX = (x-w)/2; int newY = (y-h)/2; if (newX>0 && newY>0) SetSize(newX, newY, -1, -1); } else { #ifdef NIX if (! gc_allow_wm_positioning.getBool()) #endif setSavedWindowPos(gc_login_x.getInt(), gc_login_y.getInt(), UINT_MAX, UINT_MAX); } if (gc_savelogin.getBool()) m_cbRemPass->SetValue(true); #ifdef WIN32 bool isProxyOff = gc_saveProxyOff.getBool(); UTIL::OS::setProxyOff( isProxyOff ); m_cbProxyOff->SetValue( isProxyOff ); #endif bool isBypassSSLRevocationCheck = gc_saveBypassSSLRevocationCheck.getBool(); UTIL::OS::setBypassSSLRevocationCheck( isBypassSSLRevocationCheck ); m_cbBypassSSLRevocationCheck->SetValue( isBypassSSLRevocationCheck ); if (gc_saveusername.getBool()) { const char* str = gc_lastusername.getString(); const char* avatar = gc_lastavatar.getString(); if (gcString(str) != "") { m_tbUsername->SetValue(str); m_tbPasswordDisp->Show(false); m_tbPassword->Show(); m_tbPassword->SetFocus(); Layout(); } if (avatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(avatar))) m_imgAvatar->setImage(avatar); } m_pLogThread = nullptr; m_bSavePos = true; m_bMouseDrag = false; onLoginEvent += guiDelegate(this, &LoginForm::onLogin); onLoginErrorEvent += guiDelegate(this, &LoginForm::onLoginError); onStartLoginEvent += guiDelegate(this, &LoginForm::onStartLogin); Managers::LoadTheme(this, "formlogin"); Managers::LoadTheme(m_cbRemPass, "formlogin"); #ifdef WIN32 Managers::LoadTheme(m_cbProxyOff, "formlogin"); #endif Managers::LoadTheme( m_cbBypassSSLRevocationCheck, "formlogin" ); SetSize(wxSize(400,336)); setFrameRegion(); onNewAccountLoginEvent += guiDelegate(this, &LoginForm::newAccountLoginCB); onNewAccountLoginErrorEvent += guiDelegate(this, &LoginForm::newAccountLoginErrorCB); }
LoginForm::LoginForm(wxWindow* parent) : gcFrame(parent, wxID_ANY, Managers::GetString(L"#LF_TITLE"), wxDefaultPosition, wxSize(420,246), wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxWANTS_CHARS|wxMINIMIZE_BOX, true) { m_bAutoLogin = false; m_pNewAccount = NULL; Bind(wxEVT_COMMAND_TEXT_ENTER, &LoginForm::onTextBoxEnter, this); Bind(wxEVT_CLOSE_WINDOW, &LoginForm::onClose, this); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onButtonClick, this); Bind(wxEVT_MOVE, &LoginForm::onMove, this); m_imgLogo = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 253,81 )); m_imgAvatar = new gcImageControl(this, wxID_ANY, wxDefaultPosition, wxSize( 66,66 )); m_imgLogo->setImage("#login_logo"); m_imgAvatar->setImage("#login_default_avatar"); m_tbUsername = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_USER"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS); m_tbPassword = new gcTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxWANTS_CHARS|wxTE_PASSWORD); m_tbPasswordDisp = new gcTextCtrl(this, wxID_ANY, Managers::GetString(L"#LF_PASS")); #ifndef UI_HIDE_AUTOLOGIN m_cbRemPass = new gcCheckBox(this, wxID_ANY, Managers::GetString(L"#LF_AUTO")); m_cbRemPass->SetToolTip(Managers::GetString(L"#LF_AUTO_TOOLTIP")); #endif m_butSignin = new gcButton(this, wxID_ANY, Managers::GetString(L"#LOGIN"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); m_butCancel = new gcButton(this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); m_linkOffline = new LoginLink(this, Managers::GetString(L"#LF_OFFLINE"), wxALIGN_LEFT); m_linkNewAccount = new LoginLink(this, Managers::GetString(L"#LF_NEWACCOUNT"), wxALIGN_CENTER); m_linkLostPassword = new LoginLink( this, Managers::GetString(L"#LF_LOSTPASS"), wxALIGN_RIGHT); //focus gets set to the first child. Redirect input to username box m_imgLogo->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this); m_imgAvatar->Bind(wxEVT_CHAR, &LoginForm::onFormChar, this); #ifdef WIN32 Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); m_imgLogo->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); m_imgLogo->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); m_imgLogo->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); m_imgAvatar->Bind(wxEVT_LEFT_UP, &LoginForm::onMouseUp, this); m_imgAvatar->Bind(wxEVT_LEFT_DOWN, &LoginForm::onMouseDown, this); m_imgAvatar->Bind(wxEVT_MOTION, &LoginForm::onMouseMove, this); #endif m_tbUsername->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this); m_tbUsername->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbUsername->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this); m_tbUsername->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this); m_tbPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbPassword->Bind(wxEVT_KILL_FOCUS, &LoginForm::onBlur, this); m_tbPasswordDisp->Bind(wxEVT_COMMAND_TEXT_UPDATED, &LoginForm::onTextChange, this); m_tbPasswordDisp->Bind(wxEVT_SET_FOCUS, &LoginForm::onFocus, this); #ifndef UI_HIDE_AUTOLOGIN m_cbRemPass->Bind(wxEVT_CHAR, &LoginForm::onChar, this); #endif m_linkOffline->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkNewAccount->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkLostPassword->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_linkOffline->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_linkNewAccount->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_linkLostPassword->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &LoginForm::onLinkClick, this); m_butCancel->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_butSignin->Bind(wxEVT_CHAR, &LoginForm::onChar, this); m_tbUsername->SetValue(Managers::GetString(L"#LF_USER")); m_tbPasswordDisp->SetValue(Managers::GetString(L"#LF_PASS")); m_tbPassword->Show(false); m_tbPasswordDisp->Show(true); wxFlexGridSizer* fgSizer4 = new wxFlexGridSizer( 1, 3, 0, 0 ); fgSizer4->AddGrowableCol( 0 ); fgSizer4->SetFlexibleDirection( wxBOTH ); fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); #ifndef UI_HIDE_AUTOLOGIN fgSizer4->Add( m_cbRemPass, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); #else fgSizer4->Add(0,0,0,0); #endif fgSizer4->Add( m_butSignin, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); fgSizer4->Add( m_butCancel, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); wxFlexGridSizer* fgSizer5 = new wxFlexGridSizer( 1, 3, 0, 0 ); fgSizer5->AddGrowableCol( 0 ); fgSizer5->AddGrowableCol( 1 ); fgSizer5->AddGrowableCol( 2 ); fgSizer5->AddGrowableRow( 0 ); fgSizer5->SetFlexibleDirection( wxBOTH ); fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer5->Add( m_linkOffline, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); fgSizer5->Add( m_linkNewAccount, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); fgSizer5->Add( m_linkLostPassword, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); wxFlexGridSizer* fgSizer6 = new wxFlexGridSizer( 4, 1, 0, 0 ); fgSizer6->AddGrowableCol( 0 ); fgSizer6->SetFlexibleDirection( wxBOTH ); fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer6->Add( m_tbUsername, 0, wxEXPAND|wxLEFT, 5 ); fgSizer6->Add( m_tbPassword, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); fgSizer6->Add( m_tbPasswordDisp, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); fgSizer6->Add( fgSizer4, 1, wxEXPAND, 5 ); wxFlexGridSizer* fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 ); fgSizer3->AddGrowableCol( 1 ); fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer3->Add( m_imgAvatar, 0, 0, 5 ); fgSizer3->Add( fgSizer6, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 4, 1, 0, 0 ); fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer2->Add( m_imgLogo, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 ); fgSizer2->Add( fgSizer3, 1, wxEXPAND, 5 ); fgSizer2->Add( 0, 9, 1, wxEXPAND, 5 ); fgSizer2->Add( fgSizer5, 1, wxEXPAND, 5 ); wxFlexGridSizer* fgSizer1 = new wxFlexGridSizer( 1, 3, 0, 0 ); fgSizer1->AddGrowableCol( 0 ); fgSizer1->AddGrowableCol( 2 ); fgSizer1->AddGrowableRow( 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer1->Add( fgSizer2, 1, wxEXPAND, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); this->SetSizer( fgSizer1 ); this->Layout(); m_bSavePos = false; m_vTabOrder.push_back(m_tbUsername); m_vTabOrder.push_back(m_tbPasswordDisp); m_vTabOrder.push_back(m_tbPassword); #ifndef UI_HIDE_AUTOLOGIN m_vTabOrder.push_back(m_cbRemPass); #endif m_vTabOrder.push_back(m_butSignin); m_vTabOrder.push_back(m_butCancel); m_vTabOrder.push_back(m_linkOffline); m_vTabOrder.push_back(m_linkNewAccount); m_vTabOrder.push_back(m_linkLostPassword); Centre(wxCENTRE_ON_SCREEN); SetFocus(); if (gc_login_x.getInt() == -1 || gc_login_y.getInt() == -1) { int x = wxSystemSettings::GetMetric(wxSYS_SCREEN_X); int y = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y); int w=0; int h=0; GetSize(&w, &h); int newX = (x-w)/2; int newY = (y-h)/2; if (newX>0 && newY>0) SetSize(newX, newY, -1, -1); } else { #ifdef NIX if (! gc_allow_wm_positioning.getBool()) #endif setSavedWindowPos(gc_login_x.getInt(), gc_login_y.getInt(), UINT_MAX, UINT_MAX); } #ifndef UI_HIDE_AUTOLOGIN if (gc_savelogin.getBool()) m_cbRemPass->SetValue(true); #endif if (gc_saveusername.getBool()) { const char* str = gc_lastusername.getString(); const char* avatar = gc_lastavatar.getString(); if (gcString(str) != "") { m_tbUsername->SetValue(str); m_tbPasswordDisp->Show(false); m_tbPassword->Show(); m_tbPassword->SetFocus(); Layout(); } if (avatar && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(avatar))) m_imgAvatar->setImage(avatar); } m_pLogThread = NULL; m_bSavePos = true; m_bMouseDrag = false; onLoginEvent += guiDelegate(this, &LoginForm::onLogin); onLoginErrorEvent += guiDelegate(this, &LoginForm::onLoginError); onStartLoginEvent += guiDelegate(this, &LoginForm::onStartLogin); Managers::LoadTheme(this, "formlogin"); #ifndef UI_HIDE_AUTOLOGIN Managers::LoadTheme(m_cbRemPass, "formlogin"); #endif #ifdef WIN32 SetSize(wxSize(420,246)); #endif setFrameRegion(); }