Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/dox
Modified Files:
dox.c dox.h file.c format.c text.c
Log Message:
Indent.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/dox.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- dox.c 19 Jan 2004 22:30:26 -0000 1.22
+++ dox.c 13 Feb 2004 18:13:55 -0000 1.23
@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <unistd.h>
-#if defined(__alpha__) && defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ <
96)) /* gets rid of some misalignment in GCC */
+#if defined(__alpha__) && defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ <
96)) /* gets rid of some misalignment in GCC */
#pragma 2
#endif
@@ -67,111 +67,114 @@
#define PROP_MWM_HINTS_ELEMENTS 4
-#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 {
- CARD32 flags;
- CARD32 functions;
- CARD32 decorations;
- INT32 inputMode;
+typedef struct _mwmhints
+{
+ CARD32 flags;
+ CARD32 functions;
+ CARD32 decorations;
+ INT32 inputMode;
} MWMHints;
-Display *disp;
-Root root;
+Display *disp;
+Root root;
#if !USE_IMLIB2
-ImlibData *pI1Ctx;
-ImlibImage *pIcImg;
-Drawable vIcDrw;
+ImlibData *pI1Ctx;
+ImlibImage *pIcImg;
+Drawable vIcDrw;
#endif
#if USE_FNLIB
-FnlibData *pFnlibData;
+FnlibData *pFnlibData;
#endif
-Window win_main, win_title, win_exit, win_next, win_prev, win_text, win_cover;
-int w, h, t;
-Imlib_Image *im_text;
-Imlib_Image *im_title;
-Imlib_Image *im_prev1, *im_prev2;
-Imlib_Image *im_next1, *im_next2;
-Imlib_Image *im_exit1, *im_exit2;
-char *docdir;
-
-Window CreateWindow(Window parent, int x, int y, int ww, int hh);
-int ReadHeader(FILE * f);
-int ReadPages(FILE * f);
+Window win_main, win_title, win_exit, win_next, win_prev, win_text,
+ win_cover;
+int w, h, t;
+Imlib_Image *im_text;
+Imlib_Image *im_title;
+Imlib_Image *im_prev1, *im_prev2;
+Imlib_Image *im_next1, *im_next2;
+Imlib_Image *im_exit1, *im_exit2;
+char *docdir;
+
+Window CreateWindow(Window parent, int x, int y, int ww, int hh);
+int ReadHeader(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;
- XSetWindowAttributes attr;
- MWMHints mwm;
+ Window win;
+ XSetWindowAttributes attr;
+ MWMHints mwm;
/* Atom a; */
- XSizeHints hnt;
+ XSizeHints hnt;
- attr.backing_store = NotUseful;
- attr.override_redirect = False;
- attr.colormap = root.cmap;
- attr.border_pixel = 0;
- attr.background_pixel = 0;
- attr.save_under = False;
- mwm.flags = MWM_HINTS_DECORATIONS;
- mwm.functions = 0;
- mwm.decorations = 0;
- mwm.inputMode = 0;
+ attr.backing_store = NotUseful;
+ attr.override_redirect = False;
+ attr.colormap = root.cmap;
+ attr.border_pixel = 0;
+ attr.background_pixel = 0;
+ attr.save_under = False;
+ mwm.flags = MWM_HINTS_DECORATIONS;
+ mwm.functions = 0;
+ mwm.decorations = 0;
+ mwm.inputMode = 0;
/* a = XInternAtom(disp, "_MOTIF_WM_HINTS", False); */
- win = XCreateWindow(disp, parent, x, y, ww, hh, 0, root.depth,
- InputOutput, root.vis,
- CWOverrideRedirect | CWSaveUnder |
CWBackingStore |
- CWColormap | CWBackPixel |
CWBorderPixel, &attr);
- XSetWindowBackground(disp, win, 0);
+ win = XCreateWindow(disp, parent, x, y, ww, hh, 0, root.depth,
+ InputOutput, root.vis,
+ CWOverrideRedirect | CWSaveUnder | CWBackingStore |
+ CWColormap | CWBackPixel | CWBorderPixel, &attr);
+ XSetWindowBackground(disp, win, 0);
/* XChangeProperty(disp, win, a, a, 32, PropModeReplace,
* (unsigned char *)&mwm, sizeof(MWMHints) / 4); */
- XStoreName(disp, win, "DOX: Enlightenment Document Viewer");
- hnt.flags = USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize;
- hnt.x = x;
- hnt.y = y;
- hnt.width = ww;
- hnt.height = hh;
- hnt.min_width = ww;
- hnt.max_width = ww;
- hnt.min_height = hh;
- hnt.max_height = hh;
- XSetWMNormalHints(disp, win, &hnt);
- return win;
+ XStoreName(disp, win, "DOX: Enlightenment Document Viewer");
+ hnt.flags = USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize;
+ hnt.x = x;
+ hnt.y = y;
+ hnt.width = ww;
+ hnt.height = hh;
+ hnt.min_width = ww;
+ hnt.max_width = ww;
+ hnt.min_height = hh;
+ hnt.max_height = hh;
+ XSetWMNormalHints(disp, win, &hnt);
+ return win;
}
static Imlib_Image *
LoadImage(const char *file)
{
- Imlib_Image *im;
- char tmp[4096];
+ Imlib_Image *im;
+ char tmp[4096];
- sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
- findLocalizedFile(tmp);
- im = imlib_load_image(tmp);
+ sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
+ findLocalizedFile(tmp);
+ im = imlib_load_image(tmp);
- return im;
+ return im;
}
static void
-ApplyImage1(Window win, Imlib_Image *im)
+ApplyImage1(Window win, Imlib_Image * im)
{
- Pixmap pmap = 0, mask = 0;
+ Pixmap pmap = 0, mask = 0;
- imlib_context_set_image(im);
- imlib_context_set_drawable(win);
- imlib_render_pixmaps_for_whole_image(&pmap, &mask);
- XSetWindowBackgroundPixmap(disp, win, pmap);
- IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
+ imlib_context_set_image(im);
+ imlib_context_set_drawable(win);
+ imlib_render_pixmaps_for_whole_image(&pmap, &mask);
+ XSetWindowBackgroundPixmap(disp, win, pmap);
+ IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
}
static void
-ApplyImage2(Window win, Imlib_Image *im)
+ApplyImage2(Window win, Imlib_Image * im)
{
- imlib_context_set_image(im);
- imlib_context_set_drawable(win);
- imlib_render_image_on_drawable(0, 0);
+ imlib_context_set_image(im);
+ imlib_context_set_drawable(win);
+ imlib_render_image_on_drawable(0, 0);
}
#if USE_IMLIB2
@@ -213,437 +216,491 @@
} \
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- int pagenum;
- int i, w, h, x, y;
- int wx, wy;
- FILE *f;
- char *s, *docfile = NULL;
- Pixmap draw = 0;
- Link *l = NULL, *ll = NULL;
- Imlib_Border ibd;
+ int pagenum;
+ int i, w, h, x, y;
+ int wx, wy;
+ FILE *f;
+ char *s, *docfile = NULL;
+ Pixmap draw = 0;
+ Link *l = NULL, *ll = NULL;
+ Imlib_Border ibd;
+
#if !USE_IMLIB2
- ImlibInitParams params;
+ ImlibInitParams params;
#endif
- int *page_hist = NULL;
- int page_hist_len = 1;
- int page_hist_pos = 0;
-
- w = 512;
- h = 400;
- x = 0;
- y = 0;
- pagenum = 0;
-
- if((int)(disp = XOpenDisplay(NULL)) < 1) {
- printf("%s: Cannot open X display.\n",argv[0]);
- exit(0);
- }
-
- /* now we'll set the locale */
- setlocale(LC_ALL, "");
- if (!XSupportsLocale())
- setlocale(LC_ALL, "C");
- XSetLocaleModifiers("");
- setlocale(LC_ALL, NULL);
+ int *page_hist = NULL;
+ int page_hist_len = 1;
+ int page_hist_pos = 0;
+
+ w = 512;
+ h = 400;
+ x = 0;
+ y = 0;
+ pagenum = 0;
+
+ if ((int)(disp = XOpenDisplay(NULL)) < 1)
+ {
+ printf("%s: Cannot open X display.\n", argv[0]);
+ exit(0);
+ }
+
+ /* now we'll set the locale */
+ setlocale(LC_ALL, "");
+ if (!XSupportsLocale())
+ setlocale(LC_ALL, "C");
+ XSetLocaleModifiers("");
+ setlocale(LC_ALL, NULL);
- /* I dont want any internationalisation of my numeric input & output */
- setlocale(LC_NUMERIC, "C");
+ /* I dont want any internationalisation of my numeric input & output */
+ setlocale(LC_NUMERIC, "C");
- root.scr = DefaultScreen(disp);
+ root.scr = DefaultScreen(disp);
#if USE_IMLIB2
- root.win = DefaultRootWindow(disp);
- root.vis = DefaultVisual(disp, root.scr);
- root.depth = DefaultDepth(disp, root.scr);
- root.cmap = DefaultColormap(disp, root.scr);
-
- imlib_set_color_usage(128);
-
- imlib_context_set_display(disp);
- imlib_context_set_visual(root.vis);
- imlib_context_set_colormap(root.cmap);
- imlib_context_set_dither(1);
- imlib_context_set_dither_mask(0);
+ root.win = DefaultRootWindow(disp);
+ root.vis = DefaultVisual(disp, root.scr);
+ root.depth = DefaultDepth(disp, root.scr);
+ root.cmap = DefaultColormap(disp, root.scr);
+
+ imlib_set_color_usage(128);
+
+ imlib_context_set_display(disp);
+ imlib_context_set_visual(root.vis);
+ imlib_context_set_colormap(root.cmap);
+ imlib_context_set_dither(1);
+ imlib_context_set_dither_mask(0);
#else
- params.flags = PARAMS_IMAGECACHESIZE | PARAMS_PIXMAPCACHESIZE;
- params.imagecachesize = (w * h * 3 * 2);
- params.pixmapcachesize = (w * h * 3 * 2 * 8);
- pI1Ctx = Imlib_init_with_params(disp, ¶ms);
- Imlib_set_render_type(pI1Ctx, RT_DITHER_TRUECOL);
- root.win = pI1Ctx->x.root;
- root.vis = Imlib_get_visual(pI1Ctx);
- root.depth = pI1Ctx->x.depth;
- root.cmap = Imlib_get_colormap(pI1Ctx);
+ params.flags = PARAMS_IMAGECACHESIZE | PARAMS_PIXMAPCACHESIZE;
+ params.imagecachesize = (w * h * 3 * 2);
+ params.pixmapcachesize = (w * h * 3 * 2 * 8);
+ pI1Ctx = Imlib_init_with_params(disp, ¶ms);
+ Imlib_set_render_type(pI1Ctx, RT_DITHER_TRUECOL);
+ root.win = pI1Ctx->x.root;
+ root.vis = Imlib_get_visual(pI1Ctx);
+ root.depth = pI1Ctx->x.depth;
+ root.cmap = Imlib_get_colormap(pI1Ctx);
#endif
#if USE_FNLIB
- pFnlibData = Fnlib_init(pI1Ctx);
+ pFnlibData = Fnlib_init(pI1Ctx);
#endif
- if (argc < 2) {
- printf("usage:\n"
- "%s [-page page_number] [-file Edoc_fname] [-size width
height] Edoc_dir\n",
- argv[0]);
- exit(1);
- }
-
- docdir = ".";
- docfile = "MAIN";
- for (i = 1; i < argc; i++) {
- if ((!strcmp(argv[i], "-page")) && (i < (argc - 1)))
- pagenum = atoi(argv[++i]);
- else if ((!strcmp(argv[i], "-file")) && (i < (argc - 1)))
- docfile = argv[++i];
- else if ((!strcmp(argv[i], "-size")) && (i < (argc - 2))) {
- w = atoi(argv[++i]);
- h = atoi(argv[++i]);
- } else
- docdir = strdup(argv[i]);
- }
- s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
- sprintf(s, "%s/%s", docdir, docfile);
- findLocalizedFile(s);
-
- im_title = LoadImage("title.xpm");
- imlib_context_set_image(im_title);
- ibd.left = 50;
- ibd.right = 2;
- ibd.top = 2;
- ibd.bottom = 2;
- imlib_image_set_border(&ibd);
- im_prev1 = LoadImage("prev1.xpm");
- im_prev2 = LoadImage("prev2.xpm");
- im_next1 = LoadImage("next1.xpm");
- im_next2 = LoadImage("next2.xpm");
- im_exit1 = LoadImage("exit1.xpm");
- im_exit2 = LoadImage("exit2.xpm");
+ if (argc < 2)
+ {
+ printf("usage:\n"
+ "%s [-page page_number] [-file Edoc_fname] [-size width height]
Edoc_dir\n",
+ argv[0]);
+ exit(1);
+ }
+
+ docdir = ".";
+ docfile = "MAIN";
+ for (i = 1; i < argc; i++)
+ {
+ if ((!strcmp(argv[i], "-page")) && (i < (argc - 1)))
+ pagenum = atoi(argv[++i]);
+ else if ((!strcmp(argv[i], "-file")) && (i < (argc - 1)))
+ docfile = argv[++i];
+ else if ((!strcmp(argv[i], "-size")) && (i < (argc - 2)))
+ {
+ w = atoi(argv[++i]);
+ h = atoi(argv[++i]);
+ }
+ else
+ docdir = strdup(argv[i]);
+ }
+ s = malloc(strlen(docdir) + strlen(docfile) + 2 + 20);
+ sprintf(s, "%s/%s", docdir, docfile);
+ findLocalizedFile(s);
+
+ im_title = LoadImage("title.xpm");
+ imlib_context_set_image(im_title);
+ ibd.left = 50;
+ ibd.right = 2;
+ ibd.top = 2;
+ ibd.bottom = 2;
+ imlib_image_set_border(&ibd);
+ im_prev1 = LoadImage("prev1.xpm");
+ im_prev2 = LoadImage("prev2.xpm");
+ im_next1 = LoadImage("next1.xpm");
+ im_next2 = LoadImage("next2.xpm");
+ im_exit1 = LoadImage("exit1.xpm");
+ im_exit2 = LoadImage("exit2.xpm");
#ifndef __EMX__
- f = fopen(s, "r");
+ f = fopen(s, "r");
#else
- f = fopen(s, "rt");
+ f = fopen(s, "rt");
#endif
- if (!f) {
- strcpy(s, docdir);
- strcat(s, "/");
- strcat(s, docfile);
+ if (!f)
+ {
+ strcpy(s, docdir);
+ strcat(s, "/");
+ strcat(s, docfile);
#ifndef __EMX__
- f = fopen(s, "r");
+ f = fopen(s, "r");
#else
- f = fopen(s, "rt");
+ f = fopen(s, "rt");
#endif
- if (!f) {
- printf("Edoc_dir %s does not contain a %s file\n", docdir,
docfile);
- exit(1);
- }
- }
- Esetenv("DISPLAY", DisplayString(disp), 1);
- Esetenv("E_DATADIR", ENLIGHTENMENT_ROOT, 1);
- Esetenv("E_BINDIR", ENLIGHTENMENT_BIN, 1);
-
- t = 16;
- GetObjects(f);
- fclose(f);
+ if (!f)
+ {
+ printf("Edoc_dir %s does not contain a %s file\n", docdir,
+ docfile);
+ exit(1);
+ }
+ }
+ Esetenv("DISPLAY", DisplayString(disp), 1);
+ Esetenv("E_DATADIR", ENLIGHTENMENT_ROOT, 1);
+ Esetenv("E_BINDIR", ENLIGHTENMENT_BIN, 1);
+
+ t = 16;
+ GetObjects(f);
+ fclose(f);
#if USE_FNLIB
- Fnlib_add_dir(pFnlibData, docdir);
+ Fnlib_add_dir(pFnlibData, docdir);
#endif
- wx = (DisplayWidth(disp, DefaultScreen(disp)) - w) / 2;
- wy = (DisplayHeight(disp, DefaultScreen(disp)) - (h + t)) / 2;
+ wx = (DisplayWidth(disp, DefaultScreen(disp)) - w) / 2;
+ wy = (DisplayHeight(disp, DefaultScreen(disp)) - (h + t)) / 2;
#ifdef HAS_XINERAMA
+ {
+ if (XineramaIsActive(disp))
{
- if (XineramaIsActive(disp)) {
- Window rt, ch;
- int d;
- unsigned int ud;
- int pointer_x, pointer_y;
- int num;
- XineramaScreenInfo *screens;
-
- XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y,
- &d, &d, &ud);
-
- screens = XineramaQueryScreens(disp, &num);
- 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_y >= screens[i].y_org) {
- if (pointer_y <=
(screens[i].height +
-
screens[i].y_org)) {
- wx =
((screens[i].width - w) / 2)
- +
screens[i].x_org;
- wy =
((screens[i].height - (h + t)) / 2)
- +
screens[i].y_org;
- }
- }
- }
- }
- }
-
- XFree(screens);
- }
+ Window rt, ch;
+ int d;
+ unsigned int ud;
+ int pointer_x, pointer_y;
+ int num;
+ XineramaScreenInfo *screens;
+
+ XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y,
+ &d, &d, &ud);
+
+ screens = XineramaQueryScreens(disp, &num);
+ 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_y >= screens[i].y_org)
+ {
+ if (pointer_y <= (screens[i].height +
+ screens[i].y_org))
+ {
+ wx = ((screens[i].width - w) / 2)
+ + screens[i].x_org;
+ wy = ((screens[i].height - (h + t)) / 2)
+ + screens[i].y_org;
+ }
+ }
+ }
+ }
+ }
+ XFree(screens);
}
+
+ }
#endif
- 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_prev = 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);
- XSelectInput(disp, win_prev, ButtonPressMask | ButtonReleaseMask);
- XSelectInput(disp, win_next, ButtonPressMask | ButtonReleaseMask);
- XSelectInput(disp, win_exit, ButtonPressMask | ButtonReleaseMask);
- XSelectInput(disp, win_text, ButtonPressMask | ButtonReleaseMask |
- KeyPressMask | KeyReleaseMask | PointerMotionMask);
-
- draw = XCreatePixmap(disp, win_text, w, h, root.depth);
-
- ApplyImage1(win_title, im_title);
- ApplyImage1(win_prev, im_prev1);
- ApplyImage1(win_next, im_next1);
- ApplyImage1(win_exit, im_exit1);
-
- l = RenderPage(draw, pagenum, w, h);
- UPDATE_NOW;
-
- XMapWindow(disp, win_title);
- XMapWindow(disp, win_prev);
- XMapWindow(disp, win_next);
- XMapWindow(disp, win_exit);
- XMapWindow(disp, win_text);
- XMapWindow(disp, win_main);
-
- XSync(disp, False);
- page_hist = malloc(sizeof(int));
-
- page_hist[0] = 0;
-
- for (;;) {
- KeySym key;
- XEvent ev;
-
- XNextEvent(disp, &ev);
- switch (ev.type) {
- case KeyPress:
- key = XLookupKeysym(&ev.xkey, 0);
- switch (key) {
- case XK_Escape:
- exit(0);
- break;
- case XK_Down:
- case XK_Right:
- break;
- case XK_Up:
- case XK_Left:
- break;
- case XK_Return:
- break;
- case XK_Home:
- FREE_LINKS;
- pagenum = 0;
- pagenum = FixPage(pagenum);
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- break;
- case XK_End:
- FREE_LINKS;
- pagenum = 99999;
- pagenum = FixPage(pagenum);
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- break;
- case XK_Prior:
- FREE_LINKS;
- pagenum--;
- pagenum = FixPage(pagenum);
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- break;
- case XK_Next:
- FREE_LINKS;
- pagenum++;
- pagenum = FixPage(pagenum);
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- break;
- }
- break;
- case ButtonPress:
- if (ev.xbutton.window == win_prev)
- ApplyImage2(win_prev, im_prev2);
- else if (ev.xbutton.window == win_next)
- ApplyImage2(win_next, im_next2);
- else if (ev.xbutton.window == win_exit)
- ApplyImage2(win_exit, im_exit2);
- else {
- int x, y;
-
- x = ev.xbutton.x;
- y = ev.xbutton.y;
- ll = l;
- while (ll) {
- if ((x >= ll->x) && (y >= ll->y) &&
- (x < (ll->x + ll->w)) && (y < (ll->y +
ll->h))) {
- int pg;
-
- if (!strncmp("EXEC.", ll->name, 5)) {
- if (!fork()) {
- char *exe;
-
- exe = &(ll->name[5]);
- execl("/bin/sh",
"/bin/sh", "-c", exe, NULL);
- exit(0);
- }
- } else if (!strncmp("INPUT.",
ll->name, 6)) {
- FILE *p;
- char *exe, tmp[1024];
-
- exe = &(ll->name[6]);
- if (exe[0] != '/') {
- sprintf(tmp, "%s/%s",
docdir, exe);
- findLocalizedFile(tmp);
- exe = tmp;
- }
- p = popen(exe, "r");
- if (p) {
- int dirlen = 0;
- char *sp;
-
- sp = exe;
- while ((*sp) && (*sp
!= ' '))
- sp++;
- while ((*sp != '/') &&
(sp != exe))
- sp--;
- dirlen = sp - exe;
- if (dirlen > 1) {
- free(docdir);
- docdir =
malloc(dirlen + 1);
- memcpy(docdir,
exe, dirlen);
- docdir[dirlen]
= 0;
- }
- GetObjects(p);
- pclose(p);
- if (page_hist)
-
free(page_hist);
- page_hist =
malloc(sizeof(int));
-
- page_hist[0] = 0;
- page_hist_len = 1;
- pagenum = 0;
- page_hist_pos = 0;
- FREE_LINKS;
- l = RenderPage(draw,
pagenum, w, h);
- UPDATE;
- }
- } else {
- pg = GetPage(ll->name);
- if (pg >= 0) {
- FREE_LINKS;
- pagenum = pg;
- page_hist_pos++;
- if (page_hist_pos >=
page_hist_len) {
-
page_hist_len++;
- page_hist =
-
realloc(page_hist,
-
sizeof(int) * page_hist_len);
- }
-
page_hist[page_hist_pos] = pagenum;
- l = RenderPage(draw,
pagenum, w, h);
- UPDATE;
- }
- }
- break;
+ 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_prev =
+ 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);
+ XSelectInput(disp, win_prev, ButtonPressMask | ButtonReleaseMask);
+ XSelectInput(disp, win_next, ButtonPressMask | ButtonReleaseMask);
+ XSelectInput(disp, win_exit, ButtonPressMask | ButtonReleaseMask);
+ XSelectInput(disp, win_text, ButtonPressMask | ButtonReleaseMask |
+ KeyPressMask | KeyReleaseMask | PointerMotionMask);
+
+ draw = XCreatePixmap(disp, win_text, w, h, root.depth);
+
+ ApplyImage1(win_title, im_title);
+ ApplyImage1(win_prev, im_prev1);
+ ApplyImage1(win_next, im_next1);
+ ApplyImage1(win_exit, im_exit1);
+
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE_NOW;
+
+ XMapWindow(disp, win_title);
+ XMapWindow(disp, win_prev);
+ XMapWindow(disp, win_next);
+ XMapWindow(disp, win_exit);
+ XMapWindow(disp, win_text);
+ XMapWindow(disp, win_main);
+
+ XSync(disp, False);
+ page_hist = malloc(sizeof(int));
+
+ page_hist[0] = 0;
+
+ for (;;)
+ {
+ KeySym key;
+ XEvent ev;
+
+ XNextEvent(disp, &ev);
+ switch (ev.type)
+ {
+ case KeyPress:
+ key = XLookupKeysym(&ev.xkey, 0);
+ switch (key)
+ {
+ case XK_Escape:
+ exit(0);
+ break;
+ case XK_Down:
+ case XK_Right:
+ break;
+ case XK_Up:
+ case XK_Left:
+ break;
+ case XK_Return:
+ break;
+ case XK_Home:
+ FREE_LINKS;
+ pagenum = 0;
+ pagenum = FixPage(pagenum);
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ break;
+ case XK_End:
+ FREE_LINKS;
+ pagenum = 99999;
+ pagenum = FixPage(pagenum);
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ break;
+ case XK_Prior:
+ FREE_LINKS;
+ pagenum--;
+ pagenum = FixPage(pagenum);
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ break;
+ case XK_Next:
+ FREE_LINKS;
+ pagenum++;
+ pagenum = FixPage(pagenum);
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ break;
+ }
+ break;
+ case ButtonPress:
+ if (ev.xbutton.window == win_prev)
+ ApplyImage2(win_prev, im_prev2);
+ else if (ev.xbutton.window == win_next)
+ ApplyImage2(win_next, im_next2);
+ else if (ev.xbutton.window == win_exit)
+ ApplyImage2(win_exit, im_exit2);
+ else
+ {
+ int x, y;
+
+ x = ev.xbutton.x;
+ y = ev.xbutton.y;
+ ll = l;
+ while (ll)
+ {
+ if ((x >= ll->x) && (y >= ll->y) &&
+ (x < (ll->x + ll->w)) && (y < (ll->y + ll->h)))
+ {
+ int pg;
+
+ if (!strncmp("EXEC.", ll->name, 5))
+ {
+ if (!fork())
+ {
+ char *exe;
+
+ exe = &(ll->name[5]);
+ execl("/bin/sh", "/bin/sh", "-c", exe,
+ NULL);
+ exit(0);
+ }
+ }
+ else if (!strncmp("INPUT.", ll->name, 6))
+ {
+ FILE *p;
+ char *exe, tmp[1024];
+
+ exe = &(ll->name[6]);
+ if (exe[0] != '/')
+ {
+ sprintf(tmp, "%s/%s", docdir, exe);
+ findLocalizedFile(tmp);
+ exe = tmp;
+ }
+ p = popen(exe, "r");
+ if (p)
+ {
+ int dirlen = 0;
+ char *sp;
+
+ sp = exe;
+ while ((*sp) && (*sp != ' '))
+ sp++;
+ while ((*sp != '/') && (sp != exe))
+ sp--;
+ dirlen = sp - exe;
+ if (dirlen > 1)
+ {
+ free(docdir);
+ docdir = malloc(dirlen + 1);
+ memcpy(docdir, exe, dirlen);
+ docdir[dirlen] = 0;
}
- ll = ll->next;
- }
- }
- break;
- case ButtonRelease:
- if (ev.xbutton.window == win_prev) {
- ApplyImage3(win_prev, im_prev1);
- FREE_LINKS;
- page_hist_pos--;
- if (page_hist_pos < 0)
- page_hist_pos = 0;
- pagenum = page_hist[page_hist_pos];
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- } else if (ev.xbutton.window == win_next) {
- int prev_pagenum;
-
- ApplyImage3(win_next, im_next1);
- prev_pagenum = pagenum;
- pagenum++;
- pagenum = FixPage(pagenum);
- if (pagenum != prev_pagenum) {
- FREE_LINKS;
- page_hist_pos++;
- if (page_hist_pos >= page_hist_len) {
- page_hist_len++;
- page_hist = realloc(page_hist,
-
sizeof(int) * page_hist_len);
-
- page_hist[page_hist_pos] = pagenum;
- } else
- page_hist[page_hist_pos] = pagenum;
- l = RenderPage(draw, pagenum, w, h);
- UPDATE;
- }
- } else if (ev.xbutton.window == win_exit) {
- ApplyImage3(win_exit, im_exit1);
- exit(0);
- }
- break;
- case EnterNotify:
- break;
- case LeaveNotify:
- break;
- case MotionNotify:
- while (XCheckTypedEvent(disp, ev.type, &ev));
- {
- int x, y;
- static Link *pl = NULL;
- char found = 0;
-
- x = ev.xmotion.x;
- y = ev.xmotion.y;
- ll = l;
- while (ll) {
- if ((x >= ll->x) && (y >= ll->y) &&
- (x < (ll->x + ll->w)) && (y < (ll->y +
ll->h))) {
- GC gc;
- XGCValues gcv;
- int r, g, b;
- XColor xclr;
-
- if (pl != ll) {
- if (pl) {
- UPDATE_NOW;
- }
- GetLinkColors(pagenum, &r, &g,
&b);
- ESetColor(&xclr, r, g, b);
- EAllocColor(&xclr);
- gc = XCreateGC(disp, win_text,
0, &gcv);
- XSetForeground(disp, gc,
xclr.pixel);
- XDrawRectangle(disp, win_text,
gc, ll->x, ll->y,
-
ll->w, ll->h);
- XFreeGC(disp, gc);
- pl = ll;
- }
- found = 1;
- ll = NULL;
+ GetObjects(p);
+ pclose(p);
+ if (page_hist)
+ free(page_hist);
+ page_hist = malloc(sizeof(int));
+
+ page_hist[0] = 0;
+ page_hist_len = 1;
+ pagenum = 0;
+ page_hist_pos = 0;
+ FREE_LINKS;
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ }
+ }
+ else
+ {
+ pg = GetPage(ll->name);
+ if (pg >= 0)
+ {
+ FREE_LINKS;
+ pagenum = pg;
+ page_hist_pos++;
+ if (page_hist_pos >= page_hist_len)
+ {
+ page_hist_len++;
+ page_hist =
+ realloc(page_hist,
+ sizeof(int) *
+ page_hist_len);
}
- if (ll)
- ll = ll->next;
- }
- if (!found) {
- UPDATE_NOW;
- pl = NULL;
- }
- }
- break;
- default:
- break;
- }
- }
+ page_hist[page_hist_pos] = pagenum;
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ }
+ }
+ break;
+ }
+ ll = ll->next;
+ }
+ }
+ break;
+ case ButtonRelease:
+ if (ev.xbutton.window == win_prev)
+ {
+ ApplyImage3(win_prev, im_prev1);
+ FREE_LINKS;
+ page_hist_pos--;
+ if (page_hist_pos < 0)
+ page_hist_pos = 0;
+ pagenum = page_hist[page_hist_pos];
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ }
+ else if (ev.xbutton.window == win_next)
+ {
+ int prev_pagenum;
+
+ ApplyImage3(win_next, im_next1);
+ prev_pagenum = pagenum;
+ pagenum++;
+ pagenum = FixPage(pagenum);
+ if (pagenum != prev_pagenum)
+ {
+ FREE_LINKS;
+ page_hist_pos++;
+ if (page_hist_pos >= page_hist_len)
+ {
+ page_hist_len++;
+ page_hist = realloc(page_hist,
+ sizeof(int) * page_hist_len);
+
+ page_hist[page_hist_pos] = pagenum;
+ }
+ else
+ page_hist[page_hist_pos] = pagenum;
+ l = RenderPage(draw, pagenum, w, h);
+ UPDATE;
+ }
+ }
+ else if (ev.xbutton.window == win_exit)
+ {
+ ApplyImage3(win_exit, im_exit1);
+ exit(0);
+ }
+ break;
+ case EnterNotify:
+ break;
+ case LeaveNotify:
+ break;
+ case MotionNotify:
+ while (XCheckTypedEvent(disp, ev.type, &ev));
+ {
+ int x, y;
+ static Link *pl = NULL;
+ char found = 0;
+
+ x = ev.xmotion.x;
+ y = ev.xmotion.y;
+ ll = l;
+ while (ll)
+ {
+ if ((x >= ll->x) && (y >= ll->y) &&
+ (x < (ll->x + ll->w)) && (y < (ll->y + ll->h)))
+ {
+ GC gc;
+ XGCValues gcv;
+ int r, g, b;
+ XColor xclr;
+
+ if (pl != ll)
+ {
+ if (pl)
+ {
+ UPDATE_NOW;
+ }
+ GetLinkColors(pagenum, &r, &g, &b);
+ ESetColor(&xclr, r, g, b);
+ EAllocColor(&xclr);
+ gc = XCreateGC(disp, win_text, 0, &gcv);
+ XSetForeground(disp, gc, xclr.pixel);
+ XDrawRectangle(disp, win_text, gc, ll->x, ll->y,
+ ll->w, ll->h);
+ XFreeGC(disp, gc);
+ pl = ll;
+ }
+ found = 1;
+ ll = NULL;
+ }
+ if (ll)
+ ll = ll->next;
+ }
+ if (!found)
+ {
+ UPDATE_NOW;
+ pl = NULL;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/dox.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- dox.h 19 Jan 2004 22:30:26 -0000 1.23
+++ dox.h 13 Feb 2004 18:13:55 -0000 1.24
@@ -164,7 +164,6 @@
#include <Fnlib.h>
#endif
-
#define FILEPATH_LEN_MAX 4096
#define DEFAULT_LINKCOLOR_R 30
@@ -191,7 +190,6 @@
putenv(envvar);\
}
-
typedef struct _root
{
Window win;
@@ -204,83 +202,83 @@
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 @@
extern Display *disp;
extern Root root;
+
#if USE_FNLIB
extern FnlibData *pFnlibData;
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/file.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- file.c 19 Jan 2004 22:30:26 -0000 1.11
+++ file.c 13 Feb 2004 18:13:55 -0000 1.12
@@ -357,6 +357,7 @@
static int usr_uid = -1;
static char *usr_s = NULL;
char *s;
+
#ifndef __EMX__
struct passwd *pwd;
@@ -373,8 +374,8 @@
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 @@
static int usr_uid = -1;
static char *usr_s = NULL;
char *s;
+
#ifndef __EMX__
struct passwd *pwd;
@@ -401,10 +403,10 @@
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 @@
static int usr_uid = -1;
static char *usr_s = NULL;
char *s;
+
#ifndef __EMX__
struct passwd *pwd;
@@ -432,7 +435,7 @@
}
return (strdup("/bin/sh"));
#else
- return (strdup("sh.exe"));
+ return (strdup("sh.exe"));
#endif
}
@@ -619,30 +622,49 @@
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 @@
/* 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 @@
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;
-
- if ( iswctype( wc, cc->wt ) != 0 )
- {
- mbflg = 2;
- break;
- }
- }
+ 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;
+ }
+ }
}
}
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 @@
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 @@
#ifndef __EMX__
if (file[0] == '/')
#else
- if (_fnisabs(file))
+ if (_fnisabs(file))
#endif
{
if (canexec(file))
@@ -854,7 +878,7 @@
#ifndef __EMX__
while ((ep = strchr(cp, ':')))
#else
- while ((ep = strchr(cp, ';')))
+ while ((ep = strchr(cp, ';')))
#endif
{
len = ep - cp;
@@ -865,9 +889,9 @@
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 @@
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 @@
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 @@
#ifndef __EMX__
while ((ep = strchr(cp, ':')))
#else
- while ((ep = strchr(cp, ';')))
+ while ((ep = strchr(cp, ';')))
#endif
{
len = ep - cp;
@@ -930,9 +955,9 @@
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 @@
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 @@
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 @@
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);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/format.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- format.c 19 Jan 2004 22:30:26 -0000 1.14
+++ format.c 13 Feb 2004 18:13:55 -0000 1.15
@@ -93,10 +93,8 @@
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 @@
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 @@
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);
- }
+ {
+ link_txt[0] = '\0';
+ link_link[0] = '\0';
+ link = 1;
+ oldwc = wc;
+ TextSize(&ts, s, &lx, &th, 17);
+ }
- if ( link == 1 )
+ if (link == 1)
{
- if ( eol || ( (wd[0] != '_') && spaceflag ) ) /* if NO link
tag, ... */
- {
- link_txt[0] = '\0';
- link_link[0] = '\0';
- link = 0;
- wc = oldwc;
+ 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;
-
- 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';
-
- 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;
- }
+ {
+ word(txt, wc - 1, wd);
+ spaceflag = 1;
+ }
+ }
+ else
+ {
+ int k, 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';
+
+ 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 @@
{
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/text.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- text.c 19 Jan 2004 22:30:26 -0000 1.11
+++ text.c 13 Feb 2004 18:13:55 -0000 1.12
@@ -92,7 +92,8 @@
{
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 @@
}
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 @@
{
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 @@
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 @@
{
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 @@
}
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;
}
}
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs