Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/dox
Modified Files:
Makefile.am dox.c dox.h format.c text.c
Removed Files:
exit1.xpm exit2.xpm next1.xpm next2.xpm prev1.xpm prev2.xpm
title.xpm
Log Message:
dox -> imlib2.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Makefile.am 15 Jul 2003 18:35:02 -0000 1.8
+++ Makefile.am 16 Nov 2003 19:44:01 -0000 1.9
@@ -10,13 +10,6 @@
ttfont.c \
text.c \
dox.c \
- title.xpm \
- prev1.xpm \
- prev2.xpm \
- next1.xpm \
- next2.xpm \
- exit1.xpm \
- exit2.xpm \
dox.h
LDADD = $(TTF_LIBS) $(FNLIB_LIBS) $(IMLIB_LIBS) $(XINERAMA_LIBS) -lm
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/dox.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- dox.c 5 Nov 2003 17:24:39 -0000 1.20
+++ dox.c 16 Nov 2003 19:44:01 -0000 1.21
@@ -36,10 +36,6 @@
#include <X11/extensions/Xinerama.h>
#endif
-#include <Imlib.h>
-#if USE_FNLIB
-#include <Fnlib.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -80,26 +76,24 @@
INT32 inputMode;
} MWMHints;
-#include "title.xpm"
-#include "prev1.xpm"
-#include "prev2.xpm"
-#include "next1.xpm"
-#include "next2.xpm"
-#include "exit1.xpm"
-#include "exit2.xpm"
-
Display *disp;
-ImlibData *pImlibData;
+Root root;
+
+#if !USE_IMLIB2
+ImlibData *pI1Ctx;
+ImlibImage *pIcImg;
+Drawable vIcDrw;
+#endif
#if USE_FNLIB
FnlibData *pFnlibData;
#endif
Window win_main, win_title, win_exit, win_next, win_prev, win_text, win_cover;
int w, h, t;
-ImlibImage *im_text;
-ImlibImage *im_title;
-ImlibImage *im_prev1, *im_prev2;
-ImlibImage *im_next1, *im_next2;
-ImlibImage *im_exit1, *im_exit2;
+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);
@@ -117,7 +111,7 @@
attr.backing_store = NotUseful;
attr.override_redirect = False;
- attr.colormap = Imlib_get_colormap(pImlibData);
+ attr.colormap = root.cmap;
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = False;
@@ -126,8 +120,8 @@
mwm.decorations = 0;
mwm.inputMode = 0;
/* a = XInternAtom(disp, "_MOTIF_WM_HINTS", False); */
- win = XCreateWindow(disp, parent, x, y, ww, hh, 0, pImlibData->x.depth,
- InputOutput,
Imlib_get_visual(pImlibData),
+ 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);
@@ -147,6 +141,46 @@
return win;
}
+static Imlib_Image *
+LoadImage(const char *file)
+{
+ Imlib_Image *im;
+ char tmp[4096];
+
+ sprintf(tmp, "%s/E-docs/%s", ENLIGHTENMENT_ROOT, file);
+ findLocalizedFile(tmp);
+ im = imlib_load_image(tmp);
+
+ return im;
+}
+
+static void
+ApplyImage1(Window win, Imlib_Image *im)
+{
+ 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);
+}
+
+static void
+ApplyImage2(Window win, Imlib_Image *im)
+{
+ imlib_context_set_image(im);
+ imlib_context_set_drawable(win);
+ imlib_render_image_on_drawable(0, 0);
+}
+
+#if USE_IMLIB2
+#define ApplyImage3(win, im) \
+ XClearWindow(disp, win)
+#else
+#define ApplyImage3 ApplyImage2
+#endif
+
#define FREE_LINKS \
ll = l; \
while (ll) \
@@ -188,8 +222,10 @@
char *s, *docfile = NULL;
Pixmap draw = 0;
Link *l = NULL, *ll = NULL;
- ImlibBorder ibd;
+ Imlib_Border ibd;
+#if !USE_IMLIB2
ImlibInitParams params;
+#endif
int *page_hist = NULL;
int page_hist_len = 1;
int page_hist_pos = 0;
@@ -215,34 +251,42 @@
/* I dont want any internationalisation of my numeric input & output */
setlocale(LC_NUMERIC, "C");
+ 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);
+#else
params.flags = PARAMS_IMAGECACHESIZE | PARAMS_PIXMAPCACHESIZE;
params.imagecachesize = (w * h * 3 * 2);
params.pixmapcachesize = (w * h * 3 * 2 * 8);
- pImlibData = Imlib_init_with_params(disp, ¶ms);
- Imlib_set_render_type(pImlibData, RT_DITHER_TRUECOL);
+ 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(pImlibData);
+ pFnlibData = Fnlib_init(pI1Ctx);
#endif
- im_title = Imlib_create_image_from_xpm_data(pImlibData, title_xpm);
- ibd.left = 50;
- ibd.right = 2;
- ibd.top = 2;
- ibd.bottom = 2;
- Imlib_set_image_border(pImlibData, im_title, &ibd);
- im_prev1 = Imlib_create_image_from_xpm_data(pImlibData, prev1_xpm);
- im_prev2 = Imlib_create_image_from_xpm_data(pImlibData, prev2_xpm);
- im_next1 = Imlib_create_image_from_xpm_data(pImlibData, next1_xpm);
- im_next2 = Imlib_create_image_from_xpm_data(pImlibData, next2_xpm);
- im_exit1 = Imlib_create_image_from_xpm_data(pImlibData, exit1_xpm);
- im_exit2 = Imlib_create_image_from_xpm_data(pImlibData, 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++) {
@@ -260,6 +304,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");
#else
@@ -301,7 +359,7 @@
int num;
XineramaScreenInfo *screens;
- XQueryPointer(disp, pImlibData->x.root, &rt, &ch, &pointer_x,
&pointer_y,
+ XQueryPointer(disp, root.win, &rt, &ch, &pointer_x, &pointer_y,
&d, &d, &ud);
screens = XineramaQueryScreens(disp, &num);
@@ -326,32 +384,35 @@
}
#endif
- win_main = CreateWindow(pImlibData->x.root, wx, wy, w, h + t);
- win_title = CreateWindow(win_main, 0, 0, (w - 64 - 64 - t), t);
- win_prev = CreateWindow(win_main, (w - 64 - 64 - t), 0, 64, 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_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);
- win_next = CreateWindow(win_main, (w - 64 - 64 - t) + 64, 0, 64, t);
XSelectInput(disp, win_next, ButtonPressMask | ButtonReleaseMask);
- win_exit = CreateWindow(win_main, (w - 64 - 64 - t) + 64 + 64, 0, t, t);
XSelectInput(disp, win_exit, ButtonPressMask | ButtonReleaseMask);
- win_text = CreateWindow(win_main, 0, t, w, h);
XSelectInput(disp, win_text, ButtonPressMask | ButtonReleaseMask |
KeyPressMask | KeyReleaseMask | PointerMotionMask);
- draw = XCreatePixmap(disp, win_text, w, h, pImlibData->x.depth);
- XSetWindowBackgroundPixmap(disp, win_text, draw);
- Imlib_apply_image(pImlibData, im_title, win_title);
- Imlib_apply_image(pImlibData, im_exit1, win_exit);
- Imlib_apply_image(pImlibData, im_next1, win_next);
- Imlib_apply_image(pImlibData, im_prev1, win_prev);
+
+ 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_text);
- XMapWindow(disp, win_exit);
- XMapWindow(disp, win_next);
- XMapWindow(disp, win_prev);
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));
@@ -409,11 +470,11 @@
break;
case ButtonPress:
if (ev.xbutton.window == win_prev)
- Imlib_apply_image(pImlibData, im_prev2, win_prev);
+ ApplyImage2(win_prev, im_prev2);
else if (ev.xbutton.window == win_next)
- Imlib_apply_image(pImlibData, im_next2, win_next);
+ ApplyImage2(win_next, im_next2);
else if (ev.xbutton.window == win_exit)
- Imlib_apply_image(pImlibData, im_exit2, win_exit);
+ ApplyImage2(win_exit, im_exit2);
else {
int x, y;
@@ -499,7 +560,7 @@
break;
case ButtonRelease:
if (ev.xbutton.window == win_prev) {
- Imlib_apply_image(pImlibData, im_prev1, win_prev);
+ ApplyImage3(win_prev, im_prev1);
FREE_LINKS;
page_hist_pos--;
if (page_hist_pos < 0)
@@ -510,7 +571,7 @@
} else if (ev.xbutton.window == win_next) {
int prev_pagenum;
- Imlib_apply_image(pImlibData, im_next1, win_next);
+ ApplyImage3(win_next, im_next1);
prev_pagenum = pagenum;
pagenum++;
pagenum = FixPage(pagenum);
@@ -529,7 +590,7 @@
UPDATE;
}
} else if (ev.xbutton.window == win_exit) {
- Imlib_apply_image(pImlibData, im_exit1, win_exit);
+ ApplyImage3(win_exit, im_exit1);
exit(0);
}
break;
@@ -553,14 +614,17 @@
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,
Imlib_best_color_match(pImlibData, &r, &g, &b));
+ XSetForeground(disp, gc,
xclr.pixel);
XDrawRectangle(disp, win_text,
gc, ll->x, ll->y,
ll->w, ll->h);
XFreeGC(disp, gc);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/dox.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- dox.h 5 Nov 2003 17:24:39 -0000 1.19
+++ dox.h 16 Nov 2003 19:44:01 -0000 1.20
@@ -33,10 +33,6 @@
#include <X11/cursorfont.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/XShm.h>
-#include <Imlib.h>
-#if USE_FNLIB
-#include <Fnlib.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -63,6 +59,118 @@
#include <freetype.h>
#endif
+#define ESetColor(pxc, r, g, b) \
+ ({ (pxc)->red = ((r)<<8)|r; (pxc)->green = ((g)<<8)|g; (pxc)->blue =
((b)<<8)|b; })
+#define EGetColor(pxc, pr, pg, pb) \
+ ({ *(pr) = ((pxc)->red)>>8; *(pg) = ((pxc)->green)>>8; *(pb) =
((pxc)->blue)>>8; })
+
+#if USE_IMLIB2
+#include <Imlib2.h>
+
+#define IMLIB1_SET_CONTEXT(root_ctx)
+
+#define EAllocColor(pxc) \
+ XAllocColor(disp, root.cmap, pxc)
+
+#define IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask) \
+ imlib_free_pixmap_and_mask(pmap)
+
+#define IC_RenderDepth() DefaultDepth(disp, root.scr)
+
+#else
+
+#include <Imlib.h>
+
+extern ImlibData *pI1Ctx;
+extern ImlibImage *pIcImg;
+extern Drawable vIcDrw;
+
+#define IMLIB1_SET_CONTEXT(root_ctx) \
+ pI1Ctx = ((root_ctx) && prImlib_Context) ? prImlib_Context : pImlib_Context
+
+#define imlib_context_set_image(im_img) \
+ pIcImg = im_img
+#define imlib_context_set_drawable(im_drw) \
+ vIcDrw = im_drw
+
+#define imlib_context_set_dither(onoff) \
+ Imlib_set_render_type(pI1Ctx, RT_DITHER_TRUECOL)
+#define imlib_context_get_dither() \
+ Imlib_get_render_type(pI1Ctx)
+
+#define imlib_image_get_width() \
+ pIcImg->rgb_width
+#define imlib_image_get_height() \
+ pIcImg->rgb_height
+
+#define imlib_load_image(file) \
+ Imlib_load_image(pI1Ctx, file)
+#define imlib_create_image_from_drawable(mask, x, y, w, h, grab) \
+ Imlib_create_image_from_drawable(pI1Ctx, vIcDrw, mask, x, y, w, h)
+
+#define imlib_image_set_format(fmt)
+#define imlib_save_image(file) \
+ Imlib_save_image_to_ppm(pI1Ctx, pIcImg, file)
+
+#define imlib_render_pixmaps_for_whole_image(p, m) \
+ Imlib_render(pI1Ctx, pIcImg, imlib_image_get_width(),
imlib_image_get_height()); \
+ if (p) *p = Imlib_copy_image(pI1Ctx, pIcImg); \
+ if (m) *m = Imlib_copy_mask(pI1Ctx, pIcImg)
+#define imlib_render_pixmaps_for_whole_image_at_size(p, m, w, h) \
+ Imlib_render(pI1Ctx, pIcImg, w, h); \
+ if (p) *p = Imlib_copy_image(pI1Ctx, pIcImg); \
+ if (m) *m = Imlib_copy_mask(pI1Ctx, pIcImg)
+#define imlib_render_image_on_drawable(x, y) \
+ Imlib_apply_image(pI1Ctx, pIcImg, vIcDrw)
+#define imlib_render_image_on_drawable_at_size(x, y, w, h) \
+ Imlib_paste_image(pI1Ctx, pIcImg, vIcDrw, x, y, w, h)
+
+#define imlib_create_cropped_scaled_image(x, y, w, h, w2, h2) \
+ Imlib_clone_scaled_image(pI1Ctx, pIcImg, w2, h2)
+
+#define imlib_image_orientate(rot) \
+ switch (rot) { \
+ case 1: \
+ Imlib_rotate_image(pI1Ctx, pIcImg, 1); \
+ Imlib_flip_image_horizontal(pI1Ctx, pIcImg); \
+ break; \
+ case 2: \
+ Imlib_flip_image_vertical(pI1Ctx, pIcImg); \
+ Imlib_flip_image_horizontal(pI1Ctx, pIcImg); \
+ case 3: \
+ Imlib_rotate_image(pI1Ctx, pIcImg, -1); \
+ Imlib_flip_image_vertical(pI1Ctx, pIcImg); \
+ break; \
+ }
+
+#define imlib_free_image() \
+ ({ Imlib_destroy_image(pI1Ctx, pIcImg); pIcImg = NULL; })
+#define imlib_free_image_and_decache() \
+ ({ Imlib_kill_image(pI1Ctx, pIcImg); pIcImg = NULL; })
+#define imlib_free_pixmap_and_mask(pmap) \
+ Imlib_free_pixmap(pI1Ctx, pmap)
+
+#define IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask) \
+ ({ Imlib_free_pixmap(pI1Ctx, pmap); Imlib_free_pixmap(pI1Ctx, mask); })
+
+#define imlib_image_set_border(im_bdr) \
+ Imlib_set_image_border(pI1Ctx, pIcImg, im_bdr)
+
+#define EAllocColor(pxc) \
+ ({ int r = ((pxc)->red)>>8, g = ((pxc)->green)>>8, b = ((pxc)->blue)>>8; \
+ (pxc)->pixel = Imlib_best_color_match(pI1Ctx, &r, &g, &b); })
+
+#define Imlib_Context ImlibData
+#define Imlib_Image ImlibImage
+#define Imlib_Color ImlibColor
+#define Imlib_Border ImlibBorder
+#define IC_RenderDepth() (pImlib_Context->x.render_depth)
+#endif
+
+#if USE_FNLIB
+#include <Fnlib.h>
+#endif
+
#define FILEPATH_LEN_MAX 4096
@@ -88,6 +196,18 @@
putenv(envvar);\
}
+
+typedef struct _root
+{
+ Window win;
+ Visual *vis;
+ int depth;
+ Colormap cmap;
+ int scr;
+ int w, h;
+}
+Root;
+
typedef struct _efont
{
TT_Engine engine;
@@ -110,8 +230,8 @@
FnlibStyle style;
FnlibFont *font;
#endif
- ImlibColor fg_col;
- ImlibColor bg_col;
+ XColor fg_col;
+ XColor bg_col;
int effect;
Efont *efont;
XFontStruct *xfont;
@@ -252,7 +372,7 @@
Link *RenderPage(Window win, int page_num, int w, int h);
extern Display *disp;
-extern ImlibData *pImlibData;
+extern Root root;
#if USE_FNLIB
extern FnlibData *pFnlibData;
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/format.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- format.c 5 Nov 2003 17:24:39 -0000 1.12
+++ format.c 16 Nov 2003 19:44:01 -0000 1.13
@@ -515,7 +515,7 @@
int x, y;
int justification = 0;
int firstp = 1;
- ImlibImage *im;
+ Imlib_Image *im;
int wastext = 0;
ts.fontname = NULL;
@@ -526,12 +526,8 @@
ts.style.spacing = 0;
ts.font = NULL;
#endif
- ts.fg_col.r = 0;
- ts.fg_col.g = 0;
- ts.fg_col.b = 0;
- ts.bg_col.r = 0;
- ts.bg_col.g = 0;
- ts.bg_col.b = 0;
+ ESetColor(&ts.fg_col, 0, 0, 0);
+ ESetColor(&ts.bg_col, 0, 0, 0);
ts.effect = 0;
ts.efont = NULL;
ts.xfont = NULL;
@@ -549,11 +545,13 @@
sprintf(tmp, "%s/%s", docdir, pg->background);
findLocalizedFile(tmp);
- im = Imlib_load_image(pImlibData, tmp);
+ im = imlib_load_image(tmp);
if (im)
{
- Imlib_paste_image(pImlibData, im, win, 0, 0, w, h);
- Imlib_destroy_image(pImlibData, im);
+ imlib_context_set_image(im);
+ imlib_context_set_drawable(win);
+ imlib_render_image_on_drawable_at_size(0, 0, w, h);
+ imlib_free_image();
}
}
for (i = 0; i < pg->count; i++)
@@ -574,14 +572,16 @@
char tmp[4096];
sprintf(tmp, "%s/%s", docdir, img->src);
- im = Imlib_load_image(pImlibData, tmp);
+ im = imlib_load_image(tmp);
if (im)
{
- img->w = im->rgb_width;
- img->h = im->rgb_height;
- Imlib_paste_image(pImlibData, im, win, img->x, img->y,
- im->rgb_width, im->rgb_height);
- Imlib_destroy_image(pImlibData, im);
+ imlib_context_set_image(im);
+ img->w = imlib_image_get_width();
+ img->h = imlib_image_get_height();
+ imlib_context_set_drawable(win);
+ imlib_render_image_on_drawable_at_size(img->x, img->y,
+ img->w, img->h);
+ imlib_free_image();
}
if (img->link)
{
@@ -615,12 +615,8 @@
Fnlib_free_font(pFnlibData, ts.font);
ts.font = NULL;
#endif
- ts.fg_col.r = 0;
- ts.fg_col.g = 0;
- ts.fg_col.b = 0;
- ts.bg_col.r = 0;
- ts.bg_col.g = 0;
- ts.bg_col.b = 0;
+ ESetColor(&ts.fg_col, 0, 0, 0);
+ ESetColor(&ts.bg_col, 0, 0, 0);
ts.effect = 0;
if (ts.efont)
Efont_free(ts.efont);
@@ -634,9 +630,7 @@
ts.xfontset_ascent = 0;
ts.height = 0;
ts.fontname = fn->face;
- ts.fg_col.r = fn->r;
- ts.fg_col.g = fn->g;
- ts.fg_col.b = fn->b;
+ ESetColor(&ts.fg_col, fn->r, fn->g, fn->b);
TextStateLoadFont(&ts);
break;
case P:
@@ -915,20 +909,15 @@
if (link > 1)
{
int rr, gg, bb;
- int r, g, b;
int extra;
GC gc;
XGCValues gcv;
gc = XCreateGC(disp, win, 0, &gcv);
- rr = ts.fg_col.r;
- gg = ts.fg_col.g;
- bb = ts.fg_col.b;
- r = ts.fg_col.r = pg->linkr;
- g = ts.fg_col.g = pg->linkg;
- b = ts.fg_col.b = pg->linkb;
- XSetForeground(disp, gc,
- Imlib_best_color_match(pImlibData, &r, &g, &b));
+ EGetColor(&ts.fg_col, &rr, &gg, &bb);
+ 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,
@@ -939,9 +928,7 @@
y + ts.xfontset_ascent,
x + off + lx + lw + extra,
y + ts.xfontset_ascent);
- ts.fg_col.r = rr;
- ts.fg_col.g = gg;
- ts.fg_col.b = bb;
+ ESetColor(&ts.fg_col, rr, gg, bb);
link = 0;
XFreeGC(disp, gc);
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/dox/text.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- text.c 5 Nov 2003 17:24:39 -0000 1.8
+++ text.c 16 Nov 2003 19:44:01 -0000 1.9
@@ -289,40 +289,28 @@
xx = x + (((w - wid) * justification) >> 10);
if (ts->effect == 1)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
EFont_draw_string(disp, win, gc, xx + 1, yy + 1,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
}
else if (ts->effect == 2)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
EFont_draw_string(disp, win, gc, xx - 1, yy,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
EFont_draw_string(disp, win, gc, xx + 1, yy,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
EFont_draw_string(disp, win, gc, xx, yy - 1,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
EFont_draw_string(disp, win, gc, xx, yy + 1,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
}
- r = ts->fg_col.r;
- g = ts->fg_col.g;
- b = ts->fg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g, &b));
+ EAllocColor(&ts->fg_col);
+ XSetForeground(disp, gc, ts->fg_col.pixel);
EFont_draw_string(disp, win, gc, xx, yy,
- lines[i], ts->efont, Imlib_get_visual(pImlibData),
- Imlib_get_colormap(pImlibData));
+ lines[i], ts->efont, root.vis, root.cmap);
yy += ascent + descent;
}
}
@@ -338,19 +326,15 @@
xx = x + (((w - ret2.width) * justification) >> 10);
if (ts->effect == 1)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XmbDrawString(disp, win, ts->xfontset, gc, xx + 1, yy + 1,
lines[i], strlen(lines[i]));
}
else if (ts->effect == 2)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XmbDrawString(disp, win, ts->xfontset, gc, xx - 1, yy,
lines[i], strlen(lines[i]));
XmbDrawString(disp, win, ts->xfontset, gc, xx + 1, yy,
@@ -360,10 +344,8 @@
XmbDrawString(disp, win, ts->xfontset, gc, xx, yy + 1,
lines[i], strlen(lines[i]));
}
- r = ts->fg_col.r;
- g = ts->fg_col.g;
- b = ts->fg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g, &b));
+ EAllocColor(&ts->fg_col);
+ XSetForeground(disp, gc, ts->fg_col.pixel);
XmbDrawString(disp, win, ts->xfontset, gc, xx, yy,
lines[i], strlen(lines[i]));
yy += ret2.height;
@@ -383,19 +365,15 @@
xx = x + (((w - wid) * justification) >> 10);
if (ts->effect == 1)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XDrawString(disp, win, gc, xx + 1, yy + 1,
lines[i], strlen(lines[i]));
}
else if (ts->effect == 2)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XDrawString(disp, win, gc, xx - 1, yy,
lines[i], strlen(lines[i]));
XDrawString(disp, win, gc, xx + 1, yy,
@@ -405,10 +383,8 @@
XDrawString(disp, win, gc, xx, yy + 1,
lines[i], strlen(lines[i]));
}
- r = ts->fg_col.r;
- g = ts->fg_col.g;
- b = ts->fg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g, &b));
+ EAllocColor(&ts->fg_col);
+ XSetForeground(disp, gc, ts->fg_col.pixel);
XDrawString(disp, win, gc, xx, yy,
lines[i], strlen(lines[i]));
yy += ts->xfont->ascent + ts->xfont->descent;
@@ -428,19 +404,15 @@
xx = x + (((w - wid) * justification) >> 10);
if (ts->effect == 1)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XDrawString16(disp, win, gc, xx + 1, yy + 1,
(XChar2b *) lines[i], strlen(lines[i]) / 2);
}
else if (ts->effect == 2)
{
- r = ts->bg_col.r;
- g = ts->bg_col.g;
- b = ts->bg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g,
&b));
+ EAllocColor(&ts->bg_col);
+ XSetForeground(disp, gc, ts->bg_col.pixel);
XDrawString16(disp, win, gc, xx - 1, yy,
(XChar2b *) lines[i], strlen(lines[i]) / 2);
XDrawString16(disp, win, gc, xx + 1, yy,
@@ -450,10 +422,8 @@
XDrawString16(disp, win, gc, xx, yy + 1,
(XChar2b *) lines[i], strlen(lines[i]) / 2);
}
- r = ts->fg_col.r;
- g = ts->fg_col.g;
- b = ts->fg_col.b;
- XSetForeground(disp, gc, Imlib_best_color_match(pImlibData, &r, &g, &b));
+ EAllocColor(&ts->fg_col);
+ XSetForeground(disp, gc, ts->fg_col.pixel);
XDrawString16(disp, win, gc, xx, yy,
(XChar2b *) lines[i], strlen(lines[i]) / 2);
yy += ts->xfont->ascent + ts->xfont->descent;
-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs