]> code.citadel.org Git - citadel.git/commitdiff
Migrated utils.h into includes.hpp
authorArt Cancro <ajc@citadel.org>
Sun, 14 Mar 1999 23:19:19 +0000 (23:19 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 14 Mar 1999 23:19:19 +0000 (23:19 +0000)
Renamed utils.c to utils.cpp
Edited the makefile

daphne/Makefile
daphne/includes.hpp
daphne/main.cpp
daphne/userlogin.cpp
daphne/utils.c [deleted file]
daphne/utils.cpp [new file with mode: 0644]
daphne/utils.h [deleted file]

index 9fece33dd332247f2db4d588a967bf5376808b03..c73eaa07c0f46b6db3523dcb8c839a9ff4564b36 100644 (file)
@@ -22,8 +22,8 @@ testwindow.o: testwindow.cpp includes.hpp
 who.o: who.cpp includes.hpp
        c++ -c $(CFLAGS) who.cpp
 
-utils.o: utils.c includes.hpp
-       c++ -c $(CFLAGS) utils.c
+utils.o: utils.cpp includes.hpp
+       c++ -c $(CFLAGS) utils.cpp
 
 tcp_sockets.o: tcp_sockets.cpp includes.hpp
        c++ -c $(CFLAGS) tcp_sockets.cpp
index 064e122e658d3883875e691105c5f209da4f383f..17c1a7d3f603349a490a777c686223b270ebbdd6 100644 (file)
@@ -5,15 +5,13 @@
 #include <wx/wx.h>
 #include <wx/listctrl.h>
 #include <wx/socket.h>
-#include "utils.h"
 
 
 
 // Globals
 
 extern wxMDIParentFrame *BigMDI;
-
-
+extern wxTreeCtrl *RoomList;
 
 
 
@@ -196,3 +194,17 @@ private:
        void Notify(void);
 };
 
+
+
+
+// Stuff from utils.cpp
+
+void ListToMultiline(wxString& outputbuf, wxStringList inputlist);
+void MultilineToList(wxStringList& outputlist, wxString inputbuf);
+void extract(wxString& outputbuf, wxString inputbuf, int parmnum);
+void load_roomlist(wxTreeCtrl *tree, CitClient *citsock);
+
+
+
+
+
index 5797d530e80aefbd9929fd5ace6ed426f2bae50f..48d1273010f35b2eea68aa6a2ab855ed63f62faa 100644 (file)
@@ -22,6 +22,7 @@
 
 // Globals
 wxMDIParentFrame *BigMDI;
+wxTreeCtrl *RoomList;
 
 
 // ----------------------------------------------------------------------------
@@ -56,7 +57,6 @@ public:
 private:
        void OnUsersMenu(wxCommandEvent& cmd);
        void OnWindowMenu(wxCommandEvent& cmd);
-       wxTreeCtrl *RoomList;
        wxButton *do_cmd;
        void InitToolBar(wxToolBar* toolBar);
 
@@ -174,22 +174,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
                        wxDefaultValidator,
                        "RoomList");
 
-       RoomList->AddRoot(
-               "Room List",
-               -1,
-               -1,
-               NULL);
-
         wxLayoutConstraints *t2 = new wxLayoutConstraints;
         t2->top.SameAs(this, wxTop, 4);
         t2->left.SameAs(this, wxLeft, 0);
-       t2->right.PercentOf(this, wxWidth, 25);
+       t2->right.PercentOf(this, wxWidth, 20);
         t2->bottom.SameAs(this, wxBottom, 0);
         RoomList->SetConstraints(t2);
 
        wxLayoutConstraints *t3 = new wxLayoutConstraints;
        t3->top.SameAs(this, wxTop, 4);
-       t3->left.PercentOf(this, wxWidth, 25);
+       t3->left.PercentOf(this, wxWidth, 20);
        t3->right.SameAs(this, wxRight, 0);
        t3->bottom.SameAs(this, wxBottom, 0);
        wxMDIClientWindow *children = GetClientWindow();
index 0435f0bf11b84bcf12749832aadc843e88fbe6bf..ae2697b88f8dda941f7038c3f2e9e80a291830af 100644 (file)
@@ -283,4 +283,7 @@ void UserLogin::BeginSession(wxString serv_response) {
        citsock->GotoRoom("_BASEROOM_", "", junk);
 
        // FIX ... add code here to perform registration if necessary
+
+       load_roomlist(RoomList, citsock);
+       
 }
