예제 #1
0
LRESULT CMainFrame::OnTVSelChanged(int, LPNMHDR pnmh, BOOL&)
{
	// 如何解析参数
	LPNMTREEVIEW pnmtv = reinterpret_cast<LPNMTREEVIEW>(pnmh);
	CTreeViewCtrlEx tree = pnmh->hwndFrom;
	if (tree.IsWindow())
	{
		CTreeItem item = tree.GetSelectedItem();
		std::string path;
		for (; !item.IsNull() && !item.GetParent().IsNull(); item = item.GetParent())
		{
			std::string name(256, 0);
			item.GetText((LPTSTR)name.c_str(), 256);
			std::string temp = name.c_str();
			if (!path.empty())
			{
				path = temp + "/" + path;
			}
			else
			{
				path = temp;
			}
		}
		//
		if (_canvas)
		{
			path = Buddha::FileSystem::getInstancePtr()->getDataDirectory() + path;
			_canvas->changeModelFile(standardFilePath(path));
		}
	}

	return 0L;
}
예제 #2
0
파일: FileSystem.cpp 프로젝트: cpzhang/zen
tstring FileSystem::getBinDirectory( )
{
    tstring dir = getModuleFileName();
    dir = standardFilePath(dir);
    dir = getParent(dir);
    dir = getParent(dir);
    return dir;
}
예제 #3
0
파일: FileSystem.cpp 프로젝트: cpzhang/zen
tstring FileSystem::removeParent( const tstring& dir )
{
    tstring path(standardFilePath(dir));
    size_t pos = path.find_last_of('\\');

    if (pos != tstring::npos)
    {
        return path.substr(pos + 1, path.size() - pos - 1);
    }
    return dir;
}
예제 #4
0
파일: FileSystem.cpp 프로젝트: cpzhang/zen
tstring FileSystem::getParent( const tstring& dir )
{
    tstring path(standardFilePath(dir));
    if (path[path.size() -1] == '\\')
    {
        path = path.substr(0, path.size() - 1);
    }
    size_t pos = path.find_last_of('\\');
    if (pos != tstring::npos)
    {
        return path.substr(0, pos);
    }
    return TEXT("");
}
예제 #5
0
파일: FileSystem.cpp 프로젝트: cpzhang/zen
void FileSystem::createFolder(const tstring& path)
{
    tstring folder = standardFilePath(path);
    if (folder[folder.size() - 1] != '\\' && path.find('.', 0) == tstring::npos)
    {
        folder += '\\';
    }
    size_t pos = folder.find_first_of(TEXT("\\"));
    while(pos != tstring::npos)
    {
        tstring f = folder.substr(0, pos);
        CreateDirectory(f.c_str(), NULL);
        pos = folder.find_first_of(TEXT("\\"), pos + 1);
    }
}
예제 #6
0
LRESULT CMainFrame::OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	// TODO: add code to initialize document
	CFileDialog fd(true, "entity", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Plato Documents (*.group;*.entity;*.mesh;*.mz;*.subentity)\0*.group;*.entity;*.mesh;*.mz;*.subentity\0All Files (*.*)\0*.*\0"));
	if (fd.DoModal() == IDOK)
	{
		std::string buf(512, 0);
		buf = fd.m_szFileName;
		if (!buf.empty() && _canvas)
		{
			_canvas->changeModelFile(standardFilePath(buf));
		}
	}
	return 0;
}
예제 #7
0
파일: FileSystem.cpp 프로젝트: cpzhang/zen
void FileSystem::setDataDirectory( const tstring& dir )
{
    //最后带'\'
    dataPath_ = standardFilePath(dir);
}