
/* icon support for m2emacs */
/* 4-12-88/ms */
/* 08-Aug-92/bp do not override old icons */

#include "ed.h"
#include <workbench/workbench.h>
#include <clib/icon_protos.h>
#include <clib/icon_pragmas.h>

extern struct Library __far *IconBase;

void makeicon(name)
char *name;
{
  struct DiskObject *dobj,*GetDiskObject();

  if (IconBase) {
    dobj = GetDiskObject(name);
    if (dobj) {
      FreeDiskObject(dobj); /* schon eins da, fertig */
    }
    else {
      dobj = GetDiskObject("m2:icons/txt");
      if (dobj) {
        PutDiskObject(name,dobj);
        FreeDiskObject(dobj);
      }
      else {
#ifdef DEUTSCH
        mlwrite("Keine Vorgabe-Ikone gefunden");
#else
        mlwrite("no default icon found");
#endif
      }
    }
  }
}

/* bei Backups wird also das Original kopiert */
void copyicon(from,to)
char *from,*to;
{
  struct DiskObject *dobj,*GetDiskObject();

  if (IconBase) {
    dobj = GetDiskObject(from);
    if (dobj) {
      PutDiskObject(to,dobj);
      FreeDiskObject(dobj);
    }
  }
}
