[comp.sys.amiga] The first TWO OFFICIAL Egad changes

crunch@well.UUCP (John Draper) (12/25/86)

                       EGAD CHANGES
                       ------------
		       
  There have been TWO Official changes I made to Egad.    All of my changes
will reflect from the Fish disk 46 as the BASE.

  All changes will be numbered,  so if anyone needs to refer to a specific 
change,  Please use THESE numbers to reflect them.    The following changes
fixed one bug, and added a new and useful feature.


Change #1 - Fixes a problem when using Boolean gadgets,  where the area
described by the image was shorter than it should be.    Thus Boolean 
gadgets had smaller than normal image sizes.   The change is in "men.c"
module.

 ----------------------------  OLD PIECE ------------------------------
            case SET_IMAG_BORD: /* Add GadgetRender */
                       if (SelectedGadget == NULL) {
                            autoreq(
                          "First click on the gadget you want to add the
imageto.",
                                        " OK ","Right");
                            SelectedGadget = NULL;
                            break;
                           }
               i = curgad;
               curgad = findadr(gads,SelectedGadget,nextgad);
               if (curgad == -1) {
                  kprintf("couldn't find selected gad in gads array!!\n");
                  break;
               }
               if (nextgad) {
                   if (!get_req_name("Enter Image Name", gadimage[curgad])) {
                      SelectedGadget = NULL;
                      break;
                   }
                   flags = (long)SelectedGadget->UserData;
                   wid = SelectedGadget->Width;    /* Image width */
                   hgt = SelectedGadget->Height;   /* Image Width */
 
 *****>>           hgt -= 3;   /* This is NOT correct */
 *****>>           wid -= 8;   /* And here,  so delete both these lines */
 
                   if (SelectedGadget->GadgetType == PROPGADGET) {
                      pi = (struct PropInfo *)SelectedGadget->SpecialInfo;
                      if ((pi->Flags & FREEHORIZ) == FREEHORIZ) wid >>= 2;
                      if ((pi->Flags & FREEVERT)  == FREEVERT)  hgt >>= 2;
                   }

 ----------------------- END OLD PORTION ---------------------------

   The following code should be substituted and replace the code listed
 above.

 ------------------------- NEW PORTION -----------------------------
 
            case SET_IMAG_BORD: /* Add GadgetRender */
                       if (SelectedGadget == NULL) {
                            autoreq(
                          "First click on the gadget you want to add the image
to.",
                                        " OK ","Right");
                            SelectedGadget = NULL;
                            break;
                 }
          i = curgad;
               curgad = findadr(gads,SelectedGadget,nextgad);
            if (curgad == -1) {
               kprintf("couldn't find selected gad in gads array!!\n");
                  break;
               }
               if (nextgad) {
                   if (!get_req_name("Enter Image Name", gadimage[curgad])) {
                      SelectedGadget = NULL;
            break;
                   }
                   flags = (long)SelectedGadget->UserData;
                   wid = SelectedGadget->Width;    /* Image width */
                   hgt = SelectedGadget->Height;   /* Image Width */
                   if (SelectedGadget->GadgetType == PROPGADGET) {
 
 ****>>               /* ### JD - Moved "wid" & "hgt" tweak here */
 ****>>               wid -= 8;   hgt -= 3;
                      pi = (struct PropInfo *)SelectedGadget->SpecialInfo;
                      if ((pi->Flags & FREEHORIZ) == FREEHORIZ) wid >>= 2;
                      if ((pi->Flags & FREEVERT)  == FREEVERT)  hgt >>= 2;
                   }

------------------------ END NEW PORTION --------------------------


Change #2  - As I fiddled with Egad,   I noticed that somehow,  I had used
the same name somewhere,  and found that the compiler was getting errors.
So,  I modified the "Set Gadget Name" menu item in the "Utilities" menu
so that if a gadget already is named,  just select it,  them pull down
"Set Gadget Name",  and the name appears in the requester box,   you can
then change the name,  then press OK,  and the gadget name is changed.
Otherwise,  there is NO way to retrieve the names unless you "save as
source", then search for duplicate names.     This change is in the
"men.c" module.

-------------------------- OLD PORTION ---------------------------

           case SET_GAD_NAME:  /* $$$ Open Requester, get name */
                            si = nam_info();
                            *si->Buffer = '\0';
                            si->BufferPos = 0;
                            str = getrname("Enter Gadget name");
                            if (str == NULL) {
                                SelectedGadget = NULL;
                                break;
                            }
                            strcpy(names[curgad], str);
                            gadnames[curgad] = names[curgad];
                            break;

----------------------- END OF OLD PORTION ----------------------

    Should be replaced with the following portion.
    
-------------------------- NEW PORTION --------------------------

           case SET_GAD_NAME:  /* $$$ Open Requester, get name */
 
              if (SelectedGadget == NULL) {
                autoreq(
                 "First click on the gadget you want to add the image to.",
                 " OK ","Right");
                SelectedGadget = NULL;
                break;
              }
 
              i = curgad;
              curgad = findadr(gads,SelectedGadget,nextgad);
              if (curgad == -1) {
                 kprintf("couldn't find selected gad in gads array!!\n");
                 break;
              }
              if (!get_req_name("Enter Gadget Name", names[curgad])) {
                  SelectedGadget = NULL;
              }
              break;

-------------------------- END OF NEW PORTION ------------------------

   This concludes Changes #1 and #2,  the ONLY official changes currently
made to EGAD.    If you have made any changes that corrects stupid errors
on our part,   or just plain old bugs,    Please mail me a copy of the
"changed module" along with a DIFF of your changes Vs the Fish #46 BASE
file,   I'll make sure everyone gets it,  and do the integrating.


Thanx.....
Crunch - Programmers Network 
"A global village of programmers"

UUCP:  ihnp4!ptsfa!well!crunch
WELL:  crunch
BIX: crunch
CIS: 76703,4322  <-- At least for now