home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Utilities / BackClock / sources / partial.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-31  |  3.2 KB  |  117 lines

  1. /*****************************************************************************
  2.  * 
  3.  * name                    : partial.c
  4.  * description            : close & reopen window on workbench close
  5.  * version                : 2.0
  6.  *
  7.  * created                : ?
  8.  * last change            : 13-3-98
  9.  *
  10.  *****************************************************************************
  11.  */
  12. #include "utils.h"
  13. #include "partial.h"
  14. #include "obp.h"
  15. #include <proto/intuition.h>
  16. #include <proto/exec.h>
  17.  
  18.  
  19. BOOL partialClose(idWin * prj) {
  20.   /* 
  21.    * handle notify_intuition msg
  22.    * close the window 
  23.    * 
  24.    */
  25.   BOOL ret = FALSE ;
  26.   struct Message * msg ;
  27.   struct IntNotifyMessage * imsg ;
  28.   
  29.   msg = GetMsg(prj->notifyPort) ;
  30.   imsg = (struct IntNotifyMessage*)msg ;
  31.  
  32.   if (imsg->inm_Code == 0x200) {
  33.     /* close the window
  34.      */
  35.     if (prj->win) {  
  36.       CloseWindow(prj->win) ;
  37.       prj->win = NULL ;      // in case of error
  38.       ret = TRUE ;
  39.     }
  40.   }
  41.   if (msg) ReplyMsg(msg) ;
  42.   
  43.   return(ret) ;
  44. }
  45.  
  46.  
  47. void partialOpen(idWin * prj) {
  48.   /* reopen the window
  49.    */
  50.   struct Screen * WBScreen = NULL ;
  51.   struct Message * msg ;
  52.   struct IntNotifyMessage * imsg ;
  53.   UWORD code ;
  54.   ULONG mask ;
  55.   
  56.   do{
  57.     /* get msg from notifyintuition
  58.      */
  59.     mask = Wait(1<<(prj->notifyPort->mp_SigBit)) ;
  60.     if ((msg = GetMsg(prj->notifyPort)) != NULL) {
  61.       /* received a msg
  62.        */
  63.       imsg = (struct IntNotifyMessage *)msg ;
  64.       code = imsg->inm_Code ;
  65.       ReplyMsg(msg) ;
  66.     }
  67.   }while(code != 0x100) ;
  68.    
  69.   WBScreen = LockPubScreen("Workbench") ;
  70.   prj->wb = WBScreen ;
  71.   free_bitmap(prj) ;
  72.   init_bitmap(prj) ;
  73.   prj->win = OpenWindowTags(NULL, WA_Left,    prj->backWin.posX,
  74.                                              WA_Top,        prj->backWin.posY,
  75.                                              WA_Width,    prj->backWin.width,
  76.                                              WA_Height,    prj->backWin.height,
  77.                                              WA_IDCMP,    IDCMP,
  78.                                  WA_MinWidth,     50,
  79.                                  WA_MinHeight,   50,
  80.                                  WA_MaxHeight,   200,
  81.                                  WA_MaxWidth,    200, 
  82.                                              WA_Flags,    WFLG_BORDERLESS,
  83.                                              WA_ScreenTitle, "BackClock", 
  84.                                              WA_NewLookMenus, TRUE,
  85.                                              WA_PubScreenName, "Workbench", TAG_DONE) ;
  86.   WindowToBack(prj->win) ;                                           
  87.   UnlockPubScreen(NULL, WBScreen) ;
  88.   setColors(prj) ;
  89. }
  90.  
  91.  
  92. void setWindow(idWin * prj) {
  93.   CloseWindow(prj->win) ;
  94.   prj->wb = LockPubScreen("Workbench") ;
  95.   
  96.   free_bitmap(prj) ;
  97.   init_bitmap(prj) ;
  98.   
  99.   prj->win = OpenWindowTags(NULL, WA_Left,    prj->backWin.posX,
  100.                                              WA_Top,        prj->backWin.posY,
  101.                                              WA_Width,    prj->backWin.width,
  102.                                              WA_Height,    prj->backWin.height,
  103.                                              WA_IDCMP,    IDCMP,
  104.                                  WA_MinWidth,     50,
  105.                                  WA_MinHeight,   50,
  106.                                  WA_MaxHeight,   200,
  107.                                  WA_MaxWidth,    200, 
  108.                                              WA_Flags,    WFLG_BORDERLESS,
  109.                                              WA_ScreenTitle, "BackClock", 
  110.                                              WA_NewLookMenus, TRUE,
  111.                                              WA_PubScreenName, "Workbench", TAG_DONE) ;
  112.   WindowToBack(prj->win) ; 
  113.   UnlockPubScreen(NULL, prj->wb) ; 
  114. //  ChangeWindowBox(prj->win, prj->backWin.posX, prj->backWin.posY, prj->backWin.width, prj->backWin.height) ;
  115.   reinit_win(prj) ;
  116. }
  117.