fix drawserv attribute expression propogation mechanism

[email protected] Sat, 2 Nov 2002 14:35:10 -0800
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <a04320416b9ea037aca7a@[12.236.206.76]>
Patch:    ivtools-021022-johnston-071
For:      ivtools-1.0.6
Author:   [email protected]
Subject:  fix drawserv attribute expression propogation mechanism
Requires:

This is an intermediate patch to ivtools-1.0.6.  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:

- fix drawser attribute expression propogation used for Null 
Convention Logic emulation (http://www.theseus.com).

- SVG rectangle export work.

Index: Attribute/attrlist.c
diff -c Attribute/attrlist.c:1.1 Attribute/attrlist.c:1.2
*** Attribute/attrlist.c:1.1    Fri Sep 13 09:47:40 2002
--- src/Attribute/attrlist.c    Tue Oct 22 12:09:20 2002
***************
*** 217,226 ****
                 out << "\"" << string << "\"";
                 break;
             case AttributeValue::CharType:
!               out << attrval->char_ref();
                 break;
             case AttributeValue::UCharType:
!               out << attrval->char_ref();
                 break;
             case AttributeValue::IntType:
                 out << attrval->int_ref();
--- 217,226 ----
                 out << "\"" << string << "\"";
                 break;
             case AttributeValue::CharType:
!               out << "'" << attrval->char_ref() << "'";
                 break;
             case AttributeValue::UCharType:
!               out << "'" << attrval->char_ref() << "'";
                 break;
             case AttributeValue::IntType:
                 out << attrval->int_ref();
Index: ComUnidraw/unifunc.c
diff -c ComUnidraw/unifunc.c:1.2 ComUnidraw/unifunc.c:1.3
*** ComUnidraw/unifunc.c:1.2    Fri Sep 27 11:57:12 2002
--- src/ComUnidraw/unifunc.c    Tue Oct 22 12:10:17 2002
***************
*** 512,519 ****
         compout(comp, out);
         *out << ")\n";
         } else {
-       OverlayPS::idraw_format(idraw_flag.is_true());
         OverlayPS* psv = (OverlayPS*) comp->Create(POSTSCRIPT_VIEW);
         comp->Attach(psv);
         psv->Update();
         psv->Emit(*out);
--- 512,519 ----
         compout(comp, out);
         *out << ")\n";
         } else {
         OverlayPS* psv = (OverlayPS*) comp->Create(POSTSCRIPT_VIEW);
+       psv->idraw_format(idraw_flag.is_true());
         comp->Attach(psv);
         psv->Update();
         psv->Emit(*out);
Index: DrawServ/drawcatalog.c
diff -c DrawServ/drawcatalog.c:1.1 DrawServ/drawcatalog.c:1.2
*** DrawServ/drawcatalog.c:1.1  Fri Sep 13 09:51:58 2002
--- src/DrawServ/drawcatalog.c  Tue Oct 22 12:10:23 2002
***************
*** 184,189 ****
--- 184,191 ----
       _edges[i]->Edge()->
         attach_nodes(start_id < 0 ? nil : _nodes[start_id]->Node(),
                    end_id < 0 ? nil : _nodes[end_id]->Node());
+     if (start_id >=0 && end_id >=0)
+       _edges[i]->NodeStart()->attach(_edges[i]->NodeEnd());
     }
     delete _startnode; _startnode = nil;
     delete _endnode; _endnode = nil;
Index: OverlayUnidraw/ovrect.c
diff -c OverlayUnidraw/ovrect.c:1.1 OverlayUnidraw/ovrect.c:1.2
*** OverlayUnidraw/ovrect.c:1.1 Fri Sep 13 09:51:24 2002
--- src/OverlayUnidraw/ovrect.c Tue Oct 22 12:10:09 2002
***************
*** 393,404 ****
       RectOvComp* comp = (RectOvComp*) GetSubject();
       comp->GetRect()->GetOriginal(l, b, r, t);

!     out << "rectangle(";
!     out << l << "," << b << "," << r << "," << t;
       MinGS(out);
       Annotation(out);
       Attributes(out);
!     out << ")";

       return out.good();
   }
--- 393,412 ----
       RectOvComp* comp = (RectOvComp*) GetSubject();
       comp->GetRect()->GetOriginal(l, b, r, t);

!     if (!svg_format()) {
!       out << "rectangle(";
!       out << l << "," << b << "," << r << "," << t;
!     } else {
!       out << "<rect x=\"" << l << "\" y=\"" << b
!         << "\" width=\"" << r-l << "\" height=\"" << t-b << "\" ";;
!     }
       MinGS(out);
       Annotation(out);
       Attributes(out);
