work on drawserv from 3/16/04 thru 4/30/04

[email protected] Fri, 30 Apr 2004 09:31:57 -0700
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <[email protected]>
--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040430-johnston-081"
Content-Disposition: attachment;
	filename=ivtools-040430-johnston-081

Patch:    ivtools-040430-johnston-081
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.8 ComTerp/comhandler.c:1.9
*** ComTerp/comhandler.c:1.8	Mon Mar 22 11:21:02 2004
--- src/ComTerp/comhandler.c	Fri Apr 30 09:26:10 2004
***************
*** 217,223 ****
        comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs;
  
        int  status = comterp_->ComTerp::run(false /* !once */, false /* !nested */);
!       return input_good&&status==0 ? 0 : -1;
      } else {
        if (inbuf[0]!='\004')
  	cout << inbuf << "\n";
--- 217,223 ----
        comterp_->_outfunc = (outfuncptr)&ComTerpServ::fd_fputs;
  
        int  status = comterp_->ComTerp::run(false /* !once */, false /* !nested */);
!       return input_good&&(status==0||status==3) ? 0 : -1;
      } else {
        if (inbuf[0]!='\004')
  	cout << inbuf << "\n";
Index: ComTerp/comterp.c
diff -c ComTerp/comterp.c:1.4 ComTerp/comterp.c:1.5
*** ComTerp/comterp.c:1.4	Wed Feb 18 09:29:10 2004
--- src/ComTerp/comterp.c	Fri Apr 30 09:26:11 2004
***************
*** 896,901 ****
--- 896,902 ----
  #endif
    ostream out(&fbuf);
    boolean eolflag = false;
+   boolean errorflag = false;
  
    while (!eof() && !quitflag() && !eolflag) {
      
***************
*** 922,927 ****
--- 923,929 ----
      } else {
        err_str( _errbuf, BUFSIZ, "comterp" );
        if (strlen(_errbuf)>0) {
+ 	errorflag = true;
  	out << _errbuf << "\n"; out.flush();
  	strcpy(errbuf_save, _errbuf);
  	_errbuf[0] = '\0';
***************
*** 935,940 ****
--- 937,943 ----
      if (one_expr) break;
    }
    if (status==1 && _pfnum==0) status=2;
+   if (status==1 && !errorflag) status=3;
    if (nested && status!=2) _stack_top--;
    return status;
  }
Index: ComTerp/comterp.h
diff -c ComTerp/comterp.h:1.1 ComTerp/comterp.h:1.2
*** ComTerp/comterp.h:1.1	Fri Jan  9 11:42:26 2004
--- src/ComTerp/comterp.h	Fri Apr 30 09:26:11 2004
***************
*** 158,165 ****
      // run interpreter until end-of-file or quit command, unless 
      // 'one_expr' is true.  Leave 'one_expr' false when using a ComTerpServ.
      // Return Value:  -1 if eof, 0 if normal operation, 1 if 
!     // partial expression parsed, 2 if no result computed.  'nested' indicates
!     // contents of stack should be preserved.
  
      virtual int runfile(const char* filename);
      // run interpreter on contents of 'filename'.
--- 158,165 ----
      // run interpreter until end-of-file or quit command, unless 
      // 'one_expr' is true.  Leave 'one_expr' false when using a ComTerpServ.
      // Return Value:  -1 if eof, 0 if normal operation, 1 if 
!     // partial expression parsed, 2 if no result computed, 3 if error in parsing.  
!     // 'nested' indicates contents of stack should be preserved.
  
      virtual int runfile(const char* filename);
      // run interpreter on contents of 'filename'.
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.27 DrawServ/drawfunc.c:1.28
*** DrawServ/drawfunc.c:1.27	Fri Apr  2 12:55:02 2004
--- src/DrawServ/drawfunc.c	Fri Apr 30 09:26:36 2004
***************
*** 62,72 ****
    static int close_sym = symbol_add("close");
    ComValue closev(stack_key(close_sym));
    static int pid_sym = symbol_add("pid");
!   ComValue pidv(stack_key(close_sym));
    static int sid_sym = symbol_add("sid");
!   ComValue sidv(stack_key(close_sym));
    static int user_sym = symbol_add("user");
!   ComValue userv(stack_key(close_sym));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
--- 62,72 ----
    static int close_sym = symbol_add("close");
    ComValue closev(stack_key(close_sym));
    static int pid_sym = symbol_add("pid");
!   ComValue pidv(stack_key(pid_sym));
    static int sid_sym = symbol_add("sid");
!   ComValue sidv(stack_key(sid_sym));
    static int user_sym = symbol_add("user");
!   ComValue userv(stack_key(user_sym));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 84,90 ****
--- 84,94 ----
      if (statev.int_val()==DrawLink::one_way && 
  	((DrawServ*)unidraw)->cycletest
  	(sidv.uint_val(), hostv.string_ptr(), userv.string_ptr(), pidv.int_val())) {
+ #if 1
        comterp()->quit();
+ #else
+       comterp()->handler()->destroy();
+ #endif
        return;
      }
      
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.17 DrawServ/drawlink.c:1.18
*** DrawServ/drawlink.c:1.17	Fri Apr  2 12:55:02 2004
--- src/DrawServ/drawlink.c	Fri Apr 30 09:26:36 2004
***************
*** 81,86 ****
--- 81,87 ----
      ACE_ERROR ((LM_ERROR, "%p\n", "open"));
      return -1;
    } else {
+     _socket->enable(ACE_NONBLOCK);
      fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
      ostream out(&obuf);
      out << "drawlink(\"";
Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.8 DrawServ/drawlinklist.c:1.9
*** DrawServ/drawlinklist.c:1.8	Fri Apr  2 12:55:02 2004
--- src/DrawServ/drawlinklist.c	Fri Apr 30 09:26:36 2004
***************
*** 29,34 ****
--- 29,35 ----
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/grid.h>
+ #include <DrawServ/sid.h>
  
  #include <Unidraw/iterator.h>
  #include <Unidraw/ulist.h>
***************
*** 61,67 ****
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    void* ptr = nil;
    ((DrawServ*)unidraw)->sessionidtable()->find(ptr, grid->selector());
!   return (DrawLink*)ptr;
  }
  
  DrawLink* DrawLinkList::Link (UList* r) {
--- 62,69 ----
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    void* ptr = nil;
    ((DrawServ*)unidraw)->sessionidtable()->find(ptr, grid->selector());
!   SessionId* sessionid = (SessionId*)ptr;
!   return (DrawLink*) (sessionid ? sessionid->drawlink() : nil);
  }
  
  DrawLink* DrawLinkList::Link (UList* r) {
*** /dev/null	 Fri Apr 30 09:26:49 PDT 2004
--- patches/ivtools-040430-johnston-081
*************** patches/ivtools-040430-johnston-081
*** 0 ****
--- 1 ----
+ ivtools-040430-johnston-081

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040402-johnston-080"
Content-Disposition: attachment;
	filename=ivtools-040402-johnston-080

Patch:    ivtools-040402-johnston-080
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: AttrGlyph/attredit.c
diff -c AttrGlyph/attredit.c:1.1 AttrGlyph/attredit.c:1.2
*** AttrGlyph/attredit.c:1.1	Fri Jan  9 11:44:27 2004
--- src/AttrGlyph/attredit.c	Fri Apr  2 12:54:56 2004
***************
*** 40,45 ****
--- 40,46 ----
  #include <OS/string.h>
  
  #include <IVGlyph/textedit.h>
+ #include <IVGlyph/textview.h>
  
  #include <strstream>
  #include <string.h>
***************
*** 73,78 ****
--- 74,80 ----
      s->attribute("columns", "30");
      _ete = new EivTextEditor(s, false);
      _ete->ref();
+     _ete->textview()->disable_caret();
      build();
  }
  
***************
*** 159,164 ****
--- 161,167 ----
  #else
              vbuf.push_back(' ');
  	vbuf.push_back('\n');
+ 	vbuf.push_back('\0');
  #endif
  
      }
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.26 DrawServ/drawfunc.c:1.27
*** DrawServ/drawfunc.c:1.26	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawfunc.c	Fri Apr  2 12:55:02 2004
***************
*** 61,66 ****
--- 61,72 ----
    ComValue ridv(stack_key(rid_sym));
    static int close_sym = symbol_add("close");
    ComValue closev(stack_key(close_sym));
+   static int pid_sym = symbol_add("pid");
+   ComValue pidv(stack_key(close_sym));
+   static int sid_sym = symbol_add("sid");
+   ComValue sidv(stack_key(close_sym));
+   static int user_sym = symbol_add("user");
+   ComValue userv(stack_key(close_sym));
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 73,78 ****
--- 79,92 ----
  
    /* creating a new link to remote drawserv */
    if (hostv.is_string() && portv.is_known() && statev.is_known()) {
+ 
+     /* cast of this link if it is a duplicate or cycle */
+     if (statev.int_val()==DrawLink::one_way && 
+ 	((DrawServ*)unidraw)->cycletest
+ 	(sidv.uint_val(), hostv.string_ptr(), userv.string_ptr(), pidv.int_val())) {
+       comterp()->quit();
+       return;
+     }
      
      const char* hoststr = hostv.string_ptr();
      const char* portstr = portv.is_string() ? portv.string_ptr() : nil;
***************
*** 223,226 ****
      ((DrawServ*)unidraw)->print_gridtable();
    }
  }
- 
--- 237,239 ----
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.16 DrawServ/drawlink.c:1.17
*** DrawServ/drawlink.c:1.16	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawlink.c	Fri Apr  2 12:55:02 2004
***************
*** 28,33 ****
--- 28,34 ----
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
+ #include <DrawServ/sid.h>
  #include <Unidraw/globals.h>
  #include <fstream.h>
  #include <unistd.h>
***************
*** 85,95 ****
--- 86,105 ----
      out << "drawlink(\"";
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
+     unsigned int sid = ((DrawServ*)unidraw)->sessionid();
+     void* ptr = nil;
+     ((DrawServ*)unidraw)->sessionidtable()->find(ptr, sid);
+     SessionId* sessionid = (SessionId*)ptr;
      out << buffer << "\"";
      out << " :port " << ((DrawServ*)unidraw)->comdraw_port();
      out << " :state " << _state+1;
      out << " :rid " << _local_linkid;
      out << " :lid " << _remote_linkid;
+     out << " :sid " << sid;
+     if (sessionid) {
+       out << " :pid " << sessionid->pid();
+       out << " :user \"" << sessionid->username() << "\"";
+     }
      out << ")\n";
      out.flush();
      _ok = true;
***************
*** 115,126 ****
--- 125,138 ----
    delete _host;
    _host = nil;
    if (host) _host = strnew(host);
+   notify();
  }
  
  void DrawLink::althostname(const char* althost) {
    delete _althost;
    _althost = nil;
    if (althost) _althost = strnew(althost);
+   notify();
  }
  
  int DrawLink::handle() {
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.12 DrawServ/drawlink.h:1.13
*** DrawServ/drawlink.h:1.12	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawlink.h	Fri Apr  2 12:55:02 2004
***************
*** 27,32 ****
--- 27,34 ----
  #ifndef drawlink_h
  #define drawlink_h
  
+ #include <InterViews/observe.h>
+ 
  class DrawServ;
  class DrawServHandler;
  
***************
*** 43,54 ****
  #endif
  
  //: object to encapsulate 2-way link with remote drawserv
! class DrawLink {
  public:
      DrawLink(const char* hostname, int portnum, int state);
      virtual ~DrawLink();
  
!     enum { new_link=0, one_way, two_way };
  
      const char* hostname() { return _host; }
      // return name of remote host
--- 45,56 ----
  #endif
  
  //: object to encapsulate 2-way link with remote drawserv
! class DrawLink : public Observable {
  public:
      DrawLink(const char* hostname, int portnum, int state);
      virtual ~DrawLink();
  
!     enum { new_link=0, one_way, two_way, redundant };
  
      const char* hostname() { return _host; }
      // return name of remote host
***************
*** 99,105 ****
      IncomingSidTable* incomingsidtable() { return _incomingsidtable; }
      // return pointer to table mapping incoming sessionid's to locally unique sessionid's
  
!     void state(int val) { _state = val; }
      // set state of DrawLink
  
      int state() { return _state; }
--- 101,107 ----
      IncomingSidTable* incomingsidtable() { return _incomingsidtable; }
      // return pointer to table mapping incoming sessionid's to locally unique sessionid's
  
!     void state(int val) { _state = val; notify(); }
      // set state of DrawLink
  
      int state() { return _state; }
Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.7 DrawServ/drawlinklist.c:1.8
*** DrawServ/drawlinklist.c:1.7	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawlinklist.c	Fri Apr  2 12:55:02 2004
***************
*** 73,105 ****
--- 73,118 ----
  void DrawLinkList::Append (DrawLink* v) {
      _ulist->Append(new UList(v));
      ++_count;
+     v->attach(this);
+     notify();
  }
  
  void DrawLinkList::Prepend (DrawLink* v) {
      _ulist->Prepend(new UList(v));
      ++_count;
+     v->attach(this);
+     notify();
  }
  
  void DrawLinkList::InsertAfter (Iterator i, DrawLink* v) {
      Elem(i)->Prepend(new UList(v));
      ++_count;
+     v->attach(this);
+     notify();
  }
  
  void DrawLinkList::InsertBefore (Iterator i, DrawLink* v) {
      Elem(i)->Append(new UList(v));
      ++_count;
+     v->attach(this);
+     notify();
  }
  
  void DrawLinkList::Remove (Iterator& i) {
+     GetDrawLink(i)->detach(this);
+ 
      UList* doomed = Elem(i);
  
      Next(i);
      _ulist->Remove(doomed);
      delete doomed;
      --_count;
+     notify();
  }	
      
  void DrawLinkList::Remove (DrawLink* p) {
+     p->detach(this);
+ 
      UList* temp;
  
      if ((temp = _ulist->Find(p)) != nil) {
***************
*** 107,112 ****
--- 120,126 ----
          delete temp;
  	--_count;
      }
+     notify();
  }
  
  DrawLink* DrawLinkList::GetDrawLink (Iterator i) { return Link(Elem(i)); }
Index: DrawServ/drawlinklist.h
diff -c DrawServ/drawlinklist.h:1.5 DrawServ/drawlinklist.h:1.6
*** DrawServ/drawlinklist.h:1.5	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawlinklist.h	Fri Apr  2 12:55:02 2004
***************
*** 31,43 ****
  //: UList based list of DrawLink's
  
  #include <Unidraw/globals.h>
  
  class DrawLink;
  class GraphicId;
  class Iterator;
  class UList;
  
! class DrawLinkList {
  public:
      DrawLinkList();
      virtual ~DrawLinkList();
--- 31,44 ----
  //: UList based list of DrawLink's
  
  #include <Unidraw/globals.h>
+ #include <InterViews/observe.h>
  
  class DrawLink;
  class GraphicId;
  class Iterator;
  class UList;
  
! class DrawLinkList : public Observable, Observer {
  public:
      DrawLinkList();
      virtual ~DrawLinkList();
***************
*** 88,93 ****
--- 89,96 ----
      DrawLink* Link(UList*);
      // return DrawLink pointed to by UList (UList).
  
+     virtual void update(Observable* obs) { notify(); }
+     // invoked when DrawLink is updated
  protected:
      void Remove(Iterator&);
      // remove DrawLink pointed to by iterator from the list, 
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.48 DrawServ/drawserv.c:1.49
*** DrawServ/drawserv.c:1.48	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawserv.c	Fri Apr  2 12:55:02 2004
***************
*** 93,98 ****
--- 93,99 ----
    int hostid = gethostid();
    SessionId* sid = new SessionId(_sessionid, _sessionid, pid, username, hostbuf, hostid);
    _sessionidtable->insert(_sessionid, sid);
+ 
    _comdraw_port = atoi(unidraw->GetCatalog()->GetAttribute("comdraw"));
  }
  
***************
*** 189,205 ****
    return link;
  }
  
  void DrawServ::linkdump(FILE* fptr) {
!   fprintf(fptr, "Host                            Alt.                            Port    LID  RID\n");
!   fprintf(fptr, "------------------------------  ------------------------------  ------  ---  ---\n");
    if (_linklist) {
      Iterator i;
      _linklist->First(i);
      while(!_linklist->Done(i)) {
        DrawLink* link = _linklist->GetDrawLink(i);
!       fprintf(fptr, "%-30.30s  %-30.30s  %-6d  %-3d  %-3d\n", 
  	      link->hostname(), link->althostname(), link->portnum(),
! 	      link->local_linkid(), link->remote_linkid());
        _linklist->Next(i);
      }
    }
--- 190,221 ----
    return link;
  }
  
+ DrawLink* DrawServ::linkget(const char* hostname, int portnum) {
+   DrawLink* link = nil;
+   if (_linklist) {
+     Iterator(i);
+     _linklist->First(i);
+     while (!_linklist->Done(i) && !link) {
+       DrawLink* l = _linklist->GetDrawLink(i);
+       if (strcmp(l->hostname(),hostname)==0 && l->portnum()==portnum)
+ 	link = l;
+       _linklist->Next(i);
+     }
+   }
+   return link;
+ }
+ 
  void DrawServ::linkdump(FILE* fptr) {
!   fprintf(fptr, "Host                            Alt.                            Port    LID  RID  State\n");
!   fprintf(fptr, "------------------------------  ------------------------------  ------  ---  ---  -----\n");
    if (_linklist) {
      Iterator i;
      _linklist->First(i);
      while(!_linklist->Done(i)) {
        DrawLink* link = _linklist->GetDrawLink(i);
!       fprintf(fptr, "%-30.30s  %-30.30s  %-6d  %-3d  %-3d  %-3d\n", 
  	      link->hostname(), link->althostname(), link->portnum(),
! 	      link->local_linkid(), link->remote_linkid(), link->state());
        _linklist->Next(i);
      }
    }
***************
*** 411,420 ****
      seed = time(nil) & (time(nil) << 16);
      srand(seed);
    }
!   int retval;
    do {
      static int flip=0;
!     while ((retval=rand()&GraphicIdMask)==0);
  
    } while (!test_grid(retval));
    return retval;
--- 427,436 ----
      seed = time(nil) & (time(nil) << 16);
      srand(seed);
    }
!   unsigned int retval;
    do {
      static int flip=0;
!     while ((retval=rand()&GraphicIdMask)<=1);
  
    } while (!test_grid(retval));
    return retval;
***************
*** 554,556 ****
--- 570,592 ----
      it.next();
    }
  }
+ 
+ boolean DrawServ::cycletest(unsigned int sid, const char* host,
+ 			    const char* user, int pid) 
+ {
+   boolean found = false;
+   SessionIdTable* table = sessionidtable();
+   SessionIdTable_Iterator it(*table);
+   while(it.more() && !found) {
+     SessionId* sessionid = (SessionId*)it.cur_value();
+     if (sessionid->osid()==sid) {
+       if (strcmp(host, sessionid->hostname())==0 && 
+ 	  strcmp(user, sessionid->username())==0 &&
+ 	  pid==sessionid->pid())
+ 	found = true;
+     }
+     it.next();
+   }
+   return found;
+ }
+ 
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.24 DrawServ/drawserv.h:1.25
*** DrawServ/drawserv.h:1.24	Fri Apr  2 12:53:12 2004
--- src/DrawServ/drawserv.h	Fri Apr  2 12:55:02 2004
***************
*** 72,77 ****
--- 72,80 ----
    
    DrawLink* linkget(int local_id, int remote_id=-1);
    // return pointer to existing DrawLink
+ 
+   DrawLink* linkget(const char* hostname, int portnum);
+   // return pointer to existing DrawLink
    
    void linkdump(FILE*);
    // dump text table of DrawLink's
***************
*** 92,98 ****
    // return pointer to table of GraphicId's.
    
    SessionIdTable* sessionidtable() { return _sessionidtable; }
!   // return pointer to table of SessionId's
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
--- 95,101 ----
    // return pointer to table of GraphicId's.
    
    SessionIdTable* sessionidtable() { return _sessionidtable; }
!   // return pointer to table of session id's that map to SessionId's
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
***************
*** 149,154 ****
--- 152,159 ----
    int comdraw_port() { return _comdraw_port; }
    // return port used for comdraw command interpreter
  
+   boolean cycletest(unsigned int sid, const char* host, const char* user, int pid);
+ 
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
***************
*** 157,163 ****
      // maps from id to GraphicId*
      SessionIdTable* _sessionidtable;
      // table of all session id's.
!     // maps from id to SessionId*
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
--- 162,168 ----
      // maps from id to GraphicId*
      SessionIdTable* _sessionidtable;
      // table of all session id's.
!     // maps from session id to SessionId*
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.19 DrawServ/linkselection.c:1.20
*** DrawServ/linkselection.c:1.19	Fri Apr  2 12:53:12 2004
--- src/DrawServ/linkselection.c	Fri Apr  2 12:55:02 2004
***************
*** 65,77 ****
--- 65,81 ----
  }
  
  void LinkSelection::Update(Viewer* viewer) {
+ #if 0
    fprintf(stderr, "LinkSelection::Update\n");
+ #endif
    Reserve();
    OverlaySelection::Update(viewer);
  }
  
  void LinkSelection::Clear(Viewer* viewer) {
+ #if 0
    fprintf(stderr, "LinkSelection::Clear\n");
+ #endif
  #if 0
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
    Iterator it;
***************
*** 98,104 ****
--- 102,110 ----
  }
  
  void LinkSelection::Reserve() {
+ #if 0
    fprintf(stderr, "LinkSelection::Reserve\n");
+ #endif
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
    /* clear anything that was in the previous selection, but not in this one */
Index: DrawServ/rcdialog.c
diff -c DrawServ/rcdialog.c:1.4 DrawServ/rcdialog.c:1.5
*** DrawServ/rcdialog.c:1.4	Fri Apr  2 12:53:12 2004
--- src/DrawServ/rcdialog.c	Fri Apr  2 12:55:02 2004
***************
*** 27,42 ****
--- 27,56 ----
   * RemoteConnectDialog related classes
   */
  
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/rcdialog.h>
  
  #include <Unidraw/editor.h>
+ #include <Unidraw/iterator.h>
  
  #include <IVGlyph/stredit.h>
+ #include <IVGlyph/textedit.h>
+ #include <IVGlyph/textview.h>
  
+ #include <IV-look/dialogs.h>
+ #include <IV-look/kit.h>
+ 
+ #include <InterViews/font.h>
+ #include <InterViews/layout.h>
+ #include <InterViews/patch.h>
+ #include <InterViews/style.h>
  #include <InterViews/window.h>
  
  #include <stdio.h>
+ #include <stdlib.h>
+ #include <vector.h>
  
  /*****************************************************************************/
  
***************
*** 45,50 ****
--- 59,65 ----
  }
  
  void RemoteConnectPopupAction::execute() {
+ #if 0
    StrEditDialog::accept_custom("Connect");
    StrEditDialog::cancel_custom("Close");
    StrEditDialog* dialog =
***************
*** 53,58 ****
--- 68,79 ----
       "Enter host name to connect:                  ", "localhost", nil, nil, true);
  
    StrEditDialog::action_custom(new RemoteConnectAction(dialog), nil);
+ #else
+     WidgetKit& kit = *WidgetKit::instance();
+     ConnectionsDialog* dlog = new ConnectionsDialog(((DrawServ*)unidraw)->linklist(), &kit, kit.style());
+     dlog->ref();
+     dlog->map_for(_editor->GetWindow());
+ #endif
  }
  
  /*****************************************************************************/
***************
*** 68,70 ****
--- 89,343 ----
  
  }
  
