]> code.citadel.org Git - citadel.git/commitdiff
Rudimentary support for starting a read operation
authorArt Cancro <ajc@citadel.org>
Sat, 27 Mar 1999 04:24:14 +0000 (04:24 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 27 Mar 1999 04:24:14 +0000 (04:24 +0000)
daphne/includes.hpp
daphne/roomtree.cpp
daphne/roomview.cpp
daphne/userlogin.cpp

index e79f1812c6aed9cf71ea93559a253d1ef5bf1bb2..bfb656586733871a9b48518ebbd02241e43b5d9a 100644 (file)
@@ -218,7 +218,13 @@ class RoomView : public wxMDIChildFrame {
 public:
        RoomView(CitClient *sock, wxMDIParentFrame *MyMDI, wxString roomname);
 private:
+       void OnButtonPressed(wxCommandEvent& whichbutton);
        CitClient *citsock;
+       DECLARE_EVENT_TABLE()
+       void do_readloop(wxString readcmd);
+       wxTextCtrl *message_window;
+        wxPanel *banner;
+        wxButton *close_button;
 };
 
 
index bef684a3a955bf0f45e671f27976ae8c011dbc4a..e07d87274bce9bc20cf5e6a9234315d75fe0382c 100644 (file)
@@ -155,7 +155,6 @@ void RoomTree::OnDoubleClick(wxTreeEvent& evt) {
        // Ok, it's a room, so go there.
        r = (RoomItem *)GetItemData(itemId);
 
-       cout << r->RoomName << "\n";
        new RoomView(citsock, citMyMDI, r->RoomName);
 }
 
index aab794cb000b92c730780b643fd2327f30185945..50428bc70feaacffd2f3f86ae51c565e074acd4e 100644 (file)
@@ -1,5 +1,18 @@
 #include "includes.hpp"
 
+
+enum {
+       BUTTON_CLOSE,
+       BUTTON_READNEW
+};
+
+
+BEGIN_EVENT_TABLE(RoomView, wxMDIChildFrame)
+       EVT_BUTTON(     BUTTON_CLOSE,           RoomView::OnButtonPressed)
+       EVT_BUTTON(     BUTTON_READNEW,         RoomView::OnButtonPressed)
+END_EVENT_TABLE()
+
+
 // frame constructor
 RoomView::RoomView(
        CitClient *sock, wxMDIParentFrame *MyMDI, wxString roomname)
@@ -15,6 +28,8 @@ RoomView::RoomView(
        wxString sendcmd, recvcmd;
 
        citsock = sock;
+       message_window = NULL;
+
 
        if (citsock->GotoRoom(roomname, "", recvcmd) != 2) {
                delete this;
@@ -24,4 +39,99 @@ RoomView::RoomView(
        SetAutoLayout(TRUE);
        Show(TRUE);
 
+       // Set up a top panel for the room banner...
+       banner = new wxPanel(this, -1);
+       banner->SetBackgroundColour(wxColour(0x00, 0x00, 0x77));
+       banner->SetForegroundColour(wxColour(0xFF, 0xFF, 0x00));
+       wxLayoutConstraints *b1 = new wxLayoutConstraints;
+       b1->top.SameAs(this, wxTop, 2);
+       b1->left.SameAs(this, wxLeft, 2);
+       b1->right.SameAs(this, wxRight, 2);
+       b1->height.PercentOf(this, wxHeight, 25);
+       banner->SetConstraints(b1);
+
+       wxStaticText *rname = new wxStaticText(banner, -1, roomname);
+       rname->SetFont(wxFont(18, wxDEFAULT, wxNORMAL, wxNORMAL));
+       rname->SetForegroundColour(wxColour(0xFF, 0xFF, 0x00));
+       wxLayoutConstraints *b2 = new wxLayoutConstraints;
+       b2->top.SameAs(banner, wxTop, 1);
+       b2->left.SameAs(banner, wxLeft, 1);
+       b2->width.AsIs();
+       b2->height.AsIs();
+       rname->SetConstraints(b2);
+
+       close_button = new wxButton(
+               this,
+               BUTTON_CLOSE,
+               " Close ",
+               wxDefaultPosition);
+
+       wxLayoutConstraints *c1 = new wxLayoutConstraints;
+       c1->bottom.SameAs(this, wxBottom, 2);
+       c1->height.AsIs();
+       c1->width.AsIs();
+       c1->right.SameAs(this, wxRight, 2);
+       close_button->SetConstraints(c1);
+
+       wxButton *readnew_button = new wxButton(
+               this,
+               BUTTON_READNEW,
+               " Read new messages ",
+               wxDefaultPosition);
+
+       wxLayoutConstraints *c2 = new wxLayoutConstraints;
+       c2->top.SameAs(close_button, wxTop);
+       c2->bottom.SameAs(close_button, wxBottom);
+       c2->width.AsIs();
+       c2->right.LeftOf(close_button, 5);
+       readnew_button->SetConstraints(c2);
+
+
+}
+
+
+
+void RoomView::OnButtonPressed(wxCommandEvent& whichbutton) {
+       if (whichbutton.GetId() == BUTTON_CLOSE) {
+               delete this;
+       }
+
+       if (whichbutton.GetId() == BUTTON_READNEW) {
+               do_readloop("MSGS NEW");
+       }
+}
+
+
+void RoomView::do_readloop(wxString readcmd) {
+       wxString sendcmd, recvcmd, buf;
+       wxStringList xferbuf;
+       
+       if (message_window != NULL) {
+               delete message_window;
+               message_window = NULL;
+       }
+       
+       message_window = new wxTextCtrl(
+               this,
+               -1,
+               "Loading messages...\n\n",
+               wxDefaultPosition, wxDefaultSize,
+               wxTE_MULTILINE | wxTE_READONLY
+               );
+
+       wxLayoutConstraints *m1 = new wxLayoutConstraints;
+       m1->top.Below(banner, 2);
+       m1->bottom.Above(close_button, -2);
+       m1->left.SameAs(this, wxLeft, 2);
+       m1->right.SameAs(this, wxRight, 2);
+       message_window->SetConstraints(m1);
+
+       sendcmd = readcmd;
+       if (citsock->serv_trans(sendcmd, recvcmd, xferbuf) != 1) {
+               message_window->SetValue(recvcmd.Mid(4,32767));
+               return;
+       }
+
+       ListToMultiline(buf, xferbuf);
+       message_window->SetValue(buf);
 }
index 37b1d21d3a3a05db1cfec6a2e6ae7fac0056a942..0e2eb76d821ec6c75c3392762d260a6859456e6c 100644 (file)
@@ -57,6 +57,7 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
 
        wxString sendcmd, recvcmd;
        wxStringList xferbuf;
+       wxPanel *banner;
 
        citsock = sock;
        citMyMDI = MyMDI;
@@ -135,23 +136,38 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
                wxTE_MULTILINE | wxTE_READONLY,
                wxDefaultValidator, "");
 
-       wxStaticText *humannode = new wxStaticText(
-               this, -1, citsock->HumanNode,
-               wxDefaultPosition, wxDefaultSize, 0, "");
-       humannode->SetBackgroundColour(wxColour(0x00, 0x00, 0x77));
-       humannode->SetForegroundColour(wxColour(0xFF, 0xFF, 0x00));
-       /*humannode->SetFont(wxFont(24, wxDEFAULT, wxNORMAL, wxNORMAL,
-                               FALSE, ""));*/
+
+
+        // Set up a panel for the title...
+        banner = new wxPanel(this, -1);
+        banner->SetBackgroundColour(wxColour(0x00, 0x00, 0x77));
+        banner->SetForegroundColour(wxColour(0xFF, 0xFF, 0x00));
+        wxLayoutConstraints *b1 = new wxLayoutConstraints;
+        b1->top.SameAs(this, wxTop, 2);
+        b1->left.SameAs(this, wxLeft, 2);
+        b1->right.SameAs(this, wxRight, 2);
+        b1->height.PercentOf(this, wxHeight, 25);
+        banner->SetConstraints(b1);
 
        wxLayoutConstraints *t1 = new wxLayoutConstraints;
-       t1->top.SameAs(this, wxTop, 10);
+       t1->top.SameAs(this, wxTop, 5);
+       t1->left.SameAs(this, wxLeft, 5);
+       t1->right.SameAs(this, wxRight, 5);
        t1->height.AsIs();
-       t1->centreX.SameAs(this, wxCentreX);
-       t1->width.AsIs();
-       humannode->SetConstraints(t1);
+       banner->SetConstraints(t1);
+
+        wxStaticText *rname = new wxStaticText(banner, -1, citsock->HumanNode);
+        rname->SetFont(wxFont(18, wxDEFAULT, wxNORMAL, wxNORMAL));
+        rname->SetForegroundColour(wxColour(0xFF, 0xFF, 0x00));
+        wxLayoutConstraints *t2 = new wxLayoutConstraints;
+        t2->top.SameAs(banner, wxTop, 1);
+        t2->centreX.SameAs(banner, wxCentreX);
+        t2->width.SameAs(banner, wxWidth);
+        t2->height.AsIs();
+        rname->SetConstraints(t2);
 
        wxLayoutConstraints *h0 = new wxLayoutConstraints;
-       h0->top.Below(humannode, 10);
+       h0->top.Below(banner, 10);
        h0->bottom.Above(username, -10);
        h0->left.SameAs(this, wxLeft, 10);
        h0->right.SameAs(this, wxRight, 10);