Пример #1
0
int AseFile::ReadMaterialSubMaterial(zASE_Material &mat, int subMaterial)
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MATERIAL_NAME ") )			{ CopyString( temp, mat.name );			continue; }
	//	else if( EqualString( temp, "*MATERIAL_CLASS ") )		{ CopyString( temp, mat.classname );	continue; }
		else if( EqualString( temp, "*MATERIAL_AMBIENT ") )		{ CopyVector4( temp, mat.ambient );		continue; }
		else if( EqualString( temp, "*MATERIAL_DIFFUSE ") )		{ CopyVector4( temp, mat.diffuse );		continue; }
		else if( EqualString( temp, "*MATERIAL_SPECULAR ") )		{ CopyVector4( temp, mat.specular );		continue; }
		else if( EqualString( temp, "*MATERIAL_SHINE ") )		{ CopyFloat ( temp, mat.shine );		continue; }
		else if( EqualString( temp, "*MATERIAL_SHINESTRENGTH ") ){ CopyFloat ( temp, mat.shineStrength );continue; }
		else if( EqualString( temp, "*MATERIAL_TRANSPARENCY ") )	{ CopyFloat ( temp, mat.transparency );	continue; }
		else if( EqualString( temp, "*MATERIAL_WIRESIZE ") )		{ CopyFloat ( temp, mat.wiresize );		continue; }
	//	else if( EqualString( temp, "*MATERIAL_SHADING ") )		{ strcpy( mat.shading, temp);			continue; }
	//	else if( EqualString( temp, "*MATERIAL_XP_FALLOFF ") )	{ CopyFloat ( temp, mat.xp_falloff );	continue; }
		else if( EqualString( temp, "*MATERIAL_SELFILLUM ") )	{ CopyFloat ( temp, mat.selfIllum );	continue; }
	//	else if( EqualString( temp, "*MATERIAL_FALLOFF ") )		{ strcpy( mat.falloff, temp);			continue; }
	//	else if( EqualString( temp, "*MATERIAL_XP_TYPE ") )		{ strcpy( mat.xp_type, temp);			continue; }
		else if( EqualString( temp, "*MAP_DIFFUSE ") )		{ if(!ReadMaterialMap( mat, subMaterial))return 0;	continue; }
		else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #2
0
int AseFile::ReadGeomObject()
{
	char temp[255];
	zASE_Object	obj;
	memset( &obj, 0, sizeof( zASE_Object));
	obj.rotmatrix[0].set(1,0,0);
	obj.rotmatrix[1].set(0,1,0);
	obj.rotmatrix[2].set(0,0,1);
	do
	{
		if( !fgets(temp, 255, file) )return 0;
	
		if( EqualString( temp, "*NODE_NAME ") )			{ CopyString( temp, obj.name );	continue; }
		else if( EqualString( temp, "*NODE_TM ") )		{ if(!ReadNode_TM( obj ))return 0;continue; }
		else if( EqualString( temp, "*MESH ") )				
		{ if( !ReadMesh(obj) )return 0; else continue; }
	//	else if( EqualString( temp, "*PROP_MOTIONBLUR ") )			{ continue; }		// 0,1
	//	else if( EqualString( temp, "*PROP_CASTSHADOW ") )			{ continue; }		// 0,1
	//	else if( EqualString( temp, "*PROP_RECVSHADOW ") )			{ continue; }		// 0,1
	//	else if( EqualString( temp, "*WIREFRAME_COLOR ") )			{ continue; }		// 3 x float
		else if( EqualString( temp, "*MATERIAL_REF ") )			{ obj.materialID = atoi(temp); continue; }
		else ReadUnknown( temp);

	}while(!FindBracketClose( temp));		// while temp not contain '}'
	objects.push_back( obj);
	return 1;
}
Пример #3
0
int AseFile::ReadLightObjectLightSettings(z_Light &light)
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*LIGHT_COLOR ") )	{ CopyVector( temp, light.color); continue; }
		if( EqualString( temp, "*LIGHT_ATTNEND ") )	{ light.light_range = atof( temp); continue; }
		else ReadUnknown( temp);

	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #4
