home *** CD-ROM | disk | FTP | other *** search
- /*
- * dir.h --
- *
- * Declarations of procedures and structures that directly
- * apply to the DirTree.
- *
- * Copyright 1989 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- * Author: Gary Shea (garys@earth.cchem.berkeley.edu)
- *
- * $Header: dir.h,v 1.3 89/07/18 00:05:41 garys Exp $
- */
-
- #ifndef _dir_h
- #define _dir_h
-
- /* Two kinds of paths, relative and absolute. */
-
- typedef enum {
- RelPath, AbsPath, NoPath
- } PathKind ;
-
- /* The dirTree struct is used to build a literal
- * directory tree of selected files. This may not
- * be all that efficient, but it makes error checking
- * and traversal easy. The individual list element
- * contains window information for its directory.
- */
-
- # define FILE_SLOT_INCREMENT 20
- # define BRANCH_SLOT_INCREMENT 5
-
- typedef u_short StatMode ;
- typedef struct _dirTree DirTree ;
- typedef struct _fileData FileData ;
- typedef struct _branchData BranchData ;
-
- struct _fileData
- {
- char *file ;
- StatMode statMode ;
- } ;
-
- struct _branchData
- {
- DirTree *branchPtr ;
- int index ;
- } ;
-
- struct _dirTree
- {
- char *name ; /* Name of this component of the path. */
- char *fullName ; /* Full path name. */
- char *relName ; /* Relative path name, if any. */
- int dirLevel ; /* 0 for root, increasing towards leaves. */
- int normal ; /* Picked => wanted when TRUE. */
-
- int fileCnt ; /* Number of files in the file list. */
- int fileSlots ; /* Number of slots allocated. */
- FileData *files ; /* File info for this directory. */
-
- Widget shellW ; /* Widget info. */
- Widget frameW ;
- Widget labelW ;
- Widget msgW ;
- Widget setW ;
- Widget upComW ;
- Widget quitComW ;
- Widget doneComW ;
- Widget fileComW ;
- int isDisplayed ; /* To prevent multiple displays. */
-
- XtSetDataStruct **setPtr ; /* The set data in the set widget. */
-
- DirTree *rootPtr ; /* Pointer to node up the tree. */
-
- int branchCnt ; /* Number of sub-dir's. */
- int branchSlots ; /* Slots for sub-dir's. */
- BranchData *branches ;
- } ;
-
- typedef enum {
- PreOrder, PostOrder
- } TreeOrder ;
-
- typedef enum {
- SetW, UpW, QuitW, DoneW
- } WidgetToFind ;
-
- /* procedures */
-
- char **DecomposePath( char *path, PathKind *kind, int *parts ) ;
- DirTree *DirTree_AddBranch( DirTree *trvPtr, int index ) ;
- DirTree *DirTree_Alloc( void ) ;
- void DirTree_CWD( void ) ;
- void DirTree_ClientDump( DirTree *dirTreePtr, void *clientData ) ;
- void DirTree_Dump( DirTree *dirTreePtr ) ;
- DirTree *DirTree_Find( char *path ) ;
- DirTree *DirTree_FindWidget( DirTree *dirTreePtr,
- WidgetToFind kind, Widget w ) ;
- DirTree *DirTree_GrowFiles( DirTree *dtPtr, int inc ) ;
- DirTree *DirTree_GrowBranch( DirTree *dtPtr, int inc ) ;
- void DirTree_Init( DirTree *dp ) ;
- DirTree *DirTree_PresetNew( char *name,
- char *fullName, int normal, int dirLevel ) ;
- void DirTree_TreeDump( DirTree *rootPtr ) ;
- void DirTree_TreeTrav( DirTree *dirTreePtr, TreeOrder travOrder,
- void NodeOp( DirTree *nodePtr, void *clientData ),
- void *clientData ) ;
- int FillFilesList ( DirTree *trvPtr ) ;
-
- #endif /* _dir_h */
-
-