+ /*****************************************************************************/
+ 
+ declareActionCallback(ConnectionsDialogImpl)
+ implementActionCallback(ConnectionsDialogImpl)
+ declareFieldEditorCallback(ConnectionsDialogImpl)
+ implementFieldEditorCallback(ConnectionsDialogImpl)
+ 
+ class ConnectionsDialogImpl : public Observer {
+ public:
+   virtual void update(Observable* obs);
+ private:
+ friend class ConnectionsDialog;
+ 
+     WidgetKit* kit_;
+     Style* style_;
+     ConnectionsDialog* dialog_;
+     DrawLinkList* list_;
+     Patch* patch_;
+     EivTextEditor* ete_;
+     FieldEditor* hostfe_;
+     FieldEditor* portfe_;
+ 
+     void init(DrawLinkList*, ConnectionsDialog*, Style*);
+     void free();
+     void build(DrawLinkList*);
+     void connect();
+     void disconnect();
+     void close();
+     const char* value();
+     void value(const char*, boolean update);
+     void clear();
+     Patch* table_patch(DrawLinkList*);
+     void fe_add(FieldEditor*);
+     void fe_clr(FieldEditor*);
+     void update_text(boolean);
+ };
+ 
+ ConnectionsDialog::ConnectionsDialog(DrawLinkList* list, WidgetKit* kit, Style* s) 
+ : Dialog(nil, s)
+ {
+   impl_ = new ConnectionsDialogImpl;
+   ConnectionsDialogImpl& adi = *impl_;
+   adi.kit_ = kit;
+   adi.init(list, this, s);
+ }
+ 
+ ConnectionsDialog::~ConnectionsDialog() {
+   impl_->free();
+   delete impl_;
+ }
+ 
+ /** class ConnectionsDialogImpl **/
+ 
+ void ConnectionsDialogImpl::init(DrawLinkList* list, ConnectionsDialog* p, Style* s) {
+ 
+   list->attach(this);
+ 
+   dialog_ = p;
+   style_ = s;
+   list_ = list;
+ 
+   DialogKit& dk = *DialogKit::instance();
+   WidgetKit& wk = *WidgetKit::instance();
+ 
+   hostfe_ = dk.field_editor("", wk.style(), 
+ 			    new FieldEditorCallback(ConnectionsDialogImpl)
+ 			    (this, &ConnectionsDialogImpl::fe_add, 
+ 			     &ConnectionsDialogImpl::fe_clr));
+   portfe_ = dk.field_editor("", wk.style(),
+ 			    new FieldEditorCallback(ConnectionsDialogImpl)
+ 			    (this, &ConnectionsDialogImpl::fe_add, 
+ 			     &ConnectionsDialogImpl::fe_clr));
+   s->attribute("rows", "10");
+   s->attribute("columns", "30");
+   ete_ = new EivTextEditor(s, false);
+   ete_->ref();
+   ete_->textview()->disable_caret();
+ 
+   build(list_);
+ }
+ 
+ void ConnectionsDialogImpl::free() {
+   ete_->unref();
+ }
+ 
+ void ConnectionsDialogImpl::build(DrawLinkList* list) {
+     WidgetKit& kit = *kit_;
+     const LayoutKit& layout = *LayoutKit::instance();
+     const DialogKit& dialog = *DialogKit::instance();
+     Style* s = style_;
+     String caption("DrawLink Connections");
+ #if 0
+     String connect_str("Connect");
+ #endif
+     String close_str("Close");
+ 
+ #if 0
+     Action* connect = new ActionCallback(ConnectionsDialogImpl)(
+ 	this, &ConnectionsDialogImpl::connect
+     );
+ #endif
+     Action* close = new ActionCallback(ConnectionsDialogImpl)(
+ 	this, &ConnectionsDialogImpl::close
+     );
+ 
+     Glyph* g = layout.vbox(
+ 	layout.hcenter(kit.fancy_label(caption)),
+ 	layout.vspace(15.0),
+ 	layout.hcenter(layout.hbox(
+ 	    layout.hglue(10.0),
+ 	    layout.vcenter(kit.push_button(close_str, close)),
+ #if 0
+ 	    layout.hglue(10.0, 0.0, 5.0),
+ 	    layout.vcenter(kit.push_button(connect_str, connect)),
+ #endif
+ 	    layout.hglue(10.0)
+ 	)),
+ 	layout.vspace(15.0),
+ 	layout.hcenter(table_patch(list)),
+ 	layout.vglue(1)
+     );
+     dialog_->body(
+ 	kit.outset_frame(layout.margin(g, 5.0))
+     );
+     dialog_->append_input_handler(hostfe_);
+     dialog_->append_input_handler(portfe_);
+     dialog_->focus(hostfe_);
+ }
+ 
+ void ConnectionsDialogImpl::connect() {
+   const String* hoststr = hostfe_->text();
+   const String* portstr = portfe_->text();
+   if (hoststr->length() > 0) {
+     int portnum=20002;
+     if (portstr->length() > 0) portnum = atoi(portstr->string());
+     ((DrawServ*)unidraw)->linkup(hoststr->string(), portnum, 0);
+   }
+ }
+ 
+ void ConnectionsDialogImpl::disconnect() {
+   const String* hoststr = hostfe_->text();
+   const String* portstr = portfe_->text();
+   if (hoststr->length() > 0) {
+     int portnum=20002;
+     if (portstr->length() > 0) portnum = atoi(portstr->string());
+     DrawLink* link = ((DrawServ*)unidraw)->linkget(hoststr->string(), portnum);
+     if (link) 
+       ((DrawServ*)unidraw)->linkdown(link);
+   }
+ }
+ 
+ void ConnectionsDialogImpl::close() {
+     dialog_->dismiss(false);
+ }
+ 
+ Patch* ConnectionsDialogImpl::table_patch(DrawLinkList* list) {
+ 
+   DialogKit& dk = *DialogKit::instance();
+   WidgetKit& wk = *WidgetKit::instance();
+   const LayoutKit& lk = *LayoutKit::instance();
+   PolyGlyph* mainglyph = lk.vbox();
+   Glyph* glu = lk.vspace(5);
+   PolyGlyph* _namebox = lk.vbox();
+   PolyGlyph* _valbox = lk.vbox();
+   InputHandler* ih = new InputHandler(nil, wk.style());
+   Coord wid = wk.font()->width("MMMMMMMMMMMMMMM", 15);
+   
+   Action* conaction = new ActionCallback(ConnectionsDialogImpl)
+     (this, &ConnectionsDialogImpl::connect);
+   Button* conbutton = wk.push_button("Connect", conaction);
+   Action* disaction = new ActionCallback(ConnectionsDialogImpl)
+     (this, &ConnectionsDialogImpl::disconnect);
+   Button* disbutton = wk.push_button("Disconnect", disaction);
+   mainglyph->append
+     (lk.hcenter
+      (lk.hbox
+       (lk.vcenter(conbutton),
+        lk.hspace(10),
+        lk.vcenter(disbutton)
+        )
+       )
+      );
+   mainglyph->append(lk.vspace(10));
+   mainglyph->append
+     (lk.hcenter
+      (lk.hbox
+       (lk.vcenter(lk.hfixed(wk.label("Host"), wid)),
+        lk.hspace(10),
+        lk.vcenter(lk.hfixed(wk.label("Port"), wid))
+        )
+       )
+      );
+   mainglyph->append(lk.vspace(2));
+   mainglyph->append
+     (lk.hcenter
+      (lk.hbox
+       (lk.vcenter(lk.hfixed(hostfe_, wid)),
+        lk.hspace(10),
+        lk.vcenter(lk.hfixed(portfe_, wid))
+        )
+       )
+      );
+   mainglyph->append(lk.vspace(15));
+   update_text(false);
+   mainglyph->append(lk.hcenter(lk.hspace(300)));
+   mainglyph->append(lk.hcenter(ete_));
+   ih->body(wk.outset_frame(lk.margin(mainglyph, 10)));
+   
+   patch_ = new Patch(nil);
+   patch_->body(ih);
+   return patch_;
+ }
+ 
+ void ConnectionsDialogImpl::fe_add(FieldEditor* fe) {
+ #if 0
+     const String* txt = _namefe->text();
+     if (txt->length() > 0) {
+ 	char* buf = new char[strlen(_valfe->text()->string())+2];
+ 	sprintf(buf, "%s\n", _valfe->text()->string());
+ 	_list->add_attr(txt->string(), ParamList::lexscan()->get_attr(buf, strlen(buf)));
+ 	update_text(true);
+     }
+ #endif
+ }
+ 
+ void ConnectionsDialogImpl::fe_clr(FieldEditor* fe) {
+     fe->field("");
+ }
+ 
+ void ConnectionsDialogImpl::update(Observable* obs) {
+   fprintf(stderr, "DrawLinkList has been modified\n");
+   update_text(true);
+ }
+ 
+ void ConnectionsDialogImpl::update_text(boolean update) {
+   if (!dialog_->mapped() && update) return;
+   Iterator i;
+   vector <char> vbuf;
+   char buf[BUFSIZ];
+   snprintf(buf, BUFSIZ, "Host                            Port    State\n");
+   for(int i=0; i<strlen(buf); i++) vbuf.push_back(buf[i]);
+   snprintf(buf, BUFSIZ, "---------------------------------------------\n");
+   for(int i=0; i<strlen(buf); i++) vbuf.push_back(buf[i]);
+   for (list_->First(i); !list_->Done(i); list_->Next(i)) {
+     DrawLink* link = list_->GetDrawLink(i);
+     snprintf(buf, BUFSIZ, "%-30.30s  %-6d  %-3d\n", 
+ 	     link->hostname(), link->portnum(), link->state());
+     for(int i=0; i<strlen(buf); i++) vbuf.push_back(buf[i]);
+   }
+   vbuf.push_back('\0');
+   ete_->text(&vbuf[0] ? &vbuf[0] : "", update);
+ }
Index: DrawServ/rcdialog.h
diff -c DrawServ/rcdialog.h:1.4 DrawServ/rcdialog.h:1.5
*** DrawServ/rcdialog.h:1.4	Fri Apr  2 12:53:12 2004
--- src/DrawServ/rcdialog.h	Fri Apr  2 12:55:02 2004
***************
*** 55,60 ****
--- 55,76 ----
    StrEditDialog* _dialog;
  };
  
+ #include <InterViews/dialog.h>
+ 
+ class ConnectionsDialogImpl;
+ class DrawLinkList;
+ class Style;
+ class WidgetKit;
+ 
+ //: dialog for editing list of current connections
+ class ConnectionsDialog : public Dialog {
+ public:
+     ConnectionsDialog(DrawLinkList*, WidgetKit*, Style*);
+     virtual ~ConnectionsDialog();
+ protected:
+     ConnectionsDialogImpl* impl_;
+ };
+ 
  #include <InterViews/_leave.h>
  
  #endif
Index: drawserv_/main.c
diff -c drawserv_/main.c:1.7 drawserv_/main.c:1.8
*** drawserv_/main.c:1.7	Tue Mar 30 11:05:51 2004
--- src/drawserv_/main.c	Fri Apr  2 12:55:04 2004
***************
*** 209,214 ****
--- 209,219 ----
  
  /*****************************************************************************/
  
+ void handle_badpipe(int i) {
+   fprintf(stderr, "broken pipe detected %d\n", i);
+   return;
+ }
+ 
  int main (int argc, char** argv) {
  
      /* ignore broken pipe, so socket writes that are in error return EPIPE */
***************
*** 222,228 ****
      fprintf(stderr, "sigaction status %d  errno %d\n", status, errno);
  #else
      void (*func)(int) = nil;
!     func = signal(SIGPIPE, SIG_IGN);
      if (func==SIG_ERR) 
        fprintf(stderr, "SIG_ERR returned from signal, errno = %d\n", errno);
  #endif
--- 227,233 ----
      fprintf(stderr, "sigaction status %d  errno %d\n", status, errno);
  #else
      void (*func)(int) = nil;
!     func = signal(SIGPIPE, &handle_badpipe);
      if (func==SIG_ERR) 
        fprintf(stderr, "SIG_ERR returned from signal, errno = %d\n", errno);
  #endif
Index: iclass/globals.c
diff -c iclass/globals.c:1.1 iclass/globals.c:1.2
*** iclass/globals.c:1.1	Fri Jan  9 11:43:03 2004
--- src/iclass/globals.c	Fri Apr  2 12:54:43 2004
***************
*** 32,42 ****
--- 32,44 ----
  
  /*****************************************************************************/
  
+ #if 0
  char* strnew (const char* s) {
      char* dup = new char[strlen(s) + 1];
      strcpy(dup, s);
      return dup;
  }
+ #endif
  
  char* strnnew (const char* s, int len) {
      char* dup = new char[len + 1];
Index: include_iviv-2_6/texteditor.h
diff -c include_iviv-2_6/texteditor.h:1.1 include_iviv-2_6/texteditor.h:1.2
*** include_iviv-2_6/texteditor.h:1.1	Fri Jan  9 11:45:34 2004
--- src/include/IV-2_6/InterViews/texteditor.h	Fri Apr  2 12:55:07 2004
***************
*** 79,84 ****
--- 79,87 ----
      void Select(int dot, int mark);
  
      int Locate(IntCoord x, IntCoord y);
+     void DisableCaret();
+     void EnableCaret();
+ 
  protected:
      virtual void Reconfig();
      virtual void Redraw(IntCoord, IntCoord, IntCoord, IntCoord);
***************
*** 97,102 ****
--- 100,106 ----
      int shaperows;
      int shapecolumns;
      Alignment scrollalign;
+     int caret_off;
  };
  
  inline int TextEditor::Dot () { return dot; }
Index: IVGlyph/stredit.h
diff -c IVGlyph/stredit.h:1.2 IVGlyph/stredit.h:1.3
*** IVGlyph/stredit.h:1.2	Tue Mar 30 11:05:29 2004
--- src/IVGlyph/stredit.h	Fri Apr  2 12:54:45 2004
***************
*** 28,33 ****
--- 28,34 ----
  
  #include <InterViews/_enter.h>
  
+ class Action;
  class StrEditDialogImpl;
  class WidgetKit;
  
Index: IVGlyph/textview.c
diff -c IVGlyph/textview.c:1.1 IVGlyph/textview.c:1.2
*** IVGlyph/textview.c:1.1	Fri Jan  9 11:43:14 2004
--- src/IVGlyph/textview.c	Fri Apr  2 12:54:45 2004
***************
*** 265,270 ****
--- 265,271 ----
     // delete text in editor
     text_editor_->Select(0);
     text_editor_->DeleteText(te_buffer_->characters());
+ 
     // load new text
     te_buffer_->Insert(0, txt, strlen(txt));
     text_editor_->Edit(te_buffer_, 0);
***************
*** 850,852 ****
--- 851,857 ----
  }
  
  int TE_View::lines() { return te_buffer_->lines(); }
+ 
+ void TE_View::disable_caret() { text_editor_->DisableCaret(); }
+ 
+ void TE_View::enable_caret() { text_editor_->EnableCaret(); }
Index: IVGlyph/textview.h
diff -c IVGlyph/textview.h:1.1 IVGlyph/textview.h:1.2
*** IVGlyph/textview.h:1.1	Fri Jan  9 11:43:14 2004
--- src/IVGlyph/textview.h	Fri Apr  2 12:54:45 2004
***************
*** 133,138 ****
--- 133,141 ----
      const char* text();
      void text(const char*, boolean update =true);
  
+     void disable_caret();
+     void enable_caret();
+ 
  protected:
     void scroll_to_line(int line);
     void make_visible(const boolean scroll_page = true);
Index: src_iv-2_6/texteditor.c
diff -c src_iv-2_6/texteditor.c:1.1 src_iv-2_6/texteditor.c:1.2
*** src_iv-2_6/texteditor.c:1.1	Fri Jan  9 11:42:44 2004
--- src/IV-2_6/texteditor.c	Fri Apr  2 12:54:39 2004
***************
*** 115,120 ****
--- 115,121 ----
      highlight = h;
      display = nil;
      perspective = new Perspective();
+     caret_off = false;
  }
  
  TextEditor::~TextEditor () {
***************
*** 559,564 ****
--- 560,566 ----
          display->CaretStyle(BarCaret);
      }
      if (newl == newr) {
+         if (caret_off) display->CaretStyle(NoCaret);
          display->Caret(text->LineNumber(newl), text->LineOffset(newl));
      }
      dot = d;
***************
*** 613,615 ****
--- 615,620 ----
  
      SetCursor(origCursor);
  }
+ 
+ void TextEditor::DisableCaret() { caret_off = true; }
+ void TextEditor::EnableCaret() { caret_off = false; }
*** /dev/null	 Fri Apr 2 12:55:15 PST 2004
--- patches/ivtools-040402-johnston-080
*************** patches/ivtools-040402-johnston-080
*** 0 ****
--- 1 ----
+ ivtools-040402-johnston-080

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040330-johnston-079"
Content-Disposition: attachment;
	filename=ivtools-040330-johnston-079

Patch:    ivtools-040330-johnston-079
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.5 DrawServ/drawkit.c:1.6
*** DrawServ/drawkit.c:1.5	Fri Mar 26 16:22:59 2004
--- src/DrawServ/drawkit.c	Tue Mar 30 11:05:49 2004
***************
*** 464,470 ****
      mbi->menu(kit.pulldown());
  
      MenuItem* menu_item = kit.menu_item(kit.label("Connect"));
!     menu_item->action(new RemoteConnectAction(GetEditor()));
      mbi->menu()->append_item(menu_item);
  
      return mbi;
--- 464,470 ----
      mbi->menu(kit.pulldown());
  
      MenuItem* menu_item = kit.menu_item(kit.label("Connect"));
!     menu_item->action(new RemoteConnectPopupAction(GetEditor()));
      mbi->menu()->append_item(menu_item);
  
      return mbi;
Index: DrawServ/rcdialog.c
diff -c DrawServ/rcdialog.c:1.1 DrawServ/rcdialog.c:1.2
*** DrawServ/rcdialog.c:1.1	Fri Mar 26 16:25:22 2004
--- src/DrawServ/rcdialog.c	Tue Mar 30 11:05:49 2004
***************
*** 40,54 ****
  
  /*****************************************************************************/
  
! RemoteConnectAction::RemoteConnectAction(Editor* editor) : Action() {
    _editor = editor;
  }
  
! void RemoteConnectAction::execute() {
!   char* hostname =
!     StrEditDialog::post
      (_editor->GetWindow(), 
!      "Enter host name to connect:                  ", "localhost");
!   if (hostname) ((DrawServ*)unidraw)->linkup(hostname, 20002, 0);
  }
  
--- 40,70 ----
  
  /*****************************************************************************/
  
! RemoteConnectPopupAction::RemoteConnectPopupAction(Editor* editor) : Action() {
    _editor = editor;
  }
  
! void RemoteConnectPopupAction::execute() {
!   StrEditDialog::accept_custom("Connect");
!   StrEditDialog::cancel_custom("Close");
!   StrEditDialog* dialog =
!     StrEditDialog::map
      (_editor->GetWindow(), 
!      "Enter host name to connect:                  ", "localhost", nil, nil, true);
! 
!   StrEditDialog::action_custom(new RemoteConnectAction(dialog), nil);
! }
! 
! /*****************************************************************************/
! 
! RemoteConnectAction::RemoteConnectAction(StrEditDialog* dialog) : Action() {
!   _dialog = dialog;
! }
! 
! void RemoteConnectAction::execute() {
! 
!   if (_dialog && _dialog->text()) 
!     ((DrawServ*)unidraw)->linkup(_dialog->text(), 20002, 0);
! 
  }
  
Index: DrawServ/rcdialog.h
diff -c DrawServ/rcdialog.h:1.1 DrawServ/rcdialog.h:1.2
*** DrawServ/rcdialog.h:1.1	Fri Mar 26 16:25:22 2004
--- src/DrawServ/rcdialog.h	Tue Mar 30 11:05:49 2004
***************
*** 35,47 ****
  class Editor;
  class RemoteConnectDialog;
  
! //: action to establish a connection with a remote DrawServ
! class RemoteConnectAction : public Action {
  public:
!   RemoteConnectAction(Editor*);
    virtual void execute();
  protected:
    Editor* _editor;
  };
  
  #include <InterViews/_leave.h>
--- 35,58 ----
  class Editor;
  class RemoteConnectDialog;
  
! //: action to establish a dialog box for connecting with a remote DrawServ
! class RemoteConnectPopupAction : public Action {
  public:
!   RemoteConnectPopupAction(Editor*);
    virtual void execute();
  protected:
    Editor* _editor;
+ };
+ 
+ class StrEditDialog;
+ 
+ //: action for connecting with a remote DrawServ
+ class RemoteConnectAction : public Action {
+ public:
+   RemoteConnectAction(StrEditDialog*);
+   virtual void execute();
+ protected:
+   StrEditDialog* _dialog;
  };
  
  #include <InterViews/_leave.h>
Index: drawserv_/main.c
diff -c drawserv_/main.c:1.6 drawserv_/main.c:1.7
*** drawserv_/main.c:1.6	Mon Mar 22 15:14:40 2004
--- src/drawserv_/main.c	Tue Mar 30 11:05:51 2004
***************
*** 212,217 ****
--- 212,218 ----
  int main (int argc, char** argv) {
  
      /* ignore broken pipe, so socket writes that are in error return EPIPE */
+ #if 0
      struct sigaction oldaction, newaction;
      newaction.sa_handler = SIG_IGN;
      newaction.sa_mask = 0;
***************
*** 219,224 ****
--- 220,231 ----
      newaction.sa_sigaction = 0;
      int status = sigaction(SIGPIPE, &newaction, &oldaction); 
      fprintf(stderr, "sigaction status %d  errno %d\n", status, errno);
+ #else
+     void (*func)(int) = nil;
+     func = signal(SIGPIPE, SIG_IGN);
+     if (func==SIG_ERR) 
+       fprintf(stderr, "SIG_ERR returned from signal, errno = %d\n", errno);
+ #endif
    
  #ifdef HAVE_ACE
      Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton()));
Index: include_interviews/dialog.h
diff -c include_interviews/dialog.h:1.1 include_interviews/dialog.h:1.2
*** include_interviews/dialog.h:1.1	Fri Jan  9 11:45:47 2004
--- src/include/InterViews/dialog.h	Tue Mar 30 11:05:55 2004
***************
*** 64,69 ****
--- 64,70 ----
      virtual boolean run();
      virtual void dismiss(boolean accept);
      boolean accepted() { return accepted_; }
+     boolean unmap_for_dismiss() { return unmap_for_dismiss_; }
  private:
      boolean done_;
      boolean accepted_;
Index: include_os/string.h
diff -c include_os/string.h:1.1 include_os/string.h:1.2
*** include_os/string.h:1.1	Fri Jan  9 11:45:51 2004
--- src/include/OS/string.h	Tue Mar 30 11:05:58 2004
***************
*** 164,167 ****
--- 164,169 ----
  inline int String::index(u_char c) const { return search(0, c); }
  inline int String::rindex(u_char c) const { return search(-1, c); }
  
+ extern char* strnew(const char*);   /* return a copy of the given string */
+ 
  #endif
Index: include_unidraw/globals.h
diff -c include_unidraw/globals.h:1.1 include_unidraw/globals.h:1.2
*** include_unidraw/globals.h:1.1	Fri Jan  9 11:45:56 2004
--- src/include/Unidraw/globals.h	Tue Mar 30 11:06:00 2004
***************
*** 123,129 ****
                                      /* return alignment point on graphic */
  extern void Ref(Resource*);         /* calls Reference if resource is nonnil */
  
! extern char* strnew(const char*);   /* return a copy of the given string */
  
  #include <IV-2_6/_leave.h>
  
--- 123,129 ----
                                      /* return alignment point on graphic */
  extern void Ref(Resource*);         /* calls Reference if resource is nonnil */
  
! #include <OS/string.h>    /* for strnew */
  
  #include <IV-2_6/_leave.h>
  
Index: IVGlyph/stredit.c
diff -c IVGlyph/stredit.c:1.1 IVGlyph/stredit.c:1.2
*** IVGlyph/stredit.c:1.1	Fri Jan  9 11:43:14 2004
--- src/IVGlyph/stredit.c	Tue Mar 30 11:05:29 2004
***************
*** 1,4 ****
--- 1,5 ----
  /*
+  * Copyright 2004 Scott E. Johnston
   * Copyright 1998 Vectaport Inc.
   *
   * Permission to use, copy, modify, distribute, and sell this software and
***************
*** 39,44 ****
--- 40,49 ----
  #include <string.h>
  #include <stdio.h>
  
+ const char* StrEditDialog::_accept_custom = nil;
+ const char* StrEditDialog::_cancel_custom = nil;
+ Action* StrEditDialog::_accept_action_custom = nil;
+ Action* StrEditDialog::_cancel_action_custom = nil;
  
  /*****************************************************************************/
  
***************
*** 51,75 ****
      StrEditDialog* dialog_;
      boolean cancel_;
  
!     void init(StrEditDialog*, Style*, const char*, const char*, Glyph*);
      void build(const char*, const char*, Glyph*);
  
      void accept();
      void cancel();
  
      GFieldEditor* editor_;
  };
  
  declareActionCallback(StrEditDialogImpl)
  implementActionCallback(StrEditDialogImpl)
  
! StrEditDialog::StrEditDialog(const char* c1, const char* c2, Glyph* extra) 
  : Dialog(nil, WidgetKit::instance()->style())
  {
      impl_ = new StrEditDialogImpl;
      StrEditDialogImpl& impl = *impl_;
      impl.kit_ = WidgetKit::instance();
!     impl.init(this, WidgetKit::instance()->style(), c1, c2, extra);
  }
  
  StrEditDialog::~StrEditDialog() {
--- 56,81 ----
      StrEditDialog* dialog_;
      boolean cancel_;
  
!     void init(StrEditDialog*, Style*, const char*, const char*, Glyph*, boolean custom);
      void build(const char*, const char*, Glyph*);
  
      void accept();
      void cancel();
  
      GFieldEditor* editor_;
+     boolean custom_;
  };
  
  declareActionCallback(StrEditDialogImpl)
  implementActionCallback(StrEditDialogImpl)
  
