From: mauro@netcom.com (Mauro DePalma)
Newsgroups: comp.windows.interviews
Subject: patch for ./iv/src/examples/morpher
Date: 20 Dec 92 21:53:49 GMT
Organization: Netcom - Online Communication Services  (408 241-9760 guest)

After building InterViews 3.1 on a SPARCstation 1+ using gcc-2.3.1 (libg-2.3)
I made some changes to ''iv/src/examples/morpher'' which cause a 'make install'
to place idraw files needed by the application in a ''LibAllDir/icons''
directory. Imorpher itself now will search a "ICONPATH" for the needed
files where originally they had to be in "../icons".

  I think that imorpher is a good application, wish to thank the author(s)
and include with this posting ye' `ol patch file.

    mauro@netcom.com (member of the LPF)

-- CUT HERE -- CUT HERE-- CUT HERE-- CUT HERE-- CUT HERE-- CUT HERE--
*** orig/Imakefile	Sun Dec 20 10:29:22 1992
--- Imakefile	Sun Dec 20 13:14:37 1992
***************
*** 3,8 ****
--- 3,9 ----
  XCOMM
  
  #ifdef InObjectCodeDir
+  ICONPATH = -DICONPATH=\"LibAllDir/icons/\"
  
  Use_libInterViews()
  ComplexProgramTarget(imorpher)
***************
*** 10,22 ****
  MakeObjectFromSrc(main)
  MakeObjectFromSrc(figure)
  MakeObjectFromSrc(globals)
! MakeObjectFromSrc(glypheditor)
  MakeObjectFromSrc(glyphviewer)
  MakeObjectFromSrc(idraw)
  MakeObjectFromSrc(morpher)
- 
  #else
  
  MakeInObjectCodeDir()
  
  #endif
--- 11,38 ----
  MakeObjectFromSrc(main)
  MakeObjectFromSrc(figure)
  MakeObjectFromSrc(globals)
! 
! $(AOUT): glypheditor.o
! glypheditor.o: $(SRC)/glypheditor.$(CCSUFFIX)
! 	@$(RM) glypheditor.o glypheditor..c
! 	$(CCDRIVER) $(CCFLAGS) $(ICONPATH) -c $(SRC)/glypheditor.$(CCSUFFIX)
! 
  MakeObjectFromSrc(glyphviewer)
  MakeObjectFromSrc(idraw)
  MakeObjectFromSrc(morpher)
  #else
  
+   ICONS = icons/cont_play \
+           icons/fast_forward \
+           icons/fast_reverse \
+           icons/forward_pause \
+           icons/forward_play \
+           icons/pause \
+           icons/record \
+           icons/reverse_pause \
+           icons/reverse_play
+ 
  MakeInObjectCodeDir()
+ InstallMultipleFlags($(ICONS),LibAllDir/icons,InstDatFlags)
  
  #endif
*** orig/figure.c	Thu Aug 20 14:26:08 1992
--- figure.c	Sun Dec 20 11:09:32 1992
***************
*** 1379,1385 ****
  
  /**********************************************************************/
  declarePtrList(GraphicList, Graphic);
- implmentPtrList(GraphicList, Graphic);
  
  static Cursor* grabber_cursor = nil;
  static Cursor* window_cursor = nil;
--- 1379,1384 ----
*** orig/glypheditor.c	Sun Dec 20 10:29:23 1992
--- glypheditor.c	Sun Dec 20 13:08:42 1992
***************
*** 20,25 ****
--- 20,28 ----
  #include <OS/string.h>
  #include <stdio.h>
  #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+ 
  #include "figure.h"
  #include "morpher.h"
  #include "glypheditor.h"
***************
*** 355,362 ****
  }
      
  
- static const char* icon_dir = "../icons/";
- 
  Glyph* GlyphEditor::toolpal () {
      LayoutKit* layout = LayoutKit::instance();
      WidgetKit* widget = WidgetKit::instance();
--- 358,363 ----
***************
*** 364,375 ****
      
      TelltaleFlags f = TelltaleState::is_enabled | TelltaleState::is_choosable;
      PolyGlyph* hbox = layout->hbox(12);
  
      for (int i = 0; morph_array[i]._filename != nil; i++) {
          Coord l, b, r, t;
!         char buf[256];
!         strcpy(buf, icon_dir);
!         strcat(buf, morph_array[i]._filename);
  
          Graphic* gr = IdrawReader::load(buf);
          gr->getbounds(l, b, r, t);
--- 365,404 ----
      
      TelltaleFlags f = TelltaleState::is_enabled | TelltaleState::is_choosable;
      PolyGlyph* hbox = layout->hbox(12);
+     char* icon_dir;
+     char buf[256];
+     int marker;
  
+     /* Mauro DePalma (mauro@netcom.com) stardate 1992,12,20
+ 
+           some code added to search a path for the needed icons.
+     */
+     sprintf(buf, "%s:icons/:../icons/",
+                     (icon_dir = getenv("ICONPATH")) ? icon_dir : ICONPATH);
+ 
+     for (icon_dir = strtok(buf, ":"); icon_dir; icon_dir = strtok(NULL, ":"))
+       if (access(icon_dir, F_OK) == 0)
+         {
+           strcpy(buf, icon_dir);
+           marker = strlen(icon_dir);
+           break;
+         }
+ 
+     if (icon_dir == NULL)
+       {
+         puts("no 'icons' directory found.. installation problem?");
+         exit(1);
+       }
+ 
      for (int i = 0; morph_array[i]._filename != nil; i++) {
          Coord l, b, r, t;
!         strcpy(&buf[marker], morph_array[i]._filename);
! 
!         if (access(buf, F_OK))
!           {
!             printf("can't find '%s'.. installation problem?\n", buf);
!             exit(1);
!           }
  
          Graphic* gr = IdrawReader::load(buf);
          gr->getbounds(l, b, r, t);
Newsgroups: comp.windows.interviews