motiftools-xmt-cvs Mailing List for Xmt - Motif Tools (Page 3)
Brought to you by:
motiftools
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(1) |
Apr
(22) |
May
(10) |
Jun
|
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(14) |
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
From: Grant M. <grm...@us...> - 2002-04-23 03:50:16
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv20416 Modified Files: Progress.c Log Message: Field used before set in widget record Index: Progress.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Progress.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Progress.c 23 Apr 2002 03:41:50 -0000 1.4 --- Progress.c 23 Apr 2002 03:50:12 -0000 1.5 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.5 2002/04/23 03:50:12 grmcdorman + * Field used before set in widget record + * * Revision 1.4 2002/04/23 03:41:50 grmcdorman * Error in stipple allocation in last fix *************** *** 277,285 **** { XmtProgressWidget pw = (XmtProgressWidget) init; - - AllocateGCs(init); - AllocateFonts(init); pw->progress.stipple = None; if (pw->progress.label_string != NULL) { --- 280,289 ---- { XmtProgressWidget pw = (XmtProgressWidget) init; + /* must be set first */ pw->progress.stipple = None; + + AllocateGCs(init); + AllocateFonts(init); if (pw->progress.label_string != NULL) { |
From: Grant M. <grm...@us...> - 2002-04-23 03:41:53
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv18974 Modified Files: Progress.c Log Message: Error in stipple allocation in last fix Index: Progress.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Progress.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Progress.c 23 Apr 2002 01:24:45 -0000 1.3 --- Progress.c 23 Apr 2002 03:41:50 -0000 1.4 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.4 2002/04/23 03:41:50 grmcdorman + * Error in stipple allocation in last fix + * * Revision 1.3 2002/04/23 01:24:45 grmcdorman * Fix error with stippling (may try to get unregistered Xmt bitmap) *************** *** 781,784 **** --- 784,788 ---- if (pw->progress.stipple != None) { XmDestroyPixmap(pw->core.screen, pw->progress.stipple); + pw->progress.stipple = None; } } *************** *** 841,850 **** GCSubwindowMode|GCClipMask); ! if (pw->progress.stipple != None) { pw->progress.stipple = XmGetPixmapByDepth(pw->core.screen, "50_foreground", 1, 0, 1); } values.foreground = pw->progress.fill_colour; - values.fill_style = FillStippled; - values.stipple = pw->progress.stipple; pw->progress.foreground_gc = XtAllocateGC((Widget) pw, pw->core.depth, --- 845,867 ---- GCSubwindowMode|GCClipMask); ! int stipplemask = GCStipple|GCFillStyle; ! if (pw->progress.stipple == None) { pw->progress.stipple = XmGetPixmapByDepth(pw->core.screen, "50_foreground", 1, 0, 1); + if (pw->progress.stipple == None || + pw->progress.stipple == XmUNSPECIFIED_PIXMAP) { + stipplemask = 0; + pw->progress.stipple = None; + values.stipple = None; + values.fill_style = FillSolid; + } else { + values.stipple = pw->progress.stipple; + values.fill_style = FillStippled; + } + + } else { + values.stipple = pw->progress.stipple; + values.fill_style = FillStippled; } values.foreground = pw->progress.fill_colour; pw->progress.foreground_gc = XtAllocateGC((Widget) pw, pw->core.depth, *************** *** 855,862 **** pw->progress.insensitive_gc = XtAllocateGC((Widget) pw, pw->core.depth, ! GCForeground|GCStipple|GCFillStyle, &values, 0, ! unusedmask & ~(GCStipple|GCFillStyle|GCTileStipXOrigin|GCTileStipYOrigin)); /* --- 872,879 ---- pw->progress.insensitive_gc = XtAllocateGC((Widget) pw, pw->core.depth, ! GCForeground|stipplemask, &values, 0, ! unusedmask & ~(stipplemask|GCTileStipXOrigin|GCTileStipYOrigin)); /* *************** *** 881,888 **** pw->progress.text_insensitive_gc = XtAllocateGC((Widget) pw, pw->core.depth, ! mask|GCStipple|GCFillStyle, &values, 0, ! unusedmask & ~(GCStipple|GCFillStyle|GCTileStipXOrigin|GCTileStipYOrigin)); values.foreground = pw->core.background_pixel; --- 898,905 ---- pw->progress.text_insensitive_gc = XtAllocateGC((Widget) pw, pw->core.depth, ! mask|stipplemask, &values, 0, ! unusedmask & ~(stipplemask|GCTileStipXOrigin|GCTileStipYOrigin)); values.foreground = pw->core.background_pixel; |
From: Grant M. <grm...@us...> - 2002-04-23 01:31:54
|
Update of /cvsroot/motiftools/xmt/man/man3 In directory usw-pr-cvs1:/tmp/cvs-serv21030 Modified Files: Imakefile XmtExtLabel.man Added Files: XmtCreateStippledPixmap.man Log Message: New man page for new pixmap functions; updates to Imakefile for new man pages; updates to XmtExtLabel man page --- NEW FILE --- .\" .\" Motif Tools Library, Version 3.1 .\" $Id: XmtCreateStippledPixmap.man,v 1.1 2002/04/23 01:31:52 grmcdorman Exp $ .\" .\" Written by Grant McDorman .\" Copyright (c) 2002 by Grant McDorman .\" All Rights Reserved. See the file COPYRIGHT for details. .\" This is open source software. See the file LICENSE for details. .\" There is no warranty for this software. See NO_WARRANTY for details. .\" .\" This page documents: XmtCreateStippledPixmap XmtRecolorPixmap XmtStipplePixmap .\" .TH XmtCreateStippledPixmap 3 "Motif Tools" Xmt .SH NAME \fIXmtCreateStippledPixmap()\fR, \fIXmtRecolorPixmap()\fR, \fIXmtStipplePixmap\fR \- stipple pixmaps. .SH \fBSYNOPSIS\fR .na .nh .RS 15m .ti -15m \fB#include\fR \fB<Xmt/Pixmap.h>\fR .ti -15m \fBPixmap XmtRecolorPixmap(Widget \fIw\fR, \fBPixmap \fIp\fR, \fBPixel \fIcolour1\fR, \fBPixel \fIcolour2\fR) .ti -15m \fBPixmap XmtStipplePixmap(Widget \fIw\fR, \fBPixmap \fIp\fR, \fBPixel \fIcolor\fR) .ti -15m \fBPixmap XmtCreateStippledPixmap(Widget \fIw\fR, \fBunsigned int \fIwidth\fR, \fBunsigned int \fIheight\fR, \fBunsigned int \fIdepth\fR, \fBPixel \fIfg\fR, \fBPixel \fIbg\fR) .ad .hy 14 .SH \fBARGUMENTS\fR \fBINPUTS\fR .DS 5 .IP "\fIw\fR " Any widget. Used to get access to the screen. .IP \fIp\fP The pixmap to use to create the stipple. .IP \fIcolour1\fP The first colour to use for re-colouring. .IP \fIcolour2\fP The second colour to use for re-colouring. .IP \fIcolour\fP The colour to use to stipple. .IP \fIwidth\fP The width of the pixmap to create. .IP \fIheight\fP The height of the pixmap to create. .IP \fIdepth\fP The depth of the pixmap to create. If 0, use the depth from \fIw\fP. .IP \fIfg\fP The foreground stipple color. .IP \fIbg\fP The background stipple color. .DE .PP \fBRETURNS\fR .DS 5 .PP These functions return a created Pixmap, or \fINone\fP if none can be created. .SH \fBDESCRIPTION\fP \fIXmtRecolorPixmap\fP converts a pixmap to two colours. It does this by converting each colour in the source pixmap to the closest colour of the pair supplied. \fIXmtStipplePixmap\fP creates a copy of the supplied pixmap with alternating pixels overlaided with \fIcolor\fP. As is normal for stipples, alternate rows are staggered. \fIXmtCreateStippledPixmap\fP creates a new pixmap, with pixels alternating between \fIfg\fP and \fIbg\fP. As is normal for stipples, alternate rows are staggered. The pixmaps are not cached; multiple calls to these functions with the same parameters will create new pixmaps. The pixmaps must be freed by XFreePixmap when no longer needed. .SH \fBSEE\fR \fBALSO\fR .na .nh \fIXmtLookupBitmap()\fR, \fIXmtLookupBitmask()\fR, \fIXmtLookupPixmap()\fR,' \fIXmtParseXpmData()\fR, \fIXmtParseXpmFile()\fR, \fIXmtRegisterImage()\fR, \fIXmtRegisterXbmData()\fR, \fIXmtReleasePixmap()\fR. Index: Imakefile =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/Imakefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Imakefile 24 Sep 2001 21:46:41 -0000 1.7 --- Imakefile 23 Apr 2002 01:31:52 -0000 1.8 *************** *** 346,347 **** --- 346,354 ---- InstallGenManPage(XmtInputField,$(XMTMANDIR),$(XMTMANSUFFIX)) InstallGenManPage(XmtProgress,$(XMTMANDIR),$(XMTMANSUFFIX)) + + InstallGenManPage(XmtExtLabel,$(XMTMANDIR),$(XMTMANSUFFIX)) + InstallGenManPageAliases(XmtCreateChooser,$(XMTMANDIR),$(XMTMANSUFFIX),XmtCreateExtLabel) + InstallGenManPage(XmtCreateStippledPixmap,$(XMTMANDIR),$(XMTMANSUFFIX)) + InstallGenManPageAliases(XmtCreateStippledPixmap,$(XMTMANDIR),$(XMTMANSUFFIX),XmtRecolorPixmap) + InstallGenManPageAliases(XmtCreateStippledPixmap,$(XMTMANDIR),$(XMTMANSUFFIX),XmtStipplePixmap) + Index: XmtExtLabel.man =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/XmtExtLabel.man,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** XmtExtLabel.man 21 Apr 2002 18:31:03 -0000 1.2 --- XmtExtLabel.man 23 Apr 2002 01:31:52 -0000 1.3 *************** *** 39,43 **** If the pixmap is not specified, it is treated as blank. .LP ! If the insensitive pixmap is not specified, the label pixmap is used instead. .LP \fBRESOURCES\fR --- 39,45 ---- If the pixmap is not specified, it is treated as blank. .LP ! If the insensitive pixmap is not specified, the sensitive pixmap is drawn ! either converted to the two grayForeground and grayBackground colors, or ! stippled (see INSENSITIVE PIXMAP). .LP \fBRESOURCES\fR *************** *** 138,148 **** \fBINSENSITIVE PIXMAP\fP .PP ! If no insensitive pixmap is supplied, XmtExtLabel will compute one ! internally. This pixmap will be derived from the label pixmap; the pixmap ! colours will be translated to the closest color from \fIXmtNgrayForeground\fP and ! \fIXmtNgrayBackground\fP. Note that the \fIXmNinsensitivePixmap\fP resource ! will not be set to the created pixmap. Also note that this differs from ! Motif 2 behaviour; Motif 2 will also create an insensitive pixmap, but by ! darkening the pixmap colors (resulting in a dark but full-color pixmap). \fBTRANSLATIONS\fR --- 140,164 ---- \fBINSENSITIVE PIXMAP\fP .PP ! If no insensitive pixmap is supplied (i.e. \fIXmNinsensitivePixmap\fP is ! None or XmUNSPECIFIED_PIXMAP), XmtExtLabel will use the normal pixmap, but ! drawn in a different style depending on the \fIXmtNinsensitiveStyle\fP ! resource. ! ! If the style is \fIXmtNINSENSITIVE_GRAY\fP, the pixmap will be recoloured ! by translating to the closest color from \fIXmtNgrayForeground\fP and ! \fIXmtNgrayBackground\fP. ! ! If the style is \fIXmtNINSENSITIVE_STIPPLE\fP, the pixmap will be drawn with ! a stippled mask (combined with the pixmap's mask, if any); this results in a ! similar appearance to the stippled text. ! ! Some pixmaps may not work well when treated this way; you will have to ! explicitly suppy an insensitive pixmap for these cases. ! ! Note that the \fIXmNinsensitivePixmap\fP resource will remain \fINone\fP or ! \fIXmUNSPECIFIED_PIXMAP\fP. ! ! Also note that this differs from Motif 2 behaviour; Motif 2 draws a black ! stipple over the label pixmap. \fBTRANSLATIONS\fR |
From: Grant M. <grm...@us...> - 2002-04-23 01:30:57
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv20846 Modified Files: ExtLabel.c ExtLabelP.h Log Message: Updated and extended label stippling Index: ExtLabel.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabel.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ExtLabel.c 21 Apr 2002 18:31:03 -0000 1.2 --- ExtLabel.c 23 Apr 2002 01:30:53 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.3 2002/04/23 01:30:53 grmcdorman + * Updated and extended label stippling + * * Revision 1.2 2002/04/21 18:31:03 grmcdorman * ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. *************** *** 36,40 **** { XmtNgrayForeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(ext_label.gray_foreground), ! XtRString, (XtPointer) "gray50" }, { XmtNgrayBackground, XtCBackground, XtRPixel, sizeof(Pixel), offset(ext_label.gray_background), --- 39,43 ---- { XmtNgrayForeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(ext_label.gray_foreground), ! XtRString, (XtPointer) "gray66" }, { XmtNgrayBackground, XtCBackground, XtRPixel, sizeof(Pixel), offset(ext_label.gray_background), *************** *** 273,279 **** Layout(&lw->ext_label, (XmLabelWidget) init); /* ! * Create insensitive pixmap, if required. */ ! CheckPixmapInsens(&lw->ext_label, (XmLabelWidget) init); } --- 276,283 ---- Layout(&lw->ext_label, (XmLabelWidget) init); /* ! * Insensitive pixmap creation is delayed, as some platforms ! * may not have the widget properly initialized at this point. */ ! lw->ext_label.check_mask = True; } *************** *** 300,304 **** #define CHANGED_E(field) CHANGED(ext_label.field) ! /* If we are allowd to recompute size, do so. */ if (nw->label.recompute_size) { CalculateWantedSize(&nw->ext_label, (XmLabelWidget) set); --- 304,308 ---- #define CHANGED_E(field) CHANGED(ext_label.field) ! /* If we are allowed to recompute size, do so. */ if (nw->label.recompute_size) { CalculateWantedSize(&nw->ext_label, (XmLabelWidget) set); *************** *** 381,385 **** --- 385,397 ---- { XmtExtLabelWidget lw = (XmtExtLabelWidget) w; + + if (lw->ext_label.check_mask) { + CheckPixmapInsens(&lw->ext_label, (XmLabelWidget) w); + lw->ext_label.check_mask = False; + + } + DrawDecor(&lw->ext_label, (XmLabelWidget) w); + if (lw->ext_label.show_both && lw->ext_label.label_position == XmtLABEL_UNDERLAY) { DrawLabel(&lw->ext_label, (XmLabelWidget) w); *************** *** 392,398 **** } else { Pixmap p; ! Pixmap mask; unsigned int width, height; - if (lw->label.pixmap_insen != None && lw->label.pixmap_insen != XmUNSPECIFIED_PIXMAP) { --- 404,409 ---- } else { Pixmap p; ! Pixmap mask = None; unsigned int width, height; if (lw->label.pixmap_insen != None && lw->label.pixmap_insen != XmUNSPECIFIED_PIXMAP) { *************** *** 404,411 **** --- 415,428 ---- width = lw->ext_label.pixmap_width; height = lw->ext_label.pixmap_height; + } else { + p = lw->label.pixmap; + width = lw->ext_label.pixmap_width; + height = lw->ext_label.pixmap_height; } if (lw->ext_label.mask_insen != None && lw->ext_label.mask_insen != XmUNSPECIFIED_PIXMAP) { mask = lw->ext_label.mask_insen; + } else if (lw->ext_label.computed_pixmap_insens_mask != None) { + mask = lw->ext_label.computed_pixmap_insens_mask; } else { mask = lw->ext_label.mask; *************** *** 909,927 **** (elw->show_both || lw->label.label_type == XmPIXMAP)) { /* There is a normal pixmap being shown, and no insensitive pixmap. Make one. */ - XImage *image; - Pixmap computed; - XColor color; - int intensity; - int fg_intensity; - int bg_intensity; - int delta_fg, delta_bg; - - color.pixel = elw->gray_foreground; - XQueryColor(lw->core.screen->display, lw->core.colormap, &color); - fg_intensity = (color.red + color.blue + color.green) / 3; - - color.pixel = elw->gray_background; - XQueryColor(lw->core.screen->display, lw->core.colormap, &color); - bg_intensity = (color.red + color.blue + color.green) / 3; if (elw->computed_pixmap_insens != None) { --- 926,929 ---- *************** *** 929,973 **** elw->computed_pixmap_insens = None; } ! image = XGetImage(lw->core.screen->display, lw->label.pixmap, ! 0, 0, elw->pixmap_width, elw->pixmap_height, ! ~0, ZPixmap); ! computed = XCreatePixmap(lw->core.screen->display, ! RootWindowOfScreen(lw->core.screen), ! elw->pixmap_width, elw->pixmap_height, ! lw->core.depth); ! if (image != NULL && computed != None) { ! int x, y; ! for (y = 0; y < elw->pixmap_height; y++) { ! for (x = 0; x < elw->pixmap_width; x++) { ! color.pixel = XGetPixel(image, x, y); ! XQueryColor(lw->core.screen->display, ! lw->core.colormap, &color); ! intensity = (color.red + color.blue + color.green) / 3; ! /* find the closest of the gray fg/bg colours */ ! delta_fg = abs(intensity - fg_intensity); ! delta_bg = abs(intensity - bg_intensity); ! if (delta_fg < delta_bg) { ! color.pixel = elw->gray_foreground; ! } else { ! color.pixel = elw->gray_background; ! } ! XPutPixel(image, x, y, color.pixel); ! } ! } ! XPutImage(lw->core.screen->display, computed, lw->label.normal_GC, ! image, ! 0, 0, 0, 0, elw->pixmap_width, elw->pixmap_height); ! XDestroyImage(image); } else { ! if (image != NULL) { ! XDestroyImage(image); ! } ! if (computed != None) { ! XFreePixmap(lw->core.screen->display, computed); ! computed = None; } } - elw->computed_pixmap_insens = computed; } } --- 931,953 ---- elw->computed_pixmap_insens = None; } ! if (elw->computed_pixmap_insens_mask != None) { ! XFreePixmap(lw->core.screen->display, elw->computed_pixmap_insens); ! elw->computed_pixmap_insens = None; ! } ! if (elw->insensitive_style == XmtINSENSITIVE_GRAY) { ! /* Recolour with the nearest 'gray_foreground' and 'gray_background' values. */ ! elw->computed_pixmap_insens = XmtRecolorPixmap((Widget) lw, lw->label.pixmap, ! elw->gray_foreground, elw->gray_background); } else { ! if (elw->mask == None || elw->mask == XmUNSPECIFIED_PIXMAP) { ! /* Create a depth-1 stippled pixmap with fg=0, bg=1 */ ! elw->computed_pixmap_insens_mask = XmtCreateStippledPixmap((Widget) lw, ! elw->pixmap_width, elw->pixmap_height, 1, 0, 1); ! } else { ! /* Stipple the mask with '0' (off) */ ! elw->computed_pixmap_insens_mask = XmtStipplePixmap((Widget) lw, elw->mask, 0); } } } } Index: ExtLabelP.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabelP.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ExtLabelP.h 21 Apr 2002 18:31:03 -0000 1.2 --- ExtLabelP.h 23 Apr 2002 01:30:54 -0000 1.3 *************** *** 11,14 **** --- 11,17 ---- * * $Log$ + * Revision 1.3 2002/04/23 01:30:54 grmcdorman + * Updated and extended label stippling + * * Revision 1.2 2002/04/21 18:31:03 grmcdorman * ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. *************** *** 60,63 **** --- 63,68 ---- /* private data */ + Boolean check_mask; + Dimension bottom_margin; Dimension left_margin; |
From: Grant M. <grm...@us...> - 2002-04-23 01:30:20
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv20747a Modified Files: Pixmap.c Pixmap.h Log Message: New pixmap functions: XmtCreateStippledPixmap, XmtRecolorPixmap, XmtStipplePixmap Index: Pixmap.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Pixmap.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Pixmap.c 19 Sep 2001 02:57:18 -0000 1.2 --- Pixmap.c 23 Apr 2002 01:30:16 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.3 2002/04/23 01:30:16 grmcdorman + * New pixmap functions: XmtCreateStippledPixmap, XmtRecolorPixmap, XmtStipplePixmap + * * Revision 1.2 2001/09/19 02:57:18 grmcdorman * This change makes the following modifications: *************** *** 517,518 **** --- 520,695 ---- } + + /***************************************************************** + * Recolour Pixmap based on intensities of colours. + */ + #if NeedFunctionPrototypes + Pixmap XmtRecolorPixmap(Widget w, Pixmap p, Pixel colour1, Pixel colour2) + #else + Pixmap XmtRecolorPixmap(w, p, colour1, colour2) + Widget w; + Pixmap p; + Pixel colour1; + Pixel colour2; + #endif + { + XImage *image; + Pixmap computed; + XColor color; + int intensity; + int intensity1; + int intensity2; + int delta1, delta2; + GC gc; + XGCValues values; + unsigned int border; + int x, y; + Window dummywin; + unsigned int width, height, depth; + + width = height = 0; + depth = 0; + + (void)XGetGeometry(w->core.screen->display, p, + &dummywin, &x, &y, &width, &height, &border, &depth); + + color.pixel = colour1; + XQueryColor(w->core.screen->display, w->core.colormap, &color); + intensity1 = (color.red + color.blue + color.green) / 3; + + color.pixel = colour2; + XQueryColor(w->core.screen->display, w->core.colormap, &color); + intensity2 = (color.red + color.blue + color.green) / 3; + + image = XGetImage(w->core.screen->display, p, + 0, 0, width, height, + ~0, ZPixmap); + computed = XCreatePixmap(w->core.screen->display, + RootWindowOfScreen(w->core.screen), + width, height, + depth); + if (image != NULL && computed != None) { + int x, y; + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + color.pixel = XGetPixel(image, x, y); + XQueryColor(w->core.screen->display, + w->core.colormap, &color); + intensity = (color.red + color.blue + color.green) / 3; + /* find the closest of the two colours */ + delta1 = abs(intensity - intensity1); + delta2 = abs(intensity - intensity2); + if (delta1 < delta2) { + color.pixel = colour1; + } else { + color.pixel = colour2; + } + + XPutPixel(image, x, y, color.pixel); + } + } + gc = XCreateGC(w->core.screen->display, p, 0, &values); + XPutImage(w->core.screen->display, computed, gc, + image, + 0, 0, 0, 0, width, height); + XFreeGC(w->core.screen->display, gc); + XDestroyImage(image); + } else { + if (image != NULL) { + XDestroyImage(image); + } + if (computed != None) { + XFreePixmap(w->core.screen->display, computed); + computed = None; + } + } + return computed; + } + + /***************************************************************** + * Stipple Pixmap. (Every other pixel is set to 'colour'.). + */ + #if NeedFunctionPrototypes + Pixmap XmtStipplePixmap(Widget w, Pixmap p, Pixel colour) + #else + Pixmap XmtStipplePixmap(w, p) + Widget w; + Pixmap p; + #endif + { + Pixmap computed; + Pixmap stipple; + GC gc; + XGCValues values; + unsigned int border; + int x, y; + Window dummywin; + unsigned int width, height, depth; + + width = height = 0; + depth = 0; + + + (void)XGetGeometry(w->core.screen->display, p, + &dummywin, &x, &y, &width, &height, &border, &depth); + + computed = XCreatePixmap(w->core.screen->display, + RootWindowOfScreen(w->core.screen), + width, height, + depth); + /* Create the GC to use. */ + stipple = XmGetPixmapByDepth(w->core.screen, "50_foreground", 1, 0, 1); + values.stipple = stipple; + values.fill_style = FillStippled; + values.foreground = colour; + gc = XCreateGC(w->core.screen->display, computed, GCFillStyle|GCStipple|GCForeground, &values); + /* Copy the source pixmap. */ + XCopyArea(w->core.screen->display, p, computed, gc, 0, 0, width, height, 0, 0); + /* Fill stippled. */ + XFillRectangle(w->core.screen->display, computed, gc, 0, 0, width+1, height+1); + + XmDestroyPixmap(w->core.screen, stipple); + XFreeGC(w->core.screen->display, gc); + + return computed; + } + + /***************************************************************** + * Create Stipple Bitmap. (Alternating fg/bg pixels). + */ + #if NeedFunctionPrototypes + Pixmap XmtCreateStippledPixmap(Widget w, unsigned int width, unsigned int height, unsigned int depth, Pixel fg, Pixel bg) + #else + Pixmap XmtCreateStippledPixmap(w, width, height, depth, fg, bg) + Widget w; + unsigned int width; + unsigned int height; + unsigned int depth; + Pixel fg; + Pixel bg; + #endif + { + Pixmap computed; + Pixmap stipple; + GC gc; + XGCValues values; + + stipple = XmGetPixmapByDepth(w->core.screen, "50_foreground", 1, 0, 1); + + computed = XCreatePixmap(w->core.screen->display, + RootWindowOfScreen(w->core.screen), + width, height, + depth > 0 ? depth : w->core.depth); + + /* Create a stippled mask the full size of the mask */ + values.stipple = stipple; + values.fill_style = FillOpaqueStippled; + values.foreground = fg; + values.background = bg; + gc = XCreateGC(w->core.screen->display, computed, GCFillStyle|GCStipple|GCForeground|GCBackground, &values); + XFillRectangle(w->core.screen->display, computed, gc, 0, 0, width+1, height+1); + + XmDestroyPixmap(w->core.screen, stipple); + + return computed; + } Index: Pixmap.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Pixmap.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** Pixmap.h 10 Feb 2001 13:50:11 -0000 1.1.1.1 --- Pixmap.h 23 Apr 2002 01:30:16 -0000 1.2 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.2 2002/04/23 01:30:16 grmcdorman + * New pixmap functions: XmtCreateStippledPixmap, XmtRecolorPixmap, XmtStipplePixmap + * * Revision 1.1.1.1 2001/02/10 13:50:11 motiftools * Initial import of Xmt310 to CVS *************** *** 44,47 **** --- 47,53 ---- extern Pixmap XmtGetPixmap(Widget, XmtColorTable, StringConst); extern void XmtRegisterImprovedIcons(Widget, XmtColorTable); + extern Pixmap XmtRecolorPixmap(Widget w, Pixmap p, Pixel colour1, Pixel colour2); + extern Pixmap XmtStipplePixmap(Widget w, Pixmap p, Pixel colour); + extern Pixmap XmtCreateStippledPixmap(Widget w, unsigned int width, unsigned int height, unsigned int depth, Pixel fg, Pixel bg); #else extern void XmtRegisterXbmData(); *************** *** 56,59 **** --- 62,68 ---- extern Pixmap XmtGetPixmap(); extern void XmtRegisterImprovedIcons(); + extern Pixmap XmtRecolorPixmap(); + extern Pixmap XmtStipplePixmap(); + extern Pixmap XmtCreateStippledPixmap(); #endif _XFUNCPROTOEND |
From: Grant M. <grm...@us...> - 2002-04-23 01:24:48
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv19571 Modified Files: Progress.c ProgressP.h Log Message: Fix error with stippling (may try to get unregistered Xmt bitmap) Index: Progress.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Progress.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Progress.c 16 Sep 2001 02:16:09 -0000 1.2 --- Progress.c 23 Apr 2002 01:24:45 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.3 2002/04/23 01:24:45 grmcdorman + * Fix error with stippling (may try to get unregistered Xmt bitmap) + * * Revision 1.2 2001/09/16 02:16:09 motiftools * Upper cased some style_names and style_values in order to program from *************** *** 275,278 **** --- 278,283 ---- AllocateFonts(init); + pw->progress.stipple = None; + if (pw->progress.label_string != NULL) { pw->progress.label_string = XmStringCopy(pw->progress.label_string); *************** *** 774,777 **** --- 779,785 ---- XmStringFree(pw->progress.label_string); } + if (pw->progress.stipple != None) { + XmDestroyPixmap(pw->core.screen, pw->progress.stipple); + } } *************** *** 833,839 **** GCSubwindowMode|GCClipMask); values.foreground = pw->progress.fill_colour; values.fill_style = FillStippled; ! values.stipple = XmtLookupBitmap((Widget) pw, "_xmt_gray50"); pw->progress.foreground_gc = XtAllocateGC((Widget) pw, pw->core.depth, --- 841,850 ---- GCSubwindowMode|GCClipMask); + if (pw->progress.stipple != None) { + pw->progress.stipple = XmGetPixmapByDepth(pw->core.screen, "50_foreground", 1, 0, 1); + } values.foreground = pw->progress.fill_colour; values.fill_style = FillStippled; ! values.stipple = pw->progress.stipple; pw->progress.foreground_gc = XtAllocateGC((Widget) pw, pw->core.depth, Index: ProgressP.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ProgressP.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ProgressP.h 19 Sep 2001 02:57:18 -0000 1.2 --- ProgressP.h 23 Apr 2002 01:24:45 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.3 2002/04/23 01:24:45 grmcdorman + * Fix error with stippling (may try to get unregistered Xmt bitmap) + * * Revision 1.2 2001/09/19 02:57:18 grmcdorman * This change makes the following modifications: *************** *** 74,77 **** --- 77,81 ---- /* private state */ + Pixmap stipple; GC foreground_gc; GC insensitive_gc; |
From: Grant M. <grm...@us...> - 2002-04-21 18:31:06
|
Update of /cvsroot/motiftools/xmt/man/man3 In directory usw-pr-cvs1:/tmp/cvs-serv15391/man/man3 Modified Files: XmtExtLabel.man Log Message: ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. Index: XmtExtLabel.man =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/XmtExtLabel.man,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** XmtExtLabel.man 21 Apr 2002 04:23:47 -0000 1.1 --- XmtExtLabel.man 21 Apr 2002 18:31:03 -0000 1.2 *************** *** 51,55 **** --- 51,58 ---- l l l l l. \fBName\fR|\fBType\fR|\fBClass\fR|\fBAccess\fR|\fBDefault\fR + XmtNgrayForeground|XmRPixel|XmCForeground|CSG|gray50 + XmtNgrayBackground|XmRPixel|XmCBackground|CSG|white XmtNinsensitiveMask|XmtRBitmask|XmtCMask|CSG|XmUNSPECIFIED_PIXMAP + XmtNinsensitiveStyle|XmtRInsensitiveStyle|XmtCStyle|CSG|XmINSENSITIVE_GRAY XmtNlabelPosition|XmtRExtLabelPosition|XmtCPosition|CSG|XmLABEL_LEFT XmtNmask|XmtRBitmask|XmtCMask|CSG|XmUNSPECIFIED_PIXMAP *************** *** 62,68 **** --- 65,88 ---- .TE .ps +2 + .IP \fIXmtNgrayBackground\fR + When the widget is insensitive and the \fIXmtNinsensitiveStyle\fP is + \fIXmtINSENSITIVE_GRAY\fP, this is the shadow color for the label string. + This is also used to create an insensitive pixmap if none is supplied (see + INSENSITIVE PIXMAP). + .IP \fIXmtNgrayForeground\fR + When the widget is insensitive and the \fIXmtNinsensitiveStyle\fP is + \fIXmtINSENSITIVE_GRAY\fP, this is the foreground color for the label string. + This is also used to create an insensitive pixmap if none is supplied (see + INSENSITIVE PIXMAP). .IP \fIXmtNinsensitiveMask\fR The clip mask used to display the pixmap when the label is insensitive, if the XmLabel \fIXmNinsensitivePixmap\fP has been set. + .IP \fIXmtNinsensitiveStyle\fR + The style of insensitive drawing. If this is \fIXmtINSENSITIVE_STIPPLE\fP, + the label string is drawn stippled with the foreground colour, in the standard + Motif style. If this \fIXmtINSENSITIVE_GRAY\fP, the label string is drawn + solid with a shadow, using the foreground color to \fIXmtNgrayForeground\fP + and the shadow colour \fIXmtNgrayBackground\fP. The insensitive pixmap is + not affected by this style. .IP \fIXmtNlabelPosition\fR The position of the label string. Ignored if \fIshowBoth\fP is False. Possible values are: *************** *** 114,117 **** --- 134,148 ---- .PP The ExtLabel widget has no callbacks. + + .PP + \fBINSENSITIVE PIXMAP\fP + .PP + If no insensitive pixmap is supplied, XmtExtLabel will compute one + internally. This pixmap will be derived from the label pixmap; the pixmap + colours will be translated to the closest color from \fIXmtNgrayForeground\fP and + \fIXmtNgrayBackground\fP. Note that the \fIXmNinsensitivePixmap\fP resource + will not be set to the created pixmap. Also note that this differs from + Motif 2 behaviour; Motif 2 will also create an insensitive pixmap, but by + darkening the pixmap colors (resulting in a dark but full-color pixmap). \fBTRANSLATIONS\fR |
From: Grant M. <grm...@us...> - 2002-04-21 18:31:06
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv15391/Xmt Modified Files: ExtLabel.c ExtLabel.h ExtLabelP.h ExtLabelS.c Log Message: ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. Index: ExtLabel.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabel.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ExtLabel.c 21 Apr 2002 04:23:47 -0000 1.1 --- ExtLabel.c 21 Apr 2002 18:31:03 -0000 1.2 *************** *** 1,3 **** ! /* * Motif Tools Library, Version 3.1 * $Id$ --- 1,3 ---- ! /* * Motif Tools Library, Version 3.1 * $Id$ *************** *** 10,13 **** --- 10,16 ---- [...1049 lines suppressed...] + image, + 0, 0, 0, 0, elw->pixmap_width, elw->pixmap_height); + XDestroyImage(image); + } else { + if (image != NULL) { + XDestroyImage(image); + } + if (computed != None) { + XFreePixmap(lw->core.screen->display, computed); + computed = None; + } + } + elw->computed_pixmap_insens = computed; + } + } /**************************************************************************/ ! /* application Utility Functions */ #if NeedFunctionPrototypes Widget XmtCreateExtLabel(Widget parent, String name, Index: ExtLabel.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabel.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ExtLabel.h 21 Apr 2002 04:23:47 -0000 1.1 --- ExtLabel.h 21 Apr 2002 18:31:03 -0000 1.2 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.2 2002/04/21 18:31:03 grmcdorman + * ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. + * * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) *************** *** 25,32 **** --- 28,48 ---- * string simultaneously, and also provides masks for the pixmap(s). * + * Unlike XmLabel, a shadow will be drawn (in the shadowType style) if + * the shadow thickness in XmPrimitive is not zero. + * + * The insensitive pixmap, if not provided, is computed using the + * 'grayForeground' and 'grayBackground' resources. + * + * It can also use two insensitive styles for the label string: the + * standard Motif stipple and a two-colour shadowed style using + * grayForeground and grayBackground. + * * Resources * * Name Class Type Default Access + * grayBackground Background Pixel white CSG + * grayForeground Foreground Pixel gray50 CSG * insensitiveMask Mask Bitmask XmUNSPECIFIED_PIXMAP CSG + * insensitiveStyle Style InsensitiveStyle XmtINSENSITIVE_STIPPLE CSG * labelPosition Position ExtLabelPosition XmLABEL_LEFT CSG * mask Mask Bitmask XmUNSPECIFIED_PIXMAP CSG *************** *** 52,126 **** XmtLABEL_UNDERLAY } XmtExtLabelPosition; ! externalref _Xconst char XmtExtLabelStrings[]; #ifndef XmtNinsensitiveMask ! #define XmtNinsensitiveMask ((char*)&XmtExtLabelStrings[0] #endif #ifndef XmtNlabelPosition ! #define XmtNlabelPosition ((char*)&XmtExtLabelStrings[15] #endif #ifndef XmtNmask ! #define XmtNmask ((char*)&XmtExtLabelStrings[28] #endif #ifndef XmtNpixmapAlignment ! #define XmtNpixmapAlignment ((char*)&XmtExtLabelStrings[32] #endif #ifndef XmtNpixmapVerticalAlignment ! #define XmtNpixmapVerticalAlignment ((char*)&XmtExtLabelStrings[47] #endif #ifndef XmtNshadowType ! #define XmtNshadowType ((char*)&XmtExtLabelStrings[70] #endif #ifndef XmtNshowBoth ! #define XmtNshowBoth ((char*)&XmtExtLabelStrings[80] #endif #ifndef XmtNspacing ! #define XmtNspacing ((char*)&XmtExtLabelStrings[88] #endif #ifndef XmtNverticalAlignment ! #define XmtNverticalAlignment ((char*)&XmtExtLabelStrings[95] #endif - #ifndef XmtCAlignment ! #define XmtCAlignment ((char*)&XmtExtLabelStrings[112] #endif #ifndef XmtCMask ! #define XmtCMask ((char*)&XmtExtLabelStrings[121] #endif #ifndef XmtCPosition ! #define XmtCPosition ((char*)&XmtExtLabelStrings[125] #endif #ifndef XmtCShadowType ! #define XmtCShadowType ((char*)&XmtExtLabelStrings[133] #endif #ifndef XmtCShowBoth ! #define XmtCShowBoth ((char*)&XmtExtLabelStrings[143] #endif #ifndef XmtCSpacing ! #define XmtCSpacing ((char*)&XmtExtLabelStrings[151] #endif - #ifndef XmtRAlignment ! #define XmtRAlignment ((char*)&XmtExtLabelStrings[158] #endif #ifndef XmtRBoolean ! #define XmtRBoolean ((char*)&XmtExtLabelStrings[167] #endif #ifndef XmtRDimension ! #define XmtRDimension ((char*)&XmtExtLabelStrings[174] #endif #ifndef XmtRBitmask ! #define XmtRBitmask ((char*)&XmtExtLabelStrings[183] #endif #ifndef XmtRExtLabelPosition ! #define XmtRExtLabelPosition ((char*)&XmtExtLabelStrings[190] #endif #ifndef XmtRShadowType ! #define XmtRShadowType ((char*)&XmtExtLabelStrings[206] #endif #ifndef XmtRVerticalAlignment ! #define XmtRVerticalAlignment ((char*)&XmtExtLabelStrings[216] #endif --- 68,211 ---- XmtLABEL_UNDERLAY } XmtExtLabelPosition; ! ! typedef enum { ! XmtINSENSITIVE_STIPPLE, ! XmtINSENSITIVE_GRAY, ! XmtINSENSITIVE_MOTIF=XmtINSENSITIVE_STIPPLE, ! XmtINSENSITIVE_GREY=XmtINSENSITIVE_GRAY ! } XmtInsensitiveStyle; externalref _Xconst char XmtExtLabelStrings[]; + /* + * List of resource names: + * XmtNgrayBackground + * XmtNgrayForeground + * XmtNinsensitiveMask + * XmtNinsensitiveStyle + * XmtNlabelPosition + * XmtNmask + * XmtNpixmapAlignment + * XmtNpixmapVerticalAlignment + * XmtNshadowType + * XmtNshowBoth + * XmtNspacing + * XmtNverticalAlignment + * XmtCAlignment + * XmtCMask + * XmtCPosition + * XmtCShadowType + * XmtCShowBoth + * XmtCSpacing + * XmtCStyle + * XmtRAlignment + * XmtRBoolean + * XmtRDimension + * XmtRBitmask + * XmtRExtLabelPosition + * XmtRInsensitiveStyle + * XmtRShadowType + * XmtRVerticalAlignment + * + * Run this file through this awk script: + * BEGIN { cnt = 0; } + * /^ \* Xmt[NCR]/{ + * print "#ifndef " $2; + * print "#define " $2 " ((char*)&XmtExtLabelStrings[" cnt "])"; + * print "#endif"; + * sub("Xmt[NCR]",""); + * cnt += length($2) + 1; + * } + * to get definitions below. + * Run through + * /^ \* Xmt[NCR]/{ + * sub("Xmt[NCR]",""); + * for (i = 1; i <= length($2); i++) { + * printf "'%c',", substr($2,i,1); + * } + * print " 0,"; + * } + * to get the body of the ExtLabelS.c file. + */ + #ifndef XmtNgrayBackground + #define XmtNgrayBackground ((char*)&XmtExtLabelStrings[0]) + #endif + #ifndef XmtNgrayForeground + #define XmtNgrayForeground ((char*)&XmtExtLabelStrings[15]) + #endif #ifndef XmtNinsensitiveMask ! #define XmtNinsensitiveMask ((char*)&XmtExtLabelStrings[30]) ! #endif ! #ifndef XmtNinsensitiveStyle ! #define XmtNinsensitiveStyle ((char*)&XmtExtLabelStrings[46]) #endif #ifndef XmtNlabelPosition ! #define XmtNlabelPosition ((char*)&XmtExtLabelStrings[63]) #endif #ifndef XmtNmask ! #define XmtNmask ((char*)&XmtExtLabelStrings[77]) #endif #ifndef XmtNpixmapAlignment ! #define XmtNpixmapAlignment ((char*)&XmtExtLabelStrings[82]) #endif #ifndef XmtNpixmapVerticalAlignment ! #define XmtNpixmapVerticalAlignment ((char*)&XmtExtLabelStrings[98]) #endif #ifndef XmtNshadowType ! #define XmtNshadowType ((char*)&XmtExtLabelStrings[122]) #endif #ifndef XmtNshowBoth ! #define XmtNshowBoth ((char*)&XmtExtLabelStrings[133]) #endif #ifndef XmtNspacing ! #define XmtNspacing ((char*)&XmtExtLabelStrings[142]) #endif #ifndef XmtNverticalAlignment ! #define XmtNverticalAlignment ((char*)&XmtExtLabelStrings[150]) #endif #ifndef XmtCAlignment ! #define XmtCAlignment ((char*)&XmtExtLabelStrings[168]) #endif #ifndef XmtCMask ! #define XmtCMask ((char*)&XmtExtLabelStrings[178]) #endif #ifndef XmtCPosition ! #define XmtCPosition ((char*)&XmtExtLabelStrings[183]) #endif #ifndef XmtCShadowType ! #define XmtCShadowType ((char*)&XmtExtLabelStrings[192]) #endif #ifndef XmtCShowBoth ! #define XmtCShowBoth ((char*)&XmtExtLabelStrings[203]) #endif #ifndef XmtCSpacing ! #define XmtCSpacing ((char*)&XmtExtLabelStrings[212]) ! #endif ! #ifndef XmtCStyle ! #define XmtCStyle ((char*)&XmtExtLabelStrings[220]) #endif #ifndef XmtRAlignment ! #define XmtRAlignment ((char*)&XmtExtLabelStrings[226]) #endif #ifndef XmtRBoolean ! #define XmtRBoolean ((char*)&XmtExtLabelStrings[236]) #endif #ifndef XmtRDimension ! #define XmtRDimension ((char*)&XmtExtLabelStrings[244]) #endif #ifndef XmtRBitmask ! #define XmtRBitmask ((char*)&XmtExtLabelStrings[254]) #endif #ifndef XmtRExtLabelPosition ! #define XmtRExtLabelPosition ((char*)&XmtExtLabelStrings[262]) ! #endif ! #ifndef XmtRInsensitiveStyle ! #define XmtRInsensitiveStyle ((char*)&XmtExtLabelStrings[279]) #endif #ifndef XmtRShadowType ! #define XmtRShadowType ((char*)&XmtExtLabelStrings[296]) #endif #ifndef XmtRVerticalAlignment ! #define XmtRVerticalAlignment ((char*)&XmtExtLabelStrings[307]) #endif Index: ExtLabelP.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabelP.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ExtLabelP.h 21 Apr 2002 04:23:47 -0000 1.1 --- ExtLabelP.h 21 Apr 2002 18:31:03 -0000 1.2 *************** *** 11,14 **** --- 11,17 ---- * * $Log$ + * Revision 1.2 2002/04/21 18:31:03 grmcdorman + * ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. + * * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) *************** *** 46,49 **** --- 49,53 ---- unsigned char pixmap_vertical_alignment; unsigned char shadow_type; /* XmSHADOW_... */ + unsigned char insensitive_style; /* XmtSTIPPLE, XmtGRAY, ... */ Boolean show_both; /* Show both pixmap and label */ *************** *** 52,55 **** --- 56,62 ---- Pixmap mask; + Pixel gray_foreground; /* Colours for XmtGRAY insensitive style */ + Pixel gray_background; + /* private data */ Dimension bottom_margin; *************** *** 72,75 **** --- 79,85 ---- Position label_x; Position label_y; + + Pixmap computed_pixmap_insens; + Pixmap computed_pixmap_insens_mask; unsigned int pixmap_height; Index: ExtLabelS.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtLabelS.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ExtLabelS.c 21 Apr 2002 04:23:47 -0000 1.1 --- ExtLabelS.c 21 Apr 2002 18:31:03 -0000 1.2 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.2 2002/04/21 18:31:03 grmcdorman + * ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. + * * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) *************** *** 32,57 **** externaldef(xmtExtLabelStrings) _Xconst char XmtExtLabelStrings[] = { ! /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19*/ ! 'i','n','s','e','n','s','i','t','i','v','e','M','a','s','k', 0, ! 'l','a','b','e','l','P','o','s','i','t','i','o','n', 0, ! 'm','a','s','k', 0, ! 'p','i','x','m','a','p','A','l','i','g','n','m','e','n','t', 0, ! 'p','i','x','m','a','p','V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, ! 's','h','a','d','o','w','T','y','p','e', 0, ! 's','h','o','w','B','o','t','h', 0, ! 's','p','a','c','i','n','g', 0, ! 'v','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, ! 'A','l','i','g','n','m','e','n','t', 0, ! 'M','a','s','k', 0, ! 'P','o','s','i','t','i','o','n', 0, ! 'S','h','a','d','o','w','T','y','p','e', 0, ! 'S','h','o','w','B','o','t','h', 0, ! 'S','p','a','c','i','n','g', 0, ! 'A','l','i','g','n','m','e','n','t', 0, ! 'B','o','o','l','e','a','n', 0, ! 'D','i','m','e','n','s','i','o','n', 0, ! 'B','i','t','m','a','s','k', 0, ! 'E','x','t','L','a','b','e','l','P','o','s','i','t','i','o','n', 0, ! 'S','h','a','d','o','w','T','y','p','e', 0, ! 'V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, }; --- 35,64 ---- externaldef(xmtExtLabelStrings) _Xconst char XmtExtLabelStrings[] = { ! 'g','r','a','y','B','a','c','k','g','r','o','u','n','d', 0, ! 'g','r','a','y','F','o','r','e','g','r','o','u','n','d', 0, ! 'i','n','s','e','n','s','i','t','i','v','e','M','a','s','k', 0, ! 'i','n','s','e','n','s','i','t','i','v','e','S','t','y','l','e', 0, ! 'l','a','b','e','l','P','o','s','i','t','i','o','n', 0, ! 'm','a','s','k', 0, ! 'p','i','x','m','a','p','A','l','i','g','n','m','e','n','t', 0, ! 'p','i','x','m','a','p','V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, ! 's','h','a','d','o','w','T','y','p','e', 0, ! 's','h','o','w','B','o','t','h', 0, ! 's','p','a','c','i','n','g', 0, ! 'v','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, ! 'A','l','i','g','n','m','e','n','t', 0, ! 'M','a','s','k', 0, ! 'P','o','s','i','t','i','o','n', 0, ! 'S','h','a','d','o','w','T','y','p','e', 0, ! 'S','h','o','w','B','o','t','h', 0, ! 'S','p','a','c','i','n','g', 0, ! 'S','t','y','l','e', 0, ! 'A','l','i','g','n','m','e','n','t', 0, ! 'B','o','o','l','e','a','n', 0, ! 'D','i','m','e','n','s','i','o','n', 0, ! 'B','i','t','m','a','s','k', 0, ! 'E','x','t','L','a','b','e','l','P','o','s','i','t','i','o','n', 0, ! 'I','n','s','e','n','s','i','t','i','v','e','S','t','y','l','e', 0, ! 'S','h','a','d','o','w','T','y','p','e', 0, ! 'V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, }; |
From: Grant M. <grm...@us...> - 2002-04-21 18:31:06
|
Update of /cvsroot/motiftools/xmt/tests/ExtLabel In directory usw-pr-cvs1:/tmp/cvs-serv15391/tests/ExtLabel Added Files: README test.ad Log Message: ExtLabel test (via mockup); new facilities in ExtLabel: compute insensitive pixmap if missing, and two different insensitive styles for label string. --- NEW FILE --- 'mockup test' to see different kinds of settings for XmtExtLabel. --- NEW FILE --- !*background: gray !*Foreground: navy *FontList: *-helvetica-bold-r-*-*-*-140-*,\ *-helvetica-medium-o-*-*-*-140-*=I,\ *-courier-bold-r-*-*-*-140-*=CW,\ *-helvetica-bold-r-*-*-*-240-*=BIG test.xmtChildren: XmtLayout layout; *layout.xmtChildren: XmtExtLabel left,right,top,bottom,over,under; \ XmLabel onlyLabels; \ XmtExtLabel stringOnly,pixmapOnly;\ XmLabel motifLabels; \ XmLabel xmlabelStringOnly,xmlabelPixmapOnly; *onlyLabels.labelString: - showOnly: True - *onlyLabels.background: gray *motifLabels.labelString: - Motif Labels - *motifLabels.background: gray *XmtExtLabel.labelPixmap: newwarning *XmtExtLabel.mask: newwarning *XmtExtLabel.background: light sky blue *XmLabel.labelPixmap: newwarning *XmLabel.background: light sky blue *left.labelString: Left Label, Top *left.labelPosition: LEFT *left.verticalAlignment: XmALIGNMENT_CONTENTS_TOP *right.labelString: Right Label, Bottom *right.labelPosition: RIGHT *right.verticalAlignment: XmALIGNMENT_CONTENTS_BOTTOM *top.labelString: Top Label *top.labelPosition: TOP *bottom.labelString: Bottom Label *bottom.labelPosition: BOTTOM *over.labelString: Over Label *over.labelPosition: OVERLAY *under.labelString: Under Label *under.labelPosition: UNDERLAY *stringOnly.labelString: Test\nString *stringOnly.showBoth: false *stringOnly.labelType: XmSTRING *pixmapOnly.labelString: Test\nString *pixmapOnly.showBoth: false *pixmapOnly.labelType: XmPIXMAP *xmlabelStringOnly.labelString: Test\nString *xmlabelStringOnly.labelType: XmSTRING *xmlabelPixmapOnly.labelType: XmPIXMAP _Pixmaps_*newwarning: \ 16 48 6 1\n\ m none\n\ X m lightskyblue\n\ : s foreground m black\n\ . s top_shadow m black\n\ # s bottom_shadow m black\n\ o m blue\n\ .... \n\ ..oXoX## \n\ ..oXoXoX## \n\ ..oXoXoXoX## \n\ ..XoXoXoXo## \n\ ..XoXoXoXoXo## \n\ ..oXoXoXoXoX## \n\ ..oXoXoXoXoXoX##\n\ ..XoXoXoXoXoXo##\n\ ..oXoXoXoXoXoX##\n\ ..XoXoXoXoXoXo##\n\ ..oXoXoXoXoXoX##\n\ ..XoXoXoXoXoXo##\n\ ..oXoXoXoXoXoX##\n\ ..XoXoXoXoXoXo##\n\ ..XoXoXoXoXo## \n\ ..oXoXoXoXoX## \n\ ..XoXoXoXoXo## \n\ ..XoXoXoXo## \n\ ..oXoXoXoX## \n\ ..XoXoXoXo## \n\ ..oXoXoXoX## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ .####### \n\ \n\ \n\ \n\ .... \n\ ..oXoX## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..XoXoXoXo## \n\ ..oXoXoXoX## \n\ ..XoXoXoXo## \n\ ..oXoXoXoX## \n\ ..oXoXoX## \n\ ..XoXoXo## \n\ ..XoXo## \n\ #### |
From: Grant M. <grm...@us...> - 2002-04-21 04:23:50
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv27425/Xmt Modified Files: Imakefile XmtWidgets.c Added Files: ExtLabelS.c ExtLabel.c ExtLabel.h ExtLabelP.h Log Message: New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: ExtLabelS.c,v 1.1 2002/04/21 04:23:47 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2001 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: ExtLabelS.c,v $ * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) * * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: ExtLabelutton. * * Revision 1.1 2001/07/20 23:03:48 grmcdorman * This adds the ExtLabelutton widget to Xmt. * * */ #include <X11/Intrinsic.h> #ifndef _Xconst #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) #define _Xconst const #else #define _Xconst #endif #endif /* _Xconst */ externaldef(xmtExtLabelStrings) _Xconst char XmtExtLabelStrings[] = { /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19*/ 'i','n','s','e','n','s','i','t','i','v','e','M','a','s','k', 0, 'l','a','b','e','l','P','o','s','i','t','i','o','n', 0, 'm','a','s','k', 0, 'p','i','x','m','a','p','A','l','i','g','n','m','e','n','t', 0, 'p','i','x','m','a','p','V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, 's','h','a','d','o','w','T','y','p','e', 0, 's','h','o','w','B','o','t','h', 0, 's','p','a','c','i','n','g', 0, 'v','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, 'A','l','i','g','n','m','e','n','t', 0, 'M','a','s','k', 0, 'P','o','s','i','t','i','o','n', 0, 'S','h','a','d','o','w','T','y','p','e', 0, 'S','h','o','w','B','o','t','h', 0, 'S','p','a','c','i','n','g', 0, 'A','l','i','g','n','m','e','n','t', 0, 'B','o','o','l','e','a','n', 0, 'D','i','m','e','n','s','i','o','n', 0, 'B','i','t','m','a','s','k', 0, 'E','x','t','L','a','b','e','l','P','o','s','i','t','i','o','n', 0, 'S','h','a','d','o','w','T','y','p','e', 0, 'V','e','r','t','i','c','a','l','A','l','i','g','n','m','e','n','t', 0, }; --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: ExtLabel.c,v 1.1 2002/04/21 04:23:47 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: ExtLabel.c,v $ * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) * * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: ExtLabelButton. * * * */ #include <stdio.h> #include <Xmt/ExtLabelP.h> #define offset(field) XtOffsetOf(XmtExtLabelRec, field) static XtResource resources[] = { { XmtNinsensitiveMask, XmtCMask, XmtRBitmask, sizeof(Pixmap), offset(ext_label.mask_insen), XtRImmediate, (XtPointer) XmUNSPECIFIED_PIXMAP }, { XmtNlabelPosition, XmtCPosition, XmtRExtLabelPosition, sizeof(unsigned char), offset(ext_label.label_position), XtRImmediate, (XtPointer) XmtLABEL_LEFT }, { XmtNmask, XmtCMask, XmtRBitmask, sizeof(Pixmap), offset(ext_label.mask), XtRImmediate, (XtPointer) XmUNSPECIFIED_PIXMAP }, { XmtNpixmapAlignment, XmtCAlignment, XmtRAlignment, sizeof(unsigned char), offset(ext_label.pixmap_alignment), XtRImmediate, (XtPointer) XmALIGNMENT_CENTER }, { XmtNpixmapVerticalAlignment, XmtCAlignment, XmtRVerticalAlignment, sizeof(unsigned char), offset(ext_label.pixmap_vertical_alignment), XtRImmediate, (XtPointer) XmALIGNMENT_CENTER }, { XmtNshadowType, XmtCShadowType, XmtRShadowType, sizeof(unsigned char), offset(ext_label.shadow_type), XtRImmediate, (XtPointer) XmSHADOW_OUT }, { XmtNshowBoth, XmtCShowBoth, XmtRBoolean, sizeof(Boolean), offset(ext_label.show_both), XtRImmediate, (XtPointer) True }, { XmtNspacing, XmtCSpacing, XmtRDimension, sizeof(Dimension), offset(ext_label.spacing), XtRImmediate, (XtPointer) 2 }, { XmtNverticalAlignment, XmtCAlignment, XmtRVerticalAlignment, sizeof(unsigned char), offset(ext_label.vertical_alignment), XtRImmediate, (XtPointer) XmALIGNMENT_CENTER }, }; #ifndef max # define max(a, b) ((a) < (b) ? b : a) #endif #if XmVersion < 2000 typedef XmFontList XmtFontType; #else /* Motif 2.0 or later */ typedef XmRenderTable XmtFontType; #endif /* widget procedures */ #if NeedFunctionPrototypes static void ClassInitialize(void); static void Initialize(Widget, Widget, ArgList, Cardinal *); static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); static void Redisplay(Widget, XEvent *, Region); static void Resize(Widget); static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply); static void DrawDecor(XmtExtLabelWidget lw); static void DrawLabel(XmtExtLabelWidget lw); static void DrawPixmap(XmtExtLabelWidget lw, Pixmap p, Pixmap mask, unsigned int width, unsigned int height); static void Layout(XmtExtLabelWidget lw); static void CalculateWantedSize(XmtExtLabelWidget lw); static void GetPixmapSize(Display *disp, Pixmap graphic, unsigned int *width, unsigned int *height, unsigned int *depth); static void GetStringSize(XmtFontType font, XmString string, Dimension *width, Dimension *height); #else static void ClassInitialize(); static void Initialize(); static Boolean SetValues(); static void Redisplay(); static void Resize(); static XtGeometryResult QueryGeometry(); static void DrawDecor(); static void DrawLabel(); static void DrawPixmap(); static void Layout(); static void CalculateWantedSize(); static void GetPixmapSize(); static void GetStringSize(); #endif #if XmVersion > 1001 static XmPrimitiveClassExtRec primClassExtRec = { NULL, NULLQUARK, XmPrimitiveClassExtVersion, sizeof(XmPrimitiveClassExtRec), XmInheritBaselineProc, /* widget_baseline */ XmInheritDisplayRectProc, /* widget_display_rect */ (XmWidgetMarginsProc) _XtInherit }; #endif externaldef(xmtExtLabelclassrec) XmtExtLabelClassRec xmtExtLabelClassRec = { { /* core_class fields */ /* superclass */ (WidgetClass) &xmLabelClassRec, /* class_name */ "XmtExtLabel", /* widget_size */ sizeof(XmtExtLabelRec), /* class_initialize */ ClassInitialize, /* class_part_initiali*/ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ XtExposeCompressMaximal, /* compress_enterleave*/ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, /* resize */ Resize, /* expose */ Redisplay, /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ XtInheritTranslations, /* query_geometry */ QueryGeometry, /* display accel */ XtInheritDisplayAccelerator, /* extension */ NULL, }, { /* primitive_class fields */ XmInheritBorderHighlight, /* Primitive border_highlight */ XmInheritBorderUnhighlight,/* Primitive border_unhighlight */ XmInheritTranslations, /* translations */ NULL, /* arm_and_activate */ NULL, /* get resources */ 0, /* num get_resources */ #if XmVersion <= 1001 NULL, /* extension */ #else (XtPointer)&primClassExtRec,/* extension */ #endif }, { /* XmLabel class field */ NULL, /* setOverrideCallback */ NULL, /* menuProcs */ XmInheritTranslations, /* translations */ NULL, /* extension */ }, { /* ExtLabel class field */ NULL, /* extension*/ } }; externaldef(xmtExtLabelwidgetclass) WidgetClass xmtExtLabelWidgetClass = (WidgetClass) &xmtExtLabelClassRec; /**************************************************************** * ClassInitialize ****************************************************************/ #if NeedFunctionPrototypes static void ClassInitialize(void) #else static void ClassInitialize() #endif { /* must be sorted */ static String style_names[] = { "BOTTOM", "LEFT", "OVERLAY", "RIGHT", "TOP", "UNDERLAY" }; static int style_values[] = { XmtLABEL_BOTTOM, XmtLABEL_LEFT, XmtLABEL_OVERLAY, XmtLABEL_RIGHT, XmtLABEL_TOP, XmtLABEL_UNDERLAY }; static String style_prefixes[] = {"Xmt", "LABEL_", NULL}; XmtRegisterEnumConverter(XmtRExtLabelPosition, style_names, style_values, XtNumber(style_names), style_prefixes); } /**************************************************************** * Initialize ****************************************************************/ /* ARGSUSED */ #if NeedFunctionPrototypes static void Initialize(Widget request, Widget init, ArgList arglist, Cardinal *num_args) #else static void Initialize(request, init, arglist, num_args) Widget request, init; ArgList arglist; Cardinal *num_args; #endif { /* * Rationalize resources */ /* * Calculate size */ CalculateWantedSize((XmtExtLabelWidget) init); /* * Allocate GCs */ /* * Layout. */ Layout((XmtExtLabelWidget) init); } /**************************************************************** * SetValues * ****************************************************************/ /* ARGSUSED */ #if NeedFunctionPrototypes static Boolean SetValues(Widget current, Widget request, Widget set, ArgList arglist, Cardinal *num_args) #else static Boolean SetValues(current, request, set, arglist, num_args) Widget current, request, set; ArgList arglist; Cardinal *num_args; #endif { XmtExtLabelWidget cw = (XmtExtLabelWidget) current; XmtExtLabelWidget nw = (XmtExtLabelWidget) set; Boolean redraw = False; #define CHANGED(field) (cw->field != nw->field) #define CHANGED_E(field) CHANGED(ext_label.field) /* If we are allowd to recompute size, do so. */ if (nw->label.recompute_size) { CalculateWantedSize(nw); XtResizeWidget(set, nw->ext_label.wanted_width, nw->ext_label.wanted_height, nw->core.border_width); } /* Relayout. */ Layout(nw); /* Label won't redraw if shadow thickness changes, as it does not support that. */ /* * Do not worry about margins, those are taken care of in superclass - and affect * x/y/width/height values anyway */ /* stuff that doesn't depend on show both or label_type */ redraw = CHANGED(primitive.shadow_thickness) || CHANGED_E(vertical_alignment) || CHANGED_E(shadow_type) || CHANGED_E(show_both); if (nw->ext_label.show_both && nw->label.pixmap != None) { /* * Check for pixmap and string changes, as label might ignore them * if it doesn't apply to the label_type. */ redraw |= CHANGED(label.pixmap) || CHANGED(label.pixmap_insen) || CHANGED(label._label) || CHANGED_E(spacing) || CHANGED_E(label_position) || CHANGED_E(vertical_alignment) || CHANGED_E(pixmap_alignment) || CHANGED_E(pixmap_vertical_alignment) || CHANGED_E(mask) || CHANGED_E(mask_insen) || CHANGED_E(label_x) || CHANGED_E(label_y) || CHANGED_E(label_area_width) || CHANGED_E(label_area_height) || CHANGED_E(pixmap_x) || CHANGED_E(pixmap_y) || CHANGED_E(pixmap_area_width) || CHANGED_E(pixmap_area_height) || CHANGED_E(pixmap_max_height); } else if (nw->label.label_type == XmPIXMAP) { /* don't worry about pixmap, label should take care of that */ redraw |= CHANGED_E(mask) || CHANGED_E(mask_insen) || CHANGED_E(pixmap_x) || CHANGED_E(pixmap_y) || CHANGED_E(pixmap_area_width) || CHANGED_E(pixmap_area_height); } else /* label_type == XmSTRING */ { redraw |= CHANGED_E(vertical_alignment) || CHANGED_E(label_x) || CHANGED_E(label_y) || CHANGED_E(label_area_width) || CHANGED_E(label_area_height); } #undef CHANGED #undef CHANGED_E return redraw; } #if NeedFunctionPrototypes static void Redisplay(Widget w, XEvent *event, Region region) #else static void Redisplay(w, event, region) Widget w; XEvent *event; Region region; #endif { XmtExtLabelWidget lw = (XmtExtLabelWidget) w; DrawDecor(lw); if (lw->ext_label.show_both && lw->ext_label.label_position == XmtLABEL_UNDERLAY) { DrawLabel(lw); } if (lw->ext_label.show_both || lw->label.label_type == XmPIXMAP) { if (lw->label.pixmap_insen != None && lw->label.pixmap_insen != XmUNSPECIFIED_PIXMAP && (!lw->core.sensitive || !lw->core.ancestor_sensitive)) { DrawPixmap(lw, lw->label.pixmap_insen, lw->ext_label.mask_insen, lw->ext_label.pixmap_insen_width, lw->ext_label.pixmap_insen_height); } else { DrawPixmap(lw, lw->label.pixmap, lw->ext_label.mask, lw->ext_label.pixmap_width, lw->ext_label.pixmap_height); } } if ((lw->ext_label.show_both && lw->ext_label.label_position != XmtLABEL_UNDERLAY) || (!lw->ext_label.show_both && lw->label.label_type != XmPIXMAP)) { DrawLabel(lw); } } static void Resize(Widget w) { XmtExtLabelWidget lw = (XmtExtLabelWidget) w; Layout(lw); } /* ARGSUSED */ #if NeedFunctionPrototypes static XtGeometryResult QueryGeometry(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply) #else static XtGeometryResult QueryGeometry(w, request, reply) Widget w; XtWidgetGeometry *request; XtWidgetGeometry *reply; #endif { XmtExtLabelWidget lw = (XmtExtLabelWidget) w; if (lw->label.recompute_size) { CalculateWantedSize(lw); reply->width = lw->ext_label.wanted_width; reply->height = lw->ext_label.wanted_height; } else { reply->width = lw->core.width; reply->height = lw->core.height; } reply->request_mode = CWWidth | CWHeight; if (request->request_mode & (CWWidth | CWHeight) == (CWWidth | CWHeight) && request->width == reply->width && request->height == reply->height) return XtGeometryYes; else if (reply->width == w->core.width && reply->height == w->core.height) return XtGeometryNo; else return XtGeometryAlmost; } /**************************************************************************/ /* Widget Internal Drawing Functions */ static void DrawDecor(XmtExtLabelWidget lw) { Position x, y; Dimension thickness = lw->primitive.shadow_thickness; long width, height; if (thickness > 0) { x = lw->primitive.highlight_thickness; y = lw->primitive.highlight_thickness; width = lw->core.width - lw->primitive.highlight_thickness*2; height = lw->core.height - lw->primitive.highlight_thickness*2; if (width < 1) { width = 1; } if (height < 1) { height = 1; } #if XmVersion >= 2000 XmeDrawShadows(XtDisplay((Widget) lw), lw->core.window, lw->primitive.top_shadow_GC, lw->primitive.bottom_shadow_GC, x, y, width, height, lw->primitive.shadow_thickness, lw->ext_label.shadow_type); #else _XmDrawShadows(XtDisplay((Widget) lw), lw->core.window, lw->primitive.top_shadow_GC, lw->primitive.bottom_shadow_GC, x, y, width, height, lw->primitive.shadow_thickness, lw->ext_label.shadow_type); #endif } } static void DrawLabel(XmtExtLabelWidget lw) { GC draw_gc; if (!lw->ext_label.show_both && lw->label.label_type != XmSTRING) { return; } if (lw->core.sensitive && lw->core.ancestor_sensitive) { draw_gc = lw->label.normal_GC; } else { draw_gc = lw->label.insensitive_GC; } /* Note: In Motif 2 and later, XmStringDraw takes an 'XmRenderTable'. * XmLabel has, according to the documentation, both an XmFontList and * an XmRenderTable resource. However, in practice: * - XmRenderTable and XmFontList are the same type (__XmRenderTableRec **) * - Label Widget has only one attribute, font, of type XmFontList (and * no XmRenderTable attribute) * - XmStringDraw is declared with an XmFontList argument instead of * a render table. */ XmStringDraw(lw->core.screen->display, lw->core.window, #if XmVersion < 2000 lw->label.font, #else /* Motif 2.0 or later */ lw->label.font, #endif lw->label._label, draw_gc, lw->ext_label.label_x, lw->ext_label.label_y, lw->ext_label.label_area_width, lw->label.alignment, lw->label.string_direction, NULL); } static void DrawPixmap(XmtExtLabelWidget lw, Pixmap p, Pixmap mask, unsigned int width, unsigned int height) { Position x, y; Position src_x = 0, src_y = 0; unsigned char alignment, vertical_alignment; if (p == None || p == XmUNSPECIFIED_PIXMAP) { return; } x = lw->ext_label.pixmap_x; y = lw->ext_label.pixmap_y; alignment = (lw->ext_label.show_both) ? lw->ext_label.pixmap_alignment : lw->label.alignment; vertical_alignment = (lw->ext_label.show_both) ? lw->ext_label.pixmap_vertical_alignment : lw->ext_label.vertical_alignment; /* * Align as requested. * This may move outside the box for oversize pixmaps. We'll fix that up later. */ if (alignment == XmALIGNMENT_CENTER) { x += (lw->ext_label.pixmap_area_width - width) / 2; } else if (alignment == XmALIGNMENT_END) { x += (lw->ext_label.pixmap_area_width - width); } if (vertical_alignment == XmALIGNMENT_CENTER) { y += (lw->ext_label.pixmap_area_height - height) / 2; } else if (vertical_alignment == XmALIGNMENT_CONTENTS_BOTTOM) { y += (lw->ext_label.pixmap_area_height - height); } /* Adjust overflow. */ if (x < lw->ext_label.pixmap_x) { src_x = lw->ext_label.pixmap_x - x; x = lw->ext_label.pixmap_x; } if (y < lw->ext_label.pixmap_y) { src_y = lw->ext_label.pixmap_y - y; y = lw->ext_label.pixmap_y; } if (width > lw->ext_label.pixmap_area_width) { width = lw->ext_label.pixmap_area_width; } if (height > lw->ext_label.pixmap_area_height) { height = lw->ext_label.pixmap_area_height; } /* * Set up GC */ if (mask != None && mask != XmUNSPECIFIED_PIXMAP) { XSetClipMask(XtDisplay((Widget) lw), lw->label.normal_GC, mask); XSetClipOrigin(XtDisplay((Widget) lw), lw->label.normal_GC, x, y); } XCopyArea(XtDisplay((Widget) lw), p, lw->core.window, lw->label.normal_GC, src_x, src_y, width, height, x, y); XSetClipMask(XtDisplay((Widget) lw), lw->label.normal_GC, None); } /**************************************************************************/ /* Widget Internal Utility Functions */ static void Layout(XmtExtLabelWidget lw) { Dimension internal_width; Dimension internal_height; Dimension label_width, label_height; Dimension pixmap_width, pixmap_height; Position pixmap_x, pixmap_y; Position label_x, label_y; Dimension applied_spacing = lw->ext_label.spacing; lw->ext_label.pixmap_x = lw->ext_label.left_margin; lw->ext_label.pixmap_y = lw->ext_label.top_margin; lw->ext_label.label_x = lw->ext_label.left_margin; lw->ext_label.label_y = lw->ext_label.top_margin; if (lw->core.width > lw->ext_label.left_margin + lw->ext_label.right_margin) { internal_width = lw->core.width - lw->ext_label.left_margin - lw->ext_label.right_margin; } else { internal_width = 1; } if (lw->core.height > lw->ext_label.top_margin + lw->ext_label.bottom_margin) { internal_height = lw->core.height - lw->ext_label.top_margin - lw->ext_label.bottom_margin; } else { internal_height = 1; } label_width = pixmap_width = internal_width; label_height = pixmap_height = internal_height; label_x = pixmap_x = lw->ext_label.left_margin; label_y = pixmap_y = lw->ext_label.top_margin; /* * Non-overlaid positions allocate excess space to the label. */ if (lw->ext_label.show_both) { if (lw->ext_label.label_position == XmtLABEL_LEFT || lw->ext_label.label_position == XmtLABEL_RIGHT) { /* Size the horizontal elements. */ if (internal_width > lw->ext_label.pixmap_max_width + applied_spacing + lw->ext_label.label_width) { label_width = internal_width - lw->ext_label.pixmap_max_width - applied_spacing; pixmap_width = lw->ext_label.pixmap_max_width; } else { /* * No room. Allocate as much as possible for the pixmap, * with the remainder to the label */ if (internal_width > lw->ext_label.pixmap_max_width) { pixmap_width = lw->ext_label.pixmap_max_width; label_width = internal_width - pixmap_width; } else { pixmap_width = internal_width - 1; label_width = 1; } /* Try to preserve the spacing. */ if (label_width > lw->ext_label.label_width + applied_spacing) { label_width -= applied_spacing; } applied_spacing = internal_width - label_width - pixmap_width; } /* Position the horizontal elements. */ if (lw->ext_label.label_position == XmtLABEL_LEFT) { pixmap_x = label_width + applied_spacing; } else { label_x = pixmap_width + applied_spacing; } } else if (lw->ext_label.label_position == XmtLABEL_TOP || lw->ext_label.label_position == XmtLABEL_BOTTOM) { /* Size the vertical elements. */ if (internal_height > lw->ext_label.pixmap_max_height + applied_spacing + lw->ext_label.label_height) { label_height = internal_height - lw->ext_label.pixmap_max_height - applied_spacing; pixmap_height = lw->ext_label.pixmap_max_height; pixmap_y = label_height + applied_spacing; } else { /* * No room. Allocate as much as possible for the pixmap, * with the remainder to the label */ if (internal_height > lw->ext_label.pixmap_max_height) { pixmap_height = lw->ext_label.pixmap_max_height; label_height = internal_height - pixmap_height; } else { pixmap_height = internal_height - 1; label_height = 1; } /* Try to preserve the spacing. */ if (label_height > lw->ext_label.label_height + applied_spacing) { label_height -= applied_spacing; } } /* Position the vertical elements. */ if (lw->ext_label.label_position == XmtLABEL_TOP) { pixmap_y = label_height + applied_spacing; } else { label_y = pixmap_height + applied_spacing; } } } /* * Now, adjust the label vertically according to the requested * alignment. * * Horizontal alignment isn't necessary for the label - the * Motif library routine will handle that. * * Pixmap alignment is done at redraw time, as there are several possible * pixmaps that may be involved (sensitive/insensitive; more for derived * classes). */ if (label_height > lw->ext_label.label_height) { if (lw->ext_label.vertical_alignment == XmALIGNMENT_CENTER) { label_y += (label_height - lw->ext_label.label_height) / 2; } else if (lw->ext_label.vertical_alignment == XmALIGNMENT_CONTENTS_BOTTOM) { label_y += (label_height - lw->ext_label.label_height); } } /* Save values */ lw->ext_label.label_area_width = label_width; lw->ext_label.label_area_height = label_height; lw->ext_label.label_x = label_x; lw->ext_label.label_y = label_y; lw->ext_label.pixmap_area_width = pixmap_width; lw->ext_label.pixmap_area_height = pixmap_height; lw->ext_label.pixmap_x = pixmap_x; lw->ext_label.pixmap_y = pixmap_y; } static void CalculateWantedSize(XmtExtLabelWidget lw) { unsigned int pixmap_depth; unsigned int pixmap_insen_depth; Dimension left_margin, right_margin, top_margin, bottom_margin; /* * Note that masks are ignored in calculating size. */ GetPixmapSize(XtDisplay((Widget) lw), lw->label.pixmap, &lw->ext_label.pixmap_width, &lw->ext_label.pixmap_height, &pixmap_depth); GetPixmapSize(XtDisplay((Widget) lw), lw->label.pixmap_insen, &lw->ext_label.pixmap_insen_width, &lw->ext_label.pixmap_insen_height, &pixmap_insen_depth); GetStringSize(lw->label.font, lw->label._label, &lw->ext_label.label_width, &lw->ext_label.label_height); lw->ext_label.pixmap_max_width = max(lw->ext_label.pixmap_width, lw->ext_label.pixmap_insen_width); lw->ext_label.pixmap_max_height = max(lw->ext_label.pixmap_height, lw->ext_label.pixmap_insen_height); /* * Calculate borders. */ lw->ext_label.left_margin = lw->label.margin_width + lw->label.margin_left + lw->primitive.highlight_thickness + lw->primitive.shadow_thickness; lw->ext_label.right_margin = lw->label.margin_width + lw->label.margin_right + lw->primitive.highlight_thickness + lw->primitive.shadow_thickness; lw->ext_label.top_margin = lw->label.margin_height + lw->label.margin_top + lw->primitive.highlight_thickness + lw->primitive.shadow_thickness; lw->ext_label.bottom_margin = lw->label.margin_height + lw->label.margin_bottom + lw->primitive.highlight_thickness + lw->primitive.shadow_thickness; /* * Calculate requested size. */ if (lw->ext_label.show_both) { if (lw->ext_label.label_position == XmtLABEL_LEFT || lw->ext_label.label_position == XmtLABEL_RIGHT) { lw->ext_label.wanted_width = lw->ext_label.pixmap_max_width + lw->ext_label.label_width + lw->ext_label.spacing; lw->ext_label.wanted_height = max(lw->ext_label.pixmap_max_height, lw->ext_label.label_height); } else if (lw->ext_label.label_position == XmtLABEL_TOP || lw->ext_label.label_position == XmtLABEL_BOTTOM) { lw->ext_label.wanted_height = lw->ext_label.pixmap_max_height + lw->ext_label.label_height + lw->ext_label.spacing; lw->ext_label.wanted_width = max(lw->ext_label.pixmap_max_width, lw->ext_label.label_width); } else { // UNDERLAY or OVERLAY (or unknown .. treat as OVERLAY) lw->ext_label.wanted_width = max(lw->ext_label.pixmap_max_width, lw->ext_label.label_width); lw->ext_label.wanted_height = max(lw->ext_label.pixmap_max_height, lw->ext_label.label_height); } } else { /* !show_both: Behave like a normal XmLabel ... mostly. */ if (lw->label.label_type == XmPIXMAP) { lw->ext_label.wanted_width = lw->ext_label.pixmap_max_width; lw->ext_label.wanted_height = lw->ext_label.pixmap_max_height; } else { /* XmSTRING */ lw->ext_label.wanted_width = lw->ext_label.label_width; lw->ext_label.wanted_height = lw->ext_label.label_height; } } lw->ext_label.wanted_width += lw->ext_label.left_margin + lw->ext_label.right_margin; lw->ext_label.wanted_height += lw->ext_label.top_margin + lw->ext_label.bottom_margin; } #if NeedFunctionPrototypes static void GetPixmapSize(Display *disp, Pixmap graphic, unsigned int *width, unsigned int *height, unsigned int *depth) #else static void GetPixmapSize(disp, graphic, width, height, depth) Display disp; Pixmap graphic; unsigned int *width; unsigned int *height; unsigned int *depth; #endif { unsigned int border; int x, y; Window dummywin; *width = *height = 0; *depth = 0; if (graphic != None && graphic != XmUNSPECIFIED_PIXMAP) { /* Being a pixmap, 'x' and 'y' are going to be zero. */ (void)XGetGeometry(disp, graphic, &dummywin, &x, &y, width, height, &border, depth); } } #if NeedFunctionPrototypes static void GetStringSize(XmtFontType font, XmString string, Dimension *width, Dimension *height) #else static void GetStringSize(font, string, width, height) XmtFontType font; XmString string; Dimension *width; Dimension *height; #endif { if (string != NULL) { XmStringExtent(font, string, width, height); } else { *width = *height = 0; } } /**************************************************************************/ /* Application Utility Functions */ #if NeedFunctionPrototypes Widget XmtCreateExtLabel(Widget parent, String name, ArgList args, Cardinal num_args) #else Widget XmtCreateExtLabel(parent, name, args, num_args) Widget parent; String name; ArgList args; Cardinal num_args; #endif { return XtCreateWidget(name, xmtExtLabelWidgetClass, parent, args, num_args); } --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: ExtLabel.h,v 1.1 2002/04/21 04:23:47 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: ExtLabel.h,v $ * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) * * */ #ifndef _XmtExtLabel_h #define _XmtExtLabel_h #include <Xm/Xm.h> /* * ExtLabel provides an extended label that can display the pixmap and * string simultaneously, and also provides masks for the pixmap(s). * * Resources * * Name Class Type Default Access * insensitiveMask Mask Bitmask XmUNSPECIFIED_PIXMAP CSG * labelPosition Position ExtLabelPosition XmLABEL_LEFT CSG * mask Mask Bitmask XmUNSPECIFIED_PIXMAP CSG * pixmapAlignment Alignment Alignment XmALIGNMENT_CENTER CSG * pixmapVerticalAlignment Alignment VerticalAlignment XmALIGNMENT_CENTER CSG * shadowType ShadowType ShadowType XmSHADOW_OUT CSG * showBoth ShowBoth Boolean True CSG * spacing Spacing Dimension 2 CSG * verticalAlignment Alignment VerticalAlignment XmALIGNMENT_CENTER CSG * */ externalref WidgetClass xmtExtLabelWidgetClass; typedef struct _XmtExtLabelClassRec *XmtExtLabelWidgetClass; typedef struct _XmtExtLabelRec *XmtExtLabelWidget; typedef enum { XmtLABEL_LEFT, XmtLABEL_RIGHT, XmtLABEL_TOP, XmtLABEL_BOTTOM, XmtLABEL_OVERLAY, XmtLABEL_UNDERLAY } XmtExtLabelPosition; externalref _Xconst char XmtExtLabelStrings[]; #ifndef XmtNinsensitiveMask #define XmtNinsensitiveMask ((char*)&XmtExtLabelStrings[0] #endif #ifndef XmtNlabelPosition #define XmtNlabelPosition ((char*)&XmtExtLabelStrings[15] #endif #ifndef XmtNmask #define XmtNmask ((char*)&XmtExtLabelStrings[28] #endif #ifndef XmtNpixmapAlignment #define XmtNpixmapAlignment ((char*)&XmtExtLabelStrings[32] #endif #ifndef XmtNpixmapVerticalAlignment #define XmtNpixmapVerticalAlignment ((char*)&XmtExtLabelStrings[47] #endif #ifndef XmtNshadowType #define XmtNshadowType ((char*)&XmtExtLabelStrings[70] #endif #ifndef XmtNshowBoth #define XmtNshowBoth ((char*)&XmtExtLabelStrings[80] #endif #ifndef XmtNspacing #define XmtNspacing ((char*)&XmtExtLabelStrings[88] #endif #ifndef XmtNverticalAlignment #define XmtNverticalAlignment ((char*)&XmtExtLabelStrings[95] #endif #ifndef XmtCAlignment #define XmtCAlignment ((char*)&XmtExtLabelStrings[112] #endif #ifndef XmtCMask #define XmtCMask ((char*)&XmtExtLabelStrings[121] #endif #ifndef XmtCPosition #define XmtCPosition ((char*)&XmtExtLabelStrings[125] #endif #ifndef XmtCShadowType #define XmtCShadowType ((char*)&XmtExtLabelStrings[133] #endif #ifndef XmtCShowBoth #define XmtCShowBoth ((char*)&XmtExtLabelStrings[143] #endif #ifndef XmtCSpacing #define XmtCSpacing ((char*)&XmtExtLabelStrings[151] #endif #ifndef XmtRAlignment #define XmtRAlignment ((char*)&XmtExtLabelStrings[158] #endif #ifndef XmtRBoolean #define XmtRBoolean ((char*)&XmtExtLabelStrings[167] #endif #ifndef XmtRDimension #define XmtRDimension ((char*)&XmtExtLabelStrings[174] #endif #ifndef XmtRBitmask #define XmtRBitmask ((char*)&XmtExtLabelStrings[183] #endif #ifndef XmtRExtLabelPosition #define XmtRExtLabelPosition ((char*)&XmtExtLabelStrings[190] #endif #ifndef XmtRShadowType #define XmtRShadowType ((char*)&XmtExtLabelStrings[206] #endif #ifndef XmtRVerticalAlignment #define XmtRVerticalAlignment ((char*)&XmtExtLabelStrings[216] #endif _XFUNCPROTOBEGIN #if NeedFunctionPrototypes extern Widget XmtCreateExtLabel(Widget, String, ArgList, Cardinal); #else extern Widget XmtCreateExtLabel(); #endif _XFUNCPROTOEND #endif /* _XmtExtLabel_h */ --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: ExtLabelP.h,v 1.1 2002/04/21 04:23:47 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: ExtLabelP.h,v $ * Revision 1.1 2002/04/21 04:23:47 grmcdorman * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) * * */ #ifndef _XmtExtLabelP_h #define _XmtExtLabelP_h #include <Xmt/XmtP.h> #include <Xm/LabelP.h> #include <Xmt/ExtLabel.h> typedef struct { XtPointer extension; } XmtExtLabelClassPart; typedef struct _XmtExtLabelClassRec { CoreClassPart core_class; XmPrimitiveClassPart primitive_class; XmLabelClassPart label_class; XmtExtLabelClassPart ext_label_class; } XmtExtLabelClassRec; externalref XmtExtLabelClassRec xmtExtLabelClassRec; typedef struct _XmtExtLabelPart { /* resources */ Dimension spacing; /* Spacing 'twixt label and pixmap */ unsigned char label_position; /* XmLABEL_LEFT, etc. */ unsigned char vertical_alignment; /* Label vertical alignment */ unsigned char pixmap_alignment; /* Horizontal alignment: XmALIGNMENT_.. */ unsigned char pixmap_vertical_alignment; unsigned char shadow_type; /* XmSHADOW_... */ Boolean show_both; /* Show both pixmap and label */ Pixmap mask_insen; Pixmap mask; /* private data */ Dimension bottom_margin; Dimension left_margin; Dimension right_margin; Dimension top_margin; Dimension label_area_height; Dimension label_area_width; Dimension label_height; /* XmStringGetExtents */ Dimension label_width; Dimension pixmap_area_height; Dimension pixmap_area_width; Dimension pixmap_max_height; Dimension pixmap_max_width; Dimension wanted_height; Dimension wanted_width; Position pixmap_x; Position pixmap_y; Position label_x; Position label_y; unsigned int pixmap_height; unsigned int pixmap_width; unsigned int pixmap_insen_height; unsigned int pixmap_insen_width; } XmtExtLabelPart; typedef struct _XmtExtLabelRec { CorePart core; XmPrimitivePart primitive; XmLabelPart label; XmtExtLabelPart ext_label; } XmtExtLabelRec; #endif Index: Imakefile =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Imakefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Imakefile 20 Apr 2002 04:10:44 -0000 1.6 --- Imakefile 21 Apr 2002 04:23:47 -0000 1.7 *************** *** 38,41 **** --- 38,43 ---- Create.c \ Cursor.c \ + ExtLabel.c \ + ExtLabelS.c \ DECHack.c \ Dialog.c \ *************** *** 147,150 **** --- 149,153 ---- Create.o \ Cursor.o \ + ExtLabel.o \ DECHack.o \ Dialog.o \ *************** *** 225,228 **** --- 228,232 ---- ChooserS.o\ CliS.o\ + ExtLabelS.o\ HelpBoxS.o\ HelpBrowserS.o\ *************** *** 240,243 **** --- 244,248 ---- ChooserS.o\ CliS.o\ + ExtLabelS.o\ HelpBoxS.o\ HelpBrowserS.o\ *************** *** 269,272 **** --- 274,279 ---- Dialogs.h \ DialogsP.h \ + ExtLabel.h \ + ExtLabelP.h \ Hash.h \ Help.h \ Index: XmtWidgets.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/XmtWidgets.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** XmtWidgets.c 20 Apr 2002 04:10:44 -0000 1.4 --- XmtWidgets.c 21 Apr 2002 04:23:47 -0000 1.5 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.5 2002/04/21 04:23:47 grmcdorman + * New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) + * * Revision 1.4 2002/04/20 04:10:44 grmcdorman * New widget: TransparentButton. *************** *** 46,49 **** --- 49,53 ---- #include <Xmt/Chooser.h> #include <Xmt/Cli.h> + #include <Xmt/ExtLabel.h> #include <Xmt/HelpBox.h> #include <Xmt/HelpBrowser.h> *************** *** 62,65 **** --- 66,70 ---- static XmtWidgetType xmt_widgets[] = { {"XmtCli", NULL, XmtCreateCli}, + {"XmtExtLabel", NULL, XmtCreateExtLabel}, {"XmtScrolledCli", NULL, XmtCreateScrolledCli}, {"XmtHelpBox", NULL, XmtCreateHelpBox}, |
From: Grant M. <grm...@us...> - 2002-04-21 04:23:50
|
Update of /cvsroot/motiftools/xmt/man/man3 In directory usw-pr-cvs1:/tmp/cvs-serv27425/man/man3 Modified Files: XmtCreateChooser.man Added Files: XmtExtLabel.man Log Message: New widget: ExtLabel (can show pixmap & label at same time, can use mask for pixmap) --- NEW FILE --- .\" .\" Motif Tools Library, Version 3.1 .\" $Id: XmtExtLabel.man,v 1.1 2002/04/21 04:23:47 grmcdorman Exp $ .\" .\" Written by Grant McDorman .\" Copyright (c) 2002 by Grant McDorman. .\" All Rights Reserved. See the file COPYRIGHT for details. .\" This is open source software. See the file LICENSE for details. .\" There is no warranty for this software. See NO_WARRANTY for details. .\" .\" This page documents: XmtExtLabel .\" .TH XmtExtLabel 3 "Motif Tools" Xmt .SH NAME \fIXmtExtLabel\fR \- an extended Label widget .SH \fBSYNOPSIS\fR .IP "\fBInclude\fR \fBFile:\fR" \fI#include\fR \fI<Xmt/ExtLabel.h>\fR .IP \fBConstructor:\fR \fIXmtCreateExtLabel()\fR .IP "\fBClass\fR \fBName:\fR" XmtExtLabel .IP "\fBClass\fR \fBPointer:\fR" xmtExtLabelWidgetClass .IP "\fBClass\fR \fBHierarchy:\fR" Core \(-> XmPrimitive \(-> XmLabel \(-> XmtExtLabel .SH \fBDESCRIPTION\fR The XmtExtLabel widget is an extend Motif label widget. In addition to being able to function as a normal Motif label, it also can: .IP \(bu display the label string and pixmap together, with various options for positioning the string; .IP \(bu use a mask for displaying the pixmap (allowing the label's background to show through); .IP \(bu and align the label string vertically as well as horizontally. .LP If the pixmap is not specified, it is treated as blank. .LP If the insensitive pixmap is not specified, the label pixmap is used instead. .LP \fBRESOURCES\fR ExtLabel inherits the resources of the XmLabel class, and defines the following new resources: .ps -2 .TS allbox tab(|); l l l l l. \fBName\fR|\fBType\fR|\fBClass\fR|\fBAccess\fR|\fBDefault\fR XmtNinsensitiveMask|XmtRBitmask|XmtCMask|CSG|XmUNSPECIFIED_PIXMAP XmtNlabelPosition|XmtRExtLabelPosition|XmtCPosition|CSG|XmLABEL_LEFT XmtNmask|XmtRBitmask|XmtCMask|CSG|XmUNSPECIFIED_PIXMAP XmtNpixmapAlignment|XmtRAlignment|XmtCAlignment|CSG|XmALIGNMENT_CENTER XmtNpixmapVerticalAlignment|XmtRVerticalAlignment|XmtCAlignment|CSG|XmALIGNMENT_CENTER XmtNshadowType|XmtRShadowType|XmtCShadowType|CSG|XmSHADOW_OUT XmtNshowBoth|XmtRBoolean|XmtCShowBoth|CSG|True XmtNspacing|XmtRDimension|XmtCSpacing|CSG|2 XmtNverticalAlignment|XmtRVerticalAlignment|XmtCAlignment|CSG|XmALIGNMENT_CENTER .TE .ps +2 .IP \fIXmtNinsensitiveMask\fR The clip mask used to display the pixmap when the label is insensitive, if the XmLabel \fIXmNinsensitivePixmap\fP has been set. .IP \fIXmtNlabelPosition\fR The position of the label string. Ignored if \fIshowBoth\fP is False. Possible values are: .TS tab(|); li l. XmtLABEL_LEFT|T{ The label is on the left. T} XmtLABEL_RIGHT|T{ The label is on the right. T} XmtLABEL_TOP|T{ The label is at the top. T} XmtLABEL_BOTTOM|T{ The label is at the bottom. T} .TE .IP \fIXmtNmask\fR The clip mask used to display the normal pixmap. .IP \fIXmtNpixmapAligment\fR Horizontal alignment of the label pixmap. Ignored when \fIshowBoth\fP is False, in which case XmLabel's \fIXmNalignment\fP resource is used for the pixmap when displayed. .IP \fIXmtNpixmapVerticalAlignment\fR Vertical alignment of the label pixmap. Can be \fIXmALIGNMENT_CONTENTS_TOP\fP, \fIXmALIGNMENT_CENTER\fP, or \fIXmALIGNMENT_CONTENTS_BOTTOM\fP. Ignored when \fIshowBoth\fP is False, in which case the \fIXmNverticalAlignment\fP resource is used for the pixmap when displayed. .IP \fIXmtNshadowType\fR The shadow style to draw around the label. .IP \fIXmtNshowBoth\fR If True, display both the pixmap and the label. In this mode, the XmLabel \fIXmNlabelType\fP resource is ignored, and the \fIXmtNlabelPosition\fP, \fIXmtNpixmapAlignment\fP and \fIXmtNpixmapVerticalAlignment\fP resources are used. If False, display only the label string or pixmap, according to the \fIXmNlabelType\fP resource, and apply \fIXmNalignment\fP and \fIXmtNverticalAlignment\fP to both pixmap and string displays. .IP \fIXmtNspacing\fR The spacing, in pixels, between the label string and the pixmap. .IP \fIXmtNverticalAlignment\fR The vertical alignment of the label string, or, if \fIXmtNshowBoth\fP is False, both the label string and Pixmap. Can be \fIXmALIGNMENT_CONTENTS_TOP\fP, \fIXmALIGNMENT_CENTER\fP, or \fIXmALIGNMENT_CONTENTS_BOTTOM\fP. .PP \fBCALLBACKS\fR .PP The ExtLabel widget has no callbacks. \fBTRANSLATIONS\fR .PP The ExtLabel widget inherits an unmodified set of the XmLabel widget translations. .SH \fBSEE\fR \fBALSO\fR .na .nh \fIXmtExtLabelCreate()\fP. Index: XmtCreateChooser.man =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/XmtCreateChooser.man,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** XmtCreateChooser.man 20 Apr 2002 04:11:37 -0000 1.2 --- XmtCreateChooser.man 21 Apr 2002 04:23:47 -0000 1.3 *************** *** 44,47 **** --- 44,53 ---- .ti -15m + \fB#include\fR \fB<Xmt/ExtLabel.h>\fR + .br + .ti -15m + \fBWidget\fR \fBXmtCreateExtLabel(parent,\fR \fIname,\fR \fIargs,\fR \fInum_args)\fR + + .ti -15m \fB#include\fR \fB<Xmt/InputField.h>\fR .br *************** *** 217,220 **** --- 223,229 ---- XmtCreateHelpDialog()|T{ An XmtHelpBox widget in an XmDialogShell. + T} + XmtCreateExtLabel()|T{ + An XmtExtLabel widget. T} XmtCreateInputField()|T{ |
From: Grant M. <grm...@us...> - 2002-04-21 04:19:05
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv26813/Xmt Modified Files: PixmapCvt.c Log Message: Recognize and convert XmUNSPECIFIED_PIXMAP, None, and ParentRelative to the corresponding constants. Index: PixmapCvt.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/PixmapCvt.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** PixmapCvt.c 19 Sep 2001 02:57:18 -0000 1.2 --- PixmapCvt.c 21 Apr 2002 04:19:02 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.3 2002/04/21 04:19:02 grmcdorman + * Recognize and convert XmUNSPECIFIED_PIXMAP, None, and ParentRelative to the corresponding constants. + * * Revision 1.2 2001/09/19 02:57:18 grmcdorman * This change makes the following modifications: *************** *** 58,61 **** --- 61,76 ---- Widget w = *(Widget *)args[0].addr; Pixmap pixmap; + + /* + * Special: Strings 'None', 'XmUNSPECIFIED_PIXMAP' and 'ParentRelative' + * convert to equivalent constants. (Case sensitive!) + */ + if (strcmp(str, "None") == 0) { + done(Pixmap, None); + } else if (strcmp(str, "XmUNSPECIFIED_PIXMAP") == 0) { + done(Pixmap, XmUNSPECIFIED_PIXMAP); + } else if (strcmp(str, "ParentRelative") == 0) { + done(Pixmap, ParentRelative); + } pixmap = XmtGetPixmap(w, NULL, str); |
From: Grant M. <grm...@us...> - 2002-04-21 03:11:51
|
Update of /cvsroot/motiftools/xmt/tests/ExtLabel In directory usw-pr-cvs1:/tmp/cvs-serv16685/ExtLabel Log Message: Directory /cvsroot/motiftools/xmt/tests/ExtLabel added to the repository |
From: Grant M. <grm...@us...> - 2002-04-21 01:01:15
|
Update of /cvsroot/motiftools/xmt In directory usw-pr-cvs1:/tmp/cvs-serv31295 Modified Files: CHANGE-LOG Log Message: Index: CHANGE-LOG =================================================================== RCS file: /cvsroot/motiftools/xmt/CHANGE-LOG,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** CHANGE-LOG 26 Sep 2001 02:56:55 -0000 1.6 --- CHANGE-LOG 21 Apr 2002 01:01:11 -0000 1.7 *************** *** 1,3 **** --- 1,11 ---- =========================================================================== + 20-Apr-2002 Grant McDorman <gra...@sy...> + * New widget: Transparent Button + * Typo in Progress man page fixed + + 21-Mar-2002 Grant McDorman <gra...@sy...> + * Outstanding bug with enum conversion on 64-bit platforms fixed + (problem 497185) + 25-sep-2001 Jeffrey Franks <jf...@qu...> |
From: Grant M. <grm...@us...> - 2002-04-20 04:11:39
|
Update of /cvsroot/motiftools/xmt/man/man3 In directory usw-pr-cvs1:/tmp/cvs-serv24445/man/man3 Modified Files: XmtCreateChooser.man Added Files: XmtTransparentButton.man Log Message: Manual pages for new widget: TransparentButton. --- NEW FILE --- .\" .\" Motif Tools Library, Version 3.1 .\" $Id: XmtTransparentButton.man,v 1.1 2002/04/20 04:11:37 grmcdorman Exp $ .\" .\" Written by Grant McDorman. .\" Copyright (c) 2002 by Grant McDorman. .\" All Rights Reserved. See the file COPYRIGHT for details. .\" This is open source software. See the file LICENSE for details. .\" There is no warranty for this software. See NO_WARRANTY for details. .\" .\" This page documents: XmtTransparentButton .\" .TH XmtTransparentButton 3 "Motif Tools" Xmt .SH NAME \fIXmtTransparentButton\fR \- an invisible button .SH \fBSYNOPSIS\fR .IP "\fBInclude\fR \fBFile:\fR" \fI#include\fR \fI<Xmt/TransparentB.h>\fR .IP \fBConstructor:\fR \fIXmtCreateTransparentButton()\fR .IP "\fBClass\fR \fBName:\fR" XmtTransparentButton .IP "\fBClass\fR \fBPointer:\fR" XmtTransparentButtonWidgetClass .IP "\fBClass\fR \fBHierarchy:\fR" Core \(-> XmPrimitive \(-> \(-> XmLabel \(-> XmPushButton \(-> XmtTransparentButton .SH \fBDESCRIPTION\fR The XmtTransparentButton widget is an invisible pushbutton. It can be used to make a group of widgets into a pushbutton, or to render an area of the application unresponsive to input. In the latter case, the XmtNcursor resource should be set appropriately. \fBRESOURCES\fR TransparentButton inherits the resources of the XmPushButton class, overriding the default of \fIXmNtraversalOn\fR to \fIFalse\fR, and defines the following new resources: .ps -2 .TS allbox tab(|); l l l l l. \fBName\fR|\fBType\fR|\fBClass\fR|\fBAccess\fR|\fBDefault\fR XmtNcursor|XmtRCursor|XmtCCursor|CSG|None XmtNhighlightCallback|XmtRCallback|XmtCCallback|CSG|NULL XmtNunhighlightCallback|XmtRCallback|XmtCCallback|CSG|NULL .TE .ps +2 .IP \fIXmtNcursor\fR The cursor used when the pointer is inside the transparent button. If \fBNone\fP, then the parent window's cursor is used. .IP \fIXmtNhighlightCallback\fP The procedures registered on this list are called when the transparent button is to be highlighted. It should be used to draw a highlight around the portion of the application that is functioning as the button, if applicable. The \fIcall_data\fP is NULL. .IP \fIXmtNunhighlightCallback\fP The procedures registered on this list are called when the transparent button is to be unhighlighted. It should be used to remove a highlight around the portion of the application that is functioning as the button, if applicable. The \fIcall_data\fP is NULL. .PP \fBTRANSLATIONS\fR .PP The TransparentButton widget inherits an unmodified set of the XmPushButton widget translations. .SH \fBSEE\fR \fBALSO\fR .na .nh \fIXmtCreateTransparentButton\fP Index: XmtCreateChooser.man =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/XmtCreateChooser.man,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** XmtCreateChooser.man 14 Jul 2001 19:40:43 -0000 1.1 --- XmtCreateChooser.man 20 Apr 2002 04:11:37 -0000 1.2 *************** *** 9,13 **** .\" There is no warranty for this software. See NO_WARRANTY for details. .\" ! .\" This page documents: XmtCreateChooser XmtCreateCli XmtCreateHelpBox XmtCreateHelpDialog XmtCreateInputField XmtCreateLayout XmtCreateLayoutBox XmtCreateLayoutCol XmtCreateLayoutDialog XmtCreateLayoutPixmap XmtCreateLayoutRow XmtCreateLayoutSeparator XmtCreateLayoutSpace XmtCreateLayoutString XmtCreateMenuPane XmtCreateMenubar XmtCreateMsgLine XmtCreateOptionMenu XmtCreatePopupMenu XmtCreateProgress XmtCreateScrolledCli XmtCreateWorkingBox XmtCreateWorkingDialog .\" .TH XmtCreateChooser 3 "Motif Tools" Xmt --- 9,13 ---- .\" There is no warranty for this software. See NO_WARRANTY for details. .\" ! .\" This page documents: XmtCreateChooser XmtCreateCli XmtCreateHelpBox XmtCreateHelpDialog XmtCreateInputField XmtCreateLayout XmtCreateLayoutBox XmtCreateLayoutCol XmtCreateLayoutDialog XmtCreateLayoutPixmap XmtCreateLayoutRow XmtCreateLayoutSeparator XmtCreateLayoutSpace XmtCreateLayoutString XmtCreateMenuPane XmtCreateMenubar XmtCreateMsgLine XmtCreateOptionMenu XmtCreatePopupMenu XmtCreateProgress XmtCreateScrolledCli XmtCreateTransparentButton XmtCreateWorkingBox XmtCreateWorkingDialog .\" .TH XmtCreateChooser 3 "Motif Tools" Xmt *************** *** 146,149 **** --- 146,155 ---- .ti -15m + \fB#include\fR \fB<Xmt/TransparentB.h>\fR + .br + .ti -15m + \fBWidget\fR \fBXmtCreateTransparentButton(parent,\fR \fIname,\fR \fIargs,\fR \fInum_args)\fR + + .ti -15m \fB#include\fR \fB<Xmt/WorkingBox.h>\fR .br *************** *** 265,268 **** --- 271,277 ---- XmtCreateScrolledCli()|T{ An XmtCli widget in an XmScrolledWindow. + T} + XmtCreateTransparentButton()|T{ + An XmtTransparentButton. T} XmtCreateWorkingBox()|T{ |
From: Grant M. <grm...@us...> - 2002-04-20 04:10:54
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv24306/Xmt Modified Files: Imakefile XmtWidgets.c Added Files: TransparentB.c TransparentB.h TransparentBP.h TransparentBS.c Log Message: New widget: TransparentButton. --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: TransparentB.c,v 1.1 2002/04/20 04:10:44 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: TransparentB.c,v $ * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: TransparentButton. * * * */ #include <stdio.h> #include <Xmt/TransparentBP.h> #define offset(field) XtOffsetOf(XmtTransparentButtonRec, field) static XtResource resources[] = { /* overrides */ { XmNtraversalOn, XmCTraversalOn, XmRBoolean, sizeof(Boolean), offset(primitive.traversal_on), XtRImmediate, (XtPointer) False }, /* normal resources */ { XmtNcursor, XmtCCursor, XtRCursor, sizeof(Cursor), offset(transparent_button.cursor), XtRImmediate, (XtPointer) None }, { XmtNborderHighlightCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList), offset(transparent_button.border_highlight_callback), XtRImmediate, (XtPointer) NULL }, { XmtNborderUnhighlightCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList), offset(transparent_button.border_unhighlight_callback), XtRImmediate, (XtPointer) NULL }, { XmNarmCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList), offset(transparent_button.arm_callback), XtRImmediate, (XtPointer) NULL }, { XmNdisarmCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList), offset(transparent_button.disarm_callback), XtRImmediate, (XtPointer) NULL }, { XmNactivateCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList), offset(transparent_button.activate_callback), XtRImmediate, (XtPointer) NULL }, }; /* widget procedures */ #if NeedFunctionPrototypes static void Initialize(Widget, Widget, ArgList, Cardinal *); static void Realize(Widget, XtValueMask*, XSetWindowAttributes*); static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); static void Redisplay(Widget, XEvent *, Region); static void BorderHighlight(Widget); static void BorderUnhighlight(Widget); #else static void Initialize(); static void Realize(); static Boolean SetValues(); static void Redisplay(); static void BorderHighlight(); static void BorderUnhighlight(); #endif #if XmVersion > 1001 static XmPrimitiveClassExtRec primClassExtRec = { NULL, NULLQUARK, XmPrimitiveClassExtVersion, sizeof(XmPrimitiveClassExtRec), XmInheritBaselineProc, /* widget_baseline */ XmInheritDisplayRectProc, /* widget_display_rect */ (XmWidgetMarginsProc) _XtInherit }; #endif externaldef(xmtTransparentButtonclassrec) XmtTransparentButtonClassRec xmtTransparentButtonClassRec = { { /* core_class fields */ /* superclass */ (WidgetClass) &xmPushButtonClassRec, /* class_name */ "XmtTransparentButton", /* widget_size */ sizeof(XmtTransparentButtonRec), /* class_initialize */ NULL, /* class_part_initiali*/ NULL, /* class_inited */ FALSE, /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ TRUE, /* compress_exposure */ XtExposeCompressMaximal, /* compress_enterleave*/ TRUE, /* visible_interest */ FALSE, /* destroy */ NULL, /* resize */ XtInheritResize, /* expose */ Redisplay, /* nothing to redisplay */ /* set_values */ SetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ XtInheritAcceptFocus, /* version */ XtVersion, /* callback_private */ NULL, /* tm_table */ XtInheritTranslations, /* query_geometry */ XtInheritQueryGeometry, /* display accel */ XtInheritDisplayAccelerator, /* extension */ NULL, }, { /* primitive_class fields */ BorderHighlight, /* Primitive border_highlight */ BorderUnhighlight, /* Primitive border_unhighlight */ XmInheritTranslations, /* translations */ NULL, /* arm_and_activate */ NULL, /* get resources */ 0, /* num get_resources */ #if XmVersion <= 1001 NULL, /* extension */ #else (XtPointer)&primClassExtRec,/* extension */ #endif }, { /* XmLabel class field */ NULL, /* setOverrideCallback */ NULL, /* menuProcs */ XmInheritTranslations, /* translations */ NULL, /* extension */ }, { /* XmPushButton class field */ NULL, /* extension*/ }, { /* TransparentButton class field */ NULL, /* extension*/ } }; externaldef(xmtTransparentButtonwidgetclass) WidgetClass xmtTransparentButtonWidgetClass = (WidgetClass) &xmtTransparentButtonClassRec; /**************************************************************** * Initialize ****************************************************************/ /* ARGSUSED */ #if NeedFunctionPrototypes static void Initialize(Widget request, Widget init, ArgList arglist, Cardinal *num_args) #else static void Initialize(request, init, arglist, num_args) Widget request, init; ArgList arglist; Cardinal *num_args; #endif { } /**************************************************************** * SetValues * ****************************************************************/ /* ARGSUSED */ #if NeedFunctionPrototypes static Boolean SetValues(Widget current, Widget request, Widget set, ArgList arglist, Cardinal *num_args) #else static Boolean SetValues(current, request, set, arglist, num_args) Widget current, request, set; ArgList arglist; Cardinal *num_args; #endif { XmtTransparentButtonWidget cw = (XmtTransparentButtonWidget) current; XmtTransparentButtonWidget nw = (XmtTransparentButtonWidget) set; if (cw->transparent_button.cursor != nw->transparent_button.cursor && nw->core.window != None) { XDefineCursor(XtDisplay(set), nw->core.window, nw->transparent_button.cursor); } /* Redisplay is useless. You will be assimilated. */ return False; } #if NeedFunctionPrototypes static void Realize(Widget w, XtValueMask* values, XSetWindowAttributes*attributes) #else static void Realize(w, values, attributes) Widget w; XtValueMask* values; XSetWindowAttributes* attributes; #endif { XmtTransparentButtonWidget bw = (XmtTransparentButtonWidget) w; if (bw->transparent_button.cursor != None) { attributes->cursor = bw->transparent_button.cursor; *values |= CWCursor; } *values &= ~(CWBackPixmap| CWBackPixel| CWBorderPixmap| CWBorderPixel| CWBitGravity| CWWinGravity| CWBackingStore| CWBackingPlanes| CWBackingPixel| CWSaveUnder| CWDontPropagate| CWColormap); w->core.window = XCreateWindow(XtDisplay(w), XtWindow(XtParent(w)), w->core.x, w->core.y, w->core.width, w->core.height, w->core.border_width, 0, InputOnly, CopyFromParent, *values, attributes); } #if NeedFunctionPrototypes static void Redisplay(Widget w, XEvent *event, Region region) #else static void Redisplay(w, event, region) Widget w; XEvent *event; Region region; #endif { /* What a pathetic little function. <grin> */ } #if NeedFunctionPrototypes static void BorderHighlight(Widget w) #else static void BorderHighlight(w) Widget w; #endif { XmtTransparentButtonWidget bw = (XmtTransparentButtonWidget) w; XtCallCallbackList(w, bw->transparent_button.border_highlight_callback, NULL); } #if NeedFunctionPrototypes static void BorderUnhighlight(Widget w) #else static void BorderUnhighlight(w) Widget w; #endif { XmtTransparentButtonWidget bw = (XmtTransparentButtonWidget) w; XtCallCallbackList(w, bw->transparent_button.border_unhighlight_callback, NULL); } /**************************************************************************/ /* Utility Functions */ #if NeedFunctionPrototypes Widget XmtCreateTransparentButton(Widget parent, String name, ArgList args, Cardinal num_args) #else Widget XmtCreateTransparentButton(parent, name, args, num_args) Widget parent; String name; ArgList args; Cardinal num_args; #endif { return XtCreateWidget(name, xmtTransparentButtonWidgetClass, parent, args, num_args); } --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: TransparentB.h,v 1.1 2002/04/20 04:10:44 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: TransparentB.h,v $ * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: TransparentButton. * * * */ #ifndef _XmtTransparentButton_h #define _XmtTransparentButton_h #include <Xm/Xm.h> /* * TransparentButton Widget provides a button that is transparent - that is, * it is entirely invisible. It can be used to combine a group of objects * into a single control, or to temporary lock out an area without setting * it sensitive (as a "busy" cursor). * * It is a subclass of XmPushButton so it inherits that class's resources. * * Resources * * Name Class Type Default Access * cursor Cursor Cursor None CSG * gainFocusCallback Callback Callback NULL CSG * loosefocusCallback Callback Callback NULL CSG * armCallback Callback Callback NULL CSG * disarmCallback Callback Callback NULL CSG * activateCallback Callback Callback NULL CSG * */ externalref WidgetClass xmtTransparentButtonWidgetClass; typedef struct _XmtTransparentButtonClassRec *XmtTransparentButtonWidgetClass; typedef struct _XmtTransparentButtonRec *XmtTransparentButtonWidget; /* * Callback reasons. WARNING: These can overlap with Motif reasons. */ typedef enum { XmtCR_GAINFOCUS=XmCR_FOCUS, XmtCR_LOOSEFOCUS=XmCR_LOSING_FOCUS, } XmtTransparentButtonReason; /* * Callback structures */ typedef struct { int reason; XEvent *event; } XmtTransparentButtonCallbackStruct; externalref _Xconst char XmtTransparentButtonStrings[]; /* * Duplicate the Xm resources as 'Xmt' for consistency. We accept * either, though. */ #ifndef XmtNcursor #define XmtNcursor ((char*)&XmtTransparentButtonStrings[0]) #endif #ifndef XmtNborderHighlightCallback #define XmtNborderHighlightCallback ((char*)&XmtTransparentButtonStrings[7]) #endif #ifndef XmtNborderUnhighlightCallback #define XmtNborderUnhighlightCallback ((char*)&XmtTransparentButtonStrings[31]) #endif #ifndef XmtCCallback #define XmtCCallback ((char*)&XmtTransparentButtonStrings[57]) #endif #ifndef XmtCCursor #define XmtCCursor ((char*)&XmtTransparentButtonStrings[66]) #endif _XFUNCPROTOBEGIN #if NeedFunctionPrototypes extern Widget XmtCreateTransparentButton(Widget, String, ArgList, Cardinal); #else extern Widget XmtCreateTransparentButton(); #endif _XFUNCPROTOEND #endif /* _XmtTransparentButton_h */ --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: TransparentBP.h,v 1.1 2002/04/20 04:10:44 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2002 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: TransparentBP.h,v $ * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: TransparentButton. * * * */ #ifndef _XmtTransparentBP_h #define _XmtTransparentBP_h #include <Xmt/XmtP.h> #include <Xm/PushBP.h> #include <Xmt/TransparentB.h> typedef struct { XtPointer extension; } XmtTransparentButtonClassPart; typedef struct _XmtTransparentButtonClassRec { CoreClassPart core_class; XmPrimitiveClassPart primitive_class; XmLabelClassPart label_class; XmPushButtonClassPart button_class; XmtTransparentButtonClassPart transparent_button_class; } XmtTransparentButtonClassRec; externalref XmtTransparentButtonClassRec xmtTransparentButtonClassRec; typedef struct _XmtTransparentButtonPart { /* resources */ Cursor cursor; XtCallbackList border_highlight_callback; XtCallbackList border_unhighlight_callback; XtCallbackList arm_callback; XtCallbackList disarm_callback; XtCallbackList activate_callback; } XmtTransparentButtonPart; typedef struct _XmtTransparentButtonRec { CorePart core; XmPrimitivePart primitive; XmLabelPart label; XmPushButtonPart button; XmtTransparentButtonPart transparent_button; } XmtTransparentButtonRec; #endif --- NEW FILE --- /* * Motif Tools Library, Version 3.1 * $Id: TransparentBS.c,v 1.1 2002/04/20 04:10:44 grmcdorman Exp $ * * Written by Grant McDorman * Copyright (c) 2001 by Grant McDorman * * This is open source software. See the file LICENSE for details. * There is no warranty for this software. See NO_WARRANTY for details. * * $Log: TransparentBS.c,v $ * Revision 1.1 2002/04/20 04:10:44 grmcdorman * New widget: TransparentButton. * * Revision 1.1 2001/07/20 23:03:48 grmcdorman * This adds the TransparentButton widget to Xmt. * * */ #include <X11/Intrinsic.h> #ifndef _Xconst #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) #define _Xconst const #else #define _Xconst #endif #endif /* _Xconst */ externaldef(xmtTransparentButtonstrings) _Xconst char XmtTransparentButtonStrings[] = { /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19*/ 'c','u','r','s','o','r', 0, 'b','o','r','d','e','r','H','i','g','h','l','i','g','h','t','C','a','l','l','b','a','c','k',0, 'b','o','r','d','e','r','U','n','h','i','g','h','l','i','g','h','t','C','a','l','l','b','a','c','k',0, 'C','a','l','l','b','a','c','k', 0, 'C','u','r','s','o','r', 0, }; Index: Imakefile =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/Imakefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Imakefile 24 Sep 2001 21:46:40 -0000 1.5 --- Imakefile 20 Apr 2002 04:10:44 -0000 1.6 *************** *** 92,95 **** --- 92,97 ---- Symbols.c \ Template.c \ + TransparentB.c \ + TransparentBS.c \ Visual.c \ UnixProcs.c \ *************** *** 198,201 **** --- 200,204 ---- Symbols.o \ Template.o \ + TransparentB.o \ Visual.o \ UnixProcs.o \ *************** *** 229,232 **** --- 232,236 ---- MsgLineS.o\ ProgressS.o\ + TransparentBS.o\ WorkingBoxS.o *************** *** 243,246 **** --- 247,251 ---- MsgLineS.o\ ProgressS.o\ + TransparentBS.o \ WorkingBoxS.o #endif *************** *** 294,297 **** --- 299,304 ---- Symbols.h \ Template.h \ + TransparentB.h \ + TransparentBP.h \ Util.h \ WidgetType.h \ Index: XmtWidgets.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/XmtWidgets.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** XmtWidgets.c 19 Sep 2001 02:57:18 -0000 1.3 --- XmtWidgets.c 20 Apr 2002 04:10:44 -0000 1.4 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.4 2002/04/20 04:10:44 grmcdorman + * New widget: TransparentButton. + * * Revision 1.3 2001/09/19 02:57:18 grmcdorman * This change makes the following modifications: *************** *** 50,53 **** --- 53,57 ---- #include <Xmt/Menu.h> #include <Xmt/MsgLine.h> + #include <Xmt/TransparentB.h> #include <Xmt/WorkingBox.h> #include <Xmt/Progress.h> *************** *** 78,81 **** --- 82,86 ---- {"XmtProgress", NULL, XmtCreateProgress, NULL, NULL, True}, {"XmtMsgLine", NULL, XmtCreateMsgLine}, + {"XmtTransparentButton", NULL, XmtCreateTransparentButton}, {"XmtWorkingBox", NULL, XmtCreateWorkingBox}, {"XmtWorkingDialog", NULL, XmtCreateWorkingDialog, NULL, NULL, True}, |
From: Grant M. <grm...@us...> - 2002-04-20 04:09:01
|
Update of /cvsroot/motiftools/xmt/man/man3 In directory usw-pr-cvs1:/tmp/cvs-serv23965/man/man3 Modified Files: XmtProgress.man Log Message: Correct typo (Cli instead of Progress). Index: XmtProgress.man =================================================================== RCS file: /cvsroot/motiftools/xmt/man/man3/XmtProgress.man,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** XmtProgress.man 14 Jul 2001 19:40:43 -0000 1.1 --- XmtProgress.man 20 Apr 2002 04:08:53 -0000 1.2 *************** *** 53,57 **** \fBRESOURCES\fR ! Cli inherits the resources of the XmPrimitive class, overriding the default of \fIXmNtraversalOn\fR to \fIFalse\fR, and \fIXmNhighlightThickess\fR to 0, and --- 53,57 ---- \fBRESOURCES\fR ! Progress inherits the resources of the XmPrimitive class, overriding the default of \fIXmNtraversalOn\fR to \fIFalse\fR, and \fIXmNhighlightThickess\fR to 0, and |
From: Grant M. <grm...@us...> - 2002-03-22 03:50:04
|
Update of /cvsroot/motiftools/xmt/Xmt In directory usw-pr-cvs1:/tmp/cvs-serv24368 Modified Files: EnumCvt.c Log Message: Fix for problem 497185 (http://sourceforge.net/tracker/?func=detail&atid=213298&aid=497185&group_id=13298) EnumCvt.c assumed that a pointer was the same size as an int. Unfortunately, on some 64 bit platforms, this is not so. Platforms that had the problem included 64 bit HP, SGI, and Sun systems. Instead, EnumCvt.c will now cast it as a pointer to an XtPointer, dereference, and then cast to int. Index: EnumCvt.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/EnumCvt.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** EnumCvt.c 19 Sep 2001 02:57:18 -0000 1.2 --- EnumCvt.c 22 Mar 2002 03:50:01 -0000 1.3 *************** *** 10,13 **** --- 10,23 ---- * * $Log$ + * Revision 1.3 2002/03/22 03:50:01 grmcdorman + * Fix for problem 497185 + * (http://sourceforge.net/tracker/?func=detail&atid=213298&aid=497185&group_id=13298) + * + * EnumCvt.c assumed that a pointer was the same size as an int. Unfortunately, on some 64 bit platforms, + * this is not so. Platforms that had the problem included 64 bit HP, SGI, and Sun systems. + * + * Instead, EnumCvt.c will now cast it as a pointer to an XtPointer, dereference, and then cast to + * int. + * * Revision 1.2 2001/09/19 02:57:18 grmcdorman * This change makes the following modifications: *************** *** 53,61 **** #endif { ! String type = *(String *)args[0].addr; ! String *names = *(String **)args[1].addr; ! int *values = *(int **)args[2].addr; ! int num = *(int *)args[3].addr; ! String *prefixes = *(String **)args[4].addr; String target = (String) from->addr; String prefix; --- 63,74 ---- #endif { ! /* To avoid problems with size, dereference as XtPointer. (All of these ! * are passed as XtImmediate, so they are all in an XtPointer-size object. ! */ ! String type = (String) *(XtPointer *)args[0].addr; ! String *names = (String *) *(XtPointer *)args[1].addr; ! int *values = (int *) *(XtPointer *)args[2].addr; ! int num = (int) *(XtPointer *)args[3].addr; ! String *prefixes = (String *) *(XtPointer *)args[4].addr; String target = (String) from->addr; String prefix; *************** *** 141,164 **** * XtSetTypeConverter copies these args, so it is * okay to use an automatic array. ! */ args[0].address_mode = XtImmediate; args[0].address_id = (XtPointer) type; ! args[0].size = sizeof(type); args[1].address_mode = XtImmediate; args[1].address_id = (XtPointer) names; ! args[1].size = sizeof(names); args[2].address_mode = XtImmediate; args[2].address_id = (XtPointer) values; ! args[2].size = sizeof(values); args[3].address_mode = XtImmediate; args[3].address_id = (XtPointer) num; ! args[3].size = sizeof(num); args[4].address_mode = XtImmediate; args[4].address_id = (XtPointer) prefixes; ! args[4].size = sizeof(prefixes); XtSetTypeConverter(XtRString, (String)type, XmtConvertStringToEnum, --- 154,181 ---- * XtSetTypeConverter copies these args, so it is * okay to use an automatic array. ! * ! * Because *all* are XtImmediate, the size is not the native ! * size but the size of the pointer. ! */ ! args[0].address_mode = XtImmediate; args[0].address_id = (XtPointer) type; ! args[0].size = sizeof(args[0].address_id); args[1].address_mode = XtImmediate; args[1].address_id = (XtPointer) names; ! args[1].size = sizeof(args[0].address_id); args[2].address_mode = XtImmediate; args[2].address_id = (XtPointer) values; ! args[2].size = sizeof(args[0].address_id); args[3].address_mode = XtImmediate; args[3].address_id = (XtPointer) num; ! args[3].size = sizeof(args[0].address_id); args[4].address_mode = XtImmediate; args[4].address_id = (XtPointer) prefixes; ! args[4].size = sizeof(args[0].address_id); XtSetTypeConverter(XtRString, (String)type, XmtConvertStringToEnum, |