! StrEditDialog::StrEditDialog(const char* c1, const char* c2, Glyph* extra, boolean custom) 
  : Dialog(nil, WidgetKit::instance()->style())
  {
      impl_ = new StrEditDialogImpl;
      StrEditDialogImpl& impl = *impl_;
      impl.kit_ = WidgetKit::instance();
!     impl.init(this, WidgetKit::instance()->style(), c1, c2, extra, custom);
  }
  
  StrEditDialog::~StrEditDialog() {
***************
*** 99,105 ****
  
  char* StrEditDialog::post(Window* window, const char* message, 
  			  const char* string, const char* title,
! 			  Glyph* extra) {
    WidgetKit& kit = *WidgetKit::instance();
    if (title) {
      Style* ts = new Style(kit.style());
--- 105,111 ----
  
  char* StrEditDialog::post(Window* window, const char* message, 
  			  const char* string, const char* title,
! 			  Glyph* extra, boolean custom) {
    WidgetKit& kit = *WidgetKit::instance();
    if (title) {
      Style* ts = new Style(kit.style());
***************
*** 107,113 ****
      kit.push_style(ts);
    }
    
!   StrEditDialog* dialog = new StrEditDialog(message, string, extra);
    Resource::ref(dialog);
    boolean accepted = dialog->post_for(window);
    char* retstr = strdup(dialog->text());
--- 113,119 ----
      kit.push_style(ts);
    }
    
!   StrEditDialog* dialog = new StrEditDialog(message, string, extra, custom);
    Resource::ref(dialog);
    boolean accepted = dialog->post_for(window);
    char* retstr = strdup(dialog->text());
***************
*** 118,133 ****
    return accepted ? retstr : nil;
  }
  
  /** class StrEditDialogImpl **/
  
  void StrEditDialogImpl::init(StrEditDialog* d, Style* s, 
! 			     const char* c1, const char* c2, Glyph* extra) {
      cancel_ = false;
      dialog_ = d;
      style_ = s;
      editor_ = nil;
      build(c1, c2, extra);
      editor_->select_all();
  }
  
  void StrEditDialogImpl::build(const char* msg, const char* txt, Glyph* extra) {
--- 124,191 ----
    return accepted ? retstr : nil;
  }
  
+ StrEditDialog* StrEditDialog::map(Window* window, const char* message, 
+ 			 const char* string, const char* title,
+ 			 Glyph* extra, boolean custom) {
+   WidgetKit& kit = *WidgetKit::instance();
+   if (title) {
+     Style* ts = new Style(kit.style());
+     ts->attribute("name", title);
+     kit.push_style(ts);
+   }
+   
+   StrEditDialog* dialog = new StrEditDialog(message, string, extra, custom);
+   Resource::ref(dialog);
+   dialog->map_for(window);
+   if (title)
+     kit.pop_style();
+   return dialog;
+ }
+ 
+ void StrEditDialog::accept_custom(const char* caption) { 
+   boolean same = _accept_custom ? strcmp(caption, _accept_custom)==0 : !caption;
+   if (_accept_custom && !same) {
+     delete _accept_custom;
+     _accept_custom = nil;
+   }
+   if (caption && !same) 
+     _accept_custom = strnew(caption);
+ }
+ 
+ void StrEditDialog::cancel_custom(const char* caption) { 
+   boolean same = _cancel_custom ? strcmp(caption, _cancel_custom)==0 : !caption;
+   if (_cancel_custom && !same) {
+     delete _cancel_custom;
+     _cancel_custom = nil;
+   }
+   if (caption && !same) 
+     _cancel_custom = strnew(caption);
+ }
+ 
+ void StrEditDialog::action_custom(Action* aaction, Action* caction) {
+   if (aaction != _accept_action_custom) {
+     Unref(_accept_action_custom);
+     _accept_action_custom = aaction;
+     Resource::ref(_accept_action_custom);
+   }
+   if (caction != _cancel_action_custom) {
+     Unref(_cancel_action_custom);
+     _cancel_action_custom = caction;
+     Resource::ref(_cancel_action_custom);
+   }
+ }
+ 
  /** class StrEditDialogImpl **/
  
  void StrEditDialogImpl::init(StrEditDialog* d, Style* s, 
! 			     const char* c1, const char* c2, Glyph* extra, boolean custom) {
      cancel_ = false;
      dialog_ = d;
      style_ = s;
      editor_ = nil;
      build(c1, c2, extra);
      editor_->select_all();
+     custom_ = custom;
  }
  
  void StrEditDialogImpl::build(const char* msg, const char* txt, Glyph* extra) {
***************
*** 156,164 ****
  		      editor_,
  		      layout.vspace(15.0),
  		      layout.hbox(
! 				  layout.vcenter(kit.push_button(kit.label("Accept"), accept)),
  				  layout.hspace(10.0),
! 				  layout.vcenter(kit.push_button(kit.label("Cancel"), cancel))
  				  ));
      else 
        g = layout.vbox(
--- 214,234 ----
  		      editor_,
  		      layout.vspace(15.0),
  		      layout.hbox(
! 				  layout.vcenter
! 				  (kit.push_button
! 				   (kit.label
! 				    (custom_ 
! 				     ? StrEditDialog::accept_custom() 
! 				     : "Accept"), 
! 				    accept)),
  				  layout.hspace(10.0),
! 				  layout.vcenter
! 				  (kit.push_button
! 				   (kit.label
! 				    (custom_ 
! 				     ? StrEditDialog::cancel_custom() 
! 				     : "Cancel"), 
! 				    cancel))
  				  ));
      else 
        g = layout.vbox(
***************
*** 183,192 ****
  }
  
  void StrEditDialogImpl::accept() {
!   dialog_->dismiss(true);
  }
  
  void StrEditDialogImpl::cancel() {
      cancel_ = true;
      dialog_->dismiss(false);
  }
--- 253,267 ----
  }
  
  void StrEditDialogImpl::accept() {
!   if (!dialog_->unmap_for_dismiss())
!     dialog_->dismiss(true);
!   if (custom_ && StrEditDialog::accept_action_custom())
!     StrEditDialog::accept_action_custom()->execute();
  }
  
  void StrEditDialogImpl::cancel() {
      cancel_ = true;
      dialog_->dismiss(false);
+     if (custom_ && StrEditDialog::cancel_action_custom())
+       StrEditDialog::cancel_action_custom()->execute();
  }
Index: IVGlyph/stredit.h
diff -c IVGlyph/stredit.h:1.1 IVGlyph/stredit.h:1.2
*** IVGlyph/stredit.h:1.1	Fri Jan  9 11:43:14 2004
--- src/IVGlyph/stredit.h	Tue Mar 30 11:05:29 2004
***************
*** 34,40 ****
  class StrEditDialog : public Dialog {
  public:
      StrEditDialog(const char* caption1, const char* caption2 = nil, 
! 		  Glyph* extra=nil);
      virtual ~StrEditDialog();
  
      boolean cancel();
--- 34,40 ----
  class StrEditDialog : public Dialog {
  public:
      StrEditDialog(const char* caption1, const char* caption2 = nil, 
! 		  Glyph* extra=nil, boolean custom=false);
      virtual ~StrEditDialog();
  
      boolean cancel();
***************
*** 45,53 ****
  
      static char* post(Window*, const char* message, 
  		      const char* string=nil, const char* title=nil,
! 		      Glyph* extra = nil);
  
  private:
      StrEditDialogImpl* impl_;
  };
  
--- 45,68 ----
  
      static char* post(Window*, const char* message, 
  		      const char* string=nil, const char* title=nil,
! 		      Glyph* extra = nil, boolean custom=false);
  
+     static StrEditDialog* map(Window*, const char* message, 
+ 			      const char* string=nil, const char* title=nil,
+ 			      Glyph* extra = nil, boolean custom=false);
+ 
+     static const char* accept_custom() { return _accept_custom; }
+     static void accept_custom(const char* caption);
+     static const char* cancel_custom() { return _cancel_custom; }
+     static void cancel_custom(const char* caption);
+     static void action_custom(Action* accept, Action* cancel);
+     static Action* accept_action_custom() { return _accept_action_custom; }
+     static Action* cancel_action_custom() { return _cancel_action_custom; }
  private:
+     static const char* _accept_custom;
+     static const char* _cancel_custom;
+     static Action* _accept_action_custom;
+     static Action* _cancel_action_custom;
      StrEditDialogImpl* impl_;
  };
  
Index: src_interviews/tiff.c
diff -c src_interviews/tiff.c:1.1 src_interviews/tiff.c:1.2
*** src_interviews/tiff.c:1.1	Fri Jan  9 11:42:39 2004
--- src/InterViews/tiff.c	Tue Mar 30 11:05:20 2004
***************
*** 28,33 ****
--- 28,36 ----
  #include <TIFF/tiffio.h>
  #include <stdlib.h>
  
+ #if defined(howmany)
+ #undef howmany
+ #endif
  #define	howmany(x, y)	(((x)+((y)-1))/(y))
  
  typedef	unsigned char u_char;
Index: src_os/string.c
diff -c src_os/string.c:1.1 src_os/string.c:1.2
*** src_os/string.c:1.1	Fri Jan  9 11:42:50 2004
--- src/OS/string.c	Tue Mar 30 11:05:25 2004
***************
*** 460,462 ****
--- 460,469 ----
  	allocated_ = false;
      }
  }
+ 
+ 
+ char* strnew (const char* s) {
+     char* dup = new char[strlen(s) + 1];
+     strcpy(dup, s);
+     return dup;
+ }
Index: Unidraw/globals.c
diff -c Unidraw/globals.c:1.1 Unidraw/globals.c:1.2
*** Unidraw/globals.c:1.1	Fri Jan  9 11:44:38 2004
--- src/Unidraw/globals.c	Tue Mar 30 11:05:42 2004
***************
*** 137,145 ****
          r->Reference();
      }
  }
- 
- char* strnew (const char* s) {
-     char* dup = new char[strlen(s) + 1];
-     strcpy(dup, s);
-     return dup;
- }
--- 137,139 ----
*** /dev/null	 Tue Mar 30 11:06:08 PST 2004
--- patches/ivtools-040330-johnston-079
*************** patches/ivtools-040330-johnston-079
*** 0 ****
--- 1 ----
+ ivtools-040330-johnston-079

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040326-johnston-078"
Content-Disposition: attachment;
	filename=ivtools-040326-johnston-078

Patch:    ivtools-040326-johnston-078
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.45 DrawServ/drawserv.c:1.46
*** DrawServ/drawserv.c:1.45	Fri Mar 26 16:23:00 2004
--- src/DrawServ/drawserv.c	Fri Mar 26 17:46:46 2004
***************
*** 88,98 ****
    _sessionid = unique_sessionid();
    char hostbuf[HOST_NAME_MAX];
    gethostname(hostbuf, HOST_NAME_MAX);
!   char userbuf[BUFSIZ];
!   getlogin_r(userbuf, BUFSIZ);
    int pid = getpid();
    int hostid = gethostid();
!   SessionId* sid = new SessionId(_sessionid, _sessionid, pid, userbuf, hostbuf, hostid);
    _sessionidtable->insert(_sessionid, sid);
    _comdraw_port = atoi(unidraw->GetCatalog()->GetAttribute("comdraw"));
  }
--- 88,97 ----
    _sessionid = unique_sessionid();
    char hostbuf[HOST_NAME_MAX];
    gethostname(hostbuf, HOST_NAME_MAX);
!   char* username = getlogin();
    int pid = getpid();
    int hostid = gethostid();
!   SessionId* sid = new SessionId(_sessionid, _sessionid, pid, username, hostbuf, hostid);
    _sessionidtable->insert(_sessionid, sid);
    _comdraw_port = atoi(unidraw->GetCatalog()->GetAttribute("comdraw"));
  }
*** /dev/null	 Fri Mar 26 17:46:53 PST 2004
--- patches/ivtools-040326-johnston-078
*************** patches/ivtools-040326-johnston-078
*** 0 ****
--- 1 ----
+ ivtools-040326-johnston-078

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040326-johnston-077"
Content-Disposition: attachment;
	filename=ivtools-040326-johnston-077

Patch:    ivtools-040326-johnston-077
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/rcdialog.c
diff -c /dev/null DrawServ/rcdialog.c:1.1
*** /dev/null	Fri Mar 26 16:25:23 2004
--- src/DrawServ/rcdialog.c	Fri Mar 26 16:25:22 2004
***************
*** 0 ****
--- 1,54 ----
+ /*
+  * Copyright (c) 1997,1999 Vectaport Inc.
+  * Copyright (c) 1994-1996 Vectaport Inc., Cartoactive Systems
+  * Copyright (c) 1993 David B. Hollenbeck
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * RemoteConnectDialog related classes
+  */
+ 
+ #include <DrawServ/drawserv.h>
+ #include <DrawServ/rcdialog.h>
+ 
+ #include <Unidraw/editor.h>
+ 
+ #include <IVGlyph/stredit.h>
+ 
+ #include <InterViews/window.h>
+ 
+ #include <stdio.h>
+ 
+ /*****************************************************************************/
+ 
+ RemoteConnectAction::RemoteConnectAction(Editor* editor) : Action() {
+   _editor = editor;
+ }
+ 
+ void RemoteConnectAction::execute() {
+   char* hostname =
+     StrEditDialog::post
+     (_editor->GetWindow(), 
+      "Enter host name to connect:                  ", "localhost");
+   if (hostname) ((DrawServ*)unidraw)->linkup(hostname, 20002, 0);
+ }
+ 
Index: DrawServ/rcdialog.h
diff -c /dev/null DrawServ/rcdialog.h:1.1
*** /dev/null	Fri Mar 26 16:25:23 2004
--- src/DrawServ/rcdialog.h	Fri Mar 26 16:25:22 2004
***************
*** 0 ****
--- 1,49 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  * Copyright (c) 1994-1997,1999 Vectaport Inc.
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * RemoteConnectDialog - classes related to the remote connect dialog box
+  */
+ 
+ #ifndef rcdialog_h
+ #define rcdialog_h
+ 
+ #include <InterViews/action.h>
+ #include <Unidraw/editor.h>
+ 
+ class Editor;
+ class RemoteConnectDialog;
+ 
+ //: action to establish a connection with a remote DrawServ
+ class RemoteConnectAction : public Action {
+ public:
+   RemoteConnectAction(Editor*);
+   virtual void execute();
+ protected:
+   Editor* _editor;
+ };
+ 
+ #include <InterViews/_leave.h>
+ 
+ #endif
Index: DrawServ/sid.c
diff -c /dev/null DrawServ/sid.c:1.1
*** /dev/null	Fri Mar 26 16:25:23 2004
--- src/DrawServ/sid.c	Fri Mar 26 16:25:22 2004
***************
*** 0 ****
--- 1,51 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * Implementation of SessionId class.
+  */
+ 
+ #include <DrawServ/drawlink.h>
+ #include <DrawServ/sid.h>
+ 
+ /*****************************************************************************/
+ 
+ SessionId::SessionId (unsigned int sid, unsigned int osid, int pid, 
+ 		      const char* username, const char* hostname, 
+ 		      int hostid, DrawLink* link)
+ {
+   _sid = sid;
+   _osid = osid;
+   _pid = pid;
+   _username = strnew(username);
+   _hostname = strnew(hostname);
+   _hostid = hostid;
+   _drawlink = link;
+ }
+ 
+ SessionId::~SessionId () 
+ {
+   delete _username;
+   delete _hostname;
+ }
+ 
Index: DrawServ/sid.h
diff -c /dev/null DrawServ/sid.h:1.1
*** /dev/null	Fri Mar 26 16:25:23 2004
--- src/DrawServ/sid.h	Fri Mar 26 16:25:22 2004
***************
*** 0 ****
--- 1,66 ----
+ /*
+  * Copyright (c) 2004 Scott E. Johnston
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and
+  * its documentation for any purpose is hereby granted without fee, provided
+  * that the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the names of the copyright holders not be used in
+  * advertising or publicity pertaining to distribution of the software
+  * without specific, written prior permission.  The copyright holders make
+  * no representations about the suitability of this software for any purpose.
+  * It is provided "as is" without express or implied warranty.
+  *
+  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
+  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  * 
+  */
+ 
+ /*
+  * SessionId - object to encapsulate session member info
+  */
+ #ifndef sid_h
+ #define sid_h
+ 
+ #include <Unidraw/globals.h>
+ 
+ //: object to encapsulate session member info
+ class SessionId {
+ public:
+   SessionId(unsigned int sid, unsigned int osid, int pid, 
+ 	    const char* username, const char* hostname, 
+ 	    int hostid, DrawLink* link = nil);
+   virtual ~SessionId();
+   
+   unsigned int sid() { return _sid; }
+   // return session id
+   unsigned int osid() { return _osid; }
+   // return original session id
+   unsigned int pid() { return _pid; }
+   // return associated process id
+   const char* username() { return _username; }
+   // return associated user name
+   const char* hostname() { return _hostname; }
+   // return associated host name
+   int hostid() { return _hostid; }
+   // return associated host id.
+   DrawLink* drawlink() { return _drawlink; }
+   // return associated DrawLink
+   void drawlink(DrawLink* link) {_drawlink =  link; }
+   // set associated DrawLink
+ protected:
+   unsigned int _sid;
+   unsigned int _osid;
+   int _pid;
+   char* _username;
+   char* _hostname;
+   int _hostid;
+   DrawLink* _drawlink;
+ };
+ 
+ #endif
*** /dev/null	 Fri Mar 26 16:25:28 PST 2004
--- patches/ivtools-040326-johnston-077
*************** patches/ivtools-040326-johnston-077
*** 0 ****
--- 1 ----
+ ivtools-040326-johnston-077

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040326-johnston-076"
Content-Disposition: attachment;
	filename=ivtools-040326-johnston-076

Patch:    ivtools-040326-johnston-076
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/Imakefile
diff -c DrawServ/Imakefile:1.7 DrawServ/Imakefile:1.8
*** DrawServ/Imakefile:1.7	Fri Mar  5 10:54:11 2004
--- src/DrawServ/Imakefile	Fri Mar 26 16:22:59 2004
***************
*** 33,43 ****
--- 33,45 ----
  Obj26(grid)
  Obj26(gridlist)
  Obj26(linkselection)
+ Obj26(sid)
  
  
  #define Obj31(file) MakeObjectFromSrcFlags(file, -Div2_6_incompatible -I$(TOP)/src/include $(TOP_CCINCLUDES))
  
  Obj31(drawkit)
+ Obj31(rcdialog)
  
  IncludeDependencies()
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.23 DrawServ/drawfunc.c:1.24
*** DrawServ/drawfunc.c:1.23	Fri Mar 19 14:17:14 2004
--- src/DrawServ/drawfunc.c	Fri Mar 26 16:22:59 2004
***************
*** 145,150 ****
--- 145,159 ----
    static int all_sym = symbol_add("all");
    ComValue allv(stack_key(all_sym));
  
+   static int pid_sym = symbol_add("pid");
+   ComValue pidv(stack_key(pid_sym));
+   static int user_sym = symbol_add("user");
+   ComValue userv(stack_key(user_sym));
+   static int host_sym = symbol_add("host");
+   ComValue hostv(stack_key(host_sym));
+   static int hostid_sym = symbol_add("hostid");
+   ComValue hostidv(stack_key(hostid_sym));
+ 
    ComValue sidv(stack_arg(0));
    ComValue osidv(stack_arg(1));
  
***************
*** 165,171 ****
  
    if (sidv.is_known() && osidv.is_known()) {
      ((DrawServ*)unidraw)->sessionid_register_handle
!       (link, sidv.uint_val(), osidv.uint_val());
      
    } else {
      ((DrawServ*)unidraw)->print_sidtable();
--- 174,182 ----
  
    if (sidv.is_known() && osidv.is_known()) {
      ((DrawServ*)unidraw)->sessionid_register_handle
!       (link, sidv.uint_val(), osidv.uint_val(), pidv.int_val(), 
!        userv.string_ptr(), hostv.string_ptr(), 
!        hostidv.int_val());
      
    } else {
      ((DrawServ*)unidraw)->print_sidtable();
Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.4 DrawServ/drawkit.c:1.5
*** DrawServ/drawkit.c:1.4	Mon Mar 22 12:20:07 2004
--- src/DrawServ/drawkit.c	Fri Mar 26 16:22:59 2004
***************
*** 24,30 ****
   */
  
  /*
!  * ComKit definitions
   */
  
  #include <DrawServ/drawkit.h>
--- 24,30 ----
   */
  
  /*
!  * DrawKit definitions
   */
  
  #include <DrawServ/drawkit.h>
***************
*** 33,38 ****
--- 33,39 ----
  #include <DrawServ/drawlinklist.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/linkselection.h>
+ #include <DrawServ/rcdialog.h>
  
  #include <FrameUnidraw/frameeditor.h>
  
***************
*** 454,456 ****
--- 455,473 ----
  OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
    return new LinkSelection((DrawEditor*)GetEditor(), sel);
  }
+ 
+ MenuItem * DrawKit::MakeViewersMenu() {
+     LayoutKit& lk = *LayoutKit::instance();
+     WidgetKit& kit = *WidgetKit::instance();
+ 
+     MenuItem *mbi = kit.menubar_item(kit.label("Connections"));
+     mbi->menu(kit.pulldown());
+ 
+     MenuItem* menu_item = kit.menu_item(kit.label("Connect"));
+     menu_item->action(new RemoteConnectAction(GetEditor()));
+     mbi->menu()->append_item(menu_item);
+ 
+     return mbi;
+ }
+ 
+ 
Index: DrawServ/drawkit.h
diff -c DrawServ/drawkit.h:1.2 DrawServ/drawkit.h:1.3
*** DrawServ/drawkit.h:1.2	Fri Mar  5 10:54:11 2004
--- src/DrawServ/drawkit.h	Fri Mar 26 16:23:00 2004
***************
*** 45,50 ****
--- 45,51 ----
      virtual MenuItem *MakeFileMenu();
      virtual Glyph* MakeToolbar();
      virtual MenuItem* MakeToolsMenu();
+     virtual MenuItem* MakeViewersMenu();
  
      static DrawKit* Instance();
  
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.13 DrawServ/drawlink.c:1.14
*** DrawServ/drawlink.c:1.13	Mon Mar 22 15:14:39 2004
--- src/DrawServ/drawlink.c	Fri Mar 26 16:23:00 2004
***************
*** 26,31 ****
--- 26,32 ----
   */
  
  #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawserv.h>
  #include <DrawServ/drawserv-handler.h>
  #include <Unidraw/globals.h>
  #include <fstream.h>
***************
*** 85,90 ****
--- 86,92 ----
      char buffer[HOST_NAME_MAX];
      gethostname(buffer, HOST_NAME_MAX);
      out << buffer << "\"";
+     out << " :port " << ((DrawServ*)unidraw)->comdraw_port();
      out << " :state " << _state+1;
      out << " :rid " << _local_linkid;
      out << " :lid " << _remote_linkid;
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.44 DrawServ/drawserv.c:1.45
*** DrawServ/drawserv.c:1.44	Mon Mar 22 15:14:39 2004
--- src/DrawServ/drawserv.c	Fri Mar 26 16:23:00 2004
***************
*** 33,38 ****
--- 33,39 ----
  #include <DrawServ/grid.h>
  #include <DrawServ/gridlist.h>
  #include <DrawServ/linkselection.h>
+ #include <DrawServ/sid.h>
  
  #include <OverlayUnidraw/ovclasses.h>
  #include <OverlayUnidraw/ovviews.h>
***************
*** 55,65 ****
  
  #include <fstream.h>
  #include <strstream>
  
  implementTable(GraphicIdTable,int,void*)
  implementTable(SessionIdTable,int,void*)
  implementTable(CompIdTable,void*,void*)
- implementTable(OriginalSidTable,unsigned int,unsigned int)
  
  unsigned int DrawServ::GraphicIdMask = 0x000fffff;
  unsigned int DrawServ::SessionIdMask = 0xfff00000;
--- 56,66 ----
  
  #include <fstream.h>
  #include <strstream>
+ #include <unistd.h>
  
  implementTable(GraphicIdTable,int,void*)
  implementTable(SessionIdTable,int,void*)
  implementTable(CompIdTable,void*,void*)
  
  unsigned int DrawServ::GraphicIdMask = 0x000fffff;
  unsigned int DrawServ::SessionIdMask = 0xfff00000;
***************
*** 83,92 ****
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
    _compidtable = new CompIdTable(1024);
-   _originalsidtable = new OriginalSidTable(32);
  
    _sessionid = unique_sessionid();
!   _sessionidtable->insert(_sessionid, nil); // nil pointer refers to local session id
  }
  
  DrawServ::~DrawServ () 
--- 84,100 ----
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
    _compidtable = new CompIdTable(1024);
  
    _sessionid = unique_sessionid();
!   char hostbuf[HOST_NAME_MAX];
!   gethostname(hostbuf, HOST_NAME_MAX);
!   char userbuf[BUFSIZ];
!   getlogin_r(userbuf, BUFSIZ);
!   int pid = getpid();
!   int hostid = gethostid();
!   SessionId* sid = new SessionId(_sessionid, _sessionid, pid, userbuf, hostbuf, hostid);
!   _sessionidtable->insert(_sessionid, sid);
!   _comdraw_port = atoi(unidraw->GetCatalog()->GetAttribute("comdraw"));
  }
  
  DrawServ::~DrawServ () 
***************
*** 99,105 ****
    delete _gridtable;
    delete _sessionidtable;
    delete _compidtable;
-   delete _originalsidtable;
  }
  
  DrawLink* DrawServ::linkup(const char* hostname, int portnum, 
--- 107,112 ----
***************
*** 343,361 ****
  
  // generate request to register each locally unique session id
  void DrawServ::sessionid_register(DrawLink* link) {
-   char buf[BUFSIZ];
-   snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x)%c", sessionid(), sessionid(), '\0');
-   SendCmdString(link, buf);
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    SessionIdTable_Iterator it(*table);
    while(it.more()) {
      if(it.cur_value()) {
!       DrawLink* otherlink = (DrawLink*)it.cur_value();
!       if (otherlink != link) {
! 	unsigned int sid, osid;
! 	sid = (unsigned int)it.cur_key();
! 	originalsidtable()->find(osid, sid);
! 	snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x)%c", sid, osid, '\0');
  	SendCmdString(link, buf);
        }
      }
--- 350,366 ----
  
  // generate request to register each locally unique session id
  void DrawServ::sessionid_register(DrawLink* link) {
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    SessionIdTable_Iterator it(*table);
    while(it.more()) {
      if(it.cur_value()) {
!       SessionId* sessionid = (SessionId*)it.cur_value();
!       if (sessionid && sessionid->drawlink() != link) {
! 	char buf[BUFSIZ];
! 	snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x :pid %d :user \"%s\" :host \"%s\" :hostid 0x%08x)%c", 
! 		 sessionid->sid(), sessionid->osid(), 
! 		 sessionid->pid(), sessionid->username(),
! 		 sessionid->hostname(), sessionid->hostid(), '\0');
  	SendCmdString(link, buf);
        }
      }
***************
*** 364,383 ****
  }
  
  // handle request to register session id
! void DrawServ::sessionid_register_handle(DrawLink* link, unsigned int sid, unsigned osid) {
    if (link) {
      SessionIdTable* sidtable = ((DrawServ*)unidraw)->sessionidtable();
      unsigned int alt_id = sid;
      if (!DrawServ::test_sessionid(sid)) 
        alt_id = DrawServ::unique_sessionid();
!     sidtable->insert(alt_id, link);
      link->incomingsidtable()->insert(sid, alt_id);
-     ((DrawServ*)unidraw)->originalsidtable()->insert(alt_id, osid);
  
      /* propagate */
!  }
  
!  }
  
  unsigned int DrawServ::unique_grid() {
    static int seed=0;
--- 369,410 ----
  }
  
  // handle request to register session id
! void DrawServ::sessionid_register_handle
! (DrawLink* link, unsigned int sid, unsigned osid, int pid, 
!  const char* username, const char* hostname, int hostid) 
! {
    if (link) {
      SessionIdTable* sidtable = ((DrawServ*)unidraw)->sessionidtable();
      unsigned int alt_id = sid;
      if (!DrawServ::test_sessionid(sid)) 
        alt_id = DrawServ::unique_sessionid();
!     SessionId* session_id = new SessionId(alt_id, osid, pid, username, hostname, hostid, link);
!     sidtable->insert(alt_id, session_id);
      link->incomingsidtable()->insert(sid, alt_id);
  
      /* propagate */
!     sessionid_register_propagate(link, alt_id, osid, pid, username,
! 				 hostname, hostid);
!   }
! }
  
! // propagate request to register session id
! void DrawServ::sessionid_register_propagate
! (DrawLink* link, unsigned int sid, unsigned int osid, int pid, 
!  const char* username, const char* hostname, int hostid)
! {
!   Iterator it;
!   _linklist->First(it);
!   while (!_linklist->Done(it)) {
!     char buf[BUFSIZ];
!     DrawLink* otherlink = _linklist->GetDrawLink(it);
!     if (otherlink != link) {
!       snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x :pid %d :user \"%s\" :host \"%s\" :hostid 0x%08x)%c", sid, osid, pid, username, hostname, hostid, '\0');
!       SendCmdString(otherlink, buf);
!     }
!     _linklist->Next(it);
!   }
! }
  
  unsigned int DrawServ::unique_grid() {
    static int seed=0;
***************
*** 514,518 ****
  }
  
  void DrawServ::print_sidtable() {
!   printf("not implemented yet\n");
  }
--- 541,557 ----
  }
  
  void DrawServ::print_sidtable() {
!   SessionIdTable* table = sessionidtable();
!   SessionIdTable_Iterator it(*table);
!   printf("sid         osid        &DrawLink   lid   rid   pid     hostid  user              host            \n");
!   printf("----------  ----------  ----------  ----  ----  ------  ------  ----              ----            \n");
!   while(it.more()) {
!     SessionId* sid = (SessionId*)it.cur_value();
!     DrawLink* link = sid->drawlink();
!     printf("0x%08x  0x%08x  0x%08x  %4d  %4d  %6d  %6d  %16s  %16s\n", 
! 	   sid->sid(), sid->osid(), link, 
! 	   link ? link->local_linkid() : 9999, link ? link->remote_linkid() : 9999, 
! 	   sid->pid(), sid->hostid(), sid->username(), sid->hostname());
!     it.next();
!   }
  }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.21 DrawServ/drawserv.h:1.22
*** DrawServ/drawserv.h:1.21	Mon Mar 22 15:14:39 2004
--- src/DrawServ/drawserv.h	Fri Mar 26 16:23:00 2004
***************
*** 34,40 ****
  declareTable(GraphicIdTable,int,void*)
  declareTable(SessionIdTable,int,void*)
  declareTable(CompIdTable,void*,void*);
- declareTable(OriginalSidTable,unsigned int,unsigned int);
       
  
  //: Unidraw specialized for DrawServ
