Beispiel #1
0
//HOST_IMPORT void main(IORecHandle ioRecHandle)
HOST_IMPORT int main(IORecHandle ioRecHandle) //OC030110, required for GCC 4.2 Mac OSX
{
	//#ifdef applec					// For MPW C for 68K only.
	//	void _DATAINIT(void);
	//	_DATAINIT();				// For MPW C only.
	//	UnloadSeg(_DATAINIT);
	//#endif
	
	//#ifdef XOP_GLOBALS_ARE_A4_BASED
	//	#ifdef __MWERKS__
	//		SetCurrentA4();							// Set up correct A4. This allows globals to work.
	//		SendXOPA4ToIgor(ioRecHandle, GetA4());	// And communicate it to Igor.
	//	#endif
	//#endif

	//LoadXOPSegs();
	XOPInit(ioRecHandle);							// Do standard XOP initialization.
	SetXOPEntry(XOPEntry);							// Set entry point for future calls.
	
	if(igorVersion < 200) SetXOPResult(OLD_IGOR);
	else SetXOPResult(0L);
	
	SetXOPType(RESIDENT | IDLES);
	SR.Initialize();
	srYield.Init(0.5);

	srUtiProgrIndFuncSet(&(srTIgorSend::ShowCompProgress));
	srUtiWfrExtModifFuncSet(&(srTIgorSend::WfrModify));
	srUtiOptElemGetInfByNameFuncSet(&(srTIgorSend::GetOptElemInfByName));

	return 0;
}
Beispiel #2
0
void srEnsureSrwInit()
{
	char TestName[] = "SrwVerProc";
	char StrDummy[50];
	int SRW_WasNotInit = FetchStrVar(TestName, StrDummy);
	if(SRW_WasNotInit)
	{
		char InitStr[] = "SrwInit(1)";
		XOPCommand(InitStr);
	}
	SetXOPType(RESIDENT);
}
Beispiel #3
0
/*	XOPMain(ioRecHandle)

	This is the initial entry point at which the host application calls XOP.
	The message sent by the host must be INIT.

	main does any necessary initialization and then sets the XOPEntry field of the
	ioRecHandle to the address to be called for future messages.
*/
HOST_IMPORT int
XOPMain(IORecHandle ioRecHandle)				// The use of XOPMain rather than main means this XOP requires Igor Pro 6.20 or later
{
	int err;
	
	XOPInit(ioRecHandle);						// Do standard XOP initialization.
	if (igorVersion < 620) {
		SetXOPResult(OLD_IGOR);
		return EXIT_FAILURE;
	}
	
	if (err = RegisterMenuXOP1()) {
		SetXOPResult(err);
		return EXIT_FAILURE;
	}
	
	SetXOPEntry(XOPEntry);						// Set entry point for future calls.
	SetXOPType(RESIDENT);						// Specify XOP to stick around and to Idle.
	
	mainMenuHandle = ResourceMenuIDToMenuHandle(MAINMENU_ID);
	
	SetXOPResult(0L);
	return EXIT_SUCCESS;
}
Beispiel #4
0
/*	ExecuteMenuXOP1(p)
	
	Executes MenuXOP1 operation.
*/
extern "C" int
ExecuteMenuXOP1(MenuXOP1RuntimeParamsPtr p)
{
	int menuID, itemNumber;
	MenuHandle mHandle;
	int err = 0;

	if (p->enableEncountered) {
		if (err = GetMenuHandleAndItem((int)p->enableMenuID, (int)p->enableItemNumber, &mHandle, &itemNumber))
			return err;

		if (mHandle != NULL)
			EnableItem(mHandle, itemNumber);
	}

	if (p->disableEncountered) {
		if (err = GetMenuHandleAndItem((int)p->disableMenuID, (int)p->disableItemNumber, &mHandle, &itemNumber))
			return err;

		if (mHandle != NULL)
			DisableItem(mHandle, itemNumber);
	}
	
	if (p->hideEncountered) {
		menuID = (int)p->hideMenuID;
		if (menuID != MAINMENU_ID)
			return MAIN_MENU_ONLY;
		
		menuID = ResourceToActualMenuID(menuID);
		mHandle = GetMenuHandle(menuID);
		if (mHandle != NULL) {							// Menu showing ?
			WMDeleteMenu(menuID);
			WMDrawMenuBar();
		}
	}
	
	if (p->showEncountered) {
		menuID = (int)p->showMenuID;
		if (menuID != MAINMENU_ID)
			return MAIN_MENU_ONLY;
		
		menuID = ResourceToActualMenuID(menuID);
		mHandle = GetMenuHandle(menuID);
		if (mHandle == NULL) {							// Menu not already showing ?
			WMInsertMenu(mainMenuHandle, 0);
			WMDrawMenuBar();
		}
	}
	
	if (p->quitEncountered) {
		// If you unload MenuXOP1 while main menu is hidden it will not be retrievable if MenuXOP1 is reloaded.
		menuID = ResourceToActualMenuID(MAINMENU_ID);
		if (GetMenuHandle(menuID) == NULL) {
			WMInsertMenu(mainMenuHandle, 0);
			WMDrawMenuBar();
		}
		SetXOPType(TRANSIENT);							// Tell Igor to unload XOP.
	}

	return err;
}