0
int AseFile::ReadGroup()
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*GEOMOBJECT ") )		{ if(!ReadGeomObject())return 0;	continue; }
		else if( EqualString( temp, "*LIGHTOBJECT") )	{	if(!ReadLightObject())return 0;}
	//	else if( EqualString( temp, "*HELPEROBJECT ") )	{ if(!ReadGroupHelperObject())return 0;	continue; }
		else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #5
0
ATSUFontFeatureSelector
find_selector_by_name(ATSUFontID fontID, ATSUFontFeatureType featureType, const char* name, int nameLength)
{
	ATSUFontFeatureSelector	result = 0x0000FFFF;

	Str255	inName;
	inName[0] = nameLength;
	int i;
	for (i = 0; i < inName[0]; ++i)
		inName[i + 1] = name[i];

	ItemCount	selectorCount;
	ATSUCountFontFeatureSelectors(fontID, featureType, &selectorCount);
	if (selectorCount > 0) {
		ATSUFontFeatureSelector*	selectors = (ATSUFontFeatureSelector*)xmalloc(selectorCount * sizeof(ATSUFontFeatureSelector));
		ATSUGetFontFeatureSelectors(fontID, featureType, selectorCount, selectors, 0, 0, 0);
		for (i = 0; i < selectorCount; ++i) {
			FontNameCode	nameCode;
			ATSUGetFontFeatureNameCode(fontID, featureType, selectors[i], &nameCode);
			Str255		name;
			ByteCount	nameLen;
			ATSUFindFontName(fontID, nameCode, kFontMacintoshPlatform, kFontNoScript, kFontNoLanguage,
                                 255, (Ptr)&name[1], &nameLen, 0);
			name[0] = nameLen;
			if (EqualString(inName, name, false, true)) {
				result = selectors[i];
				break;
			}
		}
		free((char*)selectors);
	}
	
	return result;
}
Пример #6
0
ATSUFontFeatureType
find_feature_by_name(ATSUFontID fontID, const char* name, int nameLength)
{
	ATSUFontFeatureType	result = 0x0000FFFF;

	Str255	inName;
	inName[0] = nameLength;
	int i;
	for (i = 0; i < inName[0]; ++i)
		inName[i + 1] = name[i];

	ItemCount	typeCount;
	ATSUCountFontFeatureTypes(fontID, &typeCount);
	if (typeCount > 0) {
		ATSUFontFeatureType*	types = (ATSUFontFeatureType*)xmalloc(typeCount * sizeof(ATSUFontFeatureType));
		ATSUGetFontFeatureTypes(fontID, typeCount, types, 0);
		for (i = 0; i < typeCount; ++i) {
			FontNameCode	nameCode;
			ATSUGetFontFeatureNameCode(fontID, types[i], 0x0000FFFF, &nameCode);
			Str255		name;
			ByteCount	nameLen;
			ATSUFindFontName(fontID, nameCode, kFontMacintoshPlatform, kFontNoScript, kFontNoLanguage,
                                 255, (Ptr)&name[1], &nameLen, 0);
			name[0] = nameLen;
			if (EqualString(inName, name, false, true)) {
				result = types[i];
				break;
			}
		}
		free((char*)types);
	}
	
	return result;
}
Пример #7
0
BOOL AFXAPI AfxComparePath(LPCTSTR lpszPath1, LPCTSTR lpszPath2)
{
#ifdef _MAC
	FSSpec fssTemp1;
	FSSpec fssTemp2;
	if (!UnwrapFile(lpszPath1, &fssTemp1) || !UnwrapFile(lpszPath2, &fssTemp2))
		return FALSE;
	return fssTemp1.vRefNum == fssTemp2.vRefNum &&
		fssTemp1.parID == fssTemp2.parID &&
		EqualString(fssTemp1.name, fssTemp2.name, false, true);
#else
	// use case insensitive compare as a starter
	if (lstrcmpi(lpszPath1, lpszPath2) != 0)
		return FALSE;

	// on non-DBCS systems, we are done
	if (!GetSystemMetrics(SM_DBCSENABLED))
		return TRUE;

	// on DBCS systems, the file name may not actually be the same
	// in particular, the file system is case sensitive with respect to
	// "full width" roman characters.
	// (ie. fullwidth-R is different from fullwidth-r).
	int nLen = lstrlen(lpszPath1);
	if (nLen != lstrlen(lpszPath2))
		return FALSE;
	ASSERT(nLen < _MAX_PATH);

	// need to get both CT_CTYPE1 and CT_CTYPE3 for each filename
	LCID lcid = GetThreadLocale();
	WORD aCharType11[_MAX_PATH];
	VERIFY(GetStringTypeEx(lcid, CT_CTYPE1, lpszPath1, -1, aCharType11));
	WORD aCharType13[_MAX_PATH];
	VERIFY(GetStringTypeEx(lcid, CT_CTYPE3, lpszPath1, -1, aCharType13));
	WORD aCharType21[_MAX_PATH];
	VERIFY(GetStringTypeEx(lcid, CT_CTYPE1, lpszPath2, -1, aCharType21));
#ifdef _DEBUG
	WORD aCharType23[_MAX_PATH];
	VERIFY(GetStringTypeEx(lcid, CT_CTYPE3, lpszPath2, -1, aCharType23));
#endif

	// for every C3_FULLWIDTH character, make sure it has same C1 value
	int i = 0;
	for (LPCTSTR lpsz = lpszPath1; *lpsz != 0; lpsz = _tcsinc(lpsz))
	{
		// check for C3_FULLWIDTH characters only
		if (aCharType13[i] & C3_FULLWIDTH)
		{
			ASSERT(aCharType23[i] & C3_FULLWIDTH); // should always match!

			// if CT_CTYPE1 is different then file system considers these
			// file names different.
			if (aCharType11[i] != aCharType21[i])
				return FALSE;
		}
		++i; // look at next character type
	}
	return TRUE; // otherwise file name is truly the same
#endif
}
Пример #8
0
/*
**	GetResRefNumFromFCB
**
**	Search open files for this resource file and return the file reference number if found.
**	Otherwise return -1.
**
*/	
static ASInt16 GetResRefNumFromFCB(ASInt16 vRefNum, ASInt32	dirID, ConstStr255Param fileName)
{
	StrFileName	fcbFileName;
	FCBPBRec	fcbPB;
	ASInt16		ioFCBIndx;
	ASInt16		plugResFile = -1;
	OSErr		err = noErr;

	/* search for open plugin resource file reference number */
/*	miMemset( &fcbPB, 0, sizeof(fcbPB) );*/ /* can not use miUtils in pdfviewer */
	memset( &fcbPB, 0, sizeof(fcbPB) );
	fcbPB.ioNamePtr = fcbFileName;
	fcbPB.ioVRefNum = vRefNum;
	for (ioFCBIndx = 1; err == noErr && plugResFile == -1; ioFCBIndx++) {
		fcbPB.ioFCBIndx = ioFCBIndx;
		err = PBGetFCBInfoSync(&fcbPB);
		if (err == noErr							&&
			fcbPB.ioFCBParID == dirID				&&
			fcbPB.ioFCBFlags & kioFCBResourceMask	&&
			EqualString(fcbFileName, fileName, true, true)	)
		{
			plugResFile = fcbPB.ioRefNum;
		}
	}

	return plugResFile;

}	/* GetResRefNumFromFCB */
Пример #9
0
int AseFile::ReadMesh_TFaceList_(zASE_Object &obj)
{
	char temp[255];
	int index=0,i;
	if( obj.numOfFaces!=0)obj.pFaceCoord_ = new zASE_Face[obj.numOfFaces];
	else return ReadUnknown( temp);
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MESH_TFACE ") )
		{
		//	*MESH_TFACE 0	9	11	10
		//	sscanf( temp, "%d", &index)
			if(index>=obj.numOfFaces)
			{
				if( FindBracketClose( temp) )return 1;
				else continue;
			}
			sscanf( temp, "%d %hu %hu %hu", &i, &obj.pFaceCoord_[index].index[0], &obj.pFaceCoord_[index].index[1], &obj.pFaceCoord_[index].index[2] );
			index++;
		}
	//	else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #10
0
int AseFile::ReadMesh_Face_List(zASE_Object &obj)
{
	char temp[255];
	int index=0,i;
	if( obj.numOfFaces!=0)obj.pFaces = new zASE_Face[obj.numOfFaces];
	else return ReadUnknown( temp);
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MESH_FACE ") )
		{
		//	*MESH_FACE    0:    A:    0 B:    2 C:    3 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 2 	*MESH_MTLID 1
		//	sscanf( temp, "%d", &index)
			if(index>=obj.numOfFaces)
			{
				if( FindBracketClose( temp) )return 1;
				else continue;
			}
			sscanf( temp, "%d: A: %hu B: %hu C: %hu", &i, &obj.pFaces[index].index[0], &obj.pFaces[index].index[1], &obj.pFaces[index].index[2] );
			index++;
		}
	//	else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #11
0
int AseFile::ReadAseFile()
{
	char temp[255];
	if(!file)return 0;

	while( fgets(temp, 255, file) )
	{
		if( EqualString( temp, "*MATERIAL_LIST") )		{	if(!ReadMaterial_List())return 0;}
		else if( EqualString( temp, "*GEOMOBJECT") )	{	if(!ReadGeomObject())return 0;}
		else if( EqualString( temp, "*GROUP") )			{	if(!ReadGroup())return 0;}
		else if( EqualString( temp, "*LIGHTOBJECT") )	{	if(!ReadLightObject())return 0;}
	//	else if( EqualString( temp, "*CAMERAOBJECT") )	{	if(!ReadCameraObject())return 0;}
		else ReadUnknown( temp);
	}
	return 1;
}
Пример #12
0
boolean SetMacroNameDialog::okCallback(Dialog *d)
{
    char *name = SetMacroNameDialog::GetTextWidgetToken(this->macroName);

    //
    // gresh889.  Set the network's name only if we're really changing it.
    // This allows the user to change the cat or descr by themselves.
    //
    if (!EqualString(name, this->network->getNameString())) {
	if (!this->verifyMacroName(name, this->network->isMacro())) {
	    delete name;
	    return FALSE;
	}

	this->network->setName(name);
    }
    delete name;

    char *cat = SetMacroNameDialog::GetTextWidgetToken(this->category);
    this->network->setCategory(cat);
    delete cat;
    char *desc = XmTextGetString(this->description);
    this->network->setDescription(desc);
    XtFree(desc);

    return TRUE;
}
Пример #13
0
int AseFile::ReadMesh_MappingChannel(zASE_Object &obj)
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
	
		else if( EqualString( temp, "*MESH_NUMTVERTEX ") )	{ obj.numOfTexVerts_ = atoi(temp); continue; }
		else if( EqualString( temp, "*MESH_TVERTLIST ") )	{ if( !ReadMesh_TVertList_(obj) )return 0; else continue; }
	//	else if( EqualString( temp, "*MESH_NUMTVFACES ") )	{ obj.numOfFaces = atoi(temp); continue; }
		else if( EqualString( temp, "*MESH_TFACELIST ") )	{ if( !ReadMesh_TFaceList_(obj) )return 0; else continue; }
		else 
			ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #14
0
boolean MacroParameterNode::netPrintAuxComment(FILE *f)
{
    if (!this->UniqueNameNode::netPrintAuxComment(f))
	return FALSE;

    ParameterDefinition *pd = this->getParameterDefinition();
#define PARAM_OFMT " parameter: position = %d, name = '%s', value = '%s'"\
		   ", descriptive = %d, description = '%s', required = %d"\
		   ", visible = %d\n"
    
    const char *dflt = pd->getDefaultValue();
    if (dflt == NULL || *dflt == '\0' || EqualString(dflt,"NULL"))
	dflt = " ";
    const char *desc = pd->getDescription();
    if (desc == NULL || *desc == '\0')
	desc = " ";

    if (fprintf(f, "    //" PARAM_OFMT,
	this->index,
	pd->getNameString(),
	dflt, 
	pd->isDefaultDescriptive(),
	desc,
	pd->isRequired(),
	pd->getDefaultVisibility()) < 0)
	return FALSE;
    return TRUE;
}
Пример #15
0
ATSUFontVariationAxis
find_axis_by_name(ATSUFontID fontID, const char* name, int nameLength)
{
	ATSUFontVariationAxis	result = 0;

	Str255	inName;
	inName[0] = nameLength;
	int i;
	for (i = 0; i < inName[0]; ++i)
		inName[i + 1] = name[i];

	ItemCount	varCount;
	ATSUCountFontVariations(fontID, &varCount);
	if (varCount > 0) {
		for (i = 0; i < varCount; ++i) {
			ATSUFontVariationAxis	axis;
			ATSUGetIndFontVariation(fontID, i, &axis, 0, 0, 0);
			FontNameCode	nameCode;
			ATSUGetFontVariationNameCode(fontID, axis, &nameCode);
			Str255		name;
			ByteCount	nameLen;
			ATSUFindFontName(fontID, nameCode, kFontMacintoshPlatform, kFontNoScript, kFontNoLanguage,
                                 255, (Ptr)&name[1], &nameLen, 0);
			name[0] = nameLen;
			if (EqualString(inName, name, false, true)) {
				result = axis;
				break;
			}
		}
	}
	
	return result;
}
//
// Build the selector interactor option menu. 
// Note that we also use this to rebuild the list of options seen in the menu
// In this case the  
//
Widget SelectorRadioInteractor::createInteractivePart(Widget form)
{
    SelectorNode	*node;
    SelectorInstance	*si = (SelectorInstance*)this->interactorInstance;
    Pixel bg,fg;
    int n;
    Arg wargs[5];

    ASSERT(si);

    node = (SelectorNode*)si->getNode();

    //ASSERT(si->getStyle()->getStyleEnum() == SelectorStyle);
    ASSERT(form);
    ASSERT(node);
    ASSERT(EqualString(node->getClassName(), ClassSelectorNode));

    this->form = form;
    XtVaGetValues (this->form, XmNbackground, &bg, XmNforeground, &fg, NULL);
    n = 0;
    XtSetArg (wargs[n], XmNbackground, bg); n++;
    XtSetArg (wargs[n], XmNforeground, bg); n++;
    this->toggleRadio = XmCreateRadioBox(form,"toggleRadio", wargs, n);
    XtManageChild(this->toggleRadio);

    // 
    // Build the option menu 
    //
    this->reloadMenuOptions();

    return this->toggleRadio;
}
Пример #17
0
int AseFile::ReadMesh_TVertList_(zASE_Object &obj)
{
	char temp[255];
	int index=0,i;
	if( obj.numOfTexVerts_!=0)obj.pTexVerts_ = new vec2[obj.numOfTexVerts_];
	else return ReadUnknown( temp);
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MESH_TVERT ") )
		{
		//	*MESH_TVERT 0	0.00000	0.00000	0.00000 
		//	sscanf( temp, "%d", &index)
			if(index>=obj.numOfTexVerts_)
			{
				if( FindBracketClose( temp) )return 1;
				else continue;
			}
			sscanf( temp, "%d %f %f", &i, &obj.pTexVerts_[index].x, &obj.pTexVerts_[index].y );
			index++;
		}
	//	else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #18
0
boolean StringTable::addString(const char* string, long& index)
{
    int key = hash(string); 
    List *l = &this->lists[key];
    ListIterator li(*l);
    char *s;

    while ( (s = (char*) li.getNext()) ) {
	if (EqualString(s,string))
	   return FALSE;
    }
 
#if  DEBUG_HASH_FUNC
    int i;
    static int hist[HASH_SIZE];
    hist[key]++;
    for (i=0 ; i<4 ; i++) {
	int j;
	for (j=0 ; j<16 ; j++) 
	    printf("%d ",hist[i*4 + j]);
	printf("\n");
    }
    printf("\n");
#endif
    //
    // The string was not found in the list, so add it.
    //
    ASSERT(l->getSize() < MAX_LISTSIZE);
    s = DuplicateString(string);
    l->appendElement((const void*)s);
    index = LISTINDEX_TO_ID(key,l->getSize());
    this->size++;
    return TRUE;
}
Пример #19
0
int AseFile::ReadMesh_Vertex_List(zASE_Object &obj)
{
	char temp[255];
	int index=0,i;
	if( obj.numOfVerts!=0)obj.pVerts = new vec[obj.numOfVerts];
	else return ReadUnknown( temp);
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MESH_VERTEX ") )
		{
		//	*MESH_VERTEX    0	-9.00000	-3.00000	3.00000
		//	sscanf( temp, "%d", &index)
			if(index>=obj.numOfVerts)
			{
				if( FindBracketClose( temp) )return 1;
				else continue;
			}
			sscanf( temp, "%d\t%f\t%f\t%f", &i, &obj.pVerts[index].x, &obj.pVerts[index].y, &obj.pVerts[index].z );
			index++;
		}
	//	else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
void ControlPanelGroupDialog::makeGroupList(int item)
{
    XmString *xmstrings;
    int      items = this->panelManager->getGroupCount();
    int      i = -1;

    if (items != 0)
    {
        xmstrings = new XmString[items];
	for(i=0; i < items; i++)
	{
            xmstrings[i] = 
		XmStringCreateSimple((char*)this->panelManager->getPanelGroup(i+1, NULL));
        }
    }
    else
    {
        items = 1;
        xmstrings = new XmString[1];
        xmstrings[0] = XmStringCreateSimple("(none)");
    }

    XtVaSetValues(this->list, 
    	XmNitemCount,        items,
    	XmNvisibleItemCount, items,
    	XmNitems,            xmstrings,
    	NULL);

    this->lastIndex = 0;

    if(i < 0 OR item == 0)
    {
	XmTextSetString(this->text, NULL);
	XtVaSetValues(this->changebtn, XmNsensitive, False, NULL);
	XtVaSetValues(this->deletebtn, XmNsensitive, False, NULL);
    	XmListDeselectAllItems(this->list);
	this->setToggles();
    }
    else
    {
	if(item > 0)
	     XmListSelectPos(this->list, item > items ? 0 : item, True);
	else
	{
	     char *name = XmTextGetString(this->text);
	     for(i=1; i<=items; i++)
		if(EqualString(name, 
			       (char*)this->panelManager->getPanelGroup(i,NULL)))
		   break;
	     XmListSelectPos(this->list, i, True);
	     XtFree(name);   //	AJ
	}
    }

    for (i=0 ; i<items ; i++)
        XmStringFree(xmstrings[i]);

    delete xmstrings;
}
Пример #21
0
boolean ReceiverNode::namesConflict (const char* his_label, const char* my_label,
                                     const char* his_classname)
{

    //
    // You can always match names with other TransmitterNodes or ReceiverNodes.
    //
    if (EqualString (his_classname, this->getClassName())) return FALSE;
    if (EqualString (his_classname, ClassTransmitterNode)) return FALSE;

    //
    // You can always use the name Receiver.
    //
    if (EqualString (my_label, "Reciever")) return FALSE;

    return this->UniqueNameNode::namesConflict (his_label, my_label, his_classname);
}
Пример #22
0
boolean PacketHandler::match(const char *s)
{
    if (s == NULL)
	return this->matchString == NULL;
    if (this->matchString == NULL)
	return FALSE;
    return EqualString(this->matchString, s);
}
Пример #23
0
int wxListBox::FindString(const wxString& s, bool bCase) const
{
    if ( s.Right(1) == wxT("*") )
    {
        wxString search = s.Left( s.length() - 1 ) ;
        int len = search.length() ;
        Str255 s1 , s2 ;
        wxMacStringToPascal( search , s2 ) ;

        for ( unsigned int i = 0 ; i < m_noItems ; ++ i )
        {
            wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;

            if ( EqualString( s1 , s2 , bCase , false ) )
                return (int)i ;
        }
        if ( s.Left(1) == wxT("*") && s.length() > 1 )
        {
            wxString st = s ;
            st.MakeLower() ;
            for ( unsigned int i = 0 ; i < m_noItems ; ++i )
            {
                if (GetString(i).Lower().Matches(st))
                    return (int)i ;
            }
        }

    }
    else
    {
        Str255 s1 , s2 ;

        wxMacStringToPascal( s , s2 ) ;

        for ( unsigned int i = 0 ; i < m_noItems ; ++ i )
        {
            wxMacStringToPascal( m_stringArray[i] , s1 ) ;

            if ( EqualString( s1 , s2 , bCase , false ) )
                return (int)i ;
        }
    }

    return wxNOT_FOUND;
}
Пример #24
0
OSErr CallImportPlug( 		MADLibrary		*inMADDriver,
													short					PlugNo,			// CODE du plug
													OSType				order,
													char					*AlienFile,
													MADMusic			*theNewMAD,
													PPInfoRec			*info)
{
	OSErr					myErr;
	short					fileID = 0;
	MADDriverSettings		driverSettings;
	CFragConnectionID		connID;
	Ptr						mainAddr;
	Str255					errName;
	static OSErr			(*mainPLUG)( OSType, char*, MADMusic*, PPInfoRec*, MADDriverSettings *);

	driverSettings.sysMemory = false;

	if( !EqualString( RSRCNAME, inMADDriver->ThePlug[ PlugNo].file.name, false, false))
	{
		fileID = FSpOpenResFile( &inMADDriver->ThePlug[ PlugNo].file, fsCurPerm);
		UseResFile( fileID);
	}
	
	myErr = GetDiskFragment( &inMADDriver->ThePlug[ PlugNo].file, 0, kCFragGoesToEOF, inMADDriver->ThePlug[ PlugNo].file.name, kLoadCFrag, &connID, (Ptr *) &mainPLUG, errName);

	if( myErr == noErr)
	{
		myErr = mainPLUG ( order, AlienFile, theNewMAD, info, &driverSettings);
		
//			DisposePtr( (Ptr) mainPLUG);
		
		CloseConnection( &connID);
	}

//	myErr = TESTmain( order, AlienFile, theNewMAD, info, &driverSettings);
	
	if( !EqualString( RSRCNAME, inMADDriver->ThePlug[ PlugNo].file.name, false, false))
		CloseResFile( fileID);
	
//	theNewMAD->currentDriver = NULL;
	
	return( myErr);
}
Пример #25
0
int AseFile::ReadMesh_Normals(zASE_Object &obj)
{
	char temp[255];
	int index=0,i;
	if( obj.numOfVerts!=0)obj.pNormals = new vec[obj.numOfVerts];
	else return ReadUnknown( temp);
	if( obj.numOfFaces!=0)obj.pFaceNormals = new vec[obj.numOfFaces];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
	//	*MESH_FACENORMAL 0	0.00000	0.00000	-1.00000
	//		*MESH_VERTEXNORMAL 0	0.00000	0.00000	-1.00000
	//		*MESH_VERTEXNORMAL 2	0.00000	0.00000	-1.00000
	//		*MESH_VERTEXNORMAL 3	0.00000	0.00000	-1.00000

		if( EqualString( temp, "*MESH_FACENORMAL ") )
		{
			sscanf( temp, "%d", &index);
			if(index>=obj.numOfFaces || index<0)continue;
		//	sscanf( temp, "%d %f %f %f", &i, &obj.pFaceNormals[index].x, &obj.pFaceNormals[index].y, &obj.pFaceNormals[index].z );
			vec in;	sscanf( temp, "%d %f %f %f", &i, &in.x, &in.y, &in.z );
			obj.pFaceNormals[index].x = DOT3( obj.rotmatrix[0], in );
			obj.pFaceNormals[index].y = DOT3( obj.rotmatrix[1], in );
			obj.pFaceNormals[index].z = DOT3( obj.rotmatrix[2], in );
			obj.pFaceNormals[index].Normalize();

		}
		else if (EqualString( temp, "*MESH_VERTEXNORMAL "))
		{
			sscanf( temp, "%d", &index);
			if(index>=obj.numOfVerts || index<0)continue;
		//	sscanf( temp, "%d %f %f %f", &i, &obj.pNormals[index].x, &obj.pNormals[index].y, &obj.pNormals[index].z );
			vec in;	sscanf( temp, "%d %f %f %f", &i, &in.x, &in.y, &in.z );
			obj.pNormals[index].x = DOT3( obj.rotmatrix[0], in );
			obj.pNormals[index].y = DOT3( obj.rotmatrix[1], in );
			obj.pNormals[index].z = DOT3( obj.rotmatrix[2], in );
		//	obj.pNormals[index].Normalize();
		}
	//	ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #26
0
int AseFile::ReadLightObjectNodeTM(z_Light &light)
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*TM_POS ") )	{ CopyVector( temp, light.lpos); continue; }
		else ReadUnknown( temp);

	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #27
0
int AseFile::ReadMaterial_List()
{
	char temp[255];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
		if( EqualString( temp, "*MATERIAL ") )	{	if( !ReadMaterial(atoi(temp)) )return 0; }
	//	else if( EqualString( temp, "*MATERIAL_COUNT ") ) numOfMat=atoi(temp);
		else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	return 1;
}
Пример #28
0
//----------------------------------------------------------------------------------------
PRBool nsFileSpec::operator == (const nsFileSpec& inOther) const
//----------------------------------------------------------------------------------------
{

#if defined(XP_MAC)
    if ( inOther.mSpec.vRefNum == mSpec.vRefNum &&
        inOther.mSpec.parID   == mSpec.parID &&
        EqualString(inOther.mSpec.name, mSpec.name, false, true))
        return PR_TRUE;
#else
    PRBool amEmpty = mPath.IsEmpty();
    PRBool heEmpty = inOther.mPath.IsEmpty();
    if (amEmpty) // we're the same if he's empty...
        return heEmpty;
    if (heEmpty) // ('cuz I'm not...)
        return PR_FALSE;
    
    nsSimpleCharString      str = mPath;
    nsSimpleCharString      inStr = inOther.mPath;
    
    // Length() is size of buffer, not length of string
    PRUint32 strLast = str.Length() - 1, inLast = inStr.Length() - 1;
#if defined(XP_WIN) || defined(XP_OS2)
#define DIR_SEPARATOR '\\'      // XXX doesn't NSPR have this?
    /* windows does not care about case. */
#ifdef XP_OS2
#define DIR_STRCMP     strcmp
#else
#define DIR_STRCMP    _stricmp
#endif
#else
#define DIR_SEPARATOR '/'
#if defined(VMS)
#define DIR_STRCMP     strcasecmp
#else
#define DIR_STRCMP     strcmp
#endif
#endif
    
    if(str[strLast] == DIR_SEPARATOR)
        str[strLast] = '\0';

    if(inStr[inLast] == DIR_SEPARATOR)
        inStr[inLast] = '\0';

    if (DIR_STRCMP(str, inStr ) == 0)
           return PR_TRUE;
#undef DIR_SEPARATOR
#undef DIR_STRCMP
#endif
   return PR_FALSE;
}
Пример #29
0
int AseFile::ReadNode_TM(zASE_Object &obj)
{
	char temp[255];
	vec row[3];
	do
	{
		if( !fgets(temp, 255, file) )return 0;
	
		if( EqualString( temp, "*TM_ROW0 ") )		{ CopyVector( temp, row[0]); continue; }
		else if( EqualString( temp, "*TM_ROW1 ") )	{ CopyVector( temp, row[1]); continue; }
		else if( EqualString( temp, "*TM_ROW2 ") )	{ CopyVector( temp, row[2]); continue; }
	//	else if( EqualString( temp, "*TM_POS ") )	{ CopyVector( temp, obj.pos); continue; }
		else ReadUnknown( temp);
	}while(!FindBracketClose( temp));		// while temp not contain '}'
	obj.rotmatrix[0].set( row[0].x, row[1].x, row[2].x);
	obj.rotmatrix[1].set( row[0].y, row[1].y, row[2].y);
	obj.rotmatrix[2].set( row[0].z, row[1].z, row[2].z);
	obj.rotmatrix[0].Normalize();
	obj.rotmatrix[1].Normalize();
	obj.rotmatrix[2].Normalize();
	return 1;
}
Пример #30
-1
P1(PUBLIC pascal trap, INTEGER, OpenDeskAcc, Str255, acc)	/* IMI-440 */
{
    INTEGER retval;
    DCtlHandle dctlh;
    WindowPtr wp;

    if (EqualString (acc, about_box_menu_name_pstr, TRUE, TRUE))
      {
	do_about_box ();
	retval = 0;
	goto done;
      }

    if (OpenDriver(acc, &retval) == noErr) {
	retval = CW(retval);
	dctlh = GetDCtlEntry(retval);
	if (dctlh)
	  {
	    wp = HxP(dctlh, dCtlWindow);
	    if (wp)
	      {
		ShowWindow(wp);
		SelectWindow(wp);
	      }
	  }
    }

  done:

    SEvtEnb = TRUE;
    return retval;
}