--- 34,39 ----
***************
*** 93,115 ****
    // return pointer to table of GraphicId's.
    
    SessionIdTable* sessionidtable() { return _sessionidtable; }
!   // return pointer to table of DrawLink's as a function of session id's.
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
    
-   OriginalSidTable* originalsidtable() { return _originalsidtable; }
-   // return pointer to table that maps from unique local session ids 
-   // to original session ids.
-   
    void sessionid_register(DrawLink* link);
    // register all sessionid's used by this DrawServ with remote DrawServ
    
    void sessionid_register_handle(DrawLink* link, unsigned int sid, 
! 				 unsigned int osid);
    // handle request to register unique session id
    
!   void sessionid_register_propagate(unsigned int sid, unsigned int osid);
    // propagate a newly registered session id to all other DrawLink's
    
    unsigned int sessionid() { return _sessionid; }
--- 92,113 ----
    // return pointer to table of GraphicId's.
    
    SessionIdTable* sessionidtable() { return _sessionidtable; }
!   // return pointer to table of SessionId's
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
    
    void sessionid_register(DrawLink* link);
    // register all sessionid's used by this DrawServ with remote DrawServ
    
    void sessionid_register_handle(DrawLink* link, unsigned int sid, 
! 				 unsigned int osid, int pid, const char* user, 
! 				 const char* host, int hostid);
    // handle request to register unique session id
    
!   void sessionid_register_propagate(DrawLink* link, unsigned int sid, 
! 				    unsigned int osid, int pid, 
! 				    const char* user, const char *host, int hostid);
    // propagate a newly registered session id to all other DrawLink's
    
    unsigned int sessionid() { return _sessionid; }
***************
*** 148,153 ****
--- 146,154 ----
    void print_sidtable();
    // print contents of table of SessionId's
  
+   int comdraw_port() { return _comdraw_port; }
+   // return port used for comdraw command interpreter
+ 
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
***************
*** 156,171 ****
      // maps from id to GraphicId*
      SessionIdTable* _sessionidtable;
      // table of all session id's.
!     // maps from id to DrawLink*
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
-     OriginalSidTable* _originalsidtable;
-     // table of that maps locally unique session ids to original
-     // session ids.
  
      int _sessionid;
      // unique session id.
  
  };
  
--- 157,172 ----
      // maps from id to GraphicId*
      SessionIdTable* _sessionidtable;
      // table of all session id's.
!     // maps from id to SessionId*
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
  
      int _sessionid;
      // unique session id.
+ 
+     int _comdraw_port;
+     // port used for comdraw command interpreter
  
  };
  
*** /dev/null	 Fri Mar 26 16:23:13 PST 2004
--- patches/ivtools-040326-johnston-076
*************** patches/ivtools-040326-johnston-076
*** 0 ****
--- 1 ----
+ ivtools-040326-johnston-076

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040323-johnston-075"
Content-Disposition: attachment;
	filename=ivtools-040323-johnston-075

Patch:    ivtools-040323-johnston-075
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComUnidraw/grfunc.h
diff -c ComUnidraw/grfunc.h:1.2 ComUnidraw/grfunc.h:1.3
*** ComUnidraw/grfunc.h:1.2	Tue Mar 23 11:18:15 2004
--- src/ComUnidraw/grfunc.h	Tue Mar 23 11:51:33 2004
***************
*** 33,41 ****
  //: base class for graphic construction func's
  class CreateGraphicFunc : public UnidrawFunc {
  public:
!     CreateRectFunc(ComTerp*,Editor*);
      Transformer* get_transformer(AttributeList*);
! }
  
  //: rectangle drawing command for comdraw.
  // compview=rect(x0,y0,x1,y1) -- create a rectangle <br>
--- 33,41 ----
  //: base class for graphic construction func's
  class CreateGraphicFunc : public UnidrawFunc {
  public:
!     CreateGraphicFunc(ComTerp*,Editor*);
      Transformer* get_transformer(AttributeList*);
! };
  
  //: rectangle drawing command for comdraw.
  // compview=rect(x0,y0,x1,y1) -- create a rectangle <br>
Index: OverlayUnidraw/ovpanner.c
diff -c OverlayUnidraw/ovpanner.c:1.2 OverlayUnidraw/ovpanner.c:1.3
*** OverlayUnidraw/ovpanner.c:1.2	Tue Mar 23 11:18:13 2004
--- src/OverlayUnidraw/ovpanner.c	Tue Mar 23 11:51:27 2004
***************
*** 430,437 ****
--- 430,439 ----
      SizeKnob();
      if (p->width != oldwidth || p->height != oldheight) {
  	h = Math::round(aspect * float(shape->width));
+ #if 0
  	printf("pw=%d, ph=%d, ow=%d, oh=%d, sw=%d, sh=%d, aspect=%f, h=%d\n",
  		p->width, p->height, oldwidth, oldheight, shape->width, shape->height, aspect, h);
+ #endif
  	if (h == shape->height || h+1 == shape->height || h-1==shape->height) {
  	    Draw();
  	} else {
*** /dev/null	 Tue Mar 23 11:51:56 PST 2004
--- patches/ivtools-040323-johnston-075
*************** patches/ivtools-040323-johnston-075
*** 0 ****
--- 1 ----
+ ivtools-040323-johnston-075

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040323-johnston-074"
Content-Disposition: attachment;
	filename=ivtools-040323-johnston-074

Patch:    ivtools-040323-johnston-074
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.6 ComUnidraw/grfunc.c:1.7
*** ComUnidraw/grfunc.c:1.6	Mon Mar 22 15:14:35 2004
--- src/ComUnidraw/grfunc.c	Tue Mar 23 11:18:15 2004
***************
*** 73,83 ****
  
  #define TITLE "GrFunc"
  
! static int transformer_symid = symbol_add("transformer");
  
  /*****************************************************************************/
  
! CreateRectFunc::CreateRectFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateRectFunc::execute() {
--- 73,117 ----
  
  #define TITLE "GrFunc"
  
! /*****************************************************************************/
! 
! CreateGraphicFunc::CreateGraphicFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
! }
! 
! Transformer* CreateGraphicFunc::get_transformer(AttributeList* al) {
!   static int transform_symid = symbol_add("transform");
  
+   AttributeValue* transformv = nil;
+   Transformer* rel = nil;
+   AttributeValueList* avl = nil;
+   if (al && 
+       (transformv=al->find(transform_symid)) && 
+       transformv->is_array() && 
+       (avl=transformv->array_val()) &&
+       avl->Number()==6) {
+     float a00, a01, a10, a11, a20, a21;
+     Iterator it;
+     avl->First(it); a00=avl->GetAttrVal(it)->float_val();
+     avl->Next(it); a01=avl->GetAttrVal(it)->float_val();
+     avl->Next(it); a10=avl->GetAttrVal(it)->float_val();
+     avl->Next(it); a11=avl->GetAttrVal(it)->float_val();
+     avl->Next(it); a20=avl->GetAttrVal(it)->float_val();
+     avl->Next(it); a21=avl->GetAttrVal(it)->float_val();
+     rel = new Transformer(a00, a01, a10, a11, a20, a21);
+   } else {
+     rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
+     if (rel != nil) {
+       rel = new Transformer(rel);
+       rel->Invert();
+     }
+   }
+   return rel;
+   
+ }
+ 
  /*****************************************************************************/
  
! CreateRectFunc::CreateRectFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateRectFunc::execute() {
***************
*** 113,123 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	SF_Rect* rect = new SF_Rect(coords[x0], coords[y0], coords[x1], coords[y1], stdgraphic);
  
--- 147,153 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	SF_Rect* rect = new SF_Rect(coords[x0], coords[y0], coords[x1], coords[y1], stdgraphic);
  
***************
*** 146,152 ****
  
  /*****************************************************************************/
  
! CreateLineFunc::CreateLineFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateLineFunc::execute() {
--- 176,182 ----
  
  /*****************************************************************************/
  
! CreateLineFunc::CreateLineFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateLineFunc::execute() {
***************
*** 182,192 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowLine* line = new ArrowLine(coords[x0], coords[y0], coords[x1], coords[y1], aVar->Head(), aVar->Tail(), 
--- 212,218 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowLine* line = new ArrowLine(coords[x0], coords[y0], coords[x1], coords[y1], aVar->Head(), aVar->Tail(), 
***************
*** 216,222 ****
  
  /*****************************************************************************/
  
! CreateEllipseFunc::CreateEllipseFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateEllipseFunc::execute() {
--- 242,248 ----
  
  /*****************************************************************************/
  
! CreateEllipseFunc::CreateEllipseFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateEllipseFunc::execute() {
***************
*** 252,263 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
! 
  	SF_Ellipse* ellipse = new SF_Ellipse(args[x0], args[y0], args[r1], args[r2], stdgraphic);
  
  	if (brVar != nil) ellipse->SetBrush(brVar->GetBrush());
--- 278,285 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
! 	Transformer* rel = get_transformer(al);
! 	
  	SF_Ellipse* ellipse = new SF_Ellipse(args[x0], args[y0], args[r1], args[r2], stdgraphic);
  
  	if (brVar != nil) ellipse->SetBrush(brVar->GetBrush());
***************
*** 287,293 ****
  
  // this one needs to get the string value, plus x,y location
  
! CreateTextFunc::CreateTextFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateTextFunc::execute() {
--- 309,315 ----
  
  // this one needs to get the string value, plus x,y location
  
! CreateTextFunc::CreateTextFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateTextFunc::execute() {
***************
*** 323,333 ****
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  	FontVar* fntVar = (FontVar*) _ed->GetState("FontVar");
  	
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  	
  	TextGraphic* text = new TextGraphic(txt, stdgraphic);
  
--- 345,351 ----
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  	FontVar* fntVar = (FontVar*) _ed->GetState("FontVar");
  	
!         Transformer* rel = get_transformer(al);
  	
  	TextGraphic* text = new TextGraphic(txt, stdgraphic);
  
***************
*** 356,362 ****
  
  /*****************************************************************************/
  
! CreateMultiLineFunc::CreateMultiLineFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateMultiLineFunc::execute() {
--- 374,380 ----
  
  /*****************************************************************************/
  
! CreateMultiLineFunc::CreateMultiLineFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateMultiLineFunc::execute() {
***************
*** 392,402 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowMultiLine* multiline = new ArrowMultiLine(x, y, npts, aVar->Head(), aVar->Tail(), 
--- 410,416 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowMultiLine* multiline = new ArrowMultiLine(x, y, npts, aVar->Head(), aVar->Tail(), 
***************
*** 427,433 ****
  
  /*****************************************************************************/
  
! CreateOpenSplineFunc::CreateOpenSplineFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateOpenSplineFunc::execute() {
--- 441,447 ----
  
  /*****************************************************************************/
  
! CreateOpenSplineFunc::CreateOpenSplineFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateOpenSplineFunc::execute() {
***************
*** 463,473 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowOpenBSpline* openspline = new ArrowOpenBSpline(x, y, npts, aVar->Head(), aVar->Tail(), 
--- 477,483 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	ArrowOpenBSpline* openspline = new ArrowOpenBSpline(x, y, npts, aVar->Head(), aVar->Tail(), 
***************
*** 498,504 ****
  
  /*****************************************************************************/
  
! CreatePolygonFunc::CreatePolygonFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreatePolygonFunc::execute() {
--- 508,514 ----
  
  /*****************************************************************************/
  
! CreatePolygonFunc::CreatePolygonFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreatePolygonFunc::execute() {
***************
*** 534,544 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	SF_Polygon* polygon = new SF_Polygon(x, y, npts, stdgraphic);
  
--- 544,550 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	SF_Polygon* polygon = new SF_Polygon(x, y, npts, stdgraphic);
  
***************
*** 567,573 ****
  
  /*****************************************************************************/
  
! CreateClosedSplineFunc::CreateClosedSplineFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateClosedSplineFunc::execute() {
--- 573,579 ----
  
  /*****************************************************************************/
  
! CreateClosedSplineFunc::CreateClosedSplineFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateClosedSplineFunc::execute() {
***************
*** 603,613 ****
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
! 	if (rel != nil) {
! 	    rel = new Transformer(rel);
! 	    rel->Invert();
! 	}
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	SFH_ClosedBSpline* closedspline = new SFH_ClosedBSpline(x, y, npts, stdgraphic);
--- 609,615 ----
  	PatternVar* patVar = (PatternVar*) _ed->GetState("PatternVar");
  	ColorVar* colVar = (ColorVar*) _ed->GetState("ColorVar");
  
!         Transformer* rel = get_transformer(al);
  
  	ArrowVar* aVar = (ArrowVar*) _ed->GetState("ArrowVar");
  	SFH_ClosedBSpline* closedspline = new SFH_ClosedBSpline(x, y, npts, stdgraphic);
***************
*** 637,643 ****
  
  /*****************************************************************************/
  
! CreateRasterFunc::CreateRasterFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
  void CreateRasterFunc::execute() {
--- 639,645 ----
  
  /*****************************************************************************/
  
! CreateRasterFunc::CreateRasterFunc(ComTerp* comterp, Editor* ed) : CreateGraphicFunc(comterp, ed) {
  }
  
  void CreateRasterFunc::execute() {
***************
*** 683,692 ****
--- 685,698 ----
  
  	OverlayRasterRect* rasterrect = new OverlayRasterRect(raster, stdgraphic);
  
+ #if 1
  	Transformer* t = new Transformer();
  	t->Translate(dcoords[x0], dcoords[y0]);
  	rasterrect->SetTransformer(t);
  	Unref(t);
+ #else
+         Transformer* rel = get_transformer(al);
+ #endif
  
  	RasterOvComp* comp = new RasterOvComp(rasterrect);
  	comp->SetAttributeList(al);
Index: ComUnidraw/grfunc.h
diff -c ComUnidraw/grfunc.h:1.1 ComUnidraw/grfunc.h:1.2
*** ComUnidraw/grfunc.h:1.1	Fri Jan  9 11:45:00 2004
--- src/ComUnidraw/grfunc.h	Tue Mar 23 11:18:15 2004
***************
*** 25,36 ****
  #if !defined(grfunc_h)
  #define _grfunc_h
  
  #include <ComUnidraw/unifunc.h>
  
  //: rectangle drawing command for comdraw.
  // compview=rect(x0,y0,x1,y1) -- create a rectangle <br>
  // compview=rectangle(x0,y0,x1,y1) -- same as rect
! class CreateRectFunc : public UnidrawFunc {
  public:
      CreateRectFunc(ComTerp*,Editor*);
      virtual void execute();
--- 25,46 ----
  #if !defined(grfunc_h)
  #define _grfunc_h
  
+ 
  #include <ComUnidraw/unifunc.h>
  
+ class Transformer;
+ 
+ //: base class for graphic construction func's
+ class CreateGraphicFunc : public UnidrawFunc {
+ public:
+     CreateRectFunc(ComTerp*,Editor*);
+     Transformer* get_transformer(AttributeList*);
+ }
+ 
  //: rectangle drawing command for comdraw.
  // compview=rect(x0,y0,x1,y1) -- create a rectangle <br>
  // compview=rectangle(x0,y0,x1,y1) -- same as rect
! class CreateRectFunc : public CreateGraphicFunc {
  public:
      CreateRectFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 41,47 ****
  //: line drawing command for comdraw.
  // compview=line(x0,y0,x1,y1) -- create a line <br>
  // compview=arrowline(x0,y0,x1,y1) -- same as line
! class CreateLineFunc : public UnidrawFunc {
  public:
      CreateLineFunc(ComTerp*,Editor*);
      virtual void execute();
--- 51,57 ----
  //: line drawing command for comdraw.
  // compview=line(x0,y0,x1,y1) -- create a line <br>
  // compview=arrowline(x0,y0,x1,y1) -- same as line
! class CreateLineFunc : public CreateGraphicFunc {
  public:
      CreateLineFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 51,57 ****
  
  //: ellipse drawing command for comdraw.
  // compview=ellipse(x0,y0,r1,r2) -- create an ellipse
! class CreateEllipseFunc : public UnidrawFunc {
  public:
      CreateEllipseFunc(ComTerp*,Editor*);
      virtual void execute();
--- 61,67 ----
  
  //: ellipse drawing command for comdraw.
  // compview=ellipse(x0,y0,r1,r2) -- create an ellipse
! class CreateEllipseFunc : public CreateGraphicFunc {
  public:
      CreateEllipseFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 61,67 ****
  
  //: text drawing command for comdraw.
  // compview=text(x0,y0 textstr) -- create a text string
! class CreateTextFunc : public UnidrawFunc { 
  public:
      CreateTextFunc(ComTerp*,Editor*);
      virtual void execute();
--- 71,77 ----
  
  //: text drawing command for comdraw.
  // compview=text(x0,y0 textstr) -- create a text string
! class CreateTextFunc : public CreateGraphicFunc { 
  public:
      CreateTextFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 72,78 ****
  //: multiline drawing command for comdraw.
  // compview=multiline(x0,y0[,x1,y1,...]) -- create a multiline <br>
  // compview=arrowmultiline(x0,y0[,x1,y1,...]) -- same as multiline
! class CreateMultiLineFunc : public UnidrawFunc {
  public:
      CreateMultiLineFunc(ComTerp*,Editor*);
      virtual void execute();
--- 82,88 ----
  //: multiline drawing command for comdraw.
  // compview=multiline(x0,y0[,x1,y1,...]) -- create a multiline <br>
  // compview=arrowmultiline(x0,y0[,x1,y1,...]) -- same as multiline
! class CreateMultiLineFunc : public CreateGraphicFunc {
  public:
      CreateMultiLineFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 83,89 ****
  //: open spline drawing command for comdraw.
  // compview=openspline(x0,y0[,x1,y1,...]) -- create an open spline <br>
  // compview=arrowspline(x0,y0[,x1,y1,...]) -- same as openspline
! class CreateOpenSplineFunc : public UnidrawFunc {
  public:
      CreateOpenSplineFunc(ComTerp*,Editor*);
      virtual void execute();
--- 93,99 ----
  //: open spline drawing command for comdraw.
  // compview=openspline(x0,y0[,x1,y1,...]) -- create an open spline <br>
  // compview=arrowspline(x0,y0[,x1,y1,...]) -- same as openspline
! class CreateOpenSplineFunc : public CreateGraphicFunc {
  public:
      CreateOpenSplineFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 93,99 ****
  
  //: polygon drawing command for comdraw.
  // compview=polygon(x0,y0[,x1,y1,...]) -- create a polygon
! class CreatePolygonFunc : public UnidrawFunc {
  public:
      CreatePolygonFunc(ComTerp*,Editor*);
      virtual void execute();
--- 103,109 ----
  
  //: polygon drawing command for comdraw.
  // compview=polygon(x0,y0[,x1,y1,...]) -- create a polygon
! class CreatePolygonFunc : public CreateGraphicFunc {
  public:
      CreatePolygonFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 103,109 ****
  
  //: closed spline drawing command for comdraw.
  // compview=closedspline(x0,y0[,x1,y1,...]) -- create a closed spline
! class CreateClosedSplineFunc : public UnidrawFunc {
  public:
      CreateClosedSplineFunc(ComTerp*,Editor*);
      virtual void execute();
--- 113,119 ----
  
  //: closed spline drawing command for comdraw.
  // compview=closedspline(x0,y0[,x1,y1,...]) -- create a closed spline
! class CreateClosedSplineFunc : public CreateGraphicFunc {
  public:
      CreateClosedSplineFunc(ComTerp*,Editor*);
      virtual void execute();
***************
*** 113,119 ****
  
  //: raster creation command for comdraw.
  // compview=raster(x0,y0,x1,y1) -- create an empty raster
! class CreateRasterFunc : public UnidrawFunc {
  public:
      CreateRasterFunc(ComTerp*,Editor*);
      virtual void execute();
--- 123,129 ----
  
  //: raster creation command for comdraw.
  // compview=raster(x0,y0,x1,y1) -- create an empty raster
! class CreateRasterFunc : public CreateGraphicFunc {
  public:
      CreateRasterFunc(ComTerp*,Editor*);
      virtual void execute();
Index: OverlayUnidraw/ovpanner.c
diff -c OverlayUnidraw/ovpanner.c:1.1 OverlayUnidraw/ovpanner.c:1.2
*** OverlayUnidraw/ovpanner.c:1.1	Fri Jan  9 11:44:54 2004
--- src/OverlayUnidraw/ovpanner.c	Tue Mar 23 11:18:13 2004
***************
*** 414,420 ****
  	top = bottom + Math::max(SliderY(s->curheight), MIN_SIZE);
      }
  }    
! 
  void OverlaySlider::Update () {
      register Perspective* p = shown;
      int h, oldwidth, oldheight;
--- 414,420 ----
  	top = bottom + Math::max(SliderY(s->curheight), MIN_SIZE);
      }
  }    
! #include <stdio.h>
  void OverlaySlider::Update () {
      register Perspective* p = shown;
      int h, oldwidth, oldheight;
***************
*** 430,436 ****
      SizeKnob();
      if (p->width != oldwidth || p->height != oldheight) {
  	h = Math::round(aspect * float(shape->width));
! 	if (h == shape->height) {
  	    Draw();
  	} else {
  	    shape->height = h;
--- 430,438 ----
      SizeKnob();
      if (p->width != oldwidth || p->height != oldheight) {
  	h = Math::round(aspect * float(shape->width));
! 	printf("pw=%d, ph=%d, ow=%d, oh=%d, sw=%d, sh=%d, aspect=%f, h=%d\n",
! 		p->width, p->height, oldwidth, oldheight, shape->width, shape->height, aspect, h);
! 	if (h == shape->height || h+1 == shape->height || h-1==shape->height) {
  	    Draw();
  	} else {
  	    shape->height = h;
*** /dev/null	 Tue Mar 23 11:18:28 PST 2004
--- patches/ivtools-040323-johnston-074
*************** patches/ivtools-040323-johnston-074
*** 0 ****
--- 1 ----
+ ivtools-040323-johnston-074

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040322-johnston-073"
Content-Disposition: attachment;
	filename=ivtools-040322-johnston-073

Patch:    ivtools-040322-johnston-073
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComUnidraw/grfunc.c
diff -c ComUnidraw/grfunc.c:1.5 ComUnidraw/grfunc.c:1.6
*** ComUnidraw/grfunc.c:1.5	Fri Mar 12 11:33:00 2004
--- src/ComUnidraw/grfunc.c	Mon Mar 22 15:14:35 2004
***************
*** 73,78 ****
--- 73,80 ----
  
  #define TITLE "GrFunc"
  
+ static int transformer_symid = symbol_add("transformer");
+ 
  /*****************************************************************************/
  
  CreateRectFunc::CreateRectFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.12 DrawServ/drawlink.c:1.13
*** DrawServ/drawlink.c:1.12	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawlink.c	Mon Mar 22 15:14:39 2004
***************
*** 26,31 ****
--- 26,32 ----
   */
  
  #include <DrawServ/drawlink.h>
+ #include <DrawServ/drawserv-handler.h>
  #include <Unidraw/globals.h>
  #include <fstream.h>
  #include <unistd.h>
***************
*** 101,106 ****
--- 102,108 ----
  int DrawLink::close() {
    fprintf(stderr, "Closing link to %s (%s) port # %d (lid=%d, rid=%d)\n", 
  	  hostname(), althostname(), portnum(), local_linkid(), remote_linkid());
+   if (handler()) handler()->drawlink(nil);
    if (_socket) {
      if (_socket->close () == -1)
        ACE_ERROR ((LM_ERROR, "%p\n", "close"));
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.43 DrawServ/drawserv.c:1.44
*** DrawServ/drawserv.c:1.43	Mon Mar 22 12:20:07 2004
--- src/DrawServ/drawserv.c	Mon Mar 22 15:14:39 2004
***************
*** 91,96 ****
--- 91,100 ----
  
  DrawServ::~DrawServ () 
  {
+   Iterator it;
+   _linklist->First(it);
+   while(_linklist->GetDrawLink(it) && !_linklist->Done(it))
+     linkdown(_linklist->GetDrawLink(it));
    delete _linklist;
    delete _gridtable;
    delete _sessionidtable;
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.20 DrawServ/drawserv.h:1.21
*** DrawServ/drawserv.h:1.20	Fri Mar 19 12:03:28 2004
--- src/DrawServ/drawserv.h	Mon Mar 22 15:14:39 2004
***************
*** 147,153 ****
    
    void print_sidtable();
    // print contents of table of SessionId's
!   
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
--- 147,153 ----
    
    void print_sidtable();
    // print contents of table of SessionId's
! 
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.16 DrawServ/linkselection.c:1.17
*** DrawServ/linkselection.c:1.16	Mon Mar 22 12:20:07 2004
--- src/DrawServ/linkselection.c	Mon Mar 22 15:14:39 2004
***************
*** 92,102 ****
      }
      Next(it);
    }
- #else
-   Reserve();
  #endif
    OverlaySelection::Clear(viewer);
!   
  }
  
  void LinkSelection::Reserve() {
--- 92,100 ----
      }
      Next(it);
    }
  #endif
    OverlaySelection::Clear(viewer);
!   Reserve();
  }
  
  void LinkSelection::Reserve() {
Index: drawserv_/main.c
diff -c drawserv_/main.c:1.5 drawserv_/main.c:1.6
*** drawserv_/main.c:1.5	Mon Mar 22 11:21:27 2004
--- src/drawserv_/main.c	Mon Mar 22 15:14:40 2004
***************
*** 218,223 ****
--- 218,224 ----
      newaction.sa_flags = 0;
      newaction.sa_sigaction = 0;
      int status = sigaction(SIGPIPE, &newaction, &oldaction); 
+     fprintf(stderr, "sigaction status %d  errno %d\n", status, errno);
    
  #ifdef HAVE_ACE
      Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton()));
*** /dev/null	 Mon Mar 22 15:14:50 PST 2004
--- patches/ivtools-040322-johnston-073
*************** patches/ivtools-040322-johnston-073
*** 0 ****
--- 1 ----
+ ivtools-040322-johnston-073

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040322-johnston-072"
Content-Disposition: attachment;
	filename=ivtools-040322-johnston-072

Patch:    ivtools-040322-johnston-072
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawkit.c
diff -c DrawServ/drawkit.c:1.3 DrawServ/drawkit.c:1.4
*** DrawServ/drawkit.c:1.3	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawkit.c	Mon Mar 22 12:20:07 2004
***************
*** 452,456 ****
  }
  
  OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
!   return new LinkSelection(sel);
  }
--- 452,456 ----
  }
  
  OverlaySelection* DrawKit::MakeSelection(Selection* sel) {
!   return new LinkSelection((DrawEditor*)GetEditor(), sel);
  }
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.42 DrawServ/drawserv.c:1.43
*** DrawServ/drawserv.c:1.42	Fri Mar 19 16:33:11 2004
--- src/DrawServ/drawserv.c	Mon Mar 22 12:20:07 2004
***************
*** 427,435 ****
  
  void DrawServ::grid_message(GraphicId* grid) {
    char buf[BUFSIZ];
!   if (grid->selected()==LinkSelection::LocallySelected) {
      snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d )%c", grid->id(), grid->selector(), 
! 	     LinkSelection::RemotelySelected, '\0');
      DistributeCmdString(buf);
    } else {
      
--- 427,437 ----
  
  void DrawServ::grid_message(GraphicId* grid) {
    char buf[BUFSIZ];
!   if (grid->selected()==LinkSelection::LocallySelected ||
!       (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected)) {
      snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d )%c", grid->id(), grid->selector(), 
! 	     grid->selected()==LinkSelection::LocallySelected ? 
! 	     LinkSelection::RemotelySelected : LinkSelection::NotSelected, '\0');
      DistributeCmdString(buf);
    } else {
      
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.15 DrawServ/linkselection.c:1.16
*** DrawServ/linkselection.c:1.15	Mon Mar 22 11:21:25 2004
--- src/DrawServ/linkselection.c	Mon Mar 22 12:20:07 2004
***************
*** 48,61 ****
  
  /*****************************************************************************/
  
! LinkSelection::LinkSelection (LinkSelection* s) : OverlaySelection(s) {
    if (!_locally_selected) {
      _locally_selected = new GraphicIdList;
      _waiting_to_be_selected = new GraphicIdList;
    }
  }
  
! LinkSelection::LinkSelection (Selection* s) : OverlaySelection(s) {
    if (!_locally_selected) {
      _locally_selected = new GraphicIdList;
      _waiting_to_be_selected = new GraphicIdList;
--- 48,63 ----
  
  /*****************************************************************************/
  
! LinkSelection::LinkSelection (DrawEditor* editor, LinkSelection* s) : OverlaySelection(s) {
!   _editor = editor;
    if (!_locally_selected) {
      _locally_selected = new GraphicIdList;
      _waiting_to_be_selected = new GraphicIdList;
    }
  }
  
! LinkSelection::LinkSelection (DrawEditor* editor, Selection* s) : OverlaySelection(s) {
!   _editor = editor;
    if (!_locally_selected) {
      _locally_selected = new GraphicIdList;
      _waiting_to_be_selected = new GraphicIdList;
***************
*** 64,76 ****
  
  void LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
!   if (viewer) 
!     Reserve(viewer->GetEditor());
    OverlaySelection::Update(viewer);
  }
  
  void LinkSelection::Clear(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Clear\n");
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
    Iterator it;
    First(it);
--- 66,78 ----
  
  void LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
!   Reserve();
    OverlaySelection::Update(viewer);
  }
  
  void LinkSelection::Clear(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Clear\n");
+ #if 0
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
    Iterator it;
    First(it);
***************
*** 90,106 ****
      }
      Next(it);
    }
    OverlaySelection::Clear(viewer);
    
  }
  
! void LinkSelection::Reserve(Editor* ed) {
    fprintf(stderr, "LinkSelection::Reserve\n");
-   static int id_sym = symbol_add("id");
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
    /* clear anything that was in the previous selection, but not in this one */
!   Selection* lastsel = ((DrawEditor*)ed)->last_selection();
    Iterator lt;
    lastsel->First(lt);
    Iterator it;
--- 92,110 ----
      }
      Next(it);
    }
+ #else
+   Reserve();
+ #endif
    OverlaySelection::Clear(viewer);
    
  }
  
! void LinkSelection::Reserve() {
    fprintf(stderr, "LinkSelection::Reserve\n");
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
    /* clear anything that was in the previous selection, but not in this one */
!   Selection* lastsel = _editor->last_selection();
    Iterator lt;
    lastsel->First(lt);
    Iterator it;
***************
*** 123,132 ****
  	((DrawServ*)unidraw)->grid_message(grid);
        }
      }
!     lastsel->Next(lt);
    }
-   lastsel->Clear();
  
    /* remove anything from selection that has a remote selector */
    First(it);
    while (!Done(it)) {
--- 127,136 ----
  	((DrawServ*)unidraw)->grid_message(grid);
        }
      }
!     lastsel->Remove(lt);
    }
  
+ 
    /* remove anything from selection that has a remote selector */
    First(it);
    while (!Done(it)) {
***************
*** 163,167 ****
    }
  
    /* store copy of selection */
!   lastsel->Merge(this);
  }
--- 167,175 ----
    }
  
    /* store copy of selection */
!   First(it);
!   while (!Done(it)) {
!     lastsel->Append(GetView(it));
!     Next(it);
!   }
  }
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.6 DrawServ/linkselection.h:1.7
*** DrawServ/linkselection.h:1.6	Mon Mar 22 11:21:25 2004
--- src/DrawServ/linkselection.h	Mon Mar 22 12:20:07 2004
***************
*** 37,49 ****
  // between two remote drawing editors that are linked together.
  class LinkSelection: public OverlaySelection {
  public:
!     LinkSelection(LinkSelection* = nil);
!     LinkSelection(Selection*);
  
      virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
!     virtual void Reserve(Editor*);
      // reserve newly created graphics in selection across the network
  
    enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected };
--- 37,49 ----
  // between two remote drawing editors that are linked together.
  class LinkSelection: public OverlaySelection {
  public:
!     LinkSelection(DrawEditor* ed, LinkSelection* = nil);
!     LinkSelection(DrawEditor* ed, Selection*);
  
      virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
!     virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
    enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected };
***************
*** 51,56 ****
--- 51,57 ----
    static const char* selected_string(int state) { return _selected_strings[state]; }
  
  protected:
+   DrawEditor* _editor;
    static GraphicIdList* _locally_selected;
    static GraphicIdList* _waiting_to_be_selected;
  
Index: OverlayUnidraw/ovcomps.c
diff -c OverlayUnidraw/ovcomps.c:1.3 OverlayUnidraw/ovcomps.c:1.4
*** OverlayUnidraw/ovcomps.c:1.3	Mon Mar 22 11:21:19 2004
--- src/OverlayUnidraw/ovcomps.c	Mon Mar 22 12:20:03 2004
***************
*** 1008,1014 ****
              if (view != nil) s->Append(view);
          }
      }
!     ((OverlaySelection*)s)->Reserve(ed);
  }
  
  void OverlaysComp::StorePosition (OverlayComp* comp, Command* cmd) {
--- 1008,1014 ----
              if (view != nil) s->Append(view);
          }
      }
!     ((OverlaySelection*)s)->Reserve();
  }
  
  void OverlaysComp::StorePosition (OverlayComp* comp, Command* cmd) {
Index: OverlayUnidraw/ovselection.h
diff -c OverlayUnidraw/ovselection.h:1.5 OverlayUnidraw/ovselection.h:1.6
*** OverlayUnidraw/ovselection.h:1.5	Mon Mar 22 11:21:20 2004
--- src/OverlayUnidraw/ovselection.h	Mon Mar 22 12:20:03 2004
***************
*** 31,37 ****
  
  #include <Unidraw/selection.h>
  
- class Editor;
  class OverlayView;
  class OverlayViewer;
  
--- 31,36 ----
***************
*** 70,76 ****
  
      OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
!     virtual void Reserve(Editor* ed) { return; }
      // for use of derived classes
  
  protected:
--- 69,75 ----
  
      OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
!     virtual void Reserve() { return; }
      // for use of derived classes
  
  protected:
*** /dev/null	 Mon Mar 22 12:20:21 PST 2004
--- patches/ivtools-040322-johnston-072
*************** patches/ivtools-040322-johnston-072
*** 0 ****
--- 1 ----
+ ivtools-040322-johnston-072

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-069"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-069

Patch:    ivtools-040319-johnston-069
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.40 DrawServ/drawserv.c:1.41
*** DrawServ/drawserv.c:1.40	Fri Mar 19 15:39:36 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 16:12:15 2004
***************
*** 437,444 ****
      DrawLink* link = _linklist->find_drawlink(grid);
      
      if (link) {
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d :request 0x%08x)%c", grid->id(), 
! 	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
        SendCmdString(link, buf);
      }
    }
--- 437,444 ----
      DrawLink* link = _linklist->find_drawlink(grid);
      
      if (link) {
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :request 0x%08x)%c", grid->id(), 
! 	       grid->selector(), sessionid(), '\0');
        SendCmdString(link, buf);
      }
    }
*** /dev/null	 Fri Mar 19 16:12:23 PST 2004
--- patches/ivtools-040319-johnston-069
*************** patches/ivtools-040319-johnston-069
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-069

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-068"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-068

Patch:    ivtools-040319-johnston-068
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.39 DrawServ/drawserv.c:1.40
*** DrawServ/drawserv.c:1.39	Fri Mar 19 15:14:32 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 15:39:36 2004
***************
*** 428,434 ****
  void DrawServ::grid_message(GraphicId* grid) {
    char buf[BUFSIZ];
    if (grid->selected()==LinkSelection::LocallySelected) {
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d )%c", grid->id(), grid->selector(), 
  	     LinkSelection::RemotelySelected, '\0');
      DistributeCmdString(buf);
    } else {
--- 428,434 ----
  void DrawServ::grid_message(GraphicId* grid) {
    char buf[BUFSIZ];
    if (grid->selected()==LinkSelection::LocallySelected) {
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d )%c", grid->id(), grid->selector(), 
  	     LinkSelection::RemotelySelected, '\0');
      DistributeCmdString(buf);
    } else {
***************
*** 437,443 ****
      DrawLink* link = _linklist->find_drawlink(grid);
      
      if (link) {
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), 
  	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
        SendCmdString(link, buf);
      }
--- 437,443 ----
      DrawLink* link = _linklist->find_drawlink(grid);
      
      if (link) {
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d :request 0x%08x)%c", grid->id(), 
  	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
        SendCmdString(link, buf);
      }
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.13 DrawServ/linkselection.c:1.14
*** DrawServ/linkselection.c:1.13	Fri Mar 19 12:03:28 2004
--- src/DrawServ/linkselection.c	Fri Mar 19 15:39:36 2004
***************
*** 81,87 ****
        if (grid->selected()==LocallySelected || grid->selected()==WaitingToBeSelected) 
  	grid->selected(NotSelected);
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c",
  	       grid->id(), grid->selector(), grid->selected(), '\0');
        ((DrawServ*)unidraw)->DistributeCmdString(buf);
      }
--- 81,87 ----
        if (grid->selected()==LocallySelected || grid->selected()==WaitingToBeSelected) 
  	grid->selected(NotSelected);
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :state %d)%c",
  	       grid->id(), grid->selector(), grid->selected(), '\0');
        ((DrawServ*)unidraw)->DistributeCmdString(buf);
      }
*** /dev/null	 Fri Mar 19 15:39:43 PST 2004
--- patches/ivtools-040319-johnston-068
*************** patches/ivtools-040319-johnston-068
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-068

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-067"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-067

Patch:    ivtools-040319-johnston-067
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.38 DrawServ/drawserv.c:1.39
*** DrawServ/drawserv.c:1.38	Fri Mar 19 14:02:41 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 15:14:32 2004
***************
*** 452,458 ****
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
!     if (selector==sessionid() && newselector) {
        if (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected) {
  	grid->selector(newselector);
  	char buf[BUFSIZ];
--- 452,458 ----
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
!     if (selector==sessionid() && newselector!=0) {
        if (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected) {
  	grid->selector(newselector);
  	char buf[BUFSIZ];
*** /dev/null	 Fri Mar 19 15:14:40 PST 2004
--- patches/ivtools-040319-johnston-067
*************** patches/ivtools-040319-johnston-067
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-067

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-066"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-066

Patch:    ivtools-040319-johnston-066
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.22 DrawServ/drawfunc.c:1.23
*** DrawServ/drawfunc.c:1.22	Fri Mar 19 13:30:05 2004
--- src/DrawServ/drawfunc.c	Fri Mar 19 14:17:14 2004
***************
*** 196,206 ****
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (grantv.is_unknown())
!     ((DrawServ*)unidraw)->grid_message_handle
!       (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
!        requestv.is_known() ? requestv.uint_val() : 0);
!     else 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         grantv.uint_val());
--- 196,210 ----
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (grantv.is_unknown()) {
!       if (requestv.is_unknown()) 
! 	((DrawServ*)unidraw)->grid_message_handle
! 	  (link, idv.uint_val(), selectorv.uint_val(), statev.int_val());
!       else
! 	((DrawServ*)unidraw)->grid_message_handle
! 	  (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
! 	   requestv.uint_val());
!     } else 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         grantv.uint_val());
*** /dev/null	 Fri Mar 19 14:17:23 PST 2004
--- patches/ivtools-040319-johnston-066
*************** patches/ivtools-040319-johnston-066
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-066

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-065"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-065

Patch:    ivtools-040319-johnston-065
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.37 DrawServ/drawserv.c:1.38
*** DrawServ/drawserv.c:1.37	Fri Mar 19 13:50:04 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 14:02:41 2004
***************
*** 426,446 ****
  }
  
  void DrawServ::grid_message(GraphicId* grid) {
!   /* find link on which current selector lives */
!   DrawLink* link = _linklist->find_drawlink(grid);
! 
!   if (link) {
!     char buf[BUFSIZ];
!     if (grid->selected()==LinkSelection::LocallySelected) 
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d )%c", grid->id(), grid->selector(), 
! 	       LinkSelection::RemotelySelected, '\0');
!     else
        snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), 
  	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
!     SendCmdString(link, buf);
    }
  }
! 
  // handle reserve request from remote DrawLink.
  void DrawServ::grid_message_handle(DrawLink* link, unsigned int id, unsigned int selector, 
  				   int state, unsigned int newselector)
--- 426,449 ----
  }
  
  void DrawServ::grid_message(GraphicId* grid) {
!   char buf[BUFSIZ];
!   if (grid->selected()==LinkSelection::LocallySelected) {
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d )%c", grid->id(), grid->selector(), 
! 	     LinkSelection::RemotelySelected, '\0');
!     DistributeCmdString(buf);
!   } else {
!     
!     /* find link on which current selector lives */
!     DrawLink* link = _linklist->find_drawlink(grid);
!     
!     if (link) {
        snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), 
  	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
!       SendCmdString(link, buf);
!     }
    }
  }
!   
  // handle reserve request from remote DrawLink.
  void DrawServ::grid_message_handle(DrawLink* link, unsigned int id, unsigned int selector, 
  				   int state, unsigned int newselector)
*** /dev/null	 Fri Mar 19 14:02:47 PST 2004
--- patches/ivtools-040319-johnston-065
*************** patches/ivtools-040319-johnston-065
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-065

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-064"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-064

Patch:    ivtools-040319-johnston-064
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.36 DrawServ/drawserv.c:1.37
*** DrawServ/drawserv.c:1.36	Fri Mar 19 12:03:28 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 13:50:04 2004
***************
*** 431,440 ****
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), grid->selector(), 
! 	     grid->selected()==LinkSelection::LocallySelected ? 
! 	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected,
! 	     sessionid(), '\0');
      SendCmdString(link, buf);
    }
  }
--- 431,442 ----
  
    if (link) {
      char buf[BUFSIZ];
!     if (grid->selected()==LinkSelection::LocallySelected) 
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d )%c", grid->id(), grid->selector(), 
! 	       LinkSelection::RemotelySelected, '\0');
!     else
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), 
! 	       grid->selector(), LinkSelection::WaitingToBeSelected, sessionid(), '\0');
      SendCmdString(link, buf);
    }
  }
