/*
 =======================================================================================
  Name        : Tree_Fct.h
 
  Author      : vincent lhullier            Date :04/09/97
 
  Description : header file for tree of project or file functions
 =======================================================================================
 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef __VSSFUNCT_H__
#define __VSSFUNCT_H__
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

typedef struct tdstFileListConfig_ tdstFileListConfig;
typedef struct tdstSection_ tdstSection;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*
 =======================================================================================
	STRUCTURES 
 =======================================================================================
 */

/*
 * structure to store info about project tree
 */
typedef struct tdstFile_
{
	char					*szName;
	BOOL					bGet;
	HTREEITEM				hTreeItem;
} tdstFile;

typedef struct tdstProject_
{
	char					*szName;
	BOOL					bGet;
	BOOL					bRecurse;
	long					lNumberOfSubProjects;
	struct tdstProject_		*d_stSubProject;
	long					lNumberOfFiles;
	tdstFile				*d_stFile;
	HTREEITEM				hTreeItem;
} tdstProject;

/*
 * structure to describe a file type
 */
typedef struct tdstFileType_
{
	char		szExt[8];
	long		lUsed;
	BOOL		bConsider;
//	long		lNumberOfSections;
//	tdstSection	*d_stSection;
} tdstFileType;


/*
 =======================================================================================
	CONSTANT
 =======================================================================================
 */

#define		C_cVssProject	0
#define		C_cLocalProject	1

/*
 =======================================================================================
	GLOBALS 
 =======================================================================================
 */
extern tdstProject	*g_p_stRootProject;

extern long			g_lNumberOfFileTypes;
extern long			g_lNumberMaxOfFileTypes;
extern tdstFileType	*g_d_stFileType;

/*
 =======================================================================================
	FUNCTIONS 
 =======================================================================================
 */

/*
 =======================================================================================
	File type functions
 =======================================================================================
 */
void			fn_Tree_vFreeFileTypeList				( void );
tdstFileType	*fn_Tree_p_stIsAFileType				( char *_szFileType );
tdstFileType	*fn_Tree_p_stAddFileType				( char *_szFileType );
void			fn_Tree_vAddFileTypeFromFile			( char *_szFile );
BOOL			fn_Tree_bConsiderFile					( char *_szFile );

void			fn_Tree_vInitProject					( tdstProject *_p_stProj, char *_szName );
void			fn_Tree_vInitProjectWithPointerName		( tdstProject *_p_stProj, char *_szName );
void			fn_Tree_vInitFile						( tdstFile *_p_stFile, char *_szName );
void			fn_Tree_vInitFileWithPointerName		( tdstFile *_p_stFile, char *_szName );

tdstProject		*fn_Tree_p_stGetProject					( tdstProject *_p_stInProj, char *_szName );
tdstFile		*fn_Tree_p_stGetFile					( tdstProject *_p_stInProj, char *_szName );

void			fn_Tree_vFreeProject					( tdstProject *_p_stProj, BOOL _bDelete );
void			fn_Tree_vFreeProjectTree				( tdstProject *_p_stProj, BOOL _bDelete);
void			fn_Tree_vFreeProjectFileList			( tdstProject *_p_stProj );

void			fn_Tree_vGetNothing						( tdstProject *_p_stProj);
void			fn_Tree_vRefreshWithFileList			( tdstProject *_p_stProj, tdstFileListConfig *_p_stFileList );

void			fn_Tree_vGetNumberOfFilesOrProjectsToGet( tdstProject *_p_stProj, long *_p_lNbFiles );
void			fn_Tree_vGetFilesOrProjectToGet			( tdstProject *_p_stProj, long *_p_lNbFiles, char **_d_szFile );
void			fn_Tree_vGetNumberOfFilesToGet			( tdstProject *_p_stProj, long *_p_lNbFiles, BOOL _bAll );
void			fn_Tree_vGetFilesToGet					( tdstProject *_p_stProj, long *_p_lNbFiles, char **_d_szFile, BOOL _bAll );

long			fn_Tree_lBuildListOfFilesToGet			( tdstProject *_p_stProj, char ***_ppp_szFile );
void			fn_Tree_vFreeListOfFilesToGet			( long _lNumberOfFiles, char **_pp_szFile );

BOOL			fn_TREE_bGetFileList					( tdstProject *_p_stProj, tdstFileListConfig *_p_stFileList, char _cConfig, char *_szFileListName );

/*
 =======================================================================================
	Function for local tree 
 =======================================================================================
 */

BOOL			fn_Tree_bBuildFromDisk					( tdstProject **_pp_stRootProject, char *_szRootName, HWND _hProjectWindow );

#endif //__VSSFUNCT_H__