Back to index

tetex-bin  3.0
Functions | Variables
sfPath.h File Reference
#include "xdvi-config.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SFchdir (char *path)
void SFupdatePath (void)
void SFsetText (char *path)
void SFbuttonPressList (Widget w, int n, XButtonPressedEvent *event)
void SFbuttonReleaseList (Widget w, int n, XButtonReleasedEvent *event)
void SFdirModTimer (XtPointer cl, XtIntervalId *id)
char SFstatChar (struct stat *statBuf)

Variables

char SFcurrentPath []
char SFstartDir []
char SFcurrentDir []
SFDirSFdirs
int SFdirEnd
int SFdirPtr

Function Documentation

void SFbuttonPressList ( Widget  w,
int  n,
XButtonPressedEvent *  event 
)

Definition at line 707 of file sfPath.c.

{
    UNUSED(w);
    UNUSED(n);
    UNUSED(event);
    
    SFbuttonPressed = 1;
}
void SFbuttonReleaseList ( Widget  w,
int  n,
XButtonReleasedEvent *  event 
)

Definition at line 717 of file sfPath.c.

{
    SFDir *dir;

    SFbuttonPressed = 0;

    if (SFcurrentInvert[n] != -1) {
       if (n < 2) {
           SFdoNotTouchDirPtr = 1;
       }
       SFdoNotTouchVorigin = 1;
       dir = &(SFdirs[SFdirPtr + n]);
       SFreplaceText(dir,
                    dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown);
       SFmotionList(w, n, (XMotionEvent *)event);
    }
}

Here is the call graph for this function:

int SFchdir ( char *  path)

Definition at line 96 of file sfPath.c.

