Пример #1
0
/*	XOPEmergencyAlert(message)
	
	This routine used by the XOP Toolkit for dire emergencies only.
	You should not need it. Use XOPOKAlert instead.
	
	Thread Safety: XOPEmergencyAlert is not thread-safe.
*/
void
XOPEmergencyAlert(const char* message)
{
	Str255 pTitle;
	Str255 pMessage;
	SInt16 itemHit;
	
	CopyCStringToPascal("Emergency", pTitle);
	CopyCStringToPascal(message, pMessage);
	StandardAlert(kAlertStopAlert, pTitle, pMessage, NULL, &itemHit);
}
Пример #2
0
Файл: MacGraph.c Проект: rolk/ug
static INT GraphOpen (GRAPH_WINDOW *gw, const char *title, short h, short v, short dh, short dv)
{
  WindowPtr MacWin;
  GrafPtr myPort;
  PaletteHandle myPalette;
  Str255 pstr;

  MacWin = MAC_WIN(gw);

  /* read in resources */
  if (GetNewCWindow(GRAPH_RSRC_ID,(Ptr) MacWin,(WindowPtr) -1)==NULL)
    return (1);

  myPalette = GetNewPalette(PALETTE_RSRC_ID);
  SetPalette(MacWin,myPalette,FALSE);

  /* move and size window */
  myPort = (GrafPtr) MacWin;
  SetPort(myPort);
  MoveWindow(MacWin,h,v,false);
  SizeWindow(MacWin,dh,dv,false);
  CopyCStringToPascal(title,pstr);
  SetWTitle(MacWin,pstr);
  ShowWindow(MacWin);
  SelectWindow(MacWin);
  DrawGrowIcon(MacWin);

  return (0);
}
Пример #3
0
/*	DrawDialogCmd(cmd, lineHeight)

	Draws command starting from current pen loc.
	This is a help routine for DisplayDialogCmd.

	Thread Safety: DrawDialogCmd is not thread-safe.
*/
static void
DrawDialogCmd(const char *cmd, int lineHeight)
{
	PenState penState;
	char temp[MAXCMDLEN+1];
	const char *p1, *p2;
	int done = FALSE;
	int h, v;
	int len;
	
	GetPenState(&penState);
	h = penState.pnLoc.h;
	v = penState.pnLoc.v;
	
	p1 = cmd;								// p1 marches through command.
	do {
		p2 = strchr(p1, 0x0d);				// Find CR.
		if (p2 == NULL) {					// No more CRs ?
			strcpy(temp, p1);
			done = TRUE;
		}
		else {
			len = p2-p1;
			strncpy(temp, p1, len);
			temp[len] = 0;
		}
		
		CopyCStringToPascal(temp, (unsigned char*)temp);
		DrawString((unsigned char*)temp);
		
		v += lineHeight;					// Move to next line.
		MoveTo(h, v);
		p1 = p2+1;							// Point to start of next line.
	} while (!done);
}
// ---------------------------------------------------------------------------
//  MacOSTransService: The protected virtual transcoding service API
// ---------------------------------------------------------------------------
XMLTranscoder*
MacOSUnicodeConverter::makeNewXMLTranscoder(const   XMLCh* const		encodingName
                                        ,       XMLTransService::Codes& resValue
                                        , const XMLSize_t               blockSize
                                        ,       MemoryManager* const    manager)
{
	XMLTranscoder* result = NULL;
	resValue = XMLTransService::Ok;
	
	TextToUnicodeInfo textToUnicodeInfo = NULL;
	UnicodeToTextInfo unicodeToTextInfo = NULL;

	//	Map the encoding to a Mac OS Encoding value
	Str255 pasEncodingName;
	char cEncodingName[256];
	ConvertWideToNarrow(encodingName, cEncodingName, sizeof(cEncodingName));
	CopyCStringToPascal(cEncodingName, pasEncodingName);
	
	TextEncoding textEncoding = 0;
	OSStatus status = TECGetTextEncodingFromInternetName (
							&textEncoding,
							pasEncodingName);
                            
    //  Make a transcoder for that encoding
	if (status == noErr)
		result = makeNewXMLTranscoder(encodingName, resValue, blockSize, textEncoding, manager);
	else
		resValue = XMLTransService::UnsupportedEncoding;
	
	return result;
}
Пример #5
0
static
void text_routine(double x, double y, int nchars, char *chars)
{
  int i, ch, xstart, ystart, width, height;
  double xrel, yrel, ax, ay;
  unsigned char *s;
  Str255 dst;

  s = (unsigned char *) malloc(nchars + 1);
  for (i = 0; i < nchars; i++)
    {
      ch = chars[i];
      if (ch < 0)
	ch += 256;
      s[i] = p->family == 3 ? ch : iso2mac[ch];
    }
  s[nchars] = '\0';
  CopyCStringToPascal((char *) s, dst);

  NDC_to_DC(x, y, xstart, ystart);

  width = StringWidth(dst);
  height = p->capheight;

  xrel = width * xfac[gkss->txal[0]];
  yrel = p->capheight * yfac[gkss->txal[1]];
  CharXform(xrel, yrel, ax, ay);
  xstart += (int)ax;
  ystart -= (int)ay;

  draw_string(xstart, ystart, width, height, dst);

  free(s);
}
Пример #6
0
// ---------------------------------------------------------------------------
void OSXWindowImpl::init_glfont()
{
  SInt16 fontid;
  unsigned char pname[256];
  CopyCStringToPascal("systemFont",pname);
  GetFNum(pname,&fontid);
  GLuint first = GL_BITMAP_FONT_FIRST_GLYPH;
  GLuint last = GL_BITMAP_FONT_LAST_GLYPH;
  GLuint count = last-first+1;
  GLuint listBase = glGenLists(count);
  GLboolean success = aglUseFont(
    mGLContext,
    fontid,
    normal,
    12, // GLsizei
    first,
    count, 
    listBase
  );
  assert(success == GL_TRUE);
  font.firstGlyph = first;
  font.listBase = listBase - first;
  font.widths = new unsigned int[count];
  for (int i=0;i<count;++i)
    font.widths[i] = 8;
}
Пример #7
0
    //------------------------------------------------------------------------
    bool pixel_map::save_as_qt(const char *filename) const
    {
		FSSpec						fss;
 		OSErr						err;
		
		// get file specification to application directory
		err = HGetVol(nil, &fss.vRefNum, &fss.parID);
		if (err == noErr)
		{
     		GraphicsExportComponent		ge;
  			CopyCStringToPascal(filename, fss.name);
  			// I decided to use PNG as output image file type.
  			// There are a number of other available formats.
  			// Should I check the file suffix to choose the image file format?
			err = OpenADefaultComponent(GraphicsExporterComponentType, kQTFileTypePNG, &ge);
			if (err == noErr)
			{
    			err = GraphicsExportSetInputGWorld(ge, m_pmap);
	    		if (err == noErr)
    			{
    				err = GraphicsExportSetOutputFile (ge, &fss);
    				if (err == noErr)
    				{
    					GraphicsExportDoExport(ge, nil);
    				}
    			}
    			CloseComponent(ge);
    		}
    	}
    	
        return err == noErr;
    }
