Example #1
0
/*
=============
InitMacStuff
=============
*/
void InitMacStuff( void ) {
	Handle 		menuBar;
	char		dir[MAX_OSPATH];
	
	// init toolbox
	MaxApplZone();
	MoreMasters();
	
	InitGraf(&qd.thePort);
	InitFonts();
	FlushEvents(everyEvent, 0);
	SetEventMask( -1 );
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	InitCursor();

	// init menu
	menuBar = GetNewMBar(rMenuBar);
	if(!menuBar) {
		Com_Error( ERR_FATAL, "MenuBar not found.");
	}
	
	SetMenuBar(menuBar);
	DisposeHandle(menuBar);
	AppendResMenu(GetMenuHandle(mApple),'DRVR');
	DrawMenuBar();

	Sys_InitConsole();

	SetEventMask( -1 );
}
Example #2
0
void BasicInit()
#ifdef MAC
{
	void InitColors();
#if MACB4CARBON  
	short i;
	Ptr stackTop;
	// JLMextern _DataInit();
	
	stackTop = GetApplLimit();
	
	
	SetApplLimit((void *)(stackTop - (Ptr)30000));
	// SetApplLimit((void *)(*(long *)csb - 30000));
	MaxApplZone();
	for (i = 1 ; i <= 16 ; i++) MoreMasters();
	
	InitGraf(&qd.thePort);
	InitFonts();
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	FlushEvents(everyEvent, 0);
#endif
	InitCursor();
	
	InitColors();
}
Example #3
0
static pascal DialogItemIndex MyAlert (UInt8 whichAlert, ConstStr255Param str1, ConstStr255Param str2)
{
	DialogItemIndex result = kDialogItemIndexNone;

	if (!AEInteractWithUser (kNoTimeOut,NULL,NULL))
	{
		ParamText (LMGetCurApName ( ), str1 ? str1 : "\p", str2 ? str2 : "\p", "\p");

		InitCursor ( );

		switch (whichAlert)
		{
			case kAlertIndex_ShortField :

				result = CautionAlert (kResID_Base + whichAlert, gStandardModalFilterUPP);
				break;

			default :

				result = StopAlert (kResID_Base + whichAlert, gStandardModalFilterUPP);
				break;
		}

		if (MoreAssertPCG (result != kDialogItemIndexNone))
		{
			EventRecord modifiers;
			OSEventAvail (0,&modifiers);
			if (modifiers.modifiers & optionKey)
				Debugger ( );
		}
	}
int InitOpening()
{
	memset(CharacterName1, 0, sizeof(CharacterName1));
	memset(CharacterName2, 0, sizeof(CharacterName2));
	
	InitCursor();

#ifdef _PLAY_MORYON
	lpLogin = new HoLogin(1);	
#else
	lpLogin = new HoLogin(0);	
#endif

	lpOpening = new HoOpening();
	
	if(WorkMode == OPENING_MODE)
		lpOpening->Init();
	else if(WorkMode == LOGIN_MODE)
		lpLogin->Init();
	
	CursorShowFlag = TRUE;
	LoginEndFlag = FALSE;
	
	//MatHoCursorDefault =  CreateTextureMaterial( "Image\\SinImage\\Cursor\\DefaultCursor.tga" , 0, 0, 0,0, SMMAT_BLEND_ALPHA );

	return TRUE;
}
Example #5
0
/* Panic button to display fatal errors.
  Completely self contained, can't rely on carbon.cc being available */
static void carbonFatalDialog(const char *error, const char *exposition)
{
  DialogRef                     alertDialog;
  CFStringRef                   cfError;
  CFStringRef                   cfExposition;
  DialogItemIndex               index;
  AlertStdCFStringAlertParamRec alertParam = {0};

  // Init libraries
  InitCursor();
  // Assemble dialog
  cfError = CFStringCreateWithCString(NULL, error, kCFStringEncodingASCII);
  if(exposition != NULL)
  {
    cfExposition = CFStringCreateWithCString(NULL, exposition, kCFStringEncodingASCII);
  }
  else {
    cfExposition = NULL;
  }
  alertParam.version       = kStdCFStringAlertVersionOne;
  alertParam.defaultText   = CFSTR("Quit");
  alertParam.position      = kWindowDefaultPosition;
  alertParam.defaultButton = kAlertStdAlertOKButton;
  // Display Dialog
  CreateStandardAlert(
    kAlertStopAlert,
    cfError,
    cfExposition,       /* can be NULL */
    &alertParam,             /* can be NULL */
    &alertDialog);
  RunStandardAlert(alertDialog, NULL, &index);
  // Cleanup
  CFRelease(cfError);
  if(cfExposition != NULL) { CFRelease(cfExposition); }
}
Example #6
0
void initMac()
{
	InitCursor();
	FlushEvents( 0, everyEvent );
	
	setUpMenus();
}
Example #7
0
static int
MacintoshInit()
{
    MaxApplZone();
    MoreMasters();
    MoreMasters();
    MoreMasters();
    MoreMasters();

    tcl_macQdPtr = &qd;

     if (TkMacHaveAppearance()) {
         RegisterAppearanceClient();
     }

    InitGraf(&tcl_macQdPtr->thePort);
    InitFonts();

    if (TkMacHaveAppearance() >= 0x110) {
	InitFloatingWindows();
    } else {
	InitWindows();
    }

    InitMenus();
    InitDialogs((long) NULL);		
    InitCursor();

    FlushEvents(everyEvent, 0);
    SetEventMask(everyEvent);
    Tcl_MacSetEventProc(TkMacConvertEvent);

    return TCL_OK;
}
int main ()
{
	int ret;
	Rect windRect;
	long start,end,amount;
	
	/* Initialize all the needed managers. */
	InitGraf(&qd.thePort);
	InitFonts();
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	InitCursor();

	//ProfilerInit(collectDetailed, bestTimeBase, 1000, 50);
	//ProfilerSetStatus(true);

	windRect = qd.screenBits.bounds;
	InsetRect(&windRect, 50, 50);
	pWindow = NewCWindow(nil, &windRect, "\pMpeg", true, documentProc, (WindowPtr) -1, false, 0);
    
    start = TickCount();
    main2();
    end = TickCount();
    amount = end - start;
    fprintf(stderr, "Time taken %d memoryAllocator %d \n", amount,counter);

   //	ProfilerDump("\pProfile.out");
     
    do {
	} while (!Button());


}
Example #9
0
static void Initialize( void )
{
    EventLoopTimerRef   timerRef;
    EventTypeSpec       eventTypeSpec = { kEventClassWindow, kEventWindowClose };
    Rect                bounds;
    WindowRef           window;

    InitCursor();

    //  Create a window and install an event handler to handle the close button.

    SetRect( &bounds, 50, 50, 600, 200 );
    CreateNewWindow( kDocumentWindowClass,
                     kWindowCloseBoxAttribute + kWindowStandardHandlerAttribute,
                     &bounds,
                     &window );
    SetWTitle( window, "\pPlugIn Host -- Close Window To Quit" );
    InstallWindowEventHandler( window, NewEventHandlerUPP( MyCloseHandler ), 1, &eventTypeSpec,
                               NULL, NULL );
							   
    //	Create a timer to handle ball-drawing in the window.
	
    InstallEventLoopTimer( GetCurrentEventLoop(), kEventDurationSecond, kEventDurationSecond,
                           NewEventLoopTimerUPP( MyTimerHandler ), window, &timerRef );

    ShowWindow( window );
}
Example #10
0
// --------------------------------------------------------------------------------------
static void initialize(void)
{
	MenuBarHandle menuBar;
	OSErr error;
	
	MoreMasters();				// I doubt we actually need any extra master pointers 
	InitGraf(&qd.thePort);		// but I left the calls here as a reminder for where they 
	InitFonts();				// belong if they are needed
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(NULL);
	
	InitCursor();
	RegisterAppearanceClient();
	
	menuBar = GetNewMBar(rMenuBar);		// draw the menu bar as soon as possible
	if (menuBar == NULL)
		ExitToShell();
	SetMenuBar(menuBar);
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that we 
		   do in the open application handler. */
	
	FlushEvents(everyEvent, 0);
}
Example #11
0
// --------------------------------------------------------------------------------------
static void initialize(void)
{
	MenuBarHandle menuBar;
	OSErr error;
	
		/* I doubt we actually need any extra master pointers but I left the call here 
		   as a reminder for where it belongs if it is needed. */
	MoreMasterPointers(64);		// each call to MoreMasters allocates 64 master pointers
	
	InitCursor();
	RegisterAppearanceClient();
	
	menuBar = GetNewMBar(rMenuBar);		// draw the menu bar as soon as possible
	if (menuBar == NULL)
		ExitToShell();
	SetMenuBar(menuBar);
	DrawMenuBar();
	
		// do non time sensitive initialization after we get the application event loop going
	gOpenAppAEHandler = NewAEEventHandlerUPP(openApplicationAEHandler);
	error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, gOpenAppAEHandler, 0, 
									false);
	if (error != noErr)
		ExitToShell();
	
		/* If we supported them, we would install open documents and print documents 
		   handlers here and we would do most of the same initialization stuff that 
		   we do in the open application handler. */
}
Example #12
0
File: ugView.c Project: rolk/ug
int main (void)
{
  /* init the Macintosh toolbox */
  InitGraf(&qd.thePort);
  InitFonts();
  FlushEvents(everyEvent,0);
  InitWindows();
  InitMenus();
  TEInit();
  InitDialogs(nil);
  InitCursor();

  /* read the screen's size */
  screenx = ((qd.screenBits).bounds).right;
  screeny = ((qd.screenBits).bounds).bottom;
  SetRect(&dragRect,4,24,((qd.screenBits).bounds).right-4,((qd.screenBits).bounds).bottom-4);


  SetUpMenus ();
  SetState(CLOSED);
  OpenCommand();

  /* handle events till the end */
  while (!quitFlag)
  {
    ProcessEvent();
  }

  return(0);
}
Example #13
0
CGeneral::CGeneral()
{
   m_fSndLoaded = false;
   LoadFonts();
   InitCursor();
   LoadImages();
   LoadSound();
}
Example #14
0
cursInit()
{
	InitCursor();
	waitCursHand = (CursHandle) GetCursor(WAIT_CURSOR_ID);
	HNoPurge(&waitCursHand);
	cursIndex = 0;
	cursStack[0] = CURS_NORM;
}
Example #15
0
void Initialize()	/* Initialize some managers */
{
    OSErr	err;
        
    InitCursor();

    err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false );
    if (err != noErr)
        ExitToShell();
}
Example #16
0
void InitStuff(void)
{
	//InitGraf(&qd.thePort);
	//InitFonts();
	//InitWindows();
	//InitMenus();
	//TEInit();
	//InitDialogs(nil);
	InitCursor();
	FlushEvents(everyEvent,0);
}
Example #17
0
CGeneral::CGeneral():
m_iPrevGirl(0),
m_iPrevGirlColor(0),
m_iCurMusic(-1)
{
   LoadImages();
   LoadFonts();
   LoadMusic();
   LoadSound();
   InitCursor();
}
Example #18
0
/* ----------- private code */
static void initialize_application(
	void)
{
	Handle menubar;
	StringHandle		userName;

#ifndef OP_PLATFORM_MAC_CARBON_FLAG
	MaxApplZone();
	MoreMasters();
	MoreMasters();
	MoreMasters();
	
	InitGraf(&qd.thePort);
	InitFonts();
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(NULL);
#else
	MoreMasterPointers(192);
#endif // ! OP_PLATFORM_MAC_CARBON_FLAG

	InitCursor();

	FlushEvents(everyEvent, 0);

	menubar= GetNewMBar(rMENU_BAR_ID);
	op_assert(menubar);

	SetMenuBar(menubar);
	DisposeHandle(menubar);
	AppendResMenu(GetMenuHandle(mApple), 'DRVR');
	DrawMenuBar();

	//	Get the user name from the systemÉ
	
	userName = GetString (-16096);
	if (userName == NULL)
		strcpy(gNameString, "OpenPlay Test");
	else
	{
		doCopyP2CStr(*userName,gNameString);
		ReleaseResource ((Handle) userName);
	}

	// ecf - we wanna enable enumeration by default...
	check_menu_item(mSpecial, iActiveEnumeration, active_enumeration);
	
	//install apple event handler for quitting
	AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,NewAEEventHandlerUPP((AEEventHandlerProcPtr)do_quit_apple_event),0L,false);
	
	return;
}
Example #19
0
static void
init_toolbox()
{
    InitGraf(&qd.thePort);
    InitFonts();
    InitWindows();
    TEInit();
    InitDialogs((long)0);
    InitMenus();
    InitCursor();
    SIOUXSettings.asktosaveonclose = 0;
}
Example #20
0
int main(int argc, char* argv[])
{
	IBNibRef 		nibRef;
	OSStatus		err;
	
	InitCursor();

	// check the correct BASS was loaded
	if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS.DLL was loaded (2.4 is required)");
		return 0;
	}

	// check the correct BASS_FX was loaded
	if (HIWORD(BASS_FX_GetVersion())!=BASSVERSION) {
		Error("An incorrect version of BASS_FX.DLL was loaded (2.4 is required)");
		return 0;
	}

	// initialize default output device
	if(!BASS_Init(-1,44100,0,NULL,NULL)) {
		Error("Can't initialize device");
		return 0;
	}

	// Create Window and Stuff
	err = CreateNibReference(CFSTR("reverse"), &nibRef);
	if (err) return err;
	err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &win);
	if (err) return err;
	DisposeNibReference(nibRef);

	SetupControlHandler(10,kEventControlHit,OpenEventHandler);
	SetControlAction(GetControl(11),NewControlActionUPP(VolEventHandler));
	SetControlAction(GetControl(13),NewControlActionUPP(TempoEventHandler));
	SetControlAction(GetControl(15),NewControlActionUPP(PosEventHandler));
	SetupControlHandler(16,kEventControlHit,DirEventHandler);

	EventLoopTimerRef timer;
	InstallEventLoopTimer(GetCurrentEventLoop(),kEventDurationNoWait,kEventDurationSecond/2,TimerProc,0,&timer);

	// The window was created hidden so show it.
	ShowWindow(win);
    
	// Call the event loop
	RunApplicationEventLoop();
   
	// Close output
	BASS_Free();

	return 0;
}
void initMac()
{
	//MaxApplZone();

	/*InitGraf( &qd.thePort );
	InitFonts();
	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs( nil );*/
	InitCursor();
	FlushEvents( 0, everyEvent );
}
Example #22
0
SetUpCursors()
  {
   /*========================================*/
   /* Get cursors from system resource file. */
   /*========================================*/
   
   Watch = GetCursor(watchCursor);
   
   /*============================*/
   /* Set standard cursor arrow. */
   /*============================*/
   
   InitCursor();
  }
