home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / cpp / graphics / Conics.sit.hqx / Conics / Sources / DocWindows.cpp < prev    next >
Text File  |  1996-11-13  |  1KB  |  63 lines

  1. //Copyright 1996 Aidan Cully
  2. //All rights reserved
  3.  
  4. #include <QuickDraw.h>
  5. #include <Scrap.h>
  6. #include <Memory.h>
  7. #include "DocWindows.h"
  8. #include "MenuHandler.h"
  9.  
  10. void TDocWindow::CopyWindow() {
  11.     OpenCPicParams params;
  12.     PicHandle picture;
  13.  
  14.     GetDrawFocus();
  15.     ::ZeroScrap();
  16.     params.srcRect = ::GetWindowPort( window )->portRect;
  17.     params.hRes = 0x00480000;
  18.     params.vRes = 0x00480000;
  19.     params.version = -2;
  20.     params.reserved1 = 0;
  21.     params.reserved2 = 0;
  22.     picture = OpenCPicture( ¶ms );
  23.     ClipRect( ¶ms.srcRect );
  24.     DrawSelf();
  25.     ClosePicture();
  26.     MoveHHi( (Handle)picture );
  27.     HLock( (Handle)picture );
  28.     PutScrap( GetHandleSize( (Handle) picture ), 'PICT', *picture );
  29.     HUnlock( (Handle)picture );
  30.     KillPicture( picture );
  31.     ReleaseDrawFocus();
  32. }
  33.  
  34. SInt8 TDocWindow::HandleAction( UInt32 action ) {
  35.     SInt16 theMenu, menuID;
  36.  
  37.     theMenu = action>>16;
  38.     menuID = (action&0x0000ffff);
  39.     switch( theMenu ) {
  40.     case m_EDIT:
  41.         switch( menuID ) {
  42.         case me_COPY:
  43.             CopyWindow();
  44.             HiliteMenu( 0 );
  45.             return(0);
  46.         }
  47.     }
  48.     if( superHandler )
  49.         return( superHandler->HandleAction( action ) );
  50.     return( 1 );
  51. }
  52.  
  53. SInt8 TDocWindow::MakeActive( Boolean active ) {
  54.     TOffScreen::MakeActive( active );
  55.     if( active )
  56.         MActionHandler::MakeActive();
  57. }
  58.  
  59. Boolean TDocWindow::Init( TInitStruct *vals ) {
  60.     TOffScreen::Init( vals );
  61.     conic = ((TDocInit*)vals)->conic;
  62.     plane = ((TDocInit*)vals)->plane;
  63. }