***************
*** 450,456 ****
      if (selector==sessionid() && newselector) {
        if (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected) {
  	grid->selector(newselector);
- 	grid->selected(LinkSelection::RemotelySelected);
  	char buf[BUFSIZ];
  	snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :grant 0x%08x)%c",
  		 grid->id(), newselector, sessionid(), '\0');
--- 452,457 ----
*** /dev/null	 Fri Mar 19 13:50:11 PST 2004
--- patches/ivtools-040319-johnston-064
*************** patches/ivtools-040319-johnston-064
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-064

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-063"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-063

Patch:    ivtools-040319-johnston-063
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.21 DrawServ/drawfunc.c:1.22
*** DrawServ/drawfunc.c:1.21	Fri Mar 19 13:23:59 2004
--- src/DrawServ/drawfunc.c	Fri Mar 19 13:30:05 2004
***************
*** 196,209 ****
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (grantv.is_false())
      ((DrawServ*)unidraw)->grid_message_handle
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         requestv.is_known() ? requestv.uint_val() : 0);
      else 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
!        grantv.is_known() ? grantv.uint_val() : 0);
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
--- 196,209 ----
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (grantv.is_unknown())
      ((DrawServ*)unidraw)->grid_message_handle
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         requestv.is_known() ? requestv.uint_val() : 0);
      else 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
!        grantv.uint_val());
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
*** /dev/null	 Fri Mar 19 13:30:11 PST 2004
--- patches/ivtools-040319-johnston-063
*************** patches/ivtools-040319-johnston-063
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-063

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-062"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-062

Patch:    ivtools-040319-johnston-062
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.20 DrawServ/drawfunc.c:1.21
*** DrawServ/drawfunc.c:1.20	Fri Mar 19 12:03:27 2004
--- src/DrawServ/drawfunc.c	Fri Mar 19 13:23:59 2004
***************
*** 196,206 ****
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (requestv.is_true())
      ((DrawServ*)unidraw)->grid_message_handle
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         requestv.is_known() ? requestv.uint_val() : 0);
!     else if (grantv.is_true()) 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         grantv.is_known() ? grantv.uint_val() : 0);
--- 196,206 ----
    DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
    if (idv.is_known() && selectorv.is_known()) {
!     if (grantv.is_false())
      ((DrawServ*)unidraw)->grid_message_handle
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         requestv.is_known() ? requestv.uint_val() : 0);
!     else 
      ((DrawServ*)unidraw)->grid_message_callback
        (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
         grantv.is_known() ? grantv.uint_val() : 0);
*** /dev/null	 Fri Mar 19 13:24:06 PST 2004
--- patches/ivtools-040319-johnston-062
*************** patches/ivtools-040319-johnston-062
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-062

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-061"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-061

Patch:    ivtools-040319-johnston-061
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.19 DrawServ/drawfunc.c:1.20
*** DrawServ/drawfunc.c:1.19	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawfunc.c	Fri Mar 19 12:03:27 2004
***************
*** 180,194 ****
  }
  
  void GraphicIdFunc::execute() {
    ComValue idv(stack_arg(0));
    ComValue selectorv(stack_arg(1));
-   ComValue selectedv(stack_arg(2));
  
    reset_stack();
  
!   if (idv.is_known() && selectorv.is_known() && selectedv.is_known()) {
      ((DrawServ*)unidraw)->grid_message_handle
!       (idv.uint_val(), selectorv.uint_val(), selectedv.int_val());
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
--- 180,209 ----
  }
  
  void GraphicIdFunc::execute() {
+   static int request_sym = symbol_add("request");
+   ComValue requestv(stack_key(request_sym));
+   static int grant_sym = symbol_add("grant");
+   ComValue grantv(stack_key(grant_sym));
+   static int state_sym = symbol_add("state");
+   ComValue statev(stack_key(state_sym));
+ 
    ComValue idv(stack_arg(0));
    ComValue selectorv(stack_arg(1));
  
    reset_stack();
+ 
+   DrawServHandler* handler = comterp() ? (DrawServHandler*)comterp()->handler() : nil;
+   DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
  
!   if (idv.is_known() && selectorv.is_known()) {
!     if (requestv.is_true())
      ((DrawServ*)unidraw)->grid_message_handle
!       (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
!        requestv.is_known() ? requestv.uint_val() : 0);
!     else if (grantv.is_true()) 
!     ((DrawServ*)unidraw)->grid_message_callback
!       (link, idv.uint_val(), selectorv.uint_val(), statev.int_val(), 
!        grantv.is_known() ? grantv.uint_val() : 0);
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.7 DrawServ/drawfunc.h:1.8
*** DrawServ/drawfunc.h:1.7	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawfunc.h	Fri Mar 19 12:03:28 2004
***************
*** 48,60 ****
  };
  
  //: command to send message between remote selections
! // grid(id selector selected) -- command to send message between remote selections
  class GraphicIdFunc : public UnidrawFunc {
  public:
      GraphicIdFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(id selector selected) -- command to send message between remote selections"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
--- 48,60 ----
  };
  
  //: command to send message between remote selections
! // grid(id selector :state selected :request newselector :grant oldselector) -- command to send message between remote selections
  class GraphicIdFunc : public UnidrawFunc {
  public:
      GraphicIdFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(id selector :state selected :request newselector :grant oldselector) -- command to send message between remote selections"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.35 DrawServ/drawserv.c:1.36
*** DrawServ/drawserv.c:1.35	Fri Mar 19 11:25:41 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 12:03:28 2004
***************
*** 425,457 ****
      return 1;
  }
  
! void DrawServ::ReserveSelection(GraphicId* grid) {
    /* find link on which current selector lives */
    DrawLink* link = _linklist->find_drawlink(grid);
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c", grid->id(), sessionid(), 
  	     grid->selected()==LinkSelection::LocallySelected ? 
! 	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected, '\0');
      SendCmdString(link, buf);
    }
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_handle(unsigned int id, unsigned int selector, int selected)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
      grid->selector(selector);
-     grid->selected(selected);
    }
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_propagate(unsigned int id, unsigned int selector, int selected)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
--- 425,483 ----
      return 1;
  }
  
! void DrawServ::grid_message(GraphicId* grid) {
    /* find link on which current selector lives */
    DrawLink* link = _linklist->find_drawlink(grid);
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d :request 0x%08x)%c", grid->id(), grid->selector(), 
  	     grid->selected()==LinkSelection::LocallySelected ? 
! 	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected,
! 	     sessionid(), '\0');
      SendCmdString(link, buf);
    }
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_handle(DrawLink* link, unsigned int id, unsigned int selector, 
! 				   int state, unsigned int newselector)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
+     if (selector==sessionid() && newselector) {
+       if (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected) {
+ 	grid->selector(newselector);
+ 	grid->selected(LinkSelection::RemotelySelected);
+ 	char buf[BUFSIZ];
+ 	snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :grant 0x%08x)%c",
+ 		 grid->id(), newselector, sessionid(), '\0');
+ 	SendCmdString(link, buf);
+       }
+     } else {
+       grid->selector(selector);
+       grid->selected(state);
+     }
+   }
+ }
+ 
+ // handle callback from remote DrawLink.
+ void DrawServ::grid_message_callback(DrawLink* link, unsigned int id, unsigned int selector, 
+ 				     int state, unsigned int oldselector)
+ {
+   void* ptr = nil;
+   gridtable()->find(ptr, id);
+   if (ptr) {
+     GraphicId* grid = (GraphicId*)ptr;
      grid->selector(selector);
    }
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_propagate(DrawLink* link, unsigned int id, unsigned int selector, 
! 				      int selected, unsigned int otherselector)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.19 DrawServ/drawserv.h:1.20
*** DrawServ/drawserv.h:1.19	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawserv.h	Fri Mar 19 12:03:28 2004
***************
*** 86,94 ****
    virtual void SendCmdString(DrawLink* link, const char* cmdstring);
    // execute command string on one remote DrawServ
  
-   virtual void ReserveSelection(GraphicId* grid);
-   // send request to reserve graphic for future selection
-   
    DrawLinkList* linklist() { return _linklist; }
    // return pointer to list of DrawLink's
    
--- 86,91 ----
***************
*** 118,130 ****
    unsigned int sessionid() { return _sessionid; }
    // current unique session id.
  
!   void grid_message(unsigned int id, unsigned int selector, int selected);
    // generate graphic id selection message
  
!   void grid_message_handle(unsigned int id, unsigned int selector, int selected);
    // handle graphic id selection message
  
!   void grid_message_propagate(unsigned int id, unsigned int selector, int selected);
    // propagate graphic id selection message
  
    static unsigned int unique_grid();
--- 115,133 ----
    unsigned int sessionid() { return _sessionid; }
    // current unique session id.
  
!   void grid_message(GraphicId* grid);
    // generate graphic id selection message
  
!   void grid_message_handle(DrawLink* link, unsigned int id, unsigned int selector, 
! 			   int state, unsigned int newselector=0);
    // handle graphic id selection message
+ 
+   void grid_message_callback(DrawLink* link, unsigned int id, unsigned int selector, 
+ 			     int state, unsigned int oldselector);
+   // callback for graphic id selection message 
  
!   void grid_message_propagate(DrawLink* link, unsigned int id, unsigned int selector, 
! 			      int state, unsigned int otherselector=0);
    // propagate graphic id selection message
  
    static unsigned int unique_grid();
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.12 DrawServ/linkselection.c:1.13
*** DrawServ/linkselection.c:1.12	Fri Mar 19 10:05:33 2004
--- src/DrawServ/linkselection.c	Fri Mar 19 12:03:28 2004
***************
*** 117,128 ****
  	  
  	  /* make a request to select this in the future */
  	  grid->selected(WaitingToBeSelected);
! 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
  	} 
  	
        } else {
  	grid->selected(LocallySelected);
! 	((DrawServ*)unidraw)->ReserveSelection(grid);
        }
        
      }
--- 117,128 ----
  	  
  	  /* make a request to select this in the future */
  	  grid->selected(WaitingToBeSelected);
! 	  ((DrawServ*)unidraw)->grid_message(grid);
  	} 
  	
        } else {
  	grid->selected(LocallySelected);
! 	((DrawServ*)unidraw)->grid_message(grid);
        }
        
      }
*** /dev/null	 Fri Mar 19 12:03:34 PST 2004
--- patches/ivtools-040319-johnston-061
*************** patches/ivtools-040319-johnston-061
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-061

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-060"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-060

Patch:    ivtools-040319-johnston-060
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.34 DrawServ/drawserv.c:1.35
*** DrawServ/drawserv.c:1.34	Fri Mar 19 10:05:33 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 11:25:41 2004
***************
*** 431,442 ****
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x)%c", grid->id(), sessionid(), 
  	     grid->selected()==LinkSelection::LocallySelected ? 
  	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected, '\0');
      SendCmdString(link, buf);
!   } else
!     fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
  }
  
  // handle reserve request from remote DrawLink.
--- 431,441 ----
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c", grid->id(), sessionid(), 
  	     grid->selected()==LinkSelection::LocallySelected ? 
  	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected, '\0');
      SendCmdString(link, buf);
!   }
  }
  
  // handle reserve request from remote DrawLink.
*** /dev/null	 Fri Mar 19 11:25:52 PST 2004
--- patches/ivtools-040319-johnston-060
*************** patches/ivtools-040319-johnston-060
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-060

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-059"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-059