Example #23
0
static BOOL InitResource (void)
{
    if (!InitFixStr ()) {
        fprintf (stderr, "MiniGUI: Can not initialize Fixed String heap failure!\n");
        goto failure;
    }

#ifdef _CURSOR_SUPPORT
    if (!InitCursor ()) {
        fprintf (stderr, "MiniGUI: Count not initialize mouse cursor!\n");
        goto failure;
    }
#endif

    if (!InitMenu ()) {
        fprintf (stderr, "MiniGUI: Init Menu module failure!\n");
        goto failure;
    }

    if (!InitControlClass ()) {
        fprintf(stderr, "MiniGUI: Init Control Class failure!\n");
        goto failure;
    }

    if (!InitAccel ()) {
        fprintf(stderr, "MiniGUI: Init Accelerator failure!\n");
        goto failure;
    }

    if (!InitDesktop ()) {
        fprintf (stderr, "MiniGUI: Init Desktop error!\n");
        goto failure;
    }

    if (!InitFreeQMSGList ()) {
        fprintf (stderr, "MiniGUI: Init free QMSG list error!\n");
        goto failure;
    }

    if (!InitDskMsgQueue ()) {
        fprintf (stderr, "MiniGUI: Init MSG queue error!\n");
        goto failure;
    }

    return TRUE;

failure:
    return FALSE;
}
static void
init_toolbox()
{
#ifndef USING_CARBON
	InitGraf(&qd.thePort);
	InitFonts();
	InitWindows();
	TEInit();
	InitDialogs((long)0);
	InitMenus();
	InitCursor();
#endif

	SIOUXSettings.asktosaveonclose = 0;
}
Example #25
0
void __fastcall start_game(int uMsg)
{
	cineflag = 0;
	zoomflag = 1;
	InitCursor();
	InitLightTable();
	LoadDebugGFX();
	music_stop();
	ShowProgress(uMsg);
	gmenu_init_menu();
	InitLevelCursor();
	sgnTimeoutCurs = 0;
	sgbMouseDown = 0;
	track_repeat_walk(0);
}
Example #26
0
void InitManagers(void)
{
	MaxApplZone();	
	MoreMasters(); MoreMasters(); MoreMasters();
	
	InitGraf(&qd.thePort);  
	InitFonts();			
	InitWindows();
	InitMenus();
	TEInit();				
	InitDialogs(NULL);
	
	InitCursor();		
	FlushEvents(everyEvent, 0);	
}
Example #27
0
void Initialize(void)
{
	InitGraf((Ptr) &qd.thePort);
	InitFonts();
	FlushEvents(everyEvent, 0);

	InitWindows();
	InitMenus();
	TEInit();
	InitDialogs(nil);
	InitCursor();
	
	SetUpMenus();

}
Example #28
0
SetUpCursors()
  {
   /*========================================*/
   /* Get cursors from system resource file. */
   /*========================================*/
   
   IBeam = GetCursor(iBeamCursor);
   Watch = GetCursor(watchCursor);
   ReadCursor = GetCursor(ReadCursorID);
   
   /*============================*/
   /* Set standard cursor arrow. */
   /*============================*/
   
   InitCursor();
  }
