Exemple #1
0
/*	XOPEntry()

	This is the entry point from the host application to the XOP when the message specified by the
	host is other than INIT.
*/
extern "C" void
XOPEntry(void)
{	
	XOPIORecResult result = 0;
	
	switch (GetXOPMessage()) {
		case MENUITEM:								// XOPs menu item selected.
			XOPMenuItem();
			break;

		case MENUENABLE:							// Enable/disable XOPs menu item.
			XOPMenuEnable();
			break;
			
		case EXECUTE_OPERATION:
			{
				void* params;
				params = (void*)GetXOPItem(1);
				result = ExecuteMenuXOP1((MenuXOP1RuntimeParams*)params);
			}
			break;
	}
	
	SetXOPResult(result);
}
Exemple #2
0
/*	DoFunction()
	
	Igor calls this when the user invokes one if the XOP's XFUNCs
	if we returned NIL for the XFUNC from RegisterFunction. In this
	XOP, we always use the direct XFUNC method, so Igor will never call
	this function. See XOP manual regarding "Direct XFUNCs".
*/
static int DoFunction()
{
	int funcIndex;
	void *p;				// Pointer to structure containing function parameters and result.
	int err;

	funcIndex = GetXOPItem(0);		// Which function is being invoked ?
	p = (void *)GetXOPItem(1);		// Get pointer to params/result.
	switch (funcIndex) {
		case 0:
			err = srLoop(p);
			break;
		case 1:
			err = srWfrFromTrj(p);
			break;
		case 2:
			err = srWfrIsotrSrc(p);
			break;
		case 3:
			err = srWfrGsnBeam(p);
			break;
		case 4:
			err = srWfrSASE(p);
			break;
		case 5:
			err = srTraj(p);
			break;
		case 6:
			err = srVerNo(p);
			break;
		case 7:
			err = srRadMom(p);
			break;
		case 8:
			err = srFFT1D(p);
			break;
		case 9:
			err = srFFT2D(p);
			break;
		case 10:
			err = srRadResizeXZ(p);
			break;
		case 11:
			err = srObsSetNxNz(p);
			break;
		case 12:
			err = srRadPropag(p);
			break;
		case 13:
			err = srWfrPropag(p);
			break;
		case 14:
			err = srRadExtract(p);
			break;
		case 15:
			err = srStokesUnd(p);
			break;
		case 16:
			err = srStokesWig(p);
			break;
		case 17:
			err = srStokesConst(p);
			break;
		case 18:
			err = srPowDens(p);
			break;
		case 19:
			err = srUtiInterTime(p);
			break;
		case 20:
			//err = srOptThinGenSetup(p);
			err = srOptElemSetup(p);
			break;
		case 21:
			err = srOptMatConst(p);
			break;
		case 22:
			err = srOptZonePlateSpecSetup(p);
			break;
		case 23:
			err = srUtiSpotInfo(p);
			break;
		case 24:
			err = srUtiWfrLimits(p);
			break;
		case 25:
			err = srUtiRemoveFlips(p);
			break;
		case 26:
			err = srUtiMagRad(p);
			break;
		case 27:
			err = srUtiMagCritPhotEn(p);
			break;
		case 28:
			err = srUtiUndK(p);
			break;
		case 29:
			err = srUtiUndFundPhotEn(p);
			break;
		case 30:
			err = srKn(p);
			break;
		case 31:
			err = srElecBeamPropag(p);
			break;
		case 32:
			err = srMagArb2Per(p);
			break;
		case 33:
			err = srStokesArb(p);
			break;
		case 34:
			err = srUtiTrfOptMir(p);
			break;
		case 35:
			err = srUti3DView(p);
			break;
		case 36:
			err = srRadPropagStokesMultiE(p);
			break;
		//case 37:
		//	err = srWfrEmitPropagStokesMultiE(p);
		//	break;
		case 37:
			err = srWfrEmitPropag(p);
			break;
		case 38:
			err = srWfrReflect(p);
			break;
		case 39:
			err = srWfrSetRepres(p);
			break;
		case 40:
			err = srUtiIntKnXn(p);
			break;
		case 41:
			err = srRadIntensInteg(p);
			break;
		case 42:
			err = srOptThinTransmCharExtract(p);
			break;
		case 43:
			err = srWfrCSR(p);
			break;
		case 44:
			err = srTraj3d(p);
			break;
		case 45:
			err = srUtiRandGsn(p);
			break;
		//case 45:
		//	err = srOptThickMirGenSetup(p);
		//	break;
	}
	return(err);
}
Exemple #3
0
/*	XOPMenuItem()

	XOPMenuItem is called when user selects XOPs menu item.
*/
static int
XOPMenuItem(void)
{
	MenuHandle mHandle;
	int resourceMenuID, actualMenuID, menuID;
	int resourceItemNumber, actuaItemNumber, itemNumber;
	int isIgorMenu, isXOPMenu;
	char message[100];
	char buf[256];
	
	isIgorMenu = isXOPMenu = 0;
	
	actualMenuID = (int)GetXOPItem(0);				// Get actual menu ID.
	actuaItemNumber = (int)GetXOPItem(1);
	
	mHandle = GetMenuHandle(actualMenuID);			// This would be NIL if the menu were hidden.
	
	resourceMenuID = ActualToResourceMenuID(actualMenuID);	// convert to resource menu ID.
	if (resourceMenuID != 0) {						// Menu added by XOP ?.
		menuID = resourceMenuID;
		isXOPMenu = 1;
		if (igorVersion >= 200)
			mHandle = ResourceMenuIDToMenuHandle(resourceMenuID);	// NIL if not menu added by XOP.
	}
	else {											// This is an Igor menu.
		menuID = actualMenuID;
		isIgorMenu = 1;
	}
	
	resourceItemNumber = ActualToResourceItem(actualMenuID, actuaItemNumber);
	if (resourceItemNumber != 0)					// Item added by XOP to Igor menu ?.
		itemNumber = resourceItemNumber;
	else											// This is an XOP menu.
		itemNumber = actuaItemNumber;
	
	switch (menuID) {
		case MAINMENU_ID:				// MenuXOP1 menu in main menu bar.
			switch (itemNumber) {
				case 1:
					// This item has a submenu so this item should never be selected.
					strcpy(message, "MenuXOP1: Item1 selected");
					break;
				case 2:
					strcpy(message, "MenuXOP1: Item2 selected");
					break;
				case 3:
					// This item has a submenu so this item will never be selected.
					break;
				default:
					strcpy(message, "MenuXOP1: unknown menu item selected");
					break;
			}
			break;
			
		case SUBMENU1_ID:				// Submenu in item 1 of main menu bar.
			switch (itemNumber) {
				case 1:
					strcpy(message, "MenuXOP1: Subitem1_1 selected");
					break;
				case 2:
					strcpy(message, "MenuXOP1: Subitem1_2 selected");
					break;
				case 3:
					strcpy(message, "MenuXOP1: Subitem1_3 selected");
					break;
				default:
					strcpy(message, "MenuXOP1: unknown menu item selected");
					break;
			}
			break;
			
		case SUBMENU2_ID:				// Submenu in item 3 of main menu bar.
			switch (itemNumber) {
				case 1:
					strcpy(message, "MenuXOP1: Subitem3_1 selected");
					break;
				case 2:
					// This item has a submenu so this item will never be selected.
					break;
				case 3:
					strcpy(message, "MenuXOP1: Subitem3_3 selected");
					break;
				default:
					strcpy(message, "MenuXOP1: unknown menu item selected");
					break;
			}
			break;
			
		case SUBMENU3_ID:				// Sub-submenu in item 2 of 2nd submenu.
			switch (itemNumber) {
				case 1:
					strcpy(message, "MenuXOP1: Subitem3_2_1 selected");
					break;
				case 2:
					strcpy(message, "MenuXOP1: Subitem3_2_2 selected");
					break;
				case 3:
					strcpy(message, "MenuXOP1: Subitem3_2_3 selected");
					break;
				default:
					strcpy(message, "MenuXOP1: unknown menu item selected");
					break;
			}
			break;
			
		case SUBMENU4_ID:				// Submenu in item added to Analysis menu.
			switch (itemNumber) {
				case 1:
					strcpy(message, "MenuXOP1: Analysis Item1 selected");
					break;
				case 2:
					strcpy(message, "MenuXOP1: Analysis Item2 selected");
					break;
				case 3:
					strcpy(message, "MenuXOP1: Analysis Item3 selected");
					break;
				default:
					strcpy(message, "MenuXOP1: unknown menu item selected");
					break;
			}
			break;
			
		case MISCID:		// MISCID = 8 (see IgorXOP.h).
			switch (itemNumber) {
				case 1:
					strcpy(message, "MenuXOP1: Misc1 selected");
					break;
				
				case 2:
					strcpy(message, "MenuXOP1: Misc2 selected");
					break;
			}
			break;
			
		default:
			strcpy(message, "MenuXOP1: unknown menu item selected");
			break;
	}
	
	sprintf(buf, "%s"CR_STR, message);
	XOPNotice(buf);
	
	if (isIgorMenu) {
		sprintf(buf, "mHandle=%p, actualMenuID=%d, resourceItemNumber=%d, actuaItemNumber=%d"CR_STR,
					  mHandle, actualMenuID, resourceItemNumber, actuaItemNumber);
		XOPNotice(buf);
	}
	if (isXOPMenu) {
		sprintf(buf, "mHandle=%p, resourceMenuID=%d, actualMenuID=%d, actuaItemNumber=%d"CR_STR,
					  mHandle, resourceMenuID, actualMenuID, actuaItemNumber);
		XOPNotice(buf);
	}
	
	return(0);
}
Exemple #4
0
/*	RegisterFunction()
	Igor calls this at startup time to find the address of the
	XFUNCs added by this XOP. See XOP manual regarding "Direct XFUNCs".
*/
static long RegisterFunction()
{
	int funcIndex;

	funcIndex = GetXOPItem(0);		// Which function is Igor asking about?
	switch (funcIndex) {
		case 0:
			return((long)srLoop);
			break;
		case 1:
			return((long)srWfrFromTrj);
			break;
		case 2:
			return((long)srWfrIsotrSrc);
			break;
		case 3:
			return((long)srWfrGsnBeam);
			break;
		case 4:
			return((long)srWfrSASE);
			break;
		case 5:
			return((long)srTraj);
			break;
		case 6:
			return((long)srVerNo);
			break;
		case 7:
			return((long)srRadMom);
			break;
		case 8:
			return((long)srFFT1D);
			break;
		case 9:
			return((long)srFFT2D);
			break;
		case 10:
			return((long)srRadResizeXZ);
			break;
		case 11:
			return((long)srObsSetNxNz);
			break;
		case 12:
			return((long)srRadPropag);
			break;
		case 13:
			return((long)srWfrPropag);
			break;
		case 14:
			return((long)srRadExtract);
			break;
		case 15:
			return((long)srStokesUnd);
			break;
		case 16:
			return((long)srStokesWig);
			break;
		case 17:
			return((long)srStokesConst);
			break;
		case 18:
			return((long)srPowDens);
			break;
		case 19:
			return((long)srUtiInterTime);
			break;
		case 20:
			//return((long)srOptThinGenSetup);
			return((long)srOptElemSetup);
			break;
		case 21:
			return((long)srOptMatConst);
			break;
		case 22:
			return((long)srOptZonePlateSpecSetup);
			break;
		case 23:
			return((long)srUtiSpotInfo);
			break;
		case 24:
			return((long)srUtiWfrLimits);
			break;
		case 25:
			return((long)srUtiRemoveFlips);
			break;
		case 26:
			return((long)srUtiMagRad);
			break;
		case 27:
			return((long)srUtiMagCritPhotEn);
			break;
		case 28:
			return((long)srUtiUndK);
			break;
		case 29:
			return((long)srUtiUndFundPhotEn);
			break;
		case 30:
			return((long)srKn);
			break;
		case 31:
			return((long)srElecBeamPropag);
			break;
		case 32:
			return((long)srMagArb2Per);
			break;
		case 33:
			return((long)srStokesArb);
			break;
		case 34:
			return((long)srUtiTrfOptMir);
			break;
		case 35:
			return((long)srUti3DView);
			break;
		case 36:
			return((long)srRadPropagStokesMultiE);
			break;
		//case 37:
		//	return((long)srWfrEmitPropagStokesMultiE);
		//	break;
		case 37:
			return((long)srWfrEmitPropag);
			break;
		case 38:
			return((long)srWfrReflect);
			break;
		case 39:
			return((long)srWfrSetRepres);
			break;
		case 40:
			return((long)srUtiIntKnXn);
			break;
		case 41:
			return((long)srRadIntensInteg);
			break;
		case 42:
			return((long)srOptThinTransmCharExtract);
			break;
		case 43:
			return((long)srWfrCSR);
			break;
		case 44:
			return((long)srTraj3d);
			break;
		case 45:
			return((long)srUtiRandGsn);
			break;
		//case 45:
		//	return((long)srOptThickMirGenSetup);
		//	break;
	}
	return(NIL);
}