/*  remparm.c   */
/*  Copyright 1989 Mountain Math Software  */
/*  All Rights Reserved                    */
#include <string.h>
#include "shared.h"
#include "gui.h"
#include "remcom.h"
// #include "grphmenu.h"
#include "usercom.h"
// #include "winmgr.h"
// #include "winpres.h"
#include "menu.h"
#include "cgidbg.h"
#include "remparm.h"
#include "xdrv.h"
#include "dsp_app.h"

void SendRemoteNameCommand(int CommandIndex, const char * Name)
{
	PacketHeader Head(PacketRemoteCommand,CommandIndex,strlen(Name));
	DspState->MenuCommandSend();
	WriteSeg->WritePacket(Head,Name);
}

const char * GetMenuStackName(int IndexFromTop)
{
	// LogOut << "GetMenuStackName(" << IndexFromTop << ")\n" ;
	const char * Return = DspApplication::root_window()->
		menu_stack_name(IndexFromTop);
	// LogOut << "Returning `" << Return << "'\n" ;
	return Return ;
	// DbgError("GetMenuStackName","called");
/*
 *	 MenuPreserve * MenuInfo = (MenuPreserve *)
 *		TheWindowsManager->GetOutWindowSpec(OutputMenu)->Preserve;
 *
 *	MenuWindow * MenWin = (MenuWindow *) TheWindowsManager->GetTextWindow(
 *		MenuInfo->GetIndex());
 *
 *	StackMenuList * TheStack = MenuInfo->GetMenuStack();
 *
 *	IndexFromTop += MenWin->GetDepthLastSelect();
 *
 *	if (IndexFromTop < 1 || IndexFromTop > TheStack->Size()) {
 *		LogForm("FromTop = %d, Size = %d",
 *			IndexFromTop, TheStack->Size());
 *		DbgError("GetMenuStackName", "invalid IndexFromTop");
 *	}
 *	StackMenu * SearchFor ;
 *	int Last = 0;
 *	int Count = 1 ;
 *	while (SearchFor = TheStack->GetStackMenuNFromTop(Last++)) {
 *		if (!strcmp(SearchFor->GetWhereFrom(),"other")) continue ;
 *		if (IndexFromTop == Count++) break ;
 *	}
 *
 *	
 *	// SearchFor = TheStack->GetStackMenuNFromTop(IndexFromTop-1);
 *	if (!SearchFor) return 0;
 *
 *	return SearchFor->GetWhereFrom();
 */
}


