parent
41bd864b0d
commit
738a6eecde
157
dox/dox.c
157
dox/dox.c
|
@ -69,7 +69,8 @@
|
||||||
|
|
||||||
#define STARTPOS 4 /* to bypass next/prev/exit buttons for key binding positions */
|
#define STARTPOS 4 /* to bypass next/prev/exit buttons for key binding positions */
|
||||||
|
|
||||||
typedef struct _mwmhints {
|
typedef struct _mwmhints
|
||||||
|
{
|
||||||
CARD32 flags;
|
CARD32 flags;
|
||||||
CARD32 functions;
|
CARD32 functions;
|
||||||
CARD32 decorations;
|
CARD32 decorations;
|
||||||
|
@ -87,7 +88,8 @@ Drawable vIcDrw;
|
||||||
#if USE_FNLIB
|
#if USE_FNLIB
|
||||||
FnlibData *pFnlibData;
|
FnlibData *pFnlibData;
|
||||||
#endif
|
#endif
|
||||||
Window win_main, win_title, win_exit, win_next, win_prev, win_text, win_cover;
|
Window win_main, win_title, win_exit, win_next, win_prev, win_text,
|
||||||
|
win_cover;
|
||||||
int w, h, t;
|
int w, h, t;
|
||||||
Imlib_Image *im_text;
|
Imlib_Image *im_text;
|
||||||
Imlib_Image *im_title;
|
Imlib_Image *im_title;
|
||||||
|
@ -100,7 +102,8 @@ Window CreateWindow(Window parent, int x, int y, int ww, int hh);
|
||||||
int ReadHeader(FILE * f);
|
int ReadHeader(FILE * f);
|
||||||
int ReadPages(FILE * f);
|
int ReadPages(FILE * f);
|
||||||
|
|
||||||
Window CreateWindow(Window parent, int x, int y, int ww, int hh)
|
Window
|
||||||
|
CreateWindow(Window parent, int x, int y, int ww, int hh)
|
||||||
{
|
{
|
||||||
Window win;
|
Window win;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
@ -213,7 +216,8 @@ XClearWindow(disp, win_text); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int pagenum;
|
int pagenum;
|
||||||
int i, w, h, x, y;
|
int i, w, h, x, y;
|
||||||
|
@ -223,6 +227,7 @@ int main(int argc, char **argv)
|
||||||
Pixmap draw = 0;
|
Pixmap draw = 0;
|
||||||
Link *l = NULL, *ll = NULL;
|
Link *l = NULL, *ll = NULL;
|
||||||
Imlib_Border ibd;
|
Imlib_Border ibd;
|
||||||
|
|
||||||
#if !USE_IMLIB2
|
#if !USE_IMLIB2
|
||||||
ImlibInitParams params;
|
ImlibInitParams params;
|
||||||
#endif
|
#endif
|
||||||
|
@ -236,7 +241,8 @@ int main(int argc, char **argv)
|
||||||
y = 0;
|
y = 0;
|
||||||
pagenum = 0;
|
pagenum = 0;
|
||||||
|
|
||||||
if((int)(disp = XOpenDisplay(NULL)) < 1) {
|
if ((int)(disp = XOpenDisplay(NULL)) < 1)
|
||||||
|
{
|
||||||
printf("%s: Cannot open X display.\n", argv[0]);
|
printf("%s: Cannot open X display.\n", argv[0]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +286,8 @@ int main(int argc, char **argv)
|
||||||
pFnlibData = Fnlib_init(pI1Ctx);
|
pFnlibData = Fnlib_init(pI1Ctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2)
|
||||||
|
{
|
||||||
printf("usage:\n"
|
printf("usage:\n"
|
||||||
"%s [-page page_number] [-file Edoc_fname] [-size width height] Edoc_dir\n",
|
"%s [-page page_number] [-file Edoc_fname] [-size width height] Edoc_dir\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
|
@ -289,15 +296,18 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
docdir = ".";
|
docdir = ".";
|
||||||
docfile = "MAIN";
|
docfile = "MAIN";
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
if ((!strcmp(argv[i], "-page")) && (i < (argc - 1)))
|
if ((!strcmp(argv[i], "-page")) && (i < (argc - 1)))
|
||||||
pagenum = atoi(argv[++i]);
|
pagenum = atoi(argv[++i]);
|
||||||
else if ((!strcmp(argv[i], "-file")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-file")) && (i < (argc - 1)))
|
||||||
docfile = argv[++i];
|
docfile = argv[++i];
|
||||||
else if ((!strcmp(argv[i], "-size")) && (i < (argc - 2))) {
|
else if ((!strcmp(argv[i], "-size")) && (i < (argc - 2)))
|
||||||
|
{
|
||||||
w = atoi(argv[++i]);
|
w = atoi(argv[++i]);
|
||||||
h = atoi(argv[++i]);
|
h = atoi(argv[++i]);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
docdir = strdup(argv[i]);
|
docdir = strdup(argv[i]);
|
||||||
}
|
}
|
||||||
s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
|
s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
|
||||||
|
@ -323,7 +333,8 @@ int main(int argc, char **argv)
|
||||||
#else
|
#else
|
||||||
f = fopen(s, "rt");
|
f = fopen(s, "rt");
|
||||||
#endif
|
#endif
|
||||||
if (!f) {
|
if (!f)
|
||||||
|
{
|
||||||
strcpy(s, docdir);
|
strcpy(s, docdir);
|
||||||
strcat(s, "/");
|
strcat(s, "/");
|
||||||
strcat(s, docfile);
|
strcat(s, docfile);
|
||||||
|
@ -332,8 +343,10 @@ int main(int argc, char **argv)
|
||||||
#else
|
#else
|
||||||
f = fopen(s, "rt");
|
f = fopen(s, "rt");
|
||||||
#endif
|
#endif
|
||||||
if (!f) {
|
if (!f)
|
||||||
printf("Edoc_dir %s does not contain a %s file\n", docdir, docfile);
|
{
|
||||||
|
printf("Edoc_dir %s does not contain a %s file\n", docdir,
|
||||||
|
docfile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +364,8 @@ int main(int argc, char **argv)
|
||||||
wy = (DisplayHeight(disp, DefaultScreen(disp)) - (h + t)) / 2;
|
wy = (DisplayHeight(disp, DefaultScreen(disp)) - (h + t)) / 2;
|
||||||
#ifdef HAS_XINERAMA
|
#ifdef HAS_XINERAMA
|
||||||
{
|
{
|
||||||
if (XineramaIsActive(disp)) {
|
if (XineramaIsActive(disp))
|
||||||
|
{
|
||||||
Window rt, ch;
|
Window rt, ch;
|
||||||
int d;
|
int d;
|
||||||
unsigned int ud;
|
unsigned int ud;
|
||||||
|
@ -363,12 +377,17 @@ int main(int argc, char **argv)
|
||||||
&d, &d, &ud);
|
&d, &d, &ud);
|
||||||
|
|
||||||
screens = XineramaQueryScreens(disp, &num);
|
screens = XineramaQueryScreens(disp, &num);
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++)
|
||||||
if (pointer_x >= screens[i].x_org) {
|
{
|
||||||
if (pointer_x <= (screens[i].width + screens[i].x_org)) {
|
if (pointer_x >= screens[i].x_org)
|
||||||
if (pointer_y >= screens[i].y_org) {
|
{
|
||||||
|
if (pointer_x <= (screens[i].width + screens[i].x_org))
|
||||||
|
{
|
||||||
|
if (pointer_y >= screens[i].y_org)
|
||||||
|
{
|
||||||
if (pointer_y <= (screens[i].height +
|
if (pointer_y <= (screens[i].height +
|
||||||
screens[i].y_org)) {
|
screens[i].y_org))
|
||||||
|
{
|
||||||
wx = ((screens[i].width - w) / 2)
|
wx = ((screens[i].width - w) / 2)
|
||||||
+ screens[i].x_org;
|
+ screens[i].x_org;
|
||||||
wy = ((screens[i].height - (h + t)) / 2)
|
wy = ((screens[i].height - (h + t)) / 2)
|
||||||
|
@ -385,10 +404,16 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
win_main = CreateWindow(root.win, wx, wy, w, h + t);
|
win_main = CreateWindow(root.win, wx, wy, w, h + t);
|
||||||
win_title = XCreateSimpleWindow(disp, win_main, 0, 0, (w - 64 - 64 - t), t, 0, 0, 0);
|
win_title =
|
||||||
win_prev = XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t), 0, 64, t, 0, 0, 0);
|
XCreateSimpleWindow(disp, win_main, 0, 0, (w - 64 - 64 - t), t, 0, 0, 0);
|
||||||
win_next = XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t) + 64, 0, 64, t, 0, 0, 0);
|
win_prev =
|
||||||
win_exit = XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t) + 64 + 64, 0, t, t, 0, 0, 0);
|
XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t), 0, 64, t, 0, 0, 0);
|
||||||
|
win_next =
|
||||||
|
XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t) + 64, 0, 64, t, 0,
|
||||||
|
0, 0);
|
||||||
|
win_exit =
|
||||||
|
XCreateSimpleWindow(disp, win_main, (w - 64 - 64 - t) + 64 + 64, 0, t, t,
|
||||||
|
0, 0, 0);
|
||||||
win_text = XCreateSimpleWindow(disp, win_main, 0, t, w, h, 0, 0, 0);
|
win_text = XCreateSimpleWindow(disp, win_main, 0, t, w, h, 0, 0, 0);
|
||||||
XSelectInput(disp, win_prev, ButtonPressMask | ButtonReleaseMask);
|
XSelectInput(disp, win_prev, ButtonPressMask | ButtonReleaseMask);
|
||||||
XSelectInput(disp, win_next, ButtonPressMask | ButtonReleaseMask);
|
XSelectInput(disp, win_next, ButtonPressMask | ButtonReleaseMask);
|
||||||
|
@ -418,15 +443,18 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
page_hist[0] = 0;
|
page_hist[0] = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;)
|
||||||
|
{
|
||||||
KeySym key;
|
KeySym key;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
XNextEvent(disp, &ev);
|
XNextEvent(disp, &ev);
|
||||||
switch (ev.type) {
|
switch (ev.type)
|
||||||
|
{
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
key = XLookupKeysym(&ev.xkey, 0);
|
key = XLookupKeysym(&ev.xkey, 0);
|
||||||
switch (key) {
|
switch (key)
|
||||||
|
{
|
||||||
case XK_Escape:
|
case XK_Escape:
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
@ -475,37 +503,47 @@ int main(int argc, char **argv)
|
||||||
ApplyImage2(win_next, im_next2);
|
ApplyImage2(win_next, im_next2);
|
||||||
else if (ev.xbutton.window == win_exit)
|
else if (ev.xbutton.window == win_exit)
|
||||||
ApplyImage2(win_exit, im_exit2);
|
ApplyImage2(win_exit, im_exit2);
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
x = ev.xbutton.x;
|
x = ev.xbutton.x;
|
||||||
y = ev.xbutton.y;
|
y = ev.xbutton.y;
|
||||||
ll = l;
|
ll = l;
|
||||||
while (ll) {
|
while (ll)
|
||||||
|
{
|
||||||
if ((x >= ll->x) && (y >= ll->y) &&
|
if ((x >= ll->x) && (y >= ll->y) &&
|
||||||
(x < (ll->x + ll->w)) && (y < (ll->y + ll->h))) {
|
(x < (ll->x + ll->w)) && (y < (ll->y + ll->h)))
|
||||||
|
{
|
||||||
int pg;
|
int pg;
|
||||||
|
|
||||||
if (!strncmp("EXEC.", ll->name, 5)) {
|
if (!strncmp("EXEC.", ll->name, 5))
|
||||||
if (!fork()) {
|
{
|
||||||
|
if (!fork())
|
||||||
|
{
|
||||||
char *exe;
|
char *exe;
|
||||||
|
|
||||||
exe = &(ll->name[5]);
|
exe = &(ll->name[5]);
|
||||||
execl("/bin/sh", "/bin/sh", "-c", exe, NULL);
|
execl("/bin/sh", "/bin/sh", "-c", exe,
|
||||||
|
NULL);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
} else if (!strncmp("INPUT.", ll->name, 6)) {
|
}
|
||||||
|
else if (!strncmp("INPUT.", ll->name, 6))
|
||||||
|
{
|
||||||
FILE *p;
|
FILE *p;
|
||||||
char *exe, tmp[1024];
|
char *exe, tmp[1024];
|
||||||
|
|
||||||
exe = &(ll->name[6]);
|
exe = &(ll->name[6]);
|
||||||
if (exe[0] != '/') {
|
if (exe[0] != '/')
|
||||||
|
{
|
||||||
sprintf(tmp, "%s/%s", docdir, exe);
|
sprintf(tmp, "%s/%s", docdir, exe);
|
||||||
findLocalizedFile(tmp);
|
findLocalizedFile(tmp);
|
||||||
exe = tmp;
|
exe = tmp;
|
||||||
}
|
}
|
||||||
p = popen(exe, "r");
|
p = popen(exe, "r");
|
||||||
if (p) {
|
if (p)
|
||||||
|
{
|
||||||
int dirlen = 0;
|
int dirlen = 0;
|
||||||
char *sp;
|
char *sp;
|
||||||
|
|
||||||
|
@ -515,7 +553,8 @@ int main(int argc, char **argv)
|
||||||
while ((*sp != '/') && (sp != exe))
|
while ((*sp != '/') && (sp != exe))
|
||||||
sp--;
|
sp--;
|
||||||
dirlen = sp - exe;
|
dirlen = sp - exe;
|
||||||
if (dirlen > 1) {
|
if (dirlen > 1)
|
||||||
|
{
|
||||||
free(docdir);
|
free(docdir);
|
||||||
docdir = malloc(dirlen + 1);
|
docdir = malloc(dirlen + 1);
|
||||||
memcpy(docdir, exe, dirlen);
|
memcpy(docdir, exe, dirlen);
|
||||||
|
@ -535,17 +574,22 @@ int main(int argc, char **argv)
|
||||||
l = RenderPage(draw, pagenum, w, h);
|
l = RenderPage(draw, pagenum, w, h);
|
||||||
UPDATE;
|
UPDATE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pg = GetPage(ll->name);
|
pg = GetPage(ll->name);
|
||||||
if (pg >= 0) {
|
if (pg >= 0)
|
||||||
|
{
|
||||||
FREE_LINKS;
|
FREE_LINKS;
|
||||||
pagenum = pg;
|
pagenum = pg;
|
||||||
page_hist_pos++;
|
page_hist_pos++;
|
||||||
if (page_hist_pos >= page_hist_len) {
|
if (page_hist_pos >= page_hist_len)
|
||||||
|
{
|
||||||
page_hist_len++;
|
page_hist_len++;
|
||||||
page_hist =
|
page_hist =
|
||||||
realloc(page_hist,
|
realloc(page_hist,
|
||||||
sizeof(int) * page_hist_len);
|
sizeof(int) *
|
||||||
|
page_hist_len);
|
||||||
}
|
}
|
||||||
page_hist[page_hist_pos] = pagenum;
|
page_hist[page_hist_pos] = pagenum;
|
||||||
l = RenderPage(draw, pagenum, w, h);
|
l = RenderPage(draw, pagenum, w, h);
|
||||||
|
@ -559,7 +603,8 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if (ev.xbutton.window == win_prev) {
|
if (ev.xbutton.window == win_prev)
|
||||||
|
{
|
||||||
ApplyImage3(win_prev, im_prev1);
|
ApplyImage3(win_prev, im_prev1);
|
||||||
FREE_LINKS;
|
FREE_LINKS;
|
||||||
page_hist_pos--;
|
page_hist_pos--;
|
||||||
|
@ -568,28 +613,35 @@ int main(int argc, char **argv)
|
||||||
pagenum = page_hist[page_hist_pos];
|
pagenum = page_hist[page_hist_pos];
|
||||||
l = RenderPage(draw, pagenum, w, h);
|
l = RenderPage(draw, pagenum, w, h);
|
||||||
UPDATE;
|
UPDATE;
|
||||||
} else if (ev.xbutton.window == win_next) {
|
}
|
||||||
|
else if (ev.xbutton.window == win_next)
|
||||||
|
{
|
||||||
int prev_pagenum;
|
int prev_pagenum;
|
||||||
|
|
||||||
ApplyImage3(win_next, im_next1);
|
ApplyImage3(win_next, im_next1);
|
||||||
prev_pagenum = pagenum;
|
prev_pagenum = pagenum;
|
||||||
pagenum++;
|
pagenum++;
|
||||||
pagenum = FixPage(pagenum);
|
pagenum = FixPage(pagenum);
|
||||||
if (pagenum != prev_pagenum) {
|
if (pagenum != prev_pagenum)
|
||||||
|
{
|
||||||
FREE_LINKS;
|
FREE_LINKS;
|
||||||
page_hist_pos++;
|
page_hist_pos++;
|
||||||
if (page_hist_pos >= page_hist_len) {
|
if (page_hist_pos >= page_hist_len)
|
||||||
|
{
|
||||||
page_hist_len++;
|
page_hist_len++;
|
||||||
page_hist = realloc(page_hist,
|
page_hist = realloc(page_hist,
|
||||||
sizeof(int) * page_hist_len);
|
sizeof(int) * page_hist_len);
|
||||||
|
|
||||||
page_hist[page_hist_pos] = pagenum;
|
page_hist[page_hist_pos] = pagenum;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
page_hist[page_hist_pos] = pagenum;
|
page_hist[page_hist_pos] = pagenum;
|
||||||
l = RenderPage(draw, pagenum, w, h);
|
l = RenderPage(draw, pagenum, w, h);
|
||||||
UPDATE;
|
UPDATE;
|
||||||
}
|
}
|
||||||
} else if (ev.xbutton.window == win_exit) {
|
}
|
||||||
|
else if (ev.xbutton.window == win_exit)
|
||||||
|
{
|
||||||
ApplyImage3(win_exit, im_exit1);
|
ApplyImage3(win_exit, im_exit1);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -608,16 +660,20 @@ int main(int argc, char **argv)
|
||||||
x = ev.xmotion.x;
|
x = ev.xmotion.x;
|
||||||
y = ev.xmotion.y;
|
y = ev.xmotion.y;
|
||||||
ll = l;
|
ll = l;
|
||||||
while (ll) {
|
while (ll)
|
||||||
|
{
|
||||||
if ((x >= ll->x) && (y >= ll->y) &&
|
if ((x >= ll->x) && (y >= ll->y) &&
|
||||||
(x < (ll->x + ll->w)) && (y < (ll->y + ll->h))) {
|
(x < (ll->x + ll->w)) && (y < (ll->y + ll->h)))
|
||||||
|
{
|
||||||
GC gc;
|
GC gc;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
XColor xclr;
|
XColor xclr;
|
||||||
|
|
||||||
if (pl != ll) {
|
if (pl != ll)
|
||||||
if (pl) {
|
{
|
||||||
|
if (pl)
|
||||||
|
{
|
||||||
UPDATE_NOW;
|
UPDATE_NOW;
|
||||||
}
|
}
|
||||||
GetLinkColors(pagenum, &r, &g, &b);
|
GetLinkColors(pagenum, &r, &g, &b);
|
||||||
|
@ -636,7 +692,8 @@ int main(int argc, char **argv)
|
||||||
if (ll)
|
if (ll)
|
||||||
ll = ll->next;
|
ll = ll->next;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found)
|
||||||
|
{
|
||||||
UPDATE_NOW;
|
UPDATE_NOW;
|
||||||
pl = NULL;
|
pl = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,6 @@ extern Drawable vIcDrw;
|
||||||
#include <Fnlib.h>
|
#include <Fnlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define FILEPATH_LEN_MAX 4096
|
#define FILEPATH_LEN_MAX 4096
|
||||||
|
|
||||||
#define DEFAULT_LINKCOLOR_R 30
|
#define DEFAULT_LINKCOLOR_R 30
|
||||||
|
@ -191,7 +190,6 @@ typedef struct _efont Efont;
|
||||||
putenv(envvar);\
|
putenv(envvar);\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct _root
|
typedef struct _root
|
||||||
{
|
{
|
||||||
Window win;
|
Window win;
|
||||||
|
@ -353,6 +351,7 @@ Link *RenderPage(Window win, int page_num, int w, int h);
|
||||||
|
|
||||||
extern Display *disp;
|
extern Display *disp;
|
||||||
extern Root root;
|
extern Root root;
|
||||||
|
|
||||||
#if USE_FNLIB
|
#if USE_FNLIB
|
||||||
extern FnlibData *pFnlibData;
|
extern FnlibData *pFnlibData;
|
||||||
#endif
|
#endif
|
||||||
|
|
47
dox/file.c
47
dox/file.c
|
@ -357,6 +357,7 @@ username(int uid)
|
||||||
static int usr_uid = -1;
|
static int usr_uid = -1;
|
||||||
static char *usr_s = NULL;
|
static char *usr_s = NULL;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
@ -385,6 +386,7 @@ homedir(int uid)
|
||||||
static int usr_uid = -1;
|
static int usr_uid = -1;
|
||||||
static char *usr_s = NULL;
|
static char *usr_s = NULL;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
@ -415,6 +417,7 @@ usershell(int uid)
|
||||||
static int usr_uid = -1;
|
static int usr_uid = -1;
|
||||||
static char *usr_s = NULL;
|
static char *usr_s = NULL;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
@ -619,19 +622,38 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
||||||
char *start, *finish, *ss, *w;
|
char *start, *finish, *ss, *w;
|
||||||
|
|
||||||
int wcflg, mbflg;
|
int wcflg, mbflg;
|
||||||
struct char_class {
|
struct char_class
|
||||||
|
{
|
||||||
char *name;
|
char *name;
|
||||||
wctype_t wt;
|
wctype_t wt;
|
||||||
} *cc, char_class_tbl[] = {
|
} *cc, char_class_tbl[] =
|
||||||
|
{
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
/* Will be supported on glibc 2.1.3 or later */
|
/* Will be supported on glibc 2.1.3 or later */
|
||||||
{"jspace", 0}, {"jhira", 0}, {"jkata", 0}, {"jkanji", 0}, {"jdigit", 0},/* Japanese */
|
{
|
||||||
{"hangul", 0}, {"hanja", 0}, /* Korean */
|
"jspace", 0},
|
||||||
|
{
|
||||||
|
"jhira", 0},
|
||||||
|
{
|
||||||
|
"jkata", 0},
|
||||||
|
{
|
||||||
|
"jkanji", 0},
|
||||||
|
{
|
||||||
|
"jdigit", 0}, /* Japanese */
|
||||||
|
{
|
||||||
|
"hangul", 0},
|
||||||
|
{
|
||||||
|
"hanja", 0}, /* Korean */
|
||||||
/* {"?????"}, {"?????"}, *//* Chinese */
|
/* {"?????"}, {"?????"}, *//* Chinese */
|
||||||
#endif
|
#endif
|
||||||
#ifdef sgi
|
#ifdef sgi
|
||||||
/* SGI IRIX (Japanese, Chinese, Korean, etc..) */
|
/* SGI IRIX (Japanese, Chinese, Korean, etc..) */
|
||||||
{"special", 0}, {"phonogram", 0}, {"ideogram", 0},
|
{
|
||||||
|
"special", 0},
|
||||||
|
{
|
||||||
|
"phonogram", 0},
|
||||||
|
{
|
||||||
|
"ideogram", 0},
|
||||||
#endif
|
#endif
|
||||||
#ifdef sun
|
#ifdef sun
|
||||||
/* {"?????"}, {"?????"}, */
|
/* {"?????"}, {"?????"}, */
|
||||||
|
@ -639,10 +661,10 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
||||||
#ifdef hpux
|
#ifdef hpux
|
||||||
/* {"?????"}, {"?????"}, */
|
/* {"?????"}, {"?????"}, */
|
||||||
#endif
|
#endif
|
||||||
{NULL, 0}
|
{
|
||||||
|
NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
if (!wd)
|
if (!wd)
|
||||||
|
@ -674,9 +696,12 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
||||||
{
|
{
|
||||||
int len, oldflg = 1;
|
int len, oldflg = 1;
|
||||||
|
|
||||||
|
|
||||||
len = mblen(s + i, MB_CUR_MAX);
|
len = mblen(s + i, MB_CUR_MAX);
|
||||||
if ( len < 0 ) { i++; continue; }
|
if (len < 0)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check multibyte character class */
|
/* Check multibyte character class */
|
||||||
if (wcflg)
|
if (wcflg)
|
||||||
|
@ -702,8 +727,7 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
||||||
else
|
else
|
||||||
mbflg = len;
|
mbflg = len;
|
||||||
|
|
||||||
if ((cnt == num) && (
|
if ((cnt == num) && ((s[i] == ' ') || (s[i] == '\t') ||
|
||||||
(s[i] == ' ') || (s[i] == '\t') ||
|
|
||||||
(oldflg != mbflg) || (mbflg > 1)))
|
(oldflg != mbflg) || (mbflg > 1)))
|
||||||
{
|
{
|
||||||
finish = &s[i];
|
finish = &s[i];
|
||||||
|
@ -900,6 +924,7 @@ pathtofile(char *file)
|
||||||
char *p, *cp, *ep;
|
char *p, *cp, *ep;
|
||||||
char *s;
|
char *s;
|
||||||
int len, exelen;
|
int len, exelen;
|
||||||
|
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
if (file[0] == '/')
|
if (file[0] == '/')
|
||||||
#else
|
#else
|
||||||
|
|
102
dox/format.c
102
dox/format.c
|
@ -93,10 +93,8 @@ AddObject(Object * obj)
|
||||||
page[num_pages - 1].obj =
|
page[num_pages - 1].obj =
|
||||||
realloc(page[num_pages - 1].obj,
|
realloc(page[num_pages - 1].obj,
|
||||||
sizeof(Object) * (page[num_pages - 1].count));
|
sizeof(Object) * (page[num_pages - 1].count));
|
||||||
page[num_pages - 1].obj[page[num_pages - 1].count - 1].type =
|
page[num_pages - 1].obj[page[num_pages - 1].count - 1].type = obj->type;
|
||||||
obj->type;
|
page[num_pages - 1].obj[page[num_pages - 1].count - 1].object = obj->object;
|
||||||
page[num_pages - 1].obj[page[num_pages - 1].count - 1].object =
|
|
||||||
obj->object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -671,7 +669,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
word(txt, wc, wd);
|
word(txt, wc, wd);
|
||||||
spaceflag = 1;
|
spaceflag = 1;
|
||||||
}
|
}
|
||||||
if (!wd[0]) eol = 1;
|
if (!wd[0])
|
||||||
|
eol = 1;
|
||||||
|
|
||||||
wc++;
|
wc++;
|
||||||
eot++;
|
eot++;
|
||||||
|
@ -712,18 +711,27 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
linkflg = 0;
|
linkflg = 0;
|
||||||
if ( wd[0] == '_' ) { j++; linkflg++; }
|
if (wd[0] == '_')
|
||||||
|
{
|
||||||
|
j++;
|
||||||
|
linkflg++;
|
||||||
|
}
|
||||||
|
|
||||||
k = strlen(link_txt);
|
k = strlen(link_txt);
|
||||||
for (; wd[j] != '(' && wd[j] != '\0'; j++, k++)
|
for (; wd[j] != '(' && wd[j] != '\0'; j++, k++)
|
||||||
{
|
{
|
||||||
if (wd[j] == '_') link_txt[k] = ' ';
|
if (wd[j] == '_')
|
||||||
else link_txt[k] = wd[j];
|
link_txt[k] = ' ';
|
||||||
if ( linkflg ) wd[ j - 1 ] = link_txt[k];
|
else
|
||||||
else wd[j] = link_txt[k];
|
link_txt[k] = wd[j];
|
||||||
|
if (linkflg)
|
||||||
|
wd[j - 1] = link_txt[k];
|
||||||
|
else
|
||||||
|
wd[j] = link_txt[k];
|
||||||
}
|
}
|
||||||
link_txt[k] = '\0';
|
link_txt[k] = '\0';
|
||||||
if ( linkflg ) wd[ j - 1 ] = '\0';
|
if (linkflg)
|
||||||
|
wd[j - 1] = '\0';
|
||||||
|
|
||||||
if (wd[j] == '(')
|
if (wd[j] == '(')
|
||||||
{
|
{
|
||||||
|
@ -765,7 +773,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
{
|
{
|
||||||
if ((iix >= sx) && (iix <= ssx))
|
if ((iix >= sx) && (iix <= ssx))
|
||||||
{
|
{
|
||||||
if (((ix + iix) / 2) > ((sx + ssx) / 2))
|
if (((ix + iix) / 2) >
|
||||||
|
((sx + ssx) / 2))
|
||||||
ssx = ix - 1;
|
ssx = ix - 1;
|
||||||
else
|
else
|
||||||
sx = iix + 1;
|
sx = iix + 1;
|
||||||
|
@ -803,7 +812,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
|
|
||||||
while (txt_disp[(point + cnt)])
|
while (txt_disp[(point + cnt)])
|
||||||
{
|
{
|
||||||
len = mblen( txt_disp + point + cnt, MB_CUR_MAX);
|
len =
|
||||||
|
mblen(txt_disp + point + cnt, MB_CUR_MAX);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
{
|
{
|
||||||
cnt++;
|
cnt++;
|
||||||
|
@ -814,7 +824,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
p1[cnt] = txt_disp[point + cnt];
|
p1[cnt] = txt_disp[point + cnt];
|
||||||
p1[cnt] = 0;
|
p1[cnt] = 0;
|
||||||
TextSize(&ts, p1, &tw, &th, 17);
|
TextSize(&ts, p1, &tw, &th, 17);
|
||||||
if ((tw > xspace) || (!txt_disp[(point + cnt)]))
|
if ((tw > xspace)
|
||||||
|
|| (!txt_disp[(point + cnt)]))
|
||||||
{
|
{
|
||||||
if (txt_disp[(point + cnt)])
|
if (txt_disp[(point + cnt)])
|
||||||
{
|
{
|
||||||
|
@ -830,9 +841,13 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
}
|
}
|
||||||
wastext = 1;
|
wastext = 1;
|
||||||
TextDraw(&ts, win, p1, x + off, y,
|
TextDraw(&ts, win, p1, x + off, y,
|
||||||
xspace, 99999, 17, justification);
|
xspace, 99999, 17,
|
||||||
|
justification);
|
||||||
y += ts.height;
|
y += ts.height;
|
||||||
if (y >= (h - (pg->padding + ts.height - (ts.height - ts.xfontset_ascent))))
|
if (y >=
|
||||||
|
(h -
|
||||||
|
(pg->padding + ts.height -
|
||||||
|
(ts.height - ts.xfontset_ascent))))
|
||||||
{
|
{
|
||||||
y = pg->padding;
|
y = pg->padding;
|
||||||
x += col_w + pg->padding;
|
x += col_w + pg->padding;
|
||||||
|
@ -848,35 +863,50 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
if (pg->obj[j].type == IMG)
|
if (pg->obj[j].type == IMG)
|
||||||
{
|
{
|
||||||
img = pg->obj[j].object;
|
img = pg->obj[j].object;
|
||||||
if ((img->w > 0) && (img->h > 0))
|
if ((img->w > 0)
|
||||||
|
&& (img->h > 0))
|
||||||
{
|
{
|
||||||
int ix,
|
int ix,
|
||||||
iy,
|
iy, iix, iiy;
|
||||||
iix,
|
|
||||||
iiy;
|
|
||||||
|
|
||||||
ix = img->x;
|
ix = img->x;
|
||||||
iy = img->y;
|
iy = img->y;
|
||||||
iix = img->x + img->w - 1;
|
iix = img->x + img->w - 1;
|
||||||
iiy = img->y + img->h - 1;
|
iiy = img->y + img->h - 1;
|
||||||
|
|
||||||
if ((iy <= ssy) && (iiy >= sy))
|
if ((iy <= ssy)
|
||||||
|
&& (iiy >= sy))
|
||||||
{
|
{
|
||||||
if ((ix >= sx) && (ix <= ssx))
|
if ((ix >= sx)
|
||||||
|
&& (ix <= ssx))
|
||||||
{
|
{
|
||||||
if ((iix >= sx) && (iix <= ssx))
|
if ((iix >= sx)
|
||||||
|
&& (iix <=
|
||||||
|
ssx))
|
||||||
{
|
{
|
||||||
if (((ix + iix) / 2) > ((sx + ssx) / 2))
|
if (((ix +
|
||||||
ssx = ix - 1;
|
iix) /
|
||||||
|
2) >
|
||||||
|
((sx +
|
||||||
|
ssx) /
|
||||||
|
2))
|
||||||
|
ssx =
|
||||||
|
ix -
|
||||||
|
1;
|
||||||
else
|
else
|
||||||
sx = iix + 1;
|
sx =
|
||||||
|
iix +
|
||||||
|
1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ssx = ix - 1;
|
ssx =
|
||||||
|
ix - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((iix >= sx) && (iix <= ssx))
|
else if ((iix >= sx)
|
||||||
|
&& (iix <=
|
||||||
|
ssx))
|
||||||
{
|
{
|
||||||
sx = iix + 1;
|
sx = iix + 1;
|
||||||
}
|
}
|
||||||
|
@ -915,13 +945,15 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
|
|
||||||
gc = XCreateGC(disp, win, 0, &gcv);
|
gc = XCreateGC(disp, win, 0, &gcv);
|
||||||
EGetColor(&ts.fg_col, &rr, &gg, &bb);
|
EGetColor(&ts.fg_col, &rr, &gg, &bb);
|
||||||
ESetColor(&ts.fg_col, pg->linkr, pg->linkg, pg->linkb);
|
ESetColor(&ts.fg_col, pg->linkr, pg->linkg,
|
||||||
|
pg->linkb);
|
||||||
EAllocColor(&ts.fg_col);
|
EAllocColor(&ts.fg_col);
|
||||||
XSetForeground(disp, gc, ts.fg_col.pixel);
|
XSetForeground(disp, gc, ts.fg_col.pixel);
|
||||||
TextSize(&ts, txt_disp, &tw, &th, 17);
|
TextSize(&ts, txt_disp, &tw, &th, 17);
|
||||||
extra = ((xspace - tw) * justification) >> 10;
|
extra = ((xspace - tw) * justification) >> 10;
|
||||||
TextDraw(&ts, win, link_txt, x + off + lx + extra, y,
|
TextDraw(&ts, win, link_txt,
|
||||||
99999, 99999, 17, 0);
|
x + off + lx + extra, y, 99999, 99999,
|
||||||
|
17, 0);
|
||||||
TextSize(&ts, link_txt, &lw, &th, 17);
|
TextSize(&ts, link_txt, &lw, &th, 17);
|
||||||
XDrawLine(disp, win, gc,
|
XDrawLine(disp, win, gc,
|
||||||
x + off + lx + extra,
|
x + off + lx + extra,
|
||||||
|
@ -947,7 +979,10 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
link_txt[0] = '\0';
|
link_txt[0] = '\0';
|
||||||
}
|
}
|
||||||
y += ts.height;
|
y += ts.height;
|
||||||
if (y >= (h - (pg->padding + ts.height - (ts.height - ts.xfontset_ascent))))
|
if (y >=
|
||||||
|
(h -
|
||||||
|
(pg->padding + ts.height -
|
||||||
|
(ts.height - ts.xfontset_ascent))))
|
||||||
{
|
{
|
||||||
y = pg->padding;
|
y = pg->padding;
|
||||||
x += col_w + pg->padding;
|
x += col_w + pg->padding;
|
||||||
|
@ -964,7 +999,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (y >= (h - (pg->padding + ts.height - (ts.height - ts.xfontset_ascent))))
|
if (y >=
|
||||||
|
(h - (pg->padding + ts.height - (ts.height - ts.xfontset_ascent))))
|
||||||
{
|
{
|
||||||
y = pg->padding;
|
y = pg->padding;
|
||||||
x += col_w + pg->padding;
|
x += col_w + pg->padding;
|
||||||
|
|
18
dox/text.c
18
dox/text.c
|
@ -92,7 +92,8 @@ TextStateLoadFont(TextState * ts)
|
||||||
{
|
{
|
||||||
int as, ds;
|
int as, ds;
|
||||||
|
|
||||||
Efont_extents(ts->efont, " ", &as, &ds, NULL, NULL, NULL, NULL, NULL);
|
Efont_extents(ts->efont, " ", &as, &ds, NULL, NULL, NULL,
|
||||||
|
NULL, NULL);
|
||||||
ts->xfontset_ascent = as;
|
ts->xfontset_ascent = as;
|
||||||
ts->height = as + ds;
|
ts->height = as + ds;
|
||||||
}
|
}
|
||||||
|
@ -145,8 +146,7 @@ TextStateLoadFont(TextState * ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextSize(TextState * ts, char *text,
|
TextSize(TextState * ts, char *text, int *width, int *height, int fsize)
|
||||||
int *width, int *height, int fsize)
|
|
||||||
{
|
{
|
||||||
char **lines;
|
char **lines;
|
||||||
int i, num_lines;
|
int i, num_lines;
|
||||||
|
@ -196,7 +196,8 @@ TextSize(TextState * ts, char *text,
|
||||||
{
|
{
|
||||||
XRectangle ret1, ret2;
|
XRectangle ret1, ret2;
|
||||||
|
|
||||||
XmbTextExtents(ts->xfontset, lines[i], strlen(lines[i]), &ret1, &ret2);
|
XmbTextExtents(ts->xfontset, lines[i], strlen(lines[i]), &ret1,
|
||||||
|
&ret2);
|
||||||
*height += ret2.height;
|
*height += ret2.height;
|
||||||
if (ret2.width > *width)
|
if (ret2.width > *width)
|
||||||
*width = ret2.width;
|
*width = ret2.width;
|
||||||
|
@ -234,8 +235,7 @@ TextSize(TextState * ts, char *text,
|
||||||
|
|
||||||
void
|
void
|
||||||
TextDraw(TextState * ts, Window win, char *text,
|
TextDraw(TextState * ts, Window win, char *text,
|
||||||
int x, int y, int w, int h, int fsize,
|
int x, int y, int w, int h, int fsize, int justification)
|
||||||
int justification)
|
|
||||||
{
|
{
|
||||||
char **lines;
|
char **lines;
|
||||||
int i, num_lines;
|
int i, num_lines;
|
||||||
|
@ -319,7 +319,8 @@ TextDraw(TextState * ts, Window win, char *text,
|
||||||
{
|
{
|
||||||
XRectangle ret1, ret2;
|
XRectangle ret1, ret2;
|
||||||
|
|
||||||
XmbTextExtents(ts->xfontset, lines[i], strlen(lines[i]), &ret1, &ret2);
|
XmbTextExtents(ts->xfontset, lines[i], strlen(lines[i]), &ret1,
|
||||||
|
&ret2);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
yy += ts->xfontset_ascent;
|
yy += ts->xfontset_ascent;
|
||||||
xx = x + (((w - ret2.width) * justification) >> 10);
|
xx = x + (((w - ret2.width) * justification) >> 10);
|
||||||
|
@ -384,8 +385,7 @@ TextDraw(TextState * ts, Window win, char *text,
|
||||||
}
|
}
|
||||||
EAllocColor(&ts->fg_col);
|
EAllocColor(&ts->fg_col);
|
||||||
XSetForeground(disp, gc, ts->fg_col.pixel);
|
XSetForeground(disp, gc, ts->fg_col.pixel);
|
||||||
XDrawString(disp, win, gc, xx, yy,
|
XDrawString(disp, win, gc, xx, yy, lines[i], strlen(lines[i]));
|
||||||
lines[i], strlen(lines[i]));
|
|
||||||
yy += ts->xfont->ascent + ts->xfont->descent;
|
yy += ts->xfont->ascent + ts->xfont->descent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
eesh/E.h
3
eesh/E.h
|
@ -213,13 +213,10 @@ extern int debug_level;
|
||||||
void Alert(char *fmt, ...);
|
void Alert(char *fmt, ...);
|
||||||
void InitStringList(void);
|
void InitStringList(void);
|
||||||
void AssignIgnoreFunction(int (*FunctionToAssign) (void *),
|
void AssignIgnoreFunction(int (*FunctionToAssign) (void *),
|
||||||
|
|
||||||
void *params);
|
void *params);
|
||||||
void AssignRestartFunction(int (*FunctionToAssign) (void *),
|
void AssignRestartFunction(int (*FunctionToAssign) (void *),
|
||||||
|
|
||||||
void *params);
|
void *params);
|
||||||
void AssignExitFunction(int (*FunctionToAssign) (void *),
|
void AssignExitFunction(int (*FunctionToAssign) (void *),
|
||||||
|
|
||||||
void *params);
|
void *params);
|
||||||
void AssignTitleText(char *text);
|
void AssignTitleText(char *text);
|
||||||
void AssignIgnoreText(char *text);
|
void AssignIgnoreText(char *text);
|
||||||
|
|
|
@ -230,7 +230,8 @@ cp(char *s, char *ss)
|
||||||
EDBUG_RETURN_;
|
EDBUG_RETURN_;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t moddate(char *s)
|
time_t
|
||||||
|
moddate(char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue