parent
41bd864b0d
commit
738a6eecde
111
dox/dox.h
111
dox/dox.h
|
@ -164,7 +164,6 @@ extern Drawable vIcDrw;
|
|||
#include <Fnlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define FILEPATH_LEN_MAX 4096
|
||||
|
||||
#define DEFAULT_LINKCOLOR_R 30
|
||||
|
@ -191,7 +190,6 @@ typedef struct _efont Efont;
|
|||
putenv(envvar);\
|
||||
}
|
||||
|
||||
|
||||
typedef struct _root
|
||||
{
|
||||
Window win;
|
||||
|
@ -204,83 +202,83 @@ typedef struct _root
|
|||
Root;
|
||||
|
||||
typedef struct _textstate
|
||||
{
|
||||
char *fontname;
|
||||
{
|
||||
char *fontname;
|
||||
#if USE_FNLIB
|
||||
FnlibStyle style;
|
||||
FnlibFont *font;
|
||||
FnlibStyle style;
|
||||
FnlibFont *font;
|
||||
#endif
|
||||
XColor fg_col;
|
||||
XColor bg_col;
|
||||
int effect;
|
||||
Efont *efont;
|
||||
XFontStruct *xfont;
|
||||
XFontSet xfontset;
|
||||
int xfontset_ascent;
|
||||
int height;
|
||||
}
|
||||
XColor fg_col;
|
||||
XColor bg_col;
|
||||
int effect;
|
||||
Efont *efont;
|
||||
XFontStruct *xfont;
|
||||
XFontSet xfontset;
|
||||
int xfontset_ascent;
|
||||
int height;
|
||||
}
|
||||
TextState;
|
||||
|
||||
typedef enum _type
|
||||
{
|
||||
IMG,
|
||||
BR,
|
||||
FONT,
|
||||
P,
|
||||
TEXT,
|
||||
PAGE
|
||||
}
|
||||
{
|
||||
IMG,
|
||||
BR,
|
||||
FONT,
|
||||
P,
|
||||
TEXT,
|
||||
PAGE
|
||||
}
|
||||
Type;
|
||||
|
||||
typedef struct _img
|
||||
{
|
||||
char *src;
|
||||
char *src2;
|
||||
char *src3;
|
||||
int x, y;
|
||||
char *link;
|
||||
int w, h;
|
||||
}
|
||||
{
|
||||
char *src;
|
||||
char *src2;
|
||||
char *src3;
|
||||
int x, y;
|
||||
char *link;
|
||||
int w, h;
|
||||
}
|
||||
Img_;
|
||||
|
||||
typedef struct _font
|
||||
{
|
||||
char *face;
|
||||
int r, g, b;
|
||||
}
|
||||
{
|
||||
char *face;
|
||||
int r, g, b;
|
||||
}
|
||||
Font_;
|
||||
|
||||
typedef struct _p
|
||||
{
|
||||
float align;
|
||||
}
|
||||
{
|
||||
float align;
|
||||
}
|
||||
P_;
|
||||
|
||||
typedef struct _object
|
||||
{
|
||||
Type type;
|
||||
void *object;
|
||||
}
|
||||
{
|
||||
Type type;
|
||||
void *object;
|
||||
}
|
||||
Object;
|
||||
|
||||
typedef struct _page
|
||||
{
|
||||
char *name;
|
||||
int count;
|
||||
Object *obj;
|
||||
int columns;
|
||||
int padding;
|
||||
int linkr, linkg, linkb;
|
||||
char *background;
|
||||
}
|
||||
{
|
||||
char *name;
|
||||
int count;
|
||||
Object *obj;
|
||||
int columns;
|
||||
int padding;
|
||||
int linkr, linkg, linkb;
|
||||
char *background;
|
||||
}
|
||||
Page;
|
||||
|
||||
typedef struct _link
|
||||
{
|
||||
char *name;
|
||||
int x, y, w, h;
|
||||
struct _link *next;
|
||||
}
|
||||
{
|
||||
char *name;
|
||||
int x, y, w, h;
|
||||
struct _link *next;
|
||||
}
|
||||
Link;
|
||||
|
||||
void Efont_extents(Efont * f, char *text,
|
||||
|
@ -353,6 +351,7 @@ Link *RenderPage(Window win, int page_num, int w, int h);
|
|||
|
||||
extern Display *disp;
|
||||
extern Root root;
|
||||
|
||||
#if USE_FNLIB
|
||||
extern FnlibData *pFnlibData;
|
||||
#endif
|
||||
|
|
163
dox/file.c
163
dox/file.c
|
@ -357,6 +357,7 @@ username(int uid)
|
|||
static int usr_uid = -1;
|
||||
static char *usr_s = NULL;
|
||||
char *s;
|
||||
|
||||
#ifndef __EMX__
|
||||
struct passwd *pwd;
|
||||
|
||||
|
@ -373,8 +374,8 @@ username(int uid)
|
|||
return (s);
|
||||
}
|
||||
#else
|
||||
if ((s = getenv("USER")) != NULL)
|
||||
return (s);
|
||||
if ((s = getenv("USER")) != NULL)
|
||||
return (s);
|
||||
#endif
|
||||
return (strdup("unknown"));
|
||||
}
|
||||
|
@ -385,6 +386,7 @@ homedir(int uid)
|
|||
static int usr_uid = -1;
|
||||
static char *usr_s = NULL;
|
||||
char *s;
|
||||
|
||||
#ifndef __EMX__
|
||||
struct passwd *pwd;
|
||||
|
||||
|
@ -401,10 +403,10 @@ homedir(int uid)
|
|||
return (s);
|
||||
}
|
||||
#else
|
||||
if ((s = getenv("HOME")) != NULL)
|
||||
return (s);
|
||||
else if ((s = getenv("TMP")) != NULL)
|
||||
return (s);
|
||||
if ((s = getenv("HOME")) != NULL)
|
||||
return (s);
|
||||
else if ((s = getenv("TMP")) != NULL)
|
||||
return (s);
|
||||
#endif
|
||||
return (strdup("/tmp"));
|
||||
}
|
||||
|
@ -415,6 +417,7 @@ usershell(int uid)
|
|||
static int usr_uid = -1;
|
||||
static char *usr_s = NULL;
|
||||
char *s;
|
||||
|
||||
#ifndef __EMX__
|
||||
struct passwd *pwd;
|
||||
|
||||
|
@ -432,7 +435,7 @@ usershell(int uid)
|
|||
}
|
||||
return (strdup("/bin/sh"));
|
||||
#else
|
||||
return (strdup("sh.exe"));
|
||||
return (strdup("sh.exe"));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -619,30 +622,49 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
|||
char *start, *finish, *ss, *w;
|
||||
|
||||
int wcflg, mbflg;
|
||||
struct char_class {
|
||||
char *name;
|
||||
wctype_t wt;
|
||||
} *cc, char_class_tbl[] = {
|
||||
struct char_class
|
||||
{
|
||||
char *name;
|
||||
wctype_t wt;
|
||||
} *cc, char_class_tbl[] =
|
||||
{
|
||||
#ifdef linux
|
||||
/* 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 */
|
||||
/* {"?????"}, {"?????"},*/ /* Chinese */
|
||||
/* 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 */
|
||||
/* {"?????"}, {"?????"}, *//* Chinese */
|
||||
#endif
|
||||
#ifdef sgi
|
||||
/* SGI IRIX (Japanese, Chinese, Korean, etc..) */
|
||||
{"special", 0}, {"phonogram", 0}, {"ideogram", 0},
|
||||
/* SGI IRIX (Japanese, Chinese, Korean, etc..) */
|
||||
{
|
||||
"special", 0},
|
||||
{
|
||||
"phonogram", 0},
|
||||
{
|
||||
"ideogram", 0},
|
||||
#endif
|
||||
#ifdef sun
|
||||
/* {"?????"}, {"?????"},*/
|
||||
/* {"?????"}, {"?????"}, */
|
||||
#endif
|
||||
#ifdef hpux
|
||||
/* {"?????"}, {"?????"},*/
|
||||
/* {"?????"}, {"?????"}, */
|
||||
#endif
|
||||
{NULL, 0}
|
||||
{
|
||||
NULL, 0}
|
||||
};
|
||||
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
if (!wd)
|
||||
|
@ -655,11 +677,11 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
|||
|
||||
/* Check multibyte character class is available or not */
|
||||
wcflg = 0;
|
||||
for ( cc = char_class_tbl; cc->name != NULL; cc++ )
|
||||
for (cc = char_class_tbl; cc->name != NULL; cc++)
|
||||
{
|
||||
cc->wt = wctype( cc->name );
|
||||
if ( cc->wt != (wctype_t)0 )
|
||||
wcflg = 1;
|
||||
cc->wt = wctype(cc->name);
|
||||
if (cc->wt != (wctype_t) 0)
|
||||
wcflg = 1;
|
||||
}
|
||||
|
||||
cnt = 0;
|
||||
|
@ -672,39 +694,41 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
|||
|
||||
while (s[i])
|
||||
{
|
||||
int len, oldflg=1;
|
||||
int len, oldflg = 1;
|
||||
|
||||
|
||||
len = mblen( s + i, MB_CUR_MAX );
|
||||
if ( len < 0 ) { i++; continue; }
|
||||
len = mblen(s + i, MB_CUR_MAX);
|
||||
if (len < 0)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check multibyte character class */
|
||||
if ( wcflg )
|
||||
if (wcflg)
|
||||
{
|
||||
wchar_t wc;
|
||||
|
||||
mbflg = 1;
|
||||
if ( (mbtowc( &wc, s + i, strlen(s + i) )) != -1 )
|
||||
if ((mbtowc(&wc, s + i, strlen(s + i))) != -1)
|
||||
{
|
||||
for ( cc = char_class_tbl; cc->name != NULL; cc++ )
|
||||
{
|
||||
if ( cc->wt == (wctype_t)0 )
|
||||
continue;
|
||||
for (cc = char_class_tbl; cc->name != NULL; cc++)
|
||||
{
|
||||
if (cc->wt == (wctype_t) 0)
|
||||
continue;
|
||||
|
||||
if ( iswctype( wc, cc->wt ) != 0 )
|
||||
{
|
||||
mbflg = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (iswctype(wc, cc->wt) != 0)
|
||||
{
|
||||
mbflg = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
mbflg = len;
|
||||
mbflg = len;
|
||||
|
||||
if ((cnt == num) && (
|
||||
(s[i] == ' ') || (s[i] == '\t') ||
|
||||
(oldflg != mbflg) || (mbflg > 1) ))
|
||||
if ((cnt == num) && ((s[i] == ' ') || (s[i] == '\t') ||
|
||||
(oldflg != mbflg) || (mbflg > 1)))
|
||||
{
|
||||
finish = &s[i];
|
||||
break;
|
||||
|
@ -712,16 +736,16 @@ word_mb(char *s, int num, char *wd, int *spaceflag)
|
|||
|
||||
if ((s[i] != ' ') && (s[i] != '\t'))
|
||||
{
|
||||
if ( (i == 0) ||
|
||||
(s[i - 1] == ' ') || (s[i - 1] == '\t') ||
|
||||
((oldflg > 1) && (mbflg > 1)) || (oldflg != mbflg) )
|
||||
if ((i == 0) ||
|
||||
(s[i - 1] == ' ') || (s[i - 1] == '\t') ||
|
||||
((oldflg > 1) && (mbflg > 1)) || (oldflg != mbflg))
|
||||
{
|
||||
cnt++;
|
||||
if (cnt == num)
|
||||
{
|
||||
start = &s[i];
|
||||
if ( (s[i - 1] == ' ') || (s[i - 1] == '\t') )
|
||||
*spaceflag = 1;
|
||||
start = &s[i];
|
||||
if ((s[i - 1] == ' ') || (s[i - 1] == '\t'))
|
||||
*spaceflag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -838,7 +862,7 @@ pathtoexec(char *file)
|
|||
#ifndef __EMX__
|
||||
if (file[0] == '/')
|
||||
#else
|
||||
if (_fnisabs(file))
|
||||
if (_fnisabs(file))
|
||||
#endif
|
||||
{
|
||||
if (canexec(file))
|
||||
|
@ -854,7 +878,7 @@ pathtoexec(char *file)
|
|||
#ifndef __EMX__
|
||||
while ((ep = strchr(cp, ':')))
|
||||
#else
|
||||
while ((ep = strchr(cp, ';')))
|
||||
while ((ep = strchr(cp, ';')))
|
||||
#endif
|
||||
{
|
||||
len = ep - cp;
|
||||
|
@ -865,9 +889,9 @@ pathtoexec(char *file)
|
|||
s[len] = 0;
|
||||
s = realloc(s, len + 2 + exelen);
|
||||
#ifdef __EMX__
|
||||
if (s[len-1] != '/')
|
||||
if (s[len - 1] != '/')
|
||||
#endif
|
||||
strcat(s, "/");
|
||||
strcat(s, "/");
|
||||
strcat(s, file);
|
||||
if (canexec(s))
|
||||
return (s);
|
||||
|
@ -883,9 +907,9 @@ pathtoexec(char *file)
|
|||
s[len] = 0;
|
||||
s = realloc(s, len + 2 + exelen);
|
||||
#ifdef __EMX__
|
||||
if (s[len-1] != '/')
|
||||
if (s[len - 1] != '/')
|
||||
#endif
|
||||
strcat(s, "/");
|
||||
strcat(s, "/");
|
||||
strcat(s, file);
|
||||
if (canexec(s))
|
||||
return (s);
|
||||
|
@ -900,10 +924,11 @@ pathtofile(char *file)
|
|||
char *p, *cp, *ep;
|
||||
char *s;
|
||||
int len, exelen;
|
||||
|
||||
#ifndef __EMX__
|
||||
if (file[0] == '/')
|
||||
#else
|
||||
if (_fnisabs(file))
|
||||
if (_fnisabs(file))
|
||||
#endif
|
||||
{
|
||||
if (exists(file))
|
||||
|
@ -919,7 +944,7 @@ pathtofile(char *file)
|
|||
#ifndef __EMX__
|
||||
while ((ep = strchr(cp, ':')))
|
||||
#else
|
||||
while ((ep = strchr(cp, ';')))
|
||||
while ((ep = strchr(cp, ';')))
|
||||
#endif
|
||||
{
|
||||
len = ep - cp;
|
||||
|
@ -930,9 +955,9 @@ pathtofile(char *file)
|
|||
s[len] = 0;
|
||||
s = realloc(s, len + 2 + exelen);
|
||||
#ifdef __EMX__
|
||||
if (s[len-1] != '/')
|
||||
if (s[len - 1] != '/')
|
||||
#endif
|
||||
strcat(s, "/");
|
||||
strcat(s, "/");
|
||||
strcat(s, file);
|
||||
if (exists(s))
|
||||
return (s);
|
||||
|
@ -948,9 +973,9 @@ pathtofile(char *file)
|
|||
s[len] = 0;
|
||||
s = realloc(s, len + 2 + exelen);
|
||||
#ifdef __EMX__
|
||||
if (s[len-1] != '/')
|
||||
if (s[len - 1] != '/')
|
||||
#endif
|
||||
strcat(s, "/");
|
||||
strcat(s, "/");
|
||||
strcat(s, file);
|
||||
if (exists(s))
|
||||
return (s);
|
||||
|
@ -967,10 +992,10 @@ findLocalizedFile(char *fname)
|
|||
int i;
|
||||
|
||||
if (!(lang = setlocale(LC_MESSAGES, NULL)))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
tmp = strdup(fname);
|
||||
lang = strdup(lang); /* lang may be in static space, thus it must
|
||||
lang = strdup(lang); /* lang may be in static space, thus it must
|
||||
* be duplicated before we change it below */
|
||||
p[0] = lang + strlen(lang);
|
||||
p[1] = strchr(lang, '.');
|
||||
|
@ -979,15 +1004,15 @@ findLocalizedFile(char *fname)
|
|||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (p[i] == NULL)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
*p[i] = '\0';
|
||||
sprintf(fname, "%s.%s", tmp, lang);
|
||||
if (exists(fname))
|
||||
{
|
||||
free(tmp);
|
||||
free(lang);
|
||||
return 1;
|
||||
free(tmp);
|
||||
free(lang);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
strcpy(fname, tmp);
|
||||
|
|
226
dox/format.c
226
dox/format.c
|
@ -93,10 +93,8 @@ AddObject(Object * obj)
|
|||
page[num_pages - 1].obj =
|
||||
realloc(page[num_pages - 1].obj,
|
||||
sizeof(Object) * (page[num_pages - 1].count));
|
||||
page[num_pages - 1].obj[page[num_pages - 1].count - 1].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].type = obj->type;
|
||||
page[num_pages - 1].obj[page[num_pages - 1].count - 1].object = obj->object;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -575,7 +573,7 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
im = imlib_load_image(tmp);
|
||||
if (im)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
imlib_context_set_image(im);
|
||||
img->w = imlib_image_get_width();
|
||||
img->h = imlib_image_get_height();
|
||||
imlib_context_set_drawable(win);
|
||||
|
@ -659,83 +657,93 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
int sx, sy, ssx, ssy;
|
||||
char link_txt[1024];
|
||||
char link_link[1024];
|
||||
int spaceflag, oldwc=0;
|
||||
int spaceflag, oldwc = 0;
|
||||
|
||||
wd[0] = 0;
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
if ( MB_CUR_MAX > 1 ) /* If multibyte locale,... */
|
||||
word_mb(txt, wc, wd, &spaceflag);
|
||||
if (MB_CUR_MAX > 1) /* If multibyte locale,... */
|
||||
word_mb(txt, wc, wd, &spaceflag);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
word(txt, wc, wd);
|
||||
spaceflag = 1;
|
||||
word(txt, wc, wd);
|
||||
spaceflag = 1;
|
||||
}
|
||||
if (!wd[0]) eol = 1;
|
||||
if (!wd[0])
|
||||
eol = 1;
|
||||
|
||||
wc++;
|
||||
eot++;
|
||||
strcpy(ss, s);
|
||||
if ( (eot != 1) && spaceflag)
|
||||
if ((eot != 1) && spaceflag)
|
||||
strcat(s, " ");
|
||||
|
||||
if (wd[0] == '_')
|
||||
{
|
||||
link_txt[0] = '\0';
|
||||
link_link[0] = '\0';
|
||||
link = 1;
|
||||
oldwc = wc;
|
||||
TextSize(&ts, s, &lx, &th, 17);
|
||||
}
|
||||
|
||||
if ( link == 1 )
|
||||
{
|
||||
if ( eol || ( (wd[0] != '_') && spaceflag ) ) /* if NO link tag, ... */
|
||||
{
|
||||
link_txt[0] = '\0';
|
||||
link_link[0] = '\0';
|
||||
link = 0;
|
||||
wc = oldwc;
|
||||
link_txt[0] = '\0';
|
||||
link_link[0] = '\0';
|
||||
link = 1;
|
||||
oldwc = wc;
|
||||
TextSize(&ts, s, &lx, &th, 17);
|
||||
}
|
||||
|
||||
if (link == 1)
|
||||
{
|
||||
if (eol || ((wd[0] != '_') && spaceflag)) /* if NO link tag, ... */
|
||||
{
|
||||
link_txt[0] = '\0';
|
||||
link_link[0] = '\0';
|
||||
link = 0;
|
||||
wc = oldwc;
|
||||
#ifdef HAVE_WCTYPE_H
|
||||
if ( MB_CUR_MAX > 1 )
|
||||
word_mb(txt, wc - 1, wd, &spaceflag);
|
||||
else
|
||||
if (MB_CUR_MAX > 1)
|
||||
word_mb(txt, wc - 1, wd, &spaceflag);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
word(txt, wc - 1, wd);
|
||||
spaceflag = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int k, linkflg;
|
||||
{
|
||||
word(txt, wc - 1, wd);
|
||||
spaceflag = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int k, linkflg;
|
||||
|
||||
j = 0;
|
||||
linkflg = 0;
|
||||
if ( wd[0] == '_' ) { j++; linkflg++; }
|
||||
j = 0;
|
||||
linkflg = 0;
|
||||
if (wd[0] == '_')
|
||||
{
|
||||
j++;
|
||||
linkflg++;
|
||||
}
|
||||
|
||||
k = strlen( link_txt );
|
||||
for ( ; wd[j] != '(' && wd[j] != '\0'; j++, k++)
|
||||
{
|
||||
if (wd[j] == '_') link_txt[k] = ' ';
|
||||
else link_txt[k] = wd[j];
|
||||
if ( linkflg ) wd[ j - 1 ] = link_txt[k];
|
||||
else wd[j] = link_txt[k];
|
||||
}
|
||||
link_txt[k] = '\0';
|
||||
if ( linkflg ) wd[ j - 1 ] = '\0';
|
||||
k = strlen(link_txt);
|
||||
for (; wd[j] != '(' && wd[j] != '\0'; j++, k++)
|
||||
{
|
||||
if (wd[j] == '_')
|
||||
link_txt[k] = ' ';
|
||||
else
|
||||
link_txt[k] = wd[j];
|
||||
if (linkflg)
|
||||
wd[j - 1] = link_txt[k];
|
||||
else
|
||||
wd[j] = link_txt[k];
|
||||
}
|
||||
link_txt[k] = '\0';
|
||||
if (linkflg)
|
||||
wd[j - 1] = '\0';
|
||||
|
||||
if ( wd[j] == '(' )
|
||||
{
|
||||
wd[j++] = '\0';
|
||||
strcpy( link_link, wd + j);
|
||||
link_link[ strlen(link_link) - 1 ] = '\0';
|
||||
strcpy( wd, link_txt );
|
||||
link = 2;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (wd[j] == '(')
|
||||
{
|
||||
wd[j++] = '\0';
|
||||
strcpy(link_link, wd + j);
|
||||
link_link[strlen(link_link) - 1] = '\0';
|
||||
strcpy(wd, link_txt);
|
||||
link = 2;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
strcat(s, wd);
|
||||
|
@ -765,7 +773,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
{
|
||||
if ((iix >= sx) && (iix <= ssx))
|
||||
{
|
||||
if (((ix + iix) / 2) > ((sx + ssx) / 2))
|
||||
if (((ix + iix) / 2) >
|
||||
((sx + ssx) / 2))
|
||||
ssx = ix - 1;
|
||||
else
|
||||
sx = iix + 1;
|
||||
|
@ -793,8 +802,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
txt_disp = s;
|
||||
if (((tw > xspace) || (eol)) && (strlen(txt_disp) > 0))
|
||||
{
|
||||
if ( txt_disp[strlen(txt_disp) - 1] == ' ' )
|
||||
txt_disp[strlen(txt_disp) - 1] = 0;
|
||||
if (txt_disp[strlen(txt_disp) - 1] == ' ')
|
||||
txt_disp[strlen(txt_disp) - 1] = 0;
|
||||
|
||||
if ((eot == 1) && (tw > xspace))
|
||||
{
|
||||
|
@ -803,18 +812,20 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
|
||||
while (txt_disp[(point + cnt)])
|
||||
{
|
||||
len = mblen( txt_disp + point + cnt, MB_CUR_MAX);
|
||||
if ( len < 0 )
|
||||
{
|
||||
cnt++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
for ( i = 0; i < len; i++, cnt++ )
|
||||
p1[cnt] = txt_disp[point + cnt];
|
||||
len =
|
||||
mblen(txt_disp + point + cnt, MB_CUR_MAX);
|
||||
if (len < 0)
|
||||
{
|
||||
cnt++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
for (i = 0; i < len; i++, cnt++)
|
||||
p1[cnt] = txt_disp[point + cnt];
|
||||
p1[cnt] = 0;
|
||||
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)])
|
||||
{
|
||||
|
@ -830,9 +841,13 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
}
|
||||
wastext = 1;
|
||||
TextDraw(&ts, win, p1, x + off, y,
|
||||
xspace, 99999, 17, justification);
|
||||
xspace, 99999, 17,
|
||||
justification);
|
||||
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;
|
||||
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)
|
||||
{
|
||||
img = pg->obj[j].object;
|
||||
if ((img->w > 0) && (img->h > 0))
|
||||
if ((img->w > 0)
|
||||
&& (img->h > 0))
|
||||
{
|
||||
int ix,
|
||||
iy,
|
||||
iix,
|
||||
iiy;
|
||||
iy, iix, iiy;
|
||||
|
||||
ix = img->x;
|
||||
iy = img->y;
|
||||
iix = img->x + img->w - 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))
|
||||
ssx = ix - 1;
|
||||
if (((ix +
|
||||
iix) /
|
||||
2) >
|
||||
((sx +
|
||||
ssx) /
|
||||
2))
|
||||
ssx =
|
||||
ix -
|
||||
1;
|
||||
else
|
||||
sx = iix + 1;
|
||||
sx =
|
||||
iix +
|
||||
1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ssx = ix - 1;
|
||||
ssx =
|
||||
ix - 1;
|
||||
}
|
||||
}
|
||||
else if ((iix >= sx) && (iix <= ssx))
|
||||
else if ((iix >= sx)
|
||||
&& (iix <=
|
||||
ssx))
|
||||
{
|
||||
sx = iix + 1;
|
||||
}
|
||||
|
@ -898,7 +928,7 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
wastext = 1;
|
||||
TextDraw(&ts, win, txt_disp, x + off, y,
|
||||
xspace, 99999, 17, justification);
|
||||
if ( link > 1 && !strcmp( wd, link_txt) )
|
||||
if (link > 1 && !strcmp(wd, link_txt))
|
||||
{
|
||||
link = 0;
|
||||
link_link[0] = '\0';
|
||||
|
@ -915,13 +945,15 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
|
||||
gc = XCreateGC(disp, win, 0, &gcv);
|
||||
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);
|
||||
XSetForeground(disp, gc, ts.fg_col.pixel);
|
||||
TextSize(&ts, txt_disp, &tw, &th, 17);
|
||||
extra = ((xspace - tw) * justification) >> 10;
|
||||
TextDraw(&ts, win, link_txt, x + off + lx + extra, y,
|
||||
99999, 99999, 17, 0);
|
||||
TextDraw(&ts, win, link_txt,
|
||||
x + off + lx + extra, y, 99999, 99999,
|
||||
17, 0);
|
||||
TextSize(&ts, link_txt, &lw, &th, 17);
|
||||
XDrawLine(disp, win, gc,
|
||||
x + off + lx + extra,
|
||||
|
@ -947,7 +979,10 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
link_txt[0] = '\0';
|
||||
}
|
||||
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;
|
||||
x += col_w + pg->padding;
|
||||
|
@ -964,7 +999,8 @@ RenderPage(Window win, int page_num, int w, int h)
|
|||
default:
|
||||
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;
|
||||
x += col_w + pg->padding;
|
||||
|
|
18
dox/text.c
18
dox/text.c
|
@ -92,7 +92,8 @@ TextStateLoadFont(TextState * ts)
|
|||
{
|
||||
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->height = as + ds;
|
||||
}
|
||||
|
@ -145,8 +146,7 @@ TextStateLoadFont(TextState * ts)
|
|||
}
|
||||
|
||||
void
|
||||
TextSize(TextState * ts, char *text,
|
||||
int *width, int *height, int fsize)
|
||||
TextSize(TextState * ts, char *text, int *width, int *height, int fsize)
|
||||
{
|
||||
char **lines;
|
||||
int i, num_lines;
|
||||
|
@ -196,7 +196,8 @@ TextSize(TextState * ts, char *text,
|
|||
{
|
||||
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;
|
||||
if (ret2.width > *width)
|
||||
*width = ret2.width;
|
||||
|
@ -234,8 +235,7 @@ TextSize(TextState * ts, char *text,
|
|||
|
||||
void
|
||||
TextDraw(TextState * ts, Window win, char *text,
|
||||
int x, int y, int w, int h, int fsize,
|
||||
int justification)
|
||||
int x, int y, int w, int h, int fsize, int justification)
|
||||
{
|
||||
char **lines;
|
||||
int i, num_lines;
|
||||
|
@ -319,7 +319,8 @@ TextDraw(TextState * ts, Window win, char *text,
|
|||
{
|
||||
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)
|
||||
yy += ts->xfontset_ascent;
|
||||
xx = x + (((w - ret2.width) * justification) >> 10);
|
||||
|
@ -384,8 +385,7 @@ TextDraw(TextState * ts, Window win, char *text,
|
|||
}
|
||||
EAllocColor(&ts->fg_col);
|
||||
XSetForeground(disp, gc, ts->fg_col.pixel);
|
||||
XDrawString(disp, win, gc, xx, yy,
|
||||
lines[i], strlen(lines[i]));
|
||||
XDrawString(disp, win, gc, xx, yy, lines[i], strlen(lines[i]));
|
||||
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 InitStringList(void);
|
||||
void AssignIgnoreFunction(int (*FunctionToAssign) (void *),
|
||||
|
||||
void *params);
|
||||
void AssignRestartFunction(int (*FunctionToAssign) (void *),
|
||||
|
||||
void *params);
|
||||
void AssignExitFunction(int (*FunctionToAssign) (void *),
|
||||
|
||||
void *params);
|
||||
void AssignTitleText(char *text);
|
||||
void AssignIgnoreText(char *text);
|
||||
|
|
|
@ -230,7 +230,8 @@ cp(char *s, char *ss)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
time_t moddate(char *s)
|
||||
time_t
|
||||
moddate(char *s)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
|
|
Loading…
Reference in New Issue