*/
#include <stdio.h>
-#include "selfile.h"
#include "xstat.h"
+#include "selfile.h"
+#include "config.h"
#include <X11/StringDefs.h>
#include <X11/Xaw/Scrollbar.h>
#include <X11/Xaw/Cardinals.h>
#endif
#define ABS(x) (((x) < 0) ? (-(x)) : (x))
-/* added missing prototypes */
-extern char SFstatChar(struct stat*);
-extern int SFchdir(char *);
-void SFvSliderMovedCallback(Widget, int, int);
-
typedef struct {
char *fontname;
} TextData, *textPtr;
XtOffset(textPtr, fontname), XtRString, SF_DEFAULT_FONT},
};
+#if ENABLE_NLS
+extern XFontSet fontSet; //XXX should really be in a .h file
+#else
static XFontStruct *SFfont;
+#endif
static int SFcurrentListY;
void
SFinitFont()
{
+#if ENABLE_NLS
+ XFontSetExtents *fse = XExtentsOfFontSet(fontSet);
+ SFcharWidth = fse->max_logical_extent.width;
+ SFcharAscent = -fse->max_logical_extent.y;
+ SFcharHeight = fse->max_logical_extent.height;
+#else
TextData *data;
data = XtNew(TextData);
SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2;
SFcharAscent = SFfont->max_bounds.ascent;
SFcharHeight = SFcharAscent + SFfont->max_bounds.descent;
+#endif
return;
}
gcValues.foreground = SFfore;
gcValues.background = SFback;
+#if !ENABLE_NLS
gcValues.font = SFfont->fid;
+#endif
SFtextGC = XCreateGC(
SFdisplay,
(unsigned long)
GCForeground |
GCBackground |
+#if !ENABLE_NLS
GCFont |
+#endif
0,
&gcValues
);
continue;
}
}
+#if ENABLE_NLS
+ XmbDrawImageString(
+ SFdisplay,
+ w,
+ fontSet,
+ SFtextGC,
+ x,
+ SFtextYoffset + i * SFentryHeight,
+ entry->shown,
+ strlen(entry->shown)
+ );
+#else
XDrawImageString(
SFdisplay,
w,
entry->shown,
strlen(entry->shown)
);
+#endif
if (dir->vOrigin + i == dir->beginSelection) {
XDrawLine(
SFdisplay,
if (SFdirPtr + (3-NR) + n < SFdirEnd) {
dir = &(SFdirs[SFdirPtr + n + (3-NR)]);
w = XtWindow(selFileLists[n]);
+#if ENABLE_NLS
+ XmbDrawImageString(
+ SFdisplay,
+ w,
+ fontSet,
+ SFtextGC,
+ SFtextX - dir->hOrigin * SFcharWidth,
+ SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
+ dir->dir,
+ strlen(dir->dir)
+ );
+#else
XDrawImageString(
SFdisplay,
w,
dir->dir,
strlen(dir->dir)
);
+#endif
SFdrawStrings(w, dir, 0, SFlistSize - 1);
}
return;
int save;
int n;
- n = (int) p;
+ n = (int)(intptr_t) p;
dir = &(SFdirs[SFdirPtr + n]);
save = dir->vOrigin;
if (SFbuttonPressed) {
SFscrollTimerId = XtAppAddTimeOut(SFapp,
- SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n);
+ SFscrollTimerInterval(), SFscrollTimer, (XtPointer)(intptr_t) n);
}
}
SFscrollTimerAdded = 1;
SFscrollTimerId = XtAppAddTimeOut(SFapp,
SFscrollTimerInterval(), SFscrollTimer,
- (XtPointer) n);
+ (XtPointer)(intptr_t) n);
}
}
dir = &(SFdirs[SFdirPtr + n]);
+
old = dir->vOrigin;
+ if(new == -1) new = old + 1; else if(new == -2) new = old - 1; // [HGM] indicates scroll direction on mousewheel event
+ if(new < 0 || new > dir->nEntries - SFlistSize) return;
dir->vOrigin = new;
if (old == new) {