Back to index

tetex-bin  3.0
Defines | Functions | Variables
sfDraw.h File Reference
#include "xdvi-config.h"
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xos.h>
#include <X11/Xaw/Text.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Scrollbar.h>
#include <X11/Xaw/Cardinals.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SF_DO_SCROLL   1
#define SF_DO_NOT_SCROLL   0

Functions

void SFinitFont (void)
void SFcreateGC (void)
void SFclearList (int n, int doScroll)
void SFdrawList (int n, int doScroll)
void SFdrawLists (int doScroll)
void SFenterList (Widget w, int n, XEnterWindowEvent *event)
void SFleaveList (Widget w, int n, XEvent *event)
void SFmotionList (Widget w, int n, XMotionEvent *event)
void SFvFloatSliderMovedCallback (Widget w, int n, float *fnew)
void SFvSliderMovedCallback (Widget w, int n, int new)
void SFvAreaSelectedCallback (Widget w, int n, int pnew)
void SFhSliderMovedCallback (Widget w, int n, float *new)
void SFhAreaSelectedCallback (Widget w, int n, int pnew)
void SFpathSliderMovedCallback (Widget w, XtPointer client_data, float *new)
void SFpathAreaSelectedCallback (Widget w, XtPointer client_data, int pnew)
Boolean SFworkProc (void)

Variables

Pixel SFfore
Pixel SFback
int(* SFfunc )()
Widget selFileField
Widget selFileForm
Widget selFileHScroll
Widget selFileHScrolls []
Widget selFileLists []
Widget selFileVScrolls []
DisplaySFdisplay
int SFcharWidth
int SFcharHeight
int SFcharAscent
XSegment SFsegs []
XSegment SFcompletionSegs []
XawTextPosition SFtextPos
int SFupperX
int SFlowerY
int SFupperY
int SFtextX
int SFtextYoffset
int SFentryWidth
int SFentryHeight
int SFlineToTextH
int SFlineToTextV
int SFbesideText
int SFaboveAndBelowText
int SFcharsPerEntry
int SFlistSize
int SFcurrentInvert []
int SFworkProcAdded
XtAppContext SFapp
int SFpathScrollWidth
int SFvScrollHeight
int SFhScrollWidth
char SFtextBuffer []
int SFbuttonPressed
XtIntervalId SFdirModTimerId

Define Documentation

#define SF_DO_NOT_SCROLL   0

Definition at line 41 of file sfDraw.h.

#define SF_DO_SCROLL   1

Definition at line 40 of file sfDraw.h.


Function Documentation

void SFclearList ( int  n,
int  doScroll 
)

Definition at line 146 of file sfDraw.c.

{
    SFDir *dir;

    SFcurrentInvert[n] = -1;

    XClearWindow(SFdisplay, XtWindow(selFileLists[n]));

    XDrawSegments(SFdisplay, XtWindow(selFileLists[n]), SFlineGC, SFsegs, 2);

    if (doScroll) {
       dir = &(SFdirs[SFdirPtr + n]);

       if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars) {
           XawScrollbarSetThumb(selFileVScrolls[n],
                             (double)dir->vOrigin / dir->nEntries,
                             (double)(dir->nEntries < SFlistSize
                                     ? dir->nEntries
                                     : SFlistSize)
                             / dir->nEntries);

           XawScrollbarSetThumb(selFileHScrolls[n],
                             (double)(dir->hOrigin) / dir->nChars,
                             (double)(dir->nChars < SFcharsPerEntry
                                     ? dir-> nChars : SFcharsPerEntry)
                             / dir->nChars);
       }
       else {
           XawScrollbarSetThumb(selFileVScrolls[n], 0.0, 1.0);
           XawScrollbarSetThumb(selFileHScrolls[n], 0.0, 1.0);
       }
    }
}

Here is the caller graph for this function:

Definition at line 106 of file sfDraw.c.