Patch:    ivtools-040319-johnston-059
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.33 DrawServ/drawserv.c:1.34
*** DrawServ/drawserv.c:1.33	Fri Mar 19 09:57:45 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 10:05:33 2004
***************
*** 431,437 ****
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x)%c", grid->id(), sessionid(), '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
--- 431,439 ----
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x)%c", grid->id(), sessionid(), 
! 	     grid->selected()==LinkSelection::LocallySelected ? 
! 	     LinkSelection::RemotelySelected : LinkSelection::WaitingToBeSelected, '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.11 DrawServ/linkselection.c:1.12
*** DrawServ/linkselection.c:1.11	Fri Mar 19 09:51:39 2004
--- src/DrawServ/linkselection.c	Fri Mar 19 10:05:33 2004
***************
*** 42,48 ****
  
  GraphicIdList* LinkSelection::_locally_selected = nil;
  GraphicIdList* LinkSelection::_waiting_to_be_selected = nil;
! char* LinkSelection::_selected_strings[] =  { "NotSelected", "LocallySelected", "RemotelySelected", "WaitingToBeSelected", "PreviouslySelected" };
  
  /*****************************************************************************/
  
--- 42,48 ----
  
  GraphicIdList* LinkSelection::_locally_selected = nil;
  GraphicIdList* LinkSelection::_waiting_to_be_selected = nil;
! char* LinkSelection::_selected_strings[] =  { "NotSelected", "LocallySelected", "RemotelySelected", "WaitingToBeSelected"};
  
  /*****************************************************************************/
  
***************
*** 78,90 ****
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selected()==LocallySelected) 
! 	grid->selected(PreviouslySelected);
!       else if (grid->selected()==WaitingToBeSelected)
  	grid->selected(NotSelected);
        char buf[BUFSIZ];
        snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c",
! 	       grid->id(), grid->selector(), NotSelected, '\0');
        ((DrawServ*)unidraw)->DistributeCmdString(buf);
      }
      Next(it);
--- 78,88 ----
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selected()==LocallySelected || grid->selected()==WaitingToBeSelected) 
  	grid->selected(NotSelected);
        char buf[BUFSIZ];
        snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c",
! 	       grid->id(), grid->selector(), grid->selected(), '\0');
        ((DrawServ*)unidraw)->DistributeCmdString(buf);
      }
      Next(it);
***************
*** 115,130 ****
  	Remove(it);
  	removed = true;
  	
! 	if (grid->selected()==PreviouslySelected || 
! 	    grid->selected()==NotSelected) {
  	  
  	  /* make a request to select this in the future */
- 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
  	  grid->selected(WaitingToBeSelected);
  	} 
  	
        } else {
  	grid->selected(LocallySelected);
        }
        
      }
--- 113,128 ----
  	Remove(it);
  	removed = true;
  	
! 	if (grid->selected()==NotSelected) {
  	  
  	  /* make a request to select this in the future */
  	  grid->selected(WaitingToBeSelected);
+ 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
  	} 
  	
        } else {
  	grid->selected(LocallySelected);
+ 	((DrawServ*)unidraw)->ReserveSelection(grid);
        }
        
      }
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.4 DrawServ/linkselection.h:1.5
*** DrawServ/linkselection.h:1.4	Thu Mar 18 10:33:29 2004
--- src/DrawServ/linkselection.h	Fri Mar 19 10:05:33 2004
***************
*** 46,52 ****
      virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
!   enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected, PreviouslySelected };
  
    static const char* selected_string(int state) { return _selected_strings[state]; }
  
--- 46,52 ----
      virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
!   enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected };
  
    static const char* selected_string(int state) { return _selected_strings[state]; }
  
*** /dev/null	 Fri Mar 19 10:05:40 PST 2004
--- patches/ivtools-040319-johnston-059
*************** patches/ivtools-040319-johnston-059
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-059

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-058"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-058

Patch:    ivtools-040319-johnston-058
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.32 DrawServ/drawserv.c:1.33
*** DrawServ/drawserv.c:1.32	Fri Mar 19 09:09:06 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 09:57:45 2004
***************
*** 444,449 ****
--- 444,451 ----
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
+     grid->selector(selector);
+     grid->selected(selected);
    }
  }
  
*** /dev/null	 Fri Mar 19 09:57:54 PST 2004
--- patches/ivtools-040319-johnston-058
*************** patches/ivtools-040319-johnston-058
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-058

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-057"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-057

Patch:    ivtools-040319-johnston-057
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.10 DrawServ/linkselection.c:1.11
*** DrawServ/linkselection.c:1.10	Thu Mar 18 13:51:08 2004
--- src/DrawServ/linkselection.c	Fri Mar 19 09:51:39 2004
***************
*** 78,87 ****
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selected()==LocallySelected)
  	grid->selected(PreviouslySelected);
        else if (grid->selected()==WaitingToBeSelected)
  	grid->selected(NotSelected);
      }
      Next(it);
    }
--- 78,91 ----
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selected()==LocallySelected) 
  	grid->selected(PreviouslySelected);
        else if (grid->selected()==WaitingToBeSelected)
  	grid->selected(NotSelected);
+       char buf[BUFSIZ];
+       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x %d)%c",
+ 	       grid->id(), grid->selector(), NotSelected, '\0');
+       ((DrawServ*)unidraw)->DistributeCmdString(buf);
      }
      Next(it);
    }
*** /dev/null	 Fri Mar 19 09:51:45 PST 2004
--- patches/ivtools-040319-johnston-057
*************** patches/ivtools-040319-johnston-057
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-057

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-056"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-056

Patch:    ivtools-040319-johnston-056
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.5 DrawServ/draweditor.c:1.6
*** DrawServ/draweditor.c:1.5	Thu Mar 18 10:33:28 2004
--- src/DrawServ/draweditor.c	Fri Mar 19 09:09:06 2004
***************
*** 84,90 ****
    FrameEditor::AddCommands(comterp);
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
!   comterp->add_command("sessionid", new SessionIdFunc(comterp, this));
    comterp->add_command("grid", new GraphicIdFunc(comterp, this));
  }
  
--- 84,90 ----
    FrameEditor::AddCommands(comterp);
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
!   comterp->add_command("sid", new SessionIdFunc(comterp, this));
    comterp->add_command("grid", new GraphicIdFunc(comterp, this));
  }
  
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.31 DrawServ/drawserv.c:1.32
*** DrawServ/drawserv.c:1.31	Thu Mar 18 22:38:08 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 09:09:06 2004
***************
*** 141,147 ****
  
        /* register all sessionid's with other DrawServ */
        sessionid_register(curlink);
!       SendCmdString(curlink, "sessionid(:all)");
        SendCmdString(curlink, "drawlink(:state 2)");
  
        return curlink;
--- 141,147 ----
  
        /* register all sessionid's with other DrawServ */
        sessionid_register(curlink);
!       SendCmdString(curlink, "sid(:all)");
        SendCmdString(curlink, "drawlink(:state 2)");
  
        return curlink;
***************
*** 337,357 ****
    }
  }
  
! // generate request to check unique session id
  void DrawServ::sessionid_register(DrawLink* link) {
    char buf[BUFSIZ];
!   snprintf(buf, BUFSIZ, "sessionid(0x%08x 0x%08x)%c", sessionid(), sessionid(), '\0');
    SendCmdString(link, buf);
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    SessionIdTable_Iterator it(*table);
    while(it.more()) {
      if(it.cur_value()) {
!       DrawLink* link = (DrawLink*)it.cur_value();
!       unsigned int sid, osid;
!       sid = (unsigned int)it.cur_key();
!       originalsidtable()->find(osid, sid);
!       snprintf(buf, BUFSIZ, "sessionid(0x%08x 0x%08x)%c", sid, osid, '\0');
!       SendCmdString(link, buf);
      }
      it.next();
    }
--- 337,359 ----
    }
  }
  
! // generate request to register each locally unique session id
  void DrawServ::sessionid_register(DrawLink* link) {
    char buf[BUFSIZ];
!   snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x)%c", sessionid(), sessionid(), '\0');
    SendCmdString(link, buf);
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    SessionIdTable_Iterator it(*table);
    while(it.more()) {
      if(it.cur_value()) {
!       DrawLink* otherlink = (DrawLink*)it.cur_value();
!       if (otherlink != link) {
! 	unsigned int sid, osid;
! 	sid = (unsigned int)it.cur_key();
! 	originalsidtable()->find(osid, sid);
! 	snprintf(buf, BUFSIZ, "sid(0x%08x 0x%08x)%c", sid, osid, '\0');
! 	SendCmdString(link, buf);
!       }
      }
      it.next();
    }
***************
*** 458,464 ****
  void DrawServ::print_gridtable() {
    GraphicIdTable* table = gridtable();
    GraphicIdTable_Iterator it(*table);
!   printf("id          grid        grcomp      selector    selected\n");
    printf("----------  ----------  ----------  ----------  --------\n");
    while(it.more()) {
      GraphicId* grid = (GraphicId*)it.cur_value();
--- 460,466 ----
  void DrawServ::print_gridtable() {
    GraphicIdTable* table = gridtable();
    GraphicIdTable_Iterator it(*table);
!   printf("id          &grid       &grcomp     selector    selected\n");
    printf("----------  ----------  ----------  ----------  --------\n");
    while(it.more()) {
      GraphicId* grid = (GraphicId*)it.cur_value();
*** /dev/null	 Fri Mar 19 09:09:12 PST 2004
--- patches/ivtools-040319-johnston-056
*************** patches/ivtools-040319-johnston-056
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-056

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-055"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-055

Patch:    ivtools-040318-johnston-055
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.30 DrawServ/drawserv.c:1.31
*** DrawServ/drawserv.c:1.30	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawserv.c	Thu Mar 18 22:38:08 2004
***************
*** 468,470 ****
--- 468,474 ----
      it.next();
    }
  }
+ 
+ void DrawServ::print_sidtable() {
+   printf("not implemented yet\n");
+ }
*** /dev/null	 Thu Mar 18 22:38:15 PST 2004
--- patches/ivtools-040318-johnston-055
*************** patches/ivtools-040318-johnston-055
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-055

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-054"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-054

Patch:    ivtools-040318-johnston-054
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.18 DrawServ/drawfunc.c:1.19
*** DrawServ/drawfunc.c:1.18	Thu Mar 18 10:33:29 2004
--- src/DrawServ/drawfunc.c	Thu Mar 18 22:31:01 2004
***************
*** 26,32 ****
--- 26,34 ----
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinkcomp.h>
  #include <DrawServ/drawserv.h>
+ #include <DrawServ/drawserv-handler.h>
  
+ #include <ComTerp/comterp.h>
  #include <Attribute/attrlist.h>
  #include <Attribute/attrvalue.h>
  
***************
*** 100,105 ****
--- 102,114 ----
      
    }
  
+   /* set state to complete linkup */
+   else if (statev.int_val()==DrawLink::two_way) {
+     DrawServHandler* handler = comterp() ? (DrawServHandler*)comterp()->handler() : nil;
+     DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
+     link->state(DrawLink::two_way);
+   }
+ 
    /* dump DrawLink table to stderr */
    else 
      ((DrawServ*)unidraw)->linkdump(stderr);
***************
*** 133,152 ****
    push_stack(ComValue::nullval());
  
  #else
!   static int chk_sym = symbol_add("chk");
!   ComValue chkv(stack_key(chk_sym));
! 
!   static int trial_sym = symbol_add("trial");
!   ComValue trialv(stack_key(trial_sym));
! 
!   static int rid_sym = symbol_add("rid");
!   ComValue ridv(stack_key(rid_sym));
  
!   static int ok_sym = symbol_add("ok");
!   ComValue okv(stack_key(ok_sym));
  
-   ComValue idv(stack_arg(0));
- 
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
--- 142,153 ----
    push_stack(ComValue::nullval());
  
  #else
!   static int all_sym = symbol_add("all");
!   ComValue allv(stack_key(all_sym));
  
!   ComValue sidv(stack_arg(0));
!   ComValue osidv(stack_arg(1));
  
    reset_stack();
  
  #if __GNUC__==3&&__GNUC_MINOR__<1
***************
*** 154,201 ****
    push_stack(ComValue::nullval());
    return;
  #endif
! 
!   unsigned int returnid = 0;
! 
!   /* request a new session id */
!   if (chkv.is_true()) {    
!     ((DrawServ*)unidraw)->sessionid_request_chk();
!     returnid = ((DrawServ*)unidraw)->sessionid(true);
!   }
! 
!   /* return the trial id */
!   else if (trialv.is_true()) {    
!     returnid = ((DrawServ*)unidraw)->sessionid(true);
    }
- 
-   else if (idv.is_known() && ridv.is_known()) {
-     returnid = idv.uint_val();
  
!     /* handle new session id request */
!     if (!okv.is_known()) 
!       ((DrawServ*)unidraw)->sessionid_handle_chk(returnid, ridv.int_val());
      
!     /* handle callback */ 
!     else
!     ((DrawServ*)unidraw)->sessionid_callback_chk(returnid, ridv.int_val(), okv.is_true());
!   }
! 
!   else if (idv.is_known() && okv.is_known() && ridv.is_known()) {
!     returnid = idv.uint_val();
    }
- 
-   /* return current session id */
-   else if (nargs()==0 && nkeys()==0) 
-     returnid = ((DrawServ*)unidraw)->sessionid();
- 
-   ComValue retval(returnid, ComValue::UIntType);
- 
-   retval.state(AttributeValue::HexState);
-   push_stack(retval);
-   return;
- 
  #endif
- 
  }
  
  
--- 155,176 ----
    push_stack(ComValue::nullval());
    return;
  #endif
!   DrawServHandler* handler = comterp() ? (DrawServHandler*)comterp()->handler() : nil;
!   DrawLink* link = handler ? (DrawLink*)handler->drawlink() : nil;
!   
!   if (allv.is_true()) {
!     ((DrawServ*)unidraw)->sessionid_register(link);
!     return;
    }
  
!   if (sidv.is_known() && osidv.is_known()) {
!     ((DrawServ*)unidraw)->sessionid_register_handle
!       (link, sidv.uint_val(), osidv.uint_val());
      
!   } else {
!     ((DrawServ*)unidraw)->print_sidtable();
    }
  #endif
  }
  
  
***************
*** 205,226 ****
  }
  
  void GraphicIdFunc::execute() {
-   static int chg_sym = symbol_add("chg");
-   ComValue chgv(stack_key(chg_sym));
- 
    ComValue idv(stack_arg(0));
    ComValue selectorv(stack_arg(1));
  
    reset_stack();
  
!   if (idv.is_known() && selectorv.is_known()) {
!     if (chgv.is_false()) {
!       ((DrawServ*)unidraw)->reserve_handle
! 	(idv.uint_val(), selectorv.uint_val());
!     } else {
!       ((DrawServ*)unidraw)->reserve_change
! 	(idv.uint_val(), selectorv.uint_val(), chgv.is_true());
!     }
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
--- 180,194 ----
  }
  
  void GraphicIdFunc::execute() {
    ComValue idv(stack_arg(0));
    ComValue selectorv(stack_arg(1));
+   ComValue selectedv(stack_arg(2));
  
    reset_stack();
  
!   if (idv.is_known() && selectorv.is_known() && selectedv.is_known()) {
!     ((DrawServ*)unidraw)->grid_message_handle
!       (idv.uint_val(), selectorv.uint_val(), selectedv.int_val());
    } else if (idv.is_unknown()) {
      ((DrawServ*)unidraw)->print_gridtable();
    }
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.6 DrawServ/drawfunc.h:1.7
*** DrawServ/drawfunc.h:1.6	Thu Mar 18 10:33:29 2004
--- src/DrawServ/drawfunc.h	Thu Mar 18 22:31:01 2004
***************
*** 28,34 ****
  #include <ComUnidraw/unifunc.h>
  
  //: command to connect to another drawserv
! // drawlink(hoststr :port portnum) -- connect to remote drawserv
  class DrawLinkFunc : public UnidrawFunc {
  public:
      DrawLinkFunc(ComTerp*,DrawEditor*);
--- 28,34 ----
  #include <ComUnidraw/unifunc.h>
  
  //: command to connect to another drawserv
! // drawlink(hoststr :port portnum :state num :lid nu :rid num :close) -- connect to remote drawserv
  class DrawLinkFunc : public UnidrawFunc {
  public:
      DrawLinkFunc(ComTerp*,DrawEditor*);
***************
*** 38,60 ****
  };
  
  //: command to reserve unique session id
! // sessionid(:chk :trial :rid num :ok bool) -- command to manage session id's
  class SessionIdFunc : public UnidrawFunc {
  public:
      SessionIdFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(:chk :trial :rid num :ok bool) -- command to manage session id's"; }
  };
  
! //: command to reserve graphics for selection in remote editors
! // grid(id selector :chg) -- reserve graphic for remote selection
  class GraphicIdFunc : public UnidrawFunc {
  public:
      GraphicIdFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(id selector :chg) -- reserve graphic for remote selection"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
--- 38,60 ----
  };
  
  //: command to reserve unique session id
! // sessionid([sid osid] :all) -- command to manage session id's
  class SessionIdFunc : public UnidrawFunc {
  public:
      SessionIdFunc(ComTerp*,DrawEditor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s([sid osid] :all) -- command to manage session id's"; }
  };
  
! //: command to send message between remote selections
! // grid(id selector selected) -- command to send message between remote selections
  class GraphicIdFunc : public UnidrawFunc {
  public:
      GraphicIdFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(id selector selected) -- command to send message between remote selections"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
Index: DrawServ/drawlink.c
diff -c DrawServ/drawlink.c:1.11 DrawServ/drawlink.c:1.12
*** DrawServ/drawlink.c:1.11	Mon Mar  8 13:29:19 2004
--- src/DrawServ/drawlink.c	Thu Mar 18 22:31:01 2004
***************
*** 32,37 ****
--- 32,39 ----
  
  int DrawLink::_linkcnt = 0;
  
+ implementTable(IncomingSidTable,unsigned int,unsigned int)
+ 
  /*****************************************************************************/
  
  DrawLink::DrawLink (const char* hostname, int portnum, int state)
***************
*** 49,56 ****
    _conn = nil;
  
    _handler = nil;
! 
!   _sessionid_state = SessionIdNada;
  }
  
  DrawLink::~DrawLink () 
--- 51,57 ----
    _conn = nil;
  
    _handler = nil;
!   _incomingsidtable = new IncomingSidTable(32);
  }
  
  DrawLink::~DrawLink () 
***************
*** 64,69 ****
--- 65,71 ----
      delete _host;
      delete _althost;
  #endif
+     delete _incomingsidtable;
  }
  
  int DrawLink::open() {
Index: DrawServ/drawlink.h
diff -c DrawServ/drawlink.h:1.9 DrawServ/drawlink.h:1.10
*** DrawServ/drawlink.h:1.9	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawlink.h	Thu Mar 18 22:31:01 2004
***************
*** 30,35 ****
--- 30,38 ----
  class DrawServ;
  class DrawServHandler;
  
+ #include <OS/table.h>
+ declareTable(IncomingSidTable,unsigned int,unsigned int)
+ 
  #ifdef HAVE_ACE
  #include <ComTerp/comhandler.h>
  #include <ace/SOCK_Connector.h>
***************
*** 68,74 ****
      int close();
      // close link to remote DrawServ
  
!     int up() { return 0; }
      // return 1 if link up, 0 if down
  
      int ok() { return _ok; }
--- 71,77 ----
      int close();
      // close link to remote DrawServ
  
!     int up() { state() == two_way; }
      // return 1 if link up, 0 if down
  
      int ok() { return _ok; }
***************
*** 92,112 ****
  
      DrawServHandler* handler() { return _handler; }
      // get DrawServHandler associated with incoming connection
  
!     int sessionid_state() { return _sessionid_state; }
!     // get state of session id negotiation
!     // -1 = no id, 0 = request made, 1 = request approved, 2 = request denied.
! 
!     void sessionid_state(int state) { _sessionid_state = state; }
!     // set state of session id negotiation
!     // -1 = no id, 0 = request made, 1 = request approved, 2 = request denied.
! 
!     enum {SessionIdNada=-1, SessionIdRequested=0, SessionIdApproved=1, SessionIdDenied=2};
! 
!     unsigned int sessionid() { return _sessionid; }
!     // get unique session id of other side
!     void sessionid(unsigned int id) { _sessionid = id; }
!     // get unique session id of other side
  
  protected:
      const char* _host;
--- 95,109 ----
  
      DrawServHandler* handler() { return _handler; }
      // get DrawServHandler associated with incoming connection
+ 
+     IncomingSidTable* incomingsidtable() { return _incomingsidtable; }
+     // return pointer to table mapping incoming sessionid's to locally unique sessionid's
+ 
+     void state(int val) { _state = val; }
+     // set state of DrawLink
  
!     int state() { return _state; }
!     // get state of DrawLink
  
  protected:
      const char* _host;
***************
*** 117,124 ****
      int _local_linkid;
      int _remote_linkid;
      int _state;
!     int _sessionid_state;
!     unsigned int _sessionid;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
--- 114,120 ----
      int _local_linkid;
      int _remote_linkid;
      int _state;
!     IncomingSidTable* _incomingsidtable;
  
  #ifdef HAVE_ACE
      ACE_INET_Addr* _addr;
Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.3 DrawServ/drawlinklist.c:1.4
*** DrawServ/drawlinklist.c:1.3	Tue Mar 16 12:57:12 2004
--- src/DrawServ/drawlinklist.c	Thu Mar 18 22:31:01 2004
***************
*** 27,32 ****
--- 27,33 ----
  
  #include <DrawServ/drawlink.h>
  #include <DrawServ/drawlinklist.h>
+ #include <DrawServ/drawserv.h>
  #include <DrawServ/grid.h>
  
  #include <Unidraw/iterator.h>
***************
*** 58,71 ****
  }
  
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
!   Iterator i;
!   First(i);
!   while(!Done(i) && GetDrawLink(i)->sessionid() != grid->selector()) 
!     Next(i);
!   if (!Done(i)) 
!     return GetDrawLink(i);
!   else
!     return nil;
  }
  
  DrawLink* DrawLinkList::Link (UList* r) {
--- 59,67 ----
  }
  
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
!   void* ptr = nil;
!   ((DrawServ*)unidraw)->sessionidtable()->find(ptr, grid->sessionid());
!   return (DrawLink*)ptr;
  }
  
  DrawLink* DrawLinkList::Link (UList* r) {
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.29 DrawServ/drawserv.c:1.30
*** DrawServ/drawserv.c:1.29	Thu Mar 18 13:51:08 2004
--- src/DrawServ/drawserv.c	Thu Mar 18 22:31:01 2004
***************
*** 59,64 ****
--- 59,65 ----
  implementTable(GraphicIdTable,int,void*)
  implementTable(SessionIdTable,int,void*)
  implementTable(CompIdTable,void*,void*)
+ implementTable(OriginalSidTable,unsigned int,unsigned int)
  
  unsigned int DrawServ::GraphicIdMask = 0x000fffff;
  unsigned int DrawServ::SessionIdMask = 0xfff00000;
***************
*** 82,90 ****
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
    _compidtable = new CompIdTable(1024);
  
!   _sessionid = candidate_sessionid();
!   _trialid = _sessionid;
    _sessionidtable->insert(_sessionid, nil); // nil pointer refers to local session id
  }
  
--- 83,91 ----
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
    _compidtable = new CompIdTable(1024);
+   _originalsidtable = new OriginalSidTable(32);
  
!   _sessionid = unique_sessionid();
    _sessionidtable->insert(_sessionid, nil); // nil pointer refers to local session id
  }
  
***************
*** 92,97 ****
--- 93,101 ----
  {
    delete _linklist;
    delete _gridtable;
+   delete _sessionidtable;
+   delete _compidtable;
+   delete _originalsidtable;
  }
  
  DrawLink* DrawServ::linkup(const char* hostname, int portnum, 
***************
*** 125,130 ****
--- 129,135 ----
        DrawLink* curlink = _linklist->GetDrawLink(i);
        curlink->remote_linkid(remote_id);
        curlink->althostname(hostname);
+       curlink->state(DrawLink::two_way);
        if (comterp && comterp->handler()) {
  	((DrawServHandler*)comterp->handler())->drawlink(curlink);
  	curlink->handler((DrawServHandler*)comterp->handler());
***************
*** 133,138 ****
--- 138,149 ----
  	      curlink->hostname(), curlink->althostname(), portnum);
        fprintf(stderr, "local id %d, remote id %d\n", curlink->local_linkid(), 
  	      curlink->remote_linkid());
+ 
+       /* register all sessionid's with other DrawServ */
+       sessionid_register(curlink);
+       SendCmdString(curlink, "sessionid(:all)");
+       SendCmdString(curlink, "drawlink(:state 2)");
+ 
        return curlink;
      } else {
        fprintf(stderr, "unable to complete two-way link\n");
***************
*** 327,388 ****
  }
  
  // generate request to check unique session id
! void DrawServ::sessionid_request_chk() {
! 
!   Iterator it;
!   _linklist->First(it);
    char buf[BUFSIZ];
!   while(!_linklist->Done(it)) {
!     DrawLink* link = _linklist->GetDrawLink(it);
!     link->sessionid_state(DrawLink::SessionIdRequested);
!     snprintf(buf, BUFSIZ, "sessionid(0x%08x :rid %d)%c", _trialid, link->local_linkid(), '\0');
!     SendCmdString(link, buf);
!     _linklist->Next(it);
    }
  }
  
! // handle request to check unique session id
! // can be answered locally, because others are required to
! // propogate their request completely before adopting new id.
! void DrawServ::sessionid_handle_chk(int new_id, int remote_linkid) {
!   DrawLink* link = linkget(-1, remote_linkid);
    if (link) {
!     if (_linklist->Number()==1) {
!       int okflag = false;
!       if (okflag = DrawServ::unique_sessionid(new_id)) {
! 	SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
! 	table->insert(new_id, link);
!       }
!       char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "sessionid(0x%08x :ok %d :rid %d )%c", new_id, okflag, link->local_linkid(), '\0');
!       SendCmdString(link, buf);
!       link->sessionid(new_id);
!     } else {
!       fprintf(stderr, "code for passing selection id request on to other DrawLink's not implemented\n");
!     }
!   } else
!     fprintf(stderr, "no link with remote id of %d found\n", remote_linkid);
! }
  
! // process callbacks on request to check unique session id
! void DrawServ::sessionid_callback_chk(int new_id, int remote_linkid, int ok_flag) {
!   fprintf(stderr, "sessionid_callback_chk: new_id %d,  remote_linkid %d, ok_flag %d\n",
! 	  new_id, remote_linkid, ok_flag);
!   if (new_id != _trialid) {
!     ok_flag = false;
!     fprintf(stderr, "new_id (%d) does not match _trialid (%d)\n", new_id, _trialid);
!   }
!   if (ok_flag) {
!     _sessionid = _trialid;
!   } else {
!   }
! }
  
! int DrawServ::online() {
!   return _sessionid==_trialid && _sessionid!=-1;
! }
  
! unsigned int DrawServ::candidate_grid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
--- 338,379 ----
  }
  
  // generate request to check unique session id
