The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MyObject.mm

Go to the documentation of this file.
00001 
00002 //
00003 //      File:           MyObject.m
00004 //
00005 //      Contains:       Implementation file for the MyObject class.
00006 //
00007 //      Original Written by:    Apple Developer Technical Support
00008 //      Modified by:    Ian Fasel -- added Face Detector (MPISearch) support
00009 //
00010 //      Copyright:        2003 Machine Perception Laboratory 
00011 //                      University of California San Diego.
00012 //
00013 //      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00014 //
00015 //    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00016 //    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00017 //    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00018 //
00019 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00020 // 
00022 
00023 #import <QuickTime/QuickTime.h>
00024 #import <Carbon/Carbon.h>
00025 
00026 #import "MyObject.h"
00027 #import "MyQuickDrawView.h"
00028 
00029 
00030 NSTimer *theTimer;
00031 
00032 @implementation MyObject
00033 
00035 //
00036 // init
00037 //
00038 // Our controller's initialization method. Well
00039 // add our self as an observer for application
00040 // termination notifications, so we can perform
00041 // cleanup when the application quits.
00042 //
00044 
00045 - (id)init
00046 {
00047     /* we'll want to be called when the application
00048      quits so we can do any cleanup */
00049      
00050     [[NSNotificationCenter defaultCenter] addObserver:self
00051         selector:@selector(applicationWillTerminate:)
00052         name:@"NSApplicationWillTerminateNotification" object:NSApp];
00053 
00054     return self;
00055 }
00056 
00058 //
00059 // awakeFromNib
00060 //
00061 // Called after all our objects are unarchived and
00062 // connected but just before the interface is made visible
00063 // to the user. We will do custom initialization of our
00064 // objects here.
00065 //
00067 
00068 - (void)awakeFromNib
00069 {
00070     NSDictionary        *dict;
00071     NSString            *windowTitle;
00072     OSErr                       err;
00073 
00074     /* grab the name string for our window */
00075     NSString *filePath  = [[NSBundle mainBundle] pathForResource:@"InfoPlist" ofType:@"strings"];
00076     dict                                = [NSDictionary dictionaryWithContentsOfFile:filePath];
00077     windowTitle                 = [dict objectForKey:@"MiniMungWindowTitleString"];
00078 
00079     /* set the window title */
00080         [window setTitle:windowTitle];
00081     
00082     /* pass our view object to our MyQuickDrawView class so we can access methods
00083         in this class from our C code routines */
00084     saveQDViewObjectForCallback(view);
00085 
00086     /* now lets create a window and display the video data passed to us by the sequence grabber */
00087     err = [view doSeqGrab:[view bounds]];
00088     
00089     /* put up an error dialog to display any errors */
00090     if (err != noErr)
00091     {
00092         NSString *errorStr = [[NSString alloc] initWithFormat:@"%d" , err];
00093         int choice;
00094 
00095         /* now display error dialog and quit */
00096         choice = NSRunAlertPanel(@"Error", errorStr, @"OK", nil, nil);
00097         [errorStr release];
00098     }
00099     
00100 }
00101 
00102 
00104 //
00105 // applicationWillTerminate
00106 //
00107 // We'll release any objects we initialized
00108 // in our init method.
00109 //
00111 
00112 - (void)applicationWillTerminate:(NSNotification *)notification
00113 {
00114     [view endGrab];    
00115 }
00116 
00117 
00118 @end
00119 

Generated on Mon Nov 8 17:07:46 2004 for MPT by  doxygen 1.3.9.1