#include "PeekIt.h"
IBNibRef 	gNibRef;
FSSpec gAppFSSpec;
extern WindowRef CreateOrShowPIMainWIND(FileTrackerPtr theFile, Boolean vis,Boolean newWindow);
extern void SavePrefs(void);
extern void InitPeekIt(void);
int main(int argc, char* argv[])
{
    
    OSStatus		err=noErr;

    // Create a Nib reference passing the name of the nib file (without the .nib extension)
    // CreategNibReference only searches into the application bundle.
    UInt32 savedFlags = SwapQDTextFlags( /* kQDUseTrueTypeScalerGlyphs
                                        | */ kQDUseCGTextRendering
                                        | kQDUseCGTextMetrics);
    err = CreateNibReference(CFSTR("peekit"), &gNibRef);
    require_noerr( err, CantGetgNibRef );
    
    // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
    // object. This name is set in InterfaceBuilder when the nib is created.
    err = SetMenuBarFromNib(gNibRef, CFSTR("MenuBar"));
    require_noerr( err, CantSetMenuBar );
    InitPeekIt();
//        CreateOrShowPIMainWIND(nil, true,true);
   

#if 0
        {extern WindowRef CreateOrShowDebugentLogWind(FSSpecPtr theFile, Boolean visi);
            CreateOrShowDebugentLogWind(0,true);


        }
#endif

    
        GetAppFSSpec(&gAppFSSpec);
// Call the event loop
    RunApplicationEventLoop();
        SavePrefs();

CantSetMenuBar:
CantGetgNibRef:
  (void)SwapQDTextFlags(savedFlags);
            return err;
}

