This commit was generated by cvs2svn to compensate for changes in r5761,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@5762 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
97094231a5
commit
ebabab8c26
@ -1,17 +1,20 @@
|
||||
##################################################################
|
||||
#
|
||||
# Makefile for XVT/NT 4.00 Examples
|
||||
# Compiler: Microsoft Visual C++ 1.0
|
||||
# Orca Software distributes these makefiles for convenience. Having a
|
||||
# makefile for a particular platform does not imply that you have a
|
||||
# license to use the source code on that platform. Before using the
|
||||
# source code on any given platform, make sure that you have purchased
|
||||
# the appropriate license.
|
||||
#
|
||||
##################################################################
|
||||
# Copyright 1989-1994 XVT Software Inc.
|
||||
|
||||
!IFNDEF APP_DEBUG
|
||||
APP_DEBUG = FALSE
|
||||
!ENDIF
|
||||
|
||||
# File pathnames
|
||||
XVT_DIR = C:\XVTDSC2\NT_X86\PTK
|
||||
XVT_DIR = $(XVT_PTK_DIR)
|
||||
XVT_INCDIR = $(XVT_DIR)\include
|
||||
XVT_LIBDIR = $(XVT_DIR)\lib
|
||||
XVT_BINDIR = $(XVT_DIR)\bin
|
||||
@ -39,9 +42,9 @@ C_FLAGS_DEBUG =
|
||||
L_FLAGS_DEBUG =
|
||||
!ENDIF
|
||||
|
||||
C_FLAGS = -I. -I$(XVT_INCDIR) -I$(XI_INCDIR) -DSTRICT $(cflags) $(cvarsmt) $(C_FLAGS_DEBUG)
|
||||
C_FLAGS = -I. -I$(XVT_INCDIR) -I$(XI_INCDIR) -DSTRICT -DXI_USE_XVT -DXI_R4_API $(cflags) $(cvarsmt) $(C_FLAGS_DEBUG)
|
||||
|
||||
L_FLAGS = $(ldebug) $(guiflags) $(L_FLAGS_DEBUG)
|
||||
L_FLAGS = $(guiflags) $(L_FLAGS_DEBUG)
|
||||
|
||||
L_LIBS = $(XN_API_LIB) $(guilibsmt)
|
||||
L_HELP_LIBS = $(XN_HBND_LIB)
|
||||
@ -56,13 +59,13 @@ L_HELP_LIBS = $(XN_HBND_LIB)
|
||||
.SUFFIXES: .rc .url
|
||||
|
||||
.c.obj:
|
||||
$(CC) $(C_FLAGS) $*.c
|
||||
$(CC) $(C_FLAGS) $*.c
|
||||
|
||||
.url.rc:
|
||||
$(XVT_BINDIR)\curl -r rcnt -s -I$(XVT_INCDIR) -DLIBDIR=$(XVT_LIBDIR) $*.url
|
||||
$(XVT_BINDIR)\curl -r rcnt -s -I$(XVT_INCDIR) -DLIBDIR=$(XVT_LIBDIR) $*.url
|
||||
|
||||
.url.res:
|
||||
$(XVT_BINDIR)\curl -r rcnt -s -I$(XVT_INCDIR) -DLIBDIR=$(XVT_LIBDIR) $*.url
|
||||
$(XVT_BINDIR)\curl -r rcnt -s -I$(XVT_INCDIR) -DLIBDIR=$(XVT_LIBDIR) $*.url
|
||||
rc -r -fo $*.res $*.rc
|
||||
|
||||
.rc.res:
|
||||
@ -70,7 +73,7 @@ L_HELP_LIBS = $(XN_HBND_LIB)
|
||||
|
||||
XILIB = $(XI_DIR)\lib\mxin.lib
|
||||
|
||||
OBJS = xilm.obj xilm2.obj xiutils.obj xitext.obj xistx.obj xitree.obj xiheap.obj xi.obj xi2.obj xicf.obj xidbg.obj
|
||||
OBJS = xilm.obj xilm2.obj xilm3.obj xiutils.obj xitext.obj xistx.obj xitree.obj xiheap.obj xi.obj xi2.obj xicf.obj xidbg.obj xilmst.obj xiport.obj xierr.obj xibitmap.obj
|
||||
|
||||
SRC = ..
|
||||
|
||||
@ -100,6 +103,9 @@ xilm.obj: $(SRC)\xilm.c
|
||||
xilm2.obj: $(SRC)\xilm2.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xilm3.obj: $(SRC)\xilm3.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xitree.obj: $(SRC)\xitree.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
@ -118,3 +124,15 @@ xicf.obj: $(SRC)\xicf.c
|
||||
xidbg.obj: $(SRC)\xidbg.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xilmst.obj: $(SRC)\xilmst.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xiport.obj: $(SRC)\xiport.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xierr.obj: $(SRC)\xierr.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xibitmap.obj: $(SRC)\xibitmap.c
|
||||
cl $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
CC = acc
|
||||
XVTDIR = $(HOME)/xvtdsc2/ch_sparc_sunos/ptk
|
||||
XVTCHLIB = $(XVTDIR)/lib/libxvtcui.a
|
||||
CCOPTS =
|
||||
CCOPTS = -DXI_USE_XVT -DXI_R4_API
|
||||
CURLOPTS =
|
||||
XIDIR = $(HOME)/xi
|
||||
|
||||
@ -37,8 +37,8 @@ XILIB = ../lib/libxisch.a
|
||||
SRC = $(XIDIR)/src
|
||||
OBJP = $(XIDIR)/src/sch
|
||||
|
||||
$(XILIB): $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o
|
||||
ar rc $(XILIB) $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o
|
||||
$(XILIB): $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xilm3.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o $(OBJP)/xierr.o $(OBJP)/xilmst.o $(OBJP)/xiport.o $(OBJP)/xibitmap.o
|
||||
ar rc $(XILIB) $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xilm3.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o $(OBJP)/xierr.o $(OBJP)/xilmst.o $(OBJP)/xiport.o $(OBJP)/xibitmap.o
|
||||
ranlib $(XILIB)
|
||||
|
||||
$(OBJP)/xiheap.o: $(SRC)/xiheap.c
|
||||
@ -53,6 +53,9 @@ $(OBJP)/xilm.o: $(SRC)/xilm.c
|
||||
$(OBJP)/xilm2.o: $(SRC)/xilm2.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilm2.c -o $(OBJP)/xilm2.o
|
||||
|
||||
$(OBJP)/xilm3.o: $(SRC)/xilm3.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilm3.c -o $(OBJP)/xilm3.o
|
||||
|
||||
$(OBJP)/xistx.o: $(SRC)/xistx.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xistx.c -o $(OBJP)/xistx.o
|
||||
|
||||
@ -74,3 +77,15 @@ $(OBJP)/xicf.o: $(SRC)/xicf.c
|
||||
$(OBJP)/xidbg.o: $(SRC)/xidbg.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xidbg.c -o $(OBJP)/xidbg.o
|
||||
|
||||
$(OBJP)/xierr.o: $(SRC)/xierr.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xierr.c -o $(OBJP)/xierr.o
|
||||
|
||||
$(OBJP)/xilmst.o: $(SRC)/xilmst.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilmst.c -o $(OBJP)/xilmst.o
|
||||
|
||||
$(OBJP)/xiport.o: $(SRC)/xiport.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xiport.c -o $(OBJP)/xiport.o
|
||||
|
||||
$(OBJP)/xibitmap.o: $(SRC)/xibitmap.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xibitmap.c -o $(OBJP)/xibitmap.o
|
||||
|
||||
|
@ -59,7 +59,7 @@ OBJP = ./sxm
|
||||
BINP = $(OBJP)
|
||||
|
||||
IDIRS = -I$(ROOTP)/include -I../include -I/d3/include -I/d3/ericw/motif/include
|
||||
CFLAGS = -c -O -DXTFUNCPROTO $(IDIRS) -temp=/usr/temp
|
||||
CFLAGS = -c -O -DXTFUNCPROTO -DXI_USE_XVT -DXI_R4_API $(IDIRS) -temp=/usr/temp
|
||||
LDLIBS = $(TKLDLIBS) -lm
|
||||
|
||||
CURL = $(XVTBINP)/curl$(BTAG) -r mtf11 -s -o
|
||||
@ -68,8 +68,8 @@ HELPC = $(XVTBINP)/helpc$(BTAG) -f xvt -I$(ROOTP)/include -o
|
||||
XILIB = ../lib/libxisxm.a
|
||||
SRC = .
|
||||
|
||||
$(XILIB): $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xistx.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xidbg.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xiutils.o
|
||||
$(AR) $(ARFLAGS) $(XILIB) $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xidbg.o
|
||||
$(XILIB): $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xistx.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xilm3.o $(OBJP)/xiutils.o $(OBJP)/xierr.o $(OBJP)/xilmst.o $(OBJP)/xiport.o $(OBJP)/xibitmap.o
|
||||
$(AR) $(ARFLAGS) $(XILIB) $(OBJP)/xiheap.o $(OBJP)/xitree.o $(OBJP)/xicf.o $(OBJP)/xitext.o $(OBJP)/xilm.o $(OBJP)/xilm2.o $(OBJP)/xilm3.o $(OBJP)/xistx.o $(OBJP)/xiutils.o $(OBJP)/xi.o $(OBJP)/xi2.o $(OBJP)/xidbg.o $(OBJP)/xierr.o $(OBJP)/xilmst.o $(OBJP)xiport.o $(OBJP)/xibitmap.o
|
||||
ranlib $(XILIB)
|
||||
|
||||
$(OBJP)/xiheap.o: $(SRC)/xiheap.c
|
||||
@ -84,6 +84,9 @@ $(OBJP)/xilm.o: $(SRC)/xilm.c
|
||||
$(OBJP)/xilm2.o: $(SRC)/xilm2.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilm2.c -o $(OBJP)/xilm2.o
|
||||
|
||||
$(OBJP)/xilm3.o: $(SRC)/xilm3.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilm3.c -o $(OBJP)/xilm3.o
|
||||
|
||||
$(OBJP)/xistx.o: $(SRC)/xistx.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xistx.c -o $(OBJP)/xistx.o
|
||||
|
||||
@ -105,4 +108,16 @@ $(OBJP)/xicf.o: $(SRC)/xicf.c
|
||||
$(OBJP)/xidbg.o: $(SRC)/xidbg.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xidbg.c -o $(OBJP)/xidbg.o
|
||||
|
||||
$(OBJP)/xierr.o: $(SRC)/xierr.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xierr.c -o $(OBJP)/xierr.o
|
||||
|
||||
$(OBJP)/xilmst.o: $(SRC)/xilmst.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xilmst.c -o $(OBJP)/xilmst.o
|
||||
|
||||
$(OBJP)/xiport.o: $(SRC)/xiport.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xiport.c -o $(OBJP)/xiport.o
|
||||
|
||||
$(OBJP)/xibitmap.o: $(SRC)/xibitmap.c
|
||||
$(CC) -c $(CFLAGS) $(SRC)/xibitmap.c -o $(OBJP)/xibitmap.o
|
||||
|
||||
|
||||
|
@ -1,21 +1,19 @@
|
||||
#################################################################
|
||||
#
|
||||
# Makefile for XI/Win source
|
||||
# Compiler: Microsoft Visual C++ version 1.0 or 1.5
|
||||
# Compiler: Microsoft Visual C++
|
||||
# Orca Software distributes these makefiles for convenience. Having a
|
||||
# makefile for a particular platform does not imply that you have a
|
||||
# makefile for a particular platform does not imply that you have a
|
||||
# license to use the source code on that platform. Before using the
|
||||
# source code on any given platform, make sure that you have purchased
|
||||
# the appropriate license.
|
||||
#
|
||||
##################################################################
|
||||
# Copyright 1989-1994 XVT Software Inc.
|
||||
|
||||
APP_MODEL = LARGE
|
||||
APP_DEBUG = FALSE
|
||||
|
||||
# File pathnames
|
||||
XVT_DIR = \xvtdsc2\win_x86\ptk
|
||||
XVT_DIR = $(XVT_PTK_DIR)
|
||||
XVT_INCDIR = $(XVT_DIR)\include
|
||||
XVT_LIBDIR = $(XVT_DIR)\lib
|
||||
XVT_BINDIR = $(XVT_DIR)\bin
|
||||
@ -39,7 +37,7 @@ all: $(LIB)
|
||||
# -Zp: Pack structure members.
|
||||
CC = cl
|
||||
CDEBUG = -Od -Zi
|
||||
CFLAGS = -G2s -GA -GEs -W3 -Zp -DWSWIN
|
||||
CFLAGS = -G2s -GA -GEs -W3 -Zp -DWSWIN -DXI_USE_XVT -DXI_R4_API
|
||||
|
||||
#
|
||||
# Link variables
|
||||
@ -81,7 +79,7 @@ XI_LIB_MODEL = $(XI_LIBDIR)\lmxiw.lib
|
||||
# Library Variables
|
||||
#
|
||||
C_FLAGS = $(C_FLAGS_DEBUG) $(CFLAGS) $(C_FLAGS_MODEL) \
|
||||
-I. -I$(XVT_INCDIR) -DSTRICT
|
||||
-I. -I$(XVT_INCDIR) -I$(XI_INCDIR) -DSTRICT
|
||||
|
||||
L_FLAGS = $(L_FLAGS_DEBUG) $(LFLAGS)
|
||||
|
||||
@ -125,7 +123,7 @@ clean:
|
||||
-del *.res
|
||||
-del *.rc
|
||||
|
||||
OBJS = xilm.obj xilm2.obj xiutils.obj xitext.obj xistx.obj xitree.obj xiheap.obj xi.obj xi2.obj xicf.obj xidbg.obj
|
||||
OBJS = xi.obj xilm2.obj xilm3.obj xiutils.obj xitext.obj xistx.obj xitree.obj xiheap.obj xilm.obj xi2.obj xicf.obj xidbg.obj xilmst.obj xiport.obj xierr.obj xibitmap.obj
|
||||
|
||||
SRC = ..
|
||||
|
||||
@ -151,6 +149,9 @@ xilm.obj: $(SRC)\xilm.c
|
||||
xilm2.obj: $(SRC)\xilm2.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xilm3.obj: $(SRC)\xilm3.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xitree.obj: $(SRC)\xitree.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
@ -169,4 +170,15 @@ xicf.obj: $(SRC)\xicf.c
|
||||
xidbg.obj: $(SRC)\xidbg.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xilmst.obj: $(SRC)\xilmst.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xiport.obj: $(SRC)\xiport.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xierr.obj: $(SRC)\xierr.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
xibitmap.obj: $(SRC)\xibitmap.c
|
||||
$(CC) -c $(C_FLAGS) $(SRC)\$*.c
|
||||
|
||||
|
54
xi/xi_int.h
54
xi/xi_int.h
@ -1,22 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef INCL_XI_INT
|
||||
#define INCL_XI_INT
|
||||
|
||||
int xi_scroll_internal( XI_OBJ *xi_obj, int nbr_lines, int percent,
|
||||
BOOLEAN same_cell );
|
||||
void realloc_ptrs(void * * *ptrs, int nbr_ptrs, void *parent);
|
||||
BOOLEAN xi_move_focus_internal( XI_OBJ *xi_obj, BOOLEAN make_callbacks,
|
||||
BOOLEAN next_if_disabled,
|
||||
int check_for_reenabled);
|
||||
XI_OBJ* xi_search_itf( XI_OBJ *xi_obj, XI_SEARCH_TYPE search_type,
|
||||
int parm1);
|
||||
XI_OBJ * xi_find_next_obj( XI_OBJ *focus_obj, XI_NEXT_TYPE tab_type, long c);
|
||||
void xi_remove_window_from_list(WINDOW win);
|
||||
void xi_clear_lasts(void);
|
||||
void xi_close_window_internal(XI_OBJ *itf);
|
||||
BOOLEAN call_cb(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
void xi_hscroll_internal(XI_OBJ *xi_obj, int nbr_lines, int pos);
|
||||
void XVT_CALLCONV1 xi_hscroll XVT_CC_ARGS((XI_OBJ *xi_obj,
|
||||
int nbr_columns));
|
||||
|
||||
int
|
||||
xi_scroll_internal( XI_OBJ * xi_obj, int nbr_lines, int percent,
|
||||
BOOLEAN same_cell );
|
||||
void
|
||||
xi_control_event_scroll( XI_OBJ * xi_obj, int nbr_lines, int percent,
|
||||
BOOLEAN same_cell );
|
||||
void realloc_ptrs( void ***ptrs, int nbr_ptrs, void *parent );
|
||||
BOOLEAN
|
||||
xi_move_focus_internal( XI_OBJ * xi_obj, BOOLEAN make_callbacks,
|
||||
BOOLEAN next_if_disabled,
|
||||
int check_for_reenabled );
|
||||
XI_OBJ *
|
||||
xi_search_itf( XI_OBJ * xi_obj, XI_SEARCH_TYPE search_type,
|
||||
int parm1 );
|
||||
XI_OBJ *xi_find_next_obj( XI_OBJ * focus_obj, XI_NEXT_TYPE tab_type, long c );
|
||||
void xi_remove_window_from_list( XinWindow win );
|
||||
void xi_clear_lasts( void );
|
||||
void xi_close_window_internal( XI_OBJ * itf );
|
||||
BOOLEAN call_cb( XI_OBJ * itf, XI_EVENT * xiev );
|
||||
void xi_hscroll_internal( XI_OBJ * xi_obj, int nbr_lines, int pos );
|
||||
void XVT_CALLCONV1 xi_hscroll
|
||||
XVT_CC_ARGS( ( XI_OBJ * xi_obj,
|
||||
int nbr_columns ) );
|
||||
void xi_draw_field_button( XI_OBJ * xi_obj );
|
||||
void xi_field_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
|
||||
void xi_container_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
|
||||
void xi_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
|
||||
#endif
|
||||
|
||||
|
260
xi/xibitmap.c
Executable file
260
xi/xibitmap.c
Executable file
@ -0,0 +1,260 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#define XI_INTERNAL
|
||||
#define XI_R3_COMPAT
|
||||
#include "xi.h"
|
||||
#include "xiutils.h"
|
||||
|
||||
#if XIWS != XIWS_MAC && XIWS != XIWS_XM
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
XI_BITMAP *
|
||||
xi_bitmap_create( char *filename, XI_BITMAP_MODE mode )
|
||||
{
|
||||
XI_BITMAP *bitmap;
|
||||
|
||||
bitmap = XinMemoryZeroAlloc( sizeof( XI_BITMAP ) );
|
||||
if ( filename != NULL )
|
||||
{
|
||||
#if XIWS != XIWS_MAC
|
||||
if ( access( filename, 0 ) != -1 )
|
||||
#endif
|
||||
bitmap->xin_bitmap = XinBitmapRead( filename );
|
||||
if ( bitmap->xin_bitmap == NULL )
|
||||
{
|
||||
XinMemoryFree( bitmap );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
bitmap->mode = mode;
|
||||
bitmap->ref_count = 1;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
XI_BITMAP *
|
||||
xi_bitmap_copy( XI_BITMAP * bitmap )
|
||||
{
|
||||
if ( bitmap != NULL )
|
||||
bitmap->ref_count++;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void
|
||||
xi_bitmap_destroy( XI_BITMAP * bitmap )
|
||||
{
|
||||
if ( bitmap != NULL && --bitmap->ref_count == 0 )
|
||||
{
|
||||
if ( bitmap->xin_bitmap != NULL )
|
||||
XinBitmapDestroy( bitmap->xin_bitmap );
|
||||
XinMemoryFree( bitmap );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
normal_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct )
|
||||
{
|
||||
short width,
|
||||
height;
|
||||
int x,
|
||||
y;
|
||||
XinRect src;
|
||||
XinRect dest;
|
||||
int full_width,
|
||||
full_height;
|
||||
XinBrush brush;
|
||||
|
||||
if ( bitmap->xin_bitmap == NULL )
|
||||
width = height = 0;
|
||||
else
|
||||
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
|
||||
full_width = rct->right - rct->left;
|
||||
full_height = rct->bottom - rct->top;
|
||||
if ( bitmap->hcenter )
|
||||
{
|
||||
if ( width > full_width )
|
||||
x = 0;
|
||||
else
|
||||
x = ( full_width - width ) / 2;
|
||||
}
|
||||
else
|
||||
x = bitmap->x_offset;
|
||||
if ( bitmap->vcenter )
|
||||
{
|
||||
if ( height > full_height )
|
||||
y = 0;
|
||||
else
|
||||
y = ( full_height - height ) / 2;
|
||||
}
|
||||
else
|
||||
y = bitmap->y_offset;
|
||||
if ( x + width > full_width )
|
||||
width = full_width - x;
|
||||
if ( y + height > full_height )
|
||||
height = full_height - y;
|
||||
if ( bitmap->xin_bitmap != 0 )
|
||||
{
|
||||
dest.top = rct->top + y;
|
||||
dest.left = rct->left + x;
|
||||
dest.bottom = dest.top + height;
|
||||
dest.right = dest.left + width;
|
||||
src.top = src.left = 0;
|
||||
src.right = width;
|
||||
src.bottom = height;
|
||||
XinWindowBitmapDraw( win, bitmap->xin_bitmap, &dest, &src );
|
||||
}
|
||||
|
||||
/* Draw background color around bitmap */
|
||||
XinWindowPenSet( win, &hollow_cpen );
|
||||
brush.pattern = XinBrushSolid;
|
||||
brush.fore_color = bitmap->background;
|
||||
XinWindowBrushSet( win, &brush );
|
||||
if ( y > 0 )
|
||||
{ /* Draw top rectangle */
|
||||
dest.top = rct->top;
|
||||
dest.left = rct->left;
|
||||
dest.bottom = rct->top + y;
|
||||
dest.right = rct->right;
|
||||
xi_draw_rect( win, &dest );
|
||||
}
|
||||
if ( x > 0 )
|
||||
{ /* Draw left rectangle */
|
||||
dest.top = rct->top + y;
|
||||
dest.left = rct->left;
|
||||
dest.bottom = dest.top + height;
|
||||
dest.right = rct->left + x;
|
||||
xi_draw_rect( win, &dest );
|
||||
}
|
||||
if ( x + width < full_width )
|
||||
{ /* Draw right rectangle */
|
||||
dest.top = rct->top + y;
|
||||
dest.left = rct->left + x + width;
|
||||
dest.bottom = dest.top + height;
|
||||
dest.right = rct->right;
|
||||
xi_draw_rect( win, &dest );
|
||||
}
|
||||
if ( y + height < full_height )
|
||||
{ /* Draw bottom rectangle */
|
||||
dest.top = rct->top + y + height;
|
||||
dest.left = rct->left;
|
||||
dest.bottom = rct->bottom;
|
||||
dest.right = rct->right;
|
||||
xi_draw_rect( win, &dest );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
resize_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct )
|
||||
{
|
||||
short width,
|
||||
height;
|
||||
XinRect src;
|
||||
|
||||
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
|
||||
src.top = src.left = 0;
|
||||
src.right = width;
|
||||
src.bottom = height;
|
||||
XinWindowBitmapDraw( win, bitmap->xin_bitmap, rct, &src );
|
||||
}
|
||||
|
||||
static void
|
||||
tile_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct, XinRect * clip_rct, BOOLEAN on_update )
|
||||
{
|
||||
short width,
|
||||
height;
|
||||
XinRect src;
|
||||
XinRect dest;
|
||||
int full_width,
|
||||
full_height;
|
||||
int x,
|
||||
y;
|
||||
|
||||
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
|
||||
full_width = rct->right - rct->left;
|
||||
full_height = rct->bottom - rct->top;
|
||||
src.top = 0;
|
||||
src.left = 0;
|
||||
src.bottom = height;
|
||||
for ( y = 0; y < full_height; y += height )
|
||||
{
|
||||
dest.top = rct->top + y;
|
||||
if ( clip_rct != NULL )
|
||||
{
|
||||
if ( dest.top > clip_rct->bottom )
|
||||
break;
|
||||
if ( dest.top + height < clip_rct->top )
|
||||
continue;
|
||||
}
|
||||
if ( y + height > full_height )
|
||||
src.bottom = full_height - y;
|
||||
src.right = width;
|
||||
for ( x = 0; x < full_width; x += width )
|
||||
{
|
||||
if ( x + width > full_width )
|
||||
src.right = full_width - x;
|
||||
dest.left = rct->left + x;
|
||||
dest.right = dest.left + src.right;
|
||||
dest.bottom = dest.top + src.bottom;
|
||||
if ( clip_rct != NULL )
|
||||
{
|
||||
if ( dest.left > clip_rct->right )
|
||||
break;
|
||||
if ( dest.right < clip_rct->left )
|
||||
continue;
|
||||
}
|
||||
if ( !on_update || XinWindowPaintNeeds( win, &dest ) )
|
||||
XinWindowBitmapDraw( win, bitmap->xin_bitmap, &dest, &src );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xi_bitmap_draw( XI_BITMAP * bitmap, XinWindow win, XinRect * rct,
|
||||
XinRect * clip_rct, BOOLEAN in_paint_event )
|
||||
{
|
||||
XI_BITMAP_MODE mode;
|
||||
|
||||
if ( bitmap == NULL )
|
||||
return;
|
||||
|
||||
if ( bitmap->xin_bitmap == NULL )
|
||||
mode = XI_BITMAP_NORMAL;
|
||||
else
|
||||
mode = bitmap->mode;
|
||||
XinWindowClipSet( win, clip_rct );
|
||||
switch ( mode )
|
||||
{
|
||||
case XI_BITMAP_NORMAL:
|
||||
normal_bitmap( bitmap, win, rct );
|
||||
break;
|
||||
case XI_BITMAP_RESIZE:
|
||||
resize_bitmap( bitmap, win, rct );
|
||||
break;
|
||||
case XI_BITMAP_TILE:
|
||||
tile_bitmap( bitmap, win, rct, clip_rct, in_paint_event );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xi_bitmap_size_get( XI_BITMAP * bitmap, short *width, short *height )
|
||||
{
|
||||
if ( bitmap != NULL && bitmap->xin_bitmap != NULL )
|
||||
XinBitmapSizeGet( bitmap->xin_bitmap, width, height );
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
xi_bitmap_draw_all_on_resize( XI_BITMAP * bitmap )
|
||||
{
|
||||
if ( bitmap == NULL || bitmap->xin_bitmap == NULL )
|
||||
return FALSE;
|
||||
return ( ( bitmap->mode == XI_BITMAP_NORMAL && ( bitmap->vcenter || bitmap->hcenter ) )
|
||||
|| bitmap->mode == XI_BITMAP_RESIZE );
|
||||
}
|
670
xi/xidbg.c
670
xi/xidbg.c
@ -1,5 +1,6 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
@ -8,297 +9,466 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#define XI_INTERNAL
|
||||
#include "xiextend.h"
|
||||
#define XI_R3_COMPAT
|
||||
#include "xi.h"
|
||||
#include "xiutils.h"
|
||||
|
||||
#define UNDEFINED 1000
|
||||
#define BUFFERLEN 200
|
||||
|
||||
static char * near
|
||||
bool_to_str(BOOLEAN b)
|
||||
static char *
|
||||
bool_to_str( BOOLEAN b )
|
||||
{
|
||||
if (b)
|
||||
if ( b )
|
||||
return "TRUE";
|
||||
else
|
||||
return "FALSE";
|
||||
}
|
||||
|
||||
void
|
||||
xi_event_debug(char *tag, XI_EVENT *xiev, char *s, int len)
|
||||
xi_event_debug( char *tag, XI_EVENT * xiev, char *s, int len )
|
||||
{
|
||||
char *tmp;
|
||||
char str[BUFFERLEN], str2[BUFFERLEN];
|
||||
int i, j, k;
|
||||
char str[BUFFERLEN],
|
||||
str2[BUFFERLEN];
|
||||
int i,
|
||||
k;
|
||||
int j;
|
||||
XI_OBJ *xi_obj;
|
||||
|
||||
static struct
|
||||
{
|
||||
{
|
||||
int type;
|
||||
char *desc;
|
||||
} event_text[] =
|
||||
{
|
||||
{
|
||||
XIE_CHAR_FIELD, "XIE_CHAR_FIELD "},
|
||||
{XIE_DBL_FIELD, "XIE_DBL_FIELD "},
|
||||
{XIE_CHG_FIELD, "XIE_CHG_FIELD "},
|
||||
{XIE_OFF_FIELD, "XIE_OFF_FIELD "},
|
||||
{XIE_ON_FIELD, "XIE_ON_FIELD "},
|
||||
{XIE_OFF_GROUP, "XIE_OFF_GROUP "},
|
||||
{XIE_ON_GROUP, "XIE_ON_GROUP "},
|
||||
{XIE_OFF_FORM, "XIE_OFF_FORM "},
|
||||
{XIE_ON_FORM, "XIE_ON_FORM "},
|
||||
{XIE_VIR_PAN, "XIE_VIR_PAN "},
|
||||
{XIE_XVT_EVENT, "XIE_XVT_EVENT "},
|
||||
{XIE_XVT_POST_EVENT,"XIE_XVT_POST_EVENT"},
|
||||
{XIE_INIT, "XIE_INIT "},
|
||||
{XIE_BUTTON, "XIE_BUTTON "},
|
||||
{XIE_CHAR_CELL, "XIE_CHAR_CELL "},
|
||||
{XIE_CLEANUP, "XIE_CLEANUP "},
|
||||
{XIE_CLOSE, "XIE_CLOSE "},
|
||||
{XIE_COMMAND, "XIE_COMMAND "},
|
||||
{XIE_DBL_CELL, "XIE_DBL_CELL "},
|
||||
{XIE_GET_FIRST, "XIE_GET_FIRST "},
|
||||
{XIE_GET_LAST, "XIE_GET_LAST "},
|
||||
{XIE_GET_NEXT, "XIE_GET_NEXT "},
|
||||
{XIE_GET_PERCENT, "XIE_GET_PERCENT "},
|
||||
{XIE_GET_PREV, "XIE_GET_PREV "},
|
||||
{XIE_CELL_REQUEST, "XIE_CELL_REQUEST"},
|
||||
{XIE_CHG_CELL, "XIE_CHG_CELL "},
|
||||
{XIE_OFF_CELL, "XIE_OFF_CELL "},
|
||||
{XIE_ON_CELL, "XIE_ON_CELL "},
|
||||
{XIE_OFF_ROW, "XIE_OFF_ROW "},
|
||||
{XIE_ON_ROW, "XIE_ON_ROW "},
|
||||
{XIE_OFF_COLUMN, "XIE_OFF_COLUMN "},
|
||||
{XIE_ON_COLUMN, "XIE_ON_COLUMN "},
|
||||
{XIE_OFF_LIST, "XIE_OFF_LIST "},
|
||||
{XIE_ON_LIST, "XIE_ON_LIST "},
|
||||
{XIE_REC_ALLOCATE, "XIE_REC_ALLOCATE"},
|
||||
{XIE_REC_FREE, "XIE_REC_FREE "},
|
||||
{XIE_ROW_SIZE, "XIE_ROW_SIZE "},
|
||||
{XIE_SELECT, "XIE_SELECT "},
|
||||
{XIE_UPDATE, "XIE_UPDATE "},
|
||||
{XIE_COL_DELETE, "XIE_COL_DELETE "},
|
||||
{XIE_COL_MOVE, "XIE_COL_MOVE "},
|
||||
{XIE_COL_SIZE, "XIE_COL_SIZE "},
|
||||
{UNDEFINED, "Unknown XI Event" }
|
||||
XIE_CHAR_FIELD, "XIE_CHAR_FIELD "
|
||||
},
|
||||
{
|
||||
XIE_DBL_FIELD, "XIE_DBL_FIELD "
|
||||
},
|
||||
{
|
||||
XIE_CHG_FIELD, "XIE_CHG_FIELD "
|
||||
},
|
||||
{
|
||||
XIE_OFF_FIELD, "XIE_OFF_FIELD "
|
||||
},
|
||||
{
|
||||
XIE_ON_FIELD, "XIE_ON_FIELD "
|
||||
},
|
||||
{
|
||||
XIE_OFF_GROUP, "XIE_OFF_GROUP "
|
||||
},
|
||||
{
|
||||
XIE_ON_GROUP, "XIE_ON_GROUP "
|
||||
},
|
||||
{
|
||||
XIE_OFF_FORM, "XIE_OFF_FORM "
|
||||
},
|
||||
{
|
||||
XIE_ON_FORM, "XIE_ON_FORM "
|
||||
},
|
||||
{
|
||||
XIE_VIR_PAN, "XIE_VIR_PAN "
|
||||
},
|
||||
{
|
||||
XIE_XVT_EVENT, "XIE_XVT_EVENT "
|
||||
},
|
||||
{
|
||||
XIE_XVT_POST_EVENT, "XIE_XVT_POST_EVENT"
|
||||
},
|
||||
{
|
||||
XIE_XIN_EVENT, "XIE_XIN_EVENT "
|
||||
},
|
||||
{
|
||||
XIE_XIN_POST_EVENT, "XIE_XIN_POST_EVENT"
|
||||
},
|
||||
{
|
||||
XIE_INIT, "XIE_INIT "
|
||||
},
|
||||
{
|
||||
XIE_BUTTON, "XIE_BUTTON "
|
||||
},
|
||||
{
|
||||
XIE_CHAR_CELL, "XIE_CHAR_CELL "
|
||||
},
|
||||
{
|
||||
XIE_CLEANUP, "XIE_CLEANUP "
|
||||
},
|
||||
{
|
||||
XIE_CLOSE, "XIE_CLOSE "
|
||||
},
|
||||
{
|
||||
XIE_COMMAND, "XIE_COMMAND "
|
||||
},
|
||||
{
|
||||
XIE_DBL_CELL, "XIE_DBL_CELL "
|
||||
},
|
||||
{
|
||||
XIE_GET_FIRST, "XIE_GET_FIRST "
|
||||
},
|
||||
{
|
||||
XIE_GET_LAST, "XIE_GET_LAST "
|
||||
},
|
||||
{
|
||||
XIE_GET_NEXT, "XIE_GET_NEXT "
|
||||
},
|
||||
{
|
||||
XIE_GET_PERCENT, "XIE_GET_PERCENT "
|
||||
},
|
||||
{
|
||||
XIE_GET_PREV, "XIE_GET_PREV "
|
||||
},
|
||||
{
|
||||
XIE_CELL_REQUEST, "XIE_CELL_REQUEST"
|
||||
},
|
||||
{
|
||||
XIE_CHG_CELL, "XIE_CHG_CELL "
|
||||
},
|
||||
{
|
||||
XIE_OFF_CELL, "XIE_OFF_CELL "
|
||||
},
|
||||
{
|
||||
XIE_ON_CELL, "XIE_ON_CELL "
|
||||
},
|
||||
{
|
||||
XIE_OFF_ROW, "XIE_OFF_ROW "
|
||||
},
|
||||
{
|
||||
XIE_ON_ROW, "XIE_ON_ROW "
|
||||
},
|
||||
{
|
||||
XIE_OFF_COLUMN, "XIE_OFF_COLUMN "
|
||||
},
|
||||
{
|
||||
XIE_ON_COLUMN, "XIE_ON_COLUMN "
|
||||
},
|
||||
{
|
||||
XIE_OFF_LIST, "XIE_OFF_LIST "
|
||||
},
|
||||
{
|
||||
XIE_ON_LIST, "XIE_ON_LIST "
|
||||
},
|
||||
{
|
||||
XIE_REC_ALLOCATE, "XIE_REC_ALLOCATE"
|
||||
},
|
||||
{
|
||||
XIE_REC_FREE, "XIE_REC_FREE "
|
||||
},
|
||||
{
|
||||
XIE_ROW_SIZE, "XIE_ROW_SIZE "
|
||||
},
|
||||
{
|
||||
XIE_SELECT, "XIE_SELECT "
|
||||
},
|
||||
{
|
||||
XIE_UPDATE, "XIE_UPDATE "
|
||||
},
|
||||
{
|
||||
XIE_COL_DELETE, "XIE_COL_DELETE "
|
||||
},
|
||||
{
|
||||
XIE_COL_MOVE, "XIE_COL_MOVE "
|
||||
},
|
||||
{
|
||||
XIE_COL_SIZE, "XIE_COL_SIZE "
|
||||
},
|
||||
{
|
||||
XIE_POST_NAVIGATION, "XIE_POST_NAVIGATION"
|
||||
},
|
||||
{
|
||||
UNDEFINED, "Unknown XI Event"
|
||||
}
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
int type;
|
||||
char *desc;
|
||||
} xvt_event_text[] =
|
||||
{
|
||||
{E_MOUSE_UP, "E_MOUSE_UP"},
|
||||
{E_MOUSE_DOWN, "E_MOUSE_DOWN"},
|
||||
{E_CREATE, "E_CREATE"},
|
||||
{E_MOUSE_MOVE, "E_MOUSE_MOVE"},
|
||||
{E_MOUSE_DBL, "E_MOUSE_DBL"},
|
||||
{E_CHAR, "E_CHAR"},
|
||||
{E_UPDATE, "E_UPDATE"},
|
||||
{E_ACTIVATE, "E_FOCUS"},
|
||||
{E_KILL_WINDOW, "E_DESTROY"},
|
||||
{E_VSCROLL, "E_VSCROLL"},
|
||||
{E_HSCROLL, "E_HSCROLL"},
|
||||
{E_COMMAND, "E_COMMAND"},
|
||||
{E_CLOSE, "E_CLOSE"},
|
||||
{E_SIZE, "E_SIZE"},
|
||||
{E_FONT, "E_FONT"},
|
||||
{E_QUIT, "E_QUIT"},
|
||||
{E_CONTROL, "E_CONTROL"},
|
||||
{UNDEFINED, "Unknown XVT Event"}
|
||||
};
|
||||
|
||||
XinEventType type;
|
||||
char *desc;
|
||||
} xin_event_text[] =
|
||||
{
|
||||
{
|
||||
XinEventCreate, "XinEventCreate"
|
||||
},
|
||||
{
|
||||
XinEventDestroy, "XinEventDestroy"
|
||||
},
|
||||
{
|
||||
XinEventFocus, "XinEventFocus"
|
||||
},
|
||||
{
|
||||
XinEventResize, "XinEventResize"
|
||||
},
|
||||
{
|
||||
XinEventPaint, "XinEventPaint"
|
||||
},
|
||||
{
|
||||
XinEventCloseButton, "XinEventCloseButton"
|
||||
},
|
||||
{
|
||||
XinEventMouseDown, "XinEventMouseDown"
|
||||
},
|
||||
{
|
||||
XinEventMouseUp, "XinEventMouseUp"
|
||||
},
|
||||
{
|
||||
XinEventMouseMove, "XinEventMouseMove"
|
||||
},
|
||||
{
|
||||
XinEventMouseDouble, "XinEventMouseDouble"
|
||||
},
|
||||
{
|
||||
XinEventCharacter, "XinEventCharacter"
|
||||
},
|
||||
{
|
||||
XinEventVScroll, "XinEventVScroll"
|
||||
},
|
||||
{
|
||||
XinEventHScroll, "XinEventHScroll"
|
||||
},
|
||||
{
|
||||
XinEventMenuCommand, "XinEventMenuCommand"
|
||||
},
|
||||
{
|
||||
XinEventControl, "XinEventControl"
|
||||
},
|
||||
{
|
||||
XinEventTimer, "XinEventTimer"
|
||||
},
|
||||
{
|
||||
XinEventQuit, "XinEventQuit"
|
||||
},
|
||||
{
|
||||
XinEventHelp, "XinEventHelp"
|
||||
},
|
||||
{
|
||||
XinEventFont, "XinEventFont"
|
||||
},
|
||||
{
|
||||
(XinEventType)UNDEFINED, "Unknown Xin Event"
|
||||
}
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
{
|
||||
int type;
|
||||
char *desc;
|
||||
} object_type[] =
|
||||
{
|
||||
{
|
||||
XIT_BTN, "XIT_BTN"},
|
||||
{XIT_CONTAINER, "XIT_CONTAINER"},
|
||||
{XIT_FORM, "XIT_FORM"},
|
||||
{XIT_FIELD, "XIT_FIELD"},
|
||||
{XIT_GROUP, "XIT_GROUP"},
|
||||
{XIT_LINE, "XIT_LINE"},
|
||||
{XIT_RECT, "XIT_RECT"},
|
||||
{XIT_TEXT, "XIT_TEXT"},
|
||||
{XIT_CELL, "XIT_CELL"},
|
||||
{XIT_COLUMN, "XIT_COLUMN"},
|
||||
{XIT_ITF, "XIT_ITF"},
|
||||
{XIT_LIST, "XIT_LIST"},
|
||||
{XIT_ROW, "XIT_ROW"},
|
||||
{UNDEFINED, "Unknown XI Object Type" }
|
||||
XIT_BTN, "XIT_BTN"
|
||||
},
|
||||
{
|
||||
XIT_CONTAINER, "XIT_CONTAINER"
|
||||
},
|
||||
{
|
||||
XIT_FORM, "XIT_FORM"
|
||||
},
|
||||
{
|
||||
XIT_FIELD, "XIT_FIELD"
|
||||
},
|
||||
{
|
||||
XIT_GROUP, "XIT_GROUP"
|
||||
},
|
||||
{
|
||||
XIT_LINE, "XIT_LINE"
|
||||
},
|
||||
{
|
||||
XIT_RECT, "XIT_RECT"
|
||||
},
|
||||
{
|
||||
XIT_TEXT, "XIT_TEXT"
|
||||
},
|
||||
{
|
||||
XIT_CELL, "XIT_CELL"
|
||||
},
|
||||
{
|
||||
XIT_COLUMN, "XIT_COLUMN"
|
||||
},
|
||||
{
|
||||
XIT_ITF, "XIT_ITF"
|
||||
},
|
||||
{
|
||||
XIT_LIST, "XIT_LIST"
|
||||
},
|
||||
{
|
||||
XIT_ROW, "XIT_ROW"
|
||||
},
|
||||
{
|
||||
UNDEFINED, "Unknown XI Object Type"
|
||||
}
|
||||
};
|
||||
|
||||
for (i = 0; event_text[i].type != xiev->type &&
|
||||
event_text[i].type != UNDEFINED; ++i)
|
||||
for ( i = 0; event_text[i].type != xiev->type &&
|
||||
event_text[i].type != UNDEFINED; ++i )
|
||||
;
|
||||
sprintf(str, "%s: %s", tag, event_text[i].desc);
|
||||
sprintf( str, "%s: %s", tag, event_text[i].desc );
|
||||
*str2 = '\0';
|
||||
switch (xiev->type)
|
||||
switch ( xiev->type )
|
||||
{
|
||||
case XIE_XVT_EVENT:
|
||||
case XIE_XVT_POST_EVENT:
|
||||
for (j = 0; xvt_event_text[j].type != xiev->v.xvte.type &&
|
||||
xvt_event_text[j].type != UNDEFINED; ++j)
|
||||
;
|
||||
sprintf(str2, " %s", xvt_event_text[j].desc);
|
||||
break;
|
||||
case XIE_COMMAND:
|
||||
sprintf(str2, " tag %d, shift %s, control %s", xiev->v.cmd.tag,
|
||||
bool_to_str(xiev->v.cmd.shift), bool_to_str(xiev->v.cmd.control));
|
||||
break;
|
||||
case XIE_INIT:
|
||||
case XIE_BUTTON:
|
||||
case XIE_CLOSE:
|
||||
case XIE_DBL_CELL:
|
||||
case XIE_DBL_FIELD:
|
||||
case XIE_CHG_FIELD:
|
||||
case XIE_OFF_FIELD:
|
||||
case XIE_ON_FIELD:
|
||||
case XIE_OFF_GROUP:
|
||||
case XIE_ON_GROUP:
|
||||
case XIE_OFF_FORM:
|
||||
case XIE_ON_FORM:
|
||||
case XIE_CHG_CELL:
|
||||
case XIE_OFF_CELL:
|
||||
case XIE_ON_CELL:
|
||||
case XIE_OFF_ROW:
|
||||
case XIE_ON_ROW:
|
||||
case XIE_OFF_COLUMN:
|
||||
case XIE_ON_COLUMN:
|
||||
case XIE_OFF_LIST:
|
||||
case XIE_ON_LIST:
|
||||
case XIE_CLEANUP:
|
||||
xi_obj = xiev->v.xi_obj;
|
||||
for (k = 0; object_type[k].type != xi_obj->type &&
|
||||
object_type[k].type != UNDEFINED; ++k)
|
||||
;
|
||||
switch (xi_obj->type)
|
||||
{
|
||||
case XIT_CELL:
|
||||
sprintf(str2, " cid %3d, type %s r %d c %d v %d",
|
||||
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
|
||||
xi_obj->v.cell.column, !xi_obj->v.cell.is_vert_scrolled);
|
||||
#ifdef XI_USE_XVT
|
||||
case XIE_XVT_EVENT:
|
||||
case XIE_XVT_POST_EVENT:
|
||||
sprintf( str2, " %s", XinXvtEventTextGet( &xiev->v.xvte ) );
|
||||
break;
|
||||
case XIT_ROW:
|
||||
sprintf(str2, " cid %3d, type %s r %d", xi_obj->cid,
|
||||
object_type[k].desc, xi_obj->v.row);
|
||||
break;
|
||||
default:
|
||||
sprintf(str2, " cid %3d, type %s", xi_obj->cid,
|
||||
object_type[k].desc);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case XIE_CHAR_CELL:
|
||||
case XIE_CHAR_FIELD:
|
||||
{
|
||||
char char_str[20];
|
||||
int ch;
|
||||
|
||||
ch = xiev->v.chr.ch;
|
||||
switch (ch)
|
||||
{
|
||||
case K_CLEAR:
|
||||
strcpy(char_str, "K_CLEAR");
|
||||
break;
|
||||
case K_DEL:
|
||||
strcpy(char_str, "K_DEL");
|
||||
break;
|
||||
case '\b':
|
||||
strcpy(char_str, "BS");
|
||||
break;
|
||||
default:
|
||||
char_str[0] = (char)ch;
|
||||
char_str[1] = '\0';
|
||||
break;
|
||||
}
|
||||
xi_obj = xiev->v.chr.xi_obj;
|
||||
for (k = 0; object_type[k].type != xi_obj->type &&
|
||||
object_type[k].type != UNDEFINED; ++k)
|
||||
#endif
|
||||
case XIE_XIN_EVENT:
|
||||
case XIE_XIN_POST_EVENT:
|
||||
for ( j = 0; xin_event_text[j].type != xiev->v.xin_event.type &&
|
||||
xin_event_text[j].type != UNDEFINED; ++j )
|
||||
;
|
||||
switch (xi_obj->type)
|
||||
sprintf( str2, " %s", xin_event_text[j].desc );
|
||||
break;
|
||||
case XIE_COMMAND:
|
||||
sprintf( str2, " tag %d, shift %s, control %s", xiev->v.cmd.tag,
|
||||
bool_to_str( xiev->v.cmd.shift ), bool_to_str( xiev->v.cmd.control ) );
|
||||
break;
|
||||
case XIE_INIT:
|
||||
case XIE_BUTTON:
|
||||
case XIE_CLOSE:
|
||||
case XIE_DBL_CELL:
|
||||
case XIE_DBL_FIELD:
|
||||
case XIE_CHG_FIELD:
|
||||
case XIE_OFF_FIELD:
|
||||
case XIE_ON_FIELD:
|
||||
case XIE_OFF_GROUP:
|
||||
case XIE_ON_GROUP:
|
||||
case XIE_OFF_FORM:
|
||||
case XIE_ON_FORM:
|
||||
case XIE_CHG_CELL:
|
||||
case XIE_OFF_CELL:
|
||||
case XIE_ON_CELL:
|
||||
case XIE_OFF_ROW:
|
||||
case XIE_ON_ROW:
|
||||
case XIE_OFF_COLUMN:
|
||||
case XIE_ON_COLUMN:
|
||||
case XIE_OFF_LIST:
|
||||
case XIE_ON_LIST:
|
||||
case XIE_CLEANUP:
|
||||
xi_obj = xiev->v.xi_obj;
|
||||
for ( k = 0; object_type[k].type != xi_obj->type &&
|
||||
object_type[k].type != UNDEFINED; ++k )
|
||||
;
|
||||
switch ( xi_obj->type )
|
||||
{
|
||||
case XIT_CELL:
|
||||
sprintf(str2,
|
||||
" cid %3d type %s r %d c %d ch %s shft %d ctrl %d",
|
||||
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
|
||||
xi_obj->v.cell.column, char_str, xiev->v.chr.shift,
|
||||
xiev->v.chr.control);
|
||||
break;
|
||||
case XIT_FIELD:
|
||||
sprintf(str2, " cid %3d type %s ch %s shft %d ctrl %d", xi_obj->cid,
|
||||
object_type[k].desc, char_str, xiev->v.chr.shift,
|
||||
xiev->v.chr.control);
|
||||
break;
|
||||
case XIT_CELL:
|
||||
sprintf( str2, " cid %3d, type %s r %d c %d v %d",
|
||||
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
|
||||
xi_obj->v.cell.column, !xi_obj->v.cell.is_vert_scrolled );
|
||||
break;
|
||||
case XIT_ROW:
|
||||
sprintf( str2, " cid %3d, type %s r %d", xi_obj->cid,
|
||||
object_type[k].desc, xi_obj->v.row );
|
||||
break;
|
||||
default:
|
||||
sprintf( str2, " cid %3d, type %s", xi_obj->cid,
|
||||
object_type[k].desc );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XIE_GET_FIRST:
|
||||
case XIE_GET_LAST:
|
||||
sprintf(str2, " data_rec %08.8lx", (long)xiev->v.rec_request.data_rec);
|
||||
break;
|
||||
case XIE_GET_NEXT:
|
||||
case XIE_GET_PREV:
|
||||
sprintf(str2, " spec_rec %08.8lx, data_rec %08.8lx",
|
||||
(long)xiev->v.rec_request.spec_rec, (long)xiev->v.rec_request.data_rec);
|
||||
break;
|
||||
case XIE_CELL_REQUEST:
|
||||
sprintf(str2, " c %2d, rec %08.8lx, len %3d",
|
||||
(int)xiev->v.cell_request.col_nbr, (long)xiev->v.cell_request.rec,
|
||||
xiev->v.cell_request.len);
|
||||
break;
|
||||
case XIE_GET_PERCENT:
|
||||
sprintf(str2, " list->cid %d, record %08.8lx",
|
||||
xiev->v.get_percent.list->cid,
|
||||
(long)xiev->v.get_percent.record);
|
||||
break;
|
||||
case XIE_SELECT:
|
||||
sprintf(str2, " row %d, selected %d, dbl_click %d shift %d control %d column %d",
|
||||
xiev->v.select.xi_obj->v.row, xiev->v.select.selected,
|
||||
xiev->v.select.dbl_click, xiev->v.select.shift, xiev->v.select.control, xiev->v.select.column);
|
||||
break;
|
||||
case XIE_REC_ALLOCATE:
|
||||
sprintf(str2, " list cid %d", xiev->v.rec_allocate.list->cid);
|
||||
break;
|
||||
case XIE_REC_FREE:
|
||||
sprintf(str2, " list cid %d, record %08.8lx", xiev->v.rec_free.list->cid, xiev->v.rec_free.record);
|
||||
break;
|
||||
case XIE_ROW_SIZE:
|
||||
sprintf(str2, " row %d, new_size %d", xiev->v.row_size.xi_obj->v.row, xiev->v.row_size.new_row_height);
|
||||
break;
|
||||
case XIE_VIR_PAN:
|
||||
sprintf(str2, " delta_x %d, delta_y %d, before_pan %d",
|
||||
xiev->v.vir_pan.delta_x, xiev->v.vir_pan.delta_y,
|
||||
xiev->v.vir_pan.before_pan);
|
||||
break;
|
||||
case XIE_COL_DELETE:
|
||||
sprintf(str2, " list cid %d, col_nbr %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr);
|
||||
break;
|
||||
case XIE_COL_MOVE:
|
||||
sprintf(str2, " list cid %d, col_nbr %d, new_col_nbr %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr,
|
||||
xiev->v.column.new_col_nbr);
|
||||
break;
|
||||
case XIE_COL_SIZE:
|
||||
sprintf(str2,
|
||||
" list cid %d, col_nbr %d, new_col_width %d new_col_pixel_width %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr,
|
||||
xiev->v.column.new_col_width, xiev->v.column.new_col_pixel_width);
|
||||
break;
|
||||
}
|
||||
tmp = (char *)xi_tree_malloc(strlen(str) + strlen(str2) + 2, NULL);
|
||||
strcpy(tmp, str);
|
||||
strcat(tmp, str2);
|
||||
if ((int)strlen(tmp) >= len)
|
||||
tmp[len] = '\0';
|
||||
strcpy(s, tmp);
|
||||
xi_tree_free(tmp);
|
||||
}
|
||||
case XIE_CHAR_CELL:
|
||||
case XIE_CHAR_FIELD:
|
||||
{
|
||||
char char_str[20];
|
||||
int ch;
|
||||
|
||||
ch = xiev->v.chr.ch;
|
||||
switch ( ch )
|
||||
{
|
||||
case XI_KEY_CLEAR:
|
||||
strcpy( char_str, "XI_KEY_CLEAR" );
|
||||
break;
|
||||
case XI_KEY_DEL:
|
||||
strcpy( char_str, "XI_KEY_DEL" );
|
||||
break;
|
||||
case '\b':
|
||||
strcpy( char_str, "BS" );
|
||||
break;
|
||||
default:
|
||||
char_str[0] = ( char ) ch;
|
||||
char_str[1] = '\0';
|
||||
break;
|
||||
}
|
||||
xi_obj = xiev->v.chr.xi_obj;
|
||||
for ( k = 0; object_type[k].type != xi_obj->type &&
|
||||
object_type[k].type != UNDEFINED; ++k )
|
||||
;
|
||||
switch ( xi_obj->type )
|
||||
{
|
||||
case XIT_CELL:
|
||||
sprintf( str2,
|
||||
" cid %3d type %s r %d c %d ch %s shft %d ctrl %d alt %d",
|
||||
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
|
||||
xi_obj->v.cell.column, char_str, xiev->v.chr.shift,
|
||||
xiev->v.chr.control, xiev->v.chr.alt );
|
||||
break;
|
||||
case XIT_FIELD:
|
||||
sprintf( str2, " cid %3d type %s ch %s shft %d ctrl %d alt %d", xi_obj->cid,
|
||||
object_type[k].desc, char_str, xiev->v.chr.shift,
|
||||
xiev->v.chr.control, xiev->v.chr.alt );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XIE_GET_FIRST:
|
||||
case XIE_GET_LAST:
|
||||
sprintf( str2, " data_rec %08.8lx", ( long ) xiev->v.rec_request.data_rec );
|
||||
break;
|
||||
case XIE_GET_NEXT:
|
||||
case XIE_GET_PREV:
|
||||
sprintf( str2, " spec_rec %08.8lx, data_rec %08.8lx",
|
||||
( long ) xiev->v.rec_request.spec_rec, ( long ) xiev->v.rec_request.data_rec );
|
||||
break;
|
||||
case XIE_CELL_REQUEST:
|
||||
sprintf( str2, " c %2d, rec %08.8lx, len %3d",
|
||||
( int ) xiev->v.cell_request.col_nbr, ( long ) xiev->v.cell_request.rec,
|
||||
xiev->v.cell_request.len );
|
||||
break;
|
||||
case XIE_GET_PERCENT:
|
||||
sprintf( str2, " list->cid %d, record %08.8lx",
|
||||
xiev->v.get_percent.list->cid,
|
||||
( long ) xiev->v.get_percent.record );
|
||||
break;
|
||||
case XIE_SELECT:
|
||||
sprintf( str2, " row %d, selected %d, dbl_click %d shift %d control %d column %d",
|
||||
xiev->v.select.xi_obj->v.row, xiev->v.select.selected,
|
||||
xiev->v.select.dbl_click, xiev->v.select.shift, xiev->v.select.control, xiev->v.select.column );
|
||||
break;
|
||||
case XIE_REC_ALLOCATE:
|
||||
sprintf( str2, " list cid %d", xiev->v.rec_allocate.list->cid );
|
||||
break;
|
||||
case XIE_REC_FREE:
|
||||
sprintf( str2, " list cid %d, record %08.8lx", xiev->v.rec_free.list->cid, xiev->v.rec_free.record );
|
||||
break;
|
||||
case XIE_ROW_SIZE:
|
||||
sprintf( str2, " row %d, new_size %d", xiev->v.row_size.xi_obj->v.row, xiev->v.row_size.new_row_height );
|
||||
break;
|
||||
case XIE_VIR_PAN:
|
||||
sprintf( str2, " delta_x %d, delta_y %d, before_pan %d",
|
||||
xiev->v.vir_pan.delta_x, xiev->v.vir_pan.delta_y,
|
||||
xiev->v.vir_pan.before_pan );
|
||||
break;
|
||||
case XIE_COL_DELETE:
|
||||
sprintf( str2, " list cid %d, col_nbr %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr );
|
||||
break;
|
||||
case XIE_COL_MOVE:
|
||||
sprintf( str2, " list cid %d, col_nbr %d, new_col_nbr %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr,
|
||||
xiev->v.column.new_col_nbr );
|
||||
break;
|
||||
case XIE_COL_SIZE:
|
||||
sprintf( str2, " list cid %d, col_nbr %d, new_col_width %d, new_col_pixel_width %d",
|
||||
xiev->v.column.list->cid, xiev->v.column.col_nbr,
|
||||
xiev->v.column.new_col_width, xiev->v.column.new_col_pixel_width );
|
||||
break;
|
||||
}
|
||||
tmp = ( char * ) xi_tree_malloc( strlen( str ) + strlen( str2 ) + 2, NULL );
|
||||
strcpy( tmp, str );
|
||||
strcat( tmp, str2 );
|
||||
if ( ( int ) strlen( tmp ) >= len )
|
||||
tmp[len] = '\0';
|
||||
strcpy( s, tmp );
|
||||
xi_tree_free( tmp );
|
||||
}
|
||||
|
@ -1,15 +1,25 @@
|
||||
#define C_UL 218 /* upper left */
|
||||
#define C_UR 191 /* upper right */
|
||||
#define C_LL 192 /* lower left */
|
||||
#define C_LR 217 /* lower right */
|
||||
#define C_XD 194 /* T-intersection down */
|
||||
#define C_XU 193 /* T-intersection up */
|
||||
#define C_XR 195 /* T-intersection right */
|
||||
#define C_XL 180 /* T-intersection left */
|
||||
#define C_XX 197 /* 4-way intersection */
|
||||
#define C_H 196 /* horizontal line */
|
||||
#define C_V 179 /* vertical line */
|
||||
#define C_ULD 201 /* next group same as above, but double */
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#define C_UL 218 /* upper left */
|
||||
#define C_UR 191 /* upper right */
|
||||
#define C_LL 192 /* lower left */
|
||||
#define C_LR 217 /* lower right */
|
||||
#define C_XD 194 /* T-intersection down */
|
||||
#define C_XU 193 /* T-intersection up */
|
||||
#define C_XR 195 /* T-intersection right */
|
||||
#define C_XL 180 /* T-intersection left */
|
||||
#define C_XX 197 /* 4-way intersection */
|
||||
#define C_H 196 /* horizontal line */
|
||||
#define C_V 179 /* vertical line */
|
||||
#define C_ULD 201 /* next group same as above, but double */
|
||||
#define C_URD 187
|
||||
#define C_LLD 200
|
||||
#define C_LRD 188
|
||||
@ -20,8 +30,5 @@
|
||||
#define C_XXD 206
|
||||
#define C_HD 205
|
||||
#define C_VD 186
|
||||
#define C_HATCH 176 /* hatching */
|
||||
#define C_SPACE 255
|
||||
|
||||
|
||||
|
||||
#define C_HATCH 176 /* hatching */
|
||||
#define C_SPACE 255
|
||||
|
316
xi/xierr.c
Executable file
316
xi/xierr.c
Executable file
@ -0,0 +1,316 @@
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "xi.h"
|
||||
|
||||
static struct s_error_entry
|
||||
{
|
||||
int errcode;
|
||||
char *text;
|
||||
} error_table[] =
|
||||
|
||||
{
|
||||
{
|
||||
1000, "Error: Problem 1000"
|
||||
},
|
||||
{
|
||||
1001, "Warning: Problem 1001"
|
||||
},
|
||||
{
|
||||
1002, "Error: XI_TEXT internal error"
|
||||
},
|
||||
{
|
||||
20001, "XI: internal object deletion error"
|
||||
},
|
||||
{
|
||||
20002, "Internal XI error"
|
||||
},
|
||||
{
|
||||
20003, "Internal error"
|
||||
},
|
||||
{
|
||||
20004, "Internal XI error"
|
||||
},
|
||||
{
|
||||
20005, "Internal error"
|
||||
},
|
||||
{
|
||||
20006, "Attempting to move to disabled or invisible object"
|
||||
},
|
||||
{
|
||||
20007, "Attempting to move to disabled or invisible object"
|
||||
},
|
||||
{
|
||||
20008, "XI: unknown STX callback"
|
||||
},
|
||||
{
|
||||
20009, "XI: unknown LM callback"
|
||||
},
|
||||
{
|
||||
20010, "Non-column object sent to xi_column_set_pixel_width"
|
||||
},
|
||||
{
|
||||
20011, "Can't create empty container"
|
||||
},
|
||||
{
|
||||
20012, "Containers can only contain buttons"
|
||||
},
|
||||
{
|
||||
20013, "Can't mix button types in a container"
|
||||
},
|
||||
{
|
||||
20014, "Not enough room in container for buttons"
|
||||
},
|
||||
{
|
||||
20015, "Internal XI error"
|
||||
},
|
||||
{
|
||||
20016, "xi_create: Invalid XI_OBJ_TYPE"
|
||||
},
|
||||
{
|
||||
20017, "Invalid XI object passed to xi_delete"
|
||||
},
|
||||
{
|
||||
20018, "Invalid object passed to xi_get_attrib"
|
||||
},
|
||||
{
|
||||
20019, "xi_get_def_rect: Invalid XI_OBJ_TYPE in tree"
|
||||
},
|
||||
{
|
||||
20020, "Non-list object passed to xi_get_list_info"
|
||||
},
|
||||
{
|
||||
20021, "xi_get_rect: Invalid XI_OBJ_TYPE in tree"
|
||||
},
|
||||
{
|
||||
20022, "Invalid object passed to xi_get_sel"
|
||||
},
|
||||
{
|
||||
20023, "xi_get_text not implemented for XIT_ROW"
|
||||
},
|
||||
{
|
||||
20024, "Invalidate object passed to xi_scroll_rec"
|
||||
},
|
||||
{
|
||||
20025, "Invalidate object passed to xi_delete_row"
|
||||
},
|
||||
{
|
||||
20026, "Invalidate object passed to xi_insert_row"
|
||||
},
|
||||
{
|
||||
20027, "Invalid object passed to xi_set_attrib"
|
||||
},
|
||||
{
|
||||
20028, "Invalid object passed to xi_set_sel"
|
||||
},
|
||||
{
|
||||
20029, "xi_set_text not implemented for XIT_ROW"
|
||||
},
|
||||
{
|
||||
20030, "Internal focus error"
|
||||
},
|
||||
{
|
||||
20031, "Non-list object sent to xi_set_fixed_columns"
|
||||
},
|
||||
{
|
||||
20032, "button height exceeds container height"
|
||||
},
|
||||
{
|
||||
20033, "button width exceeds container width"
|
||||
},
|
||||
{
|
||||
20034, "height must be at least 8 form units"
|
||||
},
|
||||
{
|
||||
20035, "Buttons won't fit in container"
|
||||
},
|
||||
{
|
||||
20036, "xi_container_reorient() passed wrong object type"
|
||||
},
|
||||
{
|
||||
20037, "Invalidate object passed to xi_scroll_internal"
|
||||
},
|
||||
{
|
||||
20038, "Non-list object sent to xi_get_fixed_columns"
|
||||
},
|
||||
{
|
||||
20039, "Non-interface object sent to xi_itf_closing_is"
|
||||
},
|
||||
{
|
||||
20050, "xi_create: Rectangles cannot have children"
|
||||
},
|
||||
{
|
||||
20051, "xi_create: Lines cannot have children"
|
||||
},
|
||||
{
|
||||
20052, "xi_create: Buttons cannot have children"
|
||||
},
|
||||
{
|
||||
20053, "xi_create: Fields cannot have children"
|
||||
},
|
||||
{
|
||||
20055, "xi_create: Static text controls cannot have children"
|
||||
},
|
||||
{
|
||||
20056, "xi_create: Columns cannot have children"
|
||||
},
|
||||
{
|
||||
20088, "xi_set_icon: Invalid object"
|
||||
},
|
||||
{
|
||||
20089, "Too many radio buttons in a container"
|
||||
},
|
||||
{
|
||||
20090, "create_window returned NULL"
|
||||
},
|
||||
{
|
||||
20091, "Window information corrupt"
|
||||
},
|
||||
{
|
||||
20092, "Window information corrupt"
|
||||
},
|
||||
{
|
||||
20094, "Window information corrupt"
|
||||
},
|
||||
{
|
||||
20095, "XinAppSystemSetupInit was not provided."
|
||||
},
|
||||
{
|
||||
20101, "Invalid interface passed to xi_add_form_def"
|
||||
},
|
||||
{
|
||||
20102, "Invalid interface passed to xi_add_list_def"
|
||||
},
|
||||
{
|
||||
20103, "Invalid list passed to xi_add_column_def"
|
||||
},
|
||||
{
|
||||
20104, "Invalid form passed to xi_add_field_def"
|
||||
},
|
||||
{
|
||||
20105, "Invalid interface passed to xi_add_container_def"
|
||||
},
|
||||
{
|
||||
20106, "Invalid parent passed to xi_add_button_def"
|
||||
},
|
||||
{
|
||||
20107, "Invalid interface passed to xi_add_text_def"
|
||||
},
|
||||
{
|
||||
20108, "Invalid interface passed to xi_add_line_def"
|
||||
},
|
||||
{
|
||||
20109, "Groups must have at least one member"
|
||||
},
|
||||
{
|
||||
20110, "Invalid interface passed to xi_add_group_def"
|
||||
},
|
||||
{
|
||||
20111, "Invalid interface passed to xi_add_rect_def"
|
||||
},
|
||||
{
|
||||
20112, "Invalid field buffer size"
|
||||
},
|
||||
{
|
||||
20201, "Out of memory"
|
||||
},
|
||||
{
|
||||
20907, "lm_get_attrib: Invalid LM part"
|
||||
},
|
||||
{
|
||||
20908, "Attempting to get text from an invalid cell"
|
||||
},
|
||||
{
|
||||
20915, "Invalid column number passed to lm_delete_column"
|
||||
},
|
||||
{
|
||||
20917, "lm_set_buf_size: Invalid LM part"
|
||||
},
|
||||
{
|
||||
20918, "lm_cell_request: Invalid LM part"
|
||||
},
|
||||
{
|
||||
20919, "xi_insert_row called with get_all_records set to TRUE"
|
||||
},
|
||||
{
|
||||
20920, "xi_delete_row called with get_all_records set to TRUE"
|
||||
},
|
||||
{
|
||||
20921, "lm_focus_cell_set called when list does not have focus"
|
||||
},
|
||||
{
|
||||
30101, "Internal focus error"
|
||||
},
|
||||
{
|
||||
30201, "Internal TEXT error"
|
||||
},
|
||||
{
|
||||
30202, "Internal TEXT error"
|
||||
},
|
||||
{
|
||||
30203, "Internal error"
|
||||
},
|
||||
{
|
||||
30205, "txt_caret called with disabled field"
|
||||
},
|
||||
{
|
||||
30206, "Invalid TXT passed to txt_event"
|
||||
},
|
||||
{
|
||||
30207, "xi_get_obj: Invalid cid"
|
||||
},
|
||||
{
|
||||
30208, "width or height required with grid"
|
||||
},
|
||||
{
|
||||
30209, "lm_start_edit: Internal error, called with focus not poperly set"
|
||||
},
|
||||
{
|
||||
0, "Unknown Error"
|
||||
}
|
||||
};
|
||||
|
||||
char *
|
||||
XinErrorCodeLookup( int errcode )
|
||||
{
|
||||
struct s_error_entry *entry;
|
||||
static char temp[30];
|
||||
|
||||
for ( entry = error_table; entry->errcode != 0 && entry->errcode != errcode;
|
||||
entry++ )
|
||||
;
|
||||
if ( entry->errcode == 0 )
|
||||
{
|
||||
sprintf( temp, "XIN Error %d", errcode );
|
||||
return temp;
|
||||
}
|
||||
return entry->text;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
XinErrorDefaultHandler( int errcode, XinSeverity severity, long app_data )
|
||||
{
|
||||
BOOLEAN terminate = FALSE;
|
||||
|
||||
NOREF( app_data );
|
||||
if ( severity == XinSeverityFatal )
|
||||
{
|
||||
terminate = TRUE;
|
||||
XinDialogError( "%s", XinErrorCodeLookup( errcode ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( XinDialogAsk( "Continue", "Terminate", NULL, "%s",
|
||||
XinErrorCodeLookup( errcode ) ) == XinResponse2 )
|
||||
terminate = TRUE;
|
||||
}
|
||||
return terminate;
|
||||
}
|
30
xi/xiheap.c
30
xi/xiheap.c
@ -1,5 +1,6 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
@ -13,45 +14,46 @@
|
||||
#include "xiheap.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
int nbr_malloc, nbr_free;
|
||||
int nbr_malloc,
|
||||
nbr_free;
|
||||
|
||||
#endif
|
||||
|
||||
void *
|
||||
heap_malloc(size_t size)
|
||||
heap_malloc( size_t size )
|
||||
{
|
||||
void *p;
|
||||
|
||||
#ifdef DEBUG
|
||||
nbr_malloc++;
|
||||
#endif
|
||||
p = malloc(size);
|
||||
p = XinMemoryAlloc( size );
|
||||
if ( p != NULL )
|
||||
memset((char *)p, '\0', (size_t)size);
|
||||
return(p);
|
||||
memset( ( char * ) p, '\0', ( size_t ) size );
|
||||
return ( p );
|
||||
}
|
||||
|
||||
void
|
||||
heap_free(void *p)
|
||||
heap_free( void *p )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nbr_free++;
|
||||
#endif
|
||||
free((char *)p);
|
||||
XinMemoryFree( ( char * ) p );
|
||||
}
|
||||
|
||||
void *
|
||||
heap_realloc(void *p, size_t size)
|
||||
heap_realloc( void *p, size_t size )
|
||||
{
|
||||
return( realloc((char *)p, size ));
|
||||
return ( XinMemoryRealloc( ( char * ) p, size ) );
|
||||
}
|
||||
|
||||
void
|
||||
heap_dbg(char *title)
|
||||
heap_dbg( char *title )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
xvt_debug_printf("heap check (%s): malloc's=%u, free's=%u", title, nbr_malloc, nbr_free);
|
||||
XinDebugPrintf( "heap check (%Fs): malloc's=%u, free's=%u", title, nbr_malloc, nbr_free );
|
||||
#else
|
||||
NOREF(title);
|
||||
NOREF( title );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
23
xi/xiheap.h
23
xi/xiheap.h
@ -1,17 +1,21 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************
|
||||
Heap module
|
||||
******************************************************************/
|
||||
void *heap_malloc(size_t size);
|
||||
void heap_free(void *p);
|
||||
void *heap_realloc(void *p, size_t size);
|
||||
void heap_dbg(char *title);
|
||||
void *heap_malloc( size_t size );
|
||||
void heap_free( void *p );
|
||||
void *heap_realloc( void *p, size_t size );
|
||||
void heap_dbg( char *title );
|
||||
|
||||
#define MAX_NODE_SIZE 16000
|
||||
#define HEAP_SIZE 32000
|
||||
|
||||
@ -38,11 +42,8 @@ typedef struct _s_node
|
||||
|
||||
typedef struct _s_enode
|
||||
{
|
||||
unsigned short size; /* equal to NODE_MAGIC */
|
||||
struct _s_node *next; /* pointer to next heap */
|
||||
unsigned short size; /* equal to NODE_MAGIC */
|
||||
struct _s_node *next; /* pointer to next heap */
|
||||
} E_NODE;
|
||||
|
||||
#define ALIGNMENT (sizeof(NODE))
|
||||
|
||||
|
||||
|
||||
|
47
xi/xil.h
47
xi/xil.h
@ -1,37 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef INCL_XIL
|
||||
#define INCL_XIL
|
||||
|
||||
#if (XVT_CC == XVT_CC_CURL)
|
||||
#include "xires.h"
|
||||
#else
|
||||
#include "xi.h"
|
||||
#endif
|
||||
|
||||
#include "xvtcm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XVTCM_CONTROL_INFO ci;
|
||||
XI_OBJ* itf;
|
||||
XI_EVENT* xiev;
|
||||
XI_OBJ *itf;
|
||||
XI_EVENT *xiev;
|
||||
} XIL_DATA;
|
||||
|
||||
WINDOW XVT_CALLCONV1 xil_create XVT_CC_ARGS((int cid, int left, int top,
|
||||
int right, int bottom, int prop_count,
|
||||
char** prop_list, WINDOW parent_win,
|
||||
int parent_rid, long parent_flags,
|
||||
char* parent_class));
|
||||
XI_OBJ_DEF* XVT_CALLCONV1 xil_parse XVT_CC_ARGS((int cid, int prop_count,
|
||||
char** prop_list));
|
||||
WINDOW XVT_CALLCONV1 xil_create XVT_CC_ARGS( ( int cid, int left, int top,
|
||||
int right, int bottom, int prop_count,
|
||||
char **prop_list, WINDOW parent_win,
|
||||
int parent_rid, long parent_flags,
|
||||
char *parent_class ) );
|
||||
XI_OBJ_DEF *XVT_CALLCONV1 xil_parse XVT_CC_ARGS( ( int cid, int prop_count,
|
||||
char **prop_list ) );
|
||||
|
||||
WINDOW XVT_CALLCONV1 xis_create XVT_CC_ARGS((int cid, int left, int top,
|
||||
int right, int bottom, int prop_count,
|
||||
char** prop_list, WINDOW parent_win,
|
||||
int parent_rid, long parent_flags,
|
||||
char* parent_class));
|
||||
WINDOW XVT_CALLCONV1 xis_create XVT_CC_ARGS( ( int cid, int left, int top,
|
||||
int right, int bottom, int prop_count,
|
||||
char **prop_list, WINDOW parent_win,
|
||||
int parent_rid, long parent_flags,
|
||||
char *parent_class ) );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
// End of extern "C"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
525
xi/xilm.h
525
xi/xilm.h
@ -1,8 +1,11 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************
|
||||
@ -13,6 +16,12 @@ LM module
|
||||
#define LM_ATR_VISIBLE XI_ATR_VISIBLE
|
||||
#define LM_ATR_NAVIGATE XI_ATR_NAVIGATE
|
||||
#define LM_ATR_TABWRAP XI_ATR_TABWRAP
|
||||
/*-------------------------------------------------------------------------
|
||||
function: lm_adj_v
|
||||
lmp: current lmp
|
||||
v: to vertical coord to convert
|
||||
-------------------------------------------------------------------------*/
|
||||
#define lm_adj_v(lmp, v) (v = v + lmp->mlr.top + lmp->rrr_offset)
|
||||
|
||||
typedef enum _lm_cb_type
|
||||
{
|
||||
@ -33,8 +42,10 @@ typedef enum _lm_cb_type
|
||||
LM_CB_ROW_SIZE,
|
||||
LM_CB_COL_DELETE,
|
||||
LM_CB_COL_MOVE,
|
||||
LM_CB_COL_SIZE
|
||||
}
|
||||
LM_CB_COL_SIZE,
|
||||
LM_CB_DROP_ROW
|
||||
}
|
||||
|
||||
LM_CB_TYPE;
|
||||
|
||||
typedef struct _lm_cb_data
|
||||
@ -42,19 +53,19 @@ typedef struct _lm_cb_data
|
||||
LM lm;
|
||||
LM_CB_TYPE cb_type;
|
||||
int cid;
|
||||
WINDOW win;
|
||||
XinWindow win;
|
||||
int row;
|
||||
int column;
|
||||
long rec;
|
||||
union
|
||||
{
|
||||
{
|
||||
struct
|
||||
{
|
||||
long spec_rec;
|
||||
long data_rec;
|
||||
int percent;
|
||||
unsigned long attrib;
|
||||
COLOR color;
|
||||
XinColor color;
|
||||
BOOLEAN refused;
|
||||
int row_height;
|
||||
BOOLEAN has_focus;
|
||||
@ -82,15 +93,18 @@ typedef struct _lm_cb_data
|
||||
char *text;
|
||||
int len;
|
||||
int icon_rid;
|
||||
XI_BITMAP* bitmap;
|
||||
unsigned long attrib;
|
||||
COLOR color;
|
||||
COLOR back_color;
|
||||
FONT *font;
|
||||
XVT_FNTID font_id;
|
||||
XinColor color;
|
||||
XinColor back_color;
|
||||
XinFont *font;
|
||||
BOOLEAN button;
|
||||
BOOLEAN button_on_left;
|
||||
BOOLEAN button_on_focus;
|
||||
BOOLEAN button_full_cell;
|
||||
int button_icon_rid;
|
||||
XI_BITMAP* button_bitmap;
|
||||
void *font_id;
|
||||
} text;
|
||||
BOOLEAN refused;
|
||||
struct
|
||||
@ -98,6 +112,7 @@ typedef struct _lm_cb_data
|
||||
int ch;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
BOOLEAN alt;
|
||||
BOOLEAN is_paste;
|
||||
BOOLEAN refused;
|
||||
} chr;
|
||||
@ -117,17 +132,26 @@ typedef struct _lm_cb_data
|
||||
} cell_btn;
|
||||
struct
|
||||
{
|
||||
int new_col_nbr;
|
||||
int new_col_nbr;
|
||||
BOOLEAN in_fixed;
|
||||
int new_col_width;
|
||||
int new_col_pixel_width;
|
||||
BOOLEAN refused;
|
||||
int new_col_width;
|
||||
int new_col_pixel_width;
|
||||
BOOLEAN refused;
|
||||
} column;
|
||||
struct
|
||||
{
|
||||
XI_OBJ* src_list;
|
||||
long src_rec;
|
||||
BOOLEAN after_all_rows;
|
||||
BOOLEAN delete_row;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
} drop_row;
|
||||
/* nothing for LM_CB_CHANGE */
|
||||
} v;
|
||||
} LM_CB_DATA;
|
||||
|
||||
typedef void (*LM_CB)(LM_CB_DATA *lm_cb_data);
|
||||
typedef void ( *LM_CB ) ( LM_CB_DATA * lm_cb_data );
|
||||
|
||||
#define LM_COL_ATR_ENABLED XI_ATR_ENABLED
|
||||
#define LM_COL_ATR_EDITMENU XI_ATR_EDITMENU
|
||||
@ -153,7 +177,6 @@ typedef struct _lm_column_data
|
||||
unsigned long attrib;
|
||||
short pix_width;
|
||||
short x_pix_pos;
|
||||
short text_offset; /* offset into row text buffer */
|
||||
short text_size;
|
||||
char *heading_text;
|
||||
short width;
|
||||
@ -162,29 +185,36 @@ typedef struct _lm_column_data
|
||||
BOOLEAN heading_platform;
|
||||
BOOLEAN column_well;
|
||||
BOOLEAN column_platform;
|
||||
FONT_OBJ *font;
|
||||
XinFont *font;
|
||||
int icon_rid;
|
||||
short icon_x;
|
||||
short icon_y;
|
||||
XI_BITMAP* bitmap;
|
||||
BOOLEAN size_rows;
|
||||
BOOLEAN suppress_update_heading;
|
||||
BOOLEAN suppress_update_cells;
|
||||
BOOLEAN vertical_align_center;
|
||||
BOOLEAN vertical_align_bottom;
|
||||
BOOLEAN wrap_text;
|
||||
BOOLEAN wrap_text_scrollbar;
|
||||
BOOLEAN cr_ok;
|
||||
BOOLEAN var_len_text;
|
||||
BOOLEAN auto_tab;
|
||||
XI_ICON_MODE_TYPE icon_mode;
|
||||
BOOLEAN pushed;
|
||||
|
||||
/* temporary variables - don't assume this is good */
|
||||
RCT column_rct; /* used for caching column rectangles to speed drawing */
|
||||
RCT prct; /* physical rect */
|
||||
BOOLEAN needs_update;
|
||||
XinRect column_rct; /* used for caching column rectangles to speed
|
||||
* drawing */
|
||||
XinRect prct; /* physical rect */
|
||||
BOOLEAN XinWindowPaintNeeds;
|
||||
} LM_COLUMN_DATA;
|
||||
|
||||
typedef struct _lm_column_def
|
||||
{
|
||||
unsigned long attrib;
|
||||
short position;
|
||||
short pix_width; /* pixels */
|
||||
short pix_width; /* pixels */
|
||||
short text_size;
|
||||
char *heading_text;
|
||||
BOOLEAN center_heading;
|
||||
@ -192,17 +222,22 @@ typedef struct _lm_column_def
|
||||
BOOLEAN heading_platform;
|
||||
BOOLEAN column_well;
|
||||
BOOLEAN column_platform;
|
||||
FONT_OBJ *font;
|
||||
XinFont *font;
|
||||
int icon_rid;
|
||||
short icon_x;
|
||||
short icon_y;
|
||||
XI_BITMAP* bitmap;
|
||||
BOOLEAN size_rows;
|
||||
BOOLEAN suppress_update_heading;
|
||||
BOOLEAN suppress_update_cells;
|
||||
BOOLEAN vertical_align_center;
|
||||
BOOLEAN vertical_align_bottom;
|
||||
BOOLEAN wrap_text;
|
||||
BOOLEAN wrap_text_scrollbar;
|
||||
BOOLEAN cr_ok;
|
||||
BOOLEAN var_len_text;
|
||||
BOOLEAN auto_tab;
|
||||
XI_ICON_MODE_TYPE icon_mode;
|
||||
} LM_COLUMN_DEF;
|
||||
|
||||
typedef struct _lm_def
|
||||
@ -212,24 +247,26 @@ typedef struct _lm_def
|
||||
XI_OBJ *itf_obj;
|
||||
|
||||
/* XI may specify this */
|
||||
PNT pnt;
|
||||
XinPoint pnt;
|
||||
short pixel_height;
|
||||
/* If absolute height is set, then the height of the list will be exactly height pixels high */
|
||||
/* If absolute height is set, then the height of the list will be exactly
|
||||
* height pixels high */
|
||||
BOOLEAN absolute_height;
|
||||
short pixel_width;
|
||||
|
||||
short pix_char_width;
|
||||
unsigned long attrib;
|
||||
LM_CB lm_cb;
|
||||
FONT_OBJ *font;
|
||||
COLOR back_color;
|
||||
COLOR enabled_color; /* but inactive */
|
||||
COLOR disabled_color;
|
||||
COLOR active_color;
|
||||
COLOR active_back_color;
|
||||
COLOR disabled_back_color;
|
||||
COLOR white_space_color;
|
||||
COLOR rule_color;
|
||||
XinFont *font;
|
||||
BOOLEAN is_list_font; /* False, if "font" is from the interface or system */
|
||||
XinColor enabled_color; /* but inactive */
|
||||
XinColor back_color;
|
||||
XinColor disabled_color;
|
||||
XinColor disabled_back_color;
|
||||
XinColor active_color;
|
||||
XinColor active_back_color;
|
||||
XinColor white_space_color;
|
||||
XinColor rule_color;
|
||||
char *parent;
|
||||
BOOLEAN no_heading;
|
||||
BOOLEAN one_row_list;
|
||||
@ -248,15 +285,18 @@ typedef struct _lm_def
|
||||
BOOLEAN fixed_row_height;
|
||||
BOOLEAN sizable_rows;
|
||||
BOOLEAN get_all_records;
|
||||
BOOLEAN keep_all_records;
|
||||
BOOLEAN resize_with_window;
|
||||
int horz_sync_list;
|
||||
int vert_sync_list;
|
||||
BOOLEAN row_focus_border;
|
||||
COLOR row_focus_border_color;
|
||||
XinColor row_focus_border_color;
|
||||
int max_lines_in_cell;
|
||||
BOOLEAN single_select;
|
||||
BOOLEAN retain_back_color_on_select;
|
||||
BOOLEAN drag_and_drop_rows;
|
||||
BOOLEAN drag_rows_autoscroll;
|
||||
BOOLEAN button_on_cell_focus;
|
||||
int position_by_typing_cid;
|
||||
} LM_DEF;
|
||||
|
||||
#define LM_HEADING_TEXT 1001
|
||||
@ -267,35 +307,34 @@ typedef enum
|
||||
LM_ROW,
|
||||
LM_COLUMN,
|
||||
LM_CELL
|
||||
}
|
||||
}
|
||||
|
||||
LM_PART;
|
||||
|
||||
typedef struct _lm_cell_data
|
||||
{
|
||||
unsigned long attrib;
|
||||
FONT_OBJ *font;
|
||||
COLOR color;
|
||||
COLOR back_color;
|
||||
XinFont *font;
|
||||
XinColor color;
|
||||
XinColor back_color;
|
||||
int icon_rid;
|
||||
XI_BITMAP* bitmap;
|
||||
BOOLEAN button;
|
||||
BOOLEAN button_on_left;
|
||||
BOOLEAN button_on_focus;
|
||||
BOOLEAN button_full_cell;
|
||||
int button_icon_rid;
|
||||
XI_BITMAP* button_bitmap;
|
||||
BOOLEAN valid_data;
|
||||
|
||||
/* multiline cell info */
|
||||
char *string;
|
||||
int pix_width;
|
||||
int nbr_lines;
|
||||
int *line_breaks;
|
||||
int font_height;
|
||||
XI_TEXT *xi_text;
|
||||
} LM_CELL_DATA;
|
||||
|
||||
typedef struct _lm_data
|
||||
{
|
||||
int cid;
|
||||
WINDOW win;
|
||||
RCT rct;
|
||||
XinWindow win;
|
||||
XinRect rct;
|
||||
short pix_top;
|
||||
short pix_hdr_bottom;
|
||||
short pix_row1_top;
|
||||
@ -304,15 +343,15 @@ typedef struct _lm_data
|
||||
short pix_row_spacing;
|
||||
unsigned long attrib;
|
||||
short nbr_columns;
|
||||
LM_COLUMN_DATA * *lm_column_data;
|
||||
COLOR back_color;
|
||||
COLOR enabled_color; /* but inactive */
|
||||
COLOR disabled_color;
|
||||
COLOR disabled_back_color;
|
||||
COLOR active_color;
|
||||
COLOR active_back_color;
|
||||
COLOR white_space_color;
|
||||
COLOR rule_color;
|
||||
LM_COLUMN_DATA **lm_column_data;
|
||||
XinColor back_color;
|
||||
XinColor enabled_color; /* but inactive */
|
||||
XinColor disabled_color;
|
||||
XinColor disabled_back_color;
|
||||
XinColor active_color;
|
||||
XinColor active_back_color;
|
||||
XinColor white_space_color;
|
||||
XinColor rule_color;
|
||||
BOOLEAN no_heading;
|
||||
BOOLEAN sizable_columns;
|
||||
BOOLEAN movable_columns;
|
||||
@ -335,37 +374,21 @@ typedef struct _lm_data
|
||||
int horz_sync_list;
|
||||
int vert_sync_list;
|
||||
BOOLEAN row_focus_border;
|
||||
COLOR row_focus_border_color;
|
||||
XinColor row_focus_border_color;
|
||||
int max_lines_in_cell;
|
||||
BOOLEAN single_select;
|
||||
BOOLEAN retain_back_color_on_select;
|
||||
|
||||
/*
|
||||
The following fields contain state information about focus and the
|
||||
list. If txt is not NULL, then editing is currently happening.
|
||||
If txt_is_invisible is TRUE, then editing is suspended because the cell
|
||||
with the focus is not visible, but could be at any point in time.
|
||||
The fields after txt_is_invisible contain state information about
|
||||
restarting editing if the focus becomes visible.
|
||||
*/
|
||||
TXT_DATA *txt;
|
||||
BOOLEAN txt_is_invisible;
|
||||
long focus_rec;
|
||||
long saved_focus_rec;
|
||||
BOOLEAN focus_rec_is_above;
|
||||
COLOR focus_rec_color;
|
||||
unsigned long focus_rec_attrib;
|
||||
int focus_rec_height;
|
||||
char *focus_cell_text;
|
||||
int focus_cell_ip1;
|
||||
int focus_cell_ip2;
|
||||
BOOLEAN drag_and_drop_rows;
|
||||
BOOLEAN drag_rows_autoscroll;
|
||||
BOOLEAN button_on_cell_focus;
|
||||
int position_by_typing_cid;
|
||||
|
||||
/* run time data */
|
||||
LM_CB lm_cb;
|
||||
XI_OBJ *list_obj;
|
||||
XI_OBJ *itf_obj;
|
||||
FONT_OBJ *font;
|
||||
short text_size;
|
||||
XinFont *font;
|
||||
BOOLEAN is_list_font; /* False, if "font" is from the interface or system */
|
||||
BOOLEAN have_mouse;
|
||||
int column_being_moved;
|
||||
int last_x;
|
||||
@ -373,6 +396,7 @@ typedef struct _lm_data
|
||||
BOOLEAN down_in_hscrolling;
|
||||
BOOLEAN in_hscrolling;
|
||||
BOOLEAN last_in_hscrolling;
|
||||
XI_OBJ* last_itf;
|
||||
int org_x;
|
||||
int org_y;
|
||||
int ascent;
|
||||
@ -389,7 +413,7 @@ typedef struct _lm_data
|
||||
int last_vis;
|
||||
int vir_left;
|
||||
int vir_right;
|
||||
BOOLEAN btn_down; /* or up */
|
||||
BOOLEAN btn_down; /* or up */
|
||||
BOOLEAN down_in_btn;
|
||||
int btn_down_row;
|
||||
int btn_down_col;
|
||||
@ -399,58 +423,57 @@ typedef struct _lm_data
|
||||
BOOLEAN text_scrolling;
|
||||
int old_row_height;
|
||||
BOOLEAN horizontally_scrolling_list;
|
||||
struct _lm_focus_state *focus_state;
|
||||
XinFont *cur_font;
|
||||
BOOLEAN have_last_rec;
|
||||
long last_rec;
|
||||
BOOLEAN down_in_heading;
|
||||
|
||||
/* vertical scrolling information */
|
||||
RCT mlr;
|
||||
XinRect mlr;
|
||||
int mlr_height;
|
||||
int rrr_offset; /* offset of mlr */
|
||||
int rrr_bottom; /* total number of vertical pixels in realized row rect */
|
||||
int nbr_rows; /* visible, specified by XI */
|
||||
int rrr_offset; /* offset of mlr */
|
||||
int rrr_bottom; /* total number of vertical pixels in realized
|
||||
* row rect */
|
||||
int nbr_rows; /* visible, specified by XI */
|
||||
int realized_rows_array_len; /* also specified by XI */
|
||||
int nbr_realized_rows; /* number of rows actually used in realized row array */
|
||||
int nbr_realized_rows; /* number of rows actually used in realized row
|
||||
* array */
|
||||
int first_fully_vis;
|
||||
int last_fully_vis;
|
||||
BOOLEAN fixed_row_height;
|
||||
BOOLEAN sizable_rows;
|
||||
BOOLEAN get_all_records;
|
||||
BOOLEAN keep_all_records;
|
||||
BOOLEAN in_cell_request; /* Hold on to text for a cell, in case application wants */
|
||||
int cell_request_row; /* to know what we had last. */
|
||||
int cell_request_col;
|
||||
char *cell_request_text;
|
||||
|
||||
/* the following arrays are all allocated to the length of realized_rows_array_len */
|
||||
/* the following arrays are all allocated to the length of
|
||||
* realized_rows_array_len */
|
||||
long *recs;
|
||||
int *pix_offsets; /* pixel offsets of each row */
|
||||
int *pix_heights; /* pixel heights of each row */
|
||||
int *pix_offsets; /* pixel offsets of each row */
|
||||
int *pix_heights; /* pixel heights of each row */
|
||||
BOOLEAN *set_heights;
|
||||
char **buffer;
|
||||
unsigned long *row_attribs;
|
||||
COLOR *row_colors;
|
||||
LM_CELL_DATA * *cell_data;
|
||||
XinColor *row_colors;
|
||||
LM_CELL_DATA **cell_data;
|
||||
|
||||
/* Drag and Drop Rows information */
|
||||
XinPoint down_pt;
|
||||
BOOLEAN down_in_row;
|
||||
BOOLEAN dragging_row;
|
||||
long rec_being_moved;
|
||||
int drag_row_height;
|
||||
BOOLEAN delay_select;
|
||||
int delay_row;
|
||||
int delay_column;
|
||||
BOOLEAN delay_dbl;
|
||||
char *position_by_typing_buf;
|
||||
} LM_DATA;
|
||||
|
||||
#define NULL_LM (LM)0
|
||||
|
||||
/*
|
||||
There are several intrinsic functions having to do with focus.
|
||||
1. Put focus on the list, start editing
|
||||
Example: starting editing on the list when the focus moves to the list
|
||||
from some other place in XI.
|
||||
lm_start_edit
|
||||
2. Move the focus from one cell on the list to another, make visible if not.
|
||||
Example: tabing from one cell to another.
|
||||
lm_make_invis
|
||||
lm_force_vis
|
||||
lm_make_vis
|
||||
3. Possible transition of the focus from visible to invisible or from
|
||||
invisible to visible.
|
||||
Example: operating the horizontal or vertical scroll bar.
|
||||
Example: resizing the list.
|
||||
lm_make_invis
|
||||
lm_make_vis
|
||||
4. Stop editing, remove focus from the list altogether.
|
||||
Example: stopping editing when the focus moves elsewhere in XI.
|
||||
lm_stop_edit
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Activities to test
|
||||
@ -480,148 +503,160 @@ typedef struct _lm_scroll_arg
|
||||
BOOLEAN same_cell;
|
||||
long rec;
|
||||
BOOLEAN have_rec;
|
||||
COLOR color;
|
||||
XinColor color;
|
||||
unsigned long attrib;
|
||||
int row_height;
|
||||
BOOLEAN rec_at_top;
|
||||
int pixels_scrolled; /* this is a return value from lm_scroll */
|
||||
int pixels_scrolled; /* this is a return value from lm_scroll */
|
||||
} LM_SCROLL_ARG;
|
||||
|
||||
|
||||
void calculate_pix_offsets(LM_DATA *lmp, BOOLEAN draw_changes );
|
||||
void calculate_visibles(LM_DATA *lmp);
|
||||
void calc_x_pix_pos( LM lm, LM_COLUMN_DATA *lcdata, int position);
|
||||
BOOLEAN do_lm_cb(LM lm, LM_CB_TYPE cb_reason, int row, int column,
|
||||
EVENT *ep, int *percent, int pixels);
|
||||
BOOLEAN do_lm_cb_get(LM lm, LM_CB_TYPE cb_reason, long *spec_rec,
|
||||
long *data_rec, int percent, COLOR *color,
|
||||
unsigned long *attrib, int *row_height);
|
||||
void do_lm_cb_text(LM_DATA *lmp, int row, int col, BOOLEAN preserve_focus );
|
||||
void do_scroll_bar(XI_LIST_DATA *listdata);
|
||||
BOOLEAN lm_adj_h(LM_DATA *lmp, short *h);
|
||||
void lm_allocate_rec_info(LM_DATA *lmp, int realized_rows_array_len);
|
||||
void lm_calc_last_vis(LM_DATA *lmp);
|
||||
int lm_calculate_row_height(LM_DATA *lmp, int row);
|
||||
BOOLEAN lm_cell_has_focus( LM_DATA* lmp, int row, int column,
|
||||
BOOLEAN is_vert_scrolled );
|
||||
void lm_cell_request( LM lm, LM_PART lm_part, int idx1, int idx2);
|
||||
void lm_column_set_pixel_width(LM lm, int idx, int width);
|
||||
LM lm_create( WINDOW win, LM_DEF *lm_def, void *parent);
|
||||
void lm_create_column( LM lm, LM_COLUMN_DEF *lm_column_def,
|
||||
BOOLEAN do_cell_requests, BOOLEAN in_hscrolling);
|
||||
void lm_delete(LM lm);
|
||||
void lm_delete_column(LM lm, int column_nbr, BOOLEAN adjust_hscrolling);
|
||||
BOOLEAN lm_delete_row(LM lm, int row);
|
||||
void lm_draw_line(LM_DATA *lmp, PNT p, BOOLEAN adj_v, BOOLEAN adj_h);
|
||||
int lm_event(LM lm, EVENT *ep);
|
||||
void lm_focus_cb( long lm, int row, int column, BOOLEAN invisible,
|
||||
BOOLEAN set);
|
||||
void lm_force_vis(LM_DATA *lmp);
|
||||
unsigned long lm_get_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
|
||||
BOOLEAN invisible );
|
||||
int lm_get_buf_size(LM lm, LM_PART part, int idx);
|
||||
int lm_get_cid(LM lm);
|
||||
RCT * lm_get_cell_rect( RCT *rctp, LM lm, int row, int col, BOOLEAN inner,
|
||||
BOOLEAN physical_rct);
|
||||
int lm_get_col_spacing(void);
|
||||
int lm_get_fixed_columns( LM lm );
|
||||
void lm_get_focus_cell( LM_DATA *lmp, int *rowp, int *columnp,
|
||||
BOOLEAN* is_vert_scrolled );
|
||||
int lm_get_left_most_far_right_col(LM_DATA *lmp, int nbr_columns);
|
||||
long* lm_get_list_info(LM lm, int *nbr_recs);
|
||||
XI_OBJ* lm_get_list_obj(LM lm);
|
||||
RCT* lm_get_list_rct(LM_DATA *lmp, RCT *r);
|
||||
void lm_get_metrics( XI_OBJ_DEF *obj_def, int *hborder, int *column_div,
|
||||
int *list_bottom);
|
||||
RCT* lm_get_rect(LM lm, LM_PART part, int idx, RCT *rct);
|
||||
RCT* lm_get_row_rect(RCT *rctp, LM lm, int row);
|
||||
void lm_get_sel(LM lm, int *c1, int *c2);
|
||||
char* lm_get_text( LM lm, char *s, int len, int row, int column,
|
||||
void calculate_pix_offsets( LM_DATA * lmp, BOOLEAN draw_changes );
|
||||
void calculate_visibles( LM_DATA * lmp );
|
||||
void calc_x_pix_pos( LM lm, LM_COLUMN_DATA * lcdata, int position );
|
||||
BOOLEAN
|
||||
do_lm_cb( LM lm, LM_CB_TYPE cb_reason, int row, int column,
|
||||
XinEvent * ep, int *percent, int pixels );
|
||||
BOOLEAN
|
||||
do_lm_cb_get( LM lm, LM_CB_TYPE cb_reason, long *spec_rec,
|
||||
long *data_rec, int percent, XinColor * color,
|
||||
unsigned long *attrib, int *row_height );
|
||||
void do_lm_cb_text( LM_DATA * lmp, int row, int col, BOOLEAN preserve_focus );
|
||||
void do_scroll_bar( XI_LIST_DATA * listdata );
|
||||
BOOLEAN lm_adj_h( LM_DATA * lmp, short *h );
|
||||
void lm_allocate_rec_info( LM_DATA * lmp, int realized_rows_array_len );
|
||||
void lm_calc_last_vis( LM_DATA * lmp );
|
||||
int lm_calculate_row_height( LM_DATA * lmp, int row );
|
||||
void lm_cell_request( LM lm, LM_PART lm_part, int idx1, int idx2 );
|
||||
void lm_column_set_pixel_width( LM lm, int idx, int width );
|
||||
LM lm_create( XinWindow win, LM_DEF * lm_def, void *parent );
|
||||
void
|
||||
lm_create_column( LM lm, LM_COLUMN_DEF * lm_column_def,
|
||||
BOOLEAN do_cell_requests, BOOLEAN in_hscrolling );
|
||||
void lm_cleanup( LM lm );
|
||||
void lm_delete( LM lm );
|
||||
void lm_delete_column( LM lm, int column_nbr, BOOLEAN adjust_hscrolling );
|
||||
BOOLEAN lm_delete_row( LM lm, int row );
|
||||
void lm_draw_line( LM_DATA * lmp, XinPoint p, BOOLEAN adj_v, BOOLEAN adj_h );
|
||||
int lm_event( XI_OBJ* itf, LM lm, XinEvent * ep );
|
||||
void
|
||||
lm_focus_cb( long lm, int row, int column, BOOLEAN invisible,
|
||||
BOOLEAN set );
|
||||
unsigned long
|
||||
lm_get_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
|
||||
BOOLEAN invisible );
|
||||
void lm_get_vertical_metrics( XI_OBJ_DEF* obj_def, int* first_row_y,
|
||||
int* row_spacing, int *client_height,
|
||||
int* title_height );
|
||||
void lm_get_visible_columns(LM lm, int *first_vis, int *last_vis);
|
||||
int lm_get_visible_rows(LM lm, int *first_vis, int *last_vis);
|
||||
void lm_hscroll(LM lm, int nbr_columns, int pos);
|
||||
BOOLEAN lm_insert_row(LM lm, int row);
|
||||
BOOLEAN lm_is_cell_visible(LM_DATA *lmp, int focus_row, int focus_column,
|
||||
BOOLEAN use_txt_is_visible, BOOLEAN *is_hscrolled);
|
||||
int lm_get_buf_size( LM lm, LM_PART part, int idx );
|
||||
int lm_get_cid( LM lm );
|
||||
XinRect *
|
||||
lm_get_cell_rect( XinRect * rctp, LM lm, int row, int col, BOOLEAN inner,
|
||||
BOOLEAN physical_rct );
|
||||
int lm_get_col_spacing( void );
|
||||
int lm_get_fixed_columns( LM lm );
|
||||
int lm_get_left_most_far_right_col( LM_DATA * lmp, int nbr_columns );
|
||||
long *lm_get_list_info( LM lm, int *nbr_recs );
|
||||
XI_OBJ *lm_get_list_obj( LM lm );
|
||||
XinRect *lm_get_list_rct( LM_DATA * lmp, XinRect * r );
|
||||
void
|
||||
lm_get_metrics( XI_OBJ_DEF * obj_def, int *hborder, int *column_div,
|
||||
int *list_bottom );
|
||||
XinRect *lm_get_rect( LM lm, LM_PART part, int idx, XinRect * rct );
|
||||
XinRect *lm_get_row_rect( XinRect * rctp, LM lm, int row );
|
||||
void lm_get_sel( LM lm, int *c1, int *c2 );
|
||||
char *
|
||||
lm_get_text( LM lm, char *s, int len, int row, int column,
|
||||
BOOLEAN invisible );
|
||||
void
|
||||
lm_get_vertical_metrics( XI_OBJ_DEF * obj_def, int *first_row_y,
|
||||
int *row_spacing, int *client_height,
|
||||
int *title_height );
|
||||
void lm_get_visible_columns( LM lm, int *first_vis, int *last_vis );
|
||||
int lm_get_visible_rows( LM lm, int *first_vis, int *last_vis );
|
||||
int lm_hit_test( LM lm, XinEvent* ep, XinEvent* oevt, int* rowp, int* columnp,
|
||||
BOOLEAN* is_vis, BOOLEAN* is_hit, BOOLEAN* is_part_vis );
|
||||
void lm_hscroll( LM lm, int nbr_columns, int pos );
|
||||
BOOLEAN lm_insert_row( LM lm, int row );
|
||||
|
||||
void lm_invalidate_rect(LM_DATA *lmp, RCT *rctp, BOOLEAN adj_h);
|
||||
void lm_invalidate_rect2( LM_DATA *lmp, RCT *rct_to_invalidate,
|
||||
BOOLEAN adj_left);
|
||||
void lm_invalidate_rows( LM lm, int row_start, int row_end,
|
||||
BOOLEAN invalidate);
|
||||
void lm_invalidate_rows_internal(LM lm, int row_start, int row_end,
|
||||
BOOLEAN redraw, int column,
|
||||
BOOLEAN preserve_focus_text );
|
||||
BOOLEAN lm_list_has_focus(LM_DATA *lmp);
|
||||
void lm_local_hscroll(LM lm, int nbr_columns);
|
||||
void lm_make_invis(LM_DATA *lmp);
|
||||
void lm_make_vis(LM_DATA *lmp);
|
||||
void lm_move_event(LM_DATA *lmp, EVENT *ep);
|
||||
void lm_move_to(LM_DATA *lmp, PNT p, BOOLEAN adj_v, BOOLEAN adj_h);
|
||||
void lm_recalc_metrics(LM lm);
|
||||
void lm_redraw_row(LM_DATA *lmp, int row, BOOLEAN update );
|
||||
void lm_remove_all_rows( LM_DATA far* lm, BOOLEAN delete_focus );
|
||||
BOOLEAN lm_row_has_focus( LM_DATA *lmp, int row, BOOLEAN is_vert_scrolled);
|
||||
int lm_scroll(LM_SCROLL_ARG *arg);
|
||||
void lm_scroll_rect(LM_DATA *lmp, RCT *rctp, int dh, int dv);
|
||||
void lm_set_fixed_columns( LM lm, int new_fixed_count );
|
||||
void lm_set_focus_cell( LM_DATA *lmp, int row, int column,
|
||||
BOOLEAN is_vert_scrolled );
|
||||
void lm_set_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
|
||||
BOOLEAN invisible, unsigned long attrib,
|
||||
int half_baked);
|
||||
void lm_set_buf_size(LM lm, LM_PART part, int idx, int size);
|
||||
void lm_set_column_width(LM lm, int idx, int width);
|
||||
void lm_set_color( LM lm, LM_PART part, int row, int column,
|
||||
BOOLEAN invisible, COLOR color, BOOLEAN half_baked);
|
||||
void lm_set_fixed_columns( LM lm, int new_fixed_count );
|
||||
void lm_set_hscroll_bar(LM lm);
|
||||
void lm_set_hscroll_range(LM lm);
|
||||
void lm_set_icon(LM lm, int icon_rid, int row, int column);
|
||||
void lm_set_focus(LM lm, int row, int column);
|
||||
void lm_set_focus_text( LM_DATA* lmp, const char* new_text );
|
||||
void lm_set_font(LM lm, LM_PART part, int idx, int idx2, FONT_OBJ *font);
|
||||
void lm_set_list_size(LM lm, int height, int width);
|
||||
void lm_set_row_height(LM lm, int row, int height, BOOLEAN set_height,
|
||||
int old_height, BOOLEAN only_update);
|
||||
void lm_set_sel( LM lm, int row, int column, BOOLEAN invisible, int c1,
|
||||
int c2 );
|
||||
void lm_set_text(LM lm, char *s, int row, int column, BOOLEAN invisible);
|
||||
void lm_size_event(LM_DATA *lmp, EVENT *ep);
|
||||
void lm_text_scrolling(XI_OBJ *xi_obj);
|
||||
void lm_wrap_text(LM_DATA *lmp, int row, int col, BOOLEAN set_font);
|
||||
int lm_make_rrr_room_pix(LM_DATA *lmp, int pixels, BOOLEAN do_redraw );
|
||||
BOOLEAN navigate_char_event(LM lm, EVENT *ep);
|
||||
void redraw_cell(LM lm, int row, int col, BOOLEAN update );
|
||||
void select_row( LM lm, int row, int column, BOOLEAN dbl_click );
|
||||
void draw_cell_range( LM_DATA* lmp, int first_row, int last_row,
|
||||
void lm_invalidate_rect( LM_DATA * lmp, XinRect * rctp, BOOLEAN adj_h );
|
||||
void
|
||||
lm_invalidate_rect2( LM_DATA * lmp, XinRect * rct_to_invalidate,
|
||||
BOOLEAN adj_left );
|
||||
void
|
||||
lm_invalidate_rows( LM lm, int row_start, int row_end,
|
||||
BOOLEAN invalidate );
|
||||
void
|
||||
lm_invalidate_rows_internal( LM lm, int row_start, int row_end,
|
||||
BOOLEAN redraw, int column,
|
||||
BOOLEAN preserve_focus_text );
|
||||
void lm_local_hscroll( LM lm, int nbr_columns );
|
||||
void lm_move_event( LM_DATA * lmp, XinEvent * ep );
|
||||
void lm_drag_row_event( XI_OBJ* itf, LM_DATA* lmp, XinEvent* ep, XinEvent* oevp );
|
||||
void lm_move_to( LM_DATA * lmp, XinPoint p, BOOLEAN adj_v, BOOLEAN adj_h );
|
||||
void lm_recalc_metrics( LM lm );
|
||||
void lm_redraw_row( LM_DATA * lmp, int row, BOOLEAN update );
|
||||
void lm_remove_all_rows( LM_DATA * lm, BOOLEAN delete_focus );
|
||||
BOOLEAN lm_row_has_focus( LM_DATA * lmp, int row, BOOLEAN is_vert_scrolled );
|
||||
int lm_scroll( LM_SCROLL_ARG * arg );
|
||||
void lm_scroll_rect( LM_DATA * lmp, XinRect * rctp, int dh, int dv );
|
||||
void lm_set_fixed_columns( LM lm, int new_fixed_count );
|
||||
void
|
||||
lm_set_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
|
||||
BOOLEAN invisible, unsigned long attrib,
|
||||
int half_baked );
|
||||
void lm_set_buf_size( LM lm, LM_PART part, int idx, int size );
|
||||
void lm_set_column_bitmap( LM lm, XI_BITMAP* bitmap, int cid );
|
||||
void lm_set_column_icon( LM lm, int icon_rid, int cid );
|
||||
void lm_set_column_width( LM lm, int idx, int width );
|
||||
void
|
||||
lm_set_color( LM lm, LM_PART part, int row, int column,
|
||||
BOOLEAN invisible, XinColor color, BOOLEAN half_baked );
|
||||
void lm_set_fixed_columns( LM lm, int new_fixed_count );
|
||||
void lm_set_hscroll_bar( LM lm );
|
||||
void lm_set_hscroll_range( LM lm );
|
||||
void lm_set_bitmap( LM lm, XI_BITMAP* bitmap, int row, int column );
|
||||
void lm_set_icon( LM lm, int icon_rid, int row, int column );
|
||||
void lm_set_focus( LM lm, int row, int column );
|
||||
void lm_set_font( LM lm, LM_PART part, int idx, int idx2, XinFont * font );
|
||||
void lm_set_list_size( LM lm, int height, int width );
|
||||
void lm_set_rect( LM lm, XinRect *rect );
|
||||
void
|
||||
lm_set_row_height( LM lm, int row, int height, BOOLEAN set_height,
|
||||
int old_height, BOOLEAN only_update );
|
||||
void
|
||||
lm_set_sel( LM lm, int row, int column, BOOLEAN invisible, int c1,
|
||||
int c2 );
|
||||
void lm_set_text( LM lm, char *s, int row, int column, BOOLEAN invisible );
|
||||
void lm_size_event( LM_DATA * lmp, XinEvent * ep );
|
||||
void lm_text_scrolling( XI_OBJ * xi_obj );
|
||||
void lm_wrap_text( LM_DATA * lmp, int row, int col, BOOLEAN set_font );
|
||||
int lm_make_rrr_room_pix( LM_DATA * lmp, int pixels, BOOLEAN do_redraw );
|
||||
BOOLEAN navigate_char_event( LM lm, XinEvent * ep );
|
||||
void redraw_cell( LM lm, int row, int col, BOOLEAN update );
|
||||
void
|
||||
draw_cell_range( LM_DATA * lmp, int first_row, int last_row,
|
||||
int first_col, int last_col,
|
||||
BOOLEAN in_event_update );
|
||||
|
||||
|
||||
XinRect *lm_get_scroll_rct( LM_DATA * lmp, XinRect * r );
|
||||
void lm_do_rec_event( LM_DATA * lmp, int row, XI_EVENT_TYPE type );
|
||||
void lm_row_copy( LM_DATA * lmp, int source_row, int dest_row );
|
||||
void lm_adjust_rows( LM_DATA * lmp, int delta );
|
||||
void set_focus_cell_rct( LM_DATA * lmp, int row, int col, BOOLEAN in_update_event );
|
||||
XI_TEXT *lm_xi_text_focus_get( LM lm );
|
||||
void lm_calculate_pix_offsets( LM lm );
|
||||
void lm_xi_text_prect_get( LM_DATA * lmp, LM_COLUMN_DATA * column_data,
|
||||
LM_CELL_DATA * cell_data, int row, int col, int col_offset,
|
||||
int leading, int ascent, int descent, XinRect * rctp );
|
||||
BOOLEAN lm_cr_is_ok( LM lm, int row, int col, BOOLEAN v_scrolled );
|
||||
BOOLEAN lm_is_button_full_cell( LM lm, int row, int col );
|
||||
void lm_xi_text_construct( LM_DATA * lmp, int row, int column );
|
||||
|
||||
#define LMP(l) ((LM_DATA *)(l))
|
||||
|
||||
#if XVT_OS == XVT_OS_CTOS
|
||||
#define RULE_Y_OFFSET_TOP ((npctos_env == CHSERVICE) ? 0 : 1)
|
||||
#define RULE_Y_OFFSET_BOTTOM ((npctos_env == CHSERVICE) ? 0 : 1)
|
||||
#define BORDER_WIDTH ((npctos_env == CHSERVICE) ? 8 : 2)
|
||||
#define RULE_WIDTH_V ((npctos_env == CHSERVICE) ? 8 : 1)
|
||||
#define RULE_WIDTH_H ((npctos_env == CHSERVICE) ? 0 : 1)
|
||||
#define HPIX_PER_CH 8
|
||||
#define VPIX_PER_CH 8
|
||||
#define WIDTHLOOP(idx, wid) for (idx = 0; idx < wid; idx++)
|
||||
#else
|
||||
#if XIWS == WMWS
|
||||
#if XIWS == XIWS_WM
|
||||
#define RULE_Y_OFFSET_TOP 0
|
||||
#define RULE_Y_OFFSET_BOTTOM 0
|
||||
#define BORDER_WIDTH 8
|
||||
#define RULE_WIDTH_V 8 /* width of vertical lines */
|
||||
#define RULE_WIDTH_H 0 /* width of horz lines */
|
||||
#define RULE_WIDTH_V 8 /* width of vertical lines */
|
||||
#define RULE_WIDTH_H 0 /* width of horz lines */
|
||||
#define HPIX_PER_CH 8
|
||||
#define VPIX_PER_CH 8
|
||||
#else
|
||||
@ -632,14 +667,8 @@ void draw_cell_range( LM_DATA* lmp, int first_row, int last_row,
|
||||
#define RULE_WIDTH_H 1
|
||||
#define WIDTHLOOP(idx, wid) for (idx = 0; idx < wid; idx++)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define ROW_IS_ENABLED(lm, row) (LMP(lm)->row_attribs[row] & LM_ROW_ATR_ENABLED)
|
||||
#define CELL_IS_ENABLED(lm, row, col) (LIST_IS_ENABLED(lm) && ROW_IS_ENABLED(lm, row) && COLUMN_IS_ENABLED(lm, col))
|
||||
#else
|
||||
#define CELL_IS_ENABLED(lm, row, col) (LIST_IS_ENABLED(lm) && COLUMN_IS_ENABLED(lm, col))
|
||||
#endif
|
||||
#define CELL_IS_SELECTED(lm, row, col) ((LMP(lm)->row_attribs[row] & LM_ROW_ATR_SELECTED) || (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTED) || \
|
||||
(LMP(lm)->cell_data[row][col].attrib & LM_CELL_ATR_SELECTED))
|
||||
#define CELL_IS_SELECTABLE(lm, row, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTABLE)
|
||||
@ -647,4 +676,4 @@ void draw_cell_range( LM_DATA* lmp, int first_row, int last_row,
|
||||
#define COLUMN_IS_ENABLED(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_ENABLED)
|
||||
#define COLUMN_IS_SELECTABLE(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_COL_SELECTABLE)
|
||||
#define COLUMN_IS_SELECTED(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTED)
|
||||
|
||||
#define COLUMN_IS_PUSHED(lm, col) (LMP(lm)->lm_column_data[col]->pushed)
|
||||
|
5467
xi/xilm2.c
5467
xi/xilm2.c
File diff suppressed because it is too large
Load Diff
4861
xi/xilm3.c
Executable file
4861
xi/xilm3.c
Executable file
File diff suppressed because it is too large
Load Diff
914
xi/xilmst.c
Executable file
914
xi/xilmst.c
Executable file
@ -0,0 +1,914 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#define XI_INTERNAL
|
||||
#include "xi.h"
|
||||
#include "xitext.h"
|
||||
#include "xilm.h"
|
||||
#include "xilmst.h"
|
||||
#include "xiutils.h"
|
||||
#include "xidisply.h"
|
||||
|
||||
void
|
||||
lm_focus_set( long lm, int row, int column, BOOLEAN v_scrolled, BOOLEAN set )
|
||||
{
|
||||
LM_DATA *lmp = ( LM_DATA * ) lm;
|
||||
|
||||
if ( set )
|
||||
{
|
||||
LM_FOCUS_CELL_VISIBLE_FORCE_ARGS args;
|
||||
|
||||
MEMCLEAR( args );
|
||||
args.lmp = lmp;
|
||||
args.row = row;
|
||||
args.column = column;
|
||||
args.vert_scrolled = v_scrolled;
|
||||
lm_focus_cell_visible_force( &args );
|
||||
}
|
||||
else
|
||||
{
|
||||
lm_focus_remove( lmp, row, column, v_scrolled );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_visible_force( LM_FOCUS_CELL_VISIBLE_FORCE_ARGS * args )
|
||||
{
|
||||
/*
|
||||
LM_DATA *lmp;
|
||||
int row;
|
||||
int column;
|
||||
int vert_scrolled;
|
||||
*/
|
||||
LM_DATA *lmp = args->lmp;
|
||||
LM_COLUMN_DATA *lmcdp;
|
||||
unsigned long attrib,
|
||||
cell_attrib;
|
||||
int c;
|
||||
XinRect mr;
|
||||
int focus_row,
|
||||
focus_column;
|
||||
BOOLEAN v_scrolled;
|
||||
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
if ( focus_row == args->row &&
|
||||
focus_column == args->column &&
|
||||
v_scrolled == FALSE &&
|
||||
lm_focus_state_get( lmp ) == LM_FOCUS_VISIBLE )
|
||||
return;
|
||||
/* force a vertically scrolled row to be visible */
|
||||
if ( lm_focus_state_get( lmp ) == LM_FOCUS_VERTICALLY_SCROLLED )
|
||||
{
|
||||
LM_SCROLL_ARG lm_scroll_arg;
|
||||
int row;
|
||||
BOOLEAN found = FALSE;
|
||||
|
||||
for ( row = 0; row < lmp->nbr_realized_rows; ++row )
|
||||
{
|
||||
if ( lmp->focus_state->focus_rec == lmp->recs[row] )
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !found )
|
||||
{
|
||||
MEMCLEAR( lm_scroll_arg );
|
||||
lm_scroll_arg.lm = ( LM ) lmp;
|
||||
/* lm_scroll_arg.nbr_lines = 0; lm_scroll_arg.percent = 0;
|
||||
* lm_scroll_arg.same_cell = 0; */
|
||||
lm_scroll_arg.rec = lmp->focus_state->focus_rec;
|
||||
lm_scroll_arg.have_rec = TRUE;
|
||||
lm_scroll_arg.color = lmp->focus_state->focus_rec_color;
|
||||
lm_scroll_arg.attrib = lmp->focus_state->focus_rec_attrib;
|
||||
lm_scroll_arg.row_height = lmp->focus_state->focus_rec_height;
|
||||
lm_scroll_arg.rec_at_top = lmp->focus_state->focus_rec_is_above;
|
||||
lm_scroll( &lm_scroll_arg );
|
||||
XinWindowPaintForce( lmp->win );
|
||||
}
|
||||
}
|
||||
|
||||
mr = lmp->mlr;
|
||||
if ( lmp->pixel_width )
|
||||
mr.right = mr.left + lmp->pixel_width + BORDER_WIDTH;
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
lmcdp = lmp->lm_column_data[focus_column];
|
||||
attrib = lmcdp->attrib;
|
||||
|
||||
cell_attrib = lm_get_attrib( ( LM ) lmp, LM_CELL, focus_row, focus_column,
|
||||
v_scrolled ) & ( XI_ATR_HCENTER | XI_ATR_RJUST );
|
||||
if ( cell_attrib )
|
||||
{
|
||||
attrib &= ~( XI_ATR_HCENTER | XI_ATR_RJUST );
|
||||
attrib |= cell_attrib;
|
||||
}
|
||||
|
||||
/* force cell to be visible */
|
||||
c = min( focus_column, lmp->nbr_columns - 1 );
|
||||
if ( c >= lmp->fixed_columns && c < lmp->first_vis )
|
||||
lm_local_hscroll( ( LM ) lmp, c - lmp->first_vis );
|
||||
else
|
||||
{
|
||||
if ( c > lmp->last_vis )
|
||||
{
|
||||
int first_col;
|
||||
|
||||
c++;
|
||||
c = min( c, lmp->nbr_columns );
|
||||
first_col = lm_get_left_most_far_right_col( lmp, c );
|
||||
lm_local_hscroll( ( LM ) lmp, first_col - lmp->first_vis );
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* this should never get executed */
|
||||
if ( focus_row < lmp->first_fully_vis )
|
||||
{
|
||||
int delta,
|
||||
idx2,
|
||||
pix2,
|
||||
old_pix;
|
||||
XinRect tmp_rct;
|
||||
|
||||
make_room_rows( lmp, focus_row - lmp->first_fully_vis, FALSE );
|
||||
idx2 = focus_row;
|
||||
pix2 = lmp->pix_offsets[idx2];
|
||||
old_pix = -lmp->rrr_offset;
|
||||
delta = old_pix - pix2;
|
||||
lmp->rrr_offset += delta;
|
||||
calculate_pix_offsets( lmp, FALSE );
|
||||
if ( !lmp->itf_obj->v.itf->half_baked )
|
||||
XinWindowPaintForce( lmp->win );
|
||||
xi_set_update_obj( lmp->list_obj );
|
||||
lm_get_scroll_rct( lmp, &tmp_rct );
|
||||
xi_scroll_rect( lmp->win, &tmp_rct, 0, delta );
|
||||
do_scroll_bar( lmp->list_obj->v.list );
|
||||
}
|
||||
#endif
|
||||
if ( focus_row > lmp->last_fully_vis )
|
||||
{
|
||||
int pix,
|
||||
delta;
|
||||
XinRect tmp_rct;
|
||||
|
||||
delta = 0;
|
||||
while ( TRUE )
|
||||
{
|
||||
if ( focus_row <= lmp->last_fully_vis )
|
||||
break;
|
||||
pix = lmp->pix_heights[0];
|
||||
delta += pix;
|
||||
lm_make_rrr_room_pix( lmp, pix, FALSE );
|
||||
lmp->rrr_offset -= pix;
|
||||
calculate_pix_offsets( lmp, FALSE );
|
||||
calculate_visibles( lmp );
|
||||
}
|
||||
if ( !lmp->itf_obj->v.itf->half_baked )
|
||||
XinWindowPaintForce( lmp->win );
|
||||
xi_set_update_obj( lmp->list_obj );
|
||||
lm_get_scroll_rct( lmp, &tmp_rct );
|
||||
xi_scroll_rect( lmp->win, &tmp_rct, 0, -delta );
|
||||
do_scroll_bar( lmp->list_obj->v.list );
|
||||
|
||||
if ( !lmp->get_all_records )
|
||||
{
|
||||
int nbr_to_free,
|
||||
cnt,
|
||||
i,
|
||||
idx;
|
||||
|
||||
nbr_to_free = lmp->first_fully_vis;
|
||||
if ( nbr_to_free > 0 )
|
||||
{
|
||||
for ( cnt = 0; cnt < nbr_to_free; cnt++ )
|
||||
{
|
||||
lmp->rrr_offset += lmp->pix_heights[cnt];
|
||||
lm_do_rec_event( lmp, cnt, XIE_REC_FREE );
|
||||
}
|
||||
|
||||
for ( idx = nbr_to_free; idx < lmp->nbr_realized_rows; ++idx )
|
||||
lm_row_copy( lmp, idx, idx - nbr_to_free );
|
||||
lm_adjust_rows( lmp, -nbr_to_free );
|
||||
|
||||
lmp->nbr_realized_rows -= cnt;
|
||||
}
|
||||
|
||||
/* free any unnecessary records at the end of the list */
|
||||
nbr_to_free = lmp->nbr_realized_rows - ( lmp->last_fully_vis + 2 );
|
||||
if ( nbr_to_free > 0 )
|
||||
{
|
||||
for ( i = lmp->nbr_realized_rows - nbr_to_free, cnt = 0; cnt < nbr_to_free;
|
||||
i++, cnt++ )
|
||||
lm_do_rec_event( lmp, i, XIE_REC_FREE );
|
||||
lmp->nbr_realized_rows -= cnt;
|
||||
}
|
||||
|
||||
calculate_pix_offsets( lmp, TRUE );
|
||||
}
|
||||
}
|
||||
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
|
||||
lm_focus_cell_visible_attempt( lmp );
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_text_set( LM_DATA * lmp, BOOLEAN preserve_focus_text, char *s,
|
||||
int row, int col, BOOLEAN v_scrolled )
|
||||
{
|
||||
int focus_row,
|
||||
focus_column;
|
||||
BOOLEAN focus_v_scrolled;
|
||||
|
||||
if ( lm_focus_list_has( lmp ) )
|
||||
{
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &focus_v_scrolled );
|
||||
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE &&
|
||||
row == focus_row &&
|
||||
col == focus_column &&
|
||||
v_scrolled == focus_v_scrolled &&
|
||||
preserve_focus_text != TRUE )
|
||||
{
|
||||
int len;
|
||||
LM_COLUMN_DATA *lm_column_data;
|
||||
int pix_spacing;
|
||||
LM_CELL_DATA *cell_data;
|
||||
|
||||
len = strlen( s ) + 1;
|
||||
if ( lmp->focus_state->focus_cell_text )
|
||||
lmp->focus_state->focus_cell_text = ( char * ) xi_tree_realloc( lmp->focus_state->focus_cell_text, len );
|
||||
else
|
||||
lmp->focus_state->focus_cell_text = ( char * ) xi_tree_malloc( len, lmp );
|
||||
strcpy( lmp->focus_state->focus_cell_text, s );
|
||||
lm_column_data = lmp->lm_column_data[focus_column];
|
||||
cell_data = &lmp->cell_data[focus_row][focus_column];
|
||||
pix_spacing = lm_column_data->pix_width -
|
||||
( cell_data->button ? lmp->pix_row_spacing : 0 );
|
||||
xi_text_pix_width_and_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text,
|
||||
pix_spacing, TRUE );
|
||||
if ( lmp->lm_column_data[col]->attrib | XI_ATR_AUTOSELECT )
|
||||
{
|
||||
lmp->focus_state->focus_cell_ip1 = 0;
|
||||
lmp->focus_state->focus_cell_ip2 = strlen( s );
|
||||
}
|
||||
else
|
||||
{
|
||||
lmp->focus_state->focus_cell_ip1 = 0;
|
||||
lmp->focus_state->focus_cell_ip2 = 0;
|
||||
}
|
||||
lmp->focus_state->button = cell_data->button;
|
||||
lmp->focus_state->button_full_cell = cell_data->button_full_cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
lm_focus_rec_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->focus_rec;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
lm_focus_cell_has( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled )
|
||||
{
|
||||
XI_ITF_DATA *itf;
|
||||
XI_OBJ *focus_obj;
|
||||
XI_CELL_DATA *cd;
|
||||
|
||||
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
|
||||
return FALSE;
|
||||
itf = lmp->itf_obj->v.itf;
|
||||
focus_obj = itf->focus_obj;
|
||||
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
|
||||
focus_obj->type == XIT_CELL )
|
||||
{
|
||||
cd = &focus_obj->v.cell;
|
||||
return ( cd->row == row && cd->column == column
|
||||
&& cd->is_vert_scrolled == v_scrolled );
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_rec_color_set( LM_DATA * lmp, XinColor color )
|
||||
{
|
||||
lmp->focus_state->focus_rec_color = color;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_attrib_set( LM_DATA * lmp, unsigned long attrib )
|
||||
{
|
||||
lmp->focus_state->focus_cell_attrib = attrib;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_selection_get( LM_DATA * lmp, int *c1, int *c2 )
|
||||
{
|
||||
if ( lm_focus_list_has( lmp ) )
|
||||
{
|
||||
XI_TEXT *text;
|
||||
|
||||
text = xi_text_focus_get( lmp->win );
|
||||
if ( text )
|
||||
xi_text_selection_get( text, c1, c2 );
|
||||
}
|
||||
else
|
||||
*c1 = *c2 = 0;
|
||||
}
|
||||
|
||||
char *
|
||||
lm_focus_cell_text_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->focus_cell_text;
|
||||
}
|
||||
|
||||
LM_FOCUS
|
||||
lm_focus_state_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->where;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
function: lm_stop_edit
|
||||
lm: current lm
|
||||
-------------------------------------------------------------------------*/
|
||||
static void
|
||||
lm_stop_edit( LM lm, BOOLEAN do_update, int row, int column, LM_FOCUS state_was )
|
||||
{
|
||||
LM_DATA *lmp = LMP( lm );
|
||||
XI_TEXT *text;
|
||||
LM_CELL_DATA *cell_data;
|
||||
|
||||
cell_data = &lmp->cell_data[row][column];
|
||||
text = cell_data->xi_text;
|
||||
if ( text && !cell_data->button_full_cell )
|
||||
{
|
||||
xi_text_editing_stop( text );
|
||||
XinWindowPaintForce( lmp->win );
|
||||
}
|
||||
/* if lmp->row_focus_border is TRUE, don't redraw, because old focus row will
|
||||
* be invalidated */
|
||||
if ( ( do_update && state_was == LM_FOCUS_VISIBLE ) ||
|
||||
do_update && cell_data->button_full_cell )
|
||||
redraw_cell( lm, row, column, FALSE );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/* lm_focus_cell_is_visible */
|
||||
/* ------------------------------------------------------------------- */
|
||||
/*
|
||||
TODO it is possible here that focus has been moved such that it is now
|
||||
visible, but the state still indicates that it is not.
|
||||
*/
|
||||
BOOLEAN
|
||||
lm_focus_cell_is_visible( LM_DATA * lmp, BOOLEAN * is_hscrolled )
|
||||
{
|
||||
if ( is_hscrolled )
|
||||
*is_hscrolled = FALSE;
|
||||
if ( lm_focus_state_get( lmp ) == LM_FOCUS_HORIZONTALLY_SCROLLED )
|
||||
{
|
||||
*is_hscrolled = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
return ( lm_focus_state_get( lmp ) == LM_FOCUS_VISIBLE );
|
||||
}
|
||||
|
||||
/*
|
||||
Semantics: this function attempts to make the focus be visible.
|
||||
It then sets the state as appropriate. If it succeeded, then
|
||||
it sets state to LM_FOCUS_VISIBLE. If it failed, then it sets
|
||||
focus to LM_FOCUS_VERTICALLY_SCROLLED or LM_FOCUS_HORIZONTALLY_SCROLLED.
|
||||
*/
|
||||
void
|
||||
lm_focus_cell_visible_attempt( LM_DATA * lmp )
|
||||
{
|
||||
int focus_row,
|
||||
focus_column;
|
||||
BOOLEAN v_scrolled;
|
||||
|
||||
if ( !lm_focus_list_has( lmp ) )
|
||||
return;
|
||||
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
if ( focus_column < lmp->fixed_columns ||
|
||||
( focus_column >= lmp->first_vis &&
|
||||
focus_column <= lmp->last_vis ) )
|
||||
{
|
||||
LM_COLUMN_DATA *lm_column_data;
|
||||
XinRect cell_r;
|
||||
unsigned long attrib,
|
||||
cell_attrib;
|
||||
LM_CELL_DATA *cell_data;
|
||||
XinRect mr;
|
||||
BOOLEAN text_was_invisible;
|
||||
LM_FOCUS focus;
|
||||
int leading,
|
||||
ascent,
|
||||
descent;
|
||||
int col_offset;
|
||||
|
||||
col_offset = ( int ) xi_get_pref( XI_PREF_COLUMN_OFFSET );
|
||||
|
||||
if ( lm_focus_state_get( lmp ) == LM_FOCUS_VERTICALLY_SCROLLED ||
|
||||
lm_focus_state_get( lmp ) == LM_FOCUS_TEMP_INVISIBLE )
|
||||
{
|
||||
int cnt;
|
||||
|
||||
for ( cnt = 0; cnt < lmp->nbr_realized_rows; ++cnt )
|
||||
{
|
||||
if ( lmp->recs[cnt] == lmp->focus_state->focus_rec )
|
||||
{
|
||||
if ( cnt <= lmp->last_fully_vis )
|
||||
{
|
||||
lm_focus_cell_set( lmp, cnt, focus_column, FALSE );
|
||||
focus_row = cnt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( cnt > lmp->last_fully_vis )
|
||||
{
|
||||
lmp->focus_state->where = LM_FOCUS_VERTICALLY_SCROLLED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
focus = lm_focus_state_get( lmp );
|
||||
text_was_invisible = FALSE;
|
||||
if ( focus == LM_FOCUS_HORIZONTALLY_SCROLLED ||
|
||||
focus == LM_FOCUS_VERTICALLY_SCROLLED ||
|
||||
focus == LM_FOCUS_TEMP_INVISIBLE )
|
||||
text_was_invisible = TRUE;
|
||||
mr = lmp->mlr;
|
||||
if ( lmp->pixel_width )
|
||||
mr.right = mr.left + lmp->pixel_width;
|
||||
lm_column_data = lmp->lm_column_data[focus_column];
|
||||
attrib = lm_column_data->attrib;
|
||||
cell_data = &lmp->cell_data[focus_row][focus_column];
|
||||
if ( cell_data->xi_text != NULL )
|
||||
xi_text_clip_set( cell_data->xi_text, &mr );
|
||||
if ( text_was_invisible )
|
||||
{
|
||||
cell_data->attrib = lmp->focus_state->focus_cell_attrib;
|
||||
if ( cell_data->font )
|
||||
XinFontDestroy( cell_data->font );
|
||||
if ( lmp->focus_state->focus_cell_font )
|
||||
{
|
||||
XinFontCopy( &cell_data->font, lmp->focus_state->focus_cell_font );
|
||||
if ( cell_data->xi_text != NULL )
|
||||
xi_text_font_set( cell_data->xi_text, cell_data->font );
|
||||
} else
|
||||
cell_data->font = NULL;
|
||||
cell_data->color = lmp->focus_state->focus_cell_color;
|
||||
cell_data->back_color = lmp->focus_state->focus_cell_back_color;
|
||||
cell_data->button = lmp->focus_state->button;
|
||||
cell_data->button_full_cell = lmp->focus_state->button_full_cell;
|
||||
cell_data->button_on_left = lmp->focus_state->button_on_left;
|
||||
cell_data->button_icon_rid = lmp->focus_state->button_icon_rid;
|
||||
cell_data->button_bitmap = lmp->focus_state->button_bitmap;
|
||||
}
|
||||
cell_attrib = cell_data->attrib & ( XI_ATR_HCENTER | XI_ATR_RJUST );
|
||||
if ( cell_attrib )
|
||||
{
|
||||
attrib &= ~( XI_ATR_HCENTER | XI_ATR_RJUST );
|
||||
attrib |= cell_attrib;
|
||||
}
|
||||
/* Create the focus cell */
|
||||
|
||||
if ( cell_data->button_full_cell )
|
||||
{
|
||||
lmp->cur_font = lmp->font;
|
||||
lmp->old_row_height = lmp->pix_heights[focus_row];
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
lmp->focus_state->where = LM_FOCUS_VISIBLE;
|
||||
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
lmp->cur_font = lmp->font;
|
||||
XinFontMetricsGet( lmp->cur_font, &leading, &ascent, &descent );
|
||||
lm_xi_text_prect_get( lmp, lm_column_data, cell_data, focus_row, focus_column,
|
||||
col_offset, leading, ascent, descent, &cell_r );
|
||||
if ( !lm_column_data->wrap_text )
|
||||
xi_text_pix_width_set( cell_data->xi_text, lm_column_data->pix_width -
|
||||
( cell_data->button ? lmp->pix_row_spacing : 0 ) );
|
||||
xi_text_prect_set( cell_data->xi_text, &cell_r );
|
||||
xi_text_color_fore_set( cell_data->xi_text, lmp->active_color );
|
||||
xi_text_color_back_set( cell_data->xi_text, lmp->active_back_color );
|
||||
if ( cell_data->back_color )
|
||||
xi_text_color_back_set( cell_data->xi_text, cell_data->back_color );
|
||||
if ( text_was_invisible )
|
||||
{
|
||||
xi_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text );
|
||||
}
|
||||
cell_data->valid_data = TRUE;
|
||||
lmp->old_row_height = lmp->pix_heights[focus_row];
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
if ( text_was_invisible )
|
||||
{
|
||||
LM_COLUMN_DATA *lm_column_data;
|
||||
int pix_spacing;
|
||||
|
||||
lm_column_data = lmp->lm_column_data[focus_column];
|
||||
pix_spacing = lm_column_data->pix_width -
|
||||
( cell_data->button ? lmp->pix_row_spacing : 0 );
|
||||
xi_text_pix_width_and_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text,
|
||||
pix_spacing, TRUE );
|
||||
xi_text_selection_set_internal( cell_data->xi_text,
|
||||
lmp->focus_state->focus_cell_ip1,
|
||||
lmp->focus_state->focus_cell_ip2,
|
||||
lmp->focus_state->focus_cell_start_ip, TRUE, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( lmp->have_mouse )
|
||||
{
|
||||
if ( ( lm_column_data->attrib & ( LM_COL_ATR_AUTOSELECT | LM_COL_ATR_READONLY ) ) ==
|
||||
( LM_COL_ATR_AUTOSELECT | LM_COL_ATR_READONLY ) )
|
||||
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
|
||||
else if ( ( lm_column_data->attrib & LM_COL_ATR_AUTOSELECT ) && xi_get_pref( XI_PREF_AUTOSEL_ON_MOUSE ) )
|
||||
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
|
||||
else
|
||||
xi_text_selection_set( cell_data->xi_text, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( lm_column_data->attrib & LM_COL_ATR_AUTOSELECT )
|
||||
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
|
||||
else
|
||||
xi_text_selection_set( cell_data->xi_text, 0, 0 );
|
||||
}
|
||||
}
|
||||
xi_text_editing_start( cell_data->xi_text );
|
||||
}
|
||||
lmp->focus_state->where = LM_FOCUS_VISIBLE;
|
||||
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VERTICALLY_SCROLLED )
|
||||
{
|
||||
lmp->focus_state->where = LM_FOCUS_HORIZONTALLY_SCROLLED;
|
||||
if ( lmp->focus_state->focus_rec )
|
||||
{
|
||||
int cnt;
|
||||
|
||||
/* the following loop should *always* find a row, because the only
|
||||
* reason the cell is not visible is because the list is horizontally
|
||||
* scrolled. */
|
||||
for ( cnt = 0; cnt < lmp->nbr_realized_rows; ++cnt )
|
||||
{
|
||||
if ( lmp->recs[cnt] == lmp->focus_state->focus_rec )
|
||||
{
|
||||
lm_focus_cell_set( lmp, cnt, focus_column, FALSE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( cnt == lmp->nbr_realized_rows )
|
||||
lmp->focus_state->where = LM_FOCUS_VERTICALLY_SCROLLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long
|
||||
lm_focus_rec_attrib_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->focus_rec_attrib;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
lm_focus_cell_attrib_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->focus_cell_attrib;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_invis_make( LM_DATA * lmp )
|
||||
{
|
||||
XI_TEXT *text;
|
||||
|
||||
if ( !lm_focus_list_has( lmp ) )
|
||||
return;
|
||||
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
|
||||
return;
|
||||
text = xi_text_focus_get( lmp->win );
|
||||
if ( text && xi_text_editing_is( text ) )
|
||||
{
|
||||
int focus_row,
|
||||
focus_column;
|
||||
int ip1,
|
||||
ip2,
|
||||
start_ip;
|
||||
BOOLEAN v_scrolled;
|
||||
LM_CELL_DATA *cell_data;
|
||||
XI_TEXT *text;
|
||||
|
||||
lmp->focus_state->where = LM_FOCUS_TEMP_INVISIBLE;
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
lmp->focus_state->focus_rec = lmp->recs[focus_row];
|
||||
lmp->focus_state->focus_rec_color = lmp->row_colors[focus_row];
|
||||
lmp->focus_state->focus_rec_attrib = lmp->row_attribs[focus_row];
|
||||
lmp->focus_state->focus_rec_height = lmp->pix_heights[focus_row];
|
||||
|
||||
cell_data = &lmp->cell_data[focus_row][focus_column];
|
||||
if ( lmp->focus_state->focus_cell_font )
|
||||
{
|
||||
XinFontDestroy( lmp->focus_state->focus_cell_font );
|
||||
lmp->focus_state->focus_cell_font = NULL;
|
||||
}
|
||||
if ( cell_data->font )
|
||||
XinFontCopy( &lmp->focus_state->focus_cell_font, cell_data->font );
|
||||
lmp->focus_state->focus_cell_color = cell_data->color;
|
||||
lmp->focus_state->focus_cell_back_color = cell_data->back_color;
|
||||
lmp->focus_state->focus_cell_attrib = cell_data->attrib;
|
||||
xi_text_selection_get_internal( cell_data->xi_text, &ip1, &ip2, &start_ip );
|
||||
lm_focus_cell_text_set( lmp, FALSE, xi_text_get( cell_data->xi_text ), focus_row,
|
||||
focus_column, FALSE );
|
||||
lmp->focus_state->focus_cell_ip1 = ip1;
|
||||
lmp->focus_state->focus_cell_ip2 = ip2;
|
||||
lmp->focus_state->focus_cell_start_ip = start_ip;
|
||||
lmp->focus_state->button = cell_data->button;
|
||||
lmp->focus_state->button_full_cell = cell_data->button_full_cell;
|
||||
lmp->focus_state->button_on_left = cell_data->button_on_left;
|
||||
lmp->focus_state->button_icon_rid = cell_data->button_icon_rid;
|
||||
lmp->focus_state->button_bitmap = cell_data->button_bitmap;
|
||||
if ( lmp->focus_state->focus_cell_ip1 != lmp->focus_state->focus_cell_ip2 )
|
||||
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
|
||||
text = xi_text_focus_get( lmp->win );
|
||||
xi_text_editing_stop( text );
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
lm_focus_list_has( LM_DATA * lmp )
|
||||
{
|
||||
XI_ITF_DATA *itf;
|
||||
BOOLEAN retval;
|
||||
|
||||
itf = lmp->itf_obj->v.itf;
|
||||
retval = ( itf->focus_obj != NULL && itf->focus_obj->parent == lmp->list_obj );
|
||||
return retval;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
lm_focus_cell_get( LM_DATA * lmp, int *rowp, int *columnp, BOOLEAN * is_vert_scrolled )
|
||||
{
|
||||
XI_ITF_DATA *itf;
|
||||
XI_OBJ *focus_obj;
|
||||
XI_CELL_DATA *cd;
|
||||
|
||||
itf = lmp->itf_obj->v.itf;
|
||||
focus_obj = itf->focus_obj;
|
||||
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
|
||||
focus_obj->type == XIT_CELL )
|
||||
{
|
||||
cd = &focus_obj->v.cell;
|
||||
*rowp = cd->row;
|
||||
*columnp = cd->column;
|
||||
*is_vert_scrolled = cd->is_vert_scrolled;
|
||||
return TRUE;
|
||||
}
|
||||
*rowp = 0;
|
||||
*columnp = 0;
|
||||
*is_vert_scrolled = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_set( LM_DATA * lmp, int row, int column, BOOLEAN is_vert_scrolled )
|
||||
{
|
||||
XI_ITF_DATA *itf;
|
||||
XI_OBJ *focus_obj;
|
||||
XI_CELL_DATA *cd;
|
||||
|
||||
itf = lmp->itf_obj->v.itf;
|
||||
focus_obj = itf->focus_obj;
|
||||
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
|
||||
focus_obj->type == XIT_CELL )
|
||||
{
|
||||
cd = &focus_obj->v.cell;
|
||||
cd->row = row;
|
||||
cd->column = column;
|
||||
cd->is_vert_scrolled = ( unsigned char ) is_vert_scrolled;
|
||||
return;
|
||||
}
|
||||
XinError( 20921, XinSeverityFatal, 0L );
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*-------------------------------------------------------------------------
|
||||
function: lm_start_edit
|
||||
lm: current lm
|
||||
row: relevant row
|
||||
column: relevant column
|
||||
notes: create a text core edit field in the position of the
|
||||
cell of interest, and copy in the necessary attributes
|
||||
and text from the list
|
||||
-------------------------------------------------------------------------*/
|
||||
static void
|
||||
lm_start_edit( LM lm, int row, int column )
|
||||
{
|
||||
LM_DATA *lmp = LMP( lm );
|
||||
int focus_row,
|
||||
focus_column;
|
||||
BOOLEAN v_scrolled;
|
||||
LM_FOCUS_CELL_VISIBLE_FORCE_ARGS args;
|
||||
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
if ( !( focus_row == row && focus_column == column ) )
|
||||
XinError( 30209, XinSeverityFatal, 0L );
|
||||
|
||||
MEMCLEAR( args );
|
||||
args.lmp = lmp;
|
||||
args.row = row;
|
||||
args.column = column;
|
||||
args.vert_scrolled = v_scrolled;
|
||||
lm_focus_cell_visible_force( &args );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
lm_focus_create_temp_row( LM_DATA * lmp )
|
||||
{
|
||||
int idx,
|
||||
focus_row,
|
||||
focus_column, i;
|
||||
BOOLEAN v_scrolled;
|
||||
LM_CELL_DATA *cell_data;
|
||||
|
||||
lm_allocate_rec_info( lmp, lmp->realized_rows_array_len + 1 );
|
||||
++lmp->nbr_realized_rows;
|
||||
idx = lmp->nbr_realized_rows - 1;
|
||||
lmp->recs[idx] = lm_focus_rec_get( lmp );
|
||||
/* cell_data_construct */
|
||||
cell_data = lmp->cell_data[idx];
|
||||
for ( i = 0; i < lmp->nbr_columns; ++i, ++cell_data )
|
||||
{
|
||||
memset( ( char * ) cell_data, '\0', sizeof( LM_CELL_DATA ) );
|
||||
lm_xi_text_construct( lmp, idx, i );
|
||||
}
|
||||
lmp->focus_state->saved_focus_rec = lm_focus_rec_get( lmp );
|
||||
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
|
||||
focus_row = idx;
|
||||
lm_focus_cell_set( lmp, focus_row, focus_column, TRUE );
|
||||
lm_invalidate_rows_internal( ( LM ) lmp, focus_row, focus_row, FALSE,
|
||||
focus_column, TRUE );
|
||||
calculate_pix_offsets( lmp, FALSE );
|
||||
calculate_visibles( lmp );
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_rec_free( LM_DATA * lmp )
|
||||
{
|
||||
LM_CB_DATA lm_cb_data;
|
||||
|
||||
lm_cb_data.lm = ( LM ) lmp;
|
||||
lm_cb_data.cb_type = LM_CB_REC_FREE;
|
||||
lm_cb_data.cid = lmp->cid;
|
||||
lm_cb_data.win = lmp->win;
|
||||
lm_cb_data.v.rec_free.record = lmp->focus_state->saved_focus_rec;
|
||||
( *lmp->lm_cb ) ( &lm_cb_data );
|
||||
lm_allocate_rec_info( lmp, lmp->nbr_realized_rows - 1 );
|
||||
--lmp->nbr_realized_rows;
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_remove( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled )
|
||||
{
|
||||
int idx;
|
||||
BOOLEAN found = FALSE;
|
||||
LM_FOCUS where_focus_was;
|
||||
|
||||
where_focus_was = lmp->focus_state->where;
|
||||
lmp->focus_state->where = LM_FOCUS_NOWHERE;
|
||||
if ( where_focus_was != LM_FOCUS_NOWHERE &&
|
||||
where_focus_was != LM_FOCUS_TEMP_INVISIBLE &&
|
||||
!v_scrolled )
|
||||
lm_stop_edit( ( LM ) lmp, TRUE, row, column, where_focus_was );
|
||||
if ( lmp->focus_state->focus_rec )
|
||||
{
|
||||
for ( idx = 0; idx < lmp->nbr_realized_rows; ++idx )
|
||||
{
|
||||
if ( lmp->recs[idx] == lmp->focus_state->focus_rec )
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( found )
|
||||
{
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
LM_CB_DATA lm_cb_data;
|
||||
|
||||
lm_cb_data.lm = ( LM ) lmp;
|
||||
lm_cb_data.cb_type = LM_CB_REC_FREE;
|
||||
lm_cb_data.cid = lmp->cid;
|
||||
lm_cb_data.win = lmp->win;
|
||||
lm_cb_data.v.rec_free.record = lmp->focus_state->focus_rec;
|
||||
( *lmp->lm_cb ) ( &lm_cb_data );
|
||||
lmp->focus_state->focus_rec = 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_selection_get( LM_DATA * lmp, int *c1, int *c2 )
|
||||
{
|
||||
LM_FOCUS state;
|
||||
|
||||
state = lm_focus_state_get( lmp );
|
||||
if ( state == LM_FOCUS_VISIBLE )
|
||||
{
|
||||
XI_TEXT *text;
|
||||
|
||||
text = xi_text_focus_get( lmp->win );
|
||||
if ( text && xi_text_editing_is( text ) )
|
||||
xi_text_selection_get( text, c1, c2 );
|
||||
else
|
||||
{
|
||||
*c1 = 0;
|
||||
*c2 = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( state == LM_FOCUS_HORIZONTALLY_SCROLLED ||
|
||||
state == LM_FOCUS_VERTICALLY_SCROLLED )
|
||||
{
|
||||
*c1 = lmp->focus_state->focus_cell_ip1;
|
||||
*c2 = lmp->focus_state->focus_cell_ip2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*c1 = 0;
|
||||
*c2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_cell_selection_set( LM_DATA * lmp, int c1, int c2 )
|
||||
{
|
||||
LM_FOCUS state;
|
||||
|
||||
state = lm_focus_state_get( lmp );
|
||||
if ( state == LM_FOCUS_VISIBLE )
|
||||
{
|
||||
XI_TEXT *text;
|
||||
|
||||
text = xi_text_focus_get( lmp->win );
|
||||
if ( text )
|
||||
xi_text_selection_set( text, c1, c2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( state == LM_FOCUS_HORIZONTALLY_SCROLLED ||
|
||||
state == LM_FOCUS_VERTICALLY_SCROLLED )
|
||||
{
|
||||
lmp->focus_state->focus_cell_ip1 = c1;
|
||||
lmp->focus_state->focus_cell_ip2 = c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_rec_is_above_set( LM_DATA * lmp, BOOLEAN is_above )
|
||||
{
|
||||
lmp->focus_state->focus_rec_is_above = is_above;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
lm_focus_rec_is_above_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->focus_rec_is_above;
|
||||
}
|
||||
|
||||
void
|
||||
lm_focus_rec_set( LM_DATA * lmp, long focus_rec )
|
||||
{
|
||||
lmp->focus_state->focus_rec = focus_rec;
|
||||
}
|
||||
|
||||
long
|
||||
lm_focus_rec_saved_get( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->saved_focus_rec;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
lm_focus_cell_is_button_full_cell( LM_DATA * lmp )
|
||||
{
|
||||
return lmp->focus_state->button_full_cell;
|
||||
}
|
96
xi/xilmst.h
Executable file
96
xi/xilmst.h
Executable file
@ -0,0 +1,96 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LM_FOCUS_NOWHERE,
|
||||
LM_FOCUS_VISIBLE,
|
||||
LM_FOCUS_HORIZONTALLY_SCROLLED,
|
||||
LM_FOCUS_VERTICALLY_SCROLLED,
|
||||
LM_FOCUS_TEMP_INVISIBLE
|
||||
} LM_FOCUS;
|
||||
|
||||
typedef struct _lm_focus_state
|
||||
{
|
||||
LM_FOCUS where;
|
||||
long focus_rec;
|
||||
long saved_focus_rec;
|
||||
BOOLEAN focus_rec_is_above;
|
||||
XinColor focus_rec_color;
|
||||
unsigned long focus_rec_attrib;
|
||||
unsigned long focus_cell_attrib;
|
||||
XinFont *focus_cell_font;
|
||||
XinColor focus_cell_color;
|
||||
XinColor focus_cell_back_color;
|
||||
int focus_rec_height;
|
||||
char *focus_cell_text;
|
||||
int focus_cell_ip1;
|
||||
int focus_cell_ip2;
|
||||
int focus_cell_start_ip;
|
||||
BOOLEAN button;
|
||||
BOOLEAN button_full_cell;
|
||||
BOOLEAN button_on_left;
|
||||
BOOLEAN button_on_focus;
|
||||
int button_icon_rid;
|
||||
XI_BITMAP* button_bitmap;
|
||||
} LM_FOCUS_STATE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LM_DATA *lmp;
|
||||
LM_FOCUS focus;
|
||||
int row;
|
||||
int column;
|
||||
int vert_scrolled;
|
||||
} LM_FOCUS_STATE_SET_ARGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LM_DATA *lmp;
|
||||
int row;
|
||||
int column;
|
||||
int vert_scrolled;
|
||||
} LM_FOCUS_CELL_VISIBLE_FORCE_ARGS;
|
||||
|
||||
unsigned long lm_focus_cell_attrib_get( LM_DATA * lmp );
|
||||
void lm_focus_cell_attrib_set( LM_DATA * lmp, unsigned long attrib );
|
||||
BOOLEAN lm_focus_cell_get( LM_DATA * lmp, int *row, int *col, BOOLEAN * v_scrolled );
|
||||
BOOLEAN lm_focus_cell_is_visible( LM_DATA * lmp, BOOLEAN * is_hscrolled );
|
||||
void lm_focus_cell_set( LM_DATA * lmp, int row, int col, BOOLEAN v_scrolled );
|
||||
BOOLEAN lm_focus_cell_has( LM_DATA * lmp, int row, int col, BOOLEAN v_scrolled );
|
||||
void lm_focus_cell_selection_get( LM_DATA * lmp, int *c1, int *c2 );
|
||||
void lm_focus_cell_selection_set( LM_DATA * lmp, int c1, int c2 );
|
||||
char *lm_focus_cell_text_get( LM_DATA * lmp );
|
||||
void
|
||||
lm_focus_cell_text_set( LM_DATA * lmp, BOOLEAN preserve_focus_text,
|
||||
char *text, int row, int col, BOOLEAN v_scrolled );
|
||||
|
||||
BOOLEAN lm_focus_list_has( LM_DATA * lmp );
|
||||
|
||||
unsigned long lm_focus_rec_attrib_get( LM_DATA * lmp );
|
||||
void lm_focus_rec_color_set( LM_DATA * lmp, XinColor color );
|
||||
long lm_focus_rec_get( LM_DATA * lmp );
|
||||
void lm_focus_rec_set( LM_DATA * lmp, long focus_rec );
|
||||
void lm_focus_rec_is_above_set( LM_DATA * lmp, BOOLEAN is_above );
|
||||
BOOLEAN lm_focus_rec_is_above_get( LM_DATA * lmp );
|
||||
void lm_focus_rec_free( LM_DATA * lmp );
|
||||
long lm_focus_rec_saved_get( LM_DATA * lmp );
|
||||
|
||||
LM_FOCUS lm_focus_state_get( LM_DATA * lmp );
|
||||
|
||||
/* State changing functions */
|
||||
void lm_focus_cell_visible_attempt( LM_DATA * lmp );
|
||||
void lm_focus_cell_visible_force( LM_FOCUS_CELL_VISIBLE_FORCE_ARGS * args );
|
||||
void lm_focus_cell_invis_make( LM_DATA * lmp );
|
||||
void lm_focus_remove( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled );
|
||||
void lm_focus_create_temp_row( LM_DATA * lmp );
|
||||
void lm_focus_set( long lm, int row, int column, BOOLEAN v_scrolled,
|
||||
BOOLEAN set );
|
||||
BOOLEAN lm_focus_cell_is_button_full_cell( LM_DATA * lmp );
|
5791
xi/xiport.c
Executable file
5791
xi/xiport.c
Executable file
File diff suppressed because it is too large
Load Diff
872
xi/xiport.h
Executable file
872
xi/xiport.h
Executable file
@ -0,0 +1,872 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
/*==============================================================================
|
||||
* Note: Portions not implemented on Motif are commented NOTIMP.
|
||||
* Portions removed from the header are commented out and marked REMOVED
|
||||
* New parts are marked with NEW
|
||||
*============================================================================*/
|
||||
|
||||
#ifndef XIN_INCL_XIPORT_H
|
||||
#define XIN_INCL_XIPORT_H
|
||||
|
||||
#define R4
|
||||
#include "xires.h"
|
||||
|
||||
#include "stdio.h"
|
||||
#include "assert.h"
|
||||
#include "string.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include "ctype.h"
|
||||
|
||||
/* This code is not needed when using the XVT define for native
|
||||
#if XIWS == XIWS_PM
|
||||
#define INCL_DOS
|
||||
#define INCL_WIN
|
||||
#define INCL_GPI
|
||||
#define COLOR pm_COLOR
|
||||
#define UINT pm_UINT
|
||||
#define ULONG pm_ULONG
|
||||
#include <os2.h>
|
||||
#undef COLOR
|
||||
#undef UINT
|
||||
#undef ULONG
|
||||
#define INTERNAL
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
We don't really use the following, we just define them so that they are removed
|
||||
from the XI source code when we don't use XVT.
|
||||
*/
|
||||
#ifndef XVT_CALLCONV1
|
||||
#define XVT_CALLCONV1
|
||||
#endif
|
||||
|
||||
#ifndef XVT_CC_ARGS
|
||||
#define XVT_CC_ARGS(a) a
|
||||
#endif
|
||||
|
||||
/* Set an object's memory to all zeros */
|
||||
#define XIN_CLEAR(obj) memset(&obj, 0, sizeof(obj));
|
||||
|
||||
#define XIN_INC_TYPE( s_T, T ) typedef struct s_T T
|
||||
#define XIN_INC_PTR_TYPE( s_T, T ) typedef struct s_T *T
|
||||
#define XIN_FAKE_TYPE( s_T, T ) typedef struct s_T {int x;} T
|
||||
#define XIN_FAKE_PTR_TYPE( s_T, T ) typedef struct s_T {int x;} *T
|
||||
|
||||
#ifndef BOOLEAN
|
||||
#define BOOLEAN short int
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinFlagNotSet,
|
||||
XinFlagTrue,
|
||||
XinFlagFalse
|
||||
} XinFlag;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinClipboardFormatText,
|
||||
XinClipboardFormatBitmap /* NOTIMP */
|
||||
} XinClipboardFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short v;
|
||||
short h;
|
||||
} XinPoint;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short top;
|
||||
short left;
|
||||
short bottom;
|
||||
short right;
|
||||
} XinRect;
|
||||
|
||||
typedef unsigned long XinColor;
|
||||
|
||||
#ifdef XIN_INTERNAL_WINDOW
|
||||
XIN_INC_PTR_TYPE( s_XinWindow, XinWindow );
|
||||
#else
|
||||
XIN_FAKE_PTR_TYPE( s_XinWindow, XinWindow );
|
||||
#endif
|
||||
|
||||
#define XI_NULL_WINDOW ((XinWindow)0L)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinEventCreate,
|
||||
XinEventDestroy,
|
||||
XinEventFocus,
|
||||
XinEventResize,
|
||||
XinEventPaint,
|
||||
XinEventCloseButton,
|
||||
XinEventMouseDown,
|
||||
XinEventMouseUp,
|
||||
XinEventMouseMove,
|
||||
XinEventMouseDouble,
|
||||
XinEventCharacter,
|
||||
XinEventVScroll, /* NOTIMP */
|
||||
XinEventHScroll, /* NOTIMP */
|
||||
XinEventMenuCommand,
|
||||
XinEventControl,
|
||||
XinEventTimer,
|
||||
XinEventQuit,
|
||||
XinEventHelp, /* NOTIMP */
|
||||
XinEventFont, /* NOTIMP */
|
||||
XinEventUser
|
||||
} XinEventType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinScrollBarActionNone,
|
||||
XinScrollBarActionLineUp,
|
||||
XinScrollBarActionLineDown,
|
||||
XinScrollBarActionPageUp,
|
||||
XinScrollBarActionPageDown,
|
||||
XinScrollBarActionThumb,
|
||||
XinScrollBarActionThumbTrack
|
||||
} XinScrollBarAction;
|
||||
|
||||
typedef int XinMenuTag;
|
||||
|
||||
/* NEW */
|
||||
typedef enum
|
||||
{
|
||||
XinBorderDouble,
|
||||
XinBorderSingle,
|
||||
XinBorderSizable,
|
||||
XinBorderFixed,
|
||||
XinBorderNone /* NOTIMP -- requires child window support */
|
||||
} XinBorderStyle;
|
||||
|
||||
/* NEW */
|
||||
typedef enum
|
||||
{
|
||||
XinModeless,
|
||||
XinModalReturn,
|
||||
XinModalWait,
|
||||
XinModalAutoclose
|
||||
} XinWindowMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinWindowTypeDocument,
|
||||
XinWindowTypePrint,
|
||||
XinWindowTypeTask,
|
||||
XinWindowTypeScreen,
|
||||
XinWindowTypeButton, /* NOTIMP */
|
||||
XinWindowTypeRadioButton, /* NOTIMP */
|
||||
XinWindowTypeCheckBox, /* NOTIMP */
|
||||
XinWindowTypeHorizontalScrollBar,
|
||||
XinWindowTypeVerticalScrollBar
|
||||
} XinWindowType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XinWindowType type;
|
||||
XinWindow win;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
XinScrollBarAction action;
|
||||
short position;
|
||||
} scroll;
|
||||
} v;
|
||||
} XinControlInformation;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinScrollBarTypeHorizontal, /* NOTIMP -- no scrollbars on window borders */
|
||||
XinScrollBarTypeVertical, /* NOTIMP -- no scrollbars on window borders */
|
||||
XinScrollBarTypeEither
|
||||
} XinScrollBarType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinFontFamilySystem,
|
||||
XinFontFamilyFixed,
|
||||
XinFontFamilyTimes,
|
||||
XinFontFamilyHelvetica,
|
||||
XinFontFamilyOther
|
||||
} XinFontFamily;
|
||||
|
||||
#ifdef XIN_INTERNAL_FONT
|
||||
/* Use an incomplete type so that complete type can be defined internally */
|
||||
XIN_INC_TYPE( s_XinFont, XinFont );
|
||||
#else
|
||||
/* Use a complete but fake type, so that Borland does not complain */
|
||||
XIN_FAKE_TYPE( s_XinFont, XinFont );
|
||||
#endif
|
||||
|
||||
#ifdef XIN_INTERNAL_BITMAP
|
||||
XIN_INC_TYPE( s_XinBitmap, XinBitmap );
|
||||
#else
|
||||
XIN_FAKE_TYPE( s_XinBitmap, XinBitmap );
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XinEventType type;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
XinPoint where;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
BOOLEAN alt;
|
||||
short button;
|
||||
} mouse;
|
||||
struct
|
||||
{
|
||||
short ch;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
BOOLEAN alt;
|
||||
BOOLEAN consumed; /* For internal use only */
|
||||
} character;
|
||||
struct
|
||||
{
|
||||
BOOLEAN active;
|
||||
} focus;
|
||||
struct
|
||||
{
|
||||
BOOLEAN query; /* NOTIMP -- always FALSE on Motif */
|
||||
} quit;
|
||||
struct
|
||||
{
|
||||
XinScrollBarAction action;
|
||||
short position;
|
||||
} scroll;
|
||||
struct
|
||||
{
|
||||
XinMenuTag tag;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
} menu_command;
|
||||
struct
|
||||
{
|
||||
BOOLEAN minimized;
|
||||
short height;
|
||||
short width;
|
||||
} resize;
|
||||
struct
|
||||
{
|
||||
short control_id;
|
||||
XinControlInformation ctrl_info;
|
||||
} control;
|
||||
struct
|
||||
{
|
||||
XinRect rect;
|
||||
} paint;
|
||||
struct
|
||||
{
|
||||
long id;
|
||||
} timer;
|
||||
struct
|
||||
{
|
||||
XinFont *font;
|
||||
} font;
|
||||
struct
|
||||
{
|
||||
XinWindow obj;
|
||||
XinMenuTag tag;
|
||||
long topic_id;
|
||||
} help;
|
||||
struct
|
||||
{
|
||||
long id;
|
||||
void *ptr;
|
||||
} user;
|
||||
} v;
|
||||
} XinEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
typedef void ( *XinWindowEventHandler ) ( XinWindow win, XinEvent * ep );
|
||||
typedef BOOLEAN( *XinPrintHandler ) ( long app_data );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct s_XinMenuItem
|
||||
{
|
||||
XinMenuTag tag;
|
||||
char *text; /* ~ in text indicates mnemonic */
|
||||
BOOLEAN enabled;
|
||||
BOOLEAN checked;
|
||||
BOOLEAN checkable;
|
||||
BOOLEAN separator;
|
||||
int nbr_children;
|
||||
struct s_XinMenuItem *children;
|
||||
} XinMenuItem;
|
||||
|
||||
/* NEW */
|
||||
typedef struct
|
||||
{
|
||||
int nbr_items;
|
||||
XinMenuItem *items;
|
||||
} XinMenu;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int control_id;
|
||||
XinWindowType type;
|
||||
XinRect *p_rect;
|
||||
char *title; /* NEW -- NULL means no titlebar */
|
||||
XinBorderStyle border_style; /* NEW */
|
||||
BOOLEAN vertical_scroll_bar; /* NOTIMP */
|
||||
BOOLEAN horizontal_scroll_bar;/* NOTIMP */
|
||||
BOOLEAN close_button;
|
||||
BOOLEAN visible;
|
||||
BOOLEAN enabled;
|
||||
BOOLEAN iconizable;
|
||||
BOOLEAN iconized;
|
||||
BOOLEAN maximized;
|
||||
XinWindowMode mode; /* NEW */
|
||||
XinWindow parent; /* See note1 below */
|
||||
XinMenu *menu; /* New -- no menubar if NULL */
|
||||
int menu_bar_rid; /* NOTIMP */
|
||||
int icon_rid; /* Implemented via XPM on Motif -- requires
|
||||
* linkage of icons */
|
||||
long app_data;
|
||||
XinWindowEventHandler eh;
|
||||
XinColor back_color; /* NEW -- window's default background.
|
||||
* Influences caret color */
|
||||
XinFont *font; /* NEW -- only used for native controls */
|
||||
} XinWindowDef;
|
||||
|
||||
/*
|
||||
{
|
||||
XinWindowDef Def;
|
||||
|
||||
MEMCLEAR(Def);
|
||||
Def.control_id = ;
|
||||
Def.type = ;
|
||||
Def.p_rect = ;
|
||||
Def.title = ;
|
||||
Def.border_style = ;
|
||||
Def.vertical_scroll_bar = ;
|
||||
Def.horizontal_scroll_bar = ;
|
||||
Def.close_button = ;
|
||||
Def.visible = ;
|
||||
Def.enabled = ;
|
||||
Def.iconizable = ;
|
||||
Def.iconized = ;
|
||||
Def.maximized = ;
|
||||
Def.mode = ;
|
||||
Def.parent = ;
|
||||
Def.menu = ;
|
||||
Def.menu_bar_rid = ;
|
||||
Def.icon_rid = ;
|
||||
Def.app_data = ;
|
||||
Def.eh = ;
|
||||
Def.back_color = ;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Note1: if mode ==
|
||||
* XinModeless, then parent argument may be task, screen or toplevel window. Setting the
|
||||
* parent to toplevel window enforfces stack-above-parent and iconize-with-parent.
|
||||
* XinModalReturn or XinModalWait, then parent argument may be task, screen or toplevel window.
|
||||
* Task or screen window is application-modal (although windows may still be closed).
|
||||
* XinModalAutoclose, then parent must be a toplevel window. Autoclose windows are closed before
|
||||
* any user input is sent to the parent window.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *task_win_title; /* NOTIMP */
|
||||
char *appl_name; /* NOTIMP */
|
||||
int menu_bar_rid; /* NOTIMP */
|
||||
XinWindowEventHandler eh;
|
||||
XinRect *p_rect; /* NOTIMP */
|
||||
BOOLEAN iconized; /* NOTIMP */
|
||||
BOOLEAN maximized; /* NOTIMP */
|
||||
BOOLEAN use_mdi; /* NOTIMP */
|
||||
BOOLEAN drawable_task_win;
|
||||
BOOLEAN app_is_unique; /* Don't allow multiple instances of the application to run. */
|
||||
int argc;
|
||||
char **argv;
|
||||
} XinSystemSetup;
|
||||
|
||||
typedef unsigned long XinCursor;
|
||||
|
||||
/* NEW */
|
||||
typedef enum
|
||||
{
|
||||
XinPenHollow,
|
||||
XinPenSolid,
|
||||
XinPenDashed
|
||||
} XinPenPattern;
|
||||
|
||||
/* NEW */
|
||||
typedef enum
|
||||
{
|
||||
XinBrushHollow,
|
||||
XinBrushSolid,
|
||||
XinBrushHatch
|
||||
} XinBrushPattern;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short width;
|
||||
XinPenPattern pattern; /* Changed to XinPenPattern */
|
||||
XinColor fore_color; /* NEW color of pen */
|
||||
} XinPen;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XinBrushPattern pattern; /* Changed to XinBrushPattern */
|
||||
XinColor fore_color; /* NEW fore_color allows future back_color with
|
||||
* hatched brushes */
|
||||
} XinBrush;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinDrawModeCopy,
|
||||
XinDrawModeXor /* See Note2 */
|
||||
} XinDrawMode;
|
||||
|
||||
/* Note2: XOR mode, if drawn on pixels equalling the back_color of the window, will attempt
|
||||
* to produce the fore_color of the tool (pen/brush/text). Drawing on pixels of fore_color
|
||||
* will attempt to produce back_color. The operation is self-reversing.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XinPen pen;
|
||||
XinBrush brush;
|
||||
XinDrawMode draw_mode;
|
||||
XinColor text_fore_color;
|
||||
XinColor text_back_color;
|
||||
BOOLEAN opaque_text;
|
||||
} XinDrawTools;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinResponse1,
|
||||
XinResponse2,
|
||||
XinResponse3
|
||||
} XinResponse;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinMetricIconHeight, /* Will pick a constant reflecting the WM
|
||||
* restirctions */
|
||||
XinMetricIconWidth, /* Will pick a constant reflecting the WM
|
||||
* restirctions */
|
||||
XinMetricHorizontalScrollBarHeight,
|
||||
XinMetricVerticalScrollBarWidth,
|
||||
XinMetricScreenHeight,
|
||||
XinMetricScreenWidth,
|
||||
XinMetricSizableFrameHeight, /* Guess on Motif */
|
||||
XinMetricSizableFrameWidth, /* Guess on Motif */
|
||||
XinMetricDoubleFrameHeight, /* Guess on Motif */
|
||||
XinMetricDoubleFrameWidth, /* Guess on Motif */
|
||||
XinMetricFrameHeight, /* Guess on Motif */
|
||||
XinMetricFrameWidth, /* Guess on Motif */
|
||||
XinMetricMenuHeight, /* Guess on Motif */
|
||||
XinMetricTitleHeight, /* Guess on Motif */
|
||||
XinMetricVerticalStagger,
|
||||
XinMetricHorizontalStagger,
|
||||
XinMetricScreenHRes,
|
||||
XinMetricScreenVRes
|
||||
} XinMetricType;
|
||||
|
||||
#define XI_FILE_MAX 256
|
||||
typedef char XinDirectory[XI_FILE_MAX + 1];
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinFileGood,
|
||||
XinFileCancel,
|
||||
XinFileBad
|
||||
} XinFileResult;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XinOpenFileDialog,
|
||||
XinSaveFileDialog
|
||||
} XinFileDialogType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *type;
|
||||
XinDirectory directory;
|
||||
char file_name[XI_FILE_MAX + 1];
|
||||
} XinFileSpec;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *type;
|
||||
char *pattern;
|
||||
BOOLEAN include_dirs;
|
||||
BOOLEAN dirs_only;
|
||||
} XinFileListSpec;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nbr_files;
|
||||
char **file_names;
|
||||
} XinFileList;
|
||||
|
||||
#ifdef XIN_INTERNAL_PRINT_RECORD
|
||||
/* Use an incomplete type so that complete type can be defined internally */
|
||||
XIN_INC_TYPE( s_XinPrintRecord, XinPrintRecord );
|
||||
#else
|
||||
/* Use a complete but fake type, so that Borland does not complain */
|
||||
XIN_FAKE_TYPE( s_XinPrintRecord, XinPrintRecord );
|
||||
#endif
|
||||
|
||||
#ifndef NOREF
|
||||
#define NOREF(a) a = a
|
||||
#endif
|
||||
|
||||
#ifndef assert4
|
||||
#define assert4(a, b, c, d) if (!(a)) XinError( (c),XinSeverityFatal,0L )
|
||||
#endif
|
||||
|
||||
#define XI_KEY_DEL 127
|
||||
#define XI_KEY_UP 301
|
||||
#define XI_KEY_DOWN 302
|
||||
#define XI_KEY_RIGHT 303
|
||||
#define XI_KEY_LEFT 304
|
||||
#define XI_KEY_PREV 305
|
||||
#define XI_KEY_NEXT 306
|
||||
#define XI_KEY_LHOME 307
|
||||
#define XI_KEY_LEND 308
|
||||
#define XI_KEY_HOME 309
|
||||
#define XI_KEY_END 310
|
||||
#define XI_KEY_WLEFT 313
|
||||
#define XI_KEY_WRIGHT 314
|
||||
#define XI_KEY_BTAB 315
|
||||
#define XI_KEY_CLEAR 317
|
||||
#define XI_KEY_F1 331
|
||||
#define XI_KEY_F2 332
|
||||
#define XI_KEY_F3 333
|
||||
#define XI_KEY_F4 334
|
||||
#define XI_KEY_F5 335
|
||||
#define XI_KEY_F6 336
|
||||
#define XI_KEY_F7 337
|
||||
#define XI_KEY_F8 338
|
||||
#define XI_KEY_F9 339
|
||||
#define XI_KEY_F10 340
|
||||
#define XI_KEY_F11 341
|
||||
#define XI_KEY_F12 342
|
||||
|
||||
#define XI_CURSOR_ARROW 0
|
||||
#define XI_CURSOR_IBEAM 1
|
||||
#define XI_CURSOR_CROSS 2
|
||||
#define XI_CURSOR_WAIT 3
|
||||
|
||||
#define XI_COLOR_RED 0x00FF0000L
|
||||
#define XI_COLOR_GREEN 0x0000FF00L
|
||||
#define XI_COLOR_BLUE 0x000000FFL
|
||||
#define XI_COLOR_CYAN 0x0000FFFFL
|
||||
#define XI_COLOR_MAGENTA 0x00FF00FFL
|
||||
#define XI_COLOR_YELLOW 0x00FFFF00L
|
||||
#define XI_COLOR_BLACK 0x80000000L
|
||||
#define XI_COLOR_DKGRAY 0x00404040L
|
||||
#define XI_COLOR_GRAY 0x00808080L
|
||||
#define XI_COLOR_LTGRAY 0x00C0C0C0L
|
||||
#define XI_COLOR_WHITE 0x00FFFFFFL
|
||||
|
||||
#ifndef USHRT_MAX
|
||||
#define USHRT_MAX (unsigned short)(~0)
|
||||
#endif
|
||||
#ifndef SHRT_MAX
|
||||
#define SHRT_MAX ((short)(USHRT_MAX >> 1))
|
||||
#endif
|
||||
#ifndef UINT_MAX
|
||||
#define UINT_MAX (unsigned)(~0)
|
||||
#endif
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX ((int)(UINT_MAX >> 1))
|
||||
#endif
|
||||
#ifndef ULONG_MAX
|
||||
#define ULONG_MAX (unsigned long)(~0)
|
||||
#endif
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX ((long)(ULONG_MAX >> 1 ))
|
||||
#endif
|
||||
|
||||
/* New -- values for Motif */
|
||||
#if XIWS == XIWS_XM
|
||||
#define XI_CLIP_EOL "\012"
|
||||
#else
|
||||
#define XI_CLIP_EOL "\015\012"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Memory */
|
||||
void *XinMemoryAlloc( size_t size );
|
||||
void XinMemoryFree( void *ptr );
|
||||
void *XinMemoryRealloc( void *ptr, size_t size );
|
||||
void *XinMemoryZeroAlloc( size_t size );
|
||||
|
||||
/* Dialogs */
|
||||
XinResponse XinDialogAsk( char *btn_text_1, char *btn_text_2,
|
||||
char *btn_text_3, char *fmt,... );
|
||||
void XinDialogError( char *format,... );
|
||||
void XinDialogFatal( char *format,... );
|
||||
XinFileResult XinDialogFile( char *message, XinFileSpec * spec,
|
||||
XinFileDialogType type );
|
||||
BOOLEAN XinDialogFont( XinFont * font );
|
||||
void XinDialogNote( char *format,... );
|
||||
BOOLEAN XinDialogPrinterSetup( XinPrintRecord * rec );
|
||||
char *XinDialogStringPrompt( char *message, char *response,
|
||||
int size_response );
|
||||
|
||||
/* Rectangles */
|
||||
BOOLEAN XinRectEmpty( XinRect * rect );
|
||||
XinRect *XinRectIntersect( XinRect * result, XinRect * r1, XinRect * r2 );
|
||||
BOOLEAN XinRectPointContained( XinRect * rect, XinPoint * point );
|
||||
XinRect *XinRectEnclose( XinRect * dst, XinRect * src1, XinRect * src2 );
|
||||
|
||||
/* Windows and drawing */
|
||||
long XinWindowAppDataGet( XinWindow win );
|
||||
void XinWindowAppDataSet( XinWindow win, long app_data );
|
||||
void XinWindowArcDraw( XinWindow win, XinRect* ellipse, XinPoint* start, XinPoint* stop );
|
||||
void XinWindowBitmapDraw( XinWindow win, XinBitmap * bitmap, XinRect * dest,
|
||||
XinRect * source );
|
||||
void XinWindowBrushSet( XinWindow win, XinBrush * brush );
|
||||
void XinWindowCaretOff( XinWindow win );
|
||||
void XinWindowCaretOn( XinWindow win, int x, int y, int height,
|
||||
XinColor assumed_back_color, XinRect * clip_rct );
|
||||
void XinWindowCheckBox( XinWindow win, BOOLEAN check ); /* NOTIMP */
|
||||
void XinWindowCheckRadioButton( XinWindow win, XinWindow * wins, /* NOTIMP */
|
||||
int nbr_windows );
|
||||
BOOLEAN XinWindowClipGet( XinWindow win, XinRect * rect );
|
||||
void XinWindowClipSet( XinWindow Win, XinRect * rect );
|
||||
void XinWindowColorTextBackSet( XinWindow win, XinColor color ); /* Added Text */
|
||||
void XinWindowColorTextForeSet( XinWindow win, XinColor color ); /* Added Text */
|
||||
XinWindow XinWindowCreate( XinWindowDef * def );
|
||||
void XinWindowCursorSet( XinWindow win, XinCursor cursor );
|
||||
void XinWindowDestroy( XinWindow win );
|
||||
|
||||
XinDrawMode XinWindowDrawModeGet( XinWindow win );
|
||||
void XinWindowDrawModeSet( XinWindow win, XinDrawMode mode );
|
||||
XinDrawTools *XinWindowDrawToolsGet( XinWindow win, XinDrawTools * tools );
|
||||
XinDrawTools *XinWindowDrawToolsNormalGet( XinDrawTools * tools );
|
||||
void XinWindowDrawToolsSet( XinWindow win, XinDrawTools * tools );
|
||||
XinWindow XinWindowDropDownParentGet( XinWindow creating_win );
|
||||
void XinWindowEllipseDraw( XinWindow win, XinRect* rect );
|
||||
void XinWindowEnable( XinWindow win, BOOLEAN enable ); /* NOTIMP */
|
||||
void XinWindowEventUserSend( XinWindow win, long id, void *ptr );
|
||||
void XinWindowFontMap( XinWindow win, XinFont * font );
|
||||
XinWindow XinWindowFocusGet( void );
|
||||
void XinWindowFocusSet( XinWindow win ); /* May be ineffective */
|
||||
void XinWindowFrontSet( XinWindow win );
|
||||
void XinWindowHotkeySet( XinWindow win, char ch );
|
||||
void XinWindowIconDraw( XinWindow win, int x, int y, int icon_rid,
|
||||
XinColor fore_color, XinColor back_color );
|
||||
void XinWindowLineDraw( XinWindow win, XinPoint * point );
|
||||
void XinWindowLineMoveTo( XinWindow win, XinPoint * point );
|
||||
void XinWindowMouseRelease( void );
|
||||
void XinWindowMouseTrap( XinWindow win,
|
||||
BOOLEAN continuous_mouse_moves );
|
||||
long XinWindowNativeGet( XinWindow win );
|
||||
void XinWindowPaintForce( XinWindow win );
|
||||
BOOLEAN XinWindowPaintNeeds( XinWindow win, XinRect * p_rect );
|
||||
XinWindow XinWindowParentGet( XinWindow win );
|
||||
void XinWindowPenSet( XinWindow win, XinPen * pen );
|
||||
void XinWindowPieDraw( XinWindow win, XinRect* ellipse, XinPoint* start, XinPoint* stop );
|
||||
void XinWindowPointsTranslate( XinWindow from_win, XinWindow to_win,
|
||||
XinPoint * points, int nbr_points );
|
||||
void XinWindowPolygonDraw( XinWindow win, XinPoint* points, int nbr_points );
|
||||
void XinWindowRectDraw( XinWindow win, XinRect * rect );
|
||||
XinRect *XinWindowRectGet( XinWindow win, XinRect * p_rect );
|
||||
void XinWindowRectInvalidate( XinWindow win, XinRect * rect );
|
||||
XinRect *XinWindowRectOuterGet( XinWindow win, XinRect * p_rect );
|
||||
void XinWindowRectScroll( XinWindow win, XinRect * p_rect,
|
||||
int dh, int dv );
|
||||
void XinWindowRectSet( XinWindow win, XinRect * rect );
|
||||
void XinWindowRectTranslate( XinWindow from_win, XinWindow to_win,
|
||||
XinRect * rect );
|
||||
XinWindow XinWindowScreenGet( void );
|
||||
void XinWindowShow( XinWindow win, BOOLEAN show );
|
||||
XinWindow XinWindowTaskGet( void );
|
||||
void XinWindowTextOpaqueSet( XinWindow win, BOOLEAN opaque );
|
||||
void XinWindowTextDraw( XinWindow win, XinFont * font, int x, int y,
|
||||
char *buf, int len );
|
||||
void XinWindowTextRotateDraw( XinWindow win, XinFont* font, int x, int y,
|
||||
int rotation, char* buf, int len );
|
||||
void XinWindowTimerKill( XinWindow win, long timer_id );
|
||||
long XinWindowTimerSet( XinWindow win, long millisecs );
|
||||
char *XinWindowTitleGet( XinWindow win );
|
||||
void XinWindowTitleSet( XinWindow win, char *title );
|
||||
#if XIWS == XIWS_XM
|
||||
long XinWindowGetWidget( XinWindow win ); /* Return value is really a
|
||||
* Widget */
|
||||
#endif
|
||||
|
||||
/* Scroll Bars */
|
||||
int XinScrollBarPositionGet( XinWindow win, XinScrollBarType type );
|
||||
void XinScrollBarPositionSet( XinWindow win, XinScrollBarType type,
|
||||
int position );
|
||||
int XinScrollBarProportionGet( XinWindow win, XinScrollBarType type );
|
||||
void XinScrollBarRangeGet( XinWindow win, XinScrollBarType type,
|
||||
int *p_min, int *p_max );
|
||||
void XinScrollBarSet( XinWindow win, XinScrollBarType type,
|
||||
int min_val, int max_val,
|
||||
int proportion, int pos );
|
||||
|
||||
/* Clip Board */
|
||||
BOOLEAN XinClipboardFormatAvail( XinClipboardFormat format );
|
||||
void *XinClipboardGet( XinClipboardFormat format, long *size );
|
||||
void XinClipboardPut( XinClipboardFormat format, long size,
|
||||
void *data );
|
||||
|
||||
/* Application */
|
||||
void XinAppCleanup( void );
|
||||
void XinAppQuitOk( void ); /* NOP on Motif */
|
||||
void XinAppTerminate( void );
|
||||
void XinAppSystemSetupInit( XinSystemSetup * setup );
|
||||
void XinDebugPrintf( char *format,... ); /* NOTIMP */
|
||||
void XinPendingEventsProcess( void );
|
||||
|
||||
/* Miscellaneous */
|
||||
void XinBeep( void );
|
||||
XinColor XinColorMake( int red, int green, int blue );
|
||||
BOOLEAN XinStringMatch( char *string, char *pattern,
|
||||
BOOLEAN case_sensitive );
|
||||
void XinCursorWait( void );
|
||||
long XinMetricGet( XinMetricType type );
|
||||
void XinCoalesceInvalidates( XinWindow win, BOOLEAN coalesce );
|
||||
void XinInitBuffer( void );
|
||||
#ifdef XI_USE_XVT
|
||||
void XinXvtEventGet( void *xvtp );
|
||||
char *XinXvtEventTextGet( void *xvtp );
|
||||
void XinXvtWindowRegister( XinWindow win, XinWindowEventHandler eh );
|
||||
#endif
|
||||
|
||||
/* Menus */
|
||||
XinMenuItem *XinMenuAdd( XinMenu * menu, int index, XinMenuItem * item );
|
||||
XinMenu *XinMenuCreate( void );
|
||||
BOOLEAN XinMenuDelete( XinMenu * menu, int index );
|
||||
XinMenu *XinMenuDuplicate( XinMenu * menu );
|
||||
void XinMenuFree( XinMenu * menu );
|
||||
XinMenuItem *XinMenuItemAdd( XinMenuItem * item, int index,
|
||||
XinMenuItem * child );
|
||||
XinMenuItem *XinMenuItemCreate( char *text );
|
||||
XinMenuItem *XinMenuItemDuplicate( XinMenuItem * item );
|
||||
BOOLEAN XinMenuItemDelete( XinMenuItem * item, int index );
|
||||
void XinMenuItemFree( XinMenuItem * item );
|
||||
void XinMenuItemTextSet( XinMenuItem * item, char *text );
|
||||
|
||||
void XinWindowMenuFontSet( XinWindow win, XinFont * font ); /* NOTIMP */
|
||||
XinMenu *XinWindowMenuGet( XinWindow win, XinMenuTag tag ); /* menubar if tag==0 */
|
||||
void XinWindowMenuItemCheck( XinWindow win, XinMenuTag tag,
|
||||
BOOLEAN check );
|
||||
void XinWindowMenuItemEnable( XinWindow win, XinMenuTag tag,
|
||||
BOOLEAN enable );
|
||||
XinMenuItem *XinWindowMenuItemGet( XinWindow win, XinMenuTag tag );
|
||||
BOOLEAN XinWindowMenuItemIsChecked( XinWindow win, XinMenuTag tag );
|
||||
BOOLEAN XinWindowMenuItemIsEnabled( XinWindow win, XinMenuTag tag );
|
||||
char *XinWindowMenuItemTextGet( XinWindow win, XinMenuTag tag );
|
||||
void XinWindowMenuItemTextSet( XinWindow win, XinMenuTag tag, char *text );
|
||||
void XinWindowMenuReplace( XinWindow win, XinMenuTag tag, XinMenu * menu ); /* menubar if tag==0 */
|
||||
|
||||
/* Fonts */
|
||||
BOOLEAN XinFontBoldGet( XinFont * font );
|
||||
void XinFontBoldSet( XinFont * font, BOOLEAN flag );
|
||||
BOOLEAN XinFontCompare( XinFont * font1, XinFont * font2 );
|
||||
void XinFontCopy( XinFont ** to, XinFont * from );
|
||||
XinFont *XinFontCreate( void );
|
||||
void XinFontDestroy( XinFont * font );
|
||||
XinFontFamily XinFontFamilyGet( XinFont * font );
|
||||
void XinFontFamilySet( XinFont * font, XinFontFamily family );
|
||||
BOOLEAN XinFontIsMapped( XinFont * font );
|
||||
BOOLEAN XinFontItalicGet( XinFont * font );
|
||||
void XinFontItalicSet( XinFont * font, BOOLEAN flag );
|
||||
void XinFontMetricsGet( XinFont * font, int *p_leading, int *p_ascent,
|
||||
int *p_descent );
|
||||
int XinFontSizeGet( XinFont * font );
|
||||
void XinFontSizeSet( XinFont * font, int size );
|
||||
int XinFontTextWidthGet( XinFont * font, char *text, int len );
|
||||
void XinFontNativeConvert( XinFont * font );
|
||||
#ifdef XI_USE_XVT
|
||||
XinFont *XinFontXvtConvert( void *font_id );
|
||||
void *XinFontXvtConvertBack( XinFont * font_id );
|
||||
void XinFontXvtDestroy( void* font_id );
|
||||
#endif
|
||||
void XinFontUnmap( XinFont* font_id ); /* RGM: Font unmap hack */
|
||||
|
||||
/* Bitmaps */
|
||||
void XinBitmapDestroy( XinBitmap * bitmap );
|
||||
XinBitmap *XinBitmapRead( char *filename );
|
||||
void XinBitmapSizeGet( XinBitmap * bitmap, short *pwidth, short *pheight );
|
||||
|
||||
/* Printing */
|
||||
XinRect *XinPrintBandNext( void );
|
||||
BOOLEAN XinPrintPageEnd( XinPrintRecord * rec );
|
||||
BOOLEAN XinPrintPageStart( XinPrintRecord * rec );
|
||||
XinPrintRecord *XinPrintRecordCreate( int *p_size );
|
||||
void XinPrintRecordDestroy( XinPrintRecord * rec );
|
||||
BOOLEAN XinPrintRecordValidate( XinPrintRecord * rec );
|
||||
BOOLEAN XinPrintThreadStart( XinPrintHandler func, long app_data );
|
||||
XinWindow XinPrintWindowCreate( XinPrintRecord * rec, char *title );
|
||||
void XinPrintWindowDestroy( XinWindow win );
|
||||
void XinPrintRecordMetricsGet( XinPrintRecord * rec, long * height, long * width,
|
||||
long * vres, long * hres );
|
||||
|
||||
/* Files and Directories */
|
||||
BOOLEAN XinDirectoryAbsoluteGet( char *full_name, XinDirectory * dir );
|
||||
BOOLEAN XinDirectoryCurrentGet( XinDirectory * dir );
|
||||
BOOLEAN XinDirectoryCurrentSet( XinDirectory * dir );
|
||||
XinFileList *XinFileListGet( XinFileListSpec * spec );
|
||||
|
||||
/* NEW error handling */
|
||||
typedef enum
|
||||
{
|
||||
XinSeverityWarning, XinSeverityFatal
|
||||
} XinSeverity;
|
||||
typedef BOOLEAN( *XinErrorHandler ) ( int errocde, XinSeverity severity, long app_data );
|
||||
/* Note: return value of error handler is TRUE if app should terminate, FALSE to continue */
|
||||
|
||||
void XinError( int errcode, XinSeverity severity, long app_data );
|
||||
XinErrorHandler XinErrorHandlerGet( void );
|
||||
void XinErrorHandlerSet( XinErrorHandler handler );
|
||||
|
||||
BOOLEAN XinErrorDefaultHandler( int errcode, XinSeverity severity,
|
||||
long app_data );
|
||||
void XinIconSizeGet( int icon_rid, int *widthp, int *heightp );
|
||||
|
||||
/* Native help (only implemented on Windows - these calls do nothing elsewhere) */
|
||||
void XinHelpFileNameSet( char *filename );
|
||||
char *XinHelpFileNameGet();
|
||||
BOOLEAN XinNativeHelp( XinWindow win, char *help_key );
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of extern "C" */
|
||||
|
||||
#endif
|
||||
|
||||
/* Range of errors used internally by Xin */
|
||||
#define XIN_ERRCODE_INTERNAL_MIN 1000
|
||||
#define XIN_ERRCODE_INTERNAL_MAX 2000
|
||||
|
||||
#endif
|
17
xi/xiport2.h
Executable file
17
xi/xiport2.h
Executable file
@ -0,0 +1,17 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
#define TEMP_BUFFER_SIZE 10000
|
||||
|
||||
extern XinWindowEventHandler xin_teh;
|
||||
extern char *xin_buffer;
|
||||
extern BOOLEAN xin_use_mdi_flag;
|
||||
extern BOOLEAN xin_xvt_initialized;
|
||||
|
||||
long XinXvtEventHandler( WINDOW win, EVENT * ep );
|
98
xi/xires.h
Executable file
98
xi/xires.h
Executable file
@ -0,0 +1,98 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#define XIWS_WIN 101
|
||||
#define XIWS_XM 102
|
||||
#define XIWS_MAC 103
|
||||
#define XIWS_PM 104
|
||||
#define XIWS_WM 105
|
||||
|
||||
#if !defined(XI_USE_XVT) && !defined(XI_USE_XM) && !defined(XI_USE_WIN)
|
||||
#define XI_USE_XVT
|
||||
#endif
|
||||
|
||||
#ifdef XI_USE_XVT
|
||||
#include "xvt_env.h"
|
||||
|
||||
#ifndef XI_R4_API
|
||||
#undef XIWS_WIN
|
||||
#define XIWS_WIN WINWS
|
||||
#undef XIWS_XM
|
||||
#define XIWS_XM MTFWS
|
||||
#undef XIWS_MAC
|
||||
#define XIWS_MAC MACWS
|
||||
#undef XIWS_PM
|
||||
#define XIWS_PM PMWS
|
||||
#undef XIWS_WM
|
||||
#define XIWS_WM WMWS
|
||||
#endif
|
||||
|
||||
#if XVTWS == MACWS
|
||||
#define XIWS XIWS_MAC
|
||||
#elif XVTWS == PMWS
|
||||
#define XIWS XIWS_PM
|
||||
#elif XVTWS == WIN32WS || XVTWS == WIN16WS
|
||||
#define XIWS XIWS_WIN
|
||||
#elif XVTWS == WMWS
|
||||
#define XIWS XIWS_WM
|
||||
#elif XVTWS == MTFWS || XVTWS == XOLWS
|
||||
#define XIWS XIWS_XM
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef XI_USE_XM
|
||||
#define XIWS XIWS_XM
|
||||
#define EOL_SEQ "\n"
|
||||
#define SZ_FNAME 64
|
||||
#endif
|
||||
|
||||
#ifdef XI_USE_WIN
|
||||
#define XIWS XIWS_WIN
|
||||
#define EOL_SEQ "\n"
|
||||
#define SZ_FNAME 256
|
||||
#endif
|
||||
|
||||
#define XI_CURSOR_RESIZE 8001
|
||||
#define XI_CURSOR_HAND 8002
|
||||
#define XI_CURSOR_VRESIZE 8003
|
||||
|
||||
#ifndef COMBO_ICON
|
||||
#define COMBO_ICON 1026
|
||||
#endif
|
||||
|
||||
#define NULL_MENU_RID 8000
|
||||
|
||||
#define XI_MENU_FILE 32000
|
||||
#define XI_MENU_FILE_NEW (XI_MENU_FILE+1)
|
||||
#define XI_MENU_FILE_OPEN (XI_MENU_FILE+2)
|
||||
#define XI_MENU_FILE_CLOSE (XI_MENU_FILE+3)
|
||||
#define XI_MENU_FILE_SAVE (XI_MENU_FILE+4)
|
||||
#define XI_MENU_FILE_SAVE_AS (XI_MENU_FILE+5)
|
||||
#define XI_MENU_FILE_REVERT (XI_MENU_FILE+6)
|
||||
#define XI_MENU_FILE_PG_SETUP (XI_MENU_FILE+7)
|
||||
#define XI_MENU_FILE_PRINT (XI_MENU_FILE+8)
|
||||
#define XI_MENU_FILE_QUIT (XI_MENU_FILE+9)
|
||||
#define XI_MENU_FILE_ABOUT (XI_MENU_FILE+10)
|
||||
|
||||
#define XI_MENU_EDIT 32025
|
||||
#define XI_MENU_EDIT_UNDO (XI_MENU_EDIT+1)
|
||||
#define XI_MENU_EDIT_CUT (XI_MENU_EDIT+2)
|
||||
#define XI_MENU_EDIT_COPY (XI_MENU_EDIT+3)
|
||||
#define XI_MENU_EDIT_PASTE (XI_MENU_EDIT+4)
|
||||
#define XI_MENU_EDIT_CLEAR (XI_MENU_EDIT+5)
|
||||
|
||||
#define XI_MENU_FONT 32030
|
||||
#define XI_MENU_FONT_SELECT 32031
|
||||
|
||||
#define XI_MENU_WIN 32100
|
||||
#define XI_MENU_WIN_CASCADE (XI_MENU_WIN+1)
|
||||
#define XI_MENU_WIN_TILE_HORZ (XI_MENU_WIN+2)
|
||||
#define XI_MENU_WIN_TILE_VERT (XI_MENU_WIN+3)
|
||||
#define XI_MENU_WIN_CLOSE_ALL (XI_MENU_WIN+4)
|
20
xi/xisetup.c
Executable file
20
xi/xisetup.c
Executable file
@ -0,0 +1,20 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "xiport.h"
|
||||
|
||||
void
|
||||
XinAppSystemSetupInit( XinSystemSetup * SystemSetup )
|
||||
{
|
||||
SystemSetup->task_win_title = "DUMMY";
|
||||
SystemSetup->appl_name = "dummy";
|
||||
SystemSetup->menu_bar_rid = 0;
|
||||
SystemSetup->eh = NULL;
|
||||
}
|
160
xi/xistx.h
160
xi/xistx.h
@ -1,32 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************
|
||||
STX module
|
||||
******************************************************************/
|
||||
#define NULL_STX (STX)0
|
||||
|
||||
#define STX_ATR_ENABLED XI_ATR_ENABLED
|
||||
#define STX_ATR_EDITMENU XI_ATR_EDITMENU
|
||||
#define STX_ATR_AUTOSELECT XI_ATR_AUTOSELECT
|
||||
#define STX_ATR_AUTOSCROLL XI_ATR_AUTOSCROLL
|
||||
#define STX_ATR_RJUST XI_ATR_RJUST
|
||||
#define STX_ATR_BORDER XI_ATR_BORDER
|
||||
#define STX_ATR_VISIBLE XI_ATR_VISIBLE
|
||||
#define STX_ATR_READONLY XI_ATR_READONLY
|
||||
#define STX_ATR_PASSWORD XI_ATR_PASSWORD
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STX_CB_CHAR,
|
||||
STX_CB_CHANGE,
|
||||
STX_CB_DBL,
|
||||
STX_CB_FOCUS
|
||||
}
|
||||
}
|
||||
|
||||
STX_CB_TYPE;
|
||||
|
||||
typedef struct _stx_cb_data
|
||||
@ -34,106 +24,134 @@ typedef struct _stx_cb_data
|
||||
STX stx;
|
||||
STX_CB_TYPE cb_type;
|
||||
int cid;
|
||||
WINDOW win;
|
||||
XinWindow win;
|
||||
union
|
||||
{
|
||||
{
|
||||
/* nothing for change notify */
|
||||
BOOLEAN refused;
|
||||
struct
|
||||
{
|
||||
{
|
||||
int ch;
|
||||
BOOLEAN shift;
|
||||
BOOLEAN control;
|
||||
BOOLEAN alt;
|
||||
BOOLEAN is_paste;
|
||||
BOOLEAN refused;
|
||||
} chr;
|
||||
} v;
|
||||
} STX_CB_DATA;
|
||||
|
||||
typedef void (*STX_CB)(STX_CB_DATA *stx_cb_data);
|
||||
typedef void ( *STX_CB ) ( STX_CB_DATA * stx_cb_data );
|
||||
|
||||
typedef struct _stx_def
|
||||
{
|
||||
int cid;
|
||||
PNT pnt;
|
||||
XinPoint pnt;
|
||||
short pixel_width;
|
||||
short pix_char_width;
|
||||
unsigned long attrib;
|
||||
short text_size;
|
||||
FONT_OBJ font;
|
||||
COLOR back_color;
|
||||
COLOR enabled_color; /* but inactive */
|
||||
COLOR disabled_color;
|
||||
COLOR active_color;
|
||||
COLOR active_back_color;
|
||||
COLOR disabled_back_color;
|
||||
COLOR hilight_color; /* for well and platform fields */
|
||||
COLOR shadow_color; /* for well and platform fields */
|
||||
XI_RCT xi_rct;
|
||||
XinFont *font;
|
||||
XinColor back_color;
|
||||
XinColor enabled_color; /* but inactive */
|
||||
XinColor disabled_color;
|
||||
XinColor active_color;
|
||||
XinColor active_back_color;
|
||||
XinColor disabled_back_color;
|
||||
XinColor hilight_color; /* for well and platform fields */
|
||||
XinColor shadow_color; /* for well and platform fields */
|
||||
XinRect xi_rct;
|
||||
STX_CB stx_cb;
|
||||
long app_data;
|
||||
char *parent;
|
||||
BOOLEAN well;
|
||||
BOOLEAN platform;
|
||||
BOOLEAN auto_tab;
|
||||
BOOLEAN scroll_bar;
|
||||
BOOLEAN cr_ok;
|
||||
BOOLEAN var_len_text;
|
||||
XI_OBJ *parent_obj;
|
||||
BOOLEAN button;
|
||||
BOOLEAN button_on_left;
|
||||
XinRect button_rect;
|
||||
XinFlag no_button_space;
|
||||
int button_width;
|
||||
} STX_DEF;
|
||||
|
||||
typedef struct _stx_data
|
||||
{
|
||||
int cid;
|
||||
WINDOW win;
|
||||
RCT rct;
|
||||
XinWindow win;
|
||||
XinRect rct;
|
||||
XinRect edit_rect;
|
||||
unsigned long attrib;
|
||||
short pixel_width;
|
||||
short pix_baseline;
|
||||
FONT_OBJ font;
|
||||
COLOR back_color;
|
||||
COLOR enabled_color; /* but inactive */
|
||||
COLOR disabled_color;
|
||||
COLOR disabled_back_color;
|
||||
COLOR active_color;
|
||||
COLOR active_back_color;
|
||||
COLOR hilight_color; /* for well and platform fields */
|
||||
COLOR shadow_color; /* for well and platform fields */
|
||||
XinFont *font;
|
||||
XinColor back_color;
|
||||
XinColor enabled_color; /* but inactive */
|
||||
XinColor disabled_color;
|
||||
XinColor disabled_back_color;
|
||||
XinColor active_color;
|
||||
XinColor active_back_color;
|
||||
XinColor hilight_color; /* for well and platform fields */
|
||||
XinColor shadow_color; /* for well and platform fields */
|
||||
STX_CB stx_cb;
|
||||
short text_size;
|
||||
char *text;
|
||||
BOOLEAN has_focus;
|
||||
TXT_DATA *txt;
|
||||
long app_data;
|
||||
BOOLEAN have_mouse;
|
||||
BOOLEAN use_text_edit;
|
||||
TXEDIT txedit;
|
||||
XI_TEXT *xi_text;
|
||||
BOOLEAN multi_line;
|
||||
BOOLEAN well;
|
||||
BOOLEAN platform;
|
||||
BOOLEAN auto_tab;
|
||||
BOOLEAN scroll_bar;
|
||||
BOOLEAN cr_ok;
|
||||
BOOLEAN var_len_text;
|
||||
char *buf;
|
||||
long timer_id;
|
||||
BOOLEAN timer_set;
|
||||
BOOLEAN has_focus;
|
||||
XI_OBJ *parent_obj;
|
||||
BOOLEAN button;
|
||||
BOOLEAN button_on_left;
|
||||
XinRect button_rect;
|
||||
XinFlag no_button_space;
|
||||
int button_width;
|
||||
#ifdef XI_USE_TX_SUPPORT
|
||||
BOOLEAN use_text_edit;
|
||||
long txedit;
|
||||
#endif
|
||||
} STX_DATA;
|
||||
|
||||
#define STX_LOSE_FOCUS NULL_STX
|
||||
|
||||
STX stx_create(WINDOW win, STX_DEF *stx_def);
|
||||
void stx_delete(STX stx);
|
||||
BOOLEAN stx_event(STX stx, EVENT *ep);
|
||||
void stx_focus_cb(long stx, BOOLEAN set);
|
||||
unsigned long stx_get_attrib(STX stx);
|
||||
int stx_get_cid(STX stx);
|
||||
long stx_get_app_data(STX stx);
|
||||
void stx_get_sel(STX stx, int *c1, int *c2);
|
||||
RCT* stx_get_rect(STX stx, RCT *rct);
|
||||
RCT* stx_get_inside_rect( STX stx, RCT* rect );
|
||||
char* stx_get_text(STX stx, char *s, int len);
|
||||
TXEDIT stx_get_txedit(STX stx);
|
||||
void stx_set_app_data(STX stx, long data);
|
||||
void stx_set_attrib(STX stx, unsigned long attrib);
|
||||
void stx_set_bufsize(STX stx, short size);
|
||||
void stx_set_focus(STX stx);
|
||||
void stx_set_pos(STX stx, PNT p);
|
||||
void stx_set_sel(STX stx, int c1, int c2);
|
||||
void stx_set_text(STX stx, char *s);
|
||||
|
||||
|
||||
|
||||
STX stx_create( XinWindow win, STX_DEF * stx_def, XinRect *field_button );
|
||||
void stx_delete( STX stx, BOOLEAN destroy_font );
|
||||
void stx_destroy_font( STX stx );
|
||||
BOOLEAN stx_event( STX stx, XinEvent * ep );
|
||||
void stx_focus_set( long stx, BOOLEAN set );
|
||||
unsigned long stx_get_attrib( STX stx );
|
||||
int stx_get_cid( STX stx );
|
||||
long stx_get_app_data( STX stx );
|
||||
void stx_get_sel( STX stx, int *c1, int *c2 );
|
||||
XinRect *stx_get_rect( STX stx, XinRect * rct );
|
||||
XinRect *stx_get_inside_rect( STX stx, XinRect * rect );
|
||||
char *stx_get_text( STX stx, char *s, int len );
|
||||
void stx_set_app_data( STX stx, long data );
|
||||
void stx_set_attrib( STX stx, unsigned long attrib );
|
||||
void stx_set_bufsize( STX stx, short size );
|
||||
void stx_set_focus( STX stx );
|
||||
void stx_set_pos( STX stx, XinPoint p );
|
||||
void stx_set_rect( XinWindow win, STX stx, XinRect *new_rect, XinRect *field_button );
|
||||
void stx_set_sel( STX stx, int c1, int c2 );
|
||||
void stx_set_text( STX stx, char *s );
|
||||
XI_TEXT *stx_xi_text_get( STX stx );
|
||||
BOOLEAN stx_cr_is_ok( STX stx );
|
||||
void stx_update_colors( STX stx );
|
||||
void stx_set_font( STX stx, XinFont* font );
|
||||
|
||||
#ifdef XI_USE_TX_SUPPORT
|
||||
BOOLEAN xi_is_txedit( XI_OBJ * xi_obj );
|
||||
BOOLEAN xi_xvt_tx_event( XinWindow win, XinEvent * ep );
|
||||
void xi_tx_edit_move( XI_OBJ * xi_obj );
|
||||
|
||||
#endif
|
||||
|
208
xi/xitext.h
208
xi/xitext.h
@ -1,102 +1,132 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef TXT_INCLUDED
|
||||
#define TXT_INCLUDED
|
||||
|
||||
typedef long TXT;
|
||||
#define NULL_TXT (TXT)0
|
||||
|
||||
#define TXT_ATR_ENABLED XI_ATR_ENABLED
|
||||
#define TXT_ATR_EDITMENU XI_ATR_EDITMENU
|
||||
#define TXT_ATR_AUTOSCROLL XI_ATR_AUTOSCROLL
|
||||
#define TXT_ATR_AUTOSELECT XI_ATR_AUTOSELECT
|
||||
#define TXT_ATR_RJUST XI_ATR_RJUST
|
||||
#define TXT_ATR_BORDER XI_ATR_BORDER
|
||||
#define TXT_ATR_VISIBLE XI_ATR_VISIBLE
|
||||
#define TXT_ATR_FOCUSBORDER XI_ATR_FOCUSBORDER
|
||||
#define TXT_ATR_READONLY XI_ATR_READONLY
|
||||
|
||||
#define TXT_FLAG_TEXT 0x1 /* text has changed */
|
||||
#define TXT_FLAG_SELECTION 0x2 /* includes insertion point */
|
||||
#define TXT_FLAG_SCROLL 0x4 /* scroll position has changed */
|
||||
#define TXT_FLAG_OVF 0x8 /* user filled buffer */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TXT_STATE_NULL,
|
||||
TXT_STATE_SELC,
|
||||
TXT_STATE_SELW
|
||||
}
|
||||
TXT_STATE;
|
||||
|
||||
typedef struct _txt_def
|
||||
{
|
||||
/* must be initialized by creator */
|
||||
RCT rct;
|
||||
XI_OBJ *parent_obj;
|
||||
unsigned long attrib;
|
||||
FONT_OBJ *font;
|
||||
COLOR back_color;
|
||||
COLOR fore_color;
|
||||
COLOR hilight_color; /* for well and platform fields */
|
||||
COLOR shadow_color; /* for well and platform fields */
|
||||
short text_size;
|
||||
char *text;
|
||||
short *hit_test;
|
||||
WINDOW win;
|
||||
BOOLEAN well;
|
||||
BOOLEAN platform;
|
||||
BOOLEAN inside_only;
|
||||
BOOLEAN auto_tab;
|
||||
long timer_id;
|
||||
BOOLEAN timer_set;
|
||||
|
||||
/* initialized by txt_reset */
|
||||
short pix_baseline;
|
||||
unsigned short flags;
|
||||
TXT_STATE state;
|
||||
short selstart, selstop;
|
||||
short scroll_pos;
|
||||
short select_start;
|
||||
short string_xpos;
|
||||
short len;
|
||||
BOOLEAN hasfocus;
|
||||
short ascent;
|
||||
short descent;
|
||||
short leading;
|
||||
} TXT_DATA;
|
||||
/*
|
||||
NOTE: if TXT_ATR_RJUST is set, then scroll_pos indicates how many
|
||||
characters are to the right of the right margin. Otherwise, it indicates
|
||||
how many characters are to the left of the left margin.
|
||||
The font in the text may be just a copy of a font pointer that
|
||||
is elsewhere, in which case, it will be freed when the interface
|
||||
goes away. It also could be an instantiated copy of a font, in
|
||||
which case, the font will have been put into the interface font list,
|
||||
so that it will be freed when the interface goes away.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int line_break;
|
||||
int ip1; /* -1 is null value */
|
||||
int ip2; /* -1 is null value */
|
||||
int active_ip;
|
||||
} XI_TEXT_LINE_BREAK;
|
||||
|
||||
TXT_DATA *txt_reset(TXT_DATA *txt);
|
||||
BOOLEAN txt_event(TXT_DATA *txt, EVENT *ep, BOOLEAN gaining_focus);
|
||||
unsigned long txt_get_attrib(TXT_DATA *txt);
|
||||
void txt_get_sel(TXT_DATA *txt, int *c1, int *c2);
|
||||
RCT *txt_get_rect(TXT_DATA *txt, RCT *rct);
|
||||
RCT *txt_set_rect(TXT_DATA *txt, RCT *rct);
|
||||
void txt_get_text(TXT_DATA *txt, char *s, int len);
|
||||
void txt_redraw(TXT_DATA *txt, BOOLEAN inside_only);
|
||||
void txt_set_attrib(TXT_DATA *txt, unsigned long attrib);
|
||||
/* turns on/off caret if selstart == selstop */
|
||||
void txt_caret(TXT_DATA *txt, BOOLEAN caret_state);
|
||||
void txt_set_sel(TXT_DATA *txt, int c1, int c2);
|
||||
void txt_set_text(TXT_DATA *txt, char *s);
|
||||
void txt_display_caret(TXT_DATA *txt);
|
||||
void txt_hide_caret(TXT_DATA *txt);
|
||||
#if XIWS == MTFWS
|
||||
void clean_primesel();
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
/* edit control info */
|
||||
char *string; /* current text of edit control */
|
||||
int pix_width; /* pix width as specified by user of text */
|
||||
int internal_pix_width; /* pix_width - scroll bar width - sb delta */
|
||||
int min_buffer_size;
|
||||
int buffer_size;
|
||||
int allocated_length;
|
||||
BOOLEAN var_len_text;
|
||||
int font_height;
|
||||
int leading;
|
||||
int ascent;
|
||||
int descent;
|
||||
XinFont *font;
|
||||
XinWindow win;
|
||||
XI_OBJ *parent_obj;
|
||||
XinRect prect; /* physical rectangle of edit control */
|
||||
XinRect clip_rect; /* clipping is intersected with this rect */
|
||||
XinColor fore_color;
|
||||
XinColor back_color;
|
||||
XinColor fore_color_in_use;
|
||||
XinColor back_color_in_use;
|
||||
BOOLEAN multi_line; /* selection of multi or single line editing */
|
||||
BOOLEAN right_justify; /* selection of right or left justified text */
|
||||
BOOLEAN password;
|
||||
BOOLEAN read_only;
|
||||
BOOLEAN cr_ok;
|
||||
|
||||
#endif /* TXT_INCLUDED */
|
||||
/* multiline edit control info */
|
||||
int nbr_lines;
|
||||
XI_TEXT_LINE_BREAK *line_breaks;
|
||||
int max_lines_to_draw;
|
||||
BOOLEAN scrollbar;
|
||||
XinWindow sb_win;
|
||||
int sb_width;
|
||||
int cid; /* used for scrollbar, same as parent's. */
|
||||
BOOLEAN scrollbar_always_visible; /* true for fields, false for cells. */
|
||||
XI_OBJ* itf;
|
||||
BOOLEAN visible;
|
||||
|
||||
/* editing state */
|
||||
BOOLEAN editing;
|
||||
int selection_start_ip;
|
||||
int ip1;
|
||||
int ip2;
|
||||
BOOLEAN selecting;
|
||||
BOOLEAN double_selecting;
|
||||
int double_selecting_start_ip;
|
||||
BOOLEAN timer_set;
|
||||
long timer_id;
|
||||
BOOLEAN initialized;
|
||||
|
||||
/* multiline editing state */
|
||||
int delta_y; /* number of lines scrolled vertically */
|
||||
|
||||
/* singleline editing state */
|
||||
int delta_x; /* number of characters scrolled horizontally */
|
||||
} XI_TEXT;
|
||||
|
||||
#define xi_text_nbr_lines_get( text ) text->nbr_lines
|
||||
#define xi_text_line_break_get( text, cnt ) ( text->line_breaks[ cnt ].line_break )
|
||||
#define xi_text_font_height_get( text ) text->font_height
|
||||
#define xi_text_clip_set( text, rctp ) ( text->clip_rect = *(rctp))
|
||||
#define xi_text_max_lines_to_draw_set( text, max_lines_to_draw_arg ) ( text->max_lines_to_draw = max_lines_to_draw_arg )
|
||||
#define xi_text_color_fore_set( text, color ) ( text->fore_color = color )
|
||||
#define xi_text_color_back_set( text, color ) ( text->back_color = color )
|
||||
#define xi_text_get( text ) text->string
|
||||
#define xi_text_parent_obj_set( text, obj ) ( text->parent_obj = obj )
|
||||
#define xi_text_scrollbar_set( text, has_scroll_bar ) ( text->scrollbar = has_scroll_bar )
|
||||
#define xi_text_password_set( text, is_pw ) ( text->password = is_pw )
|
||||
#define xi_text_read_only_set( text, flag ) ( text->read_only = flag )
|
||||
#define xi_text_editing_is( text ) text->editing
|
||||
#define xi_text_buffer_set( text, buffer ) ( text->string = buffer )
|
||||
#define xi_text_cr_ok_set( text, is_ok ) ( text->cr_ok = is_ok )
|
||||
#define xi_text_initialized_set( text, set ) ( text->initialized = set )
|
||||
#define xi_text_buffer_size_get( text ) ( text->buffer_size )
|
||||
#define xi_text_min_buffer_size_set( text, set ) ( text->min_buffer_size = set )
|
||||
#define xi_text_var_len_text_set( text, set ) ( text->var_len_text = set )
|
||||
#define xi_text_font_get( text ) text->font
|
||||
|
||||
void xi_text_set( XI_TEXT * text, char *string );
|
||||
void xi_text_wrap( XI_TEXT * text );
|
||||
void xi_text_pix_width_set( XI_TEXT * text, int pix_width );
|
||||
void xi_text_pix_width_and_text_set( XI_TEXT * text, char *string, int pix_width, BOOLEAN set_font );
|
||||
|
||||
void xi_text_destruct( XI_TEXT * text );
|
||||
XI_TEXT *xi_text_construct( XinWindow win, int pix_width, XinFont * font, void *parent,
|
||||
BOOLEAN multi_line, int cid, BOOLEAN scrollbar_always_visible );
|
||||
void xi_text_draw( XI_TEXT * text, XinColor color, XinColor back_color, BOOLEAN update );
|
||||
void xi_text_selection_set( XI_TEXT * text, int ip1, int ip2 );
|
||||
void xi_text_selection_get( XI_TEXT * text, int *ip1, int *ip2 );
|
||||
void xi_text_selection_get_internal( XI_TEXT * text, int *ip1, int *ip2, int *start_ip );
|
||||
void xi_text_selection_set_internal( XI_TEXT * text, int ip1, int ip2,
|
||||
int selection_start_ip, BOOLEAN do_carets, BOOLEAN map_font );
|
||||
void xi_text_editing_start( XI_TEXT * text );
|
||||
void xi_text_editing_stop( XI_TEXT * text );
|
||||
BOOLEAN xi_text_event( XI_TEXT * text, XinEvent * ep, BOOLEAN gaining_focus, BOOLEAN *changed );
|
||||
void xi_text_prect_set( XI_TEXT * text, XinRect * rectp );
|
||||
XI_TEXT *xi_text_focus_get( XinWindow win );
|
||||
void xi_text_buffer_size_set( XI_TEXT* text, int size );
|
||||
void xi_text_font_set( XI_TEXT* text, XinFont* font );
|
||||
void xi_text_visible_set( XI_TEXT* text, BOOLEAN visible );
|
||||
XinRect* xi_text_rect_get_adjusted( XI_TEXT * text, XinRect * rcta );
|
||||
void xi_text_paste_internal( XI_TEXT * text, char *string );
|
||||
void xi_text_right_justify_set( XI_TEXT* text, BOOLEAN flag );
|
||||
void xi_text_reinitialize( XI_TEXT* text );
|
||||
|
495
xi/xitree.c
495
xi/xitree.c
@ -1,5 +1,6 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
@ -15,24 +16,20 @@
|
||||
#include "xiheap.h"
|
||||
#include "xiutils.h"
|
||||
|
||||
#ifndef R2
|
||||
#define fatal xvt_dm_post_fatal_exit
|
||||
#endif
|
||||
|
||||
#define PADCHAR ((char)0x8e)
|
||||
#define MAGIC 0xe8
|
||||
|
||||
/*
|
||||
constants to define for more debugging
|
||||
|
||||
|
||||
PAD - pad allocations with N bytes of magic and check magic number when
|
||||
xi_tree_check_sanity is called
|
||||
FENCE - call xi_tree_check_sanity on every Nth xi_tree_* call
|
||||
PREPAD - put an extra N bytes between the node struct and the data.
|
||||
This padding is never checked.
|
||||
|
||||
|
||||
sample usage:
|
||||
|
||||
|
||||
#define PAD 20
|
||||
#define FENCE 10
|
||||
#define PREPAD 10
|
||||
@ -47,13 +44,10 @@ typedef struct _tree_node
|
||||
struct _tree_node *parent;
|
||||
struct _tree_node *sibling;
|
||||
struct _tree_node *child;
|
||||
#if XIWS == MTFWS
|
||||
struct _tree_node *dummy;
|
||||
#endif
|
||||
#ifdef TREEDEBUG
|
||||
int line;
|
||||
char *file;
|
||||
int magic; /* for sanity checks */
|
||||
int magic; /* for sanity checks */
|
||||
int size;
|
||||
#ifdef PREPAD
|
||||
char prepad[PREPAD];
|
||||
@ -61,6 +55,16 @@ typedef struct _tree_node
|
||||
#endif
|
||||
} TREE_NODE;
|
||||
|
||||
/* This code automatically determines the proper size for TREE_NODE so that
|
||||
the data following it is always correctly aligned. */
|
||||
static struct
|
||||
{
|
||||
TREE_NODE node;
|
||||
double data;
|
||||
} dummy_header;
|
||||
|
||||
#define SIZEOF_TREE_NODE ((int)( (char*)&dummy_header.data - (char*)&dummy_header.node ))
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
#undef xi_tree_malloc
|
||||
#undef xi_tree_realloc
|
||||
@ -75,421 +79,428 @@ typedef struct _tree_node
|
||||
#define xi_tree_realloc_stub xi_tree_realloc_d
|
||||
#endif
|
||||
|
||||
#define VOIDPTR_TO_TREEPTR(p) ((TREE_NODE *)((char *)(p) - sizeof(TREE_NODE)))
|
||||
#define TREEPTR_TO_VOIDPTR(t) ((void *)((t) + 1))
|
||||
#define VOIDPTR_TO_TREEPTR(p) ((TREE_NODE *)((long)(p) - SIZEOF_TREE_NODE))
|
||||
#define TREEPTR_TO_VOIDPTR(t) ((void *)((long)(t) + SIZEOF_TREE_NODE))
|
||||
|
||||
#define DBGTAB 3
|
||||
|
||||
static TREE_NODE topnode =
|
||||
{
|
||||
{
|
||||
NULL, &topnode, NULL
|
||||
#if XIWS == MTFWS
|
||||
, NULL
|
||||
#endif
|
||||
#ifdef TREEDEBUG
|
||||
, 0, "TOPNODE", MAGIC, 0
|
||||
,0, "TOPNODE", MAGIC, 0
|
||||
#endif
|
||||
};
|
||||
static TREE_NODE *top = &topnode;
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
#ifdef FENCE
|
||||
static int fence_count;
|
||||
|
||||
#endif
|
||||
static int node_count = 1; /* start with just top node */
|
||||
static int node_count = 1; /* start with just top node */
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
dflt_error_fcn(void)
|
||||
dflt_error_fcn( void )
|
||||
{
|
||||
xvt_dm_post_fatal_exit( "xi_tree_memory: Out of memory" );
|
||||
NOREF( dummy_header.data );
|
||||
XinError( 20201, XinSeverityFatal, 0L );
|
||||
}
|
||||
|
||||
static void (* error_fcn)(void) = dflt_error_fcn;
|
||||
static void ( *error_fcn ) ( void ) = dflt_error_fcn;
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
void xi_tree_check_fence(void);
|
||||
void xi_tree_check_fence( void );
|
||||
void
|
||||
xi_tree_check_fence(void)
|
||||
xi_tree_check_fence( void )
|
||||
{
|
||||
#ifdef FENCE
|
||||
static int fence_count;
|
||||
|
||||
fence_count++;
|
||||
if (fence_count % FENCE == 0)
|
||||
xi_tree_check_sanity("FENCE CHECK");
|
||||
if ( fence_count % FENCE == 0 )
|
||||
xi_tree_check_sanity( "FENCE CHECK" );
|
||||
#endif
|
||||
}
|
||||
|
||||
static void near
|
||||
adjust_size(size_t *size)
|
||||
static void
|
||||
adjust_size( size_t * size )
|
||||
{
|
||||
NOREF(size);
|
||||
NOREF( size );
|
||||
#ifdef PAD
|
||||
*size += PAD;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void near
|
||||
validate_node(void *p)
|
||||
static void
|
||||
validate_node( void *p )
|
||||
{
|
||||
if (p != NULL && VOIDPTR_TO_TREEPTR(p)->magic != MAGIC)
|
||||
fatal( "Bad tree node detected: file %s, line %d",
|
||||
VOIDPTR_TO_TREEPTR(p)->file, VOIDPTR_TO_TREEPTR(p)->line );
|
||||
if ( p != NULL && VOIDPTR_TO_TREEPTR( p )->magic != MAGIC )
|
||||
XinDialogFatal( "Bad tree node detected: file %s, line %d",
|
||||
VOIDPTR_TO_TREEPTR( p )->file, VOIDPTR_TO_TREEPTR( p )->line );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void near
|
||||
remove_from_siblings_and_parent(TREE_NODE *remove_t)
|
||||
static void
|
||||
remove_from_siblings_and_parent( TREE_NODE * remove_t )
|
||||
{
|
||||
TREE_NODE *tp;
|
||||
|
||||
/* remove from sibling list */
|
||||
/* remove from sibling list */
|
||||
tp = remove_t;
|
||||
while (tp->sibling != remove_t)
|
||||
tp = tp->sibling;
|
||||
tp->sibling = remove_t->sibling;
|
||||
while ( tp->sibling != remove_t )
|
||||
tp = tp->sibling;
|
||||
tp->sibling = remove_t->sibling;
|
||||
|
||||
/* adjust parent pointers */
|
||||
if (remove_t->parent->child == remove_t)
|
||||
{
|
||||
remove_t->parent->child = ((remove_t->sibling == remove_t) ?
|
||||
NULL : remove_t->sibling);
|
||||
/* adjust parent pointers */
|
||||
if ( remove_t->parent->child == remove_t )
|
||||
{
|
||||
remove_t->parent->child = ( ( remove_t->sibling == remove_t ) ?
|
||||
NULL : remove_t->sibling );
|
||||
}
|
||||
}
|
||||
|
||||
static void near
|
||||
xi_tree_free_internal(TREE_NODE *remove_t, BOOLEAN toplevel)
|
||||
static void
|
||||
xi_tree_free_internal( TREE_NODE * remove_t, BOOLEAN toplevel )
|
||||
{
|
||||
TREE_NODE *tp;
|
||||
TREE_NODE *nexttp;
|
||||
TREE_NODE *nexttp;
|
||||
|
||||
if (toplevel)
|
||||
{
|
||||
remove_from_siblings_and_parent(remove_t);
|
||||
remove_t->sibling = NULL;
|
||||
if ( toplevel )
|
||||
{
|
||||
remove_from_siblings_and_parent( remove_t );
|
||||
remove_t->sibling = NULL;
|
||||
}
|
||||
|
||||
/* free all child nodes */
|
||||
tp = remove_t->child;
|
||||
if (tp != NULL)
|
||||
if ( tp != NULL )
|
||||
do
|
||||
{
|
||||
/* store next pointer before nuking node */
|
||||
nexttp = tp->sibling;
|
||||
xi_tree_free_internal(tp, FALSE);
|
||||
{
|
||||
/* store next pointer before nuking node */
|
||||
nexttp = tp->sibling;
|
||||
xi_tree_free_internal( tp, FALSE );
|
||||
tp = nexttp;
|
||||
} while (tp != remove_t->child);
|
||||
} while ( tp != remove_t->child );
|
||||
|
||||
/* free underlying heap manager memory */
|
||||
/* free underlying heap manager memory */
|
||||
#ifdef TREEDEBUG
|
||||
heap_free(remove_t->file);
|
||||
node_count--;
|
||||
heap_free( remove_t->file );
|
||||
node_count--;
|
||||
#endif
|
||||
heap_free(remove_t);
|
||||
heap_free( remove_t );
|
||||
}
|
||||
|
||||
void
|
||||
xi_tree_reparent(void *p, void *parent)
|
||||
xi_tree_reparent( void *p, void *parent )
|
||||
{
|
||||
TREE_NODE *tn;
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
xi_tree_check_fence();
|
||||
validate_node(p);
|
||||
xi_tree_check_fence( );
|
||||
validate_node( p );
|
||||
#endif
|
||||
remove_from_siblings_and_parent(VOIDPTR_TO_TREEPTR(p));
|
||||
tn = VOIDPTR_TO_TREEPTR(p);
|
||||
if (parent == NULL)
|
||||
parent = TREEPTR_TO_VOIDPTR(top);
|
||||
tn->parent = VOIDPTR_TO_TREEPTR(parent);
|
||||
if (tn->parent->child == NULL)
|
||||
{
|
||||
remove_from_siblings_and_parent( VOIDPTR_TO_TREEPTR( p ) );
|
||||
tn = VOIDPTR_TO_TREEPTR( p );
|
||||
if ( parent == NULL )
|
||||
parent = TREEPTR_TO_VOIDPTR( top );
|
||||
tn->parent = VOIDPTR_TO_TREEPTR( parent );
|
||||
if ( tn->parent->child == NULL )
|
||||
{
|
||||
tn->parent->child = tn;
|
||||
tn->sibling = tn;
|
||||
tn->sibling = tn;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* insert tn in the sibling list */
|
||||
tn->sibling = tn->parent->child->sibling;
|
||||
tn->parent->child->sibling = tn;
|
||||
tn->parent->child->sibling = tn;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xi_tree_free(void *p)
|
||||
xi_tree_free( void *p )
|
||||
{
|
||||
#ifdef TREEDEBUG
|
||||
xi_tree_check_fence();
|
||||
validate_node(p);
|
||||
xi_tree_check_fence( );
|
||||
validate_node( p );
|
||||
#endif
|
||||
xi_tree_free_internal(VOIDPTR_TO_TREEPTR(p), TRUE);
|
||||
xi_tree_free_internal( VOIDPTR_TO_TREEPTR( p ), TRUE );
|
||||
}
|
||||
|
||||
void *
|
||||
xi_tree_get_parent(void *p)
|
||||
xi_tree_get_parent( void *p )
|
||||
{
|
||||
TREE_NODE *parent;
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
validate_node(p);
|
||||
validate_node( p );
|
||||
#endif
|
||||
parent = VOIDPTR_TO_TREEPTR(p)->parent;
|
||||
return((parent == top) ? NULL : TREEPTR_TO_VOIDPTR(parent));
|
||||
parent = VOIDPTR_TO_TREEPTR( p )->parent;
|
||||
return ( ( parent == top ) ? NULL : TREEPTR_TO_VOIDPTR( parent ) );
|
||||
}
|
||||
|
||||
void *
|
||||
xi_tree_malloc_body(size_t size, void *parent
|
||||
xi_tree_malloc_body( size_t size, void *parent
|
||||
#ifdef TREEDEBUG
|
||||
, int line, char *file
|
||||
,int line, char *file
|
||||
#endif
|
||||
)
|
||||
{
|
||||
TREE_NODE *tn;
|
||||
#ifdef TREEDEBUG
|
||||
size_t orig_size = size;
|
||||
|
||||
xi_tree_check_fence();
|
||||
validate_node(parent);
|
||||
adjust_size(&size);
|
||||
#ifdef TREEDEBUG
|
||||
size_t orig_size = size;
|
||||
|
||||
xi_tree_check_fence( );
|
||||
validate_node( parent );
|
||||
adjust_size( &size );
|
||||
#endif
|
||||
tn = (TREE_NODE *)heap_malloc(size + sizeof(TREE_NODE));
|
||||
if (! tn)
|
||||
{
|
||||
(* error_fcn)();
|
||||
return NULL;
|
||||
tn = ( TREE_NODE * ) heap_malloc( size + SIZEOF_TREE_NODE );
|
||||
if ( !tn )
|
||||
{
|
||||
( *error_fcn ) ( );
|
||||
return NULL;
|
||||
}
|
||||
#ifdef TREEDEBUG
|
||||
gmemset((char *)tn + sizeof(TREE_NODE) + orig_size,
|
||||
PADCHAR, (long)(size - orig_size));
|
||||
tn->file = (char *)heap_malloc(gstrlen(file) + 1);
|
||||
if (! tn->file)
|
||||
{
|
||||
(* error_fcn)();
|
||||
return NULL;
|
||||
memset( ( char * ) tn + SIZEOF_TREE_NODE + orig_size,
|
||||
PADCHAR, ( long ) ( size - orig_size ) );
|
||||
tn->file = ( char * ) heap_malloc( strlen( file ) + 1 );
|
||||
if ( !tn->file )
|
||||
{
|
||||
( *error_fcn ) ( );
|
||||
return NULL;
|
||||
}
|
||||
gstrcpy(tn->file, file);
|
||||
tn->line = line;
|
||||
tn->magic = MAGIC;
|
||||
tn->size = size;
|
||||
node_count++;
|
||||
strcpy( tn->file, file );
|
||||
tn->line = line;
|
||||
tn->magic = MAGIC;
|
||||
tn->size = size;
|
||||
node_count++;
|
||||
#endif
|
||||
tn->child = NULL;
|
||||
tn->sibling = tn;
|
||||
if (parent == NULL)
|
||||
parent = TREEPTR_TO_VOIDPTR(top);
|
||||
tn->parent = VOIDPTR_TO_TREEPTR(parent);
|
||||
if (tn->parent->child == NULL)
|
||||
tn->parent->child = tn;
|
||||
else
|
||||
tn->child = NULL;
|
||||
tn->sibling = tn;
|
||||
if ( parent == NULL )
|
||||
parent = TREEPTR_TO_VOIDPTR( top );
|
||||
tn->parent = VOIDPTR_TO_TREEPTR( parent );
|
||||
if ( tn->parent->child == NULL )
|
||||
tn->parent->child = tn;
|
||||
else
|
||||
{
|
||||
/* insert tn in the sibling list */
|
||||
tn->sibling = tn->parent->child->sibling;
|
||||
tn->parent->child->sibling = tn;
|
||||
tn->parent->child->sibling = tn;
|
||||
}
|
||||
return(TREEPTR_TO_VOIDPTR(tn));
|
||||
return ( TREEPTR_TO_VOIDPTR( tn ) );
|
||||
}
|
||||
|
||||
void *
|
||||
xi_tree_realloc_body(void *p, size_t size
|
||||
xi_tree_realloc_body( void *p, size_t size
|
||||
#ifdef TREEDEBUG
|
||||
, int line, char *file
|
||||
,int line, char *file
|
||||
#endif
|
||||
)
|
||||
{
|
||||
TREE_NODE *old_t;
|
||||
TREE_NODE *new_t;
|
||||
TREE_NODE *tp;
|
||||
#ifdef TREEDEBUG
|
||||
size_t orig_size = size;
|
||||
TREE_NODE *new_t;
|
||||
TREE_NODE *tp;
|
||||
|
||||
xi_tree_check_fence();
|
||||
adjust_size(&size);
|
||||
#endif
|
||||
old_t = VOIDPTR_TO_TREEPTR(p);
|
||||
#ifdef TREEDEBUG
|
||||
validate_node(p);
|
||||
size_t orig_size = size;
|
||||
|
||||
xi_tree_check_fence( );
|
||||
adjust_size( &size );
|
||||
#endif
|
||||
new_t = (TREE_NODE *)heap_realloc(old_t, (size + sizeof(TREE_NODE)));
|
||||
old_t = VOIDPTR_TO_TREEPTR( p );
|
||||
#ifdef TREEDEBUG
|
||||
if (! new_t)
|
||||
{
|
||||
(* error_fcn)();
|
||||
return NULL;
|
||||
validate_node( p );
|
||||
#endif
|
||||
new_t = ( TREE_NODE * ) heap_realloc( old_t, ( size + SIZEOF_TREE_NODE ) );
|
||||
#ifdef TREEDEBUG
|
||||
if ( !new_t )
|
||||
{
|
||||
( *error_fcn ) ( );
|
||||
return NULL;
|
||||
}
|
||||
gmemset((char *)new_t + sizeof(TREE_NODE) + orig_size,
|
||||
PADCHAR, (long)(size - orig_size));
|
||||
new_t->line = line;
|
||||
new_t->size = size;
|
||||
heap_free(new_t->file);
|
||||
new_t->file = (char *)heap_malloc(gstrlen(file) + 1);
|
||||
if (! new_t->file)
|
||||
{
|
||||
(* error_fcn)();
|
||||
return NULL;
|
||||
memset( ( char * ) new_t + SIZEOF_TREE_NODE + orig_size,
|
||||
PADCHAR, ( long ) ( size - orig_size ) );
|
||||
new_t->line = line;
|
||||
new_t->size = size;
|
||||
heap_free( new_t->file );
|
||||
new_t->file = ( char * ) heap_malloc( strlen( file ) + 1 );
|
||||
if ( !new_t->file )
|
||||
{
|
||||
( *error_fcn ) ( );
|
||||
return NULL;
|
||||
}
|
||||
gstrcpy(new_t->file, file);
|
||||
strcpy( new_t->file, file );
|
||||
#endif
|
||||
|
||||
if (new_t != old_t)
|
||||
{
|
||||
if ( new_t != old_t )
|
||||
{
|
||||
/* change parent pointer */
|
||||
if (new_t->parent->child == old_t)
|
||||
new_t->parent->child = new_t;
|
||||
if ( new_t->parent->child == old_t )
|
||||
new_t->parent->child = new_t;
|
||||
|
||||
/* change sibling pointers */
|
||||
for (tp = new_t; tp->sibling != old_t; tp = tp->sibling)
|
||||
;
|
||||
tp->sibling = new_t;
|
||||
|
||||
/* change children pointers */
|
||||
tp = new_t->child;
|
||||
if (tp != NULL)
|
||||
do
|
||||
{
|
||||
tp->parent = new_t;
|
||||
tp = tp->sibling;
|
||||
} while (tp != new_t->child);
|
||||
}
|
||||
return(TREEPTR_TO_VOIDPTR(new_t))
|
||||
/* change sibling pointers */
|
||||
for ( tp = new_t; tp->sibling != old_t; tp = tp->sibling )
|
||||
;
|
||||
tp->sibling = new_t;
|
||||
|
||||
/* change children pointers */
|
||||
tp = new_t->child;
|
||||
if ( tp != NULL )
|
||||
do
|
||||
{
|
||||
tp->parent = new_t;
|
||||
tp = tp->sibling;
|
||||
} while ( tp != new_t->child );
|
||||
}
|
||||
return ( TREEPTR_TO_VOIDPTR( new_t ) )
|
||||
;
|
||||
}
|
||||
|
||||
static void near
|
||||
xi_tree_dbg_internal(TREE_NODE *tn, int level)
|
||||
static void
|
||||
xi_tree_dbg_internal( TREE_NODE * tn, int level )
|
||||
{
|
||||
char buf[150];
|
||||
char *s;
|
||||
TREE_NODE *tn2;
|
||||
int i, l;
|
||||
char *s;
|
||||
TREE_NODE *tn2;
|
||||
int i,
|
||||
l;
|
||||
|
||||
if (tn == NULL)
|
||||
return;
|
||||
/* print tab indent indicating level */
|
||||
if ( tn == NULL )
|
||||
return;
|
||||
/* print tab indent indicating level */
|
||||
s = buf;
|
||||
for (l = level; l; l--)
|
||||
{
|
||||
for (i=0; i<DBGTAB; i++)
|
||||
*s++ = ' ';
|
||||
for ( l = level; l; l-- )
|
||||
{
|
||||
for ( i = 0; i < DBGTAB; i++ )
|
||||
*s++ = ' ';
|
||||
}
|
||||
#ifdef TREEDEBUG
|
||||
sprintf( s, "node %08lx: par=%08lx, sib=%08lx, ch=%08lx, file=%s, line=%d",
|
||||
PTR_LONG(tn), PTR_LONG(tn->parent), PTR_LONG(tn->sibling),
|
||||
PTR_LONG(tn->child), tn->file, tn->line );
|
||||
( long ) ( tn ), ( long ) ( tn->parent ), ( long ) ( tn->sibling ),
|
||||
( long ) ( tn->child ), tn->file, tn->line );
|
||||
#else
|
||||
sprintf( s, "node %08lx: par=%08lx, sib=%08lx, ch=%08lx",
|
||||
PTR_LONG(tn), PTR_LONG(tn->parent), PTR_LONG(tn->sibling),
|
||||
PTR_LONG(tn->child) );
|
||||
( long ) tn, ( long ) ( tn->parent ), ( long ) ( tn->sibling ),
|
||||
( long ) ( tn->child ) );
|
||||
#endif
|
||||
xi_dbg(buf);
|
||||
tn2 = tn->child;
|
||||
if (tn2 != NULL)
|
||||
do
|
||||
{
|
||||
xi_tree_dbg_internal(tn2, level + 1);
|
||||
tn2 = tn2->sibling;
|
||||
} while (tn2 != tn->child);
|
||||
xi_dbg( buf );
|
||||
tn2 = tn->child;
|
||||
if ( tn2 != NULL )
|
||||
do
|
||||
{
|
||||
xi_tree_dbg_internal( tn2, level + 1 );
|
||||
tn2 = tn2->sibling;
|
||||
} while ( tn2 != tn->child );
|
||||
}
|
||||
|
||||
void
|
||||
xi_tree_dbg(char *title)
|
||||
xi_tree_dbg( char *title )
|
||||
{
|
||||
char buf[100];
|
||||
|
||||
sprintf(buf, "TREE MEMORY DEBUG TRACE (%s)", title);
|
||||
xi_dbg(buf);
|
||||
xi_dbg("=======================");
|
||||
xi_tree_dbg_internal(top, 0);
|
||||
heap_dbg(title);
|
||||
xi_tree_check_sanity(title);
|
||||
sprintf( buf, "TREE MEMORY DEBUG TRACE (%s)", title );
|
||||
xi_dbg( buf );
|
||||
xi_dbg( "=======================" );
|
||||
xi_tree_dbg_internal( top, 0 );
|
||||
heap_dbg( title );
|
||||
xi_tree_check_sanity( title );
|
||||
}
|
||||
|
||||
static void near
|
||||
xi_tree_check_sanity_internal(TREE_NODE *tn, char *title,
|
||||
int *count)
|
||||
static void
|
||||
xi_tree_check_sanity_internal( TREE_NODE * tn, char *title,
|
||||
int *count )
|
||||
{
|
||||
TREE_NODE *tn2;
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
#ifdef PAD
|
||||
int i;
|
||||
int i;
|
||||
|
||||
/* check pad bytes for node */
|
||||
if (tn != &topnode)
|
||||
for (i = tn->size - PAD; i < tn->size; i++)
|
||||
if (*((char *)tn + sizeof(TREE_NODE) + i) != PADCHAR)
|
||||
fatal( "xi_tree_node padding corrupted: node=%08lx, file=%s, line=%d",
|
||||
PTR_LONG(tn), tn->file, tn->line );
|
||||
/* check pad bytes for node */
|
||||
if ( tn != &topnode )
|
||||
for ( i = tn->size - PAD; i < tn->size; i++ )
|
||||
if ( *( ( char * ) tn + SIZEOF_TREE_NODE + i ) != PADCHAR )
|
||||
XinDialogFatal( "xi_tree_node padding corrupted: node=%08lx, file=%s, line=%d",
|
||||
( long ) ( tn ), tn->file, tn->line );
|
||||
#endif
|
||||
#endif
|
||||
/* check that all children point to this node */
|
||||
/* check that all children point to this node */
|
||||
tn2 = tn->child;
|
||||
(*count)++;
|
||||
if (tn2 != NULL)
|
||||
( *count )++;
|
||||
if ( tn2 != NULL )
|
||||
do
|
||||
{
|
||||
if (tn2->parent != tn)
|
||||
fatal( "memory check %s: tree node %08lx has bad parent",
|
||||
title, PTR_LONG(tn2) );
|
||||
xi_tree_check_sanity_internal(tn2, title, count);
|
||||
tn2 = tn2->sibling;
|
||||
} while (tn2 != tn->child);
|
||||
{
|
||||
if ( tn2->parent != tn )
|
||||
XinDialogFatal( "memory check %s: tree node %08lx has bad parent",
|
||||
title, ( long ) ( tn2 ) );
|
||||
xi_tree_check_sanity_internal( tn2, title, count );
|
||||
tn2 = tn2->sibling;
|
||||
} while ( tn2 != tn->child );
|
||||
}
|
||||
|
||||
void
|
||||
xi_tree_check_sanity(char *title)
|
||||
xi_tree_check_sanity( char *title )
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
xi_tree_check_sanity_internal(top, title, &count);
|
||||
xi_tree_check_sanity_internal( top, title, &count );
|
||||
#ifdef TREEDEBUG
|
||||
if (count != node_count)
|
||||
fatal("tree sanity check failed: tree count=%d, allocation count=%d",
|
||||
count, node_count);
|
||||
if ( count != node_count )
|
||||
XinDialogFatal( "tree sanity check failed: tree count=%d, allocation count=%d",
|
||||
count, node_count );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TREEDEBUG
|
||||
void *xi_tree_malloc_stub(size_t size, void *parent);
|
||||
void *xi_tree_malloc_stub( size_t size, void *parent );
|
||||
void *
|
||||
xi_tree_malloc_stub(size_t size, void *parent)
|
||||
xi_tree_malloc_stub( size_t size, void *parent )
|
||||
{
|
||||
return(xi_tree_malloc_body(size, parent, 0, "(unknown)"));
|
||||
return ( xi_tree_malloc_body( size, parent, 0, "(unknown)" ) );
|
||||
}
|
||||
|
||||
void *xi_tree_realloc_stub(void *p, size_t size);
|
||||
void *xi_tree_realloc_stub( void *p, size_t size );
|
||||
void *
|
||||
xi_tree_realloc_stub(void *p, size_t size)
|
||||
xi_tree_realloc_stub( void *p, size_t size )
|
||||
{
|
||||
return(xi_tree_realloc_body(p, size, 0, "(unknown)"));
|
||||
return ( xi_tree_realloc_body( p, size, 0, "(unknown)" ) );
|
||||
}
|
||||
|
||||
#else
|
||||
void *xi_tree_malloc_stub(size_t size, void *parent,
|
||||
int line, char *file);
|
||||
void *
|
||||
xi_tree_malloc_stub(size_t size, void *parent,
|
||||
int line, char *file)
|
||||
xi_tree_malloc_stub( size_t size, void *parent,
|
||||
int line, char *file );
|
||||
void *
|
||||
xi_tree_malloc_stub( size_t size, void *parent,
|
||||
int line, char *file )
|
||||
{
|
||||
NOREF(line);
|
||||
NOREF(file);
|
||||
return(xi_tree_malloc_body(size, parent));
|
||||
NOREF( line );
|
||||
NOREF( file );
|
||||
return ( xi_tree_malloc_body( size, parent ) );
|
||||
}
|
||||
|
||||
void *xi_tree_realloc_stub(void *p, size_t size,
|
||||
int line, char *file);
|
||||
void *
|
||||
xi_tree_realloc_stub(void *p, size_t size,
|
||||
int line, char *file)
|
||||
xi_tree_realloc_stub( void *p, size_t size,
|
||||
int line, char *file );
|
||||
void *
|
||||
xi_tree_realloc_stub( void *p, size_t size,
|
||||
int line, char *file )
|
||||
{
|
||||
NOREF(line);
|
||||
NOREF(file);
|
||||
return(xi_tree_realloc_body(p, size));
|
||||
NOREF( line );
|
||||
NOREF( file );
|
||||
return ( xi_tree_realloc_body( p, size ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
xi_tree_reg_error_fcn(void (* fcn)(void))
|
||||
xi_tree_reg_error_fcn( void ( *fcn ) ( void ) )
|
||||
{
|
||||
error_fcn = fcn;
|
||||
}
|
||||
|
||||
|
||||
|
210
xi/xiutils.h
210
xi/xiutils.h
@ -1,115 +1,133 @@
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 1991-1995 by ORCA Software, Inc. *
|
||||
* Copyright 1991-1996 by ORCA Software, Inc. *
|
||||
* *
|
||||
* All rights reserved. May not be reproduced or distributed, in printed or *
|
||||
* electronic form, without permission of ORCA Software, Inc. *
|
||||
* electronic form, without permission of ORCA Software, Inc. May not be *
|
||||
* distributed as object code, separately or linked with other object modules, *
|
||||
* without permission. *
|
||||
*******************************************************************************/
|
||||
|
||||
extern CBRUSH ltgray_cbrush;
|
||||
extern CBRUSH gray_cbrush;
|
||||
extern CBRUSH hollow_cbrush;
|
||||
extern FONT_OBJ xi_sysfont;
|
||||
extern RCT big_clip;
|
||||
extern XinBrush ltgray_cbrush;
|
||||
extern XinBrush gray_cbrush;
|
||||
extern XinBrush hollow_cbrush;
|
||||
extern XinFont *xi_sysfont;
|
||||
extern XinRect big_clip;
|
||||
|
||||
/* DIMENSIONS FOR FIELD OBJET BORDER */
|
||||
#define XI_FLD_XBORDER XI_FU_MULTIPLE /* may change for OL implementation */
|
||||
#define XI_FLD_XBORDER XI_FU_MULTIPLE /* may change for OL implementation */
|
||||
#define XI_MULTILINE_SCROLLBAR_CID 31000
|
||||
|
||||
/* UTILITY FUNCTIONS */
|
||||
#ifdef DEBUG
|
||||
void pr_xi_event(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
#endif
|
||||
XinRect *adjust_rect( XinRect * rct, int pwid );
|
||||
int clip( int val, int mn, int mx );
|
||||
void dbg_rct( char *tag, XinRect * rct );
|
||||
void order_ints( int *ip1, int *ip2 );
|
||||
|
||||
#if 0 /* this is platform-dependent */
|
||||
#define XI_COLUMN_XDIV XI_FU_MULTIPLE
|
||||
#define XI_LIST_XBORDER XI_FU_MULTIPLE
|
||||
#endif
|
||||
|
||||
RCT* adjust_rect(RCT *rct, int pwid);
|
||||
int clip(int val, int mn, int mx);
|
||||
void dbg_rct(char *tag, RCT *rct);
|
||||
void order_ints(int *ip1, int *ip2);
|
||||
char* gmemmove(char *d, char *s, long n);
|
||||
/*
|
||||
char* gstrncpy(char *dst, char *src, int n);
|
||||
char* tgstrncpy(char *dst, char *src, int n);
|
||||
*/
|
||||
|
||||
char *tstrncpy( char *dst, char *src, int n );
|
||||
void xi_adjust_sb_vir_itf( XinWindow win, XI_OBJ * itf );
|
||||
void xi_button_rect_calc( XI_OBJ * btn_obj, int sequence );
|
||||
void
|
||||
xi_container_rect_calc( XI_OBJ * cnt_obj, int max_text_len,
|
||||
XI_BTN_TYPE btn_type );
|
||||
XinFont *xi_def_get_font( XI_OBJ_DEF * obj_def );
|
||||
BOOLEAN xi_get_xil_pref( XI_OBJ * obj );
|
||||
void
|
||||
xi_draw_clipped_text( XinWindow win, XinFont * font, char *s,
|
||||
XinRect * bound_rct,
|
||||
XinRect * clip_rct, unsigned long attrib,
|
||||
BOOLEAN set_the_cpen, int rule_and_space,
|
||||
int len, char mnemonic, short mnemonic_instance, int *baseline );
|
||||
void xi_dbg( char *buf );
|
||||
void
|
||||
xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
|
||||
BOOLEAN enabled, BOOLEAN visible, BOOLEAN focus,
|
||||
BOOLEAN down, BOOLEAN dflt, BOOLEAN checked, BOOLEAN box_only,
|
||||
BOOLEAN draw_border );
|
||||
BOOLEAN xi_eh( XinWindow win, XinEvent * ep );
|
||||
void xi_even_fu( int *f );
|
||||
void xi_even_fu_pnt( XinPoint * p );
|
||||
XinRect *xi_inflate_rect( XinRect * rct, int amount );
|
||||
void xi_fu_to_pu_font( XinFont * font, XinPoint * pnt, int nbr_pnts );
|
||||
XinRect *xi_get_enclosing_rect( XinRect * dst, XinRect * src1, XinRect * src2 );
|
||||
void
|
||||
xi_get_font_metrics_font( XinFont * font, int *leading, int *ascent,
|
||||
int *descent, int *char_width );
|
||||
int xi_get_fu_height( XI_OBJ * itf );
|
||||
int xi_get_fu_height_font( XinFont * font );
|
||||
int xi_get_fu_width( XI_OBJ * itf );
|
||||
int xi_get_fu_width_font( XinFont * font );
|
||||
void xi_get_hsb_rect( XI_OBJ * xi_obj, XinRect * rctp );
|
||||
XI_OBJ *xi_get_itf_from_id( int id );
|
||||
XinRect *
|
||||
xi_get_rect_internal( XI_OBJ * xi_obj, XinRect * rctp, XinRect * old_win_rct,
|
||||
XinRect * new_win_rct );
|
||||
void xi_get_sb_rect( XI_OBJ * xi_obj, XinRect * rctp );
|
||||
void xi_move_to( XinWindow win, XinPoint pnt );
|
||||
void xi_draw_line( XinWindow win, XinPoint pnt );
|
||||
void xi_scroll_rect( XinWindow win, XinRect * rct, int delta_x, int delta_y );
|
||||
BOOLEAN xi_pt_in_rect( XinRect * rct, XinPoint pnt );
|
||||
BOOLEAN xi_half_baked( XinWindow win );
|
||||
void xi_init_sysvals( void );
|
||||
void xi_make_obj_visible( XI_OBJ * xi_obj );
|
||||
void xi_menu_enable( XI_OBJ * itf, int tag, BOOLEAN enable );
|
||||
void
|
||||
xi_move_column_internal( XI_OBJ * column, int position,
|
||||
BOOLEAN in_hscrolling );
|
||||
void xi_move_list_hscroll_bar( XI_OBJ * xi_obj );
|
||||
void xi_move_list_scroll_bar( XI_OBJ * xi_obj );
|
||||
int xi_obj_to_idx( XI_OBJ * xi_obj );
|
||||
void xi_realloc_array( void **ptr, int nbr, size_t sz, void *parent );
|
||||
void xi_set_sysval( XI_SV_TYPE valtype, int value );
|
||||
void xi_set_trap_obj( XI_OBJ * obj );
|
||||
void xi_set_update_obj( XI_OBJ * xi_obj );
|
||||
int xi_get_text_width( XinFont * font, char *s, int len, unsigned long attrib );
|
||||
char *xi_get_text_string( char *src, unsigned long attrib );
|
||||
BOOLEAN xi_cr_is_ok( XI_OBJ * xi_obj );
|
||||
BOOLEAN xi_focus_obj_is_cell_button( XI_OBJ * focus_obj );
|
||||
void xi_draw_foc_and_dflt( XI_OBJ * focus_obj );
|
||||
void xi_draw_foc_and_dflt_if_necessary( XI_OBJ * focus_obj, XI_OBJ * next_obj );
|
||||
BOOLEAN xi_get_native_controls( XI_OBJ * obj );
|
||||
BOOLEAN xi_XinWindowPaintNeeds( XinWindow win, XinRect * rct );
|
||||
|
||||
void xi_adjust_sb_vir_itf(WINDOW win, XI_OBJ *itf);
|
||||
void xi_button_rect_calc(XI_OBJ *btn_obj, int sequence);
|
||||
void xi_container_rect_calc( XI_OBJ *cnt_obj, int max_text_len,
|
||||
XI_BTN_TYPE btn_type);
|
||||
FONT_OBJ* xi_def_get_font( XI_OBJ_DEF* obj_def );
|
||||
BOOLEAN xi_get_xil_pref( XI_OBJ* obj );
|
||||
void xi_draw_clipped_text( WINDOW win, char *s, RCT *bound_rct,
|
||||
RCT *clip_rct, unsigned long attrib,
|
||||
BOOLEAN set_the_cpen, int rule_and_space,
|
||||
int len);
|
||||
void xi_dbg(char *buf);
|
||||
void xi_draw_button( XI_OBJ *xi_obj, RCT *rct, char *text,
|
||||
int down_icon_rid, int up_icon_rid,
|
||||
int disabled_icon_rid, BOOLEAN enabled,
|
||||
BOOLEAN visible, BOOLEAN focus, BOOLEAN down,
|
||||
BOOLEAN dflt, BOOLEAN checked, BOOLEAN box_only);
|
||||
BOOLEAN xi_eh(WINDOW win, EVENT *ep);
|
||||
void xi_even_fu(int *f);
|
||||
void xi_even_fu_pnt(PNT *p);
|
||||
RCT* xi_inflate_rect(RCT *rct, int amount);
|
||||
#if XIWS == WMWS
|
||||
void xi_coalesce_invalidates(XI_OBJ *itf, BOOLEAN coalesce);
|
||||
void xi_fix_color(COLOR *color);
|
||||
#endif
|
||||
void xi_fu_to_pu_font(FONT_OBJ *font, PNT *pnt, int nbr_pnts);
|
||||
RCT* xi_get_enclosing_rect(RCT *dst, RCT *src1, RCT *src2);
|
||||
void xi_get_font_metrics_font( FONT_OBJ *font, int *leading, int *ascent,
|
||||
int *descent, int *char_width);
|
||||
int xi_get_fu_height(XI_OBJ *itf);
|
||||
int xi_get_fu_height_font(FONT_OBJ *font);
|
||||
int xi_get_fu_width(XI_OBJ *itf);
|
||||
int xi_get_fu_width_font(FONT_OBJ *font);
|
||||
void xi_get_hsb_rect(XI_OBJ *xi_obj, RCT *rctp);
|
||||
XI_OBJ* xi_get_itf_from_id( int id );
|
||||
RCT* xi_get_rect_internal( XI_OBJ *xi_obj, RCT *rctp, RCT *old_win_rct,
|
||||
RCT *new_win_rct);
|
||||
void xi_get_sb_rect(XI_OBJ *xi_obj, RCT *rctp);
|
||||
BOOLEAN xi_half_baked(WINDOW win);
|
||||
void xi_init_sysvals(void);
|
||||
void xi_make_obj_visible(XI_OBJ *xi_obj);
|
||||
void xi_menu_enable(XI_OBJ *itf, int tag, BOOLEAN enable);
|
||||
void xi_move_column_internal( XI_OBJ *column, int position,
|
||||
BOOLEAN in_hscrolling);
|
||||
void xi_move_list_hscroll_bar(XI_OBJ *xi_obj);
|
||||
void xi_move_list_scroll_bar(XI_OBJ *xi_obj);
|
||||
WINDOW xi_new_control( RCT *lrctp, char *title, WIN_TYPE t, WINDOW parent,
|
||||
BOOLEAN visible, int id, char *templat);
|
||||
int xi_obj_to_idx(XI_OBJ *xi_obj);
|
||||
void xi_realloc_array( void **ptr, int nbr, size_t sz, void *parent);
|
||||
void xi_set_sysval(XI_SV_TYPE valtype, int value);
|
||||
void xi_set_trap_obj(XI_OBJ *obj);
|
||||
void xi_set_update_obj(XI_OBJ *xi_obj);
|
||||
void xi_terminate(void);
|
||||
#ifdef TREEDEBUG
|
||||
#define xi_tree_realloc2(o, s, p) xi_tree_realloc_d2(o, s, p, __LINE__, __FILE__)
|
||||
char* xi_tree_realloc_d2(char *oldp, size_t size, char *parent, int line,
|
||||
char *filename);
|
||||
char *
|
||||
xi_tree_realloc_d2( char *oldp, size_t size, char *parent, int line,
|
||||
char *filename );
|
||||
|
||||
#else
|
||||
char* xi_tree_realloc2(char *oldp, size_t size, char *parent);
|
||||
char *xi_tree_realloc2( char *oldp, size_t size, char *parent );
|
||||
|
||||
#endif
|
||||
XVT_FNTID* xi_font_to_fontid(XI_OBJ *itf, void *a_font, XVT_FNTID *font_id);
|
||||
FONT* xi_fontid_to_font(XVT_FNTID font_id, void *parent);
|
||||
FONT_OBJ xi_create_copy_font_id(XI_OBJ *itf, FONT_OBJ font_id, FONT_OBJ old_font_id);
|
||||
void xi_free_font_id(XI_OBJ *itf, FONT_OBJ font_id);
|
||||
BOOLEAN font_compare ( XVT_FNTID f1, XVT_FNTID f2 );
|
||||
void
|
||||
xi_draw_icon( XinWindow win, int x, int y, int rid, XinColor fore_color,
|
||||
XinColor back_color );
|
||||
void
|
||||
xi_draw_text( XinWindow win, XinFont * font, int x, int y, char *s,
|
||||
int len );
|
||||
BOOLEAN font_compare( XinFont * f1, XinFont * f2 );
|
||||
#ifdef XI_USE_TX_SUPPORT
|
||||
void xi_caret_off( XinWindow win );
|
||||
#endif
|
||||
void xi_caret_on( XinWindow win, int x, int y, int height, XinRect * clip_rect );
|
||||
void xi_set_clip( XinWindow win, XinRect * clip );
|
||||
void xi_draw_dotted_rect( XinWindow win, XinRect * rctp );
|
||||
|
||||
XI_OBJ* xi_get_drag_list_obj( void );
|
||||
void xi_set_drag_list_obj( XI_OBJ* obj );
|
||||
|
||||
BOOLEAN xi_is_obj( XI_OBJ* obj, XI_OBJ* itf );
|
||||
|
||||
/*********************************************************************/
|
||||
/* XI minimal compatability layer */
|
||||
|
||||
extern CPEN hollow_cpen;
|
||||
extern CPEN black_cpen;
|
||||
extern CPEN rubber_cpen;
|
||||
extern CBRUSH white_cbrush;
|
||||
extern CBRUSH hollow_cbrush;
|
||||
|
||||
#define E_KILL_WINDOW E_DESTROY
|
||||
#define E_ACTIVATE E_FOCUS
|
||||
|
||||
extern XinPen hollow_cpen;
|
||||
extern XinPen black_cpen;
|
||||
extern XinPen rubber_cpen;
|
||||
extern XinBrush white_cbrush;
|
||||
extern XinBrush hollow_cbrush;
|
||||
extern XinFont normal_font;
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user