Click here to Skip to main content
15,892,059 members
Articles / Desktop Programming / MFC

VssReporter 2.1 - A Visual SourceSafe reporting tool for build administrators

Rate me:
Please Sign up or sign in to vote.
4.88/5 (100 votes)
25 Mar 200610 min read 626.5K   8.9K   162  
A support tool to allow those performing builds to independently determine exactly what source files have been changed and by whom
// vssreporterDlg.h : header file
//
#if !defined(AFX_VSSREPORTERDLG_H__C4F27D3F_4190_4E34_995E_C4A6C0B8BF7D__INCLUDED_)
#define AFX_VSSREPORTERDLG_H__C4F27D3F_4190_4E34_995E_C4A6C0B8BF7D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "vsstreectrl.h"
#include "vssqueryDlg.h"

#include <afxtempl.h>

/////////////////////////////////////////////////////////////////////////////
// CVssreporterDlg dialog

struct ResultInfo
{
	CString sFile;
	CString sPath;
	CString sUser;
	int nVersion;
	DATE date;
	CString sComment, sLabel;
	int nModType;
};

struct SortInfo
{
	SortInfo() { nSortColumn = 0; bSortAscending = TRUE; }
	void Reset() { aResults.RemoveAll();	}

	CArray<ResultInfo, ResultInfo&> aResults;
	int nSortColumn;
	BOOL bSortAscending;
};

class CVssreporterDlg : public CDialog
{
// Construction
public:
	CVssreporterDlg(CWnd* pParent = NULL);	// standard constructor
	virtual ~CVssreporterDlg();

	static CString GetUserName();

protected:
// Dialog Data
	//{{AFX_DATA(CVssreporterDlg)
	enum { IDD = IDD_VSSREPORTER_DIALOG };
	CComboBox	m_cbDatabases;
	CListCtrl	m_lcResults;
	CVSSTreeCtrl	m_tcVSS;
	CString	m_sDbPath;
	CString	m_sFilesFound;
	CString	m_sPassword;
	CString	m_sUsername;
	CString	m_sProgress;
	CString	m_sQuery;
	BOOL	m_bRecursive;
	BOOL	m_bIgnoreDeleted;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CVssreporterDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;
	IVSSDatabasePtr m_vssdb;
	COleDateTime m_dateAfter, m_dateBefore;
	BOOL m_bReporting;
	CString m_sCurProject;
	CSize m_sizeOrg;
	CString m_sVSSPath;
	CString m_sCreated, m_sCheckedIn, m_sLabeled; // locale specific strings
	SortInfo m_sortInfo;
	CImageList m_ilFolders, m_ilSorting, m_ilResults;
	CWordArray m_aColLengths;

	// Generated message map functions
	//{{AFX_MSG(CVssreporterDlg)
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnReport();
	afx_msg void OnCancelreport();
	afx_msg void OnSelchangeDatabaselist();
	afx_msg void OnSelchangedVsstree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBrowsedatabase();
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnCopyResults();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnShowVSS();
	afx_msg void OnChangeUsernamePassword();
	afx_msg void OnCopyFilestofolder();
	afx_msg void OnEditquery();
	afx_msg void OnColumnclickFilelist(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnCopyTexttoclipboardTabbed();
	afx_msg void OnCopyTexttoclipboardFormatted();
	afx_msg void OnCopyTexttofileFormatted();
	afx_msg void OnCopyTexttofileTabbed();
	afx_msg void OnSelchangedFilelist(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnResultsSelectall();
	afx_msg void OnCopyTexttofileXml();
	afx_msg void OnCopyTexttoclipboardXml();
	afx_msg void OnResultsDiff();
	afx_msg void OnDiffTool();
	//}}AFX_MSG
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
	DECLARE_MESSAGE_MAP()

	void ReportOnItem(CString szVSSPath, const VssQuery& query);
	void ReportOnItem(IVSSItemPtr& vssi, LPCTSTR szVSSPath, const VssQuery& query, BOOL bDeleted);
	void ReportOnProject(IVSSItemPtr& vssi, LPCTSTR szVSSPath, const VssQuery& query);
	void AddResult(const CString& sVSSPath, LPCTSTR szUser, int nVersion, 
					const COleDateTime& date, LPCTSTR szComment, int nModType,
					LPCTSTR szLabel);
	void AddResult(const CString& sVSSPath, const IVSSVersionPtr& objVer, int nModType); 

	BOOL OpenDatabase(LPCTSTR szDatabasePath);
	COleDateTime FindLabel(CString sVSSItem, LPCTSTR szLabel, BOOL bFirst); // else last

	void RegSaveSettings();
	void RegLoadSettings();
	void EnableControls();
	void MakeValidPath(CString& sPath);

	CString GetUserFilter(const VssQuery& query);
	BOOL Continue(BOOL& bContinue);
	LPCTSTR GetVSSExplorerPath();
	CString GetSelectedResult(int nCol = 0, int nItem = 0);
	CString GetLocalPath(LPCTSTR szVssProject, LPCTSTR szFileName);

	CString GetResultsAsText(BOOL bTabbed);
	CString GetResultsAsXml();
	void CopyTexttoclipboard(const CString& sText);
	void CopyTexttofile(const CString& sText, BOOL bXml);

    int GetVSSVersion();
	BOOL IsVSSRegistered();
	void InitLocaleStrings();
	static CString GetVSSPath();

	CString GetLabel(const IVSSVersionPtr& objVer);
	BOOL GetLabel(const IVSSVersionPtr& objVer, CString& sLabel);
	int GetModType(const IVSSVersionPtr& objVer);
	BOOL IsCheckIn(const IVSSVersionPtr& objVer);
	BOOL IsCreated(const IVSSVersionPtr& objVer);
	BOOL DateMatches(const IVSSVersionPtr& objVer, const VssQuery& query, COleDateTime& date);
	BOOL LabelMatches(const IVSSVersionPtr& objVer, const VssQuery& query);
	CString GetComment(const IVSSVersionPtr& objVer);

	void SetSortColumn(int nCol, BOOL bAscending = -1);
	CString GetVssFile(LPCTSTR szName, LPCTSTR szPath, int nVersion = -1);

	static int CALLBACK ResultsSortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);  
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_VSSREPORTERDLG_H__C4F27D3F_4190_4E34_995E_C4A6C0B8BF7D__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer Maptek
Australia Australia
.dan.g. is a naturalised Australian and has been developing commercial windows software since 1998.

Comments and Discussions