示例#1
0
	w_directory_browsing_list(const FileSpecifier& inStartingDirectory, dialog* inParentDialog, const string& inStartingFile)
	: w_list<dir_entry>(entries, 400, 15, 0), parent_dialog(inParentDialog), current_directory(inStartingDirectory)
	{
		refresh_entries();
		if(entries.size() != 0)
			select_entry(inStartingFile, false);
	}
示例#2
0
bool ShellBrowser::jump_to_pidl(LPCITEMIDLIST pidl)
{
    if (!_root._entry)
        return false;

    // iterate through the hierarchy and open all folders to reach pidl
    WaitCursor wait;

    HTREEITEM hitem = TreeView_GetRoot(_left_hwnd);
    Entry* entry = _root._entry;

    for(const void*p=pidl;;) {
        if (!p)
            return true;

        if (!entry || !hitem)
            break;

        entry->smart_scan(SORT_NAME, SCAN_DONT_ACCESS);

        Entry* found = entry->find_entry(p);
        p = entry->get_next_path_component(p);

        if (found)
            hitem = select_entry(hitem, found);

        entry = found;
    }

    return false;
}
示例#3
0
void		input_handler(LP **first, INF *infos, LP **curr, char *buf)
{
	if (BUFFER == UP_KEY || BUFFER == DOWN_KEY || BUFFER == LEFT_KEY ||
		BUFFER == RIGHT_KEY)
		lst_move(curr, first, buf);
	else if ((BUFFER > 96 && BUFFER < 123) || (infos->search &&
		(BUFFER == RET_KEY || BUFFER == DEL_KEY)))
		search(curr, infos, buf);
	else if (BUFFER == SPACE_KEY)
		select_entry(curr, infos);
	else if (BUFFER == SUP_KEY)
		lst_del(first, curr);
	else if (BUFFER == RET_KEY || BUFFER == ESC_KEY)
		exit_print(buf);
	infos->curr_page = (*curr)->page;
}
示例#4
0
	void move_up_a_level()
	{
		string base;
		string part;
		current_directory.SplitPath(base, part);
		if(part != string())
		{
			FileSpecifier parent_directory(base);
			if(parent_directory.Exists())
			{
				current_directory = parent_directory;
				refresh_entries();
				select_entry(part, true);
				announce_directory_changed();
			}
		}
	}
示例#5
0
HRESULT ShellBrowser::OnDefaultCommand(LPIDA pida)
{
    CONTEXT("ShellBrowser::OnDefaultCommand()");

    if (pida->cidl >= 1) {
        if (_left_hwnd) {	// explorer mode
            if (_last_sel) {
                ShellDirectory* parent = (ShellDirectory*)TreeView_GetItemData(_left_hwnd, _last_sel);

                if (parent) {
                    try {
                        parent->smart_scan(SORT_NAME, SCAN_DONT_ACCESS);
                    } catch(COMException& e) {
                        return e.Error();
                    }

                    UINT firstOffset = pida->aoffset[1];
                    LPITEMIDLIST pidl = (LPITEMIDLIST)((LPBYTE)pida+firstOffset);

                    Entry* entry = parent->find_entry(pidl);

                    if (entry && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
                        if (entry->_etype == ET_SHELL)
                            if (_last_sel && select_entry(_last_sel, entry))
                                return S_OK;

                    ///@todo look for hidden or new subfolders and refresh/add new entry instead of opening a new window
                    return E_NOTIMPL;
                }
            }
        } else { // no tree control
            if (MainFrameBase::OpenShellFolders(pida, _hwndFrame))
                return S_OK;

            /* create new Frame Window
            			if (MainFrame::OpenShellFolders(pida, 0))
            				return S_OK;
            */
        }
    }

    return E_NOTIMPL;
}