home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / EMBL Search / Sources / events.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-04  |  15.4 KB  |  697 lines  |  [TEXT/KAHL]

  1. /*
  2. *********************************************************************
  3. *    
  4. *    Events.c
  5. *    Event handling
  6. *        
  7. *    Rainer Fuchs
  8. *    EMBL Data Library
  9. *    Postfach 10.2209
  10. *    D-6900 Heidelberg, FRG
  11. *    E-mail: fuchs@embl-heidelberg.de
  12. *
  13. *    Copyright © 1992 EMBL Data Library
  14. *        
  15. **********************************************************************
  16. *    
  17. */ 
  18.  
  19. #include <stdio.h>
  20. #include <AppleEvents.h>
  21. #include <Balloons.h>
  22.  
  23. #include "EMBL-Search.h"
  24. #include "EMBL-Search.rsrc.h"
  25.  
  26. /*
  27. ******************************* Prototypes ***************************
  28. */
  29.  
  30. #include "events.h"
  31. #include "menus.h"
  32. #include "appleevents.h"
  33. #include "window.h"
  34. #include "sequence.h"
  35. #include "xref.h"
  36. #include "sequence.h"
  37. #include "results.h"
  38. #include "util.h"
  39. #include "click.h"
  40. #include "info.h"
  41. #include "show_help.h"
  42. #include "query.h"
  43. #include "save.h"
  44. #include "copy.h"
  45. #include "export.h"
  46. #include "print.h"
  47. #include "locate.h"
  48. #include "pref.h"
  49. #include "pstr.h"
  50.  
  51. static void HandleClick(WDPtr wdp, EventRecord theEvent);
  52. static void HandleMouseDown(EventRecord theEvent);
  53. static void HandleMenu(long sel, short modifiers);
  54. static void HandleKeyDown(EventRecord myEvent);
  55. static void HandleUpdates(EventRecord myEvent);
  56. static void SelectAll(WDPtr wdp, Boolean what);
  57.  
  58.  
  59.  
  60. /*
  61. ******************************** Global variables ******************
  62. */
  63.  
  64. extern Boolean     gQuitApplication;
  65. extern CursHandle    gCursor[8];                        /* cursors used                            */
  66. extern MenuHandle    gMenu[MENUNR];                    /* menu handles                            */
  67. extern Rect         gDragRect;
  68. extern FONTINFO    fMonaco;                            /* font information                        */
  69. extern Prefs        gPrefs;
  70. extern WDRec        gWindows[MAXWIN];
  71. extern OSType        gCreatorSig[];
  72. extern Boolean        gInBackground;
  73. extern char            gError[256];
  74.  
  75. short            gScrollAmt,gScrollCode;
  76. Boolean        gScrollDir;
  77. ClickInfo    gLastClick;
  78.  
  79. void DoEvent(EventRecord theEvent)
  80. {
  81.     Point where;
  82.     
  83.       switch (theEvent.what) {
  84.           case nullEvent:
  85.           /* here we can perform any periodic actions */
  86.               break;
  87.         case mouseDown:                    /* mouse click                             */
  88.             HandleMouseDown(theEvent);
  89.             break;
  90.         case mouseUp:
  91.             /* store time of mouseUp event (in order to detect double-clicks */
  92.             gLastClick.when = theEvent.when;
  93.             break;
  94.         case keyDown:                         /* key click                                 */
  95.         case autoKey:
  96.             MaintainMenus();
  97.             if (theEvent.modifiers & cmdKey) 
  98.                 HandleMenu(MenuKey((char) (theEvent.message & charCodeMask)),
  99.                                 theEvent.modifiers);
  100.             else
  101.                 HandleKeyDown(theEvent); /* e.g. Help key */
  102.             break;
  103.         case updateEvt:
  104.             HandleUpdates(theEvent);
  105.             break;
  106.         case activateEvt:
  107.             HandleActivates((WindowPtr)theEvent.message,
  108.                                 theEvent.modifiers & activeFlag);
  109.             break;
  110.         case diskEvt:
  111.             if(HiWord(theEvent.message) != noErr) {
  112.                 where.h=((screenBits.bounds.right-screenBits.bounds.left)-304)/2;
  113.                 where.v=((screenBits.bounds.bottom-screenBits.bounds.top)-184)/2+20;
  114.                 DIBadMount(where,theEvent.message);
  115.             }
  116.             break;
  117.         case osEvt:
  118.             if( ((theEvent.message >>24) & 0xFF) == 1) {
  119.                 gInBackground = ((theEvent.message & 1) == 0);
  120.                             /* resume/suspend */
  121.                 HandleActivates(FrontWindow(),!gInBackground);
  122.                 LoadScrap();
  123.             }
  124.             /* we don't handle mouse moved events (already done by
  125.                 call to MaintainCursor() in MainLoop()
  126.             */ 
  127.             break;
  128.         case kHighLevelEvent:
  129.             DoHighLevelEvent(theEvent);
  130.             break;
  131.     } /* end switch */
  132. } /* end if */
  133.  
  134.  
  135. /**************************************
  136. *    Activate events
  137. *    Return value:    none
  138. */
  139.  
  140. void HandleActivates(WindowPtr wPtr,Boolean activateFlag)
  141. {
  142.     WDPtr                wdp;
  143.     Str255            str,title;
  144.     ListHandle        theList;
  145.     GrafPtr            oldPort;
  146.     short                wKind;
  147.     
  148.     if (wPtr == NULL)
  149.         return;
  150.         
  151.     wKind = ((WindowPeek)wPtr)->windowKind;
  152.     if(wKind == queryW) return;    /* done by dialog mgr */
  153.     
  154.     if(activateFlag) {     /* Activate event */
  155.         if(wdp=FindMyWindow(wPtr)) {
  156.             SetPort(wPtr);
  157.             switch(wKind) {
  158.                 case queryW:
  159.                     break;
  160.                 case seqW:
  161.                     HiliteControl(wdp->vScroll,ACTIVE);
  162.                     HiliteControl(wdp->hScroll,ACTIVE);
  163.                     DrawGrowIcon(wPtr);
  164.                     HideShowSeqSelections(wdp, TRUE);
  165.                     AddXRefsToMenu(wdp);
  166.                     break;
  167.                 case resW:
  168.                     HiliteControl(wdp->vScroll,ACTIVE);
  169.                     HiliteControl(wdp->hScroll,ACTIVE);
  170.                     DrawGrowIcon(wPtr);
  171.                     HideShowResSelections(wdp, TRUE);
  172.                     break;
  173.                 default:SysBeep(10);
  174.             }
  175.         }
  176.     }
  177.     else {                                                            /* Deactivate event */
  178.         if(wdp=FindMyWindow(wPtr)) {
  179.             oldPort = ChangePort(wPtr);
  180.             switch(((WindowPeek)wdp)->windowKind) {
  181.                 case queryW:    /* done by dialog mgr */
  182.                     break;
  183.                 case seqW:
  184.                     HiliteControl(wdp->vScroll,INACTIVE);
  185.                     HiliteControl(wdp->hScroll,INACTIVE);
  186.                     DrawGrowIcon(wPtr);
  187.                     HideShowSeqSelections(wdp,FALSE);
  188.                     break;
  189.                 case resW:
  190.                     HiliteControl(wdp->vScroll,INACTIVE);
  191.                     HiliteControl(wdp->hScroll,INACTIVE);
  192.                     DrawGrowIcon(wPtr);
  193.                     HideShowResSelections(wdp,FALSE);
  194.                     break;
  195.                 default:SysBeep(10);
  196.             }
  197.             SetPort(oldPort);
  198.         }
  199.     }
  200. }
  201.  
  202.  
  203. /**************************************
  204. *    Handle mouse click events in window
  205. *    Return value:    none
  206. */
  207.  
  208. static void HandleClick(WDPtr wdp, EventRecord theEvent)
  209. {
  210.     GrafPtr    savePort;
  211.     
  212.     if(wdp == NULL)
  213.         return;
  214.         
  215.     savePort = ChangePort((GrafPtr)wdp);
  216.     switch(((WindowPeek)wdp)->windowKind) {
  217.         case queryW:    /* done by dialog mgr */
  218.             break;
  219.         case seqW:
  220.             DoSeqClicks(wdp,&theEvent);
  221.             break;    
  222.         case resW:
  223.             DoResClicks(wdp,&theEvent);
  224.             break;
  225.         default:SysBeep(10);
  226.     }
  227.     SetPort(savePort);
  228. }
  229.  
  230. /**************************************
  231. *    Mouse down events
  232. *    Return value:    none
  233. */
  234.  
  235. static void HandleMouseDown(EventRecord theEvent)
  236. {
  237.     WindowPtr    wPtr;
  238.     short            partCode;
  239.     WDPtr            wdp;
  240.  
  241.     partCode=FindWindow( theEvent.where, &wPtr ); 
  242.     switch (partCode) {
  243.         case inSysWindow:
  244.             SystemClick( &theEvent, wPtr );
  245.             break;
  246.         case inMenuBar:
  247.             MaintainMenus();
  248.             HandleMenu( MenuSelect(theEvent.where), theEvent.modifiers) ;
  249.             break;
  250.         case inDrag:
  251.             if(FindMyWindow(wPtr))
  252.                 DragWindow(wPtr,theEvent.where,&gDragRect);
  253.             break;
  254.         case inGoAway:
  255.             if(wdp=FindMyWindow(wPtr)) {
  256.                 if(TrackGoAway(wPtr,theEvent.where)) {
  257.                     if( (theEvent.modifiers & optionKey) != 0)
  258.                         CloseAllWindows((theEvent.modifiers & shiftKey) != 0);
  259.                     else
  260.                         CloseMyWindow(wdp, (theEvent.modifiers & shiftKey) != 0);
  261.                 }
  262.             }
  263.             break;
  264.         case inGrow:
  265.             if(FindMyWindow(wPtr))
  266.                 DoGrow(wPtr,theEvent.where);
  267.             break;
  268.         case inZoomIn:
  269.         case inZoomOut:
  270.             if(FindMyWindow(wPtr))
  271.                 if(TrackBox(wPtr,theEvent.where,partCode))
  272.                     DoZoom(wPtr, partCode);
  273.             break;
  274.         case inContent:
  275.             if(wPtr != FrontWindow()) {
  276.                 SelectWindow(wPtr);
  277.                 SetPort(wPtr);
  278.             }
  279.             else
  280.                 if(wdp=FindMyWindow(wPtr))
  281.                     HandleClick(wdp,theEvent);
  282.             break;
  283.         case inDesk:
  284.             break;
  285.         default:SysBeep(10);
  286.     } /* end switch */
  287.     
  288.     /* save some information about this click for later in order to identify
  289.         double-clicks */
  290.         
  291.     gLastClick.where = theEvent.where;
  292.     gLastClick.wPtr = wPtr;
  293. }
  294.  
  295. /**************************************
  296. *    Menu handling
  297. *    Return value:    none
  298. */
  299.  
  300. static void HandleMenu(long sel, short modifiers)
  301. {
  302.     register short    theItem=LoWord(sel);
  303.     GrafPtr            savePort;
  304.     WindowPtr        topWindow=FrontWindow();
  305.     Str255            name,title;
  306.     WDPtr                wdp;
  307.     short                i,k;
  308.     Boolean            shift;
  309.     short                dbcode;
  310.     short             from,to;
  311.     MenuHandle        mh;
  312.     
  313.     shift = ((modifiers & shiftKey) != 0);
  314.     
  315.     switch (HiWord(sel)) {
  316.         case APPLE_M:
  317.             switch (theItem) {
  318.                 case ABOUT_I:                        /* About…                                     */
  319.                     ShowAbout();
  320.                     break;
  321.                 case HELP_I:
  322.                     GetIndString(name,OTHERS,HELPSTR);
  323.                     Show_help( HELP_DLG, kHelpTextRsrc, kHelpPictRsrc, name,"\p");
  324.                     break;
  325.                 default:
  326.                     GetItem(gMenu[APPLE], theItem, name);
  327.                     GetPort(&savePort);                /* save old grafPort (just in case…)*/
  328.                     OpenDeskAcc(name);                /* open DA                                     */
  329.                     InitCursor();                        /* DA may have changed cursor         */
  330.                     SetPort(savePort);                /*    DA may have changed grafPort         */
  331.                     break;
  332.             }
  333.             break;
  334.             
  335.         case FILE_M:
  336.             switch(theItem) {
  337.                 case NEW_I:
  338.                     NewQuery();
  339.                     break;
  340.                 case OPEN_I:
  341.                     OpenQuery();
  342.                     break;
  343.                 case LOAD_I:
  344.                     LoadResults();
  345.                     break;
  346.                 case CLOSE_I:
  347.                     if(topWindow) {
  348.                         if ( (k=((WindowPeek)topWindow)->windowKind) < 0 )
  349.                             CloseDeskAcc(k);
  350.                         else {
  351.                             if(wdp=FindMyWindow(topWindow)) {
  352.                                 if( (modifiers & optionKey) != 0)
  353.                                     CloseAllWindows(shift);
  354.                                 else
  355.                                     CloseMyWindow(wdp,shift);
  356.                             }
  357.                         }
  358.                     }
  359.                     break;
  360.                 case SAVE_I:
  361.                     if(wdp = FindMyWindow(topWindow))
  362.                         DoSave(wdp,TRUE);
  363.                     break;
  364.                 case SAVEAS_I:
  365.                     if(wdp = FindMyWindow(topWindow))
  366.                         DoSave(wdp, FALSE);
  367.                     break;
  368.                 case EXPORTSEL_I:
  369.                     if(wdp=FindMyWindow(topWindow))
  370.                         ExportRes(wdp);
  371.                     break;
  372.                 case PAGESETUP_I:
  373.                     PrintDialog();
  374.                     break;
  375.                 case PRINT_I:
  376.                     if(wdp=FindMyWindow(topWindow))
  377.                         PrintIt(wdp);
  378.                     break;
  379.                 case QUIT_I:
  380.                    if(CloseAllWindows(shift)) {
  381.                         gQuitApplication=TRUE;
  382.                         LoadScrap();
  383.                     }
  384.                     break;
  385.                 default:SysBeep(10);
  386.             } /* end switch */
  387.             break;
  388.  
  389.         case EDIT_M: 
  390.             if(!SystemEdit(theItem-1))
  391.                 switch(theItem) {
  392.                     case UNDO_I:
  393.                         SysBeep(10);
  394.                         break;
  395.                     case CUT_I:
  396.                         if(wdp=FindMyWindow(topWindow))
  397.                             CutSelection(wdp);                        
  398.                         break;
  399.                     case COPY_I:
  400.                         if(wdp=FindMyWindow(topWindow))
  401.                             CopySelection(wdp);
  402.                         break;
  403.                     case PASTE_I:
  404.                         if(wdp=FindMyWindow(topWindow))
  405.                             PasteSelection(wdp);
  406.                         break;
  407.                     case CLEAR_I:
  408.                         if(wdp=FindMyWindow(topWindow))
  409.                             ClearSelection(wdp);
  410.                         break;
  411.                     case SELALL_I:
  412.                         if(wdp=FindMyWindow(topWindow))
  413.                             SelectAll(wdp, TRUE);
  414.                         break;
  415.                     case SELNONE_I:
  416.                         if(wdp=FindMyWindow(topWindow))
  417.                             SelectAll(wdp, FALSE);
  418.                         break;
  419.                     case DUPLICATE_I:
  420.                         if(wdp=FindMyWindow(topWindow))
  421.                             DuplicateQuery(wdp);
  422.                         break;
  423.                     default:SysBeep(10);
  424.                 }
  425.             break;
  426.                         
  427.         case OSTUFF_M:
  428.             switch(theItem) {
  429.                 case INFO_I:
  430.                     ShowDBInfo();
  431.                     break;
  432.                 default:SysBeep(10);
  433.             }
  434.             break;
  435.             
  436.         case PREFS_M:
  437.             switch(theItem) {
  438.                 case LOCATE_I:
  439.                     Locate();
  440.                     break;
  441.                 case SAVEPREFS_I:
  442.                     WritePrefs();
  443.                     break;
  444.                 case GENERAL_I:
  445.                     GeneralOptions();
  446.                     break;
  447.                 default:
  448.                     SysBeep(10);
  449.                     break;
  450.             }
  451.             break;
  452.     
  453.         case FORMAT_M:
  454.             CheckItem(gMenu[FORMAT],gPrefs.format,FALSE);
  455.             CheckItem(gMenu[FORMAT],gPrefs.format=theItem,TRUE);
  456.             break;
  457.                             
  458.         case CREATOR_M:
  459.             switch(theItem) {
  460.                 case WORD_I:
  461.                 case TTEXT_I:
  462.                 case WRITE_I:
  463.                     gPrefs.creatorSig = gCreatorSig[theItem];
  464.                     CheckItem(gMenu[CREATOR],gPrefs.creator,FALSE);
  465.                     CheckItem(gMenu[CREATOR],gPrefs.creator=theItem,TRUE);
  466.                     break;
  467.                 case OTHERS_I:
  468.                     if(PickNewCreator()) {
  469.                         UpdateOtherCreator();
  470.                         CheckItem(gMenu[CREATOR],gPrefs.creator,FALSE);
  471.                         CheckItem(gMenu[CREATOR],gPrefs.creator=theItem,TRUE);
  472.                     }
  473.                     break;
  474.             }
  475.             
  476.             break;
  477.             
  478.         case WINDOWS_M:
  479.             if(topWindow) {
  480.                 if(theItem == ROTATE_I) {
  481.                     SendBehind(topWindow,NULL);
  482.                 }
  483.                 else {
  484.                     GetItem(gMenu[WINDOWS],theItem,name);
  485.                     for(i=0;i<MAXWIN;++i) {
  486.                         if(gWindows[i].inUse == TRUE) {
  487.                             GetWTitle((WindowPtr)&gWindows[i],title);
  488.                             if(!pstrcmp(name,title)) {
  489.                                 SelectWindow((WindowPtr)&gWindows[i]);
  490.                                 SetPort((WindowPtr)&gWindows[i]);
  491.                                 break;
  492.                             }
  493.                         }
  494.                     }
  495.                 }
  496.             }
  497.             break;
  498.             
  499.         case XREF_M:
  500.             if(wdp=FindMyWindow(topWindow)) {
  501.                 dbcode = (**(SeqRecHdl)(wdp->userHandle)).dbcode;
  502.  
  503.                 if(theItem == ALLXREFS_I) {
  504.                     from = 3;
  505.                     to = CountMItems(gMenu[XREF]);
  506.                 }
  507.                 else
  508.                     from = to = theItem;
  509.                     
  510.                 for( theItem=from; theItem <= to;++theItem ) {
  511.                     GetItem(gMenu[XREF],theItem,name);
  512.                     PtoCstr(name);
  513.                     if( !OpenXRefs((char *)name,(dbcode == DB_EMBL) ? DB_SWISS : DB_EMBL) )
  514.                         break;
  515.                 }
  516.             }
  517.             break;            
  518.             
  519.         case kHMHelpMenuID:
  520.             HMGetHelpMenuHandle(&mh);
  521.             if( theItem == CountMItems(mh) ) {
  522.                 GetIndString(name,OTHERS,HELPSTR);
  523.                 Show_help( HELP_DLG, kHelpTextRsrc, kHelpPictRsrc, name,"\p");
  524.             }
  525.             break;
  526.             
  527.         } /* end switch */
  528.     HiliteMenu(0);
  529. }
  530.  
  531. /**************************************
  532. *    Key down events
  533. *    Return value:    none
  534. */
  535.  
  536. static void HandleKeyDown(EventRecord myEvent)
  537. {
  538. #define HELPKEY     0x72
  539. #define HOME        0x73
  540. #define END            0x77
  541. #define PG_UP        0x74
  542. #define PG_DN        0x79
  543.  
  544.     char            keycode=(myEvent.message & keyCodeMask) >> 8;
  545.     WindowPtr    topWindow=FrontWindow();
  546.     WDPtr            wdp;
  547.     short            wKind;
  548.     short            pagesize,oldValue,newValue,max;
  549.     Rect            viewRect;
  550.     Str255        saveStr;
  551.         
  552.     if(keycode == HELPKEY) {
  553.         GetIndString(saveStr, OTHERS, HELPSTR);
  554.         Show_help( HELP_DLG, kHelpTextRsrc, kHelpPictRsrc, saveStr, "\p");
  555.     }
  556.     
  557.     if ( (wdp=FindMyWindow(topWindow)) == NULL) {
  558.         SysBeep(10);
  559.         return;
  560.     }
  561.     
  562.     wKind=((WindowPeek)wdp)->windowKind;
  563.     if(wKind == queryW)
  564.         return;
  565.         
  566.     switch (keycode) {
  567.         case HOME:
  568.         case END:
  569.             switch(wKind) {
  570.                 case queryW:
  571.                     break;
  572.                 case seqW:
  573.                     oldValue = GetCtlValue(wdp->vScroll);
  574.                     newValue = (keycode == HOME) ?     GetCtlMin(wdp->vScroll) :
  575.                                                                 GetCtlMax(wdp->vScroll);
  576.                     SetCtlValue(wdp->vScroll,newValue);
  577.                     AdjustSeqText((WindowPtr)wdp,oldValue,newValue,vertBar);
  578.                     break;
  579.                 case resW:
  580.                     oldValue = GetCtlValue(wdp->vScroll);
  581.                     newValue = (keycode == HOME) ?     GetCtlMin(wdp->vScroll) :
  582.                                                                 GetCtlMax(wdp->vScroll);
  583.                     SetCtlValue(wdp->vScroll,newValue);
  584.                     AdjustResText((WindowPtr)wdp,oldValue,newValue,vertBar);
  585.                     break;
  586.                 default: SysBeep(10);
  587.             }
  588.             break;
  589.         case PG_DN:
  590.         case PG_UP:
  591.             switch(wKind) {
  592.                 case queryW:
  593.                     break;
  594.                 case seqW:
  595.                     GetViewRect((WindowPtr)wdp,&viewRect);    
  596.                     pagesize =
  597.                         (viewRect.bottom - viewRect.top) / fMonaco.height - 1;
  598.  
  599.                     oldValue=GetCtlValue(wdp->vScroll);
  600.                     if(keycode == PG_DN)
  601.                         newValue = oldValue + pagesize;
  602.                     else newValue = oldValue - pagesize;
  603.                     if(newValue < 0) newValue=0;
  604.                     max = GetCtlMax(wdp->vScroll);
  605.                     if(newValue > max) newValue=max;
  606.         
  607.                     SetCtlValue(wdp->vScroll, newValue );
  608.                     AdjustSeqText((WindowPtr)wdp,oldValue,newValue,vertBar);
  609.                     break;
  610.                 case resW:
  611.                     GetViewRect((WindowPtr)wdp,&viewRect);    
  612.                     pagesize =
  613.                         (viewRect.bottom - viewRect.top) / fMonaco.height - 1;
  614.  
  615.                     oldValue=GetCtlValue(wdp->vScroll);
  616.                     if(keycode == PG_DN)
  617.                         newValue = oldValue + pagesize;
  618.                     else newValue = oldValue - pagesize;
  619.                     if(newValue < 0) newValue=0;
  620.                     max = GetCtlMax(wdp->vScroll);
  621.                     if(newValue > max) newValue=max;
  622.         
  623.                     SetCtlValue(wdp->vScroll, newValue );
  624.                     AdjustResText((WindowPtr)wdp,oldValue,newValue,vertBar);
  625.                     break;
  626.                 default: SysBeep(10);
  627.             }
  628.             break;
  629.         default: SysBeep(10);
  630.     }
  631. }
  632.  
  633.  
  634. /**************************************
  635. *    Update events
  636. *    Return value:    none
  637. */
  638.  
  639. static void HandleUpdates(EventRecord myEvent)
  640. {
  641.     GrafPtr        savePort;
  642.     WindowPtr    wPtr=(WindowPtr)myEvent.message;
  643.     WDPtr            wdp;
  644.     short            wKind;
  645.     
  646.     if(wPtr == NULL)
  647.         return;
  648.         
  649.     wKind = ((WindowPeek)wPtr)->windowKind;
  650.     if(wKind == queryW) return;    /* done by dialog mgr */
  651.     
  652.     BeginUpdate(wPtr);
  653.     if( wdp=FindMyWindow(wPtr)) {
  654.         savePort = ChangePort(wPtr);
  655.         switch(wKind) {
  656.             case queryW:
  657.                 break;
  658.             case seqW:
  659.                 DrawSeqWinAll(wdp,0);
  660.                 DrawControls(wPtr);
  661.                 DoDrawGrowIcon(wPtr);
  662.                 break;
  663.             case resW:
  664.                 DrawResWinAll(wdp,0);
  665.                 DrawControls(wPtr);
  666.                 DoDrawGrowIcon(wPtr);
  667.                 break;
  668.             default:SysBeep(10);
  669.         }
  670.         SetPort(savePort);
  671.     }
  672.     EndUpdate(wPtr);
  673. }
  674.  
  675.  
  676. /**************************************
  677. * (De)Selects complete content of a window
  678. *    Return value:    none
  679. */
  680.  
  681. static void SelectAll(WDPtr wdp, Boolean what)
  682. {
  683.     if( wdp == NULL )
  684.         return;
  685.         
  686.     switch( ((WindowPeek)wdp)->windowKind) {
  687.         case queryW:
  688.             break;
  689.         case seqW:
  690.             SelectAllSeq(wdp,what);
  691.             break;
  692.         case resW:
  693.             SelectAllResults(wdp,what);
  694.             break;
  695.         default:SysBeep(10);
  696.     }
  697. }