From: Keith F. <ven...@us...> - 2002-01-19 07:09:57
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory usw-pr-cvs1:/tmp/cvs-serv18915 Modified Files: psgwchat.h psgwchat.cpp Log Message: Added support for network layer. Index: psgwchat.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psgwchat.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** psgwchat.h 2002/01/19 03:15:49 1.1 --- psgwchat.h 2002/01/19 07:09:51 1.2 *************** *** 1,56 **** ! /* ! * psdragplane.h ! * ! * Copyright (C) 2001 PlaneShift Team (in...@pl..., ! * http://www.planeshift.it) ! * ! * 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 the Free Software Foundation (version 2 of the License) ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * ! */ ! ! #ifndef PS_CHATWINDOW_H ! #define PS_CHATWINDOW_H ! ! #include "base/psdragplane.h" ! #include "csutil/garray.h" ! #include "base/pscomp.h" ! #include "base/pstextin.h" ! #include "base/pstext.h" ! ! class psManager; ! class psDialog; ! class psDragPlane; ! class csSimplePixmap; ! ! class psChatWindow : public psDragPlane ! { ! public: ! /// constructor ! psChatWindow(psDialog* idialog, int iID, int limit); ! ! ! bool HandleKeyDown(int key, char c , int modifier); ! void SetInput(psTextInput* t){ textInput = t; } ! void SetTextBox(psText* t){ textBox = t; } ! ! ! protected: ! ! psTextInput* textInput; ! psText* textBox; ! ! ! }; ! ! #endif // PS_CHATWINDOW_H ! --- 1,62 ---- ! /* ! * psdragplane.h ! * ! * Copyright (C) 2001 PlaneShift Team (in...@pl..., ! * http://www.planeshift.it) ! * ! * 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 the Free Software Foundation (version 2 of the License) ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * ! */ ! ! #ifndef PS_CHATWINDOW_H ! #define PS_CHATWINDOW_H ! ! #include "base/psdragplane.h" ! #include "csutil/garray.h" ! #include "base/pscomp.h" ! #include "base/pstextin.h" ! #include "base/pstext.h" ! ! class psManager; ! class psDialog; ! class psDragPlane; ! class csSimplePixmap; ! struct iPSEngine; ! ! class psChatWindow : public psDragPlane ! { ! public: ! /// constructor ! psChatWindow(psDialog* idialog, int iID, int limit); ! ! ! bool HandleKeyDown(int key, char c , int modifier); ! void SetInput(psTextInput* t){ textInput = t; } ! void SetTextBox(psText* t){ textBox = t; } ! ! void AddLine(const char *line); ! ! ! protected: ! ! psTextInput* textInput; ! psText* textBox; ! iPSEngine *psengine; ! }; ! ! ! ! #endif // PS_CHATWINDOW_H ! ! ! Index: psgwchat.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psgwchat.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** psgwchat.cpp 2002/01/19 05:19:40 1.3 --- psgwchat.cpp 2002/01/19 07:09:51 1.4 *************** *** 1,66 **** ! /* ! * psdragplane.cpp ! * ! * Copyright (C) 2001 PlaneShift Team (in...@pl..., ! * http://www.planeshift.it) ! * ! * 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 the Free Software Foundation (version 2 of the License) ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * ! */ ! #include "config.h" ! ! // CS includes ! #include "cstool/cspixmap.h" ! #include "iengine/engine.h" ! #include "ivideo/graph3d.h" ! #include "ivideo/graph2d.h" ! #include "ivideo/txtmgr.h" ! #include "ivideo/texture.h" ! #include "ivideo/material.h" ! #include "ivideo/fontserv.h" ! #include "iutil/evdefs.h" ! ! // PS include ! #include "psdmngr.h" ! #include "base/psdialog.h" ! #include "base/psbutton.h" ! #include "base/psdragplane.h" ! #include "base/pstext.h" ! #include "base/pstextin.h" ! #include "psgwchat.h" ! ! //------------------------------------------------------------------- ! ! psChatWindow::psChatWindow(psDialog* idialog, int iID, int limit ) ! :psDragPlane(idialog,iID,limit) ! { ! } ! ! bool psChatWindow::HandleKeyDown(int key, char c , int modifier) ! { ! if( key == CSKEY_ENTER ) ! { ! if(textInput->IsFocused()) ! { ! char *Str = textInput->GetText(); ! if(Str && strcmp(Str, "") != 0) ! textBox->AddLine(Str); ! else ! textInput->SetFocused(false); ! textInput->SetText(""); ! } ! else ! textInput->SetFocused(true); ! } ! return true; ! } --- 1,89 ---- ! /* ! * psdragplane.cpp ! * ! * Copyright (C) 2001 PlaneShift Team (in...@pl..., ! * http://www.planeshift.it) ! * ! * 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 the Free Software Foundation (version 2 of the License) ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! * ! */ ! #include "config.h" ! ! // CS includes ! #include "cstool/cspixmap.h" ! #include "iengine/engine.h" ! #include "ivideo/graph3d.h" ! #include "ivideo/graph2d.h" ! #include "ivideo/txtmgr.h" ! #include "ivideo/texture.h" ! #include "ivideo/material.h" ! #include "ivideo/fontserv.h" ! #include "iutil/evdefs.h" ! #include <iutil/objreg.h> ! ! ! // PS include ! #include "psdmngr.h" ! #include "base/psdialog.h" ! #include "base/psbutton.h" ! #include "base/psdragplane.h" ! #include "base/pstext.h" ! #include "base/pstextin.h" ! #include "psgwchat.h" ! #include "../iclient/psengine.h" ! #include "../chatclient.h" ! ! //------------------------------------------------------------------- ! ! psChatWindow::psChatWindow(psDialog* idialog, int iID, int limit ) ! ! :psDragPlane(idialog,iID,limit) ! { ! iObjectRegistry* obj = dialog->GetDialogManager()->GetObjectRegistry(); ! ! obj->IncRef(); ! iPSEngine *psengine = CS_QUERY_REGISTRY(obj, iPSEngine); ! ! // psengine->RegisterChatWindow(this); ! ! obj->DecRef(); ! } ! ! bool psChatWindow::HandleKeyDown(int key, char c , int modifier) ! { ! if( key == CSKEY_ENTER ) ! { ! if(textInput->IsFocused()) ! { ! char *Str = textInput->GetText(); ! if(Str && strcmp(Str, "") != 0) ! { ! char *pErr = psengine->SendOutChat(Str); ! if (pErr) ! textBox->AddLine(pErr); // echo error if not formatted right ! } ! else ! textInput->SetFocused(false); ! textInput->SetText(""); ! } ! else ! textInput->SetFocused(true); ! } ! return true; ! } ! ! void psChatWindow::AddLine(const char *line) ! { ! textBox->AddLine(line); ! } ! |