/* static */ void GeblGuiExtension::SampleMenuCallBack(void *appPtr,FsGuiPopUpMenu *,FsGuiPopUpMenuItem *)
{
	auto &guiExtension=*(GeblGuiExtension *)appPtr;
	auto &canvas=*guiExtension.canvasPtr;

	if(NULL!=canvas.Slhd())
	{
		YsShellExtEdit &shl=*(YsShellExtEdit *)canvas.Slhd();

		YsWString msg(L"Extension Menu Sample\n");

		YsString str;
		YsWString wStr;

		str.Printf("Number of vertices=%d\n",(int)shl.GetNumVertex());
		wStr.SetUTF8String(str);
		msg.Append(wStr);

		str.Printf("Number of polygons=%d\n",(int)shl.GetNumPolygon());
		wStr.SetUTF8String(str);
		msg.Append(wStr);

		msg.Append(L"You can write your own function in gui_extension/ysgebl_gui_extension.cpp.\n");

		canvas.MessageDialog(L"Extension Sample",msg);
	}
}
const YsWString PolyCreFileName::GetLastWindowPositionFileName(void) const
{
	const wchar_t *optDir=GetOptionDir();
	YsWString wStr;
	wStr.MakeFullPathName(optDir,L"windowpos.txt");
	printf("Last Window Position is stored in: %ls\n",wStr.Txt());
	return wStr;
}
const YsWString PolyCreFileName::GetRecentFileListFileName(void) const
{
	const wchar_t *optDir=GetOptionDir();
	YsWString wStr;
	wStr.MakeFullPathName(optDir,L"recent.txt");
	printf("Recently-Used File Names are stored in: %ls\n",wStr.Txt());
	return wStr;
}
Example #4
0
int main(int ac,char *av[])
{
	if(2<=ac)
	{
		YsWString wstr;
		wstr.SetUTF8String(av[1]);
		Parser parser;
		parser.Parse(wstr);
		parser.Print();
	}
	return 0;
}
YSRESULT YsSpecialPath::GetUserDir(YsWString &wpath)
{
	YsString path;
	if(YSOK==GetUserDir(path))
	{
		wpath.SetUTF8String(path);
		return YSOK;
	}
	return YSERR;
}
YSRESULT YsSpecialPath::GetProgramFileName(YsWString &wpath)
{
	YsString path;
	if(YSOK==GetProgramFileName(path))
	{
		wpath.SetUTF8String(path);
		return YSOK;
	}
	return YSERR;
}
YSRESULT YsSpecialPath::GetUserDir(YsWString &wpath)
{
	const char *homeDir=getenv("HOME");
	if(NULL!=homeDir)
	{
		wpath.SetUTF8String(homeDir);
		return YSOK;
	}
	return YSERR;
}
Example #8
0
YSRESULT Parser::Decompose(const YsWString &wstr)
{
	YsWString currentWord;
	for(YSSIZE_T idx=0; idx<wstr.Strlen(); ++idx)
	{
		if('+'==wstr[idx] ||
		   '-'==wstr[idx] ||
		   '*'==wstr[idx] ||
		   '/'==wstr[idx] ||
		   '%'==wstr[idx] ||
		   '('==wstr[idx] ||
		   ')'==wstr[idx] ||
		   '['==wstr[idx] ||
		   ']'==wstr[idx] ||
		   '{'==wstr[idx] ||
		   '}'==wstr[idx])
		{
			if(0<currentWord.Strlen())
			{
				auto newWord=CreateWord();
				newWord->str=currentWord;
				currentWord=L"";
			}
			auto newWord=CreateWord();
			newWord->str=L"";
			newWord->str.Append(wstr[idx]);
		}
		else
		{
			currentWord.Append(wstr[idx]);
		}
	}

	if(0<currentWord.Strlen())
	{
		auto newWord=CreateWord();
		newWord->str=currentWord;
	}

	return YSOK;
}
YSRESULT YsSystemEncodingToUnicode(YsWString &unicode,const char systemEncoding[])
{
	unicode.SetUTF8String(systemEncoding);
	return YSOK;
}