]> code.citadel.org Git - citadel.git/commitdiff
coolness. it works with wxHTML.
authorArt Cancro <ajc@citadel.org>
Fri, 2 Apr 1999 04:16:12 +0000 (04:16 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 2 Apr 1999 04:16:12 +0000 (04:16 +0000)
daphne/Makefile
daphne/citclient.cpp
daphne/includes.hpp
daphne/roomview.cpp

index 6c072f6854f82c85d452ad7e0579a5d5d8bdff13..212c96c9832597acb9e655b25d0fc1183dfbe6e1 100644 (file)
@@ -1,5 +1,7 @@
-CFLAGS=`wx-config --cflags`
-LFLAGS=`wx-config --libs`
+WXHTML=/usr/local/wxHTML
+
+CFLAGS=`wx-config --cflags` -I$(WXHTML)/include
+LFLAGS=`wx-config --libs` -L$(WXHTML)/lib -lwxhtml
 
 all: daphne
 
index addfd1d4b07414569af3dde71e31d757d284a8b0..2b7b4b7f748aedd12c7c4ef125b0e7003501892e 100644 (file)
@@ -99,10 +99,8 @@ int CitClient::serv_trans(
        // If a mutex is to be wrapped around this function in the future,
        // it must begin HERE.
 
-       cout << "<" << command << "\n" ;
        serv_puts(command);
        serv_gets(response);
-       cout << ">" << response << "\n" ;
        first_digit = (response.GetChar(0)) - '0';
 
        if (response.GetChar(3) == '*')
index ca87778217d8946c2c5e4acc452c765fa28c2a8d..da236ff643203461d4851de229cd984346f261f3 100644 (file)
@@ -9,7 +9,7 @@
 #include <wx/imaglist.h>
 #include <wx/treectrl.h>
 #include <wx/toolbar.h>
-
+#include <wxhtml/wxhtml.h>
 
 
 #define MAXFLOORS      128
@@ -223,7 +223,7 @@ private:
        CitClient *citsock;
        DECLARE_EVENT_TABLE()
        void do_readloop(wxString readcmd);
-       wxTextCtrl *message_window;
+       wxHtmlWindow *message_window;
         wxPanel *banner;
         wxButton *close_button;
        wxString ThisRoom;
index 24f9522124213eafc2c5337c4badcc7052e4d83f..bc3b6539152c03366ef902c7f6d385d7489042b5 100644 (file)
@@ -3,13 +3,15 @@
 
 enum {
        BUTTON_CLOSE,
-       BUTTON_READNEW
+       BUTTON_READNEW,
+       BUTTON_READALL
 };
 
 
 BEGIN_EVENT_TABLE(RoomView, wxMDIChildFrame)
        EVT_BUTTON(     BUTTON_CLOSE,           RoomView::OnButtonPressed)
        EVT_BUTTON(     BUTTON_READNEW,         RoomView::OnButtonPressed)
+       EVT_BUTTON(     BUTTON_READALL,         RoomView::OnButtonPressed)
 END_EVENT_TABLE()
 
 
@@ -86,6 +88,19 @@ RoomView::RoomView(
        c2->width.AsIs();
        c2->right.LeftOf(close_button, 5);
        readnew_button->SetConstraints(c2);
+
+       wxButton *readall_button = new wxButton(
+               this,
+               BUTTON_READALL,
+               " Read all messages ",
+               wxDefaultPosition);
+
+       wxLayoutConstraints *c3 = new wxLayoutConstraints;
+       c3->top.SameAs(close_button, wxTop);
+       c3->bottom.SameAs(readnew_button, wxBottom);
+       c3->width.AsIs();
+       c3->right.LeftOf(readnew_button, 5);
+       readall_button->SetConstraints(c3);
 }
 
 
@@ -93,16 +108,16 @@ RoomView::RoomView(
 void RoomView::OnButtonPressed(wxCommandEvent& whichbutton) {
        if (whichbutton.GetId() == BUTTON_CLOSE) {
                delete this;
-       }
-
-       if (whichbutton.GetId() == BUTTON_READNEW) {
+       } else if (whichbutton.GetId() == BUTTON_READNEW) {
                do_readloop("MSGS NEW");
+       } else if (whichbutton.GetId() == BUTTON_READALL) {
+               do_readloop("MSGS ALL");
        }
 }
 
 
 void RoomView::do_readloop(wxString readcmd) {
-       wxString sendcmd, recvcmd, buf;
+       wxString sendcmd, recvcmd, buf, allmsgs;
        wxStringList xferbuf, msgbuf;
         int i, r;
        
@@ -110,14 +125,8 @@ void RoomView::do_readloop(wxString readcmd) {
                delete message_window;
                message_window = NULL;
        }
-       
-       message_window = new wxTextCtrl(
-               this,
-               -1,
-               "Loading messages...\n\n",
-               wxDefaultPosition, wxDefaultSize,
-               wxTE_MULTILINE | wxTE_READONLY
-               );
+
+       message_window = new wxHtmlWindow(this);
 
        wxLayoutConstraints *m1 = new wxLayoutConstraints;
        m1->top.Below(banner, 2);
@@ -141,16 +150,19 @@ void RoomView::do_readloop(wxString readcmd) {
 
 
        // Read the messages into the window, one at a time
-       message_window->SetValue(buf);
+       message_window->SetPage("<html><body>Loading...</body></html>");
+       allmsgs = "<HTML><BODY><CENTER><H1>List of Messages</H1></CENTER><HR>";
         for (i=0; i<xferbuf.Number(); ++i) {
                 buf.Printf("%s", (wxString *)xferbuf.Nth(i)->GetData());
                sendcmd = "MSG0 " + buf;
                r = citsock->serv_trans(sendcmd, recvcmd, msgbuf, ThisRoom);
                if (r == 1) {
                        ListToMultiline(buf, msgbuf);
-                       message_window->WriteText(buf);
-                       message_window->WriteText("\n\n");
+                       allmsgs += buf;
+                       allmsgs += "<HR>";
                }
+               allmsgs += "</HTML>";
+               message_window->SetPage(allmsgs);
         }
 }