diff --git a/daphne/utils.c b/daphne/utils.c
deleted file mode 100644 (file)
index ccbee8a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// utils.c: utility functions not belonging to any particular class
-
-#include <wx/wx.h>
-#include "utils.h"
-
-
-// The following two functions convert between the wxStringList class used for
-// text transfers to and from the Citadel server, and the wxString class used
-// for the contents of a wxTextCtrl.
-
-
-void ListToMultiline(wxString& outputbuf, wxStringList inputlist) {
-       int i;
-       wxString buf;
-
-       outputbuf.Empty();
-       for (i=0; i<inputlist.Number(); ++i) {
-               buf.Printf("%s", (wxString *)inputlist.Nth(i)->GetData());
-               outputbuf.Append(buf);
-               outputbuf.Append("\n");
-       }
-}
-
-
-void MultilineToList(wxStringList& outputlist, wxString inputbuf) {
-       wxString buf;
-       int pos;
-       
-       buf = inputbuf;
-       outputlist.Clear();
-
-       while (buf.Length() > 0) {
-               // First try to locate a line break
-               pos = buf.Find('\n', FALSE);
-               if ( (pos >=0) && (pos < 256) ) {
-                       outputlist.Add(buf.Mid(0, pos-1));
-                       buf = buf.Mid(pos+1);
-               } else {
-               // Otherwise, try to find a space
-                       pos = buf.Mid(0, 256).Find(' ', TRUE);
-                       if ( (pos >=0) && (pos < 256) ) {
-                               outputlist.Add(buf.Mid(0, pos-1));
-                               buf = buf.Mid(pos+1);
-                       } else {
-                               pos = 255;
-                               outputlist.Add(buf.Mid(0, pos-1));
-                               buf = buf.Mid(pos);
-                       }
-               }
-       }
-}
-
-
-
-// Extract a field from a string returned by the server
-//
-void extract(wxString& outputbuf, wxString inputbuf, int parmnum) {
-       int a;
-       int p;
-       
-       outputbuf = inputbuf;
-
-       for (a=0; a<parmnum; ++a) {
-               p = outputbuf.First('|');
-               if (p >= 0) {
-                       outputbuf = outputbuf.Mid(p+1, 32767);
-               }
-       }
-
-       p = outputbuf.First('|');
-       if (p > 0) {
-               outputbuf = outputbuf.Mid(0, p);
-       }
-}
diff --git a/daphne/utils.cpp b/daphne/utils.cpp
new file mode 100644 (file)
index 0000000..43f0189
--- /dev/null
@@ -0,0 +1,92 @@
+// utility functions not belonging to any particular class
+
+#include <wx/wx.h>
+#include "includes.hpp"
+
+
+// The following two functions convert between the wxStringList class used for
+// text transfers to and from the Citadel server, and the wxString class used
+// for the contents of a wxTextCtrl.
+
+
+void ListToMultiline(wxString& outputbuf, wxStringList inputlist) {
+       int i;
+       wxString buf;
+
+       outputbuf.Empty();
+       for (i=0; i<inputlist.Number(); ++i) {
+               buf.Printf("%s", (wxString *)inputlist.Nth(i)->GetData());
+               outputbuf.Append(buf);
+               outputbuf.Append("\n");
+       }
+}
+
+
+void MultilineToList(wxStringList& outputlist, wxString inputbuf) {
+       wxString buf;
+       int pos;
+       
+       buf = inputbuf;
+       outputlist.Clear();
+
+       while (buf.Length() > 0) {
+               // First try to locate a line break
+               pos = buf.Find('\n', FALSE);
+               if ( (pos >=0) && (pos < 256) ) {
+                       outputlist.Add(buf.Mid(0, pos-1));
+                       buf = buf.Mid(pos+1);
+               } else {
+               // Otherwise, try to find a space
+                       pos = buf.Mid(0, 256).Find(' ', TRUE);
+                       if ( (pos >=0) && (pos < 256) ) {
+                               outputlist.Add(buf.Mid(0, pos-1));
+                               buf = buf.Mid(pos+1);
+                       } else {
+                               pos = 255;
+                               outputlist.Add(buf.Mid(0, pos-1));
+                               buf = buf.Mid(pos);
+                       }
+               }
+       }
+}
+
+
+
+// Extract a field from a string returned by the server
+//
+void extract(wxString& outputbuf, wxString inputbuf, int parmnum) {
+       int a;
+       int p;
+       
+       outputbuf = inputbuf;
+
+       for (a=0; a<parmnum; ++a) {
+               p = outputbuf.First('|');
+               if (p >= 0) {
+                       outputbuf = outputbuf.Mid(p+1, 32767);
+               }
+       }
+
+       p = outputbuf.First('|');
+       if (p > 0) {
+               outputbuf = outputbuf.Mid(0, p);
+       }
+}
+
+
+
+// Load a tree with a room list
+//
+void load_roomlist(wxTreeCtrl *tree, CitClient *citsock) {
+
+       // First, clear it out.
+       tree->DeleteAllItems();
+
+       // Set the root with the name of the Citadel server.
+       tree->AddRoot(
+               citsock->HumanNode,
+               -1,     // FIX use an "earth" pixmap here
+               -1,
+               NULL);
+
+}
diff --git a/daphne/utils.h b/daphne/utils.h
deleted file mode 100644 (file)
index 2b613da..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-void ListToMultiline(wxString& outputbuf, wxStringList inputlist);
-void MultilineToList(wxStringList& outputlist, wxString inputbuf);
-void extract(wxString& outputbuf, wxString inputbuf, int parmnum);