home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- lift.c By: Stephen Vermeulen
-
- Copyright (C) 1989 By Stephen Vermeulen
-
- Use this tool to rearrange an icon so its image overlaps
- the text description, the text being centered in the icon's image.
-
- It has the following syntax:
-
- lift file y_amount
-
- when this is typed, lift will load the file called "file.info"
- and change it and then resave it under the old name to the disk.
- Just a bit more general a version of "Center".
- ************************************************************/
-
- #include <intuition/intuition.h>
- #include <workbench/workbench.h>
- #include <stdio.h>
- #include <functions.h>
-
- #define NO_ICONS 4
-
- extern ULONG IconBase;
-
- /************************************************************
- The following routine just opens the libraries
- ************************************************************/
-
- short OpenLibs()
- {
- short flags; /* any libraries that do not open get recorded here */
-
- flags = 0;
- IconBase = (ULONG) OpenLibrary("icon.library", 0L);
- if (!IconBase) flags |= NO_ICONS;
- return(flags);
- }
-
- void CloseLibs(flags)
- short flags;
- {
- if (!(flags & NO_ICONS)) CloseLibrary(IconBase);
- }
-
- void main(argc, argv)
- short argc;
- char *argv[];
- {
- short lib_flags, icon_type;
- long xo, yo;
- struct DiskObject *dobj, *drawer_obj;
- struct DrawerData *dd_temp;
-
- if (argc == 3)
- {
- lib_flags = OpenLibs();
- if (!lib_flags)
- {
- if (dobj = GetDiskObject(argv[1]))
- {
- /** ok to proceed **/
-
- yo = ((struct Image *) dobj->do_Gadget.GadgetRender)->Height;
- if ((argv[2][0] == '-') || (argv[2][0] == '+'))
- dobj->do_Gadget.Height -= atoi(argv[2]);
- else
- dobj->do_Gadget.Height = yo - 9 - atoi(argv[2]);
- PutDiskObject(argv[1], dobj);
- FreeDiskObject(dobj);
- }
- }
- CloseLibs(lib_flags);
- }
- else
- {
- puts("Syntax is: lift icon y_amount");
- puts(" ... don't use the .icon suffix!");
- puts("If y_amount is SIGNED (ie. +10 or -5 etc.) then the text is moved");
- puts("relative to its current position. If y_amount does not have a sign");
- puts("then the text is raised by y_amount above the BOTTOM edge of the image.");
- puts("Written by: Stephen Vermeulen, PO Box 3295, Station B,");
- puts("Calgary, Alberta, CANADA, T2M 4L8.");
- }
- }
-