{
    int result;

    result = 0;

    if (strcmp(path, SFcurrentDir)) {
       result = chdir(path);
       if (!result) {
           (void)strcpy(SFcurrentDir, path);
       }
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFdirModTimer ( XtPointer  cl,
XtIntervalId *  id 
)

Definition at line 837 of file sfPath.c.

{
    static int n = -1;
    static int f = 0;
    char save;
    SFDir *dir;

    UNUSED(cl);
    UNUSED(id);

    fprintf(stderr, "sfdirmodtimer called!\n");
    
    if ((!SFtwiddle) && (SFdirPtr < SFdirEnd)) {
       n++;
       if ((n > 2) || (SFdirPtr + n >= SFdirEnd)) {
           n = 0;
           f++;
           if ((f > 2) || (SFdirPtr + f >= SFdirEnd)) {
              f = 0;
           }
       }
       dir = &(SFdirs[SFdirPtr + n]);
       save = *(dir->path);
       *(dir->path) = 0;
       if (SFchdir(SFcurrentPath)) {
           *(dir->path) = save;

           /*
            * force a re-read
            */
           *(dir->dir) = 0;

           SFupdatePath();
       }
       else {
           *(dir->path) = save;
           if (SFcheckDir(n, dir) || ((f == n) && SFcheckFiles(dir))
              ) {
              SFdrawList(n, SF_DO_SCROLL);
           }
       }
    }

    SFdirModTimerId = XtAppAddTimeOut(SFapp, 1500UL,
                                  SFdirModTimer, (XtPointer) NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFsetText ( char *  path)

Definition at line 693 of file sfPath.c.

{
    XawTextBlock text;

    text.firstPos = 0;
    text.length = strlen(path);
    text.ptr = path;
    text.format = FMT8BIT;

    XawTextReplace(selFileField, 0, strlen(SFtextBuffer), &text);
    XawTextSetInsertionPoint(selFileField, strlen(SFtextBuffer));
}

Here is the call graph for this function:

Here is the caller graph for this function:

char SFstatChar ( struct stat statBuf)

Definition at line 887 of file sfPath.c.

{
    if (S_ISDIR(statBuf->st_mode)) {
       return '/';
    }
    else if (S_ISREG(statBuf->st_mode)) {
       return S_ISXXX(statBuf->st_mode) ? '*' : ' ';
#ifdef S_ISSOCK
    }
    else if (S_ISSOCK(statBuf->st_mode)) {
       return '=';
#endif /* S_ISSOCK */
    }
    else {
       return ' ';
    }
}

Here is the caller graph for this function:

Definition at line 505 of file sfPath.c.

{
    static int alloc;
    static int wasTwiddle = 0;
    char *begin, *end;
    int i, j;
    int prevChange;
    int SFdirPtrSave, SFdirEndSave;
    SFDir *dir;

    if (!SFdirs) {
       SFdirs = (SFDir *) XtMalloc((alloc = 10) * sizeof(SFDir));
       dir = &(SFdirs[0]);
       SFstrdup(&dir->dir, "/");
       (void)SFchdir("/");
       (void)SFgetDir(dir);
       for (j = 1; j < alloc; j++) {
           SFdirs[j].dir = NULL;
       }
       dir->path = SFcurrentPath + 1;
       dir->vOrigin = 0;
       dir->hOrigin = 0;
       dir->changed = 1;
       dir->beginSelection = -1;
       dir->endSelection = -1;
       SFhomeDir.dir = NULL;
    }

    SFdirEndSave = SFdirEnd;
    SFdirEnd = 1;

    SFdirPtrSave = SFdirPtr;
    SFdirPtr = 0;

    begin = NULL;

    if (SFcurrentPath[0] == '~') {
       if (!SFtwiddle) {
           SFtwiddle = 1;
           dir = &(SFdirs[0]);
           SFrootDir = *dir;
           if (!SFhomeDir.dir) {
              SFgetHomeDirs();
           }
           *dir = SFhomeDir;
           dir->changed = 1;
       }
       end = SFcurrentPath;
       SFdoNotTouchDirPtr = 1;
       wasTwiddle = 1;
    }
    else {
       if (SFtwiddle) {
           SFtwiddle = 0;
           dir = &(SFdirs[0]);
           *dir = SFrootDir;
           dir->changed = 1;
       }
       end = SFcurrentPath + 1;
    }

    i = 0;

    prevChange = 0;

    while (*end) {
       while (*end++ == '/') {
           ;
       }
       end--;
       begin = end;
       while ((*end) && (*end++ != '/')) {
           ;
       }
       if ((end - SFcurrentPath <= SFtextPos) && (*(end - 1) == '/')) {
           SFdirPtr = i - 1;
           if (SFdirPtr < 0) {
              SFdirPtr = 0;
           }
       }
       if (*begin) {
           if (*(end - 1) == '/') {
              char save = *end;

              if (SFtwiddle) {
                  if (SFfindHomeDir(begin, end)) {
                     return;
                  }
              }
              *end = 0;
              i++;
              SFdirEnd++;
              if (i >= alloc) {
                  SFdirs = (SFDir *) XtRealloc(
                                           (char *)SFdirs,
                                           (unsigned)((alloc *= 2) *
                                                     sizeof(SFDir))
                     );
                  for (j = alloc / 2; j < alloc; j++) {
                     SFdirs[j].dir = NULL;
                  }
              }
              dir = &(SFdirs[i]);
              if ((!(dir->dir)) || prevChange || strcmp(dir->dir, begin)
                  ) {
                  if (dir->dir) {
                     SFfree(i);
                  }
                  prevChange = 1;
                  SFstrdup(&dir->dir, begin);
                  dir->path = end;
                  dir->vOrigin = 0;
                  dir->hOrigin = 0;
                  dir->changed = 1;
                  dir->beginSelection = -1;
                  dir->endSelection = -1;
                  (void)SFfindFile(dir - 1, begin);
                  if (SFchdir(SFcurrentPath) || SFgetDir(dir)
                     ) {
                     SFunreadableDir(dir);
                     break;
                  }
              }
              *end = save;
              if (!save) {
                  SFunselect();
              }
           }
           else {
              if (SFfindFile(&(SFdirs[SFdirEnd - 1]), begin)) {
                  return;
              }
           }
       }
       else {
           SFunselect();
       }
    }

    if ((end == SFcurrentPath + 1) && (!SFtwiddle)) {
       SFunselect();
    }

    for (i = SFdirEnd; i < alloc; i++) {
       if (SFdirs[i].dir) {
           SFfree(i);
       }
    }

    if (SFdoNotTouchDirPtr) {
       if (wasTwiddle) {
           wasTwiddle = 0;
           SFdirPtr = SFdirEnd - 2;
           if (SFdirPtr < 0) {
              SFdirPtr = 0;
           }
       }
       else {
           SFdirPtr = SFdirPtrSave;
       }
       SFdoNotTouchDirPtr = 0;
    }

    if ((SFdirPtr != SFdirPtrSave) || (SFdirEnd != SFdirEndSave)) {
       XawScrollbarSetThumb(selFileHScroll,
                          (double)(SFdirPtr) / SFdirEnd,
                          (double)(SFdirEnd < 3 ? SFdirEnd : 3) / SFdirEnd);
    }

    if (SFdirPtr != SFdirPtrSave) {
       SFdrawLists(SF_DO_SCROLL);
    }
    else {
       for (i = 0; i < 3; i++) {
           if (SFdirPtr + i < SFdirEnd) {
              if (SFdirs[SFdirPtr + i].changed) {
                  SFdirs[SFdirPtr + i].changed = 0;
                  SFdrawList(i, SF_DO_SCROLL);
              }
           }
           else {
              SFclearList(i, SF_DO_SCROLL);
           }
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char SFcurrentDir[]

Definition at line 99 of file sfSelFile.c.

char SFcurrentPath[]

Definition at line 99 of file sfSelFile.c.

Definition at line 79 of file sfPath.c.

Definition at line 81 of file sfPath.c.

Definition at line 77 of file sfPath.c.

char SFstartDir[]

Definition at line 99 of file sfSelFile.c.