home *** CD-ROM | disk | FTP | other *** search
- /* AboutVersion.c
- * Display a version number in an about box
- * Copyright ©1993 Working Software, Inc. All Rights Reserved.
- * 23 Feb Mike Crawford
- */
-
- /* Create an "AboutVersionDef.h" for each project that defines the constant rVersID.
- */
-
- #include "AboutVersion.h"
- #include "AboutVersionDef.h"
-
- void InstallAboutVersionProc( DialogPtr aboutDialog, short versItem )
- {
- short kind;
- Handle h;
- Rect r;
- UserItemUPP versProc;
-
- GetDItem( aboutDialog, versItem, &kind, &h, &r );
-
- versProc = NewUserItemProc( AboutVersionProc );
- if ( !versProc )
- return; // STUB should report an error
-
-
- SetDItem( aboutDialog, versItem, kind, (Handle)versProc, &r );
-
- return;
- }
-
- void DestroyAboutVersionProc( DialogPtr aboutDialog, short versItem )
- {
- short kind;
- Handle h;
- Rect r;
-
- #ifdef GENERATINGCFM
- GetDItem( aboutDialog, versItem, &kind, &h, &r );
-
- DisposeRoutineDescriptor( (UniversalProcPtr)h );
- #endif
- return;
- }
-
- pascal void AboutVersionProc( DialogPtr dlg, short item )
- {
- Handle h;
- short kind;
- Rect r;
- GrafPtr oldPort;
- VersRecHndl versH;
-
- /* From Writeswell Jr. -- draw the version number by getting it from the vers
- * resource. Saves a lot of time when making a new master disk
- */
-
- versH = (VersRecHndl)Get1Resource( 'vers', rVersID );
-
- if ( !versH ){
- return;
- }
-
- GetPort( &oldPort );
- SetPort( dlg );
-
- GetDItem( dlg, item, &kind, &h, &r );
-
- MoveTo( r.left, r.bottom );
-
- HLock( (Handle) versH );
-
- PenNormal();
- TextFont( applFont );
- TextSize( 12 );
- TextFace( 0 );
-
- DrawString( (*versH)->shortVersion );
-
- HUnlock( (Handle) versH );
- ReleaseResource( (Handle) versH );
-
- SetPort( oldPort );
-
- return;
- }
-
-