Пример #8
0
int SetFileComment(std::string spath, std::string scomment) {
	const char *path = spath.c_str();
	const char *comment = scomment.c_str();
	OSErr err = noErr;
	FSRef fileRef;
	FSSpec fileSpec;

	// see if the file in question exists and we can write it
	if (access(path, R_OK | W_OK | F_OK) == - 1) {
		return 1;
	}

	// get file reference from path
	err = FSPathMakeRef( (const UInt8 *) path, &fileRef, NULL);
	if (err != noErr) {
		return 1;
	}

	// retrieve filespec from file ref
	err = FSGetCatalogInfo(&fileRef, NULL, NULL, NULL, &fileSpec, NULL);
	if (err != noErr) {
		return 1;
	}
	// being by setting MacOS X Finder Comment
	Str255 pCommentStr;
	CopyCStringToPascal(comment, pCommentStr);
	err = MoreFESetComment(&fileSpec, pCommentStr, NULL);
	if (err != noErr) {
		return 1;
	}
	return 0;
}
Пример #9
0
int PathToDir(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
	/* Fill in the given string with the full path from a root volume to
	   to given  directory.
	*/
        CopyCStringToPascal(":",where->name);
	return PathToFile(pathName,pathNameMax,where,encoding);  
}
Пример #10
0
static
void set_font(int font)
{
  double rad, scale, ux, uy;
  int family, size, angle;
  double width, height, capheight;
  StyleParameter face;
  Str255 name;

  font = abs(font);
  if (font >= 101 && font <= 129)
    font -= 100;
  else if (font >= 1 && font <= 32)
    font = map[font - 1];
  else
    font = 9;

  WC_to_NDC_rel(gkss->chup[0], gkss->chup[1], gkss->cntnr, ux, uy);
  seg_xform_rel(&ux, &uy);

  rad = -atan2(ux, uy);
  angle = (int)(rad * 180 / M_PI + 0.5);
  if (angle < 0) angle += 360;
  p->path = ((angle + 45) / 90) % 4;

  scale = sqrt(gkss->chup[0] * gkss->chup[0] + gkss->chup[1] * gkss->chup[1]);
  ux = gkss->chup[0] / scale * gkss->chh;
  uy = gkss->chup[1] / scale * gkss->chh;
  WC_to_NDC_rel(ux, uy, gkss->cntnr, ux, uy);

  width = 0;
  height = sqrt(ux * ux + uy * uy);
  seg_xform_rel(&width, &height);

  height = sqrt(width * width + height * height);
  capheight = nint(height * (fabs(p->c) + 1));
  p->capheight = nint(capheight);

  size = nint(capheight / capheights[font - 1]);
  if (font > 13)
    font += 3;
  p->family = (font - 1) / 4;
  face = (font % 4 == 1 || font % 4 == 2) ? normal : bold;
  if (font % 4 == 2 || font % 4 == 0)
    face |= italic;

  CopyCStringToPascal(fonts[p->family], name);
  family = FMGetFontFamilyFromName(name);
  if (family != kInvalidFontFamily)
    {
      TextFont(family);
      TextFace(face);
      TextSize(size);
    }
  else
    gks_perror("invalid font family (%s)", fonts[p->family]);
}
Пример #11
0
static void 	Quartz_Deactivate(NewDevDesc *dd)
{
	Str255	Title;
	char	buffer[250];
	QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
	int devnum = devNumber((DevDesc *)dd);

	sprintf(buffer,"Quartz (%d) - Not Active",devnum+1);
	CopyCStringToPascal(buffer,Title);
	SetWTitle(xd->window,Title);
	ShowWindow(xd->window);
}
Пример #12
0
Font::Font()
{
  _id = glGenLists(96);

#ifdef __APPLE__
  Str255 fontName;
  CopyCStringToPascal("Arial", fontName);
  _fontType = FMGetFontFamilyFromName(fontName);
  assert(_fontType != kInvalidFontFamily);
  aglUseFont(aglGetCurrentContext(), _fontType, bold, 16, 32, 96, _id);
#endif
}
Пример #13
0
// Reports an interpretation error
void XML_ResourceFork::ReportInterpretError(const char *ErrorString)
{
#ifdef TARGET_API_MAC_CARBON
    if (GetNumInterpretErrors() < MaxErrorsToShow) {
        SimpleAlert(kAlertNoteAlert,ErrorString);
    }
#else
    CopyCStringToPascal(ErrorString, ptemporary);
    ParamText(ptemporary,0,0,0);
    if (GetNumInterpretErrors() < MaxErrorsToShow) {
        Alert(NonFatalErrorAlert,NULL);
    }
#endif
}
Пример #14
0
static void Quartz_SetFont(char *family,
			   int style,  double cex, double ps, NewDevDesc *dd)
{
    QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
    int size = cex * ps + 0.5;
    FMFontFamily CurrFontId;
    GrafPtr 	savePort;
    Str255	CurrFontName;
    char	CurrFont[256];
	char *fontFamily;
	
	 
    GetPort(&savePort);
    SetPortWindowPort(xd->window);
    

	fontFamily = Quartz_TranslateFontFamily(family, style, xd->family);
	 if (fontFamily)
	     strcpy(CurrFont,fontFamily);
	 else
	     strcpy(CurrFont,"Helvetica");

	if(style==5)
		strcpy(CurrFont, "Symbol");

	

	if(strcmp(CurrFont,"Symbol")==0){
		if(WeAreOnPanther)
	     CGContextSelectFont( GetContext(xd), CurrFont, size, 
				  kCGEncodingFontSpecific);
		else 
	     CGContextSelectFont( GetContext(xd), CurrFont, size, 
				  kCGEncodingMacRoman);
	}
	else CGContextSelectFont( GetContext(xd), CurrFont, size, 
			      kCGEncodingMacRoman);	



/* This is needed for test only purposes 
    if(strcmp(CurrFont,"Symbol")==0)
     CGContextSelectFont( GetContext(xd), CurrFont, size, kCGEncodingFontSpecific);
*/
    CopyCStringToPascal(CurrFont,CurrFontName);
    GetFNum(CurrFontName, &CurrFontId);
    TextSize(size);
    TextFont(CurrFontId);
    SetPort(savePort);
}
Пример #15
0
Файл: MacGraph.c Проект: rolk/ug
static void MacintoshDrawText (const char *s, INT mode)
{
  Str255 pstr;

  switch(mode)
  {
  case TEXT_REGULAR : TextMode(srcOr); break;
  case TEXT_INVERSE : TextMode(srcXor); break;
  default : return;
  }
  CopyCStringToPascal(s,pstr);
  DrawString(pstr);
  TextMode(srcOr);
}
Пример #16
0
	void CheckForError( int line, const char *file, int error )
	{
	
		if( noErr != error )
		{
			char	cString[256];
			Str255	pString;
		
			sprintf( cString, "Found Error # %i at line %i of file: %s\n", error, line, file ); 			
			CopyCStringToPascal( cString, pString );
			
			DebugStr( pString );
		}		
	}