! void DrawServ::sessionid_register(DrawLink* link) {
    char buf[BUFSIZ];
!   snprintf(buf, BUFSIZ, "sessionid(0x%08x 0x%08x)%c", sessionid(), sessionid(), '\0');
!   SendCmdString(link, buf);
!   SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
!   SessionIdTable_Iterator it(*table);
!   while(it.more()) {
!     if(it.cur_value()) {
!       DrawLink* link = (DrawLink*)it.cur_value();
!       unsigned int sid, osid;
!       sid = (unsigned int)it.cur_key();
!       originalsidtable()->find(osid, sid);
!       snprintf(buf, BUFSIZ, "sessionid(0x%08x 0x%08x)%c", sid, osid, '\0');
!       SendCmdString(link, buf);
!     }
!     it.next();
    }
  }
  
! // handle request to register session id
! void DrawServ::sessionid_register_handle(DrawLink* link, unsigned int sid, unsigned osid) {
    if (link) {
!     SessionIdTable* sidtable = ((DrawServ*)unidraw)->sessionidtable();
!     unsigned int alt_id = sid;
!     if (!DrawServ::test_sessionid(sid)) 
!       alt_id = DrawServ::unique_sessionid();
!     sidtable->insert(alt_id, link);
!     link->incomingsidtable()->insert(sid, alt_id);
!     ((DrawServ*)unidraw)->originalsidtable()->insert(alt_id, osid);
  
!     /* propagate */
!  }
  
!  }
  
! unsigned int DrawServ::unique_grid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
***************
*** 393,403 ****
      static int flip=0;
      while ((retval=rand()&GraphicIdMask)==0);
  
!   } while (!unique_grid(retval));
    return retval;
  }
  
! int DrawServ::unique_grid(unsigned int id) {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    void* ptr = nil;
    table->find(ptr, id);
--- 384,394 ----
      static int flip=0;
      while ((retval=rand()&GraphicIdMask)==0);
  
!   } while (!test_grid(retval));
    return retval;
  }
  
! int DrawServ::test_grid(unsigned int id) {
    GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
    void* ptr = nil;
    table->find(ptr, id);
***************
*** 407,413 ****
      return 1;
  }
  
! unsigned int DrawServ::candidate_sessionid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
--- 398,404 ----
      return 1;
  }
  
! unsigned int DrawServ::unique_sessionid() {
    static int seed=0;
    if (!seed) {
      seed = time(nil) & (time(nil) << 16);
***************
*** 418,428 ****
      static int flip=0;
      while ((retval=rand()&SessionIdMask)==0);
  
!   } while (!unique_sessionid(retval));
    return retval;
  }
  
! int DrawServ::unique_sessionid(unsigned int id) {
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    void* ptr = nil;
    table->find(ptr, id);
--- 409,419 ----
      static int flip=0;
      while ((retval=rand()&SessionIdMask)==0);
  
!   } while (!test_sessionid(retval));
    return retval;
  }
  
! int DrawServ::test_sessionid(unsigned int id) {
    SessionIdTable* table = ((DrawServ*)unidraw)->sessionidtable();
    void* ptr = nil;
    table->find(ptr, id);
***************
*** 445,525 ****
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::reserve_handle(unsigned int id, unsigned int selector)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
!     
!     /* check if selected */
!     if( reserve_if_not_selected(grid, selector) ) {
!       
!       /* if available, broadcast to everyone */
!       char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :chg)%c", id, selector, '\0');
!       DistributeCmdString(buf);
!     }
!     
!   } else
!     fprintf(stderr, "grid 0x%08x not found for selector 0x%08x\n", id, selector);
  }
  
! // callback for reserve request that goes to every DrawLink
! void DrawServ::reserve_change(unsigned int id, unsigned int selector, 
! 			      boolean ok)
  {
!   if (ok) {
!     void* ptr = nil;
!     gridtable()->find(ptr, id);
!     if (ptr) {
!       GraphicId* grid = (GraphicId*)ptr;
!       grid->selector(selector);
!       grid->selected(LinkSelection::RemotelySelected);
!     } else
!       fprintf(stderr, "reserve change received for unknown id 0x%08x\n", id);
!   } else
!     fprintf(stderr, "reserve request for 0x%08x denied\n", id);
! }
! 
! boolean DrawServ::reserve_if_not_selected(GraphicId* grid, unsigned int selector) {
!   
! #if 0
!   /* check if graphic is still locally selected */
!   GraphicComp* comp = grid->grcomp();
!   boolean selected = false;
!   Iterator i;
!   First(i);
!   while (!Done(i) && !selected) {
!     Viewer* viewer = GetEditor(i)->GetViewer();
!     Selection* sel = viewer->GetSelection();
!     Iterator j;
!     sel->First(j);
!     while (!sel->Done(j) && !selected) {
!       if (sel->GetView(j)->GetGraphicComp()==comp) selected = true;
!       sel->Next(j);
!     }
!     Next(i);
!   }
! 
!   if (selected)
!     return false;
!   else {
!     grid->selector(selector);
!     grid->selected(false);
!     return true;
    }
- #else
-   if (grid->selected() == LinkSelection::NotSelected ||
-       grid->selected() == LinkSelection::PreviouslySelected) {
-     grid->selector(selector);
-     return true;
-   } else if (grid->selected() == LinkSelection::RemotelySelected ||
- 	     grid->selected() == LinkSelection::WaitingToBeSelected) 
-     fprintf(stderr, "selection request made it to wrong selector\n");
-   else
-     return false;
- #endif
  }
  
  void DrawServ::print_gridtable() {
--- 436,458 ----
  }
  
  // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_handle(unsigned int id, unsigned int selector, int selected)
  {
    void* ptr = nil;
    gridtable()->find(ptr, id);
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
!   }
  }
  
! // handle reserve request from remote DrawLink.
! void DrawServ::grid_message_propagate(unsigned int id, unsigned int selector, int selected)
  {
!   void* ptr = nil;
!   gridtable()->find(ptr, id);
!   if (ptr) {
!     GraphicId* grid = (GraphicId*)ptr;
    }
  }
  
  void DrawServ::print_gridtable() {
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.18 DrawServ/drawserv.h:1.19
*** DrawServ/drawserv.h:1.18	Thu Mar 18 12:34:35 2004
--- src/DrawServ/drawserv.h	Thu Mar 18 22:31:01 2004
***************
*** 33,39 ****
  #include <OS/table.h>
  declareTable(GraphicIdTable,int,void*)
  declareTable(SessionIdTable,int,void*)
! declareTable(CompIdTable,void*, void*);
       
  
  //: Unidraw specialized for DrawServ
--- 33,40 ----
  #include <OS/table.h>
  declareTable(GraphicIdTable,int,void*)
  declareTable(SessionIdTable,int,void*)
! declareTable(CompIdTable,void*,void*);
! declareTable(OriginalSidTable,unsigned int,unsigned int);
       
  
  //: Unidraw specialized for DrawServ
***************
*** 58,66 ****
    
    void Init();
    
-   int online();
-   // return true if session id initialized, otherwise false.
-   
    DrawLink* linkup(const char* hostname, int portnum, 
  		   int state, int local_id=-1, int remote_id=-1,
  		   ComTerp* comterp=nil);
--- 59,64 ----
***************
*** 102,136 ****
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
    
!   void sessionid_request_chk();
!   // generate next request to check unique session id
    
!   void sessionid_handle_chk(int chk_id, int remote_linkid);
!   // handle request to check unique session id
    
!   void sessionid_callback_chk(int chk_id, int remote_linkid, int ok_flag);
!   // process callbacks on request to check unique session id
    
!   unsigned int sessionid(int trial=false) { return trial ? _trialid : _sessionid; }
    // current unique session id.
  
!   void reserve_handle(unsigned int id, unsigned int selector);
!   // handle reserve request from remote DrawLink.
  
!   void reserve_change(unsigned int id, unsigned int selector, boolean ok); 
!   // callback for reserve request that goes to every DrawLink.
  
!   boolean reserve_if_not_selected(GraphicId* grid, unsigned int selector);
!   // check if graphic is selected, and allow it to be borrowed if not.
!   
!   static unsigned int candidate_grid();
!   // generate candidate graphic id.
!   static int unique_grid(unsigned int id);
    // test candidate graphic id for local uniqueness
!   static unsigned int candidate_sessionid();
!   // generate candidate session id.
!   static int unique_sessionid(unsigned int id);
    // test candidate session id for local uniqueness
    
    static unsigned int GraphicIdMask;
--- 100,139 ----
    
    CompIdTable* compidtable() { return _compidtable; }
    // return pointer to table that map from GraphicComp* to GraphicId*
+   
+   OriginalSidTable* originalsidtable() { return _originalsidtable; }
+   // return pointer to table that maps from unique local session ids 
+   // to original session ids.
    
!   void sessionid_register(DrawLink* link);
!   // register all sessionid's used by this DrawServ with remote DrawServ
    
!   void sessionid_register_handle(DrawLink* link, unsigned int sid, 
! 				 unsigned int osid);
!   // handle request to register unique session id
    
!   void sessionid_register_propagate(unsigned int sid, unsigned int osid);
!   // propagate a newly registered session id to all other DrawLink's
    
!   unsigned int sessionid() { return _sessionid; }
    // current unique session id.
  
!   void grid_message(unsigned int id, unsigned int selector, int selected);
!   // generate graphic id selection message
  
!   void grid_message_handle(unsigned int id, unsigned int selector, int selected);
!   // handle graphic id selection message
  
!   void grid_message_propagate(unsigned int id, unsigned int selector, int selected);
!   // propagate graphic id selection message
! 
!   static unsigned int unique_grid();
!   // generate unique graphic id.
!   static int test_grid(unsigned int id);
    // test candidate graphic id for local uniqueness
!   static unsigned int unique_sessionid();
!   // generate unique session id.
!   static int test_sessionid(unsigned int id);
    // test candidate session id for local uniqueness
    
    static unsigned int GraphicIdMask;
***************
*** 139,144 ****
--- 142,150 ----
    void print_gridtable();
    // print contents of table of GraphicId's
    
+   void print_sidtable();
+   // print contents of table of SessionId's
+   
  protected:
      DrawLinkList* _linklist;
      // DrawLink list
***************
*** 151,161 ****
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
  
      int _sessionid;
      // unique session id.
-     int _trialid;
-     // session id undergoing reservation
  
  };
  
--- 157,168 ----
      CompIdTable* _compidtable;
      // table of all GraphicComp's associated with a GraphicId.
      // maps from GraphicComp* to GraphicId*
+     OriginalSidTable* _originalsidtable;
+     // table of that maps locally unique session ids to original
+     // session ids.
  
      int _sessionid;
      // unique session id.
  
  };
  
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.7 DrawServ/grid.c:1.8
*** DrawServ/grid.c:1.7	Thu Mar 18 12:34:35 2004
--- src/DrawServ/grid.c	Thu Mar 18 22:31:01 2004
***************
*** 42,48 ****
  {
    _comp = nil;
    if (sessionid != 0) {
!     _id = DrawServ::candidate_grid();
      _sid = sessionid&DrawServ::SessionIdMask;
      GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
      table->insert(_id|_sid, this);
--- 42,48 ----
  {
    _comp = nil;
    if (sessionid != 0) {
!     _id = DrawServ::unique_grid();
      _sid = sessionid&DrawServ::SessionIdMask;
      GraphicIdTable* table = ((DrawServ*)unidraw)->gridtable();
      table->insert(_id|_sid, this);
*** /dev/null	 Thu Mar 18 22:31:08 PST 2004
--- patches/ivtools-040318-johnston-054
*************** patches/ivtools-040318-johnston-054
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-054

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-053"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-053

Patch:    ivtools-040318-johnston-053
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.28 DrawServ/drawserv.c:1.29
*** DrawServ/drawserv.c:1.28	Thu Mar 18 12:34:35 2004
--- src/DrawServ/drawserv.c	Thu Mar 18 13:51:08 2004
***************
*** 219,224 ****
--- 219,225 ----
  	    grid->grcomp(comp);
  	    grid->id(idv->uint_val());
  	    grid->selector(sidv->uint_val());
+ 	    grid->selected(LinkSelection::RemotelySelected);
  	  } 
  	  
  	  /* generate unique id and add as attribute */
***************
*** 437,443 ****
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "reserve(0x%08x 0x%08x)%c", grid->id(), sessionid(), '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
--- 438,444 ----
  
    if (link) {
      char buf[BUFSIZ];
!     snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x)%c", grid->id(), sessionid(), '\0');
      SendCmdString(link, buf);
    } else
      fprintf(stderr, "surprisingly no selector link found for GraphicId %u\n", grid->id());
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.9 DrawServ/linkselection.c:1.10
*** DrawServ/linkselection.c:1.9	Thu Mar 18 12:43:28 2004
--- src/DrawServ/linkselection.c	Thu Mar 18 13:51:08 2004
***************
*** 101,148 ****
      int removed = false;
      OverlayView* view = GetView(it);
      OverlayComp* comp = view ? view->GetOverlayComp() : nil;
- #if 0
-     AttributeList* al = comp ? comp->attrlist() : nil;
-     AttributeValue* av = al ? al->find(id_sym) : nil;
-     if (av) {
-       void* ptr = nil;
-       ((DrawServ*)unidraw)->gridtable()->find(ptr, av->uint_val());
-       if (ptr) {
- 	GraphicId* grid = (GraphicId*)ptr;
- 	if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
- 
- 	  /* make a request to select this in the future */
- 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
- 
- 	  Remove(it);
- 	  removed = true;
- 
- 	  grid->selected(WaitingToBeSelected);
- 	} else {
- 	  grid->selected(LocallySelected);
- 	}
-       }
-     }
- #else
      void* ptr = nil;
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
  	
- 	/* make a request to select this in the future */
- 	((DrawServ*)unidraw)->ReserveSelection(grid);
- 	
  	Remove(it);
  	removed = true;
  	
- 	grid->selected(WaitingToBeSelected);
        } else {
  	grid->selected(LocallySelected);
        }
        
      }
- #endif
      if (!removed) 
        Next(it);
    }
--- 101,129 ----
      int removed = false;
      OverlayView* view = GetView(it);
      OverlayComp* comp = view ? view->GetOverlayComp() : nil;
      void* ptr = nil;
      table->find(ptr, (void*)comp);
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
!       if (grid->selector() && 
! 	  ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
  	
  	Remove(it);
  	removed = true;
+ 	
+ 	if (grid->selected()==PreviouslySelected || 
+ 	    grid->selected()==NotSelected) {
+ 	  
+ 	  /* make a request to select this in the future */
+ 	  ((DrawServ*)unidraw)->ReserveSelection(grid);
+ 	  grid->selected(WaitingToBeSelected);
+ 	} 
  	
        } else {
  	grid->selected(LocallySelected);
        }
        
      }
      if (!removed) 
        Next(it);
    }
*** /dev/null	 Thu Mar 18 13:51:15 PST 2004
--- patches/ivtools-040318-johnston-053
*************** patches/ivtools-040318-johnston-053
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-053

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-052"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-052

Patch:    ivtools-040318-johnston-052
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.8 DrawServ/linkselection.c:1.9
*** DrawServ/linkselection.c:1.8	Thu Mar 18 12:34:35 2004
--- src/DrawServ/linkselection.c	Thu Mar 18 12:43:28 2004
***************
*** 77,83 ****
      void* ptr = nil;
      table->find(ptr, (void*)comp);
      if (ptr) {
!       GraphicId* grid = (GraphicId*)grid;
        if (grid->selected()==LocallySelected)
  	grid->selected(PreviouslySelected);
        else if (grid->selected()==WaitingToBeSelected)
--- 77,83 ----
      void* ptr = nil;
      table->find(ptr, (void*)comp);
      if (ptr) {
!       GraphicId* grid = (GraphicId*)ptr;
        if (grid->selected()==LocallySelected)
  	grid->selected(PreviouslySelected);
        else if (grid->selected()==WaitingToBeSelected)
*** /dev/null	 Thu Mar 18 12:43:36 PST 2004
--- patches/ivtools-040318-johnston-052
*************** patches/ivtools-040318-johnston-052
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-052

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-051"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-051

Patch:    ivtools-040318-johnston-051
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.27 DrawServ/drawserv.c:1.28
*** DrawServ/drawserv.c:1.27	Thu Mar 18 10:33:29 2004
--- src/DrawServ/drawserv.c	Thu Mar 18 12:34:35 2004
***************
*** 58,63 ****
--- 58,64 ----
  
  implementTable(GraphicIdTable,int,void*)
  implementTable(SessionIdTable,int,void*)
+ implementTable(CompIdTable,void*,void*)
  
  unsigned int DrawServ::GraphicIdMask = 0x000fffff;
  unsigned int DrawServ::SessionIdMask = 0xfff00000;
***************
*** 80,85 ****
--- 81,87 ----
  
    _gridtable = new GraphicIdTable(1024);
    _sessionidtable = new SessionIdTable(256);
+   _compidtable = new CompIdTable(1024);
  
    _sessionid = candidate_sessionid();
    _trialid = _sessionid;
***************
*** 526,532 ****
    printf("----------  ----------  ----------  ----------  --------\n");
    while(it.more()) {
      GraphicId* grid = (GraphicId*)it.cur_value();
!     printf("0x%08x  0x%08x  0x%08x  0x%08x  0x%08x  %s\n", 
  	   (unsigned int)it.cur_key(), grid, grid->grcomp(),
  	   grid->selector(), LinkSelection::selected_string(grid->selected()));
      it.next();
--- 528,534 ----
    printf("----------  ----------  ----------  ----------  --------\n");
    while(it.more()) {
      GraphicId* grid = (GraphicId*)it.cur_value();
!     printf("0x%08x  0x%08x  0x%08x  0x%08x  %s\n", 
  	   (unsigned int)it.cur_key(), grid, grid->grcomp(),
  	   grid->selector(), LinkSelection::selected_string(grid->selected()));
      it.next();
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.17 DrawServ/drawserv.h:1.18
*** DrawServ/drawserv.h:1.17	Thu Mar 18 10:33:29 2004
--- src/DrawServ/drawserv.h	Thu Mar 18 12:34:35 2004
***************
*** 33,38 ****
--- 33,39 ----
  #include <OS/table.h>
  declareTable(GraphicIdTable,int,void*)
  declareTable(SessionIdTable,int,void*)
+ declareTable(CompIdTable,void*, void*);
       
  
  //: Unidraw specialized for DrawServ
***************
*** 99,104 ****
--- 100,108 ----
    SessionIdTable* sessionidtable() { return _sessionidtable; }
    // return pointer to table of DrawLink's as a function of session id's.
    
+   CompIdTable* compidtable() { return _compidtable; }
+   // return pointer to table that map from GraphicComp* to GraphicId*
+   
    void sessionid_request_chk();
    // generate next request to check unique session id
    
***************
*** 144,149 ****
--- 148,156 ----
      SessionIdTable* _sessionidtable;
      // table of all session id's.
      // maps from id to DrawLink*
+     CompIdTable* _compidtable;
+     // table of all GraphicComp's associated with a GraphicId.
+     // maps from GraphicComp* to GraphicId*
  
      int _sessionid;
      // unique session id.
Index: DrawServ/grid.c
diff -c DrawServ/grid.c:1.6 DrawServ/grid.c:1.7
*** DrawServ/grid.c:1.6	Fri Mar 12 12:36:06 2004
--- src/DrawServ/grid.c	Thu Mar 18 12:34:35 2004
***************
*** 90,92 ****
--- 90,103 ----
    Unref(_sublist);
    _sublist = nil;
  }
+ 
+ void GraphicId::grcomp(GraphicComp* comp) {
+   if (comp==_comp) return;
+   CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
+   if (_comp) {
+     void* ptr = nil;
+     table->find_and_remove(ptr, comp);
+   } 
+   _comp = comp;
+   table->insert((void*)comp, (void*)this);
+ }
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.8 DrawServ/grid.h:1.9
*** DrawServ/grid.h:1.8	Thu Mar 18 10:33:29 2004
--- src/DrawServ/grid.h	Thu Mar 18 12:34:35 2004
***************
*** 58,64 ****
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
  
!   void grcomp(GraphicComp* comp) { _comp = comp; }
    // set pointer to associated GraphicComp
  
    GraphicComp* grcomp() { return _comp; }
--- 58,64 ----
    virtual GraphicIdList* sublist() { return nil; }
    // returns pointer to sublist of GraphicId's, if any
  
!   void grcomp(GraphicComp* comp);
    // set pointer to associated GraphicComp
  
    GraphicComp* grcomp() { return _comp; }
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.7 DrawServ/linkselection.c:1.8
*** DrawServ/linkselection.c:1.7	Thu Mar 18 10:53:27 2004
--- src/DrawServ/linkselection.c	Thu Mar 18 12:34:35 2004
***************
*** 68,101 ****
  
  void LinkSelection::Clear(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Clear\n");
    OverlaySelection::Clear(viewer);
  }
  
  void LinkSelection::Reserve() {
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
! 
!   /* remove everything from the selected and waiting lists */
!   Iterator it;
!   _locally_selected->First(it);
!   while (!_locally_selected->Done(it)) {
!     GraphicId* grid = _locally_selected->GetGraphicId(it);
!     _locally_selected->Remove(it);
!     grid->selected(NotSelected);
!   }
!   _waiting_to_be_selected->First(it);
!   while (!_waiting_to_be_selected->Done(it)) {
!     GraphicId* grid = _waiting_to_be_selected->GetGraphicId(it);
!     _waiting_to_be_selected->Remove(it);
!     grid->selected(NotSelected);
!   }
  
    /* remove anything from selection that has a remote selector */
    First(it);
    while (!Done(it)) {
      int removed = false;
      OverlayView* view = GetView(it);
      OverlayComp* comp = view ? view->GetOverlayComp() : nil;
      AttributeList* al = comp ? comp->attrlist() : nil;
      AttributeValue* av = al ? al->find(id_sym) : nil;
      if (av) {
--- 68,107 ----
  
  void LinkSelection::Clear(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Clear\n");
+   CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
+   Iterator it;
+   First(it);
+   while(!Done(it)) {
+     OverlayView* view = GetView(it);
+     OverlayComp* comp = view ? view->GetOverlayComp() : nil;
+     void* ptr = nil;
+     table->find(ptr, (void*)comp);
+     if (ptr) {
+       GraphicId* grid = (GraphicId*)grid;
+       if (grid->selected()==LocallySelected)
+ 	grid->selected(PreviouslySelected);
+       else if (grid->selected()==WaitingToBeSelected)
+ 	grid->selected(NotSelected);
+     }
+     Next(it);
+   }
    OverlaySelection::Clear(viewer);
+   
  }
  
  void LinkSelection::Reserve() {
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
!   CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
    /* remove anything from selection that has a remote selector */
+   Iterator it;
    First(it);
    while (!Done(it)) {
      int removed = false;
      OverlayView* view = GetView(it);
      OverlayComp* comp = view ? view->GetOverlayComp() : nil;
+ #if 0
      AttributeList* al = comp ? comp->attrlist() : nil;
      AttributeValue* av = al ? al->find(id_sym) : nil;
      if (av) {
***************
*** 111,128 ****
  	  Remove(it);
  	  removed = true;
  
- 	  /* add to list of graphics waiting to be selected */
  	  grid->selected(WaitingToBeSelected);
- 	  _waiting_to_be_selected->Append(grid);
  	} else {
- 
- 	  /* add to list of graphics currently selected */
  	  grid->selected(LocallySelected);
- 	  grid->selector(((DrawServ*)unidraw)->sessionid());
- 	  _waiting_to_be_selected->Append(grid);
  	}
        }
      }
      if (!removed) 
        Next(it);
    }
--- 117,148 ----
  	  Remove(it);
  	  removed = true;
  
  	  grid->selected(WaitingToBeSelected);
  	} else {
  	  grid->selected(LocallySelected);
  	}
        }
      }
+ #else
+     void* ptr = nil;
+     table->find(ptr, (void*)comp);
+     if (ptr) {
+       GraphicId* grid = (GraphicId*)ptr;
+       if (grid->selector() && ((DrawServ*)unidraw)->sessionid()!=grid->selector()) {
+ 	
+ 	/* make a request to select this in the future */
+ 	((DrawServ*)unidraw)->ReserveSelection(grid);
+ 	
+ 	Remove(it);
+ 	removed = true;
+ 	
+ 	grid->selected(WaitingToBeSelected);
+       } else {
+ 	grid->selected(LocallySelected);
+       }
+       
+     }
+ #endif
      if (!removed) 
        Next(it);
    }
*** /dev/null	 Thu Mar 18 12:34:46 PST 2004
--- patches/ivtools-040318-johnston-051
*************** patches/ivtools-040318-johnston-051
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-051

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-050"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-050

Patch:    ivtools-040318-johnston-050
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.6 DrawServ/linkselection.c:1.7
*** DrawServ/linkselection.c:1.6	Thu Mar 18 10:33:29 2004
--- src/DrawServ/linkselection.c	Thu Mar 18 10:53:27 2004
***************
*** 83,88 ****
--- 83,89 ----
      _locally_selected->Remove(it);
      grid->selected(NotSelected);
    }
+   _waiting_to_be_selected->First(it);
    while (!_waiting_to_be_selected->Done(it)) {
      GraphicId* grid = _waiting_to_be_selected->GetGraphicId(it);
      _waiting_to_be_selected->Remove(it);
*** /dev/null	 Thu Mar 18 10:53:38 PST 2004
--- patches/ivtools-040318-johnston-050
*************** patches/ivtools-040318-johnston-050
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-050

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040318-johnston-049"
Content-Disposition: attachment;
	filename=ivtools-040318-johnston-049

Patch:    ivtools-040318-johnston-049
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.4 DrawServ/draweditor.c:1.5
*** DrawServ/draweditor.c:1.4	Mon Mar  8 13:29:19 2004
--- src/DrawServ/draweditor.c	Thu Mar 18 10:33:28 2004
***************
*** 85,90 ****
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
    comterp->add_command("sessionid", new SessionIdFunc(comterp, this));
!   comterp->add_command("reserve", new ReserveFunc(comterp, this));
  }
  
--- 85,90 ----
  
    comterp->add_command("drawlink", new DrawLinkFunc(comterp, this));
    comterp->add_command("sessionid", new SessionIdFunc(comterp, this));
!   comterp->add_command("grid", new GraphicIdFunc(comterp, this));
  }
  
Index: DrawServ/drawfunc.c
diff -c DrawServ/drawfunc.c:1.17 DrawServ/drawfunc.c:1.18
*** DrawServ/drawfunc.c:1.17	Tue Mar 16 10:54:59 2004
--- src/DrawServ/drawfunc.c	Thu Mar 18 10:33:29 2004
***************
*** 201,210 ****
  
  /*****************************************************************************/
  
