refactor OverlayPS::idraw_format

[email protected] Sat, 2 Nov 2002 14:33:12 -0800
Newsgroups gmane.comp.lib.ivtools.patches
Message-ID <a04320414b9ea0315b2c2@[12.236.206.76]>
Patch:    ivtools-020927-johnston-069
For:      ivtools-1.0.6
Author:   [email protected]
Subject:  refactor OverlayPS::idraw_format
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:

- refactor OverlayPS::idraw_format to be a pair of set/get methods
where the get method overrides the internal static member value
(_idraw_format) with the value of an idraw_format flag on an
associated Command if there is one, either OvExportCmd or OvPrintCmd.

Index: ComUnidraw/unifunc.c
diff -c ComUnidraw/unifunc.c:1.1 ComUnidraw/unifunc.c:1.2
*** ComUnidraw/unifunc.c:1.1    Fri Sep 13 09:51:35 2002
--- src/ComUnidraw/unifunc.c    Fri Sep 27 11:57:12 2002
***************
*** 512,518 ****
         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();
--- 512,518 ----
         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();
Index: OverlayUnidraw/ovarrow.c
diff -c OverlayUnidraw/ovarrow.c:1.1 OverlayUnidraw/ovarrow.c:1.2
*** OverlayUnidraw/ovarrow.c:1.1        Fri Sep 13 09:51:20 2002
--- src/OverlayUnidraw/ovarrow.c        Fri Sep 27 11:57:05 2002
***************
*** 621,636 ****

   boolean ArrowMultiLinePS::Definition (ostream& out) {

!     Command* cmd = GetCommand();
!     boolean idraw_format = OverlayPS::idraw_format;
!     if (cmd) {
!       if (cmd->IsA(OVPRINT_CMD))
!       idraw_format = ((OvPrintCmd*)cmd)->idraw_format();
!       else if (cmd->IsA(OV_EXPORT_CMD))
!       idraw_format = true;
!     }
!
!     if (idraw_format) {
         ArrowMultiLineOvComp* comp = (ArrowMultiLineOvComp*) GetSubject();
         ArrowMultiLine* aml = comp->GetArrowMultiLine();

--- 621,627 ----

   boolean ArrowMultiLinePS::Definition (ostream& out) {

!     if (idraw_format()) {
         ArrowMultiLineOvComp* comp = (ArrowMultiLineOvComp*) GetSubject();
         ArrowMultiLine* aml = comp->GetArrowMultiLine();

Index: OverlayUnidraw/ovpsview.c
diff -c OverlayUnidraw/ovpsview.c:1.1 OverlayUnidraw/ovpsview.c:1.2
*** OverlayUnidraw/ovpsview.c:1.1       Fri Sep 13 09:51:24 2002
--- src/OverlayUnidraw/ovpsview.c       Fri Sep 27 11:57:06 2002
***************
*** 101,107 ****

 
/*****************************************************************************/

! boolean OverlayPS::idraw_format = true;

   ClassId OverlayPS::GetClassId () { return OVERLAY_PS; }

--- 101,107 ----

 
/*****************************************************************************/

! boolean OverlayPS::_idraw_format = true;

   ClassId OverlayPS::GetClassId () { return OVERLAY_PS; }

***************
*** 114,120 ****
   }

   void OverlayPS::Creator (ostream& out) {
!     out << "%%Creator: " << (idraw_format ? "idraw" : "unidraw") << "\n";
   }

   UList* OverlayPS::GetPSFonts () {
--- 114,120 ----
   }

   void OverlayPS::Creator (ostream& out) {
!     out << "%%Creator: " << (idraw_format() ? "idraw" : "unidraw") << "\n";
   }

   UList* OverlayPS::GetPSFonts () {
***************
*** 182,187 ****
--- 182,201 ----
   OverlayComp* OverlayPS::GetOverlayComp () {
       return (OverlayComp*) GetSubject();
   }
+
+ boolean OverlayPS::idraw_format() {
+     boolean format = OverlayPS::_idraw_format;
+     Command* cmd = GetCommand();
+     if (cmd) {
+       if (GetCommand()->IsA(OV_EXPORT_CMD))
+       format = ((OvExportCmd*)GetCommand())->idraw_format();
+       else if (GetCommand() && GetCommand()->IsA(OVPRINT_CMD))
+       format = ((OvPrintCmd*)GetCommand())->idraw_format();
+     }
+     return format;
+ }
+
+ void OverlayPS::idraw_format(boolean flag) { _idraw_format = flag; }

 
/*****************************************************************************/

Index: OverlayUnidraw/ovpsview.h
diff -c OverlayUnidraw/ovpsview.h:1.1 OverlayUnidraw/ovpsview.h:1.2
*** OverlayUnidraw/ovpsview.h:1.1       Fri Sep 13 09:51:24 2002
--- src/OverlayUnidraw/ovpsview.h       Fri Sep 27 11:57:06 2002
***************
*** 63,71 ****
       virtual void Creator(ostream&);
       // output idraw as creator

!     static boolean idraw_format;
   protected:
       OverlayPS(OverlayComp* = nil);

       Command* _command;
   };
--- 63,73 ----
       virtual void Creator(ostream&);
       // output idraw as creator

!     boolean idraw_format();
!     void idraw_format(boolean);
   protected:
       OverlayPS(OverlayComp* = nil);
+     static boolean _idraw_format;

       Command* _command;
   };
Index: OverlayUnidraw/ovraster.c
diff -c OverlayUnidraw/ovraster.c:1.1 OverlayUnidraw/ovraster.c:1.2
*** OverlayUnidraw/ovraster.c:1.1       Fri Sep 13 09:51:24 2002
--- src/OverlayUnidraw/ovraster.c       Fri Sep 27 11:57:06 2002
***************
*** 364,376 ****
       Coord w = raster->Width();
       Coord h = raster->Height();

!     boolean idraw_format = OverlayPS::idraw_format;
!     if (GetCommand() && GetCommand()->IsA(OV_EXPORT_CMD))
!       idraw_format = ((OvExportCmd*)GetCommand())->idraw_format();
!     else if (GetCommand() && GetCommand()->IsA(OVPRINT_CMD))
!       idraw_format = ((OvPrintCmd*)GetCommand())->idraw_format();
!
!     if (idraw_format) {

         out << "Begin " << MARK << " " << "Rast\n";
         Transformation(out);
--- 364,370 ----
       Coord w = raster->Width();
       Coord h = raster->Height();

!     if (idraw_format()) {

         out << "Begin " << MARK << " " << "Rast\n";
         Transformation(out);
*** /dev/null    Fri Sep 27 11:57:36 PDT 2002
--- patches/ivtools-020927-johnston-069
*************** patches/ivtools-020927-johnston-069
*** 0 ****
--- 1 ----
+ ivtools-020927-johnston-069


-------------------------------------------------------
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