Example #29
0
play_tree_t *macosx_finder_args(m_config_t *config, int argc, char **argv) {
ProcessSerialNumber myPsn;
char myPsnStr[5+10+1+10+1];

	GetCurrentProcess(&myPsn);
	snprintf(myPsnStr, 5+10+1+10+1, "-psn_%u_%u", myPsn.highLongOfPSN, myPsn.lowLongOfPSN);
	myPsnStr[5+10+1+10]=0;

	if((argc==2) && !strcmp(myPsnStr, argv[1])) {
		m_config_set_option(config, "quiet", NULL);
		InitCursor();
		AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(AppleEventHandlerProc), 0, FALSE);
		RunApplicationEventLoop();
	}

	return files;
}
Example #30
0
File: main.c Project: prophile/dim3
void app_report_error(char *err_str)
{
#ifdef D3_OS_MAC	
	unsigned char	p_str[256];
	
	InitCursor();
	CopyCStringToPascal(err_str,p_str);
	StandardAlert(0,"\pdim3 Fatal Error",p_str,NULL,NULL);
#endif

#ifdef D3_OS_LINUX
    fprintf(stderr,"dim3 Fatal Error: %s\n", err_str);
#endif

#ifdef D3_OS_WINDOWS
	MessageBox(NULL,err_str,"dim3 Fatal Error",MB_OK);
#endif
}