! ReserveFunc::ReserveFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
! void ReserveFunc::execute() {
    static int chg_sym = symbol_add("chg");
    ComValue chgv(stack_key(chg_sym));
  
--- 201,210 ----
  
  /*****************************************************************************/
  
! GraphicIdFunc::GraphicIdFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) {
  }
  
! void GraphicIdFunc::execute() {
    static int chg_sym = symbol_add("chg");
    ComValue chgv(stack_key(chg_sym));
  
***************
*** 221,226 ****
--- 221,228 ----
        ((DrawServ*)unidraw)->reserve_change
  	(idv.uint_val(), selectorv.uint_val(), chgv.is_true());
      }
+   } else if (idv.is_unknown()) {
+     ((DrawServ*)unidraw)->print_gridtable();
    }
  }
  
Index: DrawServ/drawfunc.h
diff -c DrawServ/drawfunc.h:1.5 DrawServ/drawfunc.h:1.6
*** DrawServ/drawfunc.h:1.5	Tue Mar  9 11:11:35 2004
--- src/DrawServ/drawfunc.h	Thu Mar 18 10:33:29 2004
***************
*** 48,60 ****
  };
  
  //: command to reserve graphics for selection in remote editors
! // reserve([compview ...] :all :clear) -- reserve graphic(s) for remote selection
! class ReserveFunc : public UnidrawFunc {
  public:
!     ReserveFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s([compview ...] :all :clear) -- reserve graphic(s) for remote selection"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
--- 48,60 ----
  };
  
  //: command to reserve graphics for selection in remote editors
! // grid(id selector :chg) -- reserve graphic for remote selection
! class GraphicIdFunc : public UnidrawFunc {
  public:
!     GraphicIdFunc(ComTerp*,Editor*);
      virtual void execute();
      virtual const char* docstring() { 
! 	return "%s(id selector :chg) -- reserve graphic for remote selection"; }
  };
  
  #endif /* !defined(_drawfunc_h) */
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.26 DrawServ/drawserv.c:1.27
*** DrawServ/drawserv.c:1.26	Tue Mar 16 13:22:06 2004
--- src/DrawServ/drawserv.c	Thu Mar 18 10:33:29 2004
***************
*** 32,37 ****
--- 32,38 ----
  #include <DrawServ/drawserv-handler.h>
  #include <DrawServ/grid.h>
  #include <DrawServ/gridlist.h>
+ #include <DrawServ/linkselection.h>
  
  #include <OverlayUnidraw/ovclasses.h>
  #include <OverlayUnidraw/ovviews.h>
***************
*** 453,459 ****
        
        /* if available, broadcast to everyone */
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "reserve(0x%08x 0x%08x :chg)%c", id, selector, '\0');
        DistributeCmdString(buf);
      }
      
--- 454,460 ----
        
        /* if available, broadcast to everyone */
        char buf[BUFSIZ];
!       snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :chg)%c", id, selector, '\0');
        DistributeCmdString(buf);
      }
      
***************
*** 471,477 ****
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
        grid->selector(selector);
!       grid->selected(false);
      } else
        fprintf(stderr, "reserve change received for unknown id 0x%08x\n", id);
    } else
--- 472,478 ----
      if (ptr) {
        GraphicId* grid = (GraphicId*)ptr;
        grid->selector(selector);
!       grid->selected(LinkSelection::RemotelySelected);
      } else
        fprintf(stderr, "reserve change received for unknown id 0x%08x\n", id);
    } else
***************
*** 480,485 ****
--- 481,487 ----
  
  boolean DrawServ::reserve_if_not_selected(GraphicId* grid, unsigned int selector) {
    
+ #if 0
    /* check if graphic is still locally selected */
    GraphicComp* comp = grid->grcomp();
    boolean selected = false;
***************
*** 503,507 ****
--- 505,534 ----
      grid->selector(selector);
      grid->selected(false);
      return true;
+   }
+ #else
+   if (grid->selected() == LinkSelection::NotSelected ||
+       grid->selected() == LinkSelection::PreviouslySelected) {
+     grid->selector(selector);
+     return true;
+   } else if (grid->selected() == LinkSelection::RemotelySelected ||
+ 	     grid->selected() == LinkSelection::WaitingToBeSelected) 
+     fprintf(stderr, "selection request made it to wrong selector\n");
+   else
+     return false;
+ #endif
+ }
+ 
+ void DrawServ::print_gridtable() {
+   GraphicIdTable* table = gridtable();
+   GraphicIdTable_Iterator it(*table);
+   printf("id          grid        grcomp      selector    selected\n");
+   printf("----------  ----------  ----------  ----------  --------\n");
+   while(it.more()) {
+     GraphicId* grid = (GraphicId*)it.cur_value();
+     printf("0x%08x  0x%08x  0x%08x  0x%08x  0x%08x  %s\n", 
+ 	   (unsigned int)it.cur_key(), grid, grid->grcomp(),
+ 	   grid->selector(), LinkSelection::selected_string(grid->selected()));
+     it.next();
    }
  }
Index: DrawServ/drawserv.h
diff -c DrawServ/drawserv.h:1.16 DrawServ/drawserv.h:1.17
*** DrawServ/drawserv.h:1.16	Tue Mar 16 10:54:59 2004
--- src/DrawServ/drawserv.h	Thu Mar 18 10:33:29 2004
***************
*** 33,38 ****
--- 33,39 ----
  #include <OS/table.h>
  declareTable(GraphicIdTable,int,void*)
  declareTable(SessionIdTable,int,void*)
+      
  
  //: Unidraw specialized for DrawServ
  // Unidraw (OverlayUnidraw) specialized for DrawServ application.
***************
*** 130,135 ****
--- 131,139 ----
    
    static unsigned int GraphicIdMask;
    static unsigned int SessionIdMask;
+ 
+   void print_gridtable();
+   // print contents of table of GraphicId's
    
  protected:
      DrawLinkList* _linklist;
Index: DrawServ/grid.h
diff -c DrawServ/grid.h:1.7 DrawServ/grid.h:1.8
*** DrawServ/grid.h:1.7	Tue Mar 16 10:54:59 2004
--- src/DrawServ/grid.h	Thu Mar 18 10:33:29 2004
***************
*** 70,80 ****
    unsigned int selector() { return _selector; }
    // get session id of current selector
  
!   void selected(int flag) { _selected = flag; }
!   // set flag that indicates graphic is remotely selected
  
    int selected() { return _selected; }
!   // get flag that indicates graphic is remotely selected
  
  protected:
    unsigned int _id;
--- 70,80 ----
    unsigned int selector() { return _selector; }
    // get session id of current selector
  
!   void selected(int state) { _selected = state; }
!   // set selected state
  
    int selected() { return _selected; }
!   // get selected state
  
  protected:
    unsigned int _id;
Index: DrawServ/gridlist.h
diff -c DrawServ/gridlist.h:1.1 DrawServ/gridlist.h:1.2
*** DrawServ/gridlist.h:1.1	Fri Mar  5 10:54:11 2004
--- src/DrawServ/gridlist.h	Thu Mar 18 10:33:29 2004
***************
*** 95,100 ****
--- 95,101 ----
      unsigned int _count;
  
  friend class DrawServ;
+ friend class LinkSelection;
  };
  
  #endif
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.5 DrawServ/linkselection.c:1.6
*** DrawServ/linkselection.c:1.5	Mon Mar 15 13:25:48 2004
--- src/DrawServ/linkselection.c	Thu Mar 18 10:33:29 2004
***************
*** 27,32 ****
--- 27,33 ----
  
  #include <DrawServ/drawserv.h>
  #include <DrawServ/grid.h>
+ #include <DrawServ/gridlist.h>
  #include <DrawServ/linkselection.h>
  
  #include <OverlayUnidraw/ovcomps.h>
***************
*** 39,50 ****
--- 40,63 ----
  
  #include <stdio.h>
  
+ GraphicIdList* LinkSelection::_locally_selected = nil;
+ GraphicIdList* LinkSelection::_waiting_to_be_selected = nil;
+ char* LinkSelection::_selected_strings[] =  { "NotSelected", "LocallySelected", "RemotelySelected", "WaitingToBeSelected", "PreviouslySelected" };
+ 
  /*****************************************************************************/
  
  LinkSelection::LinkSelection (LinkSelection* s) : OverlaySelection(s) {
+   if (!_locally_selected) {
+     _locally_selected = new GraphicIdList;
+     _waiting_to_be_selected = new GraphicIdList;
+   }
  }
  
  LinkSelection::LinkSelection (Selection* s) : OverlaySelection(s) {
+   if (!_locally_selected) {
+     _locally_selected = new GraphicIdList;
+     _waiting_to_be_selected = new GraphicIdList;
+   }
  }
  
  void LinkSelection::Update(Viewer* viewer) {
***************
*** 62,69 ****
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
  
!   /* remove anything from selection that has a remote selector */
    Iterator it;
    First(it);
    while (!Done(it)) {
      int removed = false;
--- 75,95 ----
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
  
!   /* remove everything from the selected and waiting lists */
    Iterator it;
+   _locally_selected->First(it);
+   while (!_locally_selected->Done(it)) {
+     GraphicId* grid = _locally_selected->GetGraphicId(it);
+     _locally_selected->Remove(it);
+     grid->selected(NotSelected);
+   }
+   while (!_waiting_to_be_selected->Done(it)) {
+     GraphicId* grid = _waiting_to_be_selected->GetGraphicId(it);
+     _waiting_to_be_selected->Remove(it);
+     grid->selected(NotSelected);
+   }
+ 
+   /* remove anything from selection that has a remote selector */
    First(it);
    while (!Done(it)) {
      int removed = false;
***************
*** 83,88 ****
--- 109,124 ----
  
  	  Remove(it);
  	  removed = true;
+ 
+ 	  /* add to list of graphics waiting to be selected */
+ 	  grid->selected(WaitingToBeSelected);
+ 	  _waiting_to_be_selected->Append(grid);
+ 	} else {
+ 
+ 	  /* add to list of graphics currently selected */
+ 	  grid->selected(LocallySelected);
+ 	  grid->selector(((DrawServ*)unidraw)->sessionid());
+ 	  _waiting_to_be_selected->Append(grid);
  	}
        }
      }
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.3 DrawServ/linkselection.h:1.4
*** DrawServ/linkselection.h:1.3	Mon Mar 15 13:25:48 2004
--- src/DrawServ/linkselection.h	Thu Mar 18 10:33:29 2004
***************
*** 46,52 ****
--- 46,61 ----
      virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
+   enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected, PreviouslySelected };
+ 
+   static const char* selected_string(int state) { return _selected_strings[state]; }
+ 
  protected:
+   static GraphicIdList* _locally_selected;
+   static GraphicIdList* _waiting_to_be_selected;
+ 
+   static char* _selected_strings[];
+ 
  };
  
  #endif
*** /dev/null	 Thu Mar 18 10:33:44 PST 2004
--- patches/ivtools-040318-johnston-049
*************** patches/ivtools-040318-johnston-049
*** 0 ****
--- 1 ----
+ ivtools-040318-johnston-049

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040316-johnston-048"
Content-Disposition: attachment;
	filename=ivtools-040316-johnston-048

Patch:    ivtools-040316-johnston-048
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.25 DrawServ/drawserv.c:1.26
*** DrawServ/drawserv.c:1.25	Tue Mar 16 10:54:59 2004
--- src/DrawServ/drawserv.c	Tue Mar 16 13:22:06 2004
***************
*** 213,218 ****
--- 213,219 ----
  	  /* unique id already remotely assigned */
  	  if (idv && idv->uint_val() !=0 && sidv && sidv->uint_val() !=0) {
  	    GraphicId* grid = new GraphicId();
+ 	    grid->grcomp(comp);
  	    grid->id(idv->uint_val());
  	    grid->selector(sidv->uint_val());
  	  } 
***************
*** 232,237 ****
--- 233,239 ----
  	    original = true;
  	  }
  	    
+ 
  	  if (comp&&original) {
  	    Creator* creator = unidraw->GetCatalog()->GetCreator();
  	    OverlayScript* scripter = (OverlayScript*)
*** /dev/null	 Tue Mar 16 13:22:16 PST 2004
--- patches/ivtools-040316-johnston-048
*************** patches/ivtools-040316-johnston-048
*** 0 ****
--- 1 ----
+ ivtools-040316-johnston-048

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040316-johnston-047"
Content-Disposition: attachment;
	filename=ivtools-040316-johnston-047

Patch:    ivtools-040316-johnston-047
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.2 DrawServ/drawlinklist.c:1.3
*** DrawServ/drawlinklist.c:1.2	Mon Mar 15 13:25:48 2004
--- src/DrawServ/drawlinklist.c	Tue Mar 16 12:57:12 2004
***************
*** 60,66 ****
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    Iterator i;
    First(i);
!   while(!Done(i) && GetDrawLink(i)->sessionid() != grid->sessionid()) 
      Next(i);
    if (!Done(i)) 
      return GetDrawLink(i);
--- 60,66 ----
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    Iterator i;
    First(i);
!   while(!Done(i) && GetDrawLink(i)->sessionid() != grid->selector()) 
      Next(i);
    if (!Done(i)) 
      return GetDrawLink(i);
*** /dev/null	 Tue Mar 16 12:57:18 PST 2004
--- patches/ivtools-040316-johnston-047
*************** patches/ivtools-040316-johnston-047
*** 0 ****
--- 1 ----
+ ivtools-040316-johnston-047

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040322-johnston-071"
Content-Disposition: attachment;
	filename=ivtools-040322-johnston-071

Patch:    ivtools-040322-johnston-071
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: ComTerp/comhandler.c
diff -c ComTerp/comhandler.c:1.7 ComTerp/comhandler.c:1.8
*** ComTerp/comhandler.c:1.7	Mon Mar  1 13:41:37 2004
--- src/ComTerp/comhandler.c	Mon Mar 22 11:21:02 2004
***************
*** 202,219 ****
        ostr.flush();
        return 0;
  #else
-       /* ignore broken pipe just in case that is why the input was null */
-       struct sigaction oldaction, newaction;
-       newaction.sa_handler = SIG_IGN;
-       newaction.sa_mask = 0;
-       newaction.sa_flags = 0;
-       newaction.sa_sigaction = 0;
-       int status = sigaction(SIGPIPE, &newaction, &oldaction);  // this doesn't work yet
        fileptr_filebuf obuf(fd ? wrfptr() : stdout, ios_base::out);
        ostream ostr(&obuf);
        ostr << "\n";
        ostr.flush();
-       status = sigaction(SIGPIPE, &oldaction, nil);
        return 0;
  #endif
      }
--- 202,211 ----
Index: DrawServ/draweditor.c
diff -c DrawServ/draweditor.c:1.6 DrawServ/draweditor.c:1.7
*** DrawServ/draweditor.c:1.6	Fri Mar 19 09:09:06 2004
--- src/DrawServ/draweditor.c	Mon Mar 22 11:21:25 2004
***************
*** 27,32 ****
--- 27,33 ----
  #include <DrawServ/drawserv.h>
  
  #include <Unidraw/catalog.h>
+ #include <Unidraw/selection.h>
  
  #include <ComTerp/comterpserv.h>
  
***************
*** 74,79 ****
--- 75,81 ----
    add_comterp("DrawServ", _terp);
    _overlay_kit->Init(comp, name);
    InitFrame();
+   _last_selection = new Selection;
  }
  
  void DrawEditor::InitCommands() {
Index: DrawServ/draweditor.h
diff -c DrawServ/draweditor.h:1.2 DrawServ/draweditor.h:1.3
*** DrawServ/draweditor.h:1.2	Fri Mar  5 10:54:11 2004
--- src/DrawServ/draweditor.h	Mon Mar 22 11:21:25 2004
***************
*** 27,32 ****
--- 27,33 ----
  #include <FrameUnidraw/frameeditor.h>
  
  class DrawKit;
+ class Selection;
  
  //: editor for DrawServ application
  class DrawEditor : public FrameEditor {
***************
*** 45,51 ****
--- 46,55 ----
      // method for adding ComFunc objects to the ComTerp associated with
      // this DrawEditor.
  
+     Selection* last_selection() { return _last_selection; }
+     // return point to Selection that shadows the last setting.
  protected:
+     Selection* _last_selection;
  
  friend class DrawKit;
  
Index: DrawServ/linkselection.c
diff -c DrawServ/linkselection.c:1.14 DrawServ/linkselection.c:1.15
*** DrawServ/linkselection.c:1.14	Fri Mar 19 15:39:36 2004
--- src/DrawServ/linkselection.c	Mon Mar 22 11:21:25 2004
***************
*** 25,30 ****
--- 25,31 ----
   * Implementation of LinkSelection class.
   */
  
+ #include <DrawServ/draweditor.h>
  #include <DrawServ/drawserv.h>
  #include <DrawServ/grid.h>
  #include <DrawServ/gridlist.h>
***************
*** 34,39 ****
--- 35,41 ----
  #include <OverlayUnidraw/ovviews.h>
  
  #include <Unidraw/iterator.h>
+ #include <Unidraw/viewer.h>
  
  #include <Attribute/attrlist.h>
  #include <Attribute/attrvalue.h>
***************
*** 62,68 ****
  
  void LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
!   Reserve();
    OverlaySelection::Update(viewer);
  }
  
--- 64,71 ----
  
  void LinkSelection::Update(Viewer* viewer) {
    fprintf(stderr, "LinkSelection::Update\n");
!   if (viewer) 
!     Reserve(viewer->GetEditor());
    OverlaySelection::Update(viewer);
  }
  
***************
*** 91,103 ****
    
  }
  
! void LinkSelection::Reserve() {
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
!   /* remove anything from selection that has a remote selector */
    Iterator it;
    First(it);
    while (!Done(it)) {
      int removed = false;
--- 94,133 ----
    
  }
  
! void LinkSelection::Reserve(Editor* ed) {
    fprintf(stderr, "LinkSelection::Reserve\n");
    static int id_sym = symbol_add("id");
    CompIdTable* table = ((DrawServ*)unidraw)->compidtable();
  
!   /* clear anything that was in the previous selection, but not in this one */
!   Selection* lastsel = ((DrawEditor*)ed)->last_selection();
!   Iterator lt;
!   lastsel->First(lt);
    Iterator it;
+   while (!lastsel->Done(lt)) {
+     First(it);
+     boolean match = false;
+     while (!Done(it) && !match) {
+       if(GetView(it)==lastsel->GetView(lt)) 
+ 	match = true;
+       else 
+ 	Next(it);
+     }
+     if (!match) {
+       OverlayComp* comp = ((OverlayView*)lastsel->GetView(lt))->GetOverlayComp();
+       void* ptr = nil;
+       table->find(ptr, (void*)comp);
+       if (ptr) {
+ 	GraphicId* grid = (GraphicId*)ptr;
+ 	grid->selected(NotSelected);
+ 	((DrawServ*)unidraw)->grid_message(grid);
+       }
+     }
+     lastsel->Next(lt);
+   }
+   lastsel->Clear();
+ 
+   /* remove anything from selection that has a remote selector */
    First(it);
    while (!Done(it)) {
      int removed = false;
***************
*** 121,132 ****
  	} 
  	
        } else {
! 	grid->selected(LocallySelected);
! 	((DrawServ*)unidraw)->grid_message(grid);
        }
        
      }
      if (!removed) 
        Next(it);
    }
  }
--- 151,167 ----
  	} 
  	
        } else {
! 	if (grid->selected()!=LocallySelected) {
! 	  grid->selected(LocallySelected);
! 	  ((DrawServ*)unidraw)->grid_message(grid);
! 	}
        }
        
      }
      if (!removed) 
        Next(it);
    }
+ 
+   /* store copy of selection */
+   lastsel->Merge(this);
  }
Index: DrawServ/linkselection.h
diff -c DrawServ/linkselection.h:1.5 DrawServ/linkselection.h:1.6
*** DrawServ/linkselection.h:1.5	Fri Mar 19 10:05:33 2004
--- src/DrawServ/linkselection.h	Mon Mar 22 11:21:25 2004
***************
*** 43,49 ****
      virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
!     virtual void Reserve();
      // reserve newly created graphics in selection across the network
  
    enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected };
--- 43,49 ----
      virtual void Update(Viewer* = nil); 
      virtual void Clear(Viewer* = nil);
  
!     virtual void Reserve(Editor*);
      // reserve newly created graphics in selection across the network
  
    enum { NotSelected, LocallySelected, RemotelySelected, WaitingToBeSelected };
Index: drawserv_/main.c
diff -c drawserv_/main.c:1.4 drawserv_/main.c:1.5
*** drawserv_/main.c:1.4	Fri Feb 27 09:32:53 2004
--- src/drawserv_/main.c	Mon Mar 22 11:21:27 2004
***************
*** 210,215 ****
--- 210,224 ----
  /*****************************************************************************/
  
  int main (int argc, char** argv) {
+ 
+     /* ignore broken pipe, so socket writes that are in error return EPIPE */
+     struct sigaction oldaction, newaction;
+     newaction.sa_handler = SIG_IGN;
+     newaction.sa_mask = 0;
+     newaction.sa_flags = 0;
+     newaction.sa_sigaction = 0;
+     int status = sigaction(SIGPIPE, &newaction, &oldaction); 
+   
  #ifdef HAVE_ACE
      Dispatcher::instance(new AceDispatcher(ComterpHandler::reactor_singleton()));
  #endif
Index: OverlayUnidraw/ovcomps.c
diff -c OverlayUnidraw/ovcomps.c:1.2 OverlayUnidraw/ovcomps.c:1.3
*** OverlayUnidraw/ovcomps.c:1.2	Fri Mar 12 11:32:55 2004
--- src/OverlayUnidraw/ovcomps.c	Mon Mar 22 11:21:19 2004
***************
*** 1008,1014 ****
              if (view != nil) s->Append(view);
          }
      }
!     ((OverlaySelection*)s)->Reserve();
  }
  
  void OverlaysComp::StorePosition (OverlayComp* comp, Command* cmd) {
--- 1008,1014 ----
              if (view != nil) s->Append(view);
          }
      }
!     ((OverlaySelection*)s)->Reserve(ed);
  }
  
  void OverlaysComp::StorePosition (OverlayComp* comp, Command* cmd) {
Index: OverlayUnidraw/ovimport.c
diff -c OverlayUnidraw/ovimport.c:1.3 OverlayUnidraw/ovimport.c:1.4
*** OverlayUnidraw/ovimport.c:1.3	Fri Mar  5 10:54:02 2004
--- src/OverlayUnidraw/ovimport.c	Mon Mar 22 11:21:20 2004
***************
*** 1152,1159 ****
  
          // let components configures themselves with the editor
          ((OverlayEditor*)GetEditor())->InformComponents();
! 	if (preserve_selection_)
  	  GetEditor()->SetSelection(oldsel);
          unidraw->Update();
      } else {
        if (!from_dialog && !empty) {
--- 1152,1161 ----
  
          // let components configures themselves with the editor
          ((OverlayEditor*)GetEditor())->InformComponents();
! 	if (preserve_selection_) {
! 	  delete GetEditor()->GetSelection();
  	  GetEditor()->SetSelection(oldsel);
+ 	}
          unidraw->Update();
      } else {
        if (!from_dialog && !empty) {
Index: OverlayUnidraw/ovselection.h
diff -c OverlayUnidraw/ovselection.h:1.4 OverlayUnidraw/ovselection.h:1.5
*** OverlayUnidraw/ovselection.h:1.4	Mon Mar 15 13:25:42 2004
--- src/OverlayUnidraw/ovselection.h	Mon Mar 22 11:21:20 2004
***************
*** 31,36 ****
--- 31,37 ----
  
  #include <Unidraw/selection.h>
  
+ class Editor;
  class OverlayView;
  class OverlayViewer;
  
***************
*** 69,75 ****
  
      OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
!     virtual void Reserve() { return; }
      // for use of derived classes
  
  protected:
--- 70,76 ----
  
      OverlaySelection* ViewsWithin(IntCoord l, IntCoord b, IntCoord r, IntCoord t);
  
!     virtual void Reserve(Editor* ed) { return; }
      // for use of derived classes
  
  protected:
*** /dev/null	 Mon Mar 22 11:21:37 PST 2004
--- patches/ivtools-040322-johnston-071
*************** patches/ivtools-040322-johnston-071
*** 0 ****
--- 1 ----
+ ivtools-040322-johnston-071

--Apple-Mail-10--191180718
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="ivtools-040319-johnston-070"
Content-Disposition: attachment;
	filename=ivtools-040319-johnston-070

Patch:    ivtools-040319-johnston-070
For:      ivtools-1.1.3
Author:   [email protected]
Subject:  drawserv work
Requires: 

This is an intermediate patch to ivtools-1.1.3.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Summary of Changes:

Index: DrawServ/drawlinklist.c
diff -c DrawServ/drawlinklist.c:1.4 DrawServ/drawlinklist.c:1.5
*** DrawServ/drawlinklist.c:1.4	Thu Mar 18 22:31:01 2004
--- src/DrawServ/drawlinklist.c	Fri Mar 19 16:33:11 2004
***************
*** 60,66 ****
  
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    void* ptr = nil;
!   ((DrawServ*)unidraw)->sessionidtable()->find(ptr, grid->sessionid());
    return (DrawLink*)ptr;
  }
  
--- 60,66 ----
  
  DrawLink* DrawLinkList::find_drawlink(GraphicId* grid) {
    void* ptr = nil;
!   ((DrawServ*)unidraw)->sessionidtable()->find(ptr, grid->selector());
    return (DrawLink*)ptr;
  }
  
Index: DrawServ/drawserv.c
diff -c DrawServ/drawserv.c:1.41 DrawServ/drawserv.c:1.42
*** DrawServ/drawserv.c:1.41	Fri Mar 19 16:12:15 2004
--- src/DrawServ/drawserv.c	Fri Mar 19 16:33:11 2004
***************
*** 453,459 ****
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
      if (selector==sessionid() && newselector!=0) {
!       if (grid->selector()==sessionid() && grid->selected()==LinkSelection::NotSelected) {
  	grid->selector(newselector);
  	char buf[BUFSIZ];
  	snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :grant 0x%08x)%c",
--- 453,462 ----
    if (ptr) {
      GraphicId* grid = (GraphicId*)ptr;
      if (selector==sessionid() && newselector!=0) {
!       if (grid->selector()==sessionid() && 
! 	  (grid->selected()==LinkSelection::NotSelected || 
! 	   grid->selected()==LinkSelection::WaitingToBeSelected)) {
! 	grid->selected(LinkSelection::NotSelected);
  	grid->selector(newselector);
  	char buf[BUFSIZ];
  	snprintf(buf, BUFSIZ, "grid(0x%08x 0x%08x :grant 0x%08x)%c",
*** /dev/null	 Fri Mar 19 16:33:18 PST 2004
--- patches/ivtools-040319-johnston-070
*************** patches/ivtools-040319-johnston-070
*** 0 ****
--- 1 ----
+ ivtools-040319-johnston-070

--Apple-Mail-10--191180718--



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click