d88-hba@nada.kth.se (Harald Barth) (06/12/91)
Brent Browning: In Mike's case the problem is a bug in olgx, the OPEN LOOK graphics library. It only happens in monochrome and it only happens when you have a glyph of some sort. His interface had a glyph in a button and he has a monocrome monitor. If your stack trace ends up in olgx_draw_text, you're being bit. Exactly, me too. Brent Browning: I know that the bug is fixed in OpenWindows V3. There is rumored to be a patch, I'm looking around for it. Good, I need that bug fixed. Maybe I could get some help from the rumoring people. Big SMILE. More detailed bug description: I built my application built with devguide. It consists of 3 controls and 1 canvas. In the controls I got 1 button with attached menu and in another a button with a glyph. I generate C++ code witg gxv++ or c code with gxv (doesn`t matter). I use the generated Makefile. The application dumps (SEGFAULT) when I press the menubutton. This happens only when the *other* button has a glyph (instead of text label) I had the following experience with debuggers on this problem: -xdbx exits when reading the symbolic info -dbxtool dies quietly -gdb deadlocks everything -dbx prints a stack trace ending up in olgx_draw_text() (as above). dbx does not run. The whole scenario was the same with olwm(Sun 4) or twm(Sun3, Sun4). ---------------------- Thanks, Harald. (d88-hba@nada.kth.se) ---------------------
bergquis@nms.gdc.portal.com (Brett Bergquist) (06/13/91)
d88-hba@nada.kth.se (Harald Barth) writes: > Brent Browning: > In Mike's case the problem is a bug in olgx, the OPEN LOOK > graphics library. It only happens in monochrome and it only happens > when you have a glyph of some sort. His interface had a glyph in a > button and he has a monocrome monitor. If your stack trace ends > up in olgx_draw_text, you're being bit. > > Exactly, me too. > > Brent Browning: > I know that the bug is fixed in OpenWindows V3. There is rumored > to be a patch, I'm looking around for it. > > Good, I need that bug fixed. Maybe I could get some help from the rumoring > people. Big SMILE. > > > More detailed bug description: > > I built my application built with devguide. > It consists of 3 controls and 1 canvas. > In the controls I got 1 button with attached menu and in another a button with > a glyph. > I generate C++ code witg gxv++ or c code with gxv (doesn`t matter). > I use the generated Makefile. > The application dumps (SEGFAULT) when I press the menubutton. This happens only > when the *other* button has a glyph (instead of text label) > > > I had the following experience with debuggers on this problem: > > -xdbx exits when reading the symbolic info > -dbxtool dies quietly > -gdb deadlocks everything > -dbx prints a stack trace ending up in olgx_draw_text() (as above). dbx does not run. > > The whole scenario was the same with olwm(Sun 4) or twm(Sun3, Sun4). > ---------------------- > > Thanks, Harald. > (d88-hba@nada.kth.se) > > --------------------- Here is a fix for the monochrome glyph problem with Xview. These are patched sources from the Xview source on the MIT X tape. To use these files, compile and link them in before linking in the Xview and olgx libraries. You could probable also replace the broken "ol_button.o" in the olgx library also with "ar". Hope this helps. ---- Cut Here and unpack ---- #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # ol_button.c # olgx.h # olgx_impl.h # echo "x - extracting ol_button.c (Text)" sed 's/^X//' << 'SHAR_EOF' > ol_button.c && X/* X * @(#) ol_button.c 1.11 89/11/02 X */ X X/* X * OPEN LOOK object drawing package Sun Microsystems, Inc. X * X * OLGX_button.c Menu button module X */ X X#include <stdio.h> X#include <X11/Xlib.h> X#include "olgx_impl.h" X X/* X * Private function declarations X */ Xvoid olgx_set_busy_stipple(); Xvoid olgx_draw_pixmap_label(); X Xvoid Xolgx_draw_button(info, win, x, y, width, height, label, state) X Graphics_info *info; X Window win; X int x, y, width, height; X void *label; X int state; X{ X XTextItem item; X char string[STRING_SIZE]; X short add_ins[STRING_SIZE]; X register int i; X int num_add; X int inside_width; /* width minus endcaps */ X int top_color, bottom_color, fill_color; X X X inside_width = width - (2 * info->endcap_width); X X num_add = calc_add_ins(inside_width - 1, add_ins); X item.nchars = 2 + num_add; X item.font = None; X item.chars = string; X item.delta = 0; X X X if (height) X /* variable height button-- possibly a pixmap label */ X olgx_draw_varheight_button(info, win, x, y, width, height, state); X X else { X if (info->three_d) { X /* X * 3d determine what colors we should draw in X */ X if (state & OLGX_INVOKED) { /* invoked button */ X top_color = OLGX_BG3; X bottom_color = OLGX_WHITE; X fill_color = OLGX_BG2; X } else if ((state & OLGX_DEFAULT) && (state & OLGX_MENU_ITEM)) { X /* default menu item */ X top_color = bottom_color = OLGX_BLACK; X fill_color = OLGX_BG1; X } else if (state & OLGX_MENU_ITEM && state & OLGX_BUSY) { X /* busy menu item */ X fill_color = top_color = bottom_color = OLGX_BG1; X } else if (state & OLGX_MENU_ITEM) { X /* normal menu item */ X fill_color = top_color = bottom_color = NONE; X } else { /* normal panel button */ X top_color = OLGX_WHITE; X bottom_color = OLGX_BG3; X fill_color = OLGX_BG1; X } X X if (state & OLGX_BUSY) { X /* X * This routine changes GC information on-the-fly, but it is X * assumed that OLGX_BUSY won't be called often, so it makes X * sense to use the same GC rather than one for ` each color. X */ X if (!info->gc_rec[OLGX_BUSYGC]) X olgx_initialise_gcrec(info, OLGX_BUSYGC); X fill_color = OLGX_BUSYGC; X } X /* only check erase on transparent items */ X if (fill_color == NONE) { X if (state & OLGX_ERASE) { X /* X * to improve performance, we erase a rectangle the size X * of a button rather than drawing a real button. X */ X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BG1]->gc, x, y, X width, Button_Height(info)); X } X } else { X /* if not transparent, actually draw the button */ X X X if (top_color != NONE) { X /* draw the top part of the button */ X string[0] = BUTTON_UL; X VARIABLE_LENGTH_MACRO(1, BUTTON_TOP_1); X string[i + 1] = BUTTON_UR; X XDrawText(info->dpy, win, X info->gc_rec[top_color]->gc, x, y, &item, 1); X } X if (bottom_color != NONE) { X /* draw the bottom part of the button */ X string[0] = BUTTON_LL; X VARIABLE_LENGTH_MACRO(1, BUTTON_BOTTOM_1); X string[i + 1] = BUTTON_LR; X XDrawText(info->dpy, win, X info->gc_rec[bottom_color]->gc, x, y, &item, 1); X } X /* Fill in the button */ X string[0] = BUTTON_LEFT_ENDCAP_FILL; X VARIABLE_LENGTH_MACRO(1, BUTTON_FILL_1); X string[i + 1] = BUTTON_RIGHT_ENDCAP_FILL; X XDrawText(info->dpy, win, X info->gc_rec[fill_color]->gc, x, y, &item, 1); X X /* draw the inner border of a default button (not menu item) */ X if (!(state & OLGX_MENU_ITEM) && (state & OLGX_DEFAULT)) { X string[0] = DFLT_BUTTON_LEFT_ENDCAP; X VARIABLE_LENGTH_MACRO(1, DFLT_BUTTON_MIDDLE_1); X string[i + 1] = DFLT_BUTTON_RIGHT_ENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } X } /* Not transparent */ X } X /* End 3D */ X else { /* draw 2d button */ X X if (state & OLGX_ERASE) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, X width + 1, Button_Height(info)); X X X if ((state & OLGX_INVOKED)) { X string[0] = BUTTON_FILL_2D_LEFTENDCAP; X VARIABLE_LENGTH_MACRO(1, BUTTON_FILL_2D_MIDDLE_1); X string[i + 1] = BUTTON_FILL_2D_RIGHTENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } else if (state & OLGX_BUSY) { X if (!info->gc_rec[OLGX_BUSYGC]) X olgx_initialise_gcrec(info, OLGX_BUSYGC); X string[0] = BUTTON_FILL_2D_LEFTENDCAP; X VARIABLE_LENGTH_MACRO(1, BUTTON_FILL_2D_MIDDLE_1); X string[i + 1] = BUTTON_FILL_2D_RIGHTENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BUSYGC]->gc, x, y, &item, 1); X X } else if (!(state & OLGX_MENU_ITEM) && (state & OLGX_DEFAULT)) { X /* draw the 2d default ring if not menu-item */ X string[0] = DFLT_BUTTON_LEFT_ENDCAP; X VARIABLE_LENGTH_MACRO(1, DFLT_BUTTON_MIDDLE_1); X string[i + 1] = DFLT_BUTTON_RIGHT_ENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } else if (state & OLGX_DEFAULT) { X /* draw the 2d default ring for menu item */ X string[0] = MENU_DFLT_OUTLINE_LEFT_ENDCAP; X VARIABLE_LENGTH_MACRO(1, MENU_DFLT_OUTLINE_MIDDLE_1); X string[i + 1] = MENU_DFLT_OUTLINE_RIGHT_ENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } X /* draw the button if it is not a menu item */ X if (!(state & OLGX_MENU_ITEM)) { X string[0] = BUTTON_OUTLINE_LEFT_ENDCAP; X VARIABLE_LENGTH_MACRO(1, BUTTON_OUTLINE_MIDDLE_1); X string[i + 1] = BUTTON_OUTLINE_RIGHT_ENDCAP; X XDrawText(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } X } X } X X /* X * Place the label, if specified. X */ X if (label) { X if (state & OLGX_LABEL_IS_PIXMAP) { X int centerx, centery; X X centerx = (width - ((Pixlabel *) label)->width >> 1); X centery = (height - ((Pixlabel *) label)->height >> 1); X olgx_draw_pixmap_label(info, win, X ((Pixlabel *) label)->pixmap, X x + ((centerx > 0) ? centerx : 0), X y + ((centery > 0) ? centery : 0), X ((Pixlabel *) label)->width, X (height) ? ((Pixlabel *) label)->height : Button_Height(info) - 2, state); X } else { X olgx_draw_text(info, win, (char *) label, X x + info->endcap_width, X y + info->button_height - info->base_off, X inside_width - X ((state & OLGX_MENU_MARK) ? X info->mm_width : 0), X state); X } X } X /* X * Place the menu mark, if desired. X */ X if (state & OLGX_MENU_MARK) { X /* X * draw the menu mark. (fill_color != OLGX_BG2) causes the menu mark X * to be filled in only when necessary X */ X if (info->three_d) X olgx_draw_menu_mark(info, win, X x + (width - info->endcap_width - info->mm_width), X y + (info->button_height - info->mm_height - X info->base_off), X state, (fill_color != OLGX_BG2)); X else X olgx_draw_menu_mark(info, win, X x + (width - info->endcap_width - info->mm_width), X y + (info->button_height - info->mm_height - X info->base_off), X state, 0); X } X /* X * Mark the item as inactive, if specified X */ X if (state & OLGX_INACTIVE) { X olgx_stipple_rect(info, win, x, y, width, (height) ? height + 8 : Button_Height(info)); X } X} X X X/* X * Draw the outline of a variable height button Private Routine X */ X Xvoid Xolgx_draw_varheight_button(info, win, x, y, width, height, state) X Graphics_info *info; X Window win; X int x, y, width, height; X int state; X X{ X X X char string[2]; X XSegment seg[4]; X X X if (info->three_d) { X /* 3D */ X /* Draw all the four corners */ X X if (state & OLGX_INVOKED) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BG2]->gc, x + 1, X y + 1, width - 2, height - 2); X else X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BG1]->gc, x + 1, X y + 1, width - 2, height - 2); X X string[0] = PIXLABEL_BUTTON_UL; X XDrawString(info->dpy, win, (state & OLGX_INVOKED) ? X info->gc_rec[OLGX_BG3]->gc : info->gc_rec[OLGX_WHITE]->gc, x, y, X string, 1); X string[0] = PIXLABEL_BUTTON_UR; X XDrawString(info->dpy, win, (state & OLGX_INVOKED) ? X info->gc_rec[OLGX_BG3]->gc : info->gc_rec[OLGX_WHITE]->gc, X x + width - VARHEIGHT_BUTTON_CORNER_DIMEN, y, string, 1); X string[0] = PIXLABEL_BUTTON_LL; X XDrawString(info->dpy, win, (state & OLGX_INVOKED) ? X info->gc_rec[OLGX_WHITE]->gc : info->gc_rec[OLGX_BG3]->gc, x, y + X height - VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X string[0] = PIXLABEL_BUTTON_LR; X XDrawString(info->dpy, win, (state & OLGX_INVOKED) ? X info->gc_rec[OLGX_WHITE]->gc : info->gc_rec[OLGX_BG3]->gc, X x + width - VARHEIGHT_BUTTON_CORNER_DIMEN, X y + height - VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X X seg[0].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[0].y1 = seg[0].y2 = y; X seg[0].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].x1 = seg[1].x2 = x; X seg[1].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN; X XDrawSegments(info->dpy, win, (state & OLGX_INVOKED) ? info->gc_rec[OLGX_BG3]->gc : X info->gc_rec[OLGX_WHITE]->gc, seg, 2); X seg[0].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[0].y1 = seg[0].y2 = y + height - 1; X seg[0].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].x1 = seg[1].x2 = x + width - 1; X seg[1].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN; X XDrawSegments(info->dpy, win, (state & OLGX_INVOKED) ? info->gc_rec[OLGX_WHITE]->gc : X info->gc_rec[OLGX_BG3]->gc, seg, 2); X X } else { X X /* 2D */ X X if (state & OLGX_INVOKED) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x + 3, X y + 3, width - 6, height - 6); X else X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x + 1, X y + 1, width - 2, height - 2); X X string[0] = PIXLABEL_BUTTON_UL; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, string, 1); X string[0] = PIXLABEL_BUTTON_UR; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, X x + width - VARHEIGHT_BUTTON_CORNER_DIMEN, y, string, 1); X string[0] = PIXLABEL_BUTTON_LL; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, X y + height - VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X string[0] = PIXLABEL_BUTTON_LR; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, X x + width - VARHEIGHT_BUTTON_CORNER_DIMEN, X y + height - VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X X seg[0].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[0].y1 = seg[0].y2 = y; X seg[0].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].x1 = seg[1].x2 = x; X seg[1].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[2].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[2].y1 = seg[2].y2 = y + height - 1; X seg[2].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[3].x1 = seg[3].x2 = x + width - 1; X seg[3].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[3].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN; X XDrawSegments(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, seg, 4); X } X if (state & OLGX_DEFAULT) { X string[0] = PIXLABEL_DEF_BUTTON_UL; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, X string, 1); X string[0] = PIXLABEL_DEF_BUTTON_UR; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x + width - X VARHEIGHT_BUTTON_CORNER_DIMEN, y, string, 1); X string[0] = PIXLABEL_DEF_BUTTON_LL; X XDrawString(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x, y + height - X VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X string[0] = PIXLABEL_DEF_BUTTON_LR; X XDrawString(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, x + width - X VARHEIGHT_BUTTON_CORNER_DIMEN, y + height - X VARHEIGHT_BUTTON_CORNER_DIMEN, string, 1); X seg[0].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[0].y1 = seg[0].y2 = y + 2; X seg[0].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN - 1; X seg[1].x1 = seg[1].x2 = x + 2; X seg[1].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[1].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN - 1; X seg[2].x1 = x + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[2].y1 = seg[2].y2 = y + height - 1 - 2; X seg[2].x2 = x + width - VARHEIGHT_BUTTON_CORNER_DIMEN - 1; X seg[3].x1 = seg[3].x2 = x + width - 1 - 2; X seg[3].y1 = y + VARHEIGHT_BUTTON_CORNER_DIMEN; X seg[3].y2 = y + height - VARHEIGHT_BUTTON_CORNER_DIMEN - 1; X XDrawSegments(info->dpy, win, X info->gc_rec[OLGX_BLACK]->gc, seg, 4); X } X if (state & OLGX_BUSY) { X if (!info->gc_rec[OLGX_BUSYGC]) X olgx_initialise_gcrec(info, OLGX_BUSYGC); X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_BUSYGC]->gc, x + 2, X y + 2, width - 4, height - 4); X } X} X X Xvoid Xolgx_draw_menu_mark(info, win, x, y, state, fill_in) X Graphics_info *info; X Window win; X int state, fill_in; X{ X char string[3]; X if (state & OLGX_VERT_MENU_MARK) X string[0] = VERT_MENU_MARK_UL; X else if (state & OLGX_HORIZ_MENU_MARK) X string[0] = HORIZ_MENU_MARK_UL; X else if (state & OLGX_HORIZ_BACK_MENU_MARK) X string[0] = HORIZ_BACK_MENU_MARK_UL; X else if (state & OLGX_VERT_BACK_MENU_MARK) X string[0] = VERT_BACK_MENU_MARK_UL; X string[1] = string[0] + 1; X if ((state & OLGX_INVOKED) && (!info->three_d)) X XDrawString(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, &string[0], X info->three_d ? 1 : 2); X else X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, &string[0], X info->three_d ? 1 : 2); X if (info->three_d) X XDrawString(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, &string[1], 1); X /* fill in the menu mark, if requested */ X if (fill_in) { X string[0] = string[0] + 2; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BG2]->gc, x, y, &string[0], 1); X } X} X Xvoid Xolgx_draw_abbrev_button(info, win, x, y, state) X Graphics_info *info; X Window win; X int x, y; X int state; X{ X XTextItem item; X char string[3]; X int top_color, bottom_color, fill_color; X X item.nchars = 1; X item.font = None; X item.chars = string; X item.delta = 0; X if (!info->three_d) { /* 2d */ X if (state & OLGX_ERASE) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, X Abbrev_MenuButton_Width(info), Abbrev_MenuButton_Width(info)); X if (state & OLGX_BUSY) { X if (!info->gc_rec[OLGX_BUSYGC]) X olgx_initialise_gcrec(info, OLGX_BUSYGC); X string[0] = ABBREV_MENU_FILL; X XDrawText(info->dpy, win, info->gc_rec[OLGX_BUSYGC]->gc, x, y, &item, 1); X } X if (state & OLGX_INVOKED) { X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x + 2, y + 2, X (Abbrev_MenuButton_Width(info) - 4), (Abbrev_MenuButton_Width(info) - 4)); X string[0] = OLG_ABBREV_MENU_BUTTON_INVERTED; X XDrawText(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } else { X string[0] = OLG_ABBREV_MENU_BUTTON; X XDrawText(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, &item, 1); X } X X } else { /* 3d */ X X if (state & OLGX_INVOKED) { X top_color = OLGX_BG3; X bottom_color = OLGX_WHITE; X fill_color = OLGX_BG2; X } else { X top_color = OLGX_WHITE; X bottom_color = OLGX_BG3; X fill_color = OLGX_BG1; X } X if (state & OLGX_BUSY) { X if (!info->gc_rec[OLGX_BUSYGC]) X olgx_initialise_gcrec(info, OLGX_BUSYGC); X fill_color = OLGX_BUSYGC; X } X string[0] = ABBREV_MENU_UL; X XDrawText(info->dpy, win, info->gc_rec[top_color]->gc, x, y, &item, 1); X X string[0] = ABBREV_MENU_LR; X XDrawText(info->dpy, win, info->gc_rec[bottom_color]->gc, x, y, &item, 1); X X string[0] = ABBREV_MENU_FILL; X XDrawText(info->dpy, win, info->gc_rec[fill_color]->gc, x, y, &item, 1); X olgx_draw_menu_mark(info, win, x + ((Abbrev_MenuButton_Width(info) X - info->mm_width) >> 1), X y + ((1 + Abbrev_MenuButton_Height(info) - X info->mm_height) >> 1), X OLGX_VERT_MENU_MARK, 1); X } X /* If it is inactive fill the rectangle with inactive pixmap */ X if (state & OLGX_INACTIVE) { X olgx_stipple_rect(info, win, x, y, Abbrev_MenuButton_Width(info), X Abbrev_MenuButton_Height(info)); X } X} X X Xvoid Xolgx_stipple_rect(info, win, x, y, width, height) X Graphics_info *info; X Window win; X int x, y, width, height; X{ X X X if (!info->gc_rec[OLGX_GREY_OUT]) X olgx_initialise_gcrec(info, OLGX_GREY_OUT); X X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_GREY_OUT]->gc, X x, y, width, height); X} X Xvoid Xolgx_draw_text(info, win, string, x, y, max_width, state) X Graphics_info *info; X Window win; X char *string; X int x, y, max_width; X int state; X{ X int len = strlen(string); X register int i; X X /* X * if the string is too long, we'll have to truncate it max_width == 0 X * implies don't truncate. X */ X if (max_width && XTextWidth(info->textfont, string, len) > max_width) { X X int current_width = 0; X X for (i = 0; (i < len && current_width <= max_width); i++) { X current_width += X XTextWidth(info->textfont, &string[i], 1); X } X X /* X * at this point, i-1 represents the number of chars of string that X * will fit into max_width. X */ X len = i - 1; X } X if (!info->gc_rec[OLGX_TEXTGC]) { X olgx_initialise_gcrec(info, OLGX_TEXTGC); X if (!info->three_d) X olgx_initialise_gcrec(info, OLGX_TEXTGC_REV); X } X if ((state & OLGX_INVOKED) && !(info->three_d)) X XDrawString(info->dpy, win, info->gc_rec[OLGX_TEXTGC_REV]->gc, x, y, string, len); X else X XDrawString(info->dpy, win, info->gc_rec[OLGX_TEXTGC]->gc, x, y, string, len); X X} X Xvoid Xolgx_draw_pixmap_label(info, win, pix, x, y, width, height, state) X Graphics_info *info; X Window win; X Pixmap pix; X int x, y, width, height, state; X{ X X X unsigned long savebg1; X unsigned long savebg2; X X X X if (!info->gc_rec[OLGX_TEXTGC]) { X olgx_initialise_gcrec(info, OLGX_TEXTGC); X if (!info->three_d) X olgx_initialise_gcrec(info, OLGX_TEXTGC_REV); X } X X if ((state & OLGX_INVOKED) && (info->three_d)) { X X /* X * reset the value of the textgc background from bg1 to bg2 in X * invoked mode to get the transparent pixmap effect X */ X X savebg1 = olgx_get_single_color(info, OLGX_BG1); X savebg2 = olgx_get_single_color(info, OLGX_BG2); X olgx_set_single_color(info, OLGX_BG1, savebg2, OLGX_SPECIAL); X } X XCopyPlane(info->dpy, X pix, /* src */ X win, /* dest */ X info->gc_rec[OLGX_TEXTGC]->gc, X 0, 0, /* src x,y */ X width, height, X x, y, X (unsigned long) 1); /* bit plane */ X X /* Restore the original colors to the textgc */ X X if ((state & OLGX_INVOKED) && (info->three_d)) X olgx_set_single_color(info, OLGX_BG1, savebg1, OLGX_SPECIAL); X X} X X X Xvoid Xolgx_draw_textscroll_button(info, win, x, y, state) X Graphics_info *info; X Window win; X int x, y; X int state; X X{ X char string[2]; X int width, height; X int arr_x, arr_y; X X /* X * A small hack to calculate the width, arrow postiton..etc since this X * routine is expected to tbe used infrequently it is not included as X * part of the info struct and the follwoing calculations take place each X * time-- a penalty affordable at the cost of infrequency X * X */ X X X X if ((Abbrev_MenuButton_Height(info)) < 20) { X width = height = Abbrev_MenuButton_Height(info); X X arr_y = 3; X arr_x = (width / 3) - 1; X } else { X width = height = 25; /* Special case size-19 */ X arr_y = 5; X arr_x = 7; X } X X X if (!(info->three_d)) { /* Start 2-D */ X X if (state & OLGX_ERASE) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, width, height); X X if (state & OLGX_SCROLL_FORWARD) { X if (state & OLGX_INVOKED) X string[0] = TEXTSCROLLBUTTON_RIGHT_INV; X else X string[0] = TEXTSCROLLBUTTON_RIGHT; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, string, 1); X } else if (state & OLGX_SCROLL_BACKWARD) { X if (state & OLGX_INVOKED) X string[0] = TEXTSCROLLBUTTON_LEFT_INV; X else X string[0] = TEXTSCROLLBUTTON_LEFT; X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, string, 1); X } X } X /* End 2-D */ X else { /* Start 3-D */ X X olgx_draw_box(info, win, x, y, width, height, state, 0); X if (state & OLGX_SCROLL_FORWARD) X olgx_draw_menu_mark(info, win, x + arr_x, y + arr_y, X OLGX_HORIZ_MENU_MARK | OLGX_INVOKED, 1); X else X olgx_draw_menu_mark(info, win, x + arr_x - 1, y + arr_y, X OLGX_HORIZ_BACK_MENU_MARK | OLGX_INVOKED, 1); X X } /* End 3-D */ X X X if (state & OLGX_INACTIVE) X olgx_stipple_rect(info, win, x, y, TextScrollButton_Width(info), X TextScrollButton_Height(info)); X X} X X X X X X Xvoid Xolgx_draw_numscroll_button(info, win, x, y, state) X Graphics_info *info; X Window win; X int x, y, state; X X{ X X char string[2]; X int width, height, arr_x, arr_y; X X width = height = TextScrollButton_Height(info); X if (width < 20) { X arr_y = 3; X arr_x = (width / 3) - 1; X } else { X arr_y = 5; X arr_x = 7; X } X X X if (!info->three_d) { /* draw 2-D */ X if (state & OLGX_ERASE) X XFillRectangle(info->dpy, win, info->gc_rec[OLGX_WHITE]->gc, x, y, NumScrollButton_Width(info), height); X X if (state & OLGX_SCROLL_FORWARD) X string[0] = NUMERIC_SCROLL_BUTTON_RIGHT_INV; X else if (state & OLGX_SCROLL_BACKWARD) X string[0] = NUMERIC_SCROLL_BUTTON_LEFT_INV; X else X string[0] = NUMERIC_SCROLL_BUTTON_NORMAL; X X XDrawString(info->dpy, win, info->gc_rec[OLGX_BLACK]->gc, x, y, string, 1); X } else { /* draw 3-D */ X X olgx_draw_box(info, win, x, y, width, height, (state & OLGX_SCROLL_BACKWARD) ? X OLGX_INVOKED : OLGX_NORMAL, 0); X olgx_draw_box(info, win, x + width, y, width, height, X (state & OLGX_SCROLL_FORWARD) ? X OLGX_INVOKED : OLGX_NORMAL, 0); X olgx_draw_menu_mark(info, win, x + arr_x, y + arr_y, X OLGX_VERT_BACK_MENU_MARK | OLGX_INVOKED, 1); X olgx_draw_menu_mark(info, win, x + arr_x + width, y + arr_y, X OLGX_VERT_MENU_MARK | OLGX_INVOKED, 1); X X } X if (state & OLGX_INACTIVE) X olgx_stipple_rect(info, win, x, y, NumScrollButton_Width(info), X NumScrollButton_Height(info)); X if (state & OLGX_SCROLL_NO_FORWARD) X olgx_stipple_rect(info, win, x + TextScrollButton_Width(info) - 1, y, X TextScrollButton_Width(info), X NumScrollButton_Height(info)); X if (state & OLGX_SCROLL_NO_BACKWARD) X olgx_stipple_rect(info, win, x, y, X TextScrollButton_Width(info) - 2, X NumScrollButton_Height(info)); X} SHAR_EOF chmod 0664 ol_button.c || echo "restore of ol_button.c fails" echo "x - extracting olgx.h (Text)" sed 's/^X//' << 'SHAR_EOF' > olgx.h && X/* X * @(#) olgx.h 1.30 90/06/21 X */ X X/* X * OPEN LOOK object drawing package X * Sun Microsystems, Inc., X */ X X#ifndef OL_PUBLIC_DEFINED X#define OL_PUBLIC_DEFINED X X#include <X11/Xlib.h> X X/* X * Package constant definitions X */ X X X/* X * Monitor dependent definitons X */ X X#define OLGX_2D 0 X#define OLGX_3D_COLOR 1 X#define OLGX_3D_MONO 2 X X X X X/* GC number definitions */ X X#define NONE -1 /* means "don't draw in this color" */ X#define OLGX_WHITE 0 X#define OLGX_BLACK 1 X#define OLGX_BG1 2 X#define OLGX_BG2 3 X#define OLGX_BG3 4 X#define OLGX_NUM_COLORS 5 /* 1 more than last *color* GC */ X X#define OLGX_TEXTGC 5 X#define OLGX_GREY_OUT 6 /* Inactive GC */ X#define OLGX_BUSYGC 7 X#define OLGX_SCROLL_GREY_GC 8 /* Special GC for 50% black cable */ X#define OLGX_NUM_GCS 9 /* always 1 more than last GC */ X X/* 2D gc definitions */ X X#define OLGX_TEXTGC_REV 2 /* Is used only for 2D hence X substituted for OLGX_BG1 X */ X/* X * State Flag Definitions X */ X#define OLGX_NORMAL 0x0000 /* normal button */ X#define OLGX_INVOKED 0x0001 /* invoked button */ X#define OLGX_MENU_ITEM 0x0002 /* menu item */ X#define OLGX_ERASE 0x0004 /* erase first (only for menu items) */ X#define OLGX_BUSY 0x0008 /* busy item */ X#define OLGX_DEFAULT 0x0010 /* default item */ X#define OLGX_INACTIVE 0x0020 /* inactive item */ X#define OLGX_VERT_MENU_MARK 0x0040 /* include a vertical menu mark */ X#define OLGX_HORIZ_MENU_MARK 0x0080 /* include a horizontal menu mark */ X#define OLGX_VERT_BACK_MENU_MARK 0x2000 /* include a vertical menu mark */ X#define OLGX_HORIZ_BACK_MENU_MARK 0x4000/* include a horizontal menu mark */ X#define OLGX_MENU_MARK 0x00c0 /* VERT_MENU_MARK | HORIZ_MENU_MARK */ X#define OLGX_LABEL_IS_PIXMAP 0x0200 /* button label is a pixmap */ X#define OLGX_VERTICAL 0x0800 /* orientation is vertical */ X#define OLGX_HORIZONTAL 0x1000 /* orientation is horizontal */ X#define OLGX_PUSHPIN_OUT 0x2000 /* pushpin is in */ X#define OLGX_PUSHPIN_IN 0x4000 /* pushpin is out */ X#define OLGX_UPDATE 0x8000 /* object is to be updated */ X#define OLGX_ABBREV 0x0100 /* object is abbreviated */ X#define OLGX_CHECKED 0x0002 /* object is checked (check boxes) */ X X/* scrollbar -2d stateflag defns */ X X#define OLGX_SCROLL_FORWARD 0x0002 /*scroll forward */ X#define OLGX_SCROLL_BACKWARD 0x2000 /*scroll backward */ X#define OLGX_SCROLL_ABSOLUTE 0x4000 /*scroll absolute- X center darkened */ X#define OLGX_SCROLL_NO_FORWARD 0x0040 /* no scroll forward */ X#define OLGX_SCROLL_NO_BACKWARD 0x0080 /* no scroll backward */ X X/* X * corner definitions X */ X X#define OLGX_UPPER_LEFT 0 X#define OLGX_UPPER_RIGHT 1 X#define OLGX_LOWER_RIGHT 2 X#define OLGX_LOWER_LEFT 3 X X/* X * Special Definition !! X * X */ X X#define OLGX_SPECIAL 1 X X/* X * character definitions X */ X#define OLG_VSB_ELEVATOR 1 X#define OLG_VSB_ELEVATOR_LINE_BACKWARD 2 X#define OLG_VSB_ELEVATOR_ABSOLUTE 3 X#define OLG_VSB_ELEVATOR_LINE_FORWARD 4 X#define OLG_VSB_REDUCED_ELEVATOR 5 X#define OLG_VSB_REDUCED_ELEVATOR_LINE_BACKWARD 6 X#define OLG_VSB_REDUCED_ELEVATOR_LINE_FORWARD 7 X#define OLG_VSB_ANCHOR 8 X#define OLG_VSB_ANCHOR_INVERTED 9 X#define OLG_HSB_ELEVATOR 10 X#define OLG_HSB_ELEVATOR_LINE_BACKWARD 11 X#define OLG_HSB_ELEVATOR_ABSOLUTE 12 X#define OLG_HSB_ELEVATOR_LINE_FORWARD 13 X#define OLG_HSB_REDUCED_ELEVATOR 14 X#define OLG_HSB_REDUCED_ELEVATOR_LINE_BACKWARD 15 X#define OLG_HSB_REDUCED_ELEVATOR_LINE_FORWARD 16 X#define OLG_HSB_ANCHOR 17 X#define OLG_HSB_ANCHOR_INVERTED 18 X#define OLG_MENU_PIN_OUT 19 X#define OLG_MENU_PIN_IN 20 X#define OLG_MENU_DEFAULT_PIN_OUT 21 X#define OLG_ABBREV_MENU_BUTTON 22 X#define OLG_ABBREV_MENU_BUTTON_INVERTED 23 X/* new extension */ X#define BUTTON_UL 24 X#define BUTTON_LL 25 X#define BUTTON_LEFT_ENDCAP_FILL 26 X#define BUTTON_LR 27 X#define BUTTON_UR 28 X#define BUTTON_RIGHT_ENDCAP_FILL 29 X#define BUTTON_TOP_1 30 X#define BUTTON_TOP_2 31 X#define BUTTON_TOP_4 32 X#define BUTTON_TOP_8 33 X#define BUTTON_TOP_16 34 X#define BUTTON_BOTTOM_1 35 X#define BUTTON_BOTTOM_2 36 X#define BUTTON_BOTTOM_4 37 X#define BUTTON_BOTTOM_8 38 X#define BUTTON_BOTTOM_16 39 X#define BUTTON_FILL_1 40 X#define BUTTON_FILL_2 41 X#define BUTTON_FILL_4 42 X#define BUTTON_FILL_8 43 X#define BUTTON_FILL_16 44 X#define VERT_MENU_MARK_UL 45 X#define VERT_MENU_MARK_LR 46 X#define VERT_MENU_MARK_FILL 47 X#define HORIZ_MENU_MARK_UL 48 X#define HORIZ_MENU_MARK_LR 49 X#define HORIZ_MENU_MARK_FILL 50 X#define ABBREV_MENU_UL 51 X#define ABBREV_MENU_LR 52 X#define ABBREV_MENU_FILL 53 X#define VERT_SB_UL 54 X#define VERT_SB_LR 55 X#define VERT_SB_TOPBOX_FILL 56 X#define HORIZ_SB_UL 57 X#define HORIZ_SB_LR 58 X#define VERT_SB_BOTBOX_FILL 59 X#define HORIZ_SLIDER_CONTROL_UL 60 X#define HORIZ_SLIDER_CONTROL_LR 61 X#define HORIZ_SLIDER_CONTROL_FILL 62 X#define HORIZ_SLIDER_UL 63 X#define HORIZ_SLIDER_LL 64 X#define HORIZ_SLIDER_UR 65 X#define HORIZ_SLIDER_LR 66 X#define HORIZ_SLIDER_BOTTOM_1 67 X#define HORIZ_SLIDER_BOTTOM_2 68 X#define HORIZ_SLIDER_BOTTOM_4 69 X#define HORIZ_SLIDER_BOTTOM_8 70 X#define HORIZ_SLIDER_BOTTOM_16 71 X#define HORIZ_SLIDER_FILL_1 72 X#define HORIZ_SLIDER_FILL_2 73 X#define HORIZ_SLIDER_FILL_4 74 X#define HORIZ_SLIDER_FILL_8 75 X#define HORIZ_SLIDER_FILL_16 76 X#define HORIZ_SLIDER_LEFT_ENDCAP_FILL 77 X#define HORIZ_SLIDER_RIGHT_ENDCAP_FILL 78 X#define VERT_SLIDER_UL 79 X#define VERT_SLIDER_UR 80 X#define VERT_SLIDER_TOP_ENDCAP_FILL 81 X#define VERT_SLIDER_LL 82 X#define VERT_SLIDER_LR 83 X#define VERT_SLIDER_BOTTOM_ENDCAP_FILL 84 X#define VERT_SLIDER_CONTROL_UL 85 X#define VERT_SLIDER_CONTROL_LR 86 X#define VERT_SLIDER_CONTROL_FILL 87 X#define UL_RESIZE_UL 88 X#define UL_RESIZE_LR 89 X#define UL_RESIZE_FILL 90 X#define UR_RESIZE_UL 91 X#define UR_RESIZE_LR 92 X#define UR_RESIZE_FILL 93 X#define LR_RESIZE_UL 94 X#define LR_RESIZE_LR 95 X#define LR_RESIZE_FILL 96 X#define LL_RESIZE_UL 97 X#define LL_RESIZE_LR 98 X#define LL_RESIZE_FILL 99 X#define PUSHPIN_OUT_TOP 100 X#define PUSHPIN_OUT_BOTTOM 101 X#define PUSHPIN_OUT_MIDDLE 102 X#define PUSHPIN_IN_TOP 103 X#define PUSHPIN_IN_BOTTOM 104 X#define PUSHPIN_IN_MIDDLE 105 X#define DFLT_BUTTON_LEFT_ENDCAP 106 X#define DFLT_BUTTON_RIGHT_ENDCAP 107 X#define DFLT_BUTTON_MIDDLE_1 108 X#define DFLT_BUTTON_MIDDLE_2 109 X#define DFLT_BUTTON_MIDDLE_4 110 X#define DFLT_BUTTON_MIDDLE_8 111 X#define DFLT_BUTTON_MIDDLE_16 112 X#define BASE_OFF_SPECIALCHAR 113 /*special char */ X#define UNCHECKED_BOX_UL 114 X#define UNCHECKED_BOX_LR 115 X#define UNCHECKED_BOX_FILL 116 X#define CHECK_MARK 117 X#define CHECKED_BOX_FILL 118 X#define UNCHECKED_BOX_OUTLINE 119 X#define HORIZ_GAUGE_UL 120 X#define HORIZ_GAUGE_LL 121 X#define HORIZ_GAUGE_UR 122 X#define HORIZ_GAUGE_LR 123 X#define HORIZ_GAUGE_BOTTOM_1 124 X#define HORIZ_GAUGE_BOTTOM_2 125 X#define HORIZ_GAUGE_BOTTOM_4 126 X#define HORIZ_GAUGE_BOTTOM_8 127 X#define HORIZ_GAUGE_BOTTOM_16 128 X#define VERT_GAUGE_UL 129 X#define VERT_GAUGE_UR 130 X#define VERT_GAUGE_LL 131 X#define VERT_GAUGE_LR 132 X#define VERT_ABBREV_SB_UL 133 X#define VERT_ABBREV_SB_LR 134 X#define HORIZ_SB_RIGHTBOX_FILL 135 X#define HORIZ_ABBREV_SB_UL 136 X#define HORIZ_ABBREV_SB_LR 137 X#define HORIZ_SB_LEFTBOX_FILL 138 X#define BUTTON_OUTLINE_LEFT_ENDCAP 139 X#define BUTTON_OUTLINE_RIGHT_ENDCAP 140 X#define BUTTON_OUTLINE_MIDDLE_1 141 X#define BUTTON_OUTLINE_MIDDLE_2 142 X#define BUTTON_OUTLINE_MIDDLE_4 143 X#define BUTTON_OUTLINE_MIDDLE_8 144 X#define BUTTON_OUTLINE_MIDDLE_16 145 X#define BUTTON_FILL_2D_LEFTENDCAP 146 X#define BUTTON_FILL_2D_RIGHTENDCAP 147 X#define BUTTON_FILL_2D_MIDDLE_1 148 X#define BUTTON_FILL_2D_MIDDLE_2 149 X#define BUTTON_FILL_2D_MIDDLE_4 150 X#define BUTTON_FILL_2D_MIDDLE_8 151 X#define BUTTON_FILL_2D_MIDDLE_16 152 X#define MENU_DFLT_OUTLINE_LEFT_ENDCAP 153 X#define MENU_DFLT_OUTLINE_RIGHT_ENDCAP 154 X#define MENU_DFLT_OUTLINE_MIDDLE_1 155 X#define MENU_DFLT_OUTLINE_MIDDLE_2 156 X#define MENU_DFLT_OUTLINE_MIDDLE_4 157 X#define MENU_DFLT_OUTLINE_MIDDLE_8 158 X#define MENU_DFLT_OUTLINE_MIDDLE_16 159 X#define PIXLABEL_BUTTON_UL 160 X#define PIXLABEL_BUTTON_LL 161 X#define UL_RESIZE_OUTLINE 162 X#define UR_RESIZE_OUTLINE 163 X#define LR_RESIZE_OUTLINE 164 X#define LL_RESIZE_OUTLINE 165 X#define VERT_SB_NO_BACK_OUTLINE 166 X#define VERT_SB_NO_FWD_OUTLINE 167 X#define VERT_SB_INACTIVE_OUTLINE 168 X#define HORIZ_SB_NO_BACK_OUTLINE 169 X#define HORIZ_SB_NO_FWD_OUTLINE 170 X#define HORIZ_SB_INACTIVE_OUTLINE 171 X#define HORIZ_SLIDER_CONTROL_OUTLINE 172 X#define HORIZ_SLIDER_LEFT_ENDCAP_OUTLINE 173 X#define HORIZ_SLIDER_RIGHT_ENDCAP_OUTLINE 174 X#define HORIZ_SLIDER_OUTLINE_1 175 X#define HORIZ_SLIDER_OUTLINE_2 176 X#define HORIZ_SLIDER_OUTLINE_4 177 X#define HORIZ_SLIDER_OUTLINE_8 178 X#define HORIZ_SLIDER_OUTLINE_16 179 X#define VERT_SLIDER_TOP_ENDCAP_OUTLINE 180 X#define VERT_SLIDER_BOTTOM_ENDCAP_OUTLINE 181 X#define VERT_SLIDER_CONTROL_OUTLINE 182 X#define PUSHPIN_OUT_DEFAULT_TOP 183 X#define PUSHPIN_OUT_DEFAULT_BOTTOM 184 X#define PUSHPIN_OUT_DEFAULT_MIDDLE 185 X#define HORIZ_GAUGE_LEFT_ENDCAP_OUTLINE 186 X#define HORIZ_GAUGE_RIGHT_ENDCAP_OUTLINE 187 X#define HORIZ_GAUGE_OUTLINE_MIDDLE_1 188 X#define HORIZ_GAUGE_OUTLINE_MIDDLE_2 189 X#define HORIZ_GAUGE_OUTLINE_MIDDLE_4 190 X#define HORIZ_GAUGE_OUTLINE_MIDDLE_8 191 X#define HORIZ_GAUGE_OUTLINE_MIDDLE_16 192 X#define CHECK_BOX_CLEAR_FILL 193 X#define VERT_SB_BOX_UL 194 X#define VERT_SB_BOX_LR 195 X#define DIMPLE_UL 196 X#define DIMPLE_LR 197 X#define DIMPLE_FILL 198 X#define SLIDER_CHANNEL_OFFSET 199 /* special char */ X#define HORIZ_SB_BOX_UL 200 X#define HORIZ_SB_BOX_LR 201 X#define VERT_BACK_MENU_MARK_UL 202 X#define VERT_BACK_MENU_MARK_LR 203 X#define VERT_BACK_MENU_MARK_FILL 204 X#define HORIZ_BACK_MENU_MARK_UL 205 X#define HORIZ_BACK_MENU_MARK_LR 206 X#define HORIZ_BACK_MENU_MARK_FILL 207 X#define OLGX_ACTIVE_CARET 208 X#define OLGX_INACTIVE_CARET 209 X#define VERT_GAUGE_TOPENDCAP 210 X#define VERT_GAUGE_BOTENDCAP 211 X#define PIXLABEL_BUTTON_UR 212 X#define PIXLABEL_BUTTON_LR 213 X#define PIXLABEL_BUTTON_2D_LR 214 X#define PIXLABEL_DEF_BUTTON_UL 215 X#define PIXLABEL_DEF_BUTTON_LL 216 X#define PIXLABEL_DEF_BUTTON_UR 217 X#define PIXLABEL_DEF_BUTTON_LR 218 X#define HORIZ_GAUGE_LEFT_ENDFILL 219 X#define HORIZ_GAUGE_MIDDLE_FILL_1 220 X#define HORIZ_GAUGE_MIDDLE_FILL_2 221 X#define HORIZ_GAUGE_MIDDLE_FILL_4 222 X#define HORIZ_GAUGE_MIDDLE_FILL_8 223 X#define HORIZ_GAUGE_MIDDLE_FILL_16 224 X#define HORIZ_GAUGE_RIGHT_ENDFILL 225 X#define VERT_GAUGE_TOP_FILL 226 X#define VERT_GAUGE_BOT_FILL 227 X#define TEXTSCROLLBUTTON_LEFT 228 X#define TEXTSCROLLBUTTON_RIGHT 229 X#define TEXTSCROLLBUTTON_LEFT_INV 230 X#define TEXTSCROLLBUTTON_RIGHT_INV 231 X#define NUMERIC_SCROLL_BUTTON_NORMAL 232 X#define NUMERIC_SCROLL_BUTTON_LEFT_INV 233 X#define NUMERIC_SCROLL_BUTTON_RIGHT_INV 234 X X X/* X * Definitions needed by XView X */ X X X#define OLGX_VAR_HEIGHT_BTN_MARGIN 10 X#define OLGX_CHOICE_MARGIN 10 X X X /* X * Type and Structure Definitions X */ X Xtypedef char Boolean; X X Xtypedef struct _GC_rec { X GC gc; X short ref_count; X int num_cliprects; /* Information to set clip rectangles X XID clipmask; * or clipmasks on the GCs X int clip_flag; */ X unsigned long valuemask; /* what fields are being used */ X XGCValues values; /* Values stored */ X struct _GC_rec * next; /* Pointer to the next gc_info in the list */ X} GC_rec; X Xtypedef struct pixlabel { X Pixmap pixmap; X int width,height; X} Pixlabel; X X/* X * Graphics information structure X */ Xtypedef struct graphics_info { X Display *dpy; X int scrn; X unsigned int depth; /* depth in which we are drawing */ X XFontStruct *glyphfont; /* ptr to glyph font info*/ X XFontStruct *textfont; /* ptr to text font info */ X short three_d; /* Either one of OLGX_2D, X * OLGX_3D_COLOR,OLGX_3D_MONO X */ X X GC_rec * gc_rec[OLGX_NUM_GCS]; X Pixmap stipple_pixmaps[3]; X unsigned long pixvals[OLGX_NUM_COLORS]; X X /* X * important OPEN LOOK values associated with this glyph font X */ X X short button_height; /* height of buttons */ X short endcap_width; /* size of button endcap */ X short sb_width, sb_height; /* scrollbar elevator size */ X short abbrev_width; /* abbrev menu button size */ X short slider_width, slider_height; /* slider control size */ X short se_width, se_height; /* slider endcap size */ X short mm_width, mm_height; /* menu mark size */ X short base_off ; /* Text base_off */ X short slider_offset ; /*SliderChanneloffset */ X short cb_width, cb_height; /* check box size */ X short pp_width, pp_height; /* push pin size*/ X short gauge_width,gauge_height ; /* gauge width& height*/ X short textscbu_width ; /* text scroll button width */ X short gauge_endcapOffset ; /* Offset between the endcap and gauge X * channel X */ X short numscbu_width; /* Number Scrolling button Width */ X short resize_arm_width; /* Resize Corner Width */ X short abbsb_height ; /* Abbreviated Scrollbar Height */ X short cable_offset ; /* Cable offset distance from X * the Scrollbar origin */ X short cable_width ; /* Width of the Cable */ X short point_size ; /* Pixel Point size of the Font */ X} Graphics_info; X X X/* Public macro definitions to get info from the Ginfo struct */ X X X#define ScrollbarElevator_Height(info) \ X (info->three_d)?((info)->sb_height-1):((info)->sb_height) X X#define ScrollbarElevator_Width(info) \ X (info->three_d)?((info)->sb_width-1):((info) ->sb_width) X X X#define HorizSliderControl_Width(info) ((info)->slider_width) X#define HorizSliderControl_Height(info) ((info)->slider_height) X#define SliderEndCap_Width(info) ((info)->se_width) X#define SliderEndCap_Height(info) ((info)->se_height) X#define CheckBox_Height(info) ((info)->cb_height) X#define CheckBox_Width(info) ((info)->cb_width) X#define PushPinOut_Width(info) ((info)->pp_width) X#define PushPinOut_Height(info) ((info)->pp_height) X#define ButtonEndcap_Width(info) ((info)->endcap_width) X#define Button_Height(info) \ X (info->three_d)?((info)->button_height-1):((info)->button_height) X#define MenuMark_Width(info) ((info)->mm_width) X#define MenuMark_Height(info) ((info)->mm_height) X#define Abbrev_MenuButton_Height(info) ((info)->abbrev_width -1) X#define Abbrev_MenuButton_Width(info) ((info)->abbrev_width) X#define Gauge_EndCapWidth(info) ((info)->gauge_width) X#define Gauge_EndCapHeight(info) ((info)->gauge_height) X#define Gauge_EndCapOffset(info) ((info)->gauge_endcapOffset) X#define TextScrollButton_Width(info) ((info)->textscbu_width) X#define TextScrollButton_Height(info) ((info)->textscbu_width) X#define NumScrollButton_Width(info) ((info)->numscbu_width) X#define NumScrollButton_Height(info) ((info)->textscbu_width) X#define ResizeArm_Width(info) ((info)->resize_arm_width) X#define ResizeArm_Height(info) ((info)->resize_arm_width) X#define Ascent_of_TextFont(info) ((info)->textfont->ascent) X#define Descent_of_TextFont(info) ((info)->textfont->descent) X#define Ascent_of_GlyphFont(info) ((info)->glyphfont->ascent) X#define Descent_of_GlyphFont(info) ((info)->glyphfont->descent) X#define Pointsize_Glyph(info) ((info)->point_size) X#define Vertsb_Endbox_Height(info) (SliderEndCap_Height(info) + 1) X#define Vertsb_Endbox_Width(info) (ScrollbarElevator_Width(info)) X#define Dimension(info) ((info)->three_d) X X X/* X * Public function declarations X */ X X XGraphics_info * olgx_initialize(); Xvoid olgx_calculate_3Dcolors(); Xunsigned long olgx_get_single_color(); Xvoid olgx_closedown(); Xvoid olgx_destroy(); X Xvoid X olgx_set_text_font(), X olgx_set_glyph_font(), X olgx_set_single_color(), X olgx_stipple_rect(), X olgx_scroll_stipple_rects(), X olgx_draw_button(), X olgx_draw_scrollbar(), X olgx_draw_menu_mark(), X olgx_draw_abbrev_button(), X olgx_draw_horizontal_slider(), X olgx_draw_vertical_slider(), X olgx_draw_resize_corner(), X olgx_draw_textscroll_button(), X olgx_draw_numscroll_button(), X olgx_draw_gauge(), X olgx_draw_horiz_gauge(), X olgx_draw_vertical_gauge(), X olgx_draw_pushpin(), X olgx_draw_box(), X olgx_draw_text(); X X X#endif !OL_PUBLIC_DEFINED X X X X X X SHAR_EOF chmod 0664 olgx.h || echo "restore of olgx.h fails" echo "x - extracting olgx_impl.h (Text)" sed 's/^X//' << 'SHAR_EOF' > olgx_impl.h && X/* X * @(#) olgx_impl.h 1.10 90/06/25 X */ X X/* X * OPEN LOOK object drawing package X * Sun Microsystems, Inc. X */ X X#ifndef OL_PRIVATE_DEFINED X#define OL_PRIVATE_DEFINED X X#include "olgx.h" X X#define STRING_SIZE 128 /* max size of a glyph font string */ X X#define VARHEIGHT_BUTTON_CORNER_DIMEN 7 X X X#define False 0 X#define True 1 X X X/* X * OPEN LOOK (TM) constant definitions X */ X X X/* X * Macro definitions X */ X#define VARIABLE_LENGTH_MACRO(start_pos, offset) \ X for (i = 0; i < num_add; i++) { \ X string[start_pos+i] = offset + add_ins[i]; \ X } X Xtypedef struct _per_disp_res_rec { X Display * dpy; X int screen; X GC_rec * gc_list_ptr; X struct _per_disp_res_rec * next; X} per_disp_res_rec, *per_disp_res_ptr; X X/* X * Definitions used by the color calculation code X */ X#define XRGB 0xffff X#define MAXRGB 0xff X#define MAXH 360 X#define MAXSV 1000 X X#define VMUL 12 /* brighten by 20% (12 = 1.2*10) */ X#define SDIV 2 /* unsaturate by 50% (divide by 2) */ X#define VMIN 400 /* minimum highlight brightness of 40% */ X Xtypedef struct { X int r, X g, X b; X} RGB; X Xtypedef struct { X int h, X s, X v; X} HSV; X X/* X * Private function declarations X */ X Xint calc_add_ins(); Xchar * olgx_malloc(); Xvoid olgx_update_horizontal_slider(); Xvoid olgx_update_vertical_slider(); Xvoid olgx_update_vertical_gauge(); Xvoid olgx_update_horiz_gauge(); Xvoid olgx_free(); Xvoid olgx_destroy_gcrec(); Xvoid olgx_total_gcs(); Xvoid olgx_initialise_gcrec(); Xvoid olgx_draw_elevator(); Xvoid olgx_error(); Xvoid olgx_draw_pixmap_label(); Xvoid olgx_draw_varheight_button(); XPixmap olgx_get_busy_stipple(); XPixmap olgx_get_grey_stipple(); Xint gc_matches(); Xint olgx_cmp_fonts(); XGC_rec * olgx_get_gcrec(); XGC_rec * olgx_gcrec_available(); XGC_rec * olgx_set_color_smart(); XGraphics_info * olgx_create_ginfo(); Xper_disp_res_ptr olgx_get_perdisplay_list(); X X/* ol_color.c */ Xvoid hsv_to_rgb(); Xvoid rgb_to_hsv(); Xvoid rgb_to_xcolor(); Xvoid hsv_to_xcolor(); Xvoid xcolor_to_hsv(); Xvoid olgx_hsv_to_3D(); X X#endif !OL_PRIVATE_DEFINED X X X X X SHAR_EOF chmod 0664 olgx_impl.h || echo "restore of olgx_impl.h fails" exit 0 -- Brett M. Bergquist, Principal Engineer | "Remind me" ... "to write an General DataComm, Inc., | "article on the compulsive reading Middlebury, CT 06762 | of news." - Stranger in a Strange Land Email: bergquis@nms.gdc.portal.com or ...!portal!gdc!nms!bergquis