{
    XGCValues gcValues;
    XRectangle rectangles[1];

/*     XtVaGetValues(selFileLists[0], */
/*              XtNforeground, &(gcValues.foreground), */
/*              XtNbackground, &(gcValues.background), */
/*              NULL); */
    gcValues.foreground = SFfore;

    SFlineGC = XtGetGC(selFileLists[0], (XtGCMask)
                     GCForeground | 0, &gcValues);

    SFscrollGC = XtGetGC(selFileLists[0], (XtGCMask)
                      0, &gcValues);

    gcValues.function = GXinvert;
/*     gcValues.plane_mask = (gcValues.foreground ^ gcValues.background); */
    gcValues.plane_mask = (SFfore ^ SFback);

    SFinvertGC = XtGetGC(selFileLists[0], (XtGCMask)
                      GCFunction | GCPlaneMask | 0, &gcValues);

    gcValues.foreground = SFfore;
    gcValues.background = SFback;
    gcValues.font = SFfont->fid;

    SFtextGC = XCreateGC(SFdisplay, XtWindow(selFileLists[0]), (unsigned long)
                      GCForeground | GCBackground | GCFont | 0, &gcValues);

    rectangles[0].x = SFlineToTextH + SFbesideText;
    rectangles[0].y = 0;
    rectangles[0].width = SFcharsPerEntry * SFcharWidth;
    rectangles[0].height = SFupperY + 1;

    XSetClipRectangles(SFdisplay, SFtextGC, 0, 0, rectangles, 1, Unsorted);
}

Here is the caller graph for this function:

void SFdrawList ( int  n,
int  doScroll 
)

Definition at line 351 of file sfDraw.c.

