summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xc/lib/Xaw3d/AsciiSrc.c39
-rw-r--r--xc/lib/Xaw3d/AsciiText.c15
-rw-r--r--xc/lib/Xaw3d/AsciiText.h3
-rw-r--r--xc/lib/Xaw3d/AsciiTextP.h3
-rw-r--r--xc/lib/Xaw3d/Command.c37
-rw-r--r--xc/lib/Xaw3d/CommandP.h1
-rw-r--r--xc/lib/Xaw3d/Imakefile323
-rw-r--r--xc/lib/Xaw3d/Imakefrag.X11R533
-rw-r--r--xc/lib/Xaw3d/Label.c305
-rw-r--r--xc/lib/Xaw3d/Label.h4
-rw-r--r--xc/lib/Xaw3d/LabelP.h10
-rw-r--r--xc/lib/Xaw3d/List.c50
-rw-r--r--xc/lib/Xaw3d/List.h4
-rw-r--r--xc/lib/Xaw3d/ListP.h3
-rw-r--r--xc/lib/Xaw3d/MultiSrc.c1
-rw-r--r--xc/lib/Xaw3d/Paned.c10
-rw-r--r--xc/lib/Xaw3d/Panner.c18
-rw-r--r--xc/lib/Xaw3d/README.XAW3D695
-rw-r--r--xc/lib/Xaw3d/Scrollbar.c174
-rw-r--r--xc/lib/Xaw3d/ScrollbarP.h5
-rw-r--r--xc/lib/Xaw3d/Simple.c5
-rw-r--r--xc/lib/Xaw3d/Simple.h4
-rw-r--r--xc/lib/Xaw3d/SimpleMenP.h14
-rw-r--r--xc/lib/Xaw3d/SimpleMenu.c676
-rw-r--r--xc/lib/Xaw3d/SimpleMenu.h7
-rw-r--r--xc/lib/Xaw3d/SimpleP.h3
-rw-r--r--xc/lib/Xaw3d/Sme.c4
-rw-r--r--xc/lib/Xaw3d/Sme.h5
-rw-r--r--xc/lib/Xaw3d/SmeBSB.c459
-rw-r--r--xc/lib/Xaw3d/SmeBSB.h18
-rw-r--r--xc/lib/Xaw3d/SmeBSBP.h17
-rw-r--r--xc/lib/Xaw3d/SmeLine.c7
-rw-r--r--xc/lib/Xaw3d/SmeP.h4
-rw-r--r--xc/lib/Xaw3d/SmeThreeD.c87
-rw-r--r--xc/lib/Xaw3d/StripChart.c6
-rw-r--r--xc/lib/Xaw3d/Text.c185
-rw-r--r--xc/lib/Xaw3d/TextAction.c67
-rw-r--r--xc/lib/Xaw3d/TextP.h1
-rw-r--r--xc/lib/Xaw3d/TextPop.c21
-rw-r--r--xc/lib/Xaw3d/TextSrc.c5
-rw-r--r--xc/lib/Xaw3d/TextTr.c21
-rw-r--r--xc/lib/Xaw3d/ThreeD.c350
-rw-r--r--xc/lib/Xaw3d/ThreeD.h24
-rw-r--r--xc/lib/Xaw3d/ThreeDP.h3
-rw-r--r--xc/lib/Xaw3d/Tip.c718
-rw-r--r--xc/lib/Xaw3d/Tip.h135
-rw-r--r--xc/lib/Xaw3d/TipP.h76
-rw-r--r--xc/lib/Xaw3d/Vendor.c149
-rw-r--r--xc/lib/Xaw3d/Viewport.c266
-rw-r--r--xc/lib/Xaw3d/ViewportP.h2
-rw-r--r--xc/lib/Xaw3d/Xaw3dP.c212
-rw-r--r--xc/lib/Xaw3d/Xaw3dP.h.sed83
-rw-r--r--xc/lib/Xaw3d/jump_funcs128
-rw-r--r--xc/lib/Xaw3d/jump_ignore3
-rw-r--r--xc/lib/Xaw3d/jump_vars126
-rw-r--r--xc/lib/Xaw3d/sharedlib.c13
56 files changed, 4141 insertions, 1496 deletions
diff --git a/xc/lib/Xaw3d/AsciiSrc.c b/xc/lib/Xaw3d/AsciiSrc.c
index d0b8e35..be8cdf8 100644
--- a/xc/lib/Xaw3d/AsciiSrc.c
+++ b/xc/lib/Xaw3d/AsciiSrc.c
@@ -32,6 +32,7 @@ in this Software without prior written authorization from the X Consortium.
*
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <stdio.h>
#include <ctype.h>
@@ -46,7 +47,9 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xaw3d/AsciiSrcP.h>
#include <X11/Xmu/Misc.h>
#include <X11/Xmu/CharSet.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSrcP.h>
+#endif
#if (defined(ASCII_STRING) || defined(ASCII_DISK))
@@ -746,14 +749,20 @@ Widget w;
/* If the src is really a multi, call the multi routine.*/
+#ifdef XAW_INTERNATIONALIZATION
if ( XtIsSubclass( w, multiSrcObjectClass ) ) {
_XawMultiSourceFreeString( w );
return;
}
-
- else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
+ else
+#endif
+ if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
XtErrorMsg("bad argument", "asciiSource", "XawError",
+#ifdef XAW_INTERNATIONALIZATION
"XawAsciiSourceFreeString's parameter must be an asciiSrc or multiSrc.",
+#else
+ "XawAsciiSourceFreeString's parameter must be an asciiSrc.",
+#endif
NULL, NULL);
}
@@ -782,12 +791,18 @@ Widget w;
/* If the src is really a multi, call the multi save. */
+#ifdef XAW_INTERNATIONALIZATION
if ( XtIsSubclass( w, multiSrcObjectClass ) )
return( _XawMultiSave( w ) );
-
- else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
+ else
+#endif
+ if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
XtErrorMsg("bad argument", "asciiSource", "XawError",
+#ifdef XAW_INTERNATIONALIZATION
"XawAsciiSave's parameter must be an asciiSrc or multiSrc.",
+#else
+ "XawAsciiSave's parameter must be an asciiSrc.",
+#endif
NULL, NULL);
}
@@ -847,12 +862,18 @@ String name;
/* If the src is really a multi, call the multi save. - */
+#ifdef XAW_INTERNATIONALIZATION
if ( XtIsSubclass( w, multiSrcObjectClass ) )
return( _XawMultiSaveAsFile( w, name ) );
-
- else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
+ else
+#endif
+ if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) {
XtErrorMsg("bad argument", "asciiSource", "XawError",
+#ifdef XAW_INTERNATIONALIZATION
"XawAsciiSaveAsFile's 1st parameter must be an asciiSrc or multiSrc.",
+#else
+ "XawAsciiSaveAsFile's 1st parameter must be an asciiSrc.",
+#endif
NULL, NULL);
}
@@ -877,14 +898,20 @@ XawAsciiSourceChanged(w)
Widget w;
#endif
{
+#ifdef XAW_INTERNATIONALIZATION
if ( XtIsSubclass( w, multiSrcObjectClass ) )
return( ( (MultiSrcObject) w )->multi_src.changes );
+#endif
if ( XtIsSubclass( w, asciiSrcObjectClass ) )
return( ( (AsciiSrcObject) w)->ascii_src.changes );
XtErrorMsg("bad argument", "asciiSource", "XawError",
+#ifdef XAW_INTERNATIONALIZATION
"XawAsciiSourceChanged parameter must be an asciiSrc or multiSrc.",
+#else
+ "XawAsciiSourceChanged parameter must be an asciiSrc.",
+#endif
NULL, NULL);
return( True ); /* for gcc -Wall */
diff --git a/xc/lib/Xaw3d/AsciiText.c b/xc/lib/Xaw3d/AsciiText.c
index 0aa3599..69bd94e 100644
--- a/xc/lib/Xaw3d/AsciiText.c
+++ b/xc/lib/Xaw3d/AsciiText.c
@@ -67,18 +67,20 @@ SOFTWARE.
* kit@expo.lcs.mit.edu
*/
+#include "Xaw3dP.h"
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
-
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/Cardinals.h>
#include <X11/Xaw3d/AsciiTextP.h>
#include <X11/Xaw3d/AsciiSrc.h>
#include <X11/Xaw3d/AsciiSink.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSrc.h>
#include <X11/Xaw3d/MultiSinkP.h>
#include <X11/Xaw3d/XawImP.h>
+#endif
#define TAB_COUNT 32
@@ -141,7 +143,9 @@ Cardinal *num_args;
int i;
int tabs[TAB_COUNT], tab;
+#ifdef XAW_INTERNATIONALIZATION
MultiSinkObject sink;
+#endif
/* superclass Initialize can't set the following,
* as it didn't know the source or sink when it was called */
@@ -152,6 +156,7 @@ Cardinal *num_args;
/* This is the main change for internationalization. */
+#ifdef XAW_INTERNATIONALIZATION
if ( w->simple.international == True ) { /* The multi* are international. */
w->text.source = XtCreateWidget( "textSource", multiSrcObjectClass,
@@ -159,7 +164,9 @@ Cardinal *num_args;
w->text.sink = XtCreateWidget( "textSink", multiSinkObjectClass,
new, args, *num_args );
}
- else {
+ else
+#endif
+ {
w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass,
new, args, *num_args );
@@ -181,6 +188,7 @@ Cardinal *num_args;
/* If we are using a MultiSink we need to tell the input method stuff. */
+#ifdef XAW_INTERNATIONALIZATION
if ( w->simple.international == True ) {
Arg list[4];
Cardinal ac = 0;
@@ -193,6 +201,7 @@ Cardinal *num_args;
XtSetArg (list[ac], XtNbackground, sink->text_sink.background); ac++;
_XawImSetValues(new, list, ac);
}
+#endif
}
static void
@@ -201,8 +210,10 @@ Widget w;
{
/* Disconnect input method */
+#ifdef XAW_INTERNATIONALIZATION
if ( ((AsciiWidget)w)->simple.international == True )
_XawImUnregister( w );
+#endif
if (w == XtParent(((AsciiWidget)w)->text.source))
XtDestroyWidget( ((AsciiWidget)w)->text.source );
diff --git a/xc/lib/Xaw3d/AsciiText.h b/xc/lib/Xaw3d/AsciiText.h
index fb94d76..c2d88cd 100644
--- a/xc/lib/Xaw3d/AsciiText.h
+++ b/xc/lib/Xaw3d/AsciiText.h
@@ -78,9 +78,12 @@ SOFTWARE.
*
****************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Text.h> /* AsciiText is a subclass of Text */
#include <X11/Xaw3d/AsciiSrc.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSrc.h>
+#endif
/* Resources:
diff --git a/xc/lib/Xaw3d/AsciiTextP.h b/xc/lib/Xaw3d/AsciiTextP.h
index d002a21..c75890c 100644
--- a/xc/lib/Xaw3d/AsciiTextP.h
+++ b/xc/lib/Xaw3d/AsciiTextP.h
@@ -72,10 +72,13 @@ SOFTWARE.
#ifndef _AsciiTextP_h
#define _AsciiTextP_h
+#include "Xaw3dP.h"
#include <X11/Xaw3d/TextP.h>
#include <X11/Xaw3d/AsciiText.h>
#include <X11/Xaw3d/AsciiSrc.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSrc.h>
+#endif
typedef struct {int empty;} AsciiClassPart;
diff --git a/xc/lib/Xaw3d/Command.c b/xc/lib/Xaw3d/Command.c
index 43ff649..5fe16b6 100644
--- a/xc/lib/Xaw3d/Command.c
+++ b/xc/lib/Xaw3d/Command.c
@@ -52,6 +52,7 @@ SOFTWARE.
* Command.c - Command button widget
*/
+#include "Xaw3dP.h"
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
@@ -87,14 +88,12 @@ static XtResource resources[] = {
(XtPointer) DEFAULT_SHAPE_HIGHLIGHT},
{XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int),
offset(command.shape_style), XtRImmediate, (XtPointer)XawShapeRectangle},
- {XtNcornerRoundPercent, XtCCornerRoundPercent,
- XtRDimension, sizeof(Dimension),
- offset(command.corner_round), XtRImmediate, (XtPointer) 25},
- {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
- offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2},
+ {XtNcornerRoundPercent, XtCCornerRoundPercent, XtRDimension,
+ sizeof(Dimension), offset(command.corner_round), XtRImmediate,
+ (XtPointer) 25},
{XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
- (XtPointer)0}
+ (XtPointer) 0}
};
#undef offset
@@ -191,11 +190,13 @@ Pixel fg, bg;
else
values.line_width = 0;
+#ifdef XAW_INTERNATIONALIZATION
if ( cbw->simple.international == True )
return XtAllocateGC((Widget)cbw, 0,
(GCForeground|GCBackground|GCLineWidth|GCCapStyle),
&values, GCFont, 0 );
else
+#endif
return XtGetGC((Widget)cbw,
(GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle),
&values);
@@ -222,10 +223,12 @@ Cardinal *num_args; /* unused */
else
cbw->command.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
}
+
if (cbw->command.shape_style != XawShapeRectangle) {
cbw->threeD.shadow_width = 0;
cbw->core.border_width = 1;
}
+ cbw->command.shadow_width = cbw->threeD.shadow_width;
cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground,
cbw->core.background_pixel);
@@ -450,7 +453,7 @@ Boolean change;
if (cbw->command.highlight_thickness <= 0)
{
(*SuperClass->core_class.expose) (w, event, region);
- (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command.set);
+ (*cwclass->threeD_class.shadowdraw) (w, event, region, cbw->threeD.relief, !cbw->command.set);
return;
}
@@ -484,7 +487,7 @@ Boolean change;
}
}
(*SuperClass->core_class.expose) (w, event, region);
- (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command.set);
+ (*cwclass->threeD_class.shadowdraw) (w, event, region, cbw->threeD.relief, !cbw->command.set);
}
static void
@@ -546,6 +549,13 @@ Cardinal *num_args;
redisplay = True;
}
+ if (cbw->threeD.shadow_width != oldcbw->threeD.shadow_width) {
+ cbw->command.shadow_width = cbw->threeD.shadow_width;
+ redisplay = True;
+ }
+ if (cbw->core.border_width != oldcbw->core.border_width)
+ redisplay = True;
+
if ( XtIsRealized(new)
&& oldcbw->command.shape_style != cbw->command.shape_style
&& !ShapeButton(cbw, TRUE))
@@ -553,6 +563,17 @@ Cardinal *num_args;
cbw->command.shape_style = oldcbw->command.shape_style;
}
+ if (cbw->command.shape_style != XawShapeRectangle) {
+ cbw->threeD.shadow_width = 0;
+ ShapeButton(cbw, FALSE);
+ redisplay = True;
+ }
+ if (cbw->command.shape_style == XawShapeRectangle) {
+ cbw->threeD.shadow_width =
+ (cbw->command.shadow_width) ? cbw->command.shadow_width : 2;
+ redisplay = True;
+ }
+
return (redisplay);
}
diff --git a/xc/lib/Xaw3d/CommandP.h b/xc/lib/Xaw3d/CommandP.h
index 2d83723..8478b43 100644
--- a/xc/lib/Xaw3d/CommandP.h
+++ b/xc/lib/Xaw3d/CommandP.h
@@ -119,6 +119,7 @@ typedef struct {
GC inverse_GC;
Boolean set;
XtCommandHighlight highlighted;
+ Dimension shadow_width;
/* more resources */
int shape_style;
Dimension corner_round;
diff --git a/xc/lib/Xaw3d/Imakefile b/xc/lib/Xaw3d/Imakefile
index bc8af27..81e9a0a 100644
--- a/xc/lib/Xaw3d/Imakefile
+++ b/xc/lib/Xaw3d/Imakefile
@@ -1,4 +1,15 @@
-XCOMM $XConsortium: Imakefile,v 1.78 91/09/18 14:28:23 rws Exp $
+#ifndef XCOMM
+#define XCOMM #
+#endif
+
+XCOMM Build options. Have you read the README.XAW3D file yet?
+XCOMM
+XCOMM For color pixmaps, define MULTIPLANE_PIXMAPS:
+#undef MULTIPLANE_PIXMAPS
+XCOMM For grayed stipple shadows, define GRAY_BLKWHT_STIPPLES:
+#define GRAY_BLKWHT_STIPPLES
+XCOMM For scrollbars with arrows, define ARROW_SCROLLBARS:
+#undef ARROW_SCROLLBARS
#define DoNormalLib NormalLibXaw
#define DoSharedLib SharedLibXaw
@@ -10,241 +21,137 @@ XCOMM $XConsortium: Imakefile,v 1.78 91/09/18 14:28:23 rws Exp $
#define IncSubdir X11
#define IncSubSubdir Xaw3d
-#ifdef LinuxArchitecture
-JUMP_ROOT_Xaw3d = $(AWIDGETSRC)3d
-JUMP_IS_HOST_Xaw3d = YES
-JUMP_STUBLIBS_Xaw3d = libXaw3d.sa
-JUMP_SUBDIRS_Xaw3d = $(JUMP_ROOT_Xt)
-JUMP_DIR_Xaw3d = $(JUMP_ROOT_Xaw3d)/shared
-JUMP_VARS_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_vars
-JUMP_FUNCS_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_funcs
-JUMP_IGNORE_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_ignore
-JUMP_EXPORT_Xaw3d = $(JUMP_DIR_Xaw3d)/jump.vars
-JUMP_IMPORT_Xaw3d = $(JUMP_EXPORT_Xt) $(JUMP_EXPORT_X11)
-JUMP_ADDRESS_Xaw3d = 0x60300000
-JUMP_JUMPTABLESIZE_Xaw3d = 0x4000
-JUMP_GOTSIZE_Xaw3d = 4096
-JUMP_STUBNAMES_Xaw3d = libXaw3d
-JUMP_STUBS_IMPORT_Xaw3d = $(JUMP_STUBS_IMPORT_X11)
-JUMP_LDLIBS_Xaw3d = $(JUMP_ROOT_Xt)/libXt.sa $(JUMP_ROOT_Xt)/libXmu.sa \
- $(JUMP_ROOT_Xt)/libXext.sa $(JUMP_ROOT_X11)/libX11.sa \
- $(JUMP_LDLIBS_libc)
-#endif
+XCOMM When building outside an X11 source tree:
+XCOMM EXTRA_INCLUDES = -I.
#ifdef SharedXawReqs
REQUIREDLIBS = SharedXawReqs
#endif
-DEFINES = XawI18nDefines
-
- LINTLIBS = $(LINTXLIB) $(LINTXTOOL)
-
-# EXTRA_DEFINES = -DARROW_SCROLLBAR -DUSEGRAY
-
-# EXTRA_INCLUDES = -I.
-
-HEADERS = \
- AllWidgets.h \
- AsciiSink.h \
- AsciiSinkP.h \
- AsciiSrc.h \
- AsciiSrcP.h \
- AsciiText.h \
- AsciiTextP.h \
- Box.h \
- BoxP.h \
- Cardinals.h \
- Command.h \
- CommandP.h \
- Dialog.h \
- DialogP.h \
- Form.h \
- FormP.h \
- Grip.h \
- GripP.h \
- Label.h \
- LabelP.h \
- Layout.h \
- LayoutP.h \
- List.h \
- ListP.h \
- MenuButton.h \
- MenuButtoP.h \
- MultiSrc.h \
- MultiSrcP.h \
- MultiSink.h \
- MultiSinkP.h \
- Paned.h \
- PanedP.h \
- Panner.h \
- PannerP.h \
- Porthole.h \
- PortholeP.h \
- Repeater.h \
- RepeaterP.h \
- Reports.h \
- Scrollbar.h \
- ScrollbarP.h \
- Simple.h \
- SimpleP.h \
- SimpleMenu.h \
- SimpleMenP.h \
- Sme.h \
- SmeP.h \
- SmeBSB.h \
- SmeBSBP.h \
- SmeLine.h \
- SmeLineP.h \
- SmeThreeD.h \
- SmeThreeDP.h \
- StripChart.h \
- StripCharP.h \
- Template.c \
- Template.h \
- TemplateP.h \
- Text.h \
- TextP.h \
- TextSink.h \
- TextSinkP.h \
- TextSrc.h \
- TextSrcP.h \
- ThreeD.h \
- ThreeDP.h \
- Toggle.h \
- ToggleP.h \
- Tree.h \
- TreeP.h \
- VendorEP.h \
- Viewport.h \
- ViewportP.h \
- XawImP.h \
- XawInit.h
-
-SRCS = \
- AllWidgets.c \
- AsciiSink.c \
- AsciiSrc.c \
- AsciiText.c \
- Box.c \
- Command.c \
- Dialog.c \
- Form.c \
- Grip.c \
- Label.c \
- Layout.c \
- List.c \
- MenuButton.c \
- MultiSrc.c \
- MultiSink.c \
- Paned.c \
- Panner.c \
- Porthole.c \
- Repeater.c \
- Scrollbar.c \
- Simple.c \
- SimpleMenu.c \
- Sme.c \
- SmeBSB.c \
- SmeLine.c \
- SmeThreeD.c \
- StripChart.c \
- Text.c \
- TextSink.c \
- TextSrc.c \
- TextAction.c \
- TextPop.c \
- TextTr.c \
- ThreeD.c \
- Toggle.c \
- Tree.c \
- Vendor.c \
- Viewport.c \
- XawIm.c \
- XawInit.c \
- XawI18n.c \
- sharedlib.c \
- laygram.c \
- laylex.c
+LINTLIBS = $(LINTXLIB) $(LINTXTOOL)
+
+BASE_HDRS = AllWidgets.h AsciiSink.h AsciiSinkP.h AsciiSrc.h AsciiSrcP.h \
+ AsciiText.h AsciiTextP.h Box.h BoxP.h Cardinals.h Command.h \
+ CommandP.h Dialog.h DialogP.h Form.h FormP.h Grip.h GripP.h \
+ Label.h LabelP.h Layout.h LayoutP.h List.h ListP.h MenuButton.h \
+ MenuButtoP.h Paned.h PanedP.h Panner.h PannerP.h Porthole.h \
+ PortholeP.h Repeater.h RepeaterP.h Reports.h Scrollbar.h \
+ ScrollbarP.h Simple.h SimpleP.h SimpleMenu.h SimpleMenP.h Sme.h \
+ SmeP.h SmeBSB.h SmeBSBP.h SmeLine.h SmeLineP.h SmeThreeD.h \
+ SmeThreeDP.h StripChart.h StripCharP.h Template.c Template.h \
+ TemplateP.h Text.h TextP.h TextSink.h TextSinkP.h TextSrc.h \
+ TextSrcP.h ThreeD.h ThreeDP.h Tip.h TipP.h Toggle.h ToggleP.h \
+ Tree.h TreeP.h Viewport.h ViewportP.h Xaw3dP.h XawInit.h
+
+I18N_HDRS = MultiSrc.h MultiSrcP.h MultiSink.h MultiSinkP.h VendorEP.h \
+ XawImP.h
+
+BASE_SRCS = AllWidgets.c AsciiSink.c AsciiSrc.c AsciiText.c Box.c \
+ Command.c Dialog.c Form.c Grip.c Label.c Layout.c List.c \
+ MenuButton.c Paned.c Panner.c Porthole.c Repeater.c Scrollbar.c \
+ Simple.c SimpleMenu.c Sme.c SmeBSB.c SmeLine.c SmeThreeD.c \
+ StripChart.c Text.c TextSink.c TextSrc.c TextAction.c TextPop.c \
+ TextTr.c ThreeD.c Tip.c Toggle.c Tree.c Vendor.c Viewport.c \
+ Xaw3dP.c XawInit.c sharedlib.c laygram.c laylex.c
+
+I18N_SRCS = MultiSrc.c MultiSink.c XawIm.c XawI18n.c
#if SharedDataSeparation
UNSHAREDOBJS = AllWidgets.o sharedlib.o
#endif
-OBJS = \
- AllWidgets.o \
- AsciiSink.o \
- AsciiSrc.o \
- AsciiText.o \
- Box.o \
- Command.o \
- Dialog.o \
- Form.o \
- Grip.o \
- Label.o \
- Layout.o \
- List.o \
- MenuButton.o \
- MultiSrc.o \
- MultiSink.o \
- Paned.o \
- Panner.o \
- Porthole.o \
- Repeater.o \
- Scrollbar.o \
- Simple.o \
- SimpleMenu.o \
- Sme.o \
- SmeBSB.o \
- SmeLine.o \
- SmeThreeD.o \
- StripChart.o \
- Text.o \
- TextSink.o \
- TextSrc.o \
- TextAction.o \
- TextPop.o \
- TextTr.o \
- ThreeD.o \
- Toggle.o \
- Tree.o \
- Vendor.o \
- Viewport.o \
- XawIm.o \
- XawI18n.o \
- XawInit.o \
- laygram.o \
- laylex.o
+BASE_OBJS = AllWidgets.o AsciiSink.o AsciiSrc.o AsciiText.o Box.o \
+ Command.o Dialog.o Form.o Grip.o Label.o Layout.o List.o \
+ MenuButton.o Paned.o Panner.o Porthole.o Repeater.o Scrollbar.o \
+ Simple.o SimpleMenu.o Sme.o SmeBSB.o SmeLine.o SmeThreeD.o \
+ StripChart.o Text.o TextSink.o TextSrc.o TextAction.o TextPop.o \
+ TextTr.o ThreeD.o Tip.o Toggle.o Tree.o Vendor.o Viewport.o \
+ Xaw3dP.o XawInit.o laygram.o laylex.o
+
+I18N_OBJS = MultiSrc.o MultiSink.o XawIm.o XawI18n.o
+
+#ifdef XawI18nDefines
+#define INTERNATIONALIZATION
+HEADERS = $(BASE_HDRS) $(I18N_HDRS)
+SRCS = $(BASE_SRCS) $(I18N_SRCS)
+OBJS = $(BASE_OBJS) $(I18N_OBJS)
+#else
+#undef INTERNATIONALIZATION
+HEADERS = $(BASE_HDRS)
+SRCS = $(BASE_SRCS)
+OBJS = $(BASE_OBJS)
+#endif
#include <Library.tmpl>
+#if DoSharedLib && SharedDataSeparation
+SpecialCObjectRule(sharedlib.o,NullParameter,$(SHLIBDEF))
+#endif
+
+XCOMM At least one X11R5 distribution needs this:
+XCOMM #include "Imakefrag.X11R5"
+
#ifdef LexCmd
-LEX=LexCmd
+LEX = LexCmd
#endif
#ifdef YaccCmd
-YACC=YaccCmd
+YACC = YaccCmd
+#endif
+
+#ifdef INTERNATIONALIZATION
+XAW_INTERNATIONALIZATION = \
+ -e 's/\/\* I18n support \*\//\#define XAW_INTERNATIONALIZATION/'
+#else
+XAW_INTERNATIONALIZATION = \
+ -e 's/\/\* I18n support \*\//\#undef XAW_INTERNATIONALIZATION/'
+#endif
+#ifdef MULTIPLANE_PIXMAPS
+XAW_MULTIPLANE_PIXMAPS = \
+ -e 's/\/\* XPM support \*\//\#define XAW_MULTIPLANE_PIXMAPS/'
+#else
+XAW_MULTIPLANE_PIXMAPS = \
+ -e 's/\/\* XPM support \*\//\#undef XAW_MULTIPLANE_PIXMAPS/'
+#endif
+#ifdef GRAY_BLKWHT_STIPPLES
+XAW_GRAY_BLKWHT_STIPPLES = \
+ -e 's/\/\* gray stipples \*\//\#define XAW_GRAY_BLKWHT_STIPPLES/'
+#else
+XAW_GRAY_BLKWHT_STIPPLES = \
+ -e 's/\/\* gray stipples \*\//\#undef XAW_GRAY_BLKWHT_STIPPLES/'
+#endif
+#ifdef ARROW_SCROLLBARS
+XAW_ARROW_SCROLLBARS = \
+ -e 's/\/\* arrow scrollbars \*\//\#define XAW_ARROW_SCROLLBARS/'
+#else
+XAW_ARROW_SCROLLBARS = \
+ -e 's/\/\* arrow scrollbars \*\//\#undef XAW_ARROW_SCROLLBARS/'
#endif
-all::
+depend:: laygram.c laygram.h laylex.c Xaw3dP.h
-depend:: laygram.c laylex.c
+clean::
+ $(RM) laygram.c laygram.h laylex.c Xaw3dP.h
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib.o,NullParameter,$(SHLIBDEF))
-#endif
+distclean::
+ LibCleanDir(X11)
-laygram.c : laygram.y
+laygram.c: laygram.y
$(YACC) -d laygram.y
- sed 's/yy/LayYY/g' y.tab.c > laygram.c
- sed 's/yy/LayYY/g' y.tab.h > laygram.h
+ sed -e 's/yy/LayYY/g' y.tab.c > laygram.c
+ sed -e 's/yy/LayYY/g' y.tab.h > laygram.h
$(RM) y.tab.c y.tab.h
laylex.c: laylex.l
$(LEX) laylex.l
- sed 's/yy/LayYY/g' lex.yy.c > laylex.c
+ sed -e 's/yy/LayYY/g' lex.yy.c > laylex.c
$(RM) lex.yy.c
-clean::
- $(RM) laygram.c laylex.c
+Xaw3dP.h: Xaw3dP.h.sed
+ sed $(XAW_INTERNATIONALIZATION) $(XAW_MULTIPLANE_PIXMAPS) \
+ $(XAW_GRAY_BLKWHT_STIPPLES) $(XAW_ARROW_SCROLLBARS) \
+ Xaw3dP.h.sed > Xaw3dP.h
+
+$(OBJS): Xaw3dP.h
DependTarget()
diff --git a/xc/lib/Xaw3d/Imakefrag.X11R5 b/xc/lib/Xaw3d/Imakefrag.X11R5
new file mode 100644
index 0000000..6c26ddc
--- /dev/null
+++ b/xc/lib/Xaw3d/Imakefrag.X11R5
@@ -0,0 +1,33 @@
+XCOMM make rules for X11R5 -------------------------------
+
+#if DoSharedLib
+#if DoNormalLib
+SharedLibraryTarget(Xaw3d,$(SOXAWREV),$(OBJS),shared,..)
+#else
+SharedLibraryTarget(Xaw3d,$(SOXAWREV),$(OBJS),.,.)
+#endif
+SharedLibraryDataTarget(Xaw3d,$(SOXAWREV),$(UNSHAREDOBJS))
+InstallSharedLibrary(Xaw3d,$(SOXAWREV),$(USRLIBDIR))
+InstallSharedLibraryData(Xaw3d,$(SOXAWREV),$(USRLIBDIR))
+#endif
+#if DoNormalLib
+NormalLibraryTarget(Xaw3d,$(OBJS))
+InstallLibrary(Xaw3d,$(USRLIBDIR))
+#endif
+#if DoProfileLib
+ProfiledLibraryTarget(Xaw3d,$(OBJS))
+InstallLibrary(Xaw3d_p,$(USRLIBDIR))
+#endif
+#if DoDebugLib
+DebuggedLibraryTarget(Xaw3d,$(OBJS))
+InstallLibrary(Xaw3d_d,$(USRLIBDIR))
+#endif
+
+LintLibraryTarget(Xaw3d,$(SRCS))
+InstallLintLibrary(Xaw3d,$(LINTLIBDIR))
+
+BuildIncludes($(HEADERS),Xaw3d,..)
+
+InstallMultiple($(HEADERS),$(INCDIR)/Xaw3d)
+
+XCOMM end make rules for X11R5 ---------------------------
diff --git a/xc/lib/Xaw3d/Label.c b/xc/lib/Xaw3d/Label.c
index b60d0a5..5fd2e32 100644
--- a/xc/lib/Xaw3d/Label.c
+++ b/xc/lib/Xaw3d/Label.c
@@ -53,6 +53,7 @@ SOFTWARE.
*
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xos.h>
@@ -92,8 +93,10 @@ static XtResource resources[] = {
offset(label.foreground), XtRString, XtDefaultForeground},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(label.font),XtRString, XtDefaultFont},
+#ifdef XAW_INTERNATIONALIZATION
{XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ),
offset(label.fontset),XtRString, XtDefaultFontSet},
+#endif
{XtNlabel, XtCLabel, XtRString, sizeof(String),
offset(label.label), XtRString, NULL},
{XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char),
@@ -110,8 +113,6 @@ static XtResource resources[] = {
offset(label.pixmap), XtRImmediate, (XtPointer)None},
{XtNresize, XtCResize, XtRBoolean, sizeof(Boolean),
offset(label.resize), XtRImmediate, (XtPointer)True},
- {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension),
- offset(threeD.shadow_width), XtRImmediate, (XtPointer) 0},
{XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
(XtPointer)1}
@@ -175,7 +176,9 @@ LabelClassRec labelClassRec = {
/* ignore */ 0
}
};
+
WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
+
/****************************************************************
*
* Private Procedures
@@ -261,16 +264,17 @@ static void SetTextWidthAndHeight(lw)
Window root;
int x, y;
unsigned int width, height, bw, depth;
+
if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y,
&width, &height, &bw, &depth)) {
lw->label.label_height = height;
lw->label.label_width = width;
- lw->label.label_len = depth;
+ lw->label.depth = depth;
return;
}
}
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True ) {
-
XFontSet fset = lw->label.fontset;
XFontSetExtents *ext = XExtentsOfFontSet(fset);
@@ -305,8 +309,9 @@ static void SetTextWidthAndHeight(lw)
XmbTextEscapement(fset, lw->label.label, (int) lw->label.label_len);
}
- } else {
-
+ } else
+#endif
+ {
lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent;
if (lw->label.label == NULL) {
lw->label.label_len = 0;
@@ -364,6 +369,7 @@ static void GetnormalGC(lw)
values.font = lw->label.font->fid;
values.graphics_exposures = False;
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
/* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */
lw->label.normal_GC = XtAllocateGC(
@@ -371,6 +377,7 @@ static void GetnormalGC(lw)
(unsigned) GCForeground | GCBackground | GCGraphicsExposures,
&values, GCFont, 0 );
else
+#endif
lw->label.normal_GC = XtGetGC(
(Widget)lw,
(unsigned) GCForeground | GCBackground | GCFont | GCGraphicsExposures,
@@ -393,6 +400,7 @@ static void GetgrayGC(lw)
values.graphics_exposures = False;
lw->label.stipple = values.tile;
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
/* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */
lw->label.gray_GC = XtAllocateGC((Widget)lw, 0,
@@ -401,6 +409,7 @@ static void GetgrayGC(lw)
GCGraphicsExposures,
&values, GCFont, 0);
else
+#endif
lw->label.gray_GC = XtGetGC((Widget)lw,
(unsigned) GCForeground | GCBackground |
GCFont | GCTile | GCFillStyle |
@@ -411,74 +420,70 @@ static void GetgrayGC(lw)
static void compute_bitmap_offsets (lw)
LabelWidget lw;
{
- /*
- * bitmap will be eventually be displayed at
- * (internal_width, internal_height + lbm_y)
- */
- if (lw->label.lbm_height != 0) {
- lw->label.lbm_y = (lw->core.height -
- (lw->threeD.shadow_width * 2 +
- lw->label.internal_height * 2 +
- lw->label.lbm_height)) / 2;
- } else {
+ if (lw->label.lbm_height != 0)
+ lw->label.lbm_y = (lw->core.height - lw->label.lbm_height) / 2;
+ else
lw->label.lbm_y = 0;
- }
}
-
static void set_bitmap_info (lw)
LabelWidget lw;
{
Window root;
int x, y;
- unsigned int bw, depth;
+ unsigned int bw;
- if (!(lw->label.left_bitmap &&
+ if (lw->label.pixmap || !(lw->label.left_bitmap &&
XGetGeometry (XtDisplay(lw), lw->label.left_bitmap, &root, &x, &y,
&lw->label.lbm_width, &lw->label.lbm_height,
- &bw, &depth))) {
+ &bw, &lw->label.depth))) {
lw->label.lbm_width = lw->label.lbm_height = 0;
}
compute_bitmap_offsets (lw);
}
-
-
/* ARGSUSED */
static void Initialize(request, new, args, num_args)
Widget request, new;
ArgList args;
Cardinal *num_args;
{
+ extern WidgetClass commandWidgetClass;
LabelWidget lw = (LabelWidget) new;
+ /* disable shadows if we're not a subclass of Command */
+ if (!XtIsSubclass(new, commandWidgetClass))
+ lw->threeD.shadow_width = 0;
+
if (lw->label.label == NULL)
lw->label.label = XtNewString(lw->core.name);
- else {
+ else
lw->label.label = XtNewString(lw->label.label);
- }
GetnormalGC(lw);
GetgrayGC(lw);
- SetTextWidthAndHeight(lw);
+ SetTextWidthAndHeight(lw); /* label.label or label.pixmap */
if (lw->core.height == 0)
- lw->core.height = lw->label.label_height +
- 2 * lw->label.internal_height +
- 2 * lw->threeD.shadow_width;
+ lw->core.height = lw->label.label_height +
+ 2 * lw->label.internal_height;
- set_bitmap_info (lw); /* need core.height */
+ set_bitmap_info(lw); /* req's core.height, sets label.lbm_* */
- if (lw->core.width == 0) /* need label.lbm_width */
- lw->core.width = (lw->label.label_width +
- 2 * lw->label.internal_width +
- 2 * lw->threeD.shadow_width +
- LEFT_OFFSET(lw));
+ if (lw->label.lbm_height > lw->label.label_height)
+ lw->core.height = lw->label.lbm_height +
+ 2 * lw->label.internal_height;
+
+ if (lw->core.width == 0)
+ lw->core.width = lw->label.label_width +
+ 2 * lw->label.internal_width +
+ LEFT_OFFSET(lw); /* req's label.lbm_width */
lw->label.label_x = lw->label.label_y = 0;
(*XtClass(new)->core_class.resize) ((Widget)lw);
+ lw->label.stippled = lw->label.left_stippled = None;
} /* Initialize */
/*
@@ -494,16 +499,18 @@ static void Redisplay(gw, event, region)
extern WidgetClass commandWidgetClass;
LabelWidget w = (LabelWidget) gw;
LabelWidgetClass lwclass = (LabelWidgetClass) XtClass (gw);
+ Pixmap pm;
GC gc;
/*
- * Don't draw shadows if command is going to redraw them.
+ * Don't draw shadows if Command is going to redraw them.
* The shadow draw method is region aware, but since 99% of
* all labels don't have shadows, we'll check for a shadow
* before we incur the function call overhead.
*/
if (!XtIsSubclass (gw, commandWidgetClass) && w->threeD.shadow_width > 0)
- (*lwclass->threeD_class.shadowdraw) (gw, event, region, True);
+ (*lwclass->threeD_class.shadowdraw) (gw, event, region,
+ w->threeD.relief, True);
/*
* now we'll see if we need to draw the rest of the label
@@ -535,16 +542,32 @@ static void Redisplay(gw, event, region)
/* display left bitmap */
if (w->label.left_bitmap && w->label.lbm_width != 0) {
- XCopyPlane (XtDisplay(gw), w->label.left_bitmap, XtWindow(gw), gc,
- 0, 0, w->label.lbm_width, w->label.lbm_height,
- (int) w->label.internal_width
- + w->threeD.shadow_width,
- (int) w->label.internal_height
- + w->threeD.shadow_width
- + w->label.lbm_y,
- (unsigned long) 1L);
+ pm = w->label.left_bitmap;
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (!XtIsSensitive(gw)) {
+ if (w->label.left_stippled == None)
+ w->label.left_stippled = stipplePixmap(gw,
+ w->label.left_bitmap, w->core.colormap,
+ w->core.background_pixel, w->label.depth);
+ if (w->label.left_stippled != None)
+ pm = w->label.left_stippled;
+ }
+#endif
+
+ if (w->label.depth == 1)
+ XCopyPlane(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ w->label.lbm_width, w->label.lbm_height,
+ (int) w->label.internal_width,
+ (int) w->label.lbm_y,
+ (unsigned long) 1L);
+ else
+ XCopyArea(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ w->label.lbm_width, w->label.lbm_height,
+ (int) w->label.internal_width,
+ (int) w->label.lbm_y);
}
+#ifdef XAW_INTERNATIONALIZATION
if ( w->simple.international == True ) {
XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
@@ -565,7 +588,9 @@ static void Redisplay(gw, event, region)
XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc,
w->label.label_x, ksy, label, len);
- } else { /*international false, so use R5 routine */
+ } else
+#endif
+ { /* international false, so use R5 routine */
if (len == MULTI_LINE_LABEL) {
char *nl;
@@ -592,16 +617,30 @@ static void Redisplay(gw, event, region)
w->label.label_x, y, label, len);
}
- } /*endif international*/
+ } /* endif international */
- } else if (w->label.label_len == 1) { /* depth */
- XCopyPlane(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc,
- 0, 0, w->label.label_width, w->label.label_height,
- w->label.label_x, w->label.label_y, 1L);
} else {
- XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc,
- 0, 0, w->label.label_width, w->label.label_height,
- w->label.label_x, w->label.label_y);
+ pm = w->label.pixmap;
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (!XtIsSensitive(gw)) {
+ if (w->label.stippled == None)
+ w->label.stippled = stipplePixmap(gw,
+ w->label.pixmap, w->core.colormap,
+ w->core.background_pixel, w->label.depth);
+ if (w->label.stippled != None)
+ pm = w->label.stippled;
+ }
+#endif
+
+ if (w->label.depth == 1)
+ XCopyPlane(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ w->label.label_width, w->label.label_height,
+ w->label.label_x, w->label.label_y,
+ 1L);
+ else
+ XCopyArea(XtDisplay(gw), pm, XtWindow(gw), gc, 0, 0,
+ w->label.label_width, w->label.label_height,
+ w->label.label_x, w->label.label_y);
}
#ifdef notdef
@@ -616,34 +655,32 @@ static void _Reposition(lw, width, height, dx, dy)
Position *dx, *dy;
{
Position newPos;
- Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw) +
- lw->threeD.shadow_width;
+ Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw);
switch (lw->label.justify) {
-
- case XtJustifyLeft :
+ case XtJustifyLeft:
newPos = leftedge;
break;
-
- case XtJustifyRight :
- newPos = width -
- (lw->label.label_width
- + lw->label.internal_width
- + lw->threeD.shadow_width);
+ case XtJustifyRight:
+ newPos = width - lw->label.label_width - lw->label.internal_width;
break;
-
- case XtJustifyCenter :
+ case XtJustifyCenter:
default:
newPos = (int)(width - lw->label.label_width) / 2;
break;
}
+
if (newPos < (Position)leftedge)
newPos = leftedge;
*dx = newPos - lw->label.label_x;
lw->label.label_x = newPos;
+
*dy = (newPos = (int)(height - lw->label.label_height) / 2)
- lw->label.label_y;
lw->label.label_y = newPos;
+
+ lw->label.lbm_y = (height - lw->label.lbm_height) / 2;
+
return;
}
@@ -661,10 +698,10 @@ static void Resize(w)
* Set specified arguments into widget
*/
-#define PIXMAP 0
-#define WIDTH 1
-#define HEIGHT 2
-#define NUM_CHECKS 3
+#define PIXMAP 0
+#define WIDTH 1
+#define HEIGHT 2
+#define NUM_CHECKS 3
static Boolean SetValues(current, request, new, args, num_args)
Widget current, request, new;
@@ -679,7 +716,6 @@ static Boolean SetValues(current, request, new, args, num_args)
for (i = 0; i < NUM_CHECKS; i++)
checks[i] = FALSE;
-
for (i = 0; i < *num_args; i++) {
if (streq(XtNbitmap, args[i].name))
checks[PIXMAP] = TRUE;
@@ -689,63 +725,74 @@ static Boolean SetValues(current, request, new, args, num_args)
checks[HEIGHT] = TRUE;
}
- if (newlw->label.label == NULL) {
+ if (newlw->label.label == NULL)
newlw->label.label = newlw->core.name;
+ if (curlw->label.label != newlw->label.label) {
+ if (curlw->label.label != curlw->core.name)
+ XtFree((char *)curlw->label.label);
+ if (newlw->label.label != newlw->core.name)
+ newlw->label.label = XtNewString(newlw->label.label);
+ was_resized = True;
}
- /*
- * resize on bitmap change
- */
- if (curlw->label.left_bitmap != newlw->label.left_bitmap) {
+ if (was_resized || checks[PIXMAP] ||
+ curlw->label.font != newlw->label.font ||
+#ifdef XAW_INTERNATIONALIZATION
+ (curlw->simple.international &&
+ curlw->label.fontset != newlw->label.fontset) ||
+#endif
+ curlw->label.encoding != newlw->label.encoding ||
+ curlw->label.justify != newlw->label.justify) {
+ SetTextWidthAndHeight(newlw); /* label.label or label.pixmap */
was_resized = True;
}
- if (curlw->label.encoding != newlw->label.encoding)
+ if (curlw->label.left_bitmap != newlw->label.left_bitmap ||
+ curlw->label.internal_width != newlw->label.internal_width ||
+ curlw->label.internal_height != newlw->label.internal_height)
was_resized = True;
- if ( (curlw->label.fontset != newlw->label.fontset) &&
- curlw->simple.international ){
- was_resized = True;
- }
- if (curlw->label.label != newlw->label.label) {
- if (curlw->label.label != curlw->core.name)
- XtFree( (char *)curlw->label.label );
+ /* recalculate the window size if something has changed. */
+ if (newlw->label.resize && was_resized) {
+ if (curlw->core.height == reqlw->core.height && !checks[HEIGHT])
+ newlw->core.height = newlw->label.label_height +
+ 2 * newlw->label.internal_height;
- if (newlw->label.label != newlw->core.name) {
- newlw->label.label = XtNewString( newlw->label.label );
- }
- was_resized = True;
- }
+ set_bitmap_info (newlw); /* req's core.height, sets label.lbm_* */
- if (was_resized || (curlw->label.font != newlw->label.font) ||
- (curlw->label.justify != newlw->label.justify) || checks[PIXMAP]) {
+ if (newlw->label.lbm_height > newlw->label.label_height)
+ newlw->core.height = newlw->label.lbm_height +
+ 2 * newlw->label.internal_height;
- SetTextWidthAndHeight(newlw);
- was_resized = True;
+ if (curlw->core.width == reqlw->core.width && !checks[WIDTH])
+ newlw->core.width = newlw->label.label_width +
+ 2 * newlw->label.internal_width +
+ LEFT_OFFSET(newlw); /* req's label.lbm_width */
}
- /* recalculate the window size if something has changed. */
- if (newlw->label.resize && was_resized) {
- if ((curlw->core.height == reqlw->core.height) && !checks[HEIGHT])
- newlw->core.height = (newlw->label.label_height +
- 2 * newlw->label.internal_height +
- 2 * newlw->threeD.shadow_width);
-
- set_bitmap_info (newlw);
-
- if ((curlw->core.width == reqlw->core.width) && !checks[WIDTH])
- newlw->core.width = (newlw->label.label_width +
- LEFT_OFFSET(newlw) +
- 2 * newlw->label.internal_width +
- 2 * newlw->threeD.shadow_width);
+ /* enforce minimum dimensions */
+ if (newlw->label.resize) {
+ if (checks[HEIGHT]) {
+ if (newlw->label.label_height > newlw->label.lbm_height)
+ i = newlw->label.label_height +
+ 2 * newlw->label.internal_height;
+ else
+ i = newlw->label.lbm_height + 2 * newlw->label.internal_height;
+ if (i > newlw->core.height)
+ newlw->core.height = i;
+ }
+ if (checks[WIDTH]) {
+ i = newlw->label.label_width + 2 * newlw->label.internal_width +
+ LEFT_OFFSET(newlw); /* req's label.lbm_width */
+ if (i > newlw->core.width)
+ newlw->core.width = i;
+ }
}
- if (curlw->label.foreground != newlw->label.foreground
- || curlw->core.background_pixel != newlw->core.background_pixel
- || curlw->label.font->fid != newlw->label.font->fid ) {
-
- /* The Fontset is not in the GC - don't make a new GC if FS changes! */
-
+ if (curlw->core.background_pixel != newlw->core.background_pixel ||
+ curlw->label.foreground != newlw->label.foreground ||
+ curlw->label.font->fid != newlw->label.font->fid) {
+ /* the fontset is not in the GC - no new GC if fontset changes */
XtReleaseGC(new, curlw->label.normal_GC);
XtReleaseGC(new, curlw->label.gray_GC);
XmuReleaseStippledPixmap( XtScreen(current), curlw->label.stipple );
@@ -754,11 +801,25 @@ static Boolean SetValues(current, request, new, args, num_args)
redisplay = True;
}
- if ((curlw->label.internal_width != newlw->label.internal_width)
- || (curlw->label.internal_height != newlw->label.internal_height)
- || was_resized) {
- /* Resize() will be called if geometry changes succeed */
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (curlw->label.pixmap != newlw->label.pixmap)
+ {
+ newlw->label.stippled = None;
+ if (curlw->label.stippled != None)
+ XFreePixmap(XtDisplay(current), curlw->label.stippled);
+ }
+ if (curlw->label.left_bitmap != newlw->label.left_bitmap)
+ {
+ newlw->label.left_stippled = None;
+ if (curlw->label.left_stippled != None)
+ XFreePixmap(XtDisplay(current), curlw->label.left_stippled);
+ }
+#endif
+
+ if (was_resized) {
Position dx, dy;
+
+ /* Resize() will be called if geometry changes succeed */
_Reposition(newlw, curlw->core.width, curlw->core.height, &dx, &dy);
}
@@ -775,6 +836,12 @@ static void Destroy(w)
XtFree( lw->label.label );
XtReleaseGC( w, lw->label.normal_GC );
XtReleaseGC( w, lw->label.gray_GC);
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (lw->label.stippled != None)
+ XFreePixmap(XtDisplay(w), lw->label.stippled);
+ if (lw->label.left_stippled != None)
+ XFreePixmap(XtDisplay(w), lw->label.left_stippled);
+#endif
XmuReleaseStippledPixmap( XtScreen(w), lw->label.stipple );
}
@@ -788,11 +855,9 @@ static XtGeometryResult QueryGeometry(w, intended, preferred)
preferred->request_mode = CWWidth | CWHeight;
preferred->width = (lw->label.label_width +
2 * lw->label.internal_width +
- 2 * lw->threeD.shadow_width +
LEFT_OFFSET(lw));
preferred->height = lw->label.label_height +
- 2 * lw->label.internal_height +
- 2 * lw->threeD.shadow_width;
+ 2 * lw->label.internal_height;
if ( ((intended->request_mode & (CWWidth | CWHeight))
== (CWWidth | CWHeight)) &&
intended->width == preferred->width &&
diff --git a/xc/lib/Xaw3d/Label.h b/xc/lib/Xaw3d/Label.h
index 3d930e2..fda186f 100644
--- a/xc/lib/Xaw3d/Label.h
+++ b/xc/lib/Xaw3d/Label.h
@@ -57,6 +57,7 @@ SOFTWARE.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Simple.h>
/* Resources:
@@ -99,13 +100,14 @@ SOFTWARE.
#define XtNencoding "encoding"
#define XtCEncoding "Encoding"
+#ifdef XAW_INTERNATIONALIZATION
#ifndef XtNfontSet
#define XtNfontSet "fontSet"
#endif
-
#ifndef XtCFontSet
#define XtCFontSet "FontSet"
#endif
+#endif
#ifndef _XtStringDefs_h_
#define XtNbitmap "bitmap"
diff --git a/xc/lib/Xaw3d/LabelP.h b/xc/lib/Xaw3d/LabelP.h
index c237b91..e56a004 100644
--- a/xc/lib/Xaw3d/LabelP.h
+++ b/xc/lib/Xaw3d/LabelP.h
@@ -65,6 +65,7 @@ SOFTWARE.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Label.h>
#include <X11/Xaw3d/ThreeDP.h>
@@ -87,7 +88,9 @@ typedef struct {
/* resources */
Pixel foreground;
XFontStruct *font;
+#ifdef XAW_INTERNATIONALIZATION
XFontSet fontset;
+#endif
char *label;
XtJustify justify;
Dimension internal_width;
@@ -101,13 +104,16 @@ typedef struct {
GC normal_GC;
GC gray_GC;
Pixmap stipple;
+ Pixmap stippled; /* insensitive pixmap */
+ Pixmap left_stippled; /* ditto */
Position label_x;
Position label_y;
Dimension label_width;
Dimension label_height;
Dimension label_len;
int lbm_y; /* where in label */
- unsigned int lbm_width, lbm_height; /* size of pixmap */
+ unsigned int lbm_width, lbm_height; /* size of pixmap */
+ unsigned int depth; /* depth of pixmaps */
} LabelPart;
@@ -124,7 +130,7 @@ typedef struct _LabelRec {
LabelPart label;
} LabelRec;
-#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap \
+#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap && (lw)->label.pixmap == None \
? (lw)->label.lbm_width + (lw)->label.internal_width \
: 0)
diff --git a/xc/lib/Xaw3d/List.c b/xc/lib/Xaw3d/List.c
index e37e2ff..aea8720 100644
--- a/xc/lib/Xaw3d/List.c
+++ b/xc/lib/Xaw3d/List.c
@@ -36,14 +36,12 @@ in this Software without prior written authorization from the X Consortium.
* MIT X Consortium
*/
+#include "Xaw3dP.h"
#include <stdio.h>
#include <ctype.h>
-
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
-
#include <X11/Xmu/Drawing.h>
-
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/ListP.h>
@@ -83,8 +81,10 @@ static XtResource resources[] = {
offset(simple.cursor), XtRString, "left_ptr"},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(list.font),XtRString, XtDefaultFont},
+#ifdef XAW_INTERNATIONALIZATION
{XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ),
offset(list.fontset),XtRString, XtDefaultFontSet},
+#endif
{XtNlist, XtCList, XtRPointer, sizeof(char **),
offset(list.list), XtRString, NULL},
{XtNdefaultColumns, XtCColumns, XtRInt, sizeof(int),
@@ -188,19 +188,23 @@ Widget w;
values.foreground = lw->list.foreground;
values.font = lw->list.font->fid;
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
lw->list.normgc = XtAllocateGC( w, 0, (unsigned) GCForeground,
&values, GCFont, 0 );
else
+#endif
lw->list.normgc = XtGetGC( w, (unsigned) GCForeground | GCFont,
&values);
values.foreground = lw->core.background_pixel;
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
lw->list.revgc = XtAllocateGC( w, 0, (unsigned) GCForeground,
&values, GCFont, 0 );
else
+#endif
lw->list.revgc = XtGetGC( w, (unsigned) GCForeground | GCFont,
&values);
@@ -210,10 +214,12 @@ Widget w;
lw->core.depth);
values.fill_style = FillTiled;
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
lw->list.graygc = XtAllocateGC( w, 0, (unsigned) GCTile | GCFillStyle,
&values, GCFont, 0 );
else
+#endif
lw->list.graygc = XtGetGC( w, (unsigned) GCFont | GCTile | GCFillStyle,
&values);
}
@@ -255,10 +261,12 @@ Widget w;
lw->list.longest = 0; /* so it will accumulate real longest below */
for ( i = 0 ; i < lw->list.nitems; i++) {
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
strlen(lw->list.list[i]));
else
+#endif
len = XTextWidth(lw->list.font, lw->list.list[i],
strlen(lw->list.list[i]));
if (len > lw->list.longest)
@@ -370,11 +378,13 @@ Cardinal *num_args;
/* Set row height. based on font or fontset */
+#ifdef XAW_INTERNATIONALIZATION
if (lw->simple.international == True )
lw->list.row_height =
XExtentsOfFontSet(lw->list.fontset)->max_ink_extent.height
+ lw->list.row_space;
else
+#endif
lw->list.row_height = lw->list.font->max_bounds.ascent
+ lw->list.font->max_bounds.descent
+ lw->list.row_space;
@@ -578,7 +588,9 @@ int item;
GC gc;
int x, y, str_y;
ListWidget lw = (ListWidget) w;
+#ifdef XAW_INTERNATIONALIZATION
XFontSetExtents *ext = XExtentsOfFontSet(lw->list.fontset);
+#endif
if (!XtIsRealized(w)) return; /* Just in case... */
@@ -595,9 +607,11 @@ int item;
+ lw->list.internal_height;
}
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
str_y = y + abs(ext->max_ink_extent.y);
else
+#endif
str_y = y + lw->list.font->max_bounds.ascent;
if (item == lw->list.is_highlighted) {
@@ -640,10 +654,12 @@ int item;
ClipToShadowInteriorAndLongest( lw, &gc, x );
+#ifdef XAW_INTERNATIONALIZATION
if ( lw->simple.international == True )
XmbDrawString( XtDisplay( w ), XtWindow( w ), lw->list.fontset,
gc, x, str_y, str, strlen( str ) );
else
+#endif
XDrawString( XtDisplay( w ), XtWindow( w ),
gc, x, str_y, str, strlen( str ) );
@@ -951,7 +967,9 @@ Cardinal *num_args;
ListWidget rl = (ListWidget) request;
ListWidget nl = (ListWidget) new;
Boolean redraw = FALSE;
+#ifdef XAW_INTERNATIONALIZATION
XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset);
+#endif
/* If the request height/width is different, lock it. Unless its 0. If */
/* neither new nor 0, leave it as it was. Not in R5. */
@@ -985,12 +1003,15 @@ Cardinal *num_args;
redraw = TRUE;
}
- if ( ( cl->list.font != nl->list.font ) &&
- ( cl->simple.international == False ) )
- nl->list.row_height = nl->list.font->max_bounds.ascent
- + nl->list.font->max_bounds.descent
- + nl->list.row_space;
-
+ if ( cl->list.font != nl->list.font ) {
+#ifdef XAW_INTERNATIONALIZATION
+ if ( cl->simple.international == False )
+#endif
+ nl->list.row_height = nl->list.font->max_bounds.ascent
+ + nl->list.font->max_bounds.descent
+ + nl->list.row_space;
+ }
+#ifdef XAW_INTERNATIONALIZATION
else if ( ( cl->list.fontset != nl->list.fontset ) &&
( cl->simple.international == True ) )
nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
@@ -999,13 +1020,16 @@ Cardinal *num_args;
if row_space was altered. If one of the above passed, row_height will
already have been re-calculated. */
- else if ( cl->list.row_space != nl->list.row_space ) {
-
+ else
+#endif
+ if ( cl->list.row_space != nl->list.row_space ) {
+#ifdef XAW_INTERNATIONALIZATION
if (cl->simple.international == True )
nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
else
+#endif
nl->list.row_height = nl->list.font->max_bounds.ascent
- + nl->list.font->max_bounds.descent
+ + nl->list.font->max_bounds.descent
+ nl->list.row_space;
}
@@ -1024,7 +1048,9 @@ Cardinal *num_args;
(cl->list.font != nl->list.font) ||
/* Equiv. fontsets might have different values, but the same fonts, so the
next comparison is sloppy but not dangerous. */
+#ifdef XAW_INTERNATIONALIZATION
(cl->list.fontset != nl->list.fontset) ||
+#endif
(cl->list.list != nl->list.list) ) {
CalculatedValues( new );
diff --git a/xc/lib/Xaw3d/List.h b/xc/lib/Xaw3d/List.h
index c9c4ecc..a3d0abc 100644
--- a/xc/lib/Xaw3d/List.h
+++ b/xc/lib/Xaw3d/List.h
@@ -44,6 +44,7 @@ in this Software without prior written authorization from the X Consortium.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Simple.h>
/* Resources:
@@ -135,13 +136,14 @@ in this Software without prior written authorization from the X Consortium.
#define XtNrowSpacing "rowSpacing"
#define XtNverticalList "verticalList"
+#ifdef XAW_INTERNATIONALIZATION
#ifndef XtNfontSet
#define XtNfontSet "fontSet"
#endif
-
#ifndef XtCFontSet
#define XtCFontSet "FontSet"
#endif
+#endif
/* Class record constants */
diff --git a/xc/lib/Xaw3d/ListP.h b/xc/lib/Xaw3d/ListP.h
index d53165e..592ef4c 100644
--- a/xc/lib/Xaw3d/ListP.h
+++ b/xc/lib/Xaw3d/ListP.h
@@ -46,6 +46,7 @@ in this Software without prior written authorization from the X Consortium.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/SimpleP.h>
#include <X11/Xaw3d/List.h>
@@ -81,7 +82,9 @@ typedef struct {
int longest; /* in pixels */
int nitems; /* number of items in the list. */
XFontStruct *font;
+#ifdef XAW_INTERNATIONALIZATION
XFontSet fontset; /* Sheeran, Omron KK, 93/03/05 */
+#endif
String * list; /* for i18n, always in multibyte format */
XtCallbackList callback;
diff --git a/xc/lib/Xaw3d/MultiSrc.c b/xc/lib/Xaw3d/MultiSrc.c
index e89737c..05a6530 100644
--- a/xc/lib/Xaw3d/MultiSrc.c
+++ b/xc/lib/Xaw3d/MultiSrc.c
@@ -60,6 +60,7 @@ in this Software without prior written authorization from the X Consortium.
*
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xfuncs.h>
diff --git a/xc/lib/Xaw3d/Paned.c b/xc/lib/Xaw3d/Paned.c
index 83fccef..babd492 100644
--- a/xc/lib/Xaw3d/Paned.c
+++ b/xc/lib/Xaw3d/Paned.c
@@ -60,21 +60,21 @@ SOFTWARE.
* kit@expo.lcs.mit.edu
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/cursorfont.h>
#include <X11/StringDefs.h>
-
#include <X11/Xmu/Misc.h>
#include <X11/Xmu/Converters.h>
-
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/Grip.h>
#include <X11/Xaw3d/PanedP.h>
+#include <ctype.h>
/* I don't know why Paned.c calls _XawImCallVendorShellExtResize, but... */
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/XawImP.h>
-
-#include <ctype.h>
+#endif
typedef enum {UpLeftPane = 'U', LowRightPane = 'L',
ThisBorderOnly = 'T', AnyPane = 'A' } Direction;
@@ -316,7 +316,9 @@ Dimension * on_size_ret, * off_size_ret;
request.request_mode |= XtCWQueryOnly;
*result_ret = XtMakeGeometryRequest( (Widget) pw, &request, &reply );
+#ifdef XAW_INTERNATIONALIZATION
_XawImCallVendorShellExtResize( (Widget) pw );
+#endif
if ( (newsize == old_size) || (*result_ret == XtGeometryNo) ) {
*on_size_ret = old_size;
diff --git a/xc/lib/Xaw3d/Panner.c b/xc/lib/Xaw3d/Panner.c
index df9abac..2d2f482 100644
--- a/xc/lib/Xaw3d/Panner.c
+++ b/xc/lib/Xaw3d/Panner.c
@@ -44,6 +44,8 @@ extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */
extern double atof(char *);
#endif
+
+#if XtVersion >= 11006
static char defaultTranslations[] =
"<Btn1Down>: start() \n\
<Btn1Motion>: move() \n\
@@ -64,6 +66,22 @@ static char defaultTranslations[] =
:<Key>KP_Down: page(+0,+.5p) \n\
<Key>Home: page(0,0) \n\
:<Key>KP_Home: page(0,0)";
+#else
+static char defaultTranslations[] =
+ "<Btn1Down>: start() \n\
+ <Btn1Motion>: move() \n\
+ <Btn1Up>: notify() stop() \n\
+ <Btn2Down>: abort() \n\
+ <Key>KP_Enter: set(rubberband,toggle) \n\
+ <Key>space: page(+1p,+1p) \n\
+ <Key>Delete: page(-1p,-1p) \n\
+ <Key>BackSpace: page(-1p,-1p) \n\
+ <Key>Left: page(-.5p,+0) \n\
+ <Key>Right: page(+.5p,+0) \n\
+ <Key>Up: page(+0,-.5p) \n\
+ <Key>Down: page(+0,+.5p) \n\
+ <Key>Home: page(0,0)";
+#endif
static void ActionStart(), ActionStop(), ActionAbort(), ActionMove();
diff --git a/xc/lib/Xaw3d/README.XAW3D b/xc/lib/Xaw3d/README.XAW3D
index 6dcaa97..f77be1b 100644
--- a/xc/lib/Xaw3d/README.XAW3D
+++ b/xc/lib/Xaw3d/README.XAW3D
@@ -1,213 +1,544 @@
- Three-D Athena Widgets (Xaw3d)
- Kaleb S. KEITHLEY
- kaleb@opengroup.org
+ The Three-D Athena Toolkit (Xaw3d)
+ ----------------------------------
+
+ This is Release 1.5E of the Xaw3d toolkit (dated March 8, 2003), an
+ update that fixes some bugs, and adds many features. There were no
+ public releases of 1.5A through 1.5D.
+
+ I am not Kaleb Keithley. Kaleb has moved on, and no longer supports
+ Xaw3d; it's my baby now. This distribution is not a fork - it is the
+ latest update of the One True Xaw3d.
+
+ While not as insistant as Kaleb was, I do suggest you include this
+ file, as is, with any product that includes Xaw3d, in whole or in
+ part, in any form. This file is the authoritative documentation for
+ Xaw3d.
+
+ If you discover bugs not already known, do not contact Kaleb; he's had
+ no part in this effort. Feel free to contact me; I'll try to respond
+ in kind. If you're new to the Athena toolkit, understand that it is
+ highly configurable, and some resources will interact (or not) with
+ undesirable results. Some of these are bugs, but many are just the
+ nature of the beast.
+
+ D. J. Hawkey Jr.
+ _________________________________________________________________
+
+ Usage:
+ ------
+
+ This release of Xaw3d is based on X.Org's X11R6.3 Athena toolkit, with
+ bits and pieces thrown in from other sources. It is intended to be a
+ general-purpose replacement for the Athena (Xaw) toolkit.
+
+ In general, you should be able to link almost any Athena-based
+ application to this Xaw3d Athena toolkit, for a three-dimensional
+ appearance on most of the widgets. On systems with shared libraries,
+ you might be able replace your shared libXaw.* with libXaw3d.* to
+ obtain the appearance without even relinking, but the odds of this
+ working is slim, and not recommended.
+
+ Applications written for Xaw3d might have to test the library for a
+ particular feature (see the "Xaw3d build options" section below). To
+ accomodate this, a private header is installed which reflects the
+ library's capabilities. Xaw3dP.h contains four definitions that may be
+ used for this purpose. For example:
+
+ #define XAW_INTERNATIONALIZATION
+ #define XAW_MULTIPLANE_PIXMAPS
+ #define XAW_GRAY_BLKWHT_STIPPLES
+ #undef XAW_ARROW_SCROLLBARS
+
+ Xaw3dP.h need not be included by the application source, as the public
+ headers that reference any 3D features include this header. The
+ default configuration is set up to match the capabilities of X.Org's
+ Xaw toolkit.
+
+ The use of most shadow resources should be intuitive enough, and may
+ be set or read conventionally (e.g., resource files, editres,
+ programatically, etc.). The userData resource may be used to "hang"
+ application-specific data on a widget, but this is accessable to
+ programs only. Other resources and less-than-obvious features are
+ documented throughout this file.
+
+ The default resource values present a not-as-pretty-as-it-could-be
+ appearance, due to stippled shadows (as opposed to allocated colors)
+ in order to conserve colormap space, and by allowing non-rectangular
+ pushbuttons, which are not shadowed. To specify otherwise, set these
+ resources:
+
+ *beNiceToColormap: False
+ *shapeStyle: Rectangle
+
+ You might also want to remove the borders from some widgets:
+
+ *Text.borderWidth: 0
+ *SimpleMenu.borderWidth: 0
+ *Paned.internalBorderWidth: 0
+
+ To revert to reverse-video highlighting in menus:
+
+ *SmeBSB.shadowWidth: 0
+ Note that shadows "grow outward" in the SimpleMenu and Text widgets,
+ increasing these widgets' sizes, "grow inward" in the Viewport and
+ Scrollbar widgets, decreasing the size of the clip widget and thumb,
+ respectively, and "grow inward" in the Label (and superclasses of) and
+ SmeBSB widgets, encroaching on their label parts. Fat shadows will
+ probably mean some futzing with size or margin resources for a proper
+ appearance.
+ _________________________________________________________________
-NOTICE:
+ Xaw3d build requirements:
+ -------------------------
+
+ Many header files have changed since Release 1.5. This means that any
+ installed Xaw3d headers must be removed before building this
+ distribution, to see that these source files include these header
+ files. Renaming the directory that the existing headers live in is
+ sufficient.
+
+ Xaw3d build options:
+ --------------------
+
+ Like Xaw, the default Xaw3d does not accomodate multi-plane pixmaps.
+ However, at the top of this distribution's Imakefile are the lines:
+
+ XCOMM For color pixmaps, define MULTIPLANE_PIXMAPS:
+ #undef MULTIPLANE_PIXMAPS
+
+ If you want color pixmaps, and have Arnaud Le Hors's XPM library
+ installed, change the "#undef" to "#define". You may then specify
+ either XPM or XBM files for any Xaw3d bitmap resource, whether by
+ resource files, with editres, programmatically, etc.. And yes, the
+ transparency of XPM files is honored.
+
+ Note that this enables the use of structures and functions in the XPM
+ library; the XPM library include file (xpm.h) must be available when
+ building Xaw3d, and the XPM library must then be linked to any and all
+ applications that use Xaw3d. This makes Xaw3d dependant on the XPM
+ library, so think twice about it.
+
+ The default stippled shadows used when the beNiceToColormap resource
+ is True work well enough, except for widgets that have black or white
+ backgrounds. So, at the top of this distribution's Imakefile, are the
+ lines:
+
+ XCOMM For grayed stipple shadows, define GRAY_BLKWHT_STIPPLES:
+ #define GRAY_BLKWHT_STIPPLES
+
+ This makes Xaw3d allocate a gray colorcell, and use it in stippled
+ shadows when 1) widgets have black or white backgrounds and 2) the
+ beNiceToColormap resource is True and 3) the display allows it. This
+ option was disabled in previous Xaw3d releases.
+
+ The default Xaw3d does not use arrow scrollbars. At the top of this
+ distribution's Imakefile are the lines:
+
+ XCOMM For scrollbars with arrows, define ARROW_SCROLLBARS:
+ #undef ARROW_SCROLLBARS
- This file must be included with any source or binary version of Xaw3d
- or any Xaw-like library based on Xaw3d. If you hack the sources and
- distribute libraries from your hacked sources, you MUST include this
- file as is, without modification, with your libraries. NO EXCEPTIONS.
+ If you want arrow-style scrollbars, change the "#undef" to "#define".
+ Note that the Scrollbar widget's translations and actions will change
+ accordingly.
+ Building Xaw3d within an X11 source tree:
+ -----------------------------------------
-Features:
+ This distribution expects a configured X11R6.[1-6] source tree (by
+ "configured", I mean that the imake infrastructure has been built).
+ You can use the source from X.Org, XFree86, or the X Project Team.
- This is Release 1.5 (14 May, 1998) of a set of 3-D widgets based
- on the R6.1/R6.3/R6.4 Athena Widget set. The Three-D Athena may be
- used as a general replacement for the Athena (Xaw) Widget set.
+ Change to the directory containing /xc, and issue these commands:
- In general, you may relink almost any Athena Widget based application
- with the Three-D Athena Widget set and obtain a three dimensional
- appearance on some of the widgets. On systems with shared libraries,
- you can usually replace your shared libXaw with libXaw3d and obtain
- the three dimensional appearance without even relinking.
+ # gunzip -c Xaw3d-1.5E.tar.gz | tar -xpf -
+ # cd xc/lib/Xaw3d
+ # ../../config/imake/imake -I../../config/cf \
+ -DTOPDIR=../.. -DCURDIR=lib/Xaw3d
+ # make includes; make depend; make; make install
- Top and bottom shadow colors, shadow width, top and bottom shadow
- contrast should be self explanatory, and may be set via the usual
- and customary methods, e.g. app-defaults, .Xdefaults, programmatically,
- with editres, etc. The user data resource may be used to "hang"
- application specific data on a widget, and is only settable
- programmatically.
+ The Imakefile uses the Xaw symbols in /xc/config/cf, so if you have
+ debug, shared, profile, etc. libraries specified for Xaw, Xaw3d will
+ have them as well.
+ Building Xaw3d without an X11 source tree:
+ ------------------------------------------
-Changes in this release:
+ Near the top of this distribution's Imakefile are the lines:
- Some bug fixes.
+ XCOMM When building outside an X11 source tree:
+ XCOMM EXTRA_INCLUDES = -I.
+ Uncomment the second line by deleting the "XCOMM ". Then, while still
+ in /xc/lib/Xaw3d, issue these commands:
-Known problems:
+ # mkdir X11; cd X11; ln -fs .. Xaw3d; cd ..
+ # xmkmf; make depend; make; make install
- o You may not be be able to replace shared libXaw with libXaw3d on
- systems with SVR3 style shared libraries.
+ If this works for you, great. If not, well, happy hacking.
- o Xaw3d pixel allocation doesn't behave well when beNiceToColormap
- is False and the Default Colormap is full.
+ Building Xaw3d under X11R5:
+ ---------------------------
- o The samples in Layout.h are wrong and don't work. Example programs
- written by Keith Packard that use the Layout widget are available
- on ftp://ftp.x.org/R5contrib/Layout.tar.Z
+ I don't know that Xaw3d will build within an X11R5 source tree, so try
+ the "Building Xaw3d without an X11 source tree" instructions. If the
+ "make" command results in nothing being built, find these lines about
+ half-way into this distribution's Imakefile:
- o The lexer in the Layout widget doesn't work well when a program
- that uses the Layout widget is linked with GNU malloc. This
- is a problem on older releases of Linux, where the libc malloc
- is GNU malloc. It's also a problem on older releases of FreeBSD
- if you have specified "ExtraLibraries -lgnumalloc" in your imake
- config FreeBSD.cf file. (Undoubtedly this is also a problem on the
- other BSDen too, but I don't know this for a fact.) The solution
- for FreeBSD is to delete the ExtraLibraries in your vendor.cf file,
- or edit the Makefile to not link with -lgnumalloc. I don't have a
- solution for Linux users, nor do I have the time (or the inclination)
- to track this down. If you do, and you discover a fix, you're more
- than welcome to send it to me.
+ XCOMM At least one X11R5 distribution needs this:
+ XCOMM #include "Imakefrag.X11R5"
- o If your program subclasses Athena's Simple or Sme classes, or
- subclasses thereof, then there's a definite chance that Xaw3d
- isn't source-code compatible with your widgets. Sorry. I have no
- plans to fix this.
+ Uncomment the second line by deleting the "XCOMM ", and re-issue the
+ "xmkmf; make depend; make; make install" commands. This line will
+ insert the quoted file into the Makefile, and is for when the imake
+ configuration files don't create the appropriate rules.
+ Xaw3d and Internationalization:
+ -------------------------------
-Notes on Building Xaw3d Outside an X Source Tree:
+ The Imakefile depends on a conventional system-wide definition for
+ including or omitting I18n support (i.e., "XawI18nDefines"). If the
+ Imakefile erroneously disables support for I18n (see the generated
+ Xaw3dP.h file), I can only suggest searching your imake configuration
+ files for a definition that enables support for "wide characters" (try
+ `egrep 'WCHAR|WCTYPE|XMBTOWC|ISW_FUNCS' *`), and then, about half-way
+ into this distribution's Imakefile, find these lines:
- The source is intended to be built inside an R6.[134] source tree.
- You can use an X Consortium source tree (R6.1, R6.3), an X Project
- Team source tree (R6.4), or any XFree86 source tree that corresponds
- to one of the X Consortium or X Project Team source trees.
+ #ifdef XawI18nDefines
+ #define INTERNATIONALIZATION
+ HEADERS = $(BASE_HDRS) $(I18N_HDRS)
+ SRCS = $(BASE_SRCS) $(I18N_SRCS)
+ OBJS = $(BASE_OBJS) $(I18N_OBJS)
+ ...
+
+ Change the label in the first line to the label of the definition you
+ found. If no suitable definition is found, and I18n really is
+ supported, it's likely implemented in such a way that Xaw3d probably
+ won't include I18n support without some hacking at the Imakefile or
+ Makefile.
+ _________________________________________________________________
- You might be able to build it outside the source tree, but if you
- try, (pay attention here) YOU'RE ON YOUR OWN. Don't send me email
- about it. Don't send me email telling me you "...know you're on
- your own, but..." It's hard enough to find time to put out these
- releases, I don't have time for handholding if you choose to
- disregard this advice.
+ New in 1.5A:
+ ------------
- If you don't have a source tree, for whatever reason, plan on using
- binaries built by someone else. I'm sorry, that's just the way it has
- to be.
+ The SimpleMenu widget now supports scrolling through entries too
+ numerous to fit on the screen, with a new resource supporting a scroll
+ jump value. The record variable is simple_menu.jump_val, resourced as
+ XtNjumpScroll, and classed as XtCJumpScroll. Adapted from an early
+ neXtaw toolkit.
- Some people have written to me and told me that if you add the
- following line to the Imakefile:
+ Added 3D support to the SimpleMenu, Text, and Viewport widgets.
- EXTRA_INCLUDES=-I.
+ Four minor changes in ThreeD.c and SmeThreeD.c to have the widgets use
+ the app's colormap, rather than the screen's default, for those apps
+ that create their own.
- then you can build it anywhere you want, i.e. outside the R6 source
- tree. If this works for you, great. If not, see above. To simplify
- things a bit I've already added this line to the Imakefile. Just
- uncomment it (by deleting the '#' at the beginning of the line.
+ Added the deletion of laygram.h to the Imakefile.
+ Created Xaw3dP.c, for functions shared by other modules that have no
+ other appropriate home.
-Additions, bug-fixes, improvements, etc.:
-
- Many people have written to me with enhancements and bug fixes.
- If your enhancement or bug fix didn't make it into this release
- then please understand that I'm very busy with other work and I
- have very little time to devote to Xaw3d. Your enhancement may
- appear in some future release.
-
-
-xterm:
-
- A comment that appears in the xterm source:
- *
- * ...There be serious and nasty dragons here.
- *
-
- xterm is, well, xterm. The auto-scroll in the arrow-style scrollbar
- doesn't work in xterm because it relies on XtTimeouts. xterm, perhaps
- in the name of speed, circumvents XtAppNextEvent() and goes direct to
- XNextEvent() to get it's XEvents, with the unfortunate side effect of
- completely ignoring "other sources" like timeouts. At this time I
- do not have a patch to fix the R6 xterm. There is a patch to the R5
- xterm on ftp://ftp.x.org/contrib/widgets/Xaw3d/R5. It shouldn't be
- hard to integrate it into the R6 sources.
-
-
-Getting:
-
- Xaw3d may be found on:
-
- ftp://ftp.x.org/contrib/widgets/Xaw3d/R6.3/Xaw3d-1.5.tar.gz
-
- and mirror sites around the world.
-
-
-Building:
-
- Untar the distribution from the base of your X Consortium or XFree86
- source tree with the command:
-
- `gunzip -c Xaw3d-1.5.tar.gz | tar xpf -`
-
- or (if your system's tar supports the 'z' option)
-
- `tar xzpf Xaw3d-1.5.tar.gz`
-
-
- (PAY ATTENTION HERE: If you don't know where the base of your
- source tree is, don't send me email asking -- I don't know where
- you put it. If you don't know, my guess is that you don't have one.)
-
- This will create the directory .../xc/lib/Xaw3d. 'cd' there and
- enter the following commands:
-
- `../../config/imake/imake -I../../config/cf -DTOPDIR=../.. -DCURRENTDIR=lib/Xaw3d`
- `make includes; make depend; make; make install`
-
-
-Building with Arrow Scrollbars:
-
- The default Xaw3d does not use arrow scrollbars. The Imakefile
- contains the line:
-
- # EXTRA_DEFINES = -DARROW_SCROLLBAR -DUSEGRAY
-
- If you want the arrow-scrollbar, then uncomment the line by deleting
- the '#'. -DUSEGRAY will do something different with the shadows. If
- you don't want it, edit the line accordingly.
-
- The Imakefile uses the Xaw symbols in .../xc/config/cf, so if you have
- debugging, profiling, shared libs, etc. specified for Xaw, you'll get
- them in Xaw3d too.
-
-
-Using:
-
- Just relink your Xaw based application with -lXaw3d.
-
- To obtain an appearance similar to another well know widget set, use the
- following resources:
- *background: LightSkyBlue
- *shapeStyle: Rectangle
- *beNiceToColormap: False
-
- By default, Label widgets do not have shadows drawn for them. You can
- force shadows to be drawn for specifying:
- *Label*shadowWidth: 2
-
- If you'd like the default behavior (i.e. not 3-D) on pulldown menus, use:
- *SmeBSB*shadowWidth: 0
-
-
-Credits (in chronological order of their contribution):
-
- All the people at the X Consortium
-
- Achille Hui (eillihca@drizzle.stanford.edu)
- Robert Withrow (witr@rwwa.com)
- Malcolm Strickland (chuck-strickland@orl.mmc.com
- David Flanagan (david@ora.com)
- Jamie Zawinski (jwz@netscape.com)
- Frank Terhaar-Yonkers (fty@bizarre.trpnc.epa.gov)
- Mike Schulze (mike@cs.curtin.edu.au)
- Gustaf Neumann (neumann@mohegan.wi-inf.uni-essen.de)
- Jerry Whelan (guru@stasi.bradley.edu)
- Mark Rawling (mwr@mel.dit.csiro.au)
- Tim Theisen (tim@cs.wisc.edu)
- Mitch Trachtenberg (mitch@mta.com)
- Keith Packard (keithp@ncd.com)
- Dimitrios P. Bouras (dbouras@hol.gr)
- Uri Blumenthal (uri@watson.ibm.com)
- Heiko Schroeder (heiko@pool.informatik.rwth-aachen.de)
+ A new directory containing sample resource files for a few apps. See
+ the README.AD file in that directory.
+
+ New in 1.5B:
+ ------------
+
+ Made Imakefile a bit more friendly to build options. Makefile now
+ defines the build options in Xaw3dP.h during the build.
+
+ Added to the key translation tables in Panner.c and TextTr.c, and some
+ rules to Imakefile, to make this distribution X11R5 compliant. Tested
+ on exactly one X11R5 system; your mileage may vary.
+
+ Made internationalization support conditional, for systems lacking or
+ broken. Tested on exactly two systems, one with and one without; your
+ mileage may vary.
+
+ New in 1.5C:
+ ------------
+
+ Enabled multi-plane pixmap support with a new Xt resource type
+ converter. The "Xaw3d build options" section has more information.
+ Added private Pixmap resources to the Label and SmeBSB widgets for
+ stippled copies of the public Pixmap resources (record variables
+ label.stippled, label.right_stippled, sme_bsb.left_stippled, and
+ sme_bsb.right_stippled, respectively). Insensitive pixmaps are now
+ rendered properly.
+
+ New in 1.5D:
+ ------------
+
+ Added two resources to the SimpleMenu widget for setting margins. The
+ SmeBSB widgets have a tighter relationship with their parent and
+ siblings; menus and their entries now respond properly to changes in
+ themselves or their parent. See the section "The SimpleMenu widget and
+ margins" below for a detailed explanation.
+
+ New in 1.5E:
+ ------------
+
+ Enabled a new resource in the ThreeD widget to specify one of five
+ shadow types. The record variable is threeD.relief (the record part is
+ transparent), resourced as XtNRelief and classed as XtCRelief. It
+ accepts as values XtReliefNone, XtReliefRaised, XtReliefSunken,
+ XtReliefRidge, and XtReliefGroove. Note that the Text, SimpleMenu,
+ Scrollbar, and Viewport widgets ignore this resource, and display only
+ raised or sunken shadows. Built on the unfinished work of an early
+ neXtaw toolkit.
+
+ Added support for sub-menus in the SimpleMenu widget. Inspired by the
+ xfig application, adapted from XFree86's X11R6.6 "Xaw7" toolkit, and
+ made better than both. See the section "The SimpleMenu widget and
+ sub-menus" below for usage.
+
+ Added a resource to the SmeBSB widget to specify an underlined
+ character in the label. The record variable is sme_bsb.underline,
+ resourced as XtNunderline, and classed as XtCUnderline. It accepts an
+ integer as an index to the character; a value less than zero or
+ greater than or equal to the label length inhibits underlining.
+ Adapted from a recent distribution of the xfig application.
+
+ Made the SmeThreeD widget sensitive to the GRAY_BLKWHT_STIPPLES build
+ option (see the "Xaw3d build options" section for what this is and
+ does).
+
+ Added support for "tooltips". Inspired by the xfig application and
+ adapted from XFree86's X11R6.6 "Xaw7" toolkit. See the section "The
+ Tip widget" below for usage.
+
+ Fixed some geometry and positioning bugs in the Label widget. It's
+ internalHeight and internalWidth resources are now used to enforce a
+ minimum size when it's resize resource is True. The Label (and
+ superclasses of) widget now resizes properly to changes in label parts
+ and internal margins (subject to any constraints placed on the
+ widgets, of course).
+
+ Swapped the top and bottom colors in the stippled pixmap shadows.
+
+ Fixed a shadow drawing bug in the Command widget, when the shape is
+ changed.
+
+ Fixed the shadow state bug in the SmeBSB widget.
+
+ Dropped support for Linux shared a.out libraries.
+ _________________________________________________________________
+
+ Bugs and deficiencies:
+ ----------------------
+
+ You may not be be able to replace shared libXaw.* libraries with
+ libXaw3d.* libraries on systems with SVR3-style shared libraries.
+
+ The lexer in the Layout widget doesn't work well when a program that
+ uses the Layout widget is linked with GNU's malloc(). This is a
+ problem on older releases of Linux, where the libc malloc() is is GNU
+ malloc(). It's also a problem on older releases of FreeBSD if
+ "ExtraLibraries -lgnumalloc" is specified in imake's FreeBSD.cf
+ configuration file (this may be a problem on other BSDs too, but I
+ don't know this as fact). The solution under FreeBSD is to delete the
+ "ExtraLibraries" line(s) in the vendor.cf configuration file, or edit
+ the Makefile to not link with "-lgnumalloc". I don't have a solution
+ for older Linux distributions, nor do I have the time (or inclination)
+ to figure one out. If you discover a fix, you're more than welcome to
+ send it in.
+
+ The samples in Layout.h are wrong and don't work. Example programs
+ written by Keith Packard that use the Layout widget are available at
+ ftp://ftp.x.org/R5contrib/.
+
+ If an application subclasses Athena's Simple or Sme classes, or
+ subclasses thereof, there is a high probability that Xaw3d isn't
+ source compatible. Sorry, I have no plans (or ideas) on how to fix
+ this.
+
+ Xaw3d pixel allocation may not behave well when beNiceToColormap is
+ False and the colormap (default or application) is full.
+
+ Non-rectangular Command widgets are not rendered with shadows.
+
+ All geometry management routines should fully account for shadow
+ widths, but some don't, and it can show.
+
+ A few bugs and ambiguities in the Athena toolkit from which this
+ distribution is derived have been resolved. While trying to be true to
+ Athena documentation, these changes may make Xaw3d behave oddly for
+ some applications. Nothing that can't be fixed by tweaking the
+ appropriate resources, I'll wager.
+
+ A comment that appears in the xterm source:
+ -------------------------------------------
+
+ *
+ * ...There be serious and nasty dragons here.
+ *
+
+ xterm is, well, xterm. The auto-scroll with arrow-style scrollbars
+ won't work in xterm because it relies on timeouts. xterm, perhaps for
+ speed, circumvents XtAppNextEvent() by using XNextEvent() to get its X
+ events, with the unfortunate side effect of completely ignoring "other
+ sources", like timeouts. At this time there is no patch to fix the
+ X11R6 xterm, but there is a patch for the X11R5 xterm at
+ ftp://ftp.x.org/contrib/widgets/Xaw3d/R5/; it shouldn't be too hard to
+ integrate it into the X11R6 sources.
+ _________________________________________________________________
+
+ The SimpleMenu widget and margins:
+ ----------------------------------
+
+ Two resources have been added to the SimpleMenu widget for margin
+ management. The record variables are simple_menu.left_whitespace and
+ simple_menu.right_whitespace, resourced as XtNleftWhitespace and
+ XtNrightWhitespace, and classed as - yup - XtCLeftWhitespace and
+ XtCRightWhitespace. They can be also be referenced together by the
+ class XtCHorizontalWhitespace.
+
+ To illustrate, the leftMargin resource can be different values in each
+ SmeBSB widget, and SimpleMenu will oblige. If a pixmap wider than the
+ margin is specified in any SmeBSB widget, the result is less than
+ desirable (refer to ORA X, Vol 5 Sec 6, SmeBSB.*Bitmap and
+ SmeBSB.*Margin). Set the leftWhitespace resource in the parent
+ SimpleMenu widget, and SimpleMenu will set all children SmeBSB
+ leftMargins to that value. Specify a pixmap of any width for any
+ SmeBSB child, and SimpleMenu will separate the elements (menu edge,
+ pixmap, and text) of all SmeBSB children with that minimum distance as
+ it vertically aligns their text elements.
+
+ The SimpleMenu widget now resizes not only to the above, but also to
+ changes in these SmeBSB traits: Labels and fonts, pixmaps, and
+ margins.
+
+ Implementation notes: The SimpleMenu *Whitespace resources override
+ and replace the values of SmeBSB *Margin resources. To nullify this
+ behavior, a *Whitespace resource must first be set to zero, and the
+ corresponding *Margin resources then set appropriately. The *Margin
+ resources remain unchanged in and of themselves; they behave just as
+ always when the *Whitespace resources are not used.
+
+ The SimpleMenu widget and sub-menus:
+ ------------------------------------
+
+ Resources have been added to the SimpleMenu and SmeBSB widgets to
+ support sub-menus. The record variables are simple_menu.sub_menu and
+ simple_menu.state (neither are public), and sme_bsb.menu_name, which
+ is resourced as XtNmenuName, and classed as XtCMenuName. It's the
+ latter resource that is used by an application, and by default it is
+ NULL; menus behave as they always have. When this resource is set to a
+ menu name, the parent SimpleMenu widget will use the SmeBSB widget as
+ the entry point to a child SimpleMenu widget, managing it's visibility
+ and location. No constraints are placed on focus or the pointer.
+ Consider this code fragment:
+
+ /* create a menu button */
+ opsbutton = XtCreateManagedWidget("ops", menuButtonWidgetClass,
+ parent, NULL, 0);
+
+ /* create a menu for the button */
+ opsmenu = XtCreatePopupShell("opsMenu", simpleMenuWidgetClass,
+ opsbutton, NULL, 0);
+ XtSetArg(args[0], XtNmenuName, "fileMenu");
+ XtSetArg(args[1], XtNrightBitmap, rightArrow);
+ filebutton = XtCreateManagedWidget("file", smeBSBObjectClass,
+ opsmenu, args, 2);
+ XtSetArg(args[0], XtNmenuName, "pageMenu");
+ XtSetArg(args[1], XtNrightBitmap, rightArrow);
+ pagebutton = XtCreateManagedWidget("page", smeBSBObjectClass,
+ opsmenu, args, 2);
+ quitbutton = XtCreateManagedWidget("quit", smeBSBObjectClass,
+ opsmenu, NULL, 0);
+
+ /* create a sub-menu for the first menu item */
+ filemenu = XtCreatePopupShell("fileMenu", simpleMenuWidgetClass,
+ opsmenu, NULL, 0);
+ openbutton = XtCreateManagedWidget("open", smeBSBObjectClass,
+ filemenu, NULL, 0);
+ printbutton = XtCreateManagedWidget("print", smeBSBObjectClass,
+ filemenu, NULL, 0);
+
+ /* create a sub-menu for the second menu item */
+ pagemenu = XtCreatePopupShell("pageMenu", simpleMenuWidgetClass,
+ opsmenu, NULL, 0);
+ prevbutton = XtCreateManagedWidget("prev", smeBSBObjectClass,
+ pagemenu, NULL, 0);
+ nextbutton = XtCreateManagedWidget("next", smeBSBObjectClass,
+ pagemenu, NULL, 0);
+
+ The SimpleMenu widget named "opsMenu" will inherit the SimpleMenu
+ widgets named "fileMenu" and "pageMenu" as children sub-menus. It will
+ position the first sub-menu next to the SmeBSB widget named "file",
+ and the second next to the SmeBSB widget named "page". A sub-menu will
+ be mapped (or unmapped) when the pointer enters (or leaves) the
+ superior SmeBSB widget. Note that a sub-menu's parent must be the
+ superior SimpleMenu widget, not the superior SmeBSB widget. The other
+ resources of SmeBSB widgets are unaffected by the menuName resource.
+
+ The Tip widget:
+ ---------------
+
+ This Tip widget is not compatable with XFree86's "Xaw7" Tip widget. I
+ couldn't grok how it links the specified widgets to a Tip widget, nor
+ how their labels are set. Perhaps it's all done with an "Xaw7"
+ DisplayList, I don't know. So, this XawTipEnable() function requires a
+ second parameter, to set the label:
+
+ /* create a menu button */
+ opsbutton = XtCreateManagedWidget("ops", menuButtonWidgetClass,
+ parent, NULL, 0);
+
+ /* add a tooltip */
+ XawTipEnable(opsbutton, "Application functions");
+
+ ...
+
+ /* for some reason, disable the tooltip */
+ XawTipDisable(opsbutton);
+
+ The XawTipEnable() function creates a Tip widget (one per screen, as
+ required), and links the specified widget and label to the correct Tip
+ widget. Nothing else is required of the application; Tip widgets
+ manage themselves. The XawTipDisable() function removes the timeout
+ and event handler, and unmaps the Tip window if necessary, but does
+ not destroy the widget or its linked list.
+
+ Note that the labels of Tip widgets are set individually, but the
+ font, colors, margins, etc., can only be set globally, for all Tip
+ widget instances. For example, a resource file might contain:
+
+ *Tip.font: 7x13bold
+ *Tip.background: yellow
+ *Tip.foreground: blue
+ *Tip.borderColor: blue
+
+ Note also that the *Margin resources of XFree86's "Xaw7" Tip widget
+ are not in this Tip widget; they have been reduced to internalHeight
+ and internalWidth resources, like those of the Label widget.
+ _________________________________________________________________
+
+ Authors and contributors, in alphabetical order:
+ ------------------------------------------------
+
+ Uri Blumenthal <uri@watson.ibm.com>
+ Dimitrios P. Bouras <dbouras@hol.gr>
+ David Flanagan <david@ora.com>
+ D. J. Hawkey Jr. <hawkeyd@visi.com>, current maintainer
+ Achille Hui <eillihca@drizzle.stanford.edu>
+ Kaleb S. Keithley <kaleb@keithley.org>, developed and maintained Xaw3d
+ Alfredo Kojima
+ Gustaf Neumann <neumann@mohegan.wi-inf.uni-essen.de>
+ Keith Packard <keithp@ncd.com>
+ Mark Rawling <mwr@mel.dit.csiro.au>
+ Heiko Schroeder <heiko@pool.informatik.rwth-aachen.de>
+ Mike Schulze <mike@cs.curtin.edu.au>
+ Brian V. Smith <bvsmith@lbl.gov>
+ Malcolm Strickland <chuck-strickland@orl.mmc.com>
+ Frank Terhaar-Yonkers <fty@bizarre.trpnc.epa.gov>
+ Tim Theisen <tim@cs.wisc.edu>
+ Mitch Trachtenberg <mitch@mta.com>
+ Jerry Whelan <guru@stasi.bradley.edu>
+ Robert Withrow <witr@rwwa.com>
+ Jamie Zawinski <jwz@netscape.com>
+
+ And, of course, all the people at X.Org and XFree86.
diff --git a/xc/lib/Xaw3d/Scrollbar.c b/xc/lib/Xaw3d/Scrollbar.c
index 3c5d2ef..c105688 100644
--- a/xc/lib/Xaw3d/Scrollbar.c
+++ b/xc/lib/Xaw3d/Scrollbar.c
@@ -57,6 +57,8 @@ SOFTWARE.
/* created by weissman, Mon Jul 7 13:20:03 1986 */
/* converted by swick, Thu Aug 27 1987 */
+#include "Xaw3dP.h"
+
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
@@ -67,7 +69,7 @@ SOFTWARE.
/* Private definitions. */
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
static char defaultTranslations[] =
"<Btn1Down>: NotifyScroll()\n\
<Btn2Down>: MoveThumb() NotifyThumb() \n\
@@ -95,7 +97,7 @@ static float floatZero = 0.0;
#define Offset(field) XtOffsetOf(ScrollbarRec, field)
static XtResource resources[] = {
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
/* {XtNscrollCursor, XtCCursor, XtRCursor, sizeof(Cursor),
Offset(scrollbar.cursor), XtRString, "crosshair"},*/
#else
@@ -147,7 +149,7 @@ static void Resize();
static void Redisplay();
static Boolean SetValues();
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
static void HandleThumb();
#else
static void StartScroll();
@@ -158,7 +160,7 @@ static void NotifyScroll();
static void EndScroll();
static XtActionsRec actions[] = {
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
{"HandleThumb", HandleThumb},
#else
{"StartScroll", StartScroll},
@@ -233,7 +235,7 @@ static void ClassInitialize()
(XtConvertArgList)NULL, (Cardinal)0 );
}
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
/* CHECKIT #define MARGIN(sbw) (sbw)->scrollbar.thickness + (sbw)->threeD.shadow_width */
#define MARGIN(sbw) (sbw)->scrollbar.thickness
#else
@@ -287,99 +289,6 @@ static void FillArea (sbw, top, bottom, fill)
}
}
-
-
-/* _ShadowSurroundedBox is somewhat redundant with
- _Xaw3dDrawShadows (gw, event, region, out)
- in ThreeD.c; however, it is more general and allows to
- specify the boxsize of the shawdowbox explicitely. In order
- to keep the changes in other parts of Xaw3d to Kaleb's distribution
- minimal, we define it here instead of as a method in the ThreeD class.
-
- -gustaf */
-
-/* ARGSUSED */
-static void
-_ShadowSurroundedBox (gw, event, region, xtl, ytl, xbr, ybr, out)
- Widget gw;
- XEvent *event;
- Region region;
- Dimension xtl, ytl, xbr, ybr; /* INNER corners */
- Boolean out;
-{
- XPoint pt[6];
- ThreeDWidget tdw = (ThreeDWidget) gw;
- Dimension s = tdw->threeD.shadow_width;
-
- /*
- * no point to do anything if the shadow_width is 0 or the
- * widget has not been realized.
- */
- if((s > 0) && XtIsRealized (gw)){
-
- Dimension xms = xtl - s;
- Dimension yms = ytl - s;
- Dimension xps = xbr + s;
- Dimension yps = ybr + s;
- Display *dpy = XtDisplay (gw);
- Window win = XtWindow (gw);
- GC top, bot;
-
- if (out) {
- top = tdw->threeD.top_shadow_GC;
- bot = tdw->threeD.bot_shadow_GC;
- } else {
- top = tdw->threeD.bot_shadow_GC;
- bot = tdw->threeD.top_shadow_GC;
- }
- /* Draw shadows. Points are numbered as follows:
- *
- * 1_________________________________ 2
- * | / /|
- * | / / |
- * | 4_________________________/ / |
- * | | 3| |
-
- * | | | |
- * | | | |
- * | | | |
- * | |5_________________________| |
- * | / / 4 |
- * | / / |
- * |/ /_______________________________|
- * 3 1
- */
-
- /* points common to top and bottom shadow */
- pt[0].x = xms; pt[0].y = yps;
- pt[2].x = xps; pt[2].y = yms;
- pt[3].x = xbr; pt[3].y = ytl;
- pt[5].x = xtl; pt[5].y = ybr;
-
- /* top-left shadow */
- if ((region == NULL) ||
- (XRectInRegion (region, xms, yms, xps, ytl) != RectangleOut) ||
- (XRectInRegion (region, xms, yms, xtl, yps) != RectangleOut)) {
-
- pt[1].x = xms; pt[1].y = yms;
- pt[4].x = xtl; pt[4].y = ytl;
- XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin);
- }
-
- /* bottom-right shadow */
- if ((region == NULL) ||
- (XRectInRegion (region, xms, ybr, xps, yps) != RectangleOut) ||
- (XRectInRegion (region, xbr, yms, xps, yps) != RectangleOut)) {
-
- /* swap points from top left to bottom right */
- pt[1].x = xps; pt[1].y = yps;
- pt[4].x = xbr; pt[4].y = ybr;
- XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin);
- }
- }
-}
-
-
/* Paint the thumb in the area specified by sbw->top and
sbw->shown. The old area is erased. The painting and
erasing is done cleverly so that no flickering will occur. */
@@ -422,20 +331,15 @@ static void PaintThumb (sbw, event)
if (sbw->scrollbar.orientation == XtorientHorizontal)
{
- _ShadowSurroundedBox(
- sbw, event,
- (Region)NULL,
- newtop + s, 2 * s,
- newbot - s, sbw->core.height - 2 * s, TRUE);
+ _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw,
+ newtop, s, newbot, sbw->core.height - s,
+ sbw->threeD.relief, TRUE);
}
else
{
- _ShadowSurroundedBox(
- sbw, event,
- (Region)NULL,
- 2 * s, newtop + s,
- sbw->core.width - 2 * s, newbot - s,
- TRUE);
+ _ShadowSurroundedBox((Widget)sbw, (ThreeDWidget)sbw,
+ s, newtop, sbw->core.width - s, newbot,
+ sbw->threeD.relief, TRUE);
}
}
else
@@ -453,7 +357,7 @@ static void PaintThumb (sbw, event)
}
}
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
static void PaintArrows (sbw)
ScrollbarWidget sbw;
{
@@ -560,7 +464,7 @@ static void Destroy (w)
Widget w;
{
ScrollbarWidget sbw = (ScrollbarWidget) w;
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
if(sbw->scrollbar.timer_id != (XtIntervalId) 0)
XtRemoveTimeOut (sbw->scrollbar.timer_id);
#endif
@@ -648,9 +552,11 @@ static void Initialize( request, new, args, num_args )
? sbw->scrollbar.thickness : sbw->scrollbar.length;
SetDimensions (sbw);
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
sbw->scrollbar.scroll_mode = 0;
sbw->scrollbar.timer_id = (XtIntervalId)0;
+#else
+ sbw->scrollbar.direction = 0;
#endif
sbw->scrollbar.topLoc = 0;
sbw->scrollbar.shownLength = sbw->scrollbar.min_thumb;
@@ -662,7 +568,7 @@ static void Realize (w, valueMask, attributes)
XSetWindowAttributes *attributes;
{
ScrollbarWidget sbw = (ScrollbarWidget) w;
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
if(sbw->simple.cursor_name == NULL)
XtVaSetValues(w, XtNcursorName, "crosshair", NULL);
/* dont set the cursor of the window to anything */
@@ -744,7 +650,7 @@ static void Redisplay (w, event, region)
int x, y;
unsigned int width, height;
- (*swclass->threeD_class.shadowdraw) (w, event, region, FALSE);
+ (*swclass->threeD_class.shadowdraw) (w, event, region, sbw->threeD.relief, FALSE);
if (sbw->scrollbar.orientation == XtorientHorizontal) {
x = sbw->scrollbar.topLoc;
@@ -763,7 +669,7 @@ static void Redisplay (w, event, region)
sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1);
PaintThumb (sbw, event);
}
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
/* we'd like to be region aware here!!!! */
PaintArrows (sbw);
#endif
@@ -870,7 +776,7 @@ static void ExtractPosition (event, x, y)
}
}
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
/* ARGSUSED */
static void HandleThumb (w, event, params, num_params)
Widget w;
@@ -914,7 +820,7 @@ static void RepeatNotify (client_data, idp)
client_data);
}
-#else /* ARROW_SCROLLBAR */
+#else /* XAW_ARROW_SCROLLBARS */
/* ARGSUSED */
static void StartScroll (w, event, params, num_params )
Widget w;
@@ -959,14 +865,14 @@ static void StartScroll (w, event, params, num_params )
XtVaSetValues (w, XtNcursor, cursor, NULL);
XFlush (XtDisplay (w));
}
-#endif /* ARROW_SCROLLBAR */
+#endif /* XAW_ARROW_SCROLLBARS */
/*
* Make sure the first number is within the range specified by the other
* two numbers.
*/
-#ifndef ARROW_SCROLLBAR
+#ifndef XAW_ARROW_SCROLLBARS
static int InRange(num, small, big)
int num, small, big;
{
@@ -985,7 +891,7 @@ static float FloatInRange(num, small, big)
}
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
static void NotifyScroll (w, event, params, num_params)
Widget w;
XEvent *event;
@@ -1034,7 +940,7 @@ static void NotifyScroll (w, event, params, num_params)
}
return;
}
-#else /* ARROW_SCROLLBAR */
+#else /* XAW_ARROW_SCROLLBARS */
static void NotifyScroll (w, event, params, num_params)
Widget w;
XEvent *event;
@@ -1083,7 +989,7 @@ static void NotifyScroll (w, event, params, num_params)
break;
}
}
-#endif /* ARROW_SCROLLBAR */
+#endif /* XAW_ARROW_SCROLLBARS */
/* ARGSUSED */
static void EndScroll(w, event, params, num_params )
@@ -1094,7 +1000,7 @@ static void EndScroll(w, event, params, num_params )
{
ScrollbarWidget sbw = (ScrollbarWidget) w;
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
sbw->scrollbar.scroll_mode = 0;
/* no need to remove any autoscroll timeout; it will no-op */
/* because the scroll_mode is 0 */
@@ -1134,7 +1040,7 @@ static void MoveThumb (w, event, params, num_params)
Position x, y;
float loc, t, s;
-#ifndef ARROW_SCROLLBAR
+#ifndef XAW_ARROW_SCROLLBARS
if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */
#endif
@@ -1146,7 +1052,7 @@ static void MoveThumb (w, event, params, num_params)
loc = FractionLoc (sbw, x, y);
t = sbw->scrollbar.top;
s = sbw->scrollbar.shown;
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
if (sbw->scrollbar.scroll_mode != 2 )
/* initialize picked position */
sbw->scrollbar.picked = (FloatInRange( loc, t, t + s ) - t);
@@ -1160,9 +1066,12 @@ static void MoveThumb (w, event, params, num_params)
if (sbw->scrollbar.top < 0.0) sbw->scrollbar.top = 0.0;
}
+#if 0
+ /* this breaks many text-line scrolls */
if (sbw->scrollbar.top + sbw->scrollbar.shown > 1.0)
sbw->scrollbar.top = 1.0 - sbw->scrollbar.shown;
-#ifdef ARROW_SCROLLBAR
+#endif
+#ifdef XAW_ARROW_SCROLLBARS
sbw->scrollbar.scroll_mode = 2; /* indicate continuous scroll */
#endif
PaintThumb (sbw, event);
@@ -1180,7 +1089,7 @@ static void NotifyThumb (w, event, params, num_params )
register ScrollbarWidget sbw = (ScrollbarWidget) w;
float top = sbw->scrollbar.top;
-#ifndef ARROW_SCROLLBAR
+#ifndef XAW_ARROW_SCROLLBARS
if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */
#endif
@@ -1189,7 +1098,7 @@ static void NotifyThumb (w, event, params, num_params )
/* thumbProc is not pretty, but is necessary for backwards
compatibility on those architectures for which it work{s,ed};
the intent is to pass a (truncated) float by value. */
-#ifdef ARROW_SCROLLBAR
+/* #ifdef XAW_ARROW_SCROLLBARS */
/* This corrects for rounding errors: If the thumb is moved to the end of
the scrollable area sometimes the last line/column is not displayed.
This can happen when the integer number of the top line or leftmost
@@ -1204,8 +1113,11 @@ static void NotifyThumb (w, event, params, num_params )
there is no problem since in this case there is always a constant
integer number of pixels the thumb must be moved in order to scroll
to the next line/column. */
+ /* Removed the dependancy on scrollbar arrows. Xterm as distributed in
+ X11R6.6 by The XFree86 Project wants this correction, with or without
+ the arrows. */
top += 0.0001;
-#endif
+/* #endif */
XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top);
XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top);
}
@@ -1240,7 +1152,7 @@ void XawScrollbarSetThumb (w, top, shown)
w,top,shown);
#endif
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
if (sbw->scrollbar.scroll_mode == (char) 2) return; /* if still thumbing */
#else
if (sbw->scrollbar.direction == 'c') return; /* if still thumbing */
@@ -1252,6 +1164,6 @@ void XawScrollbarSetThumb (w, top, shown)
sbw->scrollbar.shown = (shown > 1.0) ? 1.0 :
(shown >= 0.0) ? shown : sbw->scrollbar.shown;
- PaintThumb (sbw);
+ PaintThumb (sbw, NULL);
}
diff --git a/xc/lib/Xaw3d/ScrollbarP.h b/xc/lib/Xaw3d/ScrollbarP.h
index 445387d..d4c8b72 100644
--- a/xc/lib/Xaw3d/ScrollbarP.h
+++ b/xc/lib/Xaw3d/ScrollbarP.h
@@ -58,6 +58,7 @@ SOFTWARE.
#ifndef _ScrollbarP_h
#define _ScrollbarP_h
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Scrollbar.h>
#include <X11/Xaw3d/ThreeDP.h>
@@ -69,7 +70,7 @@ typedef struct {
XtCallbackList thumbProc; /* jump (to position) scroll */
XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */
Pixmap thumb; /* thumb color */
-#ifndef ARROW_SCROLLBAR
+#ifndef XAW_ARROW_SCROLLBARS
Cursor upCursor; /* scroll up cursor */
Cursor downCursor; /* scroll down cursor */
Cursor leftCursor; /* scroll left cursor */
@@ -86,7 +87,7 @@ typedef struct {
* when scrolling starts */
/* private */
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
XtIntervalId timer_id; /* autorepeat timer; remove on destruction */
char scroll_mode; /* 0:none 1:up/back 2:track 3:down/forward */
#else
diff --git a/xc/lib/Xaw3d/Simple.c b/xc/lib/Xaw3d/Simple.c
index 63d7188..29cbbc8 100644
--- a/xc/lib/Xaw3d/Simple.c
+++ b/xc/lib/Xaw3d/Simple.c
@@ -48,6 +48,7 @@ SOFTWARE.
******************************************************************/
+#include "Xaw3dP.h"
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
@@ -68,8 +69,10 @@ static XtResource resources[] = {
offset(pointer_bg), XtRString, XtDefaultBackground},
{XtNcursorName, XtCCursor, XtRString, sizeof(String),
offset(cursor_name), XtRString, NULL},
+#ifdef XAW_INTERNATIONALIZATION
{XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean),
offset(international), XtRImmediate, (XtPointer) FALSE},
+#endif
#undef offset
};
@@ -239,7 +242,9 @@ static Boolean SetValues(current, request, new, args, num_args)
Boolean new_cursor = FALSE;
/* this disables user changes after creation*/
+#ifdef XAW_INTERNATIONALIZATION
s_new->simple.international = s_old->simple.international;
+#endif
if ( XtIsSensitive(current) != XtIsSensitive(new) )
(*((SimpleWidgetClass)XtClass(new))->
diff --git a/xc/lib/Xaw3d/Simple.h b/xc/lib/Xaw3d/Simple.h
index 982ba33..7be83b1 100644
--- a/xc/lib/Xaw3d/Simple.h
+++ b/xc/lib/Xaw3d/Simple.h
@@ -51,6 +51,7 @@ SOFTWARE.
#ifndef _Simple_h
#define _Simple_h
+#include "Xaw3dP.h"
#include <X11/Xmu/Converters.h>
/****************************************************************
@@ -87,13 +88,14 @@ SOFTWARE.
#define XtCInsensitive "Insensitive"
+#ifdef XAW_INTERNATIONALIZATION
#ifndef XtCInternational
#define XtCInternational "International"
#endif
-
#ifndef XtNinternational
#define XtNinternational "international"
#endif
+#endif
typedef struct _SimpleClassRec *SimpleWidgetClass;
typedef struct _SimpleRec *SimpleWidget;
diff --git a/xc/lib/Xaw3d/SimpleMenP.h b/xc/lib/Xaw3d/SimpleMenP.h
index 80d299e..4ecb187 100644
--- a/xc/lib/Xaw3d/SimpleMenP.h
+++ b/xc/lib/Xaw3d/SimpleMenP.h
@@ -68,6 +68,8 @@ typedef struct _SimpleMenuPart {
Dimension top_margin; /* Top and bottom margins. */
Dimension bottom_margin;
+ Dimension left_whitespace; /* Space between BSB elements */
+ Dimension right_whitespace;
Dimension row_height; /* height of each row (menu entry) */
Cursor cursor; /* The menu's cursor. */
@@ -86,6 +88,18 @@ typedef struct _SimpleMenuPart {
SmeObject entry_set; /* The entry that is currently set or
highlighted. */
+
+ Widget threeD; /* 3d drawing stuff */
+
+ SmeObject *first_entry; /* the first entry */
+ SmeObject *current_first; /* the first entry displayed */
+ Dimension last_y;
+ int first_y; /* Dimension doesn't do negatives! */
+ int jump_val; /* number of entries to scroll by */
+ Boolean too_tall; /* menu doesn't fit on screen */
+ Boolean didnt_fit; /* if some entry didn't fit in the menu */
+ Widget sub_menu; /* submenu of active SmeBSB object */
+ unsigned char state;
} SimpleMenuPart;
typedef struct _SimpleMenuRec {
diff --git a/xc/lib/Xaw3d/SimpleMenu.c b/xc/lib/Xaw3d/SimpleMenu.c
index a51c34e..87a3170 100644
--- a/xc/lib/Xaw3d/SimpleMenu.c
+++ b/xc/lib/Xaw3d/SimpleMenu.c
@@ -36,13 +36,17 @@ in this Software without prior written authorization from the X Consortium.
*/
#include <stdio.h>
+#include <limits.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
+#include "Xaw3dP.h"
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/SimpleMenP.h>
-#include <X11/Xaw3d/SmeBSB.h>
+#include <X11/Xaw3d/SmeBSBP.h>
+#include <X11/Xaw3d/SmeLine.h>
#include <X11/Xaw3d/Cardinals.h>
+#include <X11/Xaw3d/ThreeDP.h>
#include <X11/Xmu/Initer.h>
#include <X11/Xmu/CharSet.h>
@@ -72,6 +76,10 @@ static XtResource resources[] = {
offset(top_margin), XtRImmediate, (XtPointer) 0},
{XtNbottomMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension),
offset(bottom_margin), XtRImmediate, (XtPointer) 0},
+ {XtNleftWhitespace, XtCHorizontalWhitespace, XtRDimension, sizeof(Dimension),
+ offset(left_whitespace), XtRImmediate, (XtPointer) 0},
+ {XtNrightWhitespace, XtCHorizontalWhitespace, XtRDimension, sizeof(Dimension),
+ offset(right_whitespace), XtRImmediate, (XtPointer) 0},
/*
* Misc. Resources
@@ -89,14 +97,16 @@ static XtResource resources[] = {
{XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int),
offset(backing_store),
XtRImmediate, (XtPointer) (Always + WhenMapped + NotUseful)},
+ {XtNjumpScroll, XtCJumpScroll, XtRInt, sizeof(int),
+ offset(jump_val), XtRImmediate, (XtPointer)1},
};
#undef offset
static char defaultTranslations[] =
- ":<EnterWindow>: highlight() \n\
- :<LeaveWindow>: unhighlight() \n\
- :<BtnMotion>: highlight() \n\
- :<BtnUp>: MenuPopdown() notify() unhighlight()";
+ "<EnterWindow>: highlight() \n\
+ <LeaveWindow>: unhighlight() \n\
+ <BtnMotion>: highlight() \n\
+ <BtnUp>: notify() unhighlight() popdown()";
/*
* Semi Public function definitions.
@@ -106,12 +116,14 @@ static void Redisplay(), Realize(), Resize(), ChangeManaged();
static void Initialize(), ClassInitialize(), ClassPartInitialize();
static Boolean SetValues(), SetValuesHook();
static XtGeometryResult GeometryManager();
+static void PopupCB(), PopupSubMenu(), PopdownSubMenu();
/*
* Action Routine Definitions
*/
static void Highlight(), Unhighlight(), Notify(), PositionMenuAction();
+static void Popdown();
/*
* Private Function Definitions.
@@ -119,6 +131,7 @@ static void Highlight(), Unhighlight(), Notify(), PositionMenuAction();
static void MakeSetValuesRequest(), CreateLabel(), Layout();
static void AddPositionAction(), PositionMenu(), ChangeCursorOnGrab();
+static void SetMarginWidths();
static Dimension GetMenuWidth(), GetMenuHeight();
static Widget FindMenu();
static SmeObject GetEventEntry();
@@ -129,6 +142,7 @@ static XtActionsRec actionsList[] =
{"notify", Notify},
{"highlight", Highlight},
{"unhighlight", Unhighlight},
+ {"popdown", Popdown}
};
static CompositeClassExtensionRec extension_rec = {
@@ -192,11 +206,15 @@ SimpleMenuClassRec simpleMenuClassRec = {
WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec;
+#define SMW_ARROW_SIZE 8
+#define SMW_UNMAPPING 0x01
+#define SMW_POPLEFT 0x02
+
#define ForAllChildren(smw, childP) \
- for ( (childP) = (SmeObject *) (smw)->composite.children ; \
- (childP) < (SmeObject *) ( (smw)->composite.children + \
- (smw)->composite.num_children ) ; \
- (childP)++ )
+ for ((childP) = (SmeObject *) (smw)->composite.children; \
+ (childP) < (SmeObject *) ((smw)->composite.children + \
+ (smw)->composite.num_children); \
+ (childP)++)
/************************************************************
*
@@ -260,16 +278,30 @@ Cardinal *num_args;
XmuCallInitializers(XtWidgetToApplicationContext(new));
- if (smw->simple_menu.label_class == NULL)
- smw->simple_menu.label_class = smeBSBObjectClass;
-
smw->simple_menu.label = NULL;
smw->simple_menu.entry_set = NULL;
smw->simple_menu.recursive_set_values = FALSE;
+ smw->simple_menu.first_entry = NULL;
+ smw->simple_menu.current_first = NULL;
+ smw->simple_menu.first_y = 0;
+ smw->simple_menu.too_tall = FALSE;
+ smw->simple_menu.sub_menu = NULL;
+ smw->simple_menu.state = 0;
+
+ XtAddCallback(new, XtNpopupCallback, PopupCB, NULL);
+
+ if (smw->simple_menu.label_class == NULL)
+ smw->simple_menu.label_class = smeBSBObjectClass;
if (smw->simple_menu.label_string != NULL)
CreateLabel(new);
+ /* GetMenuHeight() needs this */
+ smw->simple_menu.threeD = XtVaCreateWidget("threeD", threeDWidgetClass,
+ new,
+ XtNx, 0, XtNy, 0, XtNwidth, /* dummy */ 10, XtNheight, /* dummy */ 10,
+ NULL);
+
smw->simple_menu.menu_width = TRUE;
if (smw->core.width == 0) {
@@ -284,10 +316,7 @@ Cardinal *num_args;
smw->core.height = GetMenuHeight(new);
}
-/*
- * Add a popup_callback routine for changing the cursor.
- */
-
+ /* add a popup_callback routine for changing the cursor */
XtAddCallback(new, XtNpopupCallback, ChangeCursorOnGrab, (XtPointer)NULL);
}
@@ -306,35 +335,115 @@ Widget w;
XEvent * event;
Region region;
{
- SimpleMenuWidget smw = (SimpleMenuWidget) w;
- SmeObject * entry;
+ SimpleMenuWidget smw = (SimpleMenuWidget)w;
+ SmeObject *entry;
SmeObjectClass class;
+ ThreeDWidget tdw = (ThreeDWidget)smw->simple_menu.threeD;
+ RectObjPart old_pos;
+ int y, max_y, new_y, dy, s = tdw->threeD.shadow_width;
+ Boolean can_paint;
+ XPoint point[3];
if (region == NULL)
XClearWindow(XtDisplay(w), XtWindow(w));
- /*
- * Check and Paint each of the entries - including the label.
- */
+ if (XtIsRealized((Widget)smw))
+ _ShadowSurroundedBox((Widget)smw, tdw,
+ 0, 0, smw->core.width, smw->core.height,
+ tdw->threeD.relief, True);
+
+ smw->simple_menu.didnt_fit = False;
+ y = 0;
+ max_y = HeightOfScreen(XtScreen(w)) - s;
+ new_y = -(*(SmeObject *)(smw)->composite.children)->rectangle.y;
+ can_paint = False;
+
+ /* check and paint each of the entries - including the label */
+ ForAllChildren(smw, entry)
+ {
+ if (!XtIsManaged((Widget)*entry)) continue;
+
+ if (smw->simple_menu.first_entry == NULL)
+ {
+ smw->simple_menu.first_entry = entry;
+ smw->simple_menu.current_first = entry;
+ }
- ForAllChildren(smw, entry) {
- if (!XtIsManaged ( (Widget) *entry)) continue;
+ if (smw->simple_menu.too_tall)
+ {
+ dy = 0;
+
+ if (entry == (smw->simple_menu.current_first))
+ {
+ new_y = (*entry)->rectangle.y - 1;
+
+ if (smw->simple_menu.current_first != smw->simple_menu.first_entry)
+ {
+ point[0].x = (*entry)->rectangle.width / 2;
+ point[0].y = s + 1;
+ point[1].x = (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
+ point[1].y = s + SMW_ARROW_SIZE;
+ point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
+ point[2].y = s + SMW_ARROW_SIZE;
+ XFillPolygon(XtDisplay(w), smw->core.window,
+ tdw->threeD.bot_shadow_GC, point, 3, Convex,
+ CoordModeOrigin);
+
+ new_y -= SMW_ARROW_SIZE;
+ dy = SMW_ARROW_SIZE;
+ }
+
+ smw->simple_menu.first_y = new_y;
+ can_paint = True;
+ }
+ else if (!can_paint)
+ continue;
- if (region != NULL)
- switch(XRectInRegion(region, (int) (*entry)->rectangle.x,
- (int) (*entry)->rectangle.y,
- (unsigned int) (*entry)->rectangle.width,
- (unsigned int) (*entry)->rectangle.height)) {
- case RectangleIn:
- case RectanglePart:
+ old_pos = (*entry)->rectangle;
+ (*entry)->rectangle.y -= new_y;
+
+ if ((*entry)->rectangle.y + (*entry)->rectangle.height + dy > max_y)
+ {
+ smw->simple_menu.last_y = (*entry)->rectangle.y;
+ point[0].x = (*entry)->rectangle.width / 2;
+ point[0].y = max_y - 1;
+ point[1].x = (*entry)->rectangle.width / 2 - SMW_ARROW_SIZE / 2;
+ point[1].y = max_y - SMW_ARROW_SIZE;
+ point[2].x = (*entry)->rectangle.width / 2 + SMW_ARROW_SIZE / 2;
+ point[2].y = max_y - SMW_ARROW_SIZE;
+ XFillPolygon(XtDisplay(w), smw->core.window,
+ tdw->threeD.bot_shadow_GC, point, 3, Convex,
+ CoordModeOrigin);
+
+ smw->simple_menu.didnt_fit = True;
+ (*entry)->rectangle = old_pos;
break;
- default:
- continue;
}
- class = (SmeObjectClass) (*entry)->object.widget_class;
+ }
+
+ /*
+ if (region != NULL)
+ switch (XRectInRegion(region,
+ (int)(*entry)->rectangle.x, (int)(*entry)->rectangle.y,
+ (unsigned int)(*entry)->rectangle.width,
+ (unsigned int)(*entry)->rectangle.height))
+ {
+ case RectangleIn:
+ case RectanglePart:
+ break;
+ default:
+ continue;
+ }
+ */
+
+ class = (SmeObjectClass)(*entry)->object.widget_class;
if (class->rect_class.expose != NULL)
- (class->rect_class.expose)( (Widget) *entry, NULL, NULL);
+ (class->rect_class.expose)((Widget)*entry, NULL, NULL);
+
+ if (smw->simple_menu.too_tall) (*entry)->rectangle = old_pos;
+
+ y += (*entry)->rectangle.height;
}
}
@@ -365,12 +474,18 @@ XSetWindowAttributes * attrs;
else
*mask &= ~CWBackingStore;
+ /* check if the menu is too big */
+ if (smw->core.height >= HeightOfScreen(XtScreen(w))) {
+ smw->simple_menu.too_tall = TRUE;
+ smw->core.height = HeightOfScreen(XtScreen(w));
+ }
+
(*superclass->core_class.realize) (w, mask, attrs);
}
/* Function Name: Resize
- * Description: Handle the menu being resized bigger.
- * Arguments: w - the simple menu widget.
+ * Description: Handle the menu being resized.
+ * Arguments: w - the simple menu widget or any of its object children.
* Returns: none.
*/
@@ -378,16 +493,20 @@ static void
Resize(w)
Widget w;
{
- SimpleMenuWidget smw = (SimpleMenuWidget) w;
- SmeObject * entry;
+ /*
+ * The sole purpose of this function is to force an initial
+ * layout by handling a call from some child widget. Ick.
+ */
- if ( !XtIsRealized(w) ) return;
+ if (XtIsSubclass(w, smeBSBObjectClass))
+ {
+ Widget parent = XtParent(w);
- ForAllChildren(smw, entry) /* reset width of all entries. */
- if (XtIsManaged( (Widget) *entry))
- (*entry)->rectangle.width = smw->core.width;
-
- Redisplay(w, (XEvent *) NULL, (Region) NULL);
+ if (!XtIsRealized(parent))
+ XtRealizeWidget(parent);
+
+ Layout(w, (Dimension *)NULL, (Dimension *)NULL);
+ }
}
/* Function Name: SetValues
@@ -449,6 +568,16 @@ Cardinal *num_args;
ret_val = TRUE;
}
+ if (smw_old->simple_menu.left_whitespace != smw_new->simple_menu.left_whitespace) {
+ layout = TRUE;
+ ret_val = TRUE;
+ }
+
+ if (smw_old->simple_menu.right_whitespace != smw_new->simple_menu.right_whitespace) {
+ layout = TRUE;
+ ret_val = TRUE;
+ }
+
if (layout)
Layout(new, (Dimension *)NULL, (Dimension *)NULL);
@@ -542,11 +671,12 @@ XtWidgetGeometry * request, * reply;
if ( (reply->width == request->width) &&
(reply->height == request->height) ) {
- if ( mode & XtCWQueryOnly ) { /* Actually perform the layout. */
+ if ( mode & XtCWQueryOnly ) {
entry->rectangle.width = old_width;
entry->rectangle.height = old_height;
}
else {
+ /* Actually perform the layout */
Layout(( Widget) smw, (Dimension *)NULL, (Dimension *)NULL);
}
answer = XtGeometryDone;
@@ -678,14 +808,36 @@ String * params;
Cardinal * num_params;
{
SimpleMenuWidget smw = (SimpleMenuWidget) w;
+ SimpleMenuWidget sub = (SimpleMenuWidget) smw->simple_menu.sub_menu;
SmeObject entry = smw->simple_menu.entry_set;
SmeObjectClass class;
+ int old_pos;
- if ( entry == NULL) return;
+ if (entry == NULL || entry == GetEventEntry(w, event)) {
+ smw->simple_menu.entry_set = NULL;
+ PopdownSubMenu(smw);
+ return;
+ }
+
+ if (event->xcrossing.y < 0 || event->xcrossing.y >= (int)smw->core.height)
+ PopdownSubMenu(smw);
+ else if (sub &&
+ ((event->xcrossing.x < 0 &&
+ !(sub->simple_menu.state & SMW_POPLEFT)) ||
+ (event->xcrossing.x >= (int)smw->core.width &&
+ (sub->simple_menu.state & SMW_POPLEFT))))
+ PopdownSubMenu(smw);
smw->simple_menu.entry_set = NULL;
class = (SmeObjectClass) entry->object.widget_class;
- (class->sme_class.unhighlight) ( (Widget) entry);
+
+ /* backup, then restore, original entry position */
+ old_pos = entry->rectangle.y;
+ entry->rectangle.y -= smw->simple_menu.first_y;
+
+ (class->sme_class.unhighlight) ((Widget) entry);
+
+ entry->rectangle.y = old_pos;
}
/* Function Name: Highlight
@@ -707,26 +859,38 @@ Cardinal * num_params;
SimpleMenuWidget smw = (SimpleMenuWidget) w;
SmeObject entry;
SmeObjectClass class;
+ int old_pos;
- if ( !XtIsSensitive(w) ) return;
+ if (!XtIsSensitive(w)) return;
entry = GetEventEntry(w, event);
+ if (entry == smw->simple_menu.entry_set)
+ return;
- if (entry == smw->simple_menu.entry_set) return;
-
- Unhighlight(w, event, params, num_params);
-
- if (entry == NULL) return;
+ PopdownSubMenu(smw);
+ Unhighlight(w, event, params, num_params);
- if ( !XtIsSensitive( (Widget) entry)) {
+ if (entry == NULL)
+ return;
+ if (!XtIsSensitive((Widget) entry)) {
smw->simple_menu.entry_set = NULL;
return;
}
- smw->simple_menu.entry_set = entry;
- class = (SmeObjectClass) entry->object.widget_class;
+ if (!(smw->simple_menu.state & SMW_UNMAPPING)) {
+ smw->simple_menu.entry_set = entry;
+ class = (SmeObjectClass) entry->object.widget_class;
+
+ /* backup, then restore, original entry position */
+ old_pos = entry->rectangle.y;
+ entry->rectangle.y -= smw->simple_menu.first_y;
+
+ (class->sme_class.highlight) ((Widget) entry);
+ if (XtIsSubclass((Widget)entry, smeBSBObjectClass))
+ PopupSubMenu(smw);
- (class->sme_class.highlight) ( (Widget) entry);
+ entry->rectangle.y = old_pos;
+ }
}
/* Function Name: Notify
@@ -894,66 +1058,80 @@ Dimension *width_ret, *height_ret;
{
SmeObject current_entry, *entry;
SimpleMenuWidget smw;
+ ThreeDWidget tdw;
Dimension width, height;
- Boolean do_layout = ((height_ret == NULL) || (width_ret == NULL));
+ Boolean do_layout = (height_ret == NULL || width_ret == NULL);
Boolean allow_change_size;
height = 0;
- if ( XtIsSubclass(w, simpleMenuWidgetClass) ) {
- smw = (SimpleMenuWidget) w;
+ if (XtIsSubclass(w, simpleMenuWidgetClass))
+ {
+ smw = (SimpleMenuWidget)w;
current_entry = NULL;
}
- else {
- smw = (SimpleMenuWidget) XtParent(w);
- current_entry = (SmeObject) w;
+ else
+ {
+ smw = (SimpleMenuWidget)XtParent(w);
+ current_entry = (SmeObject)w;
}
+ tdw = (ThreeDWidget)smw->simple_menu.threeD;
- allow_change_size = (!XtIsRealized((Widget)smw) ||
- (smw->shell.allow_shell_resize));
+ do_layout |= (current_entry != NULL);
+ allow_change_size =
+ (!XtIsRealized((Widget)smw) || smw->shell.allow_shell_resize);
- if ( smw->simple_menu.menu_height )
+ if (smw->simple_menu.menu_height)
height = smw->core.height;
- else
- if (do_layout) {
- height = smw->simple_menu.top_margin;
- ForAllChildren(smw, entry) {
- if (!XtIsManaged( (Widget) *entry)) continue;
-
- if ( (smw->simple_menu.row_height != 0) &&
- (*entry != smw->simple_menu.label) )
- (*entry)->rectangle.height = smw->simple_menu.row_height;
-
- (*entry)->rectangle.y = height;
- (*entry)->rectangle.x = 0;
- height += (*entry)->rectangle.height;
- }
- height += smw->simple_menu.bottom_margin;
- }
- else {
- if ((smw->simple_menu.row_height != 0) &&
- (current_entry != smw->simple_menu.label) )
- height = smw->simple_menu.row_height;
+ else if (do_layout)
+ {
+ height = smw->simple_menu.top_margin + tdw->threeD.shadow_width;
+
+ ForAllChildren(smw, entry)
+ {
+ if (!XtIsManaged((Widget)*entry)) continue;
+
+ if (smw->simple_menu.row_height != 0 &&
+ *entry != smw->simple_menu.label)
+ (*entry)->rectangle.height = smw->simple_menu.row_height;
+
+ (*entry)->rectangle.y = height;
+ (*entry)->rectangle.x = 0;
+ height += (*entry)->rectangle.height;
}
+
+ height += smw->simple_menu.bottom_margin + tdw->threeD.shadow_width;
+ }
+ else if (smw->simple_menu.row_height != 0 &&
+ current_entry != smw->simple_menu.label)
+ {
+ height = smw->simple_menu.row_height * smw->composite.num_children;
+ height += tdw->threeD.shadow_width * 2;
+ }
if (smw->simple_menu.menu_width)
width = smw->core.width;
- else if ( allow_change_size )
- width = GetMenuWidth((Widget) smw, (Widget) current_entry);
+ else if (allow_change_size)
+ {
+ SetMarginWidths((Widget)smw);
+
+ width = GetMenuWidth((Widget)smw, (Widget)NULL);
+ }
else
width = smw->core.width;
- if (do_layout) {
+ if (do_layout)
+ {
ForAllChildren(smw, entry)
- if (XtIsManaged( (Widget) *entry))
+ if (XtIsManaged((Widget)*entry))
(*entry)->rectangle.width = width;
if (allow_change_size)
MakeSetValuesRequest((Widget) smw, width, height);
}
- else {
+ else
+ {
*width_ret = width;
- if (height != 0)
- *height_ret = height;
+ if (height != 0) *height_ret = height;
}
}
@@ -1064,9 +1242,8 @@ MoveMenu(w, x, y)
Widget w;
Position x, y;
{
- Arg arglist[2];
- Cardinal num_args = 0;
SimpleMenuWidget smw = (SimpleMenuWidget) w;
+ Arg arglist[2];
if (smw->simple_menu.menu_on_screen) {
int width = w->core.width + 2 * w->core.border_width;
@@ -1089,9 +1266,9 @@ Position x, y;
y = 0;
}
- XtSetArg(arglist[num_args], XtNx, x); num_args++;
- XtSetArg(arglist[num_args], XtNy, y); num_args++;
- XtSetValues(w, arglist, num_args);
+ XtSetArg(arglist[0], XtNx, x);
+ XtSetArg(arglist[1], XtNy, y);
+ XtSetValues(w, arglist, TWO);
}
/* Function Name: ChangeCursorOnGrab
@@ -1135,15 +1312,15 @@ Widget w;
Dimension width, height;
{
SimpleMenuWidget smw = (SimpleMenuWidget) w;
- Arg arglist[2];
- Cardinal num_args = (Cardinal) 0;
if ( !smw->simple_menu.recursive_set_values ) {
if ( (smw->core.width != width) || (smw->core.height != height) ) {
+ Arg arglist[2];
+
smw->simple_menu.recursive_set_values = TRUE;
- XtSetArg(arglist[num_args], XtNwidth, width); num_args++;
- XtSetArg(arglist[num_args], XtNheight, height); num_args++;
- XtSetValues(w, arglist, num_args);
+ XtSetArg(arglist[0], XtNwidth, width);
+ XtSetArg(arglist[1], XtNheight, height);
+ XtSetValues(w, arglist, TWO);
}
else if (XtIsRealized( (Widget) smw))
Redisplay((Widget) smw, (XEvent *) NULL, (Region) NULL);
@@ -1151,9 +1328,68 @@ Dimension width, height;
smw->simple_menu.recursive_set_values = FALSE;
}
+/*
+ * Function Name: SetMarginWidths()
+ * Description: Set new margin values for all menu children.
+ * Arguments: w - the simple menu widget
+ * w_ent - the current menu entry
+ */
+static void
+SetMarginWidths(w)
+Widget w;
+{
+ SimpleMenuWidget smw = (SimpleMenuWidget)w;
+ SmeObject *entry;
+ SmeBSBObject bsb_entry;
+ Dimension l_mrgn, l_bmw, r_mrgn, r_bmw;
+
+ if (smw->simple_menu.left_whitespace || smw->simple_menu.right_whitespace)
+ {
+ /* determine the widest bitmaps */
+ l_bmw = r_bmw = (Dimension)0;
+ ForAllChildren(smw, entry)
+ {
+ if (!XtIsManaged((Widget)*entry)) continue;
+ if (*entry == smw->simple_menu.label) continue;
+ if (XtIsSubclass((Widget)*entry, smeLineObjectClass))
+ continue;
+
+ bsb_entry = (SmeBSBObject)&((*entry)->object);
+ if (bsb_entry->sme_bsb.left_bitmap_width > l_bmw)
+ l_bmw = bsb_entry->sme_bsb.left_bitmap_width;
+ if (bsb_entry->sme_bsb.right_bitmap_width > r_bmw)
+ r_bmw = bsb_entry->sme_bsb.right_bitmap_width;
+ }
+
+ /* set the margin values */
+ if (smw->simple_menu.left_whitespace)
+ l_mrgn = l_bmw +
+ (smw->simple_menu.left_whitespace * ((l_bmw) ? 2 : 1));
+ if (smw->simple_menu.right_whitespace)
+ r_mrgn = r_bmw +
+ (smw->simple_menu.right_whitespace * ((r_bmw) ? 2 : 1));
+
+ /* make all the margins uniform */
+ ForAllChildren(smw, entry)
+ {
+ if (!XtIsManaged((Widget)*entry)) continue;
+ if (*entry == smw->simple_menu.label) continue;
+ if (XtIsSubclass((Widget)*entry, smeLineObjectClass))
+ continue;
+
+ bsb_entry = (SmeBSBObject)&((*entry)->object);
+ if (smw->simple_menu.left_whitespace)
+ bsb_entry->sme_bsb.left_margin = l_mrgn;
+ if (smw->simple_menu.right_whitespace)
+ bsb_entry->sme_bsb.right_margin = r_mrgn;
+ }
+ }
+}
+
/* Function Name: GetMenuWidth
- * Description: Sets the length of the widest entry in pixels.
+ * Description: Sets the width to the widest entry in pixels.
* Arguments: w - the simple menu widget.
+ * w_ent - the current menu entry.
* Returns: width of menu.
*/
@@ -1193,9 +1429,9 @@ Widget w, w_ent;
}
/* Function Name: GetMenuHeight
- * Description: Sets the length of the widest entry in pixels.
+ * Description: Sets the height to all the entries in pixels.
* Arguments: w - the simple menu widget.
- * Returns: width of menu.
+ * Returns: height of menu.
*/
static Dimension
@@ -1203,6 +1439,7 @@ GetMenuHeight(w)
Widget w;
{
SimpleMenuWidget smw = (SimpleMenuWidget) w;
+ ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
SmeObject * entry;
Dimension height;
@@ -1210,6 +1447,7 @@ Widget w;
return(smw->core.height);
height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin;
+ height += tdw->threeD.shadow_width * 2;
if (smw->simple_menu.row_height == 0) {
ForAllChildren(smw, entry)
@@ -1234,44 +1472,202 @@ Widget w;
XEvent * event;
{
Position x_loc = 0, y_loc = 0;
- SimpleMenuWidget smw = (SimpleMenuWidget) w;
- SmeObject * entry;
-
+ SimpleMenuWidget smw = (SimpleMenuWidget)w;
+ SmeObject *entry;
+ static XPoint last_pos;
+ XPoint pos;
+ int s = ((ThreeDWidget)smw->simple_menu.threeD)->threeD.shadow_width;
+
switch (event->type) {
- case MotionNotify:
- x_loc = event->xmotion.x;
- y_loc = event->xmotion.y;
- break;
- case EnterNotify:
- case LeaveNotify:
- x_loc = event->xcrossing.x;
- y_loc = event->xcrossing.y;
- break;
- case ButtonPress:
- case ButtonRelease:
- x_loc = event->xbutton.x;
- y_loc = event->xbutton.y;
- break;
- default:
- XtAppError(XtWidgetToApplicationContext(w),
- "Unknown event type in GetEventEntry().");
- break;
+ case MotionNotify:
+ x_loc = event->xmotion.x;
+ y_loc = event->xmotion.y;
+ pos.y = event->xmotion.y_root;
+ break;
+ case EnterNotify:
+ case LeaveNotify:
+ x_loc = event->xcrossing.x;
+ y_loc = event->xcrossing.y;
+ pos.y = event->xcrossing.y_root;
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ x_loc = event->xbutton.x;
+ y_loc = event->xbutton.y;
+ pos.y = event->xbutton.y_root;
+ break;
+ default:
+ XtAppError(XtWidgetToApplicationContext(w),
+ "Unknown event type in GetEventEntry().");
+ break;
}
-
- if ( (x_loc < 0) || (x_loc >= (int)smw->core.width) || (y_loc < 0) ||
- (y_loc >= (int)smw->core.height) )
- return(NULL);
-
+
+ if (x_loc < 0 || x_loc >= (int)smw->core.width)
+ return NULL;
+ else if (smw->simple_menu.too_tall) {
+ if (pos.y >= smw->simple_menu.last_y && smw->simple_menu.didnt_fit) {
+ if (last_pos.y && pos.y < last_pos.y) {
+ last_pos.y = pos.y;
+ return NULL;
+ }
+ smw->simple_menu.current_first += smw->simple_menu.jump_val;
+ Redisplay(w, (XEvent *)NULL, (Region)NULL);
+ last_pos.y = pos.y;
+ return NULL;
+ } else if (pos.y <= s + SMW_ARROW_SIZE &&
+ smw->simple_menu.first_entry != smw->simple_menu.current_first)
+ {
+ if (pos.y && (!last_pos.y || pos.y > last_pos.y)) {
+ last_pos.y = pos.y;
+ return NULL;
+ }
+ smw->simple_menu.current_first -= smw->simple_menu.jump_val;
+ Redisplay(w, (XEvent *)NULL, (Region)NULL);
+ last_pos.y = pos.y;
+ return NULL;
+ }
+ else
+ last_pos.y = 0;
+ } else if (y_loc < 0 || y_loc >= (int)smw->core.height)
+ return NULL;
+
ForAllChildren(smw, entry) {
- if (!XtIsManaged ((Widget) *entry)) continue;
+ int tmp_y;
+
+ if (!XtIsManaged((Widget)*entry)) continue;
- if ( ((*entry)->rectangle.y < y_loc) &&
- ((*entry)->rectangle.y + (int) (*entry)->rectangle.height > y_loc) )
- if ( *entry == smw->simple_menu.label )
- return(NULL); /* cannot select the label. */
+ tmp_y = (*entry)->rectangle.y - smw->simple_menu.first_y;
+ if (tmp_y < y_loc && tmp_y + (int)(*entry)->rectangle.height > y_loc) {
+ if (*entry == smw->simple_menu.label)
+ return NULL; /* cannot select the label */
else
- return(*entry);
+ return *entry;
+ }
}
-
- return(NULL);
+
+ return NULL;
+}
+
+/*ARGSUSED*/
+static void
+PopupCB(w, client_data, call_data)
+Widget w;
+XtPointer client_data, call_data;
+{
+ SimpleMenuWidget smw = (SimpleMenuWidget)w;
+
+ smw->simple_menu.state &= ~SMW_UNMAPPING;
+}
+
+static void
+PopupSubMenu(smw)
+SimpleMenuWidget smw;
+{
+ Widget menu;
+ SmeBSBObject entry = (SmeBSBObject)smw->simple_menu.entry_set;
+ Position menu_x, menu_y;
+ Bool popleft;
+ Arg args[2];
+
+ if (entry->sme_bsb.menu_name == NULL)
+ return;
+
+ if ((menu = FindMenu((Widget)smw, entry->sme_bsb.menu_name)) == NULL)
+ return;
+
+ smw->simple_menu.sub_menu = menu;
+
+ if (!XtIsRealized(menu))
+ XtRealizeWidget(menu);
+
+ popleft = (smw->simple_menu.state & SMW_POPLEFT) != 0;
+
+ if (popleft)
+ XtTranslateCoords((Widget)smw, -(int)XtWidth(menu),
+ XtY(entry) - XtBorderWidth(menu), &menu_x, &menu_y);
+ else
+ XtTranslateCoords((Widget)smw, XtWidth(smw), XtY(entry)
+ - XtBorderWidth(menu), &menu_x, &menu_y);
+
+ if (!popleft && menu_x >= 0) {
+ int scr_width = WidthOfScreen(XtScreen(menu));
+
+ if (menu_x + XtWidth(menu) > scr_width) {
+ menu_x -= XtWidth(menu) + XtWidth(smw);
+ popleft = True;
+ }
+ }
+ else if (popleft && menu_x < 0) {
+ menu_x = 0;
+ popleft = False;
+ }
+
+ if (menu_y >= 0) {
+ ThreeDWidget tdw =
+ (ThreeDWidget)((SimpleMenuWidget)menu)->simple_menu.threeD;
+ int scr_height = HeightOfScreen(XtScreen(menu));
+
+ if (menu_y + XtHeight(menu) > scr_height)
+ menu_y = scr_height - XtHeight(menu) - XtBorderWidth(menu);
+
+ menu_y -= tdw->threeD.shadow_width;
+ }
+ if (menu_y < 0)
+ menu_y = 0;
+
+ XtSetArg(args[0], XtNx, menu_x);
+ XtSetArg(args[1], XtNy, menu_y);
+ XtSetValues(menu, args, TWO);
+
+ if (popleft)
+ ((SimpleMenuWidget)menu)->simple_menu.state |= SMW_POPLEFT;
+ else
+ ((SimpleMenuWidget)menu)->simple_menu.state &= ~SMW_POPLEFT;
+
+ XtPopup(menu, XtGrabNone);
}
+
+static void
+Popdown(w, event, params, num_params)
+Widget w;
+XEvent *event;
+String *params;
+Cardinal *num_params;
+{
+ SimpleMenuWidget smw = (SimpleMenuWidget)w;
+
+ while (XtParent(w) &&
+ XtIsSubclass(XtParent(w), simpleMenuWidgetClass)) {
+ if (((SimpleMenuWidget)XtParent(w))->simple_menu.sub_menu == (Widget)w)
+ {
+ w = XtParent(w);
+ smw = (SimpleMenuWidget)w;
+ smw->simple_menu.entry_set = NULL;
+ }
+ else
+ break;
+ }
+
+ smw->simple_menu.state |= SMW_UNMAPPING;
+ PopdownSubMenu(smw);
+
+ XtCallActionProc(w, "XtMenuPopdown", event, params, *num_params);
+}
+
+static void
+PopdownSubMenu(smw)
+SimpleMenuWidget smw;
+{
+ SimpleMenuWidget menu = (SimpleMenuWidget)smw->simple_menu.sub_menu;
+
+ if (!menu) return;
+
+ menu->simple_menu.state &= ~SMW_POPLEFT;
+ menu->simple_menu.state |= SMW_UNMAPPING;
+ PopdownSubMenu(menu);
+
+ XtPopdown((Widget)menu);
+
+ smw->simple_menu.sub_menu = NULL;
+}
+
diff --git a/xc/lib/Xaw3d/SimpleMenu.h b/xc/lib/Xaw3d/SimpleMenu.h
index 8f527b8..9e4c45c 100644
--- a/xc/lib/Xaw3d/SimpleMenu.h
+++ b/xc/lib/Xaw3d/SimpleMenu.h
@@ -95,6 +95,9 @@ extern WidgetClass simpleMenuWidgetClass;
#define XtNpopupOnEntry "popupOnEntry"
#define XtNrowHeight "rowHeight"
#define XtNtopMargin "topMargin"
+#define XtNjumpScroll "jumpScroll"
+#define XtNleftWhitespace "leftWhitespace"
+#define XtNrightWhitespace "rightWhitespace"
#define XtCColumnWidth "ColumnWidth"
#define XtCLabelClass "LabelClass"
@@ -102,6 +105,10 @@ extern WidgetClass simpleMenuWidgetClass;
#define XtCPopupOnEntry "PopupOnEntry"
#define XtCRowHeight "RowHeight"
#define XtCVerticalMargins "VerticalMargins"
+#define XtCJumpScroll "JumpScroll"
+#define XtCLeftWhitespace "LeftWhitespace"
+#define XtCRightWhitespace "RightWhitespace"
+#define XtCHorizontalWhitespace "HorizontalWhitespace"
/************************************************************
*
diff --git a/xc/lib/Xaw3d/SimpleP.h b/xc/lib/Xaw3d/SimpleP.h
index 05c2436..ce7d744 100644
--- a/xc/lib/Xaw3d/SimpleP.h
+++ b/xc/lib/Xaw3d/SimpleP.h
@@ -52,6 +52,7 @@ SOFTWARE.
#ifndef _SimpleP_h
#define _SimpleP_h
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Simple.h>
typedef struct {
@@ -74,7 +75,9 @@ typedef struct {
String cursor_name; /* cursor specified by name. */
Pixel pointer_fg, pointer_bg; /* Pointer colors. */
+#ifdef XAW_INTERNATIONALIZATION
Boolean international;
+#endif
/* private state */
} SimplePart;
diff --git a/xc/lib/Xaw3d/Sme.c b/xc/lib/Xaw3d/Sme.c
index 741dbef..f3b34dd 100644
--- a/xc/lib/Xaw3d/Sme.c
+++ b/xc/lib/Xaw3d/Sme.c
@@ -35,10 +35,10 @@ in this Software without prior written authorization from the X Consortium.
* kit@expo.lcs.mit.edu
*/
+#include "Xaw3dP.h"
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
-
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/SmeP.h>
#include <X11/Xaw3d/Cardinals.h>
@@ -47,8 +47,10 @@ in this Software without prior written authorization from the X Consortium.
static XtResource resources[] = {
{XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(callbacks), XtRCallback, (XtPointer)NULL},
+#ifdef XAW_INTERNATIONALIZATION
{XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean),
offset(international), XtRImmediate, (XtPointer) FALSE},
+#endif
};
#undef offset
diff --git a/xc/lib/Xaw3d/Sme.h b/xc/lib/Xaw3d/Sme.h
index 4b0dadc..709b105 100644
--- a/xc/lib/Xaw3d/Sme.h
+++ b/xc/lib/Xaw3d/Sme.h
@@ -41,6 +41,7 @@ in this Software without prior written authorization from the X Consortium.
#ifndef _Sme_h
#define _Sme_h
+#include "Xaw3dP.h"
#include <X11/RectObj.h>
/****************************************************************
@@ -63,14 +64,14 @@ in this Software without prior written authorization from the X Consortium.
*/
+#ifdef XAW_INTERNATIONALIZATION
#ifndef XtCInternational
#define XtCInternational "International"
#endif
-
#ifndef XtNinternational
#define XtNinternational "international"
#endif
-
+#endif
typedef struct _SmeClassRec* SmeObjectClass;
typedef struct _SmeRec* SmeObject;
diff --git a/xc/lib/Xaw3d/SmeBSB.c b/xc/lib/Xaw3d/SmeBSB.c
index bf7a27e..63bdc49 100644
--- a/xc/lib/Xaw3d/SmeBSB.c
+++ b/xc/lib/Xaw3d/SmeBSB.c
@@ -26,6 +26,11 @@ in this Software without prior written authorization from the X Consortium.
*/
/*
+ * Portions Copyright (c) 2003 Brian V. Smith
+ * Rights, permissions, and disclaimer per the above X Consortium license.
+ */
+
+/*
* SmeBSB.c - Source code file for BSB Menu Entry object.
*
* Date: September 26, 1989
@@ -35,27 +40,24 @@ in this Software without prior written authorization from the X Consortium.
* kit@expo.lcs.mit.edu
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xos.h>
-
-/* needed for abs() */
-#ifdef X_NOT_STDC_ENV
-extern int abs();
-#else
-#include <stdlib.h>
-#endif
-
#include <X11/Xmu/Drawing.h>
-
#include <X11/Xaw3d/XawInit.h>
-#include <X11/Xaw3d/SimpleMenu.h>
+#include <X11/Xaw3d/ThreeDP.h>
+#include <X11/Xaw3d/SimpleMenP.h>
#include <X11/Xaw3d/SmeBSBP.h>
#include <X11/Xaw3d/Cardinals.h>
-
#include <stdio.h>
-#define ONE_HUNDRED 100
+/* needed for abs() */
+#ifndef X_NOT_STDC_ENV
+#include <stdlib.h>
+#else
+extern int abs();
+#endif
#define offset(field) XtOffsetOf(SmeBSBRec, sme_bsb.field)
@@ -78,8 +80,14 @@ static XtResource resources[] = {
offset(foreground), XtRString, XtDefaultForeground},
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(font), XtRString, XtDefaultFont},
+#ifdef XAW_INTERNATIONALIZATION
{XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ),
offset(fontset),XtRString, XtDefaultFontSet},
+#endif
+ {XtNmenuName, XtCMenuName, XtRString, sizeof(String),
+ offset(menu_name), XtRImmediate, (XtPointer) NULL},
+ {XtNunderline, XtCIndex, XtRInt, sizeof(int),
+ offset(underline), XtRImmediate, (XtPointer) -1},
};
#undef offset
@@ -87,7 +95,8 @@ static XtResource resources[] = {
* Semi Public function definitions.
*/
-static void Redisplay(), Destroy(), Initialize(), FlipColors();
+static void Redisplay(), Destroy(), Initialize();
+static void Highlight(), Unhighlight();
static void ClassInitialize();
static Boolean SetValues();
static XtGeometryResult QueryGeometry();
@@ -97,7 +106,7 @@ static XtGeometryResult QueryGeometry();
*/
static void GetDefaultSize(), DrawBitmaps(), GetBitmapInfo();
-static void CreateGCs(), DestroyGCs();
+static void CreateGCs(), DestroyGCs(), FlipColors();
#define superclass (&smeThreeDClassRec)
SmeBSBClassRec smeBSBClassRec = {
@@ -136,8 +145,8 @@ SmeBSBClassRec smeBSBClassRec = {
/* extension */ NULL
},{
/* SimpleMenuClass Fields */
- /* highlight */ FlipColors,
- /* unhighlight */ FlipColors,
+ /* highlight */ Highlight,
+ /* unhighlight */ Unhighlight,
/* notify */ XtInheritNotify,
/* extension */ NULL
}, {
@@ -193,14 +202,14 @@ Cardinal *num_args;
else
entry->sme_bsb.label = XtNewString( entry->sme_bsb.label );
- GetDefaultSize(new, &(entry->rectangle.width), &(entry->rectangle.height));
CreateGCs(new);
- entry->sme_bsb.left_bitmap_width = entry->sme_bsb.left_bitmap_height = 0;
- entry->sme_bsb.right_bitmap_width = entry->sme_bsb.right_bitmap_height = 0;
-
GetBitmapInfo(new, TRUE); /* Left Bitmap Info */
GetBitmapInfo(new, FALSE); /* Right Bitmap Info */
+
+ entry->sme_bsb.left_stippled = entry->sme_bsb.right_stippled = None;
+
+ GetDefaultSize(new, &(entry->rectangle.width), &(entry->rectangle.height));
}
/* Function Name: Destroy
@@ -216,6 +225,12 @@ Widget w;
SmeBSBObject entry = (SmeBSBObject) w;
DestroyGCs(w);
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (entry->sme_bsb.left_stippled != None)
+ XFreePixmap(XtDisplayOfObject(w), entry->sme_bsb.left_stippled);
+ if (entry->sme_bsb.right_stippled != None)
+ XFreePixmap(XtDisplayOfObject(w), entry->sme_bsb.right_stippled);
+#endif
if (entry->sme_bsb.label != XtName(w))
XtFree(entry->sme_bsb.label);
}
@@ -239,22 +254,25 @@ Region region;
SmeBSBObject entry = (SmeBSBObject) w;
Dimension s = entry->sme_threeD.shadow_width;
int font_ascent = 0, font_descent = 0, y_loc;
-
+#ifdef XAW_INTERNATIONALIZATION
int fontset_ascent = 0, fontset_descent = 0;
XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
+#endif
entry->sme_bsb.set_values_area_cleared = FALSE;
+#ifdef XAW_INTERNATIONALIZATION
if ( entry->sme.international == True ) {
fontset_ascent = abs(ext->max_ink_extent.y);
fontset_descent = ext->max_ink_extent.height - fontset_ascent;
}
- else { /*else, compute size from font like R5*/
+ else
+#endif
+ { /*else, compute size from font like R5*/
font_ascent = entry->sme_bsb.font->max_bounds.ascent;
font_descent = entry->sme_bsb.font->max_bounds.descent;
}
y_loc = entry->rectangle.y;
-
if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) {
if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) {
XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
@@ -272,44 +290,42 @@ Region region;
if (entry->sme_bsb.label != NULL) {
int x_loc = entry->sme_bsb.left_margin;
int len = strlen(entry->sme_bsb.label);
+ int width, t_width;
char * label = entry->sme_bsb.label;
switch(entry->sme_bsb.justify) {
- int width, t_width;
-
- case XtJustifyCenter:
- if ( entry->sme.international == True ) {
- t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
- width = entry->rectangle.width - (entry->sme_bsb.left_margin +
- entry->sme_bsb.right_margin);
- }
- else {
- t_width = XTextWidth(entry->sme_bsb.font, label, len);
- width = entry->rectangle.width - (entry->sme_bsb.left_margin +
- entry->sme_bsb.right_margin);
- }
- x_loc += (width - t_width)/2;
- break;
- case XtJustifyRight:
- if ( entry->sme.international == True ) {
- t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
- x_loc = entry->rectangle.width - ( entry->sme_bsb.right_margin
- + t_width );
- }
- else {
- t_width = XTextWidth(entry->sme_bsb.font, label, len);
- x_loc = entry->rectangle.width - ( entry->sme_bsb.right_margin
- + t_width );
- }
- break;
- case XtJustifyLeft:
- default:
- break;
+ case XtJustifyCenter:
+#ifdef XAW_INTERNATIONALIZATION
+ if ( entry->sme.international == True )
+ t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
+ else
+#endif
+ t_width = XTextWidth(entry->sme_bsb.font, label, len);
+
+ width = entry->rectangle.width -
+ (entry->sme_bsb.left_margin +
+ entry->sme_bsb.right_margin);
+ x_loc += (width - t_width)/2;
+ break;
+ case XtJustifyRight:
+#ifdef XAW_INTERNATIONALIZATION
+ if ( entry->sme.international == True )
+ t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len);
+ else
+#endif
+ t_width = XTextWidth(entry->sme_bsb.font, label, len);
+
+ x_loc = entry->rectangle.width -
+ (entry->sme_bsb.right_margin + t_width);
+ break;
+ case XtJustifyLeft:
+ default:
+ break;
}
-
/* this will center the text in the gadget top-to-bottom */
+#ifdef XAW_INTERNATIONALIZATION
if ( entry->sme.international==True ) {
y_loc += ((int)entry->rectangle.height -
(fontset_ascent + fontset_descent)) / 2 + fontset_ascent;
@@ -317,13 +333,27 @@ Region region;
XmbDrawString(XtDisplayOfObject(w), XtWindowOfObject(w),
entry->sme_bsb.fontset, gc, x_loc + s, y_loc, label, len);
}
- else {
+ else
+#endif
+ {
y_loc += ((int)entry->rectangle.height -
(font_ascent + font_descent)) / 2 + font_ascent;
XDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
x_loc + s, y_loc, label, len);
}
+
+ if (entry->sme_bsb.underline >= 0 && entry->sme_bsb.underline < len) {
+ int ul = entry->sme_bsb.underline;
+ int ul_x1_loc = x_loc + s;
+ int ul_wid;
+
+ if (ul != 0)
+ ul_x1_loc += XTextWidth(entry->sme_bsb.font, label, ul);
+ ul_wid = XTextWidth(entry->sme_bsb.font, &label[ul], 1) - 2;
+ XDrawLine(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
+ ul_x1_loc, y_loc + 1, ul_x1_loc + ul_wid, y_loc + 1);
+ }
}
DrawBitmaps(w, gc);
@@ -345,6 +375,7 @@ Widget current, request, new;
ArgList args;
Cardinal *num_args;
{
+ Widget parent = XtParent(new);
SmeBSBObject entry = (SmeBSBObject) new;
SmeBSBObject old_entry = (SmeBSBObject) current;
Boolean ret_val = FALSE;
@@ -356,40 +387,78 @@ Cardinal *num_args;
if (entry->sme_bsb.label != XtName(new) )
entry->sme_bsb.label = XtNewString( entry->sme_bsb.label );
- ret_val = True;
- }
-
- if (entry->rectangle.sensitive != old_entry->rectangle.sensitive )
ret_val = TRUE;
+ }
- if (entry->sme_bsb.left_bitmap != old_entry->sme_bsb.left_bitmap) {
- GetBitmapInfo(new, TRUE);
+ if (entry->sme_bsb.underline != old_entry->sme_bsb.underline)
ret_val = TRUE;
- }
- if (entry->sme_bsb.right_bitmap != old_entry->sme_bsb.right_bitmap) {
- GetBitmapInfo(new, FALSE);
+ if (entry->rectangle.sensitive != old_entry->rectangle.sensitive)
ret_val = TRUE;
- }
+#ifdef XAW_INTERNATIONALIZATION
if ( ( (old_entry->sme_bsb.font != entry->sme_bsb.font) &&
(old_entry->sme.international == False ) ) ||
(old_entry->sme_bsb.foreground != entry->sme_bsb.foreground) ) {
+#else
+ if ( (old_entry->sme_bsb.font != entry->sme_bsb.font) ||
+ (old_entry->sme_bsb.foreground != entry->sme_bsb.foreground) ) {
+#endif
DestroyGCs(current);
CreateGCs(new);
+
+ ret_val = TRUE;
+ }
+
+ if (entry->sme_bsb.left_bitmap != old_entry->sme_bsb.left_bitmap)
+ {
+ GetBitmapInfo(new, TRUE);
+
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ entry->sme_bsb.left_stippled = None;
+ if (old_entry->sme_bsb.left_stippled != None)
+ XFreePixmap(XtDisplayOfObject(current),
+ old_entry->sme_bsb.left_stippled);
+#endif
+
+ ret_val = TRUE;
+ }
+
+ if (entry->sme_bsb.left_margin != old_entry->sme_bsb.left_margin)
+ ret_val = TRUE;
+
+ if (entry->sme_bsb.right_bitmap != old_entry->sme_bsb.right_bitmap)
+ {
+ GetBitmapInfo(new, FALSE);
+
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ entry->sme_bsb.right_stippled = None;
+ if (old_entry->sme_bsb.right_stippled != None)
+ XFreePixmap(XtDisplayOfObject(current),
+ old_entry->sme_bsb.right_stippled);
+#endif
+
ret_val = TRUE;
}
+ if (entry->sme_bsb.right_margin != old_entry->sme_bsb.right_margin)
+ ret_val = TRUE;
+
+#ifdef XAW_INTERNATIONALIZATION
if ( ( old_entry->sme_bsb.fontset != entry->sme_bsb.fontset) &&
(old_entry->sme.international == True ) )
- /* DONT changes the GCs, because the fontset is not in them. */
+ /* don't change the GCs - the fontset is not in them */
ret_val = TRUE;
+#endif
if (ret_val) {
GetDefaultSize(new,
&(entry->rectangle.width), &(entry->rectangle.height));
entry->sme_bsb.set_values_area_cleared = TRUE;
+
+ (parent->core.widget_class->core_class.resize)(new);
}
+
return(ret_val);
}
@@ -410,11 +479,11 @@ Widget w;
XtWidgetGeometry *intended, *return_val;
{
SmeBSBObject entry = (SmeBSBObject) w;
- Dimension width, height;
+ Dimension width, height, h;
XtGeometryResult ret_val = XtGeometryYes;
XtGeometryMask mode = intended->request_mode;
- GetDefaultSize(w, &width, &height );
+ GetDefaultSize(w, &width, &height );
if ( ((mode & CWWidth) && (intended->width != width)) ||
!(mode & CWWidth) ) {
@@ -438,36 +507,35 @@ XtWidgetGeometry *intended, *return_val;
return(XtGeometryNo);
}
+ entry->rectangle.width = width;
+ entry->rectangle.height = height;
+
return(ret_val);
}
-/* Function Name: FlipColors
- * Description: Invert the colors of the current entry.
- * Arguments: w - the bsb menu entry widget.
- * Returns: none.
+/*
+ * FlipColors() used to be called directly, but it's blind
+ * state toggling caused re-unhighlighting problems.
*/
-static void
-FlipColors(w)
+static void
+Highlight(w)
Widget w;
{
SmeBSBObject entry = (SmeBSBObject) w;
- SmeBSBObjectClass oclass = (SmeBSBObjectClass) XtClass (w);
- if (entry->sme_bsb.set_values_area_cleared) {
- entry->sme_threeD.shadowed = False;
- return;
- }
+ entry->sme_threeD.shadowed = True;
+ FlipColors(w);
+}
- if (entry->sme_threeD.shadow_width > 0) {
- entry->sme_threeD.shadowed ^= True;
- (*oclass->sme_threeD_class.shadowdraw) (w);
- } else
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- entry->sme_bsb.invert_gc,
- 0, (int) entry->rectangle.y,
- (unsigned int) entry->rectangle.width,
- (unsigned int) entry->rectangle.height);
+static void
+Unhighlight(w)
+Widget w;
+{
+ SmeBSBObject entry = (SmeBSBObject) w;
+
+ entry->sme_threeD.shadowed = False;
+ FlipColors(w);
}
/************************************************************
@@ -490,38 +558,41 @@ Widget w;
Dimension * width, * height;
{
SmeBSBObject entry = (SmeBSBObject) w;
+ Dimension h;
+#ifdef XAW_INTERNATIONALIZATION
if ( entry->sme.international == True ) {
XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
+
if (entry->sme_bsb.label == NULL)
*width = 0;
else
*width = XmbTextEscapement(entry->sme_bsb.fontset, entry->sme_bsb.label,
strlen(entry->sme_bsb.label));
- *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
- *width += (2 * entry->sme_threeD.shadow_width);
+
*height = ext->max_ink_extent.height;
- *height = ((int)*height * ( ONE_HUNDRED +
- entry->sme_bsb.vert_space )) / ONE_HUNDRED;
- *height += (2 * entry->sme_threeD.shadow_width);
}
- else {
+ else
+#endif
+ {
if (entry->sme_bsb.label == NULL)
*width = 0;
else
*width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label,
strlen(entry->sme_bsb.label));
- *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
- *width += (2 * entry->sme_threeD.shadow_width);
-
*height = (entry->sme_bsb.font->max_bounds.ascent +
entry->sme_bsb.font->max_bounds.descent);
-
- *height = ((int)*height * ( ONE_HUNDRED +
- entry->sme_bsb.vert_space )) / ONE_HUNDRED;
- *height += (2 * entry->sme_threeD.shadow_width);
}
+
+ *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
+ *width += (2 * entry->sme_threeD.shadow_width);
+
+ h = (entry->sme_bsb.left_bitmap_height > entry->sme_bsb.right_bitmap_height)
+ ? entry->sme_bsb.left_bitmap_height : entry->sme_bsb.right_bitmap_height;
+ if (h > *height) *height = h;
+ *height = ((int)*height * (100 + entry->sme_bsb.vert_space)) / 100;
+ *height += (2 * entry->sme_threeD.shadow_width);
}
/* Function Name: DrawBitmaps
@@ -536,8 +607,12 @@ DrawBitmaps(w, gc)
Widget w;
GC gc;
{
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ Widget parent = XtParent(w);
+#endif
int x_loc, y_loc;
SmeBSBObject entry = (SmeBSBObject) w;
+ Pixmap pm;
if ( (entry->sme_bsb.left_bitmap == None) &&
(entry->sme_bsb.right_bitmap == None) ) return;
@@ -549,36 +624,73 @@ GC gc;
if (entry->sme_bsb.left_bitmap != None) {
x_loc = entry->sme_threeD.shadow_width +
(int)(entry->sme_bsb.left_margin -
- entry->sme_bsb.left_bitmap_width) / 2;
+ entry->sme_bsb.left_bitmap_width) / 2;
- y_loc = entry->rectangle.y +
- (int)(entry->rectangle.height -
+ y_loc = entry->rectangle.y + (int)(entry->rectangle.height -
entry->sme_bsb.left_bitmap_height) / 2;
- XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap,
- XtWindowOfObject(w), gc, 0, 0,
- entry->sme_bsb.left_bitmap_width,
- entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1);
+ pm = entry->sme_bsb.left_bitmap;
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (!XtIsSensitive(w)) {
+ if (entry->sme_bsb.left_stippled == None)
+ entry->sme_bsb.left_stippled = stipplePixmap(w,
+ entry->sme_bsb.left_bitmap,
+ parent->core.colormap,
+ parent->core.background_pixel,
+ entry->sme_bsb.left_depth);
+ if (entry->sme_bsb.left_stippled != None)
+ pm = entry->sme_bsb.left_stippled;
+ }
+#endif
+
+ if (entry->sme_bsb.left_depth == 1)
+ XCopyPlane(XtDisplayOfObject(w), pm,
+ XtWindowOfObject(w), gc, 0, 0,
+ entry->sme_bsb.left_bitmap_width,
+ entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1);
+ else
+ XCopyArea (XtDisplayOfObject(w), pm,
+ XtWindowOfObject(w), gc, 0, 0,
+ entry->sme_bsb.left_bitmap_width,
+ entry->sme_bsb.left_bitmap_height, x_loc, y_loc);
}
/*
* Draw Right Bitmap.
*/
-
if (entry->sme_bsb.right_bitmap != None) {
x_loc = entry->rectangle.width - entry->sme_threeD.shadow_width -
(int)(entry->sme_bsb.right_margin +
- entry->sme_bsb.right_bitmap_width) / 2;
+ entry->sme_bsb.right_bitmap_width) / 2;
- y_loc = entry->rectangle.y +
- (int)(entry->rectangle.height -
+ y_loc = entry->rectangle.y + (int)(entry->rectangle.height -
entry->sme_bsb.right_bitmap_height) / 2;
- XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.right_bitmap,
- XtWindowOfObject(w), gc, 0, 0,
- entry->sme_bsb.right_bitmap_width,
- entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1);
+ pm = entry->sme_bsb.right_bitmap;
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ if (!XtIsSensitive(w)) {
+ if (entry->sme_bsb.right_stippled == None)
+ entry->sme_bsb.right_stippled = stipplePixmap(w,
+ entry->sme_bsb.right_bitmap,
+ parent->core.colormap,
+ parent->core.background_pixel,
+ entry->sme_bsb.right_depth);
+ if (entry->sme_bsb.right_stippled != None)
+ pm = entry->sme_bsb.right_stippled;
+ }
+#endif
+
+ if (entry->sme_bsb.right_depth == 1)
+ XCopyPlane(XtDisplayOfObject(w), pm,
+ XtWindowOfObject(w), gc, 0, 0,
+ entry->sme_bsb.right_bitmap_width,
+ entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1);
+ else
+ XCopyArea (XtDisplayOfObject(w), pm,
+ XtWindowOfObject(w), gc, 0, 0,
+ entry->sme_bsb.right_bitmap_width,
+ entry->sme_bsb.right_bitmap_height, x_loc, y_loc);
}
}
@@ -596,47 +708,59 @@ Widget w;
Boolean is_left;
{
SmeBSBObject entry = (SmeBSBObject) w;
- unsigned int depth, bw;
Window root;
int x, y;
- unsigned int width, height;
+ unsigned int width, height, bw;
char buf[BUFSIZ];
if (is_left) {
+ width = height = 0;
+
if (entry->sme_bsb.left_bitmap != None) {
if (!XGetGeometry(XtDisplayOfObject(w),
- entry->sme_bsb.left_bitmap, &root,
- &x, &y, &width, &height, &bw, &depth)) {
- (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", "Could not",
- "get Left Bitmap geometry information for menu entry ",
+ entry->sme_bsb.left_bitmap, &root, &x, &y,
+ &width, &height, &bw, &entry->sme_bsb.left_depth)) {
+ (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
+ "Could not get Left Bitmap",
+ "geometry information for menu entry",
XtName(w));
XtAppError(XtWidgetToApplicationContext(w), buf);
}
- if (depth != 1) {
- (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\"%s.",
- "Left Bitmap of entry ",
- XtName(w), " is not one bit deep.");
+#ifdef NEVER
+ if (entry->sme_bsb.left_depth != 1) {
+ (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.",
+ "Left Bitmap of entry", XtName(w),
+ "is not one bit deep");
XtAppError(XtWidgetToApplicationContext(w), buf);
}
- entry->sme_bsb.left_bitmap_width = (Dimension) width;
- entry->sme_bsb.left_bitmap_height = (Dimension) height;
- }
- }
- else if (entry->sme_bsb.right_bitmap != None) {
- if (!XGetGeometry(XtDisplayOfObject(w),
- entry->sme_bsb.right_bitmap, &root,
- &x, &y, &width, &height, &bw, &depth)) {
- (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", "Could not",
- "get Right Bitmap geometry information for menu entry ",
- XtName(w));
- XtAppError(XtWidgetToApplicationContext(w), buf);
+#endif
}
- if (depth != 1) {
- (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\"%s.",
- "Right Bitmap of entry ", XtName(w),
- " is not one bit deep.");
- XtAppError(XtWidgetToApplicationContext(w), buf);
+
+ entry->sme_bsb.left_bitmap_width = (Dimension) width;
+ entry->sme_bsb.left_bitmap_height = (Dimension) height;
+ } else {
+ width = height = 0;
+
+ if (entry->sme_bsb.right_bitmap != None) {
+ if (!XGetGeometry(XtDisplayOfObject(w),
+ entry->sme_bsb.right_bitmap, &root, &x, &y,
+ &width, &height, &bw, &entry->sme_bsb.right_depth)) {
+ (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".",
+ "Could not get Right Bitmap",
+ "geometry information for menu entry",
+ XtName(w));
+ XtAppError(XtWidgetToApplicationContext(w), buf);
+ }
+#ifdef NEVER
+ if (entry->sme_bsb.right_depth != 1) {
+ (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\" %s.",
+ "Right Bitmap of entry", XtName(w),
+ "is not one bit deep");
+ XtAppError(XtWidgetToApplicationContext(w), buf);
+ }
+#endif
}
+
entry->sme_bsb.right_bitmap_width = (Dimension) width;
entry->sme_bsb.right_bitmap_height = (Dimension) height;
}
@@ -654,24 +778,31 @@ Widget w;
{
SmeBSBObject entry = (SmeBSBObject) w;
XGCValues values;
- XtGCMask mask, mask_i18n;
+ XtGCMask mask;
+#ifdef XAW_INTERNATIONALIZATION
+ XtGCMask mask_i18n;
+#endif
values.foreground = XtParent(w)->core.background_pixel;
values.background = entry->sme_bsb.foreground;
values.font = entry->sme_bsb.font->fid;
values.graphics_exposures = FALSE;
mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
+#ifdef XAW_INTERNATIONALIZATION
mask_i18n = GCForeground | GCBackground | GCGraphicsExposures;
if ( entry->sme.international == True )
entry->sme_bsb.rev_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 );
else
+#endif
entry->sme_bsb.rev_gc = XtGetGC(w, mask, &values);
values.foreground = entry->sme_bsb.foreground;
values.background = XtParent(w)->core.background_pixel;
+#ifdef XAW_INTERNATIONALIZATION
if ( entry->sme.international == True )
entry->sme_bsb.norm_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 );
else
+#endif
entry->sme_bsb.norm_gc = XtGetGC(w, mask, &values);
values.fill_style = FillTiled;
@@ -681,9 +812,11 @@ Widget w;
XtParent(w)->core.depth);
values.graphics_exposures = FALSE;
mask |= GCTile | GCFillStyle;
+#ifdef XAW_INTERNATIONALIZATION
if ( entry->sme.international == True )
entry->sme_bsb.norm_gray_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 );
else
+#endif
entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values);
values.foreground ^= values.background;
@@ -711,18 +844,34 @@ Widget w;
XtReleaseGC(w, entry->sme_bsb.invert_gc);
}
-#ifdef apollo
-
-/*
- * The apollo compiler that we have optomizes out my code for
- * FlipColors() since it is static. and no one executes it in this
- * file. I am setting the function pointer into the class structure so
- * that it can be called by my parent who will tell me to when to
- * highlight and unhighlight.
+/* Function Name: FlipColors
+ * Description: Invert the colors of the current entry.
+ * Arguments: w - the bsb menu entry widget.
+ * Returns: none.
*/
-void _XawSmeBSBApolloHack ()
+static void
+FlipColors(w)
+Widget w;
{
- FlipColors();
+ SmeBSBObject entry = (SmeBSBObject) w;
+ SmeBSBObjectClass oclass = (SmeBSBObjectClass) XtClass (w);
+ SimpleMenuWidget smw = (SimpleMenuWidget) XtParent (w);
+ ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
+ Dimension s = tdw->threeD.shadow_width;
+
+ if (entry->sme_bsb.set_values_area_cleared) {
+ entry->sme_threeD.shadowed = False;
+ return;
+ }
+
+ if (entry->sme_threeD.shadow_width > 0) {
+ (*oclass->sme_threeD_class.shadowdraw) (w);
+ } else
+ XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
+ entry->sme_bsb.invert_gc,
+ s, (int) entry->rectangle.y,
+ (unsigned int) entry->rectangle.width - 2 * s,
+ (unsigned int) entry->rectangle.height);
}
-#endif /* apollo */
+
diff --git a/xc/lib/Xaw3d/SmeBSB.h b/xc/lib/Xaw3d/SmeBSB.h
index f1844b3..47ad6e0 100644
--- a/xc/lib/Xaw3d/SmeBSB.h
+++ b/xc/lib/Xaw3d/SmeBSB.h
@@ -44,6 +44,7 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xmu/Converters.h>
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Sme.h>
/****************************************************************
@@ -64,9 +65,11 @@ in this Software without prior written authorization from the X Consortium.
label Label String Name of entry
leftBitmap LeftBitmap Pixmap None
leftMargin HorizontalMargins Dimension 4
+ menuName MenuName String NULL
rightBitmap RightBitmap Pixmap None
rightMargin HorizontalMargins Dimension 4
sensitive Sensitive Boolean True
+ underline Underline int -1
vertSpace VertSpace int 25
width Width Dimension 0
x Position Position 0n
@@ -81,21 +84,28 @@ extern WidgetClass smeBSBObjectClass;
#define XtNleftBitmap "leftBitmap"
#define XtNleftMargin "leftMargin"
+#define XtNleftWhitespace "leftWhitespace"
#define XtNrightBitmap "rightBitmap"
#define XtNrightMargin "rightMargin"
-#define XtNvertSpace "vertSpace"
+#define XtNrightWhitespace "rightWhitespace"
+#define XtNvertSpace "vertSpace"
+#define XtNmenuName "menuName"
+#define XtNunderline "underline"
+#ifdef XAW_INTERNATIONALIZATION
#ifndef XtNfontSet
#define XtNfontSet "fontSet"
#endif
-
#ifndef XtCFontSet
#define XtCFontSet "FontSet"
#endif
+#endif
#define XtCLeftBitmap "LeftBitmap"
-#define XtCHorizontalMargins "HorizontalMargins"
#define XtCRightBitmap "RightBitmap"
-#define XtCVertSpace "VertSpace"
+#define XtCHorizontalMargins "HorizontalMargins"
+#define XtCVertSpace "VertSpace"
+#define XtCMenuName "MenuName"
+#define XtCUnderline "Underline"
#endif /* _SmeBSB_h */
diff --git a/xc/lib/Xaw3d/SmeBSBP.h b/xc/lib/Xaw3d/SmeBSBP.h
index fe697f3..6ef1c4b 100644
--- a/xc/lib/Xaw3d/SmeBSBP.h
+++ b/xc/lib/Xaw3d/SmeBSBP.h
@@ -41,6 +41,7 @@ in this Software without prior written authorization from the X Consortium.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/SmeThreeDP.h>
#include <X11/Xaw3d/SmeBSB.h>
@@ -70,26 +71,30 @@ typedef struct {
String label; /* The entry label. */
int vert_space; /* extra vert space to leave, as a percentage
of the font height of the label. */
- Pixmap left_bitmap, right_bitmap; /* bitmaps to show. */
+ Pixmap left_bitmap, right_bitmap; /* pixmaps to show. */
Dimension left_margin, right_margin; /* left and right margins. */
Pixel foreground; /* foreground color. */
XFontStruct * font; /* The font to show label in. */
+#ifdef XAW_INTERNATIONALIZATION
XFontSet fontset; /* or fontset */
+#endif
XtJustify justify; /* Justification for the label. */
+ int underline; /* index of letter to underline in label. */
-/* private resources. */
-
+ /* private resources. */
Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */
GC norm_gc; /* noral color gc. */
GC rev_gc; /* reverse color gc. */
GC norm_gray_gc; /* Normal color (grayed out) gc. */
GC invert_gc; /* gc for flipping colors. */
-
- Dimension left_bitmap_width; /* size of each bitmap. */
+ Pixmap left_stippled, right_stippled; /* insensitive pixmaps */
+ Dimension left_bitmap_width; /* size and depth of each pixmap. */
Dimension left_bitmap_height;
Dimension right_bitmap_width;
Dimension right_bitmap_height;
-
+ unsigned int left_depth;
+ unsigned int right_depth;
+ String menu_name; /* name of nested sub-menu or NULL */
} SmeBSBPart;
/****************************************************************
diff --git a/xc/lib/Xaw3d/SmeLine.c b/xc/lib/Xaw3d/SmeLine.c
index 51fea12..27aa65b 100644
--- a/xc/lib/Xaw3d/SmeLine.c
+++ b/xc/lib/Xaw3d/SmeLine.c
@@ -42,6 +42,8 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/StringDefs.h>
#include <X11/Xaw3d/XawInit.h>
+#include <X11/Xaw3d/ThreeDP.h>
+#include <X11/Xaw3d/SimpleMenP.h>
#include <X11/Xaw3d/SmeLineP.h>
#include <X11/Xaw3d/Cardinals.h>
@@ -213,6 +215,9 @@ XEvent * event;
Region region;
{
SmeLineObject entry = (SmeLineObject) w;
+ SimpleMenuWidget smw = (SimpleMenuWidget) XtParent (w);
+ ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
+ Dimension s = tdw->threeD.shadow_width;
int y = entry->rectangle.y +
(int)(entry->rectangle.height - entry->sme_line.line_width) / 2;
@@ -221,7 +226,7 @@ Region region;
XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
entry->sme_line.gc,
- 0, y, (unsigned int) entry->rectangle.width,
+ s, y, (unsigned int) entry->rectangle.width - 2 * s,
(unsigned int) entry->sme_line.line_width );
}
diff --git a/xc/lib/Xaw3d/SmeP.h b/xc/lib/Xaw3d/SmeP.h
index 0c7805a..9501771 100644
--- a/xc/lib/Xaw3d/SmeP.h
+++ b/xc/lib/Xaw3d/SmeP.h
@@ -47,6 +47,7 @@ in this Software without prior written authorization from the X Consortium.
*
***********************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xaw3d/Sme.h>
/************************************************************
@@ -74,8 +75,9 @@ extern SmeClassRec smeClassRec;
typedef struct {
/* resources */
XtCallbackList callbacks; /* The callback list */
+#ifdef XAW_INTERNATIONALIZATION
Boolean international;
-
+#endif
} SmePart;
/****************************************************************
diff --git a/xc/lib/Xaw3d/SmeThreeD.c b/xc/lib/Xaw3d/SmeThreeD.c
index b51c4e6..a01023c 100644
--- a/xc/lib/Xaw3d/SmeThreeD.c
+++ b/xc/lib/Xaw3d/SmeThreeD.c
@@ -27,10 +27,13 @@ SOFTWARE.
******************************************************************/
+#include "Xaw3dP.h"
#include <X11/Xlib.h>
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include <X11/Xaw3d/XawInit.h>
+#include <X11/Xaw3d/ThreeDP.h>
+#include <X11/Xaw3d/SimpleMenP.h>
#include <X11/Xaw3d/SmeThreeDP.h>
#include <X11/Xosdefs.h>
@@ -223,21 +226,25 @@ static void AllocTopShadowPixmap (new)
} else if (tdo->sme_threeD.be_nice_to_cmap) {
if (parent->core.background_pixel == WhitePixelOfScreen (scn)) {
top_fg_pixel = WhitePixelOfScreen (scn);
- top_bg_pixel = BlackPixelOfScreen (scn);
+ top_bg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
} else if (parent->core.background_pixel == BlackPixelOfScreen (scn)) {
- top_fg_pixel = BlackPixelOfScreen (scn);
+ top_fg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
top_bg_pixel = WhitePixelOfScreen (scn);
} else {
top_fg_pixel = parent->core.background_pixel;
top_bg_pixel = WhitePixelOfScreen (scn);
}
+#ifndef XAW_GRAY_BLKWHT_STIPPLES
if (parent->core.background_pixel == WhitePixelOfScreen (scn) ||
- parent->core.background_pixel == BlackPixelOfScreen (scn))
+ parent->core.background_pixel == BlackPixelOfScreen (scn)) {
pm_data = mtshadowpm_bits;
- else
+ } else
+#endif
pm_data = shadowpm_bits;
+
create_pixmap = TRUE;
}
+
if (create_pixmap)
tdo->sme_threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy,
RootWindowOfScreen (scn),
@@ -268,22 +275,26 @@ static void AllocBotShadowPixmap (new)
create_pixmap = TRUE;
} else if (tdo->sme_threeD.be_nice_to_cmap) {
if (parent->core.background_pixel == WhitePixelOfScreen (scn)) {
- bot_fg_pixel = WhitePixelOfScreen (scn);
+ bot_fg_pixel = grayPixel( WhitePixelOfScreen (scn), dpy, scn);
bot_bg_pixel = BlackPixelOfScreen (scn);
} else if (parent->core.background_pixel == BlackPixelOfScreen (scn)) {
bot_fg_pixel = BlackPixelOfScreen (scn);
- bot_bg_pixel = WhitePixelOfScreen (scn);
+ bot_bg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
} else {
bot_fg_pixel = parent->core.background_pixel;
bot_bg_pixel = BlackPixelOfScreen (scn);
}
+#ifndef XAW_GRAY_BLKWHT_STIPPLES
if (parent->core.background_pixel == WhitePixelOfScreen (scn) ||
- parent->core.background_pixel == BlackPixelOfScreen (scn))
+ parent->core.background_pixel == BlackPixelOfScreen (scn)) {
pm_data = mbshadowpm_bits;
- else
+ } else
+#endif
pm_data = shadowpm_bits;
+
create_pixmap = TRUE;
}
+
if (create_pixmap)
tdo->sme_threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy,
RootWindowOfScreen (scn),
@@ -307,7 +318,7 @@ void XawSme3dComputeTopShadowRGB (new, xcol_out)
double contrast;
Display *dpy = XtDisplayOfObject (new);
Screen *scn = XtScreenOfObject (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = w->core.colormap;
get_c.pixel = w->core.background_pixel;
if (get_c.pixel == WhitePixelOfScreen (scn) ||
@@ -335,9 +346,9 @@ static void AllocTopShadowPixel (new)
{
XColor set_c;
SmeThreeDObject tdo = (SmeThreeDObject) new;
+ Widget w = XtParent (new);
Display *dpy = XtDisplayOfObject (new);
- Screen *scn = XtScreenOfObject (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = w->core.colormap;
XawSme3dComputeTopShadowRGB (new, &set_c);
(void) XAllocColor (dpy, cmap, &set_c);
@@ -357,7 +368,7 @@ void XawSme3dComputeBottomShadowRGB (new, xcol_out)
double contrast;
Display *dpy = XtDisplayOfObject (new);
Screen *scn = XtScreenOfObject (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = w->core.colormap;
get_c.pixel = w->core.background_pixel;
if (get_c.pixel == WhitePixelOfScreen (scn) ||
@@ -383,9 +394,9 @@ static void AllocBotShadowPixel (new)
{
XColor set_c;
SmeThreeDObject tdo = (SmeThreeDObject) new;
+ Widget w = XtParent (new);
Display *dpy = XtDisplayOfObject (new);
- Screen *scn = XtScreenOfObject (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = w->core.colormap;
XawSme3dComputeBottomShadowRGB (new, &set_c);
(void) XAllocColor (dpy, cmap, &set_c);
@@ -528,33 +539,39 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
/* ARGSUSED */
static void
-_XawSme3dDrawShadows (gw)
+_XawSme3dDrawShadows(gw)
Widget gw;
{
- XPoint pt[6];
SmeThreeDObject tdo = (SmeThreeDObject) gw;
- Dimension s = tdo->sme_threeD.shadow_width;
+ SimpleMenuWidget smw = (SimpleMenuWidget) XtParent(gw);
+ ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
+ Dimension s = tdo->sme_threeD.shadow_width;
+ Dimension ps = tdw->threeD.shadow_width;
+ XPoint pt[6];
+
/*
* draw the shadows using the core part width and height,
* and the threeD part shadow_width.
*
- * no point to do anything if the shadow_width is 0 or the
- * widget has not been realized.
+ * no point to do anything if the shadow_width is 0 or the
+ * widget has not been realized.
*/
- if((s > 0) && XtIsRealized (gw)){
-
+ if (s > 0 && XtIsRealized(gw))
+ {
Dimension h = tdo->rectangle.height;
- Dimension w = tdo->rectangle.width;
- Dimension x = tdo->rectangle.x;
+ Dimension w = tdo->rectangle.width - ps;
+ Dimension x = tdo->rectangle.x + ps;
Dimension y = tdo->rectangle.y;
- Display *dpy = XtDisplayOfObject (gw);
- Window win = XtWindowOfObject (gw);
+ Display *dpy = XtDisplayOfObject(gw);
+ Window win = XtWindowOfObject(gw);
GC top, bot;
- if (tdo->sme_threeD.shadowed) {
+ if (tdo->sme_threeD.shadowed)
+ {
top = tdo->sme_threeD.top_shadow_GC;
bot = tdo->sme_threeD.bot_shadow_GC;
- } else
+ }
+ else
top = bot = tdo->sme_threeD.erase_GC;
/* top-left shadow */
@@ -562,18 +579,18 @@ _XawSme3dDrawShadows (gw)
pt[1].x = x; pt[1].y = y;
pt[2].x = w; pt[2].y = y;
pt[3].x = w - s; pt[3].y = y + s;
- pt[4].x = s; pt[4].y = y + s;
- pt[5].x = s; pt[5].y = y + h - s;
- XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin);
+ pt[4].x = ps + s; pt[4].y = y + s;
+ pt[5].x = ps + s; pt[5].y = y + h - s;
+ XFillPolygon(dpy, win, top, pt, 6, Complex, CoordModeOrigin);
/* bottom-right shadow */
- /* pt[0].x = x; pt[0].y = y + h; */
+/* pt[0].x = x; pt[0].y = y + h; */
pt[1].x = w; pt[1].y = y + h;
- /* pt[2].x = w; pt[2].y = y; */
- /* pt[3].x = w - s; pt[3].y = y + s; */
+/* pt[2].x = w; pt[2].y = y; */
+/* pt[3].x = w - s; pt[3].y = y + s; */
pt[4].x = w - s; pt[4].y = y + h - s;
- /* pt[5].x = s; pt[5].y = y + h - s; */
- XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin);
+/* pt[5].x = ps + s; pt[5].y = y + h - s; */
+ XFillPolygon(dpy, win, bot, pt, 6, Complex, CoordModeOrigin);
}
}
diff --git a/xc/lib/Xaw3d/StripChart.c b/xc/lib/Xaw3d/StripChart.c
index 6c47f4c..5344f97 100644
--- a/xc/lib/Xaw3d/StripChart.c
+++ b/xc/lib/Xaw3d/StripChart.c
@@ -238,7 +238,7 @@ static void Redisplay(gw, event, region)
StripChartWidgetClass swclass = (StripChartWidgetClass) XtClass (gw);
Dimension x, width, s = w->threeD.shadow_width;
- (*swclass->threeD_class.shadowdraw) (gw, event, region, FALSE);
+ (*swclass->threeD_class.shadowdraw) (gw, event, region, w->threeD.relief, FALSE);
if (event->type == GraphicsExpose) {
x = event->xgraphicsexpose.x;
@@ -295,7 +295,7 @@ XtIntervalId *id; /* unused */
w->strip_chart.interval = repaint_window((Widget)w, 0, (int) w->core.width - 2 * s);
(*swclass->threeD_class.shadowdraw) ((Widget) w,
(XEvent *)0, (Region)0,
- FALSE);
+ w->threeD.relief, FALSE);
}
}
@@ -364,7 +364,7 @@ int left, width;
if (XtIsRealized (gw)) {
XClearWindow (XtDisplay (gw), XtWindow (gw));
- (*swclass->threeD_class.shadowdraw) (gw, (XEvent *)0, (Region)0, FALSE);
+ (*swclass->threeD_class.shadowdraw) (gw, (XEvent *)0, (Region)0, w->threeD.relief, FALSE);
}
}
diff --git a/xc/lib/Xaw3d/Text.c b/xc/lib/Xaw3d/Text.c
index ceadbf6..4b47bbd 100644
--- a/xc/lib/Xaw3d/Text.c
+++ b/xc/lib/Xaw3d/Text.c
@@ -48,27 +48,30 @@ SOFTWARE.
******************************************************************/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#ifdef XAW_INTERNATIONALIZATION
#include "XawI18n.h"
+#endif
#include <stdio.h>
-
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/StdSel.h>
#include <X11/Xmu/Misc.h>
-
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/Cardinals.h>
#include <X11/Xaw3d/Scrollbar.h>
#include <X11/Xaw3d/TextP.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSinkP.h>
#include <X11/Xaw3d/XawImP.h>
-
+#endif
+#include <X11/Xaw3d/ThreeDP.h>
#include <X11/Xfuncs.h>
#include <ctype.h> /* for isprint() */
@@ -78,7 +81,9 @@ SOFTWARE.
unsigned long FMT8BIT = 0L;
unsigned long XawFmt8Bit = 0L;
+#ifdef XAW_INTERNATIONALIZATION
unsigned long XawFmtWide = 0L;
+#endif
#define SinkClearToBG XawTextSinkClearToBackground
@@ -314,8 +319,10 @@ ClassInitialize()
if (!XawFmt8Bit)
FMT8BIT = XawFmt8Bit = XrmPermStringToQuark("FMT8BIT");
+#ifdef XAW_INTERNATIONALIZATION
if (!XawFmtWide)
XawFmtWide = XrmPermStringToQuark("FMTWIDE");
+#endif
XawInitializeWidgetSet();
@@ -351,18 +358,23 @@ TextWidget ctx;
{
Widget vbar = ctx->text.vbar, hbar = ctx->text.hbar;
Position top, left = 0;
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
if (ctx->text.hbar == NULL) return;
if (vbar != NULL)
left += (Position) (vbar->core.width + vbar->core.border_width);
- XtResizeWidget( hbar, ctx->core.width - left, hbar->core.height,
+ XtResizeWidget( hbar, ctx->core.width - left - s, hbar->core.height,
hbar->core.border_width );
- left -= (Position) hbar->core.border_width;
-
- top = ctx->core.height - ( hbar->core.height + hbar->core.border_width);
+ left = s / 2 - (Position) hbar->core.border_width;
+ if (left < 0) left = 0;
+ if (vbar != NULL)
+ left += (Position) (vbar->core.width + vbar->core.border_width);
+
+ top = ctx->core.height - (hbar->core.height + hbar->core.border_width + s / 2);
+
XtMoveWidget( hbar, left, top);
}
@@ -377,13 +389,18 @@ PositionVScrollBar(ctx)
TextWidget ctx;
{
Widget vbar = ctx->text.vbar;
+ Position pos;
Dimension bw;
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
if (vbar == NULL) return;
bw = vbar->core.border_width;
- XtResizeWidget( vbar, vbar->core.width, ctx->core.height, bw);
- XtMoveWidget( vbar, -(Position)bw, -(Position)bw );
+ XtResizeWidget( vbar, vbar->core.width, ctx->core.height - s, bw);
+ pos = s / 2 - (Position)bw;
+ if (pos < 0) pos = 0;
+
+ XtMoveWidget( vbar, pos, pos);
}
static void
@@ -457,6 +474,10 @@ TextWidget ctx;
XtAddCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars,
(XtPointer) NULL);
+/**/
+ ctx->text.r_margin.bottom += hbar->core.height + hbar->core.border_width;
+ ctx->text.margin.bottom = ctx->text.r_margin.bottom;
+/**/
PositionHScrollBar(ctx);
if (XtIsRealized((Widget)ctx)) {
XtRealizeWidget(hbar);
@@ -478,10 +499,10 @@ TextWidget ctx;
if (hbar == NULL) return;
-/*
+/**/
ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width;
ctx->text.margin.bottom = ctx->text.r_margin.bottom;
-*/
+/**/
if (ctx->text.vbar == NULL)
XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars,
(XtPointer) NULL);
@@ -498,6 +519,19 @@ Cardinal *num_args; /* unused */
{
TextWidget ctx = (TextWidget) new;
char error_buf[BUFSIZ];
+ int s;
+
+ ctx->text.threeD = XtVaCreateWidget("threeD", threeDWidgetClass, new,
+ XtNx, 0, XtNy, 0,
+ XtNwidth, 10, XtNheight, 10, /* dummy */
+ NULL);
+
+ s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
+
+ ctx->text.r_margin.left += s;
+ ctx->text.r_margin.right += s;
+ ctx->text.r_margin.top += s;
+ ctx->text.r_margin.bottom += s - 1;
ctx->text.lt.lines = 0;
ctx->text.lt.info = NULL;
@@ -671,12 +705,14 @@ XawTextInsertState state;
/* Keep Input Method up to speed */
+#ifdef XAW_INTERNATIONALIZATION
if ( ctx->simple.international ) {
Arg list[1];
XtSetArg (list[0], XtNinsertPosition, ctx->text.insertPos);
_XawImSetValues (w, list, 1);
}
+#endif
}
/*
@@ -730,8 +766,10 @@ XawTextPosition left, right;
if (_XawTextFormat(ctx) == XawFmt8Bit)
bytes = sizeof(unsigned char);
+#ifdef XAW_INTERNATIONALIZATION
else if (_XawTextFormat(ctx) == XawFmtWide)
bytes = sizeof(wchar_t);
+#endif
else /* if there is another fomat, add here */
bytes = 1;
@@ -767,6 +805,7 @@ XawTextPosition left, right;
wchar_t *ws, wc;
/* allow ESC in accordance with ICCCM */
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
MultiSinkObject sink = (MultiSinkObject) ctx->text.sink;
ws = (wchar_t *)_XawTextGetText(ctx, left, right);
@@ -779,7 +818,9 @@ XawTextPosition left, right;
}
ws[i] = (wchar_t)0;
return (char *)ws;
- } else {
+ } else
+#endif
+ {
s = (unsigned char *)_XawTextGetText(ctx, left, right);
/* only HT and NL control chars are allowed, strip out others */
n = strlen((char *)s);
@@ -1000,7 +1041,8 @@ int line;
for ( count = 0; count < 2 ; count++)
if (line++ < ctx->text.lt.lines) { /* make sure not to run of the end. */
- (++lt)->y = (count == 0) ? y : ctx->core.height;
+ (++lt)->y = (count == 0) ? y : ctx->core.height
+ - 2 * ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
lt->textWidth = 0;
lt->position = ctx->text.lastPos + 100;
}
@@ -1103,6 +1145,7 @@ TextWidget ctx;
float first, last, widest;
Boolean temp = (ctx->text.hbar == NULL);
Boolean vtemp = (ctx->text.vbar == NULL);
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
CheckVBarScrolling(ctx);
@@ -1110,9 +1153,9 @@ TextWidget ctx;
if (ctx->text.vbar != NULL)
widest = (int)(ctx->core.width - ctx->text.vbar->core.width -
- ctx->text.vbar->core.border_width);
+ 2 * s - ctx->text.vbar->core.border_width);
else
- widest = ctx->core.width;
+ widest = ctx->core.width - 2 * s;
widest /= (last = GetWidestLine(ctx));
if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded)
if (widest < 1.0)
@@ -1157,6 +1200,7 @@ int n;
int y;
Arg list[1];
XawTextLineTable * lt = &(ctx->text.lt);
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
if (abs(n) > ctx->text.lt.lines)
n = (n > 0) ? ctx->text.lt.lines : -ctx->text.lt.lines;
@@ -1169,20 +1213,21 @@ int n;
else
top = ctx->text.lastPos;
- y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height;
+ y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height - 2 * s;
_XawTextBuildLineTable(ctx, top, FALSE);
if (top >= ctx->text.lastPos)
DisplayTextWindow( (Widget) ctx);
else {
XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc,
- 0, y, (int)ctx->core.width, (int)ctx->core.height - y,
- 0, ctx->text.margin.top);
+ s, y, (int)ctx->core.width - 2 * s, (int)ctx->core.height - y - s,
+ s, ctx->text.margin.top);
PushCopyQueue(ctx, 0, (int) -y);
SinkClearToBG(ctx->text.sink,
- (Position) 0,
- (Position) (ctx->text.margin.top + ctx->core.height - y),
- (Dimension) ctx->core.width, (Dimension) ctx->core.height);
+ (Position) s,
+ (Position) (ctx->text.margin.top + ctx->core.height - y - s),
+ (Dimension) ctx->core.width - 2 * s,
+ (Dimension) ctx->core.height - 2 * s);
if (n < lt->lines) n++; /* update descenders at bottom */
_XawTextNeedsUpdating(ctx, lt->info[lt->lines - n].position,
@@ -1200,7 +1245,7 @@ int n;
XawsdLeft, n+1, FALSE);
_XawTextBuildLineTable(ctx, top, FALSE);
- y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height;
+ y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height - 2 * s;
updateTo = IsValidLine(ctx, n) ? lt->info[n].position : ctx->text.lastPos;
if (IsValidLine(ctx, lt->lines - n))
height = lt->info[lt->lines-n].y - ctx->text.margin.top;
@@ -1215,10 +1260,11 @@ int n;
if ( updateTo == target ) {
XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc,
- 0, ctx->text.margin.top, (int) ctx->core.width, height, 0, y);
+ s, ctx->text.margin.top, (int) ctx->core.width - 2 * s,
+ height, s, y);
PushCopyQueue(ctx, 0, (int) y);
- SinkClearToBG(ctx->text.sink, (Position) 0, ctx->text.margin.top,
- (Dimension) ctx->core.width, (Dimension) clear_height);
+ SinkClearToBG(ctx->text.sink, (Position) s, ctx->text.margin.top,
+ (Dimension) ctx->core.width - 2 * s, (Dimension) clear_height);
_XawTextNeedsUpdating(ctx, lt->info[0].position, updateTo);
_XawTextSetScrollBars(ctx);
@@ -1227,7 +1273,13 @@ int n;
DisplayTextWindow((Widget)ctx);
}
XtSetArg (list[0], XtNinsertPosition, ctx->text.lt.top+ctx->text.lt.lines);
+#ifdef XAW_INTERNATIONALIZATION
_XawImSetValues ((Widget) ctx, list, 1);
+#endif
+
+ _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD,
+ 0, 0, ctx->core.width, ctx->core.height,
+ ((ThreeDWidget)ctx->text.threeD)->threeD.relief, False);
}
/*ARGSUSED*/
@@ -1241,7 +1293,8 @@ XtPointer callData; /* #pixels */
Widget tw = (Widget) ctx;
Position old_left, pixels = (Position)(int) callData;
XRectangle rect, t_rect;
-
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
+
_XawTextPrepareToUpdate(ctx);
old_left = ctx->text.margin.left;
@@ -1255,17 +1308,17 @@ XtPointer callData; /* #pixels */
rect.width = (unsigned short) pixels + ctx->text.margin.right;
rect.x = (short) ctx->core.width - (short) rect.width;
rect.y = (short) ctx->text.margin.top;
- rect.height = (unsigned short) ctx->core.height - rect.y;
+ rect.height = (unsigned short) ctx->core.height - rect.y - 2 * s;
XCopyArea(XtDisplay(tw), XtWindow(tw), XtWindow(tw), ctx->text.gc,
- pixels, (int) rect.y,
- (unsigned int) rect.x, (unsigned int) ctx->core.height,
- 0, (int) rect.y);
+ pixels + s, (int) rect.y,
+ (unsigned int) rect.x, (unsigned int) ctx->core.height - 2 * s,
+ s, (int) rect.y);
PushCopyQueue(ctx, (int) -pixels, 0);
}
else if (pixels < 0) {
- rect.x = 0;
+ rect.x = s;
if (ctx->text.vbar != NULL)
rect.x += (short) (ctx->text.vbar->core.width +
@@ -1273,11 +1326,11 @@ XtPointer callData; /* #pixels */
rect.width = (Position) - pixels;
rect.y = ctx->text.margin.top;
- rect.height = ctx->core.height - rect.y;
+ rect.height = ctx->core.height - rect.y - 2 * s;
XCopyArea(XtDisplay(tw), XtWindow(tw), XtWindow(tw), ctx->text.gc,
(int) rect.x, (int) rect.y,
- (unsigned int) ctx->core.width - rect.width,
+ (unsigned int) ctx->core.width - rect.width - 2 * s,
(unsigned int) rect.height,
(int) rect.x + rect.width, (int) rect.y);
@@ -1287,10 +1340,10 @@ XtPointer callData; /* #pixels */
* Redraw the line overflow marks.
*/
- t_rect.x = ctx->core.width - ctx->text.margin.right;
+ t_rect.x = ctx->core.width - ctx->text.margin.right - s;
t_rect.width = ctx->text.margin.right;
t_rect.y = rect.y;
- t_rect.height = rect.height;
+ t_rect.height = rect.height - 2 * s;
SinkClearToBG(ctx->text.sink, (Position) t_rect.x, (Position) t_rect.y,
(Dimension) t_rect.width, (Dimension) t_rect.height);
@@ -1409,7 +1462,7 @@ XtPointer callData; /* #pixels */
if (height < 1)
height = 1;
nlines = (int) (lines * (int) ctx->text.lt.lines) / height;
-#ifdef ARROW_SCROLLBAR
+#ifdef XAW_ARROW_SCROLLBARS
if (nlines == 0 && lines != 0)
nlines = lines > 0 ? 1 : -1;
#endif
@@ -1557,9 +1610,11 @@ int *format;
*target == XA_TEXT(d) ||
*target == XA_COMPOUND_TEXT(d)) {
if (*target == XA_TEXT(d)) {
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide)
*type = XA_COMPOUND_TEXT(d);
else
+#endif
*type = XA_STRING;
} else {
*type = *target;
@@ -1573,6 +1628,7 @@ int *format;
*/
if (!salt) {
*value = _XawTextGetSTRING(ctx, s->left, s->right);
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
XTextProperty textprop;
if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
@@ -1584,7 +1640,9 @@ int *format;
XtFree(*value);
*value = (XtPointer)textprop.value;
*length = textprop.nitems;
- } else {
+ } else
+#endif
+ {
*length = strlen(*value);
}
} else {
@@ -1592,6 +1650,7 @@ int *format;
strcpy (*value, salt->contents);
*length = salt->length;
}
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide && *type == XA_STRING) {
XTextProperty textprop;
wchar_t **wlist;
@@ -1615,6 +1674,7 @@ int *format;
*length = textprop.nitems;
XwcFreeStringList( (wchar_t**) wlist );
}
+#endif
*format = 8;
return True;
}
@@ -1804,6 +1864,7 @@ int num_atoms;
salt->s.right = ctx->text.s.right;
salt->s.type = ctx->text.s.type;
salt->contents = _XawTextGetSTRING(ctx, ctx->text.s.left, ctx->text.s.right);
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
XTextProperty textprop;
if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
@@ -1817,6 +1878,7 @@ int num_atoms;
salt->contents = (char *)textprop.value;
salt->length = textprop.nitems;
} else
+#endif
salt->length = strlen (salt->contents);
salt->next = ctx->text.salt;
ctx->text.salt = salt;
@@ -1880,6 +1942,7 @@ Cardinal count;
tptr= ptr= (unsigned char *) _XawTextGetSTRING(ctx, ctx->text.s.left,
ctx->text.s.right);
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
/*
* Only XA_STRING(Latin 1) is allowed in CUT_BUFFER,
@@ -1894,6 +1957,7 @@ Cardinal count;
XtFree((char *)ptr);
tptr = ptr = textprop.value;
}
+#endif
if (buffer == 0) {
_CreateCutBuffers(XtDisplay(w));
XRotateBuffers(XtDisplay(w), 1);
@@ -2041,6 +2105,7 @@ XawTextPosition pos1, pos2;
int height, line, i, lastPos = ctx->text.lastPos;
XawTextPosition startPos, endPos;
Boolean clear_eol, done_painting;
+ Dimension s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
pos1 = (pos1 < ctx->text.lt.top) ? ctx->text.lt.top : pos1;
pos2 = FindGoodPosition(ctx, pos2);
@@ -2060,13 +2125,22 @@ XawTextPosition pos1, pos2;
done_painting = FALSE;
}
- height = ctx->text.lt.info[i + 1].y - ctx->text.lt.info[i].y;
+ height = ctx->text.lt.info[i + 1].y - ctx->text.lt.info[i].y - s + 1;
if ( (endPos > startPos) ) {
+
+ /* note to self: _ShadowSurroundedBox() hacks are in here */
+
if ( (x == (Position) ctx->text.margin.left) && (x > 0) )
+ {
SinkClearToBG (ctx->text.sink,
- (Position) 0, y,
- (Dimension) ctx->text.margin.left, (Dimension)height);
+ (Position) s, y,
+ (Dimension) ctx->text.margin.left, (Dimension)height);
+ _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD,
+ 0, 0, ctx->core.width, ctx->core.height,
+ ((ThreeDWidget)ctx->text.threeD)->threeD.relief,
+ False);
+ }
if ( (startPos >= ctx->text.s.right) || (endPos <= ctx->text.s.left) )
XawTextSinkDisplayText(ctx->text.sink, x, y, startPos, endPos, FALSE);
@@ -2081,10 +2155,16 @@ XawTextPosition pos1, pos2;
}
startPos = endPos;
if (clear_eol) {
+ Position myx = ctx->text.lt.info[i].textWidth + ctx->text.margin.left;
+
SinkClearToBG(ctx->text.sink,
- (Position) (ctx->text.lt.info[i].textWidth +
- ctx->text.margin.left),
- (Position) y, w->core.width, (Dimension) height);
+ (Position) myx,
+ (Position) y, w->core.width - myx/* - 2 * s*/,
+ (Dimension) height);
+ _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD,
+ 0, 0, ctx->core.width, ctx->core.height,
+ ((ThreeDWidget)ctx->text.threeD)->threeD.relief,
+ False);
/*
* We only get here if single character is true, and we need
@@ -2101,7 +2181,12 @@ XawTextPosition pos1, pos2;
y += height;
SinkClearToBG(ctx->text.sink,
(Position) ctx->text.margin.left, (Position) y,
- w->core.width, (Dimension) height);
+ w->core.width - ctx->text.margin.left/* - 2 * s*/,
+ (Dimension) Min(height, ctx->core.height - 2 * s - y));
+ _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD,
+ 0, 0, ctx->core.width, ctx->core.height,
+ ((ThreeDWidget)ctx->text.threeD)->threeD.relief,
+ False);
break; /* set single_char to FALSE and return. */
}
@@ -2339,11 +2424,15 @@ ClearWindow (w)
Widget w;
{
TextWidget ctx = (TextWidget) w;
+ int s = ((ThreeDWidget)ctx->text.threeD)->threeD.shadow_width;
if (XtIsRealized(w))
+ {
SinkClearToBG(ctx->text.sink,
- (Position) 0, (Position) 0,
- w->core.width, w->core.height);
+ (Position) s, (Position) s,
+ w->core.width - 2 * s, w->core.height - 2 * s);
+ /* note to self: _ShadowSurroundedBox() hack might be needed here */
+ }
}
/* Function Name: _XawTextClearAndCenterDisplay
@@ -2641,6 +2730,10 @@ Region region; /* Unused. */
UpdateTextInRectangle(ctx, &cursor);
}
_XawTextExecuteUpdate(ctx);
+
+ _ShadowSurroundedBox((Widget)ctx, (ThreeDWidget)ctx->text.threeD,
+ 0, 0, ctx->core.width, ctx->core.height,
+ ((ThreeDWidget)ctx->text.threeD)->threeD.relief, False);
}
/*
diff --git a/xc/lib/Xaw3d/TextAction.c b/xc/lib/Xaw3d/TextAction.c
index 930a3cf..65b8539 100644
--- a/xc/lib/Xaw3d/TextAction.c
+++ b/xc/lib/Xaw3d/TextAction.c
@@ -26,6 +26,8 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
+
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
@@ -34,10 +36,14 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xmu/StdSel.h> /* for XmuConvertStandardSelection */
#include <X11/Xmu/Atoms.h> /* for XA_COMPOUND_TEXT */
#include <X11/Xaw3d/TextP.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSrcP.h>
#include <X11/Xaw3d/XawImP.h>
+#endif
#include <X11/Xfuncs.h>
+#ifdef XAW_INTERNATIONALIZATION
#include "XawI18n.h"
+#endif
#include <stdio.h>
#include <ctype.h>
@@ -218,6 +224,7 @@ and if it is we can only assume the sending client is using the same locale as
we are, and convert it. I also warn the user that the other client is evil. */
StartAction( ctx, (XEvent*) NULL );
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
XTextProperty textprop;
Display *d = XtDisplay((Widget)ctx);
@@ -264,6 +271,7 @@ we are, and convert it. I also warn the user that the other client is evil. */
XtFree((XtPointer)wlist);
text.format = XawFmtWide;
} else
+#endif
text.format = XawFmt8Bit;
text.ptr = (char*)value;
text.firstPos = 0;
@@ -691,9 +699,11 @@ ConvertSelection(w, selection, target, type, value, length, format)
*target == XA_TEXT(d) ||
*target == XA_COMPOUND_TEXT(d)) {
if (*target == XA_TEXT(d)) {
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide)
*type = XA_COMPOUND_TEXT(d);
else
+#endif
*type = XA_STRING;
} else {
*type = *target;
@@ -707,6 +717,7 @@ ConvertSelection(w, selection, target, type, value, length, format)
*/
if (!salt) {
*value = (char *)_XawTextGetSTRING(ctx, s->left, s->right);
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
XTextProperty textprop;
if (XwcTextListToTextProperty(d, (wchar_t**)value, 1,
@@ -718,7 +729,9 @@ ConvertSelection(w, selection, target, type, value, length, format)
XtFree(*value);
*value = (XtPointer)textprop.value;
*length = textprop.nitems;
- } else {
+ } else
+#endif
+ {
*length = strlen(*value);
}
} else {
@@ -726,6 +739,7 @@ ConvertSelection(w, selection, target, type, value, length, format)
strcpy (*value, salt->contents);
*length = salt->length;
}
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide && *type == XA_STRING) {
XTextProperty textprop;
wchar_t** wlist;
@@ -749,6 +763,7 @@ ConvertSelection(w, selection, target, type, value, length, format)
*length = textprop.nitems;
XwcFreeStringList( (wchar_t**) wlist );
}
+#endif
*format = 8;
return True;
}
@@ -883,6 +898,7 @@ Boolean kill;
salt->s.left = from;
salt->s.right = to;
salt->contents = (char *)_XawTextGetSTRING(ctx, from, to);
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
XTextProperty textprop;
if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
@@ -896,6 +912,7 @@ Boolean kill;
salt->contents = (char *)textprop.value;
salt->length = textprop.nitems;
} else
+#endif
salt->length = strlen (salt->contents);
salt->next = ctx->text.salt2;
ctx->text.salt2 = salt;
@@ -1113,6 +1130,7 @@ TextWidget ctx;
text.length = ctx->text.mult;
text.firstPos = 0;
+#ifdef XAW_INTERNATIONALIZATION
if ( text.format == XawFmtWide ) {
wchar_t* wptr;
text.ptr = XtMalloc(sizeof(wchar_t) * ctx->text.mult);
@@ -1120,7 +1138,9 @@ TextWidget ctx;
for (count = 0; count < ctx->text.mult; count++ )
wptr[count] = _Xaw_atowc(XawLF);
}
- else {
+ else
+#endif
+ {
text.ptr = XtMalloc(sizeof(char) * ctx->text.mult);
for (count = 0; count < ctx->text.mult; count++ )
text.ptr[count] = XawLF;
@@ -1200,6 +1220,7 @@ Cardinal *n;
text.format = _XawTextFormat(ctx);
text.firstPos = 0;
+#ifdef XAW_INTERNATIONALIZATION
if ( text.format == XawFmtWide ) {
wchar_t* ptr;
text.ptr = XtMalloc( ( 2 + wcslen((wchar_t*)line_to_ip) ) * sizeof(wchar_t) );
@@ -1214,7 +1235,9 @@ Cardinal *n;
*ptr = (wchar_t)0;
text.length = wcslen((wchar_t*)text.ptr);
- } else {
+ } else
+#endif
+ {
char *ptr;
length = strlen(line_to_ip);
/* The current line + \0 and LF will be copied to this
@@ -1428,7 +1451,9 @@ Cardinal* n;
TextWidget ctx = (TextWidget) w;
/* Let the input method know focus has arrived. */
+#ifdef XAW_INTERNATIONALIZATION
_XawImSetFocusValues (w, NULL, 0);
+#endif
if ( event->xfocus.detail == NotifyPointer ) return;
ctx->text.hasfocus = TRUE;
@@ -1445,7 +1470,9 @@ Cardinal* n;
TextWidget ctx = (TextWidget) w;
/* Let the input method know focus has left.*/
+#ifdef XAW_INTERNATIONALIZATION
_XawImUnsetFocus(w);
+#endif
if ( event->xfocus.detail == NotifyPointer ) return;
ctx->text.hasfocus = FALSE;
}
@@ -1460,10 +1487,12 @@ TextEnterWindow( w, event, params, num_params )
{
TextWidget ctx = (TextWidget) w;
+#ifdef XAW_INTERNATIONALIZATION
if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus &&
!ctx->text.hasfocus) {
_XawImSetFocusValues(w, NULL, 0);
}
+#endif
}
/*ARGSUSED*/
@@ -1476,10 +1505,12 @@ TextLeaveWindow( w, event, params, num_params )
{
TextWidget ctx = (TextWidget) w;
+#ifdef XAW_INTERNATIONALIZATION
if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus &&
!ctx->text.hasfocus) {
_XawImUnsetFocus(w);
}
+#endif
}
static XComposeStatus compose_status = {NULL, 0};
@@ -1517,12 +1548,14 @@ TextWidget ctx;
return;
text.format = XawFmt8Bit;
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
text.format = XawFmtWide;
text.ptr = (char *)XtMalloc(sizeof(wchar_t) * 2);
((wchar_t*)text.ptr)[0] = _Xaw_atowc(XawLF);
((wchar_t*)text.ptr)[1] = 0;
} else
+#endif
text.ptr = "\n";
text.length = 1;
text.firstPos = 0;
@@ -1545,16 +1578,19 @@ Cardinal* n;
KeySym keysym;
XawTextBlock text;
+#ifdef XAW_INTERNATIONALIZATION
if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass))
text.length = _XawImWcLookupString (w, &event->xkey,
(wchar_t*) strbuf, BUFSIZ, &keysym, (Status*) &compose_status);
else
+#endif
text.length = XLookupString ((XKeyEvent*)event, strbuf, BUFSIZ, &keysym, &compose_status);
if (text.length == 0)
return;
text.format = _XawTextFormat( ctx );
+#ifdef XAW_INTERNATIONALIZATION
if ( text.format == XawFmtWide ) {
text.ptr = ptr = XtMalloc(sizeof(wchar_t) * text.length * ctx->text.mult );
for (count = 0; count < ctx->text.mult; count++ ) {
@@ -1562,7 +1598,9 @@ Cardinal* n;
ptr += sizeof(wchar_t) * text.length;
}
- } else { /* == XawFmt8Bit */
+ } else
+#endif
+ { /* == XawFmt8Bit */
text.ptr = ptr = XtMalloc( sizeof(char) * text.length * ctx->text.mult );
for ( count = 0; count < ctx->text.mult; count++ ) {
strncpy( ptr, strbuf, text.length );
@@ -1707,6 +1745,7 @@ Cardinal* num_params;
if ( text.length == 0 ) continue;
+#ifdef XAW_INTERNATIONALIZATION
if ( _XawTextFormat( ctx ) == XawFmtWide ) { /* convert to WC */
int temp_len;
@@ -1734,6 +1773,7 @@ Cardinal* num_params;
continue;
}
} /* convert to WC */
+#endif
if ( _XawTextReplace( ctx, ctx->text.insertPos,
ctx->text.insertPos, &text ) ) {
@@ -1863,12 +1903,14 @@ XawTextPosition from, to;
text.format = _XawTextFormat(ctx);
if ( text.format == XawFmt8Bit )
text.ptr= " ";
+#ifdef XAW_INTERNATIONALIZATION
else {
wc_two_spaces[0] = _Xaw_atowc(XawSP);
wc_two_spaces[1] = _Xaw_atowc(XawSP);
wc_two_spaces[2] = 0;
text.ptr = (char*) wc_two_spaces;
}
+#endif
/* Strip out CR's. */
@@ -1902,10 +1944,12 @@ XawTextPosition from, to;
text.length = 1;
buf = _XawTextGetText(ctx, periodPos, next_word);
+#ifdef XAW_INTERNATIONALIZATION
if (text.format == XawFmtWide) {
if ( (periodPos < endPos) && (((wchar_t*)buf)[0] == _Xaw_atowc('.')))
text.length++;
} else
+#endif
if ( (periodPos < endPos) && (buf[0] == '.') )
text.length++; /* Put in two spaces. */
@@ -1914,11 +1958,13 @@ XawTextPosition from, to;
*/
for (i = 1 ; i < len; i++)
+#ifdef XAW_INTERNATIONALIZATION
if (text.format == XawFmtWide) {
if ( !iswspace(((wchar_t*)buf)[i]) || ((periodPos + i) >= to) ) {
break;
}
} else
+#endif
if ( !isspace(buf[i]) || ((periodPos + i) >= to) ) {
break;
}
@@ -1957,11 +2003,13 @@ XawTextPosition from, to;
if ( text.format == XawFmt8Bit )
text.ptr = "\n";
+#ifdef XAW_INTERNATIONALIZATION
else {
wide_CR[0] = _Xaw_atowc(XawLF);
wide_CR[1] = 0;
text.ptr = (char*) wide_CR;
}
+#endif
startPos = from;
/* CONSTCOND */
@@ -1983,10 +2031,12 @@ XawTextPosition from, to;
len = (int) (space - eol);
buf = _XawTextGetText(ctx, eol, space);
for ( i = 0 ; i < len ; i++)
+#ifdef XAW_INTERNATIONALIZATION
if (text.format == XawFmtWide) {
if (!iswspace(((wchar_t*)buf)[i]))
break;
} else
+#endif
if (!isspace(buf[i]))
break;
@@ -2103,6 +2153,7 @@ Cardinal* num_params;
/* Retrieve text and swap the characters. */
+#ifdef XAW_INTERNATIONALIZATION
if ( text.format == XawFmtWide) {
wchar_t wc;
wchar_t* wbuf;
@@ -2115,7 +2166,9 @@ Cardinal* num_params;
wbuf[ i-1 ] = wc;
buf = (char*) wbuf; /* so that it gets assigned and freed */
- } else { /* thus text.format == XawFmt8Bit */
+ } else
+#endif
+ { /* thus text.format == XawFmt8Bit */
char c;
buf = _XawTextGetText( ctx, start, end );
text.length = strlen( buf );
@@ -2170,6 +2223,7 @@ Cardinal* num_params;
* was started up before an IM was started up.
*/
+#ifdef XAW_INTERNATIONALIZATION
/*ARGSUSED*/
static void
Reconnect( w, event, params, num_params )
@@ -2180,6 +2234,7 @@ Reconnect( w, event, params, num_params )
{
_XawImReconnect( w );
}
+#endif
XtActionsRec _XawTextActionsTable[] = {
@@ -2264,7 +2319,9 @@ XtActionsRec _XawTextActionsTable[] = {
{"PopdownSearchAction", _XawTextPopdownSearchAction},
/* Reconnect to Input Method */
+#ifdef XAW_INTERNATIONALIZATION
{"reconnect-im", Reconnect} /* Li Yuhong, Omron KK, 1991 */
+#endif
};
Cardinal _XawTextActionsTableCount = XtNumber(_XawTextActionsTable);
diff --git a/xc/lib/Xaw3d/TextP.h b/xc/lib/Xaw3d/TextP.h
index 22c2455..9121314 100644
--- a/xc/lib/Xaw3d/TextP.h
+++ b/xc/lib/Xaw3d/TextP.h
@@ -216,6 +216,7 @@ typedef struct _TextPart {
XawTextPosition old_insert; /* Last insertPos for batched updates */
short mult; /* Multiplier. */
struct text_move * copy_area_offsets; /* Text offset area (linked list) */
+ Widget threeD; /* shadow drawing */
/* private state, shared w/Source and Sink */
Boolean redisplay_needed; /* in SetValues */
diff --git a/xc/lib/Xaw3d/TextPop.c b/xc/lib/Xaw3d/TextPop.c
index 57fc4b5..260b4dc 100644
--- a/xc/lib/Xaw3d/TextPop.c
+++ b/xc/lib/Xaw3d/TextPop.c
@@ -48,10 +48,10 @@ in this Software without prior written authorization from the X Consortium.
*
*************************************************************/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
-
#include <X11/Xaw3d/TextP.h>
#include <X11/Xaw3d/AsciiText.h>
#include <X11/Xaw3d/Cardinals.h>
@@ -59,7 +59,9 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xaw3d/Form.h>
#include <X11/Xaw3d/Toggle.h>
#include <X11/Xmu/CharSet.h>
+#ifdef XAW_INTERNATIONALIZATION
#include "XawI18n.h"
+#endif
#include <stdio.h>
#include <X11/Xos.h> /* for O_RDONLY */
#include <errno.h>
@@ -533,11 +535,13 @@ Cardinal * num_params;
if (*num_params == 2 )
ptr = params[1];
else
+#ifdef XAW_INTERNATIONALIZATION
if (_XawTextFormat(ctx) == XawFmtWide) {
/*This just does the equivalent of ptr = ""L, a waste because params[1] isnt W aligned.*/
ptr = (char *)XtMalloc(sizeof(wchar_t));
*((wchar_t*)ptr) = (wchar_t)0;
} else
+#endif
ptr = "";
switch(params[0][0]) {
@@ -813,9 +817,12 @@ struct SearchAndReplace * search;
TextWidget ctx = (TextWidget)tw;
text.ptr = GetStringRaw(search->search_text);
- if ((text.format = _XawTextFormat(ctx)) == XawFmtWide)
+ text.format = _XawTextFormat(ctx);
+#ifdef XAW_INTERNATIONALIZATION
+ if (text.format == XawFmtWide)
text.length = wcslen((wchar_t*)text.ptr);
else
+#endif
text.length = strlen(text.ptr);
text.firstPos = 0;
@@ -946,17 +953,23 @@ Boolean once_only, show_current;
TextWidget ctx = (TextWidget)tw;
find.ptr = GetStringRaw( search->search_text);
- if ((find.format = _XawTextFormat(ctx)) == XawFmtWide)
+ find.format = _XawTextFormat(ctx);
+#ifdef XAW_INTERNATIONALIZATION
+ if (find.format == XawFmtWide)
find.length = wcslen((wchar_t*)find.ptr);
else
+#endif
find.length = strlen(find.ptr);
find.firstPos = 0;
replace.ptr = GetStringRaw(search->rep_text);
replace.firstPos = 0;
- if ((replace.format = _XawTextFormat(ctx)) == XawFmtWide)
+ replace.format = _XawTextFormat(ctx);
+#ifdef XAW_INTERNATIONALIZATION
+ if (replace.format == XawFmtWide)
replace.length = wcslen((wchar_t*)replace.ptr);
else
+#endif
replace.length = strlen(replace.ptr);
dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) -
diff --git a/xc/lib/Xaw3d/TextSrc.c b/xc/lib/Xaw3d/TextSrc.c
index 27255d1..d954954 100644
--- a/xc/lib/Xaw3d/TextSrc.c
+++ b/xc/lib/Xaw3d/TextSrc.c
@@ -36,6 +36,7 @@ in this Software without prior written authorization from the X Consortium.
*
*/
+#include "Xaw3dP.h"
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
@@ -43,7 +44,9 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xaw3d/TextSrcP.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/CharSet.h>
+#ifdef XAW_INTERNATIONALIZATION
#include "XawI18n.h"
+#endif
#include <stdio.h>
#include <ctype.h>
@@ -584,6 +587,7 @@ _XawTextFormat(tw)
}
+#ifdef XAW_INTERNATIONALIZATION
/* _XawTextWCToMB():
* convert the wchar string to external encoding.
* The caller is responsible for freeing both the source and ret string.
@@ -668,4 +672,5 @@ int *len_in_out;
return(wstr);
}
}
+#endif
diff --git a/xc/lib/Xaw3d/TextTr.c b/xc/lib/Xaw3d/TextTr.c
index d8714a7..a3cd8a9 100644
--- a/xc/lib/Xaw3d/TextTr.c
+++ b/xc/lib/Xaw3d/TextTr.c
@@ -89,7 +89,9 @@ Meta<Key>Z: scroll-one-line-down() \n\
Shift Meta<Key>Delete: backward-kill-word() \n\
~Shift Meta<Key>BackSpace: delete-previous-word() \n\
Shift Meta<Key>BackSpace: backward-kill-word() \n\
-", *_XawDefaultTextTranslations3 = "\
+",
+#if XtVersion >= 11006
+*_XawDefaultTextTranslations3 = "\
<Key>Home: beginning-of-file() \n\
:<Key>KP_Home: beginning-of-file() \n\
<Key>End: end-of-file() \n\
@@ -115,7 +117,22 @@ Meta<Key>Z: scroll-one-line-down() \n\
Ctrl<Key>backslash: reconnect-im() \n\
<Key>Kanji: reconnect-im()\n\
<Key>: insert-char() \n\
-", *_XawDefaultTextTranslations4 = "\
+",
+#else
+*_XawDefaultTextTranslations3 = "\
+<Key>Right: forward-character() \n\
+<Key>Left: backward-character() \n\
+<Key>Down: next-line() \n\
+<Key>Up: previous-line() \n\
+<Key>Delete: delete-previous-character() \n\
+<Key>BackSpace: delete-previous-character() \n\
+<Key>Linefeed: newline-and-indent() \n\
+<Key>Return: newline() \n\
+<Key>KP_Enter: newline() \n\
+<Key>: insert-char() \n\
+",
+#endif
+*_XawDefaultTextTranslations4 = "\
<EnterWindow>: enter-window() \n\
<LeaveWindow>: leave-window() \n\
<FocusIn>: focus-in() \n\
diff --git a/xc/lib/Xaw3d/ThreeD.c b/xc/lib/Xaw3d/ThreeD.c
index 4f62d1a..8166a7c 100644
--- a/xc/lib/Xaw3d/ThreeD.c
+++ b/xc/lib/Xaw3d/ThreeD.c
@@ -27,6 +27,12 @@ SOFTWARE.
******************************************************************/
+/*
+ * Portions Copyright (c) 2003 David J. Hawkey Jr.
+ * Rights, permissions, and disclaimer per the above DEC/MIT license.
+ */
+
+#include "Xaw3dP.h"
#include <X11/Xlib.h>
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
@@ -41,6 +47,8 @@ SOFTWARE.
#define XtNbottomShadowPixmap "bottomShadowPixmap"
#define XtCBottomShadowPixmap "BottomShadowPixmap"
+static char defRelief[] = "Raised";
+
#define offset(field) XtOffsetOf(ThreeDRec, field)
static XtResource resources[] = {
@@ -64,12 +72,14 @@ static XtResource resources[] = {
offset(threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) True},
{XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
- (XtPointer)0}
+ (XtPointer)0},
+ {XtNrelief, XtCRelief, XtRRelief, sizeof(XtRelief),
+ offset(threeD.relief), XtRString, (XtPointer) defRelief}
};
#undef offset
-static void ClassPartInitialize(), Initialize(), Destroy();
+static void ClassInitialize(), ClassPartInitialize(), Initialize(), Destroy();
static void Redisplay(), Realize(), _Xaw3dDrawShadows();
static Boolean SetValues();
@@ -78,7 +88,7 @@ ThreeDClassRec threeDClassRec = {
/* superclass */ (WidgetClass) &simpleClassRec,
/* class_name */ "ThreeD",
/* widget_size */ sizeof(ThreeDRec),
- /* class_initialize */ NULL,
+ /* class_initialize */ ClassInitialize,
/* class_part_initialize */ ClassPartInitialize,
/* class_inited */ FALSE,
/* initialize */ Initialize,
@@ -133,33 +143,6 @@ static char mtshadowpm_bits[] = {0x02, 0x04, 0x01};
#define shadowpm_size 2
static char shadowpm_bits[] = {0x02, 0x01};
-#ifdef USEGRAY
-#include <stdio.h>
-unsigned long grayPixel(dpy, scn)
-Display *dpy;
-Screen *scn;
- {
- static XColor Gray =
- {
- /* pixel */ 0,
- /* red, green, blue */ 0,0,0,
- /* flags */ 0,
- /* pad */ 0
- };
- if (!Gray.pixel)
- {
- XColor exact;
- (void) XAllocNamedColor(dpy, DefaultColormapOfScreen (scn),
- "gray", &Gray,&exact); /* Blindflug */
- }
- return Gray.pixel;
- }
-#define setPixel(p,dpy,scn) grayPixel(dpy,scn)
-#else
-#define setPixel(p,dpy,scn) (p)
-#endif
-
-
/* ARGSUSED */
static void AllocTopShadowGC (w)
Widget w;
@@ -226,16 +209,16 @@ static void AllocTopShadowPixmap (new)
create_pixmap = TRUE;
} else if (tdw->threeD.be_nice_to_cmap) {
if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) {
- top_fg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn);
- top_bg_pixel = BlackPixelOfScreen (scn);
+ top_fg_pixel = WhitePixelOfScreen (scn);
+ top_bg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
} else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
- top_fg_pixel = BlackPixelOfScreen (scn);
- top_bg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn);
+ top_fg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
+ top_bg_pixel = WhitePixelOfScreen (scn);
} else {
top_fg_pixel = tdw->core.background_pixel;
top_bg_pixel = WhitePixelOfScreen (scn);
}
-#ifndef USEGRAY
+#ifndef XAW_GRAY_BLKWHT_STIPPLES
if (tdw->core.background_pixel == WhitePixelOfScreen (scn) ||
tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
pm_data = mtshadowpm_bits;
@@ -283,16 +266,16 @@ static void AllocBotShadowPixmap (new)
create_pixmap = TRUE;
} else if (tdw->threeD.be_nice_to_cmap) {
if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) {
- bot_fg_pixel = WhitePixelOfScreen (scn);
- bot_bg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn);
- } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
- bot_fg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn);
+ bot_fg_pixel = grayPixel( WhitePixelOfScreen (scn), dpy, scn);
bot_bg_pixel = BlackPixelOfScreen (scn);
+ } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
+ bot_fg_pixel = BlackPixelOfScreen (scn);
+ bot_bg_pixel = grayPixel( BlackPixelOfScreen (scn), dpy, scn);
} else {
bot_fg_pixel = tdw->core.background_pixel;
bot_bg_pixel = BlackPixelOfScreen (scn);
}
-#ifndef USEGRAY
+#ifndef XAW_GRAY_BLKWHT_STIPPLES
if (tdw->core.background_pixel == WhitePixelOfScreen (scn) ||
tdw->core.background_pixel == BlackPixelOfScreen (scn)) {
pm_data = mbshadowpm_bits;
@@ -330,7 +313,7 @@ void Xaw3dComputeTopShadowRGB (new, xcol_out)
double contrast;
Display *dpy = XtDisplay (new);
Screen *scn = XtScreen (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = new->core.colormap;
get_c.pixel = tdw->core.background_pixel;
if (get_c.pixel == WhitePixelOfScreen (scn) ||
@@ -360,7 +343,7 @@ static void AllocTopShadowPixel (new)
ThreeDWidget tdw = (ThreeDWidget) new;
Display *dpy = XtDisplay (new);
Screen *scn = XtScreen (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = new->core.colormap;
Xaw3dComputeTopShadowRGB (new, &set_c);
(void) XAllocColor (dpy, cmap, &set_c);
@@ -378,7 +361,7 @@ void Xaw3dComputeBottomShadowRGB (new, xcol_out)
double contrast;
Display *dpy = XtDisplay (new);
Screen *scn = XtScreen (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = new->core.colormap;
get_c.pixel = tdw->core.background_pixel;
if (get_c.pixel == WhitePixelOfScreen (scn) ||
@@ -406,7 +389,7 @@ static void AllocBotShadowPixel (new)
ThreeDWidget tdw = (ThreeDWidget) new;
Display *dpy = XtDisplay (new);
Screen *scn = XtScreen (new);
- Colormap cmap = DefaultColormapOfScreen (scn);
+ Colormap cmap = new->core.colormap;
Xaw3dComputeBottomShadowRGB (new, &set_c);
(void) XAllocColor (dpy, cmap, &set_c);
@@ -414,6 +397,67 @@ static void AllocBotShadowPixel (new)
}
+static XrmQuark XtQReliefNone, XtQReliefRaised, XtQReliefSunken,
+ XtQReliefRidge, XtQReliefGroove;
+
+#define done(address, type) { \
+ toVal->size = sizeof(type); \
+ toVal->addr = (XPointer) address; \
+ return; \
+ }
+
+/* ARGSUSED */
+static void _CvtStringToRelief(args, num_args, fromVal, toVal)
+ XrmValuePtr args; /* unused */
+ Cardinal *num_args; /* unused */
+ XrmValuePtr fromVal;
+ XrmValuePtr toVal;
+{
+ static XtRelief relief;
+ XrmQuark q;
+ char lowerName[1000];
+
+ XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr);
+ q = XrmStringToQuark(lowerName);
+ if (q == XtQReliefNone) {
+ relief = XtReliefNone;
+ done(&relief, XtRelief);
+ }
+ if (q == XtQReliefRaised) {
+ relief = XtReliefRaised;
+ done(&relief, XtRelief);
+ }
+ if (q == XtQReliefSunken) {
+ relief = XtReliefSunken;
+ done(&relief, XtRelief);
+ }
+ if (q == XtQReliefRidge) {
+ relief = XtReliefRidge;
+ done(&relief, XtRelief);
+ }
+ if (q == XtQReliefGroove) {
+ relief = XtReliefGroove;
+ done(&relief, XtRelief);
+ }
+ XtStringConversionWarning(fromVal->addr, "relief");
+ toVal->addr = NULL;
+ toVal->size = 0;
+}
+
+static void ClassInitialize()
+{
+ XawInitializeWidgetSet();
+ XtQReliefNone = XrmPermStringToQuark("none");
+ XtQReliefRaised = XrmPermStringToQuark("raised");
+ XtQReliefSunken = XrmPermStringToQuark("sunken");
+ XtQReliefRidge = XrmPermStringToQuark("ridge");
+ XtQReliefGroove = XrmPermStringToQuark("groove");
+
+ XtAddConverter( XtRString, XtRRelief, _CvtStringToRelief,
+ (XtConvertArgList)NULL, 0 );
+}
+
+
/* ARGSUSED */
static void ClassPartInitialize (wc)
WidgetClass wc;
@@ -488,7 +532,9 @@ static void Redisplay (w, event, region)
XEvent *event; /* unused */
Region region; /* unused */
{
- _Xaw3dDrawShadows (w, event, region, True);
+ ThreeDWidget tdw = (ThreeDWidget) w;
+
+ _Xaw3dDrawShadows (w, event, region, tdw->threeD.relief, True);
}
/* ARGSUSED */
@@ -507,6 +553,8 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
(*threeDWidgetClass->core_class.superclass->core_class.set_values)
(gcurrent, grequest, gnew, NULL, 0);
+ if (new->threeD.relief != current->threeD.relief)
+ redisplay = TRUE;
if (new->threeD.shadow_width != current->threeD.shadow_width)
redisplay = TRUE;
if (new->threeD.be_nice_to_cmap != current->threeD.be_nice_to_cmap) {
@@ -575,30 +623,32 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
/* ARGSUSED */
static void
-_Xaw3dDrawShadows (gw, event, region, out)
+_Xaw3dDrawShadows (gw, event, region, relief, out)
Widget gw;
XEvent *event;
Region region;
+ XtRelief relief;
Boolean out;
{
XPoint pt[6];
ThreeDWidget tdw = (ThreeDWidget) gw;
Dimension s = tdw->threeD.shadow_width;
+
/*
- * draw the shadows using the core part width and height,
- * and the threeD part shadow_width.
- *
- * no point to do anything if the shadow_width is 0 or the
- * widget has not been realized.
+ * Draw the shadows using the core part width and height,
+ * and the threeD part relief and shadow_width.
+ * No point to do anything if the shadow_width is 0 or the
+ * widget has not been realized.
*/
- if((s > 0) && XtIsRealized (gw)){
-
+ if ((s > 0) && XtIsRealized (gw)) {
Dimension h = tdw->core.height;
Dimension w = tdw->core.width;
- Dimension wms = w - s;
Dimension hms = h - s;
+ Dimension wms = w - s;
Display *dpy = XtDisplay (gw);
Window win = XtWindow (gw);
+ GC realtop = tdw->threeD.top_shadow_GC;
+ GC realbot = tdw->threeD.bot_shadow_GC;
GC top, bot;
if (out) {
@@ -609,32 +659,180 @@ _Xaw3dDrawShadows (gw, event, region, out)
bot = tdw->threeD.top_shadow_GC;
}
+ if (relief == XtReliefRaised || relief == XtReliefSunken) {
+ /* top-left shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
+ (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) {
+ pt[0].x = 0; pt[0].y = h;
+ pt[1].x = pt[1].y = 0;
+ pt[2].x = w; pt[2].y = 0;
+ pt[3].x = wms; pt[3].y = s;
+ pt[4].x = pt[4].y = s;
+ pt[5].x = s; pt[5].y = hms;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRaised) ? top : bot,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+
+ /* bottom-right shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
+ (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) {
+ pt[0].x = 0; pt[0].y = h;
+ pt[1].x = w; pt[1].y = h;
+ pt[2].x = w; pt[2].y = 0;
+ pt[3].x = wms; pt[3].y = s;
+ pt[4].x = wms; pt[4].y = hms;
+ pt[5].x = s; pt[5].y = hms;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRaised) ? bot : top,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+ } else if (relief == XtReliefRidge || relief == XtReliefGroove) {
+ /* split the shadow width */
+ s /= 2; hms = h - s; wms = w - s;
+
+ /* outer top-left shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
+ (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) {
+ pt[0].x = 0; pt[0].y = h;
+ pt[1].x = pt[1].y = 0;
+ pt[2].x = w; pt[2].y = 0;
+ pt[3].x = wms; pt[3].y = s;
+ pt[4].x = pt[4].y = s;
+ pt[5].x = s; pt[5].y = hms;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRidge) ? realtop : realbot,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+
+ /* outer bottom-right shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
+ (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) {
+ pt[0].x = 0; pt[0].y = h;
+ pt[1].x = w; pt[1].y = h;
+ pt[2].x = w; pt[2].y = 0;
+ pt[3].x = wms; pt[3].y = s;
+ pt[4].x = wms; pt[4].y = hms;
+ pt[5].x = s; pt[5].y = hms;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRidge) ? realbot : realtop,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+
+ /* inner top-left shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
+ (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) {
+ pt[0].x = s; pt[0].y = h;
+ pt[1].x = pt[1].y = s;
+ pt[2].x = w; pt[2].y = s;
+ pt[3].x = wms; pt[3].y = s * 2;
+ pt[4].x = pt[4].y = s * 2;
+ pt[5].x = s * 2; pt[5].y = hms;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRidge) ? bot: top,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+
+ /* inner bottom-right shadow */
+ if ((region == NULL) ||
+ (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
+ (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) {
+ pt[0].x = s; pt[0].y = hms;
+ pt[1].x = wms; pt[1].y = hms;
+ pt[2].x = wms; pt[2].y = s;
+ pt[3].x = wms - s; pt[3].y = s * 2;
+ pt[4].x = wms - s; pt[4].y = hms - s;
+ pt[5].x = s * 2; pt[5].y = hms - s;
+ XFillPolygon (dpy, win,
+ (relief == XtReliefRidge) ? top : bot,
+ pt, 6, Complex, CoordModeOrigin);
+ }
+ }
+ }
+}
+
+/*
+ * _ShadowSurroundedBox() is somewhat redundant with _Xaw3dDrawShadows(),
+ * but has a more explicit interface, and ignores threeD part relief.
+ */
+
+/* ARGSUSED */
+void
+_ShadowSurroundedBox(gw, tdw, x0, y0, x1, y1, relief, out)
+Widget gw;
+ThreeDWidget tdw;
+Position x0, y0, x1, y1;
+XtRelief relief; /* unused */
+Boolean out;
+{
+ XPoint pt[6];
+ Dimension s = tdw->threeD.shadow_width;
+
+ /*
+ * Draw the shadows using the core part width and height,
+ * and the threeD part shadow_width.
+ * No point to do anything if the shadow_width is 0 or the
+ * widget has not been realized.
+ */
+ if ((s > 0) && XtIsRealized(gw))
+ {
+ Dimension h = y1 - y0;
+ Dimension w = x1 - x0;
+ Dimension wms = w - s;
+ Dimension hms = h - s;
+ Dimension sm = (s > 1 ? s / 2 : 1);
+ Dimension wmsm = w - sm;
+ Dimension hmsm = h - sm;
+ Display *dpy = XtDisplay(gw);
+ Window win = XtWindow(gw);
+ GC top, bot;
+
+ if (out)
+ {
+ top = tdw->threeD.top_shadow_GC;
+ bot = tdw->threeD.bot_shadow_GC;
+ }
+ else
+ {
+ top = tdw->threeD.bot_shadow_GC;
+ bot = tdw->threeD.top_shadow_GC;
+ }
+
/* top-left shadow */
- if ((region == NULL) ||
- (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
- (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) {
-
- pt[0].x = 0; pt[0].y = h;
- pt[1].x = pt[1].y = 0;
- pt[2].x = w; pt[2].y = 0;
- pt[3].x = wms; pt[3].y = s;
- pt[4].x = pt[4].y = s;
- pt[5].x = s; pt[5].y = hms;
- XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin);
+ pt[0].x = x0; pt[0].y = y0 + h;
+ pt[1].x = x0; pt[1].y = y0;
+ pt[2].x = x0 + w; pt[2].y = y0;
+ pt[3].x = x0 + wmsm; pt[3].y = y0 + sm - 1;
+ pt[4].x = x0 + sm; pt[4].y = y0 + sm;
+ pt[5].x = x0 + sm - 1; pt[5].y = y0 + hmsm;
+ XFillPolygon(dpy, win, top, pt, 6, Complex, CoordModeOrigin);
+ if (s > 1)
+ {
+ pt[0].x = x0 + s - 1; pt[0].y = y0 + hms;
+ pt[1].x = x0 + s; pt[1].y = y0 + s;
+ pt[2].x = x0 + wms; pt[2].y = y0 + s - 1;
+ XFillPolygon(dpy, win, top, pt, 6, Complex, CoordModeOrigin);
}
/* bottom-right shadow */
- if ((region == NULL) ||
- (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
- (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) {
-
- pt[0].x = 0; pt[0].y = h;
- pt[1].x = w; pt[1].y = h;
- pt[2].x = w; pt[2].y = 0;
- pt[3].x = wms; pt[3].y = s;
- pt[4].x = wms; pt[4].y = hms;
- pt[5].x = s; pt[5].y = hms;
- XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin);
+ pt[0].x = x0; pt[0].y = y0 + h;
+ pt[1].x = x0 + w; pt[1].y = y0 + h;
+ pt[2].x = x0 + w; pt[2].y = y0;
+ pt[3].x = x0 + wmsm; pt[3].y = y0 + sm - 1;
+ pt[4].x = x0 + wmsm; pt[4].y = y0 + hmsm;
+ pt[5].x = x0 + sm - 1; pt[5].y = y0 + hmsm;
+ XFillPolygon(dpy, win, bot, pt, 6, Complex, CoordModeOrigin);
+ if (s > 1)
+ {
+ pt[0].x = x0 + s - 1; pt[0].y = y0 + hms;
+ pt[1].x = x0 + wms; pt[1].y = y0 + hms;
+ pt[2].x = x0 + wms; pt[2].y = y0 + s - 1;
+ XFillPolygon(dpy, win, bot, pt, 6, Complex, CoordModeOrigin);
}
}
}
diff --git a/xc/lib/Xaw3d/ThreeD.h b/xc/lib/Xaw3d/ThreeD.h
index 6109672..d7cf8e2 100644
--- a/xc/lib/Xaw3d/ThreeD.h
+++ b/xc/lib/Xaw3d/ThreeD.h
@@ -49,6 +49,7 @@ SOFTWARE.
bottomShadowContrast BottomShadowContrast Int 40
userData UserData XtPointer NULL
beNiceToColormap BeNiceToColormap Boolean False
+ relief Relief XtRelief XtReliefRaised
*/
@@ -68,6 +69,16 @@ SOFTWARE.
#define XtCBeNiceToColourmap "BeNiceToColormap"
#define XtNuserData "userData"
#define XtCUserData "UserData"
+#define XtNrelief "relief"
+#define XtCRelief "Relief"
+
+typedef enum {
+ XtReliefNone,
+ XtReliefRaised,
+ XtReliefSunken,
+ XtReliefRidge,
+ XtReliefGroove
+} XtRelief;
typedef struct _ThreeDRec *ThreeDWidget;
typedef struct _ThreeDClassRec *ThreeDWidgetClass;
@@ -90,6 +101,19 @@ extern void Xaw3dComputeBottomShadowRGB (
#endif
);
+extern void _ShadowSurroundedBox (
+#if NeedFunctionPrototypes
+ Widget,
+ ThreeDWidget,
+ Position,
+ Position,
+ Position,
+ Position,
+ XtRelief,
+ Boolean
+#endif
+);
+
_XFUNCPROTOEND
#endif /* _XawThreeD_h */
diff --git a/xc/lib/Xaw3d/ThreeDP.h b/xc/lib/Xaw3d/ThreeDP.h
index 316b520..44ccb97 100644
--- a/xc/lib/Xaw3d/ThreeDP.h
+++ b/xc/lib/Xaw3d/ThreeDP.h
@@ -33,6 +33,8 @@ SOFTWARE.
#include <X11/Xaw3d/ThreeD.h>
#include <X11/Xaw3d/SimpleP.h>
+#define XtRRelief "Relief"
+
typedef struct {
Dimension shadow_width;
Pixel top_shadow_pixel;
@@ -45,6 +47,7 @@ typedef struct {
GC bot_shadow_GC;
XtPointer user_data;
Boolean be_nice_to_cmap;
+ XtRelief relief;
} ThreeDPart;
/* Full instance record declaration */
diff --git a/xc/lib/Xaw3d/Tip.c b/xc/lib/Xaw3d/Tip.c
new file mode 100644
index 0000000..888eeac
--- /dev/null
+++ b/xc/lib/Xaw3d/Tip.c
@@ -0,0 +1,718 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+/*
+ * Portions Copyright (c) 2003 David J. Hawkey Jr.
+ * Rights, permissions, and disclaimer per the above XFree86 license.
+ */
+
+/* $XFree86: xc/lib/Xaw/Tip.c,v 1.5 2000/05/18 16:29:53 dawes Exp $ */
+
+#include "Xaw3dP.h"
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/Xos.h>
+#include <X11/Xmu/Converters.h>
+#include <X11/Xaw3d/TipP.h>
+#include <X11/Xaw3d/XawInit.h>
+
+#define TIP_EVENT_MASK (ButtonPressMask | \
+ ButtonReleaseMask | \
+ PointerMotionMask | \
+ ButtonMotionMask | \
+ KeyPressMask | \
+ KeyReleaseMask | \
+ EnterWindowMask | \
+ LeaveWindowMask)
+
+/*
+ * Types
+ */
+typedef struct _WidgetInfo {
+ Widget widget;
+ String label;
+ struct _WidgetInfo *next;
+} WidgetInfo;
+
+typedef struct _XawTipInfo {
+ Screen *screen;
+ TipWidget tip;
+ Bool mapped;
+ WidgetInfo *widgets;
+ struct _XawTipInfo *next;
+} XawTipInfo;
+
+typedef struct {
+ XawTipInfo *info;
+ WidgetInfo *winfo;
+} TimeoutInfo;
+
+/*
+ * Class Methods
+ */
+static void XawTipClassInitialize();
+static void XawTipInitialize();
+static void XawTipDestroy();
+static void XawTipExpose();
+static void XawTipRealize();
+static Boolean XawTipSetValues();
+
+/*
+ * Prototypes
+ */
+static void TipEventHandler();
+static void TipShellEventHandler();
+static WidgetInfo *CreateWidgetInfo();
+static WidgetInfo *FindWidgetInfo();
+static XawTipInfo *CreateTipInfo();
+static XawTipInfo *FindTipInfo();
+static void ResetTip();
+static void TipTimeoutCallback();
+static void TipLayout();
+static void TipPosition();
+
+/*
+ * Initialization
+ */
+#define offset(field) XtOffsetOf(TipRec, tip.field)
+static XtResource resources[] = {
+ {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
+ offset(foreground), XtRString, XtDefaultForeground},
+ {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct*),
+ offset(font), XtRString, XtDefaultFont},
+#ifdef XAW_INTERNATIONALIZATION
+ {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
+ offset(fontset), XtRString, XtDefaultFontSet},
+#endif
+ {XtNlabel, XtCLabel, XtRString, sizeof(String),
+ offset(label), XtRString, NULL},
+ {XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char),
+ offset(encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit},
+ {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension),
+ offset(internal_height), XtRImmediate, (XtPointer)2},
+ {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension),
+ offset(internal_width), XtRImmediate, (XtPointer)2},
+ {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof(int),
+ offset(backing_store), XtRImmediate,
+ (XtPointer)(Always + WhenMapped + NotUseful)},
+ {XtNtimeout, XtCTimeout, XtRInt, sizeof(int),
+ offset(timeout), XtRImmediate, (XtPointer)500},
+};
+#undef offset
+
+TipClassRec tipClassRec = {
+ /* core */
+ {
+ (WidgetClass)&widgetClassRec, /* superclass */
+ "Tip", /* class_name */
+ sizeof(TipRec), /* widget_size */
+ XawTipClassInitialize, /* class_initialize */
+ NULL, /* class_part_initialize */
+ False, /* class_inited */
+ XawTipInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XawTipRealize, /* realize */
+ NULL, /* actions */
+ 0, /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ XawTipDestroy, /* destroy */
+ NULL, /* resize */
+ XawTipExpose, /* expose */
+ XawTipSetValues, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ NULL, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ },
+ /* tip */
+ {
+ NULL, /* extension */
+ },
+};
+
+WidgetClass tipWidgetClass = (WidgetClass)&tipClassRec;
+
+static XawTipInfo *TipInfoList = NULL;
+static TimeoutInfo TimeoutData;
+
+/*
+ * Implementation
+ */
+
+/*
+ * XmuCvtBackingStoreToString() from XFree86's distribution, because
+ * X.Org's distribution doesn't have it.
+ */
+
+/*ARGSUSED*/
+static Boolean
+XawCvtBackingStoreToString(dpy, args, num_args, fromVal, toVal, data)
+Display *dpy;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValuePtr fromVal, toVal;
+XtPointer *data;
+{
+ static String buffer;
+ Cardinal size;
+
+ switch (*(int *)fromVal->addr)
+ {
+ case NotUseful:
+ buffer = XtEnotUseful;
+ break;
+ case WhenMapped:
+ buffer = XtEwhenMapped;
+ break;
+ case Always:
+ buffer = XtEalways;
+ break;
+ case (Always + WhenMapped + NotUseful):
+ buffer = XtEdefault;
+ break;
+ default:
+ XtWarning("Cannot convert BackingStore to String");
+ toVal->addr = NULL;
+ toVal->size = 0;
+ return (False);
+ }
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL)
+ {
+ if (toVal->size < size)
+ {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *)toVal->addr, buffer);
+ }
+ else
+ toVal->addr = (XPointer)buffer;
+ toVal->size = sizeof(String);
+
+ return (True);
+}
+
+static void
+XawTipClassInitialize()
+{
+ XawInitializeWidgetSet();
+ XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
+ NULL, 0);
+ XtSetTypeConverter(XtRBackingStore, XtRString, XawCvtBackingStoreToString,
+ NULL, 0, XtCacheNone, NULL);
+}
+
+/*ARGSUSED*/
+static void
+XawTipInitialize(req, w, args, num_args)
+Widget req, w;
+ArgList args;
+Cardinal *num_args;
+{
+ TipWidget tip = (TipWidget)w;
+ XGCValues values;
+
+ tip->tip.timer = 0;
+
+ values.foreground = tip->tip.foreground;
+ values.background = tip->core.background_pixel;
+ values.font = tip->tip.font->fid;
+ values.graphics_exposures = False;
+
+ tip->tip.gc = XtAllocateGC(w, 0, GCForeground | GCBackground | GCFont |
+ GCGraphicsExposures, &values, GCFont, 0);
+}
+
+static void
+XawTipDestroy(w)
+Widget w;
+{
+ XawTipInfo *info = FindTipInfo(w);
+ WidgetInfo *winfo;
+ TipWidget tip = (TipWidget)w;
+
+ if (tip->tip.timer)
+ XtRemoveTimeOut(tip->tip.timer);
+
+ XtReleaseGC(w, tip->tip.gc);
+
+ XtRemoveEventHandler(XtParent(w), KeyPressMask, False,
+ TipShellEventHandler, (XtPointer)NULL);
+
+ while (info->widgets) {
+ winfo = info->widgets->next;
+ XtFree((char *)info->widgets->label);
+ XtFree((char *)info->widgets);
+ info->widgets = winfo;
+ }
+
+ if (info == TipInfoList)
+ TipInfoList = TipInfoList->next;
+ else {
+ XawTipInfo *p = TipInfoList;
+
+ while (p && p->next != info)
+ p = p->next;
+ if (p)
+ p->next = info->next;
+ }
+
+ XtFree((char *)info);
+}
+
+static void
+XawTipRealize(w, mask, attr)
+Widget w;
+Mask *mask;
+XSetWindowAttributes *attr;
+{
+ TipWidget tip = (TipWidget)w;
+
+ if (tip->tip.backing_store == Always ||
+ tip->tip.backing_store == NotUseful ||
+ tip->tip.backing_store == WhenMapped) {
+ *mask |= CWBackingStore;
+ attr->backing_store = tip->tip.backing_store;
+ }
+ else
+ *mask &= ~CWBackingStore;
+ *mask |= CWOverrideRedirect;
+ attr->override_redirect = True;
+
+ XtWindow(w) = XCreateWindow(DisplayOfScreen(XtScreen(w)),
+ RootWindowOfScreen(XtScreen(w)),
+ XtX(w), XtY(w),
+ XtWidth(w) ? XtWidth(w) : 1,
+ XtHeight(w) ? XtHeight(w) : 1,
+ XtBorderWidth(w),
+ DefaultDepthOfScreen(XtScreen(w)),
+ InputOutput, CopyFromParent, *mask, attr);
+}
+
+static void
+XawTipExpose(w, event, region)
+Widget w;
+XEvent *event;
+Region region;
+{
+ TipWidget tip = (TipWidget)w;
+ GC gc = tip->tip.gc;
+ char *nl, *label = tip->tip.label;
+ Position y = tip->tip.internal_height + tip->tip.font->max_bounds.ascent;
+ int len;
+
+#ifdef XAW_INTERNATIONALIZATION
+ if (tip->tip.international == True) {
+ Position ksy = tip->tip.internal_height;
+ XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
+
+ ksy += abs(ext->max_ink_extent.y);
+
+ while ((nl = index(label, '\n')) != NULL) {
+ XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset,
+ gc, tip->tip.internal_width, ksy, label,
+ (int)(nl - label));
+ ksy += ext->max_ink_extent.height;
+ label = nl + 1;
+ }
+ len = strlen(label);
+ if (len)
+ XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset, gc,
+ tip->tip.internal_width, ksy, label, len);
+ }
+ else
+#endif
+ {
+ while ((nl = index(label, '\n')) != NULL) {
+ if (tip->tip.encoding)
+ XDrawString16(XtDisplay(w), XtWindow(w), gc,
+ tip->tip.internal_width, y,
+ (XChar2b*)label, (int)(nl - label) >> 1);
+ else
+ XDrawString(XtDisplay(w), XtWindow(w), gc,
+ tip->tip.internal_width, y,
+ label, (int)(nl - label));
+ y += tip->tip.font->max_bounds.ascent +
+ tip->tip.font->max_bounds.descent;
+ label = nl + 1;
+ }
+ len = strlen(label);
+ if (len) {
+ if (tip->tip.encoding)
+ XDrawString16(XtDisplay(w), XtWindow(w), gc,
+ tip->tip.internal_width, y,
+ (XChar2b*)label, len >> 1);
+ else
+ XDrawString(XtDisplay(w), XtWindow(w), gc,
+ tip->tip.internal_width, y, label, len);
+ }
+ }
+}
+
+/*ARGSUSED*/
+static Boolean
+XawTipSetValues(current, request, cnew, args, num_args)
+Widget current, request, cnew;
+ArgList args;
+Cardinal *num_args;
+{
+ TipWidget curtip = (TipWidget)current;
+ TipWidget newtip = (TipWidget)cnew;
+ Boolean redisplay = False;
+
+ if (curtip->tip.font->fid != newtip->tip.font->fid ||
+ curtip->tip.foreground != newtip->tip.foreground) {
+ XGCValues values;
+
+ values.foreground = newtip->tip.foreground;
+ values.background = newtip->core.background_pixel;
+ values.font = newtip->tip.font->fid;
+ values.graphics_exposures = False;
+ XtReleaseGC(cnew, curtip->tip.gc);
+ newtip->tip.gc = XtAllocateGC(cnew, 0, GCForeground | GCBackground |
+ GCFont | GCGraphicsExposures, &values,
+ GCFont, 0);
+ redisplay = True;
+ }
+
+ return (redisplay);
+}
+
+static void
+TipLayout(info)
+XawTipInfo *info;
+{
+ XFontStruct *fs = info->tip->tip.font;
+ int width = 0, height;
+ char *nl, *label = info->tip->tip.label;
+
+#ifdef XAW_INTERNATIONALIZATION
+ if (info->tip->tip.international == True) {
+ XFontSet fset = info->tip->tip.fontset;
+ XFontSetExtents *ext = XExtentsOfFontSet(fset);
+
+ height = ext->max_ink_extent.height;
+ if ((nl = index(label, '\n')) != NULL) {
+ /*CONSTCOND*/
+ while (True) {
+ int w = XmbTextEscapement(fset, label, (int)(nl - label));
+
+ if (w > width)
+ width = w;
+ if (*nl == '\0')
+ break;
+ label = nl + 1;
+ if (*label)
+ height += ext->max_ink_extent.height;
+ if ((nl = index(label, '\n')) == NULL)
+ nl = index(label, '\0');
+ }
+ }
+ else
+ width = XmbTextEscapement(fset, label, strlen(label));
+ }
+ else
+#endif
+ {
+ height = fs->max_bounds.ascent + fs->max_bounds.descent;
+ if ((nl = index(label, '\n')) != NULL) {
+ /*CONSTCOND*/
+ while (True) {
+ int w = info->tip->tip.encoding ?
+ XTextWidth16(fs, (XChar2b*)label,
+ (int)(nl - label) >> 1) :
+ XTextWidth(fs, label, (int)(nl - label));
+
+ if (w > width)
+ width = w;
+ if (*nl == '\0')
+ break;
+ label = nl + 1;
+ if (*label)
+ height += fs->max_bounds.ascent + fs->max_bounds.descent;
+ if ((nl = index(label, '\n')) == NULL)
+ nl = index(label, '\0');
+ }
+ }
+ else
+ width = info->tip->tip.encoding ?
+ XTextWidth16(fs, (XChar2b*)label, strlen(label) >> 1) :
+ XTextWidth(fs, label, strlen(label));
+ }
+ XtWidth(info->tip) = width + info->tip->tip.internal_width * 2;
+ XtHeight(info->tip) = height + info->tip->tip.internal_height * 2;
+}
+
+#define DEFAULT_TIP_OFFSET 12
+
+static void
+TipPosition(info)
+XawTipInfo *info;
+{
+ Window r, c;
+ int rx, ry, wx, wy;
+ unsigned mask;
+ Position x, y;
+ int bw2 = XtBorderWidth(info->tip) * 2;
+ int scr_width = WidthOfScreen(XtScreen(info->tip));
+ int scr_height = HeightOfScreen(XtScreen(info->tip));
+ int win_width = XtWidth(info->tip) + bw2;
+ int win_height = XtHeight(info->tip) + bw2;
+
+ XQueryPointer(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip),
+ &r, &c, &rx, &ry, &wx, &wy, &mask);
+ x = rx + DEFAULT_TIP_OFFSET;
+ y = ry + DEFAULT_TIP_OFFSET;
+
+ if (x + win_width > scr_width)
+ x = scr_width - win_width;
+ if (x < 0)
+ x = 0;
+
+ if (y + win_height > scr_height)
+ y -= win_height + (DEFAULT_TIP_OFFSET << 1);
+ if (y < 0)
+ y = 0;
+
+ XMoveResizeWindow(XtDisplay(info->tip), XtWindow(info->tip),
+ (int)(XtX(info->tip) = x), (int)(XtY(info->tip) = y),
+ (unsigned)XtWidth(info->tip),
+ (unsigned)XtHeight(info->tip));
+}
+
+static WidgetInfo *
+CreateWidgetInfo(w)
+Widget w;
+{
+ WidgetInfo *winfo = XtNew(WidgetInfo);
+
+ winfo->widget = w;
+ winfo->label = NULL;
+ winfo->next = NULL;
+
+ return (winfo);
+}
+
+static WidgetInfo *
+FindWidgetInfo(info, w)
+XawTipInfo *info;
+Widget w;
+{
+ WidgetInfo *winfo, *wlist = info->widgets;
+
+ if (wlist == NULL)
+ return (info->widgets = CreateWidgetInfo(w));
+
+ for (winfo = wlist; wlist; winfo = wlist, wlist = wlist->next)
+ if (wlist->widget == w)
+ return (wlist);
+
+ return (winfo->next = CreateWidgetInfo(w));
+}
+
+static XawTipInfo *
+CreateTipInfo(w)
+Widget w;
+{
+ XawTipInfo *info = XtNew(XawTipInfo);
+ Widget shell = w;
+
+ while (XtParent(shell))
+ shell = XtParent(shell);
+
+ info->tip = (TipWidget)XtCreateWidget("tip", tipWidgetClass,
+ shell, NULL, 0);
+ XtRealizeWidget((Widget)info->tip);
+ info->screen = XtScreen(w);
+ info->mapped = False;
+ info->widgets = NULL;
+ info->next = NULL;
+ XtAddEventHandler(shell, KeyPressMask, False, TipShellEventHandler,
+ (XtPointer)NULL);
+
+ return (info);
+}
+
+static XawTipInfo *
+FindTipInfo(w)
+Widget w;
+{
+ XawTipInfo *info, *list = TipInfoList;
+ Screen *screen;
+
+ if (list == NULL)
+ return (TipInfoList = CreateTipInfo(w));
+
+ screen = XtScreen(w);
+ for (info = list; list; info = list, list = list->next)
+ if (list->screen == screen)
+ return (list);
+
+ return (info->next = CreateTipInfo(w));
+}
+
+static void
+ResetTip(info, winfo, add_timeout)
+XawTipInfo *info;
+WidgetInfo *winfo;
+Bool add_timeout;
+{
+ if (info->tip->tip.timer) {
+ XtRemoveTimeOut(info->tip->tip.timer);
+ info->tip->tip.timer = 0;
+ }
+ if (info->mapped) {
+ XtRemoveGrab(XtParent((Widget)info->tip));
+ XUnmapWindow(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
+ info->mapped = False;
+ }
+ if (add_timeout) {
+ TimeoutData.info = info;
+ TimeoutData.winfo = winfo;
+ info->tip->tip.timer =
+ XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)info->tip),
+ info->tip->tip.timeout, TipTimeoutCallback,
+ (XtPointer)&TimeoutData);
+ }
+}
+
+static void
+TipTimeoutCallback(closure, id)
+XtPointer closure;
+XtIntervalId *id;
+{
+ TimeoutInfo *cinfo = (TimeoutInfo *)closure;
+ XawTipInfo *info = cinfo->info;
+ WidgetInfo *winfo = cinfo->winfo;
+ Arg args[2];
+
+ info->tip->tip.label = winfo->label;
+ info->tip->tip.encoding = 0;
+ XtSetArg(args[0], XtNencoding, &info->tip->tip.encoding);
+#ifdef XAW_INTERNATIONALIZATION
+ info->tip->tip.international = False;
+ XtSetArg(args[1], XtNinternational, &info->tip->tip.international);
+#endif
+ XtGetValues(winfo->widget, args, 2);
+
+ TipLayout(info);
+ TipPosition(info);
+ XMapRaised(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
+ XtAddGrab(XtParent((Widget)info->tip), True, True);
+ info->mapped = True;
+}
+
+/*ARGSUSED*/
+static void
+TipShellEventHandler(w, client_data, event, continue_to_dispatch)
+Widget w;
+XtPointer client_data;
+XEvent *event;
+Boolean *continue_to_dispatch;
+{
+ XawTipInfo *info = FindTipInfo(w);
+
+ ResetTip(info, FindWidgetInfo(info, w), False);
+}
+
+/*ARGSUSED*/
+static void
+TipEventHandler(w, client_data, event, continue_to_dispatch)
+Widget w;
+XtPointer client_data;
+XEvent *event;
+Boolean *continue_to_dispatch;
+{
+ XawTipInfo *info = FindTipInfo(w);
+ Boolean add_timeout;
+
+ switch (event->type) {
+ case EnterNotify:
+ add_timeout = True;
+ break;
+ case MotionNotify:
+ /* If any button is pressed, timer is 0 */
+ if (info->mapped)
+ return;
+ add_timeout = info->tip->tip.timer != 0;
+ break;
+ default:
+ add_timeout = False;
+ break;
+ }
+ ResetTip(info, FindWidgetInfo(info, w), add_timeout);
+}
+
+/*
+ * Public routines
+ */
+void
+XawTipEnable(w, label)
+Widget w;
+String label;
+{
+ if (XtIsWidget(w) && label && *label) {
+ XawTipInfo *info = FindTipInfo(w);
+ WidgetInfo *winfo = FindWidgetInfo(info, w);
+
+ if (winfo->label)
+ XtFree((char *)winfo->label);
+ winfo->label = XtNewString(label);
+
+ XtAddEventHandler(w, TIP_EVENT_MASK, False, TipEventHandler,
+ (XtPointer)NULL);
+ }
+}
+
+void
+XawTipDisable(w)
+Widget w;
+{
+ if (XtIsWidget(w)) {
+ XawTipInfo *info = FindTipInfo(w);
+
+ XtRemoveEventHandler(w, TIP_EVENT_MASK, False, TipEventHandler,
+ (XtPointer)NULL);
+ ResetTip(info, FindWidgetInfo(info, w), False);
+ }
+}
diff --git a/xc/lib/Xaw3d/Tip.h b/xc/lib/Xaw3d/Tip.h
new file mode 100644
index 0000000..f576fd7
--- /dev/null
+++ b/xc/lib/Xaw3d/Tip.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+/* $XFree86: xc/lib/Xaw/Tip.h,v 1.1 1999/06/27 14:07:35 dawes Exp $ */
+
+#ifndef _XawTip_h
+#define _XawTip_h
+
+/*
+ * Tip Widget
+ */
+
+#include "Xaw3dP.h"
+#include <X11/Xaw3d/Simple.h>
+
+/* Resources:
+
+ Name Class RepType Default Value
+ ---- ----- ------- -------------
+ background Background Pixel XtDefaultBackground
+ backgroundPixmap BackgroundPixmap Pixmap XtUnspecifiedPixmap
+ border BorderColor Pixel XtDefaultForeground
+ borderWidth BorderWidth Dimension 1
+ destroyCallback Callback XtCallbackList NULL
+ font Font XFontStruct* XtDefaultFont
+ foreground Foreground Pixel XtDefaultForeground
+ height Height Dimension text height
+ internalHeight Height Dimension 2
+ internalWidth Width Dimension 2
+ label Label String NULL
+ timeout Timeout Int 500
+ width Width Dimension text width
+ x Position Position 0
+ y Position Position 0
+
+*/
+
+typedef struct _TipClassRec *TipWidgetClass;
+typedef struct _TipRec *TipWidget;
+
+extern WidgetClass tipWidgetClass;
+
+#define XawTextEncoding8bit 0
+#define XawTextEncodingChar2b 1
+
+#define XtNencoding "encoding"
+#define XtNtimeout "timeout"
+#define XtNtip "tip"
+
+#ifdef XAW_INTERNATIONALIZATION
+#ifndef XtNfontSet
+#define XtNfontSet "fontSet"
+#endif
+#ifndef XtCFontSet
+#define XtCFontSet "FontSet"
+#endif
+#endif
+
+#define XtCEncoding "Encoding"
+#define XtCTimeout "Timeout"
+#define XtCTip "Tip"
+
+#ifndef _XtStringDefs_h_
+#define XtNforeground "foreground"
+#define XtNlabel "label"
+#define XtNfont "font"
+#define XtNinternalWidth "internalWidth"
+#define XtNinternalHeight "internalHeight"
+#endif
+
+/*
+ * Public Functions
+ */
+
+/*
+ * Function:
+ * XawTipEnable
+ *
+ * Parameters:
+ * Widget - widget for tooltip
+ * String - tooltip label
+ *
+ * Description:
+ * Enables the tip event handler for this widget.
+ */
+void XawTipEnable(
+#if NeedFunctionPrototypes
+ Widget,
+ String
+#endif
+);
+
+/*
+ * Function:
+ * XawTipDisable
+ *
+ * Parameters:
+ * Widget - widget for tooltip
+ *
+ * Description:
+ * Disables the tip event handler for this widget.
+ */
+void XawTipDisable(
+#if NeedFunctionPrototypes
+ Widget
+#endif
+);
+
+#endif /* _XawTip_h */
diff --git a/xc/lib/Xaw3d/TipP.h b/xc/lib/Xaw3d/TipP.h
new file mode 100644
index 0000000..a4430d7
--- /dev/null
+++ b/xc/lib/Xaw3d/TipP.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+/* $XFree86: xc/lib/Xaw/TipP.h,v 1.1 1999/06/27 14:07:35 dawes Exp $ */
+
+#ifndef _XawTipP_h
+#define _XawTipP_h
+
+#include "Xaw3dP.h"
+#include <X11/Xaw3d/Tip.h>
+
+typedef struct {
+ XtPointer extension;
+} TipClassPart;
+
+typedef struct _TipClassRec {
+ CoreClassPart core_class;
+ TipClassPart tip_class;
+} TipClassRec;
+
+extern TipClassRec tipClassRec;
+
+typedef struct _TipPart {
+ /* resources */
+ Pixel foreground;
+ XFontStruct *font;
+#ifdef XAW_INTERNATIONALIZATION
+ XFontSet fontset;
+#endif
+ Dimension internal_width;
+ Dimension internal_height;
+ String label;
+ int backing_store;
+ int timeout;
+
+ /* private */
+ GC gc;
+ XtIntervalId timer;
+#ifdef XAW_INTERNATIONALIZATION
+ Boolean international;
+#endif
+ unsigned char encoding;
+} TipPart;
+
+typedef struct _TipRec {
+ CorePart core;
+ TipPart tip;
+} TipRec;
+
+#endif /* _XawTipP_h */
diff --git a/xc/lib/Xaw3d/Vendor.c b/xc/lib/Xaw3d/Vendor.c
index 4d69319..4fa43db 100644
--- a/xc/lib/Xaw3d/Vendor.c
+++ b/xc/lib/Xaw3d/Vendor.c
@@ -49,6 +49,11 @@ SOFTWARE.
******************************************************************/
/*
+ * Portions Copyright (c) 1996 Alfredo Kojima
+ * Rights, permissions, and disclaimer per the above X Consortium license.
+ */
+
+/*
* This is a copy of Xt/Vendor.c with an additional ClassInitialize
* procedure to register Xmu resource type converters, and all the
* monkey business associated with input methods...
@@ -57,6 +62,7 @@ SOFTWARE.
/* Make sure all wm properties can make it out of the resource manager */
+#include "Xaw3dP.h"
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
@@ -65,12 +71,19 @@ SOFTWARE.
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/Editres.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xmu/ExtAgent.h>
+#endif
+#ifdef XAW_MULTIPLANE_PIXMAPS
+#include <X11/xpm.h>
+#include <X11/Xmu/Drawing.h>
+#endif
/* The following two headers are for the input method. */
-
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/VendorEP.h>
#include <X11/Xaw3d/XawImP.h>
+#endif
static XtResource resources[] = {
@@ -86,13 +99,16 @@ static XtResource resources[] = {
***************************************************************************/
static void XawVendorShellClassInitialize();
-static void XawVendorShellClassPartInit();
static void XawVendorShellInitialize();
static Boolean XawVendorShellSetValues();
static void Realize(), ChangeManaged();
static XtGeometryResult GeometryManager();
+#ifdef XAW_INTERNATIONALIZATION
+static void XawVendorShellClassPartInit();
void XawVendorShellExtResize();
+#endif
+#ifdef XAW_INTERNATIONALIZATION
static CompositeClassExtensionRec vendorCompositeExt = {
/* next_extension */ NULL,
/* record_type */ NULLQUARK,
@@ -101,6 +117,7 @@ static CompositeClassExtensionRec vendorCompositeExt = {
/* accepts_objects */ TRUE,
/* allows_change_managed_set */ FALSE
};
+#endif
#define SuperClass (&wmShellClassRec)
externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
@@ -109,7 +126,11 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
/* class_name */ "VendorShell",
/* size */ sizeof(VendorShellRec),
/* class_initialize */ XawVendorShellClassInitialize,
+#ifdef XAW_INTERNATIONALIZATION
/* class_part_init */ XawVendorShellClassPartInit,
+#else
+ /* class_part_init */ NULL,
+#endif
/* Class init'ed ? */ FALSE,
/* initialize */ XawVendorShellInitialize,
/* initialize_hook */ NULL,
@@ -124,7 +145,11 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
/* compress_enterleave*/ FALSE,
/* visible_interest */ FALSE,
/* destroy */ NULL,
+#ifdef XAW_INTERNATIONALIZATION
/* resize */ XawVendorShellExtResize,
+#else
+ /* resize */ XtInheritResize,
+#endif
/* expose */ NULL,
/* set_values */ XawVendorShellSetValues,
/* set_values_hook */ NULL,
@@ -142,7 +167,11 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
/* change_managed */ ChangeManaged,
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
+#ifdef XAW_INTERNATIONALIZATION
/* extension */ (XtPointer) &vendorCompositeExt
+#else
+ /* extension */ NULL
+#endif
},{
/* extension */ NULL
},{
@@ -156,6 +185,7 @@ externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
(WidgetClass) (&vendorShellClassRec);
+#ifdef XAW_INTERNATIONALIZATION
/***************************************************************************
*
* The following section is for the Vendor shell Extension class record
@@ -224,6 +254,7 @@ externaldef(vendorshellextclassrec) XawVendorShellExtClassRec
externaldef(xawvendorshellwidgetclass) WidgetClass
xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec);
+#endif
/*ARGSUSED*/
@@ -262,23 +293,123 @@ XtPointer *cvt_data;
return True;
}
+#ifdef XAW_MULTIPLANE_PIXMAPS
+#define DONE(type, address) \
+ {to->size = sizeof(type); to->addr = (XPointer)address;}
+
+/* ARGSUSED */
+static Boolean
+_XawCvtStringToPixmap(dpy, args, nargs, from, to, data)
+Display *dpy;
+XrmValuePtr args;
+Cardinal *nargs;
+XrmValuePtr from, to;
+XtPointer *data;
+{
+ static Pixmap pixmap;
+ Window win;
+ XpmAttributes attr;
+ XpmColorSymbol colors[1];
+
+ if (*nargs != 3)
+ XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
+ "_XawCvtStringToPixmap", "wrongParameters", "XtToolkitError",
+ "_XawCvtStringToPixmap needs screen, colormap, and background_pixel",
+ (String *) NULL, (Cardinal *) NULL);
+
+ if (strcmp(from->addr, "None") == 0)
+ {
+ pixmap = None;
+ DONE(Pixmap, &pixmap);
+ return (True);
+ }
+ if (strcmp(from->addr, "ParentRelative") == 0)
+ {
+ pixmap = ParentRelative;
+ DONE(Pixmap, &pixmap);
+ return (True);
+ }
+
+ win = RootWindowOfScreen(*((Screen **) args[0].addr));
+
+ attr.colormap = *((Colormap *) args[1].addr);
+ attr.closeness = 32768; /* might help on 8-bpp displays? */
+ attr.valuemask = XpmColormap | XpmCloseness;
+
+ colors[0].name = NULL;
+ colors[0].value = "none";
+ colors[0].pixel = *((Pixel *) args[2].addr);
+ attr.colorsymbols = colors;
+ attr.numsymbols = 1;
+ attr.valuemask |= XpmColorSymbols;
+
+ if (XpmReadFileToPixmap(dpy, win, (String) from->addr,
+ &pixmap, NULL, &attr) != XpmSuccess)
+ {
+ if ((pixmap = XmuLocateBitmapFile(*((Screen **) args[0].addr),
+ (char *)from->addr, NULL, 0, NULL, NULL, NULL, NULL)) == None)
+ {
+ XtDisplayStringConversionWarning(dpy, (String) from->addr,
+ XtRPixmap);
+ return (False);
+ }
+ }
+
+ if (to->addr == NULL)
+ to->addr = (XtPointer) & pixmap;
+ else
+ {
+ if (to->size < sizeof(Pixmap))
+ {
+ to->size = sizeof(Pixmap);
+ XtDisplayStringConversionWarning(dpy, (String) from->addr,
+ XtRPixmap);
+ return (False);
+ }
+
+ *((Pixmap *) to->addr) = pixmap;
+ }
+ to->size = sizeof(Pixmap);
+ return (True);
+}
+#endif
+
static void XawVendorShellClassInitialize()
{
static XtConvertArgRec screenConvertArg[] = {
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
sizeof(Screen *)}
};
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ static XtConvertArgRec _XawCvtStrToPix[] = {
+ {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
+ sizeof(Screen *)},
+ {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
+ sizeof(Colormap)},
+ {XtWidgetBaseOffset,
+ (XtPointer)XtOffsetOf(WidgetRec, core.background_pixel),
+ sizeof(Pixel)}
+ };
+#endif
XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
screenConvertArg, XtNumber(screenConvertArg));
+#ifdef XAW_MULTIPLANE_PIXMAPS
+ XtSetTypeConverter(XtRString, XtRBitmap,
+ (XtTypeConverter)_XawCvtStringToPixmap,
+ _XawCvtStrToPix, XtNumber(_XawCvtStrToPix),
+ XtCacheByDisplay, (XtDestructor)NULL);
+#else
XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
screenConvertArg, XtNumber(screenConvertArg));
+#endif
XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString,
NULL, 0, XtCacheNone, NULL);
}
+#ifdef XAW_INTERNATIONALIZATION
static void XawVendorShellClassPartInit(class)
WidgetClass class;
{
@@ -302,6 +433,7 @@ static void XawVendorShellClassPartInit(class)
}
}
}
+#endif
#ifdef __osf__
/* stupid OSF/1 shared libraries have the wrong semantics */
@@ -322,9 +454,11 @@ static void XawVendorShellInitialize(req, new, args, num_args)
Cardinal *num_args;
{
XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
+#ifdef XAW_INTERNATIONALIZATION
XtAddEventHandler(new, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL);
XtCreateWidget("shellext", xawvendorShellExtWidgetClass,
new, args, *num_args);
+#endif
}
/* ARGSUSED */
@@ -344,10 +478,13 @@ static void Realize(wid, vmask, attr)
/* Make my superclass do all the dirty work */
(*super->core_class.realize) (wid, vmask, attr);
+#ifdef XAW_INTERNATIONALIZATION
_XawImRealize(wid);
+#endif
}
+#ifdef XAW_INTERNATIONALIZATION
static void XawVendorShellExtClassInitialize()
{
}
@@ -391,6 +528,7 @@ void XawVendorShellExtResize( w )
}
}
}
+#endif
/*ARGSUSED*/
static XtGeometryResult GeometryManager( wid, request, reply )
@@ -415,7 +553,10 @@ static XtGeometryResult GeometryManager( wid, request, reply )
}
if (request->request_mode & CWHeight) {
my_request.height = request->height
- + _XawImGetImAreaHeight( wid );
+#ifdef XAW_INTERNATIONALIZATION
+ + _XawImGetImAreaHeight( wid )
+#endif
+ ;
my_request.request_mode |= CWHeight;
}
if (request->request_mode & CWBorderWidth) {
@@ -438,7 +579,9 @@ static XtGeometryResult GeometryManager( wid, request, reply )
if (request->request_mode & CWBorderWidth) {
wid->core.x = wid->core.y = -request->border_width;
}
+#ifdef XAW_INTERNATIONALIZATION
_XawImCallVendorShellExtResize(wid);
+#endif
return XtGeometryYes;
} else return XtGeometryNo;
}
diff --git a/xc/lib/Xaw3d/Viewport.c b/xc/lib/Xaw3d/Viewport.c
index 79f8eca..b257cd3 100644
--- a/xc/lib/Xaw3d/Viewport.c
+++ b/xc/lib/Xaw3d/Viewport.c
@@ -173,9 +173,9 @@ static Widget CreateScrollbar(w, horizontal)
XtSetArg(barArgs[3], XtNright,
(!horizontal && !w->viewport.useright) ? XtChainLeft : XtChainRight);
XtSetArg(barArgs[4], XtNtop,
- (horizontal && w->viewport.usebottom) ? XtChainBottom: XtChainTop);
+ (horizontal && w->viewport.usebottom) ? XtChainBottom : XtChainTop);
XtSetArg(barArgs[5], XtNbottom,
- (horizontal && !w->viewport.usebottom) ? XtChainTop: XtChainBottom);
+ (horizontal && !w->viewport.usebottom) ? XtChainTop : XtChainBottom);
bar = XtCreateWidget((horizontal ? "horizontal" : "vertical"),
scrollbarWidgetClass, (Widget)w,
@@ -205,9 +205,11 @@ static void Initialize(request, new, args, num_args)
{
ViewportWidget w = (ViewportWidget)new;
static Arg clip_args[8];
+ static Arg threeD_args[8];
Cardinal arg_cnt;
Widget h_bar, v_bar;
Dimension clip_height, clip_width;
+ Dimension pad = 0, sw = 0;
w->form.default_spacing = 0; /* Reset the default spacing to 0 pixels. */
@@ -219,6 +221,31 @@ static void Initialize(request, new, args, num_args)
w->viewport.child = (Widget) NULL;
w->viewport.horiz_bar = w->viewport.vert_bar = (Widget)NULL;
+/*
+ * Create 3D Widget.
+ */
+
+ arg_cnt = 0;
+ XtSetArg(threeD_args[arg_cnt], XtNleft, XtChainLeft); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNwidth, w->core.width); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNheight, w->core.height); arg_cnt++;
+ XtSetArg(threeD_args[arg_cnt], XtNrelief, XtReliefSunken); arg_cnt++;
+ w->viewport.threeD =
+ (ThreeDWidget)XtCreateManagedWidget("threeD", threeDWidgetClass, new,
+ threeD_args, arg_cnt);
+ XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+ if (sw)
+ {
+ pad = 2;
+
+ arg_cnt = 0;
+ XtSetArg(threeD_args[arg_cnt], XtNborderWidth, 0); arg_cnt++;
+ XtSetValues((Widget)w, threeD_args, arg_cnt);
+ }
+
/*
* Create Clip Widget.
*/
@@ -230,8 +257,8 @@ static void Initialize(request, new, args, num_args)
XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height); arg_cnt++;
+ XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width - 2 * sw); arg_cnt++;
+ XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height - 2 * sw); arg_cnt++;
w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new,
clip_args, arg_cnt);
@@ -251,18 +278,18 @@ static void Initialize(request, new, args, num_args)
* Set the clip widget to the correct height.
*/
- clip_width = w->core.width;
- clip_height = w->core.height;
+ clip_width = w->core.width - 2 * sw;
+ clip_height = w->core.height - 2 * sw;
if ( (h_bar != NULL) &&
((int)w->core.width >
- (int)(h_bar->core.width + h_bar->core.border_width)) )
- clip_width -= h_bar->core.width + h_bar->core.border_width;
+ (int)(h_bar->core.width + h_bar->core.border_width + pad)) )
+ clip_width -= h_bar->core.width + h_bar->core.border_width + pad;
if ( (v_bar != NULL) &&
((int)w->core.height >
- (int)(v_bar->core.height + v_bar->core.border_width)) )
- clip_height -= v_bar->core.height + v_bar->core.border_width;
+ (int)(v_bar->core.height + v_bar->core.border_width + pad)) )
+ clip_height -= v_bar->core.height + v_bar->core.border_width + pad;
arg_cnt = 0;
XtSetArg(clip_args[arg_cnt], XtNwidth, clip_width); arg_cnt++;
@@ -287,6 +314,7 @@ static void Realize(widget, value_mask, attributes)
ViewportWidget w = (ViewportWidget)widget;
Widget child = w->viewport.child;
Widget clip = w->viewport.clip;
+ Widget threeD = (Widget)w->viewport.threeD;
*value_mask |= CWBitGravity;
attributes->bit_gravity = NorthWestGravity;
@@ -298,6 +326,8 @@ static void Realize(widget, value_mask, attributes)
XtMoveWidget( child, (Position)0, (Position)0 );
XtRealizeWidget( clip );
XtRealizeWidget( child );
+ XtRealizeWidget( threeD );
+ XLowerWindow( XtDisplay(threeD), XtWindow(threeD) );
XReparentWindow( XtDisplay(w), XtWindow(child), XtWindow(clip),
(Position)0, (Position)0 );
XtMapWidget( child );
@@ -339,7 +369,8 @@ static void ChangeManaged(widget)
if (XtIsManaged(*childP)
&& *childP != w->viewport.clip
&& *childP != w->viewport.horiz_bar
- && *childP != w->viewport.vert_bar)
+ && *childP != w->viewport.vert_bar
+ && *childP != (Widget)w->viewport.threeD)
{
child = *childP;
break;
@@ -476,16 +507,32 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
ViewportWidget w = (ViewportWidget)widget;
Widget child = w->viewport.child;
Widget clip = w->viewport.clip;
+ Widget threeD = (Widget)w->viewport.threeD;
ViewportConstraints constraints
= (ViewportConstraints)clip->core.constraints;
Boolean needshoriz, needsvert;
int clip_width, clip_height;
+ int bar_width, bar_height;
XtWidgetGeometry intended;
+ Dimension pad = 0, sw = 0;
+
+ /*
+ * I've made two optimizations here. The first does away with the
+ * loop, and the second defers setting the child dimensions to the
+ * clip if smaller until after adjusting for possible scrollbars.
+ * If you find that these go too far, define the identifiers here
+ * as required. -- djhjr
+ */
+#define NEED_LAYOUT_LOOP
+#undef PREP_CHILD_TO_CLIP
if (child == (Widget) NULL) return;
- clip_width = w->core.width;
- clip_height = w->core.height;
+ XtVaGetValues(threeD, XtNshadowWidth, &sw, NULL);
+ if (sw) pad = 2;
+
+ clip_width = w->core.width - 2 * sw;
+ clip_height = w->core.height - 2 * sw;
intended.request_mode = CWBorderWidth;
intended.border_width = 0;
@@ -496,8 +543,10 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
&clip_width, &clip_height);
}
else {
+#ifdef NEED_LAYOUT_LOOP
Dimension prev_width, prev_height;
XtGeometryMask prev_mode;
+#endif
XtWidgetGeometry preferred;
needshoriz = needsvert = False;
@@ -511,25 +560,31 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
if (!w->viewport.allowhoriz)
intended.request_mode |= CWWidth;
+#ifdef PREP_CHILD_TO_CLIP
if ((int)child->core.width < clip_width)
intended.width = clip_width;
else
+#endif
intended.width = child->core.width;
+ if (!w->viewport.allowvert)
+ intended.request_mode |= CWHeight;
+
+#ifdef PREP_CHILD_TO_CLIP
if ((int)child->core.height < clip_height)
intended.height = clip_height;
else
+#endif
intended.height = child->core.height;
- if (!w->viewport.allowvert)
- intended.request_mode |= CWHeight;
-
if (!query) {
preferred.width = child->core.width;
preferred.height = child->core.height;
}
- do { /* while intended != prev */
+#ifdef NEED_LAYOUT_LOOP
+ do { /* while intended != prev */
+#endif
if (query) {
(void) XtQueryGeometry( child, &intended, &preferred );
if ( !(preferred.request_mode & CWWidth) )
@@ -537,72 +592,114 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
if ( !(preferred.request_mode & CWHeight) )
preferred.height = intended.height;
}
+
+#ifdef NEED_LAYOUT_LOOP
prev_width = intended.width;
prev_height = intended.height;
prev_mode = intended.request_mode;
+#endif
+
/*
- * note that having once decided to turn on either bar
+ * Note that having once decided to turn on either bar
* we'll not change our mind until we're next resized,
* thus avoiding potential oscillations.
*/
-#define CheckHoriz() \
- if ( w->viewport.allowhoriz && \
- (int)preferred.width > clip_width) { \
- if (!needshoriz) { \
- Widget bar; \
- needshoriz = True; \
- if ((bar = w->viewport.horiz_bar) == (Widget)NULL) \
- bar = CreateScrollbar(w, True); \
- clip_height -= bar->core.height + \
- bar->core.border_width; \
- if (clip_height < 1) clip_height = 1; \
- } \
- intended.width = preferred.width; \
+
+#define CheckHoriz() \
+ if (w->viewport.allowhoriz && \
+ (int)preferred.width > clip_width + 2 * sw) { \
+ if (!needshoriz) { \
+ Widget bar = w->viewport.horiz_bar; \
+ needshoriz = True; \
+ if (bar == (Widget)NULL) \
+ bar = CreateScrollbar(w, True); \
+ clip_height -= bar->core.height + \
+ bar->core.border_width + pad; \
+ if (clip_height < 1) clip_height = 1; \
+ } \
+ intended.width = preferred.width; \
}
-/*enddef*/
+/* enddef */
CheckHoriz();
- if (w->viewport.allowvert && (int)preferred.height > clip_height) {
- if (!needsvert) {
- Widget bar;
+ if (w->viewport.allowvert &&
+ (int)preferred.height > clip_height + 2 * sw) {
+ if (!needsvert) {
+ Widget bar = w->viewport.vert_bar;
needsvert = True;
- if ((bar = w->viewport.vert_bar) == (Widget)NULL)
- bar = CreateScrollbar(w, False);
- clip_width -= bar->core.width + bar->core.border_width;
+ if (bar == (Widget)NULL)
+ bar = CreateScrollbar(w, False);
+ clip_width -= bar->core.width +
+ bar->core.border_width + pad;
if (clip_width < 1) clip_width = 1;
- CheckHoriz();
+ if (!needshoriz) CheckHoriz();
}
intended.height = preferred.height;
}
- if ( !w->viewport.allowhoriz ||
- (int)preferred.width < clip_width) {
+
+#ifdef PREP_CHILD_TO_CLIP
+ if (!w->viewport.allowhoriz ||
+ (int)preferred.width < clip_width) {
intended.width = clip_width;
intended.request_mode |= CWWidth;
}
- if ( !w->viewport.allowvert ||
- (int)preferred.height < clip_height) {
+ if (!w->viewport.allowvert ||
+ (int)preferred.height < clip_height) {
intended.height = clip_height;
intended.request_mode |= CWHeight;
}
- } while (intended.request_mode != prev_mode
- || (intended.request_mode & CWWidth
- && intended.width != prev_width)
- || (intended.request_mode & CWHeight
- && intended.height != prev_height));
+#endif
+#ifdef NEED_LAYOUT_LOOP
+ } while ( intended.request_mode != prev_mode ||
+ (intended.request_mode & CWWidth &&
+ intended.width != prev_width) ||
+ (intended.request_mode & CWHeight &&
+ intended.height != prev_height) );
+#endif
+
+#ifndef PREP_CHILD_TO_CLIP
+ if (!w->viewport.allowhoriz ||
+ (int)preferred.width < clip_width) {
+ intended.width = clip_width;
+ intended.request_mode |= CWWidth;
+ }
+ if (!w->viewport.allowvert ||
+ (int)preferred.height < clip_height) {
+ intended.height = clip_height;
+ intended.request_mode |= CWHeight;
+ }
+#endif
}
+ bar_width = bar_height = 0;
+ if (needsvert)
+ bar_width = w->viewport.vert_bar->core.width +
+ w->viewport.vert_bar->core.border_width + pad;
+ if (needshoriz)
+ bar_height = w->viewport.horiz_bar->core.height +
+ w->viewport.horiz_bar->core.border_width + pad;
+
+ if (XtIsRealized(threeD))
+ XLowerWindow( XtDisplay(threeD), XtWindow(threeD) );
+
+ XtMoveWidget( threeD,
+ (Position)(!needsvert ? 0 :
+ (w->viewport.useright ? 0 : bar_width)),
+ (Position)(!needshoriz ? 0 :
+ (w->viewport.usebottom ? 0 : bar_height)) );
+ XtResizeWidget( threeD, (Dimension)(w->core.width - bar_width),
+ (Dimension)(w->core.height - bar_height), (Dimension)0 );
+
if (XtIsRealized(clip))
XRaiseWindow( XtDisplay(clip), XtWindow(clip) );
XtMoveWidget( clip,
- (Position) (needsvert ? (w->viewport.useright ? 0 :
- w->viewport.vert_bar->core.width +
- w->viewport.vert_bar->core.border_width) : 0),
- (Position) (needshoriz ? (w->viewport.usebottom ? 0 :
- w->viewport.horiz_bar->core.height +
- w->viewport.horiz_bar->core.border_width) : 0));
- XtResizeWidget( clip, (Dimension)clip_width,
- (Dimension)clip_height, (Dimension)0 );
-
+ (Position)(!needsvert ? sw :
+ (w->viewport.useright ? sw : bar_width + sw)),
+ (Position)(!needshoriz ? sw :
+ (w->viewport.usebottom ? sw : bar_height + sw)) );
+ XtResizeWidget( clip, (Dimension)clip_width, (Dimension)clip_height,
+ (Dimension)0 );
+
if (w->viewport.horiz_bar != (Widget)NULL) {
Widget bar = w->viewport.horiz_bar;
if (!needshoriz) {
@@ -614,10 +711,12 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
}
else {
int bw = bar->core.border_width;
- XtResizeWidget( bar, (Dimension) clip_width, bar->core.height, (Dimension) bw );
+ XtResizeWidget( bar,
+ (Dimension)(clip_width + 2 * sw), bar->core.height,
+ (Dimension)bw );
XtMoveWidget( bar,
(Position)((needsvert && !w->viewport.useright)
- ? w->viewport.vert_bar->core.width
+ ? w->viewport.vert_bar->core.width + pad
: -bw),
(Position)(w->viewport.usebottom
? w->core.height - bar->core.height - bw
@@ -637,13 +736,15 @@ static void ComputeLayout(widget, query, destroy_scrollbars)
}
else {
int bw = bar->core.border_width;
- XtResizeWidget( bar, bar->core.width, (Dimension)clip_height, (Dimension)bw );
+ XtResizeWidget( bar,
+ bar->core.width, (Dimension)(clip_height + 2 * sw),
+ (Dimension)bw );
XtMoveWidget( bar,
(Position)(w->viewport.useright
- ? w->core.width - bar->core.width - bw
+ ? w->core.width - bar->core.width - bw
: -bw),
(Position)((needshoriz && !w->viewport.usebottom)
- ? w->viewport.horiz_bar->core.height
+ ? w->viewport.horiz_bar->core.height + pad
: -bw) );
XtSetMappedWhenManaged( bar, True );
}
@@ -681,18 +782,22 @@ int *clip_width, *clip_height;
ViewportWidget w = (ViewportWidget)widget;
Widget child = w->viewport.child;
XtWidgetGeometry preferred;
+ Dimension pad = 0, sw = 0;
/*
* If forcebars then needs = allows = has.
* Thus if needsvert is set it MUST have a scrollbar.
*/
+ XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+ if (sw) pad = 2;
+
if (w->viewport.allowvert) {
if (w->viewport.vert_bar == NULL)
w->viewport.vert_bar = CreateScrollbar(w, False);
*clip_width -= w->viewport.vert_bar->core.width +
- w->viewport.vert_bar->core.border_width;
+ w->viewport.vert_bar->core.border_width + pad;
}
if (w->viewport.allowhoriz) {
@@ -700,7 +805,7 @@ int *clip_width, *clip_height;
w->viewport.horiz_bar = CreateScrollbar(w, True);
*clip_height -= w->viewport.horiz_bar->core.height +
- w->viewport.horiz_bar->core.border_width;
+ w->viewport.horiz_bar->core.border_width + pad;
}
AssignMax( *clip_width, 1 );
@@ -708,11 +813,11 @@ int *clip_width, *clip_height;
if (!w->viewport.allowvert) {
intended->height = *clip_height;
- intended->request_mode = CWHeight;
+ intended->request_mode |= CWHeight;
}
if (!w->viewport.allowhoriz) {
intended->width = *clip_width;
- intended->request_mode = CWWidth;
+ intended->request_mode |= CWWidth;
}
if ( query ) {
@@ -832,14 +937,19 @@ GeometryRequestPlusScrollbar(w, horizontal, request, reply_return)
ViewportWidget w;
XtWidgetGeometry *request, *reply_return;
{
- Widget sb;
+ Widget bar;
XtWidgetGeometry plusScrollbars;
+ Dimension pad = 0, sw = 0;
+
+ XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+ if (sw) pad = 2;
+
plusScrollbars = *request;
- if ((sb = w->viewport.horiz_bar) == (Widget)NULL)
- sb = CreateScrollbar( w, horizontal);
- request->width += sb->core.width;
- request->height += sb->core.height;
- XtDestroyWidget(sb);
+ if ((bar = w->viewport.horiz_bar) == (Widget)NULL)
+ bar = CreateScrollbar(w, horizontal);
+ request->width += bar->core.width + pad;
+ request->height += bar->core.height + pad;
+ XtDestroyWidget(bar);
return XtMakeGeometryRequest((Widget) w, &plusScrollbars, reply_return);
}
@@ -892,6 +1002,7 @@ static XtGeometryResult GeometryManager(child, request, reply)
Boolean reconfigured;
Boolean child_changed_size;
Dimension height_remaining;
+ Dimension pad = 0, sw = 0;
if (request->request_mode & XtCWQueryOnly)
return QueryGeometry(w, request, reply);
@@ -903,6 +1014,9 @@ static XtGeometryResult GeometryManager(child, request, reply)
&& request->border_width > 0))
return XtGeometryNo;
+ XtVaGetValues((Widget)(w->viewport.threeD), XtNshadowWidth, &sw, NULL);
+ if (sw) pad = 2;
+
allowed = *request;
reconfigured = GetGeometry( (Widget)w,
@@ -920,7 +1034,8 @@ static XtGeometryResult GeometryManager(child, request, reply)
Widget bar;
if ((bar = w->viewport.horiz_bar) == (Widget)NULL)
bar = CreateScrollbar( w, True );
- height_remaining -= bar->core.height + bar->core.border_width;
+ height_remaining -= bar->core.height +
+ bar->core.border_width + pad;
reconfigured = True;
}
else {
@@ -939,8 +1054,9 @@ static XtGeometryResult GeometryManager(child, request, reply)
allowed.request_mode |= CWWidth;
}
if ( (int)allowed.width >
- (int)(bar->core.width + bar->core.border_width) )
- allowed.width -= bar->core.width + bar->core.border_width;
+ (int)(bar->core.width + bar->core.border_width + pad) )
+ allowed.width -= bar->core.width +
+ bar->core.border_width + pad;
else
allowed.width = 1;
reconfigured = True;
diff --git a/xc/lib/Xaw3d/ViewportP.h b/xc/lib/Xaw3d/ViewportP.h
index d24d6ea..20e279b 100644
--- a/xc/lib/Xaw3d/ViewportP.h
+++ b/xc/lib/Xaw3d/ViewportP.h
@@ -56,6 +56,7 @@ SOFTWARE.
#include <X11/Xaw3d/Viewport.h>
#include <X11/Xaw3d/FormP.h>
+#include <X11/Xaw3d/ThreeDP.h>
typedef struct {int empty;} ViewportClassPart;
@@ -81,6 +82,7 @@ typedef struct _ViewportPart {
/* private state */
Widget clip, child; /* The clipping and (scrolled) child widgets */
Widget horiz_bar, vert_bar;/* What scrollbars we currently have. */
+ ThreeDWidget threeD;
} ViewportPart;
typedef struct _ViewportRec {
diff --git a/xc/lib/Xaw3d/Xaw3dP.c b/xc/lib/Xaw3d/Xaw3dP.c
new file mode 100644
index 0000000..b3b26f7
--- /dev/null
+++ b/xc/lib/Xaw3d/Xaw3dP.c
@@ -0,0 +1,212 @@
+/*
+ * Xaw3dP.c
+ *
+ * Global functions that don't really belong anywhere else.
+ */
+
+/*********************************************************************
+Copyright (C) 1992 Kaleb Keithley
+Copyright (C) 2000, 2003 David J. Hawkey Jr.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of the copyright holders
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*********************************************************************/
+
+#include "Xaw3dP.h"
+#ifdef XAW_MULTIPLANE_PIXMAPS
+#include <stdio.h>
+#include <X11/xpm.h>
+#endif
+
+#ifdef XAW_GRAY_BLKWHT_STIPPLES
+/* ARGSUSED */
+unsigned long
+grayPixel(p, dpy, scn)
+unsigned long p; /* unused */
+Display *dpy;
+Screen *scn;
+{
+ static XColor Gray =
+ {
+ 0, /* pixel */
+ 0, 0, 0, /* red, green, blue */
+ 0, /* flags */
+ 0 /* pad */
+ };
+
+ if (!Gray.pixel)
+ {
+ XColor exact;
+
+ (void)XAllocNamedColor(dpy, DefaultColormapOfScreen(scn),
+ "gray", &Gray, &exact); /* Blindflug */
+ }
+
+ return Gray.pixel;
+}
+#endif
+
+#ifdef XAW_MULTIPLANE_PIXMAPS
+#define IS_EVEN(x) (((x) % 2) == 0)
+#define IS_ODD(x) (((x) % 2) == 1)
+
+/* ARGSUSED */
+Pixmap
+stipplePixmap(w, pm, cm, bg, d)
+Widget w;
+Pixmap pm;
+Colormap cm;
+Pixel bg;
+unsigned int d;
+{
+ static Pixmap pixmap;
+ Display *dpy;
+ XpmImage image;
+ XpmAttributes attr;
+ XpmColor *src_table, *dst_table;
+ int i, j, index = -1;
+
+ if (pm == None)
+ return (None);
+ if (XtIsRealized(w) == False)
+ return (None);
+
+ dpy = XtDisplayOfObject(w);
+
+ attr.colormap = cm;
+ attr.closeness = 32768; /* might help on 8-bpp displays? */
+ attr.valuemask = XpmColormap | XpmCloseness;
+
+ if (XpmCreateXpmImageFromPixmap(dpy, pm, None,
+ &image, &attr) != XpmSuccess)
+ return (None);
+ if (image.height == 0 || image.width == 0)
+ {
+ XpmFreeXpmImage(&image);
+ return (None);
+ }
+
+ if (d > 1)
+ {
+ XColor x_color;
+ XpmColor *dst_color;
+ char dst_rgb[14];
+
+ /*
+ * Multi-plane (XPM) pixmap. Don't bother scanning the color table
+ * for the background color, it might not be there. Copy the color
+ * table, add an entry for the background color, and set the index
+ * to that.
+ */
+
+ x_color.pixel = bg;
+ XQueryColor(dpy, cm, &x_color);
+ sprintf(dst_rgb, "#%04X%04X%04X",
+ x_color.red, x_color.green, x_color.blue);
+
+ dst_table = (XpmColor *) XtCalloc(sizeof(XpmColor),
+ image.ncolors + 1);
+ memcpy(dst_table, image.colorTable, image.ncolors * sizeof(XpmColor));
+
+ dst_color = &dst_table[image.ncolors];
+ switch (w->core.depth)
+ {
+ case 1:
+ dst_color->m_color = dst_rgb;
+ break;
+ case 4:
+ dst_color->g4_color = dst_rgb;
+ break;
+ case 6:
+ dst_color->g_color = dst_rgb;
+ break;
+ case 8:
+ default:
+ dst_color->c_color = dst_rgb;
+ break;
+ }
+ dst_color->string = "\x01"; /* ! */
+
+ src_table = image.colorTable;
+ image.colorTable = dst_table;
+
+ index = image.ncolors++;
+ }
+ else
+ {
+ XpmColor *src_color;
+ char *src_rgb;
+
+ /*
+ * Single-plane (XBM) pixmap. Set the index to the white color.
+ */
+
+ for (i = 0, src_color = image.colorTable; i < image.ncolors;
+ i++, src_color++)
+ {
+ switch (w->core.depth)
+ {
+ case 1:
+ src_rgb = src_color->m_color;
+ break;
+ case 4:
+ src_rgb = src_color->g4_color;
+ break;
+ case 6:
+ src_rgb = src_color->g_color;
+ break;
+ case 8:
+ default:
+ src_rgb = src_color->c_color;
+ break;
+ }
+ if (strcmp(src_rgb, "#000000000000") == 0)
+ {
+ index = i;
+ break;
+ }
+ }
+
+ if (index == -1)
+ {
+ XpmFreeXpmImage(&image);
+ return (None);
+ }
+ }
+
+ for (i = 0; i < image.height; i++)
+ for (j = 0; j < image.width; j++)
+ if ((IS_ODD(i) && IS_EVEN(j)) || (IS_EVEN(i) && IS_ODD(j)))
+ image.data[(i * image.width) + j] = index;
+
+ attr.depth = d;
+ attr.valuemask |= XpmDepth;
+
+ i = XpmCreatePixmapFromXpmImage(dpy, pm, &image, &pixmap, NULL, &attr);
+
+ if (d > 1)
+ {
+ XtFree((void *)image.colorTable); /* dst_table */
+ image.colorTable = src_table;
+ image.ncolors--;
+ }
+ XpmFreeXpmImage(&image);
+
+ return ((i == XpmSuccess) ? pixmap : None);
+}
+#endif
diff --git a/xc/lib/Xaw3d/Xaw3dP.h.sed b/xc/lib/Xaw3d/Xaw3dP.h.sed
new file mode 100644
index 0000000..391bde3
--- /dev/null
+++ b/xc/lib/Xaw3d/Xaw3dP.h.sed
@@ -0,0 +1,83 @@
+/*
+ * Xaw3dP.h
+ *
+ * Global definitions and declarations. Not for public consumption.
+ */
+
+/*********************************************************************
+Copyright (C) 1992 Kaleb Keithley
+Copyright (C) 2000, 2003 David J. Hawkey Jr.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of the copyright holders
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*********************************************************************/
+
+#ifndef _Xaw3dP_h
+#define _Xaw3dP_h
+
+#include <X11/IntrinsicP.h>
+
+/* These are set during the build to reflect capability and options. */
+/* I18n support */
+/* XPM support */
+/* gray stipples */
+/* arrow scrollbars */
+
+#ifndef XtX
+#define XtX(w) (((RectObj)w)->rectangle.x)
+#endif
+#ifndef XtY
+#define XtY(w) (((RectObj)w)->rectangle.y)
+#endif
+#ifndef XtWidth
+#define XtWidth(w) (((RectObj)w)->rectangle.width)
+#endif
+#ifndef XtHeight
+#define XtHeight(w) (((RectObj)w)->rectangle.height)
+#endif
+#ifndef XtBorderWidth
+#define XtBorderWidth(w) (((RectObj)w)->rectangle.border_width)
+#endif
+
+#ifdef XAW_GRAY_BLKWHT_STIPPLES
+extern unsigned long
+grayPixel(
+#if NeedFunctionPrototypes
+ unsigned long,
+ Display *,
+ Screen *
+#endif
+);
+#else
+#define grayPixel(p, dpy, scn) (p)
+#endif
+
+#ifdef XAW_MULTIPLANE_PIXMAPS
+extern Pixmap
+stipplePixmap(
+#if NeedFunctionPrototypes
+ Widget,
+ Pixmap,
+ Colormap,
+ Pixel,
+ unsigned int
+#endif
+);
+#endif
+
+#endif /* _Xaw3dP_h */
diff --git a/xc/lib/Xaw3d/jump_funcs b/xc/lib/Xaw3d/jump_funcs
deleted file mode 100644
index 9c137a7..0000000
--- a/xc/lib/Xaw3d/jump_funcs
+++ /dev/null
@@ -1,128 +0,0 @@
-# $XConsortium: jump_funcs,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_funcs,v 3.0 1994/04/28 12:31:51 dawes Exp $
-#
-00000000 T _XawAsciiSourceFreeString libXaw3d AsciiSrc
-00000000 T _XawAsciiSave libXaw3d AsciiSrc
-00000000 T _XawAsciiSaveAsFile libXaw3d AsciiSrc
-00000000 T _XawAsciiSourceChanged libXaw3d AsciiSrc
-00000000 T _XawDialogAddButton libXaw3d Dialog
-00000000 T _XawDialogGetValueString libXaw3d Dialog
-00000000 T _XawFormDoLayout libXaw3d Form
-00000000 T _XawListChange libXaw3d List
-00000000 T _XawListUnhighlight libXaw3d List
-00000000 T _XawListHighlight libXaw3d List
-00000000 T _XawListShowCurrent libXaw3d List
-00000000 T _XawPanedSetMinMax libXaw3d Paned
-00000000 T _XawPanedGetMinMax libXaw3d Paned
-00000000 T _XawPanedSetRefigureMode libXaw3d Paned
-00000000 T _XawPanedGetNumSub libXaw3d Paned
-00000000 T _XawPanedAllowResize libXaw3d Paned
-00000000 T _XawScrollbarSetThumb libXaw3d Scrollbar
-00000000 T _XawSimpleMenuAddGlobalActions libXaw3d SimpleMenu
-00000000 T _XawSimpleMenuGetActiveEntry libXaw3d SimpleMenu
-00000000 T _XawSimpleMenuClearActiveEntry libXaw3d SimpleMenu
-00000000 T __XawTextNeedsUpdating libXaw3d Text
-00000000 T __XawTextGetText libXaw3d Text
-00000000 T __XawTextGetSTRING libXaw3d Text
-00000000 T __XawTextBuildLineTable libXaw3d Text
-00000000 T __XawTextSetScrollBars libXaw3d Text
-00000000 T __XawTextVScroll libXaw3d Text
-00000000 T __XawTextSaltAwaySelection libXaw3d Text
-00000000 T __XawTextReplace libXaw3d Text
-00000000 T __XawTextClearAndCenterDisplay libXaw3d Text
-00000000 T __XawTextCheckResize libXaw3d Text
-00000000 T __XawTextSelectionList libXaw3d Text
-00000000 T __XawTextSetSelection libXaw3d Text
-00000000 T __XawTextAlterSelection libXaw3d Text
-00000000 T __XawTextPrepareToUpdate libXaw3d Text
-00000000 T __XawTextShowPosition libXaw3d Text
-00000000 T __XawTextExecuteUpdate libXaw3d Text
-00000000 T _XawTextDisplay libXaw3d Text
-00000000 T _XawTextSetSelectionArray libXaw3d Text
-00000000 T _XawTextGetSelectionPos libXaw3d Text
-00000000 T _XawTextSetSource libXaw3d Text
-00000000 T _XawTextReplace libXaw3d Text
-00000000 T _XawTextTopPosition libXaw3d Text
-00000000 T _XawTextSetInsertionPoint libXaw3d Text
-00000000 T _XawTextGetInsertionPoint libXaw3d Text
-00000000 T _XawTextUnsetSelection libXaw3d Text
-00000000 T _XawTextSetSelection libXaw3d Text
-00000000 T _XawTextInvalidate libXaw3d Text
-00000000 T _XawTextDisableRedisplay libXaw3d Text
-00000000 T _XawTextEnableRedisplay libXaw3d Text
-00000000 T _XawTextGetSource libXaw3d Text
-00000000 T _XawTextDisplayCaret libXaw3d Text
-00000000 T _XawTextSearch libXaw3d Text
-00000000 T _XawTextSinkDisplayText libXaw3d TextSink
-00000000 T _XawTextSinkInsertCursor libXaw3d TextSink
-00000000 T _XawTextSinkClearToBackground libXaw3d TextSink
-00000000 T _XawTextSinkFindPosition libXaw3d TextSink
-00000000 T _XawTextSinkFindDistance libXaw3d TextSink
-00000000 T _XawTextSinkResolve libXaw3d TextSink
-00000000 T _XawTextSinkMaxLines libXaw3d TextSink
-00000000 T _XawTextSinkMaxHeight libXaw3d TextSink
-00000000 T _XawTextSinkSetTabs libXaw3d TextSink
-00000000 T _XawTextSinkGetCursorBounds libXaw3d TextSink
-00000000 T _XawTextSourceRead libXaw3d TextSrc
-00000000 T _XawTextSourceReplace libXaw3d TextSrc
-00000000 T _XawTextSourceScan libXaw3d TextSrc
-00000000 T _XawTextSourceSearch libXaw3d TextSrc
-00000000 T _XawTextSourceConvertSelection libXaw3d TextSrc
-00000000 T _XawTextSourceSetSelection libXaw3d TextSrc
-00000000 T __XawTextZapSelection libXaw3d TextAction
-00000000 T __XawTextInsertFileAction libXaw3d TextPop
-00000000 T __XawTextInsertFile libXaw3d TextPop
-00000000 T __XawTextDoSearchAction libXaw3d TextPop
-00000000 T __XawTextPopdownSearchAction libXaw3d TextPop
-00000000 T __XawTextSearch libXaw3d TextPop
-00000000 T __XawTextDoReplaceAction libXaw3d TextPop
-00000000 T __XawTextSetField libXaw3d TextPop
-00000000 T _XawToggleChangeRadioGroup libXaw3d Toggle
-00000000 T _XawToggleGetCurrent libXaw3d Toggle
-00000000 T _XawToggleSetCurrent libXaw3d Toggle
-00000000 T _XawToggleUnsetCurrent libXaw3d Toggle
-00000000 T _XawTreeForceLayout libXaw3d Tree
-00000000 T _XawViewportSetLocation libXaw3d Viewport
-00000000 T _XawViewportSetCoordinates libXaw3d Viewport
-00000000 T _XawInitializeWidgetSet libXaw3d XawInit
-00000000 T __XawMultiSourceFreeString libXaw3d MultiSrc
-00000000 T __XawMultiSave libXaw3d MultiSrc
-00000000 T __XawMultiSaveAsFile libXaw3d MultiSrc
-00000000 T __XawMultiSinkPosToXY libXaw3d MultiSink
-00000000 T __XawTextPosToXY libXaw3d Text
-00000000 T __XawTextFormat libXaw3d TextSrc
-00000000 T __XawTextWCToMB libXaw3d TextSrc
-00000000 T __XawTextMBToWC libXaw3d TextSrc
-00000000 T _XawVendorShellExtResize libXaw3d Vendor
-00000000 T __XawImResizeVendorShell libXaw3d XawIm
-00000000 T __XawImGetShellHeight libXaw3d XawIm
-00000000 T __XawImRealize libXaw3d XawIm
-00000000 T __XawImInitialize libXaw3d XawIm
-00000000 T __XawImReconnect libXaw3d XawIm
-00000000 T __XawImRegister libXaw3d XawIm
-00000000 T __XawImUnregister libXaw3d XawIm
-00000000 T __XawImSetValues libXaw3d XawIm
-00000000 T __XawImVASetValues libXaw3d XawIm
-00000000 T __XawImSetFocusValues libXaw3d XawIm
-00000000 T __XawImVASetFocusValues libXaw3d XawIm
-00000000 T __XawImUnsetFocus libXaw3d XawIm
-00000000 T __XawImWcLookupString libXaw3d XawIm
-00000000 T __XawImGetImAreaHeight libXaw3d XawIm
-00000000 T __XawImCallVendorShellExtResize libXaw3d XawIm
-00000000 T __XawImDestroy libXaw3d XawIm
-00000000 T __Xaw_atowc libXaw3d XawI18n
-00000000 T _XawSme3dComputeTopShadowRGB libXaw3d SmeThreeD
-00000000 T _XawSme3dComputeBottomShadowRGB libXaw3d SmeThreeD
-00000000 T _Xaw3dComputeTopShadowRGB libXaw3d ThreeD
-00000000 T _Xaw3dComputeBottomShadowRGB libXaw3d ThreeD
-00000000 T _LayYYwrap libXaw3d laygram
-00000000 T _LayYYsetdest libXaw3d laygram
-00000000 T _LayYYparse libXaw3d laygram
-00000000 T _LayYYlex libXaw3d laylex
-00000000 T _LayYYsetsource libXaw3d laylex
-00000000 T _LayYYerror libXaw3d laylex
-00000000 T _LayYYlook libXaw3d laylex
-00000000 T _LayYYback libXaw3d laylex
-00000000 T _LayYYinput libXaw3d laylex
-00000000 T _LayYYoutput libXaw3d laylex
-00000000 T _LayYYunput libXaw3d laylex
diff --git a/xc/lib/Xaw3d/jump_ignore b/xc/lib/Xaw3d/jump_ignore
deleted file mode 100644
index cf0567d..0000000
--- a/xc/lib/Xaw3d/jump_ignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# $XConsortium: jump_ignore,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_ignore,v 3.0 1994/04/28 12:31:53 dawes Exp $
-# jump_ignore
diff --git a/xc/lib/Xaw3d/jump_vars b/xc/lib/Xaw3d/jump_vars
deleted file mode 100644
index 254c4ee..0000000
--- a/xc/lib/Xaw3d/jump_vars
+++ /dev/null
@@ -1,126 +0,0 @@
-# $XConsortium: jump_vars,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_vars,v 3.0 1994/04/28 12:31:54 dawes Exp $
-#
-00001400 D _XawWidgetArray libXaw3d AllWidgets
-00000004 D _XawWidgetCount libXaw3d AllWidgets
-00000140 D _asciiSinkClassRec libXaw3d AsciiSink
-00000004 D _asciiSinkObjectClass libXaw3d AsciiSink
-00000120 D _asciiSrcClassRec libXaw3d AsciiSrc
-00000004 D _asciiSrcObjectClass libXaw3d AsciiSrc
-00000100 D _asciiTextClassRec libXaw3d AsciiText
-00000004 D _asciiTextWidgetClass libXaw3d AsciiText
-00000100 D _boxClassRec libXaw3d Box
-00000004 D _boxWidgetClass libXaw3d Box
-00000100 D _commandClassRec libXaw3d Command
-00000004 D _commandWidgetClass libXaw3d Command
-00000140 D _dialogClassRec libXaw3d Dialog
-00000004 D _dialogWidgetClass libXaw3d Dialog
-00000140 D _formClassRec libXaw3d Form
-00000004 D _formWidgetClass libXaw3d Form
-00000100 D _gripClassRec libXaw3d Grip
-00000004 D _gripWidgetClass libXaw3d Grip
-00000100 D _labelClassRec libXaw3d Label
-00000004 D _labelWidgetClass libXaw3d Label
-00000100 D _listClassRec libXaw3d List
-00000004 D _listWidgetClass libXaw3d List
-00000100 D _menuButtonClassRec libXaw3d MenuButton
-00000004 D _menuButtonWidgetClass libXaw3d MenuButton
-00000140 D _panedClassRec libXaw3d Paned
-00000004 D _panedWidgetClass libXaw3d Paned
-00000004 D _vPanedWidgetClass libXaw3d Paned
-00000100 D _pannerClassRec libXaw3d Panner
-00000004 D _pannerWidgetClass libXaw3d Panner
-00000100 D _portholeClassRec libXaw3d Porthole
-00000004 D _portholeWidgetClass libXaw3d Porthole
-00000100 D _repeaterClassRec libXaw3d Repeater
-00000004 D _repeaterWidgetClass libXaw3d Repeater
-00000100 D _scrollbarClassRec libXaw3d Scrollbar
-00000004 D _scrollbarWidgetClass libXaw3d Scrollbar
-00000100 D _simpleClassRec libXaw3d Simple
-00000004 D _simpleWidgetClass libXaw3d Simple
-00000100 D _simpleMenuClassRec libXaw3d SimpleMenu
-00000004 D _simpleMenuWidgetClass libXaw3d SimpleMenu
-00000100 D _smeClassRec libXaw3d Sme
-00000004 D _smeObjectClass libXaw3d Sme
-00000100 D _smeBSBClassRec libXaw3d SmeBSB
-00000004 D _smeBSBObjectClass libXaw3d SmeBSB
-00000100 D _smeLineClassRec libXaw3d SmeLine
-00000004 D _smeLineObjectClass libXaw3d SmeLine
-00000100 D _stripChartClassRec libXaw3d StripChart
-00000004 D _stripChartWidgetClass libXaw3d StripChart
-00000004 D _FMT8BIT libXaw3d Text
-00000100 D _textClassRec libXaw3d Text
-00000004 D _textWidgetClass libXaw3d Text
-00000100 D _textSinkClassRec libXaw3d TextSink
-00000004 D _textSinkObjectClass libXaw3d TextSink
-00000100 D _textSrcClassRec libXaw3d TextSrc
-00000004 D _textSrcObjectClass libXaw3d TextSrc
-00000300 D __XawTextActionsTable libXaw3d TextAction
-00000004 D __XawTextActionsTableCount libXaw3d TextAction
-00000004 D __XawDefaultTextTranslations1 libXaw3d TextTr
-00000004 D __XawDefaultTextTranslations2 libXaw3d TextTr
-00000004 D __XawDefaultTextTranslations3 libXaw3d TextTr
-00000100 D _toggleClassRec libXaw3d Toggle
-00000004 D _toggleWidgetClass libXaw3d Toggle
-00000140 D _treeClassRec libXaw3d Tree
-00000004 D _treeWidgetClass libXaw3d Tree
-00000100 D _vendorShellClassRec libXaw3d Vendor
-00000004 D _vendorShellWidgetClass libXaw3d Vendor
-00000140 D _viewportClassRec libXaw3d Viewport
-00000004 D _viewportWidgetClass libXaw3d Viewport
-00000140 D _multiSrcClassRec libXaw3d MultiSrc
-00000004 D _multiSrcObjectClass libXaw3d MultiSrc
-00000140 D _multiSinkClassRec libXaw3d MultiSink
-00000004 D _multiSinkObjectClass libXaw3d MultiSink
-00000004 D __XawDefaultTextTranslations4 libXaw3d TextTr
-00000140 D _xawvendorShellExtClassRec libXaw3d Vendor
-00000004 D _xawvendorShellExtWidgetClass libXaw3d Vendor
-00000004 D _XawFmt8Bit libXaw3d Text
-00000004 D _XawFmtWide libXaw3d Text
-00000140 D _layoutClassRec libXaw3d Layout
-00000004 D _layoutWidgetClass libXaw3d Layout
-00000140 D _smeThreeDClassRec libXaw3d SmeThreeD
-00000004 D _smeThreeDObjectClass libXaw3d SmeThreeD
-00000100 D _threeDClassRec libXaw3d ThreeD
-00000004 D _threeDWidgetClass libXaw3d ThreeD
-000000a0 D _LayYYlhs libXaw3d laygram
-000000a0 D _LayYYlen libXaw3d laygram
-00000100 D _LayYYdefred libXaw3d laygram
-00000040 D _LayYYdgoto libXaw3d laygram
-00000140 D _LayYYsindex libXaw3d laygram
-00000140 D _LayYYrindex libXaw3d laygram
-00000040 D _LayYYgindex libXaw3d laygram
-00000400 D _LayYYtable libXaw3d laygram
-00000400 D _LayYYcheck libXaw3d laygram
-00000004 C _LayYYdebug libXaw3d laygram
-00000004 C _LayYYnerrs libXaw3d laygram
-00000004 C _LayYYerrflag libXaw3d laygram
-00000004 C _LayYYchar libXaw3d laygram
-00000004 C _LayYYssp libXaw3d laygram
-00000004 C _LayYYvsp libXaw3d laygram
-00000040 C _LayYYval libXaw3d laygram
-00000040 C _LayYYlval libXaw3d laygram
-00000800 C _LayYYss libXaw3d laygram
-00004000 C _LayYYvs libXaw3d laygram
-00000004 D _LayYYin libXaw3d laylex
-00000004 D _LayYYout libXaw3d laylex
-00000400 D _LayYYvstop libXaw3d laylex
-00000400 D _LayYYcrank libXaw3d laylex
-00000600 D _LayYYsvec libXaw3d laylex
-00000004 D _LayYYtop libXaw3d laylex
-00000004 D _LayYYbgin libXaw3d laylex
-00000200 D _LayYYmatch libXaw3d laylex
-00000040 D _LayYYextra libXaw3d laylex
-00000004 D _LayYYlineno libXaw3d laylex
-00000004 D _LayYYsptr libXaw3d laylex
-00000004 D _LayYYprevious libXaw3d laylex
-00000004 C _LayYYleng libXaw3d laylex
-00000800 C _LayYYtext libXaw3d laylex
-00000004 C _LayYYmorfg libXaw3d laylex
-00000800 C _LayYYsbuf libXaw3d laylex
-00000004 C _LayYYtchar libXaw3d laylex
-00000004 C _LayYYestate libXaw3d laylex
-00002000 C _LayYYlstate libXaw3d laylex
-00000004 C _LayYYlsp libXaw3d laylex
-00000004 C _LayYYolsp libXaw3d laylex
-00000004 C _LayYYfnd libXaw3d laylex
diff --git a/xc/lib/Xaw3d/sharedlib.c b/xc/lib/Xaw3d/sharedlib.c
index 254bd52..486cf0a 100644
--- a/xc/lib/Xaw3d/sharedlib.c
+++ b/xc/lib/Xaw3d/sharedlib.c
@@ -28,12 +28,15 @@ in this Software without prior written authorization from the X Consortium.
#if defined(SUNSHLIB) && !defined(SHAREDCODE)
+#include <X11/Xaw3d/Xaw3dP.h>
#include <X11/IntrinsicP.h>
#include <X11/Xaw3d/AsciiSinkP.h>
#include <X11/Xaw3d/AsciiSrcP.h>
#include <X11/Xaw3d/AsciiTextP.h>
+#ifdef XAW_INTERNATIONALIZATION
#include <X11/Xaw3d/MultiSinkP.h>
#include <X11/Xaw3d/MultiSrcP.h>
+#endif
#include <X11/Xaw3d/BoxP.h>
#include <X11/Xaw3d/CommandP.h>
#include <X11/Xaw3d/DialogP.h>
@@ -58,6 +61,7 @@ in this Software without prior written authorization from the X Consortium.
#include <X11/Xaw3d/TextSinkP.h>
#include <X11/Xaw3d/TextSrcP.h>
#include <X11/Xaw3d/ThreeDP.h>
+#include <X11/Xaw3d/TipP.h>
#include <X11/Xaw3d/ToggleP.h>
#include <X11/Xaw3d/TreeP.h>
#include <X11/VendorP.h>
@@ -82,11 +86,15 @@ extern AsciiDiskClassRec asciiDiskClassRec;
WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
#endif
+#ifdef XAW_INTERNATIONALIZATION
extern MultiSinkClassRec multiSinkClassRec;
WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec;
+#endif
+#ifdef XAW_INTERNATIONALIZATION
extern MultiSrcClassRec multiSrcClassRec;
WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec;
+#endif
extern BoxClassRec boxClassRec;
WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec;
@@ -153,7 +161,9 @@ WidgetClass textWidgetClass = (WidgetClass)&textClassRec;
unsigned long FMT8BIT = 0L;
unsigned long XawFmt8Bit = 0L;
+#ifdef XAW_INTERNATIONALIZATION
unsigned long XawFmtWide = 0L;
+#endif
extern TextSinkClassRec textSinkClassRec;
WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec;
@@ -164,6 +174,9 @@ WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec;
extern ThreeDClassRec threeDClassRec;
WidgetClass threeDClass = (WidgetClass)&threeDClassRec;
+extern TipClassRec tipClassRec;
+WidgetClass tipWidgetClass = (WidgetClass)&tipClassRec;
+
extern ToggleClassRec toggleClassRec;
WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec;