Ejemplo n.º 1
0
// *******************************************************************************           
// FUNCTION:     ToggleEditMenu                                                              
//                                                                                           
// FUNCTION USE: Will enable or disable menuitems from the edit menu accordingly    
//                                                                                           
// DESCRIPTION:  This function will enable or disable the cut, copy and paste
//               menuitems.              
//                                                                                           
// PARAMETERS:   HWND     The handle of the menu window                                      
//               USHORT   The identifier of the menuitem to enable or disable        
//               HBITMAP  The bitmap handle
//
// RETURNS:      VOID                                                                        
//                                                                                           
// HISTORY:                                                                                  
//                                                                                           
// *******************************************************************************           
VOID ToggleEditMenu(HWND hwndMenu, USHORT usID, HBITMAP hbmClip)                                                
{                                                                                              
 BOOL   rc;                                                                                      
 ULONG  ulFormat;                                                                               
 HAB    hab;                                                                                    
                                                                                               
 // --------------------------------------------------------------------------                         
 // Get an anchor block handle                                                                        
 // --------------------------------------------------------------------------                         
 hab = WinQueryAnchorBlock(WinQueryWindow(hwndMenu, QW_PARENT));                               
                                                                                               
 switch (usID)                                                                                 
 {                                                                                             
  case IDM_EDITCUT:
  case IDM_EDITCOPY:
  case IDM_EDITCLEAR:            
       // --------------------------------------------------------------------------                 
       // Enable cut and copy if we have a valid bitmap handle from our                       
       // tracking operation.
       // --------------------------------------------------------------------------                 
       if (hbmClip) 
        {
         WinEnableMenuItem(hwndMenu, usID, TRUE);                         
        }

       // --------------------------------------------------------------------------                 
       // Disable cut and copy if we don't have a bitmap                          
       // --------------------------------------------------------------------------                 
       else
        {
         WinEnableMenuItem(hwndMenu, usID, FALSE);                         
        }
       return;

  case IDM_EDITPASTE:                                                                              
       // --------------------------------------------------------------------------             
       // Enable paste if we have a valid bitmap handle in the clipboard.                
       // --------------------------------------------------------------------------             
       rc = WinQueryClipbrdFmtInfo (hab, CF_BITMAP, &ulFormat);                                
       if (rc)                                                                         
        {                                                                                      
         WinEnableMenuItem(hwndMenu, usID, TRUE);                                              
        }                                                                                      

       // --------------------------------------------------------------------------             
       // Disable paste if we do not have a valid bitmap.                
       // --------------------------------------------------------------------------             
       else                                                                                    
        {                                                                                      
         WinEnableMenuItem(hwndMenu, usID, FALSE);                                             
        }                                                                                      
       return;                                                                                  
 }                                                                                             
}
Ejemplo n.º 2
0
NS_IMETHODIMP nsClipboard::HasDataMatchingFlavors(const char** aFlavorList,
                                                  PRUint32 aLength,
                                                  PRInt32 aWhichClipboard,
                                                  PRBool *_retval)
{
  *_retval = PR_FALSE;
  if (aWhichClipboard != kGlobalClipboard || !aFlavorList)
    return NS_OK;

  for (PRUint32 i = 0; i < aLength; ++i) {
    ULONG fmtInfo = 0;
    ULONG format = GetFormatID(aFlavorList[i]);

    if (WinQueryClipbrdFmtInfo(0/*hab*/, format, &fmtInfo)) {
      *_retval = PR_TRUE;
      break;
    }

    // if the client asked for unicode and it wasn't present, check if we have CF_TEXT.
    if (!strcmp(aFlavorList[i], kUnicodeMime)) {
      if (WinQueryClipbrdFmtInfo(0/*hab*/, CF_TEXT, &fmtInfo)) {
        *_retval = PR_TRUE;
        break;
      }
    }

// OS2TODO - Support for Images
    // if the client asked for image/.. and it wasn't present, check if we have CF_BITMAP.
    if (strstr(aFlavorList[i], "image/")) {
      if (WinQueryClipbrdFmtInfo (0, CF_BITMAP, &fmtInfo)) {
#ifdef DEBUG
        printf("nsClipboard:: Image present on clipboard; need to add BMP conversion!\n");
#endif
//          *_retval = PR_TRUE;
//          break;
      }
    }
  }
  return NS_OK;
}
Ejemplo n.º 3
0
BOOL UpdateMenuStatus (HWND hwnd, SHORT sMenuID)
     {

     /*
      *  UpdateMenuStatus tests for and keeps updated the
      *  state of the GO button on the main menu bar.
      *  Also the selectability and text of the
      *  Swap between Mandel/Julia selection on the Set menu.
      *  Also other menu items.
     */

     int iWhatFractal;
     double ccreal, ccimag;
     USHORT usClipBrdInfo;

     switch (sMenuID)
            {
            case ID_RESOURCE:

                 if (tidCalc == -1)
                      EnableMenuItem (hwnd, IDM_GO, FALSE) ;
                 return TRUE;

            case IDM_OPTIONS_MENU:

                 /* keep Mandel/Julia status up to date */
                 /* keep Reset status up to date */

                 if (sStatus == STATUS_FROZEN)
                    {
                    iWhatFractal = npNewParms.iFractType;
                    ccreal = npNewParms.param[0];
                    ccimag = npNewParms.param[1];
                    }
                 else
                    {
                    iWhatFractal = cp.iFractType;
                    ccreal = cp.param[0];
                    ccimag = cp.param[1];
                    }

                 if (fractalspecific[iWhatFractal].tojulia != NOFRACTAL
                       && ccreal == 0.0 && ccimag == 0.0)
                    {   /* to julia is kosher */
                    UpdateMenuText (hwnd, IDM_SET_SWAP, szSwapJulia);
                    EnableMenuItem (hwnd, IDM_SET_SWAP, TRUE);
                    }
                 else
                 if (fractalspecific[iWhatFractal].tomandel != NOFRACTAL)
                    {   /* to mandel is kosher */
                    UpdateMenuText (hwnd, IDM_SET_SWAP, szSwapMandel);
                    EnableMenuItem (hwnd, IDM_SET_SWAP, TRUE);
                    }
                 else
                    {   /* this is a stand-alone fractal, swap disabled */
                    UpdateMenuText (hwnd, IDM_SET_SWAP, szSwapMandel);
                    EnableMenuItem (hwnd, IDM_SET_SWAP, FALSE);
                    }

                 EnableMenuItem (hwnd, IDM_SET_RESET,
                                        sStatus == STATUS_FROZEN );
                 EnableMenuItem (hwnd, IDM_SET_EXTENTS,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_SET_PARAMS,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_SET_OPTIONS,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_SET_IMAGE,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_SET_PALETTE,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );

                 return TRUE;

            case IDM_EDIT_MENU:

                 EnableMenuItem (hwnd, IDM_COPY_BMP,
                       sStatus == STATUS_READY);
                 EnableMenuItem (hwnd, IDM_COPY_MET,
                       sStatus == STATUS_READY);
                 EnableMenuItem (hwnd, IDM_PASTE,
                      ( sStatus == STATUS_READY ) &&
                      ( WinQueryClipbrdFmtInfo(hab, CF_BITMAP, &usClipBrdInfo)
                        /* || WinQueryClipbrdFmtInfo(hab, CF_METAFILE, &usClipBrdInfo) */
                        ) ) ;
                 EnableMenuItem (hwnd, IDM_CLPB_TEXT,
                        WinQueryClipbrdFmtInfo(hab, CF_TEXT, &usClipBrdInfo) );
                 EnableMenuItem (hwnd, IDM_CLPB_BMP,
                        WinQueryClipbrdFmtInfo(hab, CF_BITMAP, &usClipBrdInfo) );
                 EnableMenuItem (hwnd, IDM_CLPB_MET,
                        WinQueryClipbrdFmtInfo(hab, CF_METAFILE, &usClipBrdInfo) );

                 return TRUE;

            case IDM_FILE_MENU:

                 EnableMenuItem (hwnd, IDM_NEW_FRACTAL,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_PRINT_FILE,
                       sStatus == STATUS_READY);
                 EnableMenuItem (hwnd, IDM_SAVE_FILE,
                       sStatus == STATUS_READY);
                 EnableMenuItem (hwnd, IDM_READ_FILE,
                       sStatus == STATUS_READY);
                 EnableMenuItem (hwnd, IDM_READ_COLORMAP,
                       sStatus != STATUS_INIT);
                 EnableMenuItem (hwnd, IDM_WRITE_COLORMAP,
                       sStatus != STATUS_INIT);

                 return TRUE;

            case IDM_VIEW_MENU:

                 EnableMenuItem (hwnd, IDM_ZIN_WIN, fGoodZoom);
                 EnableMenuItem (hwnd, IDM_ZOUT_WIN, fGoodZoom);
                 EnableMenuItem (hwnd, IDM_PAN,
                        fGoodPan && (sStatus != STATUS_NEWPARMS) &&
                                    (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_ZIN_MENU,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );
                 EnableMenuItem (hwnd, IDM_ZOUT_MENU,
                       (sStatus != STATUS_NEWPARMS) &&
                       (sStatus != STATUS_INIT) );

                 return TRUE;

            default:
                 break;

            }

     return FALSE;

     }
Ejemplo n.º 4
0
MRESULT PMfrCommands (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
     {
     /*
        These are the routnes that handle the commands issued by
        the FRACTINT for PM menus.

        In most cases, they call another support routine to
        handle or schedule the event requested by the user.
     */

     SHORT sCommand = SHORT1FROMMP(mp1);


     switch (sCommand)
          {
          case IDM_GO:
               /* fire up the subtask */
               cp.fContinueCalc = TRUE ;
               if (npNewParms.fNewParms)
                  {
                  CopyParmsToBase();
                  /* GetMemoryBitmap(); */
                  SetSwitchEntry (hwnd, szTitleBar,
                                  GetFractalName(cp.iFractType) );
                  }

               cp.sSubAction = SUB_ACT_CALC;   /* we want a Calculation */

               DosSemClear (&cp.ulSemTrigger) ;  /* release the subthread */

               sStatus = STATUS_WORKING ;
               /* WinInvalidateRect (hwnd, NULL, FALSE) ; */
               UpdateMenuText (hwnd, IDM_FREEZE_HALT, szHalt);
               EnableMenuItem (hwnd, IDM_GO, FALSE) ;
               EnableMenuItem (hwnd, IDM_FREEZE_HALT, TRUE) ;
               /* WinStartTimer (hab, hwnd, ID_TIMER, 5000); */
               return 0 ;

          case IDM_PAN:
               /* Pan selected.  Pan to where the cross hairs were */
               PanNewCenter(hwnd);
               fGoodPan = FALSE;
               return 0;

          case IDM_ZIN_WIN:
               /* Zoom to the Window selected. */
               EraseZoomBox(hwnd);
               ZoomNewWindow(hwnd, TRUE);   /* zoom in */
               fGoodZoom = FALSE;
               return 0;

          case IDM_ZOUT_WIN:
               /* Zoom to the Window selected. */
               EraseZoomBox(hwnd);
               ZoomNewWindow(hwnd, FALSE);   /* zoom out */
               fGoodZoom = FALSE;
               return 0;

          case IDM_FREEZE_HALT:
               if (sStatus == STATUS_WORKING)
                  {
                  /* schedule the subthread to find a stopping place */
                  cp.fContinueCalc = FALSE ;
                  EnableMenuItem (hwnd, IDM_FREEZE_HALT, FALSE) ;
                  }
               if (sStatus == STATUS_READY)
                  {
                  /* we Freeze to play with parms repeatedly */
                  /* make a copy to play with.  We will keep */
                  /* working with only this copy */
                  InitNewParms(NULL);
                  /* now change state */
                  sStatus = STATUS_FROZEN;
                  EnableMenuItem (hwnd, IDM_FREEZE_HALT, FALSE);
                  }

               return 0 ;

          case IDM_ABOUT:
               /* send up the About box */
               WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
                    (HMODULE) 0, IDD_ABOUT, NULL) ;

               return 0 ;

          case IDM_NEW_FRACTAL:
               /*
                * send up the Select Fractal Type box.
                * On OK return, schedule the new parameters.
                * Handle the special cases needing files or other data
                * as part of exiting the initial dialog box.
               */
               if (WinDlgBox (HWND_DESKTOP, hwnd, SelFractalDlgProc,
                       (HMODULE) 0, IDD_SET_FRACTTYPE, NULL) )
                  ScheduleNewParms (hwnd);

               return 0 ;

          case IDM_SET_PARAMS:
               /*
                * send up the Set Paramters box.
                * On OK return, schedule the new parameters.
               */
               if (WinDlgBox (HWND_DESKTOP, hwnd, SetParametersDlgProc,
                       (HMODULE) 0, IDD_SET_PARAMS, NULL) )
               ScheduleNewParms (hwnd);

               return 0 ;

          case IDM_SET_OPTIONS:
               /*
                * send up the Set Options box.
                * On OK return, schedule the new parameters.
               */
               if (WinDlgBox (HWND_DESKTOP, hwnd, SetOptionsDlgProc,
                       (HMODULE) 0, IDD_SET_OPTIONS, NULL) )
               ScheduleNewParms (hwnd);

               return 0 ;

          case IDM_SET_IMAGE:
               /*
                * send up the Set Image box.
                * On OK return, schedule the new parameters.
               */
               if (WinDlgBox (HWND_DESKTOP, hwnd, SetImageDlgProc,
                       (HMODULE) 0, IDD_SET_IMAGE, NULL) )
               ScheduleNewParms (hwnd);

               return 0 ;

          case IDM_SET_PALETTE:
               /*
                * send up the Set Palette box.
                * Return is not checked because effects are immediate
               */
               WinDlgBox (HWND_DESKTOP, hwnd, SetPaletteDlgProc,
                       (HMODULE) 0, IDD_SET_PALETTE, NULL) ;

               return 0 ;

          case IDM_ZIN_PICK:
          case IDM_ZOUT_PICK:
               /*
                * Send up the Zoom Value dialog box.
                * On OK return, schedule the new parameters.
               */
               if ( WinDlgBox (HWND_DESKTOP, hwnd, ZoomValueDlgProc,
                        (HMODULE) 0, IDD_NUMBER_PICK,
                        MPFROMP((PVOID) &COMMANDMSG(&msg)->cmd)) )
                  ScheduleNewParms (hwnd);

               return 0 ;

          case IDM_ZIN_2:
          case IDM_ZIN_5:
          case IDM_ZIN_10:
               /*
                * Zoom in by fixed value.
                * Schedule the new parameters.
               */
               InitNewParms(NULL);
               CalcZoomValues(&npNewParms,
                      (double) (sCommand), TRUE );
               npNewParms.fNewParms = TRUE;
               ScheduleNewParms(hwnd);

               return 0;

          case IDM_ZOUT_2:
          case IDM_ZOUT_5:
          case IDM_ZOUT_10:
               /*
                * Zoom out by fixed value.
                * Schedule the new parameters.
               */
               InitNewParms(NULL);
               CalcZoomValues(&npNewParms,
                      (double) (sCommand - 10), FALSE );
               npNewParms.fNewParms = TRUE;
               ScheduleNewParms(hwnd);

               return 0;

          case IDM_SET_EXTENTS:
               /*
                * Send up the Set Extents dialog box.
                * On OK return, schedule the new parameters.
               */
               if ( WinDlgBox (HWND_DESKTOP, hwnd, SetExtentsDlgProc,
                      (HMODULE) 0, IDD_SET_EXTENTS, NULL) )
                   ScheduleNewParms (hwnd);

               return 0;

          case IDM_SET_SWAP:
               /* swap Mandel for Julia or vice versa.
                  Handle it as a parm change */
               InitNewParms(NULL);
               if (fractalspecific[npNewParms.iFractType].tojulia != NOFRACTAL
                      && npNewParms.param[0] == 0.0
                      && npNewParms.param[1] == 0.0)
                  {
                  /* switch to corresponding Julia set */
                  npNewParms.iFractType =
                         fractalspecific[npNewParms.iFractType].tojulia;
                  npNewParms.param[0] = npNewParms.XCenter;
                  npNewParms.param[1] = npNewParms.YCenter;

                  npNewParms.mxXL = fractalspecific[npNewParms.iFractType].xmin;
                  npNewParms.mxXR = fractalspecific[npNewParms.iFractType].xmax;
                  npNewParms.mxYB = fractalspecific[npNewParms.iFractType].ymin;
                  npNewParms.mxYT = fractalspecific[npNewParms.iFractType].ymax;

                  }

               else if (fractalspecific[npNewParms.iFractType].tomandel != NOFRACTAL)
                  {
                  /* switch to corresponding Mandel set */
                  npNewParms.iFractType =
                         fractalspecific[npNewParms.iFractType].tomandel;
                  npNewParms.param[0] = 0.0;
                  npNewParms.param[1] = 0.0;
                  npNewParms.mxXL = fractalspecific[npNewParms.iFractType].xmin;
                  npNewParms.mxXR = fractalspecific[npNewParms.iFractType].xmax;
                  npNewParms.mxYB = fractalspecific[npNewParms.iFractType].ymin;
                  npNewParms.mxYT = fractalspecific[npNewParms.iFractType].ymax;
                  }

               npNewParms.fNewParms = TRUE;
               ScheduleNewParms (hwnd);
               return 0;

          case IDM_SET_RESET:
               /* copy the work copy of the parms back from the
                  set used by the calculation engine.
                  This resets any dicking around done with the
                  dialogs.
                  Note: this is only active during FREEZE mode.
               */

               CopyParmsToNew();

               return 0;

          case IDM_HELP_INTRO:
               /* basic Introductory Help */
               SimpleHelp(hab, hwnd, szTitleBar,
                         (HMODULE) 0, IDT_TEXT, IDT_HELP_INTRO);
               return 0;

          case IDM_HELP_FRACTTYPE:
               /* Fractal list Help */
               SimpleHelp(hab, hwnd, szTitleBar,
                         (HMODULE) 0, IDT_TEXT, IDT_HELP_TYPES);
               return 0;

          case IDM_HELP_OPERATE:
               /* Menu Help */
               SimpleHelp(hab, hwnd, szTitleBar,
                       (HMODULE) 0, IDT_TEXT, IDT_HELP_OPERATE);
               return 0;

          case IDM_PRINT_FILE:
               /* Send up the Print Where Dialog.
                  On OK return, fire up the subtask */
               if ( WinDlgBox(HWND_DESKTOP, hwnd, PrintOptionsDlgProc,
                    (HMODULE) 0, IDD_PRINT, NULL) )
                  {
                  /* fire up the subtask */
                  cp.sSubAction = SUB_ACT_PRINT;   /* we want a Print */

                  cp.fContinueCalc = TRUE;
                  DosSemClear (&cp.ulSemTrigger) ;  /* release the subthread */

                  sStatus = STATUS_WORKING ;
                  UpdateMenuText (hwnd, IDM_FREEZE_HALT, szHalt);
                  EnableMenuItem (hwnd, IDM_GO, FALSE) ;
                  EnableMenuItem (hwnd, IDM_FREEZE_HALT, TRUE) ;
                  cp.fSuppressPaint = TRUE;
                  WinInvalidateRect(hwnd, NULL, FALSE);
                  }

               return 0 ;

          case IDM_READ_FILE:
               /* Send up the Load/Save Format Dialog to find
                  out the format we will read.
                  Then send up the generic Open File dialog.
                  On OK return, fire up the subtask */
               {
               DLF dlf;
               HFILE hfDummy;
               PSZ pszExt;

               if ( WinDlgBox(HWND_DESKTOP, hwnd, LoadSaveFmtDlgProc,
                    (HMODULE) 0, IDD_LOADSAVE_TYPE, szLoadWhatFmt) )
                  {

                  FileFmtExt (&pszExt);

                  SetupDLF (&dlf, DLG_OPENDLG, &hfDummy,
                            pszExt, szTitleBar,
                            szOpenTitle, szOpenHelp);

                  if (TDF_OLDOPEN == DlgFile(hwnd, &dlf) )
                     {
                     /* close the dummy file handle */
                     DosClose(hfDummy);
                     /* fire up the subtask */
                     cp.sSubAction = SUB_ACT_LOAD;   /* we want a Load */
                     cp.sSubFunction = cp.sLastLoadSaveType;
                     _fstrcpy(cp.szFileName, dlf.szOpenFile);

                     cp.fContinueCalc = TRUE;
                     DosSemClear (&cp.ulSemTrigger) ;  /* release the subthread */

                     sStatus = STATUS_WORKING ;
                     UpdateMenuText (hwnd, IDM_FREEZE_HALT, szHalt);
                     EnableMenuItem (hwnd, IDM_GO, FALSE) ;
                     EnableMenuItem (hwnd, IDM_FREEZE_HALT, TRUE) ;
                     cp.fSuppressPaint = TRUE;
                     WinInvalidateRect(hwnd, NULL, FALSE);
                     }
                  }

               return 0 ;
               }

          case IDM_SAVE_FILE:
               /* Send up the Load/Save Format Dialog to find
                  out the format we will be writing.
                  Then send up the generic Save File dialog.
                  On OK return, fire up the subtask */
               {
               DLF dlf;
               HFILE hfDummy;
               PSZ pszExt;

               if ( WinDlgBox(HWND_DESKTOP, hwnd, LoadSaveFmtDlgProc,
                    (HMODULE) 0, IDD_LOADSAVE_TYPE, szSaveWhatFmt) )
                  {

                  FileFmtExt (&pszExt);

                  SetupDLF (&dlf, DLG_SAVEDLG, &hfDummy,
                            pszExt, szTitleBar,
                            szOpenTitle, szOpenHelp);
                  _fstrcpy(dlf.szOpenFile, cp.szFileName);

                  if (TDF_NOSAVE != DlgFile(hwnd, &dlf) )
                     {
                     /* close the dummy file handle */
                     DosClose(hfDummy);
                     /* and delete the dummy file */
                     DosDelete(dlf.szOpenFile, 0);
                     /* fire up the subtask */
                     cp.sSubAction = SUB_ACT_SAVE;   /* we want a Save */
                     cp.sSubFunction = cp.sLastLoadSaveType;
                     _fstrcpy(cp.szFileName, dlf.szOpenFile);

                     cp.fContinueCalc = TRUE;
                     DosSemClear (&cp.ulSemTrigger) ;  /* release the subthread */

                     sStatus = STATUS_WORKING ;
                     UpdateMenuText (hwnd, IDM_FREEZE_HALT, szHalt);
                     EnableMenuItem (hwnd, IDM_GO, FALSE) ;
                     EnableMenuItem (hwnd, IDM_FREEZE_HALT, TRUE) ;
                     cp.fSuppressPaint = TRUE;
                     WinInvalidateRect(hwnd, NULL, FALSE);
                     }
                 }

               return 0 ;
               }

          case IDM_READ_COLORMAP:
               /* Send up the generic Open File dialog.
                  On OK return, read in the file via subroutine. */
               {
               DLF dlf;
               HFILE hfDummy;

               SetupDLF (&dlf, DLG_OPENDLG, &hfDummy,
                         "\\*.map", szTitleBar,
                         szColorMapTitle, szColorMapHelp);

               if (TDF_OLDOPEN == DlgFile(hwnd, &dlf) )
                  {
                  /* close the dummy file handle */
                  DosClose(hfDummy);
                  /* throw up the hour-glass */
                  WinSetCapture(HWND_DESKTOP, hwnd);
                  WinSetPointer(HWND_DESKTOP, hptrWait);
                  /* read it in */
                  LoadColorMap(dlf.szOpenFile);
                  /* now clean up */
                  WinSetPointer(HWND_DESKTOP, hptrArrow);
                  WinSetCapture(HWND_DESKTOP, (HWND) NULL);
                  }
               }

               return 0;

          case IDM_WRITE_COLORMAP:
               /* Send up the generic Save File dialog.
                  On OK return, write the file via subroutine */
               {
               DLF dlf;
               HFILE hfDummy;

               SetupDLF (&dlf, DLG_SAVEDLG, &hfDummy,
                         "\\*.map", szTitleBar,
                         szColorMapTitle, szColorMapHelp);

               if (TDF_NOSAVE != DlgFile(hwnd, &dlf) )
                  {
                  /* close the dummy file handle */
                  DosClose(hfDummy);
                  /* throw up the hour-glass */
                  WinSetCapture(HWND_DESKTOP, hwnd);
                  WinSetPointer(HWND_DESKTOP, hptrWait);
                  /* write it out */
                  SaveColorMap(dlf.szOpenFile);
                  /* now clean up */
                  WinSetPointer(HWND_DESKTOP, hptrArrow);
                  WinSetCapture(HWND_DESKTOP, (HWND) NULL);
                  }
               }

               return 0;

          case IDM_CLEAR_CLPB:
               /* clear the current contents of the clipboard */
               WinOpenClipbrd (hab);
               WinEmptyClipbrd (hab);
               WinCloseClipbrd (hab);

               return 0;

          case IDM_PASTE:
               {  /* paste from the clipboard into us */
               USHORT usClipBrdInfo;

               if ( WinQueryClipbrdFmtInfo(hab, CF_BITMAP, &usClipBrdInfo) )
                  {  /* we have a bitmap to fetch */
                  /* draw the curtain over the display */
                  cp.fSuppressPaint = TRUE;
                  WinInvalidateRect(hwnd, NULL, FALSE);
                  WinUpdateWindow(hwnd);
                  /* throw up the hour-glass */
                  WinSetCapture(HWND_DESKTOP, hwnd);
                  WinSetPointer(HWND_DESKTOP, hptrWait);
                  /* fetch the bitmap */
                  PMfrFetchClipbrdBmp(hab);
                  /* now clean up */
                  WinSetPointer(HWND_DESKTOP, hptrArrow);
                  WinSetCapture(HWND_DESKTOP, (HWND) NULL);
                  /* and schedule redrawing the window */
                  SetSwitchEntry (hwnd, szTitleBar,
                                  GetFractalName(cp.iFractType) );
                  cp.fSuppressPaint = FALSE;
                  WinInvalidateRect(hwnd, NULL, FALSE);
                  }
               }

               return 0;

          case IDM_COPY_BMP:
               {  /* copy to the clipboard from us */

               /* throw up the hour-glass */
               WinSetCapture(HWND_DESKTOP, hwnd);
               WinSetPointer(HWND_DESKTOP, hptrWait);
               /* write the bitmap */
               PMfrWriteClipbrdBmp(hab);
               /* now clean up */
               WinSetPointer(HWND_DESKTOP, hptrArrow);
               WinSetCapture(HWND_DESKTOP, (HWND) NULL);

               }

               return 0;

          }

     return 0;

     }