From: Keith F. <ven...@us...> - 2002-02-25 09:08:03
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory usw-pr-cvs1:/tmp/cvs-serv28557 Modified Files: psgwchat.h psgwchat.cpp Log Message: Implement iReporterListener from CS in here. Index: psgwchat.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psgwchat.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** psgwchat.h 24 Feb 2002 05:00:52 -0000 1.7 --- psgwchat.h 25 Feb 2002 08:55:04 -0000 1.8 *************** *** 21,24 **** --- 21,25 ---- #include <csutil/garray.h> + #include "ivaria/reporter.h" // this lets other classes send things to the console #include "base/psdialog.h" *************** *** 32,40 **** class psChatClient; ! class psChatWindow : public psDialog { public: /// constructor psChatWindow(psDialogManager* idmanager); bool Initialize(); --- 33,44 ---- class psChatClient; ! class psChatWindow : public psDialog, public iReporterListener { public: + SCF_DECLARE_IBASE; // declare SCF functions for iRL + /// constructor psChatWindow(psDialogManager* idmanager); + virtual ~psChatWindow(); bool Initialize(); *************** *** 43,49 **** void SetTextBox(psText* t){ textBox = t; } ! void AddLine(char *line); ! static void Temp(psDialog* , int ); protected: --- 47,58 ---- void SetTextBox(psText* t){ textBox = t; } ! /// iReporterListner fn ! virtual bool Report (iReporter* reporter, int severity, const char* msgId, ! const char* description); ! void AddLine(const char *line); ! ! static void Temp(psDialog* , int ); ! protected: *************** *** 52,55 **** --- 61,65 ---- psTextInput *textInput; psText *textBox; + iReporter *reporter; }; Index: psgwchat.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psgwchat.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** psgwchat.cpp 24 Feb 2002 19:59:23 -0000 1.17 --- psgwchat.cpp 25 Feb 2002 08:55:04 -0000 1.18 *************** *** 42,45 **** --- 42,50 ---- #include "chatclient.h" + SCF_IMPLEMENT_IBASE( psChatWindow ) + SCF_IMPLEMENTS_INTERFACE( iReporterListener ) + SCF_IMPLEMENT_IBASE_END + + //------------------------------------------------------------------- *************** *** 52,60 **** CS_ASSERT (psengine->GetMsgHandler() != NULL); cmdhandler = psengine->GetCmdHandler(); ! chatConnection = new psChatClient(psengine->GetMsgHandler(),cmdhandler ); chatConnection->RegisterChatWindow(this); psengine->DecRef(); } //--------------------------------------------------------------------------- --- 57,76 ---- CS_ASSERT (psengine->GetMsgHandler() != NULL); cmdhandler = psengine->GetCmdHandler(); ! ! reporter = CS_QUERY_REGISTRY(obj, iReporter); ! reporter->AddReporterListener(this); ! ! chatConnection = new psChatClient(psengine->GetMsgHandler(),cmdhandler,obj ); chatConnection->RegisterChatWindow(this); psengine->DecRef(); } + psChatWindow::~psChatWindow() + { + reporter->RemoveReporterListener(this); + reporter->DecRef(); + } + + //--------------------------------------------------------------------------- *************** *** 148,152 **** //--------------------------------------------------------------------------- ! void psChatWindow::AddLine(char *line) { textBox->AddLine(line); --- 164,177 ---- //--------------------------------------------------------------------------- ! bool psChatWindow::Report(iReporter* reporter, int severity, const char* msgId, ! const char* description) ! { ! // We'll add different types using msgId parm here. ! AddLine(description); ! return TRUE; ! } ! ! ! void psChatWindow::AddLine(const char *line) { textBox->AddLine(line); |