{
    SFDir *dir;
    Window w;

    SFclearList(n, doScroll);

    if (SFdirPtr + n < SFdirEnd) {
       dir = &(SFdirs[SFdirPtr + n]);
       w = XtWindow(selFileLists[n]);
       XDrawImageString(SFdisplay,
                      w,
                      SFtextGC,
                      SFtextX - dir->hOrigin * SFcharWidth,
                      SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
                      dir->dir, strlen(dir->dir)
           );
       SFdrawStrings(w, dir, 0, SFlistSize - 1);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFdrawLists ( int  doScroll)

Definition at line 373 of file sfDraw.c.

{
    int i;

    for (i = 0; i < 3; i++) {
       SFdrawList(i, doScroll);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFenterList ( Widget  w,
int  n,
XEnterWindowEvent *  event 
)

Definition at line 513 of file sfDraw.c.

{
    int new;

    UNUSED(w);
    
    /* sanity */
    if (SFcurrentInvert[n] != -1) {
       SFinvertEntry(n);
       SFcurrentInvert[n] = -1;
    }

    new = SFnewInvertEntry(n, (XMotionEvent *) event);
    if (new != -1) {
       SFcurrentInvert[n] = new;
       SFinvertEntry(n);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFhAreaSelectedCallback ( Widget  w,
int  n,
int  pnew 
)

Definition at line 696 of file sfDraw.c.

{
    SFDir *dir;
    int new;

    dir = &(SFdirs[SFdirPtr + n]);

    new = dir->hOrigin + (((double)pnew) / SFhScrollWidth) * dir->nChars;

    if (new > dir->nChars - SFcharsPerEntry) {
       new = dir->nChars - SFcharsPerEntry;
    }

    if (new < 0) {
       new = 0;
    }

    if (dir->nChars) {
       float f;

       f = (double)new / dir->nChars;

       XawScrollbarSetThumb(w, f,
                          (double)(dir->nChars < SFcharsPerEntry
                                  ? dir->nChars
                                  : SFcharsPerEntry)
                          / dir->nChars);

       SFhSliderMovedCallback(w, n, &f);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFhSliderMovedCallback ( Widget  w,
int  n,
float *  new 
)

Definition at line 678 of file sfDraw.c.

{
    SFDir *dir;
    int save;

    UNUSED(w);
    
    dir = &(SFdirs[SFdirPtr + n]);
    save = dir->hOrigin;
    dir->hOrigin = (*new) * dir->nChars;
    if (dir->hOrigin == save) {
       return;
    }

    SFdrawList(n, SF_DO_NOT_SCROLL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 64 of file sfDraw.c.

{
    TextData *data;

    data = XtNew(TextData);

    XtGetApplicationResources(selFileForm, (XtPointer) data, textResources,
                           XtNumber(textResources), (Arg *) NULL, ZERO);

    SFfont = XLoadQueryFont(SFdisplay, data->font);
    if (!SFfont) {
       SFfont = XLoadQueryFont(SFdisplay, SF_DEFAULT_FONT);
       if (!SFfont) {
           char sbuf[256];

           (void)sprintf(sbuf, "XsraSelFile: can't get font %s",
                       SF_DEFAULT_FONT);

           XtAppError(SFapp, sbuf);
       }
    }

    TRACE_GUI((stderr, "FONT: width %d, %d\n", SFfont->max_bounds.width, SFfont->min_bounds.width));
    SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2;
    SFcharAscent = SFfont->max_bounds.ascent;
    SFcharHeight = SFcharAscent + SFfont->max_bounds.descent;
    if (SFcharWidth == 0) {
       /* if min_bounds.width = -max_bounds.width, we probably
          have a scalable TT font; try to determine its actual
          width by measuring the letter `x':
       */
       SFcharWidth = XTextWidth(SFfont, "x", 1);
    }
    if (SFcharWidth == 0) { /* last resort */
       SFcharWidth = SFfont->max_bounds.width / 2;
    }
    TRACE_GUI((stderr,
              "Using font measures: charwidth %d, ascent %d, height %d",
              SFcharWidth, SFcharAscent, SFcharHeight));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFleaveList ( Widget  w,
int  n,
XEvent *  event 
)

Definition at line 533 of file sfDraw.c.

{
    UNUSED(w);
    UNUSED(event);
    
    if (SFcurrentInvert[n] != -1) {
       SFinvertEntry(n);
       SFcurrentInvert[n] = -1;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFmotionList ( Widget  w,
int  n,
XMotionEvent *  event 
)

Definition at line 545 of file sfDraw.c.

{
    int new;

    UNUSED(w);
    
    new = SFnewInvertEntry(n, event);

    if (new != SFcurrentInvert[n]) {
       if (SFcurrentInvert[n] != -1) {
           SFinvertEntry(n);
       }
       SFcurrentInvert[n] = new;
       if (new != -1) {
           SFinvertEntry(n);
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFpathAreaSelectedCallback ( Widget  w,
XtPointer  client_data,
int  pnew 
)

Definition at line 767 of file sfDraw.c.

{
    int new;
    float f;

    UNUSED(client_data);
    
    new = SFdirPtr + (((double)pnew) / SFpathScrollWidth) * SFdirEnd;

    if (new > SFdirEnd - 3) {
       new = SFdirEnd - 3;
    }

    if (new < 0) {
       new = 0;
    }

    f = ((double)new) / SFdirEnd;

    XawScrollbarSetThumb(w, f,
                      (double)(SFdirEnd < 3 ? SFdirEnd : 3) / SFdirEnd);

    SFpathSliderMovedCallback(w, (XtPointer) NULL, &f);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFpathSliderMovedCallback ( Widget  w,
XtPointer  client_data,
float *  new 
)

Definition at line 729 of file sfDraw.c.

{
    SFDir *dir;
    int n;
    XawTextPosition pos;
    int SFdirPtrSave;

    UNUSED(w);
    UNUSED(client_data);
    
    SFdirPtrSave = SFdirPtr;
    SFdirPtr = (*new) * SFdirEnd;
    if (SFdirPtr == SFdirPtrSave) {
       return;
    }

    SFdrawLists(SF_DO_SCROLL);

    n = 2;
    while (SFdirPtr + n >= SFdirEnd) {
       n--;
    }

    dir = &(SFdirs[SFdirPtr + n]);

    pos = dir->path - SFcurrentPath;

    if (!strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) {
       pos -= strlen(SFstartDir);
       if (pos < 0) {
           pos = 0;
       }
    }

    XawTextSetInsertionPoint(selFileField, pos);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFvAreaSelectedCallback ( Widget  w,
int  n,
int  pnew 
)

Definition at line 645 of file sfDraw.c.

{
    SFDir *dir;
    int new;

    dir = &(SFdirs[SFdirPtr + n]);

    new = dir->vOrigin + ((double)pnew / SFvScrollHeight) * dir->nEntries;

    if (new > dir->nEntries - SFlistSize) {
       new = dir->nEntries - SFlistSize;
    }

    if (new < 0) {
       new = 0;
    }

    if (dir->nEntries) {
       float f;

       f = ((double)new) / dir->nEntries;

       XawScrollbarSetThumb(w, f,
                          (double)(dir->nEntries < SFlistSize
                                  ? dir->nEntries
                                  : SFlistSize)
                          / dir->nEntries);
    }

    SFvSliderMovedCallback(w, n, new);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFvFloatSliderMovedCallback ( Widget  w,
int  n,
float *  fnew 
)

Definition at line 565 of file sfDraw.c.

{
    int new;

    new = (*fnew) * SFdirs[SFdirPtr + n].nEntries;

    SFvSliderMovedCallback(w, n, new);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SFvSliderMovedCallback ( Widget  w,
int  n,
int  new 
)

Definition at line 575 of file sfDraw.c.

{
    int old;
    Window win;
    SFDir *dir;

    UNUSED(w);
    
    dir = &(SFdirs[SFdirPtr + n]);

    old = dir->vOrigin;
    dir->vOrigin = new;

    if (old == new) {
       return;
    }

    win = XtWindow(selFileLists[n]);

    if (ABS(new - old) < SFlistSize) {
       if (new > old) {
           XCopyArea(SFdisplay,
                    win,
                    win,
                    SFscrollGC,
                    SFlineToTextH,
                    SFlowerY + (new - old) * SFentryHeight,
                    SFentryWidth + SFlineToTextH,
                    (SFlistSize - (new - old)) * SFentryHeight,
                    SFlineToTextH, SFlowerY);
           XClearArea(SFdisplay,
                     win,
                     SFlineToTextH,
                     SFlowerY + (SFlistSize - (new - old)) *
                     SFentryHeight,
                     SFentryWidth + SFlineToTextH,
                     (new - old) * SFentryHeight, False);
           SFdrawStrings(win, dir, SFlistSize - (new - old), SFlistSize - 1);
       }
       else {
           XCopyArea(SFdisplay,
                    win,
                    win,
                    SFscrollGC,
                    SFlineToTextH,
                    SFlowerY,
                    SFentryWidth + SFlineToTextH,
                    (SFlistSize - (old - new)) * SFentryHeight,
                    SFlineToTextH, SFlowerY + (old - new) * SFentryHeight);
           XClearArea(SFdisplay,
                     win,
                     SFlineToTextH,
                     SFlowerY,
                     SFentryWidth + SFlineToTextH,
                     (old - new) * SFentryHeight, False);
           SFdrawStrings(win, dir, 0, old - new);
       }
    }
    else {
       XClearArea(SFdisplay,
                 win,
                 SFlineToTextH,
                 SFlowerY,
                 SFentryWidth + SFlineToTextH,
                 SFlistSize * SFentryHeight, False);
       SFdrawStrings(win, dir, 0, SFlistSize - 1);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 793 of file sfDraw.c.

{
    SFDir *dir;
    SFEntry *entry;

    for (dir = &(SFdirs[SFdirEnd - 1]); dir >= SFdirs; dir--) {
       if (!(dir->nEntries)) {
           continue;
       }
       for (entry = &(dir->entries[dir->nEntries - 1]);
            entry >= dir->entries; entry--) {
           if (!(entry->statDone)) {
              (void)SFstatAndCheck(dir, entry);
              return False;
           }
       }
    }

    SFworkProcAdded = 0;

    return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Widget selFileField

Definition at line 100 of file sfSelFile.c.

Widget selFileForm

Definition at line 100 of file sfSelFile.c.

Definition at line 100 of file sfSelFile.c.

Widget selFileHScrolls[]

Definition at line 100 of file sfSelFile.c.

Widget selFileLists[]

Definition at line 100 of file sfSelFile.c.

Widget selFileVScrolls[]

Definition at line 100 of file sfSelFile.c.

Definition at line 111 of file sfSelFile.c.

XtAppContext SFapp

Definition at line 115 of file sfSelFile.c.

Pixel SFback

Definition at line 102 of file sfSelFile.c.

Definition at line 110 of file sfSelFile.c.

Definition at line 83 of file sfPath.c.

Definition at line 46 of file sfDraw.c.

Definition at line 46 of file sfDraw.c.

Definition at line 112 of file sfSelFile.c.

Definition at line 46 of file sfDraw.c.

XSegment SFcompletionSegs[]

Definition at line 103 of file sfSelFile.c.

Definition at line 48 of file sfDraw.c.

XtIntervalId SFdirModTimerId

Definition at line 118 of file sfSelFile.c.

Definition at line 101 of file sfSelFile.c.

Definition at line 107 of file sfSelFile.c.

Definition at line 107 of file sfSelFile.c.

Pixel SFfore

Definition at line 102 of file sfSelFile.c.

int(* SFfunc)()

Definition at line 119 of file sfSelFile.c.

Definition at line 116 of file sfSelFile.c.

Definition at line 108 of file sfSelFile.c.

Definition at line 109 of file sfSelFile.c.

Definition at line 113 of file sfSelFile.c.

Definition at line 105 of file sfSelFile.c.

Definition at line 116 of file sfSelFile.c.

XSegment SFsegs[]

Definition at line 103 of file sfSelFile.c.

char SFtextBuffer[]

Definition at line 117 of file sfSelFile.c.

XawTextPosition SFtextPos

Definition at line 104 of file sfSelFile.c.

Definition at line 106 of file sfSelFile.c.

Definition at line 106 of file sfSelFile.c.

Definition at line 105 of file sfSelFile.c.

Definition at line 105 of file sfSelFile.c.

Definition at line 116 of file sfSelFile.c.

Definition at line 114 of file sfSelFile.c.