!     if (!svg_format())
!       out << ")";
!     else
!       out << "/>\n";

       return out.good();
   }
Index: OverlayUnidraw/scriptview.c
diff -c OverlayUnidraw/scriptview.c:1.2 OverlayUnidraw/scriptview.c:1.3
*** OverlayUnidraw/scriptview.c:1.2     Mon Oct  7 13:01:56 2002
--- src/OverlayUnidraw/scriptview.c     Tue Oct 22 12:10:09 2002
***************
*** 111,143 ****
           out << w;
         } else {
           out << "stroke-width: " << w << "; ";
-         out << "stroke-dasharray: ";

!         /* reverse dash bit field */
!         int reverse_p = 0;
!         for (int i=0; i<16; i++) {
!           reverse_p <<= 1;
!           reverse_p |= p & 0x1;
!           p >>= 1;
!         }
!
!         /* output count of on/off runs */
!         boolean lastbit=1;
!         int dashlen = 0;
!         for (int i=0; i<16; i++) {
!           boolean bit = reverse_p & 1;
!           if (lastbit==bit) dashlen++;
!           if (lastbit != bit || i==15)  {
!             out << dashlen;
!             if (i != 15 ) out << ", ";
!             dashlen=1;
             }
!           lastbit = bit;
!           reverse_p >>= 1;
           }
-         out << "; ";
         }
!
         }
       }
   }
--- 111,146 ----
           out << w;
         } else {
           out << "stroke-width: " << w << "; ";

!         if (p != 0xffff) {
!           out << "stroke-dasharray: ";
!
!           /* reverse dash bit field */
!           int reverse_p = 0;
!           for (int i=0; i<16; i++) {
!             reverse_p <<= 1;
!             reverse_p |= p & 0x1;
!             p >>= 1;
             }
!
!           /* output count of on/off runs */
!           boolean lastbit=1;
!           int dashlen = 0;
!           for (int i=0; i<16; i++) {
!             boolean bit = reverse_p & 1;
!             if (lastbit==bit) dashlen++;
!             if (lastbit != bit || i==15)  {
!               out << dashlen;
!               if (i != 15 ) out << ", ";
!               dashlen=1;
!             }
!             lastbit = bit;
!             reverse_p >>= 1;
!           }
!           out << "; ";
           }
         }
!
         }
       }
   }
***************
*** 159,164 ****
--- 162,171 ----
             << (int)(r*100) << "%,"
             << (int)(g*100) << "%,"
             << (int)(b*100) << "%) ";
+       out << "fill-color: rgb("
+           << (int)(r*100) << "%,"
+           << (int)(g*100) << "%,"
+           << (int)(b*100) << "%) ";
         }

       }
***************
*** 244,249 ****
--- 251,271 ----
           out << " :graypat " << graylevel;
         }
         }
+     }
+ }
+
+ void OverlayScript::Transformation(ostream& out, char* keyword, 
Graphic* gr = nil) {
+     Transformer* t = gr ? gr->GetTransformer() : 
GetOverlayComp()->GetGraphic()->GetTransformer();
+     Transformer identity;
+
+     if (t != nil && *t != identity) {
+       char key[strlen(keyword)+4];
+       sprintf(key," :%s ",keyword);
+       float a00, a01, a10, a11, a20, a21;
+       t->GetEntries(a00, a01, a10, a11, a20, a21);
+       out << key;
+       out << a00 << "," << a01 << "," << a10 << ",";
+       out << a11 << "," << a20 << "," << a21;
       }
   }

Index: OverlayUnidraw/scriptview.h
diff -c OverlayUnidraw/scriptview.h:1.2 OverlayUnidraw/scriptview.h:1.3
*** OverlayUnidraw/scriptview.h:1.2     Mon Oct  7 13:01:57 2002
--- src/OverlayUnidraw/scriptview.h     Tue Oct 22 12:10:09 2002
***************
*** 179,184 ****
--- 179,185 ----
       virtual void Font(ostream& out);
       virtual void Pattern(ostream& out);
       virtual void Transformation(ostream& out);
+     virtual void Transformation(ostream& out, char* keyword, 
Graphic* gr = nil);
       virtual void Annotation(ostream& out);

       void Attributes(ostream& out);
*** /dev/null    Tue Oct 22 12:10:51 PDT 2002
--- patches/ivtools-021022-johnston-071
*************** patches/ivtools-021022-johnston-071
*** 0 ****
--- 1 ----
+ ivtools-021022-johnston-071


-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en