Beispiel #1
0
void BookmarkToolBar::OnDropShortcut(STGMEDIUM *aStgMedium, xpr_sint_t aBookmark)
{
    if (aStgMedium == XPR_NULL)
        return;

    BookmarkItem *sBookmarkItem = BookmarkMgr::instance().getBookmark(aBookmark);
    if (sBookmarkItem == XPR_NULL)
        return;

    LPIDA sIda = (LPIDA)::GlobalLock(aStgMedium->hGlobal);
    if (sIda == XPR_NULL)
        return;

    LPITEMIDLIST sFullPidl = Path2Pidl(sBookmarkItem->mPath);
    if (sFullPidl != XPR_NULL && IsFileSystemFolder(sFullPidl) == XPR_TRUE)
    {
        xpr_sint_t sCount = sIda->cidl;
        LPITEMIDLIST sFullPidl2 = XPR_NULL; // fully-qualified PIDL
        LPITEMIDLIST sPidl1 = XPR_NULL; // folder PIDL
        LPITEMIDLIST sPidl2 = XPR_NULL; // item PIDL

        // get folder PIDL
        sPidl1 = (LPITEMIDLIST)(((xpr_byte_t *)sIda)+(sIda)->aoffset[0]);

        xpr_sint_t i;
        xpr_size_t sColon;
        xpr::string sDir;
        xpr::string sName;
        xpr::string sBookmarkPath;
        const xpr_tchar_t *sLinkSuffix = gApp.loadString(XPR_STRING_LITERAL("common.shortcut.suffix"));

        GetName(sFullPidl, SHGDN_FORPARSING, sDir);

        for (i = 0; i < sCount; ++i)
        {
            // get item PIDL and get full-qualified PIDL
            sPidl2 = (LPITEMIDLIST)(((xpr_byte_t *)sIda)+(sIda)->aoffset[i+1]);
            sFullPidl2 = fxfile::base::Pidl::concat(sPidl1, sPidl2);

            GetName(sFullPidl2, SHGDN_INFOLDER, sName);

            sColon = sName.find(XPR_STRING_LITERAL(':'));
            if (sColon != xpr::string::npos)
                sName.erase(sColon, 1);

            sName += sLinkSuffix;

            if (SetNewPath(sBookmarkPath, sDir, sName, XPR_STRING_LITERAL(".lnk")))
            {
                CreateShortcut(sBookmarkPath.c_str(), sFullPidl2);
            }

            COM_FREE(sFullPidl2);
        }
    }

    COM_FREE(sFullPidl);
    ::GlobalUnlock(aStgMedium->hGlobal);
}
void EntMobile::SetMovement(int x, int y)
{
	if (path_on)
	{
		SetNewPath(x, y);
	}
	else
	{
		iPoint target = App->map->GetTileCenter(x, y);
		SetTarget(target);

		//StateMachine change
		current_input = ENTITY_INPUT_MOVE;
	}
}