Пример #17
0
/*	SetDText(theDialog, theItem, theText)

	Sets text in text item in dialog.

	Thread Safety: SetDText is not thread-safe.
*/
void
SetDText(DialogPtr theDialog, int theItem, const char *theText)
{
	ControlHandle controlH;
	unsigned char temp[256];

	// According to Apple, this is the correct routine to use to get a handle
	// to pass to SetDialogItemText, when embedding (kDialogFlagsUseControlHierarchy)
	// is on.
	if (XOPGetDialogItemAsControl(theDialog, theItem, &controlH) == 0) {
		CopyCStringToPascal(theText, temp);
		SetDialogItemText((Handle)controlH, temp);
	}
}
void HIDReportError (char * strError)
{
	char errMsgCStr [256];

	sprintf (errMsgCStr, "%s", strError); 

	// out as debug string
#ifdef kVerboseErrors
	{
		Str255 strErr = "\p";
		CopyCStringToPascal (errMsgCStr, strErr);
		DebugStr (strErr);
	}
#endif // kVerboseErrors
}
Пример #19
0
void *  ioFindExternalFunctionIn(char *lookupName, void * moduleHandle) {
	CFragSymbolClass ignored;
	Ptr functionPtr = 0;
	OSErr err;
        Str255 tempLookupName;
    
	if (!moduleHandle) return 0;

	/* get the address of the desired primitive function */
	CopyCStringToPascal(lookupName,tempLookupName);
	err = FindSymbol(
		(CFragConnectionID) moduleHandle, (unsigned char *) tempLookupName,
		&functionPtr, &ignored);
	if (err) 
	    return 0;
	return (void *) functionPtr;
}
Пример #20
0
static int
DoXOPAlert(short dlogID, const char* title, const char* message)
{
	DialogPtr theDialog;
	WindowRef theWindow;
	short hit;
	unsigned char temp[256];
	int result = 0;

	ArrowCursor();

	paramtext(message, "", "", "");

	theDialog = GetNewDialog(dlogID, NULL, (WindowPtr)-1L);		// This must access Igor's data fork which contains the DLOG resources for these dialogs.
	if (theDialog == NULL)
		return -1;
	theWindow = GetDialogWindow(theDialog);
	if (theWindow == NULL)
		return -1;
	
	CopyCStringToPascal(title, temp);
	SetWTitle(theWindow, temp);
	
	ShowDialogWindow(theDialog);
	do {
		ModalDialog(NULL, &hit);
		switch(hit) {
			case 1:						// OK or Yes.
				result = 1;
				break;
			case 2:						// No or Cancel.
				if (dlogID == IGOR_OK_CANCEL_DLOG)
					result = -1;		// Cancel result is -1.
				else
					result = 2;
				break;
			case 3:						// Cancel.
				result = -1;
				break;
		}
	} while(result == 0);
	
	DisposeDialog(theDialog);

	return result;
}
Пример #21
0
/* FSSpec -> FSRef -> URL(Unix) -> HPFS+ */
int PathToFile(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {        
        CFURLRef sillyThing;
        CFStringRef filePath;
        FSSpec	failureRetry;
        FSRef	theFSRef;
        OSErr	error;
        Boolean isDirectory=false,retryWithDirectory=false;
        char	rememberName[256];
        
        *pathName = 0x00;
        error = FSpMakeFSRef (where, &theFSRef);
        if (error != noErr) {
            retryWithDirectory = true;
            failureRetry = *where;
            CopyCStringToPascal(":",failureRetry.name);
            CopyPascalStringToC(where->name,(char *) &rememberName);
            error = FSpMakeFSRef(&failureRetry,&theFSRef);
            if (error != noErr) 
                return -1;
	}
        
        sillyThing =  CFURLCreateFromFSRef (kCFAllocatorDefault, &theFSRef);
        isDirectory = CFURLHasDirectoryPath(sillyThing);
        
        filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
        CFRelease(sillyThing);
        
  		CFMutableStringRef mutableStr= CFStringCreateMutableCopy(NULL, 0, filePath);
          CFRelease(filePath);
  
  		// HFS+ imposes Unicode2.1 decomposed UTF-8 encoding on all path elements
  		if (gCurrentVMEncoding == kCFStringEncodingUTF8) 
  			CFStringNormalize(mutableStr, kCFStringNormalizationFormKC); // pre-combined
  
          CFStringGetCString (mutableStr, pathName,pathNameMax, encoding);
        
        if (retryWithDirectory) {
            strcat(pathName,":");
            strcat(pathName,rememberName);
            isDirectory = false;
        }
        if (isDirectory)
            strcat(pathName,":");
        return 0;
}
Пример #22
0
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
}
Пример #23
0
Файл: MacGraph.c Проект: rolk/ug
void DrawInfoBox (WINDOWID win, const char *info)
{
  WindowPtr theMacWindow;
  Rect r,box,WinRect;
  CGrafPtr myPort;
  Rect myClipRect;
  short w;
  GRAPH_WINDOW *gw;
  Str255 pstr;

  gw = (GRAPH_WINDOW *)win;
  theMacWindow = MAC_WIN(gw);
  /* set port */
  myPort = GetWindowPort(theMacWindow);
  SetPort(myPort);

  GetPortBounds(myPort,&WinRect);

  PmForeColor(1);               /* black */
  GetPortBounds(myPort,&r);

  /* info box */
  SetRect(&box,r.left+1,r.bottom-14,r.right-121,r.bottom);

  /* set clipping region to info box */
  ClipRect(&box);

  EraseRect(&box);

  CopyCStringToPascal(info,pstr);
  w = StringWidth(pstr);
  MoveTo((box.left+box.right)/2-w/2,box.bottom-3);
  TextSize(9);
  DrawString(pstr);

  /* adjust clipping rectangle again to plottable area */
  myClipRect.left   = gw->Local_LL[0];
  myClipRect.right  = gw->Local_UR[0];
  myClipRect.bottom = gw->Local_LL[1];
  myClipRect.top    = gw->Local_UR[1];

  ClipRect(&myClipRect);
}
Пример #24
0
Файл: MacGraph.c Проект: rolk/ug
static void MacCenteredText (SHORT_POINT point, const char *s, INT mode)
{
  short ts,w;
  Str255 pstr;

  ts = currgw->textSize;

  switch(mode)
  {
  case TEXT_REGULAR : TextMode(srcOr); break;
  case TEXT_INVERSE : TextMode(srcXor); break;
  default : return;
  }
  CopyCStringToPascal(s,pstr);
  w = StringWidth(pstr);
  MoveTo(point.x-w/2,point.y+ts/2);
  DrawString(pstr);
  TextMode(srcOr);
}
Пример #25
0
Handle getPtrDataRef(unsigned char *data, unsigned int size, const std::string &filename)
{
     // Load Data Reference
     Handle dataRef;
     Handle fileNameHandle;
     PointerDataRefRecord ptrDataRefRec;
     ComponentInstance dataRefHandler;
     unsigned char pstr[255];
 
     ptrDataRefRec.data = data;
     ptrDataRefRec.dataLength = size;
 
     /*err = */PtrToHand(&ptrDataRefRec, &dataRef, sizeof(PointerDataRefRecord));
 
     // Open a Data Handler for the Data Reference
     /*err = */OpenADataHandler(dataRef, PointerDataHandlerSubType, NULL,
         (OSType)0, NULL, kDataHCanRead, &dataRefHandler);
 
     // Convert From CString in filename to a PascalString in pstr
     if (filename.length() > 255) {
         //hmm...not good, pascal string limit is 255!
         //do some error handling maybe?!
         throw QTImportExportException(0, "filename length limit exceeded");
     }
     CopyCStringToPascal(filename.c_str(), pstr);
 
    // Add filename extension
     /*err = */PtrToHand(pstr, &fileNameHandle, filename.length() + 1);
     /*err = */DataHSetDataRefExtension(dataRefHandler, fileNameHandle,
         kDataRefExtensionFileName);
     DisposeHandle(fileNameHandle);
 
     // Release old handler which does not have the extensions
     DisposeHandle(dataRef);
 
     // Grab the SAFE_NEW version of the data ref from the data handler
     /*err = */ DataHGetDataRef(dataRefHandler, &dataRef);
     
     CloseComponent(dataRefHandler);
     
     return dataRef;
}
Пример #26
0
void app_report_error_ask_fix_setup(char *err_str)
{
#ifdef D3_OS_MAC	
	short					hit;
	char					str[256];
	unsigned char			p_str[256];
	AlertStdAlertParamRec	alert_param;
	
	InitCursor();
	
	memset(&alert_param,0x0,sizeof(AlertStdAlertParamRec));
	alert_param.defaultText="\pYes";
	alert_param.cancelText="\pNo";
	alert_param.defaultButton=kAlertStdAlertOKButton;
	alert_param.position=kWindowDefaultPosition;
	
	strcpy(str,err_str);
	strncat(str,"\n\nClick the Yes button if you want dim3 to reset your setup to their default values.  This might allow you to start the application properly.",256);
	str[255]=0x0;
	
	CopyCStringToPascal(str,p_str);

	StandardAlert(0,"\pdim3 Fatal Error",p_str,&alert_param,&hit);
	
	if (hit==kAlertStdAlertOKButton) setup_restore();
#endif

#ifdef D3_OS_LINUX
	app_report_error("Check your setup files.");
#endif

#ifdef D3_OS_WINDOWS
	char			str[1024];

	strcpy(str,err_str);
	strncat(str,"\n\nClick the Yes button if you want dim3 to reset your setup to their default values.  This might allow you to start the application properly.",1024);
	str[1023]=0x0;

	if (MessageBox(NULL,str,"dim3 Fatal Error",MB_YESNO)==IDYES) setup_restore();
#endif
}
Пример #27
0
static void 	Quartz_Activate(NewDevDesc *dd)
{
	Str255	Title;
	char	buffer[250];
	QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
	int devnum = devNumber((DevDesc *)dd);
        OSStatus err;

	sprintf(buffer,"Quartz (%d) - Active",devnum+1);
	CopyCStringToPascal(buffer,Title);
	SetWTitle(xd->window,Title);

/*
   We add a property to the Window each time we activate it.
   We should only make this the first time we open the device.
*/
        err = SetWindowProperty(xd->window,kRAppSignature,'QRTZ',sizeof(int),&devnum);

	ShowWindow(xd->window);

}
Пример #28
0
void Error( const char* extra )
{
#if TARGET_API_MAC_CARBON
	Str255 myString, extraP;
	
	CopyCStringToPascal( extra, extraP );
	ReleaseMonitor( );
	GetIndString( myString, 131, errUnknown );
	ParamText( myString, extraP, "\p", "\p" );
	Alert( dFatalErrorAlert, NULL );
	ExitToShell( );
#else
	char message[256];
	sprintf( message, "Sorry, a critical error has occurred. Please report the following error message:\n    %s", extra );
	#if WIN32
		MessageBox( NULL, message, "Candy Crisis", MB_OK );
	#else
		fprintf(stderr, "Candy Crisis: %s\n", message);
	#endif
	exit(0);
#endif
}
Пример #29
0
    // I let Quicktime handle image import since it supports most popular
    // image formats such as:
    // *.psd, *.bmp, *.tif, *.png, *.jpg, *.gif, *.pct, *.pcx
    //------------------------------------------------------------------------
    bool pixel_map::load_from_qt(const char *filename)
    {
		FSSpec						fss;
		OSErr						err;
		
		// get file specification to application directory
		err = HGetVol(nil, &fss.vRefNum, &fss.parID);
		if (err == noErr)
		{
			CopyCStringToPascal(filename, fss.name);
			GraphicsImportComponent		gi;
			err = GetGraphicsImporterForFile (&fss, &gi);
			if (err == noErr)
			{
				ImageDescriptionHandle	desc;
				GraphicsImportGetImageDescription(gi, &desc);
// For simplicity, all images are currently converted to 32 bit.
				// create an empty pixelmap
				short depth = 32;
				create ((**desc).width, (**desc).height, (org_e)depth, 0xff);
				DisposeHandle ((Handle)desc);
				// let Quicktime draw to pixelmap
				GraphicsImportSetGWorld(gi, m_pmap, nil);
				GraphicsImportDraw(gi);
// Well, this is a hack. The graphics importer sets the alpha channel of the pixelmap to 0x00
// for imported images without alpha channel but this would cause agg to draw an invisible image.
				// set alpha channel to 0xff
				unsigned char * buf = m_buf;
				for (unsigned int size = 0; size < m_img_size; size += 4)
				{
					*buf = 0xff;
					buf += 4;
				}
			}
		}
        return err == noErr;
    }
Пример #30
0
int PathToDir(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
    CopyCStringToPascal(":",where->name);
	return PathToFile(pathName,pathNameMax,where,encoding);  
}