Exemple #1
0
void wxListCtrlEx::SaveColumnSettings(int widthsOptionId, int visibilityOptionId, int sortOptionId)
{
	if (widthsOptionId != -1)
		SaveColumnWidths(widthsOptionId);

	if (visibilityOptionId != -1)
	{
		wxString visibleColumns;
		for (unsigned int i = 0; i < m_columnInfo.size(); i++)
		{
			if (m_columnInfo[i].shown)
				visibleColumns += _T("1");
			else
				visibleColumns += _T("0");
		}
		COptions::Get()->SetOption(visibilityOptionId, visibleColumns);
	}

	if (sortOptionId != -1)
	{
		wxString order;
		for (unsigned int i = 0; i < m_columnInfo.size(); i++)
		{
			if (i)
				order += _T(",");
			order += wxString::Format(_T("%d"), m_columnInfo[i].order);
		}
		COptions::Get()->SetOption(sortOptionId, order);
	}
}
Exemple #2
0
void CCJListCtrl::OnDestroy() 
{
	if (m_bSaveColumnState)
		SaveColumnWidths();
	CListCtrl::OnDestroy();
}
HRESULT CShellBrowser::BrowseFolder(LPCITEMIDLIST pidlDirectory,UINT wFlags)
{
	SetCursor(LoadCursor(NULL,IDC_WAIT));

	LPITEMIDLIST pidl = ILClone(pidlDirectory);

	if(m_bFolderVisited)
	{
		SaveColumnWidths();
	}

	/* The path may not be absolute, in which case it will
	need to be completed. */
	BOOL StoreHistory = TRUE;
	HRESULT hr = ParsePath(&pidl,wFlags,&StoreHistory);

	if(hr != S_OK)
	{
		SetCursor(LoadCursor(NULL,IDC_ARROW));
		return E_FAIL;
	}

	EmptyIconFinderQueue();
	EmptyThumbnailsQueue();
	EmptyColumnQueue();
	EmptyFolderQueue();

	/* TODO: Wait for any background threads to finish processing. */

	EnterCriticalSection(&m_csDirectoryAltered);
	m_FilesAdded.clear();
	m_FileSelectionList.clear();
	LeaveCriticalSection(&m_csDirectoryAltered);

	TCHAR szParsingPath[MAX_PATH];
	GetDisplayName(pidl,szParsingPath,SIZEOF_ARRAY(szParsingPath),SHGDN_FORPARSING);

	/* TODO: Method callback. */
	SendMessage(m_hOwner,WM_USER_STARTEDBROWSING,m_ID,reinterpret_cast<WPARAM>(szParsingPath));

	StringCchCopy(m_CurDir,SIZEOF_ARRAY(m_CurDir),szParsingPath);

	if(StoreHistory)
	{
		m_pPathManager->StoreIdl(pidl);
	}

	if(m_bFolderVisited)
	{
		ResetFolderMemoryAllocations();
	}

	m_nTotalItems = 0;

	BrowseVirtualFolder(pidl);

	CoTaskMemFree(pidl);

	/* Stop the list view from redrawing itself each time is inserted.
	Redrawing will be allowed once all items have being inserted.
	(reduces lag when a large number of items are going to be inserted). */
	SendMessage(m_hListView,WM_SETREDRAW,FALSE,NULL);

	ListView_DeleteAllItems(m_hListView);

	/* Window updates needs these to be set. */
	m_NumFilesSelected		= 0;
	m_NumFoldersSelected	= 0;

	m_ulTotalDirSize.QuadPart = 0;
	m_ulFileSelectionSize.QuadPart = 0;

	SetActiveColumnSet();
	SetCurrentViewModeInternal(m_ViewMode);

	InsertAwaitingItems(FALSE);

	VerifySortMode();
	SortFolder(m_SortMode);

	ListView_EnsureVisible(m_hListView,0,FALSE);

	/* Allow the listview to redraw itself once again. */
	SendMessage(m_hListView,WM_SETREDRAW,TRUE,NULL);

	m_bFolderVisited = TRUE;

	SetCursor(LoadCursor(NULL,IDC_ARROW));

	m_iUniqueFolderIndex++;

	return S_OK;
}